diff --git a/Backend/package.json b/Backend/package.json index c438e40..2849491 100644 --- a/Backend/package.json +++ b/Backend/package.json @@ -2,8 +2,10 @@ "name": "backend", "version": "1.0.0", "main": "server.js", + "type": "module", "scripts": { - "start": "nodemon server.js" + "start": "node server.js", + "dev": "nodemon server.js" }, "keywords": [], "author": "", @@ -11,10 +13,17 @@ "description": "", "dependencies": { "bcrypt": "^6.0.0", + "cloudinary": "^2.7.0", "cookie-parser": "^1.4.7", + "cors": "^2.8.5", "dotenv": "^17.2.1", "express": "^5.1.0", + "fs": "^0.0.1-security", "jsonwebtoken": "^9.0.2", - "mongoose": "^8.16.5" + "mongoose": "^8.16.5", + "multer": "^2.0.2" + }, + "devDependencies": { + "nodemon": "^3.1.10" } } diff --git a/Backend/server.js b/Backend/server.js index 2bc2b39..1c341f4 100644 --- a/Backend/server.js +++ b/Backend/server.js @@ -1,8 +1,29 @@ -const http = require("http"); -const app = require("./app"); -const port = process.env.PORT; +import express from "express"; +import http from "http"; +import dotenv from "dotenv"; +import cookieParser from "cookie-parser"; +import cors from "cors"; +dotenv.config(); // Load .env file + +const app = express(); + +// Middlewares +app.use(cors()); +app.use(express.json()); +app.use(cookieParser()); + +// Simple test route +app.get("/", (req, res) => { + res.send("🚀 Backend is working fine!"); +}); + +// Port setup +const PORT = process.env.PORT || 5000; + +// Create HTTP server const server = http.createServer(app); -server.listen(port, () => { - console.log(`Server was running at ${port}`); + +server.listen(PORT, () => { + console.log(`✅ Server is running at http://localhost:${PORT}`); }); diff --git a/server/src/index.js b/Backend/src/index.js similarity index 100% rename from server/src/index.js rename to Backend/src/index.js diff --git a/server/src/middleware/multer.js b/Backend/src/middleware/multer.js similarity index 100% rename from server/src/middleware/multer.js rename to Backend/src/middleware/multer.js diff --git a/server/src/routes/upload.js b/Backend/src/routes/upload.js similarity index 100% rename from server/src/routes/upload.js rename to Backend/src/routes/upload.js diff --git a/server/src/utils/cloudinary.js b/Backend/src/utils/cloudinary.js similarity index 100% rename from server/src/utils/cloudinary.js rename to Backend/src/utils/cloudinary.js diff --git a/admin-dashboard.html b/frontend/admin-dashboard.html similarity index 100% rename from admin-dashboard.html rename to frontend/admin-dashboard.html diff --git a/frontend/login.png b/frontend/assets/img/login.png similarity index 100% rename from frontend/login.png rename to frontend/assets/img/login.png diff --git a/frontend/sign-up.png b/frontend/assets/img/sign-up.png similarity index 100% rename from frontend/sign-up.png rename to frontend/assets/img/sign-up.png diff --git a/index.html b/frontend/index.html similarity index 100% rename from index.html rename to frontend/index.html diff --git a/frontend/login.html b/frontend/login.html index 74a9f00..f44e36c 100644 --- a/frontend/login.html +++ b/frontend/login.html @@ -9,7 +9,7 @@
- Login Illustration + Login Illustration

Sign In

diff --git a/member-dashboard.html b/frontend/member-dashboard.html similarity index 100% rename from member-dashboard.html rename to frontend/member-dashboard.html diff --git a/script.js b/frontend/script.js similarity index 100% rename from script.js rename to frontend/script.js diff --git a/styles.css b/frontend/styles.css similarity index 100% rename from styles.css rename to frontend/styles.css diff --git a/frontend/team.css b/frontend/team/team.css similarity index 100% rename from frontend/team.css rename to frontend/team/team.css diff --git a/frontend/team.html b/frontend/team/team.html similarity index 100% rename from frontend/team.html rename to frontend/team/team.html diff --git a/frontend/team.js b/frontend/team/team.js similarity index 100% rename from frontend/team.js rename to frontend/team/team.js diff --git a/server/.env-example b/server/.env-example deleted file mode 100644 index a72f564..0000000 --- a/server/.env-example +++ /dev/null @@ -1,3 +0,0 @@ -CLOUDINARY_CLOUD_NAME="" -CLOUDINARY_API_KEY="" -CLOUDINARY_API_SECRET="" \ No newline at end of file diff --git a/server/.gitignore b/server/.gitignore deleted file mode 100644 index 13dfa36..0000000 --- a/server/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.env -node_modules/ \ No newline at end of file diff --git a/server/node_modules/.bin/mkdirp b/server/node_modules/.bin/mkdirp deleted file mode 100644 index 1ab9c81..0000000 --- a/server/node_modules/.bin/mkdirp +++ /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/../mkdirp/bin/cmd.js" "$@" -else - exec node "$basedir/../mkdirp/bin/cmd.js" "$@" -fi diff --git a/server/node_modules/.bin/mkdirp.cmd b/server/node_modules/.bin/mkdirp.cmd deleted file mode 100644 index a865dd9..0000000 --- a/server/node_modules/.bin/mkdirp.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%\..\mkdirp\bin\cmd.js" %* diff --git a/server/node_modules/.bin/mkdirp.ps1 b/server/node_modules/.bin/mkdirp.ps1 deleted file mode 100644 index 911e854..0000000 --- a/server/node_modules/.bin/mkdirp.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/../mkdirp/bin/cmd.js" $args - } else { - & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args - } else { - & "node$exe" "$basedir/../mkdirp/bin/cmd.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 b40fa67..0000000 --- a/server/node_modules/.package-lock.json +++ /dev/null @@ -1,1060 +0,0 @@ -{ - "name": "server", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "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==", - "license": "MIT", - "dependencies": { - "mime-types": "^3.0.0", - "negotiator": "^1.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/append-field": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", - "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", - "license": "MIT" - }, - "node_modules/body-parser": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz", - "integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==", - "license": "MIT", - "dependencies": { - "bytes": "^3.1.2", - "content-type": "^1.0.5", - "debug": "^4.4.0", - "http-errors": "^2.0.0", - "iconv-lite": "^0.6.3", - "on-finished": "^2.4.1", - "qs": "^6.14.0", - "raw-body": "^3.0.0", - "type-is": "^2.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "license": "MIT" - }, - "node_modules/busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "dependencies": { - "streamsearch": "^1.1.0" - }, - "engines": { - "node": ">=10.16.0" - } - }, - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "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/cloudinary": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/cloudinary/-/cloudinary-2.7.0.tgz", - "integrity": "sha512-qrqDn31+qkMCzKu1GfRpzPNAO86jchcNwEHCUiqvPHNSFqu7FTNF9FuAkBUyvM1CFFgFPu64NT0DyeREwLwK0w==", - "license": "MIT", - "dependencies": { - "lodash": "^4.17.21", - "q": "^1.5.1" - }, - "engines": { - "node": ">=9" - } - }, - "node_modules/concat-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", - "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", - "engines": [ - "node >= 6.0" - ], - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.0.2", - "typedarray": "^0.0.6" - } - }, - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-signature": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", - "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", - "license": "MIT", - "engines": { - "node": ">=6.6.0" - } - }, - "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==", - "dev": true, - "license": "MIT", - "dependencies": { - "object-assign": "^4", - "vary": "^1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/debug": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", - "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", - "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==", - "license": "MIT", - "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==", - "license": "BSD-2-Clause", - "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==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "es-errors": "^1.3.0", - "gopd": "^1.2.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "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==", - "license": "MIT" - }, - "node_modules/encodeurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", - "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", - "license": "MIT", - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "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==", - "license": "MIT" - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "license": "MIT", - "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==", - "license": "MIT", - "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/finalhandler": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz", - "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==", - "license": "MIT", - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/fs": { - "version": "0.0.1-security", - "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", - "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==", - "license": "ISC" - }, - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "dependencies": { - "dunder-proto": "^1.0.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/gopd": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "license": "MIT", - "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/http-errors/node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "license": "ISC" - }, - "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==", - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "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==", - "license": "MIT" - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "license": "MIT" - }, - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "dependencies": { - "mime-db": "^1.54.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", - "license": "MIT", - "dependencies": { - "minimist": "^1.2.6" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "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==", - "license": "MIT" - }, - "node_modules/multer": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/multer/-/multer-2.0.2.tgz", - "integrity": "sha512-u7f2xaZ/UG8oLXHvtF/oWTRvT44p9ecwBBqTwgJVq0+4BW1g8OW01TyMEGWBHbyMOYVHXslaut7qEQ1meATXgw==", - "license": "MIT", - "dependencies": { - "append-field": "^1.0.0", - "busboy": "^1.6.0", - "concat-stream": "^2.0.0", - "mkdirp": "^0.5.6", - "object-assign": "^4.1.1", - "type-is": "^1.6.18", - "xtend": "^4.0.2" - }, - "engines": { - "node": ">= 10.16.0" - } - }, - "node_modules/multer/node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/multer/node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/multer/node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "license": "MIT", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/multer/node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "license": "MIT", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "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==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "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==", - "license": "ISC", - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "engines": { - "node": ">=16" - } - }, - "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==", - "license": "MIT", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/q": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", - "integrity": "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==", - "deprecated": "You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other.\n\n(For a CapTP with native promises, see @endo/eventual-send and @endo/captp)", - "license": "MIT", - "engines": { - "node": ">=0.6.0", - "teleport": ">=0.2.0" - } - }, - "node_modules/qs": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", - "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", - "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==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.0.tgz", - "integrity": "sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g==", - "license": "MIT", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.6.3", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/router": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", - "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", - "license": "MIT", - "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" - } - ], - "license": "MIT" - }, - "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/send": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", - "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", - "license": "MIT", - "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==", - "license": "MIT", - "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==", - "license": "ISC" - }, - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "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==", - "license": "MIT", - "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/statuses": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", - "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.2.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==", - "license": "MIT", - "engines": { - "node": ">=0.6" - } - }, - "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==", - "license": "MIT", - "dependencies": { - "content-type": "^1.0.5", - "media-typer": "^1.1.0", - "mime-types": "^3.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", - "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/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "license": "MIT" - }, - "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==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "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==", - "license": "ISC" - }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "license": "MIT", - "engines": { - "node": ">=0.4" - } - } - } -} diff --git a/server/node_modules/accepts/HISTORY.md b/server/node_modules/accepts/HISTORY.md deleted file mode 100644 index 627a81d..0000000 --- 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 0616607..0000000 --- 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 f3f10c4..0000000 --- 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 4f2840c..0000000 --- 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 b35b262..0000000 --- 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/append-field/.npmignore b/server/node_modules/append-field/.npmignore deleted file mode 100644 index c2658d7..0000000 --- a/server/node_modules/append-field/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ diff --git a/server/node_modules/append-field/LICENSE b/server/node_modules/append-field/LICENSE deleted file mode 100644 index 14b1f89..0000000 --- a/server/node_modules/append-field/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Linus Unnebäck - -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/append-field/README.md b/server/node_modules/append-field/README.md deleted file mode 100644 index 62b901b..0000000 --- a/server/node_modules/append-field/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# `append-field` - -A [W3C HTML JSON forms spec](http://www.w3.org/TR/html-json-forms/) compliant -field appender (for lack of a better name). Useful for people implementing -`application/x-www-form-urlencoded` and `multipart/form-data` parsers. - -It works best on objects created with `Object.create(null)`. Otherwise it might -conflict with variables from the prototype (e.g. `hasOwnProperty`). - -## Installation - -```sh -npm install --save append-field -``` - -## Usage - -```javascript -var appendField = require('append-field') -var obj = Object.create(null) - -appendField(obj, 'pets[0][species]', 'Dahut') -appendField(obj, 'pets[0][name]', 'Hypatia') -appendField(obj, 'pets[1][species]', 'Felis Stultus') -appendField(obj, 'pets[1][name]', 'Billie') - -console.log(obj) -``` - -```text -{ pets: - [ { species: 'Dahut', name: 'Hypatia' }, - { species: 'Felis Stultus', name: 'Billie' } ] } -``` - -## API - -### `appendField(store, key, value)` - -Adds the field named `key` with the value `value` to the object `store`. - -## License - -MIT diff --git a/server/node_modules/append-field/index.js b/server/node_modules/append-field/index.js deleted file mode 100644 index fc5acc8..0000000 --- a/server/node_modules/append-field/index.js +++ /dev/null @@ -1,12 +0,0 @@ -var parsePath = require('./lib/parse-path') -var setValue = require('./lib/set-value') - -function appendField (store, key, value) { - var steps = parsePath(key) - - steps.reduce(function (context, step) { - return setValue(context, step, context[step.key], value) - }, store) -} - -module.exports = appendField diff --git a/server/node_modules/append-field/lib/parse-path.js b/server/node_modules/append-field/lib/parse-path.js deleted file mode 100644 index 31d6179..0000000 --- a/server/node_modules/append-field/lib/parse-path.js +++ /dev/null @@ -1,53 +0,0 @@ -var reFirstKey = /^[^\[]*/ -var reDigitPath = /^\[(\d+)\]/ -var reNormalPath = /^\[([^\]]+)\]/ - -function parsePath (key) { - function failure () { - return [{ type: 'object', key: key, last: true }] - } - - var firstKey = reFirstKey.exec(key)[0] - if (!firstKey) return failure() - - var len = key.length - var pos = firstKey.length - var tail = { type: 'object', key: firstKey } - var steps = [tail] - - while (pos < len) { - var m - - if (key[pos] === '[' && key[pos + 1] === ']') { - pos += 2 - tail.append = true - if (pos !== len) return failure() - continue - } - - m = reDigitPath.exec(key.substring(pos)) - if (m !== null) { - pos += m[0].length - tail.nextType = 'array' - tail = { type: 'array', key: parseInt(m[1], 10) } - steps.push(tail) - continue - } - - m = reNormalPath.exec(key.substring(pos)) - if (m !== null) { - pos += m[0].length - tail.nextType = 'object' - tail = { type: 'object', key: m[1] } - steps.push(tail) - continue - } - - return failure() - } - - tail.last = true - return steps -} - -module.exports = parsePath diff --git a/server/node_modules/append-field/lib/set-value.js b/server/node_modules/append-field/lib/set-value.js deleted file mode 100644 index c15e873..0000000 --- a/server/node_modules/append-field/lib/set-value.js +++ /dev/null @@ -1,64 +0,0 @@ -function valueType (value) { - if (value === undefined) return 'undefined' - if (Array.isArray(value)) return 'array' - if (typeof value === 'object') return 'object' - return 'scalar' -} - -function setLastValue (context, step, currentValue, entryValue) { - switch (valueType(currentValue)) { - case 'undefined': - if (step.append) { - context[step.key] = [entryValue] - } else { - context[step.key] = entryValue - } - break - case 'array': - context[step.key].push(entryValue) - break - case 'object': - return setLastValue(currentValue, { type: 'object', key: '', last: true }, currentValue[''], entryValue) - case 'scalar': - context[step.key] = [context[step.key], entryValue] - break - } - - return context -} - -function setValue (context, step, currentValue, entryValue) { - if (step.last) return setLastValue(context, step, currentValue, entryValue) - - var obj - switch (valueType(currentValue)) { - case 'undefined': - if (step.nextType === 'array') { - context[step.key] = [] - } else { - context[step.key] = Object.create(null) - } - return context[step.key] - case 'object': - return context[step.key] - case 'array': - if (step.nextType === 'array') { - return currentValue - } - - obj = Object.create(null) - context[step.key] = obj - currentValue.forEach(function (item, i) { - if (item !== undefined) obj['' + i] = item - }) - - return obj - case 'scalar': - obj = Object.create(null) - obj[''] = currentValue - context[step.key] = obj - return obj - } -} - -module.exports = setValue diff --git a/server/node_modules/append-field/package.json b/server/node_modules/append-field/package.json deleted file mode 100644 index 8d6e716..0000000 --- a/server/node_modules/append-field/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "append-field", - "version": "1.0.0", - "license": "MIT", - "author": "Linus Unnebäck ", - "main": "index.js", - "devDependencies": { - "mocha": "^2.2.4", - "standard": "^6.0.5", - "testdata-w3c-json-form": "^0.2.0" - }, - "scripts": { - "test": "standard && mocha" - }, - "repository": { - "type": "git", - "url": "http://github.com/LinusU/node-append-field.git" - } -} diff --git a/server/node_modules/append-field/test/forms.js b/server/node_modules/append-field/test/forms.js deleted file mode 100644 index dd6fbc9..0000000 --- a/server/node_modules/append-field/test/forms.js +++ /dev/null @@ -1,19 +0,0 @@ -/* eslint-env mocha */ - -var assert = require('assert') -var appendField = require('../') -var testData = require('testdata-w3c-json-form') - -describe('Append Field', function () { - for (var test of testData) { - it('handles ' + test.name, function () { - var store = Object.create(null) - - for (var field of test.fields) { - appendField(store, field.key, field.value) - } - - assert.deepEqual(store, test.expected) - }) - } -}) diff --git a/server/node_modules/body-parser/HISTORY.md b/server/node_modules/body-parser/HISTORY.md deleted file mode 100644 index 17dd110..0000000 --- a/server/node_modules/body-parser/HISTORY.md +++ /dev/null @@ -1,731 +0,0 @@ -2.2.0 / 2025-03-27 -========================= - -* refactor: normalize common options for all parsers -* deps: - * iconv-lite@^0.6.3 - -2.1.0 / 2025-02-10 -========================= - -* deps: - * type-is@^2.0.0 - * debug@^4.4.0 - * Removed destroy -* refactor: prefix built-in node module imports -* use the node require cache instead of custom caching - -2.0.2 / 2024-10-31 -========================= - -* remove `unpipe` package and use native `unpipe()` method - -2.0.1 / 2024-09-10 -========================= - -* Restore expected behavior `extended` to `false` - -2.0.0 / 2024-09-10 -========================= -* Propagate changes from 1.20.3 -* add brotli support #406 -* Breaking Change: Node.js 18 is the minimum supported version - -2.0.0-beta.2 / 2023-02-23 -========================= - -This incorporates all changes after 1.19.1 up to 1.20.2. - - * Remove deprecated `bodyParser()` combination middleware - * deps: debug@3.1.0 - - Add `DEBUG_HIDE_DATE` environment variable - - Change timer to per-namespace instead of global - - Change non-TTY date format - - Remove `DEBUG_FD` environment variable support - - Support 256 namespace colors - * deps: iconv-lite@0.5.2 - - Add encoding cp720 - - Add encoding UTF-32 - * deps: raw-body@3.0.0-beta.1 - -2.0.0-beta.1 / 2021-12-17 -========================= - - * Drop support for Node.js 0.8 - * `req.body` is no longer always initialized to `{}` - - it is left `undefined` unless a body is parsed - * `urlencoded` parser now defaults `extended` to `false` - * Use `on-finished` to determine when body read - -1.20.3 / 2024-09-10 -=================== - - * deps: qs@6.13.0 - * add `depth` option to customize the depth level in the parser - * IMPORTANT: The default `depth` level for parsing URL-encoded data is now `32` (previously was `Infinity`) - -1.20.2 / 2023-02-21 -=================== - - * Fix strict json error message on Node.js 19+ - * deps: content-type@~1.0.5 - - perf: skip value escaping when unnecessary - * deps: raw-body@2.5.2 - -1.20.1 / 2022-10-06 -=================== - - * deps: qs@6.11.0 - * perf: remove unnecessary object clone - -1.20.0 / 2022-04-02 -=================== - - * Fix error message for json parse whitespace in `strict` - * Fix internal error when inflated body exceeds limit - * Prevent loss of async hooks context - * Prevent hanging when request already read - * deps: depd@2.0.0 - - Replace internal `eval` usage with `Function` constructor - - Use instance methods on `process` to check for listeners - * deps: http-errors@2.0.0 - - deps: depd@2.0.0 - - deps: statuses@2.0.1 - * deps: on-finished@2.4.1 - * deps: qs@6.10.3 - * deps: raw-body@2.5.1 - - deps: http-errors@2.0.0 - -1.19.2 / 2022-02-15 -=================== - - * deps: bytes@3.1.2 - * deps: qs@6.9.7 - * Fix handling of `__proto__` keys - * deps: raw-body@2.4.3 - - deps: bytes@3.1.2 - -1.19.1 / 2021-12-10 -=================== - - * deps: bytes@3.1.1 - * deps: http-errors@1.8.1 - - deps: inherits@2.0.4 - - deps: toidentifier@1.0.1 - - deps: setprototypeof@1.2.0 - * deps: qs@6.9.6 - * deps: raw-body@2.4.2 - - deps: bytes@3.1.1 - - deps: http-errors@1.8.1 - * deps: safe-buffer@5.2.1 - * deps: type-is@~1.6.18 - -1.19.0 / 2019-04-25 -=================== - - * deps: bytes@3.1.0 - - Add petabyte (`pb`) support - * deps: http-errors@1.7.2 - - Set constructor name when possible - - deps: setprototypeof@1.1.1 - - deps: statuses@'>= 1.5.0 < 2' - * deps: iconv-lite@0.4.24 - - Added encoding MIK - * deps: qs@6.7.0 - - Fix parsing array brackets after index - * deps: raw-body@2.4.0 - - deps: bytes@3.1.0 - - deps: http-errors@1.7.2 - - deps: iconv-lite@0.4.24 - * deps: type-is@~1.6.17 - - deps: mime-types@~2.1.24 - - perf: prevent internal `throw` on invalid type - -1.18.3 / 2018-05-14 -=================== - - * Fix stack trace for strict json parse error - * deps: depd@~1.1.2 - - perf: remove argument reassignment - * deps: http-errors@~1.6.3 - - deps: depd@~1.1.2 - - deps: setprototypeof@1.1.0 - - deps: statuses@'>= 1.3.1 < 2' - * deps: iconv-lite@0.4.23 - - Fix loading encoding with year appended - - Fix deprecation warnings on Node.js 10+ - * deps: qs@6.5.2 - * deps: raw-body@2.3.3 - - deps: http-errors@1.6.3 - - deps: iconv-lite@0.4.23 - * deps: type-is@~1.6.16 - - deps: mime-types@~2.1.18 - -1.18.2 / 2017-09-22 -=================== - - * deps: debug@2.6.9 - * perf: remove argument reassignment - -1.18.1 / 2017-09-12 -=================== - - * deps: content-type@~1.0.4 - - perf: remove argument reassignment - - perf: skip parameter parsing when no parameters - * deps: iconv-lite@0.4.19 - - Fix ISO-8859-1 regression - - Update Windows-1255 - * deps: qs@6.5.1 - - Fix parsing & compacting very deep objects - * deps: raw-body@2.3.2 - - deps: iconv-lite@0.4.19 - -1.18.0 / 2017-09-08 -=================== - - * Fix JSON strict violation error to match native parse error - * Include the `body` property on verify errors - * Include the `type` property on all generated errors - * Use `http-errors` to set status code on errors - * deps: bytes@3.0.0 - * deps: debug@2.6.8 - * deps: depd@~1.1.1 - - Remove unnecessary `Buffer` loading - * deps: http-errors@~1.6.2 - - deps: depd@1.1.1 - * deps: iconv-lite@0.4.18 - - Add support for React Native - - Add a warning if not loaded as utf-8 - - Fix CESU-8 decoding in Node.js 8 - - Improve speed of ISO-8859-1 encoding - * deps: qs@6.5.0 - * deps: raw-body@2.3.1 - - Use `http-errors` for standard emitted errors - - deps: bytes@3.0.0 - - deps: iconv-lite@0.4.18 - - perf: skip buffer decoding on overage chunk - * perf: prevent internal `throw` when missing charset - -1.17.2 / 2017-05-17 -=================== - - * deps: debug@2.6.7 - - Fix `DEBUG_MAX_ARRAY_LENGTH` - - deps: ms@2.0.0 - * deps: type-is@~1.6.15 - - deps: mime-types@~2.1.15 - -1.17.1 / 2017-03-06 -=================== - - * deps: qs@6.4.0 - - Fix regression parsing keys starting with `[` - -1.17.0 / 2017-03-01 -=================== - - * deps: http-errors@~1.6.1 - - Make `message` property enumerable for `HttpError`s - - deps: setprototypeof@1.0.3 - * deps: qs@6.3.1 - - Fix compacting nested arrays - -1.16.1 / 2017-02-10 -=================== - - * deps: debug@2.6.1 - - Fix deprecation messages in WebStorm and other editors - - Undeprecate `DEBUG_FD` set to `1` or `2` - -1.16.0 / 2017-01-17 -=================== - - * deps: debug@2.6.0 - - Allow colors in workers - - Deprecated `DEBUG_FD` environment variable - - Fix error when running under React Native - - Use same color for same namespace - - deps: ms@0.7.2 - * deps: http-errors@~1.5.1 - - deps: inherits@2.0.3 - - deps: setprototypeof@1.0.2 - - deps: statuses@'>= 1.3.1 < 2' - * deps: iconv-lite@0.4.15 - - Added encoding MS-31J - - Added encoding MS-932 - - Added encoding MS-936 - - Added encoding MS-949 - - Added encoding MS-950 - - Fix GBK/GB18030 handling of Euro character - * deps: qs@6.2.1 - - Fix array parsing from skipping empty values - * deps: raw-body@~2.2.0 - - deps: iconv-lite@0.4.15 - * deps: type-is@~1.6.14 - - deps: mime-types@~2.1.13 - -1.15.2 / 2016-06-19 -=================== - - * deps: bytes@2.4.0 - * deps: content-type@~1.0.2 - - perf: enable strict mode - * deps: http-errors@~1.5.0 - - Use `setprototypeof` module to replace `__proto__` setting - - deps: statuses@'>= 1.3.0 < 2' - - perf: enable strict mode - * deps: qs@6.2.0 - * deps: raw-body@~2.1.7 - - deps: bytes@2.4.0 - - perf: remove double-cleanup on happy path - * deps: type-is@~1.6.13 - - deps: mime-types@~2.1.11 - -1.15.1 / 2016-05-05 -=================== - - * deps: bytes@2.3.0 - - Drop partial bytes on all parsed units - - Fix parsing byte string that looks like hex - * deps: raw-body@~2.1.6 - - deps: bytes@2.3.0 - * deps: type-is@~1.6.12 - - deps: mime-types@~2.1.10 - -1.15.0 / 2016-02-10 -=================== - - * deps: http-errors@~1.4.0 - - Add `HttpError` export, for `err instanceof createError.HttpError` - - deps: inherits@2.0.1 - - deps: statuses@'>= 1.2.1 < 2' - * deps: qs@6.1.0 - * deps: type-is@~1.6.11 - - deps: mime-types@~2.1.9 - -1.14.2 / 2015-12-16 -=================== - - * deps: bytes@2.2.0 - * deps: iconv-lite@0.4.13 - * deps: qs@5.2.0 - * deps: raw-body@~2.1.5 - - deps: bytes@2.2.0 - - deps: iconv-lite@0.4.13 - * deps: type-is@~1.6.10 - - deps: mime-types@~2.1.8 - -1.14.1 / 2015-09-27 -=================== - - * Fix issue where invalid charset results in 400 when `verify` used - * deps: iconv-lite@0.4.12 - - Fix CESU-8 decoding in Node.js 4.x - * deps: raw-body@~2.1.4 - - Fix masking critical errors from `iconv-lite` - - deps: iconv-lite@0.4.12 - * deps: type-is@~1.6.9 - - deps: mime-types@~2.1.7 - -1.14.0 / 2015-09-16 -=================== - - * Fix JSON strict parse error to match syntax errors - * Provide static `require` analysis in `urlencoded` parser - * deps: depd@~1.1.0 - - Support web browser loading - * deps: qs@5.1.0 - * deps: raw-body@~2.1.3 - - Fix sync callback when attaching data listener causes sync read - * deps: type-is@~1.6.8 - - Fix type error when given invalid type to match against - - deps: mime-types@~2.1.6 - -1.13.3 / 2015-07-31 -=================== - - * deps: type-is@~1.6.6 - - deps: mime-types@~2.1.4 - -1.13.2 / 2015-07-05 -=================== - - * deps: iconv-lite@0.4.11 - * deps: qs@4.0.0 - - Fix dropping parameters like `hasOwnProperty` - - Fix user-visible incompatibilities from 3.1.0 - - Fix various parsing edge cases - * deps: raw-body@~2.1.2 - - Fix error stack traces to skip `makeError` - - deps: iconv-lite@0.4.11 - * deps: type-is@~1.6.4 - - deps: mime-types@~2.1.2 - - perf: enable strict mode - - perf: remove argument reassignment - -1.13.1 / 2015-06-16 -=================== - - * deps: qs@2.4.2 - - Downgraded from 3.1.0 because of user-visible incompatibilities - -1.13.0 / 2015-06-14 -=================== - - * Add `statusCode` property on `Error`s, in addition to `status` - * Change `type` default to `application/json` for JSON parser - * Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser - * Provide static `require` analysis - * Use the `http-errors` module to generate errors - * deps: bytes@2.1.0 - - Slight optimizations - * deps: iconv-lite@0.4.10 - - The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails - - Leading BOM is now removed when decoding - * deps: on-finished@~2.3.0 - - Add defined behavior for HTTP `CONNECT` requests - - Add defined behavior for HTTP `Upgrade` requests - - deps: ee-first@1.1.1 - * deps: qs@3.1.0 - - Fix dropping parameters like `hasOwnProperty` - - Fix various parsing edge cases - - Parsed object now has `null` prototype - * deps: raw-body@~2.1.1 - - Use `unpipe` module for unpiping requests - - deps: iconv-lite@0.4.10 - * deps: type-is@~1.6.3 - - deps: mime-types@~2.1.1 - - perf: reduce try block size - - perf: remove bitwise operations - * perf: enable strict mode - * perf: remove argument reassignment - * perf: remove delete call - -1.12.4 / 2015-05-10 -=================== - - * deps: debug@~2.2.0 - * deps: qs@2.4.2 - - Fix allowing parameters like `constructor` - * deps: on-finished@~2.2.1 - * deps: raw-body@~2.0.1 - - Fix a false-positive when unpiping in Node.js 0.8 - - deps: bytes@2.0.1 - * deps: type-is@~1.6.2 - - deps: mime-types@~2.0.11 - -1.12.3 / 2015-04-15 -=================== - - * Slight efficiency improvement when not debugging - * deps: depd@~1.0.1 - * deps: iconv-lite@0.4.8 - - Add encoding alias UNICODE-1-1-UTF-7 - * deps: raw-body@1.3.4 - - Fix hanging callback if request aborts during read - - deps: iconv-lite@0.4.8 - -1.12.2 / 2015-03-16 -=================== - - * deps: qs@2.4.1 - - Fix error when parameter `hasOwnProperty` is present - -1.12.1 / 2015-03-15 -=================== - - * deps: debug@~2.1.3 - - Fix high intensity foreground color for bold - - deps: ms@0.7.0 - * deps: type-is@~1.6.1 - - deps: mime-types@~2.0.10 - -1.12.0 / 2015-02-13 -=================== - - * add `debug` messages - * accept a function for the `type` option - * use `content-type` to parse `Content-Type` headers - * deps: iconv-lite@0.4.7 - - Gracefully support enumerables on `Object.prototype` - * deps: raw-body@1.3.3 - - deps: iconv-lite@0.4.7 - * deps: type-is@~1.6.0 - - fix argument reassignment - - fix false-positives in `hasBody` `Transfer-Encoding` check - - support wildcard for both type and subtype (`*/*`) - - deps: mime-types@~2.0.9 - -1.11.0 / 2015-01-30 -=================== - - * make internal `extended: true` depth limit infinity - * deps: type-is@~1.5.6 - - deps: mime-types@~2.0.8 - -1.10.2 / 2015-01-20 -=================== - - * deps: iconv-lite@0.4.6 - - Fix rare aliases of single-byte encodings - * deps: raw-body@1.3.2 - - deps: iconv-lite@0.4.6 - -1.10.1 / 2015-01-01 -=================== - - * deps: on-finished@~2.2.0 - * deps: type-is@~1.5.5 - - deps: mime-types@~2.0.7 - -1.10.0 / 2014-12-02 -=================== - - * make internal `extended: true` array limit dynamic - -1.9.3 / 2014-11-21 -================== - - * deps: iconv-lite@0.4.5 - - Fix Windows-31J and X-SJIS encoding support - * deps: qs@2.3.3 - - Fix `arrayLimit` behavior - * deps: raw-body@1.3.1 - - deps: iconv-lite@0.4.5 - * deps: type-is@~1.5.3 - - deps: mime-types@~2.0.3 - -1.9.2 / 2014-10-27 -================== - - * deps: qs@2.3.2 - - Fix parsing of mixed objects and values - -1.9.1 / 2014-10-22 -================== - - * deps: on-finished@~2.1.1 - - Fix handling of pipelined requests - * deps: qs@2.3.0 - - Fix parsing of mixed implicit and explicit arrays - * deps: type-is@~1.5.2 - - deps: mime-types@~2.0.2 - -1.9.0 / 2014-09-24 -================== - - * include the charset in "unsupported charset" error message - * include the encoding in "unsupported content encoding" error message - * deps: depd@~1.0.0 - -1.8.4 / 2014-09-23 -================== - - * fix content encoding to be case-insensitive - -1.8.3 / 2014-09-19 -================== - - * deps: qs@2.2.4 - - Fix issue with object keys starting with numbers truncated - -1.8.2 / 2014-09-15 -================== - - * deps: depd@0.4.5 - -1.8.1 / 2014-09-07 -================== - - * deps: media-typer@0.3.0 - * deps: type-is@~1.5.1 - -1.8.0 / 2014-09-05 -================== - - * make empty-body-handling consistent between chunked requests - - empty `json` produces `{}` - - empty `raw` produces `new Buffer(0)` - - empty `text` produces `''` - - empty `urlencoded` produces `{}` - * deps: qs@2.2.3 - - Fix issue where first empty value in array is discarded - * deps: type-is@~1.5.0 - - fix `hasbody` to be true for `content-length: 0` - -1.7.0 / 2014-09-01 -================== - - * add `parameterLimit` option to `urlencoded` parser - * change `urlencoded` extended array limit to 100 - * respond with 413 when over `parameterLimit` in `urlencoded` - -1.6.7 / 2014-08-29 -================== - - * deps: qs@2.2.2 - - Remove unnecessary cloning - -1.6.6 / 2014-08-27 -================== - - * deps: qs@2.2.0 - - Array parsing fix - - Performance improvements - -1.6.5 / 2014-08-16 -================== - - * deps: on-finished@2.1.0 - -1.6.4 / 2014-08-14 -================== - - * deps: qs@1.2.2 - -1.6.3 / 2014-08-10 -================== - - * deps: qs@1.2.1 - -1.6.2 / 2014-08-07 -================== - - * deps: qs@1.2.0 - - Fix parsing array of objects - -1.6.1 / 2014-08-06 -================== - - * deps: qs@1.1.0 - - Accept urlencoded square brackets - - Accept empty values in implicit array notation - -1.6.0 / 2014-08-05 -================== - - * deps: qs@1.0.2 - - Complete rewrite - - Limits array length to 20 - - Limits object depth to 5 - - Limits parameters to 1,000 - -1.5.2 / 2014-07-27 -================== - - * deps: depd@0.4.4 - - Work-around v8 generating empty stack traces - -1.5.1 / 2014-07-26 -================== - - * deps: depd@0.4.3 - - Fix exception when global `Error.stackTraceLimit` is too low - -1.5.0 / 2014-07-20 -================== - - * deps: depd@0.4.2 - - Add `TRACE_DEPRECATION` environment variable - - Remove non-standard grey color from color output - - Support `--no-deprecation` argument - - Support `--trace-deprecation` argument - * deps: iconv-lite@0.4.4 - - Added encoding UTF-7 - * deps: raw-body@1.3.0 - - deps: iconv-lite@0.4.4 - - Added encoding UTF-7 - - Fix `Cannot switch to old mode now` error on Node.js 0.10+ - * deps: type-is@~1.3.2 - -1.4.3 / 2014-06-19 -================== - - * deps: type-is@1.3.1 - - fix global variable leak - -1.4.2 / 2014-06-19 -================== - - * deps: type-is@1.3.0 - - improve type parsing - -1.4.1 / 2014-06-19 -================== - - * fix urlencoded extended deprecation message - -1.4.0 / 2014-06-19 -================== - - * add `text` parser - * add `raw` parser - * check accepted charset in content-type (accepts utf-8) - * check accepted encoding in content-encoding (accepts identity) - * deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed - * deprecate `urlencoded()` without provided `extended` option - * lazy-load urlencoded parsers - * parsers split into files for reduced mem usage - * support gzip and deflate bodies - - set `inflate: false` to turn off - * deps: raw-body@1.2.2 - - Support all encodings from `iconv-lite` - -1.3.1 / 2014-06-11 -================== - - * deps: type-is@1.2.1 - - Switch dependency from mime to mime-types@1.0.0 - -1.3.0 / 2014-05-31 -================== - - * add `extended` option to urlencoded parser - -1.2.2 / 2014-05-27 -================== - - * deps: raw-body@1.1.6 - - assert stream encoding on node.js 0.8 - - assert stream encoding on node.js < 0.10.6 - - deps: bytes@1 - -1.2.1 / 2014-05-26 -================== - - * invoke `next(err)` after request fully read - - prevents hung responses and socket hang ups - -1.2.0 / 2014-05-11 -================== - - * add `verify` option - * deps: type-is@1.2.0 - - support suffix matching - -1.1.2 / 2014-05-11 -================== - - * improve json parser speed - -1.1.1 / 2014-05-11 -================== - - * fix repeated limit parsing with every request - -1.1.0 / 2014-05-10 -================== - - * add `type` option - * deps: pin for safety and consistency - -1.0.2 / 2014-04-14 -================== - - * use `type-is` module - -1.0.1 / 2014-03-20 -================== - - * lower default limits to 100kb diff --git a/server/node_modules/body-parser/LICENSE b/server/node_modules/body-parser/LICENSE deleted file mode 100644 index 386b7b6..0000000 --- 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 9fcd4c6..0000000 --- a/server/node_modules/body-parser/README.md +++ /dev/null @@ -1,491 +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: - -##### 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://badgen.net/github/checks/expressjs/body-parser/master?label=ci -[ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml -[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/body-parser/master -[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master -[node-version-image]: https://badgen.net/npm/node/body-parser -[node-version-url]: https://nodejs.org/en/download -[npm-downloads-image]: https://badgen.net/npm/dm/body-parser -[npm-url]: https://npmjs.org/package/body-parser -[npm-version-image]: https://badgen.net/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 d722d0b..0000000 --- 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/lib/read.js b/server/node_modules/body-parser/lib/read.js deleted file mode 100644 index eee8b11..0000000 --- a/server/node_modules/body-parser/lib/read.js +++ /dev/null @@ -1,210 +0,0 @@ -/*! - * body-parser - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -var createError = require('http-errors') -var getBody = require('raw-body') -var iconv = require('iconv-lite') -var onFinished = require('on-finished') -var zlib = require('node:zlib') - -/** - * Module exports. - */ - -module.exports = read - -/** - * Read a request into a buffer and parse. - * - * @param {object} req - * @param {object} res - * @param {function} next - * @param {function} parse - * @param {function} debug - * @param {object} options - * @private - */ - -function read (req, res, next, parse, debug, options) { - var length - var opts = options - var stream - - // read options - var encoding = opts.encoding !== null - ? opts.encoding - : null - var verify = opts.verify - - try { - // get the content stream - stream = contentstream(req, debug, opts.inflate) - length = stream.length - stream.length = undefined - } catch (err) { - return next(err) - } - - // set raw-body options - opts.length = length - opts.encoding = verify - ? null - : encoding - - // assert charset is supported - if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) { - return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', { - charset: encoding.toLowerCase(), - type: 'charset.unsupported' - })) - } - - // read body - debug('read body') - getBody(stream, opts, function (error, body) { - if (error) { - var _error - - if (error.type === 'encoding.unsupported') { - // echo back charset - _error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', { - charset: encoding.toLowerCase(), - type: 'charset.unsupported' - }) - } else { - // set status code on error - _error = createError(400, error) - } - - // unpipe from stream and destroy - if (stream !== req) { - req.unpipe() - stream.destroy() - } - - // read off entire request - dump(req, function onfinished () { - next(createError(400, _error)) - }) - return - } - - // verify - if (verify) { - try { - debug('verify body') - verify(req, res, body, encoding) - } catch (err) { - next(createError(403, err, { - body: body, - type: err.type || 'entity.verify.failed' - })) - return - } - } - - // parse - var str = body - try { - debug('parse body') - str = typeof body !== 'string' && encoding !== null - ? iconv.decode(body, encoding) - : body - req.body = parse(str, encoding) - } catch (err) { - next(createError(400, err, { - body: str, - type: err.type || 'entity.parse.failed' - })) - return - } - - next() - }) -} - -/** - * Get the content stream of the request. - * - * @param {object} req - * @param {function} debug - * @param {boolean} [inflate=true] - * @return {object} - * @api private - */ - -function contentstream (req, debug, inflate) { - var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase() - var length = req.headers['content-length'] - - debug('content-encoding "%s"', encoding) - - if (inflate === false && encoding !== 'identity') { - throw createError(415, 'content encoding unsupported', { - encoding: encoding, - type: 'encoding.unsupported' - }) - } - - if (encoding === 'identity') { - req.length = length - return req - } - - var stream = createDecompressionStream(encoding, debug) - req.pipe(stream) - return stream -} - -/** - * Create a decompression stream for the given encoding. - * @param {string} encoding - * @param {function} debug - * @return {object} - * @api private - */ -function createDecompressionStream (encoding, debug) { - switch (encoding) { - case 'deflate': - debug('inflate body') - return zlib.createInflate() - case 'gzip': - debug('gunzip body') - return zlib.createGunzip() - case 'br': - debug('brotli decompress body') - return zlib.createBrotliDecompress() - default: - throw createError(415, 'unsupported content encoding "' + encoding + '"', { - encoding: encoding, - type: 'encoding.unsupported' - }) - } -} - -/** - * Dump the contents of a request. - * - * @param {object} req - * @param {function} callback - * @api private - */ - -function dump (req, callback) { - if (onFinished.isFinished(req)) { - callback(null) - } else { - onFinished(req, callback) - req.resume() - } -} diff --git a/server/node_modules/body-parser/lib/types/json.js b/server/node_modules/body-parser/lib/types/json.js deleted file mode 100644 index 078ce71..0000000 --- a/server/node_modules/body-parser/lib/types/json.js +++ /dev/null @@ -1,206 +0,0 @@ -/*! - * body-parser - * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -var createError = require('http-errors') -var debug = require('debug')('body-parser:json') -var isFinished = require('on-finished').isFinished -var read = require('../read') -var typeis = require('type-is') -var { getCharset, normalizeOptions } = require('../utils') - -/** - * Module exports. - */ - -module.exports = json - -/** - * RegExp to match the first non-space in a string. - * - * Allowed whitespace is defined in RFC 7159: - * - * ws = *( - * %x20 / ; Space - * %x09 / ; Horizontal tab - * %x0A / ; Line feed or New line - * %x0D ) ; Carriage return - */ - -var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex - -var JSON_SYNTAX_CHAR = '#' -var JSON_SYNTAX_REGEXP = /#+/g - -/** - * Create a middleware to parse JSON bodies. - * - * @param {object} [options] - * @return {function} - * @public - */ - -function json (options) { - var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'application/json') - - var reviver = options?.reviver - var strict = options?.strict !== false - - function parse (body) { - if (body.length === 0) { - // special-case empty json body, as it's a common client-side mistake - // TODO: maybe make this configurable or part of "strict" option - return {} - } - - if (strict) { - var first = firstchar(body) - - if (first !== '{' && first !== '[') { - debug('strict violation') - throw createStrictSyntaxError(body, first) - } - } - - try { - debug('parse json') - return JSON.parse(body, reviver) - } catch (e) { - throw normalizeJsonSyntaxError(e, { - message: e.message, - stack: e.stack - }) - } - } - - return function jsonParser (req, res, next) { - if (isFinished(req)) { - debug('body already parsed') - next() - return - } - - if (!('body' in req)) { - req.body = undefined - } - - // skip requests without bodies - if (!typeis.hasBody(req)) { - debug('skip empty body') - next() - return - } - - debug('content-type %j', req.headers['content-type']) - - // determine if request should be parsed - if (!shouldParse(req)) { - debug('skip parsing') - next() - return - } - - // assert charset per RFC 7159 sec 8.1 - var charset = getCharset(req) || 'utf-8' - if (charset.slice(0, 4) !== 'utf-') { - debug('invalid charset') - next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', { - charset: charset, - type: 'charset.unsupported' - })) - return - } - - // read - read(req, res, next, parse, debug, { - encoding: charset, - inflate, - limit, - verify - }) - } -} - -/** - * Create strict violation syntax error matching native error. - * - * @param {string} str - * @param {string} char - * @return {Error} - * @private - */ - -function createStrictSyntaxError (str, char) { - var index = str.indexOf(char) - var partial = '' - - if (index !== -1) { - partial = str.substring(0, index) + JSON_SYNTAX_CHAR - - for (var i = index + 1; i < str.length; i++) { - partial += JSON_SYNTAX_CHAR - } - } - - try { - JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation') - } catch (e) { - return normalizeJsonSyntaxError(e, { - message: e.message.replace(JSON_SYNTAX_REGEXP, function (placeholder) { - return str.substring(index, index + placeholder.length) - }), - stack: e.stack - }) - } -} - -/** - * Get the first non-whitespace character in a string. - * - * @param {string} str - * @return {function} - * @private - */ - -function firstchar (str) { - var match = FIRST_CHAR_REGEXP.exec(str) - - return match - ? match[1] - : undefined -} - -/** - * Normalize a SyntaxError for JSON.parse. - * - * @param {SyntaxError} error - * @param {object} obj - * @return {SyntaxError} - */ - -function normalizeJsonSyntaxError (error, obj) { - var keys = Object.getOwnPropertyNames(error) - - for (var i = 0; i < keys.length; i++) { - var key = keys[i] - if (key !== 'stack' && key !== 'message') { - delete error[key] - } - } - - // replace stack before message for Node.js 0.10 and below - error.stack = obj.stack.replace(error.message, obj.message) - error.message = obj.message - - return error -} diff --git a/server/node_modules/body-parser/lib/types/raw.js b/server/node_modules/body-parser/lib/types/raw.js deleted file mode 100644 index 3788ff2..0000000 --- a/server/node_modules/body-parser/lib/types/raw.js +++ /dev/null @@ -1,75 +0,0 @@ -/*! - * body-parser - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - */ - -var debug = require('debug')('body-parser:raw') -var isFinished = require('on-finished').isFinished -var read = require('../read') -var typeis = require('type-is') -var { normalizeOptions } = require('../utils') - -/** - * Module exports. - */ - -module.exports = raw - -/** - * Create a middleware to parse raw bodies. - * - * @param {object} [options] - * @return {function} - * @api public - */ - -function raw (options) { - var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'application/octet-stream') - - function parse (buf) { - return buf - } - - return function rawParser (req, res, next) { - if (isFinished(req)) { - debug('body already parsed') - next() - return - } - - if (!('body' in req)) { - req.body = undefined - } - - // skip requests without bodies - if (!typeis.hasBody(req)) { - debug('skip empty body') - next() - return - } - - debug('content-type %j', req.headers['content-type']) - - // determine if request should be parsed - if (!shouldParse(req)) { - debug('skip parsing') - next() - return - } - - // read - read(req, res, next, parse, debug, { - encoding: null, - inflate, - limit, - verify - }) - } -} diff --git a/server/node_modules/body-parser/lib/types/text.js b/server/node_modules/body-parser/lib/types/text.js deleted file mode 100644 index 3e0ab1b..0000000 --- a/server/node_modules/body-parser/lib/types/text.js +++ /dev/null @@ -1,80 +0,0 @@ -/*! - * body-parser - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - */ - -var debug = require('debug')('body-parser:text') -var isFinished = require('on-finished').isFinished -var read = require('../read') -var typeis = require('type-is') -var { getCharset, normalizeOptions } = require('../utils') - -/** - * Module exports. - */ - -module.exports = text - -/** - * Create a middleware to parse text bodies. - * - * @param {object} [options] - * @return {function} - * @api public - */ - -function text (options) { - var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'text/plain') - - var defaultCharset = options?.defaultCharset || 'utf-8' - - function parse (buf) { - return buf - } - - return function textParser (req, res, next) { - if (isFinished(req)) { - debug('body already parsed') - next() - return - } - - if (!('body' in req)) { - req.body = undefined - } - - // skip requests without bodies - if (!typeis.hasBody(req)) { - debug('skip empty body') - next() - return - } - - debug('content-type %j', req.headers['content-type']) - - // determine if request should be parsed - if (!shouldParse(req)) { - debug('skip parsing') - next() - return - } - - // get charset - var charset = getCharset(req) || defaultCharset - - // read - read(req, res, next, parse, debug, { - encoding: charset, - inflate, - limit, - verify - }) - } -} diff --git a/server/node_modules/body-parser/lib/types/urlencoded.js b/server/node_modules/body-parser/lib/types/urlencoded.js deleted file mode 100644 index f993425..0000000 --- a/server/node_modules/body-parser/lib/types/urlencoded.js +++ /dev/null @@ -1,177 +0,0 @@ -/*! - * body-parser - * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -var createError = require('http-errors') -var debug = require('debug')('body-parser:urlencoded') -var isFinished = require('on-finished').isFinished -var read = require('../read') -var typeis = require('type-is') -var qs = require('qs') -var { getCharset, normalizeOptions } = require('../utils') - -/** - * Module exports. - */ - -module.exports = urlencoded - -/** - * Create a middleware to parse urlencoded bodies. - * - * @param {object} [options] - * @return {function} - * @public - */ - -function urlencoded (options) { - var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'application/x-www-form-urlencoded') - - var defaultCharset = options?.defaultCharset || 'utf-8' - if (defaultCharset !== 'utf-8' && defaultCharset !== 'iso-8859-1') { - throw new TypeError('option defaultCharset must be either utf-8 or iso-8859-1') - } - - // create the appropriate query parser - var queryparse = createQueryParser(options) - - function parse (body, encoding) { - return body.length - ? queryparse(body, encoding) - : {} - } - - return function urlencodedParser (req, res, next) { - if (isFinished(req)) { - debug('body already parsed') - next() - return - } - - if (!('body' in req)) { - req.body = undefined - } - - // skip requests without bodies - if (!typeis.hasBody(req)) { - debug('skip empty body') - next() - return - } - - debug('content-type %j', req.headers['content-type']) - - // determine if request should be parsed - if (!shouldParse(req)) { - debug('skip parsing') - next() - return - } - - // assert charset - var charset = getCharset(req) || defaultCharset - if (charset !== 'utf-8' && charset !== 'iso-8859-1') { - debug('invalid charset') - next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', { - charset: charset, - type: 'charset.unsupported' - })) - return - } - - // read - read(req, res, next, parse, debug, { - encoding: charset, - inflate, - limit, - verify - }) - } -} - -/** - * Get the extended query parser. - * - * @param {object} options - */ - -function createQueryParser (options) { - var extended = Boolean(options?.extended) - var parameterLimit = options?.parameterLimit !== undefined - ? options?.parameterLimit - : 1000 - var charsetSentinel = options?.charsetSentinel - var interpretNumericEntities = options?.interpretNumericEntities - var depth = extended ? (options?.depth !== undefined ? options?.depth : 32) : 0 - - if (isNaN(parameterLimit) || parameterLimit < 1) { - throw new TypeError('option parameterLimit must be a positive number') - } - - if (isNaN(depth) || depth < 0) { - throw new TypeError('option depth must be a zero or a positive number') - } - - if (isFinite(parameterLimit)) { - parameterLimit = parameterLimit | 0 - } - - return function queryparse (body, encoding) { - var paramCount = parameterCount(body, parameterLimit) - - if (paramCount === undefined) { - debug('too many parameters') - throw createError(413, 'too many parameters', { - type: 'parameters.too.many' - }) - } - - var arrayLimit = extended ? Math.max(100, paramCount) : 0 - - debug('parse ' + (extended ? 'extended ' : '') + 'urlencoding') - try { - return qs.parse(body, { - allowPrototypes: true, - arrayLimit: arrayLimit, - depth: depth, - charsetSentinel: charsetSentinel, - interpretNumericEntities: interpretNumericEntities, - charset: encoding, - parameterLimit: parameterLimit, - strictDepth: true - }) - } catch (err) { - if (err instanceof RangeError) { - throw createError(400, 'The input exceeded the depth', { - type: 'querystring.parse.rangeError' - }) - } else { - throw err - } - } - } -} - -/** - * Count the number of parameters, stopping once limit reached - * - * @param {string} body - * @param {number} limit - * @api private - */ - -function parameterCount (body, limit) { - var len = body.split('&').length - - return len > limit ? undefined : len - 1 -} diff --git a/server/node_modules/body-parser/lib/utils.js b/server/node_modules/body-parser/lib/utils.js deleted file mode 100644 index eee5d95..0000000 --- a/server/node_modules/body-parser/lib/utils.js +++ /dev/null @@ -1,83 +0,0 @@ -'use strict' - -/** - * Module dependencies. - */ - -var bytes = require('bytes') -var contentType = require('content-type') -var typeis = require('type-is') - -/** - * Module exports. - */ - -module.exports = { - getCharset, - normalizeOptions -} - -/** - * Get the charset of a request. - * - * @param {object} req - * @api private - */ - -function getCharset (req) { - try { - return (contentType.parse(req).parameters.charset || '').toLowerCase() - } catch { - return undefined - } -} - -/** - * Get the simple type checker. - * - * @param {string | string[]} type - * @return {function} - */ - -function typeChecker (type) { - return function checkType (req) { - return Boolean(typeis(req, type)) - } -} - -/** - * Normalizes the common options for all parsers. - * - * @param {object} options options to normalize - * @param {string | string[] | function} defaultType default content type(s) or a function to determine it - * @returns {object} - */ -function normalizeOptions (options, defaultType) { - if (!defaultType) { - // Parsers must define a default content type - throw new TypeError('defaultType must be provided') - } - - var inflate = options?.inflate !== false - var limit = typeof options?.limit !== 'number' - ? bytes.parse(options?.limit || '100kb') - : options?.limit - var type = options?.type || defaultType - var verify = options?.verify || false - - if (verify !== false && typeof verify !== 'function') { - throw new TypeError('option verify must be function') - } - - // create the appropriate type checking function - var shouldParse = typeof type !== 'function' - ? typeChecker(type) - : type - - return { - inflate, - limit, - verify, - shouldParse - } -} diff --git a/server/node_modules/body-parser/package.json b/server/node_modules/body-parser/package.json deleted file mode 100644 index e7f763b..0000000 --- a/server/node_modules/body-parser/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "body-parser", - "description": "Node.js body parsing middleware", - "version": "2.2.0", - "contributors": [ - "Douglas Christopher Wilson ", - "Jonathan Ong (http://jongleberry.com)" - ], - "license": "MIT", - "repository": "expressjs/body-parser", - "dependencies": { - "bytes": "^3.1.2", - "content-type": "^1.0.5", - "debug": "^4.4.0", - "http-errors": "^2.0.0", - "iconv-lite": "^0.6.3", - "on-finished": "^2.4.1", - "qs": "^6.14.0", - "raw-body": "^3.0.0", - "type-is": "^2.0.0" - }, - "devDependencies": { - "eslint": "8.34.0", - "eslint-config-standard": "14.1.1", - "eslint-plugin-import": "2.27.5", - "eslint-plugin-markdown": "3.0.0", - "eslint-plugin-node": "11.1.0", - "eslint-plugin-promise": "6.1.1", - "eslint-plugin-standard": "4.1.0", - "mocha": "^11.1.0", - "nyc": "^17.1.0", - "supertest": "^7.0.0" - }, - "files": [ - "lib/", - "LICENSE", - "HISTORY.md", - "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/buffer-from/LICENSE b/server/node_modules/buffer-from/LICENSE deleted file mode 100644 index e4bf1d6..0000000 --- a/server/node_modules/buffer-from/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016, 2018 Linus Unnebäck - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/server/node_modules/buffer-from/index.js b/server/node_modules/buffer-from/index.js deleted file mode 100644 index e1a58b5..0000000 --- a/server/node_modules/buffer-from/index.js +++ /dev/null @@ -1,72 +0,0 @@ -/* eslint-disable node/no-deprecated-api */ - -var toString = Object.prototype.toString - -var isModern = ( - typeof Buffer !== 'undefined' && - typeof Buffer.alloc === 'function' && - typeof Buffer.allocUnsafe === 'function' && - typeof Buffer.from === 'function' -) - -function isArrayBuffer (input) { - return toString.call(input).slice(8, -1) === 'ArrayBuffer' -} - -function fromArrayBuffer (obj, byteOffset, length) { - byteOffset >>>= 0 - - var maxLength = obj.byteLength - byteOffset - - if (maxLength < 0) { - throw new RangeError("'offset' is out of bounds") - } - - if (length === undefined) { - length = maxLength - } else { - length >>>= 0 - - if (length > maxLength) { - throw new RangeError("'length' is out of bounds") - } - } - - return isModern - ? Buffer.from(obj.slice(byteOffset, byteOffset + length)) - : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length))) -} - -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('"encoding" must be a valid string encoding') - } - - return isModern - ? Buffer.from(string, encoding) - : new Buffer(string, encoding) -} - -function bufferFrom (value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number') - } - - if (isArrayBuffer(value)) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } - - return isModern - ? Buffer.from(value) - : new Buffer(value) -} - -module.exports = bufferFrom diff --git a/server/node_modules/buffer-from/package.json b/server/node_modules/buffer-from/package.json deleted file mode 100644 index 6ac5327..0000000 --- a/server/node_modules/buffer-from/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "buffer-from", - "version": "1.1.2", - "license": "MIT", - "repository": "LinusU/buffer-from", - "files": [ - "index.js" - ], - "scripts": { - "test": "standard && node test" - }, - "devDependencies": { - "standard": "^12.0.1" - }, - "keywords": [ - "buffer", - "buffer from" - ] -} diff --git a/server/node_modules/buffer-from/readme.md b/server/node_modules/buffer-from/readme.md deleted file mode 100644 index 9880a55..0000000 --- a/server/node_modules/buffer-from/readme.md +++ /dev/null @@ -1,69 +0,0 @@ -# Buffer From - -A [ponyfill](https://ponyfill.com) for `Buffer.from`, uses native implementation if available. - -## Installation - -```sh -npm install --save buffer-from -``` - -## Usage - -```js -const bufferFrom = require('buffer-from') - -console.log(bufferFrom([1, 2, 3, 4])) -//=> - -const arr = new Uint8Array([1, 2, 3, 4]) -console.log(bufferFrom(arr.buffer, 1, 2)) -//=> - -console.log(bufferFrom('test', 'utf8')) -//=> - -const buf = bufferFrom('test') -console.log(bufferFrom(buf)) -//=> -``` - -## API - -### bufferFrom(array) - -- `array` <Array> - -Allocates a new `Buffer` using an `array` of octets. - -### bufferFrom(arrayBuffer[, byteOffset[, length]]) - -- `arrayBuffer` <ArrayBuffer> The `.buffer` property of a TypedArray or ArrayBuffer -- `byteOffset` <Integer> Where to start copying from `arrayBuffer`. **Default:** `0` -- `length` <Integer> How many bytes to copy from `arrayBuffer`. **Default:** `arrayBuffer.length - byteOffset` - -When passed a reference to the `.buffer` property of a TypedArray instance, the -newly created `Buffer` will share the same allocated memory as the TypedArray. - -The optional `byteOffset` and `length` arguments specify a memory range within -the `arrayBuffer` that will be shared by the `Buffer`. - -### bufferFrom(buffer) - -- `buffer` <Buffer> An existing `Buffer` to copy data from - -Copies the passed `buffer` data onto a new `Buffer` instance. - -### bufferFrom(string[, encoding]) - -- `string` <String> A string to encode. -- `encoding` <String> The encoding of `string`. **Default:** `'utf8'` - -Creates a new `Buffer` containing the given JavaScript string `string`. If -provided, the `encoding` parameter identifies the character encoding of -`string`. - -## See also - -- [buffer-alloc](https://github.com/LinusU/buffer-alloc) A ponyfill for `Buffer.alloc` -- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe` diff --git a/server/node_modules/busboy/.eslintrc.js b/server/node_modules/busboy/.eslintrc.js deleted file mode 100644 index be9311d..0000000 --- a/server/node_modules/busboy/.eslintrc.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -module.exports = { - extends: '@mscdex/eslint-config', -}; diff --git a/server/node_modules/busboy/.github/workflows/ci.yml b/server/node_modules/busboy/.github/workflows/ci.yml deleted file mode 100644 index 799bae0..0000000 --- a/server/node_modules/busboy/.github/workflows/ci.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: CI - -on: - pull_request: - push: - branches: [ master ] - -jobs: - tests-linux: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node-version: [10.16.0, 10.x, 12.x, 14.x, 16.x] - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: Install module - run: npm install - - name: Run tests - run: npm test diff --git a/server/node_modules/busboy/.github/workflows/lint.yml b/server/node_modules/busboy/.github/workflows/lint.yml deleted file mode 100644 index 9f9e1f5..0000000 --- a/server/node_modules/busboy/.github/workflows/lint.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: lint - -on: - pull_request: - push: - branches: [ master ] - -env: - NODE_VERSION: 16.x - -jobs: - lint-js: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v1 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Install ESLint + ESLint configs/plugins - run: npm install --only=dev - - name: Lint files - run: npm run lint diff --git a/server/node_modules/busboy/LICENSE b/server/node_modules/busboy/LICENSE deleted file mode 100644 index 290762e..0000000 --- a/server/node_modules/busboy/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright Brian White. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. \ No newline at end of file diff --git a/server/node_modules/busboy/README.md b/server/node_modules/busboy/README.md deleted file mode 100644 index 654af30..0000000 --- a/server/node_modules/busboy/README.md +++ /dev/null @@ -1,191 +0,0 @@ -# Description - -A node.js module for parsing incoming HTML form data. - -Changes (breaking or otherwise) in v1.0.0 can be found [here](https://github.com/mscdex/busboy/issues/266). - -# Requirements - -* [node.js](http://nodejs.org/) -- v10.16.0 or newer - - -# Install - - npm install busboy - - -# Examples - -* Parsing (multipart) with default options: - -```js -const http = require('http'); - -const busboy = require('busboy'); - -http.createServer((req, res) => { - if (req.method === 'POST') { - console.log('POST request'); - const bb = busboy({ headers: req.headers }); - bb.on('file', (name, file, info) => { - const { filename, encoding, mimeType } = info; - console.log( - `File [${name}]: filename: %j, encoding: %j, mimeType: %j`, - filename, - encoding, - mimeType - ); - file.on('data', (data) => { - console.log(`File [${name}] got ${data.length} bytes`); - }).on('close', () => { - console.log(`File [${name}] done`); - }); - }); - bb.on('field', (name, val, info) => { - console.log(`Field [${name}]: value: %j`, val); - }); - bb.on('close', () => { - console.log('Done parsing form!'); - res.writeHead(303, { Connection: 'close', Location: '/' }); - res.end(); - }); - req.pipe(bb); - } else if (req.method === 'GET') { - res.writeHead(200, { Connection: 'close' }); - res.end(` - - - -
-
-
- -
- - - `); - } -}).listen(8000, () => { - console.log('Listening for requests'); -}); - -// Example output: -// -// Listening for requests -// < ... form submitted ... > -// POST request -// File [filefield]: filename: "logo.jpg", encoding: "binary", mime: "image/jpeg" -// File [filefield] got 11912 bytes -// Field [textfield]: value: "testing! :-)" -// File [filefield] done -// Done parsing form! -``` - -* Save all incoming files to disk: - -```js -const { randomFillSync } = require('crypto'); -const fs = require('fs'); -const http = require('http'); -const os = require('os'); -const path = require('path'); - -const busboy = require('busboy'); - -const random = (() => { - const buf = Buffer.alloc(16); - return () => randomFillSync(buf).toString('hex'); -})(); - -http.createServer((req, res) => { - if (req.method === 'POST') { - const bb = busboy({ headers: req.headers }); - bb.on('file', (name, file, info) => { - const saveTo = path.join(os.tmpdir(), `busboy-upload-${random()}`); - file.pipe(fs.createWriteStream(saveTo)); - }); - bb.on('close', () => { - res.writeHead(200, { 'Connection': 'close' }); - res.end(`That's all folks!`); - }); - req.pipe(bb); - return; - } - res.writeHead(404); - res.end(); -}).listen(8000, () => { - console.log('Listening for requests'); -}); -``` - - -# API - -## Exports - -`busboy` exports a single function: - -**( _function_ )**(< _object_ >config) - Creates and returns a new _Writable_ form parser stream. - -* Valid `config` properties: - - * **headers** - _object_ - These are the HTTP headers of the incoming request, which are used by individual parsers. - - * **highWaterMark** - _integer_ - highWaterMark to use for the parser stream. **Default:** node's _stream.Writable_ default. - - * **fileHwm** - _integer_ - highWaterMark to use for individual file streams. **Default:** node's _stream.Readable_ default. - - * **defCharset** - _string_ - Default character set to use when one isn't defined. **Default:** `'utf8'`. - - * **defParamCharset** - _string_ - For multipart forms, the default character set to use for values of part header parameters (e.g. filename) that are not extended parameters (that contain an explicit charset). **Default:** `'latin1'`. - - * **preservePath** - _boolean_ - If paths in filenames from file parts in a `'multipart/form-data'` request shall be preserved. **Default:** `false`. - - * **limits** - _object_ - Various limits on incoming data. Valid properties are: - - * **fieldNameSize** - _integer_ - Max field name size (in bytes). **Default:** `100`. - - * **fieldSize** - _integer_ - Max field value size (in bytes). **Default:** `1048576` (1MB). - - * **fields** - _integer_ - Max number of non-file fields. **Default:** `Infinity`. - - * **fileSize** - _integer_ - For multipart forms, the max file size (in bytes). **Default:** `Infinity`. - - * **files** - _integer_ - For multipart forms, the max number of file fields. **Default:** `Infinity`. - - * **parts** - _integer_ - For multipart forms, the max number of parts (fields + files). **Default:** `Infinity`. - - * **headerPairs** - _integer_ - For multipart forms, the max number of header key-value pairs to parse. **Default:** `2000` (same as node's http module). - -This function can throw exceptions if there is something wrong with the values in `config`. For example, if the Content-Type in `headers` is missing entirely, is not a supported type, or is missing the boundary for `'multipart/form-data'` requests. - -## (Special) Parser stream events - -* **file**(< _string_ >name, < _Readable_ >stream, < _object_ >info) - Emitted for each new file found. `name` contains the form field name. `stream` is a _Readable_ stream containing the file's data. No transformations/conversions (e.g. base64 to raw binary) are done on the file's data. `info` contains the following properties: - - * `filename` - _string_ - If supplied, this contains the file's filename. **WARNING:** You should almost _never_ use this value as-is (especially if you are using `preservePath: true` in your `config`) as it could contain malicious input. You are better off generating your own (safe) filenames, or at the very least using a hash of the filename. - - * `encoding` - _string_ - The file's `'Content-Transfer-Encoding'` value. - - * `mimeType` - _string_ - The file's `'Content-Type'` value. - - **Note:** If you listen for this event, you should always consume the `stream` whether you care about its contents or not (you can simply do `stream.resume();` if you want to discard/skip the contents), otherwise the `'finish'`/`'close'` event will never fire on the busboy parser stream. - However, if you aren't accepting files, you can either simply not listen for the `'file'` event at all or set `limits.files` to `0`, and any/all files will be automatically skipped (these skipped files will still count towards any configured `limits.files` and `limits.parts` limits though). - - **Note:** If a configured `limits.fileSize` limit was reached for a file, `stream` will both have a boolean property `truncated` set to `true` (best checked at the end of the stream) and emit a `'limit'` event to notify you when this happens. - -* **field**(< _string_ >name, < _string_ >value, < _object_ >info) - Emitted for each new non-file field found. `name` contains the form field name. `value` contains the string value of the field. `info` contains the following properties: - - * `nameTruncated` - _boolean_ - Whether `name` was truncated or not (due to a configured `limits.fieldNameSize` limit) - - * `valueTruncated` - _boolean_ - Whether `value` was truncated or not (due to a configured `limits.fieldSize` limit) - - * `encoding` - _string_ - The field's `'Content-Transfer-Encoding'` value. - - * `mimeType` - _string_ - The field's `'Content-Type'` value. - -* **partsLimit**() - Emitted when the configured `limits.parts` limit has been reached. No more `'file'` or `'field'` events will be emitted. - -* **filesLimit**() - Emitted when the configured `limits.files` limit has been reached. No more `'file'` events will be emitted. - -* **fieldsLimit**() - Emitted when the configured `limits.fields` limit has been reached. No more `'field'` events will be emitted. diff --git a/server/node_modules/busboy/bench/bench-multipart-fields-100mb-big.js b/server/node_modules/busboy/bench/bench-multipart-fields-100mb-big.js deleted file mode 100644 index ef15729..0000000 --- a/server/node_modules/busboy/bench/bench-multipart-fields-100mb-big.js +++ /dev/null @@ -1,149 +0,0 @@ -'use strict'; - -function createMultipartBuffers(boundary, sizes) { - const bufs = []; - for (let i = 0; i < sizes.length; ++i) { - const mb = sizes[i] * 1024 * 1024; - bufs.push(Buffer.from([ - `--${boundary}`, - `content-disposition: form-data; name="field${i + 1}"`, - '', - '0'.repeat(mb), - '', - ].join('\r\n'))); - } - bufs.push(Buffer.from([ - `--${boundary}--`, - '', - ].join('\r\n'))); - return bufs; -} - -const boundary = '-----------------------------168072824752491622650073'; -const buffers = createMultipartBuffers(boundary, [ - 10, - 10, - 10, - 20, - 50, -]); -const calls = { - partBegin: 0, - headerField: 0, - headerValue: 0, - headerEnd: 0, - headersEnd: 0, - partData: 0, - partEnd: 0, - end: 0, -}; - -const moduleName = process.argv[2]; -switch (moduleName) { - case 'busboy': { - const busboy = require('busboy'); - - const parser = busboy({ - limits: { - fieldSizeLimit: Infinity, - }, - headers: { - 'content-type': `multipart/form-data; boundary=${boundary}`, - }, - }); - parser.on('field', (name, val, info) => { - ++calls.partBegin; - ++calls.partData; - ++calls.partEnd; - }).on('close', () => { - ++calls.end; - console.timeEnd(moduleName); - }); - - console.time(moduleName); - for (const buf of buffers) - parser.write(buf); - break; - } - - case 'formidable': { - const { MultipartParser } = require('formidable'); - - const parser = new MultipartParser(); - parser.initWithBoundary(boundary); - parser.on('data', ({ name }) => { - ++calls[name]; - if (name === 'end') - console.timeEnd(moduleName); - }); - - console.time(moduleName); - for (const buf of buffers) - parser.write(buf); - - break; - } - - case 'multiparty': { - const { Readable } = require('stream'); - - const { Form } = require('multiparty'); - - const form = new Form({ - maxFieldsSize: Infinity, - maxFields: Infinity, - maxFilesSize: Infinity, - autoFields: false, - autoFiles: false, - }); - - const req = new Readable({ read: () => {} }); - req.headers = { - 'content-type': `multipart/form-data; boundary=${boundary}`, - }; - - function hijack(name, fn) { - const oldFn = form[name]; - form[name] = function() { - fn(); - return oldFn.apply(this, arguments); - }; - } - - hijack('onParseHeaderField', () => { - ++calls.headerField; - }); - hijack('onParseHeaderValue', () => { - ++calls.headerValue; - }); - hijack('onParsePartBegin', () => { - ++calls.partBegin; - }); - hijack('onParsePartData', () => { - ++calls.partData; - }); - hijack('onParsePartEnd', () => { - ++calls.partEnd; - }); - - form.on('close', () => { - ++calls.end; - console.timeEnd(moduleName); - }).on('part', (p) => p.resume()); - - console.time(moduleName); - form.parse(req); - for (const buf of buffers) - req.push(buf); - req.push(null); - - break; - } - - default: - if (moduleName === undefined) - console.error('Missing parser module name'); - else - console.error(`Invalid parser module name: ${moduleName}`); - process.exit(1); -} diff --git a/server/node_modules/busboy/bench/bench-multipart-fields-100mb-small.js b/server/node_modules/busboy/bench/bench-multipart-fields-100mb-small.js deleted file mode 100644 index f32d421..0000000 --- a/server/node_modules/busboy/bench/bench-multipart-fields-100mb-small.js +++ /dev/null @@ -1,143 +0,0 @@ -'use strict'; - -function createMultipartBuffers(boundary, sizes) { - const bufs = []; - for (let i = 0; i < sizes.length; ++i) { - const mb = sizes[i] * 1024 * 1024; - bufs.push(Buffer.from([ - `--${boundary}`, - `content-disposition: form-data; name="field${i + 1}"`, - '', - '0'.repeat(mb), - '', - ].join('\r\n'))); - } - bufs.push(Buffer.from([ - `--${boundary}--`, - '', - ].join('\r\n'))); - return bufs; -} - -const boundary = '-----------------------------168072824752491622650073'; -const buffers = createMultipartBuffers(boundary, (new Array(100)).fill(1)); -const calls = { - partBegin: 0, - headerField: 0, - headerValue: 0, - headerEnd: 0, - headersEnd: 0, - partData: 0, - partEnd: 0, - end: 0, -}; - -const moduleName = process.argv[2]; -switch (moduleName) { - case 'busboy': { - const busboy = require('busboy'); - - const parser = busboy({ - limits: { - fieldSizeLimit: Infinity, - }, - headers: { - 'content-type': `multipart/form-data; boundary=${boundary}`, - }, - }); - parser.on('field', (name, val, info) => { - ++calls.partBegin; - ++calls.partData; - ++calls.partEnd; - }).on('close', () => { - ++calls.end; - console.timeEnd(moduleName); - }); - - console.time(moduleName); - for (const buf of buffers) - parser.write(buf); - break; - } - - case 'formidable': { - const { MultipartParser } = require('formidable'); - - const parser = new MultipartParser(); - parser.initWithBoundary(boundary); - parser.on('data', ({ name }) => { - ++calls[name]; - if (name === 'end') - console.timeEnd(moduleName); - }); - - console.time(moduleName); - for (const buf of buffers) - parser.write(buf); - - break; - } - - case 'multiparty': { - const { Readable } = require('stream'); - - const { Form } = require('multiparty'); - - const form = new Form({ - maxFieldsSize: Infinity, - maxFields: Infinity, - maxFilesSize: Infinity, - autoFields: false, - autoFiles: false, - }); - - const req = new Readable({ read: () => {} }); - req.headers = { - 'content-type': `multipart/form-data; boundary=${boundary}`, - }; - - function hijack(name, fn) { - const oldFn = form[name]; - form[name] = function() { - fn(); - return oldFn.apply(this, arguments); - }; - } - - hijack('onParseHeaderField', () => { - ++calls.headerField; - }); - hijack('onParseHeaderValue', () => { - ++calls.headerValue; - }); - hijack('onParsePartBegin', () => { - ++calls.partBegin; - }); - hijack('onParsePartData', () => { - ++calls.partData; - }); - hijack('onParsePartEnd', () => { - ++calls.partEnd; - }); - - form.on('close', () => { - ++calls.end; - console.timeEnd(moduleName); - }).on('part', (p) => p.resume()); - - console.time(moduleName); - form.parse(req); - for (const buf of buffers) - req.push(buf); - req.push(null); - - break; - } - - default: - if (moduleName === undefined) - console.error('Missing parser module name'); - else - console.error(`Invalid parser module name: ${moduleName}`); - process.exit(1); -} diff --git a/server/node_modules/busboy/bench/bench-multipart-files-100mb-big.js b/server/node_modules/busboy/bench/bench-multipart-files-100mb-big.js deleted file mode 100644 index b46bdee..0000000 --- a/server/node_modules/busboy/bench/bench-multipart-files-100mb-big.js +++ /dev/null @@ -1,154 +0,0 @@ -'use strict'; - -function createMultipartBuffers(boundary, sizes) { - const bufs = []; - for (let i = 0; i < sizes.length; ++i) { - const mb = sizes[i] * 1024 * 1024; - bufs.push(Buffer.from([ - `--${boundary}`, - `content-disposition: form-data; name="file${i + 1}"; ` - + `filename="random${i + 1}.bin"`, - 'content-type: application/octet-stream', - '', - '0'.repeat(mb), - '', - ].join('\r\n'))); - } - bufs.push(Buffer.from([ - `--${boundary}--`, - '', - ].join('\r\n'))); - return bufs; -} - -const boundary = '-----------------------------168072824752491622650073'; -const buffers = createMultipartBuffers(boundary, [ - 10, - 10, - 10, - 20, - 50, -]); -const calls = { - partBegin: 0, - headerField: 0, - headerValue: 0, - headerEnd: 0, - headersEnd: 0, - partData: 0, - partEnd: 0, - end: 0, -}; - -const moduleName = process.argv[2]; -switch (moduleName) { - case 'busboy': { - const busboy = require('busboy'); - - const parser = busboy({ - limits: { - fieldSizeLimit: Infinity, - }, - headers: { - 'content-type': `multipart/form-data; boundary=${boundary}`, - }, - }); - parser.on('file', (name, stream, info) => { - ++calls.partBegin; - stream.on('data', (chunk) => { - ++calls.partData; - }).on('end', () => { - ++calls.partEnd; - }); - }).on('close', () => { - ++calls.end; - console.timeEnd(moduleName); - }); - - console.time(moduleName); - for (const buf of buffers) - parser.write(buf); - break; - } - - case 'formidable': { - const { MultipartParser } = require('formidable'); - - const parser = new MultipartParser(); - parser.initWithBoundary(boundary); - parser.on('data', ({ name }) => { - ++calls[name]; - if (name === 'end') - console.timeEnd(moduleName); - }); - - console.time(moduleName); - for (const buf of buffers) - parser.write(buf); - - break; - } - - case 'multiparty': { - const { Readable } = require('stream'); - - const { Form } = require('multiparty'); - - const form = new Form({ - maxFieldsSize: Infinity, - maxFields: Infinity, - maxFilesSize: Infinity, - autoFields: false, - autoFiles: false, - }); - - const req = new Readable({ read: () => {} }); - req.headers = { - 'content-type': `multipart/form-data; boundary=${boundary}`, - }; - - function hijack(name, fn) { - const oldFn = form[name]; - form[name] = function() { - fn(); - return oldFn.apply(this, arguments); - }; - } - - hijack('onParseHeaderField', () => { - ++calls.headerField; - }); - hijack('onParseHeaderValue', () => { - ++calls.headerValue; - }); - hijack('onParsePartBegin', () => { - ++calls.partBegin; - }); - hijack('onParsePartData', () => { - ++calls.partData; - }); - hijack('onParsePartEnd', () => { - ++calls.partEnd; - }); - - form.on('close', () => { - ++calls.end; - console.timeEnd(moduleName); - }).on('part', (p) => p.resume()); - - console.time(moduleName); - form.parse(req); - for (const buf of buffers) - req.push(buf); - req.push(null); - - break; - } - - default: - if (moduleName === undefined) - console.error('Missing parser module name'); - else - console.error(`Invalid parser module name: ${moduleName}`); - process.exit(1); -} diff --git a/server/node_modules/busboy/bench/bench-multipart-files-100mb-small.js b/server/node_modules/busboy/bench/bench-multipart-files-100mb-small.js deleted file mode 100644 index 46b5dff..0000000 --- a/server/node_modules/busboy/bench/bench-multipart-files-100mb-small.js +++ /dev/null @@ -1,148 +0,0 @@ -'use strict'; - -function createMultipartBuffers(boundary, sizes) { - const bufs = []; - for (let i = 0; i < sizes.length; ++i) { - const mb = sizes[i] * 1024 * 1024; - bufs.push(Buffer.from([ - `--${boundary}`, - `content-disposition: form-data; name="file${i + 1}"; ` - + `filename="random${i + 1}.bin"`, - 'content-type: application/octet-stream', - '', - '0'.repeat(mb), - '', - ].join('\r\n'))); - } - bufs.push(Buffer.from([ - `--${boundary}--`, - '', - ].join('\r\n'))); - return bufs; -} - -const boundary = '-----------------------------168072824752491622650073'; -const buffers = createMultipartBuffers(boundary, (new Array(100)).fill(1)); -const calls = { - partBegin: 0, - headerField: 0, - headerValue: 0, - headerEnd: 0, - headersEnd: 0, - partData: 0, - partEnd: 0, - end: 0, -}; - -const moduleName = process.argv[2]; -switch (moduleName) { - case 'busboy': { - const busboy = require('busboy'); - - const parser = busboy({ - limits: { - fieldSizeLimit: Infinity, - }, - headers: { - 'content-type': `multipart/form-data; boundary=${boundary}`, - }, - }); - parser.on('file', (name, stream, info) => { - ++calls.partBegin; - stream.on('data', (chunk) => { - ++calls.partData; - }).on('end', () => { - ++calls.partEnd; - }); - }).on('close', () => { - ++calls.end; - console.timeEnd(moduleName); - }); - - console.time(moduleName); - for (const buf of buffers) - parser.write(buf); - break; - } - - case 'formidable': { - const { MultipartParser } = require('formidable'); - - const parser = new MultipartParser(); - parser.initWithBoundary(boundary); - parser.on('data', ({ name }) => { - ++calls[name]; - if (name === 'end') - console.timeEnd(moduleName); - }); - - console.time(moduleName); - for (const buf of buffers) - parser.write(buf); - - break; - } - - case 'multiparty': { - const { Readable } = require('stream'); - - const { Form } = require('multiparty'); - - const form = new Form({ - maxFieldsSize: Infinity, - maxFields: Infinity, - maxFilesSize: Infinity, - autoFields: false, - autoFiles: false, - }); - - const req = new Readable({ read: () => {} }); - req.headers = { - 'content-type': `multipart/form-data; boundary=${boundary}`, - }; - - function hijack(name, fn) { - const oldFn = form[name]; - form[name] = function() { - fn(); - return oldFn.apply(this, arguments); - }; - } - - hijack('onParseHeaderField', () => { - ++calls.headerField; - }); - hijack('onParseHeaderValue', () => { - ++calls.headerValue; - }); - hijack('onParsePartBegin', () => { - ++calls.partBegin; - }); - hijack('onParsePartData', () => { - ++calls.partData; - }); - hijack('onParsePartEnd', () => { - ++calls.partEnd; - }); - - form.on('close', () => { - ++calls.end; - console.timeEnd(moduleName); - }).on('part', (p) => p.resume()); - - console.time(moduleName); - form.parse(req); - for (const buf of buffers) - req.push(buf); - req.push(null); - - break; - } - - default: - if (moduleName === undefined) - console.error('Missing parser module name'); - else - console.error(`Invalid parser module name: ${moduleName}`); - process.exit(1); -} diff --git a/server/node_modules/busboy/bench/bench-urlencoded-fields-100pairs-small.js b/server/node_modules/busboy/bench/bench-urlencoded-fields-100pairs-small.js deleted file mode 100644 index 5c337df..0000000 --- a/server/node_modules/busboy/bench/bench-urlencoded-fields-100pairs-small.js +++ /dev/null @@ -1,101 +0,0 @@ -'use strict'; - -const buffers = [ - Buffer.from( - (new Array(100)).fill('').map((_, i) => `key${i}=value${i}`).join('&') - ), -]; -const calls = { - field: 0, - end: 0, -}; - -let n = 3e3; - -const moduleName = process.argv[2]; -switch (moduleName) { - case 'busboy': { - const busboy = require('busboy'); - - console.time(moduleName); - (function next() { - const parser = busboy({ - limits: { - fieldSizeLimit: Infinity, - }, - headers: { - 'content-type': 'application/x-www-form-urlencoded; charset=utf-8', - }, - }); - parser.on('field', (name, val, info) => { - ++calls.field; - }).on('close', () => { - ++calls.end; - if (--n === 0) - console.timeEnd(moduleName); - else - process.nextTick(next); - }); - - for (const buf of buffers) - parser.write(buf); - parser.end(); - })(); - break; - } - - case 'formidable': { - const QuerystringParser = - require('formidable/src/parsers/Querystring.js'); - - console.time(moduleName); - (function next() { - const parser = new QuerystringParser(); - parser.on('data', (obj) => { - ++calls.field; - }).on('end', () => { - ++calls.end; - if (--n === 0) - console.timeEnd(moduleName); - else - process.nextTick(next); - }); - - for (const buf of buffers) - parser.write(buf); - parser.end(); - })(); - break; - } - - case 'formidable-streaming': { - const QuerystringParser = - require('formidable/src/parsers/StreamingQuerystring.js'); - - console.time(moduleName); - (function next() { - const parser = new QuerystringParser(); - parser.on('data', (obj) => { - ++calls.field; - }).on('end', () => { - ++calls.end; - if (--n === 0) - console.timeEnd(moduleName); - else - process.nextTick(next); - }); - - for (const buf of buffers) - parser.write(buf); - parser.end(); - })(); - break; - } - - default: - if (moduleName === undefined) - console.error('Missing parser module name'); - else - console.error(`Invalid parser module name: ${moduleName}`); - process.exit(1); -} diff --git a/server/node_modules/busboy/bench/bench-urlencoded-fields-900pairs-small-alt.js b/server/node_modules/busboy/bench/bench-urlencoded-fields-900pairs-small-alt.js deleted file mode 100644 index 1f5645c..0000000 --- a/server/node_modules/busboy/bench/bench-urlencoded-fields-900pairs-small-alt.js +++ /dev/null @@ -1,84 +0,0 @@ -'use strict'; - -const buffers = [ - Buffer.from( - (new Array(900)).fill('').map((_, i) => `key${i}=value${i}`).join('&') - ), -]; -const calls = { - field: 0, - end: 0, -}; - -const moduleName = process.argv[2]; -switch (moduleName) { - case 'busboy': { - const busboy = require('busboy'); - - console.time(moduleName); - const parser = busboy({ - limits: { - fieldSizeLimit: Infinity, - }, - headers: { - 'content-type': 'application/x-www-form-urlencoded; charset=utf-8', - }, - }); - parser.on('field', (name, val, info) => { - ++calls.field; - }).on('close', () => { - ++calls.end; - console.timeEnd(moduleName); - }); - - for (const buf of buffers) - parser.write(buf); - parser.end(); - break; - } - - case 'formidable': { - const QuerystringParser = - require('formidable/src/parsers/Querystring.js'); - - console.time(moduleName); - const parser = new QuerystringParser(); - parser.on('data', (obj) => { - ++calls.field; - }).on('end', () => { - ++calls.end; - console.timeEnd(moduleName); - }); - - for (const buf of buffers) - parser.write(buf); - parser.end(); - break; - } - - case 'formidable-streaming': { - const QuerystringParser = - require('formidable/src/parsers/StreamingQuerystring.js'); - - console.time(moduleName); - const parser = new QuerystringParser(); - parser.on('data', (obj) => { - ++calls.field; - }).on('end', () => { - ++calls.end; - console.timeEnd(moduleName); - }); - - for (const buf of buffers) - parser.write(buf); - parser.end(); - break; - } - - default: - if (moduleName === undefined) - console.error('Missing parser module name'); - else - console.error(`Invalid parser module name: ${moduleName}`); - process.exit(1); -} diff --git a/server/node_modules/busboy/lib/index.js b/server/node_modules/busboy/lib/index.js deleted file mode 100644 index 873272d..0000000 --- a/server/node_modules/busboy/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict'; - -const { parseContentType } = require('./utils.js'); - -function getInstance(cfg) { - const headers = cfg.headers; - const conType = parseContentType(headers['content-type']); - if (!conType) - throw new Error('Malformed content type'); - - for (const type of TYPES) { - const matched = type.detect(conType); - if (!matched) - continue; - - const instanceCfg = { - limits: cfg.limits, - headers, - conType, - highWaterMark: undefined, - fileHwm: undefined, - defCharset: undefined, - defParamCharset: undefined, - preservePath: false, - }; - if (cfg.highWaterMark) - instanceCfg.highWaterMark = cfg.highWaterMark; - if (cfg.fileHwm) - instanceCfg.fileHwm = cfg.fileHwm; - instanceCfg.defCharset = cfg.defCharset; - instanceCfg.defParamCharset = cfg.defParamCharset; - instanceCfg.preservePath = cfg.preservePath; - return new type(instanceCfg); - } - - throw new Error(`Unsupported content type: ${headers['content-type']}`); -} - -// Note: types are explicitly listed here for easier bundling -// See: https://github.com/mscdex/busboy/issues/121 -const TYPES = [ - require('./types/multipart'), - require('./types/urlencoded'), -].filter(function(typemod) { return typeof typemod.detect === 'function'; }); - -module.exports = (cfg) => { - if (typeof cfg !== 'object' || cfg === null) - cfg = {}; - - if (typeof cfg.headers !== 'object' - || cfg.headers === null - || typeof cfg.headers['content-type'] !== 'string') { - throw new Error('Missing Content-Type'); - } - - return getInstance(cfg); -}; diff --git a/server/node_modules/busboy/lib/types/multipart.js b/server/node_modules/busboy/lib/types/multipart.js deleted file mode 100644 index cc0d7bb..0000000 --- a/server/node_modules/busboy/lib/types/multipart.js +++ /dev/null @@ -1,653 +0,0 @@ -'use strict'; - -const { Readable, Writable } = require('stream'); - -const StreamSearch = require('streamsearch'); - -const { - basename, - convertToUTF8, - getDecoder, - parseContentType, - parseDisposition, -} = require('../utils.js'); - -const BUF_CRLF = Buffer.from('\r\n'); -const BUF_CR = Buffer.from('\r'); -const BUF_DASH = Buffer.from('-'); - -function noop() {} - -const MAX_HEADER_PAIRS = 2000; // From node -const MAX_HEADER_SIZE = 16 * 1024; // From node (its default value) - -const HPARSER_NAME = 0; -const HPARSER_PRE_OWS = 1; -const HPARSER_VALUE = 2; -class HeaderParser { - constructor(cb) { - this.header = Object.create(null); - this.pairCount = 0; - this.byteCount = 0; - this.state = HPARSER_NAME; - this.name = ''; - this.value = ''; - this.crlf = 0; - this.cb = cb; - } - - reset() { - this.header = Object.create(null); - this.pairCount = 0; - this.byteCount = 0; - this.state = HPARSER_NAME; - this.name = ''; - this.value = ''; - this.crlf = 0; - } - - push(chunk, pos, end) { - let start = pos; - while (pos < end) { - switch (this.state) { - case HPARSER_NAME: { - let done = false; - for (; pos < end; ++pos) { - if (this.byteCount === MAX_HEADER_SIZE) - return -1; - ++this.byteCount; - const code = chunk[pos]; - if (TOKEN[code] !== 1) { - if (code !== 58/* ':' */) - return -1; - this.name += chunk.latin1Slice(start, pos); - if (this.name.length === 0) - return -1; - ++pos; - done = true; - this.state = HPARSER_PRE_OWS; - break; - } - } - if (!done) { - this.name += chunk.latin1Slice(start, pos); - break; - } - // FALLTHROUGH - } - case HPARSER_PRE_OWS: { - // Skip optional whitespace - let done = false; - for (; pos < end; ++pos) { - if (this.byteCount === MAX_HEADER_SIZE) - return -1; - ++this.byteCount; - const code = chunk[pos]; - if (code !== 32/* ' ' */ && code !== 9/* '\t' */) { - start = pos; - done = true; - this.state = HPARSER_VALUE; - break; - } - } - if (!done) - break; - // FALLTHROUGH - } - case HPARSER_VALUE: - switch (this.crlf) { - case 0: // Nothing yet - for (; pos < end; ++pos) { - if (this.byteCount === MAX_HEADER_SIZE) - return -1; - ++this.byteCount; - const code = chunk[pos]; - if (FIELD_VCHAR[code] !== 1) { - if (code !== 13/* '\r' */) - return -1; - ++this.crlf; - break; - } - } - this.value += chunk.latin1Slice(start, pos++); - break; - case 1: // Received CR - if (this.byteCount === MAX_HEADER_SIZE) - return -1; - ++this.byteCount; - if (chunk[pos++] !== 10/* '\n' */) - return -1; - ++this.crlf; - break; - case 2: { // Received CR LF - if (this.byteCount === MAX_HEADER_SIZE) - return -1; - ++this.byteCount; - const code = chunk[pos]; - if (code === 32/* ' ' */ || code === 9/* '\t' */) { - // Folded value - start = pos; - this.crlf = 0; - } else { - if (++this.pairCount < MAX_HEADER_PAIRS) { - this.name = this.name.toLowerCase(); - if (this.header[this.name] === undefined) - this.header[this.name] = [this.value]; - else - this.header[this.name].push(this.value); - } - if (code === 13/* '\r' */) { - ++this.crlf; - ++pos; - } else { - // Assume start of next header field name - start = pos; - this.crlf = 0; - this.state = HPARSER_NAME; - this.name = ''; - this.value = ''; - } - } - break; - } - case 3: { // Received CR LF CR - if (this.byteCount === MAX_HEADER_SIZE) - return -1; - ++this.byteCount; - if (chunk[pos++] !== 10/* '\n' */) - return -1; - // End of header - const header = this.header; - this.reset(); - this.cb(header); - return pos; - } - } - break; - } - } - - return pos; - } -} - -class FileStream extends Readable { - constructor(opts, owner) { - super(opts); - this.truncated = false; - this._readcb = null; - this.once('end', () => { - // We need to make sure that we call any outstanding _writecb() that is - // associated with this file so that processing of the rest of the form - // can continue. This may not happen if the file stream ends right after - // backpressure kicks in, so we force it here. - this._read(); - if (--owner._fileEndsLeft === 0 && owner._finalcb) { - const cb = owner._finalcb; - owner._finalcb = null; - // Make sure other 'end' event handlers get a chance to be executed - // before busboy's 'finish' event is emitted - process.nextTick(cb); - } - }); - } - _read(n) { - const cb = this._readcb; - if (cb) { - this._readcb = null; - cb(); - } - } -} - -const ignoreData = { - push: (chunk, pos) => {}, - destroy: () => {}, -}; - -function callAndUnsetCb(self, err) { - const cb = self._writecb; - self._writecb = null; - if (err) - self.destroy(err); - else if (cb) - cb(); -} - -function nullDecoder(val, hint) { - return val; -} - -class Multipart extends Writable { - constructor(cfg) { - const streamOpts = { - autoDestroy: true, - emitClose: true, - highWaterMark: (typeof cfg.highWaterMark === 'number' - ? cfg.highWaterMark - : undefined), - }; - super(streamOpts); - - if (!cfg.conType.params || typeof cfg.conType.params.boundary !== 'string') - throw new Error('Multipart: Boundary not found'); - - const boundary = cfg.conType.params.boundary; - const paramDecoder = (typeof cfg.defParamCharset === 'string' - && cfg.defParamCharset - ? getDecoder(cfg.defParamCharset) - : nullDecoder); - const defCharset = (cfg.defCharset || 'utf8'); - const preservePath = cfg.preservePath; - const fileOpts = { - autoDestroy: true, - emitClose: true, - highWaterMark: (typeof cfg.fileHwm === 'number' - ? cfg.fileHwm - : undefined), - }; - - const limits = cfg.limits; - const fieldSizeLimit = (limits && typeof limits.fieldSize === 'number' - ? limits.fieldSize - : 1 * 1024 * 1024); - const fileSizeLimit = (limits && typeof limits.fileSize === 'number' - ? limits.fileSize - : Infinity); - const filesLimit = (limits && typeof limits.files === 'number' - ? limits.files - : Infinity); - const fieldsLimit = (limits && typeof limits.fields === 'number' - ? limits.fields - : Infinity); - const partsLimit = (limits && typeof limits.parts === 'number' - ? limits.parts - : Infinity); - - let parts = -1; // Account for initial boundary - let fields = 0; - let files = 0; - let skipPart = false; - - this._fileEndsLeft = 0; - this._fileStream = undefined; - this._complete = false; - let fileSize = 0; - - let field; - let fieldSize = 0; - let partCharset; - let partEncoding; - let partType; - let partName; - let partTruncated = false; - - let hitFilesLimit = false; - let hitFieldsLimit = false; - - this._hparser = null; - const hparser = new HeaderParser((header) => { - this._hparser = null; - skipPart = false; - - partType = 'text/plain'; - partCharset = defCharset; - partEncoding = '7bit'; - partName = undefined; - partTruncated = false; - - let filename; - if (!header['content-disposition']) { - skipPart = true; - return; - } - - const disp = parseDisposition(header['content-disposition'][0], - paramDecoder); - if (!disp || disp.type !== 'form-data') { - skipPart = true; - return; - } - - if (disp.params) { - if (disp.params.name) - partName = disp.params.name; - - if (disp.params['filename*']) - filename = disp.params['filename*']; - else if (disp.params.filename) - filename = disp.params.filename; - - if (filename !== undefined && !preservePath) - filename = basename(filename); - } - - if (header['content-type']) { - const conType = parseContentType(header['content-type'][0]); - if (conType) { - partType = `${conType.type}/${conType.subtype}`; - if (conType.params && typeof conType.params.charset === 'string') - partCharset = conType.params.charset.toLowerCase(); - } - } - - if (header['content-transfer-encoding']) - partEncoding = header['content-transfer-encoding'][0].toLowerCase(); - - if (partType === 'application/octet-stream' || filename !== undefined) { - // File - - if (files === filesLimit) { - if (!hitFilesLimit) { - hitFilesLimit = true; - this.emit('filesLimit'); - } - skipPart = true; - return; - } - ++files; - - if (this.listenerCount('file') === 0) { - skipPart = true; - return; - } - - fileSize = 0; - this._fileStream = new FileStream(fileOpts, this); - ++this._fileEndsLeft; - this.emit( - 'file', - partName, - this._fileStream, - { filename, - encoding: partEncoding, - mimeType: partType } - ); - } else { - // Non-file - - if (fields === fieldsLimit) { - if (!hitFieldsLimit) { - hitFieldsLimit = true; - this.emit('fieldsLimit'); - } - skipPart = true; - return; - } - ++fields; - - if (this.listenerCount('field') === 0) { - skipPart = true; - return; - } - - field = []; - fieldSize = 0; - } - }); - - let matchPostBoundary = 0; - const ssCb = (isMatch, data, start, end, isDataSafe) => { -retrydata: - while (data) { - if (this._hparser !== null) { - const ret = this._hparser.push(data, start, end); - if (ret === -1) { - this._hparser = null; - hparser.reset(); - this.emit('error', new Error('Malformed part header')); - break; - } - start = ret; - } - - if (start === end) - break; - - if (matchPostBoundary !== 0) { - if (matchPostBoundary === 1) { - switch (data[start]) { - case 45: // '-' - // Try matching '--' after boundary - matchPostBoundary = 2; - ++start; - break; - case 13: // '\r' - // Try matching CR LF before header - matchPostBoundary = 3; - ++start; - break; - default: - matchPostBoundary = 0; - } - if (start === end) - return; - } - - if (matchPostBoundary === 2) { - matchPostBoundary = 0; - if (data[start] === 45/* '-' */) { - // End of multipart data - this._complete = true; - this._bparser = ignoreData; - return; - } - // We saw something other than '-', so put the dash we consumed - // "back" - const writecb = this._writecb; - this._writecb = noop; - ssCb(false, BUF_DASH, 0, 1, false); - this._writecb = writecb; - } else if (matchPostBoundary === 3) { - matchPostBoundary = 0; - if (data[start] === 10/* '\n' */) { - ++start; - if (parts >= partsLimit) - break; - // Prepare the header parser - this._hparser = hparser; - if (start === end) - break; - // Process the remaining data as a header - continue retrydata; - } else { - // We saw something other than LF, so put the CR we consumed - // "back" - const writecb = this._writecb; - this._writecb = noop; - ssCb(false, BUF_CR, 0, 1, false); - this._writecb = writecb; - } - } - } - - if (!skipPart) { - if (this._fileStream) { - let chunk; - const actualLen = Math.min(end - start, fileSizeLimit - fileSize); - if (!isDataSafe) { - chunk = Buffer.allocUnsafe(actualLen); - data.copy(chunk, 0, start, start + actualLen); - } else { - chunk = data.slice(start, start + actualLen); - } - - fileSize += chunk.length; - if (fileSize === fileSizeLimit) { - if (chunk.length > 0) - this._fileStream.push(chunk); - this._fileStream.emit('limit'); - this._fileStream.truncated = true; - skipPart = true; - } else if (!this._fileStream.push(chunk)) { - if (this._writecb) - this._fileStream._readcb = this._writecb; - this._writecb = null; - } - } else if (field !== undefined) { - let chunk; - const actualLen = Math.min( - end - start, - fieldSizeLimit - fieldSize - ); - if (!isDataSafe) { - chunk = Buffer.allocUnsafe(actualLen); - data.copy(chunk, 0, start, start + actualLen); - } else { - chunk = data.slice(start, start + actualLen); - } - - fieldSize += actualLen; - field.push(chunk); - if (fieldSize === fieldSizeLimit) { - skipPart = true; - partTruncated = true; - } - } - } - - break; - } - - if (isMatch) { - matchPostBoundary = 1; - - if (this._fileStream) { - // End the active file stream if the previous part was a file - this._fileStream.push(null); - this._fileStream = null; - } else if (field !== undefined) { - let data; - switch (field.length) { - case 0: - data = ''; - break; - case 1: - data = convertToUTF8(field[0], partCharset, 0); - break; - default: - data = convertToUTF8( - Buffer.concat(field, fieldSize), - partCharset, - 0 - ); - } - field = undefined; - fieldSize = 0; - this.emit( - 'field', - partName, - data, - { nameTruncated: false, - valueTruncated: partTruncated, - encoding: partEncoding, - mimeType: partType } - ); - } - - if (++parts === partsLimit) - this.emit('partsLimit'); - } - }; - this._bparser = new StreamSearch(`\r\n--${boundary}`, ssCb); - - this._writecb = null; - this._finalcb = null; - - // Just in case there is no preamble - this.write(BUF_CRLF); - } - - static detect(conType) { - return (conType.type === 'multipart' && conType.subtype === 'form-data'); - } - - _write(chunk, enc, cb) { - this._writecb = cb; - this._bparser.push(chunk, 0); - if (this._writecb) - callAndUnsetCb(this); - } - - _destroy(err, cb) { - this._hparser = null; - this._bparser = ignoreData; - if (!err) - err = checkEndState(this); - const fileStream = this._fileStream; - if (fileStream) { - this._fileStream = null; - fileStream.destroy(err); - } - cb(err); - } - - _final(cb) { - this._bparser.destroy(); - if (!this._complete) - return cb(new Error('Unexpected end of form')); - if (this._fileEndsLeft) - this._finalcb = finalcb.bind(null, this, cb); - else - finalcb(this, cb); - } -} - -function finalcb(self, cb, err) { - if (err) - return cb(err); - err = checkEndState(self); - cb(err); -} - -function checkEndState(self) { - if (self._hparser) - return new Error('Malformed part header'); - const fileStream = self._fileStream; - if (fileStream) { - self._fileStream = null; - fileStream.destroy(new Error('Unexpected end of file')); - } - if (!self._complete) - return new Error('Unexpected end of form'); -} - -const TOKEN = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -]; - -const FIELD_VCHAR = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -]; - -module.exports = Multipart; diff --git a/server/node_modules/busboy/lib/types/urlencoded.js b/server/node_modules/busboy/lib/types/urlencoded.js deleted file mode 100644 index 5c463a2..0000000 --- a/server/node_modules/busboy/lib/types/urlencoded.js +++ /dev/null @@ -1,350 +0,0 @@ -'use strict'; - -const { Writable } = require('stream'); - -const { getDecoder } = require('../utils.js'); - -class URLEncoded extends Writable { - constructor(cfg) { - const streamOpts = { - autoDestroy: true, - emitClose: true, - highWaterMark: (typeof cfg.highWaterMark === 'number' - ? cfg.highWaterMark - : undefined), - }; - super(streamOpts); - - let charset = (cfg.defCharset || 'utf8'); - if (cfg.conType.params && typeof cfg.conType.params.charset === 'string') - charset = cfg.conType.params.charset; - - this.charset = charset; - - const limits = cfg.limits; - this.fieldSizeLimit = (limits && typeof limits.fieldSize === 'number' - ? limits.fieldSize - : 1 * 1024 * 1024); - this.fieldsLimit = (limits && typeof limits.fields === 'number' - ? limits.fields - : Infinity); - this.fieldNameSizeLimit = ( - limits && typeof limits.fieldNameSize === 'number' - ? limits.fieldNameSize - : 100 - ); - - this._inKey = true; - this._keyTrunc = false; - this._valTrunc = false; - this._bytesKey = 0; - this._bytesVal = 0; - this._fields = 0; - this._key = ''; - this._val = ''; - this._byte = -2; - this._lastPos = 0; - this._encode = 0; - this._decoder = getDecoder(charset); - } - - static detect(conType) { - return (conType.type === 'application' - && conType.subtype === 'x-www-form-urlencoded'); - } - - _write(chunk, enc, cb) { - if (this._fields >= this.fieldsLimit) - return cb(); - - let i = 0; - const len = chunk.length; - this._lastPos = 0; - - // Check if we last ended mid-percent-encoded byte - if (this._byte !== -2) { - i = readPctEnc(this, chunk, i, len); - if (i === -1) - return cb(new Error('Malformed urlencoded form')); - if (i >= len) - return cb(); - if (this._inKey) - ++this._bytesKey; - else - ++this._bytesVal; - } - -main: - while (i < len) { - if (this._inKey) { - // Parsing key - - i = skipKeyBytes(this, chunk, i, len); - - while (i < len) { - switch (chunk[i]) { - case 61: // '=' - if (this._lastPos < i) - this._key += chunk.latin1Slice(this._lastPos, i); - this._lastPos = ++i; - this._key = this._decoder(this._key, this._encode); - this._encode = 0; - this._inKey = false; - continue main; - case 38: // '&' - if (this._lastPos < i) - this._key += chunk.latin1Slice(this._lastPos, i); - this._lastPos = ++i; - this._key = this._decoder(this._key, this._encode); - this._encode = 0; - if (this._bytesKey > 0) { - this.emit( - 'field', - this._key, - '', - { nameTruncated: this._keyTrunc, - valueTruncated: false, - encoding: this.charset, - mimeType: 'text/plain' } - ); - } - this._key = ''; - this._val = ''; - this._keyTrunc = false; - this._valTrunc = false; - this._bytesKey = 0; - this._bytesVal = 0; - if (++this._fields >= this.fieldsLimit) { - this.emit('fieldsLimit'); - return cb(); - } - continue; - case 43: // '+' - if (this._lastPos < i) - this._key += chunk.latin1Slice(this._lastPos, i); - this._key += ' '; - this._lastPos = i + 1; - break; - case 37: // '%' - if (this._encode === 0) - this._encode = 1; - if (this._lastPos < i) - this._key += chunk.latin1Slice(this._lastPos, i); - this._lastPos = i + 1; - this._byte = -1; - i = readPctEnc(this, chunk, i + 1, len); - if (i === -1) - return cb(new Error('Malformed urlencoded form')); - if (i >= len) - return cb(); - ++this._bytesKey; - i = skipKeyBytes(this, chunk, i, len); - continue; - } - ++i; - ++this._bytesKey; - i = skipKeyBytes(this, chunk, i, len); - } - if (this._lastPos < i) - this._key += chunk.latin1Slice(this._lastPos, i); - } else { - // Parsing value - - i = skipValBytes(this, chunk, i, len); - - while (i < len) { - switch (chunk[i]) { - case 38: // '&' - if (this._lastPos < i) - this._val += chunk.latin1Slice(this._lastPos, i); - this._lastPos = ++i; - this._inKey = true; - this._val = this._decoder(this._val, this._encode); - this._encode = 0; - if (this._bytesKey > 0 || this._bytesVal > 0) { - this.emit( - 'field', - this._key, - this._val, - { nameTruncated: this._keyTrunc, - valueTruncated: this._valTrunc, - encoding: this.charset, - mimeType: 'text/plain' } - ); - } - this._key = ''; - this._val = ''; - this._keyTrunc = false; - this._valTrunc = false; - this._bytesKey = 0; - this._bytesVal = 0; - if (++this._fields >= this.fieldsLimit) { - this.emit('fieldsLimit'); - return cb(); - } - continue main; - case 43: // '+' - if (this._lastPos < i) - this._val += chunk.latin1Slice(this._lastPos, i); - this._val += ' '; - this._lastPos = i + 1; - break; - case 37: // '%' - if (this._encode === 0) - this._encode = 1; - if (this._lastPos < i) - this._val += chunk.latin1Slice(this._lastPos, i); - this._lastPos = i + 1; - this._byte = -1; - i = readPctEnc(this, chunk, i + 1, len); - if (i === -1) - return cb(new Error('Malformed urlencoded form')); - if (i >= len) - return cb(); - ++this._bytesVal; - i = skipValBytes(this, chunk, i, len); - continue; - } - ++i; - ++this._bytesVal; - i = skipValBytes(this, chunk, i, len); - } - if (this._lastPos < i) - this._val += chunk.latin1Slice(this._lastPos, i); - } - } - - cb(); - } - - _final(cb) { - if (this._byte !== -2) - return cb(new Error('Malformed urlencoded form')); - if (!this._inKey || this._bytesKey > 0 || this._bytesVal > 0) { - if (this._inKey) - this._key = this._decoder(this._key, this._encode); - else - this._val = this._decoder(this._val, this._encode); - this.emit( - 'field', - this._key, - this._val, - { nameTruncated: this._keyTrunc, - valueTruncated: this._valTrunc, - encoding: this.charset, - mimeType: 'text/plain' } - ); - } - cb(); - } -} - -function readPctEnc(self, chunk, pos, len) { - if (pos >= len) - return len; - - if (self._byte === -1) { - // We saw a '%' but no hex characters yet - const hexUpper = HEX_VALUES[chunk[pos++]]; - if (hexUpper === -1) - return -1; - - if (hexUpper >= 8) - self._encode = 2; // Indicate high bits detected - - if (pos < len) { - // Both hex characters are in this chunk - const hexLower = HEX_VALUES[chunk[pos++]]; - if (hexLower === -1) - return -1; - - if (self._inKey) - self._key += String.fromCharCode((hexUpper << 4) + hexLower); - else - self._val += String.fromCharCode((hexUpper << 4) + hexLower); - - self._byte = -2; - self._lastPos = pos; - } else { - // Only one hex character was available in this chunk - self._byte = hexUpper; - } - } else { - // We saw only one hex character so far - const hexLower = HEX_VALUES[chunk[pos++]]; - if (hexLower === -1) - return -1; - - if (self._inKey) - self._key += String.fromCharCode((self._byte << 4) + hexLower); - else - self._val += String.fromCharCode((self._byte << 4) + hexLower); - - self._byte = -2; - self._lastPos = pos; - } - - return pos; -} - -function skipKeyBytes(self, chunk, pos, len) { - // Skip bytes if we've truncated - if (self._bytesKey > self.fieldNameSizeLimit) { - if (!self._keyTrunc) { - if (self._lastPos < pos) - self._key += chunk.latin1Slice(self._lastPos, pos - 1); - } - self._keyTrunc = true; - for (; pos < len; ++pos) { - const code = chunk[pos]; - if (code === 61/* '=' */ || code === 38/* '&' */) - break; - ++self._bytesKey; - } - self._lastPos = pos; - } - - return pos; -} - -function skipValBytes(self, chunk, pos, len) { - // Skip bytes if we've truncated - if (self._bytesVal > self.fieldSizeLimit) { - if (!self._valTrunc) { - if (self._lastPos < pos) - self._val += chunk.latin1Slice(self._lastPos, pos - 1); - } - self._valTrunc = true; - for (; pos < len; ++pos) { - if (chunk[pos] === 38/* '&' */) - break; - ++self._bytesVal; - } - self._lastPos = pos; - } - - return pos; -} - -/* eslint-disable no-multi-spaces */ -const HEX_VALUES = [ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, - -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -]; -/* eslint-enable no-multi-spaces */ - -module.exports = URLEncoded; diff --git a/server/node_modules/busboy/lib/utils.js b/server/node_modules/busboy/lib/utils.js deleted file mode 100644 index 8274f6c..0000000 --- a/server/node_modules/busboy/lib/utils.js +++ /dev/null @@ -1,596 +0,0 @@ -'use strict'; - -function parseContentType(str) { - if (str.length === 0) - return; - - const params = Object.create(null); - let i = 0; - - // Parse type - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (TOKEN[code] !== 1) { - if (code !== 47/* '/' */ || i === 0) - return; - break; - } - } - // Check for type without subtype - if (i === str.length) - return; - - const type = str.slice(0, i).toLowerCase(); - - // Parse subtype - const subtypeStart = ++i; - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (TOKEN[code] !== 1) { - // Make sure we have a subtype - if (i === subtypeStart) - return; - - if (parseContentTypeParams(str, i, params) === undefined) - return; - break; - } - } - // Make sure we have a subtype - if (i === subtypeStart) - return; - - const subtype = str.slice(subtypeStart, i).toLowerCase(); - - return { type, subtype, params }; -} - -function parseContentTypeParams(str, i, params) { - while (i < str.length) { - // Consume whitespace - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (code !== 32/* ' ' */ && code !== 9/* '\t' */) - break; - } - - // Ended on whitespace - if (i === str.length) - break; - - // Check for malformed parameter - if (str.charCodeAt(i++) !== 59/* ';' */) - return; - - // Consume whitespace - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (code !== 32/* ' ' */ && code !== 9/* '\t' */) - break; - } - - // Ended on whitespace (malformed) - if (i === str.length) - return; - - let name; - const nameStart = i; - // Parse parameter name - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (TOKEN[code] !== 1) { - if (code !== 61/* '=' */) - return; - break; - } - } - - // No value (malformed) - if (i === str.length) - return; - - name = str.slice(nameStart, i); - ++i; // Skip over '=' - - // No value (malformed) - if (i === str.length) - return; - - let value = ''; - let valueStart; - if (str.charCodeAt(i) === 34/* '"' */) { - valueStart = ++i; - let escaping = false; - // Parse quoted value - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (code === 92/* '\\' */) { - if (escaping) { - valueStart = i; - escaping = false; - } else { - value += str.slice(valueStart, i); - escaping = true; - } - continue; - } - if (code === 34/* '"' */) { - if (escaping) { - valueStart = i; - escaping = false; - continue; - } - value += str.slice(valueStart, i); - break; - } - if (escaping) { - valueStart = i - 1; - escaping = false; - } - // Invalid unescaped quoted character (malformed) - if (QDTEXT[code] !== 1) - return; - } - - // No end quote (malformed) - if (i === str.length) - return; - - ++i; // Skip over double quote - } else { - valueStart = i; - // Parse unquoted value - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (TOKEN[code] !== 1) { - // No value (malformed) - if (i === valueStart) - return; - break; - } - } - value = str.slice(valueStart, i); - } - - name = name.toLowerCase(); - if (params[name] === undefined) - params[name] = value; - } - - return params; -} - -function parseDisposition(str, defDecoder) { - if (str.length === 0) - return; - - const params = Object.create(null); - let i = 0; - - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (TOKEN[code] !== 1) { - if (parseDispositionParams(str, i, params, defDecoder) === undefined) - return; - break; - } - } - - const type = str.slice(0, i).toLowerCase(); - - return { type, params }; -} - -function parseDispositionParams(str, i, params, defDecoder) { - while (i < str.length) { - // Consume whitespace - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (code !== 32/* ' ' */ && code !== 9/* '\t' */) - break; - } - - // Ended on whitespace - if (i === str.length) - break; - - // Check for malformed parameter - if (str.charCodeAt(i++) !== 59/* ';' */) - return; - - // Consume whitespace - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (code !== 32/* ' ' */ && code !== 9/* '\t' */) - break; - } - - // Ended on whitespace (malformed) - if (i === str.length) - return; - - let name; - const nameStart = i; - // Parse parameter name - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (TOKEN[code] !== 1) { - if (code === 61/* '=' */) - break; - return; - } - } - - // No value (malformed) - if (i === str.length) - return; - - let value = ''; - let valueStart; - let charset; - //~ let lang; - name = str.slice(nameStart, i); - if (name.charCodeAt(name.length - 1) === 42/* '*' */) { - // Extended value - - const charsetStart = ++i; - // Parse charset name - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (CHARSET[code] !== 1) { - if (code !== 39/* '\'' */) - return; - break; - } - } - - // Incomplete charset (malformed) - if (i === str.length) - return; - - charset = str.slice(charsetStart, i); - ++i; // Skip over the '\'' - - //~ const langStart = ++i; - // Parse language name - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (code === 39/* '\'' */) - break; - } - - // Incomplete language (malformed) - if (i === str.length) - return; - - //~ lang = str.slice(langStart, i); - ++i; // Skip over the '\'' - - // No value (malformed) - if (i === str.length) - return; - - valueStart = i; - - let encode = 0; - // Parse value - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (EXTENDED_VALUE[code] !== 1) { - if (code === 37/* '%' */) { - let hexUpper; - let hexLower; - if (i + 2 < str.length - && (hexUpper = HEX_VALUES[str.charCodeAt(i + 1)]) !== -1 - && (hexLower = HEX_VALUES[str.charCodeAt(i + 2)]) !== -1) { - const byteVal = (hexUpper << 4) + hexLower; - value += str.slice(valueStart, i); - value += String.fromCharCode(byteVal); - i += 2; - valueStart = i + 1; - if (byteVal >= 128) - encode = 2; - else if (encode === 0) - encode = 1; - continue; - } - // '%' disallowed in non-percent encoded contexts (malformed) - return; - } - break; - } - } - - value += str.slice(valueStart, i); - value = convertToUTF8(value, charset, encode); - if (value === undefined) - return; - } else { - // Non-extended value - - ++i; // Skip over '=' - - // No value (malformed) - if (i === str.length) - return; - - if (str.charCodeAt(i) === 34/* '"' */) { - valueStart = ++i; - let escaping = false; - // Parse quoted value - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (code === 92/* '\\' */) { - if (escaping) { - valueStart = i; - escaping = false; - } else { - value += str.slice(valueStart, i); - escaping = true; - } - continue; - } - if (code === 34/* '"' */) { - if (escaping) { - valueStart = i; - escaping = false; - continue; - } - value += str.slice(valueStart, i); - break; - } - if (escaping) { - valueStart = i - 1; - escaping = false; - } - // Invalid unescaped quoted character (malformed) - if (QDTEXT[code] !== 1) - return; - } - - // No end quote (malformed) - if (i === str.length) - return; - - ++i; // Skip over double quote - } else { - valueStart = i; - // Parse unquoted value - for (; i < str.length; ++i) { - const code = str.charCodeAt(i); - if (TOKEN[code] !== 1) { - // No value (malformed) - if (i === valueStart) - return; - break; - } - } - value = str.slice(valueStart, i); - } - - value = defDecoder(value, 2); - if (value === undefined) - return; - } - - name = name.toLowerCase(); - if (params[name] === undefined) - params[name] = value; - } - - return params; -} - -function getDecoder(charset) { - let lc; - while (true) { - switch (charset) { - case 'utf-8': - case 'utf8': - return decoders.utf8; - case 'latin1': - case 'ascii': // TODO: Make these a separate, strict decoder? - case 'us-ascii': - case 'iso-8859-1': - case 'iso8859-1': - case 'iso88591': - case 'iso_8859-1': - case 'windows-1252': - case 'iso_8859-1:1987': - case 'cp1252': - case 'x-cp1252': - return decoders.latin1; - case 'utf16le': - case 'utf-16le': - case 'ucs2': - case 'ucs-2': - return decoders.utf16le; - case 'base64': - return decoders.base64; - default: - if (lc === undefined) { - lc = true; - charset = charset.toLowerCase(); - continue; - } - return decoders.other.bind(charset); - } - } -} - -const decoders = { - utf8: (data, hint) => { - if (data.length === 0) - return ''; - if (typeof data === 'string') { - // If `data` never had any percent-encoded bytes or never had any that - // were outside of the ASCII range, then we can safely just return the - // input since UTF-8 is ASCII compatible - if (hint < 2) - return data; - - data = Buffer.from(data, 'latin1'); - } - return data.utf8Slice(0, data.length); - }, - - latin1: (data, hint) => { - if (data.length === 0) - return ''; - if (typeof data === 'string') - return data; - return data.latin1Slice(0, data.length); - }, - - utf16le: (data, hint) => { - if (data.length === 0) - return ''; - if (typeof data === 'string') - data = Buffer.from(data, 'latin1'); - return data.ucs2Slice(0, data.length); - }, - - base64: (data, hint) => { - if (data.length === 0) - return ''; - if (typeof data === 'string') - data = Buffer.from(data, 'latin1'); - return data.base64Slice(0, data.length); - }, - - other: (data, hint) => { - if (data.length === 0) - return ''; - if (typeof data === 'string') - data = Buffer.from(data, 'latin1'); - try { - const decoder = new TextDecoder(this); - return decoder.decode(data); - } catch {} - }, -}; - -function convertToUTF8(data, charset, hint) { - const decode = getDecoder(charset); - if (decode) - return decode(data, hint); -} - -function basename(path) { - if (typeof path !== 'string') - return ''; - for (let i = path.length - 1; i >= 0; --i) { - switch (path.charCodeAt(i)) { - case 0x2F: // '/' - case 0x5C: // '\' - path = path.slice(i + 1); - return (path === '..' || path === '.' ? '' : path); - } - } - return (path === '..' || path === '.' ? '' : path); -} - -const TOKEN = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -]; - -const QDTEXT = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -]; - -const CHARSET = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -]; - -const EXTENDED_VALUE = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -]; - -/* eslint-disable no-multi-spaces */ -const HEX_VALUES = [ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, - -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -]; -/* eslint-enable no-multi-spaces */ - -module.exports = { - basename, - convertToUTF8, - getDecoder, - parseContentType, - parseDisposition, -}; diff --git a/server/node_modules/busboy/package.json b/server/node_modules/busboy/package.json deleted file mode 100644 index ac2577f..0000000 --- a/server/node_modules/busboy/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ "name": "busboy", - "version": "1.6.0", - "author": "Brian White ", - "description": "A streaming parser for HTML form data for node.js", - "main": "./lib/index.js", - "dependencies": { - "streamsearch": "^1.1.0" - }, - "devDependencies": { - "@mscdex/eslint-config": "^1.1.0", - "eslint": "^7.32.0" - }, - "scripts": { - "test": "node test/test.js", - "lint": "eslint --cache --report-unused-disable-directives --ext=.js .eslintrc.js lib test bench", - "lint:fix": "npm run lint -- --fix" - }, - "engines": { "node": ">=10.16.0" }, - "keywords": [ "uploads", "forms", "multipart", "form-data" ], - "licenses": [ { "type": "MIT", "url": "http://github.com/mscdex/busboy/raw/master/LICENSE" } ], - "repository": { "type": "git", "url": "http://github.com/mscdex/busboy.git" } -} diff --git a/server/node_modules/busboy/test/common.js b/server/node_modules/busboy/test/common.js deleted file mode 100644 index fb82ad8..0000000 --- a/server/node_modules/busboy/test/common.js +++ /dev/null @@ -1,109 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { inspect } = require('util'); - -const mustCallChecks = []; - -function noop() {} - -function runCallChecks(exitCode) { - if (exitCode !== 0) return; - - const failed = mustCallChecks.filter((context) => { - if ('minimum' in context) { - context.messageSegment = `at least ${context.minimum}`; - return context.actual < context.minimum; - } - context.messageSegment = `exactly ${context.exact}`; - return context.actual !== context.exact; - }); - - failed.forEach((context) => { - console.error('Mismatched %s function calls. Expected %s, actual %d.', - context.name, - context.messageSegment, - context.actual); - console.error(context.stack.split('\n').slice(2).join('\n')); - }); - - if (failed.length) - process.exit(1); -} - -function mustCall(fn, exact) { - return _mustCallInner(fn, exact, 'exact'); -} - -function mustCallAtLeast(fn, minimum) { - return _mustCallInner(fn, minimum, 'minimum'); -} - -function _mustCallInner(fn, criteria = 1, field) { - if (process._exiting) - throw new Error('Cannot use common.mustCall*() in process exit handler'); - - if (typeof fn === 'number') { - criteria = fn; - fn = noop; - } else if (fn === undefined) { - fn = noop; - } - - if (typeof criteria !== 'number') - throw new TypeError(`Invalid ${field} value: ${criteria}`); - - const context = { - [field]: criteria, - actual: 0, - stack: inspect(new Error()), - name: fn.name || '' - }; - - // Add the exit listener only once to avoid listener leak warnings - if (mustCallChecks.length === 0) - process.on('exit', runCallChecks); - - mustCallChecks.push(context); - - function wrapped(...args) { - ++context.actual; - return fn.call(this, ...args); - } - // TODO: remove origFn? - wrapped.origFn = fn; - - return wrapped; -} - -function getCallSite(top) { - const originalStackFormatter = Error.prepareStackTrace; - Error.prepareStackTrace = (err, stack) => - `${stack[0].getFileName()}:${stack[0].getLineNumber()}`; - const err = new Error(); - Error.captureStackTrace(err, top); - // With the V8 Error API, the stack is not formatted until it is accessed - // eslint-disable-next-line no-unused-expressions - err.stack; - Error.prepareStackTrace = originalStackFormatter; - return err.stack; -} - -function mustNotCall(msg) { - const callSite = getCallSite(mustNotCall); - return function mustNotCall(...args) { - args = args.map(inspect).join(', '); - const argsInfo = (args.length > 0 - ? `\ncalled with arguments: ${args}` - : ''); - assert.fail( - `${msg || 'function should not have been called'} at ${callSite}` - + argsInfo); - }; -} - -module.exports = { - mustCall, - mustCallAtLeast, - mustNotCall, -}; diff --git a/server/node_modules/busboy/test/test-types-multipart-charsets.js b/server/node_modules/busboy/test/test-types-multipart-charsets.js deleted file mode 100644 index ed9c38a..0000000 --- a/server/node_modules/busboy/test/test-types-multipart-charsets.js +++ /dev/null @@ -1,94 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { inspect } = require('util'); - -const { mustCall } = require(`${__dirname}/common.js`); - -const busboy = require('..'); - -const input = Buffer.from([ - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_0"; filename="テスト.dat"', - 'Content-Type: application/octet-stream', - '', - 'A'.repeat(1023), - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--' -].join('\r\n')); -const boundary = '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k'; -const expected = [ - { type: 'file', - name: 'upload_file_0', - data: Buffer.from('A'.repeat(1023)), - info: { - filename: 'テスト.dat', - encoding: '7bit', - mimeType: 'application/octet-stream', - }, - limited: false, - }, -]; -const bb = busboy({ - defParamCharset: 'utf8', - headers: { - 'content-type': `multipart/form-data; boundary=${boundary}`, - } -}); -const results = []; - -bb.on('field', (name, val, info) => { - results.push({ type: 'field', name, val, info }); -}); - -bb.on('file', (name, stream, info) => { - const data = []; - let nb = 0; - const file = { - type: 'file', - name, - data: null, - info, - limited: false, - }; - results.push(file); - stream.on('data', (d) => { - data.push(d); - nb += d.length; - }).on('limit', () => { - file.limited = true; - }).on('close', () => { - file.data = Buffer.concat(data, nb); - assert.strictEqual(stream.truncated, file.limited); - }).once('error', (err) => { - file.err = err.message; - }); -}); - -bb.on('error', (err) => { - results.push({ error: err.message }); -}); - -bb.on('partsLimit', () => { - results.push('partsLimit'); -}); - -bb.on('filesLimit', () => { - results.push('filesLimit'); -}); - -bb.on('fieldsLimit', () => { - results.push('fieldsLimit'); -}); - -bb.on('close', mustCall(() => { - assert.deepStrictEqual( - results, - expected, - 'Results mismatch.\n' - + `Parsed: ${inspect(results)}\n` - + `Expected: ${inspect(expected)}` - ); -})); - -bb.end(input); diff --git a/server/node_modules/busboy/test/test-types-multipart-stream-pause.js b/server/node_modules/busboy/test/test-types-multipart-stream-pause.js deleted file mode 100644 index df7268a..0000000 --- a/server/node_modules/busboy/test/test-types-multipart-stream-pause.js +++ /dev/null @@ -1,102 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { randomFillSync } = require('crypto'); -const { inspect } = require('util'); - -const busboy = require('..'); - -const { mustCall } = require('./common.js'); - -const BOUNDARY = 'u2KxIV5yF1y+xUspOQCCZopaVgeV6Jxihv35XQJmuTx8X3sh'; - -function formDataSection(key, value) { - return Buffer.from( - `\r\n--${BOUNDARY}` - + `\r\nContent-Disposition: form-data; name="${key}"` - + `\r\n\r\n${value}` - ); -} - -function formDataFile(key, filename, contentType) { - const buf = Buffer.allocUnsafe(100000); - return Buffer.concat([ - Buffer.from(`\r\n--${BOUNDARY}\r\n`), - Buffer.from(`Content-Disposition: form-data; name="${key}"` - + `; filename="${filename}"\r\n`), - Buffer.from(`Content-Type: ${contentType}\r\n\r\n`), - randomFillSync(buf) - ]); -} - -const reqChunks = [ - Buffer.concat([ - formDataFile('file', 'file.bin', 'application/octet-stream'), - formDataSection('foo', 'foo value'), - ]), - formDataSection('bar', 'bar value'), - Buffer.from(`\r\n--${BOUNDARY}--\r\n`) -]; -const bb = busboy({ - headers: { - 'content-type': `multipart/form-data; boundary=${BOUNDARY}` - } -}); -const expected = [ - { type: 'file', - name: 'file', - info: { - filename: 'file.bin', - encoding: '7bit', - mimeType: 'application/octet-stream', - }, - }, - { type: 'field', - name: 'foo', - val: 'foo value', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, - { type: 'field', - name: 'bar', - val: 'bar value', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, -]; -const results = []; - -bb.on('field', (name, val, info) => { - results.push({ type: 'field', name, val, info }); -}); - -bb.on('file', (name, stream, info) => { - results.push({ type: 'file', name, info }); - // Simulate a pipe where the destination is pausing (perhaps due to waiting - // for file system write to finish) - setTimeout(() => { - stream.resume(); - }, 10); -}); - -bb.on('close', mustCall(() => { - assert.deepStrictEqual( - results, - expected, - 'Results mismatch.\n' - + `Parsed: ${inspect(results)}\n` - + `Expected: ${inspect(expected)}` - ); -})); - -for (const chunk of reqChunks) - bb.write(chunk); -bb.end(); diff --git a/server/node_modules/busboy/test/test-types-multipart.js b/server/node_modules/busboy/test/test-types-multipart.js deleted file mode 100644 index 9755642..0000000 --- a/server/node_modules/busboy/test/test-types-multipart.js +++ /dev/null @@ -1,1053 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { inspect } = require('util'); - -const busboy = require('..'); - -const active = new Map(); - -const tests = [ - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; name="file_name_0"', - '', - 'super alpha file', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; name="file_name_1"', - '', - 'super beta file', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_0"; filename="1k_a.dat"', - 'Content-Type: application/octet-stream', - '', - 'A'.repeat(1023), - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_1"; filename="1k_b.dat"', - 'Content-Type: application/octet-stream', - '', - 'B'.repeat(1023), - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--' - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - expected: [ - { type: 'field', - name: 'file_name_0', - val: 'super alpha file', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, - { type: 'field', - name: 'file_name_1', - val: 'super beta file', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, - { type: 'file', - name: 'upload_file_0', - data: Buffer.from('A'.repeat(1023)), - info: { - filename: '1k_a.dat', - encoding: '7bit', - mimeType: 'application/octet-stream', - }, - limited: false, - }, - { type: 'file', - name: 'upload_file_1', - data: Buffer.from('B'.repeat(1023)), - info: { - filename: '1k_b.dat', - encoding: '7bit', - mimeType: 'application/octet-stream', - }, - limited: false, - }, - ], - what: 'Fields and files' - }, - { source: [ - ['------WebKitFormBoundaryTB2MiQ36fnSJlrhY', - 'Content-Disposition: form-data; name="cont"', - '', - 'some random content', - '------WebKitFormBoundaryTB2MiQ36fnSJlrhY', - 'Content-Disposition: form-data; name="pass"', - '', - 'some random pass', - '------WebKitFormBoundaryTB2MiQ36fnSJlrhY', - 'Content-Disposition: form-data; name=bit', - '', - '2', - '------WebKitFormBoundaryTB2MiQ36fnSJlrhY--' - ].join('\r\n') - ], - boundary: '----WebKitFormBoundaryTB2MiQ36fnSJlrhY', - expected: [ - { type: 'field', - name: 'cont', - val: 'some random content', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, - { type: 'field', - name: 'pass', - val: 'some random pass', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, - { type: 'field', - name: 'bit', - val: '2', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, - ], - what: 'Fields only' - }, - { source: [ - '' - ], - boundary: '----WebKitFormBoundaryTB2MiQ36fnSJlrhY', - expected: [ - { error: 'Unexpected end of form' }, - ], - what: 'No fields and no files' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; name="file_name_0"', - '', - 'super alpha file', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_0"; filename="1k_a.dat"', - 'Content-Type: application/octet-stream', - '', - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--' - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - limits: { - fileSize: 13, - fieldSize: 5 - }, - expected: [ - { type: 'field', - name: 'file_name_0', - val: 'super', - info: { - nameTruncated: false, - valueTruncated: true, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, - { type: 'file', - name: 'upload_file_0', - data: Buffer.from('ABCDEFGHIJKLM'), - info: { - filename: '1k_a.dat', - encoding: '7bit', - mimeType: 'application/octet-stream', - }, - limited: true, - }, - ], - what: 'Fields and files (limits)' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; name="file_name_0"', - '', - 'super alpha file', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_0"; filename="1k_a.dat"', - 'Content-Type: application/octet-stream', - '', - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--' - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - limits: { - files: 0 - }, - expected: [ - { type: 'field', - name: 'file_name_0', - val: 'super alpha file', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, - 'filesLimit', - ], - what: 'Fields and files (limits: 0 files)' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; name="file_name_0"', - '', - 'super alpha file', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; name="file_name_1"', - '', - 'super beta file', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_0"; filename="1k_a.dat"', - 'Content-Type: application/octet-stream', - '', - 'A'.repeat(1023), - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_1"; filename="1k_b.dat"', - 'Content-Type: application/octet-stream', - '', - 'B'.repeat(1023), - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--' - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - expected: [ - { type: 'field', - name: 'file_name_0', - val: 'super alpha file', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, - { type: 'field', - name: 'file_name_1', - val: 'super beta file', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, - ], - events: ['field'], - what: 'Fields and (ignored) files' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_0"; filename="/tmp/1k_a.dat"', - 'Content-Type: application/octet-stream', - '', - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_1"; filename="C:\\files\\1k_b.dat"', - 'Content-Type: application/octet-stream', - '', - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_2"; filename="relative/1k_c.dat"', - 'Content-Type: application/octet-stream', - '', - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--' - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - expected: [ - { type: 'file', - name: 'upload_file_0', - data: Buffer.from('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), - info: { - filename: '1k_a.dat', - encoding: '7bit', - mimeType: 'application/octet-stream', - }, - limited: false, - }, - { type: 'file', - name: 'upload_file_1', - data: Buffer.from('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), - info: { - filename: '1k_b.dat', - encoding: '7bit', - mimeType: 'application/octet-stream', - }, - limited: false, - }, - { type: 'file', - name: 'upload_file_2', - data: Buffer.from('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), - info: { - filename: '1k_c.dat', - encoding: '7bit', - mimeType: 'application/octet-stream', - }, - limited: false, - }, - ], - what: 'Files with filenames containing paths' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_0"; filename="/absolute/1k_a.dat"', - 'Content-Type: application/octet-stream', - '', - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_1"; filename="C:\\absolute\\1k_b.dat"', - 'Content-Type: application/octet-stream', - '', - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_2"; filename="relative/1k_c.dat"', - 'Content-Type: application/octet-stream', - '', - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--' - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - preservePath: true, - expected: [ - { type: 'file', - name: 'upload_file_0', - data: Buffer.from('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), - info: { - filename: '/absolute/1k_a.dat', - encoding: '7bit', - mimeType: 'application/octet-stream', - }, - limited: false, - }, - { type: 'file', - name: 'upload_file_1', - data: Buffer.from('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), - info: { - filename: 'C:\\absolute\\1k_b.dat', - encoding: '7bit', - mimeType: 'application/octet-stream', - }, - limited: false, - }, - { type: 'file', - name: 'upload_file_2', - data: Buffer.from('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), - info: { - filename: 'relative/1k_c.dat', - encoding: '7bit', - mimeType: 'application/octet-stream', - }, - limited: false, - }, - ], - what: 'Paths to be preserved through the preservePath option' - }, - { source: [ - ['------WebKitFormBoundaryTB2MiQ36fnSJlrhY', - 'Content-Disposition: form-data; name="cont"', - 'Content-Type: ', - '', - 'some random content', - '------WebKitFormBoundaryTB2MiQ36fnSJlrhY', - 'Content-Disposition: ', - '', - 'some random pass', - '------WebKitFormBoundaryTB2MiQ36fnSJlrhY--' - ].join('\r\n') - ], - boundary: '----WebKitFormBoundaryTB2MiQ36fnSJlrhY', - expected: [ - { type: 'field', - name: 'cont', - val: 'some random content', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, - ], - what: 'Empty content-type and empty content-disposition' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="file"; filename*=utf-8\'\'n%C3%A4me.txt', - 'Content-Type: application/octet-stream', - '', - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--' - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - expected: [ - { type: 'file', - name: 'file', - data: Buffer.from('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), - info: { - filename: 'näme.txt', - encoding: '7bit', - mimeType: 'application/octet-stream', - }, - limited: false, - }, - ], - what: 'Unicode filenames' - }, - { source: [ - ['--asdasdasdasd\r\n', - 'Content-Type: text/plain\r\n', - 'Content-Disposition: form-data; name="foo"\r\n', - '\r\n', - 'asd\r\n', - '--asdasdasdasd--' - ].join(':)') - ], - boundary: 'asdasdasdasd', - expected: [ - { error: 'Malformed part header' }, - { error: 'Unexpected end of form' }, - ], - what: 'Stopped mid-header' - }, - { source: [ - ['------WebKitFormBoundaryTB2MiQ36fnSJlrhY', - 'Content-Disposition: form-data; name="cont"', - 'Content-Type: application/json', - '', - '{}', - '------WebKitFormBoundaryTB2MiQ36fnSJlrhY--', - ].join('\r\n') - ], - boundary: '----WebKitFormBoundaryTB2MiQ36fnSJlrhY', - expected: [ - { type: 'field', - name: 'cont', - val: '{}', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'application/json', - }, - }, - ], - what: 'content-type for fields' - }, - { source: [ - '------WebKitFormBoundaryTB2MiQ36fnSJlrhY--', - ], - boundary: '----WebKitFormBoundaryTB2MiQ36fnSJlrhY', - expected: [], - what: 'empty form' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name=upload_file_0; filename="1k_a.dat"', - 'Content-Type: application/octet-stream', - 'Content-Transfer-Encoding: binary', - '', - '', - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - expected: [ - { type: 'file', - name: 'upload_file_0', - data: Buffer.alloc(0), - info: { - filename: '1k_a.dat', - encoding: 'binary', - mimeType: 'application/octet-stream', - }, - limited: false, - err: 'Unexpected end of form', - }, - { error: 'Unexpected end of form' }, - ], - what: 'Stopped mid-file #1' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name=upload_file_0; filename="1k_a.dat"', - 'Content-Type: application/octet-stream', - '', - 'a', - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - expected: [ - { type: 'file', - name: 'upload_file_0', - data: Buffer.from('a'), - info: { - filename: '1k_a.dat', - encoding: '7bit', - mimeType: 'application/octet-stream', - }, - limited: false, - err: 'Unexpected end of form', - }, - { error: 'Unexpected end of form' }, - ], - what: 'Stopped mid-file #2' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_0"; filename="notes.txt"', - 'Content-Type: text/plain; charset=utf8', - '', - 'a', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--', - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - expected: [ - { type: 'file', - name: 'upload_file_0', - data: Buffer.from('a'), - info: { - filename: 'notes.txt', - encoding: '7bit', - mimeType: 'text/plain', - }, - limited: false, - }, - ], - what: 'Text file with charset' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_0"; filename="notes.txt"', - 'Content-Type: ', - ' text/plain; charset=utf8', - '', - 'a', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--', - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - expected: [ - { type: 'file', - name: 'upload_file_0', - data: Buffer.from('a'), - info: { - filename: 'notes.txt', - encoding: '7bit', - mimeType: 'text/plain', - }, - limited: false, - }, - ], - what: 'Folded header value' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Type: text/plain; charset=utf8', - '', - 'a', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--', - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - expected: [], - what: 'No Content-Disposition' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; name="file_name_0"', - '', - 'a'.repeat(64 * 1024), - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_0"; filename="notes.txt"', - 'Content-Type: ', - ' text/plain; charset=utf8', - '', - 'bc', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--', - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - limits: { - fieldSize: Infinity, - }, - expected: [ - { type: 'file', - name: 'upload_file_0', - data: Buffer.from('bc'), - info: { - filename: 'notes.txt', - encoding: '7bit', - mimeType: 'text/plain', - }, - limited: false, - }, - ], - events: [ 'file' ], - what: 'Skip field parts if no listener' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; name="file_name_0"', - '', - 'a', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_0"; filename="notes.txt"', - 'Content-Type: ', - ' text/plain; charset=utf8', - '', - 'bc', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--', - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - limits: { - parts: 1, - }, - expected: [ - { type: 'field', - name: 'file_name_0', - val: 'a', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, - 'partsLimit', - ], - what: 'Parts limit' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; name="file_name_0"', - '', - 'a', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; name="file_name_1"', - '', - 'b', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--', - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - limits: { - fields: 1, - }, - expected: [ - { type: 'field', - name: 'file_name_0', - val: 'a', - info: { - nameTruncated: false, - valueTruncated: false, - encoding: '7bit', - mimeType: 'text/plain', - }, - }, - 'fieldsLimit', - ], - what: 'Fields limit' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_0"; filename="notes.txt"', - 'Content-Type: text/plain; charset=utf8', - '', - 'ab', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_1"; filename="notes2.txt"', - 'Content-Type: text/plain; charset=utf8', - '', - 'cd', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--', - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - limits: { - files: 1, - }, - expected: [ - { type: 'file', - name: 'upload_file_0', - data: Buffer.from('ab'), - info: { - filename: 'notes.txt', - encoding: '7bit', - mimeType: 'text/plain', - }, - limited: false, - }, - 'filesLimit', - ], - what: 'Files limit' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + `name="upload_file_0"; filename="${'a'.repeat(64 * 1024)}.txt"`, - 'Content-Type: text/plain; charset=utf8', - '', - 'ab', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_1"; filename="notes2.txt"', - 'Content-Type: text/plain; charset=utf8', - '', - 'cd', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--', - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - expected: [ - { error: 'Malformed part header' }, - { type: 'file', - name: 'upload_file_1', - data: Buffer.from('cd'), - info: { - filename: 'notes2.txt', - encoding: '7bit', - mimeType: 'text/plain', - }, - limited: false, - }, - ], - what: 'Oversized part header' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + 'name="upload_file_0"; filename="notes.txt"', - 'Content-Type: text/plain; charset=utf8', - '', - 'a'.repeat(31) + '\r', - ].join('\r\n'), - 'b'.repeat(40), - '\r\n-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--', - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - fileHwm: 32, - expected: [ - { type: 'file', - name: 'upload_file_0', - data: Buffer.from('a'.repeat(31) + '\r' + 'b'.repeat(40)), - info: { - filename: 'notes.txt', - encoding: '7bit', - mimeType: 'text/plain', - }, - limited: false, - }, - ], - what: 'Lookbehind data should not stall file streams' - }, - { source: [ - ['-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + `name="upload_file_0"; filename="${'a'.repeat(8 * 1024)}.txt"`, - 'Content-Type: text/plain; charset=utf8', - '', - 'ab', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + `name="upload_file_1"; filename="${'b'.repeat(8 * 1024)}.txt"`, - 'Content-Type: text/plain; charset=utf8', - '', - 'cd', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - 'Content-Disposition: form-data; ' - + `name="upload_file_2"; filename="${'c'.repeat(8 * 1024)}.txt"`, - 'Content-Type: text/plain; charset=utf8', - '', - 'ef', - '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--', - ].join('\r\n') - ], - boundary: '---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k', - expected: [ - { type: 'file', - name: 'upload_file_0', - data: Buffer.from('ab'), - info: { - filename: `${'a'.repeat(8 * 1024)}.txt`, - encoding: '7bit', - mimeType: 'text/plain', - }, - limited: false, - }, - { type: 'file', - name: 'upload_file_1', - data: Buffer.from('cd'), - info: { - filename: `${'b'.repeat(8 * 1024)}.txt`, - encoding: '7bit', - mimeType: 'text/plain', - }, - limited: false, - }, - { type: 'file', - name: 'upload_file_2', - data: Buffer.from('ef'), - info: { - filename: `${'c'.repeat(8 * 1024)}.txt`, - encoding: '7bit', - mimeType: 'text/plain', - }, - limited: false, - }, - ], - what: 'Header size limit should be per part' - }, - { source: [ - '\r\n--d1bf46b3-aa33-4061-b28d-6c5ced8b08ee\r\n', - 'Content-Type: application/gzip\r\n' - + 'Content-Encoding: gzip\r\n' - + 'Content-Disposition: form-data; name=batch-1; filename=batch-1' - + '\r\n\r\n', - '\r\n--d1bf46b3-aa33-4061-b28d-6c5ced8b08ee--', - ], - boundary: 'd1bf46b3-aa33-4061-b28d-6c5ced8b08ee', - expected: [ - { type: 'file', - name: 'batch-1', - data: Buffer.alloc(0), - info: { - filename: 'batch-1', - encoding: '7bit', - mimeType: 'application/gzip', - }, - limited: false, - }, - ], - what: 'Empty part' - }, -]; - -for (const test of tests) { - active.set(test, 1); - - const { what, boundary, events, limits, preservePath, fileHwm } = test; - const bb = busboy({ - fileHwm, - limits, - preservePath, - headers: { - 'content-type': `multipart/form-data; boundary=${boundary}`, - } - }); - const results = []; - - if (events === undefined || events.includes('field')) { - bb.on('field', (name, val, info) => { - results.push({ type: 'field', name, val, info }); - }); - } - - if (events === undefined || events.includes('file')) { - bb.on('file', (name, stream, info) => { - const data = []; - let nb = 0; - const file = { - type: 'file', - name, - data: null, - info, - limited: false, - }; - results.push(file); - stream.on('data', (d) => { - data.push(d); - nb += d.length; - }).on('limit', () => { - file.limited = true; - }).on('close', () => { - file.data = Buffer.concat(data, nb); - assert.strictEqual(stream.truncated, file.limited); - }).once('error', (err) => { - file.err = err.message; - }); - }); - } - - bb.on('error', (err) => { - results.push({ error: err.message }); - }); - - bb.on('partsLimit', () => { - results.push('partsLimit'); - }); - - bb.on('filesLimit', () => { - results.push('filesLimit'); - }); - - bb.on('fieldsLimit', () => { - results.push('fieldsLimit'); - }); - - bb.on('close', () => { - active.delete(test); - - assert.deepStrictEqual( - results, - test.expected, - `[${what}] Results mismatch.\n` - + `Parsed: ${inspect(results)}\n` - + `Expected: ${inspect(test.expected)}` - ); - }); - - for (const src of test.source) { - const buf = (typeof src === 'string' ? Buffer.from(src, 'utf8') : src); - bb.write(buf); - } - bb.end(); -} - -// Byte-by-byte versions -for (let test of tests) { - test = { ...test }; - test.what += ' (byte-by-byte)'; - active.set(test, 1); - - const { what, boundary, events, limits, preservePath, fileHwm } = test; - const bb = busboy({ - fileHwm, - limits, - preservePath, - headers: { - 'content-type': `multipart/form-data; boundary=${boundary}`, - } - }); - const results = []; - - if (events === undefined || events.includes('field')) { - bb.on('field', (name, val, info) => { - results.push({ type: 'field', name, val, info }); - }); - } - - if (events === undefined || events.includes('file')) { - bb.on('file', (name, stream, info) => { - const data = []; - let nb = 0; - const file = { - type: 'file', - name, - data: null, - info, - limited: false, - }; - results.push(file); - stream.on('data', (d) => { - data.push(d); - nb += d.length; - }).on('limit', () => { - file.limited = true; - }).on('close', () => { - file.data = Buffer.concat(data, nb); - assert.strictEqual(stream.truncated, file.limited); - }).once('error', (err) => { - file.err = err.message; - }); - }); - } - - bb.on('error', (err) => { - results.push({ error: err.message }); - }); - - bb.on('partsLimit', () => { - results.push('partsLimit'); - }); - - bb.on('filesLimit', () => { - results.push('filesLimit'); - }); - - bb.on('fieldsLimit', () => { - results.push('fieldsLimit'); - }); - - bb.on('close', () => { - active.delete(test); - - assert.deepStrictEqual( - results, - test.expected, - `[${what}] Results mismatch.\n` - + `Parsed: ${inspect(results)}\n` - + `Expected: ${inspect(test.expected)}` - ); - }); - - for (const src of test.source) { - const buf = (typeof src === 'string' ? Buffer.from(src, 'utf8') : src); - for (let i = 0; i < buf.length; ++i) - bb.write(buf.slice(i, i + 1)); - } - bb.end(); -} - -{ - let exception = false; - process.once('uncaughtException', (ex) => { - exception = true; - throw ex; - }); - process.on('exit', () => { - if (exception || active.size === 0) - return; - process.exitCode = 1; - console.error('=========================='); - console.error(`${active.size} test(s) did not finish:`); - console.error('=========================='); - console.error(Array.from(active.keys()).map((v) => v.what).join('\n')); - }); -} diff --git a/server/node_modules/busboy/test/test-types-urlencoded.js b/server/node_modules/busboy/test/test-types-urlencoded.js deleted file mode 100644 index c35962b..0000000 --- a/server/node_modules/busboy/test/test-types-urlencoded.js +++ /dev/null @@ -1,488 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { transcode } = require('buffer'); -const { inspect } = require('util'); - -const busboy = require('..'); - -const active = new Map(); - -const tests = [ - { source: ['foo'], - expected: [ - ['foo', - '', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Unassigned value' - }, - { source: ['foo=bar'], - expected: [ - ['foo', - 'bar', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Assigned value' - }, - { source: ['foo&bar=baz'], - expected: [ - ['foo', - '', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ['bar', - 'baz', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Unassigned and assigned value' - }, - { source: ['foo=bar&baz'], - expected: [ - ['foo', - 'bar', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ['baz', - '', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Assigned and unassigned value' - }, - { source: ['foo=bar&baz=bla'], - expected: [ - ['foo', - 'bar', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ['baz', - 'bla', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Two assigned values' - }, - { source: ['foo&bar'], - expected: [ - ['foo', - '', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ['bar', - '', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Two unassigned values' - }, - { source: ['foo&bar&'], - expected: [ - ['foo', - '', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ['bar', - '', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Two unassigned values and ampersand' - }, - { source: ['foo+1=bar+baz%2Bquux'], - expected: [ - ['foo 1', - 'bar baz+quux', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Assigned key and value with (plus) space' - }, - { source: ['foo=bar%20baz%21'], - expected: [ - ['foo', - 'bar baz!', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Assigned value with encoded bytes' - }, - { source: ['foo%20bar=baz%20bla%21'], - expected: [ - ['foo bar', - 'baz bla!', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Assigned value with encoded bytes #2' - }, - { source: ['foo=bar%20baz%21&num=1000'], - expected: [ - ['foo', - 'bar baz!', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ['num', - '1000', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Two assigned values, one with encoded bytes' - }, - { source: [ - Array.from(transcode(Buffer.from('foo'), 'utf8', 'utf16le')).map( - (n) => `%${n.toString(16).padStart(2, '0')}` - ).join(''), - '=', - Array.from(transcode(Buffer.from('😀!'), 'utf8', 'utf16le')).map( - (n) => `%${n.toString(16).padStart(2, '0')}` - ).join(''), - ], - expected: [ - ['foo', - '😀!', - { nameTruncated: false, - valueTruncated: false, - encoding: 'UTF-16LE', - mimeType: 'text/plain' }, - ], - ], - charset: 'UTF-16LE', - what: 'Encoded value with multi-byte charset' - }, - { source: [ - 'foo=<', - Array.from(transcode(Buffer.from('©:^þ'), 'utf8', 'latin1')).map( - (n) => `%${n.toString(16).padStart(2, '0')}` - ).join(''), - ], - expected: [ - ['foo', - '<©:^þ', - { nameTruncated: false, - valueTruncated: false, - encoding: 'ISO-8859-1', - mimeType: 'text/plain' }, - ], - ], - charset: 'ISO-8859-1', - what: 'Encoded value with single-byte, ASCII-compatible, non-UTF8 charset' - }, - { source: ['foo=bar&baz=bla'], - expected: [], - what: 'Limits: zero fields', - limits: { fields: 0 } - }, - { source: ['foo=bar&baz=bla'], - expected: [ - ['foo', - 'bar', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Limits: one field', - limits: { fields: 1 } - }, - { source: ['foo=bar&baz=bla'], - expected: [ - ['foo', - 'bar', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ['baz', - 'bla', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Limits: field part lengths match limits', - limits: { fieldNameSize: 3, fieldSize: 3 } - }, - { source: ['foo=bar&baz=bla'], - expected: [ - ['fo', - 'bar', - { nameTruncated: true, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ['ba', - 'bla', - { nameTruncated: true, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Limits: truncated field name', - limits: { fieldNameSize: 2 } - }, - { source: ['foo=bar&baz=bla'], - expected: [ - ['foo', - 'ba', - { nameTruncated: false, - valueTruncated: true, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ['baz', - 'bl', - { nameTruncated: false, - valueTruncated: true, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Limits: truncated field value', - limits: { fieldSize: 2 } - }, - { source: ['foo=bar&baz=bla'], - expected: [ - ['fo', - 'ba', - { nameTruncated: true, - valueTruncated: true, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ['ba', - 'bl', - { nameTruncated: true, - valueTruncated: true, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Limits: truncated field name and value', - limits: { fieldNameSize: 2, fieldSize: 2 } - }, - { source: ['foo=bar&baz=bla'], - expected: [ - ['fo', - '', - { nameTruncated: true, - valueTruncated: true, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ['ba', - '', - { nameTruncated: true, - valueTruncated: true, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Limits: truncated field name and zero value limit', - limits: { fieldNameSize: 2, fieldSize: 0 } - }, - { source: ['foo=bar&baz=bla'], - expected: [ - ['', - '', - { nameTruncated: true, - valueTruncated: true, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ['', - '', - { nameTruncated: true, - valueTruncated: true, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Limits: truncated zero field name and zero value limit', - limits: { fieldNameSize: 0, fieldSize: 0 } - }, - { source: ['&'], - expected: [], - what: 'Ampersand' - }, - { source: ['&&&&&'], - expected: [], - what: 'Many ampersands' - }, - { source: ['='], - expected: [ - ['', - '', - { nameTruncated: false, - valueTruncated: false, - encoding: 'utf-8', - mimeType: 'text/plain' }, - ], - ], - what: 'Assigned value, empty name and value' - }, - { source: [''], - expected: [], - what: 'Nothing' - }, -]; - -for (const test of tests) { - active.set(test, 1); - - const { what } = test; - const charset = test.charset || 'utf-8'; - const bb = busboy({ - limits: test.limits, - headers: { - 'content-type': `application/x-www-form-urlencoded; charset=${charset}`, - }, - }); - const results = []; - - bb.on('field', (key, val, info) => { - results.push([key, val, info]); - }); - - bb.on('file', () => { - throw new Error(`[${what}] Unexpected file`); - }); - - bb.on('close', () => { - active.delete(test); - - assert.deepStrictEqual( - results, - test.expected, - `[${what}] Results mismatch.\n` - + `Parsed: ${inspect(results)}\n` - + `Expected: ${inspect(test.expected)}` - ); - }); - - for (const src of test.source) { - const buf = (typeof src === 'string' ? Buffer.from(src, 'utf8') : src); - bb.write(buf); - } - bb.end(); -} - -// Byte-by-byte versions -for (let test of tests) { - test = { ...test }; - test.what += ' (byte-by-byte)'; - active.set(test, 1); - - const { what } = test; - const charset = test.charset || 'utf-8'; - const bb = busboy({ - limits: test.limits, - headers: { - 'content-type': `application/x-www-form-urlencoded; charset="${charset}"`, - }, - }); - const results = []; - - bb.on('field', (key, val, info) => { - results.push([key, val, info]); - }); - - bb.on('file', () => { - throw new Error(`[${what}] Unexpected file`); - }); - - bb.on('close', () => { - active.delete(test); - - assert.deepStrictEqual( - results, - test.expected, - `[${what}] Results mismatch.\n` - + `Parsed: ${inspect(results)}\n` - + `Expected: ${inspect(test.expected)}` - ); - }); - - for (const src of test.source) { - const buf = (typeof src === 'string' ? Buffer.from(src, 'utf8') : src); - for (let i = 0; i < buf.length; ++i) - bb.write(buf.slice(i, i + 1)); - } - bb.end(); -} - -{ - let exception = false; - process.once('uncaughtException', (ex) => { - exception = true; - throw ex; - }); - process.on('exit', () => { - if (exception || active.size === 0) - return; - process.exitCode = 1; - console.error('=========================='); - console.error(`${active.size} test(s) did not finish:`); - console.error('=========================='); - console.error(Array.from(active.keys()).map((v) => v.what).join('\n')); - }); -} diff --git a/server/node_modules/busboy/test/test.js b/server/node_modules/busboy/test/test.js deleted file mode 100644 index d0380f2..0000000 --- a/server/node_modules/busboy/test/test.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -const { spawnSync } = require('child_process'); -const { readdirSync } = require('fs'); -const { join } = require('path'); - -const files = readdirSync(__dirname).sort(); -for (const filename of files) { - if (filename.startsWith('test-')) { - const path = join(__dirname, filename); - console.log(`> Running ${filename} ...`); - const result = spawnSync(`${process.argv0} ${path}`, { - shell: true, - stdio: 'inherit', - windowsHide: true - }); - if (result.status !== 0) - process.exitCode = 1; - } -} diff --git a/server/node_modules/bytes/History.md b/server/node_modules/bytes/History.md deleted file mode 100644 index d60ce0e..0000000 --- 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 63e95a9..0000000 --- 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 5790e23..0000000 --- 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 6f2d0f8..0000000 --- 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 f2b6a8b..0000000 --- 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 201e859..0000000 --- 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 0011e9d..0000000 --- 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 bdd626c..0000000 --- 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 2484942..0000000 --- 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 f82f389..0000000 --- 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 8fc0dae..0000000 --- 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 b87286a..0000000 --- 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 ffa5135..0000000 --- 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 d176c1a..0000000 --- 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 d2b7723..0000000 --- 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 1f6e11b..0000000 --- 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 c71df9c..0000000 --- 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 15e93df..0000000 --- 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 7a8d873..0000000 --- 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 541516b..0000000 --- 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 2f6dab4..0000000 --- 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 923b8be..0000000 --- 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 6b2ae76..0000000 --- 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 3d03caa..0000000 --- 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 1cdc89e..0000000 --- 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 aef9993..0000000 --- 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 2612ed8..0000000 --- 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 2a2a135..0000000 --- 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 bdd626c..0000000 --- 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 8bde4e9..0000000 --- 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 f82f389..0000000 --- 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 a44e43e..0000000 --- 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 5562f00..0000000 --- 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 e9ade74..0000000 --- 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 d542db4..0000000 --- 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 a2fc9f0..0000000 --- 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 8976d98..0000000 --- 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/cloudinary/CHANGELOG.md b/server/node_modules/cloudinary/CHANGELOG.md deleted file mode 100644 index bceaa8f..0000000 --- a/server/node_modules/cloudinary/CHANGELOG.md +++ /dev/null @@ -1,1040 +0,0 @@ -2.7.0 / 2025-06-18 -================== - -* fix: prevent parameter injection via ampersand in parameter values (#709) - -2.6.1 / 2025-05-05 -================== - - - -2.6.1-rc.1 / 2025-05-05 -================== - -* fix: uploader interface - -2.6.0 / 2025-03-11 -================== - - * chore: bumped jsdoc - * fix: defaults for related asset methods and proper content_type - * chore: Updated Sample Projects (#698) - * fix: metadata field datasource type (#693) - * feat: Add support for DELETE /resources/backup/:asset_id (#700) - * chore: dev dependencies cleanup - * chore: new node version support in CI - -2.5.1 / 2024-10-08 -================== - -* fix: added missing stream method to ts spec - -2.5.0 / 2024-09-15 -================== - -* feat: auto_transcription on upload and explicit support (#690) -* feat: auto_chaptering on upload and explicit support (#689) -* feat: access key management via provisioning api (#687) - -2.4.0 / 2024-07-30 -================== - -* feat: exposing config endpoint from admin api -* fix: update metadata field added missing param default_disabled -* fix: types definitions - - -2.3.1 / 2024-07-25 -================== - -* fix: use 0.0.0 as fallback when package.json unavailable -* fix: upload_chunked_stream works properly with more than 2 chunks - -2.3.0 / 2024-07-16 -================== - - * fix: url analytics property name - * fix: dependencies explicit version (fix for CI) - * fix: decoding transformation string before sending in upload payload - * feat: update folders - -2.2.0 / 2024-04-22 -================== - -* feat: selective response for admin and search api -* feat: multiple values support for fields and with_field methods in search api - -2.1.0 / 2024-03-29 -================== - - * feat: added support for new api in beta - analyze api - * chore: added state to datasource entry type - * fix: metadata field api response datasource type improved - * feat: notification-url for rename and destroy methods - -2.0.3 / 2024-03-05 -================== - -* fix: file and field encoding fixed for next.js production build - -2.0.2 / 2024-03-01 -================== - -* fix: custom regions - -2.0.1 / 2024-02-07 -================== - - * fix: search expression not required - * chore: proxy-agent not needed any more - * chore: cleanup - * feat: supporting new analytics options, changed analytics algorithm - -2.0.0 / 2024-01-29 -================== - - - -2.0.0-rc.1 / 2024-01-18 -================== - - - -2.0.0-rc / 2024-01-08 -================== - -* feat!: secure option from config set to true by default -* feat!: url analytics enabled by default -* feat!: dropped Node@6 and Node@8 - -1.41.1 / 2023-12-18 -================== - - * fix: sending restrictions when creating or updating metadata fields - -1.41.0 / 2023-09-26 -================== - -* fix: improved calculation of the signature in url -* fix: improved ResourceApiResponse interface -* fix: fetch overlay video creates correct transformation -* feat: added support for on_success script for uploader_spec.js - -1.40.0 / 2023-07-31 -================== - -* feat: visual search api -* fix: adding clear_invalid only when not null - -1.39.0 / 2023-07-24 -================== - -* feat: basic asset relations api - -1.38.0 / 2023-07-20 -================== - - * feat: new method to_url added to support cached search feature - -1.37.3 / 2023-06-26 -================== - -* fix: native http agent used instead of an external dependency - -1.37.2 / 2023-06-19 -================== - -* chore: bumped npm override for vm2 to latest - -1.37.1 / 2023-06-09 -================== - - * chore: removing ts installed with dtslint to prevent fails on older node.js - * fix: only explicit require used - * fix: upgrade core-js from 3.30.1 to 3.30.2 - -1.37.0 / 2023-05-16 -================== - -* feat: exposing structured metadata rules api - -1.36.4 / 2023-05-02 -================== - -fix: isRemoteUrl check improved to reduce false positives - -1.36.3 / 2023-05-02 -================== - - * fix: smd number field allows both numbers and string when uploading - * fix: isRemoteUrl not working on big files sometimes - -1.36.2 / 2023-04-24 -================== - -fix: bumped vm2 override to latest - -1.36.1 / 2023-04-13 -================== - -chore: overriding vulnerable transitive dependency - -1.36.0 / 2023-04-13 -================== - -* feat: add support for `media_metadata` param for `upload` and `explicit` -* feat: passing context and metadata when using rename - -1.35.0 / 2023-03-03 -================== - - * fix: removing nested nulls from options passed to api, closes #581 - * feat: add option to configure tracked analytics - -1.34.0 / 2023-02-13 -================== - - * fix: resource_type is not optional - * feat: search for folders - * feat: support for extra_headers in upload request - -1.33.0 / 2022-12-15 -================== - - * feat: start and end offset normalized in a transformation string - * feat: new config option for hiding sensitive data when logging errors - * feat: multiple ACLs for generate_auth_token - * fix: improved TS typing - -1.32.0 / 2022-09-14 -================== - -* Add dynamic folder feature (#559) - - -1.31.0 / 2022-08-28 -================== - - * Update core-js package (#558) - * Add download_backedup_asset typings (#557) - - -1.30.1 / 2022-07-21 -================== - -* Bump lodash version to 4.17.21 (#551) -* Add types for verifyNotificationSignature (#555) - - -1.30.0 / 2022-05-15 -================== - - * Add filename_override option to types (#548) - - -1.29.1 / 2022-04-17 -================== - - * Fix support of the lowercase response headers (#545) - * Fix tags function type definition (#544) - - -1.29.0 / 2022-03-24 -================== - -New functionality ------------------ -* Add support for `resources_by_asset_ids` Admin API (#529) -* Add support for `reorder_metadata_fields` Admin API (#526) - -Other changes ------------------ - * bump bson version (#541) - * bumbed ejs version in photo_album (#540) - * Add Travis configuration for node 16 (#535) - * Stabilize OCR tests (#533) - * update README (#528) - * Stabilize metadata tests (#530) - - -1.28.1 / 2022-01-06 -================== - -* Bump proxy-agent version to ^5.0.0 due to vulnerability - -1.28.0 / 2022-01-02 -================== - -New functionality ------------------ - * Add support for folder decoupling (#523) - * Add support for `resource_by_asset_id` Admin API (#522) - * Add proxy support (#518) - -Other changes ------------------ - * Add tests for expression normalization (#521) - -1.27.1 / 2021-10-11 -================== - - * Add node version to user agent (#519) - - -1.27.0 / 2021-09-12 -================== - -* Fix: `verifyNotificationSignature` timestamps are in seconds (#515) - * Allow multi and sprite with urls, add download_generated_sprite and download_multi methods (#493) - * Prevent preview:duration from being normalized (#513) - * Prevent duplicate search fields in search api (#510) - * Add support for create_slideshow Upload API (#508) - * Add support for variables in text style (#507) - - -1.26.3 / 2021-08-01 -================== - - * Add update_metada type to upload api (#500) - * Return structured metadata in resources APIs (#503) - -1.26.2 / 2021-07-04 -================== - - * fixed font_family encoding (#498) - - -1.26.1 / 2021-06-22 -================== - - * updated sent upload params (#497) - * Improve the return type of cloudinary.v2.config() in TypeScript (#494) - - -1.26.0 / 2021-06-06 -================== - -Add support for oauth authorization (#489) - - -1.25.2 / 2021-05-30 -================== - -Other Changes - * Fix - Remove file extensions from require statements (#490) - * Fix - Add support for complex variable names (aheight) (#488) - * Fix - #486 - upload_prefix configuration retrieval (#487) - - - -1.25.1 / 2021-03-22 -================== - - * Fix/unhandled promise rejection call api (#481) - * Fix return type of api_url function(return String instead of Promise) (#483) - * Add SHA-256 support for auth signatures (#479) - -1.25.0 / 2021-02-22 -================== - -New functionality ------------------ -* Add sort by metadata field (#474) -* Add filename override param (#471) - -Other changes -------------- -* Add safe base64 to all url generation (#477) -* Fix config backup in sign requests test (#476) -* Add missing types to create/delete_folder and private_download_url (#473) -* Add validation to genreate_auth_token to enforce url or acl (#472) - - - - 1.24.0 / 2021-01-31 -============= - -New functionality and features ------------------------------- - * Add `accessibility_analysis` parameter support (#463) - * Add support for date parameter in usage API (#467) - -Other Changes -------------- - * Change test for `eval` upload parameter (#468) - * Update docstring for normalize_expression (#461) - * Fix secure_distribution has type (#462) - * Remove unused parameter from archive_params (#454) - * Fix type of generate_auth_token options (#448) - * Set the provisioning API config as optional (#451) - * Encode all URI components when building a URL in base_api_url() (#447) - * Generate url-safe base64 strings in remote custom functions (#446) - -1.23.0 / 2020-08-26 -=================== -New functionality and features ------------------------------- -* Add support for pending, prefix, and sub_account_id to users method (#417) -* Add support for metadata array value (#433) -* Detect data URLs with suffix in mime type (#418) -* Add support for download backedup asset function (#415) -* Add support `max_results` and `next_cursor` in `root_folders` and `sub_folders` (#411) -* Add download_folder method (#404) - -Other Changes -------------- -* Added linter rules (#423) -* Fix docstring for pending parameter of the users method (#436) -* Fix invalid detection failing test (#439) -* Test: Ignore URL in AuthToken generation if ACL is provided (#431) -* Add pull_request_template.md (#435) -* Fix and improve docstring for download_folder() (#434) -* Refactor `pickOnlyExistingValues()` function (#432) -* Add tests for new OCR features (#385) - - -1.22.0 / 2020-06-08 -================== - - -New functionality and features ------------------------------- - * Feature encode sdk version (#371) - * Add support for cinemagraph_analysis parameter in upload, explicit, and resource (#391) - * Support for creating folders using Admin API (#370) - * Add support for pow operator in expressions (#386) - * Feature/support download backup version api (#380) - * Fix normalize_expression when variable is named like a keyword (e.g., ) (#367) - * Add support for 32 char SHA-256 signatures (#368) - - Other Changes - ------------- - * Add missing types for sign-request (#398) - * Add deprecation warning for node 6, add tests for node 14 (#389) - * Add linter (#388) - * Fix incorrect text implementation for list resources(#382) - * Update issue templates (#365) - - - - - - -1.21.0 / 2020-03-29 -================== - -New functionality and features ------------------------------- - * Add types for Structured Metadata functions (#359) - * Added types for upload response callback (#360) - * Updated promise types for resources methods (#358) - -Other Changes -------------- - * Add back to responses sent from Admin API (#361) - * Align all structured metadata tests with reference implementation (#351) - * Improve provisioning api tests (#354) - * Refactor in a wait period for eager uploads (#355) - - -1.20.0 / 2020-03-11 -================== - -New functionality and features ------------------------------- - * Add support for sources in video tag (#265) - * Add support multiple resource_types in ZIP generation (#348) - * Add API support for account/provisioning (#343) - * Add filename options (#273) - * Add use_filename option (#274) - * Support quality_override param for update and explicit api (#242) - - Other Changes - ------------- - * Refactor out a duplicate test (#353) - * Refactor the order of the assertions in account_spec (#352) - * Fix type defs for stream upload methods (#336) - * Remove typings spec and config from npm package - * Add automation to delete the es5-lib dir when npm run compile is run - * Move typescript to devDependencies and update version - * Refactor out utils functions - -1.19.0 / 2020-01-20 -================== - -New functionality and features ------------------------------- - * Add structured metadata support - * Add verifyNotificationSignature() - -Other Changes -------------- - * Fix isRemoteUrl to correctly detect docx files - * Fix named transformations with spaces - * Fix/fixed type def for upload stream - * Add name to errors in uploader.js - -1.18.1 / 2019-12-11 -================== - -* Fix acl and url escaping in auth_token generation - -1.18.0 / 2019-12-09 -=================== - - New functionality - ----------------- - * Add live parameter to create_upload_preset and update_upload_preset - - Other changes - ------------- - * Fixed tests on Utils and Cloudinary_spec and removed a duplicate one - - -1.17.0 / 2019-11-11 -=================== - - * Update ejs dependency in photo album - * Add Type Script declaration file - -1.16.0 / 2019-10-15 -=================== - - * Support different radius for each corner (containing images and overlays) (#260) - * Add feature to allow override on timestamp and signature (#295) - * remove package-lock (#303) - * Fixed open linting issues (#279) - * Feature/publish script (#289) - * Fix parameters sent when creating a text image (#298) - * Add custom pre function support (#302) - * Escape quotes in HTML attributes (#259) - -1.15.0 / 2019-09-08 -=================== - -New functionality ------------------ - -* Add 'derived_next_resource' to api.resource method -* Add support for 'delete folder' API -* Add support for remote/local function invocation (fn:remote and fn:wasm) (#261) -* Add antialiasing and hinting -* Add `force_version` transformation parameterAdd automatic JavaScript linting and fix existing code conflicts (#262) -* Add automatic JavaScript linting and fix existing code conflicts (#262) - -Other changes -------------- - * Mock upload preset listing test - * Feature/duration to condition video - * Update test for change moderation status - * Simplified error assertions in a few test specs - * Fix base64 URL validation - * Rearrange util tests - * Test support of `async` option in explicit api - * Remove unnecessary return statements and options from tests - * Remove unnecessary use of options and API in access_control_spec.js - * Merge pull request #239 from tornqvist/remove-coffeescript-transform - * Remove coffee script deps and transform - -1.14.0 / 2019-03-26 -=================== - -New functionality ------------------ - - * Support format in transformation API - * Add support for `start_offset` value `auto` - * Add support for gs:// urls in uploader - * Add support for the `quality_analysis` upload parameter. Fixes #171 - * Add `fps` transformation parameter (#230) - -Other changes -------------- - - * Update code samples in the README file. Fixes #135 - * Reject deferred on request error. Fixes #136 - * Refactor test code after conversion from CoffeeScript - * Convert test code from CoffeeScript to JavaScript - * Merge pull request #208 from cloudinary/fix_update_samples_readme - * Fix the "upload large" test for node 4 - * Remove bower from the sample code - * Add timeout to search integration tests - * Fix detection test - * Fix broken links in node sample project readme - -1.13.2 / 2018-11-14 -=================== - - * Use a new timestamp for each chunk in `upload_large` API - -1.13.1 / 2018-11-13 -=================== - - * Filter files in the npm package - * Add polyfill for `Object.entries` - * Add `update_version` script - -1.13.0 / 2018-11-13 -=================== - - * Support listing of named transformations using the `named` parameter - * Fix Node version check. Fixes #217 - -1.12.0 / 2018-11-08 -=================== - -New functionality ------------------ - - * Add Responsive Breakpoints cache - * Add `picture` and `source` tags - * Add fetch support to overlay/underlay (#189) - * Add async param to uploader (#193) - -Other changes -------------- - - * Convert CoffeeScript source to JavaScript - * Refactor compiled coffee to proper JS - * Remove old lib files - * Move all sources from `src` to `lib` - * Move `cloudinary.js` inside the src folder - * Setup library and tests to run with either es6 or es5 - * Apply babel to support older Node versions - * Refactor tests to use promises - * Fix Tests - * Refactor utils - * Move utils.js to utils folder - * Add `ensurePresenceOf` and `rimraf` utility functions - * Add `nyc` for coverage and update sinon - * Add "Join the Community" (#201) - * Use upload params in explicit API - * Fix raw convert test - -1.11.0 / 2018-03-19 -=================== - -New functionality ------------------ - - * Add `access_control` parameter to `upload` and `update` - -Other changes -------------- - - * Mock `delete_all_resources` test - * Add `compileTests` script to `package.json` - * Add http/https handling to spec helper - * Mock moderation tests - * Fix `categorization` test - * Remove `similiarity_search` test - * Add test helper functions - * Add utility functions to `utils` - * Replace lodash's `_` with explicitly requiring methods - -1.10.0 / 2018-02-13 -=================== - -New functionality ------------------ - - * Support url suffix for shared CDN - * Add Node 8 to Travis CI tests and remove secure variables - * Fix breakpoints format parameter - * Extend support of url_suffix for different resource types - * Add support for URLs in upload_large - * Add support for transformations parameter in delete_resources api - * Add support for delete_derived_by_transformation - * Add format parameter support to responsive-breakpoints encoder - * Add expires_at parameter to archive_params - * Add `faces` parameter to the `explicit` API - -Other changes -------------- - - * Fix typos - * Test transformations api with next_cursor - * add test cases of ocr for upload and url generation - * add test case of conditional tags - * Update dependencies - * Fix tests - * Remove tests for `auto_tagging` - -1.9.1 / 2017-10-24 -================== - - * Decode string to sign before creating the signature (#167) - * Update Readme to point to HTTPS URLs of cloudinary.com - * Update lib files - * Ignore error when `.env` file is missing. - * Remove CoffeeScript header - * Add `lib\v2\search.js` to git. - -1.9.0 / 2017-04-30 -================== - -New functionality ------------------ - - * Add Search API - * Add support for `type` parameter in publish-resources api - * Add support for `keyframe-interval` (ki) video manipulation parameter - * Added parameters `allow_missing` and `skip_transformation_name` to generate-archive api - * Add support for `notification-url` parameter to update API - * Support = and | characters within context values using escaping + test (#143) - -Other changes -------------- - - * Test/upgrade mocha (#142) - * fix bad escaping of special characters in certain scenarios + tests (#140) Fixes #138 - * Don't normalize negative numbers. - * Fix typo: rename `min` to `sub` - -1.8.0 / 2017-03-09 -================== - - * Add User Defined Variables - -1.7.1 / 2017-02-23 -================== - - * Refactor `generate_auth_token` - * Update utils documentation. - * Add URL authorization token. - * Rename token function. - * Support nested keys in CLOUDINARY_URL - * Allow tests to run concurrently - -1.7.0 / 2017-02-08 -================== - -New functionality ------------------ - - * Add access mode API - -Other changes -------------- - - * Rework tests cleanup - * Use TRAVIS_JOB_ID to make test tags unique - -1.6.0 / 2017-01-30 -================== - -New functionality ------------------ - - * Add Akamai token generator - * Add Search resource by context - -Other changes -------------- - - * Use http library when api protocol is set to http patch - * Added timeouts to spec in order to force consistency - * Fix publish API test cleanup - * Use random suffix in api tests - * Use binary encoding for signature - * Add coffee watch - * Fixed async issues with before queue - * Add missing options to explicit api call - -1.5.0 / 2016-12-29 -================== - -New functionality ------------------ - - * `add_context` & `remove_all_context` API - * Add `data-max-chunk-size` to input created by `image_upload_tag` - * Add `moderation` and `phash` parameters to explicit API - - -Other changes -------------- - - * Modify Travis configuration to test NodeJS v4 and v6 only. - * Modify `TEST_TAG` - * Use Sinon spy in `start_at` test - * Support context as hash argument in context API - * Delete streaming profiles after tests - * Fix signing URL tests, Fixes #89 - * Add timeout to delete streaming profile test - * add tests for add_context & remove_all_context - * add add_context & remove_all_context methods - * fix test description - * add test to phash in an explicit call - * add test to moderation parameter in an explicit call - * Add test to accepts {effect: art:incognito} - * support phash in explicit call - * Fix missing moderation parameter in an explicit call - * Fix `nil` to `null`. Call `config()` with parameter name. - -1.4.6 / 2016-11-25 -================== - - * Merge pull request #118 from cloudinary/explicit-eager-transformations - * Support multiple eager transformations with explicit api - -1.4.5 / 2016-11-25 -================== - -New functionality ------------------ - - * Add `remove_all_tags` API - * Add `streaming_profile` transformation parameter. - -Other changes -------------- - - * Fix face coordinates test - * Sort parameters - * Support `http` mode for tests. - * Add tests for gravity modes - -1.4.4 / 2016-10-27 -================== - -New functionality ------------------ - - * Add streaming profiles API - -Other changes -------------- - - * Change email address in sample project's bower.json - * Add files to `.npmignore` - -1.4.3 / 2016-10-27 -================== - -1.4.2 / 2016-09-14 -================== - -New functionality ------------------ - - * Add publish API: `publish_by_prefix`, `publish_by_public_ids`, `publish_by_tag`. - * Add `to_type` to `rename`. - -Other changes -------------- - - * Get version in `utils` from `package.json` - * Fix tests. - -1.4.1 / 2016-06-22 -================== - -Other changes -------------- - - * Fix #105 #106 - url generation broken width numeric width parameter - -1.4.0 / 2016-06-22 -================== - -New functionality ------------------ - - * New configuration parameter `:client_hints` - * Enhanced auto `width` values - * Enhanced `quality` values - * Add `next_cursor` to `transformation` - -Other changes -------------- - - * Remove redundant `max_results` from `upload_preset` - * Add tests for `max_results` and `next_cursor` - * Refactor explicit with invalidate test - * Fix double slash replacement - * Fix "should allow listing resources by start date" test - -1.3.1 / 2016-04-04 -================== - -New functionality ------------------ - - * Conditional transformations - -Other changes -------------- - - * Add error handling to test - * Fix categorization test - * Update sample project to use the new cloudinary_js library. - * Change explicit test to simple eager instead of twitter - * Add `*.js` and `*.map` to gitignore. - * Merge pull request #87 from bompus/util-speedup-2 - * optimized speed of generate_transformation_string, removed js/map files. - * optimized speed of generate_transformation_string - * Replace `_.include` with `_.includes` - It was removed in lodash 4.0. PR #83 - * Merge pull request #1 from cloudinary/master - * Merge pull request #76 from joneslee85/renaming-tests - * Use snakecase naming for spec files - * Fix dependency of sample projects on cloudinary. Fixes #80. - * Remove `promised-jugglingdb` - it has been deprecated. Fixes #81. - -1.3.0 / 2016-01-08 -================== - -New functionality ------------------ - - * Add Archive functionality - * Add responsive breakpoints. - * Add structured text layers - * Add upload mapping API - * Add Restore API - * Add new USER_AGENT format - CloudinaryNodeJS/ver - * Add Support for `aspect_ratio` transformation parameter - * Add invalidate to explicit. Encode public_ids array with `[]` in URL. Replace cleanup code with TEST_TAG. - * Add "invalidate" flag to rename - * Add support invalidate=>true in explicit for social resources - * Support uploading large files using the new Content-Range based upload API. - -Other changes -------------- - * Use `target_tags` instead of `tags` in tests. - * Utilize spechelper - * Add license to package, add Sinon.JS, update mocha - * Increase timeout in tests. - * Merge pull request #77 from joneslee85/consolidate-test-runner - * get rid of Cakefile - -1.2.6 / 2015-11-19 -================== - - * Fix API timeout from 60ms to 60000ms - -1.2.5 / 2015-10-14 -================== - - * Add timeout to test. Compiled CoffeeScript and whitespace changes - * Add dev dependency on `coffee-script` - * Updated upload_large_stream tols return a stream and let the caller control the piping to it, similar to upload_stream. - * fixes #65 - upload_large using chunk_size is corrupting data - also adds the very useful upload_large_stream function. upload_large tests now verify data integrity. - * Add bower to the photo_album sample project. - * Add CHANGELOG.md - -1.2.4 / 2015-08-09 -================== - - * Fix npmignore entries - -1.2.3 / 2015-08-09 -================== - - * Adding samples and test to .npmignore - -1.2.2 / 2015-07-19 -================== - - * Fix upload_large, change api signature to v2, update dependencies - * Fix typo - * Add tests to see if options are mutated - * Update cloudinary.js to copy over options instead of mutating - -1.2.1 / 2015-04-16 -================== - - * Add and arrange `var` keywords. Edit video() documentation. - * Better error handling of read stream errors - -1.2.0 / 2015-04-07 -================== - - * return delete token on direct upload in sample project - * Reapply node 0.12 compatibility fix. Test minor cleanup - * Correct use of _.extend - * Support video tag generation. Support html5 attributes - * Video support, underscore -> lodash, tests, zoom parameter, eager - * Spelling, Tag fixes - * Add video support - * Fix issue with admin api on node >= 0.12 - * Override lodash's _.first to maintain compatibility with underscore version. - * Change underscore to lodash - * added lodash to package.json - * compile changes after migrating from underscore to lodash - * remove underscore from pacakge.json - * update from underscore to lodash - -1.1.2 / 2015-02-26 -================== - - * Test fixes - resilient to test order change. Cleanup - * Update coffeescript configuration - * remove duplicate object key - * remove duplicate object key - * Support root path for shared CDN - * added failed http.Agent test - * override https agent - * Allow request agent to be customized - * fixed issue #42 Bug in samples/basic , api fully supports node.js stream api - * Add method to generate a webhook signature. - -1.1.1 / 2014-12-22 -================== - - * invalidate in bulk deltes - * after code review - * precompiling coffeescript - * all tests pass - * fixed default type and public_id - * utils cloudinary_url supports new signature & dns sharding - * upload supports tags - -1.1.0 / 2014-12-02 -================== - - * Update README.md - * Update README.md - * fix #34 Upload stream does not support pipe - -1.0.13 / 2014-11-09 -=================== - - * fixed #32 Reject promise for error codes https://github.com/cloudinary/cloudinary_npm/issues/32 - * bug fix - * fixed #27 cloudinary.utils.sign_request doesn't read config properly - -1.0.12 / 2014-08-28 -=================== - - * Skipping folder listing test in default - * - support unsigned upload - redirect to upload form when no image was provided - * comments - * set explicit format (jpg) - * moved image_upload_tag & cloudinary_js_config to view (ejs) - * case fix - * using Cloudinary gem to generate images and urls - * - added cloudinary to response locals - added cloudinary configuration logging - * ignoring bin directories (support node_monules .bin symlinks) - * fixed v2 missing methods - * - added root_folders & sub_folders management api + tests - fixed v2 module (requiring v2 would override v1) - fixed api promises reject a result with error attribute - added dotenv for test environment - * ignoring bin folder - * updated demo - * node photo album - * fix: changed to public api cloudinary.url - * Fix mis-spell of deferred - * added promise support - * 2space indent - * package description - * basic samples + fix to v2 api - * git ignore - -1.0.11 / 2014-07-17 -=================== - - * Support custom_coordinates in upload, explicit and update, coordinates flag in resource details - * Support return_delete_token flag in upload - * Encode utf-8 when signing requests. Issue #20 - * Correctly encode parameters as utf8 in uploader API - * Support node style callbacks and parameter order in cloudinary.v2.uploader and cloudinary.v2.api - issue #18 - * Support browserify via coffeeify. diff --git a/server/node_modules/cloudinary/README.md b/server/node_modules/cloudinary/README.md deleted file mode 100644 index d776cdb..0000000 --- a/server/node_modules/cloudinary/README.md +++ /dev/null @@ -1,103 +0,0 @@ -Cloudinary Node SDK -========================= -## About -The Cloudinary Node SDK allows you to quickly and easily integrate your application with Cloudinary. -Effortlessly optimize, transform, upload and manage your cloud's assets. - - -#### Note -This Readme provides basic installation and usage information. -For the complete documentation, see the [Node SDK Guide](https://cloudinary.com/documentation/node_integration). - -## Table of Contents -- [Key Features](#key-features) -- [Version Support](#Version-Support) -- [Installation](#installation) -- [Usage](#usage) - - [Setup](#Setup) - - [Transform and Optimize Assets](#Transform-and-Optimize-Assets) - - [Generate Image and HTML Tags](#Generate-Image-and-Video-HTML-Tags) - - -## Key Features -- [Transform](https://cloudinary.com/documentation/node_video_manipulation#video_transformation_examples) and - [optimize](https://cloudinary.com/documentation/node_image_manipulation#image_optimizations) assets. -- Generate [image](https://cloudinary.com/documentation/node_image_manipulation#deliver_and_transform_images) and - [video](https://cloudinary.com/documentation/node_video_manipulation#video_element) tags. -- [Asset Management](https://cloudinary.com/documentation/node_asset_administration). -- [Secure URLs](https://cloudinary.com/documentation/video_manipulation_and_delivery#generating_secure_https_urls_using_sdks). - - - -## Version Support -| SDK Version | Node version | -|-------------|--------------| -| 1.x.x | Node@6 & up | -| 2.x.x | Node@9 & up | - -## Installation -```bash -npm install cloudinary -``` - -# Usage -### Setup -```js -// Require the Cloudinary library -const cloudinary = require('cloudinary').v2 -``` - -### Transform and Optimize Assets -- [See full documentation](https://cloudinary.com/documentation/node_image_manipulation). - -```js -cloudinary.url("sample.jpg", {width: 100, height: 150, crop: "fill", fetch_format: "auto"}) -``` - -### Upload -- [See full documentation](https://cloudinary.com/documentation/node_image_and_video_upload). -- [Learn more about configuring your uploads with upload presets](https://cloudinary.com/documentation/upload_presets). -```js -cloudinary.v2.uploader.upload("/home/my_image.jpg", {upload_preset: "my_preset"}, (error, result)=>{ - console.log(result, error); -}); -``` -### Large/Chunked Upload -- [See full documentation](https://cloudinary.com/documentation/node_image_and_video_upload#node_js_video_upload). -```js - cloudinary.v2.uploader.upload_large(LARGE_RAW_FILE, { - chunk_size: 7000000 - }, (error, result) => {console.log(error)}); -``` -### Security options -- [See full documentation](https://cloudinary.com/documentation/solution_overview#security). - -## Contributions -- Ensure tests run locally (add test command) -- Open a PR and ensure Travis tests pass - - -## Get Help -If you run into an issue or have a question, you can either: -- Issues related to the SDK: [Open a Github issue](https://github.com/cloudinary/cloudinary_npm/issues). -- Issues related to your account: [Open a support ticket](https://cloudinary.com/contact) - - -## About Cloudinary -Cloudinary is a powerful media API for websites and mobile apps alike, Cloudinary enables developers to efficiently manage, transform, optimize, and deliver images and videos through multiple CDNs. Ultimately, viewers enjoy responsive and personalized visual-media experiences—irrespective of the viewing device. - - -## Additional Resources -- [Cloudinary Transformation and REST API References](https://cloudinary.com/documentation/cloudinary_references): Comprehensive references, including syntax and examples for all SDKs. -- [MediaJams.dev](https://mediajams.dev/): Bite-size use-case tutorials written by and for Cloudinary Developers -- [DevJams](https://www.youtube.com/playlist?list=PL8dVGjLA2oMr09amgERARsZyrOz_sPvqw): Cloudinary developer podcasts on YouTube. -- [Cloudinary Academy](https://training.cloudinary.com/): Free self-paced courses, instructor-led virtual courses, and on-site courses. -- [Code Explorers and Feature Demos](https://cloudinary.com/documentation/code_explorers_demos_index): A one-stop shop for all code explorers, Postman collections, and feature demos found in the docs. -- [Cloudinary Roadmap](https://cloudinary.com/roadmap): Your chance to follow, vote, or suggest what Cloudinary should develop next. -- [Cloudinary Facebook Community](https://www.facebook.com/groups/CloudinaryCommunity): Learn from and offer help to other Cloudinary developers. -- [Cloudinary Account Registration](https://cloudinary.com/users/register/free): Free Cloudinary account registration. -- [Cloudinary Website](https://cloudinary.com): Learn about Cloudinary's products, partners, customers, pricing, and more. - - -## Licence -Released under the MIT license. diff --git a/server/node_modules/cloudinary/babel.config.js b/server/node_modules/cloudinary/babel.config.js deleted file mode 100644 index d9defe8..0000000 --- a/server/node_modules/cloudinary/babel.config.js +++ /dev/null @@ -1,14 +0,0 @@ -const presets = [ - [ - [ - "env", - { - targets: { node: "4" } - } - ], - "stage-0" - ] -]; -const plugins = ["transform-object-rest-spread"]; - -module.exports = { presets, plugins }; diff --git a/server/node_modules/cloudinary/cloudinary.js b/server/node_modules/cloudinary/cloudinary.js deleted file mode 100644 index f13597a..0000000 --- a/server/node_modules/cloudinary/cloudinary.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/cloudinary'); diff --git a/server/node_modules/cloudinary/lib/analysis/index.js b/server/node_modules/cloudinary/lib/analysis/index.js deleted file mode 100644 index 3a42551..0000000 --- a/server/node_modules/cloudinary/lib/analysis/index.js +++ /dev/null @@ -1,28 +0,0 @@ -const utils = require("../utils"); -const {call_analysis_api} = require('../api_client/call_analysis_api'); - -function analyze_uri(uri, analysis_type, options = {}, callback) { - const params = { - uri, - analysis_type - } - - if (analysis_type === 'custom') { - if (!('model_name' in options) || !('model_version' in options)) { - throw new Error('Setting analysis_type to "custom" requires additional params: "model_name" and "model_version"'); - } - params.parameters = { - custom: { - model_name: options.model_name, - model_version: options.model_version - } - } - } - - let api_uri = ['analysis', 'analyze', 'uri']; - return call_analysis_api('POST', api_uri, params, callback, options); -} - -module.exports = { - analyze_uri -}; diff --git a/server/node_modules/cloudinary/lib/api.js b/server/node_modules/cloudinary/lib/api.js deleted file mode 100644 index f5a598d..0000000 --- a/server/node_modules/cloudinary/lib/api.js +++ /dev/null @@ -1,719 +0,0 @@ -const utils = require("./utils"); -const call_api = require("./api_client/call_api"); - -const { - extend, - pickOnlyExistingValues -} = utils; - -const TRANSFORMATIONS_URI = "transformations"; - -function deleteResourcesParams(options, params = {}) { - return extend(params, pickOnlyExistingValues(options, "keep_original", "invalidate", "next_cursor", "transformations")); -} - -function getResourceParams(options) { - return pickOnlyExistingValues(options, "exif", "cinemagraph_analysis", "colors", "derived_next_cursor", "faces", "image_metadata", "media_metadata", "pages", "phash", "coordinates", "max_results", "versions", "accessibility_analysis", 'related', 'related_next_cursor'); -} - -exports.ping = function ping(callback, options = {}) { - return call_api("get", ["ping"], {}, callback, options); -}; - -exports.usage = function usage(callback, options = {}) { - const uri = ["usage"]; - - if (options.date) { - uri.push(options.date); - } - - return call_api("get", uri, {}, callback, options); -}; - -exports.resource_types = function resource_types(callback, options = {}) { - return call_api("get", ["resources"], {}, callback, options); -}; - -exports.resources = function resources(callback, options = {}) { - let resource_type, type, uri; - resource_type = options.resource_type || "image"; - type = options.type; - uri = ["resources", resource_type]; - if (type != null) { - uri.push(type); - } - if ((options.start_at != null) && Object.prototype.toString.call(options.start_at) === '[object Date]') { - options.start_at = options.start_at.toUTCString(); - } - return call_api("get", uri, pickOnlyExistingValues(options, "next_cursor", "max_results", "prefix", "tags", "context", "direction", "moderations", "start_at", "metadata", "fields"), callback, options); -}; - -exports.resources_by_tag = function resources_by_tag(tag, callback, options = {}) { - let resource_type, uri; - resource_type = options.resource_type || "image"; - uri = ["resources", resource_type, "tags", tag]; - return call_api("get", uri, pickOnlyExistingValues(options, "next_cursor", "max_results", "tags", "context", "direction", "moderations", "metadata", "fields"), callback, options); -}; - -exports.resources_by_context = function resources_by_context(key, value, callback, options = {}) { - let params, resource_type, uri; - resource_type = options.resource_type || "image"; - uri = ["resources", resource_type, "context"]; - params = pickOnlyExistingValues(options, "next_cursor", "max_results", "tags", "context", "direction", "moderations", "metadata", "fields"); - params.key = key; - if (value != null) { - params.value = value; - } - return call_api("get", uri, params, callback, options); -}; - -exports.resources_by_moderation = function resources_by_moderation(kind, status, callback, options = {}) { - let resource_type, uri; - resource_type = options.resource_type || "image"; - uri = ["resources", resource_type, "moderations", kind, status]; - return call_api("get", uri, pickOnlyExistingValues(options, "next_cursor", "max_results", "tags", "context", "direction", "moderations", "metadata", "fields"), callback, options); -}; - -exports.resource_by_asset_id = function resource_by_asset_id(asset_id, callback, options = {}) { - const uri = ["resources", asset_id]; - return call_api("get", uri, getResourceParams(options), callback, options); -} - -exports.resources_by_asset_folder = function resources_by_asset_folder(asset_folder, callback, options = {}) { - let params, uri; - uri = ["resources", 'by_asset_folder']; - params = pickOnlyExistingValues(options, "next_cursor", "max_results", "tags", "context", "moderations", "fields"); - params.asset_folder = asset_folder; - return call_api("get", uri, params, callback, options); -}; - -exports.resources_by_asset_ids = function resources_by_asset_ids(asset_ids, callback, options = {}) { - let params, uri; - uri = ["resources", "by_asset_ids"]; - params = pickOnlyExistingValues(options, "tags", "context", "moderations", "fields"); - params["asset_ids[]"] = asset_ids; - return call_api("get", uri, params, callback, options); -} - -exports.resources_by_ids = function resources_by_ids(public_ids, callback, options = {}) { - let params, resource_type, type, uri; - resource_type = options.resource_type || "image"; - type = options.type || "upload"; - uri = ["resources", resource_type, type]; - params = pickOnlyExistingValues(options, "tags", "context", "moderations", "fields"); - params["public_ids[]"] = public_ids; - return call_api("get", uri, params, callback, options); -}; - -exports.resource = function resource(public_id, callback, options = {}) { - let resource_type, type, uri; - resource_type = options.resource_type || "image"; - type = options.type || "upload"; - uri = ["resources", resource_type, type, public_id]; - return call_api("get", uri, getResourceParams(options), callback, options); -}; - -exports.restore = function restore(public_ids, callback, options = {}) { - options.content_type = 'json'; - let resource_type, type, uri; - resource_type = options.resource_type || "image"; - type = options.type || "upload"; - uri = ["resources", resource_type, type, "restore"]; - return call_api("post", uri, { - public_ids: public_ids, - versions: options.versions - }, callback, options); -}; - -exports.update = function update(public_id, callback, options = {}) { - let params, resource_type, type, uri; - resource_type = options.resource_type || "image"; - type = options.type || "upload"; - uri = ["resources", resource_type, type, public_id]; - params = utils.updateable_resource_params(options); - if (options.moderation_status != null) { - params.moderation_status = options.moderation_status; - } - if (options.clear_invalid != null) { - params.clear_invalid = options.clear_invalid; - } - return call_api("post", uri, params, callback, options); -}; - -exports.delete_resources = function delete_resources(public_ids, callback, options = {}) { - let resource_type, type, uri; - resource_type = options.resource_type || "image"; - type = options.type || "upload"; - uri = ["resources", resource_type, type]; - return call_api("delete", uri, deleteResourcesParams(options, { - "public_ids[]": public_ids - }), callback, options); -}; - -exports.delete_resources_by_prefix = function delete_resources_by_prefix(prefix, callback, options = {}) { - let resource_type, type, uri; - resource_type = options.resource_type || "image"; - type = options.type || "upload"; - uri = ["resources", resource_type, type]; - return call_api("delete", uri, deleteResourcesParams(options, { - prefix: prefix - }), callback, options); -}; - -exports.delete_resources_by_tag = function delete_resources_by_tag(tag, callback, options = {}) { - let resource_type, uri; - resource_type = options.resource_type || "image"; - uri = ["resources", resource_type, "tags", tag]; - return call_api("delete", uri, deleteResourcesParams(options), callback, options); -}; - -exports.delete_all_resources = function delete_all_resources(callback, options = {}) { - let resource_type, type, uri; - - resource_type = options.resource_type || "image"; - type = options.type || "upload"; - uri = ["resources", resource_type, type]; - return call_api("delete", uri, deleteResourcesParams(options, { - all: true - }), callback, options); -}; - -exports.delete_backed_up_assets = (assetId, versionIds, callback, options = {}) => { - const params = deleteBackupParams(versionIds); - - return call_api('delete', ['resources', 'backup', assetId], params, callback, options); -} - -const deleteBackupParams = (versionIds = []) => { - return { - "version_ids[]": Array.isArray(versionIds) ? versionIds : [versionIds] - }; -}; - -const createRelationParams = (publicIds = []) => { - return { - assets_to_relate: Array.isArray(publicIds) ? publicIds : [publicIds] - }; -}; - -const deleteRelationParams = (publicIds = []) => { - return { - assets_to_unrelate: Array.isArray(publicIds) ? publicIds : [publicIds] - }; -}; - -exports.add_related_assets = (publicId, assetsToRelate, callback, options = {}) => { - const params = createRelationParams(assetsToRelate); - const resourceType = options.resource_type || 'image'; - const type = options.type || 'upload'; - options.content_type = 'json'; - return call_api('post', ['resources', 'related_assets', resourceType, type, publicId], params, callback, options); -}; - -exports.add_related_assets_by_asset_id = (assetId, assetsToRelate, callback, options = {}) => { - const params = createRelationParams(assetsToRelate); - options.content_type = 'json'; - return call_api('post', ['resources', 'related_assets', assetId], params, callback, options); -}; - -exports.delete_related_assets = (publicId, assetsToUnrelate, callback, options = {}) => { - const params = deleteRelationParams(assetsToUnrelate); - const resourceType = options.resource_type || 'image'; - const type = options.type || 'upload'; - options.content_type = 'json'; - return call_api('delete', ['resources', 'related_assets', resourceType, type, publicId], params, callback, options); -}; - -exports.delete_related_assets_by_asset_id = (assetId, assetsToUnrelate, callback, options = {}) => { - const params = deleteRelationParams(assetsToUnrelate); - options.content_type = 'json'; - return call_api('delete', ['resources', 'related_assets', assetId], params, callback, options); -}; - -exports.delete_derived_resources = function delete_derived_resources(derived_resource_ids, callback, options = {}) { - let uri; - uri = ["derived_resources"]; - return call_api("delete", uri, { - "derived_resource_ids[]": derived_resource_ids - }, callback, options); -}; - -exports.delete_derived_by_transformation = function delete_derived_by_transformation( - public_ids, - transformations, - callback, - options = {} -) { - let params, resource_type, type, uri; - resource_type = options.resource_type || "image"; - type = options.type || "upload"; - uri = "resources/" + resource_type + "/" + type; - params = extend({ - "public_ids[]": public_ids - }, pickOnlyExistingValues(options, "invalidate")); - params.keep_original = true; - params.transformations = utils.build_eager(transformations); - return call_api("delete", uri, params, callback, options); -}; - -exports.tags = function tags(callback, options = {}) { - let resource_type, uri; - resource_type = options.resource_type || "image"; - uri = ["tags", resource_type]; - return call_api("get", uri, pickOnlyExistingValues(options, "next_cursor", "max_results", "prefix"), callback, options); -}; - -exports.transformations = function transformations(callback, options = {}) { - const params = pickOnlyExistingValues(options, "next_cursor", "max_results", "named"); - return call_api("get", TRANSFORMATIONS_URI, params, callback, options); -}; - -exports.transformation = function transformation(transformationName, callback, options = {}) { - const params = pickOnlyExistingValues(options, "next_cursor", "max_results"); - params.transformation = utils.build_eager(transformationName); - return call_api("get", TRANSFORMATIONS_URI, params, callback, options); -}; - -exports.delete_transformation = function delete_transformation(transformationName, callback, options = {}) { - const params = {}; - params.transformation = utils.build_eager(transformationName); - return call_api("delete", TRANSFORMATIONS_URI, params, callback, options); -}; - -exports.update_transformation = function update_transformation(transformationName, updates, callback, options = {}) { - const params = pickOnlyExistingValues(updates, "allowed_for_strict"); - params.transformation = utils.build_eager(transformationName); - if (updates.unsafe_update != null) { - params.unsafe_update = utils.build_eager(updates.unsafe_update); - } - return call_api("put", TRANSFORMATIONS_URI, params, callback, options); -}; - -exports.create_transformation = function create_transformation(name, definition, callback, options = {}) { - const params = {name}; - params.transformation = utils.build_eager(definition); - return call_api("post", TRANSFORMATIONS_URI, params, callback, options); -}; - -exports.upload_presets = function upload_presets(callback, options = {}) { - return call_api("get", ["upload_presets"], pickOnlyExistingValues(options, "next_cursor", "max_results"), callback, options); -}; - -exports.upload_preset = function upload_preset(name, callback, options = {}) { - let uri; - uri = ["upload_presets", name]; - return call_api("get", uri, {}, callback, options); -}; - -exports.delete_upload_preset = function delete_upload_preset(name, callback, options = {}) { - let uri; - uri = ["upload_presets", name]; - return call_api("delete", uri, {}, callback, options); -}; - -exports.update_upload_preset = function update_upload_preset(name, callback, options = {}) { - let params, uri; - uri = ["upload_presets", name]; - params = utils.merge(utils.clear_blank(utils.build_upload_params(options)), pickOnlyExistingValues(options, "unsigned", "disallow_public_id", "live")); - return call_api("put", uri, params, callback, options); -}; - -exports.create_upload_preset = function create_upload_preset(callback, options = {}) { - let params, uri; - uri = ["upload_presets"]; - params = utils.merge(utils.clear_blank(utils.build_upload_params(options)), pickOnlyExistingValues(options, "name", "unsigned", "disallow_public_id", "live")); - return call_api("post", uri, params, callback, options); -}; - -exports.root_folders = function root_folders(callback, options = {}) { - let uri, params; - uri = ["folders"]; - params = pickOnlyExistingValues(options, "next_cursor", "max_results"); - return call_api("get", uri, params, callback, options); -}; - -exports.sub_folders = function sub_folders(path, callback, options = {}) { - let uri, params; - uri = ["folders", path]; - params = pickOnlyExistingValues(options, "next_cursor", "max_results"); - return call_api("get", uri, params, callback, options); -}; - -/** - * Creates an empty folder - * - * @param {string} path The folder path to create - * @param {function} callback Callback function - * @param {object} options Configuration options - * @returns {*} - */ -exports.create_folder = function create_folder(path, callback, options = {}) { - let uri; - uri = ["folders", path]; - return call_api("post", uri, {}, callback, options); -}; - -exports.delete_folder = function delete_folder(path, callback, options = {}) { - let uri; - uri = ["folders", path]; - return call_api("delete", uri, {}, callback, options); -}; - -exports.rename_folder = function rename_folder(old_path, new_path, callback, options = {}) { - let uri; - uri = ['folders', old_path]; - let rename_folder_params = { - to_folder: new_path - }; - options.content_type = 'json'; - return call_api('put', uri, rename_folder_params, callback, options); -}; - -exports.upload_mappings = function upload_mappings(callback, options = {}) { - let params; - params = pickOnlyExistingValues(options, "next_cursor", "max_results"); - return call_api("get", "upload_mappings", params, callback, options); -}; - -exports.upload_mapping = function upload_mapping(name, callback, options = {}) { - if (name == null) { - name = null; - } - return call_api("get", 'upload_mappings', { - folder: name - }, callback, options); -}; - -exports.delete_upload_mapping = function delete_upload_mapping(name, callback, options = {}) { - return call_api("delete", 'upload_mappings', { - folder: name - }, callback, options); -}; - -exports.update_upload_mapping = function update_upload_mapping(name, callback, options = {}) { - let params; - params = pickOnlyExistingValues(options, "template"); - params.folder = name; - return call_api("put", 'upload_mappings', params, callback, options); -}; - -exports.create_upload_mapping = function create_upload_mapping(name, callback, options = {}) { - let params; - params = pickOnlyExistingValues(options, "template"); - params.folder = name; - return call_api("post", 'upload_mappings', params, callback, options); -}; - -function publishResource(byKey, value, callback, options = {}) { - let params, resource_type, uri; - params = pickOnlyExistingValues(options, "type", "invalidate", "overwrite"); - params[byKey] = value; - resource_type = options.resource_type || "image"; - uri = ["resources", resource_type, "publish_resources"]; - options = extend({ - resource_type: resource_type - }, options); - return call_api("post", uri, params, callback, options); -} - -exports.publish_by_prefix = function publish_by_prefix(prefix, callback, options = {}) { - return publishResource("prefix", prefix, callback, options); -}; - -exports.publish_by_tag = function publish_by_tag(tag, callback, options = {}) { - return publishResource("tag", tag, callback, options); -}; - -exports.publish_by_ids = function publish_by_ids(public_ids, callback, options = {}) { - return publishResource("public_ids", public_ids, callback, options); -}; - -exports.list_streaming_profiles = function list_streaming_profiles(callback, options = {}) { - return call_api("get", "streaming_profiles", {}, callback, options); -}; - -exports.get_streaming_profile = function get_streaming_profile(name, callback, options = {}) { - return call_api("get", "streaming_profiles/" + name, {}, callback, options); -}; - -exports.delete_streaming_profile = function delete_streaming_profile(name, callback, options = {}) { - return call_api("delete", "streaming_profiles/" + name, {}, callback, options); -}; - -exports.update_streaming_profile = function update_streaming_profile(name, callback, options = {}) { - let params; - params = utils.build_streaming_profiles_param(options); - return call_api("put", "streaming_profiles/" + name, params, callback, options); -}; - -exports.create_streaming_profile = function create_streaming_profile(name, callback, options = {}) { - let params; - params = utils.build_streaming_profiles_param(options); - params.name = name; - return call_api("post", 'streaming_profiles', params, callback, options); -}; - -function updateResourcesAccessMode(access_mode, by_key, value, callback, options = {}) { - let params, resource_type, type; - resource_type = options.resource_type || "image"; - type = options.type || "upload"; - params = { - access_mode: access_mode - }; - params[by_key] = value; - return call_api("post", "resources/" + resource_type + "/" + type + "/update_access_mode", params, callback, options); -} - -exports.search = function search(params, callback, options = {}) { - options.content_type = 'json'; - return call_api("post", "resources/search", params, callback, options); -}; - -exports.visual_search = function visual_search(params, callback, options = {}) { - const allowedParams = pickOnlyExistingValues(params, 'image_url', 'image_asset_id', 'text'); - return call_api('get', ['resources', 'visual_search'], allowedParams, callback, options); -}; - -exports.search_folders = function search_folders(params, callback, options = {}) { - options.content_type = 'json'; - return call_api("post", "folders/search", params, callback, options); -}; - -exports.update_resources_access_mode_by_prefix = function update_resources_access_mode_by_prefix( - access_mode, - prefix, - callback, - options = {} -) { - return updateResourcesAccessMode(access_mode, "prefix", prefix, callback, options); -}; - -exports.update_resources_access_mode_by_tag = function update_resources_access_mode_by_tag( - access_mode, - tag, - callback, - options = {} -) { - return updateResourcesAccessMode(access_mode, "tag", tag, callback, options); -}; - -exports.update_resources_access_mode_by_ids = function update_resources_access_mode_by_ids( - access_mode, - ids, - callback, - options = {} -) { - return updateResourcesAccessMode(access_mode, "public_ids[]", ids, callback, options); -}; - -/** - * Creates a new metadata field definition - * - * @see https://cloudinary.com/documentation/admin_api#create_a_metadata_field - * - * @param {Object} field The field to add - * @param {Function} callback Callback function - * @param {Object} options Configuration options - * - * @return {Object} - */ -exports.add_metadata_field = function add_metadata_field(field, callback, options = {}) { - const params = pickOnlyExistingValues(field, "external_id", "type", "label", "mandatory", "default_value", "validation", "datasource", "restrictions"); - options.content_type = "json"; - return call_api("post", ["metadata_fields"], params, callback, options); -}; - -/** - * Returns a list of all metadata field definitions - * - * @see https://cloudinary.com/documentation/admin_api#get_metadata_fields - * - * @param {Function} callback Callback function - * @param {Object} options Configuration options - * - * @return {Object} - */ -exports.list_metadata_fields = function list_metadata_fields(callback, options = {}) { - return call_api("get", ["metadata_fields"], {}, callback, options); -}; - -/** - * Deletes a metadata field definition. - * - * The field should no longer be considered a valid candidate for all other endpoints - * - * @see https://cloudinary.com/documentation/admin_api#delete_a_metadata_field_by_external_id - * - * @param {String} field_external_id The external id of the field to delete - * @param {Function} callback Callback function - * @param {Object} options Configuration options - * - * @return {Object} - */ -exports.delete_metadata_field = function delete_metadata_field(field_external_id, callback, options = {}) { - return call_api("delete", ["metadata_fields", field_external_id], {}, callback, options); -}; - -/** - * Get a metadata field by external id - * - * @see https://cloudinary.com/documentation/admin_api#get_a_metadata_field_by_external_id - * - * @param {String} external_id The ID of the metadata field to retrieve - * @param {Function} callback Callback function - * @param {Object} options Configuration options - * - * @return {Object} - */ -exports.metadata_field_by_field_id = function metadata_field_by_field_id(external_id, callback, options = {}) { - return call_api("get", ["metadata_fields", external_id], {}, callback, options); -}; - -/** - * Updates a metadata field by external id - * - * Updates a metadata field definition (partially, no need to pass the entire object) passed as JSON data. - * See {@link https://cloudinary.com/documentation/admin_api#generic_structure_of_a_metadata_field Generic structure of a metadata field} for details. - * - * @see https://cloudinary.com/documentation/admin_api#update_a_metadata_field_by_external_id - * - * @param {String} external_id The ID of the metadata field to update - * @param {Object} field Updated values of metadata field - * @param {Function} callback Callback function - * @param {Object} options Configuration options - * - * @return {Object} - */ -exports.update_metadata_field = function update_metadata_field(external_id, field, callback, options = {}) { - const params = pickOnlyExistingValues(field, "external_id", "type", "label", "mandatory", "default_value", "validation", "datasource", "restrictions", "default_disabled"); - options.content_type = "json"; - return call_api("put", ["metadata_fields", external_id], params, callback, options); -}; - -/** - * Updates a metadata field datasource - * - * Updates the datasource of a supported field type (currently only enum and set), passed as JSON data. The - * update is partial: datasource entries with an existing external_id will be updated and entries with new - * external_id’s (or without external_id’s) will be appended. - * - * @see https://cloudinary.com/documentation/admin_api#update_a_metadata_field_datasource - * - * @param {String} field_external_id The ID of the field to update - * @param {Object} entries_external_id Updated values for datasource - * @param {Function} callback Callback function - * @param {Object} options Configuration options - * - * @return {Object} - */ -exports.update_metadata_field_datasource = function update_metadata_field_datasource(field_external_id, entries_external_id, callback, options = {}) { - const params = pickOnlyExistingValues(entries_external_id, "values"); - options.content_type = "json"; - return call_api("put", ["metadata_fields", field_external_id, "datasource"], params, callback, options); -}; - -/** - * Deletes entries in a metadata field datasource - * - * Deletes (blocks) the datasource entries for a specified metadata field definition. Sets the state of the - * entries to inactive. This is a soft delete, the entries still exist under the hood and can be activated again - * with the restore datasource entries method. - * - * @see https://cloudinary.com/documentation/admin_api#delete_entries_in_a_metadata_field_datasource - * - * @param {String} field_external_id The ID of the metadata field - * @param {Array} entries_external_id An array of IDs of datasource entries to delete - * @param {Function} callback Callback function - * @param {Object} options Configuration options - * - * @return {Object} - */ -exports.delete_datasource_entries = function delete_datasource_entries(field_external_id, entries_external_id, callback, options = {}) { - options.content_type = "json"; - const params = {external_ids: entries_external_id}; - return call_api("delete", ["metadata_fields", field_external_id, "datasource"], params, callback, options); -}; - -/** - * Restores entries in a metadata field datasource - * - * Restores (unblocks) any previously deleted datasource entries for a specified metadata field definition. - * Sets the state of the entries to active. - * - * @see https://cloudinary.com/documentation/admin_api#restore_entries_in_a_metadata_field_datasource - * - * @param {String} field_external_id The ID of the metadata field - * @param {Array} entries_external_id An array of IDs of datasource entries to delete - * @param {Function} callback Callback function - * @param {Object} options Configuration options - * - * @return {Object} - */ -exports.restore_metadata_field_datasource = function restore_metadata_field_datasource(field_external_id, entries_external_id, callback, options = {}) { - options.content_type = "json"; - const params = {external_ids: entries_external_id}; - return call_api("post", ["metadata_fields", field_external_id, "datasource_restore"], params, callback, options); -}; - -/** - * Sorts metadata field datasource. Currently supports only value - * @param {String} field_external_id The ID of the metadata field - * @param {String} sort_by Criteria for the sort. Currently supports only value - * @param {String} direction Optional (gets either asc or desc) - * @param {Function} callback Callback function - * @param {Object} options Configuration options - * - * @return {Object} - */ -exports.order_metadata_field_datasource = function order_metadata_field_datasource(field_external_id, sort_by, direction, callback, options = {}) { - options.content_type = "json"; - const params = { - order_by: sort_by, - direction: direction - }; - return call_api("post", ["metadata_fields", field_external_id, "datasource", "order"], params, callback, options); -}; - -/** - * Reorders metadata fields. - * - * @param {String} order_by Criteria for the order (one of the fields 'label', 'external_id', 'created_at'). - * @param {String} direction Optional (gets either asc or desc). - * @param {Function} callback Callback function. - * @param {Object} options Configuration options. - * - * @return {Object} - */ -exports.reorder_metadata_fields = function reorder_metadata_fields(order_by, direction, callback, options = {}) { - options.content_type = "json"; - const params = { - order_by, - direction - }; - return call_api("put", ["metadata_fields", "order"], params, callback, options); -}; - -exports.list_metadata_rules = function list_metadata_rules(callback, options = {}) { - return call_api('get', ['metadata_rules'], {}, callback, options); -}; - -exports.add_metadata_rule = function add_metadata_rule(metadata_rule, callback, options = {}) { - options.content_type = 'json'; - const params = pickOnlyExistingValues(metadata_rule, 'metadata_field_id', 'condition', 'result', 'name'); - return call_api('post', ['metadata_rules'], params, callback, options); -}; - -exports.update_metadata_rule = function update_metadata_rule(field_external_id, updated_metadata_rule, callback, options = {}) { - options.content_type = 'json'; - const params = pickOnlyExistingValues(updated_metadata_rule, 'metadata_field_id', 'condition', 'result', 'name', 'state'); - return call_api('put', ['metadata_rules', field_external_id], params, callback, options); -}; - -exports.delete_metadata_rule = function delete_metadata_rule(field_external_id, callback, options = {}) { - return call_api('delete', ['metadata_rules', field_external_id], {}, callback, options); -}; - -exports.config = function config(callback, options = {}) { - const params = pickOnlyExistingValues(options, 'settings'); - return call_api('get', ['config'], params, callback, options); -} diff --git a/server/node_modules/cloudinary/lib/api_client/call_account_api.js b/server/node_modules/cloudinary/lib/api_client/call_account_api.js deleted file mode 100644 index 1df492a..0000000 --- a/server/node_modules/cloudinary/lib/api_client/call_account_api.js +++ /dev/null @@ -1,22 +0,0 @@ -// eslint-disable-next-line import/order -const config = require("../config"); -const utils = require("../utils"); -const ensureOption = require('../utils/ensureOption').defaults(config()); -const execute_request = require('./execute_request'); - -const { ensurePresenceOf } = utils; - -function call_account_api(method, uri, params, callback, options) { - ensurePresenceOf({ method, uri }); - const cloudinary = ensureOption(options, "upload_prefix", "https://api.cloudinary.com"); - const account_id = ensureOption(options, "account_id"); - const api_url = [cloudinary, "v1_1", "provisioning", "accounts", account_id].concat(uri).join("/"); - const auth = { - key: ensureOption(options, "provisioning_api_key"), - secret: ensureOption(options, "provisioning_api_secret") - }; - - return execute_request(method, params, auth, api_url, callback, options); -} - -module.exports = call_account_api; diff --git a/server/node_modules/cloudinary/lib/api_client/call_analysis_api.js b/server/node_modules/cloudinary/lib/api_client/call_analysis_api.js deleted file mode 100644 index 073068e..0000000 --- a/server/node_modules/cloudinary/lib/api_client/call_analysis_api.js +++ /dev/null @@ -1,32 +0,0 @@ -const utils = require("../utils"); -const config = require("../config"); -const ensureOption = require('../utils/ensureOption').defaults(config()); -const execute_request = require("./execute_request"); - -const {ensurePresenceOf} = utils; - -function call_analysis_api(method, uri, params, callback, options) { - ensurePresenceOf({ - method, - uri - }); - const api_url = utils.base_api_url_v2()(uri, options); - let auth = {}; - if (options.oauth_token || config().oauth_token) { - auth = { - oauth_token: ensureOption(options, "oauth_token") - }; - } else { - auth = { - key: ensureOption(options, "api_key"), - secret: ensureOption(options, "api_secret") - }; - } - options.content_type = 'json'; - - return execute_request(method, params, auth, api_url, callback, options); -} - -module.exports = { - call_analysis_api -}; diff --git a/server/node_modules/cloudinary/lib/api_client/call_api.js b/server/node_modules/cloudinary/lib/api_client/call_api.js deleted file mode 100644 index 11c4e5f..0000000 --- a/server/node_modules/cloudinary/lib/api_client/call_api.js +++ /dev/null @@ -1,26 +0,0 @@ -// eslint-disable-next-line import/order -const config = require("../config"); -const utils = require("../utils"); -const ensureOption = require('../utils/ensureOption').defaults(config()); -const execute_request = require('./execute_request'); - -const { ensurePresenceOf } = utils; - -function call_api(method, uri, params, callback, options) { - ensurePresenceOf({ method, uri }); - const api_url = utils.base_api_url_v1()(uri, options); - let auth = {}; - if (options.oauth_token || config().oauth_token){ - auth = { - oauth_token: ensureOption(options, "oauth_token") - }; - } else { - auth = { - key: ensureOption(options, "api_key"), - secret: ensureOption(options, "api_secret") - }; - } - return execute_request(method, params, auth, api_url, callback, options); -} - -module.exports = call_api; diff --git a/server/node_modules/cloudinary/lib/api_client/execute_request.js b/server/node_modules/cloudinary/lib/api_client/execute_request.js deleted file mode 100644 index 9c0418d..0000000 --- a/server/node_modules/cloudinary/lib/api_client/execute_request.js +++ /dev/null @@ -1,169 +0,0 @@ -// eslint-disable-next-line import/order -const config = require("../config"); -const https = /^http:/.test(config().upload_prefix) ? require('http') : require('https'); -const querystring = require("querystring"); -const Q = require('q'); -const url = require('url'); -const utils = require("../utils"); -const ensureOption = require('../utils/ensureOption').defaults(config()); - -const { extend, includes, isEmpty } = utils; - -const agent = config.api_proxy ? new https.Agent(config.api_proxy) : null; - -function execute_request(method, params, auth, api_url, callback, options = {}) { - method = method.toUpperCase(); - const deferred = Q.defer(); - - let query_params, handle_response; // declare to user later - let key = auth.key; - let secret = auth.secret; - let oauth_token = auth.oauth_token; - let content_type = 'application/x-www-form-urlencoded'; - - if (options.content_type === 'json') { - query_params = JSON.stringify(params); - content_type = 'application/json'; - } else { - query_params = querystring.stringify(params); - } - - if (method === "GET") { - api_url += "?" + query_params; - } - - let request_options = url.parse(api_url); - - request_options = extend(request_options, { - method: method, - headers: { - 'Content-Type': content_type, - 'User-Agent': utils.getUserAgent() - } - }); - - if (oauth_token) { - request_options.headers.Authorization = `Bearer ${oauth_token}`; - } else { - request_options.auth = key + ":" + secret - } - - if (options.agent != null) { - request_options.agent = options.agent; - } - - let proxy = options.api_proxy || config().api_proxy; - if (!isEmpty(proxy)) { - if (!request_options.agent && agent) { - request_options.agent = agent; - } else if (!request_options.agent) { - request_options.agent = new https.Agent(proxy); - } else { - console.warn("Proxy is set, but request uses a custom agent, proxy is ignored."); - } - } - if (method !== "GET") { - request_options.headers['Content-Length'] = Buffer.byteLength(query_params); - } - handle_response = function (res) { - const {hide_sensitive = false} = config(); - const sanitizedOptions = {...request_options}; - - if (hide_sensitive === true){ - if ("auth" in sanitizedOptions) { delete sanitizedOptions.auth; } - if ("Authorization" in sanitizedOptions.headers) { delete sanitizedOptions.headers.Authorization; } - } - - if (includes([200, 400, 401, 403, 404, 409, 420, 500], res.statusCode)) { - let buffer = ""; - let error = false; - res.on("data", function (d) { - buffer += d; - return buffer; - }); - res.on("end", function () { - let result; - if (error) { - return; - } - try { - result = JSON.parse(buffer); - } catch (e) { - result = { - error: { - message: "Server return invalid JSON response. Status Code " + res.statusCode - } - }; - } - - if (result.error) { - result.error.http_code = res.statusCode; - } else { - if (res.headers["x-featureratelimit-limit"]) { - result.rate_limit_allowed = parseInt(res.headers["x-featureratelimit-limit"]); - } - if (res.headers["x-featureratelimit-reset"]) { - result.rate_limit_reset_at = new Date(res.headers["x-featureratelimit-reset"]); - } - if (res.headers["x-featureratelimit-remaining"]) { - result.rate_limit_remaining = parseInt(res.headers["x-featureratelimit-remaining"]); - } - } - - if (result.error) { - deferred.reject(Object.assign({ - request_options: sanitizedOptions, - query_params - }, result)); - } else { - deferred.resolve(result); - } - if (typeof callback === "function") { - callback(result); - } - }); - res.on("error", function (e) { - error = true; - let err_obj = { - error: { - message: e, - http_code: res.statusCode, - request_options: sanitizedOptions, - query_params - } - }; - deferred.reject(err_obj.error); - if (typeof callback === "function") { - callback(err_obj); - } - }); - } else { - let err_obj = { - error: { - message: "Server returned unexpected status code - " + res.statusCode, - http_code: res.statusCode, - request_options: sanitizedOptions, - query_params - } - }; - deferred.reject(err_obj.error); - if (typeof callback === "function") { - callback(err_obj); - } - } - }; - - const request = https.request(request_options, handle_response); - request.on("error", function (e) { - deferred.reject(e); - return typeof callback === "function" ? callback({ error: e }) : void 0; - }); - request.setTimeout(ensureOption(options, "timeout", 60000)); - if (method !== "GET") { - request.write(query_params); - } - request.end(); - return deferred.promise; -} - -module.exports = execute_request; diff --git a/server/node_modules/cloudinary/lib/auth_token.js b/server/node_modules/cloudinary/lib/auth_token.js deleted file mode 100644 index 39694b5..0000000 --- a/server/node_modules/cloudinary/lib/auth_token.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Authorization Token - * @module auth_token - */ - -const crypto = require('crypto'); -const smart_escape = require('./utils/encoding/smart_escape'); - -const unsafe = /([ "#%&'/:;<=>?@[\]^`{|}~]+)/g; - -function digest(message, key) { - return crypto.createHmac("sha256", Buffer.from(key, "hex")).update(message).digest('hex'); -} - -/** - * Escape url using lowercase hex code - * @param {string} url a url string - * @return {string} escaped url - */ -function escapeToLower(url) { - const safeUrl = smart_escape(url, unsafe); - return safeUrl.replace(/%../g, function (match) { - return match.toLowerCase(); - }); -} - -/** - * Auth token options - * @typedef {object} authTokenOptions - * @property {string} [token_name="__cld_token__"] The name of the token. - * @property {string} key The secret key required to sign the token. - * @property {string} ip The IP address of the client. - * @property {number} start_time=now The start time of the token in seconds from epoch. - * @property {string} expiration The expiration time of the token in seconds from epoch. - * @property {string} duration The duration of the token (from start_time). - * @property {string|Array} acl The ACL(s) for the token. - * @property {string} url The URL to authentication in case of a URL token. - * - */ - -/** - * Generate an authorization token - * @param {authTokenOptions} options - * @returns {string} the authorization token - */ -module.exports = function (options) { - const tokenName = options.token_name ? options.token_name : "__cld_token__"; - const tokenSeparator = "~"; - if (options.expiration == null) { - if (options.duration != null) { - let start = options.start_time != null ? options.start_time : Math.round(Date.now() / 1000); - options.expiration = start + options.duration; - } else { - throw new Error("Must provide either expiration or duration"); - } - } - let tokenParts = []; - if (options.ip != null) { - tokenParts.push(`ip=${options.ip}`); - } - if (options.start_time != null) { - tokenParts.push(`st=${options.start_time}`); - } - tokenParts.push(`exp=${options.expiration}`); - if (options.acl != null) { - if (Array.isArray(options.acl) === true) { - options.acl = options.acl.join("!"); - } - tokenParts.push(`acl=${escapeToLower(options.acl)}`); - } - let toSign = [...tokenParts]; - if (options.url != null && options.acl == null) { - let url = escapeToLower(options.url); - toSign.push(`url=${url}`); - } - let auth = digest(toSign.join(tokenSeparator), options.key); - tokenParts.push(`hmac=${auth}`); - - if (!options.url && !options.acl) { - throw 'authToken must contain either an acl or a url property' - } - - return `${tokenName}=${tokenParts.join(tokenSeparator)}`; -}; diff --git a/server/node_modules/cloudinary/lib/cache.js b/server/node_modules/cloudinary/lib/cache.js deleted file mode 100644 index 6e40272..0000000 --- a/server/node_modules/cloudinary/lib/cache.js +++ /dev/null @@ -1,147 +0,0 @@ -/* eslint-disable class-methods-use-this */ - -const CACHE = Symbol.for("com.cloudinary.cache"); -const CACHE_ADAPTER = Symbol.for("com.cloudinary.cacheAdapter"); -const { ensurePresenceOf, generate_transformation_string } = require('./utils'); - -/** - * The adapter used to communicate with the underlying cache storage - */ -class CacheAdapter { - /** - * Get a value from the cache - * @param {string} publicId - * @param {string} type - * @param {string} resourceType - * @param {string} transformation - * @param {string} format - * @return {*} the value associated with the provided arguments - */ - get(publicId, type, resourceType, transformation, format) {} - - /** - * Set a new value in the cache - * @param {string} publicId - * @param {string} type - * @param {string} resourceType - * @param {string} transformation - * @param {string} format - * @param {*} value - */ - set(publicId, type, resourceType, transformation, format, value) {} - - /** - * Delete all values in the cache - */ - flushAll() {} -} -/** - * @class Cache - * Stores and retrieves values identified by publicId / options pairs - */ -const Cache = { - /** - * The adapter interface. Extend this class to implement a specific adapter. - * @type CacheAdapter - */ - CacheAdapter, - /** - * Set the cache adapter - * @param {CacheAdapter} adapter The cache adapter - */ - setAdapter(adapter) { - if (this.adapter) { - console.warn("Overriding existing cache adapter"); - } - this.adapter = adapter; - }, - /** - * Get the adapter the Cache is using - * @return {CacheAdapter} the current cache adapter - */ - getAdapter() { - return this.adapter; - }, - /** - * Get an item from the cache - * @param {string} publicId - * @param {object} options - * @return {*} - */ - get(publicId, options) { - if (!this.adapter) { return undefined; } - ensurePresenceOf({ publicId }); - let transformation = generate_transformation_string({ ...options }); - return this.adapter.get( - publicId, options.type || 'upload', - options.resource_type || 'image', - transformation, - options.format - ); - }, - /** - * Set a new value in the cache - * @param {string} publicId - * @param {object} options - * @param {*} value - * @return {*} - */ - set(publicId, options, value) { - if (!this.adapter) { return undefined; } - ensurePresenceOf({ publicId, value }); - let transformation = generate_transformation_string({ ...options }); - return this.adapter.set( - publicId, - options.type || 'upload', - options.resource_type || 'image', - transformation, - options.format, - value - ); - }, - /** - * Clear all items in the cache - * @return {*} Returns the value from the adapter's flushAll() method - */ - flushAll() { - if (!this.adapter) { return undefined; } - return this.adapter.flushAll(); - } - -}; - -// Define singleton property -Object.defineProperty(Cache, "instance", { - get() { - return global[CACHE]; - } -}); -Object.defineProperty(Cache, "adapter", { - /** - * - * @return {CacheAdapter} The current cache adapter - */ - get() { - return global[CACHE_ADAPTER]; - }, - /** - * Set the cache adapter to be used by Cache - * @param {CacheAdapter} adapter Cache adapter - */ - set(adapter) { - global[CACHE_ADAPTER] = adapter; - } -}); -Object.freeze(Cache); - -// Instantiate the singleton -let symbols = Object.getOwnPropertySymbols(global); -if (symbols.indexOf(CACHE) < 0) { - global[CACHE] = Cache; -} - -/** - * Store key value pairs - - */ -module.exports = Cache; diff --git a/server/node_modules/cloudinary/lib/cache/FileKeyValueStorage.js b/server/node_modules/cloudinary/lib/cache/FileKeyValueStorage.js deleted file mode 100644 index 319067e..0000000 --- a/server/node_modules/cloudinary/lib/cache/FileKeyValueStorage.js +++ /dev/null @@ -1,54 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const rimraf = require('../utils/rimraf'); - -class FileKeyValueStorage { - constructor({ baseFolder } = {}) { - this.init(baseFolder); - } - - init(baseFolder) { - if (baseFolder) { - try { - fs.accessSync(baseFolder); - this.baseFolder = baseFolder; - } catch (err) { - throw err; - } - } else { - if (!fs.existsSync('test_cache')) { - fs.mkdirSync('test_cache'); - } - this.baseFolder = fs.mkdtempSync('test_cache/cloudinary_cache_'); - console.info("Created temporary cache folder at " + this.baseFolder); - } - } - - get(key) { - let value = fs.readFileSync(this.getFilename(key)); - try { - return JSON.parse(value); - } catch (e) { - throw "Cannot parse cache value"; - } - } - - set(key, value) { - fs.writeFileSync(this.getFilename(key), JSON.stringify(value)); - } - - clear() { - let files = fs.readdirSync(this.baseFolder); - files.forEach(file => fs.unlinkSync(path.join(this.baseFolder, file))); - } - - deleteBaseFolder() { - rimraf(this.baseFolder); - } - - getFilename(key) { - return path.format({ name: key, base: key, ext: '.json', dir: this.baseFolder }); - } -} - -module.exports = FileKeyValueStorage; diff --git a/server/node_modules/cloudinary/lib/cache/KeyValueCacheAdapter.js b/server/node_modules/cloudinary/lib/cache/KeyValueCacheAdapter.js deleted file mode 100644 index f49531c..0000000 --- a/server/node_modules/cloudinary/lib/cache/KeyValueCacheAdapter.js +++ /dev/null @@ -1,62 +0,0 @@ -const crypto = require('crypto'); -const CacheAdapter = require('../cache').CacheAdapter; - -/** - * - */ -class KeyValueCacheAdapter extends CacheAdapter { - constructor(storage) { - super(); - this.storage = storage; - } - - /** @inheritDoc */ - get(publicId, type, resourceType, transformation, format) { - let key = KeyValueCacheAdapter.generateCacheKey(publicId, type, resourceType, transformation, format); - return KeyValueCacheAdapter.extractData(this.storage.get(key)); - } - - /** @inheritDoc */ - set(publicId, type, resourceType, transformation, format, value) { - let key = KeyValueCacheAdapter.generateCacheKey(publicId, type, resourceType, transformation, format); - this.storage.set( - key, - KeyValueCacheAdapter.prepareData( - publicId, - type, - resourceType, - transformation, - format, - value - ) - ); - } - - /** @inheritDoc */ - flushAll() { - this.storage.clear(); - } - - /** @inheritDoc */ - delete(publicId, type, resourceType, transformation, format) { - let key = KeyValueCacheAdapter.generateCacheKey(publicId, type, resourceType, transformation, format); - return this.storage.delete(key); - } - - static generateCacheKey(publicId, type, resourceType, transformation, format) { - type = type || "upload"; - resourceType = resourceType || "image"; - let sha1 = crypto.createHash('sha1'); - return sha1.update([publicId, type, resourceType, transformation, format].filter(i => i).join('/')).digest('hex'); - } - - static prepareData(publicId, type, resourceType, transformation, format, data) { - return { publicId, type, resourceType, transformation, format, breakpoints: data }; - } - - static extractData(data) { - return data ? data.breakpoints : null; - } -} - -module.exports = KeyValueCacheAdapter; diff --git a/server/node_modules/cloudinary/lib/cloudinary.js b/server/node_modules/cloudinary/lib/cloudinary.js deleted file mode 100644 index f3b9767..0000000 --- a/server/node_modules/cloudinary/lib/cloudinary.js +++ /dev/null @@ -1,239 +0,0 @@ -const _ = require('lodash'); -exports.config = require("./config"); -exports.utils = require("./utils"); -exports.uploader = require("./uploader"); -exports.api = require("./api"); -exports.analysis = require('./analysis'); - -const account = require("./provisioning/account"); - -exports.provisioning = { - account: account -}; -exports.PreloadedFile = require("./preloaded_file"); -exports.Cache = require('./cache'); - -const cloudinary = module.exports; - -const optionConsume = cloudinary.utils.option_consume; - -exports.url = function url(public_id, options) { - options = _.extend({}, options); - return cloudinary.utils.url(public_id, options); -}; - -const { generateImageResponsiveAttributes, generateMediaAttr } = require('./utils/srcsetUtils'); - -/** - * Helper function, allows chaining transformation to the end of transformation list - * - * @private - * @param {object} options Original options - * @param {object|object[]} transformation Transformations to chain at the end - * - * @return {object} Resulting options - */ -function chainTransformations(options, transformation = []) { - // preserve url options - let urlOptions = cloudinary.utils.extractUrlParams(options); - let currentTransformation = cloudinary.utils.extractTransformationParams(options); - transformation = cloudinary.utils.build_array(transformation); - urlOptions.transformation = [currentTransformation, ...transformation]; - return urlOptions; -} - -/** - * Generate an HTML img tag with a Cloudinary URL - * @param {string} source A Public ID or a URL - * @param {object} options Configuration options - * @param {srcset} options.srcset srcset options - * @param {object} options.attributes HTML attributes - * @param {number} options.html_width (deprecated) The HTML tag width - * @param {number} options.html_height (deprecated) The HTML tag height - * @param {boolean} options.client_hints Don't implement the client side responsive function. - * This argument can override the the same option in the global configuration. - * @param {boolean} options.responsive Setup the tag for the client side responsive function. - * @param {boolean} options.hidpi Setup the tag for the client side auto dpr function. - * @param {boolean} options.responsive_placeholder A place holder image URL to use with. - * the client side responsive function - * @return {string} An HTML img tag - */ -exports.image = function image(source, options) { - let localOptions = _.extend({}, options); - let srcsetParam = optionConsume(localOptions, 'srcset'); - let attributes = optionConsume(localOptions, 'attributes', {}); - let src = cloudinary.utils.url(source, localOptions); - if ("html_width" in localOptions) localOptions.width = optionConsume(localOptions, "html_width"); - if ("html_height" in localOptions) localOptions.height = optionConsume(localOptions, "html_height"); - - let client_hints = optionConsume(localOptions, "client_hints", cloudinary.config().client_hints); - let responsive = optionConsume(localOptions, "responsive"); - let hidpi = optionConsume(localOptions, "hidpi"); - - if ((responsive || hidpi) && !client_hints) { - localOptions["data-src"] = src; - let classes = [responsive ? "cld-responsive" : "cld-hidpi"]; - let current_class = optionConsume(localOptions, "class"); - if (current_class) classes.push(current_class); - localOptions.class = classes.join(" "); - src = optionConsume(localOptions, "responsive_placeholder", cloudinary.config().responsive_placeholder); - if (src === "blank") { - src = cloudinary.BLANK; - } - } - let html = ""; - return html; -}; - -/** - * Creates an HTML video tag for the provided public_id - * @param {String} public_id the resource public ID - * @param {Object} [options] options for the resource and HTML tag - * @param {(String|Array)} [options.source_types] Specify which - * source type the tag should include. defaults to webm, mp4 and ogv. - * @param {String} [options.source_transformation] specific transformations - * to use for a specific source type. - * @param {(String|Object)} [options.poster] image URL or - * poster options that may include a public_id key and - * poster-specific transformations - * @example Example of generating a video tag: - * cloudinary.video("mymovie.mp4"); - * cloudinary.video("mymovie.mp4", {source_types: 'webm'}); - * cloudinary.video("mymovie.ogv", {poster: "myspecialplaceholder.jpg"}); - * cloudinary.video("mymovie.webm", {source_types: ['webm', 'mp4'], poster: {effect: 'sepia'}}); - * @return {string} HTML video tag - */ -exports.video = function video(public_id, options) { - options = _.extend({}, options); - public_id = public_id.replace(/\.(mp4|ogv|webm)$/, ''); - let source_types = optionConsume(options, 'source_types', []); - let source_transformation = optionConsume(options, 'source_transformation', {}); - let sources = optionConsume(options, 'sources', []); - let fallback = optionConsume(options, 'fallback_content', ''); - - if (source_types.length === 0) source_types = cloudinary.utils.DEFAULT_VIDEO_SOURCE_TYPES; - let video_options = _.cloneDeep(options); - - if (video_options.hasOwnProperty('poster')) { - if (_.isPlainObject(video_options.poster)) { - if (video_options.poster.hasOwnProperty('public_id')) { - video_options.poster = cloudinary.utils.url(video_options.poster.public_id, video_options.poster); - } else { - video_options.poster = cloudinary.utils.url(public_id, _.extend({}, cloudinary.utils.DEFAULT_POSTER_OPTIONS, video_options.poster)); - } - } - } else { - video_options.poster = cloudinary.utils.url(public_id, _.extend({}, cloudinary.utils.DEFAULT_POSTER_OPTIONS, options)); - } - - if (!video_options.poster) delete video_options.poster; - - let html = '`; -}; - - -/** - * Generate a source tag. - * @param {string} public_id - * @param {object} options - * @param {srcset} options.srcset arguments required to generate the srcset attribute. - * @param {object} options.attributes HTML tag attributes - * @return {string} - */ -exports.source = function source(public_id, options = {}) { - let srcsetParam = cloudinary.utils.extend({}, options.srcset, cloudinary.config().srcset); - let attributes = options.attributes || {}; - - cloudinary.utils.extend(attributes, generateImageResponsiveAttributes(public_id, attributes, srcsetParam, options)); - if (!attributes.srcset) { - attributes.srcset = cloudinary.url(public_id, options); - } - if (!attributes.media && options.media) { - attributes.media = generateMediaAttr(options.media); - } - return ``; -}; - -/** - * Generate a picture HTML tag.
- * The sources argument defines different transformations to apply for each - * media query. - * @param {string}public_id - * @param {object} options - * @param {object[]} options.sources a list of source arguments. A source tag will be rendered for each item - * @param {number} options.sources.min_width a minimum width query - * @param {number} options.sources.max_width a maximum width query - * @param {number} options.sources.transformation the transformation to apply to the source tag. - * @return {string} A picture HTML tag - * @example - * - * cloudinary.picture("sample", { - * sources: [ - * {min_width: 1600, transformation: {crop: 'fill', width: 800, aspect_ratio: 2}}, - * {min_width: 500, transformation: {crop: 'fill', width: 600, aspect_ratio: 2.3}}, - * {transformation: {crop: 'crop', width: 400, gravity: 'auto'}}, - * ]} - * ); - */ -exports.picture = function picture(public_id, options = {}) { - let sources = options.sources || []; - options = cloudinary.utils.clone(options); - delete options.sources; - cloudinary.utils.patchFetchFormat(options); - return "" - + sources.map((source) => { - let sourceOptions = chainTransformations(options, source.transformation); - sourceOptions.media = source; - return cloudinary.source(public_id, sourceOptions); - }).join('') - + cloudinary.image(public_id, options) - + ""; -}; - -exports.cloudinary_js_config = cloudinary.utils.cloudinary_js_config; -exports.CF_SHARED_CDN = cloudinary.utils.CF_SHARED_CDN; -exports.AKAMAI_SHARED_CDN = cloudinary.utils.AKAMAI_SHARED_CDN; -exports.SHARED_CDN = cloudinary.utils.SHARED_CDN; -exports.BLANK = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"; -exports.v2 = require('./v2'); diff --git a/server/node_modules/cloudinary/lib/config.js b/server/node_modules/cloudinary/lib/config.js deleted file mode 100644 index 1de579d..0000000 --- a/server/node_modules/cloudinary/lib/config.js +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Assign a value to a nested object - * @function putNestedValue - * @param params the parent object - this argument will be modified! - * @param key key in the form nested[innerkey] - * @param value the value to assign - * @return the modified params object - */ -const url = require('url'); -const extend = require("lodash/extend"); -const isObject = require("lodash/isObject"); -const isString = require("lodash/isString"); -const isUndefined = require("lodash/isUndefined"); -const isEmpty = require("lodash/isEmpty"); -const entries = require('./utils/entries'); - -let cloudinary_config = void 0; - -/** - * Sets a value in an object using a nested key - * @param {object} params The object to assign the value in. - * @param {string} key The key of the value. A period is used to denote inner keys. - * @param {*} value The value to set. - * @returns {object} The params argument. - * @example - * let o = {foo: {bar: 1}}; - * putNestedValue(o, 'foo.bar', 2); // {foo: {bar: 2}} - * putNestedValue(o, 'foo.inner.key', 'this creates an inner object'); - * // {{foo: {bar: 2}, inner: {key: 'this creates an inner object'}}} - */ -function putNestedValue(params, key, value) { - let chain = key.split(/[\[\]]+/).filter(i => i.length); - let outer = params; - let lastKey = chain.pop(); - for (let j = 0; j < chain.length; j++) { - let innerKey = chain[j]; - let inner = outer[innerKey]; - if (inner == null) { - inner = {}; - outer[innerKey] = inner; - } - outer = inner; - } - outer[lastKey] = value; - return params; -} - -function parseCloudinaryConfigFromEnvURL(ENV_STR) { - let conf = {}; - - let uri = url.parse(ENV_STR, true); - - if (uri.protocol === 'cloudinary:') { - conf = Object.assign({}, conf, { - cloud_name: uri.host, - api_key: uri.auth && uri.auth.split(":")[0], - api_secret: uri.auth && uri.auth.split(":")[1], - private_cdn: uri.pathname != null, - secure_distribution: uri.pathname && uri.pathname.substring(1) - }); - } else if (uri.protocol === 'account:') { - conf = Object.assign({}, conf, { - account_id: uri.host, - provisioning_api_key: uri.auth && uri.auth.split(":")[0], - provisioning_api_secret: uri.auth && uri.auth.split(":")[1] - }); - } - - return conf; -} - -function extendCloudinaryConfigFromQuery(ENV_URL, confToExtend = {}) { - let uri = url.parse(ENV_URL, true); - if (uri.query != null) { - entries(uri.query).forEach(([key, value]) => putNestedValue(confToExtend, key, value)); - } -} - -function extendCloudinaryConfig(parsedConfig, confToExtend = {}) { - entries(parsedConfig).forEach(([key, value]) => { - if (value !== undefined) { - confToExtend[key] = value; - } - }); - - return confToExtend; -} - -module.exports = function (new_config, new_value) { - if ((cloudinary_config == null) || new_config === true) { - if (cloudinary_config == null) { - cloudinary_config = {}; - } else { - Object.keys(cloudinary_config).forEach(key => delete cloudinary_config[key]); - } - - let CLOUDINARY_ENV_URL = process.env.CLOUDINARY_URL; - let CLOUDINARY_ENV_ACCOUNT_URL = process.env.CLOUDINARY_ACCOUNT_URL; - let CLOUDINARY_API_PROXY = process.env.CLOUDINARY_API_PROXY; - - if (CLOUDINARY_ENV_URL && !CLOUDINARY_ENV_URL.toLowerCase().startsWith('cloudinary://')) { - throw new Error("Invalid CLOUDINARY_URL protocol. URL should begin with 'cloudinary://'"); - } - if (CLOUDINARY_ENV_ACCOUNT_URL && !CLOUDINARY_ENV_ACCOUNT_URL.toLowerCase().startsWith('account://')) { - throw new Error("Invalid CLOUDINARY_ACCOUNT_URL protocol. URL should begin with 'account://'"); - } - if (!isEmpty(CLOUDINARY_API_PROXY)) { - extendCloudinaryConfig({ api_proxy: CLOUDINARY_API_PROXY }, cloudinary_config); - } - - [CLOUDINARY_ENV_URL, CLOUDINARY_ENV_ACCOUNT_URL].forEach((ENV_URL) => { - if (ENV_URL) { - let parsedConfig = parseCloudinaryConfigFromEnvURL(ENV_URL); - extendCloudinaryConfig(parsedConfig, cloudinary_config); - // Provide Query support in ENV url cloudinary://key:secret@test123?foo[bar]=value - // expect(cloudinary_config.foo.bar).to.eql('value') - extendCloudinaryConfigFromQuery(ENV_URL, cloudinary_config); - } - }); - } - if (!isUndefined(new_value)) { - cloudinary_config[new_config] = new_value; - } else if (isString(new_config)) { - return cloudinary_config[new_config]; - } else if (isObject(new_config)) { - extend(cloudinary_config, new_config); - } - return cloudinary_config; -}; diff --git a/server/node_modules/cloudinary/lib/preloaded_file.js b/server/node_modules/cloudinary/lib/preloaded_file.js deleted file mode 100644 index 1733bf8..0000000 --- a/server/node_modules/cloudinary/lib/preloaded_file.js +++ /dev/null @@ -1,61 +0,0 @@ -let PRELOADED_CLOUDINARY_PATH, config, utils; - -utils = require("./utils"); - -config = require("./config"); - -PRELOADED_CLOUDINARY_PATH = /^([^\/]+)\/([^\/]+)\/v(\d+)\/([^#]+)#([^\/]+)$/; - -class PreloadedFile { - constructor(file_info) { - let matches, public_id_and_format; - matches = file_info.match(PRELOADED_CLOUDINARY_PATH); - if (!matches) { - throw "Invalid preloaded file info"; - } - this.resource_type = matches[1]; - this.type = matches[2]; - this.version = matches[3]; - this.filename = matches[4]; - this.signature = matches[5]; - public_id_and_format = PreloadedFile.split_format(this.filename); - this.public_id = public_id_and_format[0]; - this.format = public_id_and_format[1]; - } - - is_valid() { - return utils.verify_api_response_signature(this.public_id, this.version, this.signature); - } - - static split_format(identifier) { - let format, last_dot, public_id; - last_dot = identifier.lastIndexOf("."); - if (last_dot === -1) { - return [identifier, null]; - } - public_id = identifier.substr(0, last_dot); - format = identifier.substr(last_dot + 1); - return [public_id, format]; - } - - identifier() { - return `v${this.version}/${this.filename}`; - } - - toString() { - return `${this.resource_type}/${this.type}/v${this.version}/${this.filename}#${this.signature}`; - } - - toJSON() { - let result = {}; - Object.getOwnPropertyNames(this).forEach((key) => { - let val = this[key]; - if (typeof val !== 'function') { - result[key] = val; - } - }); - return result; - } -} - -module.exports = PreloadedFile; diff --git a/server/node_modules/cloudinary/lib/provisioning/account.js b/server/node_modules/cloudinary/lib/provisioning/account.js deleted file mode 100644 index f2c8566..0000000 --- a/server/node_modules/cloudinary/lib/provisioning/account.js +++ /dev/null @@ -1,390 +0,0 @@ -const utils = require("../utils"); -const call_account_api = require('../api_client/call_account_api'); - -const { pickOnlyExistingValues } = utils; - -/** - * @desc Lists sub-accounts. - * @param [enabled] {boolean} - Whether to only return enabled sub-accounts (true) or disabled accounts (false). - * Default: all accounts are returned (both enabled and disabled). - * @param [ids] {number[]} - A list of up to 100 sub-account IDs. When provided, other parameters are ignored. - * @param [prefix] {string} - Returns accounts where the name begins with the specified case-insensitive string. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function sub_accounts(enabled, ids = [], prefix, options = {}, callback) { - let params = { - enabled, - ids, - prefix - }; - - let uri = ['sub_accounts']; - return call_account_api('GET', uri, params, callback, options); -} - - -/** - * @desc Retrieves the details of the specified sub-account. - * @param sub_account_id {string} - The ID of the sub-account. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function sub_account(sub_account_id, options = {}, callback) { - let uri = ['sub_accounts', sub_account_id]; - return call_account_api('GET', uri, {}, callback, options); -} - - -/** - * @desc Creates a new sub-account. Any users that have access to all sub-accounts will also automatically have access - * to the new sub-account. - * @param name {string} The display name as shown in the management console. - * @param cloud_name {string} A case-insensitive cloud name comprised of alphanumeric and underscore characters. - * Generates an error if the specified cloud name is not unique across all Cloudinary - * accounts. Note: Once created, the name can only be changed for accounts with fewer than - * 1000 assets. - * @param custom_attributes {object} Any custom attributes you want to associate with the sub-account, as a map/hash of - * key/value pairs. - * @param enabled {boolean} Whether the sub-account is enabled. Default: true - * @param base_account {string} The ID of another sub-account, from which to copy all of the following settings: - * Size limits, Timed limits, and Flags. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param callback - */ -function create_sub_account(name, cloud_name, custom_attributes, enabled, base_account, options = {}, callback) { - let params = { - cloud_name: cloud_name, - name, - custom_attributes: custom_attributes, - enabled, - base_sub_account_id: base_account - }; - - options.content_type = "json"; - let uri = ['sub_accounts']; - return call_account_api('POST', uri, params, callback, options); -} - -/** - * @desc Deletes the specified sub-account. Supported only for accounts with fewer than 1000 assets. - * @param sub_account_id {string} - The ID of the sub-account to delete. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function delete_sub_account(sub_account_id, options = {}, callback) { - let uri = ['sub_accounts', sub_account_id]; - return call_account_api('DELETE', uri, {}, callback, options); -} - -/** - * @desc Updates the specified details of the sub-account. - * @param sub_account_id {string} - The ID of the sub-account. - * @param [name] {string} - The display name as shown in the management console. - * @param [cloud_name] {string} - A new cloud name for the account. - * Notes: - * - Can only be changed for accounts with fewer than 1000 assets. - * - generates an error if the cloud name is not unique across all Cloudinary accounts. - * @param [custom_attributes] {object} - Any custom attributes you want to associate with the sub-account, as a map/hash - * of key/value pairs. - * @param [enabled] {boolean} - Whether the sub-account is enabled. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function update_sub_account(sub_account_id, name, cloud_name, custom_attributes, enabled, options = {}, callback) { - let params = { - cloud_name: cloud_name, - name, - custom_attributes: custom_attributes, - enabled - }; - - options.content_type = "json"; - let uri = ['sub_accounts', sub_account_id]; - return call_account_api('PUT', uri, params, callback, options); -} - -/** - * @desc Returns the user with the specified ID. - * @param user_id {string} - The ID of the user. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function user(user_id, options = {}, callback) { - let uri = ['users', user_id]; - return call_account_api('GET', uri, {}, callback, options); -} - -/** - * @desc Lists users in the account. - * @param [pending] {boolean} - Limit results to pending users (true), users that are not pending (false), or all users (undefined, the default) - * @param [user_ids] {string[]} - A list of up to 100 user IDs. When provided, other parameters are ignored. - * @param [prefix] {string} - Returns users where the name or email address begins with the specified case-insensitive - * string. - * @param [sub_account_id[ {string} - Only returns users who have access to the specified account. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function users(pending, user_ids, prefix, sub_account_id, options = {}, callback) { - let uri = ['users']; - let params = { - ids: user_ids, - pending, - prefix, - sub_account_id - }; - return call_account_api('GET', uri, pickOnlyExistingValues(params, "ids", "pending", "prefix", "sub_account_id"), callback, options); -} - -/** - * @desc Creates a new user in the account. - * @param name {string} - The name of the user. - * @param email {string} - A unique email address, which serves as the login name and notification address. - * @param role {string} - The role to assign. Possible values: master_admin, admin, billing, technical_admin, reports, - * media_library_admin, media_library_user - * @param [sub_account_ids] {string[]} - The list of sub-account IDs that this user can access. - * Note: This parameter is ignored if the role is specified as master_admin. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function create_user(name, email, role, sub_account_ids, options = {}, callback) { - let uri = ['users']; - let params = { - name, - email, - role, - sub_account_ids: sub_account_ids - }; - options.content_type = 'json'; - return call_account_api('POST', uri, params, callback, options); -} - -/** - * @desc Updates the details of the specified user. - * @param user_id {string} - The ID of the user to update. - * @param [name] {string} - The name of the user. - * @param [email] {string} - A unique email address, which serves as the login name and notification address. - * @param [role] {string} - The role to assign. Possible values: master_admin, admin, billing, technical_admin, reports, - * media_library_admin, media_library_user - * @param [sub_account_ids] {string[]} - The list of sub-account IDs that this user can access. - * Note: This parameter is ignored if the role is specified as master_admin. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function update_user(user_id, name, email, role, sub_account_ids, options = {}, callback) { - let uri = ['users', user_id]; - let params = { - name, - email, - role, - sub_account_ids: sub_account_ids - }; - options.content_type = 'json'; - return call_account_api('PUT', uri, params, callback, options); -} - -/** - * @desc Deletes an existing user. - * @param user_id {string} - The ID of the user to delete. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function delete_user(user_id, options = {}, callback) { - let uri = ['users', user_id]; - return call_account_api('DELETE', uri, {}, callback, options); -} - -/** - * @desc Creates a new user group. - * @param name {string} - The name for the user group. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function create_user_group(name, options = {}, callback) { - let uri = ['user_groups']; - options.content_type = 'json'; - let params = { - name - }; - return call_account_api('POST', uri, params, callback, options); -} - -/** - * @desc Updates the specified user group. - * @param group_id {string} The ID of the user group to update. - * @param name {string} - The name for the user group. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function update_user_group(group_id, name, options = {}, callback) { - let uri = ['user_groups', group_id]; - let params = { - name - }; - return call_account_api('PUT', uri, params, callback, options); -} - -/** - * @desc Deletes the user group with the specified ID. - * @param group_id {string} The ID of the user group to delete. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function delete_user_group(group_id, options = {}, callback) { - let uri = ['user_groups', group_id]; - return call_account_api('DELETE', uri, {}, callback, options); -} - -/** - * @desc Adds a user to a group with the specified ID. - * @param group_id {string} - The ID of the user group. - * @param user_id {string} - The ID of the user. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function add_user_to_group(group_id, user_id, options = {}, callback) { - let uri = ['user_groups', group_id, 'users', user_id]; - return call_account_api('POST', uri, {}, callback, options); -} - -/** - * @desc Removes a user from a group with the specified ID. - * @param group_id {string} - The ID of the user group. - * @param user_id {string} - The ID of the user. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function remove_user_from_group(group_id, user_id, options = {}, callback) { - let uri = ['user_groups', group_id, 'users', user_id]; - return call_account_api('DELETE', uri, {}, callback, options); -} - -/** - * @desc Retrieves the details of the specified user group. - * @param group_id {string} - The ID of the user group to retrieve. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function user_group(group_id, options = {}, callback) { - let uri = ['user_groups', group_id]; - return call_account_api('GET', uri, {}, callback, options); -} - -/** - * @desc Lists user groups in the account. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function user_groups(options = {}, callback) { - let uri = ['user_groups']; - return call_account_api('GET', uri, {}, callback, options); -} - -/** - * @desc Lists users in the specified user group. - * @param group_id {string} - The ID of the user group. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters|Configuration parameters} in the SDK documentation. - * @param [callback] {function} - */ -function user_group_users(group_id, options = {}, callback) { - let uri = ['user_groups', group_id, 'users']; - return call_account_api('GET', uri, {}, callback, options); -} - -/** - * @desc Lists access keys in the given subaccount. - * @param sub_account_id {string} - The ID of the subaccount. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/provisioning_api#tag/access-keys/GET/sub_accounts/{{sub_account_id}}/access_keys|get access keys optional parameters} in the SDK documentation. - * @param [callback] {function} - */ -function access_keys(sub_account_id, options = {}, callback) { - const params = pickOnlyExistingValues({ - page_size: options.page_size, - page: options.page, - sort_by: options.sort_by, - sort_order: options.sort_order - }, 'page_size', 'page', 'sort_by', 'sort_order'); - const uri = ['sub_accounts', sub_account_id, 'access_keys']; - return call_account_api('GET', uri, params, callback, options); -} - -/** - * @desc Generate a new access key pair in the given subaccount. - * @param sub_account_id {string} - The ID of the subaccount. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/provisioning_api#tag/access-keys/POST/sub_accounts/{{sub_account_id}}/access_keys|generate access key optional parameters} in the SDK documentation. - * @param [callback] {function} - */ -function generate_access_key(sub_account_id, options = {}, callback) { - const params = pickOnlyExistingValues({ - name: options.name, - enabled: options.enabled - }, 'name', 'enabled'); - options.content_type = "json"; - const uri = ['sub_accounts', sub_account_id, 'access_keys']; - return call_account_api('POST', uri, params, callback, options); -} - -/** - * @desc Update an existing access key pair in the given subaccount. - * @param sub_account_id {string} - The ID of the subaccount. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/provisioning_api#tag/access-keys/PUT/sub_accounts/{sub_account_id}/access_keys/{key}|update access key optional parameters} in the SDK documentation. - * @param [callback] {function} - */ -function update_access_key(sub_account_id, api_key, options = {}, callback) { - const params = pickOnlyExistingValues({ - name: options.name, - enabled: options.enabled - }, 'name', 'enabled'); - options.content_type = "json"; - const uri = ['sub_accounts', sub_account_id, 'access_keys', api_key]; - return call_account_api('PUT', uri, params, callback, options); -} - -/** - * @desc Delete an existing access key pair in the given subaccount. - * @param sub_account_id {string} - The ID of the subaccount. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/provisioning_api#tag/access-keys/DELETE/sub_accounts/{sub_account_id}/access_keys|delete access key optional parameters} in the SDK documentation. - * @param [callback] {function} - */ -function delete_access_key(sub_account_id, api_key, options = {}, callback) { - const uri = ['sub_accounts', sub_account_id, 'access_keys', api_key]; - return call_account_api('DELETE', uri, {}, callback, options); -} - -/** - * @desc Delete an existing access key pair in the given subaccount by its name. - * @param sub_account_id {string} - The ID of the subaccount. - * @param [options] {object} - See {@link https://cloudinary.com/documentation/provisioning_api#tag/access-keys/DELETE/sub_accounts/{sub_account_id}/access_keys|delete access key optional parameters} in the SDK documentation. - * @param [callback] {function} - */ -function delete_access_key_by_name(sub_account_id, options = {}, callback) { - const params = { name: options.name }; - const uri = ['sub_accounts', sub_account_id, 'access_keys']; - return call_account_api('DELETE', uri, params, callback, options); -} - -module.exports = { - sub_accounts, - create_sub_account, - delete_sub_account, - sub_account, - update_sub_account, - user, - users, - user_group, - user_groups, - user_group_users, - remove_user_from_group, - delete_user, - update_user_group, - update_user, - create_user, - create_user_group, - add_user_to_group, - delete_user_group, - access_keys, - generate_access_key, - update_access_key, - delete_access_key, - delete_access_key_by_name -}; diff --git a/server/node_modules/cloudinary/lib/upload_stream.js b/server/node_modules/cloudinary/lib/upload_stream.js deleted file mode 100644 index de946a9..0000000 --- a/server/node_modules/cloudinary/lib/upload_stream.js +++ /dev/null @@ -1,23 +0,0 @@ - -const Transform = require("stream").Transform; - -class UploadStream extends Transform { - constructor(options) { - super(); - this.boundary = options.boundary; - } - - _transform(data, encoding, next) { - let buffer = ((Buffer.isBuffer(data)) ? data : Buffer.from(data, encoding)); - this.push(buffer); - next(); - } - - _flush(next) { - this.push(Buffer.from("\r\n", 'ascii')); - this.push(Buffer.from("--" + this.boundary + "--", 'ascii')); - return next(); - } -} - -module.exports = UploadStream; diff --git a/server/node_modules/cloudinary/lib/uploader.js b/server/node_modules/cloudinary/lib/uploader.js deleted file mode 100644 index 93318f0..0000000 --- a/server/node_modules/cloudinary/lib/uploader.js +++ /dev/null @@ -1,725 +0,0 @@ -const fs = require('fs'); -const { extname, basename } = require('path'); -const Q = require('q'); -const Writable = require("stream").Writable; -const urlLib = require('url'); - -// eslint-disable-next-line import/order -const { upload_prefix } = require("./config")(); - -const isSecure = !(upload_prefix && upload_prefix.slice(0, 5) === 'http:'); -const https = isSecure ? require('https') : require('http'); - -const Cache = require('./cache'); -const utils = require("./utils"); -const UploadStream = require('./upload_stream'); -const config = require("./config"); -const ensureOption = require('./utils/ensureOption').defaults(config()); - -const agent = config.api_proxy ? new https.Agent(config.api_proxy) : null; - -const { - build_upload_params, - extend, - includes, - isEmpty, - isObject, - isRemoteUrl, - merge, - pickOnlyExistingValues -} = utils; - -exports.unsigned_upload_stream = function unsigned_upload_stream(upload_preset, callback, options = {}) { - return exports.upload_stream(callback, merge(options, { - unsigned: true, - upload_preset: upload_preset - })); -}; - -exports.upload_stream = function upload_stream(callback, options = {}) { - return exports.upload(null, callback, extend({ - stream: true - }, options)); -}; - -exports.unsigned_upload = function unsigned_upload(file, upload_preset, callback, options = {}) { - return exports.upload(file, callback, merge(options, { - unsigned: true, - upload_preset: upload_preset - })); -}; - -exports.upload = function upload(file, callback, options = {}) { - return call_api("upload", callback, options, function () { - let params = build_upload_params(options); - return isRemoteUrl(file) ? [params, { file: file }] : [params, {}, file]; - }); -}; - -exports.upload_large = function upload_large(path, callback, options = {}) { - if ((path != null) && isRemoteUrl(path)) { - // upload a remote file - return exports.upload(path, callback, options); - } - if (path != null && !options.filename) { - options.filename = path.split(/(\\|\/)/g).pop().replace(/\.[^/.]+$/, ""); - } - return exports.upload_chunked(path, callback, extend({ - resource_type: 'raw' - }, options)); -}; - -exports.upload_chunked = function upload_chunked(path, callback, options) { - let file_reader = fs.createReadStream(path); - let out_stream = exports.upload_chunked_stream(callback, options); - return file_reader.pipe(out_stream); -}; - -class Chunkable extends Writable { - constructor(options) { - super(options); - this.chunk_size = options.chunk_size != null ? options.chunk_size : 20000000; - this.buffer = Buffer.alloc(0); - this.active = true; - this.on('finish', () => { - if (this.active) { - this.emit('ready', this.buffer, true, function () { - }); - } - }); - } - - _write(data, encoding, done) { - if (!this.active) { - done(); - } - if (this.buffer.length + data.length <= this.chunk_size) { - this.buffer = Buffer.concat([this.buffer, data], this.buffer.length + data.length); - done(); - } else { - const grab = this.chunk_size - this.buffer.length; - this.buffer = Buffer.concat([this.buffer, data.slice(0, grab)], this.buffer.length + grab); - this.emit('ready', this.buffer, false, (active) => { - this.active = active; - if (this.active) { - // Start processing the remaining data - const remaining = data.slice(grab); - this.buffer = Buffer.alloc(0); // Reset the buffer - this._write(remaining, encoding, done); // Process the remaining data - } - }); - } - } -} - -exports.upload_large_stream = function upload_large_stream(_unused_, callback, options = {}) { - return exports.upload_chunked_stream(callback, extend({ - resource_type: 'raw' - }, options)); -}; - -exports.upload_chunked_stream = function upload_chunked_stream(callback, options = {}) { - options = extend({}, options, { - stream: true - }); - options.x_unique_upload_id = utils.random_public_id(); - let params = build_upload_params(options); - let chunk_size = options.chunk_size != null ? options.chunk_size : options.part_size; - let chunker = new Chunkable({ - chunk_size: chunk_size - }); - let sent = 0; - chunker.on('ready', function (buffer, is_last, done) { - let chunk_start = sent; - sent += buffer.length; - options.content_range = `bytes ${chunk_start}-${sent - 1}/${(is_last ? sent : -1)}`; - params.timestamp = utils.timestamp(); - let finished_part = function (result) { - const errorOrLast = (result.error != null) || is_last; - if (errorOrLast && typeof callback === "function") { - callback(result); - } - return done(!errorOrLast); - }; - let stream = call_api("upload", finished_part, options, function () { - return [params, {}, buffer]; - }); - return stream.write(buffer, 'buffer', function () { - return stream.end(); - }); - }); - return chunker; -}; - -exports.explicit = function explicit(public_id, callback, options = {}) { - return call_api("explicit", callback, options, function () { - return utils.build_explicit_api_params(public_id, options); - }); -}; - -// Creates a new archive in the server and returns information in JSON format -exports.create_archive = function create_archive(callback, options = {}, target_format = null) { - return call_api("generate_archive", callback, options, function () { - let opt = utils.archive_params(options); - if (target_format) { - opt.target_format = target_format; - } - return [opt]; - }); -}; - -// Creates a new zip archive in the server and returns information in JSON format -exports.create_zip = function create_zip(callback, options = {}) { - return exports.create_archive(callback, options, "zip"); -}; - - -exports.create_slideshow = function create_slideshow(options, callback) { - options.resource_type = ensureOption(options, "resource_type", "video"); - return call_api("create_slideshow", callback, options, function () { - // Generate a transformation from the manifest_transformation key, which should be a valid transformation - const manifest_transformation = utils.generate_transformation_string(extend({}, options.manifest_transformation)); - - // Try to use {options.transformation} to generate a transformation (Example: options.transformation.width, options.transformation.height) - const transformation = utils.generate_transformation_string(extend({}, ensureOption(options, 'transformation', {}))); - - return [ - { - timestamp: utils.timestamp(), - manifest_transformation: manifest_transformation, - upload_preset: options.upload_preset, - overwrite: options.overwrite, - public_id: options.public_id, - notification_url: options.notification_url, - manifest_json: options.manifest_json, - tags: options.tags, - transformation: transformation - } - ]; - }); -}; - - -exports.destroy = function destroy(public_id, callback, options = {}) { - return call_api("destroy", callback, options, function () { - return [ - { - timestamp: utils.timestamp(), - type: options.type, - invalidate: options.invalidate, - public_id: public_id, - notification_url: options.notification_url - } - ]; - }); -}; - -exports.rename = function rename(from_public_id, to_public_id, callback, options = {}) { - return call_api("rename", callback, options, function () { - return [ - { - timestamp: utils.timestamp(), - type: options.type, - from_public_id: from_public_id, - to_public_id: to_public_id, - overwrite: options.overwrite, - invalidate: options.invalidate, - to_type: options.to_type, - context: options.context, - metadata: options.metadata, - notification_url: options.notification_url - } - ]; - }); -}; - -const TEXT_PARAMS = ["public_id", "font_family", "font_size", "font_color", "text_align", "font_weight", "font_style", "background", "opacity", "text_decoration", "font_hinting", "font_antialiasing"]; - -exports.text = function text(content, callback, options = {}) { - return call_api("text", callback, options, function () { - let textParams = pickOnlyExistingValues(options, ...TEXT_PARAMS); - let params = { - timestamp: utils.timestamp(), - text: content, - ...textParams - }; - - return [params]; - }); -}; - -/** - * Generate a sprite by merging multiple images into a single large image for reducing network overhead and bypassing - * download limitations. - * - * The process produces 2 files as follows: - * - A single image file containing all the images with the specified tag (PNG by default). - * - A CSS file that includes the style class names and the location of the individual images in the sprite. - * - * @param {String|Object} tag A string specifying a tag that indicates which images to include or an object - * which includes options and image URLs. - * @param {Function} callback Callback function - * @param {Object} options Configuration options. If options are passed as the first parameter, this parameter - * should be empty - * - * @return {Object} - */ -exports.generate_sprite = function generate_sprite(tag, callback, options = {}) { - return call_api("sprite", callback, options, function () { - return [utils.build_multi_and_sprite_params(tag, options)]; - }); -}; - - -/** - * Returns a signed url to download a sprite - * - * @param {String|Object} tag A string specifying a tag that indicates which images to include or an object - * which includes options and image URLs. - * @param {Object} options Configuration options. If options are passed as the first parameter, this parameter - * should be empty - * - * @returns {string} - */ -exports.download_generated_sprite = function download_generated_sprite(tag, options = {}) { - return utils.api_download_url("sprite", utils.build_multi_and_sprite_params(tag, options), options); -} - -/** - * Returns a signed url to download a single animated image (GIF, PNG or WebP), video (MP4 or WebM) or a single PDF from - * multiple image assets. - * - * @param {String|Object} tag A string specifying a tag that indicates which images to include or an object - * which includes options and image URLs. - * @param {Object} options Configuration options. If options are passed as the first parameter, this parameter - * should be empty - * - * @returns {string} - */ -exports.download_multi = function download_multi(tag, options = {}) { - return utils.api_download_url("multi", utils.build_multi_and_sprite_params(tag, options), options); -} - -/** - * Creates either a single animated image (GIF, PNG or WebP), video (MP4 or WebM) or a single PDF from multiple image - * assets. - * - * Each asset is included as a single frame of the resulting animated image/video, or a page of the PDF (sorted - * alphabetically by their Public ID). - * - * @param {String|Object} tag A string specifying a tag that indicates which images to include or an object - * which includes options and image URLs. - * @param {Function} callback Callback function - * @param {Object} options Configuration options. If options are passed as the first parameter, this parameter - * should be empty - * - * @return {Object} - */ -exports.multi = function multi(tag, callback, options = {}) { - return call_api("multi", callback, options, function () { - return [utils.build_multi_and_sprite_params(tag, options)]; - }); -}; - -exports.explode = function explode(public_id, callback, options = {}) { - return call_api("explode", callback, options, function () { - const transformation = utils.generate_transformation_string(extend({}, options)); - return [ - { - timestamp: utils.timestamp(), - public_id: public_id, - transformation: transformation, - format: options.format, - type: options.type, - notification_url: options.notification_url - } - ]; - }); -}; - -/** - * - * @param {String} tag The tag or tags to assign. Can specify multiple - * tags in a single string, separated by commas - "t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11". - * - * @param {Array} public_ids A list of public IDs (up to 1000) of assets uploaded to Cloudinary. - * - * @param {Function} callback Callback function - * - * @param {Object} options Configuration options may include 'exclusive' (boolean) which causes - * clearing this tag from all other resources - * @return {Object} - */ -exports.add_tag = function add_tag(tag, public_ids = [], callback, options = {}) { - const exclusive = utils.option_consume("exclusive", options); - const command = exclusive ? "set_exclusive" : "add"; - return call_tags_api(tag, command, public_ids, callback, options); -}; - - -/** - * @param {String} tag The tag or tags to remove. Can specify multiple - * tags in a single string, separated by commas - "t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11". - * - * @param {Array} public_ids A list of public IDs (up to 1000) of assets uploaded to Cloudinary. - * - * @param {Function} callback Callback function - * - * @param {Object} options Configuration options may include 'exclusive' (boolean) which causes - * clearing this tag from all other resources - * @return {Object} - */ -exports.remove_tag = function remove_tag(tag, public_ids = [], callback, options = {}) { - return call_tags_api(tag, "remove", public_ids, callback, options); -}; - -exports.remove_all_tags = function remove_all_tags(public_ids = [], callback, options = {}) { - return call_tags_api(null, "remove_all", public_ids, callback, options); -}; - -exports.replace_tag = function replace_tag(tag, public_ids = [], callback, options = {}) { - return call_tags_api(tag, "replace", public_ids, callback, options); -}; - -function call_tags_api(tag, command, public_ids = [], callback, options = {}) { - return call_api("tags", callback, options, function () { - let params = { - timestamp: utils.timestamp(), - public_ids: utils.build_array(public_ids), - command: command, - type: options.type - }; - if (tag != null) { - params.tag = tag; - } - return [params]; - }); -} - -exports.add_context = function add_context(context, public_ids = [], callback, options = {}) { - return call_context_api(context, 'add', public_ids, callback, options); -}; - -exports.remove_all_context = function remove_all_context(public_ids = [], callback, options = {}) { - return call_context_api(null, 'remove_all', public_ids, callback, options); -}; - -function call_context_api(context, command, public_ids = [], callback, options = {}) { - return call_api('context', callback, options, function () { - let params = { - timestamp: utils.timestamp(), - public_ids: utils.build_array(public_ids), - command: command, - type: options.type - }; - if (context != null) { - params.context = utils.encode_context(context); - } - return [params]; - }); -} - -/** - * Cache (part of) the upload results. - * @param result - * @param {object} options - * @param {string} options.type - * @param {string} options.resource_type - */ -function cacheResults(result, { type, resource_type }) { - if (result.responsive_breakpoints) { - result.responsive_breakpoints.forEach( - ({ transformation, - url, - breakpoints }) => Cache.set( - result.public_id, - { type, resource_type, raw_transformation: transformation, format: extname(breakpoints[0].url).slice(1) }, - breakpoints.map(i => i.width) - ) - ); - } -} - - -function parseResult(buffer, res) { - let result = ''; - try { - result = JSON.parse(buffer); - if (result.error && !result.error.name) { - result.error.name = "Error"; - } - } catch (jsonError) { - result = { - error: { - message: `Server return invalid JSON response. Status Code ${res.statusCode}. ${jsonError}`, - name: "Error" - } - }; - } - return result; -} - -function call_api(action, callback, options, get_params) { - if (typeof callback !== "function") { - callback = function () {}; - } - - const USE_PROMISES = !options.disable_promises; - - let deferred = Q.defer(); - if (options == null) { - options = {}; - } - let [params, unsigned_params, file] = get_params.call(); - params = utils.process_request_params(params, options); - params = extend(params, unsigned_params); - let api_url = utils.api_url(action, options); - let boundary = utils.random_public_id(); - let errorRaised = false; - let handle_response = function (res) { - // let buffer; - if (errorRaised) { - - // Already reported - } else if (res.error) { - errorRaised = true; - - if (USE_PROMISES) { - deferred.reject(res); - } - callback(res); - } else if (includes([200, 400, 401, 404, 420, 500], res.statusCode)) { - let buffer = ""; - res.on("data", (d) => { - buffer += d; - return buffer; - }); - res.on("end", () => { - let result; - if (errorRaised) { - return; - } - result = parseResult(buffer, res); - if (result.error) { - result.error.http_code = res.statusCode; - if (USE_PROMISES) { - deferred.reject(result.error); - } - } else { - cacheResults(result, options); - if (USE_PROMISES) { - deferred.resolve(result); - } - } - callback(result); - }); - res.on("error", (error) => { - errorRaised = true; - if (USE_PROMISES) { - deferred.reject(error); - } - callback({ error }); - }); - } else { - let error = { - message: `Server returned unexpected status code - ${res.statusCode}`, - http_code: res.statusCode, - name: "UnexpectedResponse" - }; - if (USE_PROMISES) { - deferred.reject(error); - } - callback({ error }); - } - }; - let post_data = utils.hashToParameters(params) - .filter(([key, value]) => value != null) - .map( - ([key, value]) => Buffer.from(encodeFieldPart(boundary, key, value), 'utf8') - ); - let result = post(api_url, post_data, boundary, file, handle_response, options); - if (isObject(result)) { - return result; - } - - if (USE_PROMISES) { - return deferred.promise; - } -} - -function post(url, post_data, boundary, file, callback, options) { - let file_header; - let finish_buffer = Buffer.from("--" + boundary + "--", 'ascii'); - let oauth_token = options.oauth_token || config().oauth_token; - if ((file != null) || options.stream) { - // eslint-disable-next-line no-nested-ternary - let filename = options.stream ? options.filename ? options.filename : "file" : basename(file); - file_header = Buffer.from(encodeFilePart(boundary, 'application/octet-stream', 'file', filename), 'binary'); - } - let post_options = urlLib.parse(url); - let headers = { - 'Content-Type': `multipart/form-data; boundary=${boundary}`, - 'User-Agent': utils.getUserAgent() - }; - if (options.content_range != null) { - headers['Content-Range'] = options.content_range; - } - if (options.x_unique_upload_id != null) { - headers['X-Unique-Upload-Id'] = options.x_unique_upload_id; - } - if (options.extra_headers !== null) { - headers = merge(headers, options.extra_headers); - } - if (oauth_token != null) { - headers.Authorization = `Bearer ${oauth_token}`; - } - - post_options = extend(post_options, { - method: 'POST', - headers: headers - }); - if (options.agent != null) { - post_options.agent = options.agent; - } - let proxy = options.api_proxy || config().api_proxy; - if (!isEmpty(proxy)) { - if (!post_options.agent && agent) { - post_options.agent = agent; - } else if (!post_options.agent) { - post_options.agent = new https.Agent(proxy); - } else { - console.warn("Proxy is set, but request uses a custom agent, proxy is ignored."); - } - } - - let post_request = https.request(post_options, callback); - let upload_stream = new UploadStream({ boundary }); - upload_stream.pipe(post_request); - let timeout = false; - post_request.on("error", function (error) { - if (timeout) { - error = { - message: "Request Timeout", - http_code: 499, - name: "TimeoutError" - }; - } - return callback({ error }); - }); - post_request.setTimeout(options.timeout != null ? options.timeout : 60000, function () { - timeout = true; - return post_request.abort(); - }); - post_data.forEach(postDatum => post_request.write(postDatum)); - if (options.stream) { - post_request.write(file_header); - return upload_stream; - } - if (file != null) { - post_request.write(file_header); - fs.createReadStream(file).on('error', function (error) { - callback({ - error: error - }); - return post_request.abort(); - }).pipe(upload_stream); - } else { - post_request.write(finish_buffer); - post_request.end(); - } - return true; -} - -function encodeFieldPart(boundary, name, value) { - return [ - `--${boundary}\r\n`, - `Content-Disposition: form-data; name="${name}"\r\n`, - '\r\n', - `${value}\r\n`, - '' - ].join(''); -} - -function encodeFilePart(boundary, type, name, filename) { - return [ - `--${boundary}\r\n`, - `Content-Disposition: form-data; name="${name}"; filename="${filename}"\r\n`, - `Content-Type: ${type}\r\n`, - '\r\n', - '' - ].join(''); -} - -exports.direct_upload = function direct_upload(callback_url, options = {}) { - let params = build_upload_params(extend({ - callback: callback_url - }, options)); - params = utils.process_request_params(params, options); - let api_url = utils.api_url("upload", options); - return { - hidden_fields: params, - form_attrs: { - action: api_url, - method: "POST", - enctype: "multipart/form-data" - } - }; -}; - -exports.upload_tag_params = function upload_tag_params(options = {}) { - let params = build_upload_params(options); - params = utils.process_request_params(params, options); - return JSON.stringify(params); -}; - -exports.upload_url = function upload_url(options = {}) { - if (options.resource_type == null) { - options.resource_type = "auto"; - } - return utils.api_url("upload", options); -}; - -exports.image_upload_tag = function image_upload_tag(field, options = {}) { - let html_options = options.html || {}; - let tag_options = extend({ - type: "file", - name: "file", - "data-url": exports.upload_url(options), - "data-form-data": exports.upload_tag_params(options), - "data-cloudinary-field": field, - "data-max-chunk-size": options.chunk_size, - "class": [html_options.class, "cloudinary-fileupload"].join(" ") - }, html_options); - return ``; -}; - -exports.unsigned_image_upload_tag = function unsigned_image_upload_tag(field, upload_preset, options = {}) { - return exports.image_upload_tag(field, merge(options, { - unsigned: true, - upload_preset: upload_preset - })); -}; - - -/** - * Populates metadata fields with the given values. Existing values will be overwritten. - * - * @param {Object} metadata A list of custom metadata fields (by external_id) and the values to assign to each - * @param {Array} public_ids The public IDs of the resources to update - * @param {Function} callback Callback function - * @param {Object} options Configuration options - * - * @return {Object} - */ -exports.update_metadata = function update_metadata(metadata, public_ids, callback, options = {}) { - return call_api("metadata", callback, options, function () { - let params = { - metadata: utils.encode_context(metadata), - public_ids: utils.build_array(public_ids), - timestamp: utils.timestamp(), - type: options.type, - clear_invalid: options.clear_invalid - }; - return [params]; - }); -}; diff --git a/server/node_modules/cloudinary/lib/utils/analytics/encodeVersion.js b/server/node_modules/cloudinary/lib/utils/analytics/encodeVersion.js deleted file mode 100644 index 89ee463..0000000 --- a/server/node_modules/cloudinary/lib/utils/analytics/encodeVersion.js +++ /dev/null @@ -1,44 +0,0 @@ -const reverseVersion = require('./reverseVersion'); -const stringPad = require('./stringPad'); -const base64Map = require('../encoding/base64Map'); - -/** - * @private - * @description Encodes a semVer-like version string - * @param {string} semVer Input can be either x.y.z or x.y - * @return {string} A string built from 3 characters of the base64 table that encode the semVer - */ -module.exports = (semVer) => { - let strResult = ''; - - // support x.y or x.y.z by using 'parts' as a variable - let parts = semVer.split('.').length; - let paddedStringLength = parts * 6; // we pad to either 12 or 18 characters - - // reverse (but don't mirror) the version. 1.5.15 -> 15.5.1 - // Pad to two spaces, 15.5.1 -> 15.05.01 - let paddedReversedSemver = reverseVersion(semVer); - - // turn 15.05.01 to a string '150501' then to a number 150501 - let num = parseInt(paddedReversedSemver.split('.').join('')); - - // Represent as binary, add left padding to 12 or 18 characters. - // 150,501 -> 100100101111100101 - - let paddedBinary = num.toString(2); - paddedBinary = stringPad(paddedBinary, paddedStringLength, '0'); - - // Stop in case an invalid version number was provided - // paddedBinary must be built from sections of 6 bits - if (paddedBinary.length % 6 !== 0) { - throw 'Version must be smaller than 43.21.26)'; - } - - // turn every 6 bits into a character using the base64Map - paddedBinary.match(/.{1,6}/g).forEach((bitString) => { - // console.log(bitString); - strResult += base64Map[bitString]; - }); - - return strResult; -}; diff --git a/server/node_modules/cloudinary/lib/utils/analytics/getSDKVersions.js b/server/node_modules/cloudinary/lib/utils/analytics/getSDKVersions.js deleted file mode 100644 index 14daeb2..0000000 --- a/server/node_modules/cloudinary/lib/utils/analytics/getSDKVersions.js +++ /dev/null @@ -1,42 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const sdkCode = 'M'; // Constant per SDK - -function readSdkSemver() { - const pkgJsonPath = path.join(__dirname, '../../../package.json'); - try { - const pkgJSONFile = fs.readFileSync(pkgJsonPath, 'utf-8'); - return JSON.parse(pkgJSONFile).version - } catch (e) { - if (e.code === 'ENOENT') { - return '0.0.0' - } - return 'n/a'; - } -} - -/** - * @description Gets the relevant versions of the SDK(package version, node version and sdkCode) - * @param {'default' | 'x.y.z' | 'x.y' | string} useSDKVersion Default uses package.json version - * @param {'default' | 'x.y.z' | 'x.y' | string} useNodeVersion Default uses process.versions.node - * @return {{sdkSemver:string, techVersion:string, sdkCode:string}} A map of relevant versions and codes - */ -function getSDKVersions(useSDKVersion = 'default', useNodeVersion = 'default') { - // allow to pass a custom SDKVersion - const sdkSemver = useSDKVersion === 'default' ? readSdkSemver() : useSDKVersion; - - // allow to pass a custom techVersion (Node version) - const version = process.version.slice(1); - const techVersion = useNodeVersion === 'default' ? version : useNodeVersion; - - const product = 'A'; - - return { - sdkSemver, - techVersion, - sdkCode, - product - }; -} - -module.exports = getSDKVersions; diff --git a/server/node_modules/cloudinary/lib/utils/analytics/index.js b/server/node_modules/cloudinary/lib/utils/analytics/index.js deleted file mode 100644 index 08bca7c..0000000 --- a/server/node_modules/cloudinary/lib/utils/analytics/index.js +++ /dev/null @@ -1,67 +0,0 @@ -const removePatchFromSemver = require('./removePatchFromSemver'); -const encodeVersion = require('./encodeVersion'); - -/** - * @description Gets the SDK signature by encoding the SDK version and tech version - * @param {{ - * [techVersion]:string, - * [sdkSemver]: string, - * [sdkCode]: string, - * [product]: string, - * [feature]: string - * }} analyticsOptions - * @return {string} sdkAnalyticsSignature - */ -function getSDKAnalyticsSignature(analyticsOptions = {}) { - try { - const twoPartVersion = removePatchFromSemver(analyticsOptions.techVersion); - const encodedSDKVersion = encodeVersion(analyticsOptions.sdkSemver); - const encodedTechVersion = encodeVersion(twoPartVersion); - const featureCode = analyticsOptions.feature; - const SDKCode = analyticsOptions.sdkCode; - const product = analyticsOptions.product; - const algoVersion = 'B'; // The algo version is determined here, it should not be an argument - - return `${algoVersion}${product}${SDKCode}${encodedSDKVersion}${encodedTechVersion}${featureCode}`; - } catch (e) { - // Either SDK or Node versions were unparsable - return 'E'; - } -} - -/** - * @description Gets the analyticsOptions from options - should include sdkSemver, techVersion, sdkCode, and feature - * @param options - * @returns {{sdkSemver: (string), sdkCode, product, feature: string, techVersion: (string)} || {}} - */ -function getAnalyticsOptions(options) { - let analyticsOptions = { - sdkSemver: options.sdkSemver, - techVersion: options.techVersion, - sdkCode: options.sdkCode, - product: options.product, - feature: '0' - }; - if (options.urlAnalytics) { - if (options.accessibility) { - analyticsOptions.feature = 'D'; - } - if (options.loading === 'lazy') { - analyticsOptions.feature = 'C'; - } - if (options.responsive) { - analyticsOptions.feature = 'A'; - } - if (options.placeholder) { - analyticsOptions.feature = 'B'; - } - return analyticsOptions; - } else { - return {}; - } -} - -module.exports = { - getSDKAnalyticsSignature, - getAnalyticsOptions -}; diff --git a/server/node_modules/cloudinary/lib/utils/analytics/removePatchFromSemver.js b/server/node_modules/cloudinary/lib/utils/analytics/removePatchFromSemver.js deleted file mode 100644 index b282836..0000000 --- a/server/node_modules/cloudinary/lib/utils/analytics/removePatchFromSemver.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @description Removes patch version from the semver if it exists - * Turns x.y.z OR x.y into x.y - * @param {'x.y.z' || 'x.y' || string} semVerStr - */ -module.exports = (semVerStr) => { - let parts = semVerStr.split('.'); - return `${parts[0]}.${parts[1]}`; -} diff --git a/server/node_modules/cloudinary/lib/utils/analytics/reverseVersion.js b/server/node_modules/cloudinary/lib/utils/analytics/reverseVersion.js deleted file mode 100644 index c26ba1c..0000000 --- a/server/node_modules/cloudinary/lib/utils/analytics/reverseVersion.js +++ /dev/null @@ -1,20 +0,0 @@ -const stringPad = require('./stringPad'); - -/** - * @description A semVer like string, x.y.z or x.y is allowed - * Reverses the version positions, x.y.z turns to z.y.x - * Pads each segment with '0' so they have length of 2 - * Example: 1.2.3 -> 03.02.01 - * @param {string} semVer Input can be either x.y.z or x.y - * @return {string} in the form of zz.yy.xx ( - */ -module.exports = (semVer) => { - if (semVer.split('.').length < 2) { - throw new Error('invalid semVer, must have at least two segments'); - } - - // Split by '.', reverse, create new array with padded values and concat it together - return semVer.split('.').reverse().map((segment) => { - return stringPad(segment, 2, '0'); - }).join('.'); -}; diff --git a/server/node_modules/cloudinary/lib/utils/analytics/stringPad.js b/server/node_modules/cloudinary/lib/utils/analytics/stringPad.js deleted file mode 100644 index df83466..0000000 --- a/server/node_modules/cloudinary/lib/utils/analytics/stringPad.js +++ /dev/null @@ -1,22 +0,0 @@ -function repeatStringNumTimes(string, times) { - let repeatedString = ""; - while (times > 0) { - repeatedString += string; - times--; - } - return repeatedString; -} - -module.exports = (value, targetLength, padString) => { - targetLength = targetLength >> 0; // truncate if number or convert non-number to 0; - padString = String((typeof padString !== 'undefined' ? padString : ' ')); - if (value.length > targetLength) { - return String(value); - } else { - targetLength = targetLength - value.length; - if (targetLength > padString.length) { - padString += repeatStringNumTimes(padString, targetLength / padString.length); - } - return padString.slice(0, targetLength) + String(value); - } -} diff --git a/server/node_modules/cloudinary/lib/utils/consts.js b/server/node_modules/cloudinary/lib/utils/consts.js deleted file mode 100644 index 90f7449..0000000 --- a/server/node_modules/cloudinary/lib/utils/consts.js +++ /dev/null @@ -1,149 +0,0 @@ -const DEFAULT_RESPONSIVE_WIDTH_TRANSFORMATION = { - width: "auto", - crop: "limit" -}; - -const DEFAULT_POSTER_OPTIONS = { - format: 'jpg', - resource_type: 'video' -}; - -const DEFAULT_VIDEO_SOURCE_TYPES = ['webm', 'mp4', 'ogv']; - -const CONDITIONAL_OPERATORS = { - "=": 'eq', - "!=": 'ne', - "<": 'lt', - ">": 'gt', - "<=": 'lte', - ">=": 'gte', - "&&": 'and', - "||": 'or', - "*": "mul", - "/": "div", - "+": "add", - "-": "sub", - "^": "pow" -}; - -let SIMPLE_PARAMS = [ - ["audio_codec", "ac"], - ["audio_frequency", "af"], - ["bit_rate", 'br'], - ["color_space", "cs"], - ["default_image", "d"], - ["delay", "dl"], - ["density", "dn"], - ["duration", "du"], - ["end_offset", "eo"], - ["fetch_format", "f"], - ["gravity", "g"], - ["page", "pg"], - ["prefix", "p"], - ["start_offset", "so"], - ["streaming_profile", "sp"], - ["video_codec", "vc"], - ["video_sampling", "vs"] -]; - -const PREDEFINED_VARS = { - "aspect_ratio": "ar", - "aspectRatio": "ar", - "current_page": "cp", - "currentPage": "cp", - "duration": "du", - "face_count": "fc", - "faceCount": "fc", - "height": "h", - "initial_aspect_ratio": "iar", - "initial_height": "ih", - "initial_width": "iw", - "initialAspectRatio": "iar", - "initialHeight": "ih", - "initialWidth": "iw", - "initial_duration": "idu", - "initialDuration": "idu", - "page_count": "pc", - "page_x": "px", - "page_y": "py", - "pageCount": "pc", - "pageX": "px", - "pageY": "py", - "tags": "tags", - "width": "w" -}; - -const TRANSFORMATION_PARAMS = [ - 'angle', - 'aspect_ratio', - 'audio_codec', - 'audio_frequency', - 'background', - 'bit_rate', - 'border', - 'color', - 'color_space', - 'crop', - 'default_image', - 'delay', - 'density', - 'dpr', - 'duration', - 'effect', - 'end_offset', - 'fetch_format', - 'flags', - 'fps', - 'gravity', - 'height', - 'if', - 'keyframe_interval', - 'offset', - 'opacity', - 'overlay', - 'page', - 'prefix', - 'quality', - 'radius', - 'raw_transformation', - 'responsive_width', - 'size', - 'start_offset', - 'streaming_profile', - 'transformation', - 'underlay', - 'variables', - 'video_codec', - 'video_sampling', - 'width', - 'x', - 'y', - 'zoom' // + any key that starts with '$' -]; - -const LAYER_KEYWORD_PARAMS = { - font_weight: "normal", - font_style: "normal", - text_decoration: "none", - text_align: null, - stroke: "none" -}; - -const UPLOAD_PREFIX = "https://api.cloudinary.com"; - -const SUPPORTED_SIGNATURE_ALGORITHMS = ["sha1", "sha256"]; -const DEFAULT_SIGNATURE_ALGORITHM = "sha1"; - -module.exports = { - DEFAULT_RESPONSIVE_WIDTH_TRANSFORMATION, - DEFAULT_POSTER_OPTIONS, - DEFAULT_VIDEO_SOURCE_TYPES, - CONDITIONAL_OPERATORS, - PREDEFINED_VARS, - LAYER_KEYWORD_PARAMS, - TRANSFORMATION_PARAMS, - SIMPLE_PARAMS, - UPLOAD_PREFIX, - SUPPORTED_SIGNATURE_ALGORITHMS, - DEFAULT_SIGNATURE_ALGORITHM -}; diff --git a/server/node_modules/cloudinary/lib/utils/crc32.js b/server/node_modules/cloudinary/lib/utils/crc32.js deleted file mode 100644 index e8c21d3..0000000 --- a/server/node_modules/cloudinary/lib/utils/crc32.js +++ /dev/null @@ -1,41 +0,0 @@ -/* eslint-disable no-bitwise */ -// http://kevin.vanzonneveld.net -// + original by: Webtoolkit.info (http://www.webtoolkit.info/) -// + improved by: T0bsn -// + improved by: http://stackoverflow.com/questions/2647935/javascript-crc32-function-and-php-crc32-not-matching -// - depends on: utf8_encode -// * example 1: crc32('Kevin van Zonneveld') -// * returns 1: 1249991249 - -const utf8_encode = require('./utf8_encode'); - -/** - * Compute the crc32 checksum if the given string - * @private - * @param {string} str - * @return {number|*} - */ -function crc32(str) { - let crc, i, iTop, table, x, y; - str = utf8_encode(str); - table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D"; - crc = 0; - x = 0; - y = 0; - crc = crc ^ (-1); - i = 0; - iTop = str.length; - while (i < iTop) { - y = (crc ^ str.charCodeAt(i)) & 0xFF; - x = "0x" + table.substr(y * 9, 8); - crc = (crc >>> 8) ^ x; - i++; - } - crc = crc ^ (-1); - if (crc < 0) { - crc += 4294967296; - } - return crc; -} - -module.exports = crc32; diff --git a/server/node_modules/cloudinary/lib/utils/encoding/base64Encode.js b/server/node_modules/cloudinary/lib/utils/encoding/base64Encode.js deleted file mode 100644 index e3aa190..0000000 --- a/server/node_modules/cloudinary/lib/utils/encoding/base64Encode.js +++ /dev/null @@ -1,8 +0,0 @@ -function base64Encode(input) { - if (!(input instanceof Buffer)) { - input = Buffer.from(String(input), 'binary'); - } - return input.toString('base64'); -} - -module.exports.base64Encode = base64Encode; diff --git a/server/node_modules/cloudinary/lib/utils/encoding/base64EncodeURL.js b/server/node_modules/cloudinary/lib/utils/encoding/base64EncodeURL.js deleted file mode 100644 index 738a789..0000000 --- a/server/node_modules/cloudinary/lib/utils/encoding/base64EncodeURL.js +++ /dev/null @@ -1,17 +0,0 @@ -const { base64Encode } = require('./base64Encode') - -function base64EncodeURL(sourceUrl) { - try { - sourceUrl = decodeURI(sourceUrl); - } catch (error) { - // ignore errors - } - sourceUrl = encodeURI(sourceUrl); - return base64Encode(sourceUrl) - .replace(/\+/g, '-') // Convert '+' to '-' - .replace(/\//g, '_') // Convert '/' to '_' - .replace(/=+$/, ''); // Remove ending '='; -} - - -module.exports.base64EncodeURL = base64EncodeURL; diff --git a/server/node_modules/cloudinary/lib/utils/encoding/base64Map.js b/server/node_modules/cloudinary/lib/utils/encoding/base64Map.js deleted file mode 100644 index 58b3767..0000000 --- a/server/node_modules/cloudinary/lib/utils/encoding/base64Map.js +++ /dev/null @@ -1,18 +0,0 @@ -const stringPad = require('../analytics/stringPad'); - -const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -let num = 0; - -/** - * Map of six-bit binary codes to Base64 characters - */ -let base64Map = {}; - -[...chars].forEach((char) => { - let key = num.toString(2); - key = stringPad(key, 6, '0'); - base64Map[key] = char; - num++; -}); - -module.exports = base64Map; diff --git a/server/node_modules/cloudinary/lib/utils/encoding/encodeDoubleArray.js b/server/node_modules/cloudinary/lib/utils/encoding/encodeDoubleArray.js deleted file mode 100644 index 9251b92..0000000 --- a/server/node_modules/cloudinary/lib/utils/encoding/encodeDoubleArray.js +++ /dev/null @@ -1,18 +0,0 @@ -const isArray = require('lodash/isArray'); -const toArray = require('../parsing/toArray'); - -/** - * Serialize an array of arrays into a string - * @param {string[] | Array.>} array - An array of arrays. - * If the first element is not an array the argument is wrapped in an array. - * @returns {string} A string representation of the arrays. - */ -function encodeDoubleArray(array) { - array = toArray(array); - if (!isArray(array[0])) { - array = [array]; - } - return array.map(e => toArray(e).join(",")).join("|"); -} - -module.exports = encodeDoubleArray; diff --git a/server/node_modules/cloudinary/lib/utils/encoding/smart_escape.js b/server/node_modules/cloudinary/lib/utils/encoding/smart_escape.js deleted file mode 100644 index e3e9fc9..0000000 --- a/server/node_modules/cloudinary/lib/utils/encoding/smart_escape.js +++ /dev/null @@ -1,11 +0,0 @@ -// Based on CGI::unescape. In addition does not escape / : -// smart_escape = (string) => encodeURIComponent(string).replace(/%3A/g, ":").replace(/%2F/g, "/") -function smart_escape(string, unsafe = /([^a-zA-Z0-9_.\-\/:]+)/g) { - return string.replace(unsafe, function (match) { - return match.split("").map(function (c) { - return "%" + c.charCodeAt(0).toString(16).toUpperCase(); - }).join(""); - }); -} - -module.exports = smart_escape; diff --git a/server/node_modules/cloudinary/lib/utils/ensureOption.js b/server/node_modules/cloudinary/lib/utils/ensureOption.js deleted file mode 100644 index 16d1473..0000000 --- a/server/node_modules/cloudinary/lib/utils/ensureOption.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Returns an ensureOption function that relies on the provided `defaultOptions` argument - * for default values. - * @private - * @param {object} defaultOptions - * @return {function(*, *, *=): *} - */ -function defaults(defaultOptions) { - return function ensureOption(options, name, defaultValue) { - let value; - - if (typeof options[name] !== 'undefined') { - value = options[name]; - } else if (typeof defaultOptions[name] !== 'undefined') { - value = defaultOptions[name]; - } else if (typeof defaultValue !== 'undefined') { - value = defaultValue; - } else { - throw new Error(`Must supply ${name}`); - } - - return value; - }; -} - -/** - * Get the option `name` from options, the global config, or the default value. - * If the value is not defined and no default value was provided, - * the method will throw an error. - * @private - * @param {object} options - * @param {string} name - * @param {*} [defaultValue] - * @return {*} the value associated with the provided `name` or the default. - * - */ -module.exports = defaults({}); - -module.exports.defaults = defaults; diff --git a/server/node_modules/cloudinary/lib/utils/ensurePresenceOf.js b/server/node_modules/cloudinary/lib/utils/ensurePresenceOf.js deleted file mode 100644 index 15adff8..0000000 --- a/server/node_modules/cloudinary/lib/utils/ensurePresenceOf.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Validate that the given values are defined - * @private - * @param {object} parameters where each key value pair is the name and value of the argument to validate. - * - * @example - * - * function foo(bar){ - * ensurePresenceOf({bar}); - * // ... - * } - */ -function ensurePresenceOf(parameters) { - let missing = Object.keys(parameters).filter(key => parameters[key] === undefined); - if (missing.length) { - console.error(missing.join(',') + " cannot be undefined"); - } -} - -module.exports = ensurePresenceOf; diff --git a/server/node_modules/cloudinary/lib/utils/entries.js b/server/node_modules/cloudinary/lib/utils/entries.js deleted file mode 100644 index 6bf8e19..0000000 --- a/server/node_modules/cloudinary/lib/utils/entries.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = Object.entries ? Object.entries : function (obj) { - let ownProps = Object.keys(obj), - i = ownProps.length, - resArray = new Array(i); // preallocate the Array - while (i--) { - resArray[i] = [ownProps[i], obj[ownProps[i]]]; - } - - return resArray; -}; diff --git a/server/node_modules/cloudinary/lib/utils/generateBreakpoints.js b/server/node_modules/cloudinary/lib/utils/generateBreakpoints.js deleted file mode 100644 index f81453e..0000000 --- a/server/node_modules/cloudinary/lib/utils/generateBreakpoints.js +++ /dev/null @@ -1,41 +0,0 @@ - -/** - * Helper function. Gets or populates srcset breakpoints using provided parameters - * Either the breakpoints or min_width, max_width, max_images must be provided. - * - * @module utils - * @private - * @param {srcset} srcset Options with either `breakpoints` or `min_width`, `max_width`, and `max_images` - * - * @return {number[]} Array of breakpoints - * - */ -function generateBreakpoints(srcset) { - let breakpoints = srcset.breakpoints || []; - if (breakpoints.length) { - return breakpoints; - } - let [min_width, max_width, max_images] = [srcset.min_width, srcset.max_width, srcset.max_images].map(Number); - if ([min_width, max_width, max_images].some(Number.isNaN)) { - throw 'Either (min_width, max_width, max_images) ' - + 'or breakpoints must be provided to the image srcset attribute'; - } - - if (min_width > max_width) { - throw 'min_width must be less than max_width'; - } - - if (max_images <= 0) { - throw 'max_images must be a positive integer'; - } else if (max_images === 1) { - min_width = max_width; - } - - let stepSize = Math.ceil((max_width - min_width) / Math.max(max_images - 1, 1)); - for (let current = min_width; current < max_width; current += stepSize) { - breakpoints.push(current); - } - breakpoints.push(max_width); - return breakpoints; -} -module.exports = generateBreakpoints; diff --git a/server/node_modules/cloudinary/lib/utils/index.js b/server/node_modules/cloudinary/lib/utils/index.js deleted file mode 100644 index 5b1fa73..0000000 --- a/server/node_modules/cloudinary/lib/utils/index.js +++ /dev/null @@ -1,1751 +0,0 @@ -/** - * Utilities - * @module utils - * @borrows module:auth_token as generate_auth_token - */ - -const crypto = require("crypto"); -const querystring = require("querystring"); -const urlParse = require("url").parse; - -// Functions used internally -const compact = require("lodash/compact"); -const first = require("lodash/first"); -const isFunction = require("lodash/isFunction"); -const isPlainObject = require("lodash/isPlainObject"); -const last = require("lodash/last"); -const map = require("lodash/map"); -const take = require("lodash/take"); -const at = require("lodash/at"); - -// Exposed by the module -const clone = require("lodash/clone"); -const extend = require("lodash/extend"); -const filter = require("lodash/filter"); -const includes = require("lodash/includes"); -const isArray = require("lodash/isArray"); -const isEmpty = require("lodash/isEmpty"); -const isNumber = require("lodash/isNumber"); -const isObject = require("lodash/isObject"); -const isString = require("lodash/isString"); -const isUndefined = require("lodash/isUndefined"); - -const smart_escape = require("./encoding/smart_escape"); -const consumeOption = require('./parsing/consumeOption'); -const toArray = require('./parsing/toArray'); -let {base64EncodeURL} = require('./encoding/base64EncodeURL'); -const encodeDoubleArray = require('./encoding/encodeDoubleArray'); - -const config = require("../config"); -const generate_token = require("../auth_token"); -const crc32 = require('./crc32'); -const ensurePresenceOf = require('./ensurePresenceOf'); -const ensureOption = require('./ensureOption').defaults(config()); -const entries = require('./entries'); -const isRemoteUrl = require('./isRemoteUrl'); - -const getSDKVersions = require('./analytics/getSDKVersions'); -const { - getAnalyticsOptions, - getSDKAnalyticsSignature -} = require('./analytics'); - -exports = module.exports; -const utils = module.exports; - -try { - // eslint-disable-next-line global-require - utils.VERSION = require('../../package.json').version; -} catch (error) { - utils.VERSION = ''; -} - -function generate_auth_token(options) { - let token_options = Object.assign({}, config().auth_token, options); - return generate_token(token_options); -} - -exports.CF_SHARED_CDN = "d3jpl91pxevbkh.cloudfront.net"; -exports.OLD_AKAMAI_SHARED_CDN = "cloudinary-a.akamaihd.net"; -exports.AKAMAI_SHARED_CDN = "res.cloudinary.com"; -exports.SHARED_CDN = exports.AKAMAI_SHARED_CDN; -exports.USER_AGENT = `CloudinaryNodeJS/${exports.VERSION} (Node ${process.versions.node})`; - -// Add platform information to the USER_AGENT header -// This is intended for platform information and not individual applications! -exports.userPlatform = ""; - -function getUserAgent() { - return isEmpty(utils.userPlatform) ? `${utils.USER_AGENT}` : `${utils.userPlatform} ${utils.USER_AGENT}`; -} - -const { - DEFAULT_RESPONSIVE_WIDTH_TRANSFORMATION, - DEFAULT_POSTER_OPTIONS, - DEFAULT_VIDEO_SOURCE_TYPES, - CONDITIONAL_OPERATORS, - PREDEFINED_VARS, - LAYER_KEYWORD_PARAMS, - TRANSFORMATION_PARAMS, - SIMPLE_PARAMS, - UPLOAD_PREFIX, - SUPPORTED_SIGNATURE_ALGORITHMS, - DEFAULT_SIGNATURE_ALGORITHM -} = require('./consts'); - -function textStyle(layer) { - let keywords = []; - let style = ""; - - if (!isEmpty(layer.text_style)) { - return layer.text_style; - } - Object.keys(LAYER_KEYWORD_PARAMS).forEach((attr) => { - let default_value = LAYER_KEYWORD_PARAMS[attr]; - let attr_value = layer[attr] || default_value; - if (attr_value !== default_value) { - keywords.push(attr_value); - } - }); - - Object.keys(layer).forEach((attr) => { - if (attr === "letter_spacing" || attr === "line_spacing") { - keywords.push(`${attr}_${layer[attr]}`); - } - if (attr === "font_hinting") { - keywords.push(`${attr.split("_").pop()}_${layer[attr]}`); - } - if (attr === "font_antialiasing") { - keywords.push(`antialias_${layer[attr]}`); - } - }); - - if (layer.hasOwnProperty("font_size" || "font_family") || !isEmpty(keywords)) { - if (!layer.font_size) throw new Error('Must supply font_size for text in overlay/underlay'); - if (!layer.font_family) throw new Error('Must supply font_family for text in overlay/underlay'); - keywords.unshift(layer.font_size); - keywords.unshift(layer.font_family); - style = compact(keywords).join("_"); - } - return style; -} - -/** - * Normalize an expression string, replace "nice names" with their coded values and spaces with "_" - * e.g. `width > 0` => `w_lt_0` - * - * @param {String} expression An expression to be normalized - * @return {Object|String} A normalized String of the input value if possible otherwise the value itself - */ -function normalize_expression(expression) { - if (!isString(expression) || expression.length === 0 || expression.match(/^!.+!$/)) { - return expression; - } - - const operators = "\\|\\||>=|<=|&&|!=|>|=|<|/|-|\\^|\\+|\\*"; - const operatorsPattern = "((" + operators + ")(?=[ _]))"; - const operatorsReplaceRE = new RegExp(operatorsPattern, "g"); - expression = expression.replace(operatorsReplaceRE, match => CONDITIONAL_OPERATORS[match]); - - // Duplicate PREDEFINED_VARS to also include :{var_name} as well as {var_name} - // Example: - // -- PREDEFINED_VARS = ['foo'] - // -- predefinedVarsPattern = ':foo|foo' - // It is done like this because node 6 does not support regex lookbehind - const predefinedVarsPattern = "(" + Object.keys(PREDEFINED_VARS).map(v => `:${v}|${v}`).join("|") + ")"; - const userVariablePattern = '(\\$_*[^_ ]+)'; - const variablesReplaceRE = new RegExp(`${userVariablePattern}|${predefinedVarsPattern}`, "g"); - expression = expression.replace(variablesReplaceRE, (match) => (PREDEFINED_VARS[match] || match)); - - return expression.replace(/[ _]+/g, '_'); -} - -/** - * Parse custom_function options - * @private - * @param {object|*} customFunction a custom function object containing function_type and source values - * @return {string|*} custom_function transformation string - */ -function process_custom_function(customFunction) { - if (!isObject(customFunction)) { - return customFunction; - } - if (customFunction.function_type === "remote") { - const encodedSource = base64EncodeURL(customFunction.source); - - return [customFunction.function_type, encodedSource].join(":"); - } - return [customFunction.function_type, customFunction.source].join(":"); -} - -/** - * Parse custom_pre_function options - * @private - * @param {object|*} customPreFunction a custom function object containing function_type and source values - * @return {string|*} custom_pre_function transformation string - */ -function process_custom_pre_function(customPreFunction) { - let result = process_custom_function(customPreFunction); - return utils.isString(result) ? `pre:${result}` : null; -} - -/** - * Parse "if" parameter - * Translates the condition if provided. - * @private - * @return {string} "if_" + ifValue - */ -function process_if(ifValue) { - return ifValue ? "if_" + normalize_expression(ifValue) : ifValue; -} - -/** - * Parse layer options - * @private - * @param {object|*} layer The layer to parse. - * @return {string} layer transformation string - */ -function process_layer(layer) { - if (isString(layer)) { - let resourceType = null; - let layerUrl = ''; - - let fetchLayerBegin = 'fetch:'; - if (layer.startsWith(fetchLayerBegin)) { - layerUrl = layer.substring(fetchLayerBegin.length); - } else if (layer.indexOf(':fetch:', 0) !== -1) { - const parts = layer.split(':', 3); - resourceType = parts[0]; - layerUrl = parts[2]; - } else { - return layer; - } - - layer = { - url: layerUrl, - type: 'fetch' - }; - - if (resourceType) { - layer.resource_type = resourceType; - } - } - - if (typeof layer !== 'object') { - return layer; - } - - let { - resource_type, - text, - type, - public_id, - format, - url: fetchUrl - } = layer; - const components = []; - - if (!isEmpty(text) && isEmpty(resource_type)) { - resource_type = 'text'; - } - - if (!isEmpty(fetchUrl) && isEmpty(type)) { - type = 'fetch'; - } - - if (!isEmpty(public_id) && !isEmpty(format)) { - public_id = `${public_id}.${format}`; - } - - if (isEmpty(public_id) && resource_type !== 'text' && type !== 'fetch') { - throw new Error('Must supply public_id for non-text overlay'); - } - - if (!isEmpty(resource_type) && resource_type !== 'image') { - components.push(resource_type); - } - - if (!isEmpty(type) && type !== 'upload') { - components.push(type); - } - - if (resource_type === 'text' || resource_type === 'subtitles') { - if (isEmpty(public_id) && isEmpty(text)) { - throw new Error('Must supply either text or public_in in overlay'); - } - - const textOptions = textStyle(layer); - - if (!isEmpty(textOptions)) { - components.push(textOptions); - } - - if (!isEmpty(public_id)) { - public_id = public_id.replace('/', ':'); - components.push(public_id); - } - - if (!isEmpty(text)) { - const variablesRegex = new RegExp(/(\$\([a-zA-Z]\w+\))/g); - const textDividedByVariables = text.split(variablesRegex).filter(x => x); - const encodedParts = textDividedByVariables.map(subText => { - const matches = variablesRegex[Symbol.match](subText); - const isVariable = matches ? matches.length > 0 : false; - if (isVariable) { - return subText; - } - return encodeCurlyBraces(encodeURIComponent(smart_escape(subText, new RegExp(/([,\/])/g)))); - }); - components.push(encodedParts.join('')); - } - } else if (type === 'fetch') { - const encodedUrl = base64EncodeURL(fetchUrl); - components.push(encodedUrl); - } else { - public_id = public_id.replace('/', ':'); - components.push(public_id); - } - - return components.join(':'); -} - -function replaceAllSubstrings(string, search, replacement = '') { - return string.split(search).join(replacement); -} - -function encodeCurlyBraces(input) { - return replaceAllSubstrings(replaceAllSubstrings(input, '(', '%28'), ')', '%29'); -} - -/** - * Parse radius options - * @private - * @param {Array|string|number} radius The radius to parse - * @return {string} radius transformation string - */ -function process_radius(radius) { - if (!radius) { - return radius; - } - if (!isArray(radius)) { - radius = [radius]; - } - if (radius.length === 0 || radius.length > 4) { - throw new Error("Radius array should contain between 1 and 4 values"); - } - if (radius.findIndex(x => x === null) >= 0) { - throw new Error("Corner: Cannot be null"); - } - return radius.map(normalize_expression).join(':'); -} - -function build_multi_and_sprite_params(tagOrOptions, options) { - let tag = null; - if (typeof tagOrOptions === 'string') { - tag = tagOrOptions; - } else { - if (isEmpty(options)) { - options = tagOrOptions; - } else { - throw new Error('First argument must be a tag when additional options are passed'); - } - tag = null; - } - if (!options && !tag) { - throw new Error('Either tag or urls are required') - } - if (!options) { - options = {} - } - const urls = options.urls - const transformation = generate_transformation_string(extend({}, options, { - fetch_format: options.format - })); - return { - tag, - transformation, - urls, - timestamp: utils.timestamp(), - async: options.async, - notification_url: options.notification_url - }; -} - -function build_upload_params(options) { - let params = { - access_mode: options.access_mode, - allowed_formats: options.allowed_formats && toArray(options.allowed_formats).join(","), - asset_folder: options.asset_folder, - async: utils.as_safe_bool(options.async), - backup: utils.as_safe_bool(options.backup), - callback: options.callback, - cinemagraph_analysis: utils.as_safe_bool(options.cinemagraph_analysis), - colors: utils.as_safe_bool(options.colors), - display_name: options.display_name, - discard_original_filename: utils.as_safe_bool(options.discard_original_filename), - eager: utils.build_eager(options.eager), - eager_async: utils.as_safe_bool(options.eager_async), - eager_notification_url: options.eager_notification_url, - eval: options.eval, - exif: utils.as_safe_bool(options.exif), - faces: utils.as_safe_bool(options.faces), - folder: options.folder, - format: options.format, - filename_override: options.filename_override, - image_metadata: utils.as_safe_bool(options.image_metadata), - media_metadata: utils.as_safe_bool(options.media_metadata), - invalidate: utils.as_safe_bool(options.invalidate), - moderation: options.moderation, - notification_url: options.notification_url, - overwrite: utils.as_safe_bool(options.overwrite), - phash: utils.as_safe_bool(options.phash), - proxy: options.proxy, - public_id: options.public_id, - public_id_prefix: options.public_id_prefix, - quality_analysis: utils.as_safe_bool(options.quality_analysis), - responsive_breakpoints: utils.generate_responsive_breakpoints_string(options.responsive_breakpoints), - return_delete_token: utils.as_safe_bool(options.return_delete_token), - timestamp: options.timestamp || exports.timestamp(), - transformation: decodeURIComponent(utils.generate_transformation_string(clone(options))), - type: options.type, - unique_filename: utils.as_safe_bool(options.unique_filename), - upload_preset: options.upload_preset, - use_filename: utils.as_safe_bool(options.use_filename), - use_filename_as_display_name: utils.as_safe_bool(options.use_filename_as_display_name), - quality_override: options.quality_override, - accessibility_analysis: utils.as_safe_bool(options.accessibility_analysis), - use_asset_folder_as_public_id_prefix: utils.as_safe_bool(options.use_asset_folder_as_public_id_prefix), - visual_search: utils.as_safe_bool(options.visual_search), - on_success: options.on_success, - auto_transcription: options.auto_transcription, - auto_chaptering: utils.as_safe_bool(options.auto_chaptering) - }; - - return utils.updateable_resource_params(options, params); -} - -function encode_key_value(arg) { - if (!isObject(arg)) { - return arg; - } - return entries(arg).map(([k, v]) => `${k}=${v}`).join('|'); -} - - -/** - * @description Escape = and | with two backslashes \\ - * @param {string|number} value - * @return {string} - */ -function escapeMetadataValue(value) { - return value.toString().replace(/([=|])/g, '\\$&'); -} - - -/** - * - * @description Encode metadata fields based on incoming value. - * If array, escape as color_id=[\"green\",\"red\"] - * If string/number, escape as in_stock_id=50 - * - * Joins resulting values with a pipe: - * in_stock_id=50|color_id=[\"green\",\"red\"] - * - * = and | and escaped by default (this can't be turned off) - * - * @param metadataObj - * @return {string} - */ -function encode_context(metadataObj) { - if (!isObject(metadataObj)) { - return metadataObj; - } - - return entries(metadataObj).map(([key, value]) => { - // if string, simply parse the value and move on - if (isString(value)) { - return `${key}=${escapeMetadataValue(value)}`; - - // If array, parse each item individually - } else if (isArray(value)) { - let values = value.map((innerVal) => { - return `\"${escapeMetadataValue(innerVal)}\"` - }).join(','); - return `${key}=[${values}]` - // if number, convert to string - } else if (Number.isInteger(value)) { - return `${key}=${escapeMetadataValue(String(value))}`; - // if unknown, return the value as string - } else { - return value.toString(); - } - }).join('|'); -} - -function build_eager(transformations) { - return toArray(transformations) - .map((transformation) => { - const transformationString = utils.generate_transformation_string(clone(transformation)); - const format = transformation.format; - return format == null ? transformationString : `${transformationString}/${format}`; - }).join('|'); -} - -/** - * Build the custom headers for the request - * @private - * @param headers - * @return {Array|object|string} An object of name and value, - * an array of header strings, or a string of headers - */ -function build_custom_headers(headers) { - switch (true) { - case headers == null: - return void 0; - case isArray(headers): - return headers.join("\n"); - case isObject(headers): - return entries(headers).map(([k, v]) => `${k}:${v}`).join("\n"); - default: - return headers; - } -} - -function generate_transformation_string(options) { - if (utils.isString(options)) { - return options; - } - if (isArray(options)) { - return options.map(t => utils.generate_transformation_string(clone(t))).filter(utils.present).join('/'); - } - - let responsive_width = consumeOption(options, "responsive_width", config().responsive_width); - let width = options.width; - let height = options.height; - let size = consumeOption(options, "size"); - if (size) { - [width, height] = size.split("x"); - [options.width, options.height] = [width, height]; - } - let has_layer = options.overlay || options.underlay; - let crop = consumeOption(options, "crop"); - let angle = toArray(consumeOption(options, "angle")).join("."); - let no_html_sizes = has_layer || utils.present(angle) || crop === "fit" || crop === "limit" || responsive_width; - if (width && (width.toString().indexOf("auto") === 0 || no_html_sizes || parseFloat(width) < 1)) { - delete options.width; - } - if (height && (no_html_sizes || parseFloat(height) < 1)) { - delete options.height; - } - let background = consumeOption(options, "background"); - background = background && background.replace(/^#/, "rgb:"); - let color = consumeOption(options, "color"); - color = color && color.replace(/^#/, "rgb:"); - let base_transformations = toArray(consumeOption(options, "transformation", [])); - let named_transformation = []; - if (base_transformations.some(isObject)) { - base_transformations = base_transformations.map(tr => utils.generate_transformation_string(isObject(tr) ? clone(tr) : {transformation: tr})); - } else { - named_transformation = base_transformations.join("."); - base_transformations = []; - } - let effect = consumeOption(options, "effect"); - if (isArray(effect)) { - effect = effect.join(":"); - } else if (isObject(effect)) { - effect = entries(effect).map(([key, value]) => `${key}:${value}`); - } - let border = consumeOption(options, "border"); - if (isObject(border)) { - border = `${border.width != null ? border.width : 2}px_solid_${(border.color != null ? border.color : "black").replace(/^#/, 'rgb:')}`; - } else if (/^\d+$/.exec(border)) { // fallback to html border attributes - options.border = border; - border = void 0; - } - let flags = toArray(consumeOption(options, "flags")).join("."); - let dpr = consumeOption(options, "dpr", config().dpr); - if (options.offset != null) { - [options.start_offset, options.end_offset] = split_range(consumeOption(options, "offset")); - } - if (options.start_offset) { - options.start_offset = normalize_expression(options.start_offset); - } - if (options.end_offset) { - options.end_offset = normalize_expression(options.end_offset); - } - let overlay = process_layer(consumeOption(options, "overlay")); - let radius = process_radius(consumeOption(options, "radius")); - let underlay = process_layer(consumeOption(options, "underlay")); - let ifValue = process_if(consumeOption(options, "if")); - let custom_function = process_custom_function(consumeOption(options, "custom_function")); - let custom_pre_function = process_custom_pre_function(consumeOption(options, "custom_pre_function")); - let fps = consumeOption(options, 'fps'); - if (isArray(fps)) { - fps = fps.join('-'); - } - let params = { - a: normalize_expression(angle), - ar: normalize_expression(consumeOption(options, "aspect_ratio")), - b: background, - bo: border, - c: crop, - co: color, - dpr: normalize_expression(dpr), - e: normalize_expression(effect), - fl: flags, - fn: custom_function || custom_pre_function, - fps: fps, - h: normalize_expression(height), - ki: normalize_expression(consumeOption(options, "keyframe_interval")), - l: overlay, - o: normalize_expression(consumeOption(options, "opacity")), - q: normalize_expression(consumeOption(options, "quality")), - r: radius, - t: named_transformation, - u: underlay, - w: normalize_expression(width), - x: normalize_expression(consumeOption(options, "x")), - y: normalize_expression(consumeOption(options, "y")), - z: normalize_expression(consumeOption(options, "zoom")) - }; - - SIMPLE_PARAMS.forEach(([name, short]) => { - let value = consumeOption(options, name); - if (value !== undefined) { - params[short] = value; - } - }); - if (params.vc != null) { - params.vc = process_video_params(params.vc); - } - ["so", "eo", "du"].forEach((short) => { - if (params[short] !== undefined) { - params[short] = norm_range_value(params[short]); - } - }); - - let variablesParam = consumeOption(options, "variables", []); - let variables = entries(options) - .filter(([key, value]) => key.startsWith('$')) - .map(([key, value]) => { - delete options[key]; - return `${key}_${normalize_expression(value)}`; - }).sort().concat(variablesParam.map(([name, value]) => `${name}_${normalize_expression(value)}`)).join(','); - - let transformations = entries(params) - .filter(([key, value]) => utils.present(value)) - .map(([key, value]) => key + '_' + value) - .sort() - .join(','); - - let raw_transformation = consumeOption(options, 'raw_transformation'); - transformations = compact([ifValue, variables, transformations, raw_transformation]).join(","); - base_transformations.push(transformations); - transformations = base_transformations; - if (responsive_width) { - let responsive_width_transformation = config().responsive_width_transformation || DEFAULT_RESPONSIVE_WIDTH_TRANSFORMATION; - - transformations.push(utils.generate_transformation_string(clone(responsive_width_transformation))); - } - if (String(width).startsWith("auto") || responsive_width) { - options.responsive = true; - } - if (dpr === "auto") { - options.hidpi = true; - } - return filter(transformations, utils.present).join("/"); -} - -function updateable_resource_params(options, params = {}) { - if (options.access_control != null) { - params.access_control = utils.jsonArrayParam(options.access_control); - } - if (options.auto_tagging != null) { - params.auto_tagging = options.auto_tagging; - } - if (options.background_removal != null) { - params.background_removal = options.background_removal; - } - if (options.categorization != null) { - params.categorization = options.categorization; - } - if (options.context != null) { - params.context = utils.encode_context(options.context); - } - if (options.metadata != null) { - params.metadata = utils.encode_context(options.metadata); - } - if (options.custom_coordinates != null) { - params.custom_coordinates = encodeDoubleArray(options.custom_coordinates); - } - if (options.detection != null) { - params.detection = options.detection; - } - if (options.face_coordinates != null) { - params.face_coordinates = encodeDoubleArray(options.face_coordinates); - } - if (options.headers != null) { - params.headers = utils.build_custom_headers(options.headers); - } - if (options.notification_url != null) { - params.notification_url = options.notification_url; - } - if (options.ocr != null) { - params.ocr = options.ocr; - } - if (options.raw_convert != null) { - params.raw_convert = options.raw_convert; - } - if (options.similarity_search != null) { - params.similarity_search = options.similarity_search; - } - if (options.tags != null) { - params.tags = toArray(options.tags).join(","); - } - if (options.quality_override != null) { - params.quality_override = options.quality_override; - } - if (options.asset_folder != null) { - params.asset_folder = options.asset_folder; - } - if (options.display_name != null) { - params.display_name = options.display_name; - } - if (options.unique_display_name != null) { - params.unique_display_name = options.unique_display_name; - } - if (options.visual_search != null) { - params.visual_search = options.visual_search; - } - if (options.regions != null) { - params.regions = JSON.stringify(options.regions); - } - const autoTranscription = options.auto_transcription; - if (autoTranscription != null) { - if (typeof autoTranscription === 'boolean') { - params.auto_transcription = utils.as_safe_bool(autoTranscription); - } else { - const isAutoTranscriptionObject = typeof autoTranscription === 'object' && !Array.isArray(autoTranscription); - if (isAutoTranscriptionObject && Object.keys(autoTranscription).includes('translate')) { - params.auto_transcription = JSON.stringify(autoTranscription); - } - } - } - return params; -} - -/** - * A list of keys used by the url() function. - * @private - */ -const URL_KEYS = ['api_secret', 'auth_token', 'cdn_subdomain', 'cloud_name', 'cname', 'format', 'long_url_signature', 'private_cdn', 'resource_type', 'secure', 'secure_cdn_subdomain', 'secure_distribution', 'shorten', 'sign_url', 'ssl_detected', 'type', 'url_suffix', 'use_root_path', 'version']; - -/** - * Create a new object with only URL parameters - * @param {object} options The source object - * @return {Object} An object containing only URL parameters - */ - -function extractUrlParams(options) { - return pickOnlyExistingValues(options, ...URL_KEYS); -} - -/** - * Create a new object with only transformation parameters - * @param {object} options The source object - * @return {Object} An object containing only transformation parameters - */ - -function extractTransformationParams(options) { - return pickOnlyExistingValues(options, ...TRANSFORMATION_PARAMS); -} - -/** - * Handle the format parameter for fetch urls - * @private - * @param options url and transformation options. This argument may be changed by the function! - */ - -function patchFetchFormat(options = {}) { - if (options.type === "fetch") { - if (options.fetch_format == null) { - options.fetch_format = consumeOption(options, "format"); - } - } -} - -function build_distribution_domain(source, options) { - const cloud_name = consumeOption(options, 'cloud_name', config().cloud_name); - if (!cloud_name) { - throw new Error('Must supply cloud_name in tag or in configuration'); - } - - let secure = consumeOption(options, 'secure', true); - const ssl_detected = consumeOption(options, 'ssl_detected', config().ssl_detected); - if (secure === null) { - secure = ssl_detected || config().secure; - } - - const private_cdn = consumeOption(options, 'private_cdn', config().private_cdn); - const cname = consumeOption(options, 'cname', config().cname); - const secure_distribution = consumeOption(options, 'secure_distribution', config().secure_distribution); - const cdn_subdomain = consumeOption(options, 'cdn_subdomain', config().cdn_subdomain); - const secure_cdn_subdomain = consumeOption(options, 'secure_cdn_subdomain', config().secure_cdn_subdomain); - - return unsigned_url_prefix(source, cloud_name, private_cdn, cdn_subdomain, secure_cdn_subdomain, cname, secure, secure_distribution); -} - -function url(public_id, options = {}) { - let signature, source_to_sign; - utils.patchFetchFormat(options); - let type = consumeOption(options, "type", null); - let transformation = utils.generate_transformation_string(options); - - let resource_type = consumeOption(options, "resource_type", "image"); - let version = consumeOption(options, "version"); - let force_version = consumeOption(options, "force_version", config().force_version); - if (force_version == null) { - force_version = true; - } - let long_url_signature = !!consumeOption(options, "long_url_signature", config().long_url_signature); - let format = consumeOption(options, "format"); - let shorten = consumeOption(options, "shorten", config().shorten); - let sign_url = consumeOption(options, "sign_url", config().sign_url); - let api_secret = consumeOption(options, "api_secret", config().api_secret); - let url_suffix = consumeOption(options, "url_suffix"); - let use_root_path = consumeOption(options, "use_root_path", config().use_root_path); - let signature_algorithm = consumeOption(options, "signature_algorithm", config().signature_algorithm || DEFAULT_SIGNATURE_ALGORITHM); - if (long_url_signature) { - signature_algorithm = 'sha256'; - } - let auth_token = consumeOption(options, "auth_token"); - if (auth_token !== false) { - auth_token = exports.merge(config().auth_token, auth_token); - } - let preloaded = /^(image|raw)\/([a-z0-9_]+)\/v(\d+)\/([^#]+)$/.exec(public_id); - if (preloaded) { - resource_type = preloaded[1]; - type = preloaded[2]; - version = preloaded[3]; - public_id = preloaded[4]; - } - let original_source = public_id; - if (public_id == null) { - return original_source; - } - public_id = public_id.toString(); - if (type === null && public_id.match(/^https?:\//i)) { - return original_source; - } - [resource_type, type] = finalize_resource_type(resource_type, type, url_suffix, use_root_path, shorten); - [public_id, source_to_sign] = finalize_source(public_id, format, url_suffix); - - if (version == null && force_version && source_to_sign.indexOf("/") >= 0 && !source_to_sign.match(/^v[0-9]+/) && !source_to_sign.match(/^https?:\//)) { - version = 1; - } - if (version != null) { - version = `v${version}`; - } else { - version = null; - } - - transformation = transformation.replace(/([^:])\/\//g, '$1/'); - if (sign_url && isEmpty(auth_token)) { - let to_sign = [transformation, source_to_sign].filter(function (part) { - return (part != null) && part !== ''; - }).join('/'); - - const signatureConfig = {}; - if (long_url_signature) { - signatureConfig.algorithm = 'sha256'; - signatureConfig.signatureLength = 32; - } else { - signatureConfig.algorithm = signature_algorithm; - signatureConfig.signatureLength = 8; - } - - const truncated = compute_hash(to_sign + api_secret, signatureConfig.algorithm, 'base64') - .slice(0, signatureConfig.signatureLength) - .replace(/\//g, '_') - .replace(/\+/g, '-'); - signature = `s--${truncated}--`; - } - - let prefix = build_distribution_domain(public_id, options); - let resultUrl = [prefix, resource_type, type, signature, transformation, version, public_id].filter(function (part) { - return (part != null) && part !== ''; - }).join('/').replace(/ /g, '%20'); - if (sign_url && !isEmpty(auth_token)) { - auth_token.url = urlParse(resultUrl).path; - let token = generate_token(auth_token); - resultUrl += `?${token}`; - } - - const urlAnalytics = ensureOption(options, 'urlAnalytics', ensureOption(options, 'analytics', true)); - - if (urlAnalytics === true) { - let { - sdkCode: sdkCodeDefault, - sdkSemver: sdkSemverDefault, - techVersion: techVersionDefault, - product: productDefault - } = getSDKVersions(); - const sdkCode = ensureOption(options, 'sdkCode', ensureOption(options, 'sdk_code', sdkCodeDefault)); - const sdkSemver = ensureOption(options, 'sdkSemver', ensureOption(options, 'sdk_semver', sdkSemverDefault)); - const techVersion = ensureOption(options, 'techVersion', ensureOption(options, 'tech_version', techVersionDefault)); - const product = ensureOption(options, 'product', productDefault); - - let sdkVersions = { - sdkCode: sdkCode, - sdkSemver: sdkSemver, - techVersion: techVersion, - product: product, - urlAnalytics - }; - - let analyticsOptions = getAnalyticsOptions(Object.assign({}, options, sdkVersions)); - - let sdkAnalyticsSignature = getSDKAnalyticsSignature(analyticsOptions); - - // url might already have a '?' query param - let appender = '?'; - if (resultUrl.indexOf('?') >= 0) { - appender = '&'; - } - resultUrl = `${resultUrl}${appender}_a=${sdkAnalyticsSignature}`; - } - - return resultUrl; -} - -function video_url(public_id, options) { - options = extend({ - resource_type: 'video' - }, options); - return utils.url(public_id, options); -} - -function finalize_source(source, format, url_suffix) { - let source_to_sign; - source = source.replace(/([^:])\/\//g, '$1/'); - if (source.match(/^https?:\//i)) { - source = smart_escape(source); - source_to_sign = source; - } else { - source = encodeURIComponent(decodeURIComponent(source)).replace(/%3A/g, ":").replace(/%2F/g, "/"); - source_to_sign = source; - if (url_suffix) { - if (url_suffix.match(/[\.\/]/)) { - throw new Error('url_suffix should not include . or /'); - } - source = source + '/' + url_suffix; - } - if (format != null) { - source = source + '.' + format; - source_to_sign = source_to_sign + '.' + format; - } - } - return [source, source_to_sign]; -} - -function video_thumbnail_url(public_id, options) { - options = extend({}, DEFAULT_POSTER_OPTIONS, options); - return utils.url(public_id, options); -} - -function finalize_resource_type(resource_type, type, url_suffix, use_root_path, shorten) { - if (type == null) { - type = 'upload'; - } - if (url_suffix != null) { - if (resource_type === 'image' && type === 'upload') { - resource_type = "images"; - type = null; - } else if (resource_type === 'image' && type === 'private') { - resource_type = 'private_images'; - type = null; - } else if (resource_type === 'image' && type === 'authenticated') { - resource_type = 'authenticated_images'; - type = null; - } else if (resource_type === 'raw' && type === 'upload') { - resource_type = 'files'; - type = null; - } else if (resource_type === 'video' && type === 'upload') { - resource_type = 'videos'; - type = null; - } else { - throw new Error("URL Suffix only supported for image/upload, image/private, image/authenticated, video/upload and raw/upload"); - } - } - if (use_root_path) { - if ((resource_type === 'image' && type === 'upload') || (resource_type === 'images' && (type == null))) { - resource_type = null; - type = null; - } else { - throw new Error("Root path only supported for image/upload"); - } - } - if (shorten && resource_type === 'image' && type === 'upload') { - resource_type = 'iu'; - type = null; - } - return [resource_type, type]; -} - -// cdn_subdomain and secure_cdn_subdomain -// 1) Customers in shared distribution (e.g. res.cloudinary.com) -// if cdn_domain is true uses res-[1-5].cloudinary.com for both http and https. -// Setting secure_cdn_subdomain to false disables this for https. -// 2) Customers with private cdn -// if cdn_domain is true uses cloudname-res-[1-5].cloudinary.com for http -// if secure_cdn_domain is true uses cloudname-res-[1-5].cloudinary.com for https -// (please contact support if you require this) -// 3) Customers with cname -// if cdn_domain is true uses a[1-5].cname for http. -// For https, uses the same naming scheme as 1 for shared distribution and as 2 for private distribution. - -function unsigned_url_prefix(source, cloud_name, private_cdn, cdn_subdomain, secure_cdn_subdomain, cname, secure, secure_distribution) { - let prefix; - if (cloud_name.indexOf("/") === 0) { - return '/res' + cloud_name; - } - let shared_domain = !private_cdn; - if (secure) { - if ((secure_distribution == null) || secure_distribution === exports.OLD_AKAMAI_SHARED_CDN) { - secure_distribution = private_cdn ? cloud_name + "-res.cloudinary.com" : exports.SHARED_CDN; - } - if (shared_domain == null) { - shared_domain = secure_distribution === exports.SHARED_CDN; - } - if ((secure_cdn_subdomain == null) && shared_domain) { - secure_cdn_subdomain = cdn_subdomain; - } - if (secure_cdn_subdomain) { - secure_distribution = secure_distribution.replace('res.cloudinary.com', 'res-' + ((crc32(source) % 5) + 1 + '.cloudinary.com')); - } - prefix = 'https://' + secure_distribution; - } else if (cname) { - let subdomain = cdn_subdomain ? 'a' + ((crc32(source) % 5) + 1) + '.' : ''; - prefix = 'http://' + subdomain + cname; - } else { - let cdn_part = private_cdn ? cloud_name + '-' : ''; - let subdomain_part = cdn_subdomain ? '-' + ((crc32(source) % 5) + 1) : ''; - let host = [cdn_part, 'res', subdomain_part, '.cloudinary.com'].join(''); - prefix = 'http://' + host; - } - if (shared_domain) { - prefix += '/' + cloud_name; - } - return prefix; -} - -function base_api_url_v1_1() { - return base_api_url('v1_1'); -} - -function base_api_url_v2() { - return base_api_url('v2'); -} - -function base_api_url(api_version) { - if (!api_version || api_version.length === 0) { - throw new Error('api_version needs to be a non-empty string'); - } - - return (path = [], options = []) => { - let cloudinary = ensureOption(options, "upload_prefix", UPLOAD_PREFIX); - let cloud_name = ensureOption(options, "cloud_name"); - let encode_path = unencoded_path => encodeURIComponent(unencoded_path).replace("'", '%27'); - let encoded_path = Array.isArray(path) ? path.map(encode_path) : encode_path(path); - return [cloudinary, api_version, cloud_name].concat(encoded_path).join("/"); - }; -} - -function api_url(action = 'upload', options = {}) { - let resource_type = options.resource_type || "image"; - return base_api_url_v1_1()([resource_type, action], options); -} - -function random_public_id() { - return crypto.randomBytes(12).toString('base64').replace(/[^a-z0-9]/g, ""); -} - -function signed_preloaded_image(result) { - return `${result.resource_type}/upload/v${result.version}/${filter([result.public_id, result.format], utils.present).join(".")}#${result.signature}`; -} - -// Encodes a parameter for safe inclusion in URL query strings (only replaces & with %26) -function encode_param(value) { - return String(value).replace(/&/g, '%26'); -} - -// Generates a string to be signed for API requests -function api_string_to_sign(params_to_sign, signature_version = 2) { - let params = entries(params_to_sign) - .map(([k, v]) => [String(k), Array.isArray(v) ? v.join(",") : v]) - .filter(([k, v]) => v !== null && v !== undefined && v !== ""); - params.sort((a, b) => a[0].localeCompare(b[0])); - let paramStrings = params.map(([k, v]) => { - const paramString = `${k}=${v}`; - return signature_version >= 2 ? encode_param(paramString) : paramString; - }); - return paramStrings.join("&"); -} - -/** - * Signs API request parameters - * @param {Object} params_to_sign Parameters to sign - * @param {string} api_secret API secret - * @param {string|undefined|null} signature_algorithm Hash algorithm to use ('sha1' or 'sha256') - * @param {number|undefined|null} signature_version Version of signature algorithm to use: - * - Version 1: Original behavior without parameter encoding - * - Version 2+ (default): Includes parameter encoding to prevent parameter smuggling - * @return {string} Hexadecimal signature - * @private - */ -function api_sign_request(params_to_sign, api_secret, signature_algorithm = null, signature_version = null) { - if (signature_version == null) { - signature_version = config().signature_version || 2; - } - const to_sign = api_string_to_sign(params_to_sign, signature_version); - const algo = signature_algorithm || config().signature_algorithm || DEFAULT_SIGNATURE_ALGORITHM; - return compute_hash(to_sign + api_secret, algo, 'hex'); -} - -/** - * Computes hash from input string using specified algorithm. - * @private - * @param {string} input string which to compute hash from - * @param {string} signature_algorithm algorithm to use for computing hash - * @param {string} encoding type of encoding - * @return {string} computed hash value - */ -function compute_hash(input, signature_algorithm, encoding) { - if (!SUPPORTED_SIGNATURE_ALGORITHMS.includes(signature_algorithm)) { - throw new Error(`Signature algorithm ${signature_algorithm} is not supported. Supported algorithms: ${SUPPORTED_SIGNATURE_ALGORITHMS.join(', ')}`); - } - const hash = crypto.createHash(signature_algorithm).update(input).digest(); - return Buffer.from(hash).toString(encoding); -} - -function clear_blank(hash) { - let filtered_hash = {}; - entries(hash).filter(([k, v]) => utils.present(v)).forEach(([k, v]) => { - filtered_hash[k] = v.filter ? v.filter(x => x) : v; - }); - return filtered_hash; -} - -function sort_object_by_key(object) { - return Object.keys(object).sort().reduce((obj, key) => { - obj[key] = object[key]; - return obj; - }, {}); -} - -function merge(hash1, hash2) { - return {...hash1, ...hash2}; -} - -function sign_request(params, options = {}) { - let apiKey = ensureOption(options, 'api_key'); - let apiSecret = ensureOption(options, 'api_secret'); - let signature_algorithm = options.signature_algorithm; - let signature_version = options.signature_version; - params = exports.clear_blank(params); - params.signature = exports.api_sign_request(params, apiSecret, signature_algorithm, signature_version); - params.api_key = apiKey; - return params; -} - -function webhook_signature(data, timestamp, options = {}) { - ensurePresenceOf({ - data, - timestamp - }); - - let api_secret = ensureOption(options, 'api_secret'); - let signature_algorithm = ensureOption(options, 'signature_algorithm', DEFAULT_SIGNATURE_ALGORITHM); - return compute_hash(data + timestamp + api_secret, signature_algorithm, 'hex'); -} - -/** - * Verifies the authenticity of a notification signature - * - * @param {string} body JSON of the request's body - * @param {number} timestamp Unix timestamp in seconds. Can be retrieved from the X-Cld-Timestamp header - * @param {string} signature Actual signature. Can be retrieved from the X-Cld-Signature header - * @param {number} [valid_for=7200] The desired time in seconds for considering the request valid - * - * @return {boolean} - */ -function verifyNotificationSignature(body, timestamp, signature, valid_for = 7200) { - // verify that signature is valid for the given timestamp - if (timestamp < Math.round(Date.now() / 1000) - valid_for) { - return false; - } - const payload_hash = utils.webhook_signature(body, timestamp, { - api_secret: config().api_secret, - signature_algorithm: config().signature_algorithm - }); - return signature === payload_hash; -} - -function process_request_params(params, options) { - if ((options.unsigned != null) && options.unsigned) { - params = exports.clear_blank(params); - delete params.timestamp; - } else if (options.oauth_token || config().oauth_token) { - params = exports.clear_blank(params); - } else if (options.signature) { - params = exports.clear_blank(options); - } else { - params = exports.sign_request(params, options); - } - - return params; -} - -function private_download_url(public_id, format, options = {}) { - let params = exports.sign_request({ - timestamp: options.timestamp || exports.timestamp(), - public_id: public_id, - format: format, - type: options.type, - attachment: options.attachment, - expires_at: options.expires_at - }, options); - return exports.api_url("download", options) + "?" + querystring.stringify(params); -} - -/** - * Utility method that uses the deprecated ZIP download API. - * @deprecated Replaced by {download_zip_url} that uses the more advanced and robust archive generation and download API - */ - -function zip_download_url(tag, options = {}) { - let params = exports.sign_request({ - timestamp: options.timestamp || exports.timestamp(), - tag: tag, - transformation: utils.generate_transformation_string(options) - }, options); - return exports.api_url("download_tag.zip", options) + "?" + hashToQuery(params); -} - -/** - * The returned url should allow downloading the backedup asset based on the - * version and asset id - * asset and version id are returned with resource(, { versions: true }) - * @param asset_id - * @param version_id - * @param options - * @returns {string } - */ -function download_backedup_asset(asset_id, version_id, options = {}) { - let params = exports.sign_request({ - timestamp: options.timestamp || exports.timestamp(), - asset_id: asset_id, - version_id: version_id - }, options); - return exports.base_api_url_v1()(['download_backup'], options) + "?" + hashToQuery(params); -} - -/** - * Utility method to create a signed URL for specified resources. - * @param action - * @param params - * @param options - */ -function api_download_url(action, params, options) { - const download_params = { - ...params, - mode: "download" - } - let cloudinary_params = exports.sign_request(download_params, options); - return exports.api_url(action, options) + "?" + hashToQuery(cloudinary_params); -} - -/** - * Returns a URL that when invokes creates an archive and returns it. - * @param {object} options - * @param {string} [options.resource_type="image"] The resource type of files to include in the archive. - * Must be one of :image | :video | :raw - * @param {string} [options.type="upload"] The specific file type of resources: :upload|:private|:authenticated - * @param {string|Array} [options.tags] list of tags to include in the archive - * @param {string|Array} [options.public_ids] list of public_ids to include in the archive - * @param {string|Array} [options.prefixes] list of prefixes of public IDs (e.g., folders). - * @param {string|Array} [options.fully_qualified_public_ids] list of fully qualified public_ids to include - * in the archive. - * @param {string|Array} [options.transformations] list of transformations. - * The derived images of the given transformations are included in the archive. Using the string representation of - * multiple chained transformations as we use for the 'eager' upload parameter. - * @param {string} [options.mode="create"] return the generated archive file or to store it as a raw resource and - * return a JSON with URLs for accessing the archive. Possible values: :download, :create - * @param {string} [options.target_format="zip"] - * @param {string} [options.target_public_id] public ID of the generated raw resource. - * Relevant only for the create mode. If not specified, random public ID is generated. - * @param {boolean} [options.flatten_folders=false] If true, flatten public IDs with folders to be in the root - * of the archive. Add numeric counter to the file name in case of a name conflict. - * @param {boolean} [options.flatten_transformations=false] If true, and multiple transformations are given, - * flatten the folder structure of derived images and store the transformation details on the file name instead. - * @param {boolean} [options.use_original_filename] Use the original file name of included images - * (if available) instead of the public ID. - * @param {boolean} [options.async=false] If true, return immediately and perform archive creation in the background. - * Relevant only for the create mode. - * @param {string} [options.notification_url] URL to send an HTTP post request (webhook) to when the - * archive creation is completed. - * @param {string|Array} [options.target_tags=] Allows assigning one or more tags to the generated archive file - * (for later housekeeping via the admin API). - * @param {string} [options.keep_derived=false] keep the derived images used for generating the archive - * @return {String} archive url - */ -function download_archive_url(options = {}) { - const params = exports.archive_params(merge(options, { - mode: "download" - })) - return api_download_url("generate_archive", params, options) -} - -/** - * Returns a URL that when invokes creates an zip archive and returns it. - * @see download_archive_url - */ - -function download_zip_url(options = {}) { - return exports.download_archive_url(merge(options, { - target_format: "zip" - })); -} - -/** - * Creates and returns a URL that when invoked creates an archive of a folder - * @param {string} folder_path Full path (from the root) of the folder to download - * @param {object} options Additional options - * @returns {string} Url for downloading an archive of a folder - */ -function download_folder(folder_path, options = {}) { - options.resource_type = options.resource_type || "all"; - options.prefixes = folder_path; - let cloudinary_params = exports.sign_request(exports.archive_params(merge(options, { - mode: "download" - })), options); - return exports.api_url("generate_archive", options) + "?" + hashToQuery(cloudinary_params); -} - -/** - * Render the key/value pair as an HTML tag attribute - * @private - * @param {string} key - * @param {string|boolean|number} [value] - * @return {string} A string representing the HTML attribute - */ -function join_pair(key, value) { - if (!value) { - return void 0; - } - return value === true ? key : key + "='" + value + "'"; -} - -/** - * If the given value is a string, replaces single or double quotes with character entities - * @private - * @param {*} value The string to encode quotes in - * @return {*} Encoded string or original value if not a string - */ -function escapeQuotes(value) { - return isString(value) ? value.replace(/\"/g, '"').replace(/\'/g, ''') : value; -} - -/** - * - * @param attrs - * @return {*} - */ -exports.html_attrs = function html_attrs(attrs) { - return filter(map(attrs, function (value, key) { - return join_pair(key, escapeQuotes(value)); - })).sort().join(" "); -}; - -const CLOUDINARY_JS_CONFIG_PARAMS = ['api_key', 'cloud_name', 'private_cdn', 'secure_distribution', 'cdn_subdomain']; - -function cloudinary_js_config() { - let params = pickOnlyExistingValues(config(), ...CLOUDINARY_JS_CONFIG_PARAMS); - return ``; -} - -function v1_result_adapter(callback) { - if (callback == null) { - return undefined; - } - return function (result) { - if (result.error != null) { - return callback(result.error); - } - return callback(void 0, result); - }; -} - -function v1_adapter(name, num_pass_args, v1) { - return function (...args) { - let pass_args = take(args, num_pass_args); - let options = args[num_pass_args]; - let callback = args[num_pass_args + 1]; - if ((callback == null) && isFunction(options)) { - callback = options; - options = {}; - } - callback = v1_result_adapter(callback); - args = pass_args.concat([callback, options]); - return v1[name].apply(this, args); - }; -} - -function v1_adapters(exports, v1, mapping) { - return Object.keys(mapping).map((name) => { - let num_pass_args = mapping[name]; - exports[name] = v1_adapter(name, num_pass_args, v1); - return exports[name]; - }); -} - -function as_safe_bool(value) { - if (value == null) { - return void 0; - } - if (value === true || value === 'true' || value === '1') { - value = 1; - } - if (value === false || value === 'false' || value === '0') { - value = 0; - } - return value; -} - -const NUMBER_PATTERN = "([0-9]*)\\.([0-9]+)|([0-9]+)"; - -const OFFSET_ANY_PATTERN = `(${NUMBER_PATTERN})([%pP])?`; -const RANGE_VALUE_RE = RegExp(`^${OFFSET_ANY_PATTERN}$`); -const OFFSET_ANY_PATTERN_RE = RegExp(`(${OFFSET_ANY_PATTERN})\\.\\.(${OFFSET_ANY_PATTERN})`); - -// Split a range into the start and end values -function split_range(range) { // :nodoc: - switch (range.constructor) { - case String: - if (!OFFSET_ANY_PATTERN_RE.test(range)) { - return range; - } - return range.split(".."); - case Array: - return [first(range), last(range)]; - default: - return [null, null]; - } -} - -function norm_range_value(value) { // :nodoc: - let offset = String(value).match(RANGE_VALUE_RE); - if (offset) { - let modifier = offset[5] ? 'p' : ''; - value = `${offset[1] || offset[4]}${modifier}`; - } - return value; -} - -/** - * A video codec parameter can be either a String or a Hash. - * @param {Object} param vc_[ : : []] - * or { codec: 'h264', profile: 'basic', level: '3.1' } - * @return {String} : : []] if a Hash was provided - * or the param if a String was provided. - * Returns null if param is not a Hash or String - */ -function process_video_params(param) { - switch (param.constructor) { - case Object: { - let video = ""; - if ('codec' in param) { - video = param.codec; - if ('profile' in param) { - video += ":" + param.profile; - if ('level' in param) { - video += ":" + param.level; - } - } - } - return video; - } - case String: - return param; - default: - return null; - } -} - -/** - * Returns a Hash of parameters used to create an archive - * @private - * @param {object} options - * @return {object} Archive API parameters - */ - -function archive_params(options = {}) { - return { - allow_missing: exports.as_safe_bool(options.allow_missing), - async: exports.as_safe_bool(options.async), - expires_at: options.expires_at, - flatten_folders: exports.as_safe_bool(options.flatten_folders), - flatten_transformations: exports.as_safe_bool(options.flatten_transformations), - keep_derived: exports.as_safe_bool(options.keep_derived), - mode: options.mode, - notification_url: options.notification_url, - prefixes: options.prefixes && toArray(options.prefixes), - fully_qualified_public_ids: options.fully_qualified_public_ids && toArray(options.fully_qualified_public_ids), - public_ids: options.public_ids && toArray(options.public_ids), - skip_transformation_name: exports.as_safe_bool(options.skip_transformation_name), - tags: options.tags && toArray(options.tags), - target_format: options.target_format, - target_public_id: options.target_public_id, - target_tags: options.target_tags && toArray(options.target_tags), - timestamp: options.timestamp || exports.timestamp(), - transformations: utils.build_eager(options.transformations), - type: options.type, - use_original_filename: exports.as_safe_bool(options.use_original_filename) - }; -} - -exports.process_layer = process_layer; - -exports.create_source_tag = function create_source_tag(src, source_type, codecs = null) { - let video_type = source_type === 'ogv' ? 'ogg' : source_type; - let mime_type = `video/${video_type}`; - if (!isEmpty(codecs)) { - let codecs_str = isArray(codecs) ? codecs.join(', ') : codecs; - mime_type += `; codecs=${codecs_str}`; - } - return ``; -}; - -function build_explicit_api_params(public_id, options = {}) { - return [exports.build_upload_params(extend({}, {public_id}, options))]; -} - -function generate_responsive_breakpoints_string(breakpoints) { - if (breakpoints == null) { - return null; - } - breakpoints = clone(breakpoints); - if (!isArray(breakpoints)) { - breakpoints = [breakpoints]; - } - for (let j = 0; j < breakpoints.length; j++) { - let breakpoint_settings = breakpoints[j]; - if (breakpoint_settings != null) { - if (breakpoint_settings.transformation) { - breakpoint_settings.transformation = utils.generate_transformation_string(clone(breakpoint_settings.transformation)); - } - } - } - return JSON.stringify(breakpoints); -} - -function build_streaming_profiles_param(options = {}) { - let params = pickOnlyExistingValues(options, "display_name", "representations"); - if (isArray(params.representations)) { - params.representations = JSON.stringify(params.representations.map(r => ({ - transformation: utils.generate_transformation_string(r.transformation) - }))); - } - return params; -} - -function hashToParameters(hash) { - return entries(hash).reduce((parameters, [key, value]) => { - if (isArray(value)) { - key = key.endsWith('[]') ? key : key + '[]'; - const items = value.map(v => [key, v]); - parameters = parameters.concat(items); - } else { - parameters.push([key, value]); - } - return parameters; - }, []); -} - -/** - * Convert a hash of values to a URI query string. - * Array values are spread as individual parameters. - * @param {object} hash Key-value parameters - * @return {string} A URI query string. - */ -function hashToQuery(hash) { - return hashToParameters(hash).map(([key, value]) => `${querystring.escape(key)}=${querystring.escape(value)}`).join('&'); -} - -/** - * Verify that the parameter `value` is defined and it's string value is not zero. - *
This function should not be confused with `isEmpty()`. - * @private - * @param {string|number} value The value to check. - * @return {boolean} True if the value is defined and not empty. - */ - -function present(value) { - return value != null && ("" + value).length > 0; -} - -/** - * Returns a new object with key values from source based on the keys. - * `null` or `undefined` values are not copied. - * @private - * @param {object} source The object to pick values from. - * @param {...string} keys One or more keys to copy from source. - * @return {object} A new object with the required keys and values. - */ - -function pickOnlyExistingValues(source, ...keys) { - let result = {}; - if (source) { - keys.forEach((key) => { - if (source[key] != null) { - result[key] = source[key]; - } - }); - } - return result; -} - -/** - * Returns a JSON array as String. - * Yields the array before it is converted to JSON format - * @private - * @param {object|String|Array} data - * @param {function(*):*} [modifier] called with the array before the array is stringified - * @return {String|null} a JSON array string or `null` if data is `null` - */ - -function jsonArrayParam(data, modifier) { - if (!data) { - return null; - } - if (isString(data)) { - data = JSON.parse(data); - } - if (!isArray(data)) { - data = [data]; - } - if (isFunction(modifier)) { - data = modifier(data); - } - return JSON.stringify(data); -} - -/** - * Empty function - do nothing - * - */ -exports.NOP = function () { -}; -exports.generate_auth_token = generate_auth_token; -exports.getUserAgent = getUserAgent; -exports.build_upload_params = build_upload_params; -exports.build_multi_and_sprite_params = build_multi_and_sprite_params; -exports.api_download_url = api_download_url; -exports.timestamp = () => Math.floor(new Date().getTime() / 1000); -exports.option_consume = consumeOption; // for backwards compatibility -exports.build_array = toArray; // for backwards compatibility -exports.encode_double_array = encodeDoubleArray; -exports.encode_key_value = encode_key_value; -exports.encode_context = encode_context; -exports.build_eager = build_eager; -exports.build_custom_headers = build_custom_headers; -exports.generate_transformation_string = generate_transformation_string; -exports.updateable_resource_params = updateable_resource_params; -exports.extractUrlParams = extractUrlParams; -exports.extractTransformationParams = extractTransformationParams; -exports.patchFetchFormat = patchFetchFormat; -exports.url = url; -exports.video_url = video_url; -exports.video_thumbnail_url = video_thumbnail_url; -exports.api_url = api_url; -exports.random_public_id = random_public_id; -exports.signed_preloaded_image = signed_preloaded_image; -exports.api_sign_request = api_sign_request; -exports.clear_blank = clear_blank; -exports.merge = merge; -exports.sign_request = sign_request; -exports.webhook_signature = webhook_signature; -exports.verifyNotificationSignature = verifyNotificationSignature; -exports.process_request_params = process_request_params; -exports.private_download_url = private_download_url; -exports.zip_download_url = zip_download_url; -exports.download_archive_url = download_archive_url; -exports.download_zip_url = download_zip_url; -exports.cloudinary_js_config = cloudinary_js_config; -exports.v1_adapters = v1_adapters; -exports.as_safe_bool = as_safe_bool; -exports.archive_params = archive_params; -exports.build_explicit_api_params = build_explicit_api_params; -exports.generate_responsive_breakpoints_string = generate_responsive_breakpoints_string; -exports.build_streaming_profiles_param = build_streaming_profiles_param; -exports.hashToParameters = hashToParameters; -exports.present = present; -exports.only = pickOnlyExistingValues; // for backwards compatibility -exports.pickOnlyExistingValues = pickOnlyExistingValues; -exports.jsonArrayParam = jsonArrayParam; -exports.download_folder = download_folder; -exports.base_api_url_v1 = base_api_url_v1_1; -exports.base_api_url_v2 = base_api_url_v2; -exports.download_backedup_asset = download_backedup_asset; -exports.compute_hash = compute_hash; -exports.build_distribution_domain = build_distribution_domain; -exports.sort_object_by_key = sort_object_by_key; - -// was exported before, so kept for backwards compatibility -exports.DEFAULT_POSTER_OPTIONS = DEFAULT_POSTER_OPTIONS; -exports.DEFAULT_VIDEO_SOURCE_TYPES = DEFAULT_VIDEO_SOURCE_TYPES; - -Object.assign(module.exports, { - normalize_expression, - at, - clone, - extend, - filter, - includes, - isArray, - isEmpty, - isNumber, - isObject, - isRemoteUrl, - isString, - isUndefined, - keys: source => Object.keys(source), - ensurePresenceOf -}); - -/** - * Verifies an API response signature for a given public_id and version. - * Always uses signature version 1 for backward compatibility, matching the Ruby SDK. - * @param {string} public_id - * @param {string|number} version - * @param {string} signature - * @returns {boolean} - */ -function verify_api_response_signature(public_id, version, signature) { - const api_secret = config().api_secret; - const expected = exports.api_sign_request( - { - public_id, - version - }, - api_secret, - null, - 1 - ); - return signature === expected; -} - -exports.verify_api_response_signature = verify_api_response_signature; diff --git a/server/node_modules/cloudinary/lib/utils/isRemoteUrl.js b/server/node_modules/cloudinary/lib/utils/isRemoteUrl.js deleted file mode 100644 index eadcce7..0000000 --- a/server/node_modules/cloudinary/lib/utils/isRemoteUrl.js +++ /dev/null @@ -1,14 +0,0 @@ -const isString = require('lodash/isString'); - -/** - * Checks whether a given url or path is a local file - * @param {string} url the url or path to the file - * @returns {boolean} true if the given url is a remote location or data - */ -function isRemoteUrl(url) { - const SUBSTRING_LENGTH = 120; - const urlSubstring = isString(url) && url.substring(0, SUBSTRING_LENGTH); - return isString(url) && /^ftp:|^https?:|^gs:|^s3:|^data:([\w-.]+\/[\w-.]+(\+[\w-.]+)?)?(;[\w-.]+=[\w-.]+)*;base64,([a-zA-Z0-9\/+\n=]+)$/.test(urlSubstring); -} - -module.exports = isRemoteUrl; diff --git a/server/node_modules/cloudinary/lib/utils/parsing/consumeOption.js b/server/node_modules/cloudinary/lib/utils/parsing/consumeOption.js deleted file mode 100644 index 6bc8993..0000000 --- a/server/node_modules/cloudinary/lib/utils/parsing/consumeOption.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Deletes `option_name` from `options` and return the value if present. - * If `options` doesn't contain `option_name` the default value is returned. - * @param {Object} options a collection - * @param {String} option_name the name (key) of the desired value - * @param {*} [default_value] the value to return is option_name is missing - */ - -function consumeOption(options, option_name, default_value) { - let result = options[option_name]; - delete options[option_name]; - return result != null ? result : default_value; -} - -module.exports = consumeOption; diff --git a/server/node_modules/cloudinary/lib/utils/parsing/toArray.js b/server/node_modules/cloudinary/lib/utils/parsing/toArray.js deleted file mode 100644 index 0c40632..0000000 --- a/server/node_modules/cloudinary/lib/utils/parsing/toArray.js +++ /dev/null @@ -1,19 +0,0 @@ -const isArray = require('lodash/isArray'); - -/** - * @desc Turns arguments that aren't arrays into arrays - * @param arg - * @returns { any | any[] } - */ -function toArray(arg) { - switch (true) { - case arg == null: - return []; - case isArray(arg): - return arg; - default: - return [arg]; - } -} - -module.exports = toArray; diff --git a/server/node_modules/cloudinary/lib/utils/rimraf.js b/server/node_modules/cloudinary/lib/utils/rimraf.js deleted file mode 100644 index 27e5a61..0000000 --- a/server/node_modules/cloudinary/lib/utils/rimraf.js +++ /dev/null @@ -1,23 +0,0 @@ -const fs = require('fs'); -const path = require('path'); - -/** - * Remove directory recursively - * @param {string} dir_path - * @see https://stackoverflow.com/a/42505874/3027390 - */ -function rimraf(dir_path) { - if (fs.existsSync(dir_path)) { - fs.readdirSync(dir_path).forEach(function (entry) { - let entry_path = path.join(dir_path, entry); - if (fs.lstatSync(entry_path).isDirectory()) { - rimraf(entry_path); - } else { - fs.unlinkSync(entry_path); - } - }); - fs.rmdirSync(dir_path); - } -} - -module.exports = rimraf; diff --git a/server/node_modules/cloudinary/lib/utils/srcsetUtils.js b/server/node_modules/cloudinary/lib/utils/srcsetUtils.js deleted file mode 100644 index 2d55ac5..0000000 --- a/server/node_modules/cloudinary/lib/utils/srcsetUtils.js +++ /dev/null @@ -1,156 +0,0 @@ - -const utils = require('./index'); -const generateBreakpoints = require('./generateBreakpoints'); -const Cache = require('../cache'); - -const isEmpty = utils.isEmpty; - -/** - * Options used to generate the srcset attribute. - * @typedef {object} srcset - * @property {(number[]|string[])} [breakpoints] An array of breakpoints. - * @property {number} [min_width] Minimal width of the srcset images. - * @property {number} [max_width] Maximal width of the srcset images. - * @property {number} [max_images] Number of srcset images to generate. - * @property {object|string} [transformation] The transformation to use in the srcset urls. - * @property {boolean} [sizes] Whether to calculate and add the sizes attribute. - */ - -/** - * Helper function. Generates a single srcset item url - * - * @private - * @param {string} public_id Public ID of the resource. - * @param {number} width Width in pixels of the srcset item. - * @param {object|string} transformation - * @param {object} options Additional options. - * - * @return {string} Resulting URL of the item - */ -function scaledUrl(public_id, width, transformation, options = {}) { - let configParams = utils.extractUrlParams(options); - transformation = transformation || options; - configParams.raw_transformation = utils.generate_transformation_string([utils.extend({}, transformation), { crop: 'scale', width: width }]); - - return utils.url(public_id, configParams); -} - -/** - * If cache is enabled, get the breakpoints from the cache. If the values were not found in the cache, - * or cache is not enabled, generate the values. - * @param {srcset} srcset The srcset configuration parameters - * @param {string} public_id - * @param {object} options - * @return {*|Array} - */ -function getOrGenerateBreakpoints(public_id, srcset = {}, options = {}) { - let breakpoints = []; - if (srcset.useCache) { - breakpoints = Cache.get(public_id, options); - if (!breakpoints) { - breakpoints = []; - } - } else { - breakpoints = generateBreakpoints(srcset); - } - return breakpoints; -} - -/** - * Helper function. Generates srcset attribute value of the HTML img tag - * @private - * - * @param {string} public_id Public ID of the resource - * @param {number[]} breakpoints An array of breakpoints (in pixels) - * @param {object} transformation The transformation - * @param {object} options Includes html tag options, transformation options - * @return {string} Resulting srcset attribute value - */ -function generateSrcsetAttribute(public_id, breakpoints, transformation, options) { - options = utils.clone(options); - utils.patchFetchFormat(options); - return breakpoints.map(width => `${scaledUrl(public_id, width, transformation, options)} ${width}w`).join(', '); -} - -/** - * Helper function. Generates sizes attribute value of the HTML img tag - * @private - * @param {number[]} breakpoints An array of breakpoints. - * @return {string} Resulting sizes attribute value - */ -function generateSizesAttribute(breakpoints = []) { - return breakpoints.map(width => `(max-width: ${width}px) ${width}px`).join(', '); -} - -/** - * Helper function. Generates srcset and sizes attributes of the image tag - * - * Generated attributes are added to attributes argument - * - * @private - * @param {string} publicId The public ID of the resource - * @param {object} attributes Existing HTML attributes. - * @param {srcset} srcsetData - * @param {object} options Additional options. - * - * @return array The responsive attributes - */ -function generateImageResponsiveAttributes(publicId, attributes = {}, srcsetData = {}, options = {}) { - // Create both srcset and sizes here to avoid fetching breakpoints twice - - let responsiveAttributes = {}; - if (isEmpty(srcsetData)) { - return responsiveAttributes; - } - - const generateSizes = (!attributes.sizes && srcsetData.sizes === true); - - const generateSrcset = !attributes.srcset; - if (generateSrcset || generateSizes) { - let breakpoints = getOrGenerateBreakpoints(publicId, srcsetData, options); - - if (generateSrcset) { - let transformation = srcsetData.transformation; - let srcsetAttr = generateSrcsetAttribute(publicId, breakpoints, transformation, options); - if (!isEmpty(srcsetAttr)) { - responsiveAttributes.srcset = srcsetAttr; - } - } - - if (generateSizes) { - let sizesAttr = generateSizesAttribute(breakpoints); - if (!isEmpty(sizesAttr)) { - responsiveAttributes.sizes = sizesAttr; - } - } - } - return responsiveAttributes; -} - -/** - * Generate a media query - * - * @private - * @param {object} options configuration options - * @param {number|string} options.min_width - * @param {number|string} options.max_width - * @return {string} a media query string - */ -function generateMediaAttr(options = {}) { - let mediaQuery = []; - if (options.min_width != null) { - mediaQuery.push(`(min-width: ${options.min_width}px)`); - } - if (options.max_width != null) { - mediaQuery.push(`(max-width: ${options.max_width}px)`); - } - return mediaQuery.join(' and '); -} - -module.exports = { - srcsetUrl: scaledUrl, - generateSrcsetAttribute, - generateSizesAttribute, - generateMediaAttr, - generateImageResponsiveAttributes -}; diff --git a/server/node_modules/cloudinary/lib/utils/utf8_encode.js b/server/node_modules/cloudinary/lib/utils/utf8_encode.js deleted file mode 100644 index 4ab7a6f..0000000 --- a/server/node_modules/cloudinary/lib/utils/utf8_encode.js +++ /dev/null @@ -1,57 +0,0 @@ -/* eslint-disable no-bitwise */ -// http://kevin.vanzonneveld.net -// + original by: Webtoolkit.info (http://www.webtoolkit.info/) -// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) -// + improved by: sowberry -// + tweaked by: Jack -// + bugfixed by: Onno Marsman -// + improved by: Yves Sucaet -// + bugfixed by: Onno Marsman -// + bugfixed by: Ulrich -// + bugfixed by: Rafal Kukawski -// + improved by: kirilloid -// * example 1: utf8_encode('Kevin van Zonneveld') -// * returns 1: 'Kevin van Zonneveld' - -/** - * Encode the given string - * @private - * @param {string} argString the string to encode - * @return {string} - */ -module.exports = function utf8_encode(argString) { - let c1, enc, n; - if (argString == null) { - return ""; - } - let string = argString + ""; - let utftext = ""; - let start = 0; - let end = 0; - let stringl = string.length; - n = 0; - while (n < stringl) { - c1 = string.charCodeAt(n); - enc = null; - if (c1 < 128) { - end++; - } else if (c1 > 127 && c1 < 2048) { - enc = String.fromCharCode((c1 >> 6) | 192, (c1 & 63) | 128); - } else { - enc = String.fromCharCode((c1 >> 12) | 224, ((c1 >> 6) & 63) | 128, (c1 & 63) | 128); - } - if (enc !== null) { - if (end > start) { - utftext += string.slice(start, end); - } - utftext += enc; - start = n + 1; - end = start; - } - n++; - } - if (end > start) { - utftext += string.slice(start, stringl); - } - return utftext; -}; diff --git a/server/node_modules/cloudinary/lib/v2/api.js b/server/node_modules/cloudinary/lib/v2/api.js deleted file mode 100644 index 4f10984..0000000 --- a/server/node_modules/cloudinary/lib/v2/api.js +++ /dev/null @@ -1,80 +0,0 @@ -const api = require('../api'); -const v1_adapters = require('../utils').v1_adapters; - -v1_adapters(exports, api, { - ping: 0, - usage: 0, - resource_types: 0, - resources: 0, - resources_by_tag: 1, - resources_by_context: 2, - resources_by_moderation: 2, - resource_by_asset_id: 1, - resources_by_asset_ids: 1, - resources_by_ids: 1, - resources_by_asset_folder: 1, - resource: 1, - restore: 1, - update: 1, - delete_resources: 1, - delete_resources_by_prefix: 1, - delete_resources_by_tag: 1, - delete_all_resources: 0, - delete_derived_resources: 1, - tags: 0, - transformations: 0, - transformation: 1, - delete_transformation: 1, - update_transformation: 2, - create_transformation: 2, - upload_presets: 0, - upload_preset: 1, - delete_upload_preset: 1, - update_upload_preset: 1, - create_upload_preset: 0, - root_folders: 0, - sub_folders: 1, - delete_folder: 1, - rename_folder: 2, - create_folder: 1, - upload_mappings: 0, - upload_mapping: 1, - delete_upload_mapping: 1, - update_upload_mapping: 1, - create_upload_mapping: 1, - list_streaming_profiles: 0, - get_streaming_profile: 1, - delete_streaming_profile: 1, - update_streaming_profile: 1, - create_streaming_profile: 1, - publish_by_ids: 1, - publish_by_tag: 1, - publish_by_prefix: 1, - update_resources_access_mode_by_prefix: 2, - update_resources_access_mode_by_tag: 2, - update_resources_access_mode_by_ids: 2, - search: 1, - search_folders: 1, - visual_search: 1, - delete_derived_by_transformation: 2, - add_metadata_field: 1, - list_metadata_fields: 1, - delete_metadata_field: 1, - metadata_field_by_field_id: 1, - update_metadata_field: 2, - update_metadata_field_datasource: 2, - delete_datasource_entries: 2, - restore_metadata_field_datasource: 2, - order_metadata_field_datasource: 3, - reorder_metadata_fields: 2, - list_metadata_rules: 1, - add_metadata_rule: 1, - delete_metadata_rule: 1, - update_metadata_rule: 2, - add_related_assets: 2, - add_related_assets_by_asset_id: 2, - delete_related_assets: 2, - delete_related_assets_by_asset_id: 2, - delete_backed_up_assets: 2, - config: 0 -}); diff --git a/server/node_modules/cloudinary/lib/v2/index.js b/server/node_modules/cloudinary/lib/v2/index.js deleted file mode 100644 index 1dcb49f..0000000 --- a/server/node_modules/cloudinary/lib/v2/index.js +++ /dev/null @@ -1,14 +0,0 @@ -const v1 = require('../cloudinary'); -const api = require('./api'); -const uploader = require('./uploader'); -const search = require('./search'); -const search_folders = require('./search_folders'); - -const v2 = { - ...v1, - api, - uploader, - search, - search_folders -}; -module.exports = v2; diff --git a/server/node_modules/cloudinary/lib/v2/search.js b/server/node_modules/cloudinary/lib/v2/search.js deleted file mode 100644 index 72934af..0000000 --- a/server/node_modules/cloudinary/lib/v2/search.js +++ /dev/null @@ -1,185 +0,0 @@ -const api = require('./api'); -const config = require('../config'); -const { - isEmpty, - isNumber, - compute_hash, - build_distribution_domain, - clear_blank, - sort_object_by_key -} = require('../utils'); -const {base64Encode} = require('../utils/encoding/base64Encode'); - -const Search = class Search { - constructor() { - this.query_hash = { - sort_by: [], - aggregate: [], - with_field: [], - fields: [] - }; - this._ttl = 300; - } - - static instance() { - return new Search(); - } - - static expression(value) { - return this.instance().expression(value); - } - - static max_results(value) { - return this.instance().max_results(value); - } - - static next_cursor(value) { - return this.instance().next_cursor(value); - } - - static aggregate(value) { - return this.instance().aggregate(value); - } - - static with_field(value) { - return this.instance().with_field(value); - } - - static fields(value) { - return this.instance().fields(value); - } - - static sort_by(field_name, dir = 'asc') { - return this.instance().sort_by(field_name, dir); - } - - static ttl(newTtl) { - return this.instance().ttl(newTtl); - } - - static execute(options, callback) { - return this.instance().execute(options, callback); - } - - expression(value) { - this.query_hash.expression = value; - return this; - } - - max_results(value) { - this.query_hash.max_results = value; - return this; - } - - next_cursor(value) { - this.query_hash.next_cursor = value; - return this; - } - - aggregate(value) { - const found = this.query_hash.aggregate.find(v => v === value); - - if (!found) { - this.query_hash.aggregate.push(value); - } - - return this; - } - - with_field(value) { - if (Array.isArray(value)) { - this.query_hash.with_field = this.query_hash.with_field.concat(value); - } else { - this.query_hash.with_field.push(value); - } - - this.query_hash.with_field = Array.from(new Set(this.query_hash.with_field)); - return this; - } - - fields(value) { - if (Array.isArray(value)) { - this.query_hash.fields = this.query_hash.fields.concat(value); - } else { - this.query_hash.fields.push(value); - } - - this.query_hash.fields = Array.from(new Set(this.query_hash.fields)); - return this; - } - - sort_by(field_name, dir = "desc") { - let sort_bucket; - sort_bucket = {}; - sort_bucket[field_name] = dir; - - // Check if this field name is already stored in the hash - const previously_sorted_obj = this.query_hash.sort_by.find((sort_by) => sort_by[field_name]); - - // Since objects are references in Javascript, we can update the reference we found - // For example, - if (previously_sorted_obj) { - previously_sorted_obj[field_name] = dir; - } else { - this.query_hash.sort_by.push(sort_bucket); - } - - return this; - } - - ttl(newTtl) { - if (isNumber(newTtl)) { - this._ttl = newTtl; - return this; - } - - throw new Error('New TTL value has to be a Number.'); - } - - to_query() { - Object.keys(this.query_hash).forEach((k) => { - let v = this.query_hash[k]; - if (!isNumber(v) && isEmpty(v)) { - delete this.query_hash[k]; - } - }); - return this.query_hash; - } - - execute(options, callback) { - if (callback === null) { - callback = options; - } - options = options || {}; - return api.search(this.to_query(), options, callback); - } - - to_url(ttl, next_cursor, options = {}) { - const apiSecret = 'api_secret' in options ? options.api_secret : config().api_secret; - if (!apiSecret) { - throw new Error('Must supply api_secret'); - } - - const urlTtl = ttl || this._ttl; - - const query = this.to_query(); - - let urlCursor = next_cursor; - if (query.next_cursor && !next_cursor) { - urlCursor = query.next_cursor; - } - delete query.next_cursor; - - const dataOrderedByKey = sort_object_by_key(clear_blank(query)); - const encodedQuery = base64Encode(JSON.stringify(dataOrderedByKey)); - - const urlPrefix = build_distribution_domain(options.source, options); - - const signature = compute_hash(`${urlTtl}${encodedQuery}${apiSecret}`, 'sha256', 'hex'); - - const urlWithoutCursor = `${urlPrefix}/search/${signature}/${urlTtl}/${encodedQuery}`; - return urlCursor ? `${urlWithoutCursor}/${urlCursor}` : urlWithoutCursor; - } -}; - -module.exports = Search; diff --git a/server/node_modules/cloudinary/lib/v2/search_folders.js b/server/node_modules/cloudinary/lib/v2/search_folders.js deleted file mode 100644 index 9221b14..0000000 --- a/server/node_modules/cloudinary/lib/v2/search_folders.js +++ /dev/null @@ -1,22 +0,0 @@ -const Search = require('./search'); -const api = require('./api'); - -const SearchFolders = class SearchFolders extends Search { - constructor() { - super(); - } - - static instance() { - return new SearchFolders(); - } - - execute(options, callback) { - if (callback === null) { - callback = options; - } - options = options || {}; - return api.search_folders(this.to_query(), options, callback); - } -}; - -module.exports = SearchFolders; diff --git a/server/node_modules/cloudinary/lib/v2/uploader.js b/server/node_modules/cloudinary/lib/v2/uploader.js deleted file mode 100644 index 5c1bd6d..0000000 --- a/server/node_modules/cloudinary/lib/v2/uploader.js +++ /dev/null @@ -1,38 +0,0 @@ -const uploader = require('../uploader'); -const v1_adapters = require('../utils').v1_adapters; - -v1_adapters(exports, uploader, { - unsigned_upload_stream: 1, - upload_stream: 0, - unsigned_upload: 2, - upload: 1, - upload_large_part: 0, - upload_large: 1, - upload_chunked: 1, - upload_chunked_stream: 0, - explicit: 1, - destroy: 1, - rename: 2, - text: 1, - generate_sprite: 1, - multi: 1, - explode: 1, - add_tag: 2, - remove_tag: 2, - remove_all_tags: 1, - add_context: 2, - remove_all_context: 1, - replace_tag: 2, - create_archive: 0, - create_zip: 0, - update_metadata: 2 -}); - -exports.direct_upload = uploader.direct_upload; -exports.upload_tag_params = uploader.upload_tag_params; -exports.upload_url = uploader.upload_url; -exports.image_upload_tag = uploader.image_upload_tag; -exports.unsigned_image_upload_tag = uploader.unsigned_image_upload_tag; -exports.create_slideshow = uploader.create_slideshow; -exports.download_generated_sprite = uploader.download_generated_sprite; -exports.download_multi = uploader.download_multi; diff --git a/server/node_modules/cloudinary/package.json b/server/node_modules/cloudinary/package.json deleted file mode 100644 index 3a2ffde..0000000 --- a/server/node_modules/cloudinary/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "author": "Cloudinary ", - "name": "cloudinary", - "description": "Cloudinary NPM for node.js integration", - "version": "2.7.0", - "homepage": "https://cloudinary.com", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cloudinary/cloudinary_npm.git" - }, - "main": "cloudinary.js", - "dependencies": { - "lodash": "^4.17.21", - "q": "^1.5.1" - }, - "devDependencies": { - "@types/expect.js": "^0.3.29", - "@types/mocha": "^7.0.2", - "@types/node": "^13.5.0", - "date-fns": "^2.16.1", - "dotenv": "4.x", - "dtslint": "^0.9.1", - "eslint": "^6.8.0", - "eslint-config-airbnb-base": "^14.2.1", - "eslint-plugin-import": "^2.20.2", - "expect.js": "0.3.x", - "glob": "^7.1.6", - "jsdoc": "^4.0.4", - "jsdom": "^9.12.0", - "jsdom-global": "2.1.1", - "mocha": "^6.2.3", - "nyc": "^14.1.1", - "rimraf": "^3.0.0", - "sinon": "^6.1.4", - "typescript": "^3.7.5", - "webpack-cli": "^3.2.1" - }, - "files": [ - "lib/**/*", - "cloudinary.js", - "babel.config.js", - "package.json", - "types/index.d.ts" - ], - "types": "types", - "scripts": { - "test": "tools/scripts/test.sh", - "test:unit": "tools/scripts/test.es6.unit.sh", - "test-with-temp-cloud": "tools/scripts/tests-with-temp-cloud.sh", - "dtslint": "tools/scripts/ditslint.sh", - "lint": "tools/scripts/lint.sh", - "coverage": "tools/scripts/test.es6.sh --coverage", - "test-es6": "tools/scripts/test.es6.sh", - "docs": "tools/scripts/docs.sh" - }, - "engines": { - "node": ">=9" - } -} diff --git a/server/node_modules/cloudinary/types/index.d.ts b/server/node_modules/cloudinary/types/index.d.ts deleted file mode 100644 index 2037896..0000000 --- a/server/node_modules/cloudinary/types/index.d.ts +++ /dev/null @@ -1,1542 +0,0 @@ -import {Transform} from 'stream'; - - -declare module 'cloudinary' { - - /****************************** Constants *************************************/ - /****************************** Transformations *******************************/ - type CropMode = - | (string & {}) - | "scale" - | "fit" - | "limit" - | "mfit" - | "fill" - | "lfill" - | "pad" - | "lpad" - | "mpad" - | "crop" - | "thumb" - | "imagga_crop" - | "imagga_scale"; - type Gravity = - | (string & {}) - | "north_west" - | "north" - | "north_east" - | "west" - | "center" - | "east" - | "south_west" - | "south" - | "south_east" - | "xy_center" - | "face" - | "face:center" - | "face:auto" - | "faces" - | "faces:center" - | "faces:auto" - | "body" - | "body:face" - | "adv_face" - | "adv_faces" - | "adv_eyes" - | "custom" - | "custom:face" - | "custom:faces" - | "custom:adv_face" - | "custom:adv_faces" - | "auto" - | "auto:adv_face" - | "auto:adv_faces" - | "auto:adv_eyes" - | "auto:body" - | "auto:face" - | "auto:faces" - | "auto:custom_no_override" - | "auto:none" - | "liquid" - | "ocr_text"; - type Angle = - number - | (string & {}) - | Array - | "auto_right" - | "auto_left" - | "ignore" - | "vflip" - | "hflip"; - type ImageEffect = - | (string & {}) - | "hue" - | "red" - | "green" - | "blue" - | "negate" - | "brightness" - | "auto_brightness" - | "brightness_hsb" - | "sepia" - | "grayscale" - | "blackwhite" - | "saturation" - | "colorize" - | "replace_color" - | "simulate_colorblind" - | "assist_colorblind" - | "recolor" - | "tint" - | "contrast" - | "auto_contrast" - | "auto_color" - | "vibrance" - | "noise" - | "ordered_dither" - | "pixelate_faces" - | "pixelate_region" - | "pixelate" - | "unsharp_mask" - | "sharpen" - | "blur_faces" - | "blur_region" - | "blur" - | "tilt_shift" - | "gradient_fade" - | "vignette" - | "anti_removal" - | "overlay" - | "mask" - | "multiply" - | "displace" - | "shear" - | "distort" - | "trim" - | "make_transparent" - | "shadow" - | "viesus_correct" - | "fill_light" - | "gamma" - | "improve"; - - type VideoEffect = - (string & {}) - | "accelerate" - | "reverse" - | "boomerang" - | "loop" - | "make_transparent" - | "transition"; - type AudioCodec = (string & {}) | "none" | "aac" | "vorbis" | "mp3"; - type AudioFrequency = - string - | (number & {}) - | 8000 - | 11025 - | 16000 - | 22050 - | 32000 - | 37800 - | 44056 - | 44100 - | 47250 - | 48000 - | 88200 - | 96000 - | 176400 - | 192000; - /****************************** Flags *************************************/ - type ImageFlags = - | (string & {}) - | Array - | "any_format" - | "attachment" - | "apng" - | "awebp" - | "clip" - | "clip_evenodd" - | "cutter" - | "force_strip" - | "getinfo" - | "ignore_aspect_ratio" - | "immutable_cache" - | "keep_attribution" - | "keep_iptc" - | "layer_apply" - | "lossy" - | "preserve_transparency" - | "png8" - | "png32" - | "progressive" - | "rasterize" - | "region_relative" - | "relative" - | "replace_image" - | "sanitize" - | "strip_profile" - | "text_no_trim" - | "no_overflow" - | "text_disallow_overflow" - | "tiff8_lzw" - | "tiled"; - type VideoFlags = - | (string & {}) - | Array - | "animated" - | "awebp" - | "attachment" - | "streaming_attachment" - | "hlsv3" - | "keep_dar" - | "splice" - | "layer_apply" - | "no_stream" - | "mono" - | "relative" - | "truncate_ts" - | "waveform"; - type ColorSpace = (string & {}) | "srgb" | "no_cmyk" | "keep_cmyk"; - type DeliveryType = - | (string & {}) - | "upload" - | "private" - | "authenticated" - | "fetch" - | "multi" - | "text" - | "asset" - | "list" - | "facebook" - | "twitter" - | "twitter_name" - | "instagram" - | "gravatar" - | "youtube" - | "hulu" - | "vimeo" - | "animoto" - | "worldstarhiphop" - | "dailymotion"; - /****************************** URL *************************************/ - type ResourceType = (string & {}) | "image" | "raw" | "video"; - type ImageFormat = - | (string & {}) - | "gif" - | "png" - | "jpg" - | "bmp" - | "ico" - | "pdf" - | "tiff" - | "eps" - | "jpc" - | "jp2" - | "psd" - | "webp" - | "zip" - | "svg" - | "webm" - | "wdp" - | "hpx" - | "djvu" - | "ai" - | "flif" - | "bpg" - | "miff" - | "tga" - | "heic" - type VideoFormat = - | (string & {}) - | "auto" - | "flv" - | "m3u8" - | "ts" - | "mov" - | "mkv" - | "mp4" - | "mpd" - | "ogv" - | "webm" - - export interface CommonTransformationOptions { - transformation?: TransformationOptions; - raw_transformation?: string; - crop?: CropMode; - width?: number | string; - height?: number | string; - size?: string; - aspect_ratio?: number | string; - gravity?: Gravity; - x?: number | string; - y?: number | string; - zoom?: number | string; - effect?: string | Array; - background?: string; - angle?: Angle; - radius?: number | string; - overlay?: string | object; //might be Record - custom_function?: string | { function_type: (string & {}) | "wasm" | "remote", source: string } - variables?: Array; //might be Record - if?: string; - else?: string; - end_if?: string; - dpr?: number | string; - quality?: number | string; - delay?: number | string; - - [futureKey: string]: any; - } - - export interface ImageTransformationOptions extends CommonTransformationOptions { - underlay?: string | Object; //might be Record - color?: string; - color_space?: ColorSpace; - opacity?: number | string; - border?: string; - default_image?: string; - density?: number | string; - format?: ImageFormat; - fetch_format?: ImageFormat; - effect?: string | Array | ImageEffect; - page?: number | string; - flags?: ImageFlags | string; - - [futureKey: string]: any; - } - - interface VideoTransformationOptions extends CommonTransformationOptions { - audio_codec?: AudioCodec; - audio_frequency?: AudioFrequency; - video_codec?: string | Object; //might be Record - bit_rate?: number | string; - fps?: string | Array; - keyframe_interval?: string; - offset?: string, - start_offset?: number | string; - end_offset?: number | string; - duration?: number | string; - streaming_profile?: StreamingProfiles - video_sampling?: number | string; - format?: VideoFormat; - fetch_format?: VideoFormat; - effect?: string | Array | VideoEffect; - flags?: VideoFlags; - - [futureKey: string]: any; - } - - interface TextStyleOptions { - text_style?: string; - font_family?: string; - font_size?: number; - font_color?: string; - font_weight?: string; - font_style?: string; - background?: string; - opacity?: number; - text_decoration?: string - } - - interface ConfigOptions { - cloud_name?: string; - api_key?: string; - api_secret?: string; - api_proxy?: string; - private_cdn?: boolean; - secure_distribution?: string; - force_version?: boolean; - ssl_detected?: boolean; - secure?: boolean; - cdn_subdomain?: boolean; - secure_cdn_subdomain?: boolean; - cname?: string; - shorten?: boolean; - sign_url?: boolean; - long_url_signature?: boolean; - use_root_path?: boolean; - auth_token?: AuthTokenApiOptions; - account_id?: string; - provisioning_api_key?: string; - provisioning_api_secret?: string; - oauth_token?: string; - - [futureKey: string]: any; - } - - export interface ResourceOptions { - type?: string; - resource_type?: string; - } - - export interface UrlOptions extends ResourceOptions { - version?: string; - format?: string; - url_suffix?: string; - - [futureKey: string]: any; - } - - export interface ImageTagOptions { - html_height?: string; - html_width?: string; - srcset?: object; //might be Record - attributes?: object; //might be Record - client_hints?: boolean; - responsive?: boolean; - hidpi?: boolean; - responsive_placeholder?: boolean; - - [futureKey: string]: any; - } - - export interface VideoTagOptions { - source_types?: string | string[]; - source_transformation?: TransformationOptions; - fallback_content?: string; - poster?: string | object; //might be Record - controls?: boolean; - preload?: string; - - [futureKey: string]: any; - } - - /****************************** Admin API Options *************************************/ - export interface AdminApiOptions { - agent?: object; //might be Record - content_type?: string; - oauth_token?: string; - - [futureKey: string]: any; - } - - export type VisualSearchParams = { image_url: string } | { image_asset_id: string } | { text: string }; - - export interface ArchiveApiOptions { - allow_missing?: boolean; - async?: boolean; - expires_at?: number; - flatten_folders?: boolean; - flatten_transformations?: boolean; - keep_derived?: boolean; - mode?: string; - notification_url?: string; - prefixes?: string; - public_ids?: string[] | string; - fully_qualified_public_ids?: string[] | string; - skip_transformation_name?: boolean; - tags?: string | string[]; - target_format?: TargetArchiveFormat; - target_public_id?: string; - target_tags?: string[]; - timestamp?: number; - transformations?: TransformationOptions; - type?: DeliveryType - use_original_filename?: boolean; - - [futureKey: string]: any; - } - - export interface UpdateApiOptions extends ResourceOptions { - access_control?: string[]; - auto_tagging?: number; - background_removal?: string; - categorization?: string; - context?: boolean | string; - custom_coordinates?: string; - detection?: string; - face_coordinates?: string; - headers?: string; - notification_url?: string; - ocr?: string; - raw_convert?: string; - similarity_search?: string; - tags?: string | string[]; - moderation_status?: string; - unsafe_update?: object; //might be Record - allowed_for_strict?: boolean; - asset_folder?: string; - unique_display_name?: boolean; - display_name?: string - - [futureKey: string]: any; - } - - export interface PublishApiOptions extends ResourceOptions { - invalidate?: boolean; - overwrite?: boolean; - - [futureKey: string]: any; - } - - export interface ResourceApiOptions extends ResourceOptions { - transformation?: TransformationOptions; - transformations?: TransformationOptions; - keep_original?: boolean; - next_cursor?: boolean | string; - public_ids?: string[]; - prefix?: string; - all?: boolean; - max_results?: number; - tags?: boolean; - tag?: string; - context?: boolean; - direction?: number | string; - moderations?: boolean; - start_at?: string; - exif?: boolean; - colors?: boolean; - derived_next_cursor?: string; - faces?: boolean; - image_metadata?: boolean; - media_metadata?: boolean; - pages?: boolean; - coordinates?: boolean; - phash?: boolean; - cinemagraph_analysis?: boolean; - accessibility_analysis?: boolean; - related?: boolean; - - [futureKey: string]: any; - } - - export interface UploadApiOptions { - access_mode?: AccessMode; - allowed_formats?: Array | Array; - async?: boolean; - backup?: boolean; - callback?: string; - colors?: boolean; - discard_original_filename?: boolean; - eager?: TransformationOptions; - eager_async?: boolean; - eager_notification_url?: string; - eval?: string; - exif?: boolean; - faces?: boolean; - filename_override?: string; - folder?: string; - format?: VideoFormat | ImageFormat; - image_metadata?: boolean; - media_metadata?: boolean; - invalidate?: boolean; - moderation?: ModerationKind; - notification_url?: string; - overwrite?: boolean; - phash?: boolean; - proxy?: string; - public_id?: string; - quality_analysis?: boolean; - resource_type?: "image" | "video" | "raw" | "auto"; - responsive_breakpoints?: Record; - return_delete_token?: boolean - timestamp?: number; - transformation?: TransformationOptions; - type?: DeliveryType; - unique_filename?: boolean; - upload_preset?: string; - use_filename?: boolean; - chunk_size?: number; - disable_promises?: boolean; - oauth_token?: string; - use_asset_folder_as_public_id_prefix?: boolean; - regions?: Record]>; - auto_chaptering?: boolean; - auto_transcription?: boolean | { translate: Array; }; - - [futureKey: string]: any; - } - - export type RegionCoordinate = [number, number]; - - export interface ProvisioningApiOptions { - account_id?: string; - provisioning_api_key?: string; - provisioning_api_secret?: string; - agent?: object; //might be Record? - content_type?: string; - - [futureKey: string]: any; - } - - export interface AccessKeyDetails { - name: string, - api_key: string, - api_secret: string, - created_at: string, - updated_at: string, - enabled: boolean - } - - export interface AccessKeysListResponse { - access_keys: Array, - total: number - } - - export interface DeleteAccessKeyResponse { - message: 'ok' | 'not_found' - } - - export interface AuthTokenApiOptions { - key: string; - acl: string; - ip?: string; - start_time?: number; - duration?: number; - expiration?: number; - url?: string; - } - - type TransformationOptions = - string - | string[] - | VideoTransformationOptions - | ImageTransformationOptions - | Object //might be Record - | Array - | Array; - - type ImageTransformationAndTagsOptions = ImageTransformationOptions | ImageTagOptions; - type VideoTransformationAndTagsOptions = VideoTransformationOptions | VideoTagOptions; - type ImageAndVideoFormatOptions = ImageFormat | VideoFormat; - type ConfigAndUrlOptions = ConfigOptions | UrlOptions; - type AdminAndPublishOptions = AdminApiOptions | PublishApiOptions; - type AdminAndResourceOptions = AdminApiOptions | ResourceApiOptions; - type AdminAndUpdateApiOptions = AdminApiOptions | UpdateApiOptions; - - /****************************** API *************************************/ - type Status = (string & {}) | "pending" | "approved" | "rejected"; - type StreamingProfiles = - (string & {}) - | "4k" - | "full_hd" - | "hd" - | "sd" - | "full_hd_wifi" - | "full_hd_lean" - | "hd_lean"; - type ModerationKind = (string & {}) | "manual" | "webpurify" | "aws_rek" | "metascan"; - type AccessMode = (string & {}) | "public" | "authenticated"; - type TargetArchiveFormat = (string & {}) | "zip" | "tgz"; - - // err is kept for backwards compatibility, it currently will always be undefined - type ResponseCallback = (err?: any, callResult?: any) => any; - - type UploadResponseCallback = (err?: UploadApiErrorResponse, callResult?: UploadApiResponse) => void; - - export interface AdminApiPaginationResponse { - next_cursor?: string; - } - - export interface AdminApiBaseResponse { - rate_limit_allowed?: number; - rate_limit_reset_at?: string; - rate_limit_remaining?: number; - } - - export interface UploadApiResponse { - public_id: string; - version: number; - signature: string; - width: number; - height: number; - format: string; - resource_type: "image" | "video" | "raw" | "auto"; - created_at: string; - tags: Array; - pages: number; - bytes: number; - type: string; - etag: string; - placeholder: boolean; - url: string; - secure_url: string; - access_mode: string; - original_filename: string; - moderation: Array; - access_control: Array; - context: object; //won't change since it's response, we need to discuss documentation team about it before implementing. - metadata: object; //won't change since it's response, we need to discuss documentation team about it before implementing. - colors?: [string, number][]; - - [futureKey: string]: any; - } - - export interface UploadApiErrorResponse { - message: string; - name: string; - http_code: number; - - [futureKey: string]: any; - } - - class UploadStream extends Transform { - } - - export interface DeleteApiResponse { - message: string; - http_code: number; - } - - export interface BaseAssetRelation { - asset: string; - status: 200; - } - - export interface AssetRelationSuccess extends BaseAssetRelation { - message: 'success'; - code: 'success_ids' - } - - export interface AssetRelationAlreadyExists extends BaseAssetRelation { - message: 'resource already exists'; - code: 'already_exists_ids'; - } - - export interface NewAssetRelationResponse { - failed: [any], - success: Array - } - - export interface DeleteAssetRelation { - failed: [any], - success: Array - } - - export interface MetadataFieldApiOptions { - external_id?: string; - type?: string; - label?: string; - mandatory?: boolean; - default_value?: number; - validation?: object; //there are 4 types, we need to discuss documentation team about it before implementing. - datasource?: { - values: Array - }; - default_disabled?: boolean; - - [futureKey: string]: any; - } - - export interface MetadataFieldApiResponse { - external_id: string; - type: string; - label: string; - mandatory: boolean; - default_value: number; - validation: object; //there are 4 types, we need to discuss documentation team about it before implementing. - datasource: { - values: Array - }; - - [futureKey: string]: any; - } - - export interface MetadataFieldsApiResponse extends AdminApiPaginationResponse, AdminApiBaseResponse { - metadata_fields: MetadataFieldApiResponse[] - } - - export interface DatasourceEntry { - external_id?: string; - value: string; - state?: 'active' | 'inactive' - } - - export interface DatasourceChange { - values: Array - } - - export type MetadataRuleCondition = - MetadataRulePopulatedCondition - | MetadataRuleEqualsCondition - | MetadataRuleIncludesCondition - | MetadataRuleOrCondition - | MetadataRuleAndCondition; - - export interface MetadataRulePopulatedCondition { - metadata_field_id: string; - populated: boolean; - } - - export interface MetadataRuleEqualsCondition { - metadata_field_id: string; - equals: string; - } - - export interface MetadataRuleIncludesCondition { - metadata_field_id: string; - includes: Array; - } - - export interface MetadataRuleOrCondition { - and: Array - } - - export interface MetadataRuleAndCondition { - or: Array - } - - export type MetadataRuleResult = - MetadataRuleResultEnable - | MetadataRuleResultEnableWithActivate - | MetadataRuleResultEnableWithApply; - - interface MetadataRuleResultCommon { - set_mandatory?: boolean; - } - - export interface MetadataRuleResultEnable extends MetadataRuleResultCommon { - enable: boolean; - } - - export interface MetadataRuleResultEnableWithActivate extends MetadataRuleResultCommon { - enable?: boolean; - activate_values: "all" | { - external_ids: string | Array | null; - mode?: "override" | "append"; - } - } - - export interface MetadataRuleResultEnableWithApply extends MetadataRuleResultCommon { - enable?: boolean; - apply_value: { - value: string | Array; - mode?: "default" | "append"; - } - } - - export interface MetadataRule { - metadata_field_id: string; - name: string | null; - condition: MetadataRuleCondition; - result: MetadataRuleResult | Array; - state?: string; - } - - export interface MetadataRuleResponse extends MetadataRule { - condition_signature: string; - external_id: string; - } - - export type MetadataRulesListResponse = Array; - - export interface ResourceApiResponse extends AdminApiPaginationResponse, AdminApiBaseResponse { - resources: [ - { - public_id: string; - format: string; - version: number; - resource_type: string; - type: string; - placeholder: boolean; - created_at: string; - bytes: number; - width: number; - height: number; - backup: boolean; - access_mode: string; - url: string; - secure_url: string; - tags: Array; - context: object; //won't change since it's response, we need to discuss documentation team about it before implementing. - next_cursor: string; - derived_next_cursor: string; - exif: object; //won't change since it's response, we need to discuss documentation team about it before implementing. - image_metadata: object; //won't change since it's response, we need to discuss documentation team about it before implementing. - media_metadata: object; - faces: number[][]; - quality_analysis: number; - colors: [string, number][]; - derived: Array; - moderation: object; //won't change since it's response, we need to discuss documentation team about it before implementing. - phash: string; - predominant: object; //won't change since it's response, we need to discuss documentation team about it before implementing. - coordinates: object; //won't change since it's response, we need to discuss documentation team about it before implementing. - access_control: Array; - pages: number; - - [futureKey: string]: any; - } - ] - } - - export type SignApiOptions = Record; - - export interface DatasourceEntry { - external_id?: string; - value: string; - } - - export type AnalysisType = 'custom' | 'captioning' | 'cld_fashion' | 'cld_text' | 'coco' | 'google_tagging' | 'human_anatomy' | 'lvis' | 'shop_classifier' | 'unidet'; - - export type CustomAnalysisOptions = { - model_name: string, - model_version: number - } - - export interface AnalyzeResponse { - data: { - entity: string, - analysis: Record | Array | string> - }, - request_id: string, - } - - export interface RenameFolderResponse { - from: { - name: string, - path: string, - } - to: { - name: string, - path: string, - } - } - - export interface ConfigResponse { - cloud_name: string - created_at: string - settings?: { - folder_mode: 'fixed' | 'dynamic' - } - } - - export namespace v2 { - - /****************************** Global Utils *************************************/ - - function cloudinary_js_config(): string; - - function config(new_config?: boolean | ConfigOptions): ConfigOptions; - - function config(key: K, value?: undefined): V; - - function config(key: K, value: V): ConfigOptions & { [Property in K]: V } - - function url(public_id: string, options?: TransformationOptions | ConfigAndUrlOptions): string; - - /****************************** Tags *************************************/ - - function image(source: string, options?: ImageTransformationAndTagsOptions | ConfigAndUrlOptions): string; - - function picture(public_id: string, options?: ImageTransformationAndTagsOptions | ConfigAndUrlOptions): string; - - function source(public_id: string, options?: TransformationOptions | ConfigAndUrlOptions): string; - - function video(public_id: string, options?: VideoTransformationAndTagsOptions | ConfigAndUrlOptions): string; - - /****************************** Utils *************************************/ - - namespace utils { - - function sign_request(params_to_sign: SignApiOptions, options?: ConfigAndUrlOptions): { - signature: string; - api_key: string; - [key: string]: any - }; - - function api_sign_request(params_to_sign: SignApiOptions, api_secret: string): string; - - function verifyNotificationSignature(body: string, timestamp: number, signature: string, valid_for?: number): boolean; - - function api_url(action?: string, options?: ConfigAndUrlOptions): string; - - function url(public_id?: string, options?: TransformationOptions | ConfigAndUrlOptions): string; - - function video_thumbnail_url(public_id?: string, options?: VideoTransformationOptions | ConfigAndUrlOptions): string; - - function video_url(public_id?: string, options?: VideoTransformationOptions | ConfigAndUrlOptions): string; - - function generate_transformation_string(options: TransformationOptions): string; - - function archive_params(options?: ArchiveApiOptions): Promise; - - function download_archive_url(options?: ArchiveApiOptions | ConfigAndUrlOptions): string - - function download_zip_url(options?: ArchiveApiOptions | ConfigAndUrlOptions): string; - - function download_folder(folder_path: string, options?: ArchiveApiOptions | ConfigAndUrlOptions): string; - - function download_backedup_asset(asset_id?: string, version_id?: string, options?: ArchiveApiOptions | ConfigAndUrlOptions): string - - function generate_auth_token(options?: AuthTokenApiOptions): string; - - function webhook_signature(data?: string, timestamp?: number, options?: ConfigOptions): string; - - function private_download_url(publicID: string, format: string, options: Partial<{ - resource_type: ResourceType; - type: DeliveryType; - expires_at: number; - attachment: boolean; - }>): string; - } - - /****************************** Admin API V2 Methods *************************************/ - - namespace api { - function config(options?: AdminApiOptions | { settings: boolean }, callback?: ResponseCallback): Promise - - function create_streaming_profile(name: string, options: AdminApiOptions | { - display_name?: string, - representations: TransformationOptions - }, callback?: ResponseCallback): Promise; - - function create_transformation(name: string, transformation: TransformationOptions, callback?: ResponseCallback): Promise; - - function create_transformation(name: string, transformation: TransformationOptions, options?: AdminApiOptions | { - allowed_for_strict?: boolean - }, callback?: ResponseCallback): Promise; - - function create_upload_mapping(folder: string, options: AdminApiOptions | { - template: string - }, callback?: ResponseCallback): Promise; - - function create_upload_preset(options?: AdminApiOptions | { - name?: string, - unsigned?: boolean, - disallow_public_id?: boolean - }, callback?: ResponseCallback): Promise; - - function delete_all_resources(value?: AdminAndResourceOptions, callback?: ResponseCallback): Promise; - - function delete_derived_by_transformation(public_ids: string[], transformations: TransformationOptions, callback?: ResponseCallback): Promise; - - function delete_derived_by_transformation(public_ids: string[], transformations: TransformationOptions, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function delete_derived_resources(public_ids: string[], callback?: ResponseCallback): Promise; - - function delete_derived_resources(public_ids: string[], options?: AdminAndResourceOptions, callback?: ResponseCallback): Promise; - - function delete_resources(value: string[], callback?: ResponseCallback): Promise; - - function delete_resources(value: string[], options?: AdminAndResourceOptions, callback?: ResponseCallback): Promise; - - function delete_resources_by_prefix(prefix: string, options?: AdminAndResourceOptions, callback?: ResponseCallback): Promise; - - function delete_resources_by_prefix(prefix: string, callback?: ResponseCallback): Promise; - - function delete_resources_by_tag(tag: string, options?: AdminAndResourceOptions, callback?: ResponseCallback): Promise; - - function delete_resources_by_tag(tag: string, callback?: ResponseCallback): Promise; - - function delete_streaming_profile(name: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function delete_streaming_profile(name: string, callback?: ResponseCallback): Promise; - - function delete_transformation(transformationName: TransformationOptions, callback?: ResponseCallback): Promise; - - function delete_transformation(transformationName: TransformationOptions, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function delete_upload_mapping(folder: string, callback?: ResponseCallback): Promise; - - function delete_upload_mapping(folder: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function delete_upload_preset(name: string, callback?: ResponseCallback): Promise; - - function delete_upload_preset(name: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function get_streaming_profile(name: string | ResponseCallback, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function get_streaming_profile(name: string | ResponseCallback, callback?: ResponseCallback): Promise; - - function list_streaming_profiles(callback?: ResponseCallback): Promise; - - function list_streaming_profiles(options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function ping(options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function ping(callback?: ResponseCallback): Promise; - - function publish_by_ids(public_ids: string[], options?: AdminAndPublishOptions, callback?: ResponseCallback): Promise; - - function publish_by_ids(public_ids: string[], callback?: ResponseCallback): Promise; - - function publish_by_prefix(prefix: string[] | string, options?: AdminAndPublishOptions, callback?: ResponseCallback): Promise; - - function publish_by_prefix(prefix: string[] | string, callback?: ResponseCallback): Promise; - - function publish_by_tag(tag: string, options?: AdminAndPublishOptions, callback?: ResponseCallback): Promise; - - function publish_by_tag(tag: string, callback?: ResponseCallback): Promise; - - function resource(public_id: string, options?: AdminAndResourceOptions, callback?: ResponseCallback): Promise; - - function resource(public_id: string, callback?: ResponseCallback): Promise; - - function resource_types(options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function resources(options?: AdminAndResourceOptions, callback?: ResponseCallback): Promise; - - function resources_by_context(key: string, value?: string, options?: AdminAndResourceOptions, callback?: ResponseCallback): Promise; - - function resources_by_context(key: string, value?: string, options?: AdminAndResourceOptions): Promise; - - function resources_by_context(key: string, options?: AdminAndResourceOptions): Promise; - - function resources_by_context(key: string, callback?: ResponseCallback): Promise; - - function resources_by_asset_ids(asset_ids: string[] | string, options?: AdminAndResourceOptions, callback?: ResponseCallback): Promise; - - function resources_by_asset_ids(asset_ids: string[] | string, callback?: ResponseCallback): Promise; - - function resources_by_ids(public_ids: string[] | string, options?: AdminAndResourceOptions, callback?: ResponseCallback): Promise; - - function resources_by_ids(public_ids: string[] | string, callback?: ResponseCallback): Promise; - - function resources_by_asset_folder(asset_folder: string, options?: AdminAndResourceOptions, callback?: ResponseCallback): Promise; - - function resources_by_asset_folder(asset_folder: string, callback?: ResponseCallback): Promise; - - function resources_by_moderation(moderation: ModerationKind, status: Status, options?: AdminAndResourceOptions, callback?: ResponseCallback): Promise; - - function resources_by_moderation(moderation: ModerationKind, status: Status, callback?: ResponseCallback): Promise; - - function resources_by_tag(tag: string, options?: AdminAndResourceOptions, callback?: ResponseCallback): Promise; - - function resources_by_tag(tag: string, callback?: ResponseCallback): Promise; - - function restore(public_ids: string[], options?: AdminApiOptions | { - resource_type: ResourceType, - type: DeliveryType - }, callback?: ResponseCallback): Promise; - - function restore(public_ids: string[], callback?: ResponseCallback): Promise; - - function root_folders(callback?: ResponseCallback, options?: AdminApiOptions): Promise; - - function search(params: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function search(params: string, callback?: ResponseCallback): Promise; - - function sub_folders(root_folder: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function sub_folders(root_folder: string, callback?: ResponseCallback): Promise; - - function search_folders(search_input: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function search_folders(search_input: string, callback?: ResponseCallback): Promise; - - function visual_search(params: VisualSearchParams, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function visual_search(params: VisualSearchParams, callback?: ResponseCallback): Promise; - - function tags(options?: AdminApiOptions | { - max_results?: number, - next_cursor?: string, - prefix?: string - }, callback?: ResponseCallback): Promise; - - function transformation(transformation: TransformationOptions, options?: AdminApiOptions | { - max_results?: number, - next_cursor?: string, - named?: boolean - }, callback?: ResponseCallback): Promise; - - function transformation(transformation: TransformationOptions, callback?: ResponseCallback): Promise; - - function transformations(options?: AdminApiOptions | { - max_results?: number, - next_cursor?: string, - named?: boolean - }, callback?: ResponseCallback): Promise; - - function transformations(callback?: ResponseCallback): Promise; - - function update(public_id: string, options?: AdminAndUpdateApiOptions, callback?: ResponseCallback): Promise; - - function update(public_id: string, callback?: ResponseCallback): Promise; - - function update_resources_access_mode_by_ids(access_mode: AccessMode, ids: string[], options?: AdminAndUpdateApiOptions, callback?: ResponseCallback): Promise; - - function update_resources_access_mode_by_ids(access_mode: AccessMode, ids: string[], callback?: ResponseCallback): Promise; - - function update_resources_access_mode_by_prefix(access_mode: AccessMode, prefix: string, options?: AdminAndUpdateApiOptions, callback?: ResponseCallback): Promise; - - function update_resources_access_mode_by_prefix(access_mode: AccessMode, prefix: string, callback?: ResponseCallback): Promise; - - function update_resources_access_mode_by_tag(access_mode: AccessMode, tag: string, options?: AdminAndUpdateApiOptions, callback?: ResponseCallback): Promise; - - function update_resources_access_mode_by_tag(access_mode: AccessMode, tag: string, callback?: ResponseCallback): Promise; - - function update_streaming_profile(name: string, options: { - display_name?: string, - representations: Array<{ transformation?: VideoTransformationOptions }> - }, callback?: ResponseCallback): Promise; - - function update_transformation(transformation_name: TransformationOptions, updates?: TransformationOptions, callback?: ResponseCallback): Promise; - - function update_transformation(transformation_name: TransformationOptions, callback?: ResponseCallback): Promise; - - function update_upload_mapping(name: string, options: AdminApiOptions | { - template: string - }, callback?: ResponseCallback): Promise; - - function update_upload_preset(name?: string, options?: AdminApiOptions | { - unsigned?: boolean, - disallow_public_id?: boolean - }, callback?: ResponseCallback): Promise; - - function update_upload_preset(name?: string, callback?: ResponseCallback): Promise; - - function upload_mapping(name?: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function upload_mapping(name?: string, callback?: ResponseCallback): Promise; - - function upload_mappings(options?: AdminApiOptions | { - max_results?: number, - next_cursor?: string - }, callback?: ResponseCallback): Promise; - - function upload_mappings(callback?: ResponseCallback): Promise; - - function upload_preset(name?: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function upload_preset(name?: string, callback?: ResponseCallback): Promise; - - function upload_presets(options?: AdminApiOptions | { - max_results?: number, - next_cursor?: string - }, callback?: ResponseCallback): Promise; - - function usage(callback?: ResponseCallback, options?: AdminApiOptions): Promise; - - function usage(options?: AdminApiOptions): Promise; - - function create_folder(path: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function delete_folder(path: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function rename_folder(old_path: string, new_path: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function add_related_assets(public_id: string, public_ids_to_relate: string | Array, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function add_related_assets_by_asset_id(asset_id: string, public_ids_to_relate: string | Array, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function delete_related_assets(public_id: string, public_ids_to_unrelate: string | Array, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function delete_related_assets_by_asset_id(asset_id: string, public_ids_to_unrelate: string | Array, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - /****************************** Structured Metadata API V2 Methods *************************************/ - - function add_metadata_field(field: MetadataFieldApiOptions, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function add_metadata_field(field: MetadataFieldApiOptions, callback?: ResponseCallback): Promise; - - function list_metadata_fields(callback?: ResponseCallback, options?: AdminApiOptions): Promise; - - function list_metadata_fields(options?: AdminApiOptions): Promise; - - function delete_metadata_field(field_external_id: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function delete_metadata_field(field_external_id: string, callback?: ResponseCallback): Promise; - - function metadata_field_by_field_id(external_id: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function metadata_field_by_field_id(external_id: string, callback?: ResponseCallback): Promise; - - function update_metadata_field(external_id: string, field: MetadataFieldApiOptions, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function update_metadata_field(external_id: string, field: MetadataFieldApiOptions, callback?: ResponseCallback): Promise; - - function update_metadata_field_datasource(field_external_id: string, entries_external_id: DatasourceChange, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function update_metadata_field_datasource(field_external_id: string, entries_external_id: DatasourceChange, callback?: ResponseCallback): Promise; - - function delete_datasource_entries(field_external_id: string, entries_external_id: string[], options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function delete_datasource_entries(field_external_id: string, entries_external_id: string[], callback?: ResponseCallback): Promise; - - function restore_metadata_field_datasource(field_external_id: string, entries_external_id: string[], options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function restore_metadata_field_datasource(field_external_id: string, entries_external_id: string[], callback?: ResponseCallback): Promise; - - /****************************** Structured Metadata Rules API V2 Methods *************************************/ - function add_metadata_rule(rule: MetadataRule, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function add_metadata_rule(rule: MetadataRule, callback?: ResponseCallback): Promise; - - function list_metadata_rules(callback?: ResponseCallback, options?: AdminApiOptions): Promise; - - function list_metadata_rules(options?: AdminApiOptions): Promise; - - function update_metadata_rule(external_id: string, rule: MetadataRule, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function update_metadata_rule(external_id: string, rule: MetadataRule, callback?: ResponseCallback): Promise; - - function delete_metadata_rule(external_id: string, options?: AdminApiOptions, callback?: ResponseCallback): Promise; - - function delete_metadata_rule(external_id: string, callback?: ResponseCallback): Promise; - - } - - /****************************** Upload API V2 Methods *************************************/ - - namespace uploader { - function add_context(context: string, public_ids: string[], options?: { - type?: DeliveryType, - resource_type?: ResourceType - }, callback?: ResponseCallback): Promise; - - function add_context(context: string, public_ids: string[], callback?: ResponseCallback): Promise; - - function add_tag(tag: string, public_ids: string[], options?: { - type?: DeliveryType, - resource_type?: ResourceType - }, callback?: ResponseCallback): Promise; - - function add_tag(tag: string, public_ids: string[], callback?: ResponseCallback): Promise; - - function create_archive(options?: ArchiveApiOptions, target_format?: TargetArchiveFormat, callback?: ResponseCallback,): Promise; - - function create_zip(options?: ArchiveApiOptions, callback?: ResponseCallback): Promise; - - function destroy(public_id: string, options?: { - resource_type?: ResourceType, - type?: DeliveryType, - invalidate?: boolean - }, callback?: ResponseCallback,): Promise; - - function destroy(public_id: string, callback?: ResponseCallback,): Promise; - - function explicit(public_id: string, options?: UploadApiOptions, callback?: ResponseCallback): Promise; - - function explicit(public_id: string, callback?: ResponseCallback): Promise; - - function explode(public_id: string, options?: { - page?: 'all', - type?: DeliveryType, - format?: ImageAndVideoFormatOptions, - notification_url?: string, - transformations?: TransformationOptions - }, callback?: ResponseCallback): Promise - - function explode(public_id: string, callback?: ResponseCallback): Promise - - function generate_sprite(tag: string, options?: { - transformation?: TransformationOptions, - format?: ImageAndVideoFormatOptions, - notification_url?: string, - async?: boolean - }, callback?: ResponseCallback): Promise; - - function generate_sprite(tag: string, callback?: ResponseCallback): Promise; - - function image_upload_tag(field?: string, options?: UploadApiOptions): Promise; - - function multi(tag: string, options?: { - transformation?: TransformationOptions, - async?: boolean, - format?: ImageAndVideoFormatOptions, - notification_url?: string - }, callback?: ResponseCallback): Promise; - - function multi(tag: string, callback?: ResponseCallback): Promise; - - function remove_all_context(public_ids: string[], options?: { - context?: string, - resource_type?: ResourceType, - type?: DeliveryType - }, callback?: ResponseCallback): Promise; - - function remove_all_context(public_ids: string[], callback?: ResponseCallback): Promise; - - function remove_all_tags(public_ids: string[], options?: { - tag?: string, - resource_type?: ResourceType, - type?: DeliveryType - }, callback?: ResponseCallback): Promise; - - function remove_all_tags(public_ids: string[], callback?: ResponseCallback): Promise; - - function remove_tag(tag: string, public_ids: string[], options?: { - tag?: string, - resource_type?: ResourceType, - type?: DeliveryType - }, callback?: ResponseCallback): Promise; - - function remove_tag(tag: string, public_ids: string[], callback?: ResponseCallback): Promise; - - function rename(from_public_id: string, to_public_id: string, options?: { - resource_type?: ResourceType, - type?: DeliveryType, - to_type?: DeliveryType, - overwrite?: boolean, - invalidate?: boolean - }, callback?: ResponseCallback): Promise; - - function rename(from_public_id: string, to_public_id: string, callback?: ResponseCallback): Promise; - - function replace_tag(tag: string, public_ids: string[], options?: { - resource_type?: ResourceType, - type?: DeliveryType - }, callback?: ResponseCallback): Promise; - - function replace_tag(tag: string, public_ids: string[], callback?: ResponseCallback): Promise; - - function text(text: string, options?: TextStyleOptions | { - public_id?: string - }, callback?: ResponseCallback): Promise; - - function text(text: string, callback?: ResponseCallback): Promise; - - function unsigned_image_upload_tag(field: string, upload_preset: string, options?: UploadApiOptions): Promise; - - function unsigned_upload(file: string, upload_preset: string, options?: UploadApiOptions, callback?: ResponseCallback): Promise; - - function unsigned_upload(file: string, upload_preset: string, callback?: ResponseCallback): Promise; - - function unsigned_upload_stream(upload_preset: string, options?: UploadApiOptions, callback?: ResponseCallback): UploadStream; - - function unsigned_upload_stream(upload_preset: string, callback?: ResponseCallback): UploadStream; - - function upload(file: string, options?: UploadApiOptions, callback?: UploadResponseCallback): Promise; - - function upload(file: string, callback?: UploadResponseCallback): Promise; - - function upload_chunked(path: string, options?: UploadApiOptions, callback?: UploadResponseCallback): UploadStream; - - function upload_chunked(path: string, callback?: UploadResponseCallback): UploadStream; - - function upload_chunked_stream(options?: UploadApiOptions, callback?: UploadResponseCallback): UploadStream; - - function upload_large_stream(options?: UploadApiOptions, callback?: UploadResponseCallback): UploadStream; - - function upload_large(path: string, options?: UploadApiOptions, callback?: UploadResponseCallback): Promise | UploadStream; - - function upload_large(path: string, callback?: UploadResponseCallback): Promise | UploadStream; - - function upload_stream(options?: UploadApiOptions, callback?: UploadResponseCallback): UploadStream; - - function upload_stream(callback?: UploadResponseCallback): UploadStream; - - function upload_tag_params(options?: UploadApiOptions, callback?: UploadResponseCallback): Promise; - - function upload_url(options?: ConfigOptions): Promise; - - function create_slideshow(options?: ConfigOptions & { - manifest_transformation?: TransformationOptions, - manifest_json?: Record - }, callback?: UploadResponseCallback): Promise; - - /****************************** Structured Metadata API V2 Methods *************************************/ - - function update_metadata(metadata: string | Record, public_ids: string[], options?: UploadApiOptions, callback?: ResponseCallback): Promise; - - function update_metadata(metadata: string | Record, public_ids: string[], callback?: ResponseCallback): Promise; - } - - /****************************** Search API *************************************/ - - class search { - - aggregate(value?: string): search; - - execute(): Promise; - - expression(value?: string): search; - - max_results(value?: number): search; - - next_cursor(value?: string): search; - - sort_by(key: string, value: 'asc' | 'desc'): search; - - ttl(newTtl: number): search; - - to_query(value?: string): search; - - with_field(value?: string | Array): search; - - fields(value?: string | Array): search; - - to_url(newTtl?: number, next_cursor?: string, options?: ConfigOptions): string; - - static aggregate(args?: string): search; - - static expression(args?: string): search; - - static instance(args?: string): search; - - static max_results(args?: number): search; - - static next_cursor(args?: string): search; - - static sort_by(key: string, value: 'asc' | 'desc'): search; - - static ttl(newTtl: number): search; - - static with_field(args?: string | Array): search; - - static fields(args?: string | Array): search; - } - - /****************************** Provisioning API *************************************/ - - namespace provisioning { - namespace account { - function sub_accounts(enabled: boolean, ids?: string[], prefix?: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function sub_account(subAccountId: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function create_sub_account(name: string, cloudName: string, customAttributes?: Record, enabled?: boolean, baseAccount?: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function delete_sub_account(subAccountId: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function update_sub_account(subAccountId: string, name?: string, cloudName?: string, customAttributes?: Record, enabled?: boolean, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function user(userId: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function users(pending: boolean, userIds?: string[], prefix?: string, subAccountId?: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function create_user(name: string, email: string, role: string, subAccountIds?: string[], options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function update_user(userId: string, name?: string, email?: string, role?: string, subAccountIds?: string[], options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function delete_user(userId: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function create_user_group(name: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function update_user_group(groupId: string, name: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function delete_user_group(groupId: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function add_user_to_group(groupId: string, userId: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function remove_user_from_group(groupId: string, userId: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function user_group(groupId: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function user_groups(options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function user_group_users(groupId: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function access_keys(subAccountId: string, options?: ProvisioningApiOptions | { - page_size?: number, - page?: number, - sort_by?: string, - sort_order?: 'desc' | 'asc' - }, callback?: ResponseCallback): Promise; - - function generate_access_key(subAccountId: string, options?: ProvisioningApiOptions | { - name?: string, - enabled?: boolean - }, callback?: ResponseCallback): Promise; - - function update_access_key(subAccountId: string, apiKey: string, options?: ProvisioningApiOptions | { - name?: string, - enabled?: boolean - }, callback?: ResponseCallback): Promise; - - function delete_access_key(subAccountId: string, apiKey: string, options?: ProvisioningApiOptions, callback?: ResponseCallback): Promise; - - function delete_access_key_by_name(subAccountId: string, options: ProvisioningApiOptions | { - name: string, - }, callback?: ResponseCallback): Promise; - } - } - - namespace analysis { - function analyze_uri(uri: string, analysis_type: AnalysisType, options?: ConfigOptions & CustomAnalysisOptions): Promise - } - } -} diff --git a/server/node_modules/concat-stream/LICENSE b/server/node_modules/concat-stream/LICENSE deleted file mode 100644 index 99c130e..0000000 --- a/server/node_modules/concat-stream/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -The MIT License - -Copyright (c) 2013 Max Ogden - -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/concat-stream/index.js b/server/node_modules/concat-stream/index.js deleted file mode 100644 index dd672a7..0000000 --- a/server/node_modules/concat-stream/index.js +++ /dev/null @@ -1,144 +0,0 @@ -var Writable = require('readable-stream').Writable -var inherits = require('inherits') -var bufferFrom = require('buffer-from') - -if (typeof Uint8Array === 'undefined') { - var U8 = require('typedarray').Uint8Array -} else { - var U8 = Uint8Array -} - -function ConcatStream(opts, cb) { - if (!(this instanceof ConcatStream)) return new ConcatStream(opts, cb) - - if (typeof opts === 'function') { - cb = opts - opts = {} - } - if (!opts) opts = {} - - var encoding = opts.encoding - var shouldInferEncoding = false - - if (!encoding) { - shouldInferEncoding = true - } else { - encoding = String(encoding).toLowerCase() - if (encoding === 'u8' || encoding === 'uint8') { - encoding = 'uint8array' - } - } - - Writable.call(this, { objectMode: true }) - - this.encoding = encoding - this.shouldInferEncoding = shouldInferEncoding - - if (cb) this.on('finish', function () { cb(this.getBody()) }) - this.body = [] -} - -module.exports = ConcatStream -inherits(ConcatStream, Writable) - -ConcatStream.prototype._write = function(chunk, enc, next) { - this.body.push(chunk) - next() -} - -ConcatStream.prototype.inferEncoding = function (buff) { - var firstBuffer = buff === undefined ? this.body[0] : buff; - if (Buffer.isBuffer(firstBuffer)) return 'buffer' - if (typeof Uint8Array !== 'undefined' && firstBuffer instanceof Uint8Array) return 'uint8array' - if (Array.isArray(firstBuffer)) return 'array' - if (typeof firstBuffer === 'string') return 'string' - if (Object.prototype.toString.call(firstBuffer) === "[object Object]") return 'object' - return 'buffer' -} - -ConcatStream.prototype.getBody = function () { - if (!this.encoding && this.body.length === 0) return [] - if (this.shouldInferEncoding) this.encoding = this.inferEncoding() - if (this.encoding === 'array') return arrayConcat(this.body) - if (this.encoding === 'string') return stringConcat(this.body) - if (this.encoding === 'buffer') return bufferConcat(this.body) - if (this.encoding === 'uint8array') return u8Concat(this.body) - return this.body -} - -var isArray = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]' -} - -function isArrayish (arr) { - return /Array\]$/.test(Object.prototype.toString.call(arr)) -} - -function isBufferish (p) { - return typeof p === 'string' || isArrayish(p) || (p && typeof p.subarray === 'function') -} - -function stringConcat (parts) { - var strings = [] - var needsToString = false - for (var i = 0; i < parts.length; i++) { - var p = parts[i] - if (typeof p === 'string') { - strings.push(p) - } else if (Buffer.isBuffer(p)) { - strings.push(p) - } else if (isBufferish(p)) { - strings.push(bufferFrom(p)) - } else { - strings.push(bufferFrom(String(p))) - } - } - if (Buffer.isBuffer(parts[0])) { - strings = Buffer.concat(strings) - strings = strings.toString('utf8') - } else { - strings = strings.join('') - } - return strings -} - -function bufferConcat (parts) { - var bufs = [] - for (var i = 0; i < parts.length; i++) { - var p = parts[i] - if (Buffer.isBuffer(p)) { - bufs.push(p) - } else if (isBufferish(p)) { - bufs.push(bufferFrom(p)) - } else { - bufs.push(bufferFrom(String(p))) - } - } - return Buffer.concat(bufs) -} - -function arrayConcat (parts) { - var res = [] - for (var i = 0; i < parts.length; i++) { - res.push.apply(res, parts[i]) - } - return res -} - -function u8Concat (parts) { - var len = 0 - for (var i = 0; i < parts.length; i++) { - if (typeof parts[i] === 'string') { - parts[i] = bufferFrom(parts[i]) - } - len += parts[i].length - } - var u8 = new U8(len) - for (var i = 0, offset = 0; i < parts.length; i++) { - var part = parts[i] - for (var j = 0; j < part.length; j++) { - u8[offset++] = part[j] - } - } - return u8 -} diff --git a/server/node_modules/concat-stream/package.json b/server/node_modules/concat-stream/package.json deleted file mode 100644 index 3797828..0000000 --- a/server/node_modules/concat-stream/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "concat-stream", - "version": "2.0.0", - "description": "writable stream that concatenates strings or binary data and calls a callback with the result", - "tags": [ - "stream", - "simple", - "util", - "utility" - ], - "author": "Max Ogden ", - "repository": { - "type": "git", - "url": "http://github.com/maxogden/concat-stream.git" - }, - "bugs": { - "url": "http://github.com/maxogden/concat-stream/issues" - }, - "engines": [ - "node >= 6.0" - ], - "main": "index.js", - "files": [ - "index.js" - ], - "scripts": { - "test": "tape test/*.js test/server/*.js" - }, - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.0.2", - "typedarray": "^0.0.6" - }, - "devDependencies": { - "tape": "^4.6.3" - }, - "testling": { - "files": "test/*.js", - "browsers": [ - "ie/8..latest", - "firefox/17..latest", - "firefox/nightly", - "chrome/22..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/concat-stream/readme.md b/server/node_modules/concat-stream/readme.md deleted file mode 100644 index 7aa19c4..0000000 --- a/server/node_modules/concat-stream/readme.md +++ /dev/null @@ -1,102 +0,0 @@ -# concat-stream - -Writable stream that concatenates all the data from a stream and calls a callback with the result. Use this when you want to collect all the data from a stream into a single buffer. - -[![Build Status](https://travis-ci.org/maxogden/concat-stream.svg?branch=master)](https://travis-ci.org/maxogden/concat-stream) - -[![NPM](https://nodei.co/npm/concat-stream.png)](https://nodei.co/npm/concat-stream/) - -### description - -Streams emit many buffers. If you want to collect all of the buffers, and when the stream ends concatenate all of the buffers together and receive a single buffer then this is the module for you. - -Only use this if you know you can fit all of the output of your stream into a single Buffer (e.g. in RAM). - -There are also `objectMode` streams that emit things other than Buffers, and you can concatenate these too. See below for details. - -## Related - -`concat-stream` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one. - -### examples - -#### Buffers - -```js -var fs = require('fs') -var concat = require('concat-stream') - -var readStream = fs.createReadStream('cat.png') -var concatStream = concat(gotPicture) - -readStream.on('error', handleError) -readStream.pipe(concatStream) - -function gotPicture(imageBuffer) { - // imageBuffer is all of `cat.png` as a node.js Buffer -} - -function handleError(err) { - // handle your error appropriately here, e.g.: - console.error(err) // print the error to STDERR - process.exit(1) // exit program with non-zero exit code -} - -``` - -#### Arrays - -```js -var write = concat(function(data) {}) -write.write([1,2,3]) -write.write([4,5,6]) -write.end() -// data will be [1,2,3,4,5,6] in the above callback -``` - -#### Uint8Arrays - -```js -var write = concat(function(data) {}) -var a = new Uint8Array(3) -a[0] = 97; a[1] = 98; a[2] = 99 -write.write(a) -write.write('!') -write.end(Buffer.from('!!1')) -``` - -See `test/` for more examples - -# methods - -```js -var concat = require('concat-stream') -``` - -## var writable = concat(opts={}, cb) - -Return a `writable` stream that will fire `cb(data)` with all of the data that -was written to the stream. Data can be written to `writable` as strings, -Buffers, arrays of byte integers, and Uint8Arrays. - -By default `concat-stream` will give you back the same data type as the type of the first buffer written to the stream. Use `opts.encoding` to set what format `data` should be returned as, e.g. if you if you don't want to rely on the built-in type checking or for some other reason. - -* `string` - get a string -* `buffer` - get back a Buffer -* `array` - get an array of byte integers -* `uint8array`, `u8`, `uint8` - get back a Uint8Array -* `object`, get back an array of Objects - -If you don't specify an encoding, and the types can't be inferred (e.g. you write things that aren't in the list above), it will try to convert concat them into a `Buffer`. - -If nothing is written to `writable` then `data` will be an empty array `[]`. - -# error handling - -`concat-stream` does not handle errors for you, so you must handle errors on whatever streams you pipe into `concat-stream`. This is a general rule when programming with node.js streams: always handle errors on each and every stream. Since `concat-stream` is not itself a stream it does not emit errors. - -We recommend using [`end-of-stream`](https://npmjs.org/end-of-stream) or [`pump`](https://npmjs.org/pump) for writing error tolerant stream code. - -# license - -MIT LICENSE diff --git a/server/node_modules/content-disposition/HISTORY.md b/server/node_modules/content-disposition/HISTORY.md deleted file mode 100644 index ff0b68b..0000000 --- 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 84441fb..0000000 --- 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 3a0bb05..0000000 --- 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 44f1d51..0000000 --- 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 5cea50b..0000000 --- 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 4583671..0000000 --- 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 34b1a2d..0000000 --- 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 c1a922a..0000000 --- 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 41840e7..0000000 --- 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 9db19f6..0000000 --- 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-signature/History.md b/server/node_modules/cookie-signature/History.md deleted file mode 100644 index 479211a..0000000 --- a/server/node_modules/cookie-signature/History.md +++ /dev/null @@ -1,70 +0,0 @@ -1.2.2 / 2024-10-29 -================== - -* various metadata/documentation tweaks (incl. #51) - - -1.2.1 / 2023-02-27 -================== - -* update annotations for allowed secret key types (#44, thanks @jyasskin!) - - -1.2.0 / 2022-02-17 -================== - -* allow buffer and other node-supported types as key (#33) -* be pickier about extra content after signed portion (#40) -* some internal code clarity/cleanup improvements (#26) - - -1.1.0 / 2018-01-18 -================== - -* switch to built-in `crypto.timingSafeEqual` for validation instead of previous double-hash method (thank you @jodevsa!) - - -1.0.7 / 2023-04-12 -================== - -Later release for older node.js versions. See the [v1.0.x branch notes](https://github.com/tj/node-cookie-signature/blob/v1.0.x/History.md#107--2023-04-12). - - -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/LICENSE b/server/node_modules/cookie-signature/LICENSE deleted file mode 100644 index a2671bf..0000000 --- a/server/node_modules/cookie-signature/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2012–2024 LearnBoost and other contributors; - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/cookie-signature/Readme.md b/server/node_modules/cookie-signature/Readme.md deleted file mode 100644 index 369af15..0000000 --- a/server/node_modules/cookie-signature/Readme.md +++ /dev/null @@ -1,23 +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 - -MIT. - -See LICENSE file for details. diff --git a/server/node_modules/cookie-signature/index.js b/server/node_modules/cookie-signature/index.js deleted file mode 100644 index 3fbbddb..0000000 --- a/server/node_modules/cookie-signature/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Module dependencies. - */ - -var crypto = require('crypto'); - -/** - * Sign the given `val` with `secret`. - * - * @param {String} val - * @param {String|NodeJS.ArrayBufferView|crypto.KeyObject} 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 (null == secret) throw new TypeError("Secret key must be provided."); - return val + '.' + crypto - .createHmac('sha256', secret) - .update(val) - .digest('base64') - .replace(/\=+$/, ''); -}; - -/** - * Unsign and decode the given `input` with `secret`, - * returning `false` if the signature is invalid. - * - * @param {String} input - * @param {String|NodeJS.ArrayBufferView|crypto.KeyObject} secret - * @return {String|Boolean} - * @api private - */ - -exports.unsign = function(input, secret){ - if ('string' != typeof input) throw new TypeError("Signed cookie string must be provided."); - if (null == secret) throw new TypeError("Secret key must be provided."); - var tentativeValue = input.slice(0, input.lastIndexOf('.')), - expectedInput = exports.sign(tentativeValue, secret), - expectedBuffer = Buffer.from(expectedInput), - inputBuffer = Buffer.from(input); - return ( - expectedBuffer.length === inputBuffer.length && - crypto.timingSafeEqual(expectedBuffer, inputBuffer) - ) ? tentativeValue : false; -}; diff --git a/server/node_modules/cookie-signature/package.json b/server/node_modules/cookie-signature/package.json deleted file mode 100644 index a160040..0000000 --- a/server/node_modules/cookie-signature/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "cookie-signature", - "version": "1.2.2", - "main": "index.js", - "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": {}, - "engines": { - "node": ">=6.6.0" - }, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "scripts": { - "test": "mocha --require should --reporter spec" - } -} diff --git a/server/node_modules/cookie/LICENSE b/server/node_modules/cookie/LICENSE deleted file mode 100644 index 058b6b4..0000000 --- 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 71fdac1..0000000 --- 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 fd4a6c5..0000000 --- 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 acd5acd..0000000 --- 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 - * =