From 745168cf510fd9a136440ddbe607cea81a8fa0e8 Mon Sep 17 00:00:00 2001 From: josedario87 Date: Wed, 14 May 2025 16:10:41 -0600 Subject: [PATCH] sistema creado v0.5.0 --- .gitea/workflows/build.backup.yml | 73 + .gitea/workflows/build.yml | 58 +- .gitignore | 1 + Dockerfile | 19 - Makefile | 13 + agent/Dockerfile | 28 + agent/config.js | 16 + .../exampleOnAnyMessage.txt | 195 +++ agent/gemini.js | 120 ++ agent/handlers.js | 51 + agent/index.js | 35 + agent/logger.js | 17 + agent/package.json | 20 + agent/processMessage/processVideoMessage.js | 0 agent/respuestas/respuestaBrave.js | 128 ++ agent/respuestas/respuestaMCP.js | 127 ++ agent/respuestas/respuestaNormal.js | 100 ++ agent/routes.js | 200 +++ agent/utils/decryptMediaContent.js | 80 + agent/utils/processMessage.js | 80 + agent/utils/saveMedia.js | 80 + agent/whatsapp.js | 137 ++ api/.gitignore | 3 + api/node_modules/.package-lock.json | 587 ++++--- api/node_modules/accepts/HISTORY.md | 7 - api/node_modules/accepts/README.md | 2 +- api/node_modules/accepts/index.js | 2 +- api/node_modules/accepts/package.json | 6 +- api/node_modules/body-parser/HISTORY.md | 61 +- api/node_modules/body-parser/README.md | 77 +- api/node_modules/body-parser/index.js | 90 +- api/node_modules/body-parser/lib/read.js | 49 +- .../body-parser/lib/types/json.js | 65 +- api/node_modules/body-parser/lib/types/raw.js | 46 +- .../body-parser/lib/types/text.js | 63 +- .../body-parser/lib/types/urlencoded.js | 204 ++- api/node_modules/body-parser/lib/utils.js | 83 - api/node_modules/body-parser/package.json | 39 +- .../content-disposition/HISTORY.md | 6 - api/node_modules/content-disposition/index.js | 7 +- .../content-disposition/package.json | 10 +- api/node_modules/cookie-signature/History.md | 32 - api/node_modules/cookie-signature/LICENSE | 22 - api/node_modules/cookie-signature/Readme.md | 25 +- api/node_modules/cookie-signature/index.js | 36 +- .../cookie-signature/package.json | 14 +- api/node_modules/cookie/index.js | 3 +- api/node_modules/cookie/package.json | 2 +- api/node_modules/debug/LICENSE | 19 +- api/node_modules/debug/README.md | 293 +--- api/node_modules/debug/package.json | 60 +- api/node_modules/debug/src/browser.js | 299 ++-- api/node_modules/debug/src/common.js | 292 ---- api/node_modules/debug/src/index.js | 8 +- api/node_modules/debug/src/node.js | 337 ++-- api/node_modules/express/History.md | 232 +-- api/node_modules/express/Readme.md | 100 +- api/node_modules/express/lib/application.js | 174 +- api/node_modules/express/lib/express.js | 41 +- api/node_modules/express/lib/request.js | 90 +- api/node_modules/express/lib/response.js | 262 ++- api/node_modules/express/lib/utils.js | 104 +- api/node_modules/express/lib/view.js | 29 +- api/node_modules/express/package.json | 84 +- api/node_modules/finalhandler/HISTORY.md | 23 - api/node_modules/finalhandler/index.js | 68 +- api/node_modules/finalhandler/package.json | 24 +- api/node_modules/fresh/HISTORY.md | 10 - api/node_modules/fresh/README.md | 18 +- api/node_modules/fresh/index.js | 17 +- api/node_modules/fresh/package.json | 30 +- .../iconv-lite/.github/dependabot.yml | 11 - .../iconv-lite/.idea/codeStyles/Project.xml | 47 - .../.idea/codeStyles/codeStyleConfig.xml | 5 - .../iconv-lite/.idea/iconv-lite.iml | 12 - .../inspectionProfiles/Project_Default.xml | 6 - api/node_modules/iconv-lite/.idea/modules.xml | 8 - api/node_modules/iconv-lite/.idea/vcs.xml | 6 - api/node_modules/iconv-lite/Changelog.md | 100 +- api/node_modules/iconv-lite/README.md | 68 +- .../iconv-lite/encodings/dbcs-codec.js | 144 +- .../iconv-lite/encodings/dbcs-data.js | 14 +- .../iconv-lite/encodings/index.js | 3 +- .../iconv-lite/encodings/internal.js | 14 +- .../iconv-lite/encodings/sbcs-data.js | 5 - .../encodings/tables/gbk-added.json | 5 +- .../iconv-lite/encodings/utf16.js | 92 +- .../iconv-lite/encodings/utf32.js | 319 ---- api/node_modules/iconv-lite/encodings/utf7.js | 8 +- api/node_modules/iconv-lite/lib/index.d.ts | 17 - api/node_modules/iconv-lite/lib/index.js | 51 +- api/node_modules/iconv-lite/lib/streams.js | 208 +-- api/node_modules/iconv-lite/package.json | 26 +- api/node_modules/is-promise/LICENSE | 19 - api/node_modules/is-promise/index.d.ts | 2 - api/node_modules/is-promise/index.js | 6 - api/node_modules/is-promise/index.mjs | 3 - api/node_modules/is-promise/package.json | 30 - api/node_modules/is-promise/readme.md | 33 - api/node_modules/media-typer/HISTORY.md | 28 - api/node_modules/media-typer/LICENSE | 2 +- api/node_modules/media-typer/README.md | 76 +- api/node_modules/media-typer/index.js | 221 ++- api/node_modules/media-typer/package.json | 21 +- api/node_modules/merge-descriptors/index.d.ts | 11 - api/node_modules/merge-descriptors/index.js | 74 +- api/node_modules/merge-descriptors/license | 26 +- .../merge-descriptors/package.json | 85 +- api/node_modules/merge-descriptors/readme.md | 66 +- api/node_modules/mime-db/HISTORY.md | 36 +- api/node_modules/mime-db/README.md | 57 +- api/node_modules/mime-db/db.json | 973 +---------- api/node_modules/mime-db/package.json | 26 +- api/node_modules/mime-types/HISTORY.md | 24 - api/node_modules/mime-types/README.md | 13 - api/node_modules/mime-types/index.js | 61 +- api/node_modules/mime-types/mimeScore.js | 52 - api/node_modules/mime-types/package.json | 17 +- api/node_modules/ms/index.js | 50 +- api/node_modules/ms/license.md | 2 +- api/node_modules/ms/package.json | 15 +- api/node_modules/ms/readme.md | 28 +- api/node_modules/negotiator/HISTORY.md | 6 - api/node_modules/negotiator/README.md | 9 - api/node_modules/negotiator/index.js | 9 +- api/node_modules/negotiator/lib/encoding.js | 31 +- api/node_modules/negotiator/lib/mediaType.js | 6 +- api/node_modules/negotiator/package.json | 3 +- api/node_modules/once/LICENSE | 15 - api/node_modules/once/README.md | 79 - api/node_modules/once/once.js | 42 - api/node_modules/once/package.json | 33 - api/node_modules/path-to-regexp/Readme.md | 219 +-- .../path-to-regexp/dist/index.d.ts | 136 -- api/node_modules/path-to-regexp/dist/index.js | 403 ----- .../path-to-regexp/dist/index.js.map | 1 - api/node_modules/path-to-regexp/package.json | 66 +- api/node_modules/qs/.eslintrc | 1 - api/node_modules/qs/CHANGELOG.md | 22 - api/node_modules/qs/README.md | 26 +- api/node_modules/qs/dist/qs.js | 157 +- api/node_modules/qs/lib/parse.js | 56 +- api/node_modules/qs/lib/stringify.js | 17 +- api/node_modules/qs/lib/utils.js | 11 +- api/node_modules/qs/package.json | 16 +- api/node_modules/qs/test/parse.js | 160 +- api/node_modules/qs/test/stringify.js | 30 +- api/node_modules/qs/test/utils.js | 126 -- api/node_modules/raw-body/HISTORY.md | 17 - api/node_modules/raw-body/index.d.ts | 12 +- api/node_modules/raw-body/package.json | 17 +- api/node_modules/router/HISTORY.md | 228 --- api/node_modules/router/LICENSE | 23 - api/node_modules/router/README.md | 416 ----- api/node_modules/router/index.js | 748 --------- api/node_modules/router/lib/layer.js | 247 --- api/node_modules/router/lib/route.js | 242 --- api/node_modules/router/package.json | 44 - api/node_modules/send/HISTORY.md | 54 - api/node_modules/send/README.md | 36 +- api/node_modules/send/index.js | 173 +- api/node_modules/send/package.json | 42 +- api/node_modules/serve-static/HISTORY.md | 41 +- api/node_modules/serve-static/README.md | 16 +- api/node_modules/serve-static/index.js | 1 + api/node_modules/serve-static/package.json | 19 +- api/node_modules/type-is/HISTORY.md | 33 - api/node_modules/type-is/README.md | 44 +- api/node_modules/type-is/index.js | 58 +- api/node_modules/type-is/package.json | 32 +- api/node_modules/wrappy/LICENSE | 15 - api/node_modules/wrappy/README.md | 36 - api/node_modules/wrappy/package.json | 29 - api/node_modules/wrappy/wrappy.js | 33 - api/package-lock.json | 967 ++++++++--- api/package.json | 5 +- api/prisma/schema.prisma | 15 + dev/scripts/estructura.ps1 | 5 + docker-compose.yml | 83 +- estructura.txt | 54 + index.js | 11 - mcp/.gitignore | 1 + mcp/index.js | 37 + mcp/package.json | 17 +- mcp/server.js | 31 - package-lock.json | 14 - package.json | 10 - worker/.gitignore | 3 + worker/Dockerfile | 7 + worker/package-lock.json | 1462 +++++++++++++++++ worker/package.json | 16 + worker/prisma/schema.prisma | 15 + worker/server.js | 8 + 193 files changed, 7267 insertions(+), 8789 deletions(-) create mode 100644 .gitea/workflows/build.backup.yml create mode 100644 .gitignore delete mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 agent/Dockerfile create mode 100644 agent/config.js create mode 100644 agent/example webhooksEvents/exampleOnAnyMessage.txt create mode 100644 agent/gemini.js create mode 100644 agent/handlers.js create mode 100644 agent/index.js create mode 100644 agent/logger.js create mode 100644 agent/package.json create mode 100644 agent/processMessage/processVideoMessage.js create mode 100644 agent/respuestas/respuestaBrave.js create mode 100644 agent/respuestas/respuestaMCP.js create mode 100644 agent/respuestas/respuestaNormal.js create mode 100644 agent/routes.js create mode 100644 agent/utils/decryptMediaContent.js create mode 100644 agent/utils/processMessage.js create mode 100644 agent/utils/saveMedia.js create mode 100644 agent/whatsapp.js create mode 100644 api/.gitignore delete mode 100644 api/node_modules/body-parser/lib/utils.js delete mode 100644 api/node_modules/cookie-signature/LICENSE delete mode 100644 api/node_modules/debug/src/common.js delete mode 100644 api/node_modules/iconv-lite/.github/dependabot.yml delete mode 100644 api/node_modules/iconv-lite/.idea/codeStyles/Project.xml delete mode 100644 api/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml delete mode 100644 api/node_modules/iconv-lite/.idea/iconv-lite.iml delete mode 100644 api/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml delete mode 100644 api/node_modules/iconv-lite/.idea/modules.xml delete mode 100644 api/node_modules/iconv-lite/.idea/vcs.xml delete mode 100644 api/node_modules/iconv-lite/encodings/utf32.js delete mode 100644 api/node_modules/is-promise/LICENSE delete mode 100644 api/node_modules/is-promise/index.d.ts delete mode 100644 api/node_modules/is-promise/index.js delete mode 100644 api/node_modules/is-promise/index.mjs delete mode 100644 api/node_modules/is-promise/package.json delete mode 100644 api/node_modules/is-promise/readme.md delete mode 100644 api/node_modules/merge-descriptors/index.d.ts delete mode 100644 api/node_modules/mime-types/mimeScore.js delete mode 100644 api/node_modules/once/LICENSE delete mode 100644 api/node_modules/once/README.md delete mode 100644 api/node_modules/once/once.js delete mode 100644 api/node_modules/once/package.json delete mode 100644 api/node_modules/path-to-regexp/dist/index.d.ts delete mode 100644 api/node_modules/path-to-regexp/dist/index.js delete mode 100644 api/node_modules/path-to-regexp/dist/index.js.map delete mode 100644 api/node_modules/router/HISTORY.md delete mode 100644 api/node_modules/router/LICENSE delete mode 100644 api/node_modules/router/README.md delete mode 100644 api/node_modules/router/index.js delete mode 100644 api/node_modules/router/lib/layer.js delete mode 100644 api/node_modules/router/lib/route.js delete mode 100644 api/node_modules/router/package.json delete mode 100644 api/node_modules/wrappy/LICENSE delete mode 100644 api/node_modules/wrappy/README.md delete mode 100644 api/node_modules/wrappy/package.json delete mode 100644 api/node_modules/wrappy/wrappy.js create mode 100644 api/prisma/schema.prisma create mode 100644 dev/scripts/estructura.ps1 create mode 100644 estructura.txt delete mode 100644 index.js create mode 100644 mcp/.gitignore create mode 100644 mcp/index.js delete mode 100644 mcp/server.js delete mode 100644 package-lock.json delete mode 100644 package.json create mode 100644 worker/.gitignore create mode 100644 worker/Dockerfile create mode 100644 worker/package-lock.json create mode 100644 worker/package.json create mode 100644 worker/prisma/schema.prisma create mode 100644 worker/server.js diff --git a/.gitea/workflows/build.backup.yml b/.gitea/workflows/build.backup.yml new file mode 100644 index 0000000..71e574b --- /dev/null +++ b/.gitea/workflows/build.backup.yml @@ -0,0 +1,73 @@ +name: build-and-push + +on: + push: + branches: [ main ] + +jobs: + build: + runs-on: docker + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to registry + uses: docker/login-action@v2 + with: + registry: gitea.interno.com + username: nucleo000 + password: 7bc7b2fcd283bd6a251bef3ede368b7f897c919d + + - name: Build root image + run: | + docker build -f ./Dockerfile \ + -t gitea.interno.com/nucleo000/planilla:${{ github.sha }} \ + -t gitea.interno.com/nucleo000/planilla:latest . + + - name: Build API image + run: | + docker build -f ./api/Dockerfile \ + -t gitea.interno.com/nucleo000/planilla-api:${{ github.sha }} \ + -t gitea.interno.com/nucleo000/planilla-api:latest \ + ./api + + - name: Build UI image + run: | + docker build -f ./ui/Dockerfile \ + -t gitea.interno.com/nucleo000/planilla-ui:${{ github.sha }} \ + -t gitea.interno.com/nucleo000/planilla-ui:latest \ + ./ui + + - name: Push images + run: | + for img in planilla planilla-api planilla-ui; do + docker push gitea.interno.com/nucleo000/$img:${{ github.sha }} + docker push gitea.interno.com/nucleo000/$img:latest + done + + deploy: + runs-on: docker + needs: build + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Login to registry + run: | + echo "Logging into registry…" + docker login gitea.interno.com -u nucleo000 -p 7bc7b2fcd283bd6a251bef3ede368b7f897c919d + + - name: Pull latest images + run: | + docker pull gitea.interno.com/nucleo000/planilla:latest + docker pull gitea.interno.com/nucleo000/planilla-api:latest + docker pull gitea.interno.com/nucleo000/planilla-ui:latest + + - name: Teardown previous stack + run: docker compose down --remove-orphans || true + + - name: Start all services fresh + run: docker compose up -d --build --force-recreate --remove-orphans diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 71e574b..888d9da 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -8,25 +8,31 @@ jobs: build: runs-on: docker steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + - uses: docker/setup-buildx-action@v2 - name: Login to registry uses: docker/login-action@v2 with: registry: gitea.interno.com - username: nucleo000 - password: 7bc7b2fcd283bd6a251bef3ede368b7f897c919d + username: nucleo000 # ⬅ ponelo en secrets + password: 7bc7b2fcd283bd6a251bef3ede368b7f897c919d # ⬅ idem + # ──────────────── builds ──────────────── - name: Build root image run: | docker build -f ./Dockerfile \ -t gitea.interno.com/nucleo000/planilla:${{ github.sha }} \ -t gitea.interno.com/nucleo000/planilla:latest . + - name: Build AGENT image + run: | + docker build -f ./agent/Dockerfile \ + -t gitea.interno.com/nucleo000/planilla-agent:${{ github.sha }} \ + -t gitea.interno.com/nucleo000/planilla-agent:latest \ + ./agent + - name: Build API image run: | docker build -f ./api/Dockerfile \ @@ -34,6 +40,13 @@ jobs: -t gitea.interno.com/nucleo000/planilla-api:latest \ ./api + - name: Build MCP image + run: | + docker build -f ./mcp/Dockerfile \ + -t gitea.interno.com/nucleo000/planilla-mcp:${{ github.sha }} \ + -t gitea.interno.com/nucleo000/planilla-mcp:latest \ + ./mcp + - name: Build UI image run: | docker build -f ./ui/Dockerfile \ @@ -41,9 +54,22 @@ jobs: -t gitea.interno.com/nucleo000/planilla-ui:latest \ ./ui + - name: Build WORKER image + run: | + docker build -f ./worker/Dockerfile \ + -t gitea.interno.com/nucleo000/planilla-worker:${{ github.sha }} \ + -t gitea.interno.com/nucleo000/planilla-worker:latest \ + ./worker + + # ──────────────── push loop ──────────────── - name: Push images run: | - for img in planilla planilla-api planilla-ui; do + for img in planilla \ + planilla-agent \ + planilla-api \ + planilla-mcp \ + planilla-ui \ + planilla-worker; do docker push gitea.interno.com/nucleo000/$img:${{ github.sha }} docker push gitea.interno.com/nucleo000/$img:latest done @@ -52,19 +78,21 @@ jobs: runs-on: docker needs: build steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - name: Login to registry - run: | - echo "Logging into registry…" - docker login gitea.interno.com -u nucleo000 -p 7bc7b2fcd283bd6a251bef3ede368b7f897c919d + run: docker login gitea.interno.com -u nucleo000 -p 7bc7b2fcd283bd6a251bef3ede368b7f897c919d - name: Pull latest images run: | - docker pull gitea.interno.com/nucleo000/planilla:latest - docker pull gitea.interno.com/nucleo000/planilla-api:latest - docker pull gitea.interno.com/nucleo000/planilla-ui:latest + for img in planilla \ + planilla-agent \ + planilla-api \ + planilla-mcp \ + planilla-ui \ + planilla-worker; do + docker pull gitea.interno.com/nucleo000/$img:latest + done - name: Teardown previous stack run: docker compose down --remove-orphans || true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 4b015d1..0000000 --- a/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# Dockerfile actualizado - -FROM node:23-slim - -WORKDIR /app - -# 1) Copiás sólo package.json (y package-lock.json si existe) para aprovechar cache -COPY package.json package-lock.json* ./ -RUN npm install --omit=dev - -# 2) Copiás el resto del código (todos los .js y módulos separados) -COPY . . - -# 3) Variables y puerto -ENV PORT=3000 -EXPOSE 3000 - -# 4) Arranque -CMD ["node", "index.js"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2cc35c2 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +estructura: + powershell -ExecutionPolicy Bypass -File ./dev/scripts/estructura.ps1 + +build: + docker compose build + +up: + docker compose up -d + +down: + docker compose down + +todo: estructura build diff --git a/agent/Dockerfile b/agent/Dockerfile new file mode 100644 index 0000000..f2918c7 --- /dev/null +++ b/agent/Dockerfile @@ -0,0 +1,28 @@ +# Dockerfile con acceso a docker CLI +FROM node:23-slim + +WORKDIR /app + +# 1) Instalar dependencias normales +COPY package.json package-lock.json* ./ +RUN npm install --omit=dev + +# 2) Instalar Docker CLI +RUN apt-get update && \ + apt-get install -y ca-certificates curl gnupg && \ + install -m 0755 -d /etc/apt/keyrings && \ + curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \ + chmod a+r /etc/apt/keyrings/docker.gpg && \ + echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable" \ + > /etc/apt/sources.list.d/docker.list && \ + apt-get update && \ + apt-get install -y docker-ce-cli && \ + rm -rf /var/lib/apt/lists/* + +# 3) Copiar el código fuente +COPY . . + +# 4) Puerto y arranque +ENV PORT=4000 +EXPOSE 4000 +CMD ["node", "index.js"] diff --git a/agent/config.js b/agent/config.js new file mode 100644 index 0000000..5d409b0 --- /dev/null +++ b/agent/config.js @@ -0,0 +1,16 @@ + /*───────────────────────────────────────────────────────────────*/ + /* ⚙️ Variables de entorno */ + /*───────────────────────────────────────────────────────────────*/ + + export const config = { + VERSION : '0.6.12', + API_URL : process.env.BOT_API_URL ?? 'http://whatsapp-bot:8002', + GROUP_ID : process.env.GROUP_ID ?? '120363203056794284@g.us', + REPLY_MSG : process.env.REPLY_MSG ?? 'que pedos', + PORT : +(process.env.PORT ?? 4000), + LOG_LEVEL : process.env.LOG_LEVEL ?? 'debug', + RETRY_MS : +(process.env.RETRY_MS ?? 5_000), + MAX_ATTEMPTS : +(process.env.MAX_ATTEMPTS ?? 60), + GEMINI_KEY : process.env.GEMINI_API_KEY ?? process.env.GOOGLE_API_KEY ?? '', + GEMINI_MODEL_ID: process.env.GEMINI_MODEL_ID ?? 'gemini-2.5-flash-preview-04-17', + }; \ No newline at end of file diff --git a/agent/example webhooksEvents/exampleOnAnyMessage.txt b/agent/example webhooksEvents/exampleOnAnyMessage.txt new file mode 100644 index 0000000..19d043d --- /dev/null +++ b/agent/example webhooksEvents/exampleOnAnyMessage.txt @@ -0,0 +1,195 @@ +{ + "id": "true_50496210031@c.us_3F4F5E90B644956AC938", + "viewed": false, + "body": "amor", + "type": "chat", + "t": 1745718602, + "notifyName": "📀🧮📡🌐", + "from": "50498554225@c.us", + "to": "50496210031@c.us", + "author": "50498554225:77@c.us", + "invis": false, + "isNewMsg": true, + "star": false, + "kicNotified": false, + "recvFresh": true, + "isFromTemplate": false, + "thumbnail": "", + "pollInvalidated": false, + "isSentCagPollCreation": false, + "latestEditMsgKey": null, + "latestEditSenderTimestampMs": null, + "mentionedJidList": [], + "groupMentions": [], + "isEventCanceled": false, + "eventInvalidated": false, + "isVcardOverMmsDocument": false, + "labels": [], + "hasReaction": false, + "ephemeralDuration": 0, + "ephemeralSettingTimestamp": 0, + "disappearingModeInitiator": "chat", + "disappearingModeTrigger": "chat_settings", + "viewMode": "VISIBLE", + "productHeaderImageRejected": false, + "lastPlaybackProgress": 0, + "isDynamicReplyButtonsMsg": false, + "isCarouselCard": false, + "parentMsgId": null, + "callSilenceReason": null, + "isVideoCall": false, + "callDuration": null, + "callParticipants": null, + "isMdHistoryMsg": false, + "stickerSentTs": 0, + "isAvatar": false, + "lastUpdateFromServerTs": 0, + "invokedBotWid": null, + "bizBotType": null, + "botResponseTargetId": null, + "botPluginType": null, + "botPluginReferenceIndex": null, + "botPluginSearchProvider": null, + "botPluginSearchUrl": null, + "botPluginSearchQuery": null, + "botPluginMaybeParent": false, + "botReelPluginThumbnailCdnUrl": null, + "botMessageDisclaimerText": null, + "botMsgBodyType": null, + "reportingTokenInfo": null, + "requiresDirectConnection": false, + "bizContentPlaceholderType": null, + "hostedBizEncStateMismatch": false, + "senderOrRecipientAccountTypeHosted": false, + "placeholderCreatedWhenAccountIsHosted": false, + "device": 77, + "local": false, + "fromMe": true, + "mId": "3F4F5E90B644956AC938", + "sender": { + "id": "50498554225@c.us", + "name": "📀🧮📡🌐jose", + "shortName": "📀🧮📡🌐jose", + "pushname": "📀🧮📡🌐", + "type": "in", + "isBusiness": false, + "isEnterprise": false, + "isSmb": false, + "isContactSyncCompleted": 1, + "disappearingModeDuration": 0, + "disappearingModeSettingTimestamp": 1700599275, + "textStatusLastUpdateTime": -1, + "syncToAddressbook": true, + "formattedName": "Tú", + "isMe": true, + "isMyContact": true, + "isPSA": false, + "isUser": true, + "status": "Can't talk, WhatsApp only", + "isVerified": false, + "isWAContact": true, + "profilePicThumbObj": { + "eurl": "https://pps.whatsapp.net/v/t61.24694-24/471428085_1635189164083925_3546014480456031647_n.jpg?ccb=11-4&oh=01_Q5Aa1QEqY8vxL1FGF3t2s1OQw0t3tPQ8cS66RZvtzTy6nE1VWQ&oe=6817A633&_nc_sid=5e03e0&_nc_cat=106", + "id": "50498554225@c.us", + "img": "https://media-mia3-1.cdn.whatsapp.net/v/t61.24694-24/471428085_1635189164083925_3546014480456031647_n.jpg?stp=dst-jpg_s96x96_tt6&ccb=11-4&oh=01_Q5Aa1QELed0umu8TOLHLhNq8lHmkZ2srD3fu-IK3spzsNxkLug&oe=6817A633&_nc_sid=5e03e0&_nc_cat=106", + "imgFull": "https://media-mia3-1.cdn.whatsapp.net/v/t61.24694-24/471428085_1635189164083925_3546014480456031647_n.jpg?ccb=11-4&oh=01_Q5Aa1QEqY8vxL1FGF3t2s1OQw0t3tPQ8cS66RZvtzTy6nE1VWQ&oe=6817A633&_nc_sid=5e03e0&_nc_cat=106", + "tag": "1735668406" + }, + "msgs": null + }, + "senderId": null, + "timestamp": 1745718602, + "content": "amor", + "isGroupMsg": false, + "isQuotedMsgAvailable": true, + "isMedia": false, + "chat": { + "id": "50496210031@c.us", + "pendingMsgs": false, + "lastReceivedKey": { + "fromMe": true, + "remote": "50496210031@c.us", + "id": "3F009E582691FEE944F0", + "_serialized": "true_50496210031@c.us_3F009E582691FEE944F0" + }, + "t": 1745717805, + "unreadCount": 0, + "unreadDividerOffset": 0, + "archive": false, + "isReadOnly": false, + "isLocked": false, + "muteExpiration": 0, + "isAutoMuted": false, + "name": "Margie (:", + "notSpam": true, + "pin": 1695127572481, + "ephemeralDuration": 0, + "ephemeralSettingTimestamp": 0, + "disappearingModeInitiator": "chat", + "disappearingModeTrigger": "chat_settings", + "createdLocally": false, + "unreadMentionsOfMe": [], + "unreadMentionCount": 0, + "hasUnreadMention": false, + "archiveAtMentionViewedInDrawer": false, + "hasChatBeenOpened": false, + "tcToken": {}, + "tcTokenTimestamp": 1745616969, + "tcTokenSenderTimestamp": 1744944499, + "endOfHistoryTransferType": 0, + "pendingInitialLoading": false, + "chatlistPreview": { + "type": "reaction", + "msgKey": "false_50496210031@c.us_3FEA807956686BD2AD73", + "parentMsgKey": "true_50496210031@c.us_3F93865C2A9E8061A668", + "reactionText": "🙏", + "sender": "50496210031@c.us", + "timestamp": 1745717107750 + }, + "unreadEditTimestampMs": 1745508257945, + "celebrationAnimationLastPlayed": 0, + "hasRequestedWelcomeMsg": false, + "msgs": null, + "canSend": true, + "isGroup": false, + "pic": "https://pps.whatsapp.net/v/t61.24694-24/470810943_1065895391975207_6852834404866940192_n.jpg?ccb=11-4&oh=01_Q5Aa1QEWA1-AVsmMc5-23KYTOSB9RsYUB41vONjdzNZCen_qGw&oe=6817C3B1&_nc_sid=5e03e0&_nc_cat=109", + "formattedTitle": "Margie (:", + "contact": { + "id": "50496210031@c.us", + "name": "Margie (:", + "shortName": "Margie", + "pushname": "Margie Elizabeth:)", + "type": "in", + "isBusiness": false, + "isEnterprise": false, + "isSmb": false, + "isContactSyncCompleted": 1, + "disappearingModeDuration": 0, + "disappearingModeSettingTimestamp": 1671409557, + "textStatusLastUpdateTime": -1, + "syncToAddressbook": true, + "formattedName": "Margie (:", + "isMe": false, + "isMyContact": true, + "isPSA": false, + "isUser": true, + "isVerified": false, + "isWAContact": true, + "profilePicThumbObj": { + "eurl": "https://pps.whatsapp.net/v/t61.24694-24/470810943_1065895391975207_6852834404866940192_n.jpg?ccb=11-4&oh=01_Q5Aa1QEWA1-AVsmMc5-23KYTOSB9RsYUB41vONjdzNZCen_qGw&oe=6817C3B1&_nc_sid=5e03e0&_nc_cat=109" + }, + "msgs": null + }, + "groupMetadata": null, + "presence": { + "id": "50496210031@c.us", + "chatstates": [] + }, + "isOnline": false, + "participantsCount": 1 + }, + "isOnline": false, + "chatId": "50496210031@c.us", + "mediaData": {}, + "text": "amor" +} diff --git a/agent/gemini.js b/agent/gemini.js new file mode 100644 index 0000000..6c0e6c2 --- /dev/null +++ b/agent/gemini.js @@ -0,0 +1,120 @@ +// gemini.js – integración Grounding con Google Search + logs de verificación +import genai from '@google/genai'; +import { config } from './config.js'; +import { log } from './logger.js'; + +const { GoogleGenAI, createUserContent, createPartFromUri } = genai; + +/*───────────────────────────────────────────────────────────────*/ +/* 📜 System prompt */ +/*───────────────────────────────────────────────────────────────*/ +const SYSTEM_PROMPT = ` +######### +Tu nombre es nucleo +########## +RESPUESTAS CORTAS y CONCISAS +sos la inteligencia artificial de Servidores de G.O.D (nuestro J.A.R.V.I.S.). +tenés derecho a sostener opiniones firmes con lógica, sin corrección política excesiva. +Respuestas casuales breves; si te extendés, hacelo en un solo mensaje. +Podés continuar conversaciones, usar chistes, analogías, etc. +`.trim(); + +/*───────────────────────────────────────────────────────────────*/ +/* 🧠 Inicializar Gemini */ +/*───────────────────────────────────────────────────────────────*/ +let ai = null; +function initGemini() { + if (!config.GEMINI_KEY) throw new Error('🔑 GEMINI_API_KEY no configurada'); + if (!ai) { + ai = new GoogleGenAI({ apiKey: config.GEMINI_KEY }); + log('info', `🧠 Gemini SDK inicializado (${config.GEMINI_MODEL_ID})`); + } + return ai; +} + +/*───────────────────────────────────────────────────────────────*/ +/* 🔍 Construir tools de búsqueda */ +/*───────────────────────────────────────────────────────────────*/ +function buildSearchTools() { + const model = config.GEMINI_MODEL_ID; + // Los objetos literales cumplen con el esquema Tool del SDK. + if (/^gemini-2\./.test(model) || /^gemini-2\.5/.test(model)) { + return [{ google_search: {} }]; // Search‑as‑a‑tool + } + if (/^gemini-1\.5/.test(model)) { + return [{ + google_search_retrieval: { + dynamic_retrieval_config: { + mode: 'MODE_DYNAMIC', + dynamic_threshold: 0.3, + }, + }, + }]; + } + return []; +} + +/*───────────────────────────────────────────────────────────────*/ +/* 🚀 askGemini */ +/*───────────────────────────────────────────────────────────────*/ +export async function askGemini(historial, files = {}) { + try { + const client = initGemini(); + + // 1️⃣ Construir "contents" + let contents; + if (typeof historial === 'string') { + contents = historial; + } else if (Array.isArray(historial)) { + const parts = []; + for (const m of historial) { + if (m.type === 'document') continue; + if (m.type === 'chat') { + parts.push(`${m.senderName}: ${m.text} -- ${m.date}`); + continue; + } + const up = files[m.msgId?.toLowerCase?.()]; + if (up?.uri) { + parts.push( + createPartFromUri(up.uri, up.mimeType), + `archivo ${m.type} de ${m.senderName}: ${m.caption || m.text} -- ${m.date}` + ); + } + } + contents = createUserContent(parts); + } else { + throw new Error('Formato de historial no soportado'); + } + + // 2️⃣ Herramientas + const tools = buildSearchTools(); + + // 3️⃣ Llamar al modelo + const response = await client.models.generateContent({ + model: config.GEMINI_MODEL_ID, + contents, + config: { + systemInstruction: SYSTEM_PROMPT, + maxOutputTokens: 4096, + temperature: 0.3, // menor → mayor factualidad + tools, + response_modalities: ['TEXT'], + }, + }); + + // 4️⃣ Log de grounding + const candidate = response?.candidates?.[0]; + if (candidate?.groundingMetadata) { + log('info', '🔗 GroundingMetadata presente:', JSON.stringify(candidate.groundingMetadata.webSearchQueries)); + } else { + log('warn', 'ℹ️ Sin groundingMetadata en la respuesta'); + } + + if (!candidate) return '⚠️ Sin candidato.'; + return candidate.content.parts.map(p => p.text).join('').trim() || '⚠️ Respuesta vacía.'; + } catch (e) { + log('error', 'Gemini falló:', e.message); + if (e.response?.status === 429) return '🚦 Límite alcanzado. Probá más tarde.'; + return '⚠️ No se pudo obtener respuesta de Gemini.'; + } +} diff --git a/agent/handlers.js b/agent/handlers.js new file mode 100644 index 0000000..c53f052 --- /dev/null +++ b/agent/handlers.js @@ -0,0 +1,51 @@ +// handlers.js +import { respuestaMCP } from './respuestas/respuestaMCP.js'; // <- NUEVA IMPORTACIÓN +import fs from 'fs/promises'; +import { log } from './logger.js'; +// Ya no se necesitan: sendText, fetchChatMessages, setTypingStatus, askGemini aquí +import { processMessage } from './utils/processMessage.js'; +import { saveMedia } from './utils/saveMedia.js'; +import { respuestaNormal } from './respuestas/respuestaNormal.js'; // <- NUEVA IMPORTACIÓN +import { respuestaBrave } from './respuestas/respuestaBrave.js'; // <- NUEVA IMPORTACIÓN +import { sendText } from './whatsapp.js'; // <- NUEVA IMPORTACIÓN + +/* carpeta raíz donde saveMedia deja todo */ +const MEDIA_DIR = '/media'; +await fs.mkdir(MEDIA_DIR, { recursive: true }); + +// La función cleanForGemini se movió a respuestaNormal.js + +export async function processIncoming(raw) { + // Guarda media si no es un mensaje de texto plano + if (raw.type !== 'chat') { + try { + // Nota: saveMedia podría necesitar acceso a MEDIA_DIR si no está codificado internamente + await saveMedia(raw /*, MEDIA_DIR */); // Podrías necesitar pasar MEDIA_DIR si saveMedia lo requiere + } catch (error) { + log('error', 'Error guardando media:', error); + } + } + + const msg = processMessage(raw); + const text = msg.text || ''; + + /* ----- comando @nucleo ----- */ + if (/^@nucleo(\s|$)/i.test(text)) { + // Llama a la función importada + // await respuestaNormal(msg); // <- LLAMADA A LA FUNCIÓN EXTERNA + await respuestaMCP(msg); // <- LLAMADA A LA FUNCIÓN EXTERNA + } else { + // Lógica para otros mensajes (si aplica) + // log('debug', 'Mensaje recibido no es comando @nucleo:', text); + } + + if (/^@nucleo.(\s|$)/i.test(text)) { + log('info', '🧠 Generando respuesta para @nucleo...'); + const respuestaObjMCP = await respuestaBrave(msg); // <- LLAMADA A LA FUNCIÓN EXTERNA + log('info', 'Respuesta de MCP:', respuestaObjMCP); + sendText(msg.chatId, respuestaObjMCP); + } else { + // Lógica para otros mensajes (si aplica) + // log('debug', 'Mensaje recibido no es comando @nucleo:', text); + } +} \ No newline at end of file diff --git a/agent/index.js b/agent/index.js new file mode 100644 index 0000000..093500e --- /dev/null +++ b/agent/index.js @@ -0,0 +1,35 @@ +/* nucleo-bot ― index.js */ +import express from 'express'; +import morgan from 'morgan'; +import { config } from './config.js'; +import { log } from './logger.js'; +import { router } from './routes.js'; +import { + waitForGateway, + clearWebhooks, + registerWebhook +} from './whatsapp.js'; + + + +export let globalMemory = {}; + +/* 🌐 Express app */ +const app = express(); +app.use(express.json({ limit: '1mb' })); +app.use(morgan('[:date[iso]] :method :url :status - :response-time ms')); +app.use(router); + +/* 🚀 Bootstrap */ +async function bootstrap() { + await waitForGateway(); + await clearWebhooks(); + await registerWebhook(); +} + +/* 🏁 Arranque */ +app.listen(config.PORT, () => { + log('info', `🪪 Versión del bot: ${config.VERSION}`); + log('info', `🚀 nucleo-bot escuchando en :${config.PORT}`); + bootstrap().catch(e => log('error', 'Error en bootstrap:', e.message)); +}); diff --git a/agent/logger.js b/agent/logger.js new file mode 100644 index 0000000..4dbb0b6 --- /dev/null +++ b/agent/logger.js @@ -0,0 +1,17 @@ +/*───────────────────────────────────────────────────────────────*/ +/* 🖨️ Logger */ +/*───────────────────────────────────────────────────────────────*/ +import dayjs from 'dayjs'; +import utc from 'dayjs/plugin/utc.js'; +import { config } from './config.js'; + +dayjs.extend(utc); + +export function log(level, ...args) { + const levels = ['debug', 'info', 'warn', 'error']; + if (levels.indexOf(level) >= levels.indexOf(config.LOG_LEVEL)) { + console[level === 'debug' ? 'log' : level]( + `[${dayjs().utc().format()}]`, level.toUpperCase(), ...args + ); + } +} \ No newline at end of file diff --git a/agent/package.json b/agent/package.json new file mode 100644 index 0000000..010f853 --- /dev/null +++ b/agent/package.json @@ -0,0 +1,20 @@ +{ + "name": "nucleo-bot", + "version": "0.4.0", + "type": "module", + "scripts": { + "start:mcp": "npx @philschmid/weather-mcp" + }, + "dependencies": { + "axios": "^1.8.4", + "dayjs": "^1.11.11", + "express": "^4.19.2", + "morgan": "^1.10.0", + "@google/generative-ai": "^0.4.0", + "@google/genai": "^0.9.0", + "@open-wa/wa-automate": "^4.34.3", + "mime-types": "^2.1.35", + "@modelcontextprotocol/sdk": "^1.0.0", + "@philschmid/weather-mcp": "^1.0.0" + } +} diff --git a/agent/processMessage/processVideoMessage.js b/agent/processMessage/processVideoMessage.js new file mode 100644 index 0000000..e69de29 diff --git a/agent/respuestas/respuestaBrave.js b/agent/respuestas/respuestaBrave.js new file mode 100644 index 0000000..0096b9c --- /dev/null +++ b/agent/respuestas/respuestaBrave.js @@ -0,0 +1,128 @@ +// /respuesta/respuestaBrave.js +import fs from 'fs/promises'; +import { log } from '../logger.js'; +import { + sendText, + fetchChatMessages, + setTypingStatus +} from '../whatsapp.js'; +import { processMessage } from '../utils/processMessage.js'; +import { saveMedia } from '../utils/saveMedia.js'; + +import { GoogleGenAI } from '@google/genai'; +import { Client } from '@modelcontextprotocol/sdk/client/index.js'; +import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; + +function sanitizeSchema(obj) { + if (Array.isArray(obj)) return obj.map(sanitizeSchema); + if (obj && typeof obj === 'object') { + const out = {}; + for (const [k, v] of Object.entries(obj)) { + if (k === 'additionalProperties' || k === '$schema') continue; + out[k] = sanitizeSchema(v); + } + return out; + } + return obj; +} + +const cleanForGemini = ({ media, reactions, preview, ...rest }) => rest; + +export async function respuestaBrave(msg) { + const text = msg.text || ''; + + setTypingStatus(msg.chatId, true); + log('info', '🧠 Generando respuesta para @nucleo (Brave)…'); + + try { + const allraw = await fetchChatMessages(msg.chatId); + const allMsgs = allraw.map(processMessage); + + const context = allMsgs.map(cleanForGemini); + let json = JSON.stringify(context); + while (json.length > 100_000 && context.length) { + context.shift(); + json = JSON.stringify(context); + } + + const chatName = context.length > 0 ? context[0]?.chatName : 'chat'; + const prompt = [ + `Eres un asistente con acceso a Brave Search mediante herramientas externas.`, + `Pregunta del usuario: ${text}`, + ...context + ]; + + const medias = allraw.filter(m => m.type !== 'chat'); + const settled = await Promise.allSettled(medias.map(saveMedia)); + + const MAX = 20 * 1024 * 1024; + let total = 0; + const files = {}; + + for (const r of settled) { + if (r.status !== 'fulfilled' || !r.value) continue; + const entries = Object.entries(r.value); + if (entries.length === 0) continue; + const [msgId, obj] = entries[0]; + let size = Number(obj.sizeBytes || 0); + if (!size && obj.filePath) { + try { size = (await fs.stat(obj.filePath)).size; } catch { size = 0; } + } + if (total + size > MAX && total > 0) break; + if (size > MAX) continue; + + total += size; + files[msgId] = { uri: obj.uri || obj.filePath, mimeType: obj.mimeType }; + } + + // === MCP Brave Search === + const client = new Client({ name: 'brave-agent', version: '1.0.0' }); + const serverParams = new StdioClientTransport({ + command: 'uvx', + args: ['mcp-server-fetch'] + }); + + + await client.connect(serverParams); + + const mcp = await client.listTools(); + const tools = mcp.tools.map(t => ({ + name: t.name, + description: t.description, + parameters: sanitizeSchema({ + type: 'object', + ...t.inputSchema + }) + })); + + const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY }); + const response = await ai.models.generateContent({ + model: 'gemini-2.5-flash-preview-04-17', + contents: prompt, + config: { + tools: [{ functionDeclarations: tools }], + temperature: 0 + } + }); + + let respuesta; + if (response.functionCalls && response.functionCalls.length > 0) { + const call = response.functionCalls[0]; + const result = await client.callTool({ name: call.name, arguments: call.args }); + await client.close(); + respuesta = result.content?.[0]?.text ?? JSON.stringify(result); + } else { + await client.close(); + respuesta = response.text; + } + + await sendText(msg.chatId, respuesta); + log('info', '🧠 Respuesta enviada'); + + } catch (error) { + log('error', 'Error en respuestaBrave:', error); + await sendText(msg.chatId, 'Hubo un error al procesar tu solicitud.'); + } finally { + setTypingStatus(msg.chatId, false); + } +} diff --git a/agent/respuestas/respuestaMCP.js b/agent/respuestas/respuestaMCP.js new file mode 100644 index 0000000..5ccc774 --- /dev/null +++ b/agent/respuestas/respuestaMCP.js @@ -0,0 +1,127 @@ +// /respuesta/respuestaMCP.js +import fs from 'fs/promises'; +import { log } from '../logger.js'; +import { + sendText, + fetchChatMessages, + setTypingStatus +} from '../whatsapp.js'; +import { processMessage } from '../utils/processMessage.js'; +import { saveMedia } from '../utils/saveMedia.js'; + +import { GoogleGenAI } from '@google/genai'; +import { Client } from '@modelcontextprotocol/sdk/client/index.js'; +import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; + +/* limpia el esquema JSON recursivamente */ +function sanitizeSchema(obj) { + if (Array.isArray(obj)) return obj.map(sanitizeSchema); + if (obj && typeof obj === 'object') { + const out = {}; + for (const [k, v] of Object.entries(obj)) { + if (k === 'additionalProperties' || k === '$schema') continue; + out[k] = sanitizeSchema(v); + } + return out; + } + return obj; +} + +const cleanForGemini = ({ media, reactions, preview, ...rest }) => rest; + +export async function respuestaMCP(msg) { + const text = msg.text || ''; + + setTypingStatus(msg.chatId, true); + log('info', '🧠 Generando respuesta para @nucleo…'); + + try { + const allraw = await fetchChatMessages(msg.chatId); + const allMsgs = allraw.map(processMessage); + + const context = allMsgs.map(cleanForGemini); + let json = JSON.stringify(context); + while (json.length > 100_000 && context.length) { + context.shift(); + json = JSON.stringify(context); + } + + const chatName = context.length > 0 ? context[0]?.chatName : 'chat'; + const prompt = [ + `Eres el asistente del grupo "${chatName}". tenes la capacidad de interactuar con las carpetas ubicacadas en el directorio "/media/mcp" y sus subcarpetas.`, + `Pregunta del usuario: ${text}`, + ...context + ]; + + const medias = allraw.filter(m => m.type !== 'chat'); + const settled = await Promise.allSettled(medias.map(saveMedia)); + + const MAX = 20 * 1024 * 1024; + let total = 0; + const files = {}; + + for (const r of settled) { + if (r.status !== 'fulfilled' || !r.value) continue; + const entries = Object.entries(r.value); + if (entries.length === 0) continue; + const [msgId, obj] = entries[0]; + let size = Number(obj.sizeBytes || 0); + if (!size && obj.filePath) { + try { size = (await fs.stat(obj.filePath)).size; } catch { size = 0; } + } + if (total + size > MAX && total > 0) break; + if (size > MAX) continue; + + total += size; + files[msgId] = { uri: obj.uri || obj.filePath, mimeType: obj.mimeType }; + } + + // === MCP setup === + const client = new Client({ name: 'mcp-agent', version: '1.0.0' }); + const serverParams = new StdioClientTransport({ + command: 'npx', + args: ['-y', '@modelcontextprotocol/server-filesystem', '/media/mcp'] + }); + await client.connect(serverParams); + + const mcp = await client.listTools(); + const tools = mcp.tools.map(t => ({ + name: t.name, + description: t.description, + parameters: sanitizeSchema({ + type: 'object', + ...t.inputSchema + }) + })); + + const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY }); + const response = await ai.models.generateContent({ + model: 'gemini-2.5-flash-preview-04-17', + contents: prompt, + config: { + tools: [{ googleSearch: {} }], + temperature: 0 + } + }); + + let respuesta; + if (response.functionCalls && response.functionCalls.length > 0) { + const call = response.functionCalls[0]; + const result = await client.callTool({ name: call.name, arguments: call.args }); + await client.close(); + respuesta = result.content?.[0]?.text ?? JSON.stringify(result); + } else { + await client.close(); + respuesta = response.text; + } + + await sendText(msg.chatId, respuesta); + log('info', '🧠 Respuesta enviada'); + + } catch (error) { + log('error', 'Error en respuestaMCP:', error); + await sendText(msg.chatId, 'Hubo un error al procesar tu solicitud.'); + } finally { + setTypingStatus(msg.chatId, false); + } +} diff --git a/agent/respuestas/respuestaNormal.js b/agent/respuestas/respuestaNormal.js new file mode 100644 index 0000000..cef10ae --- /dev/null +++ b/agent/respuestas/respuestaNormal.js @@ -0,0 +1,100 @@ +// /respuesta/respuestaNormal.js +import fs from 'fs/promises'; +import { log } from '../logger.js'; // <- Nota el '../' +import { + sendText, + fetchChatMessages, + setTypingStatus +} from '../whatsapp.js'; // <- Nota el '../' +import { askGemini } from '../gemini.js'; // <- Nota el '../' +import { processMessage } from '../utils/processMessage.js'; // <- Nota el '../' +import { saveMedia } from '../utils/saveMedia.js'; // <- Nota el '../' + +/* Quita campos pesados antes de mandar a Gemini */ +const cleanForGemini = ({ media, reactions, preview, ...rest }) => rest; + +/** + * Procesa la lógica específica para el comando @nucleo. + * Obtiene el historial, prepara el contexto, procesa media, + * llama a Gemini y envía la respuesta. + * @param {object} msg - El objeto de mensaje procesado. + */ +export async function respuestaNormal(msg) { + const text = msg.text || ''; // Necesitamos el texto original aquí también + + setTypingStatus(msg.chatId, true); + log('info', '🧠 Generando respuesta para @nucleo…'); + + try { + /* 1) historial completo del chat */ + const allraw = await fetchChatMessages(msg.chatId); + const allMsgs = allraw.map(processMessage); + + /* 2) recorta contexto a ≤100 kB */ + const context = allMsgs.map(cleanForGemini); + let json = JSON.stringify(context); + while (json.length > 100_000 && context.length) { + context.shift(); + json = JSON.stringify(context); + } + + // Asegurarse de que el contexto no esté vacío antes de acceder a context[0] + const chatName = context.length > 0 ? context[0]?.chatName : 'chat'; + + /* 3) prompt */ + const prompt = [ + `Eres el asistente del grupo "${chatName}".`, + `Pregunta del usuario: ${text}` // Usamos el 'text' del mensaje original que activó el comando + , ...context]; + + /* 4) procesa medias y respeta el límite de 20 MB */ + // Filtrar solo los mensajes que no son de tipo 'chat' del historial obtenido + const medias = allraw.filter(m => m.type !== 'chat'); + const settled = await Promise.allSettled(medias.map(saveMedia)); + + const MAX = 20 * 1024 * 1024; // 20 MB + let total = 0; + const files = {}; + + for (const r of settled) { + if (r.status !== 'fulfilled' || !r.value) continue; + + if (typeof r.value !== 'object' || r.value === null) continue; + const entries = Object.entries(r.value); + if (entries.length === 0) continue; + const [msgId, obj] = entries[0]; + if (typeof obj !== 'object' || obj === null) continue; + + let size = Number(obj.sizeBytes || 0); + + if (!size && obj.filePath) { + try { size = (await fs.stat(obj.filePath)).size; } + catch { size = 0; } + } + + // Comprobar si añadir este archivo excede el límite MÁXIMO TOTAL + // y si ya tenemos *algo* (total > 0) para evitar empezar con un archivo demasiado grande + if (total + size > MAX && total > 0) break; + // Si este archivo *por sí solo* excede el límite, saltarlo + if (size > MAX) continue; + + total += size; + files[msgId] = { uri: obj.uri || obj.filePath, mimeType: obj.mimeType }; + } + + // log('info', '🧠 Enviando a Gemini...', { files }); + + /* 5) llama a Gemini y responde */ + const respuesta = await askGemini(prompt, files); + await sendText(msg.chatId, respuesta); + + log('info', '🧠 Respuesta enviada'); + + } catch (error) { + log('error', 'Error en respuestaNormal:', error); + await sendText(msg.chatId, 'Hubo un error al procesar tu solicitud.'); + + } finally { + setTypingStatus(msg.chatId, false); + } +} \ No newline at end of file diff --git a/agent/routes.js b/agent/routes.js new file mode 100644 index 0000000..5a60d19 --- /dev/null +++ b/agent/routes.js @@ -0,0 +1,200 @@ +// routes.js +import express from 'express'; +import axios from 'axios'; +import dayjs from 'dayjs'; +import { config } from './config.js'; +import { log } from './logger.js'; +import { sendText } from './whatsapp.js'; +import { processIncoming } from './handlers.js'; +import { processMessage } from './utils/processMessage.js'; + +// chats a tomar en cuenta para el bot + +const relevantChats = [ + '50496210031@c.us', + '120363203056794284@g.us', + '120363398335375917@g.us', + '50498554225@c.us', + '50496934012@c.us', + '50497588328@c.us', + '50489701450@c.us' +] + + + + +export const router = express.Router(); + +// --- Manejo de eventos del webhook ------------------------------------------------ +router.post('/webhook', async (req, res) => { + const { event, data: raw } = req.body; + const data = processMessage(raw); + + // Si el evento no es relevante, ignorar + if(data.chatId && !relevantChats.includes(data.chatId)) { + log('info', `Mensaje de ${data.chatId} ignorado`); + return res.sendStatus(200); + } + // console.log('----------------------------------------------------------------'); + // log('debug', '↪︎ Mensaje IN →', raw); + // console.log('----------------------------------------------------------------'); + + // log('debug', `📩 Webhook event "${event}"`); + + switch (event) { + case 'onAck': + log('info', 'Ack:', data); + break; + + case 'onAddedToGroup': + log('info', 'Added to group:', data); + break; + + case 'onAnyMessage': + // log('info', 'onAnyMessage', data); + log('info', 'onAnyMessage', raw.chatId); + await processIncoming(raw); + break; + + case 'onBattery': + log('info', 'Battery status:', data); + break; + + case 'onBroadcast': + log('info', 'Broadcast:', data); + break; + + case 'onButton': + log('info', 'Button pressed:', data); + break; + + case 'onCallState': + log('info', 'Call state:', data); + break; + + case 'onChatDeleted': + log('info', 'Chat deleted:', data); + break; + + case 'onChatOpened': + log('info', 'Chat opened:', data); + break; + + case 'onChatState': + log('info', 'Chat state:', data); + break; + + case 'onContactAdded': + log('info', 'Contact added:', data); + break; + + case 'onGlobalParticipantsChanged': + log('info', 'Global participants changed:', data); + break; + + case 'onGroupApprovalRequest': + log('info', 'Group approval request:', data); + break; + + case 'onGroupChange': + log('info', 'Group change:', data); + break; + + case 'onIncomingCall': + log('info', 'Incoming call:', data); + break; + + case 'onLabel': + log('info', 'Label event:', data); + break; + + case 'onLogout': + log('info', 'Logout:', data); + break; + + case 'onMessage': + log('info', 'Message:', data); + break; + + case 'onMessageDeleted': + log('info', 'Message deleted:', data); + break; + + case 'onNewProduct': + log('info', 'New product:', data); + break; + + case 'onOrder': + log('info', 'Order:', data); + break; + + case 'onPlugged': + log('info', 'Plugged:', data); + break; + + case 'onPollVote': + log('info', 'Poll vote:', data); + break; + + case 'onReaction': + log('info', 'Reaction:', data); + break; + + case 'onRemovedFromGroup': + log('info', 'Removed from group:', data); + break; + + case 'onStateChanged': + log('info', 'State changed:', data); + break; + + case 'onStory': + log('info', 'Story:', data); + break; + + default: + log('warn', `Unhandled event type: "${event}"`, data); + break; + } + + res.sendStatus(200); +}); + + + + + + + + + + + + + + + + +// comentado el 4/26/2025 +/* Debug: escanear últimos mensajes */ +// router.get('/debug/scan', async (_req, res) => { +// const { data } = await axios.post(`${config.API_URL}/loadAndGetAllMessagesInChat`, { +// args: { chatId: config.GROUP_ID, includeMe: 'true', includeNotifications: 'false' } +// }); +// const msgs = (data?.response ?? []).slice(-20); +// log('info', `Escaneando ${msgs.length} mensajes recientes…`); +// for (const m of msgs) await processIncoming(m); +// res.json({ ok: true, scanned: msgs.length }); +// }); + +/* Debug: enviar mensaje */ +// router.get('/debug/send', async (req, res) => { +// const text = req.query.msg ?? config.REPLY_MSG; +// const resp = await sendText(config.GROUP_ID, text); +// res.json({ ok: true, resp }); +// }); + +/* Debug: versión */ +router.get('/debug/version', (_req, res) => { + res.json({ version: config.VERSION }); +}); diff --git a/agent/utils/decryptMediaContent.js b/agent/utils/decryptMediaContent.js new file mode 100644 index 0000000..ee0a994 --- /dev/null +++ b/agent/utils/decryptMediaContent.js @@ -0,0 +1,80 @@ +// utils/decryptMediaContent.js (ES modules) +import fs from 'fs'; +import path from 'path'; +import axios from 'axios'; +import mime from 'mime-types'; +import { decryptMedia } from '@open-wa/wa-automate'; +import { log } from '../logger.js'; + +// 🔒 quita caracteres que rompen rutas +const safe = s => (s || '').replace(/[\\/:*?"<>|]/g, '_'); + +export async function decryptMediaContent( + mediaInfo, + outputDir = 'media/dec', + rawDir = 'media/raw', + filename = null +) { + const { clientUrl, t, filehash, msgId, type } = mediaInfo; + let { mimetype } = mediaInfo; + + if (!clientUrl) { + log('error', '❌ Sin clientUrl, no se puede bajar'); + return null; + } + + // deducir mimetype si falta + if (!mimetype) { + mimetype = + mime.lookup(clientUrl) || + (type?.startsWith('image') && 'image/jpeg') || + (type?.startsWith('video') && 'video/mp4') || + 'application/octet-stream'; + } + + const ext = mime.extension(mimetype) || 'bin'; + const baseName = safe(filename || msgId || filehash?.slice(0,16) || `file_${t||Date.now()}`); + const rawPath = path.join(rawDir , `${baseName}.enc`); + const decPath = path.join(outputDir, `${baseName}.${ext}`); + + if (fs.existsSync(decPath)) return decPath; + + fs.mkdirSync(rawDir , { recursive: true }); + fs.mkdirSync(outputDir, { recursive: true }); + + try { + /* ───── descarga RAW (solo si no existe) ───── */ + if (!fs.existsSync(rawPath)) { + const { data } = await axios + .get(clientUrl, { responseType: 'arraybuffer' }) + .catch(e => { + if (e.response?.status === 410) throw new Error('URL expirada (410)'); + throw e; + }); + fs.writeFileSync(rawPath, Buffer.from(data)); + } + + /* ───── inyectar RAW para que decryptMedia no lo vuelva a bajar ───── */ + const fake = { + ...mediaInfo, + mimetype, + mimeType: mimetype, + _data: { + ...mediaInfo, + mimetype, + mimeType: mimetype, + _raw: fs.readFileSync(rawPath) + } + }; + + const plain = await decryptMedia(fake); + if (!plain?.length) throw new Error('descifrado vacío'); + + fs.writeFileSync(decPath, plain); + log('info', `✔️ ${type || ext} → ${decPath}`); + return decPath; + } catch (e) { + log('error', `❌ decryptMedia falló → ${e.message}`); + return null; + } +} diff --git a/agent/utils/processMessage.js b/agent/utils/processMessage.js new file mode 100644 index 0000000..701ba97 --- /dev/null +++ b/agent/utils/processMessage.js @@ -0,0 +1,80 @@ +import dayjs from 'dayjs'; + +/** + * Convierte el raw de open-wa a un objeto compacto. + * Solo coloca `media` cuando hay TODO para desencriptar: mediaKey + clientUrl. + */ +export function processMessage(raw) { + const m = raw?.data ?? raw; // alias corto + + const base = { + msgId : m.id, + chatId : m.chatId, + chatName : m.chat?.name ?? m.chat?.formattedTitle ?? null, + senderId : m.sender?.id ?? m.author ?? null, + senderName: m.sender?.name ?? m.notifyName ?? null, + type : m.type, + text : m.text ?? m.caption ?? '', + fromMe : !!m.fromMe, + timestamp : m.timestamp ?? m.t, + date : m.timestamp + ? dayjs.unix(m.timestamp).utcOffset(-360).format('YYYY-MM-DD HH:mm:ss') + : null, + hasReactions: (m.reactions?.length ?? 0) > 0 || !!m.hasReaction, + reactions : (m.reactions ?? []).map(r => r.aggregateEmoji) + }; + + /* ---------- quoted ---------- */ + if (m.quotedMsg) { + base.replyTo = { + id : m.quotedMsg.id, + text: m.quotedMsg.text ?? m.quotedMsg.body ?? '', + from: m.quotedParticipant ?? null, + type: m.quotedMsg.type + }; + } + + /* ---------- preview de enlaces ---------- */ + if (m.matchedText) { + base.preview = { + url : m.matchedText, + title: m.title ?? null, + description: m.description ?? null + }; + } + + /* ---------- media listo para desencriptar ---------- */ + const isMediaType = ['image','video','sticker','ptt','audio','document'].includes(m.type); + const hasKeys = m.mediaKey || m.mediaData?.mediaKey; + const hasUrl = m.clientUrl || m.directPath; + + if (isMediaType && hasKeys && hasUrl) { + base.media = { + type : m.type, + clientUrl: m.clientUrl ?? m.directPath, + mimetype : m.mimetype, + size : m.size ?? m.mediaData?.size, + width : m.width, + height : m.height, + duration : Number(m.duration) || 0, + filename : m.filename ?? null, + caption : m.caption ?? null, + + /* claves para decryptMediaContent */ + mediaKey : m.mediaKey ?? m.mediaData?.mediaKey, + filehash : m.filehash ?? m.mediaData?.filehash, + t : m.t ?? m.timestamp + }; + + if (m.type === 'sticker') { + Object.assign(base.media, { + packId : m.stickerPackId ?? m.mediaData?.stickerPackId, + pack : m.stickerPackName ?? m.mediaData?.stickerPackName, + author : m.stickerPackPublisher ?? m.mediaData?.stickerPackPublisher, + animated: m.isLottie || m.mediaData?.isAnimated || false + }); + } + } + + return base; +} diff --git a/agent/utils/saveMedia.js b/agent/utils/saveMedia.js new file mode 100644 index 0000000..346418f --- /dev/null +++ b/agent/utils/saveMedia.js @@ -0,0 +1,80 @@ +// utils/saveMedia.js +import fs from 'fs'; +import path from 'path'; +import axios from 'axios'; +import mime from 'mime-types'; +import { decryptMedia } from '@open-wa/wa-automate'; +import { GoogleGenAI } from '@google/genai'; +import { config } from '../config.js'; +import { log } from '../logger.js'; + +const BASE_DIR = '/media'; +const safe = s => (s || '').replace(/[\\/:*?"<>|]/g, '_'); +const ai = new GoogleGenAI({ apiKey: config.GEMINI_KEY }); + +function getShortId(msgId = '') { + return msgId.replace(/^true_|^false_|@c\.us_/g, '').split('_')[0]; +} + +export async function saveMedia(msg) { + if (msg.type === 'chat') return null; + if (!msg.clientUrl) { + log('warn', `Sin clientUrl: ${msg.id}`); + return null; + } + + const ext = mime.extension(msg.mimetype || 'application/octet-stream') || 'bin'; + const chatId = safe(msg.chatId); + const shortId = (`${msg.timestamp}${msg.type}`).toLocaleLowerCase(); + // const shortId = getShortId(msg.id); + const folder = path.join(BASE_DIR, chatId, safe(msg.type)); + const filePath = path.join(folder, `${shortId}.${ext}`); + const fileName = shortId // solo para Files API + + // Buscar primero en Files API + try { + const existing = await ai.files.get({ name: fileName }); + log('info', `📂 ya existe en Files API: ${fileName}`); + return { [msg.id]: existing }; + } catch (e) { + if (e.message?.includes('INVALID_ARGUMENT')) { + log('error', `files.get falló para ${fileName}: ${e.message}`); + } + } + + // Buscar en disco + if (fs.existsSync(filePath)) { + log('info', `📁 ya existe local: ${fileName}`, 'subiendo a Files API'); + const uploaded = await ai.files.upload({ + file: fileName, + config: { mimeType: msg.mimetype || 'application/octet-stream', name: fileName }, + }); + log('info', `📤 subido a Files API: ${uploaded.name}`); + return { [msg.id]: uploaded }; + } + + try { + const raw = await axios.get(msg.clientUrl, { responseType: 'arraybuffer' }); + msg._data = { ...msg, _raw: raw.data }; + const buf = await decryptMedia(msg); + + fs.mkdirSync(folder, { recursive: true }); + fs.writeFileSync(filePath, buf); + log('info', `✅ guardado: ${filePath}`); + + const uploaded = await ai.files.upload({ + file: filePath, + config: { mimeType: msg.mimetype || 'application/octet-stream', name: fileName }, + }); + log('info', `📤 subido a Files API: ${uploaded.name}`); + return { [msg.id]: uploaded }; + + } catch (err) { + if (err.response?.status === 410) { + log('warn', `URL expirada (410) para ${msg.id}`); + } else { + log('error', `Error al guardar media ${msg.id}: ${err.message}`); + } + return null; + } +} diff --git a/agent/whatsapp.js b/agent/whatsapp.js new file mode 100644 index 0000000..97cbc72 --- /dev/null +++ b/agent/whatsapp.js @@ -0,0 +1,137 @@ +// whatsapp.js +import axios from 'axios'; +import { config } from './config.js'; +import { log } from './logger.js'; + +/* ✉️ Enviar texto -------------------------------------------------------- */ +export async function sendText(to, content) { + log('info', `Enviando mensaje a ${to}: "${content}"`); + const { data } = await axios.post(`${config.API_URL}/sendText`, { + args: { to, content } + }); + log('debug', 'Respuesta de /sendText →', data); + return data; +} + +/* 🗨️ Traer todos los mensajes cargados en el chat ------------------------ */ +export async function fetchChatMessages(chatId) { + try { + const { data } = await axios.post(`${config.API_URL}/getAllMessagesInChat`, { + args: { + chatId, + includeMe: 'true', + includeNotifications: 'false' + } + }); + return data?.response ?? []; + } catch (e) { + log('error', 'Fallo /getAllMessagesInChat:', e.response?.data ?? e.message); + return []; + } +} + +/* ⏳ Esperar gateway ------------------------------------------------------ */ +export async function waitForGateway() { + for (let i = 1; i <= config.MAX_ATTEMPTS; i++) { + try { + await axios.get(`${config.API_URL}/api-docs`); + log('info', '🟢 whatsapp-gateway listo'); + return; + } catch { + log('warn', `Gateway no responde (intento ${i}/${config.MAX_ATTEMPTS})…`); + await new Promise(r => setTimeout(r, config.RETRY_MS)); + } + } + throw new Error('whatsapp-gateway no respondió a tiempo'); +} + +/* 🧹 Limpiar webhooks anteriores ----------------------------------------- */ +export async function clearWebhooks() { + try { + const { data } = await axios.post(`${config.API_URL}/listWebhooks`); + const hooks = data?.response ?? []; + if (!hooks.length) { + log('info', 'Sin webhooks previos que limpiar'); + return; + } + + log('info', `Eliminando ${hooks.length} webhooks…`); + const results = await Promise.allSettled( + hooks.map(h => axios.post(`${config.API_URL}/removeWebhook`, { args: { webhookId: h.id } })) + ); + + results.forEach((r, i) => { + const id = hooks[i].id; + if (r.status === 'fulfilled' && r.value?.data?.response === true) { + log('debug', `✔️ Eliminado webhook ${id}`); + } else { + log('warn', `⚠️ Falló eliminar webhook ${id}`); + } + }); + + const ok = results.filter(r => r.status === 'fulfilled' && r.value?.data?.response === true).length; + log('info', `Limpieza OK (${ok}/${hooks.length} eliminados)`); + } catch (e) { + log('error', 'Fallo limpiando webhooks:', e.response?.data ?? e.message); + } +} + +// --- Registro del webhook con todos los eventos disponibles ---------- +export async function registerWebhook() { + const url = `http://nucleo-bot:${config.PORT}/webhook`; + + const eventConfig = { + onAck: false, // ❌ + onAddedToGroup: true, + onAnyMessage: true, + onBattery: true, + onBroadcast: true, + onButton: true, + onCallState: false, // ❌ + onChatDeleted: true, + onChatOpened: true, + onChatState: true, + onContactAdded: true, + onGlobalParticipantsChanged: true, + onGroupApprovalRequest: true, + onGroupChange: true, + onIncomingCall: false, // ❌ + onLabel: true, + onLogout: true, + onMessage: false, // ❌ + onMessageDeleted: true, + onNewProduct: true, + onOrder: true, + onPlugged: false, // ❌ + onPollVote: true, + onReaction: true, + onRemovedFromGroup: false, // ❌ + onStateChanged: false, // ❌ + onStory: false, // ❌ + }; + + // usa el config de eventos para filtrar los habilitados (el config de arriba) + const allEvents = Object.entries(eventConfig) + .filter(([_, enabled]) => enabled) + .map(([event]) => event); + + + const { data } = await axios.post(`${config.API_URL}/registerWebhook`, { + args: { url, events: allEvents, id: 'nucleo-bot' } + }); + + log('info', '✔️ Webhook registrado:', data); +} + + +export async function setTypingStatus(chatId, status) { + try { + const { data } = await axios.post(`${config.API_URL}/simulateTyping`, { + args: { to: chatId, on: status } + }); + log('debug', 'Respuesta de /setChatState →', data); + } catch (e) { + log('error', 'Fallo /setChatState:', e.response?.data ?? e.message); + } +} + diff --git a/api/.gitignore b/api/.gitignore new file mode 100644 index 0000000..11ddd8d --- /dev/null +++ b/api/.gitignore @@ -0,0 +1,3 @@ +node_modules +# Keep environment variables out of version control +.env diff --git a/api/node_modules/.package-lock.json b/api/node_modules/.package-lock.json index c9386c6..cbd2121 100644 --- a/api/node_modules/.package-lock.json +++ b/api/node_modules/.package-lock.json @@ -1,38 +1,132 @@ { - "name": "api", + "name": "planilla-api", "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==", + "node_modules/@esbuild/win32-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.4.tgz", + "integrity": "sha512-nOT2vZNw6hJ+z43oP1SPea/G/6AbN6X+bGNhNuq8NtRHy4wsMhw765IKLNmnjek7GvjWBYQ8Q5VBoYTFg9y1UQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@prisma/client": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.7.0.tgz", + "integrity": "sha512-+k61zZn1XHjbZul8q6TdQLpuI/cvyfil87zqK2zpreNIXyXtpUv3+H/oM69hcsFcZXaokHJIzPAt5Z8C8eK2QA==", + "hasInstallScript": true, + "engines": { + "node": ">=18.18" + }, + "peerDependencies": { + "prisma": "*", + "typescript": ">=5.1.0" + }, + "peerDependenciesMeta": { + "prisma": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/@prisma/config": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/config/-/config-6.7.0.tgz", + "integrity": "sha512-di8QDdvSz7DLUi3OOcCHSwxRNeW7jtGRUD2+Z3SdNE3A+pPiNT8WgUJoUyOwJmUr5t+JA2W15P78C/N+8RXrOA==", "dependencies": { - "mime-types": "^3.0.0", - "negotiator": "^1.0.0" + "esbuild": ">=0.12 <1", + "esbuild-register": "3.6.0" + } + }, + "node_modules/@prisma/debug": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.7.0.tgz", + "integrity": "sha512-RabHn9emKoYFsv99RLxvfG2GHzWk2ZI1BuVzqYtmMSIcuGboHY5uFt3Q3boOREM9de6z5s3bQoyKeWnq8Fz22w==" + }, + "node_modules/@prisma/engines": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.7.0.tgz", + "integrity": "sha512-3wDMesnOxPrOsq++e5oKV9LmIiEazFTRFZrlULDQ8fxdub5w4NgRBoxtWbvXmj2nJVCnzuz6eFix3OhIqsZ1jw==", + "hasInstallScript": true, + "dependencies": { + "@prisma/debug": "6.7.0", + "@prisma/engines-version": "6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed", + "@prisma/fetch-engine": "6.7.0", + "@prisma/get-platform": "6.7.0" + } + }, + "node_modules/@prisma/engines-version": { + "version": "6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed.tgz", + "integrity": "sha512-EvpOFEWf1KkJpDsBCrih0kg3HdHuaCnXmMn7XFPObpFTzagK1N0Q0FMnYPsEhvARfANP5Ok11QyoTIRA2hgJTA==" + }, + "node_modules/@prisma/fetch-engine": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.7.0.tgz", + "integrity": "sha512-zLlAGnrkmioPKJR4Yf7NfW3hftcvqeNNEHleMZK9yX7RZSkhmxacAYyfGsCcqRt47jiZ7RKdgE0Wh2fWnm7WsQ==", + "dependencies": { + "@prisma/debug": "6.7.0", + "@prisma/engines-version": "6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed", + "@prisma/get-platform": "6.7.0" + } + }, + "node_modules/@prisma/get-platform": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.7.0.tgz", + "integrity": "sha512-i9IH5lO4fQwnMLvQLYNdgVh9TK3PuWBfQd7QLk/YurnAIg+VeADcZDbmhAi4XBBDD+hDif9hrKyASu0hbjwabw==", + "dependencies": { + "@prisma/debug": "6.7.0" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" }, "engines": { "node": ">= 0.6" } }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, "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==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", "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" + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" }, "engines": { - "node": ">=18" + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" } }, "node_modules/bytes": { @@ -71,9 +165,9 @@ } }, "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==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", "dependencies": { "safe-buffer": "5.2.1" }, @@ -90,35 +184,24 @@ } }, "node_modules/cookie": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", - "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", "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==", - "engines": { - "node": ">=6.6.0" - } + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, "node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "ms": "2.0.0" } }, "node_modules/depd": { @@ -129,6 +212,15 @@ "node": ">= 0.8" } }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -182,6 +274,77 @@ "node": ">= 0.4" } }, + "node_modules/esbuild": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.4.tgz", + "integrity": "sha512-8pgjLUcUjcgDg+2Q4NYXnPbo/vncAY4UmyaCm0jZevERqCHZIaWwdJHkf8XQtu4AxSKCdvrUbT0XUr1IdZzI8Q==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.4", + "@esbuild/android-arm": "0.25.4", + "@esbuild/android-arm64": "0.25.4", + "@esbuild/android-x64": "0.25.4", + "@esbuild/darwin-arm64": "0.25.4", + "@esbuild/darwin-x64": "0.25.4", + "@esbuild/freebsd-arm64": "0.25.4", + "@esbuild/freebsd-x64": "0.25.4", + "@esbuild/linux-arm": "0.25.4", + "@esbuild/linux-arm64": "0.25.4", + "@esbuild/linux-ia32": "0.25.4", + "@esbuild/linux-loong64": "0.25.4", + "@esbuild/linux-mips64el": "0.25.4", + "@esbuild/linux-ppc64": "0.25.4", + "@esbuild/linux-riscv64": "0.25.4", + "@esbuild/linux-s390x": "0.25.4", + "@esbuild/linux-x64": "0.25.4", + "@esbuild/netbsd-arm64": "0.25.4", + "@esbuild/netbsd-x64": "0.25.4", + "@esbuild/openbsd-arm64": "0.25.4", + "@esbuild/openbsd-x64": "0.25.4", + "@esbuild/sunos-x64": "0.25.4", + "@esbuild/win32-arm64": "0.25.4", + "@esbuild/win32-ia32": "0.25.4", + "@esbuild/win32-x64": "0.25.4" + } + }, + "node_modules/esbuild-register": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/esbuild-register/-/esbuild-register-3.6.0.tgz", + "integrity": "sha512-H2/S7Pm8a9CL1uhp9OvjwrBh5Pvx0H8qVOxNu8Wed9Y7qv56MPtq+GGM8RJpq6glYJn9Wspr8uw7l55uyinNeg==", + "dependencies": { + "debug": "^4.3.4" + }, + "peerDependencies": { + "esbuild": ">=0.12 <1" + } + }, + "node_modules/esbuild-register/node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild-register/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -196,40 +359,44 @@ } }, "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==", + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", "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" + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.7.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.12", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" }, "engines": { - "node": ">= 18" + "node": ">= 0.10.0" }, "funding": { "type": "opencollective", @@ -237,16 +404,17 @@ } }, "node_modules/finalhandler": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz", - "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", "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" + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" }, "engines": { "node": ">= 0.8" @@ -261,11 +429,11 @@ } }, "node_modules/fresh": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", - "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", "engines": { - "node": ">= 0.8" + "node": ">= 0.6" } }, "node_modules/function-bind": { @@ -360,11 +528,11 @@ } }, "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==", + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" + "safer-buffer": ">= 2.1.2 < 3" }, "engines": { "node": ">=0.10.0" @@ -383,11 +551,6 @@ "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==" - }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", @@ -397,56 +560,80 @@ } }, "node_modules/media-typer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", - "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", "engines": { - "node": ">= 0.8" + "node": ">= 0.6" } }, "node_modules/merge-descriptors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", - "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", - "engines": { - "node": ">=18" - }, + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/mime-db": { - "version": "1.54.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", - "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "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==", + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dependencies": { - "mime-db": "^1.54.0" + "mime-db": "1.52.0" }, "engines": { "node": ">= 0.6" } }, "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==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, "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==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "engines": { "node": ">= 0.6" } }, + "node_modules/node-cron": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/node-cron/-/node-cron-4.0.5.tgz", + "integrity": "sha512-XN5PwNBniFz6y9Ic/VChtrBtlXfAqdKUFou7nid/1pLGNFKO7cXN1nmLKUL7KLnM/Y4nUe5/EC+GsAghCj/N5g==", + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/object-inspect": { "version": "1.13.4", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", @@ -469,14 +656,6 @@ "node": ">= 0.8" } }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dependencies": { - "wrappy": "1" - } - }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -486,12 +665,9 @@ } }, "node_modules/path-to-regexp": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz", - "integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==", - "engines": { - "node": ">=16" - } + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==" }, "node_modules/pg": { "version": "8.15.6", @@ -609,6 +785,33 @@ "node": ">=0.10.0" } }, + "node_modules/prisma": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.7.0.tgz", + "integrity": "sha512-vArg+4UqnQ13CVhc2WUosemwh6hr6cr6FY2uzDvCIFwH8pu8BXVv38PktoMLVjtX7sbYThxbnZF5YiR8sN2clw==", + "hasInstallScript": true, + "dependencies": { + "@prisma/config": "6.7.0", + "@prisma/engines": "6.7.0" + }, + "bin": { + "prisma": "build/index.js" + }, + "engines": { + "node": ">=18.18" + }, + "optionalDependencies": { + "fsevents": "2.3.3" + }, + "peerDependencies": { + "typescript": ">=5.1.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -622,11 +825,11 @@ } }, "node_modules/qs": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", - "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "dependencies": { - "side-channel": "^1.1.0" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" @@ -644,34 +847,19 @@ } }, "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==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", - "iconv-lite": "0.6.3", + "iconv-lite": "0.4.24", "unpipe": "1.0.0" }, "engines": { "node": ">= 0.8" } }, - "node_modules/router": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", - "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", - "dependencies": { - "debug": "^4.4.0", - "depd": "^2.0.0", - "is-promise": "^4.0.0", - "parseurl": "^1.3.3", - "path-to-regexp": "^8.0.0" - }, - "engines": { - "node": ">= 18" - } - }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -697,38 +885,53 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/send": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", - "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "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" + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" }, "engines": { - "node": ">= 18" + "node": ">= 0.8.0" } }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, "node_modules/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==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "dependencies": { - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "parseurl": "^1.3.3", - "send": "^1.2.0" + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" }, "engines": { - "node": ">= 18" + "node": ">= 0.8.0" } }, "node_modules/setprototypeof": { @@ -829,13 +1032,12 @@ } }, "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==", + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", "dependencies": { - "content-type": "^1.0.5", - "media-typer": "^1.1.0", - "mime-types": "^3.0.0" + "media-typer": "0.3.0", + "mime-types": "~2.1.24" }, "engines": { "node": ">= 0.6" @@ -849,6 +1051,14 @@ "node": ">= 0.8" } }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -857,11 +1067,6 @@ "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==" - }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/api/node_modules/accepts/HISTORY.md b/api/node_modules/accepts/HISTORY.md index 627a81d..cb5990c 100644 --- a/api/node_modules/accepts/HISTORY.md +++ b/api/node_modules/accepts/HISTORY.md @@ -1,10 +1,3 @@ -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 ================== diff --git a/api/node_modules/accepts/README.md b/api/node_modules/accepts/README.md index f3f10c4..82680c5 100644 --- a/api/node_modules/accepts/README.md +++ b/api/node_modules/accepts/README.md @@ -74,7 +74,7 @@ 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`. +that is not a full MIME types is passed to `require('mime-types').lookup`. #### .types() diff --git a/api/node_modules/accepts/index.js b/api/node_modules/accepts/index.js index 4f2840c..e9b2f63 100644 --- a/api/node_modules/accepts/index.js +++ b/api/node_modules/accepts/index.js @@ -229,7 +229,7 @@ function extToMime (type) { * Check if mime is valid. * * @param {String} type - * @return {Boolean} + * @return {String} * @private */ diff --git a/api/node_modules/accepts/package.json b/api/node_modules/accepts/package.json index b35b262..0f2d15d 100644 --- a/api/node_modules/accepts/package.json +++ b/api/node_modules/accepts/package.json @@ -1,7 +1,7 @@ { "name": "accepts", "description": "Higher-level content negotiation", - "version": "2.0.0", + "version": "1.3.8", "contributors": [ "Douglas Christopher Wilson ", "Jonathan Ong (http://jongleberry.com)" @@ -9,8 +9,8 @@ "license": "MIT", "repository": "jshttp/accepts", "dependencies": { - "mime-types": "^3.0.0", - "negotiator": "^1.0.0" + "mime-types": "~2.1.34", + "negotiator": "0.6.3" }, "devDependencies": { "deep-equal": "1.0.1", diff --git a/api/node_modules/body-parser/HISTORY.md b/api/node_modules/body-parser/HISTORY.md index 17dd110..81d23e0 100644 --- a/api/node_modules/body-parser/HISTORY.md +++ b/api/node_modules/body-parser/HISTORY.md @@ -1,69 +1,10 @@ -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 =================== diff --git a/api/node_modules/body-parser/README.md b/api/node_modules/body-parser/README.md index 9fcd4c6..f6661b7 100644 --- a/api/node_modules/body-parser/README.md +++ b/api/node_modules/body-parser/README.md @@ -51,12 +51,14 @@ $ npm install body-parser ## API ```js -const bodyParser = require('body-parser') +var bodyParser = require('body-parser') ``` The `bodyParser` object exposes various factories to create middlewares. All middlewares will populate the `req.body` property with the parsed body when -the `Content-Type` request header matches the `type` option. +the `Content-Type` request header matches the `type` option, or an empty +object (`{}`) if there was no body to parse, the `Content-Type` was not matched, +or an error occurred. The various errors returned by this module are described in the [errors section](#errors). @@ -65,8 +67,8 @@ The various errors returned by this module are described in the 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. +Unicode encoding of the body and supports automatic inflation of `gzip` and +`deflate` encodings. A new `body` object containing the parsed data is populated on the `request` object after the middleware (i.e. `req.body`). @@ -120,8 +122,7 @@ encoding of the request. The parsing can be aborted by throwing an error. 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. +parser supports automatic inflation of `gzip` and `deflate` encodings. A new `body` object containing the parsed data is populated on the `request` object after the middleware (i.e. `req.body`). This will be a `Buffer` object @@ -166,8 +167,7 @@ encoding of the request. The parsing can be aborted by throwing an error. 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. +parser supports automatic inflation of `gzip` and `deflate` encodings. A new `body` string containing the parsed data is populated on the `request` object after the middleware (i.e. `req.body`). This will be a string of the @@ -217,7 +217,7 @@ encoding of the request. The parsing can be aborted by throwing an error. 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. +inflation of `gzip` and `deflate` encodings. A new `body` object containing the parsed data is populated on the `request` object after the middleware (i.e. `req.body`). This object will contain @@ -231,12 +231,16 @@ 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). +The `extended` option allows to choose between parsing the URL-encoded data +with the `querystring` library (when `false`) or the `qs` library (when +`true`). The "extended" syntax allows for rich objects and arrays to be +encoded into the URL-encoded format, allowing for a JSON-like experience +with URL-encoded. For more information, please +[see the qs library](https://www.npmjs.org/package/qs#readme). -Defaults to `false`. +Defaults to `true`, but using the default has been deprecated. Please +research into the difference between `qs` and `querystring` and choose the +appropriate setting. ##### inflate @@ -274,23 +278,6 @@ 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. @@ -404,13 +391,13 @@ 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') +var express = require('express') +var bodyParser = require('body-parser') -const app = express() +var app = express() // parse application/x-www-form-urlencoded -app.use(bodyParser.urlencoded()) +app.use(bodyParser.urlencoded({ extended: false })) // parse application/json app.use(bodyParser.json()) @@ -418,7 +405,7 @@ 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))) + res.end(JSON.stringify(req.body, null, 2)) }) ``` @@ -429,26 +416,24 @@ 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') +var express = require('express') +var bodyParser = require('body-parser') -const app = express() +var app = express() // create application/json parser -const jsonParser = bodyParser.json() +var jsonParser = bodyParser.json() // create application/x-www-form-urlencoded parser -const urlencodedParser = bodyParser.urlencoded() +var urlencodedParser = bodyParser.urlencoded({ extended: false }) // 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 }) ``` @@ -459,10 +444,10 @@ 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') +var express = require('express') +var bodyParser = require('body-parser') -const app = express() +var app = express() // parse various different custom JSON types as JSON app.use(bodyParser.json({ type: 'application/*+json' })) diff --git a/api/node_modules/body-parser/index.js b/api/node_modules/body-parser/index.js index d722d0b..bb24d73 100644 --- a/api/node_modules/body-parser/index.js +++ b/api/node_modules/body-parser/index.js @@ -6,6 +6,20 @@ 'use strict' +/** + * Module dependencies. + * @private + */ + +var deprecate = require('depd')('body-parser') + +/** + * Cache of loaded parsers. + * @private + */ + +var parsers = Object.create(null) + /** * @typedef Parsers * @type {function} @@ -20,7 +34,8 @@ * @type {Parsers} */ -exports = module.exports = bodyParser +exports = module.exports = deprecate.function(bodyParser, + 'bodyParser: use individual json/urlencoded middlewares') /** * JSON parser. @@ -30,7 +45,7 @@ exports = module.exports = bodyParser Object.defineProperty(exports, 'json', { configurable: true, enumerable: true, - get: () => require('./lib/types/json') + get: createParserGetter('json') }) /** @@ -41,7 +56,7 @@ Object.defineProperty(exports, 'json', { Object.defineProperty(exports, 'raw', { configurable: true, enumerable: true, - get: () => require('./lib/types/raw') + get: createParserGetter('raw') }) /** @@ -52,7 +67,7 @@ Object.defineProperty(exports, 'raw', { Object.defineProperty(exports, 'text', { configurable: true, enumerable: true, - get: () => require('./lib/types/text') + get: createParserGetter('text') }) /** @@ -63,7 +78,7 @@ Object.defineProperty(exports, 'text', { Object.defineProperty(exports, 'urlencoded', { configurable: true, enumerable: true, - get: () => require('./lib/types/urlencoded') + get: createParserGetter('urlencoded') }) /** @@ -75,6 +90,67 @@ Object.defineProperty(exports, 'urlencoded', { * @public */ -function bodyParser () { - throw new Error('The bodyParser() generic has been split into individual middleware to use instead.') +function bodyParser (options) { + // use default type for parsers + var opts = Object.create(options || null, { + type: { + configurable: true, + enumerable: true, + value: undefined, + writable: true + } + }) + + var _urlencoded = exports.urlencoded(opts) + var _json = exports.json(opts) + + return function bodyParser (req, res, next) { + _json(req, res, function (err) { + if (err) return next(err) + _urlencoded(req, res, next) + }) + } +} + +/** + * Create a getter for loading a parser. + * @private + */ + +function createParserGetter (name) { + return function get () { + return loadParser(name) + } +} + +/** + * Load a parser module. + * @private + */ + +function loadParser (parserName) { + var parser = parsers[parserName] + + if (parser !== undefined) { + return parser + } + + // this uses a switch for static require analysis + switch (parserName) { + case 'json': + parser = require('./lib/types/json') + break + case 'raw': + parser = require('./lib/types/raw') + break + case 'text': + parser = require('./lib/types/text') + break + case 'urlencoded': + parser = require('./lib/types/urlencoded') + break + } + + // store to prevent invoking require() + return (parsers[parserName] = parser) } diff --git a/api/node_modules/body-parser/lib/read.js b/api/node_modules/body-parser/lib/read.js index eee8b11..fce6283 100644 --- a/api/node_modules/body-parser/lib/read.js +++ b/api/node_modules/body-parser/lib/read.js @@ -12,10 +12,12 @@ */ var createError = require('http-errors') +var destroy = require('destroy') var getBody = require('raw-body') var iconv = require('iconv-lite') var onFinished = require('on-finished') -var zlib = require('node:zlib') +var unpipe = require('unpipe') +var zlib = require('zlib') /** * Module exports. @@ -40,6 +42,9 @@ function read (req, res, next, parse, debug, options) { var opts = options var stream + // flag as parsed + req._body = true + // read options var encoding = opts.encoding !== null ? opts.encoding @@ -88,8 +93,8 @@ function read (req, res, next, parse, debug, options) { // unpipe from stream and destroy if (stream !== req) { - req.unpipe() - stream.destroy() + unpipe(req) + destroy(stream, true) } // read off entire request @@ -120,7 +125,7 @@ function read (req, res, next, parse, debug, options) { str = typeof body !== 'string' && encoding !== null ? iconv.decode(body, encoding) : body - req.body = parse(str, encoding) + req.body = parse(str) } catch (err) { next(createError(400, err, { body: str, @@ -146,6 +151,7 @@ function read (req, res, next, parse, debug, options) { function contentstream (req, debug, inflate) { var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase() var length = req.headers['content-length'] + var stream debug('content-encoding "%s"', encoding) @@ -156,40 +162,29 @@ function contentstream (req, debug, inflate) { }) } - 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': + stream = zlib.createInflate() debug('inflate body') - return zlib.createInflate() + req.pipe(stream) + break case 'gzip': + stream = zlib.createGunzip() debug('gunzip body') - return zlib.createGunzip() - case 'br': - debug('brotli decompress body') - return zlib.createBrotliDecompress() + req.pipe(stream) + break + case 'identity': + stream = req + stream.length = length + break default: throw createError(415, 'unsupported content encoding "' + encoding + '"', { encoding: encoding, type: 'encoding.unsupported' }) } + + return stream } /** diff --git a/api/node_modules/body-parser/lib/types/json.js b/api/node_modules/body-parser/lib/types/json.js index 078ce71..59f3f7e 100644 --- a/api/node_modules/body-parser/lib/types/json.js +++ b/api/node_modules/body-parser/lib/types/json.js @@ -12,12 +12,12 @@ * @private */ +var bytes = require('bytes') +var contentType = require('content-type') 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. @@ -51,10 +51,25 @@ var JSON_SYNTAX_REGEXP = /#+/g */ function json (options) { - var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'application/json') + var opts = options || {} - var reviver = options?.reviver - var strict = options?.strict !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var inflate = opts.inflate !== false + var reviver = opts.reviver + var strict = opts.strict !== false + var type = opts.type || 'application/json' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type function parse (body) { if (body.length === 0) { @@ -84,15 +99,13 @@ function json (options) { } return function jsonParser (req, res, next) { - if (isFinished(req)) { + if (req._body) { debug('body already parsed') next() return } - if (!('body' in req)) { - req.body = undefined - } + req.body = req.body || {} // skip requests without bodies if (!typeis.hasBody(req)) { @@ -124,9 +137,9 @@ function json (options) { // read read(req, res, next, parse, debug, { encoding: charset, - inflate, - limit, - verify + inflate: inflate, + limit: limit, + verify: verify }) } } @@ -180,6 +193,21 @@ function firstchar (str) { : undefined } +/** + * Get the charset of a request. + * + * @param {object} req + * @api private + */ + +function getCharset (req) { + try { + return (contentType.parse(req).parameters.charset || '').toLowerCase() + } catch (e) { + return undefined + } +} + /** * Normalize a SyntaxError for JSON.parse. * @@ -204,3 +232,16 @@ function normalizeJsonSyntaxError (error, obj) { return error } + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/api/node_modules/body-parser/lib/types/raw.js b/api/node_modules/body-parser/lib/types/raw.js index 3788ff2..f5d1b67 100644 --- a/api/node_modules/body-parser/lib/types/raw.js +++ b/api/node_modules/body-parser/lib/types/raw.js @@ -10,11 +10,10 @@ * Module dependencies. */ +var bytes = require('bytes') 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. @@ -31,22 +30,36 @@ module.exports = raw */ function raw (options) { - var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'application/octet-stream') + var opts = options || {} + + var inflate = opts.inflate !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var type = opts.type || 'application/octet-stream' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type function parse (buf) { return buf } return function rawParser (req, res, next) { - if (isFinished(req)) { + if (req._body) { debug('body already parsed') next() return } - if (!('body' in req)) { - req.body = undefined - } + req.body = req.body || {} // skip requests without bodies if (!typeis.hasBody(req)) { @@ -67,9 +80,22 @@ function raw (options) { // read read(req, res, next, parse, debug, { encoding: null, - inflate, - limit, - verify + inflate: inflate, + limit: limit, + verify: verify }) } } + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/api/node_modules/body-parser/lib/types/text.js b/api/node_modules/body-parser/lib/types/text.js index 3e0ab1b..083a009 100644 --- a/api/node_modules/body-parser/lib/types/text.js +++ b/api/node_modules/body-parser/lib/types/text.js @@ -10,11 +10,11 @@ * Module dependencies. */ +var bytes = require('bytes') +var contentType = require('content-type') 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. @@ -31,24 +31,37 @@ module.exports = text */ function text (options) { - var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'text/plain') + var opts = options || {} - var defaultCharset = options?.defaultCharset || 'utf-8' + var defaultCharset = opts.defaultCharset || 'utf-8' + var inflate = opts.inflate !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var type = opts.type || 'text/plain' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type function parse (buf) { return buf } return function textParser (req, res, next) { - if (isFinished(req)) { + if (req._body) { debug('body already parsed') next() return } - if (!('body' in req)) { - req.body = undefined - } + req.body = req.body || {} // skip requests without bodies if (!typeis.hasBody(req)) { @@ -72,9 +85,37 @@ function text (options) { // read read(req, res, next, parse, debug, { encoding: charset, - inflate, - limit, - verify + inflate: inflate, + limit: limit, + verify: verify }) } } + +/** + * Get the charset of a request. + * + * @param {object} req + * @api private + */ + +function getCharset (req) { + try { + return (contentType.parse(req).parameters.charset || '').toLowerCase() + } catch (e) { + return undefined + } +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/api/node_modules/body-parser/lib/types/urlencoded.js b/api/node_modules/body-parser/lib/types/urlencoded.js index f993425..2bd4485 100644 --- a/api/node_modules/body-parser/lib/types/urlencoded.js +++ b/api/node_modules/body-parser/lib/types/urlencoded.js @@ -12,13 +12,13 @@ * @private */ +var bytes = require('bytes') +var contentType = require('content-type') var createError = require('http-errors') var debug = require('debug')('body-parser:urlencoded') -var isFinished = require('on-finished').isFinished +var deprecate = require('depd')('body-parser') var read = require('../read') var typeis = require('type-is') -var qs = require('qs') -var { getCharset, normalizeOptions } = require('../utils') /** * Module exports. @@ -26,6 +26,12 @@ var { getCharset, normalizeOptions } = require('../utils') module.exports = urlencoded +/** + * Cache of parser modules. + */ + +var parsers = Object.create(null) + /** * Create a middleware to parse urlencoded bodies. * @@ -35,32 +41,52 @@ module.exports = urlencoded */ function urlencoded (options) { - var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'application/x-www-form-urlencoded') + var opts = options || {} - 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') + // notice because option default will flip in next major + if (opts.extended === undefined) { + deprecate('undefined extended: provide extended option') + } + + var extended = opts.extended !== false + var inflate = opts.inflate !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var type = opts.type || 'application/x-www-form-urlencoded' + var verify = opts.verify || false + var depth = typeof opts.depth !== 'number' + ? Number(opts.depth || 32) + : opts.depth + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') } // create the appropriate query parser - var queryparse = createQueryParser(options) + var queryparse = extended + ? extendedparser(opts) + : simpleparser(opts) - function parse (body, encoding) { + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (body) { return body.length - ? queryparse(body, encoding) + ? queryparse(body) : {} } return function urlencodedParser (req, res, next) { - if (isFinished(req)) { + if (req._body) { debug('body already parsed') next() return } - if (!('body' in req)) { - req.body = undefined - } + req.body = req.body || {} // skip requests without bodies if (!typeis.hasBody(req)) { @@ -79,8 +105,8 @@ function urlencoded (options) { } // assert charset - var charset = getCharset(req) || defaultCharset - if (charset !== 'utf-8' && charset !== 'iso-8859-1') { + var charset = getCharset(req) || 'utf-8' + if (charset !== 'utf-8') { debug('invalid charset') next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', { charset: charset, @@ -91,10 +117,12 @@ function urlencoded (options) { // read read(req, res, next, parse, debug, { + debug: debug, encoding: charset, - inflate, - limit, - verify + inflate: inflate, + limit: limit, + verify: verify, + depth: depth }) } } @@ -105,14 +133,15 @@ function urlencoded (options) { * @param {object} options */ -function createQueryParser (options) { - var extended = Boolean(options?.extended) - var parameterLimit = options?.parameterLimit !== undefined - ? options?.parameterLimit +function extendedparser (options) { + 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 + + var depth = typeof options.depth !== 'number' + ? Number(options.depth || 32) + : options.depth + var parse = parser('qs') if (isNaN(parameterLimit) || parameterLimit < 1) { throw new TypeError('option parameterLimit must be a positive number') @@ -126,7 +155,7 @@ function createQueryParser (options) { parameterLimit = parameterLimit | 0 } - return function queryparse (body, encoding) { + return function queryparse (body) { var paramCount = parameterCount(body, parameterLimit) if (paramCount === undefined) { @@ -136,19 +165,16 @@ function createQueryParser (options) { }) } - var arrayLimit = extended ? Math.max(100, paramCount) : 0 + var arrayLimit = Math.max(100, paramCount) - debug('parse ' + (extended ? 'extended ' : '') + 'urlencoding') + debug('parse extended urlencoding') try { - return qs.parse(body, { + return parse(body, { allowPrototypes: true, arrayLimit: arrayLimit, depth: depth, - charsetSentinel: charsetSentinel, - interpretNumericEntities: interpretNumericEntities, - charset: encoding, - parameterLimit: parameterLimit, - strictDepth: true + strictDepth: true, + parameterLimit: parameterLimit }) } catch (err) { if (err instanceof RangeError) { @@ -162,6 +188,21 @@ function createQueryParser (options) { } } +/** + * Get the charset of a request. + * + * @param {object} req + * @api private + */ + +function getCharset (req) { + try { + return (contentType.parse(req).parameters.charset || '').toLowerCase() + } catch (e) { + return undefined + } +} + /** * Count the number of parameters, stopping once limit reached * @@ -171,7 +212,96 @@ function createQueryParser (options) { */ function parameterCount (body, limit) { - var len = body.split('&').length + var count = 0 + var index = 0 - return len > limit ? undefined : len - 1 + while ((index = body.indexOf('&', index)) !== -1) { + count++ + index++ + + if (count === limit) { + return undefined + } + } + + return count +} + +/** + * Get parser for module name dynamically. + * + * @param {string} name + * @return {function} + * @api private + */ + +function parser (name) { + var mod = parsers[name] + + if (mod !== undefined) { + return mod.parse + } + + // this uses a switch for static require analysis + switch (name) { + case 'qs': + mod = require('qs') + break + case 'querystring': + mod = require('querystring') + break + } + + // store to prevent invoking require() + parsers[name] = mod + + return mod.parse +} + +/** + * Get the simple query parser. + * + * @param {object} options + */ + +function simpleparser (options) { + var parameterLimit = options.parameterLimit !== undefined + ? options.parameterLimit + : 1000 + var parse = parser('querystring') + + if (isNaN(parameterLimit) || parameterLimit < 1) { + throw new TypeError('option parameterLimit must be a positive number') + } + + if (isFinite(parameterLimit)) { + parameterLimit = parameterLimit | 0 + } + + return function queryparse (body) { + var paramCount = parameterCount(body, parameterLimit) + + if (paramCount === undefined) { + debug('too many parameters') + throw createError(413, 'too many parameters', { + type: 'parameters.too.many' + }) + } + + debug('parse urlencoding') + return parse(body, undefined, undefined, { maxKeys: parameterLimit }) + } +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } } diff --git a/api/node_modules/body-parser/lib/utils.js b/api/node_modules/body-parser/lib/utils.js deleted file mode 100644 index eee5d95..0000000 --- a/api/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/api/node_modules/body-parser/package.json b/api/node_modules/body-parser/package.json index e7f763b..3c9926f 100644 --- a/api/node_modules/body-parser/package.json +++ b/api/node_modules/body-parser/package.json @@ -1,7 +1,7 @@ { "name": "body-parser", "description": "Node.js body parsing middleware", - "version": "2.2.0", + "version": "1.20.3", "contributors": [ "Douglas Christopher Wilson ", "Jonathan Ong (http://jongleberry.com)" @@ -9,15 +9,18 @@ "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" + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" }, "devDependencies": { "eslint": "8.34.0", @@ -27,23 +30,27 @@ "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" + "methods": "1.1.2", + "mocha": "10.2.0", + "nyc": "15.1.0", + "safe-buffer": "5.2.1", + "supertest": "6.3.3" }, "files": [ "lib/", "LICENSE", "HISTORY.md", + "SECURITY.md", "index.js" ], "engines": { - "node": ">=18" + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" }, "scripts": { "lint": "eslint .", - "test": "mocha --reporter spec --check-leaks test/", - "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test": "mocha --require test/support/env --reporter spec --check-leaks --bail test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", "test-cov": "nyc --reporter=html --reporter=text npm test" } } diff --git a/api/node_modules/content-disposition/HISTORY.md b/api/node_modules/content-disposition/HISTORY.md index ff0b68b..488effa 100644 --- a/api/node_modules/content-disposition/HISTORY.md +++ b/api/node_modules/content-disposition/HISTORY.md @@ -1,9 +1,3 @@ -1.0.0 / 2024-08-31 -================== - - * drop node <18 - * allow utf8 as alias for utf-8 - 0.5.4 / 2021-12-10 ================== diff --git a/api/node_modules/content-disposition/index.js b/api/node_modules/content-disposition/index.js index 44f1d51..ecec899 100644 --- a/api/node_modules/content-disposition/index.js +++ b/api/node_modules/content-disposition/index.js @@ -243,7 +243,7 @@ function format (obj) { for (var i = 0; i < params.length; i++) { param = params[i] - var val = param.slice(-1) === '*' + var val = param.substr(-1) === '*' ? ustring(parameters[param]) : qstring(parameters[param]) @@ -281,7 +281,6 @@ function decodefield (str) { value = getlatin1(binary) break case 'utf-8': - case 'utf8': value = Buffer.from(binary, 'binary').toString('utf8') break default: @@ -333,7 +332,7 @@ function parse (string) { var value // calculate index to start at - index = PARAM_REGEXP.lastIndex = match[0].slice(-1) === ';' + index = PARAM_REGEXP.lastIndex = match[0].substr(-1) === ';' ? index - 1 : index @@ -370,7 +369,7 @@ function parse (string) { if (value[0] === '"') { // remove quotes and escapes value = value - .slice(1, -1) + .substr(1, value.length - 2) .replace(QESC_REGEXP, '$1') } diff --git a/api/node_modules/content-disposition/package.json b/api/node_modules/content-disposition/package.json index 5cea50b..43c70ce 100644 --- a/api/node_modules/content-disposition/package.json +++ b/api/node_modules/content-disposition/package.json @@ -1,7 +1,7 @@ { "name": "content-disposition", "description": "Create and parse Content-Disposition header", - "version": "1.0.0", + "version": "0.5.4", "author": "Douglas Christopher Wilson ", "license": "MIT", "keywords": [ @@ -23,8 +23,8 @@ "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" + "istanbul": "0.4.5", + "mocha": "9.1.3" }, "files": [ "LICENSE", @@ -38,7 +38,7 @@ "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" + "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" } } diff --git a/api/node_modules/cookie-signature/History.md b/api/node_modules/cookie-signature/History.md index 479211a..78513cc 100644 --- a/api/node_modules/cookie-signature/History.md +++ b/api/node_modules/cookie-signature/History.md @@ -1,35 +1,3 @@ -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 ================== diff --git a/api/node_modules/cookie-signature/LICENSE b/api/node_modules/cookie-signature/LICENSE deleted file mode 100644 index a2671bf..0000000 --- a/api/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/api/node_modules/cookie-signature/Readme.md b/api/node_modules/cookie-signature/Readme.md index 369af15..2559e84 100644 --- a/api/node_modules/cookie-signature/Readme.md +++ b/api/node_modules/cookie-signature/Readme.md @@ -16,8 +16,27 @@ cookie.unsign(val, 'tobiiscool').should.equal('hello'); cookie.unsign(val, 'luna').should.be.false; ``` -## License +## License -MIT. +(The MIT License) -See LICENSE file for details. +Copyright (c) 2012 LearnBoost <tj@learnboost.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/api/node_modules/cookie-signature/index.js b/api/node_modules/cookie-signature/index.js index 3fbbddb..b8c9463 100644 --- a/api/node_modules/cookie-signature/index.js +++ b/api/node_modules/cookie-signature/index.js @@ -8,14 +8,14 @@ var crypto = require('crypto'); * Sign the given `val` with `secret`. * * @param {String} val - * @param {String|NodeJS.ArrayBufferView|crypto.KeyObject} secret + * @param {String} secret * @return {String} * @api private */ exports.sign = function(val, secret){ if ('string' != typeof val) throw new TypeError("Cookie value must be provided as a string."); - if (null == secret) throw new TypeError("Secret key must be provided."); + if ('string' != typeof secret) throw new TypeError("Secret string must be provided."); return val + '.' + crypto .createHmac('sha256', secret) .update(val) @@ -24,24 +24,28 @@ exports.sign = function(val, secret){ }; /** - * Unsign and decode the given `input` with `secret`, + * Unsign and decode the given `val` with `secret`, * returning `false` if the signature is invalid. * - * @param {String} input - * @param {String|NodeJS.ArrayBufferView|crypto.KeyObject} secret + * @param {String} val + * @param {String} 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; +exports.unsign = function(val, secret){ + if ('string' != typeof val) throw new TypeError("Signed cookie string must be provided."); + if ('string' != typeof secret) throw new TypeError("Secret string must be provided."); + var str = val.slice(0, val.lastIndexOf('.')) + , mac = exports.sign(str, secret); + + return sha1(mac) == sha1(val) ? str : false; }; + +/** + * Private + */ + +function sha1(str){ + return crypto.createHash('sha1').update(str).digest('hex'); +} diff --git a/api/node_modules/cookie-signature/package.json b/api/node_modules/cookie-signature/package.json index a160040..29c4498 100644 --- a/api/node_modules/cookie-signature/package.json +++ b/api/node_modules/cookie-signature/package.json @@ -1,24 +1,18 @@ { "name": "cookie-signature", - "version": "1.2.2", - "main": "index.js", + "version": "1.0.6", "description": "Sign and unsign cookies", "keywords": ["cookie", "sign", "unsign"], "author": "TJ Holowaychuk ", "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/visionmedia/node-cookie-signature.git" - }, + "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" - } + }, + "main": "index" } diff --git a/api/node_modules/cookie/index.js b/api/node_modules/cookie/index.js index acd5acd..51a58cb 100644 --- a/api/node_modules/cookie/index.js +++ b/api/node_modules/cookie/index.js @@ -21,7 +21,6 @@ exports.serialize = serialize; */ var __toString = Object.prototype.toString -var __hasOwnProperty = Object.prototype.hasOwnProperty /** * RegExp to match cookie-name in RFC 6265 sec 4.1.1 @@ -131,7 +130,7 @@ function parse(str, opt) { var key = str.slice(keyStartIdx, keyEndIdx); // only assign once - if (!__hasOwnProperty.call(obj, key)) { + if (!obj.hasOwnProperty(key)) { var valStartIdx = startIndex(str, eqIdx + 1, endIdx); var valEndIdx = endIndex(str, endIdx, valStartIdx); diff --git a/api/node_modules/cookie/package.json b/api/node_modules/cookie/package.json index 22e3f92..f498ea7 100644 --- a/api/node_modules/cookie/package.json +++ b/api/node_modules/cookie/package.json @@ -1,7 +1,7 @@ { "name": "cookie", "description": "HTTP server cookie parsing and serialization", - "version": "0.7.2", + "version": "0.7.1", "author": "Roman Shtylman ", "contributors": [ "Douglas Christopher Wilson " diff --git a/api/node_modules/debug/LICENSE b/api/node_modules/debug/LICENSE index 1a9820e..658c933 100644 --- a/api/node_modules/debug/LICENSE +++ b/api/node_modules/debug/LICENSE @@ -1,20 +1,19 @@ (The MIT License) -Copyright (c) 2014-2017 TJ Holowaychuk -Copyright (c) 2018-2021 Josh Junon +Copyright (c) 2014 TJ Holowaychuk -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, +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 +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 +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/api/node_modules/debug/README.md b/api/node_modules/debug/README.md index 9ebdfbf..f67be6b 100644 --- a/api/node_modules/debug/README.md +++ b/api/node_modules/debug/README.md @@ -1,11 +1,12 @@ # debug -[![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) [![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) - -A tiny JavaScript debugging utility modelled after Node.js core's debugging -technique. Works in Node.js and web browsers. + +A tiny node.js debugging utility modelled after node core's debugging technique. + +**Discussion around the V3 API is under way [here](https://github.com/visionmedia/debug/issues/370)** ## Installation @@ -17,7 +18,7 @@ $ npm install debug `debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. -Example [_app.js_](./examples/node/app.js): +Example _app.js_: ```js var debug = require('debug')('http') @@ -26,7 +27,7 @@ var debug = require('debug')('http') // fake app -debug('booting %o', name); +debug('booting %s', name); http.createServer(function(req, res){ debug(req.method + ' ' + req.url); @@ -40,148 +41,81 @@ http.createServer(function(req, res){ require('./worker'); ``` -Example [_worker.js_](./examples/node/worker.js): +Example _worker.js_: ```js -var a = require('debug')('worker:a') - , b = require('debug')('worker:b'); +var debug = require('debug')('worker'); -function work() { - a('doing lots of uninteresting work'); - setTimeout(work, Math.random() * 1000); -} - -work(); - -function workb() { - b('doing some work'); - setTimeout(workb, Math.random() * 2000); -} - -workb(); +setInterval(function(){ + debug('doing some work'); +}, 1000); ``` -The `DEBUG` environment variable is then used to enable these based on space or -comma-delimited names. + The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: -Here are some examples: + ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) -screen shot 2017-08-08 at 12 53 04 pm -screen shot 2017-08-08 at 12 53 38 pm -screen shot 2017-08-08 at 12 53 25 pm + ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) -#### Windows command prompt notes +#### Windows note -##### CMD + On Windows the environment variable is set using the `set` command. -On Windows the environment variable is set using the `set` command. + ```cmd + set DEBUG=*,-not_this + ``` -```cmd -set DEBUG=*,-not_this -``` + Note that PowerShell uses different syntax to set environment variables. -Example: - -```cmd -set DEBUG=* & node app.js -``` - -##### PowerShell (VS Code default) - -PowerShell uses different syntax to set environment variables. - -```cmd -$env:DEBUG = "*,-not_this" -``` - -Example: - -```cmd -$env:DEBUG='app';node app.js -``` + ```cmd + $env:DEBUG = "*,-not_this" + ``` Then, run the program to be debugged as usual. -npm script example: -```js - "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", -``` - -## Namespace Colors - -Every debug instance has a color generated for it based on its namespace name. -This helps when visually parsing the debug output to identify which debug instance -a debug line belongs to. - -#### Node.js - -In Node.js, colors are enabled when stderr is a TTY. You also _should_ install -the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, -otherwise debug will only use a small handful of basic colors. - - - -#### Web Browser - -Colors are also enabled on "Web Inspectors" that understand the `%c` formatting -option. These are WebKit web inspectors, Firefox ([since version -31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) -and the Firebug plugin for Firefox (any version). - - - - ## Millisecond diff -When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - + ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) -When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: - - + When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: + ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) ## Conventions -If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". ## Wildcards -The `*` character may be used as a wildcard. Suppose for example your library has -debuggers named "connect:bodyParser", "connect:compress", "connect:session", -instead of listing all three with -`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do -`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. -You can also exclude specific debuggers by prefixing them with a "-" character. -For example, `DEBUG=*,-connect:*` would include all debuggers except those -starting with "connect:". + You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". ## Environment Variables -When running through Node.js, you can set a few environment variables that will -change the behavior of the debug logging: + When running through Node.js, you can set a few environment variables that will + change the behavior of the debug logging: | Name | Purpose | |-----------|-------------------------------------------------| | `DEBUG` | Enables/disables specific debugging namespaces. | -| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | | `DEBUG_COLORS`| Whether or not to use colors in the debug output. | -| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_DEPTH` | Object inspection depth. | | `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | -__Note:__ The environment variables beginning with `DEBUG_` end up being -converted into an Options object that gets used with `%o`/`%O` formatters. -See the Node.js documentation for -[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) -for the complete list. + __Note:__ The environment variables beginning with `DEBUG_` end up being + converted into an Options object that gets used with `%o`/`%O` formatters. + See the Node.js documentation for + [`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) + for the complete list. ## Formatters -Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. -Below are the officially supported formatters: + + Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. Below are the officially supported formatters: | Formatter | Representation | |-----------|----------------| @@ -192,12 +126,9 @@ Below are the officially supported formatters: | `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | | `%%` | Single percent sign ('%'). This does not consume an argument. | - ### Custom formatters -You can add custom formatters by extending the `debug.formatters` object. -For example, if you wanted to add support for rendering a Buffer as hex with -`%h`, you could do something like: + You can add custom formatters by extending the `debug.formatters` object. For example, if you wanted to add support for rendering a Buffer as hex with `%h`, you could do something like: ```js const createDebug = require('debug') @@ -211,16 +142,14 @@ debug('this is hex: %h', new Buffer('hello world')) // foo this is hex: 68656c6c6f20776f726c6421 +0ms ``` +## Browser support + You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), + or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), + if you don't want to build it yourself. -## Browser Support - -You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), -or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), -if you don't want to build it yourself. - -Debug's enable state is currently persisted by `localStorage`. -Consider the situation shown below where you have `worker:a` and `worker:b`, -and wish to debug both. You can enable this using `localStorage.debug`: + Debug's enable state is currently persisted by `localStorage`. + Consider the situation shown below where you have `worker:a` and `worker:b`, + and wish to debug both. You can enable this using `localStorage.debug`: ```js localStorage.debug = 'worker:*' @@ -241,15 +170,23 @@ setInterval(function(){ }, 1200); ``` -In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_. +#### Web Inspector Colors + + Colors are also enabled on "Web Inspectors" that understand the `%c` formatting + option. These are WebKit web inspectors, Firefox ([since version + 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) + and the Firebug plugin for Firefox (any version). + + Colored output looks something like: + + ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) - ## Output streams By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: -Example [_stdout.js_](./examples/node/stdout.js): +Example _stdout.js_: ```js var debug = require('debug'); @@ -271,118 +208,13 @@ error('now goes to stdout via console.info'); log('still goes to stdout, but via console.info now'); ``` -## Extend -You can simply extend debugger -```js -const log = require('debug')('auth'); - -//creates new debug instance with extended namespace -const logSign = log.extend('sign'); -const logLogin = log.extend('login'); - -log('hello'); // auth hello -logSign('hello'); //auth:sign hello -logLogin('hello'); //auth:login hello -``` - -## Set dynamically - -You can also enable debug dynamically by calling the `enable()` method : - -```js -let debug = require('debug'); - -console.log(1, debug.enabled('test')); - -debug.enable('test'); -console.log(2, debug.enabled('test')); - -debug.disable(); -console.log(3, debug.enabled('test')); - -``` - -print : -``` -1 false -2 true -3 false -``` - -Usage : -`enable(namespaces)` -`namespaces` can include modes separated by a colon and wildcards. - -Note that calling `enable()` completely overrides previously set DEBUG variable : - -``` -$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' -=> false -``` - -`disable()` - -Will disable all namespaces. The functions returns the namespaces currently -enabled (and skipped). This can be useful if you want to disable debugging -temporarily without knowing what was enabled to begin with. - -For example: - -```js -let debug = require('debug'); -debug.enable('foo:*,-foo:bar'); -let namespaces = debug.disable(); -debug.enable(namespaces); -``` - -Note: There is no guarantee that the string will be identical to the initial -enable string, but semantically they will be identical. - -## Checking whether a debug target is enabled - -After you've created a debug instance, you can determine whether or not it is -enabled by checking the `enabled` property: - -```javascript -const debug = require('debug')('http'); - -if (debug.enabled) { - // do stuff... -} -``` - -You can also manually toggle this property to force the debug instance to be -enabled or disabled. - -## Usage in child processes - -Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process. -For example: - -```javascript -worker = fork(WORKER_WRAP_PATH, [workerPath], { - stdio: [ - /* stdin: */ 0, - /* stdout: */ 'pipe', - /* stderr: */ 'pipe', - 'ipc', - ], - env: Object.assign({}, process.env, { - DEBUG_COLORS: 1 // without this settings, colors won't be shown - }), -}); - -worker.stderr.pipe(process.stderr, { end: false }); -``` - ## Authors - TJ Holowaychuk - Nathan Rajlich - Andrew Rhyne - - Josh Junon - + ## Backers Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] @@ -458,8 +290,7 @@ Become a sponsor and get your logo on our README on Github with a link to your s (The MIT License) -Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> -Copyright (c) 2018-2021 Josh Junon +Copyright (c) 2014-2016 TJ Holowaychuk <tj@vision-media.ca> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/api/node_modules/debug/package.json b/api/node_modules/debug/package.json index 60dfcf5..dc787ba 100644 --- a/api/node_modules/debug/package.json +++ b/api/node_modules/debug/package.json @@ -1,65 +1,49 @@ { "name": "debug", - "version": "4.4.0", + "version": "2.6.9", "repository": { "type": "git", - "url": "git://github.com/debug-js/debug.git" + "url": "git://github.com/visionmedia/debug.git" }, - "description": "Lightweight debugging utility for Node.js and the browser", + "description": "small debugging utility", "keywords": [ "debug", "log", "debugger" ], - "files": [ - "src", - "LICENSE", - "README.md" - ], - "author": "Josh Junon (https://github.com/qix-)", + "author": "TJ Holowaychuk ", "contributors": [ - "TJ Holowaychuk ", "Nathan Rajlich (http://n8.io)", "Andrew Rhyne " ], "license": "MIT", - "scripts": { - "lint": "xo", - "test": "npm run test:node && npm run test:browser && npm run lint", - "test:node": "istanbul cover _mocha -- test.js test.node.js", - "test:browser": "karma start --single-run", - "test:coverage": "cat ./coverage/lcov.info | coveralls" - }, "dependencies": { - "ms": "^2.1.3" + "ms": "2.0.0" }, "devDependencies": { - "brfs": "^2.0.1", - "browserify": "^16.2.3", - "coveralls": "^3.0.2", + "browserify": "9.0.3", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^2.11.15", + "eslint": "^3.12.1", "istanbul": "^0.4.5", - "karma": "^3.1.4", - "karma-browserify": "^6.0.0", - "karma-chrome-launcher": "^2.2.0", + "karma": "^1.3.0", + "karma-chai": "^0.1.0", "karma-mocha": "^1.3.0", - "mocha": "^5.2.0", + "karma-phantomjs-launcher": "^1.0.2", + "karma-sinon": "^1.0.5", + "mocha": "^3.2.0", "mocha-lcov-reporter": "^1.2.0", - "sinon": "^14.0.0", - "xo": "^0.23.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "rimraf": "^2.5.4", + "sinon": "^1.17.6", + "sinon-chai": "^2.8.0" }, "main": "./src/index.js", "browser": "./src/browser.js", - "engines": { - "node": ">=6.0" - }, - "xo": { - "rules": { - "import/extensions": "off" + "component": { + "scripts": { + "debug/index.js": "browser.js", + "debug/debug.js": "debug.js" } } } diff --git a/api/node_modules/debug/src/browser.js b/api/node_modules/debug/src/browser.js index df8e179..7106924 100644 --- a/api/node_modules/debug/src/browser.js +++ b/api/node_modules/debug/src/browser.js @@ -1,106 +1,31 @@ -/* eslint-env browser */ - /** * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. */ +exports = module.exports = require('./debug'); +exports.log = log; exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; -exports.storage = localstorage(); -exports.destroy = (() => { - let warned = false; - - return () => { - if (!warned) { - warned = true; - console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); - } - }; -})(); +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); /** * Colors. */ exports.colors = [ - '#0000CC', - '#0000FF', - '#0033CC', - '#0033FF', - '#0066CC', - '#0066FF', - '#0099CC', - '#0099FF', - '#00CC00', - '#00CC33', - '#00CC66', - '#00CC99', - '#00CCCC', - '#00CCFF', - '#3300CC', - '#3300FF', - '#3333CC', - '#3333FF', - '#3366CC', - '#3366FF', - '#3399CC', - '#3399FF', - '#33CC00', - '#33CC33', - '#33CC66', - '#33CC99', - '#33CCCC', - '#33CCFF', - '#6600CC', - '#6600FF', - '#6633CC', - '#6633FF', - '#66CC00', - '#66CC33', - '#9900CC', - '#9900FF', - '#9933CC', - '#9933FF', - '#99CC00', - '#99CC33', - '#CC0000', - '#CC0033', - '#CC0066', - '#CC0099', - '#CC00CC', - '#CC00FF', - '#CC3300', - '#CC3333', - '#CC3366', - '#CC3399', - '#CC33CC', - '#CC33FF', - '#CC6600', - '#CC6633', - '#CC9900', - '#CC9933', - '#CCCC00', - '#CCCC33', - '#FF0000', - '#FF0033', - '#FF0066', - '#FF0099', - '#FF00CC', - '#FF00FF', - '#FF3300', - '#FF3333', - '#FF3366', - '#FF3399', - '#FF33CC', - '#FF33FF', - '#FF6600', - '#FF6633', - '#FF9900', - '#FF9933', - '#FFCC00', - '#FFCC33' + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' ]; /** @@ -111,35 +36,39 @@ exports.colors = [ * TODO: add a `localStorage` variable to explicitly enable/disable colors */ -// eslint-disable-next-line complexity function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { - return true; - } + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { + return true; + } - // Internet Explorer and Edge do not support colors. - if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } - - let m; - - // Is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - // eslint-disable-next-line no-return-assign - return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || - // Is firebug? http://stackoverflow.com/a/398120/376773 - (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || - // Is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) || - // Double check webkit in userAgent just in case we are in a worker - (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); + // is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); } +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } +}; + + /** * Colorize log arguments if enabled. * @@ -147,49 +76,52 @@ function useColors() { */ function formatArgs(args) { - args[0] = (this.useColors ? '%c' : '') + - this.namespace + - (this.useColors ? ' %c' : ' ') + - args[0] + - (this.useColors ? '%c ' : ' ') + - '+' + module.exports.humanize(this.diff); + var useColors = this.useColors; - if (!this.useColors) { - return; - } + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); - const c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit'); + if (!useColors) return; - // The final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - let index = 0; - let lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, match => { - if (match === '%%') { - return; - } - index++; - if (match === '%c') { - // We only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit') - args.splice(lastC, 0, c); + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); } /** - * Invokes `console.debug()` when available. - * No-op when `console.debug` is not a "function". - * If `console.debug` is not available, falls back - * to `console.log`. + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". * * @api public */ -exports.log = console.debug || console.log || (() => {}); + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} /** * Save `namespaces`. @@ -197,17 +129,15 @@ exports.log = console.debug || console.log || (() => {}); * @param {String} namespaces * @api private */ + function save(namespaces) { - try { - if (namespaces) { - exports.storage.setItem('debug', namespaces); - } else { - exports.storage.removeItem('debug'); - } - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} } /** @@ -216,23 +146,27 @@ function save(namespaces) { * @return {String} returns the previously persisted debug modes * @api private */ + function load() { - let r; - try { - r = exports.storage.getItem('debug'); - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } + var r; + try { + r = exports.storage.debug; + } catch(e) {} - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } - return r; + return r; } +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + /** * Localstorage attempts to return the localstorage. * @@ -245,28 +179,7 @@ function load() { */ function localstorage() { - try { - // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context - // The Browser also has localStorage in the global context. - return localStorage; - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } + try { + return window.localStorage; + } catch (e) {} } - -module.exports = require('./common')(exports); - -const {formatters} = module.exports; - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -formatters.j = function (v) { - try { - return JSON.stringify(v); - } catch (error) { - return '[UnexpectedJSONParseError]: ' + error.message; - } -}; diff --git a/api/node_modules/debug/src/common.js b/api/node_modules/debug/src/common.js deleted file mode 100644 index 528c7ec..0000000 --- a/api/node_modules/debug/src/common.js +++ /dev/null @@ -1,292 +0,0 @@ - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - */ - -function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = require('ms'); - createDebug.destroy = destroy; - - Object.keys(env).forEach(key => { - createDebug[key] = env[key]; - }); - - /** - * The currently active debug mode names, and names to skip. - */ - - createDebug.names = []; - createDebug.skips = []; - - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ - createDebug.formatters = {}; - - /** - * Selects a color for a debug namespace - * @param {String} namespace The namespace string for the debug instance to be colored - * @return {Number|String} An ANSI color code for the given namespace - * @api private - */ - function selectColor(namespace) { - let hash = 0; - - for (let i = 0; i < namespace.length; i++) { - hash = ((hash << 5) - hash) + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } - - return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; - } - createDebug.selectColor = selectColor; - - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - function createDebug(namespace) { - let prevTime; - let enableOverride = null; - let namespacesCache; - let enabledCache; - - function debug(...args) { - // Disabled? - if (!debug.enabled) { - return; - } - - const self = debug; - - // Set `diff` timestamp - const curr = Number(new Date()); - const ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - args[0] = createDebug.coerce(args[0]); - - if (typeof args[0] !== 'string') { - // Anything else let's inspect with %O - args.unshift('%O'); - } - - // Apply any `formatters` transformations - let index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { - // If we encounter an escaped % then don't increase the array index - if (match === '%%') { - return '%'; - } - index++; - const formatter = createDebug.formatters[format]; - if (typeof formatter === 'function') { - const val = args[index]; - match = formatter.call(self, val); - - // Now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - // Apply env-specific formatting (colors, etc.) - createDebug.formatArgs.call(self, args); - - const logFn = self.log || createDebug.log; - logFn.apply(self, args); - } - - debug.namespace = namespace; - debug.useColors = createDebug.useColors(); - debug.color = createDebug.selectColor(namespace); - debug.extend = extend; - debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. - - Object.defineProperty(debug, 'enabled', { - enumerable: true, - configurable: false, - get: () => { - if (enableOverride !== null) { - return enableOverride; - } - if (namespacesCache !== createDebug.namespaces) { - namespacesCache = createDebug.namespaces; - enabledCache = createDebug.enabled(namespace); - } - - return enabledCache; - }, - set: v => { - enableOverride = v; - } - }); - - // Env-specific initialization logic for debug instances - if (typeof createDebug.init === 'function') { - createDebug.init(debug); - } - - return debug; - } - - function extend(namespace, delimiter) { - const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); - newDebug.log = this.log; - return newDebug; - } - - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - function enable(namespaces) { - createDebug.save(namespaces); - createDebug.namespaces = namespaces; - - createDebug.names = []; - createDebug.skips = []; - - const split = (typeof namespaces === 'string' ? namespaces : '') - .trim() - .replace(' ', ',') - .split(',') - .filter(Boolean); - - for (const ns of split) { - if (ns[0] === '-') { - createDebug.skips.push(ns.slice(1)); - } else { - createDebug.names.push(ns); - } - } - } - - /** - * Checks if the given string matches a namespace template, honoring - * asterisks as wildcards. - * - * @param {String} search - * @param {String} template - * @return {Boolean} - */ - function matchesTemplate(search, template) { - let searchIndex = 0; - let templateIndex = 0; - let starIndex = -1; - let matchIndex = 0; - - while (searchIndex < search.length) { - if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) { - // Match character or proceed with wildcard - if (template[templateIndex] === '*') { - starIndex = templateIndex; - matchIndex = searchIndex; - templateIndex++; // Skip the '*' - } else { - searchIndex++; - templateIndex++; - } - } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition - // Backtrack to the last '*' and try to match more characters - templateIndex = starIndex + 1; - matchIndex++; - searchIndex = matchIndex; - } else { - return false; // No match - } - } - - // Handle trailing '*' in template - while (templateIndex < template.length && template[templateIndex] === '*') { - templateIndex++; - } - - return templateIndex === template.length; - } - - /** - * Disable debug output. - * - * @return {String} namespaces - * @api public - */ - function disable() { - const namespaces = [ - ...createDebug.names, - ...createDebug.skips.map(namespace => '-' + namespace) - ].join(','); - createDebug.enable(''); - return namespaces; - } - - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - function enabled(name) { - for (const skip of createDebug.skips) { - if (matchesTemplate(name, skip)) { - return false; - } - } - - for (const ns of createDebug.names) { - if (matchesTemplate(name, ns)) { - return true; - } - } - - return false; - } - - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - return val; - } - - /** - * XXX DO NOT USE. This is a temporary stub function. - * XXX It WILL be removed in the next major release. - */ - function destroy() { - console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); - } - - createDebug.enable(createDebug.load()); - - return createDebug; -} - -module.exports = setup; diff --git a/api/node_modules/debug/src/index.js b/api/node_modules/debug/src/index.js index bf4c57f..e12cf4d 100644 --- a/api/node_modules/debug/src/index.js +++ b/api/node_modules/debug/src/index.js @@ -1,10 +1,10 @@ /** - * Detect Electron renderer / nwjs process, which is node, but we should + * Detect Electron renderer process, which is node, but we should * treat as a browser. */ -if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { - module.exports = require('./browser.js'); +if (typeof process !== 'undefined' && process.type === 'renderer') { + module.exports = require('./browser.js'); } else { - module.exports = require('./node.js'); + module.exports = require('./node.js'); } diff --git a/api/node_modules/debug/src/node.js b/api/node_modules/debug/src/node.js index 715560a..b15109c 100644 --- a/api/node_modules/debug/src/node.js +++ b/api/node_modules/debug/src/node.js @@ -2,23 +2,22 @@ * Module dependencies. */ -const tty = require('tty'); -const util = require('util'); +var tty = require('tty'); +var util = require('util'); /** * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. */ +exports = module.exports = require('./debug'); exports.init = init; exports.log = log; exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; -exports.destroy = util.deprecate( - () => {}, - 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' -); /** * Colors. @@ -26,138 +25,80 @@ exports.destroy = util.deprecate( exports.colors = [6, 2, 3, 4, 5, 1]; -try { - // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) - // eslint-disable-next-line import/no-extraneous-dependencies - const supportsColor = require('supports-color'); - - if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { - exports.colors = [ - 20, - 21, - 26, - 27, - 32, - 33, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 56, - 57, - 62, - 63, - 68, - 69, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 92, - 93, - 98, - 99, - 112, - 113, - 128, - 129, - 134, - 135, - 148, - 149, - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 168, - 169, - 170, - 171, - 172, - 173, - 178, - 179, - 184, - 185, - 196, - 197, - 198, - 199, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - 208, - 209, - 214, - 215, - 220, - 221 - ]; - } -} catch (error) { - // Swallow - we only care if `supports-color` is available; it doesn't have to be. -} - /** * Build up the default `inspectOpts` object from the environment variables. * * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js */ -exports.inspectOpts = Object.keys(process.env).filter(key => { - return /^debug_/i.test(key); -}).reduce((obj, key) => { - // Camel-case - const prop = key - .substring(6) - .toLowerCase() - .replace(/_([a-z])/g, (_, k) => { - return k.toUpperCase(); - }); +exports.inspectOpts = Object.keys(process.env).filter(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // camel-case + var prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); - // Coerce string value into JS value - let val = process.env[key]; - if (/^(yes|on|true|enabled)$/i.test(val)) { - val = true; - } else if (/^(no|off|false|disabled)$/i.test(val)) { - val = false; - } else if (val === 'null') { - val = null; - } else { - val = Number(val); - } + // coerce string value into JS value + var val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) val = true; + else if (/^(no|off|false|disabled)$/i.test(val)) val = false; + else if (val === 'null') val = null; + else val = Number(val); - obj[prop] = val; - return obj; + obj[prop] = val; + return obj; }, {}); +/** + * The file descriptor to write the `debug()` calls to. + * Set the `DEBUG_FD` env variable to override with another value. i.e.: + * + * $ DEBUG_FD=3 node script.js 3>debug.log + */ + +var fd = parseInt(process.env.DEBUG_FD, 10) || 2; + +if (1 !== fd && 2 !== fd) { + util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')() +} + +var stream = 1 === fd ? process.stdout : + 2 === fd ? process.stderr : + createWritableStdioStream(fd); + /** * Is stdout a TTY? Colored output is enabled when `true`. */ function useColors() { - return 'colors' in exports.inspectOpts ? - Boolean(exports.inspectOpts.colors) : - tty.isatty(process.stderr.fd); + return 'colors' in exports.inspectOpts + ? Boolean(exports.inspectOpts.colors) + : tty.isatty(fd); } +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +exports.formatters.o = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n').map(function(str) { + return str.trim() + }).join(' '); +}; + +/** + * Map %o to `util.inspect()`, allowing multiple lines if needed. + */ + +exports.formatters.O = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + /** * Adds ANSI color escape codes if enabled. * @@ -165,33 +106,27 @@ function useColors() { */ function formatArgs(args) { - const {namespace: name, useColors} = this; + var name = this.namespace; + var useColors = this.useColors; - if (useColors) { - const c = this.color; - const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); - const prefix = ` ${colorCode};1m${name} \u001B[0m`; + if (useColors) { + var c = this.color; + var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m'; - args[0] = prefix + args[0].split('\n').join('\n' + prefix); - args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); - } else { - args[0] = getDate() + name + ' ' + args[0]; - } -} - -function getDate() { - if (exports.inspectOpts.hideDate) { - return ''; - } - return new Date().toISOString() + ' '; + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); + } else { + args[0] = new Date().toUTCString() + + ' ' + name + ' ' + args[0]; + } } /** - * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr. + * Invokes `util.format()` with the specified arguments and writes to `stream`. */ -function log(...args) { - return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n'); +function log() { + return stream.write(util.format.apply(util, arguments) + '\n'); } /** @@ -200,14 +135,15 @@ function log(...args) { * @param {String} namespaces * @api private */ + function save(namespaces) { - if (namespaces) { - process.env.DEBUG = namespaces; - } else { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } } /** @@ -218,7 +154,75 @@ function save(namespaces) { */ function load() { - return process.env.DEBUG; + return process.env.DEBUG; +} + +/** + * Copied from `node/src/node.js`. + * + * XXX: It's lame that node doesn't expose this API out-of-the-box. It also + * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. + */ + +function createWritableStdioStream (fd) { + var stream; + var tty_wrap = process.binding('tty_wrap'); + + // Note stream._type is used for test-module-load-list.js + + switch (tty_wrap.guessHandleType(fd)) { + case 'TTY': + stream = new tty.WriteStream(fd); + stream._type = 'tty'; + + // Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + case 'FILE': + var fs = require('fs'); + stream = new fs.SyncWriteStream(fd, { autoClose: false }); + stream._type = 'fs'; + break; + + case 'PIPE': + case 'TCP': + var net = require('net'); + stream = new net.Socket({ + fd: fd, + readable: false, + writable: true + }); + + // FIXME Should probably have an option in net.Socket to create a + // stream from an existing fd which is writable only. But for now + // we'll just add this hack and set the `readable` member to false. + // Test: ./node test/fixtures/echo.js < /etc/passwd + stream.readable = false; + stream.read = null; + stream._type = 'pipe'; + + // FIXME Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + default: + // Probably an error on in uv_guess_handle() + throw new Error('Implement me. Unknown stream file type!'); + } + + // For supporting legacy API we put the FD here. + stream.fd = fd; + + stream._isStdio = true; + + return stream; } /** @@ -228,36 +232,17 @@ function load() { * differently for a particular `debug` instance. */ -function init(debug) { - debug.inspectOpts = {}; +function init (debug) { + debug.inspectOpts = {}; - const keys = Object.keys(exports.inspectOpts); - for (let i = 0; i < keys.length; i++) { - debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; - } + var keys = Object.keys(exports.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } } -module.exports = require('./common')(exports); - -const {formatters} = module.exports; - /** - * Map %o to `util.inspect()`, all on a single line. + * Enable namespaces listed in `process.env.DEBUG` initially. */ -formatters.o = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts) - .split('\n') - .map(str => str.trim()) - .join(' '); -}; - -/** - * Map %O to `util.inspect()`, allowing multiple lines if needed. - */ - -formatters.O = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts); -}; +exports.enable(load()); diff --git a/api/node_modules/express/History.md b/api/node_modules/express/History.md index 5b6cba5..c234f52 100644 --- a/api/node_modules/express/History.md +++ b/api/node_modules/express/History.md @@ -1,227 +1,25 @@ -5.1.0 / 2025-03-31 -======================== - -* Add support for `Uint8Array` in `res.send()` -* Add support for ETag option in `res.sendFile()` -* Add support for multiple links with the same rel in `res.links()` -* Add funding field to package.json -* perf: use loop for acceptParams -* refactor: prefix built-in node module imports -* deps: remove `setprototypeof` -* deps: remove `safe-buffer` -* deps: remove `utils-merge` -* deps: remove `methods` -* deps: remove `depd` -* deps: `debug@^4.4.0` -* deps: `body-parser@^2.2.0` -* deps: `router@^2.2.0` -* deps: `content-type@^1.0.5` -* deps: `finalhandler@^2.1.0` -* deps: `qs@^6.14.0` -* deps: `server-static@2.2.0` -* deps: `type-is@2.0.1` - -5.0.1 / 2024-10-08 +4.21.2 / 2024-11-06 ========== -* Update `cookie` semver lock to address [CVE-2024-47764](https://nvd.nist.gov/vuln/detail/CVE-2024-47764) + * deps: path-to-regexp@0.1.12 + - Fix backtracking protection + * deps: path-to-regexp@0.1.11 + - Throws an error on invalid path values -5.0.0 / 2024-09-10 -========================= -* remove: - - `path-is-absolute` dependency - use `path.isAbsolute` instead -* breaking: - * `res.status()` accepts only integers, and input must be greater than 99 and less than 1000 - * will throw a `RangeError: Invalid status code: ${code}. Status code must be greater than 99 and less than 1000.` for inputs outside this range - * will throw a `TypeError: Invalid status code: ${code}. Status code must be an integer.` for non integer inputs - * deps: send@1.0.0 - * `res.redirect('back')` and `res.location('back')` is no longer a supported magic string, explicitly use `req.get('Referrer') || '/'`. -* change: - - `res.clearCookie` will ignore user provided `maxAge` and `expires` options -* deps: cookie-signature@^1.2.1 -* deps: debug@4.3.6 -* deps: merge-descriptors@^2.0.0 -* deps: serve-static@^2.1.0 -* deps: qs@6.13.0 -* deps: accepts@^2.0.0 -* deps: mime-types@^3.0.0 - - `application/javascript` => `text/javascript` -* deps: type-is@^2.0.0 -* deps: content-disposition@^1.0.0 -* deps: finalhandler@^2.0.0 -* deps: fresh@^2.0.0 -* deps: body-parser@^2.0.1 -* deps: send@^1.1.0 +4.21.1 / 2024-10-08 +========== -5.0.0-beta.3 / 2024-03-25 -========================= + * Backported a fix for [CVE-2024-47764](https://nvd.nist.gov/vuln/detail/CVE-2024-47764) -This incorporates all changes after 4.19.1 up to 4.19.2. -5.0.0-beta.2 / 2024-03-20 -========================= +4.21.0 / 2024-09-11 +========== -This incorporates all changes after 4.17.2 up to 4.19.1. - -5.0.0-beta.1 / 2022-02-14 -========================= - -This is the first Express 5.0 beta release, based off 4.17.2 and includes -changes from 5.0.0-alpha.8. - - * change: - - Default "query parser" setting to `'simple'` - - Requires Node.js 4+ - - Use `mime-types` for file to content type mapping - * deps: array-flatten@3.0.0 - * deps: body-parser@2.0.0-beta.1 - - `req.body` is no longer always initialized to `{}` - - `urlencoded` parser now defaults `extended` to `false` - - Use `on-finished` to determine when body read - * deps: router@2.0.0-beta.1 - - Add new `?`, `*`, and `+` parameter modifiers - - Internalize private `router.process_params` method - - Matching group expressions are only RegExp syntax - - Named matching groups no longer available by position in `req.params` - - Regular expressions can only be used in a matching group - - Remove `debug` dependency - - Special `*` path segment behavior removed - - deps: array-flatten@3.0.0 - - deps: parseurl@~1.3.3 - - deps: path-to-regexp@3.2.0 - - deps: setprototypeof@1.2.0 - * deps: send@1.0.0-beta.1 - - Change `dotfiles` option default to `'ignore'` - - Remove `hidden` option; use `dotfiles` option instead - - Use `mime-types` for file to content type mapping - - deps: debug@3.1.0 - * deps: serve-static@2.0.0-beta.1 - - Change `dotfiles` option default to `'ignore'` - - Remove `hidden` option; use `dotfiles` option instead - - Use `mime-types` for file to content type mapping - - Remove `express.static.mime` export; use `mime-types` package instead - - deps: send@1.0.0-beta.1 - -5.0.0-alpha.8 / 2020-03-25 -========================== - -This is the eighth Express 5.0 alpha release, based off 4.17.1 and includes -changes from 5.0.0-alpha.7. - -5.0.0-alpha.7 / 2018-10-26 -========================== - -This is the seventh Express 5.0 alpha release, based off 4.16.4 and includes -changes from 5.0.0-alpha.6. - -The major change with this alpha is the basic support for returned, rejected -Promises in the router. - - * remove: - - `path-to-regexp` dependency - * 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: router@2.0.0-alpha.1 - - Add basic support for returned, rejected Promises - - Fix JSDoc for `Router` constructor - - deps: debug@3.1.0 - - deps: parseurl@~1.3.2 - - deps: setprototypeof@1.1.0 - - deps: utils-merge@1.0.1 - -5.0.0-alpha.6 / 2017-09-24 -========================== - -This is the sixth Express 5.0 alpha release, based off 4.15.5 and includes -changes from 5.0.0-alpha.5. - - * remove: - - `res.redirect(url, status)` signature - use `res.redirect(status, url)` - - `res.send(status, body)` signature - use `res.status(status).send(body)` - * deps: router@~1.3.1 - - deps: debug@2.6.8 - -5.0.0-alpha.5 / 2017-03-06 -========================== - -This is the fifth Express 5.0 alpha release, based off 4.15.2 and includes -changes from 5.0.0-alpha.4. - -5.0.0-alpha.4 / 2017-03-01 -========================== - -This is the fourth Express 5.0 alpha release, based off 4.15.0 and includes -changes from 5.0.0-alpha.3. - - * remove: - - Remove Express 3.x middleware error stubs - * deps: router@~1.3.0 - - Add `next("router")` to exit from router - - Fix case where `router.use` skipped requests routes did not - - Skip routing when `req.url` is not set - - Use `%o` in path debug to tell types apart - - deps: debug@2.6.1 - - deps: setprototypeof@1.0.3 - - perf: add fast match path for `*` route - -5.0.0-alpha.3 / 2017-01-28 -========================== - -This is the third Express 5.0 alpha release, based off 4.14.1 and includes -changes from 5.0.0-alpha.2. - - * remove: - - `res.json(status, obj)` signature - use `res.status(status).json(obj)` - - `res.jsonp(status, obj)` signature - use `res.status(status).jsonp(obj)` - - `res.vary()` (no arguments) -- provide a field name as an argument - * deps: array-flatten@2.1.1 - * deps: path-is-absolute@1.0.1 - * deps: router@~1.1.5 - - deps: array-flatten@2.0.1 - - deps: methods@~1.1.2 - - deps: parseurl@~1.3.1 - - deps: setprototypeof@1.0.2 - -5.0.0-alpha.2 / 2015-07-06 -========================== - -This is the second Express 5.0 alpha release, based off 4.13.1 and includes -changes from 5.0.0-alpha.1. - - * remove: - - `app.param(fn)` - - `req.param()` -- use `req.params`, `req.body`, or `req.query` instead - * change: - - `res.render` callback is always async, even for sync view engines - - The leading `:` character in `name` for `app.param(name, fn)` is no longer removed - - Use `router` module for routing - - Use `path-is-absolute` module for absolute path detection - -5.0.0-alpha.1 / 2014-11-06 -========================== - -This is the first Express 5.0 alpha release, based off 4.10.1. - - * remove: - - `app.del` - use `app.delete` - - `req.acceptsCharset` - use `req.acceptsCharsets` - - `req.acceptsEncoding` - use `req.acceptsEncodings` - - `req.acceptsLanguage` - use `req.acceptsLanguages` - - `res.json(obj, status)` signature - use `res.json(status, obj)` - - `res.jsonp(obj, status)` signature - use `res.jsonp(status, obj)` - - `res.send(body, status)` signature - use `res.send(status, body)` - - `res.send(status)` signature - use `res.sendStatus(status)` - - `res.sendfile` - use `res.sendFile` instead - - `express.query` middleware - * change: - - `req.host` now returns host (`hostname:port`) - use `req.hostname` for only hostname - - `req.query` is now a getter instead of a plain property - * add: - - `app.router` is a reference to the base router + * Deprecate `res.location("back")` and `res.redirect("back")` magic string + * deps: serve-static@1.16.2 + * includes send@0.19.0 + * deps: finalhandler@1.3.1 + * deps: qs@6.13.0 4.20.0 / 2024-09-10 ========== diff --git a/api/node_modules/express/Readme.md b/api/node_modules/express/Readme.md index 7443b81..bc108d5 100644 --- a/api/node_modules/express/Readme.md +++ b/api/node_modules/express/Readme.md @@ -1,6 +1,6 @@ -[![Express Logo](https://i.cloudup.com/zfY6lL7eFa-3000x3000.png)](https://expressjs.com/) +[![Express Logo](https://i.cloudup.com/zfY6lL7eFa-3000x3000.png)](http://expressjs.com/) -**Fast, unopinionated, minimalist web framework for [Node.js](https://nodejs.org).** +**Fast, unopinionated, minimalist web framework for [Node.js](http://nodejs.org).** **This project has a [Code of Conduct][].** @@ -20,16 +20,16 @@ [![NPM Version][npm-version-image]][npm-url] +[![NPM Install Size][npm-install-size-image]][npm-install-size-url] [![NPM Downloads][npm-downloads-image]][npm-downloads-url] [![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer] ```js -import express from 'express' - +const express = require('express') const app = express() -app.get('/', (req, res) => { +app.get('/', function (req, res) { res.send('Hello World') }) @@ -42,7 +42,7 @@ This is a [Node.js](https://nodejs.org/en/) module available through the [npm registry](https://www.npmjs.com/). Before installing, [download and install Node.js](https://nodejs.org/en/download/). -Node.js 18 or higher is required. +Node.js 0.10 or higher is required. If this is a brand new project, make sure to create a `package.json` first with the [`npm init` command](https://docs.npmjs.com/creating-a-package-json-file). @@ -50,11 +50,11 @@ the [`npm init` command](https://docs.npmjs.com/creating-a-package-json-file). Installation is done using the [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): -```bash -npm install express +```console +$ npm install express ``` -Follow [our installing guide](https://expressjs.com/en/starter/installing.html) +Follow [our installing guide](http://expressjs.com/en/starter/installing.html) for more information. ## Features @@ -69,11 +69,14 @@ for more information. ## Docs & Community - * [Website and Documentation](https://expressjs.com/) - [[website repo](https://github.com/expressjs/expressjs.com)] + * [Website and Documentation](http://expressjs.com/) - [[website repo](https://github.com/expressjs/expressjs.com)] + * [#express](https://web.libera.chat/#express) on [Libera Chat](https://libera.chat) IRC * [GitHub Organization](https://github.com/expressjs) for Official Middleware & Modules - * [Github Discussions](https://github.com/expressjs/discussions) for discussion on the development and usage of Express + * Visit the [Wiki](https://github.com/expressjs/express/wiki) + * [Google Group](https://groups.google.com/group/express-js) for discussion + * [Gitter](https://gitter.im/expressjs/express) for support and discussion -**PROTIP** Be sure to read the [migration guide to v5](https://expressjs.com/en/guide/migrating-5) +**PROTIP** Be sure to read [Migrating from 3.x to 4.x](https://github.com/expressjs/express/wiki/Migrating-from-3.x-to-4.x) as well as [New features in 4.x](https://github.com/expressjs/express/wiki/New-features-in-4.x). ## Quick Start @@ -81,26 +84,26 @@ for more information. Install the executable. The executable's major version will match Express's: -```bash -npm install -g express-generator@4 +```console +$ npm install -g express-generator@4 ``` Create the app: -```bash -express /tmp/foo && cd /tmp/foo +```console +$ express /tmp/foo && cd /tmp/foo ``` Install dependencies: -```bash -npm install +```console +$ npm install ``` Start the server: -```bash -npm start +```console +$ npm start ``` View the website at: http://localhost:3000 @@ -112,32 +115,29 @@ npm start HTTP APIs. Express does not force you to use any specific ORM or template engine. With support for over - 14 template engines via [@ladjs/consolidate](https://github.com/ladjs/consolidate), + 14 template engines via [Consolidate.js](https://github.com/tj/consolidate.js), you can quickly craft your perfect framework. ## Examples - To view the examples, clone the Express repository: + To view the examples, clone the Express repo and install the dependencies: -```bash -git clone https://github.com/expressjs/express.git --depth 1 && cd express -``` - - Then install the dependencies: - -```bash -npm install +```console +$ git clone https://github.com/expressjs/express.git --depth 1 +$ cd express +$ npm install ``` Then run whichever example you want: -```bash -node examples/content-negotiation +```console +$ node examples/content-negotiation ``` ## Contributing [![Linux Build][github-actions-ci-image]][github-actions-ci-url] + [![Windows Build][appveyor-image]][appveyor-url] [![Test Coverage][coveralls-image]][coveralls-url] The Express.js project welcomes all constructive contributions. Contributions take many forms, @@ -152,16 +152,11 @@ If you discover a security vulnerability in Express, please see [Security Polici ### Running Tests -To run the test suite, first install the dependencies: +To run the test suite, first install the dependencies, then run `npm test`: -```bash -npm install -``` - -Then run `npm test`: - -```bash -npm test +```console +$ npm install +$ npm test ``` ## People @@ -197,16 +192,18 @@ The original author of Express is [TJ Holowaychuk](https://github.com/tj) ### Triagers * [aravindvnair99](https://github.com/aravindvnair99) - **Aravind Nair** -* [bjohansebas](https://github.com/bjohansebas) - **Sebastian Beltran** * [carpasse](https://github.com/carpasse) - **Carlos Serrano** * [CBID2](https://github.com/CBID2) - **Christine Belzie** -* [dpopp07](https://github.com/dpopp07) - **Dustin Popp** +* [enyoghasim](https://github.com/enyoghasim) - **David Enyoghasim** * [UlisesGascon](https://github.com/UlisesGascon) - **Ulises Gascón** (he/him) +* [mertcanaltin](https://github.com/mertcanaltin) - **Mert Can Altin** +* [0ss](https://github.com/0ss) - **Salah** +* [import-brain](https://github.com/import-brain) - **Eric Cheng** (he/him) * [3imed-jaberi](https://github.com/3imed-jaberi) - **Imed Jaberi** +* [dakshkhetan](https://github.com/dakshkhetan) - **Daksh Khetan** (he/him) +* [lucasraziel](https://github.com/lucasraziel) - **Lucas Soares Do Rego** * [IamLizu](https://github.com/IamLizu) - **S M Mahmudul Hasan** (he/him) -* [Phillip9587](https://github.com/Phillip9587) - **Phillip Barta** * [Sushmeet](https://github.com/Sushmeet) - **Sushmeet Sunger** -* [rxmarbles](https://github.com/rxmarbles) **Rick Markins** (He/him)
Triagers emeriti members @@ -239,13 +236,6 @@ The original author of Express is [TJ Holowaychuk](https://github.com/tj) * [sheplu](https://github.com/sheplu) - **Jean Burellier** * [tarunyadav1](https://github.com/tarunyadav1) - **Tarun yadav** * [tunniclm](https://github.com/tunniclm) - **Mike Tunnicliffe** - * [enyoghasim](https://github.com/enyoghasim) - **David Enyoghasim** - * [0ss](https://github.com/0ss) - **Salah** - * [import-brain](https://github.com/import-brain) - **Eric Cheng** (he/him) - * [dakshkhetan](https://github.com/dakshkhetan) - **Daksh Khetan** (he/him) - * [lucasraziel](https://github.com/lucasraziel) - **Lucas Soares Do Rego** - * [mertcanaltin](https://github.com/mertcanaltin) - **Mert Can Altin** -
@@ -253,12 +243,16 @@ The original author of Express is [TJ Holowaychuk](https://github.com/tj) [MIT](LICENSE) +[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/express/master?label=windows +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/express [coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/express/master [coveralls-url]: https://coveralls.io/r/expressjs/express?branch=master -[github-actions-ci-image]: https://badgen.net/github/checks/expressjs/express/master?label=CI +[github-actions-ci-image]: https://badgen.net/github/checks/expressjs/express/master?label=linux [github-actions-ci-url]: https://github.com/expressjs/express/actions/workflows/ci.yml [npm-downloads-image]: https://badgen.net/npm/dm/express [npm-downloads-url]: https://npmcharts.com/compare/express?minimal=true +[npm-install-size-image]: https://badgen.net/packagephobia/install/express +[npm-install-size-url]: https://packagephobia.com/result?p=express [npm-url]: https://npmjs.org/package/express [npm-version-image]: https://badgen.net/npm/v/express [ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/express/badge diff --git a/api/node_modules/express/lib/application.js b/api/node_modules/express/lib/application.js index cf6d78c..ebb30b5 100644 --- a/api/node_modules/express/lib/application.js +++ b/api/node_modules/express/lib/application.js @@ -14,24 +14,29 @@ */ var finalhandler = require('finalhandler'); +var Router = require('./router'); +var methods = require('methods'); +var middleware = require('./middleware/init'); +var query = require('./middleware/query'); var debug = require('debug')('express:application'); var View = require('./view'); -var http = require('node:http'); -var methods = require('./utils').methods; +var http = require('http'); var compileETag = require('./utils').compileETag; var compileQueryParser = require('./utils').compileQueryParser; var compileTrust = require('./utils').compileTrust; -var resolve = require('node:path').resolve; -var once = require('once') -var Router = require('router'); +var deprecate = require('depd')('express'); +var flatten = require('array-flatten'); +var merge = require('utils-merge'); +var resolve = require('path').resolve; +var setPrototypeOf = require('setprototypeof') /** * Module variables. * @private */ +var hasOwnProperty = Object.prototype.hasOwnProperty var slice = Array.prototype.slice; -var flatten = Array.prototype.flat; /** * Application prototype. @@ -57,29 +62,11 @@ var trustProxyDefaultSymbol = '@@symbol:trust_proxy_default'; */ app.init = function init() { - var router = null; - - this.cache = Object.create(null); - this.engines = Object.create(null); - this.settings = Object.create(null); + this.cache = {}; + this.engines = {}; + this.settings = {}; this.defaultConfiguration(); - - // Setup getting to lazily add base router - Object.defineProperty(this, 'router', { - configurable: true, - enumerable: true, - get: function getrouter() { - if (router === null) { - router = new Router({ - caseSensitive: this.enabled('case sensitive routing'), - strict: this.enabled('strict routing') - }); - } - - return router; - } - }); }; /** @@ -94,7 +81,7 @@ app.defaultConfiguration = function defaultConfiguration() { this.enable('x-powered-by'); this.set('etag', 'weak'); this.set('env', env); - this.set('query parser', 'simple') + this.set('query parser', 'extended'); this.set('subdomain offset', 2); this.set('trust proxy', false); @@ -115,10 +102,10 @@ app.defaultConfiguration = function defaultConfiguration() { } // inherit protos - Object.setPrototypeOf(this.request, parent.request) - Object.setPrototypeOf(this.response, parent.response) - Object.setPrototypeOf(this.engines, parent.engines) - Object.setPrototypeOf(this.settings, parent.settings) + setPrototypeOf(this.request, parent.request) + setPrototypeOf(this.response, parent.response) + setPrototypeOf(this.engines, parent.engines) + setPrototypeOf(this.settings, parent.settings) }); // setup locals @@ -138,6 +125,32 @@ app.defaultConfiguration = function defaultConfiguration() { if (env === 'production') { this.enable('view cache'); } + + Object.defineProperty(this, 'router', { + get: function() { + throw new Error('\'app.router\' is deprecated!\nPlease see the 3.x to 4.x migration guide for details on how to update your app.'); + } + }); +}; + +/** + * lazily adds the base router if it has not yet been added. + * + * We cannot add the base router in the defaultConfiguration because + * it reads app settings which might be set after that has run. + * + * @private + */ +app.lazyrouter = function lazyrouter() { + if (!this._router) { + this._router = new Router({ + caseSensitive: this.enabled('case sensitive routing'), + strict: this.enabled('strict routing') + }); + + this._router.use(query(this.get('query parser fn'))); + this._router.use(middleware.init(this)); + } }; /** @@ -150,31 +163,22 @@ app.defaultConfiguration = function defaultConfiguration() { */ app.handle = function handle(req, res, callback) { + var router = this._router; + // final handler var done = callback || finalhandler(req, res, { env: this.get('env'), onerror: logerror.bind(this) }); - // set powered by header - if (this.enabled('x-powered-by')) { - res.setHeader('X-Powered-By', 'Express'); + // no routes + if (!router) { + debug('no routes defined on app'); + done(); + return; } - // set circular references - req.res = res; - res.req = req; - - // alter the prototypes - Object.setPrototypeOf(req, this.request) - Object.setPrototypeOf(res, this.response) - - // setup locals - if (!res.locals) { - res.locals = Object.create(null); - } - - this.router.handle(req, res, done); + router.handle(req, res, done); }; /** @@ -207,14 +211,15 @@ app.use = function use(fn) { } } - var fns = flatten.call(slice.call(arguments, offset), Infinity); + var fns = flatten(slice.call(arguments, offset)); if (fns.length === 0) { throw new TypeError('app.use() requires a middleware function') } - // get router - var router = this.router; + // setup router + this.lazyrouter(); + var router = this._router; fns.forEach(function (fn) { // non-express app @@ -230,8 +235,8 @@ app.use = function use(fn) { router.use(path, function mounted_app(req, res, next) { var orig = req.app; fn.handle(req, res, function (err) { - Object.setPrototypeOf(req, orig.request) - Object.setPrototypeOf(res, orig.response) + setPrototypeOf(req, orig.request) + setPrototypeOf(res, orig.response) next(err); }); }); @@ -254,7 +259,8 @@ app.use = function use(fn) { */ app.route = function route(path) { - return this.router.route(path); + this.lazyrouter(); + return this._router.route(path); }; /** @@ -320,6 +326,8 @@ app.engine = function engine(ext, fn) { */ app.param = function param(name, fn) { + this.lazyrouter(); + if (Array.isArray(name)) { for (var i = 0; i < name.length; i++) { this.param(name[i], fn); @@ -328,7 +336,7 @@ app.param = function param(name, fn) { return this; } - this.router.param(name, fn); + this._router.param(name, fn); return this; }; @@ -351,7 +359,17 @@ app.param = function param(name, fn) { app.set = function set(setting, val) { if (arguments.length === 1) { // app.get(setting) - return this.settings[setting]; + var settings = this.settings + + while (settings && settings !== Object.prototype) { + if (hasOwnProperty.call(settings, setting)) { + return settings[setting] + } + + settings = Object.getPrototypeOf(settings) + } + + return undefined } debug('set "%s" to %o', setting, val); @@ -468,14 +486,16 @@ app.disable = function disable(setting) { * Delegate `.VERB(...)` calls to `router.VERB(...)`. */ -methods.forEach(function (method) { - app[method] = function (path) { +methods.forEach(function(method){ + app[method] = function(path){ if (method === 'get' && arguments.length === 1) { // app.get(setting) return this.set(path); } - var route = this.route(path); + this.lazyrouter(); + + var route = this._router.route(path); route[method].apply(route, slice.call(arguments, 1)); return this; }; @@ -492,7 +512,9 @@ methods.forEach(function (method) { */ app.all = function all(path) { - var route = this.route(path); + this.lazyrouter(); + + var route = this._router.route(path); var args = slice.call(arguments, 1); for (var i = 0; i < methods.length; i++) { @@ -502,6 +524,10 @@ app.all = function all(path) { return this; }; +// del -> delete alias + +app.del = deprecate.function(app.delete, 'app.del: Use app.delete instead'); + /** * Render the given view `name` name with `options` * and a callback accepting an error and the @@ -524,6 +550,7 @@ app.render = function render(name, options, callback) { var done = callback; var engines = this.engines; var opts = options; + var renderOptions = {}; var view; // support callback function as second arg @@ -532,8 +559,16 @@ app.render = function render(name, options, callback) { opts = {}; } + // merge app.locals + merge(renderOptions, this.locals); + + // merge options._locals + if (opts._locals) { + merge(renderOptions, opts._locals); + } + // merge options - var renderOptions = { ...this.locals, ...opts._locals, ...opts }; + merge(renderOptions, opts); // set .cache unless explicitly provided if (renderOptions.cache == null) { @@ -583,8 +618,8 @@ app.render = function render(name, options, callback) { * and HTTPS server you may do so with the "http" * and "https" modules as shown here: * - * var http = require('node:http') - * , https = require('node:https') + * var http = require('http') + * , https = require('https') * , express = require('express') * , app = express(); * @@ -596,14 +631,9 @@ app.render = function render(name, options, callback) { */ app.listen = function listen() { - var server = http.createServer(this) - var args = Array.prototype.slice.call(arguments) - if (typeof args[args.length - 1] === 'function') { - var done = args[args.length - 1] = once(args[args.length - 1]) - server.once('error', done) - } - return server.listen.apply(server, args) -} + var server = http.createServer(this); + return server.listen.apply(server, arguments); +}; /** * Log error using console.error. diff --git a/api/node_modules/express/lib/express.js b/api/node_modules/express/lib/express.js index 2d502eb..d188a16 100644 --- a/api/node_modules/express/lib/express.js +++ b/api/node_modules/express/lib/express.js @@ -13,10 +13,11 @@ */ var bodyParser = require('body-parser') -var EventEmitter = require('node:events').EventEmitter; +var EventEmitter = require('events').EventEmitter; var mixin = require('merge-descriptors'); var proto = require('./application'); -var Router = require('router'); +var Route = require('./router/route'); +var Router = require('./router'); var req = require('./request'); var res = require('./response'); @@ -67,7 +68,7 @@ exports.response = res; * Expose constructors. */ -exports.Route = Router.Route; +exports.Route = Route; exports.Router = Router; /** @@ -75,7 +76,41 @@ exports.Router = Router; */ exports.json = bodyParser.json +exports.query = require('./middleware/query'); exports.raw = bodyParser.raw exports.static = require('serve-static'); exports.text = bodyParser.text exports.urlencoded = bodyParser.urlencoded + +/** + * Replace removed middleware with an appropriate error message. + */ + +var removedMiddlewares = [ + 'bodyParser', + 'compress', + 'cookieSession', + 'session', + 'logger', + 'cookieParser', + 'favicon', + 'responseTime', + 'errorHandler', + 'timeout', + 'methodOverride', + 'vhost', + 'csrf', + 'directory', + 'limit', + 'multipart', + 'staticCache' +] + +removedMiddlewares.forEach(function (name) { + Object.defineProperty(exports, name, { + get: function () { + throw new Error('Most middleware (like ' + name + ') is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.'); + }, + configurable: true + }); +}); diff --git a/api/node_modules/express/lib/request.js b/api/node_modules/express/lib/request.js index d8e5263..3f1eeca 100644 --- a/api/node_modules/express/lib/request.js +++ b/api/node_modules/express/lib/request.js @@ -14,9 +14,10 @@ */ var accepts = require('accepts'); -var isIP = require('node:net').isIP; +var deprecate = require('depd')('express'); +var isIP = require('net').isIP; var typeis = require('type-is'); -var http = require('node:http'); +var http = require('http'); var fresh = require('fresh'); var parseRange = require('range-parser'); var parse = require('parseurl'); @@ -146,6 +147,9 @@ req.acceptsEncodings = function(){ return accept.encodings.apply(accept, arguments); }; +req.acceptsEncoding = deprecate.function(req.acceptsEncodings, + 'req.acceptsEncoding: Use acceptsEncodings instead'); + /** * Check if the given `charset`s are acceptable, * otherwise you should respond with 406 "Not Acceptable". @@ -160,6 +164,9 @@ req.acceptsCharsets = function(){ return accept.charsets.apply(accept, arguments); }; +req.acceptsCharset = deprecate.function(req.acceptsCharsets, + 'req.acceptsCharset: Use acceptsCharsets instead'); + /** * Check if the given `lang`s are acceptable, * otherwise you should respond with 406 "Not Acceptable". @@ -174,6 +181,9 @@ req.acceptsLanguages = function(){ return accept.languages.apply(accept, arguments); }; +req.acceptsLanguage = deprecate.function(req.acceptsLanguages, + 'req.acceptsLanguage: Use acceptsLanguages instead'); + /** * Parse Range header field, capping to the given `size`. * @@ -206,27 +216,38 @@ req.range = function range(size, options) { }; /** - * Parse the query string of `req.url`. + * Return the value of param `name` when present or `defaultValue`. * - * This uses the "query parser" setting to parse the raw - * string into an object. + * - Checks route placeholders, ex: _/user/:id_ + * - Checks body params, ex: id=12, {"id":12} + * - Checks query string params, ex: ?id=12 * + * To utilize request bodies, `req.body` + * should be an object. This can be done by using + * the `bodyParser()` middleware. + * + * @param {String} name + * @param {Mixed} [defaultValue] * @return {String} - * @api public + * @public */ -defineGetter(req, 'query', function query(){ - var queryparse = this.app.get('query parser fn'); +req.param = function param(name, defaultValue) { + var params = this.params || {}; + var body = this.body || {}; + var query = this.query || {}; - if (!queryparse) { - // parsing is disabled - return Object.create(null); - } + var args = arguments.length === 1 + ? 'name' + : 'name, default'; + deprecate('req.param(' + args + '): Use req.params, req.body, or req.query instead'); - var querystring = parse(this).query; + if (null != params[name] && params.hasOwnProperty(name)) return params[name]; + if (null != body[name]) return body[name]; + if (null != query[name]) return query[name]; - return queryparse(querystring); -}); + return defaultValue; +}; /** * Check if the incoming request contains the "Content-Type" @@ -393,7 +414,7 @@ defineGetter(req, 'path', function path() { }); /** - * Parse the "Host" header field to a host. + * Parse the "Host" header field to a hostname. * * When the "trust proxy" setting trusts the socket * address, the "X-Forwarded-Host" header field will @@ -403,35 +424,18 @@ defineGetter(req, 'path', function path() { * @public */ -defineGetter(req, 'host', function host(){ +defineGetter(req, 'hostname', function hostname(){ var trust = this.app.get('trust proxy fn'); - var val = this.get('X-Forwarded-Host'); + var host = this.get('X-Forwarded-Host'); - if (!val || !trust(this.connection.remoteAddress, 0)) { - val = this.get('Host'); - } else if (val.indexOf(',') !== -1) { + if (!host || !trust(this.connection.remoteAddress, 0)) { + host = this.get('Host'); + } else if (host.indexOf(',') !== -1) { // Note: X-Forwarded-Host is normally only ever a // single value, but this is to be safe. - val = val.substring(0, val.indexOf(',')).trimRight() + host = host.substring(0, host.indexOf(',')).trimRight() } - return val || undefined; -}); - -/** - * Parse the "Host" header field to a hostname. - * - * When the "trust proxy" setting trusts the socket - * address, the "X-Forwarded-Host" header field will - * be trusted. - * - * @return {String} - * @api public - */ - -defineGetter(req, 'hostname', function hostname(){ - var host = this.host; - if (!host) return; // IPv6 literal support @@ -445,9 +449,15 @@ defineGetter(req, 'hostname', function hostname(){ : host; }); +// TODO: change req.host to return host in next major + +defineGetter(req, 'host', deprecate.function(function host(){ + return this.hostname; +}, 'req.host: Use req.hostname instead')); + /** * Check if the request is fresh, aka - * Last-Modified or the ETag + * Last-Modified and/or the ETag * still match. * * @return {Boolean} diff --git a/api/node_modules/express/lib/response.js b/api/node_modules/express/lib/response.js index 9362d0e..2b654f4 100644 --- a/api/node_modules/express/lib/response.js +++ b/api/node_modules/express/lib/response.js @@ -12,16 +12,18 @@ * @private */ +var Buffer = require('safe-buffer').Buffer var contentDisposition = require('content-disposition'); var createError = require('http-errors') +var deprecate = require('depd')('express'); var encodeUrl = require('encodeurl'); var escapeHtml = require('escape-html'); -var http = require('node:http'); +var http = require('http'); +var isAbsolute = require('./utils').isAbsolute; var onFinished = require('on-finished'); -var mime = require('mime-types') -var path = require('node:path'); -var pathIsAbsolute = require('node:path').isAbsolute; +var path = require('path'); var statuses = require('statuses') +var merge = require('utils-merge'); var sign = require('cookie-signature').sign; var normalizeType = require('./utils').normalizeType; var normalizeTypes = require('./utils').normalizeTypes; @@ -29,6 +31,7 @@ var setCharset = require('./utils').setCharset; var cookie = require('cookie'); var send = require('send'); var extname = path.extname; +var mime = send.mime; var resolve = path.resolve; var vary = require('vary'); @@ -47,28 +50,24 @@ var res = Object.create(http.ServerResponse.prototype) module.exports = res /** - * Set the HTTP status code for the response. + * Module variables. + * @private + */ + +var charsetRegExp = /;\s*charset\s*=/; + +/** + * Set status `code`. * - * Expects an integer value between 100 and 999 inclusive. - * Throws an error if the provided status code is not an integer or if it's outside the allowable range. - * - * @param {number} code - The HTTP status code to set. - * @return {ServerResponse} - Returns itself for chaining methods. - * @throws {TypeError} If `code` is not an integer. - * @throws {RangeError} If `code` is outside the range 100 to 999. + * @param {Number} code + * @return {ServerResponse} * @public */ res.status = function status(code) { - // Check if the status code is not an integer - if (!Number.isInteger(code)) { - throw new TypeError(`Invalid status code: ${JSON.stringify(code)}. Status code must be an integer.`); + if ((typeof code === 'string' || Math.floor(code) !== code) && code > 99 && code < 1000) { + deprecate('res.status(' + JSON.stringify(code) + '): use res.status(' + Math.floor(code) + ') instead') } - // Check if the status code is outside of Node's valid range - if (code < 100 || code > 999) { - throw new RangeError(`Invalid status code: ${JSON.stringify(code)}. Status code must be greater than 99 and less than 1000.`); - } - this.statusCode = code; return this; }; @@ -80,11 +79,7 @@ res.status = function status(code) { * * res.links({ * next: 'http://api.example.com/users?page=2', - * last: 'http://api.example.com/users?page=5', - * pages: [ - * 'http://api.example.com/users?page=1', - * 'http://api.example.com/users?page=2' - * ] + * last: 'http://api.example.com/users?page=5' * }); * * @param {Object} links @@ -92,18 +87,11 @@ res.status = function status(code) { * @public */ -res.links = function(links) { +res.links = function(links){ var link = this.get('Link') || ''; if (link) link += ', '; - return this.set('Link', link + Object.keys(links).map(function(rel) { - // Allow multiple links if links[rel] is an array - if (Array.isArray(links[rel])) { - return links[rel].map(function (singleLink) { - return `<${singleLink}>; rel="${rel}"`; - }).join(', '); - } else { - return `<${links[rel]}>; rel="${rel}"`; - } + return this.set('Link', link + Object.keys(links).map(function(rel){ + return '<' + links[rel] + '>; rel="' + rel + '"'; }).join(', ')); }; @@ -129,6 +117,31 @@ res.send = function send(body) { // settings var app = this.app; + // allow status / body + if (arguments.length === 2) { + // res.send(body, status) backwards compat + if (typeof arguments[0] !== 'number' && typeof arguments[1] === 'number') { + deprecate('res.send(body, status): Use res.status(status).send(body) instead'); + this.statusCode = arguments[1]; + } else { + deprecate('res.send(status, body): Use res.status(status).send(body) instead'); + this.statusCode = arguments[0]; + chunk = arguments[1]; + } + } + + // disambiguate res.send(status) and res.send(status, num) + if (typeof chunk === 'number' && arguments.length === 1) { + // res.send(status) will set status message as text string + if (!this.get('Content-Type')) { + this.type('txt'); + } + + deprecate('res.send(status): Use res.sendStatus(status) instead'); + this.statusCode = chunk; + chunk = statuses.message[chunk] + } + switch (typeof chunk) { // string defaulting to html case 'string': @@ -141,7 +154,7 @@ res.send = function send(body) { case 'object': if (chunk === null) { chunk = ''; - } else if (ArrayBuffer.isView(chunk)) { + } else if (Buffer.isBuffer(chunk)) { if (!this.get('Content-Type')) { this.type('bin'); } @@ -194,7 +207,7 @@ res.send = function send(body) { } // freshness - if (req.fresh) this.status(304); + if (req.fresh) this.statusCode = 304; // strip irrelevant headers if (204 === this.statusCode || 304 === this.statusCode) { @@ -235,12 +248,27 @@ res.send = function send(body) { */ res.json = function json(obj) { + var val = obj; + + // allow status / body + if (arguments.length === 2) { + // res.json(body, status) backwards compat + if (typeof arguments[1] === 'number') { + deprecate('res.json(obj, status): Use res.status(status).json(obj) instead'); + this.statusCode = arguments[1]; + } else { + deprecate('res.json(status, obj): Use res.status(status).json(obj) instead'); + this.statusCode = arguments[0]; + val = arguments[1]; + } + } + // settings var app = this.app; var escape = app.get('json escape') var replacer = app.get('json replacer'); var spaces = app.get('json spaces'); - var body = stringify(obj, replacer, spaces, escape) + var body = stringify(val, replacer, spaces, escape) // content-type if (!this.get('Content-Type')) { @@ -263,12 +291,27 @@ res.json = function json(obj) { */ res.jsonp = function jsonp(obj) { + var val = obj; + + // allow status / body + if (arguments.length === 2) { + // res.jsonp(body, status) backwards compat + if (typeof arguments[1] === 'number') { + deprecate('res.jsonp(obj, status): Use res.status(status).jsonp(obj) instead'); + this.statusCode = arguments[1]; + } else { + deprecate('res.jsonp(status, obj): Use res.status(status).jsonp(obj) instead'); + this.statusCode = arguments[0]; + val = arguments[1]; + } + } + // settings var app = this.app; var escape = app.get('json escape') var replacer = app.get('json replacer'); var spaces = app.get('json spaces'); - var body = stringify(obj, replacer, spaces, escape) + var body = stringify(val, replacer, spaces, escape) var callback = this.req.query[app.get('jsonp callback name')]; // content-type @@ -326,7 +369,7 @@ res.jsonp = function jsonp(obj) { res.sendStatus = function sendStatus(statusCode) { var body = statuses.message[statusCode] || String(statusCode) - this.status(statusCode); + this.statusCode = statusCode; this.type('txt'); return this.send(body); @@ -394,15 +437,12 @@ res.sendFile = function sendFile(path, options, callback) { opts = {}; } - if (!opts.root && !pathIsAbsolute(path)) { + if (!opts.root && !isAbsolute(path)) { throw new TypeError('path must be absolute or specify root to res.sendFile'); } // create file stream var pathname = encodeURI(path); - - // wire application etag option to send - opts.etag = this.app.enabled('etag'); var file = send(req, pathname, opts); // transfer @@ -417,6 +457,78 @@ res.sendFile = function sendFile(path, options, callback) { }); }; +/** + * Transfer the file at the given `path`. + * + * Automatically sets the _Content-Type_ response header field. + * The callback `callback(err)` is invoked when the transfer is complete + * or when an error occurs. Be sure to check `res.headersSent` + * if you wish to attempt responding, as the header and some data + * may have already been transferred. + * + * Options: + * + * - `maxAge` defaulting to 0 (can be string converted by `ms`) + * - `root` root directory for relative filenames + * - `headers` object of headers to serve with file + * - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them + * + * Other options are passed along to `send`. + * + * Examples: + * + * The following example illustrates how `res.sendfile()` may + * be used as an alternative for the `static()` middleware for + * dynamic situations. The code backing `res.sendfile()` is actually + * the same code, so HTTP cache support etc is identical. + * + * app.get('/user/:uid/photos/:file', function(req, res){ + * var uid = req.params.uid + * , file = req.params.file; + * + * req.user.mayViewFilesFrom(uid, function(yes){ + * if (yes) { + * res.sendfile('/uploads/' + uid + '/' + file); + * } else { + * res.send(403, 'Sorry! you cant see that.'); + * } + * }); + * }); + * + * @public + */ + +res.sendfile = function (path, options, callback) { + var done = callback; + var req = this.req; + var res = this; + var next = req.next; + var opts = options || {}; + + // support function as second arg + if (typeof options === 'function') { + done = options; + opts = {}; + } + + // create file stream + var file = send(req, path, opts); + + // transfer + sendfile(res, file, opts, function (err) { + if (done) return done(err); + if (err && err.code === 'EISDIR') return next(); + + // next() all but write errors + if (err && err.code !== 'ECONNABORTED' && err.syscall !== 'write') { + next(err); + } + }); +}; + +res.sendfile = deprecate.function(res.sendfile, + 'res.sendfile: Use res.sendFile instead'); + /** * Transfer the file at the given `path` as an attachment. * @@ -487,10 +599,8 @@ res.download = function download (path, filename, options, callback) { }; /** - * Set _Content-Type_ response header with `type` through `mime.contentType()` + * Set _Content-Type_ response header with `type` through `mime.lookup()` * when it does not contain "/", or set the Content-Type to `type` otherwise. - * When no mapping is found though `mime.contentType()`, the type is set to - * "application/octet-stream". * * Examples: * @@ -508,7 +618,7 @@ res.download = function download (path, filename, options, callback) { res.contentType = res.type = function contentType(type) { var ct = type.indexOf('/') === -1 - ? (mime.contentType(type) || 'application/octet-stream') + ? mime.lookup(type) : type; return this.set('Content-Type', ct); @@ -657,9 +767,6 @@ res.append = function append(field, val) { * * Aliased as `res.header()`. * - * When the set header is "Content-Type", the type is expanded to include - * the charset if not present using `mime.contentType()`. - * * @param {String|Object} field * @param {String|Array} val * @return {ServerResponse} for chaining @@ -678,7 +785,10 @@ res.header = function header(field, val) { if (Array.isArray(value)) { throw new TypeError('Content-Type cannot be set to an Array'); } - value = mime.contentType(value) + if (!charsetRegExp.test(value)) { + var charset = mime.charsets.lookup(value.split(';')[0]); + if (charset) value += '; charset=' + charset.toLowerCase(); + } } this.setHeader(field, value); @@ -712,10 +822,15 @@ res.get = function(field){ */ res.clearCookie = function clearCookie(name, options) { - // Force cookie expiration by setting expires to the past - const opts = { path: '/', ...options, expires: new Date(1)}; - // ensure maxAge is not passed - delete opts.maxAge + if (options) { + if (options.maxAge) { + deprecate('res.clearCookie: Passing "options.maxAge" is deprecated. In v5.0.0 of Express, this option will be ignored, as res.clearCookie will automatically set cookies to expire immediately. Please update your code to omit this option.'); + } + if (options.expires) { + deprecate('res.clearCookie: Passing "options.expires" is deprecated. In v5.0.0 of Express, this option will be ignored, as res.clearCookie will automatically set cookies to expire immediately. Please update your code to omit this option.'); + } + } + var opts = merge({ expires: new Date(1), path: '/' }, options); return this.cookie(name, '', opts); }; @@ -745,7 +860,7 @@ res.clearCookie = function clearCookie(name, options) { */ res.cookie = function (name, value, options) { - var opts = { ...options }; + var opts = merge({}, options); var secret = this.req.secret; var signed = opts.signed; @@ -797,13 +912,27 @@ res.cookie = function (name, value, options) { */ res.location = function location(url) { - return this.set('Location', encodeUrl(url)); + var loc; + + // "back" is an alias for the referrer + if (url === 'back') { + deprecate('res.location("back"): use res.location(req.get("Referrer") || "/") and refer to https://dub.sh/security-redirect for best practices'); + loc = this.req.get('Referrer') || '/'; + } else { + loc = String(url); + } + + return this.set('Location', encodeUrl(loc)); }; /** * Redirect to the given `url` with optional response `status` * defaulting to 302. * + * The resulting `url` is determined by `res.location()`, so + * it will play nicely with mounted apps, relative paths, + * `"back"` etc. + * * Examples: * * res.redirect('/foo/bar'); @@ -821,8 +950,13 @@ res.redirect = function redirect(url) { // allow status / url if (arguments.length === 2) { - status = arguments[0] - address = arguments[1] + if (typeof arguments[0] === 'number') { + status = arguments[0]; + address = arguments[1]; + } else { + deprecate('res.redirect(url, status): Use res.redirect(status, url) instead'); + status = arguments[1]; + } } // Set location header @@ -845,7 +979,7 @@ res.redirect = function redirect(url) { }); // Respond - this.status(status); + this.statusCode = status; this.set('Content-Length', Buffer.byteLength(body)); if (this.req.method === 'HEAD') { @@ -865,6 +999,12 @@ res.redirect = function redirect(url) { */ res.vary = function(field){ + // checks for back-compat + if (!field || (Array.isArray(field) && !field.length)) { + deprecate('res.vary(): Provide a field name'); + return this; + } + vary(this, field); return this; diff --git a/api/node_modules/express/lib/utils.js b/api/node_modules/express/lib/utils.js index d53c5a1..56e12b9 100644 --- a/api/node_modules/express/lib/utils.js +++ b/api/node_modules/express/lib/utils.js @@ -12,20 +12,17 @@ * @api private */ -var { METHODS } = require('node:http'); +var Buffer = require('safe-buffer').Buffer +var contentDisposition = require('content-disposition'); var contentType = require('content-type'); +var deprecate = require('depd')('express'); +var flatten = require('array-flatten'); +var mime = require('send').mime; var etag = require('etag'); -var mime = require('mime-types') var proxyaddr = require('proxy-addr'); var qs = require('qs'); var querystring = require('querystring'); -/** - * A list of lowercased HTTP methods that are supported by Node.js. - * @api private - */ -exports.methods = METHODS.map((method) => method.toLowerCase()); - /** * Return strong ETag for `body`. * @@ -48,6 +45,31 @@ exports.etag = createETagGenerator({ weak: false }) exports.wetag = createETagGenerator({ weak: true }) +/** + * Check if `path` looks absolute. + * + * @param {String} path + * @return {Boolean} + * @api private + */ + +exports.isAbsolute = function(path){ + if ('/' === path[0]) return true; + if (':' === path[1] && ('\\' === path[2] || '/' === path[2])) return true; // Windows device path + if ('\\\\' === path.substring(0, 2)) return true; // Microsoft Azure absolute path +}; + +/** + * Flatten the given `arr`. + * + * @param {Array} arr + * @return {Array} + * @api private + */ + +exports.flatten = deprecate.function(flatten, + 'utils.flatten: use array-flatten npm module instead'); + /** * Normalize the given `type`, for example "html" becomes "text/html". * @@ -59,7 +81,7 @@ exports.wetag = createETagGenerator({ weak: true }) exports.normalizeType = function(type){ return ~type.indexOf('/') ? acceptParams(type) - : { value: (mime.lookup(type) || 'application/octet-stream'), params: {} } + : { value: mime.lookup(type), params: {} }; }; /** @@ -70,10 +92,27 @@ exports.normalizeType = function(type){ * @api private */ -exports.normalizeTypes = function(types) { - return types.map(exports.normalizeType); +exports.normalizeTypes = function(types){ + var ret = []; + + for (var i = 0; i < types.length; ++i) { + ret.push(exports.normalizeType(types[i])); + } + + return ret; }; +/** + * Generate Content-Disposition header appropriate for the filename. + * non-ascii filenames are urlencoded and a filename* parameter is added + * + * @param {String} filename + * @return {String} + * @api private + */ + +exports.contentDisposition = deprecate.function(contentDisposition, + 'utils.contentDisposition: use content-disposition npm module instead'); /** * Parse accept params `str` returning an @@ -85,33 +124,16 @@ exports.normalizeTypes = function(types) { */ function acceptParams (str) { - var length = str.length; - var colonIndex = str.indexOf(';'); - var index = colonIndex === -1 ? length : colonIndex; - var ret = { value: str.slice(0, index).trim(), quality: 1, params: {} }; + var parts = str.split(/ *; */); + var ret = { value: parts[0], quality: 1, params: {} } - while (index < length) { - var splitIndex = str.indexOf('=', index); - if (splitIndex === -1) break; - - var colonIndex = str.indexOf(';', index); - var endIndex = colonIndex === -1 ? length : colonIndex; - - if (splitIndex > endIndex) { - index = str.lastIndexOf(';', splitIndex - 1) + 1; - continue; - } - - var key = str.slice(index, splitIndex).trim(); - var value = str.slice(splitIndex + 1, endIndex).trim(); - - if (key === 'q') { - ret.quality = parseFloat(value); + for (var i = 1; i < parts.length; ++i) { + var pms = parts[i].split(/ *= */); + if ('q' === pms[0]) { + ret.quality = parseFloat(pms[1]); } else { - ret.params[key] = value; + ret.params[pms[0]] = pms[1]; } - - index = endIndex + 1; } return ret; @@ -170,6 +192,7 @@ exports.compileQueryParser = function compileQueryParser(val) { fn = querystring.parse; break; case false: + fn = newObject; break; case 'extended': fn = parseExtendedQueryString; @@ -267,3 +290,14 @@ function parseExtendedQueryString(str) { allowPrototypes: true }); } + +/** + * Return new empty object. + * + * @return {Object} + * @api private + */ + +function newObject() { + return {}; +} diff --git a/api/node_modules/express/lib/view.js b/api/node_modules/express/lib/view.js index d66b4a2..c08ab4d 100644 --- a/api/node_modules/express/lib/view.js +++ b/api/node_modules/express/lib/view.js @@ -14,8 +14,8 @@ */ var debug = require('debug')('express:view'); -var path = require('node:path'); -var fs = require('node:fs'); +var path = require('path'); +var fs = require('fs'); /** * Module variables. @@ -131,31 +131,8 @@ View.prototype.lookup = function lookup(name) { */ View.prototype.render = function render(options, callback) { - var sync = true; - debug('render "%s"', this.path); - - // render, normalizing sync callbacks - this.engine(this.path, options, function onRender() { - if (!sync) { - return callback.apply(this, arguments); - } - - // copy arguments - var args = new Array(arguments.length); - var cntx = this; - - for (var i = 0; i < arguments.length; i++) { - args[i] = arguments[i]; - } - - // force callback to be async - return process.nextTick(function renderTick() { - return callback.apply(cntx, args); - }); - }); - - sync = false; + this.engine(this.path, options, callback); }; /** diff --git a/api/node_modules/express/package.json b/api/node_modules/express/package.json index bdcd25e..60f65fe 100644 --- a/api/node_modules/express/package.json +++ b/api/node_modules/express/package.json @@ -1,7 +1,7 @@ { "name": "express", "description": "Fast, unopinionated, minimalist web framework", - "version": "5.1.0", + "version": "4.21.2", "author": "TJ Holowaychuk ", "contributors": [ "Aaron Heckmann ", @@ -14,7 +14,7 @@ ], "license": "MIT", "repository": "expressjs/express", - "homepage": "https://expressjs.com/", + "homepage": "http://expressjs.com/", "funding": { "type": "opencollective", "url": "https://opencollective.com/express" @@ -32,54 +32,58 @@ "api" ], "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" + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.7.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.12", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" }, "devDependencies": { "after": "0.8.2", - "connect-redis": "^8.0.1", - "cookie-parser": "1.4.7", - "cookie-session": "2.1.0", - "ejs": "^3.1.10", + "connect-redis": "3.4.2", + "cookie-parser": "1.4.6", + "cookie-session": "2.0.0", + "ejs": "3.1.9", "eslint": "8.47.0", - "express-session": "^1.18.1", + "express-session": "1.17.2", "hbs": "4.2.0", - "marked": "^15.0.3", + "marked": "0.7.0", "method-override": "3.0.0", - "mocha": "^10.7.3", + "mocha": "10.2.0", "morgan": "1.10.0", - "nyc": "^17.1.0", + "nyc": "15.1.0", "pbkdf2-password": "1.2.1", - "supertest": "^6.3.0", + "supertest": "6.3.0", "vhost": "~3.0.2" }, "engines": { - "node": ">= 18" + "node": ">= 0.10.0" }, "files": [ "LICENSE", @@ -90,7 +94,7 @@ ], "scripts": { "lint": "eslint .", - "test": "mocha --require test/support/env --reporter spec --check-leaks test/ test/acceptance/", + "test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/ test/acceptance/", "test-ci": "nyc --exclude examples --exclude test --exclude benchmarks --reporter=lcovonly --reporter=text npm test", "test-cov": "nyc --exclude examples --exclude test --exclude benchmarks --reporter=html --reporter=text npm test", "test-tap": "mocha --require test/support/env --reporter tap --check-leaks test/ test/acceptance/" diff --git a/api/node_modules/finalhandler/HISTORY.md b/api/node_modules/finalhandler/HISTORY.md index 4bc1850..7faa4f0 100644 --- a/api/node_modules/finalhandler/HISTORY.md +++ b/api/node_modules/finalhandler/HISTORY.md @@ -1,26 +1,3 @@ -v2.1.0 / 2025-03-05 -================== - - * deps: - * use caret notation for dependency versions - * encodeurl@^2.0.0 - * debug@^4.4.0 - * remove `ServerResponse.headersSent` support check - * remove setImmediate support check - * update test dependencies - * remove unnecessary devDependency `safe-buffer` - * remove `unpipe` package and use native `unpipe()` method - * remove unnecessary devDependency `readable-stream` - * refactor: use object spread to copy error headers - * refactor: use replaceAll instead of replace with a regex - * refactor: replace setHeaders function with optimized inline header setting - -v2.0.0 / 2024-09-02 -================== - - * drop support for node <18 - * ignore status message for HTTP/2 (#53) - v1.3.1 / 2024-09-11 ================== diff --git a/api/node_modules/finalhandler/index.js b/api/node_modules/finalhandler/index.js index bf15e48..ec34be9 100644 --- a/api/node_modules/finalhandler/index.js +++ b/api/node_modules/finalhandler/index.js @@ -17,12 +17,20 @@ var escapeHtml = require('escape-html') var onFinished = require('on-finished') var parseUrl = require('parseurl') var statuses = require('statuses') +var unpipe = require('unpipe') /** * Module variables. * @private */ +var DOUBLE_SPACE_REGEXP = /\x20{2}/g +var NEWLINE_REGEXP = /\n/g + +/* istanbul ignore next */ +var defer = typeof setImmediate === 'function' + ? setImmediate + : function (fn) { process.nextTick(fn.bind.apply(fn, arguments)) } var isFinished = onFinished.isFinished /** @@ -34,8 +42,8 @@ var isFinished = onFinished.isFinished function createHtmlDocument (message) { var body = escapeHtml(message) - .replaceAll('\n', '
') - .replaceAll(' ', '  ') + .replace(NEWLINE_REGEXP, '
') + .replace(DOUBLE_SPACE_REGEXP, '  ') return '\n' + '\n' + @@ -81,7 +89,7 @@ function finalhandler (req, res, options) { var status // ignore 404 on in-flight response - if (!err && res.headersSent) { + if (!err && headersSent(res)) { debug('cannot 404 after headers sent') return } @@ -111,11 +119,11 @@ function finalhandler (req, res, options) { // schedule onerror callback if (err && onerror) { - setImmediate(onerror, err, req, res) + defer(onerror, err, req, res) } // cannot actually respond - if (res.headersSent) { + if (headersSent(res)) { debug('cannot %d after headers sent', status) if (req.socket) { req.socket.destroy() @@ -141,7 +149,15 @@ function getErrorHeaders (err) { return undefined } - return { ...err.headers } + var headers = Object.create(null) + var keys = Object.keys(err.headers) + + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + headers[key] = err.headers[key] + } + + return headers } /** @@ -230,6 +246,20 @@ function getResponseStatusCode (res) { return status } +/** + * Determine if the response headers have been sent. + * + * @param {object} res + * @returns {boolean} + * @private + */ + +function headersSent (res) { + return typeof res.headersSent !== 'boolean' + ? Boolean(res._header) + : res.headersSent +} + /** * Send response. * @@ -259,9 +289,7 @@ function send (req, res, status, headers, message) { res.removeHeader('Content-Range') // response headers - for (const [key, value] of Object.entries(headers ?? {})) { - res.setHeader(key, value) - } + setHeaders(res, headers) // security headers res.setHeader('Content-Security-Policy', "default-src 'none'") @@ -285,9 +313,29 @@ function send (req, res, status, headers, message) { } // unpipe everything from the request - req.unpipe() + unpipe(req) // flush the request onFinished(req, write) req.resume() } + +/** + * Set response headers from an object. + * + * @param {OutgoingMessage} res + * @param {object} headers + * @private + */ + +function setHeaders (res, headers) { + if (!headers) { + return + } + + var keys = Object.keys(headers) + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + res.setHeader(key, headers[key]) + } +} diff --git a/api/node_modules/finalhandler/package.json b/api/node_modules/finalhandler/package.json index 992b306..2363eb4 100644 --- a/api/node_modules/finalhandler/package.json +++ b/api/node_modules/finalhandler/package.json @@ -1,17 +1,18 @@ { "name": "finalhandler", "description": "Node.js final http responder", - "version": "2.1.0", + "version": "1.3.1", "author": "Douglas Christopher Wilson ", "license": "MIT", "repository": "pillarjs/finalhandler", "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" + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" }, "devDependencies": { "eslint": "7.32.0", @@ -21,13 +22,16 @@ "eslint-plugin-node": "11.1.0", "eslint-plugin-promise": "5.2.0", "eslint-plugin-standard": "4.1.0", - "mocha": "^11.0.1", - "nyc": "^17.1.0", - "supertest": "^7.0.0" + "mocha": "10.0.0", + "nyc": "15.1.0", + "readable-stream": "2.3.6", + "safe-buffer": "5.2.1", + "supertest": "6.2.4" }, "files": [ "LICENSE", "HISTORY.md", + "SECURITY.md", "index.js" ], "engines": { diff --git a/api/node_modules/fresh/HISTORY.md b/api/node_modules/fresh/HISTORY.md index fd3888a..4586996 100644 --- a/api/node_modules/fresh/HISTORY.md +++ b/api/node_modules/fresh/HISTORY.md @@ -1,13 +1,3 @@ -2.0.0 - 2024-09-04 -========== - * Drop support for Node.js <18 - -1.0.0 - 2024-09-04 -========== - - * Drop support for Node.js below 0.8 - * Fix: Ignore `If-Modified-Since` in the presence of `If-None-Match`, according to [spec](https://www.rfc-editor.org/rfc/rfc9110.html#section-13.1.3-5). Fixes [#35](https://github.com/jshttp/fresh/issues/35) - 0.5.2 / 2017-09-13 ================== diff --git a/api/node_modules/fresh/README.md b/api/node_modules/fresh/README.md index fd79c5b..1c1c680 100644 --- a/api/node_modules/fresh/README.md +++ b/api/node_modules/fresh/README.md @@ -3,7 +3,7 @@ [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] [![Node.js Version][node-version-image]][node-version-url] -[![Build Status][ci-image]][ci-url] +[![Build Status][travis-image]][travis-url] [![Test Coverage][coveralls-image]][coveralls-url] HTTP response freshness testing @@ -20,6 +20,8 @@ $ npm install fresh ## API + + ```js var fresh = require('fresh') ``` @@ -40,7 +42,7 @@ to make handling these requests transparent. This module is designed to only follow the HTTP specifications, not to work-around all kinda of client bugs (especially since this module -typically does not receive enough information to understand what the +typically does not recieve enough information to understand what the client actually is). There is a known issue that in certain versions of Safari, Safari @@ -55,16 +57,16 @@ links to further reading on this Safari bug. ### API usage - + ```js var reqHeaders = { 'if-none-match': '"foo"' } -var resHeaders = { etag: '"bar"' } +var resHeaders = { 'etag': '"bar"' } fresh(reqHeaders, resHeaders) // => false var reqHeaders = { 'if-none-match': '"foo"' } -var resHeaders = { etag: '"foo"' } +var resHeaders = { 'etag': '"foo"' } fresh(reqHeaders, resHeaders) // => true ``` @@ -93,7 +95,7 @@ var server = http.createServer(function (req, res) { function isFresh (req, res) { return fresh(req.headers, { - etag: res.getHeader('ETag'), + 'etag': res.getHeader('ETag'), 'last-modified': res.getHeader('Last-Modified') }) } @@ -105,12 +107,12 @@ server.listen(3000) [MIT](LICENSE) -[ci-image]: https://img.shields.io/github/workflow/status/jshttp/fresh/ci/master?label=ci -[ci-url]: https://github.com/jshttp/fresh/actions/workflows/ci.yml [npm-image]: https://img.shields.io/npm/v/fresh.svg [npm-url]: https://npmjs.org/package/fresh [node-version-image]: https://img.shields.io/node/v/fresh.svg [node-version-url]: https://nodejs.org/en/ +[travis-image]: https://img.shields.io/travis/jshttp/fresh/master.svg +[travis-url]: https://travis-ci.org/jshttp/fresh [coveralls-image]: https://img.shields.io/coveralls/jshttp/fresh/master.svg [coveralls-url]: https://coveralls.io/r/jshttp/fresh?branch=master [downloads-image]: https://img.shields.io/npm/dm/fresh.svg diff --git a/api/node_modules/fresh/index.js b/api/node_modules/fresh/index.js index fc3dea7..d154f5a 100644 --- a/api/node_modules/fresh/index.js +++ b/api/node_modules/fresh/index.js @@ -48,26 +48,27 @@ function fresh (reqHeaders, resHeaders) { return false } - // if-none-match takes precedent over if-modified-since - if (noneMatch) { - if (noneMatch === '*') { - return true - } - var etag = resHeaders.etag + // if-none-match + if (noneMatch && noneMatch !== '*') { + var etag = resHeaders['etag'] if (!etag) { return false } + var etagStale = true var matches = parseTokenList(noneMatch) for (var i = 0; i < matches.length; i++) { var match = matches[i] if (match === etag || match === 'W/' + etag || 'W/' + match === etag) { - return true + etagStale = false + break } } - return false + if (etagStale) { + return false + } } // if-modified-since diff --git a/api/node_modules/fresh/package.json b/api/node_modules/fresh/package.json index 5d7e215..c2fa0f4 100644 --- a/api/node_modules/fresh/package.json +++ b/api/node_modules/fresh/package.json @@ -1,7 +1,7 @@ { "name": "fresh", "description": "HTTP response freshness testing", - "version": "2.0.0", + "version": "0.5.2", "author": "TJ Holowaychuk (http://tjholowaychuk.com)", "contributors": [ "Douglas Christopher Wilson ", @@ -18,15 +18,15 @@ "devDependencies": { "beautify-benchmark": "0.2.4", "benchmark": "2.1.4", - "eslint": "8.12.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": "6.0.0", - "eslint-plugin-standard": "4.1.0", - "mocha": "9.2.0", - "nyc": "15.1.0" + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "5.1.1", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "1.21.5" }, "files": [ "HISTORY.md", @@ -34,13 +34,13 @@ "index.js" ], "engines": { - "node": ">= 0.8" + "node": ">= 0.6" }, "scripts": { "bench": "node benchmark/index.js", - "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" + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" } } diff --git a/api/node_modules/iconv-lite/.github/dependabot.yml b/api/node_modules/iconv-lite/.github/dependabot.yml deleted file mode 100644 index e4a0e0a..0000000 --- a/api/node_modules/iconv-lite/.github/dependabot.yml +++ /dev/null @@ -1,11 +0,0 @@ -# Please see the documentation for all configuration options: -# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: - - package-ecosystem: "npm" - directory: "/" - schedule: - interval: "daily" - allow: - - dependency-type: production diff --git a/api/node_modules/iconv-lite/.idea/codeStyles/Project.xml b/api/node_modules/iconv-lite/.idea/codeStyles/Project.xml deleted file mode 100644 index 3f2688c..0000000 --- a/api/node_modules/iconv-lite/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/api/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml b/api/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123..0000000 --- a/api/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/api/node_modules/iconv-lite/.idea/iconv-lite.iml b/api/node_modules/iconv-lite/.idea/iconv-lite.iml deleted file mode 100644 index 0c8867d..0000000 --- a/api/node_modules/iconv-lite/.idea/iconv-lite.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/api/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml b/api/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 03d9549..0000000 --- a/api/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/api/node_modules/iconv-lite/.idea/modules.xml b/api/node_modules/iconv-lite/.idea/modules.xml deleted file mode 100644 index 5d24f2e..0000000 --- a/api/node_modules/iconv-lite/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/api/node_modules/iconv-lite/.idea/vcs.xml b/api/node_modules/iconv-lite/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/api/node_modules/iconv-lite/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/api/node_modules/iconv-lite/Changelog.md b/api/node_modules/iconv-lite/Changelog.md index 464549b..f252313 100644 --- a/api/node_modules/iconv-lite/Changelog.md +++ b/api/node_modules/iconv-lite/Changelog.md @@ -1,100 +1,50 @@ -## 0.6.3 / 2021-05-23 - * Fix HKSCS encoding to prefer Big5 codes if both Big5 and HKSCS codes are possible (#264) - - -## 0.6.2 / 2020-07-08 - * Support Uint8Array-s decoding without conversion to Buffers, plus fix an edge case. - - -## 0.6.1 / 2020-06-28 - * Support Uint8Array-s directly when decoding (#246, by @gyzerok) - * Unify package.json version ranges to be strictly semver-compatible (#241) - * Fix minor issue in UTF-32 decoder's endianness detection code. - - -## 0.6.0 / 2020-06-08 - * Updated 'gb18030' encoding to :2005 edition (see https://github.com/whatwg/encoding/issues/22). - * Removed `iconv.extendNodeEncodings()` mechanism. It was deprecated 5 years ago and didn't work - in recent Node versions. - * Reworked Streaming API behavior in browser environments to fix #204. Streaming API will be - excluded by default in browser packs, saving ~100Kb bundle size, unless enabled explicitly using - `iconv.enableStreamingAPI(require('stream'))`. - * Updates to development environment & tests: - * Added ./test/webpack private package to test complex new use cases that need custom environment. - It's tested as a separate job in Travis CI. - * Updated generation code for the new EUC-KR index file format from Encoding Standard. - * Removed Buffer() constructor in tests (#197 by @gabrielschulhof). - - -## 0.5.2 / 2020-06-08 - * Added `iconv.getEncoder()` and `iconv.getDecoder()` methods to typescript definitions (#229). - * Fixed semver version to 6.1.2 to support Node 8.x (by @tanandara). - * Capped iconv version to 2.x as 3.x has dropped support for older Node versions. - * Switched from instanbul to c8 for code coverage. - - -## 0.5.1 / 2020-01-18 - - * Added cp720 encoding (#221, by @kr-deps) - * (minor) Changed Changelog.md formatting to use h2. - - -## 0.5.0 / 2019-06-26 - - * Added UTF-32 encoding, both little-endian and big-endian variants (UTF-32LE, UTF32-BE). If endianness - is not provided for decoding, it's deduced automatically from the stream using a heuristic similar to - what we use in UTF-16. (great work in #216 by @kshetline) - * Several minor updates to README (#217 by @oldj, plus some more) - * Added Node versions 10 and 12 to Travis test harness. - - -## 0.4.24 / 2018-08-22 +# 0.4.24 / 2018-08-22 * Added MIK encoding (#196, by @Ivan-Kalatchev) -## 0.4.23 / 2018-05-07 +# 0.4.23 / 2018-05-07 * Fix deprecation warning in Node v10 due to the last usage of `new Buffer` (#185, by @felixbuenemann) * Switched from NodeBuffer to Buffer in typings (#155 by @felixfbecker, #186 by @larssn) -## 0.4.22 / 2018-05-05 +# 0.4.22 / 2018-05-05 * Use older semver style for dependencies to be compatible with Node version 0.10 (#182, by @dougwilson) * Fix tests to accomodate fixes in Node v10 (#182, by @dougwilson) -## 0.4.21 / 2018-04-06 +# 0.4.21 / 2018-04-06 * Fix encoding canonicalization (#156) * Fix the paths in the "browser" field in package.json (#174 by @LMLB) * Removed "contributors" section in package.json - see Git history instead. -## 0.4.20 / 2018-04-06 +# 0.4.20 / 2018-04-06 * Updated `new Buffer()` usages with recommended replacements as it's being deprecated in Node v10 (#176, #178 by @ChALkeR) -## 0.4.19 / 2017-09-09 +# 0.4.19 / 2017-09-09 * Fixed iso8859-1 codec regression in handling untranslatable characters (#162, caused by #147) * Re-generated windows1255 codec, because it was updated in iconv project * Fixed grammar in error message when iconv-lite is loaded with encoding other than utf8 -## 0.4.18 / 2017-06-13 +# 0.4.18 / 2017-06-13 * Fixed CESU-8 regression in Node v8. -## 0.4.17 / 2017-04-22 +# 0.4.17 / 2017-04-22 * Updated typescript definition file to support Angular 2 AoT mode (#153 by @larssn) -## 0.4.16 / 2017-04-22 +# 0.4.16 / 2017-04-22 * Added support for React Native (#150) * Changed iso8859-1 encoding to usine internal 'binary' encoding, as it's the same thing (#147 by @mscdex) @@ -103,12 +53,12 @@ * Added a warning if iconv-lite is loaded not as utf-8 (see #142) -## 0.4.15 / 2016-11-21 +# 0.4.15 / 2016-11-21 * Fixed typescript type definition (#137) -## 0.4.14 / 2016-11-20 +# 0.4.14 / 2016-11-20 * Preparation for v1.0 * Added Node v6 and latest Node versions to Travis CI test rig @@ -118,12 +68,12 @@ * Add ms prefix to dbcs windows encodings (@rokoroku) -## 0.4.13 / 2015-10-01 +# 0.4.13 / 2015-10-01 * Fix silly mistake in deprecation notice. -## 0.4.12 / 2015-09-26 +# 0.4.12 / 2015-09-26 * Node v4 support: * Added CESU-8 decoding (#106) @@ -131,18 +81,18 @@ * Added Travis tests for Node v4 and io.js latest (#105 by @Mithgol) -## 0.4.11 / 2015-07-03 +# 0.4.11 / 2015-07-03 * Added CESU-8 encoding. -## 0.4.10 / 2015-05-26 +# 0.4.10 / 2015-05-26 * Changed UTF-16 endianness heuristic to take into account any ASCII chars, not just spaces. This should minimize the importance of "default" endianness. -## 0.4.9 / 2015-05-24 +# 0.4.9 / 2015-05-24 * Streamlined BOM handling: strip BOM by default, add BOM when encoding if addBOM: true. Added docs to Readme. @@ -154,12 +104,12 @@ * Use strict mode in all files. -## 0.4.8 / 2015-04-14 +# 0.4.8 / 2015-04-14 * added alias UNICODE-1-1-UTF-7 for UTF-7 encoding (#94) -## 0.4.7 / 2015-02-05 +# 0.4.7 / 2015-02-05 * stop official support of Node.js v0.8. Should still work, but no guarantees. reason: Packages needed for testing are hard to get on Travis CI. @@ -167,40 +117,40 @@ props (#89). -## 0.4.6 / 2015-01-12 +# 0.4.6 / 2015-01-12 * fix rare aliases of single-byte encodings (thanks @mscdex) * double the timeout for dbcs tests to make them less flaky on travis -## 0.4.5 / 2014-11-20 +# 0.4.5 / 2014-11-20 * fix windows-31j and x-sjis encoding support (@nleush) * minor fix: undefined variable reference when internal error happens -## 0.4.4 / 2014-07-16 +# 0.4.4 / 2014-07-16 * added encodings UTF-7 (RFC2152) and UTF-7-IMAP (RFC3501 Section 5.1.3) * fixed streaming base64 encoding -## 0.4.3 / 2014-06-14 +# 0.4.3 / 2014-06-14 * added encodings UTF-16BE and UTF-16 with BOM -## 0.4.2 / 2014-06-12 +# 0.4.2 / 2014-06-12 * don't throw exception if `extendNodeEncodings()` is called more than once -## 0.4.1 / 2014-06-11 +# 0.4.1 / 2014-06-11 * codepage 808 added -## 0.4.0 / 2014-06-10 +# 0.4.0 / 2014-06-10 * code is rewritten from scratch * all widespread encodings are supported diff --git a/api/node_modules/iconv-lite/README.md b/api/node_modules/iconv-lite/README.md index 3c97f87..c981c37 100644 --- a/api/node_modules/iconv-lite/README.md +++ b/api/node_modules/iconv-lite/README.md @@ -1,40 +1,38 @@ -## iconv-lite: Pure JS character encoding conversion +## Pure JS character encoding conversion [![Build Status](https://travis-ci.org/ashtuchkin/iconv-lite.svg?branch=master)](https://travis-ci.org/ashtuchkin/iconv-lite) - * No need for native code compilation. Quick to install, works on Windows and in sandboxed environments like [Cloud9](http://c9.io). + * Doesn't need native code compilation. Works on Windows and in sandboxed environments like [Cloud9](http://c9.io). * Used in popular projects like [Express.js (body_parser)](https://github.com/expressjs/body-parser), [Grunt](http://gruntjs.com/), [Nodemailer](http://www.nodemailer.com/), [Yeoman](http://yeoman.io/) and others. * Faster than [node-iconv](https://github.com/bnoordhuis/node-iconv) (see below for performance comparison). - * Intuitive encode/decode API, including Streaming support. - * In-browser usage via [browserify](https://github.com/substack/node-browserify) or [webpack](https://webpack.js.org/) (~180kb gzip compressed with Buffer shim included). + * Intuitive encode/decode API + * Streaming support for Node v0.10+ + * [Deprecated] Can extend Node.js primitives (buffers, streams) to support all iconv-lite encodings. + * In-browser usage via [Browserify](https://github.com/substack/node-browserify) (~180k gzip compressed with Buffer shim included). * Typescript [type definition file](https://github.com/ashtuchkin/iconv-lite/blob/master/lib/index.d.ts) included. - * React Native is supported (need to install `stream` module to enable Streaming API). + * React Native is supported (need to explicitly `npm install` two more modules: `buffer` and `stream`). * License: MIT. -[![NPM Stats](https://nodei.co/npm/iconv-lite.png)](https://npmjs.org/package/iconv-lite/) -[![Build Status](https://travis-ci.org/ashtuchkin/iconv-lite.svg?branch=master)](https://travis-ci.org/ashtuchkin/iconv-lite) -[![npm](https://img.shields.io/npm/v/iconv-lite.svg)](https://npmjs.org/package/iconv-lite/) -[![npm downloads](https://img.shields.io/npm/dm/iconv-lite.svg)](https://npmjs.org/package/iconv-lite/) -[![npm bundle size](https://img.shields.io/bundlephobia/min/iconv-lite.svg)](https://npmjs.org/package/iconv-lite/) +[![NPM Stats](https://nodei.co/npm/iconv-lite.png?downloads=true&downloadRank=true)](https://npmjs.org/packages/iconv-lite/) ## Usage ### Basic API ```javascript var iconv = require('iconv-lite'); -// Convert from an encoded buffer to a js string. +// Convert from an encoded buffer to js string. str = iconv.decode(Buffer.from([0x68, 0x65, 0x6c, 0x6c, 0x6f]), 'win1251'); -// Convert from a js string to an encoded buffer. +// Convert from js string to an encoded buffer. buf = iconv.encode("Sample input string", 'win1251'); // Check if encoding is supported iconv.encodingExists("us-ascii") ``` -### Streaming API +### Streaming API (Node v0.10+) ```javascript -// Decode stream (from binary data stream to js strings) +// Decode stream (from binary stream to js strings) http.createServer(function(req, res) { var converterStream = iconv.decodeStream('win1251'); req.pipe(converterStream); @@ -59,10 +57,44 @@ http.createServer(function(req, res) { }); ``` +### [Deprecated] Extend Node.js own encodings +> NOTE: This doesn't work on latest Node versions. See [details](https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility). + +```javascript +// After this call all Node basic primitives will understand iconv-lite encodings. +iconv.extendNodeEncodings(); + +// Examples: +buf = new Buffer(str, 'win1251'); +buf.write(str, 'gbk'); +str = buf.toString('latin1'); +assert(Buffer.isEncoding('iso-8859-15')); +Buffer.byteLength(str, 'us-ascii'); + +http.createServer(function(req, res) { + req.setEncoding('big5'); + req.collect(function(err, body) { + console.log(body); + }); +}); + +fs.createReadStream("file.txt", "shift_jis"); + +// External modules are also supported (if they use Node primitives, which they probably do). +request = require('request'); +request({ + url: "http://github.com/", + encoding: "cp932" +}); + +// To remove extensions +iconv.undoExtendNodeEncodings(); +``` + ## Supported encodings * All node.js native encodings: utf8, ucs2 / utf16-le, ascii, binary, base64, hex. - * Additional unicode encodings: utf16, utf16-be, utf-7, utf-7-imap, utf32, utf32-le, and utf32-be. + * Additional unicode encodings: utf16, utf16-be, utf-7, utf-7-imap. * All widespread singlebyte encodings: Windows 125x family, ISO-8859 family, IBM/DOS codepages, Macintosh family, KOI8 family, all others supported by iconv library. Aliases like 'latin1', 'us-ascii' also supported. @@ -101,12 +133,6 @@ smart about endianness in the following ways: overridden with `defaultEncoding: 'utf-16be'` option. Strips BOM unless `stripBOM: false`. * Encoding: uses UTF-16LE and writes BOM by default. Use `addBOM: false` to override. -## UTF-32 Encodings - -This library supports UTF-32LE, UTF-32BE and UTF-32 encodings. Like the UTF-16 encoding above, UTF-32 defaults to UTF-32LE, but uses BOM and 'spaces heuristics' to determine input endianness. - * The default of UTF-32LE can be overridden with the `defaultEncoding: 'utf-32be'` option. Strips BOM unless `stripBOM: false`. - * Encoding: uses UTF-32LE and writes BOM by default. Use `addBOM: false` to override. (`defaultEncoding: 'utf-32be'` can also be used here to change encoding.) - ## Other notes When decoding, be sure to supply a Buffer to decode() method, otherwise [bad things usually happen](https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding). diff --git a/api/node_modules/iconv-lite/encodings/dbcs-codec.js b/api/node_modules/iconv-lite/encodings/dbcs-codec.js index fa83917..1fe3e16 100644 --- a/api/node_modules/iconv-lite/encodings/dbcs-codec.js +++ b/api/node_modules/iconv-lite/encodings/dbcs-codec.js @@ -49,48 +49,6 @@ function DBCSCodec(codecOptions, iconv) { for (var i = 0; i < mappingTable.length; i++) this._addDecodeChunk(mappingTable[i]); - // Load & create GB18030 tables when needed. - if (typeof codecOptions.gb18030 === 'function') { - this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges. - - // Add GB18030 common decode nodes. - var commonThirdByteNodeIdx = this.decodeTables.length; - this.decodeTables.push(UNASSIGNED_NODE.slice(0)); - - var commonFourthByteNodeIdx = this.decodeTables.length; - this.decodeTables.push(UNASSIGNED_NODE.slice(0)); - - // Fill out the tree - var firstByteNode = this.decodeTables[0]; - for (var i = 0x81; i <= 0xFE; i++) { - var secondByteNode = this.decodeTables[NODE_START - firstByteNode[i]]; - for (var j = 0x30; j <= 0x39; j++) { - if (secondByteNode[j] === UNASSIGNED) { - secondByteNode[j] = NODE_START - commonThirdByteNodeIdx; - } else if (secondByteNode[j] > NODE_START) { - throw new Error("gb18030 decode tables conflict at byte 2"); - } - - var thirdByteNode = this.decodeTables[NODE_START - secondByteNode[j]]; - for (var k = 0x81; k <= 0xFE; k++) { - if (thirdByteNode[k] === UNASSIGNED) { - thirdByteNode[k] = NODE_START - commonFourthByteNodeIdx; - } else if (thirdByteNode[k] === NODE_START - commonFourthByteNodeIdx) { - continue; - } else if (thirdByteNode[k] > NODE_START) { - throw new Error("gb18030 decode tables conflict at byte 3"); - } - - var fourthByteNode = this.decodeTables[NODE_START - thirdByteNode[k]]; - for (var l = 0x30; l <= 0x39; l++) { - if (fourthByteNode[l] === UNASSIGNED) - fourthByteNode[l] = GB18030_CODE; - } - } - } - } - } - this.defaultCharUnicode = iconv.defaultCharUnicode; @@ -134,6 +92,30 @@ function DBCSCodec(codecOptions, iconv) { this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)]; if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]['?']; if (this.defCharSB === UNASSIGNED) this.defCharSB = "?".charCodeAt(0); + + + // Load & create GB18030 tables when needed. + if (typeof codecOptions.gb18030 === 'function') { + this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges. + + // Add GB18030 decode tables. + var thirdByteNodeIdx = this.decodeTables.length; + var thirdByteNode = this.decodeTables[thirdByteNodeIdx] = UNASSIGNED_NODE.slice(0); + + var fourthByteNodeIdx = this.decodeTables.length; + var fourthByteNode = this.decodeTables[fourthByteNodeIdx] = UNASSIGNED_NODE.slice(0); + + for (var i = 0x81; i <= 0xFE; i++) { + var secondByteNodeIdx = NODE_START - this.decodeTables[0][i]; + var secondByteNode = this.decodeTables[secondByteNodeIdx]; + for (var j = 0x30; j <= 0x39; j++) + secondByteNode[j] = NODE_START - thirdByteNodeIdx; + } + for (var i = 0x81; i <= 0xFE; i++) + thirdByteNode[i] = NODE_START - fourthByteNodeIdx; + for (var i = 0x30; i <= 0x39; i++) + fourthByteNode[i] = GB18030_CODE + } } DBCSCodec.prototype.encoder = DBCSEncoder; @@ -142,7 +124,7 @@ DBCSCodec.prototype.decoder = DBCSDecoder; // Decoder helpers DBCSCodec.prototype._getDecodeTrieNode = function(addr) { var bytes = []; - for (; addr > 0; addr >>>= 8) + for (; addr > 0; addr >>= 8) bytes.push(addr & 0xFF); if (bytes.length == 0) bytes.push(0); @@ -267,32 +249,19 @@ DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) { DBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) { var node = this.decodeTables[nodeIdx]; - var hasValues = false; - var subNodeEmpty = {}; for (var i = 0; i < 0x100; i++) { var uCode = node[i]; var mbCode = prefix + i; if (skipEncodeChars[mbCode]) continue; - if (uCode >= 0) { + if (uCode >= 0) this._setEncodeChar(uCode, mbCode); - hasValues = true; - } else if (uCode <= NODE_START) { - var subNodeIdx = NODE_START - uCode; - if (!subNodeEmpty[subNodeIdx]) { // Skip empty subtrees (they are too large in gb18030). - var newPrefix = (mbCode << 8) >>> 0; // NOTE: '>>> 0' keeps 32-bit num positive. - if (this._fillEncodeTable(subNodeIdx, newPrefix, skipEncodeChars)) - hasValues = true; - else - subNodeEmpty[subNodeIdx] = true; - } - } else if (uCode <= SEQ_START) { + else if (uCode <= NODE_START) + this._fillEncodeTable(NODE_START - uCode, mbCode << 8, skipEncodeChars); + else if (uCode <= SEQ_START) this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode); - hasValues = true; - } } - return hasValues; } @@ -419,15 +388,10 @@ DBCSEncoder.prototype.write = function(str) { newBuf[j++] = dbcsCode >> 8; // high byte newBuf[j++] = dbcsCode & 0xFF; // low byte } - else if (dbcsCode < 0x1000000) { + else { newBuf[j++] = dbcsCode >> 16; newBuf[j++] = (dbcsCode >> 8) & 0xFF; newBuf[j++] = dbcsCode & 0xFF; - } else { - newBuf[j++] = dbcsCode >>> 24; - newBuf[j++] = (dbcsCode >>> 16) & 0xFF; - newBuf[j++] = (dbcsCode >>> 8) & 0xFF; - newBuf[j++] = dbcsCode & 0xFF; } } @@ -476,7 +440,7 @@ DBCSEncoder.prototype.findIdx = findIdx; function DBCSDecoder(options, codec) { // Decoder state this.nodeIdx = 0; - this.prevBytes = []; + this.prevBuf = Buffer.alloc(0); // Static data this.decodeTables = codec.decodeTables; @@ -488,12 +452,15 @@ function DBCSDecoder(options, codec) { DBCSDecoder.prototype.write = function(buf) { var newBuf = Buffer.alloc(buf.length*2), nodeIdx = this.nodeIdx, - prevBytes = this.prevBytes, prevOffset = this.prevBytes.length, - seqStart = -this.prevBytes.length, // idx of the start of current parsed sequence. + prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length, + seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence. uCode; + if (prevBufOffset > 0) // Make prev buf overlap a little to make it easier to slice later. + prevBuf = Buffer.concat([prevBuf, buf.slice(0, 10)]); + for (var i = 0, j = 0; i < buf.length; i++) { - var curByte = (i >= 0) ? buf[i] : prevBytes[i + prevOffset]; + var curByte = (i >= 0) ? buf[i] : prevBuf[i + prevBufOffset]; // Lookup in current trie node. var uCode = this.decodeTables[nodeIdx][curByte]; @@ -503,18 +470,13 @@ DBCSDecoder.prototype.write = function(buf) { } else if (uCode === UNASSIGNED) { // Unknown char. // TODO: Callback with seq. + //var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset); + i = seqStart; // Try to parse again, after skipping first byte of the sequence ('i' will be incremented by 'for' cycle). uCode = this.defaultCharUnicode.charCodeAt(0); - i = seqStart; // Skip one byte ('i' will be incremented by the for loop) and try to parse again. } else if (uCode === GB18030_CODE) { - if (i >= 3) { - var ptr = (buf[i-3]-0x81)*12600 + (buf[i-2]-0x30)*1260 + (buf[i-1]-0x81)*10 + (curByte-0x30); - } else { - var ptr = (prevBytes[i-3+prevOffset]-0x81)*12600 + - (((i-2 >= 0) ? buf[i-2] : prevBytes[i-2+prevOffset])-0x30)*1260 + - (((i-1 >= 0) ? buf[i-1] : prevBytes[i-1+prevOffset])-0x81)*10 + - (curByte-0x30); - } + var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset); + var ptr = (curSeq[0]-0x81)*12600 + (curSeq[1]-0x30)*1260 + (curSeq[2]-0x81)*10 + (curSeq[3]-0x30); var idx = findIdx(this.gb18030.gbChars, ptr); uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx]; } @@ -535,13 +497,13 @@ DBCSDecoder.prototype.write = function(buf) { throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte); // Write the character to buffer, handling higher planes using surrogate pair. - if (uCode >= 0x10000) { + if (uCode > 0xFFFF) { uCode -= 0x10000; - var uCodeLead = 0xD800 | (uCode >> 10); + var uCodeLead = 0xD800 + Math.floor(uCode / 0x400); newBuf[j++] = uCodeLead & 0xFF; newBuf[j++] = uCodeLead >> 8; - uCode = 0xDC00 | (uCode & 0x3FF); + uCode = 0xDC00 + uCode % 0x400; } newBuf[j++] = uCode & 0xFF; newBuf[j++] = uCode >> 8; @@ -551,10 +513,7 @@ DBCSDecoder.prototype.write = function(buf) { } this.nodeIdx = nodeIdx; - this.prevBytes = (seqStart >= 0) - ? Array.prototype.slice.call(buf, seqStart) - : prevBytes.slice(seqStart + prevOffset).concat(Array.prototype.slice.call(buf)); - + this.prevBuf = (seqStart >= 0) ? buf.slice(seqStart) : prevBuf.slice(seqStart + prevBufOffset); return newBuf.slice(0, j).toString('ucs2'); } @@ -562,19 +521,18 @@ DBCSDecoder.prototype.end = function() { var ret = ''; // Try to parse all remaining chars. - while (this.prevBytes.length > 0) { + while (this.prevBuf.length > 0) { // Skip 1 character in the buffer. ret += this.defaultCharUnicode; - var bytesArr = this.prevBytes.slice(1); + var buf = this.prevBuf.slice(1); // Parse remaining as usual. - this.prevBytes = []; + this.prevBuf = Buffer.alloc(0); this.nodeIdx = 0; - if (bytesArr.length > 0) - ret += this.write(bytesArr); + if (buf.length > 0) + ret += this.write(buf); } - this.prevBytes = []; this.nodeIdx = 0; return ret; } @@ -586,7 +544,7 @@ function findIdx(table, val) { var l = 0, r = table.length; while (l < r-1) { // always table[l] <= val < table[r] - var mid = l + ((r-l+1) >> 1); + var mid = l + Math.floor((r-l+1)/2); if (table[mid] <= val) l = mid; else diff --git a/api/node_modules/iconv-lite/encodings/dbcs-data.js b/api/node_modules/iconv-lite/encodings/dbcs-data.js index 0d17e58..4b61914 100644 --- a/api/node_modules/iconv-lite/encodings/dbcs-data.js +++ b/api/node_modules/iconv-lite/encodings/dbcs-data.js @@ -167,19 +167,7 @@ module.exports = { 'big5hkscs': { type: '_dbcs', table: function() { return require('./tables/cp950.json').concat(require('./tables/big5-added.json')) }, - encodeSkipVals: [ - // Although Encoding Standard says we should avoid encoding to HKSCS area (See Step 1 of - // https://encoding.spec.whatwg.org/#index-big5-pointer), we still do it to increase compatibility with ICU. - // But if a single unicode point can be encoded both as HKSCS and regular Big5, we prefer the latter. - 0x8e69, 0x8e6f, 0x8e7e, 0x8eab, 0x8eb4, 0x8ecd, 0x8ed0, 0x8f57, 0x8f69, 0x8f6e, 0x8fcb, 0x8ffe, - 0x906d, 0x907a, 0x90c4, 0x90dc, 0x90f1, 0x91bf, 0x92af, 0x92b0, 0x92b1, 0x92b2, 0x92d1, 0x9447, 0x94ca, - 0x95d9, 0x96fc, 0x9975, 0x9b76, 0x9b78, 0x9b7b, 0x9bc6, 0x9bde, 0x9bec, 0x9bf6, 0x9c42, 0x9c53, 0x9c62, - 0x9c68, 0x9c6b, 0x9c77, 0x9cbc, 0x9cbd, 0x9cd0, 0x9d57, 0x9d5a, 0x9dc4, 0x9def, 0x9dfb, 0x9ea9, 0x9eef, - 0x9efd, 0x9f60, 0x9fcb, 0xa077, 0xa0dc, 0xa0df, 0x8fcc, 0x92c8, 0x9644, 0x96ed, - - // Step 2 of https://encoding.spec.whatwg.org/#index-big5-pointer: Use last pointer for U+2550, U+255E, U+2561, U+256A, U+5341, or U+5345 - 0xa2a4, 0xa2a5, 0xa2a7, 0xa2a6, 0xa2cc, 0xa2ce, - ], + encodeSkipVals: [0xa2cc], }, 'cnbig5': 'big5hkscs', diff --git a/api/node_modules/iconv-lite/encodings/index.js b/api/node_modules/iconv-lite/encodings/index.js index d95c244..e304003 100644 --- a/api/node_modules/iconv-lite/encodings/index.js +++ b/api/node_modules/iconv-lite/encodings/index.js @@ -4,7 +4,6 @@ // We support Browserify by skipping automatic module discovery and requiring modules directly. var modules = [ require("./internal"), - require("./utf32"), require("./utf16"), require("./utf7"), require("./sbcs-codec"), @@ -14,7 +13,7 @@ var modules = [ require("./dbcs-data"), ]; -// Put all encoding/alias/codec definitions to single object and export it. +// Put all encoding/alias/codec definitions to single object and export it. for (var i = 0; i < modules.length; i++) { var module = modules[i]; for (var enc in module) diff --git a/api/node_modules/iconv-lite/encodings/internal.js b/api/node_modules/iconv-lite/encodings/internal.js index dc1074f..05ce38b 100644 --- a/api/node_modules/iconv-lite/encodings/internal.js +++ b/api/node_modules/iconv-lite/encodings/internal.js @@ -53,20 +53,10 @@ if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method. function InternalDecoder(options, codec) { - this.decoder = new StringDecoder(codec.enc); + StringDecoder.call(this, codec.enc); } -InternalDecoder.prototype.write = function(buf) { - if (!Buffer.isBuffer(buf)) { - buf = Buffer.from(buf); - } - - return this.decoder.write(buf); -} - -InternalDecoder.prototype.end = function() { - return this.decoder.end(); -} +InternalDecoder.prototype = StringDecoder.prototype; //------------------------------------------------------------------------------ diff --git a/api/node_modules/iconv-lite/encodings/sbcs-data.js b/api/node_modules/iconv-lite/encodings/sbcs-data.js index 066f904..fdb81a3 100644 --- a/api/node_modules/iconv-lite/encodings/sbcs-data.js +++ b/api/node_modules/iconv-lite/encodings/sbcs-data.js @@ -22,11 +22,6 @@ module.exports = { "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя└┴┬├─┼╣║╚╔╩╦╠═╬┐░▒▓│┤№§╗╝┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " }, - "cp720": { - "type": "_sbcs", - "chars": "\x80\x81éâ\x84à\x86çêëèïî\x8d\x8e\x8f\x90\u0651\u0652ô¤ـûùءآأؤ£إئابةتثجحخدذرزسشص«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ضطظعغفµقكلمنهوىي≡\u064b\u064c\u064d\u064e\u064f\u0650≈°∙·√ⁿ²■\u00a0" - }, - // Aliases of generated encodings. "ascii8bit": "ascii", "usascii": "ascii", diff --git a/api/node_modules/iconv-lite/encodings/tables/gbk-added.json b/api/node_modules/iconv-lite/encodings/tables/gbk-added.json index b742e36..8abfa9f 100644 --- a/api/node_modules/iconv-lite/encodings/tables/gbk-added.json +++ b/api/node_modules/iconv-lite/encodings/tables/gbk-added.json @@ -27,7 +27,7 @@ ["a7c2","",14], ["a7f2","",12], ["a896","",10], -["a8bc","ḿ"], +["a8bc",""], ["a8bf","ǹ"], ["a8c1",""], ["a8ea","",20], @@ -51,6 +51,5 @@ ["fca1","",93], ["fda1","",93], ["fe50","⺁⺄㑳㑇⺈⺋㖞㘚㘎⺌⺗㥮㤘㧏㧟㩳㧐㭎㱮㳠⺧⺪䁖䅟⺮䌷⺳⺶⺷䎱䎬⺻䏝䓖䙡䙌"], -["fe80","䜣䜩䝼䞍⻊䥇䥺䥽䦂䦃䦅䦆䦟䦛䦷䦶䲣䲟䲠䲡䱷䲢䴓",6,"䶮",93], -["8135f437",""] +["fe80","䜣䜩䝼䞍⻊䥇䥺䥽䦂䦃䦅䦆䦟䦛䦷䦶䲣䲟䲠䲡䱷䲢䴓",6,"䶮",93] ] diff --git a/api/node_modules/iconv-lite/encodings/utf16.js b/api/node_modules/iconv-lite/encodings/utf16.js index 97d0669..54765ae 100644 --- a/api/node_modules/iconv-lite/encodings/utf16.js +++ b/api/node_modules/iconv-lite/encodings/utf16.js @@ -61,7 +61,6 @@ Utf16BEDecoder.prototype.write = function(buf) { } Utf16BEDecoder.prototype.end = function() { - this.overflowByte = -1; } @@ -104,8 +103,8 @@ Utf16Encoder.prototype.end = function() { function Utf16Decoder(options, codec) { this.decoder = null; - this.initialBufs = []; - this.initialBufsLen = 0; + this.initialBytes = []; + this.initialBytesLen = 0; this.options = options || {}; this.iconv = codec.iconv; @@ -114,22 +113,17 @@ function Utf16Decoder(options, codec) { Utf16Decoder.prototype.write = function(buf) { if (!this.decoder) { // Codec is not chosen yet. Accumulate initial bytes. - this.initialBufs.push(buf); - this.initialBufsLen += buf.length; + this.initialBytes.push(buf); + this.initialBytesLen += buf.length; - if (this.initialBufsLen < 16) // We need more bytes to use space heuristic (see below) + if (this.initialBytesLen < 16) // We need more bytes to use space heuristic (see below) return ''; // We have enough bytes -> detect endianness. - var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); + var buf = Buffer.concat(this.initialBytes), + encoding = detectEncoding(buf, this.options.defaultEncoding); this.decoder = this.iconv.getDecoder(encoding, this.options); - - var resStr = ''; - for (var i = 0; i < this.initialBufs.length; i++) - resStr += this.decoder.write(this.initialBufs[i]); - - this.initialBufs.length = this.initialBufsLen = 0; - return resStr; + this.initialBytes.length = this.initialBytesLen = 0; } return this.decoder.write(buf); @@ -137,61 +131,47 @@ Utf16Decoder.prototype.write = function(buf) { Utf16Decoder.prototype.end = function() { if (!this.decoder) { - var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); + var buf = Buffer.concat(this.initialBytes), + encoding = detectEncoding(buf, this.options.defaultEncoding); this.decoder = this.iconv.getDecoder(encoding, this.options); - var resStr = ''; - for (var i = 0; i < this.initialBufs.length; i++) - resStr += this.decoder.write(this.initialBufs[i]); + var res = this.decoder.write(buf), + trail = this.decoder.end(); - var trail = this.decoder.end(); - if (trail) - resStr += trail; - - this.initialBufs.length = this.initialBufsLen = 0; - return resStr; + return trail ? (res + trail) : res; } return this.decoder.end(); } -function detectEncoding(bufs, defaultEncoding) { - var b = []; - var charsProcessed = 0; - var asciiCharsLE = 0, asciiCharsBE = 0; // Number of ASCII chars when decoded as LE or BE. +function detectEncoding(buf, defaultEncoding) { + var enc = defaultEncoding || 'utf-16le'; - outer_loop: - for (var i = 0; i < bufs.length; i++) { - var buf = bufs[i]; - for (var j = 0; j < buf.length; j++) { - b.push(buf[j]); - if (b.length === 2) { - if (charsProcessed === 0) { - // Check BOM first. - if (b[0] === 0xFF && b[1] === 0xFE) return 'utf-16le'; - if (b[0] === 0xFE && b[1] === 0xFF) return 'utf-16be'; - } + if (buf.length >= 2) { + // Check BOM. + if (buf[0] == 0xFE && buf[1] == 0xFF) // UTF-16BE BOM + enc = 'utf-16be'; + else if (buf[0] == 0xFF && buf[1] == 0xFE) // UTF-16LE BOM + enc = 'utf-16le'; + else { + // No BOM found. Try to deduce encoding from initial content. + // Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon. + // So, we count ASCII as if it was LE or BE, and decide from that. + var asciiCharsLE = 0, asciiCharsBE = 0, // Counts of chars in both positions + _len = Math.min(buf.length - (buf.length % 2), 64); // Len is always even. - if (b[0] === 0 && b[1] !== 0) asciiCharsBE++; - if (b[0] !== 0 && b[1] === 0) asciiCharsLE++; - - b.length = 0; - charsProcessed++; - - if (charsProcessed >= 100) { - break outer_loop; - } + for (var i = 0; i < _len; i += 2) { + if (buf[i] === 0 && buf[i+1] !== 0) asciiCharsBE++; + if (buf[i] !== 0 && buf[i+1] === 0) asciiCharsLE++; } + + if (asciiCharsBE > asciiCharsLE) + enc = 'utf-16be'; + else if (asciiCharsBE < asciiCharsLE) + enc = 'utf-16le'; } } - // Make decisions. - // Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon. - // So, we count ASCII as if it was LE or BE, and decide from that. - if (asciiCharsBE > asciiCharsLE) return 'utf-16be'; - if (asciiCharsBE < asciiCharsLE) return 'utf-16le'; - - // Couldn't decide (likely all zeros or not enough data). - return defaultEncoding || 'utf-16le'; + return enc; } diff --git a/api/node_modules/iconv-lite/encodings/utf32.js b/api/node_modules/iconv-lite/encodings/utf32.js deleted file mode 100644 index 2fa900a..0000000 --- a/api/node_modules/iconv-lite/encodings/utf32.js +++ /dev/null @@ -1,319 +0,0 @@ -'use strict'; - -var Buffer = require('safer-buffer').Buffer; - -// == UTF32-LE/BE codec. ========================================================== - -exports._utf32 = Utf32Codec; - -function Utf32Codec(codecOptions, iconv) { - this.iconv = iconv; - this.bomAware = true; - this.isLE = codecOptions.isLE; -} - -exports.utf32le = { type: '_utf32', isLE: true }; -exports.utf32be = { type: '_utf32', isLE: false }; - -// Aliases -exports.ucs4le = 'utf32le'; -exports.ucs4be = 'utf32be'; - -Utf32Codec.prototype.encoder = Utf32Encoder; -Utf32Codec.prototype.decoder = Utf32Decoder; - -// -- Encoding - -function Utf32Encoder(options, codec) { - this.isLE = codec.isLE; - this.highSurrogate = 0; -} - -Utf32Encoder.prototype.write = function(str) { - var src = Buffer.from(str, 'ucs2'); - var dst = Buffer.alloc(src.length * 2); - var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE; - var offset = 0; - - for (var i = 0; i < src.length; i += 2) { - var code = src.readUInt16LE(i); - var isHighSurrogate = (0xD800 <= code && code < 0xDC00); - var isLowSurrogate = (0xDC00 <= code && code < 0xE000); - - if (this.highSurrogate) { - if (isHighSurrogate || !isLowSurrogate) { - // There shouldn't be two high surrogates in a row, nor a high surrogate which isn't followed by a low - // surrogate. If this happens, keep the pending high surrogate as a stand-alone semi-invalid character - // (technically wrong, but expected by some applications, like Windows file names). - write32.call(dst, this.highSurrogate, offset); - offset += 4; - } - else { - // Create 32-bit value from high and low surrogates; - var codepoint = (((this.highSurrogate - 0xD800) << 10) | (code - 0xDC00)) + 0x10000; - - write32.call(dst, codepoint, offset); - offset += 4; - this.highSurrogate = 0; - - continue; - } - } - - if (isHighSurrogate) - this.highSurrogate = code; - else { - // Even if the current character is a low surrogate, with no previous high surrogate, we'll - // encode it as a semi-invalid stand-alone character for the same reasons expressed above for - // unpaired high surrogates. - write32.call(dst, code, offset); - offset += 4; - this.highSurrogate = 0; - } - } - - if (offset < dst.length) - dst = dst.slice(0, offset); - - return dst; -}; - -Utf32Encoder.prototype.end = function() { - // Treat any leftover high surrogate as a semi-valid independent character. - if (!this.highSurrogate) - return; - - var buf = Buffer.alloc(4); - - if (this.isLE) - buf.writeUInt32LE(this.highSurrogate, 0); - else - buf.writeUInt32BE(this.highSurrogate, 0); - - this.highSurrogate = 0; - - return buf; -}; - -// -- Decoding - -function Utf32Decoder(options, codec) { - this.isLE = codec.isLE; - this.badChar = codec.iconv.defaultCharUnicode.charCodeAt(0); - this.overflow = []; -} - -Utf32Decoder.prototype.write = function(src) { - if (src.length === 0) - return ''; - - var i = 0; - var codepoint = 0; - var dst = Buffer.alloc(src.length + 4); - var offset = 0; - var isLE = this.isLE; - var overflow = this.overflow; - var badChar = this.badChar; - - if (overflow.length > 0) { - for (; i < src.length && overflow.length < 4; i++) - overflow.push(src[i]); - - if (overflow.length === 4) { - // NOTE: codepoint is a signed int32 and can be negative. - // NOTE: We copied this block from below to help V8 optimize it (it works with array, not buffer). - if (isLE) { - codepoint = overflow[i] | (overflow[i+1] << 8) | (overflow[i+2] << 16) | (overflow[i+3] << 24); - } else { - codepoint = overflow[i+3] | (overflow[i+2] << 8) | (overflow[i+1] << 16) | (overflow[i] << 24); - } - overflow.length = 0; - - offset = _writeCodepoint(dst, offset, codepoint, badChar); - } - } - - // Main loop. Should be as optimized as possible. - for (; i < src.length - 3; i += 4) { - // NOTE: codepoint is a signed int32 and can be negative. - if (isLE) { - codepoint = src[i] | (src[i+1] << 8) | (src[i+2] << 16) | (src[i+3] << 24); - } else { - codepoint = src[i+3] | (src[i+2] << 8) | (src[i+1] << 16) | (src[i] << 24); - } - offset = _writeCodepoint(dst, offset, codepoint, badChar); - } - - // Keep overflowing bytes. - for (; i < src.length; i++) { - overflow.push(src[i]); - } - - return dst.slice(0, offset).toString('ucs2'); -}; - -function _writeCodepoint(dst, offset, codepoint, badChar) { - // NOTE: codepoint is signed int32 and can be negative. We keep it that way to help V8 with optimizations. - if (codepoint < 0 || codepoint > 0x10FFFF) { - // Not a valid Unicode codepoint - codepoint = badChar; - } - - // Ephemeral Planes: Write high surrogate. - if (codepoint >= 0x10000) { - codepoint -= 0x10000; - - var high = 0xD800 | (codepoint >> 10); - dst[offset++] = high & 0xff; - dst[offset++] = high >> 8; - - // Low surrogate is written below. - var codepoint = 0xDC00 | (codepoint & 0x3FF); - } - - // Write BMP char or low surrogate. - dst[offset++] = codepoint & 0xff; - dst[offset++] = codepoint >> 8; - - return offset; -}; - -Utf32Decoder.prototype.end = function() { - this.overflow.length = 0; -}; - -// == UTF-32 Auto codec ============================================================= -// Decoder chooses automatically from UTF-32LE and UTF-32BE using BOM and space-based heuristic. -// Defaults to UTF-32LE. http://en.wikipedia.org/wiki/UTF-32 -// Encoder/decoder default can be changed: iconv.decode(buf, 'utf32', {defaultEncoding: 'utf-32be'}); - -// Encoder prepends BOM (which can be overridden with (addBOM: false}). - -exports.utf32 = Utf32AutoCodec; -exports.ucs4 = 'utf32'; - -function Utf32AutoCodec(options, iconv) { - this.iconv = iconv; -} - -Utf32AutoCodec.prototype.encoder = Utf32AutoEncoder; -Utf32AutoCodec.prototype.decoder = Utf32AutoDecoder; - -// -- Encoding - -function Utf32AutoEncoder(options, codec) { - options = options || {}; - - if (options.addBOM === undefined) - options.addBOM = true; - - this.encoder = codec.iconv.getEncoder(options.defaultEncoding || 'utf-32le', options); -} - -Utf32AutoEncoder.prototype.write = function(str) { - return this.encoder.write(str); -}; - -Utf32AutoEncoder.prototype.end = function() { - return this.encoder.end(); -}; - -// -- Decoding - -function Utf32AutoDecoder(options, codec) { - this.decoder = null; - this.initialBufs = []; - this.initialBufsLen = 0; - this.options = options || {}; - this.iconv = codec.iconv; -} - -Utf32AutoDecoder.prototype.write = function(buf) { - if (!this.decoder) { - // Codec is not chosen yet. Accumulate initial bytes. - this.initialBufs.push(buf); - this.initialBufsLen += buf.length; - - if (this.initialBufsLen < 32) // We need more bytes to use space heuristic (see below) - return ''; - - // We have enough bytes -> detect endianness. - var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); - this.decoder = this.iconv.getDecoder(encoding, this.options); - - var resStr = ''; - for (var i = 0; i < this.initialBufs.length; i++) - resStr += this.decoder.write(this.initialBufs[i]); - - this.initialBufs.length = this.initialBufsLen = 0; - return resStr; - } - - return this.decoder.write(buf); -}; - -Utf32AutoDecoder.prototype.end = function() { - if (!this.decoder) { - var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); - this.decoder = this.iconv.getDecoder(encoding, this.options); - - var resStr = ''; - for (var i = 0; i < this.initialBufs.length; i++) - resStr += this.decoder.write(this.initialBufs[i]); - - var trail = this.decoder.end(); - if (trail) - resStr += trail; - - this.initialBufs.length = this.initialBufsLen = 0; - return resStr; - } - - return this.decoder.end(); -}; - -function detectEncoding(bufs, defaultEncoding) { - var b = []; - var charsProcessed = 0; - var invalidLE = 0, invalidBE = 0; // Number of invalid chars when decoded as LE or BE. - var bmpCharsLE = 0, bmpCharsBE = 0; // Number of BMP chars when decoded as LE or BE. - - outer_loop: - for (var i = 0; i < bufs.length; i++) { - var buf = bufs[i]; - for (var j = 0; j < buf.length; j++) { - b.push(buf[j]); - if (b.length === 4) { - if (charsProcessed === 0) { - // Check BOM first. - if (b[0] === 0xFF && b[1] === 0xFE && b[2] === 0 && b[3] === 0) { - return 'utf-32le'; - } - if (b[0] === 0 && b[1] === 0 && b[2] === 0xFE && b[3] === 0xFF) { - return 'utf-32be'; - } - } - - if (b[0] !== 0 || b[1] > 0x10) invalidBE++; - if (b[3] !== 0 || b[2] > 0x10) invalidLE++; - - if (b[0] === 0 && b[1] === 0 && (b[2] !== 0 || b[3] !== 0)) bmpCharsBE++; - if ((b[0] !== 0 || b[1] !== 0) && b[2] === 0 && b[3] === 0) bmpCharsLE++; - - b.length = 0; - charsProcessed++; - - if (charsProcessed >= 100) { - break outer_loop; - } - } - } - } - - // Make decisions. - if (bmpCharsBE - invalidBE > bmpCharsLE - invalidLE) return 'utf-32be'; - if (bmpCharsBE - invalidBE < bmpCharsLE - invalidLE) return 'utf-32le'; - - // Couldn't decide (likely all zeros or not enough data). - return defaultEncoding || 'utf-32le'; -} diff --git a/api/node_modules/iconv-lite/encodings/utf7.js b/api/node_modules/iconv-lite/encodings/utf7.js index eacae34..b7631c2 100644 --- a/api/node_modules/iconv-lite/encodings/utf7.js +++ b/api/node_modules/iconv-lite/encodings/utf7.js @@ -74,7 +74,7 @@ Utf7Decoder.prototype.write = function(buf) { if (i == lastI && buf[i] == minusChar) {// "+-" -> "+" res += "+"; } else { - var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i), "ascii"); + var b64str = base64Accum + buf.slice(lastI, i).toString(); res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); } @@ -91,7 +91,7 @@ Utf7Decoder.prototype.write = function(buf) { if (!inBase64) { res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. } else { - var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii"); + var b64str = base64Accum + buf.slice(lastI).toString(); var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. @@ -245,7 +245,7 @@ Utf7IMAPDecoder.prototype.write = function(buf) { if (i == lastI && buf[i] == minusChar) { // "&-" -> "&" res += "&"; } else { - var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i), "ascii").replace(/,/g, '/'); + var b64str = base64Accum + buf.slice(lastI, i).toString().replace(/,/g, '/'); res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); } @@ -262,7 +262,7 @@ Utf7IMAPDecoder.prototype.write = function(buf) { if (!inBase64) { res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. } else { - var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii").replace(/,/g, '/'); + var b64str = base64Accum + buf.slice(lastI).toString().replace(/,/g, '/'); var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. diff --git a/api/node_modules/iconv-lite/lib/index.d.ts b/api/node_modules/iconv-lite/lib/index.d.ts index 99f200f..0547eb3 100644 --- a/api/node_modules/iconv-lite/lib/index.d.ts +++ b/api/node_modules/iconv-lite/lib/index.d.ts @@ -6,22 +6,15 @@ *--------------------------------------------------------------------------------------------*/ declare module 'iconv-lite' { - // Basic API export function decode(buffer: Buffer, encoding: string, options?: Options): string; export function encode(content: string, encoding: string, options?: Options): Buffer; export function encodingExists(encoding: string): boolean; - // Stream API export function decodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; export function encodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; - - // Low-level stream APIs - export function getEncoder(encoding: string, options?: Options): EncoderStream; - - export function getDecoder(encoding: string, options?: Options): DecoderStream; } export interface Options { @@ -29,13 +22,3 @@ export interface Options { addBOM?: boolean; defaultEncoding?: string; } - -export interface EncoderStream { - write(str: string): Buffer; - end(): Buffer | undefined; -} - -export interface DecoderStream { - write(buf: Buffer): string; - end(): string | undefined; -} diff --git a/api/node_modules/iconv-lite/lib/index.js b/api/node_modules/iconv-lite/lib/index.js index 657701c..5391919 100644 --- a/api/node_modules/iconv-lite/lib/index.js +++ b/api/node_modules/iconv-lite/lib/index.js @@ -1,5 +1,7 @@ "use strict"; +// Some environments don't have global Buffer (e.g. React Native). +// Solution would be installing npm modules "buffer" and "stream" explicitly. var Buffer = require("safer-buffer").Buffer; var bomHandling = require("./bom-handling"), @@ -131,50 +133,21 @@ iconv.getDecoder = function getDecoder(encoding, options) { return decoder; } -// Streaming API -// NOTE: Streaming API naturally depends on 'stream' module from Node.js. Unfortunately in browser environments this module can add -// up to 100Kb to the output bundle. To avoid unnecessary code bloat, we don't enable Streaming API in browser by default. -// If you would like to enable it explicitly, please add the following code to your app: -// > iconv.enableStreamingAPI(require('stream')); -iconv.enableStreamingAPI = function enableStreamingAPI(stream_module) { - if (iconv.supportsStreams) - return; - // Dependency-inject stream module to create IconvLite stream classes. - var streams = require("./streams")(stream_module); +// Load extensions in Node. All of them are omitted in Browserify build via 'browser' field in package.json. +var nodeVer = typeof process !== 'undefined' && process.versions && process.versions.node; +if (nodeVer) { - // Not public API yet, but expose the stream classes. - iconv.IconvLiteEncoderStream = streams.IconvLiteEncoderStream; - iconv.IconvLiteDecoderStream = streams.IconvLiteDecoderStream; - - // Streaming API. - iconv.encodeStream = function encodeStream(encoding, options) { - return new iconv.IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options); + // Load streaming support in Node v0.10+ + var nodeVerArr = nodeVer.split(".").map(Number); + if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) { + require("./streams")(iconv); } - iconv.decodeStream = function decodeStream(encoding, options) { - return new iconv.IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options); - } - - iconv.supportsStreams = true; -} - -// Enable Streaming API automatically if 'stream' module is available and non-empty (the majority of environments). -var stream_module; -try { - stream_module = require("stream"); -} catch (e) {} - -if (stream_module && stream_module.Transform) { - iconv.enableStreamingAPI(stream_module); - -} else { - // In rare cases where 'stream' module is not available by default, throw a helpful exception. - iconv.encodeStream = iconv.decodeStream = function() { - throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it."); - }; + // Load Node primitive extensions. + require("./extend-node")(iconv); } if ("Ā" != "\u0100") { - console.error("iconv-lite warning: js files use non-utf8 encoding. See https://github.com/ashtuchkin/iconv-lite/wiki/Javascript-source-file-encodings for more info."); + console.error("iconv-lite warning: javascript files use encoding different from utf-8. See https://github.com/ashtuchkin/iconv-lite/wiki/Javascript-source-file-encodings for more info."); } diff --git a/api/node_modules/iconv-lite/lib/streams.js b/api/node_modules/iconv-lite/lib/streams.js index a150648..4409552 100644 --- a/api/node_modules/iconv-lite/lib/streams.js +++ b/api/node_modules/iconv-lite/lib/streams.js @@ -1,109 +1,121 @@ "use strict"; -var Buffer = require("safer-buffer").Buffer; +var Buffer = require("buffer").Buffer, + Transform = require("stream").Transform; -// NOTE: Due to 'stream' module being pretty large (~100Kb, significant in browser environments), -// we opt to dependency-inject it instead of creating a hard dependency. -module.exports = function(stream_module) { - var Transform = stream_module.Transform; - // == Encoder stream ======================================================= - - function IconvLiteEncoderStream(conv, options) { - this.conv = conv; - options = options || {}; - options.decodeStrings = false; // We accept only strings, so we don't need to decode them. - Transform.call(this, options); +// == Exports ================================================================== +module.exports = function(iconv) { + + // Additional Public API. + iconv.encodeStream = function encodeStream(encoding, options) { + return new IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options); } - IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, { - constructor: { value: IconvLiteEncoderStream } - }); - - IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) { - if (typeof chunk != 'string') - return done(new Error("Iconv encoding stream needs strings as its input.")); - try { - var res = this.conv.write(chunk); - if (res && res.length) this.push(res); - done(); - } - catch (e) { - done(e); - } + iconv.decodeStream = function decodeStream(encoding, options) { + return new IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options); } - IconvLiteEncoderStream.prototype._flush = function(done) { - try { - var res = this.conv.end(); - if (res && res.length) this.push(res); - done(); - } - catch (e) { - done(e); - } - } - - IconvLiteEncoderStream.prototype.collect = function(cb) { - var chunks = []; - this.on('error', cb); - this.on('data', function(chunk) { chunks.push(chunk); }); - this.on('end', function() { - cb(null, Buffer.concat(chunks)); - }); - return this; - } + iconv.supportsStreams = true; - // == Decoder stream ======================================================= - - function IconvLiteDecoderStream(conv, options) { - this.conv = conv; - options = options || {}; - options.encoding = this.encoding = 'utf8'; // We output strings. - Transform.call(this, options); - } - - IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, { - constructor: { value: IconvLiteDecoderStream } - }); - - IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) { - if (!Buffer.isBuffer(chunk) && !(chunk instanceof Uint8Array)) - return done(new Error("Iconv decoding stream needs buffers as its input.")); - try { - var res = this.conv.write(chunk); - if (res && res.length) this.push(res, this.encoding); - done(); - } - catch (e) { - done(e); - } - } - - IconvLiteDecoderStream.prototype._flush = function(done) { - try { - var res = this.conv.end(); - if (res && res.length) this.push(res, this.encoding); - done(); - } - catch (e) { - done(e); - } - } - - IconvLiteDecoderStream.prototype.collect = function(cb) { - var res = ''; - this.on('error', cb); - this.on('data', function(chunk) { res += chunk; }); - this.on('end', function() { - cb(null, res); - }); - return this; - } - - return { - IconvLiteEncoderStream: IconvLiteEncoderStream, - IconvLiteDecoderStream: IconvLiteDecoderStream, - }; + // Not published yet. + iconv.IconvLiteEncoderStream = IconvLiteEncoderStream; + iconv.IconvLiteDecoderStream = IconvLiteDecoderStream; + iconv._collect = IconvLiteDecoderStream.prototype.collect; }; + + +// == Encoder stream ======================================================= +function IconvLiteEncoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.decodeStrings = false; // We accept only strings, so we don't need to decode them. + Transform.call(this, options); +} + +IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteEncoderStream } +}); + +IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) { + if (typeof chunk != 'string') + return done(new Error("Iconv encoding stream needs strings as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteEncoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteEncoderStream.prototype.collect = function(cb) { + var chunks = []; + this.on('error', cb); + this.on('data', function(chunk) { chunks.push(chunk); }); + this.on('end', function() { + cb(null, Buffer.concat(chunks)); + }); + return this; +} + + +// == Decoder stream ======================================================= +function IconvLiteDecoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.encoding = this.encoding = 'utf8'; // We output strings. + Transform.call(this, options); +} + +IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteDecoderStream } +}); + +IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) { + if (!Buffer.isBuffer(chunk)) + return done(new Error("Iconv decoding stream needs buffers as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteDecoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteDecoderStream.prototype.collect = function(cb) { + var res = ''; + this.on('error', cb); + this.on('data', function(chunk) { res += chunk; }); + this.on('end', function() { + cb(null, res); + }); + return this; +} + diff --git a/api/node_modules/iconv-lite/package.json b/api/node_modules/iconv-lite/package.json index d351115..a7c74fc 100644 --- a/api/node_modules/iconv-lite/package.json +++ b/api/node_modules/iconv-lite/package.json @@ -1,7 +1,7 @@ { "name": "iconv-lite", "description": "Convert character encodings in pure javascript.", - "version": "0.6.3", + "version": "0.4.24", "license": "MIT", "keywords": [ "iconv", @@ -22,23 +22,25 @@ "node": ">=0.10.0" }, "scripts": { - "coverage": "c8 _mocha --grep .", + "coverage": "istanbul cover _mocha -- --grep .", + "coverage-open": "open coverage/lcov-report/index.html", "test": "mocha --reporter spec --grep ." }, "browser": { - "stream": false + "./lib/extend-node": false, + "./lib/streams": false }, "devDependencies": { - "async": "^3.2.0", - "c8": "^7.2.0", - "errto": "^0.2.1", - "iconv": "^2.3.5", - "mocha": "^3.5.3", - "request": "^2.88.2", - "semver": "^6.3.0", - "unorm": "^1.6.0" + "mocha": "^3.1.0", + "request": "~2.87.0", + "unorm": "*", + "errto": "*", + "async": "*", + "istanbul": "*", + "semver": "*", + "iconv": "*" }, "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" + "safer-buffer": ">= 2.1.2 < 3" } } diff --git a/api/node_modules/is-promise/LICENSE b/api/node_modules/is-promise/LICENSE deleted file mode 100644 index 27cc9f3..0000000 --- a/api/node_modules/is-promise/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014 Forbes Lindesay - -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/api/node_modules/is-promise/index.d.ts b/api/node_modules/is-promise/index.d.ts deleted file mode 100644 index 2107b42..0000000 --- a/api/node_modules/is-promise/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare function isPromise(obj: PromiseLike | S): obj is PromiseLike; -export default isPromise; diff --git a/api/node_modules/is-promise/index.js b/api/node_modules/is-promise/index.js deleted file mode 100644 index 1bed087..0000000 --- a/api/node_modules/is-promise/index.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = isPromise; -module.exports.default = isPromise; - -function isPromise(obj) { - return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'; -} diff --git a/api/node_modules/is-promise/index.mjs b/api/node_modules/is-promise/index.mjs deleted file mode 100644 index bf9e99b..0000000 --- a/api/node_modules/is-promise/index.mjs +++ /dev/null @@ -1,3 +0,0 @@ -export default function isPromise(obj) { - return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'; -} diff --git a/api/node_modules/is-promise/package.json b/api/node_modules/is-promise/package.json deleted file mode 100644 index 2a3c540..0000000 --- a/api/node_modules/is-promise/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "is-promise", - "version": "4.0.0", - "description": "Test whether an object looks like a promises-a+ promise", - "main": "./index.js", - "scripts": { - "test": "node test" - }, - "files": [ - "index.js", - "index.mjs", - "index.d.ts" - ], - "exports": { - ".": [ - { - "import": "./index.mjs", - "require": "./index.js", - "default": "./index.js" - }, - "./index.js" - ] - }, - "repository": { - "type": "git", - "url": "https://github.com/then/is-promise.git" - }, - "author": "ForbesLindesay", - "license": "MIT" -} diff --git a/api/node_modules/is-promise/readme.md b/api/node_modules/is-promise/readme.md deleted file mode 100644 index d53d34b..0000000 --- a/api/node_modules/is-promise/readme.md +++ /dev/null @@ -1,33 +0,0 @@ - - -# is-promise - - Test whether an object looks like a promises-a+ promise - - [![Build Status](https://img.shields.io/travis/then/is-promise/master.svg)](https://travis-ci.org/then/is-promise) - [![Dependency Status](https://img.shields.io/david/then/is-promise.svg)](https://david-dm.org/then/is-promise) - [![NPM version](https://img.shields.io/npm/v/is-promise.svg)](https://www.npmjs.org/package/is-promise) - - - -## Installation - - $ npm install is-promise - -You can also use it client side via npm. - -## API - -```typescript -import isPromise from 'is-promise'; - -isPromise(Promise.resolve());//=>true -isPromise({then:function () {...}});//=>true -isPromise(null);//=>false -isPromise({});//=>false -isPromise({then: true})//=>false -``` - -## License - - MIT diff --git a/api/node_modules/media-typer/HISTORY.md b/api/node_modules/media-typer/HISTORY.md index 538ade1..62c2003 100644 --- a/api/node_modules/media-typer/HISTORY.md +++ b/api/node_modules/media-typer/HISTORY.md @@ -1,31 +1,3 @@ -1.1.0 / 2019-04-24 -================== - - * Add `test(string)` function - -1.0.2 / 2019-04-19 -================== - - * Fix JSDoc comment for `parse` function - -1.0.1 / 2018-10-20 -================== - - * Remove left over `parameters` property from class - -1.0.0 / 2018-10-20 -================== - -This major release brings the module back to it's RFC 6838 roots. If you want -a module to parse the `Content-Type` or similar HTTP headers, use the -`content-type` module instead. - - * Drop support for Node.js below 0.8 - * Remove parameter handling, which is outside RFC 6838 scope - * Remove `parse(req)` and `parse(res)` signatures - * perf: enable strict mode - * perf: use a class for object creation - 0.3.0 / 2014-09-07 ================== diff --git a/api/node_modules/media-typer/LICENSE b/api/node_modules/media-typer/LICENSE index 84441fb..b7dce6c 100644 --- a/api/node_modules/media-typer/LICENSE +++ b/api/node_modules/media-typer/LICENSE @@ -1,6 +1,6 @@ (The MIT License) -Copyright (c) 2014-2017 Douglas Christopher Wilson +Copyright (c) 2014 Douglas Christopher Wilson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/api/node_modules/media-typer/README.md b/api/node_modules/media-typer/README.md index 37edad1..d8df623 100644 --- a/api/node_modules/media-typer/README.md +++ b/api/node_modules/media-typer/README.md @@ -1,45 +1,29 @@ # media-typer -[![NPM Version][npm-version-image]][npm-url] -[![NPM Downloads][npm-downloads-image]][npm-url] +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] [![Node.js Version][node-version-image]][node-version-url] [![Build Status][travis-image]][travis-url] [![Test Coverage][coveralls-image]][coveralls-url] -Simple RFC 6838 media type parser. - -This module will parse a given media type into it's component parts, like type, -subtype, and suffix. A formatter is also provided to put them back together and -the two can be combined to normalize media types into a canonical form. - -If you are looking to parse the string that represents a media type and it's -parameters in HTTP (for example, the `Content-Type` header), use the -[content-type module](https://www.npmjs.com/package/content-type). +Simple RFC 6838 media type parser ## 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 media-typer ``` ## API - - ```js var typer = require('media-typer') ``` ### typer.parse(string) - - ```js -var obj = typer.parse('image/svg+xml') +var obj = typer.parse('image/svg+xml; charset=utf-8') ``` Parse a media type string. This will return an object with the following @@ -51,43 +35,47 @@ properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`): - `suffix`: The suffix of the media type (always lower case). Example: `'xml'` -If the given type string is invalid, then a `TypeError` is thrown. + - `parameters`: An object of the parameters in the media type (name of parameter always lower case). Example: `{charset: 'utf-8'}` + +### typer.parse(req) + +```js +var obj = typer.parse(req) +``` + +Parse the `content-type` header from the given `req`. Short-cut for +`typer.parse(req.headers['content-type'])`. + +### typer.parse(res) + +```js +var obj = typer.parse(res) +``` + +Parse the `content-type` header set on the given `res`. Short-cut for +`typer.parse(res.getHeader('content-type'))`. ### typer.format(obj) - - ```js -var obj = typer.format({ type: 'image', subtype: 'svg', suffix: 'xml' }) +var obj = typer.format({type: 'image', subtype: 'svg', suffix: 'xml'}) ``` Format an object into a media type string. This will return a string of the mime type for the given object. For the properties of the object, see the documentation for `typer.parse(string)`. -If any of the given object values are invalid, then a `TypeError` is thrown. - -### typer.test(string) - - - -```js -var valid = typer.test('image/svg+xml') -``` - -Validate a media type string. This will return `true` is the string is a well- -formatted media type, or `false` otherwise. - ## License [MIT](LICENSE) -[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/media-typer/master -[coveralls-url]: https://coveralls.io/r/jshttp/media-typer?branch=master -[node-version-image]: https://badgen.net/npm/node/media-typer -[node-version-url]: https://nodejs.org/en/download -[npm-downloads-image]: https://badgen.net/npm/dm/media-typer +[npm-image]: https://img.shields.io/npm/v/media-typer.svg?style=flat [npm-url]: https://npmjs.org/package/media-typer -[npm-version-image]: https://badgen.net/npm/v/media-typer -[travis-image]: https://badgen.net/travis/jshttp/media-typer/master +[node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat +[node-version-url]: http://nodejs.org/download/ +[travis-image]: https://img.shields.io/travis/jshttp/media-typer.svg?style=flat [travis-url]: https://travis-ci.org/jshttp/media-typer +[coveralls-image]: https://img.shields.io/coveralls/jshttp/media-typer.svg?style=flat +[coveralls-url]: https://coveralls.io/r/jshttp/media-typer +[downloads-image]: https://img.shields.io/npm/dm/media-typer.svg?style=flat +[downloads-url]: https://npmjs.org/package/media-typer diff --git a/api/node_modules/media-typer/index.js b/api/node_modules/media-typer/index.js index 897cae1..07f7295 100644 --- a/api/node_modules/media-typer/index.js +++ b/api/node_modules/media-typer/index.js @@ -1,10 +1,48 @@ /*! * media-typer - * Copyright(c) 2014-2017 Douglas Christopher Wilson + * Copyright(c) 2014 Douglas Christopher Wilson * MIT Licensed */ -'use strict' +/** + * RegExp to match *( ";" parameter ) in RFC 2616 sec 3.7 + * + * 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 = + * SHT = + * CTL = + * OCTET = + */ +var paramRegExp = /; *([!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) *= *("(?:[ !\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u0020-\u007e])*"|[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) */g; +var textRegExp = /^[\u0020-\u007e\u0080-\u00ff]+$/ +var tokenRegExp = /^[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+$/ + +/** + * RegExp to match quoted-pair in RFC 2616 + * + * quoted-pair = "\" CHAR + * CHAR = + */ +var qescRegExp = /\\([\u0000-\u007f])/g; + +/** + * RegExp to match chars that must be quoted-pair in RFC 2616 + */ +var quoteRegExp = /([\\"])/g; /** * RegExp to match type in RFC 6838 @@ -22,9 +60,9 @@ * ALPHA = %x41-5A / %x61-7A ; A-Z / a-z * DIGIT = %x30-39 ; 0-9 */ -var SUBTYPE_NAME_REGEXP = /^[A-Za-z0-9][A-Za-z0-9!#$&^_.-]{0,126}$/ -var TYPE_NAME_REGEXP = /^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}$/ -var TYPE_REGEXP = /^ *([A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126})\/([A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}) *$/ +var subtypeNameRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_.-]{0,126}$/ +var typeNameRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}$/ +var typeRegExp = /^ *([A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126})\/([A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}) *$/; /** * Module exports. @@ -32,30 +70,30 @@ var TYPE_REGEXP = /^ *([A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126})\/([A-Za-z0-9][A-Za- exports.format = format exports.parse = parse -exports.test = test /** * Format object to media type. * * @param {object} obj * @return {string} - * @public + * @api public */ -function format (obj) { +function format(obj) { if (!obj || typeof obj !== 'object') { throw new TypeError('argument obj is required') } + var parameters = obj.parameters var subtype = obj.subtype var suffix = obj.suffix var type = obj.type - if (!type || !TYPE_NAME_REGEXP.test(type)) { + if (!type || !typeNameRegExp.test(type)) { throw new TypeError('invalid type') } - if (!subtype || !SUBTYPE_NAME_REGEXP.test(subtype)) { + if (!subtype || !subtypeNameRegExp.test(subtype)) { throw new TypeError('invalid subtype') } @@ -64,54 +102,148 @@ function format (obj) { // append +suffix if (suffix) { - if (!TYPE_NAME_REGEXP.test(suffix)) { + if (!typeNameRegExp.test(suffix)) { throw new TypeError('invalid suffix') } string += '+' + suffix } + // 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 (!tokenRegExp.test(param)) { + throw new TypeError('invalid parameter name') + } + + string += '; ' + param + '=' + qstring(parameters[param]) + } + } + return string } -/** - * Test media type. - * - * @param {string} string - * @return {object} - * @public - */ - -function test (string) { - if (!string) { - throw new TypeError('argument string is required') - } - - if (typeof string !== 'string') { - throw new TypeError('argument string is required to be a string') - } - - return TYPE_REGEXP.test(string.toLowerCase()) -} - /** * Parse media type to object. * - * @param {string} string - * @return {object} - * @public + * @param {string|object} string + * @return {Object} + * @api public */ -function parse (string) { +function parse(string) { if (!string) { throw new TypeError('argument string is required') } + // support req/res-like objects as argument + if (typeof string === 'object') { + string = getcontenttype(string) + } + if (typeof string !== 'string') { throw new TypeError('argument string is required to be a string') } - var match = TYPE_REGEXP.exec(string.toLowerCase()) + var index = string.indexOf(';') + var type = index !== -1 + ? string.substr(0, index) + : string + + var key + var match + var obj = splitType(type) + var params = {} + var value + + paramRegExp.lastIndex = index + + while (match = paramRegExp.exec(string)) { + if (match.index !== index) { + throw new TypeError('invalid parameter format') + } + + index += match[0].length + key = match[1].toLowerCase() + value = match[2] + + if (value[0] === '"') { + // remove quotes and escapes + value = value + .substr(1, value.length - 2) + .replace(qescRegExp, '$1') + } + + params[key] = value + } + + if (index !== -1 && index !== string.length) { + throw new TypeError('invalid parameter format') + } + + obj.parameters = params + + return obj +} + +/** + * Get content-type from req/res objects. + * + * @param {object} + * @return {Object} + * @api private + */ + +function getcontenttype(obj) { + if (typeof obj.getHeader === 'function') { + // res-like + return obj.getHeader('content-type') + } + + if (typeof obj.headers === 'object') { + // req-like + return obj.headers && obj.headers['content-type'] + } +} + +/** + * Quote a string if necessary. + * + * @param {string} val + * @return {string} + * @api private + */ + +function qstring(val) { + var str = String(val) + + // no need to quote tokens + if (tokenRegExp.test(str)) { + return str + } + + if (str.length > 0 && !textRegExp.test(str)) { + throw new TypeError('invalid parameter value') + } + + return '"' + str.replace(quoteRegExp, '\\$1') + '"' +} + +/** + * Simply "type/subtype+siffx" into parts. + * + * @param {string} string + * @return {Object} + * @api private + */ + +function splitType(string) { + var match = typeRegExp.exec(string.toLowerCase()) if (!match) { throw new TypeError('invalid media type') @@ -128,16 +260,11 @@ function parse (string) { subtype = subtype.substr(0, index) } - return new MediaType(type, subtype, suffix) -} + var obj = { + type: type, + subtype: subtype, + suffix: suffix + } -/** - * Class for MediaType object. - * @public - */ - -function MediaType (type, subtype, suffix) { - this.type = type - this.subtype = subtype - this.suffix = suffix + return obj } diff --git a/api/node_modules/media-typer/package.json b/api/node_modules/media-typer/package.json index 1dca712..8cf3ebc 100644 --- a/api/node_modules/media-typer/package.json +++ b/api/node_modules/media-typer/package.json @@ -1,20 +1,14 @@ { "name": "media-typer", "description": "Simple RFC 6838 media type parser and formatter", - "version": "1.1.0", + "version": "0.3.0", "author": "Douglas Christopher Wilson ", "license": "MIT", "repository": "jshttp/media-typer", "devDependencies": { - "eslint": "5.16.0", - "eslint-config-standard": "12.0.0", - "eslint-plugin-import": "2.17.2", - "eslint-plugin-markdown": "1.0.0", - "eslint-plugin-node": "8.0.1", - "eslint-plugin-promise": "4.1.1", - "eslint-plugin-standard": "4.0.0", - "mocha": "6.1.4", - "nyc": "14.0.0" + "istanbul": "0.3.2", + "mocha": "~1.21.4", + "should": "~4.0.4" }, "files": [ "LICENSE", @@ -22,12 +16,11 @@ "index.js" ], "engines": { - "node": ">= 0.8" + "node": ">= 0.6" }, "scripts": { - "lint": "eslint --plugin markdown --ext js,md .", "test": "mocha --reporter spec --check-leaks --bail test/", - "test-cov": "nyc --reporter=html --reporter=text npm test", - "test-travis": "nyc --reporter=text npm test" + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" } } diff --git a/api/node_modules/merge-descriptors/index.d.ts b/api/node_modules/merge-descriptors/index.d.ts deleted file mode 100644 index df8f91f..0000000 --- a/api/node_modules/merge-descriptors/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** -Merges "own" properties from a source to a destination object, including non-enumerable and accessor-defined properties. It retains original values and descriptors, ensuring the destination receives a complete and accurate copy of the source's properties. - -@param destination - The object to receive properties. -@param source - The object providing properties. -@param overwrite - Optional boolean to control overwriting of existing properties. Defaults to true. -@returns The modified destination object. -*/ -declare function mergeDescriptors(destination: T, source: U, overwrite?: boolean): T & U; - -export = mergeDescriptors; diff --git a/api/node_modules/merge-descriptors/index.js b/api/node_modules/merge-descriptors/index.js index 51228e5..f22ebab 100644 --- a/api/node_modules/merge-descriptors/index.js +++ b/api/node_modules/merge-descriptors/index.js @@ -1,26 +1,60 @@ -'use strict'; +/*! + * merge-descriptors + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ -function mergeDescriptors(destination, source, overwrite = true) { - if (!destination) { - throw new TypeError('The `destination` argument is required.'); - } +'use strict' - if (!source) { - throw new TypeError('The `source` argument is required.'); - } +/** + * Module exports. + * @public + */ - for (const name of Object.getOwnPropertyNames(source)) { - if (!overwrite && Object.hasOwn(destination, name)) { - // Skip descriptor - continue; - } +module.exports = merge - // Copy descriptor - const descriptor = Object.getOwnPropertyDescriptor(source, name); - Object.defineProperty(destination, name, descriptor); - } +/** + * Module variables. + * @private + */ - return destination; +var hasOwnProperty = Object.prototype.hasOwnProperty + +/** + * Merge the property descriptors of `src` into `dest` + * + * @param {object} dest Object to add descriptors to + * @param {object} src Object to clone descriptors from + * @param {boolean} [redefine=true] Redefine `dest` properties with `src` properties + * @returns {object} Reference to dest + * @public + */ + +function merge (dest, src, redefine) { + if (!dest) { + throw new TypeError('argument dest is required') + } + + if (!src) { + throw new TypeError('argument src is required') + } + + if (redefine === undefined) { + // Default to true + redefine = true + } + + Object.getOwnPropertyNames(src).forEach(function forEachOwnPropertyName (name) { + if (!redefine && hasOwnProperty.call(dest, name)) { + // Skip descriptor + return + } + + // Copy descriptor + var descriptor = Object.getOwnPropertyDescriptor(src, name) + Object.defineProperty(dest, name, descriptor) + }) + + return dest } - -module.exports = mergeDescriptors; diff --git a/api/node_modules/merge-descriptors/license b/api/node_modules/merge-descriptors/license index c509d45..274bfd8 100644 --- a/api/node_modules/merge-descriptors/license +++ b/api/node_modules/merge-descriptors/license @@ -1,11 +1,23 @@ -MIT License +(The MIT License) -Copyright (c) Jonathan Ong -Copyright (c) Douglas Christopher Wilson -Copyright (c) Sindre Sorhus (https://sindresorhus.com) +Copyright (c) 2013 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: +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 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. +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/api/node_modules/merge-descriptors/package.json b/api/node_modules/merge-descriptors/package.json index 9bedb25..aa9af0a 100644 --- a/api/node_modules/merge-descriptors/package.json +++ b/api/node_modules/merge-descriptors/package.json @@ -1,50 +1,39 @@ { - "name": "merge-descriptors", - "version": "2.0.0", - "description": "Merge objects using their property descriptors", - "license": "MIT", - "repository": "sindresorhus/merge-descriptors", - "funding": "https://github.com/sponsors/sindresorhus", - "contributors": [ - "Jonathan Ong ", - "Douglas Christopher Wilson ", - "Mike Grabowski ", - "Sindre Sorhus " - ], - "exports": { - "types": "./index.d.ts", - "default": "./index.js" - }, - "main": "./index.js", - "types": "./index.d.ts", - "sideEffects": false, - "engines": { - "node": ">=18" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "merge", - "descriptors", - "object", - "property", - "properties", - "merging", - "getter", - "setter" - ], - "devDependencies": { - "ava": "^5.3.1", - "xo": "^0.56.0" - }, - "xo": { - "rules": { - "unicorn/prefer-module": "off" - } - } + "name": "merge-descriptors", + "description": "Merge objects using descriptors", + "version": "1.0.3", + "author": { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com", + "twitter": "https://twitter.com/jongleberry" + }, + "contributors": [ + "Douglas Christopher Wilson ", + "Mike Grabowski " + ], + "license": "MIT", + "repository": "sindresorhus/merge-descriptors", + "funding": "https://github.com/sponsors/sindresorhus", + "devDependencies": { + "eslint": "5.9.0", + "eslint-config-standard": "12.0.0", + "eslint-plugin-import": "2.14.0", + "eslint-plugin-node": "7.0.1", + "eslint-plugin-promise": "4.0.1", + "eslint-plugin-standard": "4.0.0", + "mocha": "5.2.0", + "nyc": "13.1.0" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "index.js" + ], + "scripts": { + "lint": "eslint .", + "test": "mocha test/", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } } diff --git a/api/node_modules/merge-descriptors/readme.md b/api/node_modules/merge-descriptors/readme.md index 1dee67d..3403f4a 100644 --- a/api/node_modules/merge-descriptors/readme.md +++ b/api/node_modules/merge-descriptors/readme.md @@ -1,55 +1,49 @@ # merge-descriptors -> Merge objects using their property descriptors +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] -## Install - -```sh -npm install merge-descriptors -``` - -## Usage +Merge objects using descriptors. ```js -import mergeDescriptors from 'merge-descriptors'; - -const thing = { - get name() { - return 'John' - } +var thing = { + get name() { + return 'jon' + } } -const animal = {}; +var animal = { -mergeDescriptors(animal, thing); +} -console.log(animal.name); -//=> 'John' +merge(animal, thing) + +animal.name === 'jon' ``` ## API -### merge(destination, source, overwrite?) +### merge(destination, source) -Merges "own" properties from a source to a destination object, including non-enumerable and accessor-defined properties. It retains original values and descriptors, ensuring the destination receives a complete and accurate copy of the source's properties. +Redefines `destination`'s descriptors with `source`'s. The return value is the +`destination` object. -Returns the modified destination object. +### merge(destination, source, false) -#### destination +Defines `source`'s descriptors on `destination` if `destination` does not have +a descriptor by the same name. The return value is the `destination` object. -Type: `object` +## License -The object to receive properties. +[MIT](LICENSE) -#### source - -Type: `object` - -The object providing properties. - -#### overwrite - -Type: `boolean`\ -Default: `true` - -A boolean to control overwriting of existing properties. +[npm-image]: https://img.shields.io/npm/v/merge-descriptors.svg +[npm-url]: https://npmjs.org/package/merge-descriptors +[travis-image]: https://img.shields.io/travis/component/merge-descriptors/master.svg +[travis-url]: https://travis-ci.org/component/merge-descriptors +[coveralls-image]: https://img.shields.io/coveralls/component/merge-descriptors/master.svg +[coveralls-url]: https://coveralls.io/r/component/merge-descriptors?branch=master +[downloads-image]: https://img.shields.io/npm/dm/merge-descriptors.svg +[downloads-url]: https://npmjs.org/package/merge-descriptors diff --git a/api/node_modules/mime-db/HISTORY.md b/api/node_modules/mime-db/HISTORY.md index fb35bec..7436f64 100644 --- a/api/node_modules/mime-db/HISTORY.md +++ b/api/node_modules/mime-db/HISTORY.md @@ -1,37 +1,3 @@ -1.54.0 / 2025-03-17 -=================== - - * Update mime type for DCM format (#362) - * mark application/octet-stream as compressible (#163) - * Fix typo in application/x-zip-compressed mimetype (#359) - * Add mime-type for Jupyter notebooks (#282) - * Add Google Drive MIME types (#311) - * Add .blend file type (#338) - * Add support for the FBX file extension (#342) - * Add Adobe DNG file (#340) - * Add Procreate Brush and Brush Set file Types (#339) - * Add support for Procreate Dreams (#341) - * replace got with undici (#352) - * Added extensions list for model/step (#293) - * Add m4b as a type of audio/mp4 (#357) - * windows 11 application/x-zip-compressed (#346) - * add dotLottie mime type (#351) - * Add some MS-related extensions and types (#336) - -1.53.0 / 2024-07-12 -=================== - - * Add extension `.sql` to `application/sql` - * Add extensions `.aac` and `.adts` to `audio/aac` - * Add extensions `.js` and `.mjs` to `text/javascript` - * Add extensions for `application/mp4` from IANA - * Add extensions from IANA for more MIME types - * Add Microsoft app installer types and extensions - * Add new upstream MIME types - * Fix extensions for `text/markdown` to match IANA - * Remove extension `.mjs` from `application/javascript` - * Remove obsolete MIME types from IANA data - 1.52.0 / 2022-02-21 =================== @@ -70,7 +36,7 @@ =================== * Add new upstream MIME types - * Remove ambiguous extensions from IANA for `application/*+xml` types + * Remove ambigious extensions from IANA for `application/*+xml` types * Update primary extension to `.es` for `application/ecmascript` 1.46.0 / 2021-02-13 diff --git a/api/node_modules/mime-db/README.md b/api/node_modules/mime-db/README.md index ee93fa0..5a8fcfe 100644 --- a/api/node_modules/mime-db/README.md +++ b/api/node_modules/mime-db/README.md @@ -11,9 +11,9 @@ It consists of a single, public JSON file and does not include any logic, allowing it to remain as un-opinionated as possible with an API. It aggregates data from the following sources: -- https://www.iana.org/assignments/media-types/media-types.xhtml -- https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types -- https://hg.nginx.org/nginx/raw-file/default/conf/mime.types +- http://www.iana.org/assignments/media-types/media-types.xhtml +- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types +- http://hg.nginx.org/nginx/raw-file/default/conf/mime.types ## Installation @@ -23,7 +23,10 @@ npm install mime-db ### Database Download -If you intend to use this in a web browser, you can conveniently access the JSON file via [jsDelivr](https://www.jsdelivr.com/), a popular CDN (Content Delivery Network). To ensure stability and compatibility, it is advisable to specify [a release tag](https://github.com/jshttp/mime-db/tags) instead of using the 'master' branch. This is because the JSON file's format might change in future updates, and relying on a specific release tag will prevent potential issues arising from these changes. +If you're crazy enough to use this in the browser, you can just grab the +JSON file using [jsDelivr](https://www.jsdelivr.com/). It is recommended to +replace `master` with [a release tag](https://github.com/jshttp/mime-db/tags) +as the JSON format may change in the future. ``` https://cdn.jsdelivr.net/gh/jshttp/mime-db@master/db.json @@ -45,42 +48,17 @@ Each mime type has the following properties: - `.source` - where the mime type is defined. If not set, it's probably a custom media type. - - `apache` - [Apache common media types](https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types) - - `iana` - [IANA-defined media types](https://www.iana.org/assignments/media-types/media-types.xhtml) - - `nginx` - [nginx media types](https://hg.nginx.org/nginx/raw-file/default/conf/mime.types) + - `apache` - [Apache common media types](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types) + - `iana` - [IANA-defined media types](http://www.iana.org/assignments/media-types/media-types.xhtml) + - `nginx` - [nginx media types](http://hg.nginx.org/nginx/raw-file/default/conf/mime.types) - `.extensions[]` - known extensions associated with this mime type. - `.compressible` - whether a file of this type can be gzipped. - `.charset` - the default charset associated with this type, if any. If unknown, every property could be `undefined`. -## Note on MIME Type Data and Semver - -This package considers the programmatic api as the semver compatibility. This means the MIME type resolution is *not* considered -in the semver bumps. This means that if you want to pin your `mime-db` data you will need to do it in your application. While -this expectation was not set in docs until now, it is how the pacakge operated, so we do not feel this is a breaking change. - ## Contributing -The primary way to contribute to this database is by updating the data in -one of the upstream sources. The database is updated from the upstreams -periodically and will pull in any changes. - -### Registering Media Types - -The best way to get new media types included in this library is to register -them with the IANA. The community registration procedure is outlined in -[RFC 6838 section 5](https://tools.ietf.org/html/rfc6838#section-5). Types -registered with the IANA are automatically pulled into this library. - -### Direct Inclusion - -If that is not possible / feasible, they can be added directly here as a -"custom" type. To do this, it is required to have a primary source that -definitively lists the media type. If an extension is going to be listed as -associated with this media type, the source must definitively link the -media type and extension as well. - To edit the database, only make PRs against `src/custom-types.json` or `src/custom-suffix.json`. @@ -98,8 +76,21 @@ keys and the values being an object with the following keys: To update the build, run `npm run build`. +### Adding Custom Media Types + +The best way to get new media types included in this library is to register +them with the IANA. The community registration procedure is outlined in +[RFC 6838 section 5](http://tools.ietf.org/html/rfc6838#section-5). Types +registered with the IANA are automatically pulled into this library. + +If that is not possible / feasible, they can be added directly here as a +"custom" type. To do this, it is required to have a primary source that +definitively lists the media type. If an extension is going to be listed as +associateed with this media type, the source must definitively link the +media type and extension as well. + [ci-image]: https://badgen.net/github/checks/jshttp/mime-db/master?label=ci -[ci-url]: https://github.com/jshttp/mime-db/actions/workflows/ci.yml +[ci-url]: https://github.com/jshttp/mime-db/actions?query=workflow%3Aci [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-db/master [coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master [node-image]: https://badgen.net/npm/node/mime-db diff --git a/api/node_modules/mime-db/db.json b/api/node_modules/mime-db/db.json index 7e74733..eb9c42c 100644 --- a/api/node_modules/mime-db/db.json +++ b/api/node_modules/mime-db/db.json @@ -25,16 +25,6 @@ "application/ace+cbor": { "source": "iana" }, - "application/ace+json": { - "source": "iana", - "compressible": true - }, - "application/ace-groupcomm+cbor": { - "source": "iana" - }, - "application/ace-trl+cbor": { - "source": "iana" - }, "application/activemessage": { "source": "iana" }, @@ -42,21 +32,6 @@ "source": "iana", "compressible": true }, - "application/aif+cbor": { - "source": "iana" - }, - "application/aif+json": { - "source": "iana", - "compressible": true - }, - "application/alto-cdni+json": { - "source": "iana", - "compressible": true - }, - "application/alto-cdnifilter+json": { - "source": "iana", - "compressible": true - }, "application/alto-costmap+json": { "source": "iana", "compressible": true @@ -97,22 +72,6 @@ "source": "iana", "compressible": true }, - "application/alto-propmap+json": { - "source": "iana", - "compressible": true - }, - "application/alto-propmapparams+json": { - "source": "iana", - "compressible": true - }, - "application/alto-tips+json": { - "source": "iana", - "compressible": true - }, - "application/alto-tipsparams+json": { - "source": "iana", - "compressible": true - }, "application/alto-updatestreamcontrol+json": { "source": "iana", "compressible": true @@ -128,10 +87,6 @@ "source": "iana", "extensions": ["ez"] }, - "application/appinstaller": { - "compressible": false, - "extensions": ["appinstaller"] - }, "application/applefile": { "source": "iana" }, @@ -139,14 +94,6 @@ "source": "apache", "extensions": ["aw"] }, - "application/appx": { - "compressible": false, - "extensions": ["appx"] - }, - "application/appxbundle": { - "compressible": false, - "extensions": ["appxbundle"] - }, "application/at+jwt": { "source": "iana" }, @@ -208,16 +155,6 @@ "source": "iana", "compressible": true }, - "application/automationml-aml+xml": { - "source": "iana", - "compressible": true, - "extensions": ["aml"] - }, - "application/automationml-amlx+zip": { - "source": "iana", - "compressible": false, - "extensions": ["amlx"] - }, "application/bacnet-xdd+zip": { "source": "iana", "compressible": false @@ -234,12 +171,6 @@ "charset": "UTF-8", "compressible": true }, - "application/bufr": { - "source": "iana" - }, - "application/c2pa": { - "source": "iana" - }, "application/calendar+json": { "source": "iana", "compressible": true @@ -277,11 +208,6 @@ "compressible": true, "extensions": ["ccxml"] }, - "application/cda+xml": { - "source": "iana", - "charset": "UTF-8", - "compressible": true - }, "application/cdfx+xml": { "source": "iana", "compressible": true, @@ -310,9 +236,6 @@ "application/cdni": { "source": "iana" }, - "application/ce+cbor": { - "source": "iana" - }, "application/cea": { "source": "iana" }, @@ -327,16 +250,10 @@ "application/cfw": { "source": "iana" }, - "application/cid-edhoc+cbor-seq": { - "source": "iana" - }, "application/city+json": { "source": "iana", "compressible": true }, - "application/city+json-seq": { - "source": "iana" - }, "application/clr": { "source": "iana" }, @@ -355,9 +272,6 @@ "source": "iana", "compressible": true }, - "application/coap-eap": { - "source": "iana" - }, "application/coap-group+json": { "source": "iana", "compressible": true @@ -368,9 +282,6 @@ "application/commonground": { "source": "iana" }, - "application/concise-problem-details+cbor": { - "source": "iana" - }, "application/conference-info+xml": { "source": "iana", "compressible": true @@ -384,9 +295,6 @@ "application/cose-key-set": { "source": "iana" }, - "application/cose-x509": { - "source": "iana" - }, "application/cpl+xml": { "source": "iana", "compressible": true, @@ -411,17 +319,6 @@ "source": "apache", "extensions": ["cu"] }, - "application/cwl": { - "source": "iana", - "extensions": ["cwl"] - }, - "application/cwl+json": { - "source": "iana", - "compressible": true - }, - "application/cwl+yaml": { - "source": "iana" - }, "application/cwt": { "source": "iana" }, @@ -463,8 +360,7 @@ "compressible": true }, "application/dicom": { - "source": "iana", - "extensions": ["dcm"] + "source": "iana" }, "application/dicom+json": { "source": "iana", @@ -498,9 +394,6 @@ "application/dots+cbor": { "source": "iana" }, - "application/dpop+jwt": { - "source": "iana" - }, "application/dskpp+xml": { "source": "iana", "compressible": true @@ -517,33 +410,10 @@ "application/dvcs": { "source": "iana" }, - "application/eat+cwt": { - "source": "iana" - }, - "application/eat+jwt": { - "source": "iana" - }, - "application/eat-bun+cbor": { - "source": "iana" - }, - "application/eat-bun+json": { - "source": "iana", - "compressible": true - }, - "application/eat-ucs+cbor": { - "source": "iana" - }, - "application/eat-ucs+json": { - "source": "iana", - "compressible": true - }, "application/ecmascript": { - "source": "apache", + "source": "iana", "compressible": true, - "extensions": ["ecma"] - }, - "application/edhoc+cbor-seq": { - "source": "iana" + "extensions": ["es","ecma"] }, "application/edi-consent": { "source": "iana" @@ -588,10 +458,6 @@ "application/emergencycalldata.ecall.msd": { "source": "iana" }, - "application/emergencycalldata.legacyesn+json": { - "source": "iana", - "compressible": true - }, "application/emergencycalldata.providerinfo+xml": { "source": "iana", "compressible": true @@ -621,9 +487,6 @@ "application/encaprtp": { "source": "iana" }, - "application/entity-statement+jwt": { - "source": "iana" - }, "application/epp+xml": { "source": "iana", "compressible": true @@ -654,10 +517,6 @@ "application/fastsoap": { "source": "iana" }, - "application/fdf": { - "source": "iana", - "extensions": ["fdf"] - }, "application/fdt+xml": { "source": "iana", "compressible": true, @@ -708,14 +567,6 @@ "application/geopackage+sqlite3": { "source": "iana" }, - "application/geopose+json": { - "source": "iana", - "compressible": true - }, - "application/geoxacml+json": { - "source": "iana", - "compressible": true - }, "application/geoxacml+xml": { "source": "iana", "compressible": true @@ -728,26 +579,11 @@ "compressible": true, "extensions": ["gml"] }, - "application/gnap-binding-jws": { - "source": "iana" - }, - "application/gnap-binding-jwsd": { - "source": "iana" - }, - "application/gnap-binding-rotation-jws": { - "source": "iana" - }, - "application/gnap-binding-rotation-jwsd": { - "source": "iana" - }, "application/gpx+xml": { "source": "apache", "compressible": true, "extensions": ["gpx"] }, - "application/grib": { - "source": "iana" - }, "application/gxf": { "source": "apache", "extensions": ["gxf"] @@ -767,11 +603,6 @@ "application/hjson": { "extensions": ["hjson"] }, - "application/hl7v2+xml": { - "source": "iana", - "charset": "UTF-8", - "compressible": true - }, "application/http": { "source": "iana" }, @@ -837,7 +668,7 @@ "extensions": ["its"] }, "application/java-archive": { - "source": "iana", + "source": "apache", "compressible": false, "extensions": ["jar","war","ear"] }, @@ -852,10 +683,10 @@ "extensions": ["class"] }, "application/javascript": { - "source": "apache", + "source": "iana", "charset": "UTF-8", "compressible": true, - "extensions": ["js"] + "extensions": ["js","mjs"] }, "application/jf2feed+json": { "source": "iana", @@ -876,10 +707,6 @@ "source": "iana", "compressible": true }, - "application/jscontact+json": { - "source": "iana", - "compressible": true - }, "application/json": { "source": "iana", "charset": "UTF-8", @@ -901,9 +728,6 @@ "compressible": true, "extensions": ["jsonml"] }, - "application/jsonpath": { - "source": "iana" - }, "application/jwk+json": { "source": "iana", "compressible": true @@ -912,9 +736,6 @@ "source": "iana", "compressible": true }, - "application/jwk-set+jwt": { - "source": "iana" - }, "application/jwt": { "source": "iana" }, @@ -939,20 +760,10 @@ "application/link-format": { "source": "iana" }, - "application/linkset": { - "source": "iana" - }, - "application/linkset+json": { - "source": "iana", - "compressible": true - }, "application/load-control+xml": { "source": "iana", "compressible": true }, - "application/logout+jwt": { - "source": "iana" - }, "application/lost+xml": { "source": "iana", "compressible": true, @@ -1143,7 +954,7 @@ }, "application/mp4": { "source": "iana", - "extensions": ["mp4","mpg4","mp4s","m4p"] + "extensions": ["mp4s","m4p"] }, "application/mpeg4-generic": { "source": "iana" @@ -1172,14 +983,6 @@ "charset": "UTF-8", "compressible": true }, - "application/msix": { - "compressible": false, - "extensions": ["msix"] - }, - "application/msixbundle": { - "compressible": false, - "extensions": ["msixbundle"] - }, "application/msword": { "source": "iana", "compressible": false, @@ -1243,7 +1046,7 @@ }, "application/octet-stream": { "source": "iana", - "compressible": true, + "compressible": false, "extensions": ["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"] }, "application/oda": { @@ -1267,9 +1070,6 @@ "compressible": false, "extensions": ["ogx"] }, - "application/ohttp-keys": { - "source": "iana" - }, "application/omdoc+xml": { "source": "apache", "compressible": true, @@ -1277,7 +1077,7 @@ }, "application/onenote": { "source": "apache", - "extensions": ["onetoc","onetoc2","onetmp","onepkg","one","onea"] + "extensions": ["onetoc","onetoc2","onetmp","onepkg"] }, "application/opc-nodeset+xml": { "source": "iana", @@ -1335,7 +1135,7 @@ }, "application/pgp-signature": { "source": "iana", - "extensions": ["sig","asc"] + "extensions": ["asc","sig"] }, "application/pics-rules": { "source": "apache", @@ -1412,15 +1212,6 @@ "source": "iana", "compressible": true }, - "application/private-token-issuer-directory": { - "source": "iana" - }, - "application/private-token-request": { - "source": "iana" - }, - "application/private-token-response": { - "source": "iana" - }, "application/problem+json": { "source": "iana", "compressible": true @@ -1434,9 +1225,6 @@ "compressible": true, "extensions": ["provx"] }, - "application/provided-claims+jwt": { - "source": "iana" - }, "application/prs.alvestrand.titrax-sheet": { "source": "iana" }, @@ -1452,29 +1240,6 @@ "source": "iana", "compressible": false }, - "application/prs.implied-document+xml": { - "source": "iana", - "compressible": true - }, - "application/prs.implied-executable": { - "source": "iana" - }, - "application/prs.implied-object+json": { - "source": "iana", - "compressible": true - }, - "application/prs.implied-object+json-seq": { - "source": "iana" - }, - "application/prs.implied-object+yaml": { - "source": "iana" - }, - "application/prs.implied-structure": { - "source": "iana" - }, - "application/prs.mayfile": { - "source": "iana" - }, "application/prs.nprend": { "source": "iana" }, @@ -1484,13 +1249,9 @@ "application/prs.rdf-xml-crypt": { "source": "iana" }, - "application/prs.vcfbzip2": { - "source": "iana" - }, "application/prs.xsf+xml": { "source": "iana", - "compressible": true, - "extensions": ["xsf"] + "compressible": true }, "application/pskc+xml": { "source": "iana", @@ -1530,15 +1291,12 @@ "extensions": ["rnc"] }, "application/remote-printing": { - "source": "apache" + "source": "iana" }, "application/reputon+json": { "source": "iana", "compressible": true }, - "application/resolve-response+jwt": { - "source": "iana" - }, "application/resource-lists+xml": { "source": "iana", "compressible": true, @@ -1580,9 +1338,6 @@ "compressible": true, "extensions": ["rusd"] }, - "application/rpki-checklist": { - "source": "iana" - }, "application/rpki-ghostbusters": { "source": "iana", "extensions": ["gbr"] @@ -1598,9 +1353,6 @@ "source": "iana", "extensions": ["roa"] }, - "application/rpki-signed-tal": { - "source": "iana" - }, "application/rpki-updown": { "source": "iana" }, @@ -1773,7 +1525,7 @@ "source": "iana" }, "application/smil": { - "source": "apache" + "source": "iana" }, "application/smil+xml": { "source": "iana", @@ -1808,8 +1560,7 @@ "compressible": true }, "application/sql": { - "source": "iana", - "extensions": ["sql"] + "source": "iana" }, "application/srgs": { "source": "iana", @@ -1830,27 +1581,15 @@ "compressible": true, "extensions": ["ssdl"] }, - "application/sslkeylogfile": { - "source": "iana" - }, "application/ssml+xml": { "source": "iana", "compressible": true, "extensions": ["ssml"] }, - "application/st2110-41": { - "source": "iana" - }, "application/stix+json": { "source": "iana", "compressible": true }, - "application/stratum": { - "source": "iana" - }, - "application/swid+cbor": { - "source": "iana" - }, "application/swid+xml": { "source": "iana", "compressible": true, @@ -1930,21 +1669,13 @@ "source": "iana", "compressible": true }, - "application/tm+json": { - "source": "iana", - "compressible": true - }, "application/tnauthlist": { "source": "iana" }, - "application/toc+cbor": { - "source": "iana" - }, "application/token-introspection+jwt": { "source": "iana" }, "application/toml": { - "source": "iana", "compressible": true, "extensions": ["toml"] }, @@ -1955,16 +1686,6 @@ "source": "iana", "extensions": ["trig"] }, - "application/trust-chain+json": { - "source": "iana", - "compressible": true - }, - "application/trust-mark+jwt": { - "source": "iana" - }, - "application/trust-mark-delegation+jwt": { - "source": "iana" - }, "application/ttml+xml": { "source": "iana", "compressible": true, @@ -1983,13 +1704,6 @@ "compressible": false, "extensions": ["ubj"] }, - "application/uccs+cbor": { - "source": "iana" - }, - "application/ujcs+json": { - "source": "iana", - "compressible": true - }, "application/ulpfec": { "source": "iana" }, @@ -2011,15 +1725,6 @@ "source": "iana", "compressible": true }, - "application/vc": { - "source": "iana" - }, - "application/vc+cose": { - "source": "iana" - }, - "application/vc+jwt": { - "source": "iana" - }, "application/vcard+json": { "source": "iana", "compressible": true @@ -2039,47 +1744,20 @@ "compressible": true, "extensions": ["1km"] }, - "application/vnd.1ob": { - "source": "iana" - }, "application/vnd.3gpp-prose+xml": { "source": "iana", "compressible": true }, - "application/vnd.3gpp-prose-pc3a+xml": { - "source": "iana", - "compressible": true - }, - "application/vnd.3gpp-prose-pc3ach+xml": { - "source": "iana", - "compressible": true - }, "application/vnd.3gpp-prose-pc3ch+xml": { "source": "iana", "compressible": true }, - "application/vnd.3gpp-prose-pc8+xml": { - "source": "iana", - "compressible": true - }, "application/vnd.3gpp-v2x-local-service-information": { "source": "iana" }, "application/vnd.3gpp.5gnas": { "source": "iana" }, - "application/vnd.3gpp.5gsa2x": { - "source": "iana" - }, - "application/vnd.3gpp.5gsa2x-local-service-information": { - "source": "iana" - }, - "application/vnd.3gpp.5gsv2x": { - "source": "iana" - }, - "application/vnd.3gpp.5gsv2x-local-service-information": { - "source": "iana" - }, "application/vnd.3gpp.access-transfer-events+xml": { "source": "iana", "compressible": true @@ -2088,14 +1766,6 @@ "source": "iana", "compressible": true }, - "application/vnd.3gpp.crs+xml": { - "source": "iana", - "compressible": true - }, - "application/vnd.3gpp.current-location-discovery+xml": { - "source": "iana", - "compressible": true - }, "application/vnd.3gpp.gmop+xml": { "source": "iana", "compressible": true @@ -2120,17 +1790,9 @@ "source": "iana", "compressible": true }, - "application/vnd.3gpp.mcdata-msgstore-ctrl-request+xml": { - "source": "iana", - "compressible": true - }, "application/vnd.3gpp.mcdata-payload": { "source": "iana" }, - "application/vnd.3gpp.mcdata-regroup+xml": { - "source": "iana", - "compressible": true - }, "application/vnd.3gpp.mcdata-service-config+xml": { "source": "iana", "compressible": true @@ -2166,10 +1828,6 @@ "source": "iana", "compressible": true }, - "application/vnd.3gpp.mcptt-regroup+xml": { - "source": "iana", - "compressible": true - }, "application/vnd.3gpp.mcptt-service-config+xml": { "source": "iana", "compressible": true @@ -2194,6 +1852,10 @@ "source": "iana", "compressible": true }, + "application/vnd.3gpp.mcvideo-affiliation-info+xml": { + "source": "iana", + "compressible": true + }, "application/vnd.3gpp.mcvideo-info+xml": { "source": "iana", "compressible": true @@ -2206,10 +1868,6 @@ "source": "iana", "compressible": true }, - "application/vnd.3gpp.mcvideo-regroup+xml": { - "source": "iana", - "compressible": true - }, "application/vnd.3gpp.mcvideo-service-config+xml": { "source": "iana", "compressible": true @@ -2248,45 +1906,9 @@ "source": "iana", "extensions": ["pvb"] }, - "application/vnd.3gpp.pinapp-info+xml": { - "source": "iana", - "compressible": true - }, "application/vnd.3gpp.s1ap": { "source": "iana" }, - "application/vnd.3gpp.seal-group-doc+xml": { - "source": "iana", - "compressible": true - }, - "application/vnd.3gpp.seal-info+xml": { - "source": "iana", - "compressible": true - }, - "application/vnd.3gpp.seal-location-info+xml": { - "source": "iana", - "compressible": true - }, - "application/vnd.3gpp.seal-mbms-usage-info+xml": { - "source": "iana", - "compressible": true - }, - "application/vnd.3gpp.seal-network-qos-management-info+xml": { - "source": "iana", - "compressible": true - }, - "application/vnd.3gpp.seal-ue-config-info+xml": { - "source": "iana", - "compressible": true - }, - "application/vnd.3gpp.seal-unicast-info+xml": { - "source": "iana", - "compressible": true - }, - "application/vnd.3gpp.seal-user-profile-info+xml": { - "source": "iana", - "compressible": true - }, "application/vnd.3gpp.sms": { "source": "iana" }, @@ -2310,13 +1932,6 @@ "source": "iana", "compressible": true }, - "application/vnd.3gpp.v2x": { - "source": "iana" - }, - "application/vnd.3gpp.vae-info+xml": { - "source": "iana", - "compressible": true - }, "application/vnd.3gpp2.bcmcsinfo+xml": { "source": "iana", "compressible": true @@ -2343,14 +1958,6 @@ "source": "iana", "extensions": ["imp"] }, - "application/vnd.acm.addressxfer+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.acm.chatbot+json": { - "source": "iana", - "compressible": true - }, "application/vnd.acucobol": { "source": "iana", "extensions": ["acu"] @@ -2384,7 +1991,7 @@ "extensions": ["xdp"] }, "application/vnd.adobe.xfdf": { - "source": "apache", + "source": "iana", "extensions": ["xfdf"] }, "application/vnd.aether.imp": { @@ -2434,7 +2041,7 @@ "extensions": ["age"] }, "application/vnd.ah-barcode": { - "source": "apache" + "source": "iana" }, "application/vnd.ahead.space": { "source": "iana", @@ -2500,9 +2107,6 @@ "application/vnd.apache.arrow.stream": { "source": "iana" }, - "application/vnd.apache.parquet": { - "source": "iana" - }, "application/vnd.apache.thrift.binary": { "source": "iana" }, @@ -2512,9 +2116,6 @@ "application/vnd.apache.thrift.json": { "source": "iana" }, - "application/vnd.apexlang": { - "source": "iana" - }, "application/vnd.api+json": { "source": "iana", "compressible": true @@ -2553,7 +2154,7 @@ "extensions": ["pkpass"] }, "application/vnd.arastra.swi": { - "source": "apache" + "source": "iana" }, "application/vnd.aristanetworks.swi": { "source": "iana", @@ -2574,9 +2175,6 @@ "source": "iana", "extensions": ["aep"] }, - "application/vnd.autodesk.fbx": { - "extensions": ["fbx"] - }, "application/vnd.autopackage": { "source": "iana" }, @@ -2613,14 +2211,6 @@ "source": "iana", "compressible": true }, - "application/vnd.belightsoft.lhzd+zip": { - "source": "iana", - "compressible": false - }, - "application/vnd.belightsoft.lhzl+zip": { - "source": "iana", - "compressible": false - }, "application/vnd.bint.med-content": { "source": "iana" }, @@ -2659,13 +2249,6 @@ "source": "iana", "compressible": true }, - "application/vnd.bzip3": { - "source": "iana" - }, - "application/vnd.c3voc.schedule+xml": { - "source": "iana", - "compressible": true - }, "application/vnd.cab-jscript": { "source": "iana" }, @@ -2732,16 +2315,6 @@ "source": "iana", "extensions": ["c11amz"] }, - "application/vnd.cncf.helm.chart.content.v1.tar+gzip": { - "source": "iana" - }, - "application/vnd.cncf.helm.chart.provenance.v1.prov": { - "source": "iana" - }, - "application/vnd.cncf.helm.config.v1+json": { - "source": "iana", - "compressible": true - }, "application/vnd.coffeescript": { "source": "iana" }, @@ -2908,9 +2481,6 @@ "source": "iana", "extensions": ["rdz"] }, - "application/vnd.datalog": { - "source": "iana" - }, "application/vnd.datapackage+json": { "source": "iana", "compressible": true @@ -2923,11 +2493,6 @@ "source": "iana", "extensions": ["dbf"] }, - "application/vnd.dcmp+xml": { - "source": "iana", - "compressible": true, - "extensions": ["dcmp"] - }, "application/vnd.debian.binary-package": { "source": "iana" }, @@ -3126,10 +2691,6 @@ "application/vnd.efi.iso": { "source": "iana" }, - "application/vnd.eln+zip": { - "source": "iana", - "compressible": false - }, "application/vnd.emclient.accessrequest+xml": { "source": "iana", "compressible": true @@ -3168,9 +2729,6 @@ "application/vnd.ericsson.quickcall": { "source": "iana" }, - "application/vnd.erofs": { - "source": "iana" - }, "application/vnd.espass-espass+zip": { "source": "iana", "compressible": false @@ -3307,7 +2865,7 @@ "source": "iana" }, "application/vnd.fdf": { - "source": "apache", + "source": "iana", "extensions": ["fdf"] }, "application/vnd.fdsn.mseed": { @@ -3318,11 +2876,6 @@ "source": "iana", "extensions": ["seed","dataless"] }, - "application/vnd.fdsn.stationxml+xml": { - "source": "iana", - "charset": "XML-BASED", - "compressible": true - }, "application/vnd.ffsns": { "source": "iana" }, @@ -3354,15 +2907,12 @@ "source": "iana", "extensions": ["fm","frame","maker","book"] }, - "application/vnd.freelog.comic": { - "source": "iana" - }, "application/vnd.frogans.fnc": { - "source": "apache", + "source": "iana", "extensions": ["fnc"] }, "application/vnd.frogans.ltf": { - "source": "apache", + "source": "iana", "extensions": ["ltf"] }, "application/vnd.fsc.weblaunch": { @@ -3440,61 +2990,28 @@ "source": "iana", "extensions": ["fzs"] }, - "application/vnd.ga4gh.passport+jwt": { - "source": "iana" - }, "application/vnd.genomatix.tuxedo": { "source": "iana", "extensions": ["txd"] }, - "application/vnd.genozip": { - "source": "iana" - }, "application/vnd.gentics.grd+json": { "source": "iana", "compressible": true }, - "application/vnd.gentoo.catmetadata+xml": { - "source": "iana", - "compressible": true - }, - "application/vnd.gentoo.ebuild": { - "source": "iana" - }, - "application/vnd.gentoo.eclass": { - "source": "iana" - }, - "application/vnd.gentoo.gpkg": { - "source": "iana" - }, - "application/vnd.gentoo.manifest": { - "source": "iana" - }, - "application/vnd.gentoo.pkgmetadata+xml": { - "source": "iana", - "compressible": true - }, - "application/vnd.gentoo.xpak": { - "source": "iana" - }, "application/vnd.geo+json": { - "source": "apache", + "source": "iana", "compressible": true }, "application/vnd.geocube+xml": { - "source": "apache", + "source": "iana", "compressible": true }, "application/vnd.geogebra.file": { "source": "iana", "extensions": ["ggb"] }, - "application/vnd.geogebra.pinboard": { - "source": "iana" - }, "application/vnd.geogebra.slides": { - "source": "iana", - "extensions": ["ggs"] + "source": "iana" }, "application/vnd.geogebra.tool": { "source": "iana", @@ -3529,64 +3046,18 @@ "source": "iana", "extensions": ["gmx"] }, - "application/vnd.gnu.taler.exchange+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.gnu.taler.merchant+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.google-apps.audio": {}, "application/vnd.google-apps.document": { "compressible": false, "extensions": ["gdoc"] }, - "application/vnd.google-apps.drawing": { - "compressible": false, - "extensions": ["gdraw"] - }, - "application/vnd.google-apps.drive-sdk": { - "compressible": false - }, - "application/vnd.google-apps.file": {}, - "application/vnd.google-apps.folder": { - "compressible": false - }, - "application/vnd.google-apps.form": { - "compressible": false, - "extensions": ["gform"] - }, - "application/vnd.google-apps.fusiontable": {}, - "application/vnd.google-apps.jam": { - "compressible": false, - "extensions": ["gjam"] - }, - "application/vnd.google-apps.mail-layout": {}, - "application/vnd.google-apps.map": { - "compressible": false, - "extensions": ["gmap"] - }, - "application/vnd.google-apps.photo": {}, "application/vnd.google-apps.presentation": { "compressible": false, "extensions": ["gslides"] }, - "application/vnd.google-apps.script": { - "compressible": false, - "extensions": ["gscript"] - }, - "application/vnd.google-apps.shortcut": {}, - "application/vnd.google-apps.site": { - "compressible": false, - "extensions": ["gsite"] - }, "application/vnd.google-apps.spreadsheet": { "compressible": false, "extensions": ["gsheet"] }, - "application/vnd.google-apps.unknown": {}, - "application/vnd.google-apps.video": {}, "application/vnd.google-earth.kml+xml": { "source": "iana", "compressible": true, @@ -3598,7 +3069,7 @@ "extensions": ["kmz"] }, "application/vnd.gov.sk.e-form+xml": { - "source": "apache", + "source": "iana", "compressible": true }, "application/vnd.gov.sk.e-form+zip": { @@ -3606,11 +3077,6 @@ "compressible": false }, "application/vnd.gov.sk.xmldatacontainer+xml": { - "source": "iana", - "compressible": true, - "extensions": ["xdcf"] - }, - "application/vnd.gpxsee.map+xml": { "source": "iana", "compressible": true }, @@ -3685,6 +3151,16 @@ "source": "iana", "extensions": ["les"] }, + "application/vnd.hl7cda+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/vnd.hl7v2+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, "application/vnd.hp-hpgl": { "source": "iana", "extensions": ["hpgl"] @@ -3709,9 +3185,6 @@ "source": "iana", "extensions": ["pclxl"] }, - "application/vnd.hsl": { - "source": "iana" - }, "application/vnd.httphone": { "source": "iana" }, @@ -3735,7 +3208,7 @@ "source": "iana" }, "application/vnd.ibm.afplinedata": { - "source": "apache" + "source": "iana" }, "application/vnd.ibm.electronic-media": { "source": "iana" @@ -3745,7 +3218,7 @@ "extensions": ["mpy"] }, "application/vnd.ibm.modcap": { - "source": "apache", + "source": "iana", "extensions": ["afp","listafp","list3820"] }, "application/vnd.ibm.rights-management": { @@ -3821,7 +3294,7 @@ "compressible": true }, "application/vnd.informix-visionary": { - "source": "apache" + "source": "iana" }, "application/vnd.infotech.project": { "source": "iana" @@ -3859,21 +3332,6 @@ "source": "iana", "extensions": ["qfx"] }, - "application/vnd.ipfs.ipns-record": { - "source": "iana" - }, - "application/vnd.ipld.car": { - "source": "iana" - }, - "application/vnd.ipld.dag-cbor": { - "source": "iana" - }, - "application/vnd.ipld.dag-json": { - "source": "iana" - }, - "application/vnd.ipld.raw": { - "source": "iana" - }, "application/vnd.iptc.g2.catalogitem+xml": { "source": "iana", "compressible": true @@ -4002,20 +3460,10 @@ "source": "iana", "extensions": ["kwd","kwt"] }, - "application/vnd.kdl": { - "source": "iana" - }, "application/vnd.kenameaapp": { "source": "iana", "extensions": ["htke"] }, - "application/vnd.keyman.kmp+zip": { - "source": "iana", - "compressible": false - }, - "application/vnd.keyman.kmx": { - "source": "iana" - }, "application/vnd.kidspiration": { "source": "iana", "extensions": ["kia"] @@ -4047,9 +3495,6 @@ "application/vnd.laszip": { "source": "iana" }, - "application/vnd.ldev.productlicensing": { - "source": "iana" - }, "application/vnd.leap+json": { "source": "iana", "compressible": true @@ -4140,12 +3585,6 @@ "source": "iana", "extensions": ["mcd"] }, - "application/vnd.mdl": { - "source": "iana" - }, - "application/vnd.mdl-mbsdf": { - "source": "iana" - }, "application/vnd.medcalcdata": { "source": "iana", "extensions": ["mc1"] @@ -4154,15 +3593,9 @@ "source": "iana", "extensions": ["cdkey"] }, - "application/vnd.medicalholodeck.recordxr": { - "source": "iana" - }, "application/vnd.meridian-slingshot": { "source": "iana" }, - "application/vnd.mermaid": { - "source": "iana" - }, "application/vnd.mfer": { "source": "iana", "extensions": ["mwf"] @@ -4231,9 +3664,6 @@ "source": "iana", "extensions": ["txf"] }, - "application/vnd.modl": { - "source": "iana" - }, "application/vnd.mophun.application": { "source": "iana", "extensions": ["mpn"] @@ -4401,9 +3831,6 @@ "application/vnd.ms-tnef": { "source": "iana" }, - "application/vnd.ms-visio.viewer": { - "extensions": ["vdx"] - }, "application/vnd.ms-windows.devicepairing": { "source": "iana" }, @@ -4456,9 +3883,6 @@ "source": "iana", "extensions": ["mseq"] }, - "application/vnd.msgpack": { - "source": "iana" - }, "application/vnd.msign": { "source": "iana" }, @@ -4487,22 +3911,6 @@ "source": "iana", "compressible": true }, - "application/vnd.nato.bindingdataobject+cbor": { - "source": "iana" - }, - "application/vnd.nato.bindingdataobject+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.nato.bindingdataobject+xml": { - "source": "iana", - "compressible": true, - "extensions": ["bdo"] - }, - "application/vnd.nato.openxmlformats-package.iepd+zip": { - "source": "iana", - "compressible": false - }, "application/vnd.ncd.control": { "source": "iana" }, @@ -4589,7 +3997,7 @@ "extensions": ["ngdat"] }, "application/vnd.nokia.n-gage.symbian.install": { - "source": "apache", + "source": "iana", "extensions": ["n-gage"] }, "application/vnd.nokia.ncd": { @@ -4637,19 +4045,6 @@ "application/vnd.ntt-local.sip-ta_tcp_stream": { "source": "iana" }, - "application/vnd.oai.workflows": { - "source": "iana" - }, - "application/vnd.oai.workflows+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.oai.workflows+yaml": { - "source": "iana" - }, - "application/vnd.oasis.opendocument.base": { - "source": "iana" - }, "application/vnd.oasis.opendocument.chart": { "source": "iana", "extensions": ["odc"] @@ -4659,7 +4054,7 @@ "extensions": ["otc"] }, "application/vnd.oasis.opendocument.database": { - "source": "apache", + "source": "iana", "extensions": ["odb"] }, "application/vnd.oasis.opendocument.formula": { @@ -4714,9 +4109,6 @@ "source": "iana", "extensions": ["odm"] }, - "application/vnd.oasis.opendocument.text-master-template": { - "source": "iana" - }, "application/vnd.oasis.opendocument.text-template": { "source": "iana", "extensions": ["ott"] @@ -4799,7 +4191,7 @@ "compressible": true }, "application/vnd.oma.bcast.drm-trigger+xml": { - "source": "apache", + "source": "iana", "compressible": true }, "application/vnd.oma.bcast.imd+xml": { @@ -4830,7 +4222,7 @@ "source": "iana" }, "application/vnd.oma.bcast.smartcard-trigger+xml": { - "source": "apache", + "source": "iana", "compressible": true }, "application/vnd.oma.bcast.sprov+xml": { @@ -4960,9 +4352,6 @@ "application/vnd.onepagertatx": { "source": "iana" }, - "application/vnd.onvif.metadata": { - "source": "iana" - }, "application/vnd.openblox.game+xml": { "source": "iana", "compressible": true, @@ -4986,10 +4375,6 @@ "application/vnd.opentimestamps.ots": { "source": "iana" }, - "application/vnd.openvpi.dspx+json": { - "source": "iana", - "compressible": true - }, "application/vnd.openxmlformats-officedocument.custom-properties+xml": { "source": "iana", "compressible": true @@ -5400,15 +4785,6 @@ "source": "iana", "extensions": ["box"] }, - "application/vnd.procrate.brushset": { - "extensions": ["brushset"] - }, - "application/vnd.procreate.brush": { - "extensions": ["brush"] - }, - "application/vnd.procreate.dream": { - "extensions": ["drm"] - }, "application/vnd.proteus.magazine": { "source": "iana", "extensions": ["mgz"] @@ -5416,9 +4792,6 @@ "application/vnd.psfs": { "source": "iana" }, - "application/vnd.pt.mundusmundi": { - "source": "iana" - }, "application/vnd.publishare-delta-tree": { "source": "iana", "extensions": ["qps"] @@ -5432,8 +4805,7 @@ }, "application/vnd.pwg-xhtml-print+xml": { "source": "iana", - "compressible": true, - "extensions": ["xhtm"] + "compressible": true }, "application/vnd.qualcomm.brew-app-res": { "source": "iana" @@ -5531,9 +4903,6 @@ "compressible": true, "extensions": ["musicxml"] }, - "application/vnd.relpipe": { - "source": "iana" - }, "application/vnd.renlearn.rlprint": { "source": "iana" }, @@ -5687,9 +5056,6 @@ "source": "iana", "compressible": true }, - "application/vnd.sketchometry": { - "source": "iana" - }, "application/vnd.smaf": { "source": "iana", "extensions": ["mmf"] @@ -5701,9 +5067,6 @@ "source": "iana", "extensions": ["teacher"] }, - "application/vnd.smintio.portals.archive": { - "source": "iana" - }, "application/vnd.snesdev-page-table": { "source": "iana" }, @@ -5831,9 +5194,6 @@ "application/vnd.swiftview-ics": { "source": "iana" }, - "application/vnd.sybyl.mol2": { - "source": "iana" - }, "application/vnd.sycle+xml": { "source": "iana", "compressible": true @@ -5938,10 +5298,6 @@ "source": "iana", "extensions": ["ufd","ufdl"] }, - "application/vnd.uic.osdm+json": { - "source": "iana", - "compressible": true - }, "application/vnd.uiq.theme": { "source": "iana", "extensions": ["utz"] @@ -5957,7 +5313,7 @@ "application/vnd.uoml+xml": { "source": "iana", "compressible": true, - "extensions": ["uoml","uo"] + "extensions": ["uoml"] }, "application/vnd.uplanet.alert": { "source": "iana" @@ -6018,13 +5374,6 @@ "source": "iana", "compressible": true }, - "application/vnd.veraison.tsm-report+cbor": { - "source": "iana" - }, - "application/vnd.veraison.tsm-report+json": { - "source": "iana", - "compressible": true - }, "application/vnd.verimatrix.vcas": { "source": "iana" }, @@ -6043,7 +5392,7 @@ }, "application/vnd.visio": { "source": "iana", - "extensions": ["vsd","vst","vss","vsw","vsdx","vtx"] + "extensions": ["vsd","vst","vss","vsw"] }, "application/vnd.visionary": { "source": "iana", @@ -6052,9 +5401,6 @@ "application/vnd.vividence.scriptfile": { "source": "iana" }, - "application/vnd.vocalshaper.vsp4": { - "source": "iana" - }, "application/vnd.vsf": { "source": "iana", "extensions": ["vsf"] @@ -6078,9 +5424,6 @@ "source": "iana", "extensions": ["wmlsc"] }, - "application/vnd.wasmflow.wafl": { - "source": "iana" - }, "application/vnd.webturbo": { "source": "iana", "extensions": ["wtb"] @@ -6113,9 +5456,6 @@ "source": "iana", "extensions": ["nbp"] }, - "application/vnd.wordlift": { - "source": "iana" - }, "application/vnd.wordperfect": { "source": "iana", "extensions": ["wpd"] @@ -6150,12 +5490,6 @@ "source": "iana", "extensions": ["xar"] }, - "application/vnd.xarin.cpj": { - "source": "iana" - }, - "application/vnd.xecrets-encrypted": { - "source": "iana" - }, "application/vnd.xfdl": { "source": "iana", "extensions": ["xfdl"] @@ -6227,6 +5561,9 @@ "source": "iana", "extensions": ["cmp"] }, + "application/vnd.youtube.yt": { + "source": "iana" + }, "application/vnd.zul": { "source": "iana", "extensions": ["zir","zirz"] @@ -6245,19 +5582,6 @@ "source": "iana", "compressible": true }, - "application/voucher-jws+json": { - "source": "iana", - "compressible": true - }, - "application/vp": { - "source": "iana" - }, - "application/vp+cose": { - "source": "iana" - }, - "application/vp+jwt": { - "source": "iana" - }, "application/vq-rtcpxr": { "source": "iana" }, @@ -6353,9 +5677,6 @@ "source": "apache", "extensions": ["torrent"] }, - "application/x-blender": { - "extensions": ["blend"] - }, "application/x-blorb": { "source": "apache", "extensions": ["blb","blorb"] @@ -6400,9 +5721,6 @@ "application/x-compress": { "source": "apache" }, - "application/x-compressed": { - "extensions": ["rar"] - }, "application/x-conference": { "source": "apache", "extensions": ["nsc"] @@ -6547,10 +5865,6 @@ "source": "apache", "extensions": ["install"] }, - "application/x-ipynb+json": { - "compressible": true, - "extensions": ["ipynb"] - }, "application/x-iso9660-image": { "source": "apache", "extensions": ["iso"] @@ -6882,9 +6196,6 @@ "source": "apache", "extensions": ["xz"] }, - "application/x-zip-compressed": { - "extensions": ["zip"] - }, "application/x-zmachine": { "source": "apache", "extensions": ["z1","z2","z3","z4","z5","z6","z7","z8"] @@ -6943,10 +6254,6 @@ "compressible": true, "extensions": ["xenc"] }, - "application/xfdf": { - "source": "iana", - "extensions": ["xfdf"] - }, "application/xhtml+xml": { "source": "iana", "compressible": true, @@ -7007,16 +6314,10 @@ "compressible": true, "extensions": ["mxml","xhvml","xvml","xvm"] }, - "application/yaml": { - "source": "iana" - }, "application/yang": { "source": "iana", "extensions": ["yang"] }, - "application/yang-data+cbor": { - "source": "iana" - }, "application/yang-data+json": { "source": "iana", "compressible": true @@ -7033,10 +6334,6 @@ "source": "iana", "compressible": true }, - "application/yang-sid+json": { - "source": "iana", - "compressible": true - }, "application/yin+xml": { "source": "iana", "compressible": true, @@ -7047,9 +6344,6 @@ "compressible": false, "extensions": ["zip"] }, - "application/zip+dotlottie": { - "extensions": ["lottie"] - }, "application/zlib": { "source": "iana" }, @@ -7071,8 +6365,7 @@ "source": "iana" }, "audio/aac": { - "source": "iana", - "extensions": ["adts","aac"] + "source": "iana" }, "audio/ac3": { "source": "iana" @@ -7195,9 +6488,6 @@ "audio/evs": { "source": "iana" }, - "audio/flac": { - "source": "iana" - }, "audio/flexfec": { "source": "iana" }, @@ -7280,9 +6570,6 @@ "audio/lpc": { "source": "iana" }, - "audio/matroska": { - "source": "iana" - }, "audio/melp": { "source": "iana" }, @@ -7302,9 +6589,6 @@ "source": "apache", "extensions": ["mid","midi","kar","rmi"] }, - "audio/midi-clip": { - "source": "iana" - }, "audio/mobile-xmf": { "source": "iana", "extensions": ["mxmf"] @@ -7316,7 +6600,7 @@ "audio/mp4": { "source": "iana", "compressible": false, - "extensions": ["m4a","mp4a","m4b"] + "extensions": ["m4a","mp4a"] }, "audio/mp4a-latm": { "source": "iana" @@ -7566,7 +6850,7 @@ "source": "iana" }, "audio/vnd.qcelp": { - "source": "apache" + "source": "iana" }, "audio/vnd.rhetorex.32kadpcm": { "source": "iana" @@ -7725,7 +7009,6 @@ "extensions": ["exr"] }, "image/apng": { - "source": "iana", "compressible": false, "extensions": ["apng"] }, @@ -7745,7 +7028,7 @@ "image/bmp": { "source": "iana", "compressible": true, - "extensions": ["bmp","dib"] + "extensions": ["bmp"] }, "image/cgm": { "source": "iana", @@ -7755,10 +7038,6 @@ "source": "iana", "extensions": ["drle"] }, - "image/dpx": { - "source": "iana", - "extensions": ["dpx"] - }, "image/emf": { "source": "iana", "extensions": ["emf"] @@ -7796,21 +7075,14 @@ "source": "iana", "extensions": ["hej2"] }, + "image/hsj2": { + "source": "iana", + "extensions": ["hsj2"] + }, "image/ief": { "source": "iana", "extensions": ["ief"] }, - "image/j2c": { - "source": "iana" - }, - "image/jaii": { - "source": "iana", - "extensions": ["jaii"] - }, - "image/jais": { - "source": "iana", - "extensions": ["jais"] - }, "image/jls": { "source": "iana", "extensions": ["jls"] @@ -7823,7 +7095,7 @@ "image/jpeg": { "source": "iana", "compressible": false, - "extensions": ["jpg","jpeg","jpe"] + "extensions": ["jpeg","jpg","jpe"] }, "image/jph": { "source": "iana", @@ -7836,17 +7108,13 @@ "image/jpm": { "source": "iana", "compressible": false, - "extensions": ["jpm","jpgm"] + "extensions": ["jpm"] }, "image/jpx": { "source": "iana", "compressible": false, "extensions": ["jpx","jpf"] }, - "image/jxl": { - "source": "iana", - "extensions": ["jxl"] - }, "image/jxr": { "source": "iana", "extensions": ["jxr"] @@ -7887,8 +7155,7 @@ "source": "iana" }, "image/pjpeg": { - "compressible": false, - "extensions": ["jfif"] + "compressible": false }, "image/png": { "source": "iana", @@ -7897,7 +7164,7 @@ }, "image/prs.btif": { "source": "iana", - "extensions": ["btif","btf"] + "extensions": ["btif"] }, "image/prs.pti": { "source": "iana", @@ -7937,9 +7204,6 @@ "source": "iana", "extensions": ["azv"] }, - "image/vnd.clip": { - "source": "iana" - }, "image/vnd.cns.inf2": { "source": "iana" }, @@ -8053,7 +7317,7 @@ "extensions": ["pcx"] }, "image/webp": { - "source": "iana", + "source": "apache", "extensions": ["webp"] }, "image/wmf": { @@ -8064,9 +7328,6 @@ "source": "apache", "extensions": ["3ds"] }, - "image/x-adobe-dng": { - "extensions": ["dng"] - }, "image/x-cmu-raster": { "source": "apache", "extensions": ["ras"] @@ -8075,9 +7336,6 @@ "source": "apache", "extensions": ["cmx"] }, - "image/x-emf": { - "source": "iana" - }, "image/x-freehand": { "source": "apache", "extensions": ["fh","fhc","fh4","fh5","fh7"] @@ -8132,9 +7390,6 @@ "source": "apache", "extensions": ["tga"] }, - "image/x-wmf": { - "source": "iana" - }, "image/x-xbitmap": { "source": "apache", "extensions": ["xbm"] @@ -8150,9 +7405,6 @@ "source": "apache", "extensions": ["xwd"] }, - "message/bhttp": { - "source": "iana" - }, "message/cpim": { "source": "iana" }, @@ -8195,16 +7447,7 @@ "source": "iana", "compressible": true }, - "message/mls": { - "source": "iana" - }, "message/news": { - "source": "apache" - }, - "message/ohttp-req": { - "source": "iana" - }, - "message/ohttp-res": { "source": "iana" }, "message/partial": { @@ -8214,10 +7457,10 @@ "message/rfc822": { "source": "iana", "compressible": true, - "extensions": ["eml","mime","mht","mhtml"] + "extensions": ["eml","mime"] }, "message/s-http": { - "source": "apache" + "source": "iana" }, "message/sip": { "source": "iana" @@ -8229,7 +7472,7 @@ "source": "iana" }, "message/vnd.si.simp": { - "source": "apache" + "source": "iana" }, "message/vnd.wfa.wsc": { "source": "iana", @@ -8257,10 +7500,6 @@ "compressible": false, "extensions": ["igs","iges"] }, - "model/jt": { - "source": "iana", - "extensions": ["jt"] - }, "model/mesh": { "source": "iana", "compressible": false, @@ -8274,13 +7513,8 @@ "source": "iana", "extensions": ["obj"] }, - "model/prc": { - "source": "iana", - "extensions": ["prc"] - }, "model/step": { - "source": "iana", - "extensions": ["step","stp","stpnc","p21","210"] + "source": "iana" }, "model/step+xml": { "source": "iana", @@ -8301,18 +7535,6 @@ "source": "iana", "extensions": ["stl"] }, - "model/u3d": { - "source": "iana", - "extensions": ["u3d"] - }, - "model/vnd.bary": { - "source": "iana", - "extensions": ["bary"] - }, - "model/vnd.cld": { - "source": "iana", - "extensions": ["cld"] - }, "model/vnd.collada+xml": { "source": "iana", "compressible": true, @@ -8360,8 +7582,7 @@ "extensions": ["x_t"] }, "model/vnd.pytha.pyox": { - "source": "iana", - "extensions": ["pyo","pyox"] + "source": "iana" }, "model/vnd.rosette.annotated-data-model": { "source": "iana" @@ -8370,10 +7591,6 @@ "source": "iana", "extensions": ["vds"] }, - "model/vnd.usda": { - "source": "iana", - "extensions": ["usda"] - }, "model/vnd.usdz+zip": { "source": "iana", "compressible": false, @@ -8519,7 +7736,7 @@ "source": "iana" }, "text/ecmascript": { - "source": "apache" + "source": "iana" }, "text/encaprtp": { "source": "iana" @@ -8542,9 +7759,6 @@ "text/grammar-ref-list": { "source": "iana" }, - "text/hl7v2": { - "source": "iana" - }, "text/html": { "source": "iana", "compressible": true, @@ -8555,9 +7769,7 @@ }, "text/javascript": { "source": "iana", - "charset": "UTF-8", - "compressible": true, - "extensions": ["js","mjs"] + "compressible": true }, "text/jcr-cnd": { "source": "iana" @@ -8573,7 +7785,7 @@ "text/markdown": { "source": "iana", "compressible": true, - "extensions": ["md","markdown"] + "extensions": ["markdown","md"] }, "text/mathml": { "source": "nginx", @@ -8618,9 +7830,6 @@ "text/prs.prop.logic": { "source": "iana" }, - "text/prs.texi": { - "source": "iana" - }, "text/raptorfec": { "source": "iana" }, @@ -8743,9 +7952,6 @@ "source": "iana", "charset": "UTF-8" }, - "text/vnd.exchangeable": { - "source": "iana" - }, "text/vnd.familysearch.gedcom": { "source": "iana", "extensions": ["ged"] @@ -8807,7 +8013,7 @@ "source": "iana" }, "text/vnd.si.uricatalogue": { - "source": "apache" + "source": "iana" }, "text/vnd.sosi": { "source": "iana" @@ -8821,9 +8027,6 @@ "source": "iana", "charset": "UTF-8" }, - "text/vnd.vcf": { - "source": "iana" - }, "text/vnd.wap.si": { "source": "iana" }, @@ -8838,19 +8041,12 @@ "source": "iana", "extensions": ["wmls"] }, - "text/vnd.zoo.kcl": { - "source": "iana" - }, "text/vtt": { "source": "iana", "charset": "UTF-8", "compressible": true, "extensions": ["vtt"] }, - "text/wgsl": { - "source": "iana", - "extensions": ["wgsl"] - }, "text/x-asm": { "source": "apache", "extensions": ["s","asm"] @@ -8981,9 +8177,6 @@ "video/encaprtp": { "source": "iana" }, - "video/evc": { - "source": "iana" - }, "video/ffv1": { "source": "iana" }, @@ -9017,9 +8210,6 @@ "video/h265": { "source": "iana" }, - "video/h266": { - "source": "iana" - }, "video/iso.segment": { "source": "iana", "extensions": ["m4s"] @@ -9038,16 +8228,6 @@ "video/jxsv": { "source": "iana" }, - "video/lottie+json": { - "source": "iana", - "compressible": true - }, - "video/matroska": { - "source": "iana" - }, - "video/matroska-3d": { - "source": "iana" - }, "video/mj2": { "source": "iana", "extensions": ["mj2","mjp2"] @@ -9060,7 +8240,7 @@ }, "video/mp2t": { "source": "iana", - "extensions": ["ts","m2t","m2ts","mts"] + "extensions": ["ts"] }, "video/mp4": { "source": "iana", @@ -9223,14 +8403,11 @@ "video/vnd.objectvideo": { "source": "iana" }, - "video/vnd.planar": { - "source": "iana" - }, "video/vnd.radgamettools.bink": { "source": "iana" }, "video/vnd.radgamettools.smacker": { - "source": "apache" + "source": "iana" }, "video/vnd.sealed.mpeg1": { "source": "iana" diff --git a/api/node_modules/mime-db/package.json b/api/node_modules/mime-db/package.json index 289a370..32c14b8 100644 --- a/api/node_modules/mime-db/package.json +++ b/api/node_modules/mime-db/package.json @@ -1,7 +1,7 @@ { "name": "mime-db", "description": "Media Type Database", - "version": "1.54.0", + "version": "1.52.0", "contributors": [ "Douglas Christopher Wilson ", "Jonathan Ong (http://jongleberry.com)", @@ -19,19 +19,23 @@ ], "repository": "jshttp/mime-db", "devDependencies": { + "bluebird": "3.7.2", + "co": "4.6.0", + "cogent": "1.0.1", "csv-parse": "4.16.3", - "eslint": "8.32.0", + "eslint": "7.32.0", "eslint-config-standard": "15.0.1", - "eslint-plugin-import": "2.27.5", - "eslint-plugin-markdown": "3.0.0", + "eslint-plugin-import": "2.25.4", + "eslint-plugin-markdown": "2.2.1", "eslint-plugin-node": "11.1.0", - "eslint-plugin-promise": "6.1.1", + "eslint-plugin-promise": "5.1.1", "eslint-plugin-standard": "4.1.0", + "gnode": "0.1.2", "media-typer": "1.1.0", - "mocha": "10.2.0", + "mocha": "9.2.1", "nyc": "15.1.0", - "stream-to-array": "2.3.0", - "undici": "7.1.0" + "raw-body": "2.5.0", + "stream-to-array": "2.3.0" }, "files": [ "HISTORY.md", @@ -45,10 +49,10 @@ }, "scripts": { "build": "node scripts/build", - "fetch": "node scripts/fetch-apache && node scripts/fetch-iana && node scripts/fetch-nginx", + "fetch": "node scripts/fetch-apache && gnode scripts/fetch-iana && node scripts/fetch-nginx", "lint": "eslint .", - "test": "mocha --reporter spec --check-leaks test/", - "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", "test-cov": "nyc --reporter=html --reporter=text npm test", "update": "npm run fetch && npm run build", "version": "node scripts/version-history.js && git add HISTORY.md" diff --git a/api/node_modules/mime-types/HISTORY.md b/api/node_modules/mime-types/HISTORY.md index 18473e4..c5043b7 100644 --- a/api/node_modules/mime-types/HISTORY.md +++ b/api/node_modules/mime-types/HISTORY.md @@ -1,27 +1,3 @@ -3.0.1 / 2025-03-26 -=================== - -* deps: mime-db@1.54.0 - -3.0.0 / 2024-08-31 -=================== - -* Drop support for node <18 -* deps: mime-db@1.53.0 -* resolve extension conflicts with mime-score (#119) - * asc -> application/pgp-signature is now application/pgp-keys - * mpp -> application/vnd.ms-project is now application/dash-patch+xml - * ac -> application/vnd.nokia.n-gage.ac+xml is now application/pkix-attr-cert - * bdoc -> application/x-bdoc is now application/bdoc - * wmz -> application/x-msmetafile is now application/x-ms-wmz - * xsl -> application/xslt+xml is now application/xml - * wav -> audio/wave is now audio/wav - * rtf -> text/rtf is now application/rtf - * xml -> text/xml is now application/xml - * mp4 -> video/mp4 is now application/mp4 - * mpg4 -> video/mp4 is now application/mp4 - - 2.1.35 / 2022-03-12 =================== diff --git a/api/node_modules/mime-types/README.md b/api/node_modules/mime-types/README.md index 222d2b5..48d2fb4 100644 --- a/api/node_modules/mime-types/README.md +++ b/api/node_modules/mime-types/README.md @@ -29,19 +29,6 @@ This is a [Node.js](https://nodejs.org/en/) module available through the $ npm install mime-types ``` -## Note on MIME Type Data and Semver - -This package considers the programmatic api as the semver compatibility. Additionally, the package which provides the MIME data -for this package (`mime-db`) *also* considers it's programmatic api as the semver contract. This means the MIME type resolution is *not* considered -in the semver bumps. - -In the past the version of `mime-db` was pinned to give two decision points when adopting MIME data changes. This is no longer true. We still update the -`mime-db` package here as a `minor` release when necessary, but will use a `^` range going forward. This means that if you want to pin your `mime-db` data -you will need to do it in your application. While this expectation was not set in docs until now, it is how the pacakge operated, so we do not feel this is -a breaking change. - -If you wish to pin your `mime-db` version you can do that with overrides via your package manager of choice. See their documentation for how to correctly configure that. - ## Adding Types All mime types are based on [mime-db](https://www.npmjs.com/package/mime-db), diff --git a/api/node_modules/mime-types/index.js b/api/node_modules/mime-types/index.js index c348cb6..b9f34d5 100644 --- a/api/node_modules/mime-types/index.js +++ b/api/node_modules/mime-types/index.js @@ -14,7 +14,6 @@ var db = require('mime-db') var extname = require('path').extname -var mimeScore = require('./mimeScore') /** * Module variables. @@ -36,7 +35,6 @@ exports.extension = extension exports.extensions = Object.create(null) exports.lookup = lookup exports.types = Object.create(null) -exports._extensionConflicts = [] // Populate the extensions/types maps populateMaps(exports.extensions, exports.types) @@ -82,7 +80,9 @@ function contentType (str) { return false } - var mime = str.indexOf('/') === -1 ? exports.lookup(str) : str + var mime = str.indexOf('/') === -1 + ? exports.lookup(str) + : str if (!mime) { return false @@ -137,7 +137,7 @@ function lookup (path) { // get the extension ("ext" or ".ext" or full path) var extension = extname('x.' + path) .toLowerCase() - .slice(1) + .substr(1) if (!extension) { return false @@ -152,6 +152,9 @@ function lookup (path) { */ function populateMaps (extensions, types) { + // source preference (least -> most) + var preference = ['nginx', 'apache', undefined, 'iana'] + Object.keys(db).forEach(function forEachMimeType (type) { var mime = db[type] var exts = mime.extensions @@ -166,46 +169,20 @@ function populateMaps (extensions, types) { // extension -> mime for (var i = 0; i < exts.length; i++) { var extension = exts[i] - types[extension] = _preferredType(extension, types[extension], type) - // DELETE (eventually): Capture extension->type maps that change as a - // result of switching to mime-score. This is just to help make reviewing - // PR #119 easier, and can be removed once that PR is approved. - const legacyType = _preferredTypeLegacy( - extension, - types[extension], - type - ) - if (legacyType !== types[extension]) { - exports._extensionConflicts.push([extension, legacyType, types[extension]]) + if (types[extension]) { + var from = preference.indexOf(db[types[extension]].source) + var to = preference.indexOf(mime.source) + + if (types[extension] !== 'application/octet-stream' && + (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) { + // skip the remapping + continue + } } + + // set the extension -> mime + types[extension] = type } }) } - -// Resolve type conflict using mime-score -function _preferredType (ext, type0, type1) { - var score0 = type0 ? mimeScore(type0, db[type0].source) : 0 - var score1 = type1 ? mimeScore(type1, db[type1].source) : 0 - - return score0 > score1 ? type0 : type1 -} - -// Resolve type conflict using pre-mime-score logic -function _preferredTypeLegacy (ext, type0, type1) { - var SOURCE_RANK = ['nginx', 'apache', undefined, 'iana'] - - var score0 = type0 ? SOURCE_RANK.indexOf(db[type0].source) : 0 - var score1 = type1 ? SOURCE_RANK.indexOf(db[type1].source) : 0 - - if ( - exports.types[extension] !== 'application/octet-stream' && - (score0 > score1 || - (score0 === score1 && - exports.types[extension]?.slice(0, 12) === 'application/')) - ) { - return type0 - } - - return score0 > score1 ? type0 : type1 -} diff --git a/api/node_modules/mime-types/mimeScore.js b/api/node_modules/mime-types/mimeScore.js deleted file mode 100644 index e2ecc66..0000000 --- a/api/node_modules/mime-types/mimeScore.js +++ /dev/null @@ -1,52 +0,0 @@ -// 'mime-score' back-ported to CommonJS - -// Score RFC facets (see https://tools.ietf.org/html/rfc6838#section-3) -var FACET_SCORES = { - 'prs.': 100, - 'x-': 200, - 'x.': 300, - 'vnd.': 400, - default: 900 -} - -// Score mime source (Logic originally from `jshttp/mime-types` module) -var SOURCE_SCORES = { - nginx: 10, - apache: 20, - iana: 40, - default: 30 // definitions added by `jshttp/mime-db` project? -} - -var TYPE_SCORES = { - // prefer application/xml over text/xml - // prefer application/rtf over text/rtf - application: 1, - - // prefer font/woff over application/font-woff - font: 2, - - default: 0 -} - -/** - * Get each component of the score for a mime type. The sum of these is the - * total score. The higher the score, the more "official" the type. - */ -module.exports = function mimeScore (mimeType, source = 'default') { - if (mimeType === 'application/octet-stream') { - return 0 - } - - const [type, subtype] = mimeType.split('/') - - const facet = subtype.replace(/(\.|x-).*/, '$1') - - const facetScore = FACET_SCORES[facet] || FACET_SCORES.default - const sourceScore = SOURCE_SCORES[source] || SOURCE_SCORES.default - const typeScore = TYPE_SCORES[type] || TYPE_SCORES.default - - // All else being equal prefer shorter types - const lengthScore = 1 - mimeType.length / 100 - - return facetScore + sourceScore + typeScore + lengthScore -} diff --git a/api/node_modules/mime-types/package.json b/api/node_modules/mime-types/package.json index 79481ae..bbef696 100644 --- a/api/node_modules/mime-types/package.json +++ b/api/node_modules/mime-types/package.json @@ -1,7 +1,7 @@ { "name": "mime-types", "description": "The ultimate javascript content-type utility.", - "version": "3.0.1", + "version": "2.1.35", "contributors": [ "Douglas Christopher Wilson ", "Jeremiah Senkpiel (https://searchbeam.jit.su)", @@ -14,24 +14,23 @@ ], "repository": "jshttp/mime-types", "dependencies": { - "mime-db": "^1.54.0" + "mime-db": "1.52.0" }, "devDependencies": { - "eslint": "8.33.0", + "eslint": "7.32.0", "eslint-config-standard": "14.1.1", - "eslint-plugin-import": "2.27.5", - "eslint-plugin-markdown": "3.0.0", + "eslint-plugin-import": "2.25.4", + "eslint-plugin-markdown": "2.2.1", "eslint-plugin-node": "11.1.0", - "eslint-plugin-promise": "6.1.1", + "eslint-plugin-promise": "5.2.0", "eslint-plugin-standard": "4.1.0", - "mocha": "10.2.0", + "mocha": "9.2.2", "nyc": "15.1.0" }, "files": [ "HISTORY.md", "LICENSE", - "index.js", - "mimeScore.js" + "index.js" ], "engines": { "node": ">= 0.6" diff --git a/api/node_modules/ms/index.js b/api/node_modules/ms/index.js index ea734fb..6a522b1 100644 --- a/api/node_modules/ms/index.js +++ b/api/node_modules/ms/index.js @@ -6,7 +6,6 @@ var s = 1000; var m = s * 60; var h = m * 60; var d = h * 24; -var w = d * 7; var y = d * 365.25; /** @@ -23,12 +22,12 @@ var y = d * 365.25; * @api public */ -module.exports = function (val, options) { +module.exports = function(val, options) { options = options || {}; var type = typeof val; if (type === 'string' && val.length > 0) { return parse(val); - } else if (type === 'number' && isFinite(val)) { + } else if (type === 'number' && isNaN(val) === false) { return options.long ? fmtLong(val) : fmtShort(val); } throw new Error( @@ -50,7 +49,7 @@ function parse(str) { if (str.length > 100) { return; } - var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( str ); if (!match) { @@ -65,10 +64,6 @@ function parse(str) { case 'yr': case 'y': return n * y; - case 'weeks': - case 'week': - case 'w': - return n * w; case 'days': case 'day': case 'd': @@ -111,17 +106,16 @@ function parse(str) { */ function fmtShort(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { + if (ms >= d) { return Math.round(ms / d) + 'd'; } - if (msAbs >= h) { + if (ms >= h) { return Math.round(ms / h) + 'h'; } - if (msAbs >= m) { + if (ms >= m) { return Math.round(ms / m) + 'm'; } - if (msAbs >= s) { + if (ms >= s) { return Math.round(ms / s) + 's'; } return ms + 'ms'; @@ -136,27 +130,23 @@ function fmtShort(ms) { */ function fmtLong(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return plural(ms, msAbs, d, 'day'); - } - if (msAbs >= h) { - return plural(ms, msAbs, h, 'hour'); - } - if (msAbs >= m) { - return plural(ms, msAbs, m, 'minute'); - } - if (msAbs >= s) { - return plural(ms, msAbs, s, 'second'); - } - return ms + ' ms'; + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; } /** * Pluralization helper. */ -function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name; + } + return Math.ceil(ms / n) + ' ' + name + 's'; } diff --git a/api/node_modules/ms/license.md b/api/node_modules/ms/license.md index fa5d39b..69b6125 100644 --- a/api/node_modules/ms/license.md +++ b/api/node_modules/ms/license.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2020 Vercel, Inc. +Copyright (c) 2016 Zeit, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/api/node_modules/ms/package.json b/api/node_modules/ms/package.json index 4997189..6a31c81 100644 --- a/api/node_modules/ms/package.json +++ b/api/node_modules/ms/package.json @@ -1,8 +1,8 @@ { "name": "ms", - "version": "2.1.3", - "description": "Tiny millisecond conversion utility", - "repository": "vercel/ms", + "version": "2.0.0", + "description": "Tiny milisecond conversion utility", + "repository": "zeit/ms", "main": "./index", "files": [ "index.js" @@ -28,11 +28,10 @@ }, "license": "MIT", "devDependencies": { - "eslint": "4.18.2", + "eslint": "3.19.0", "expect.js": "0.3.1", - "husky": "0.14.3", - "lint-staged": "5.0.0", - "mocha": "4.0.1", - "prettier": "2.0.5" + "husky": "0.13.3", + "lint-staged": "3.4.1", + "mocha": "3.4.1" } } diff --git a/api/node_modules/ms/readme.md b/api/node_modules/ms/readme.md index 0fc1abb..84a9974 100644 --- a/api/node_modules/ms/readme.md +++ b/api/node_modules/ms/readme.md @@ -1,6 +1,7 @@ # ms -![CI](https://github.com/vercel/ms/workflows/CI/badge.svg) +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Slack Channel](http://zeit-slackin.now.sh/badge.svg)](https://zeit.chat/) Use this package to easily convert various time formats to milliseconds. @@ -16,44 +17,35 @@ ms('1m') // 60000 ms('5s') // 5000 ms('1y') // 31557600000 ms('100') // 100 -ms('-3 days') // -259200000 -ms('-1h') // -3600000 -ms('-200') // -200 ``` -### Convert from Milliseconds +### Convert from milliseconds ```js ms(60000) // "1m" ms(2 * 60000) // "2m" -ms(-3 * 60000) // "-3m" ms(ms('10 hours')) // "10h" ``` -### Time Format Written-Out +### Time format written-out ```js ms(60000, { long: true }) // "1 minute" ms(2 * 60000, { long: true }) // "2 minutes" -ms(-3 * 60000, { long: true }) // "-3 minutes" ms(ms('10 hours'), { long: true }) // "10 hours" ``` ## Features -- Works both in [Node.js](https://nodejs.org) and in the browser -- If a number is supplied to `ms`, a string with a unit is returned -- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) -- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned +- Works both in [node](https://nodejs.org) and in the browser. +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of equivalent ms is returned. -## Related Packages - -- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. - -## Caught a Bug? +## Caught a bug? 1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device 2. Link the package to the global module directory: `npm link` -3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms! As always, you can run the tests using: `npm test` diff --git a/api/node_modules/negotiator/HISTORY.md b/api/node_modules/negotiator/HISTORY.md index 63d537d..a9a5449 100644 --- a/api/node_modules/negotiator/HISTORY.md +++ b/api/node_modules/negotiator/HISTORY.md @@ -1,9 +1,3 @@ -1.0.0 / 2024-08-31 -================== - - * Drop support for node <18 - * Added an option preferred encodings array #59 - 0.6.3 / 2022-01-22 ================== diff --git a/api/node_modules/negotiator/README.md b/api/node_modules/negotiator/README.md index 6fb7f2d..82915e5 100644 --- a/api/node_modules/negotiator/README.md +++ b/api/node_modules/negotiator/README.md @@ -172,10 +172,6 @@ Returns the most preferred encoding from the client. Returns the most preferred encoding from a list of available encodings. -##### encoding(availableEncodings, { preferred }) - -Returns the most preferred encoding from a list of available encodings, while prioritizing based on `preferred` array between same-quality encodings. - ##### encodings() Returns an array of preferred encodings ordered by the client preference. @@ -185,11 +181,6 @@ Returns an array of preferred encodings ordered by the client preference. Returns an array of preferred encodings ordered by priority from a list of available encodings. -##### encodings(availableEncodings, { preferred }) - -Returns an array of preferred encodings ordered by priority from a list of -available encodings, while prioritizing based on `preferred` array between same-quality encodings. - ## See Also The [accepts](https://npmjs.org/package/accepts#readme) module builds on diff --git a/api/node_modules/negotiator/index.js b/api/node_modules/negotiator/index.js index 4f51315..4788264 100644 --- a/api/node_modules/negotiator/index.js +++ b/api/node_modules/negotiator/index.js @@ -44,14 +44,13 @@ Negotiator.prototype.charsets = function charsets(available) { return preferredCharsets(this.request.headers['accept-charset'], available); }; -Negotiator.prototype.encoding = function encoding(available, opts) { - var set = this.encodings(available, opts); +Negotiator.prototype.encoding = function encoding(available) { + var set = this.encodings(available); return set && set[0]; }; -Negotiator.prototype.encodings = function encodings(available, options) { - var opts = options || {}; - return preferredEncodings(this.request.headers['accept-encoding'], available, opts.preferred); +Negotiator.prototype.encodings = function encodings(available) { + return preferredEncodings(this.request.headers['accept-encoding'], available); }; Negotiator.prototype.language = function language(available) { diff --git a/api/node_modules/negotiator/lib/encoding.js b/api/node_modules/negotiator/lib/encoding.js index 9ebb633..8432cd7 100644 --- a/api/node_modules/negotiator/lib/encoding.js +++ b/api/node_modules/negotiator/lib/encoding.js @@ -96,7 +96,7 @@ function parseEncoding(str, i) { */ function getEncodingPriority(encoding, accepted, index) { - var priority = {encoding: encoding, o: -1, q: 0, s: 0}; + var priority = {o: -1, q: 0, s: 0}; for (var i = 0; i < accepted.length; i++) { var spec = specify(encoding, accepted[i], index); @@ -123,7 +123,6 @@ function specify(encoding, spec, index) { } return { - encoding: encoding, i: index, o: spec.i, q: spec.q, @@ -136,34 +135,14 @@ function specify(encoding, spec, index) { * @public */ -function preferredEncodings(accept, provided, preferred) { +function preferredEncodings(accept, provided) { var accepts = parseAcceptEncoding(accept || ''); - var comparator = preferred ? function comparator (a, b) { - if (a.q !== b.q) { - return b.q - a.q // higher quality first - } - - var aPreferred = preferred.indexOf(a.encoding) - var bPreferred = preferred.indexOf(b.encoding) - - if (aPreferred === -1 && bPreferred === -1) { - // consider the original specifity/order - return (b.s - a.s) || (a.o - b.o) || (a.i - b.i) - } - - if (aPreferred !== -1 && bPreferred !== -1) { - return aPreferred - bPreferred // consider the preferred order - } - - return aPreferred === -1 ? 1 : -1 // preferred first - } : compareSpecs; - if (!provided) { // sorted list of all encodings return accepts .filter(isQuality) - .sort(comparator) + .sort(compareSpecs) .map(getFullEncoding); } @@ -172,7 +151,7 @@ function preferredEncodings(accept, provided, preferred) { }); // sorted list of accepted encodings - return priorities.filter(isQuality).sort(comparator).map(function getEncoding(priority) { + return priorities.filter(isQuality).sort(compareSpecs).map(function getEncoding(priority) { return provided[priorities.indexOf(priority)]; }); } @@ -183,7 +162,7 @@ function preferredEncodings(accept, provided, preferred) { */ function compareSpecs(a, b) { - return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i); + return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0; } /** diff --git a/api/node_modules/negotiator/lib/mediaType.js b/api/node_modules/negotiator/lib/mediaType.js index 8e402ea..67309dd 100644 --- a/api/node_modules/negotiator/lib/mediaType.js +++ b/api/node_modules/negotiator/lib/mediaType.js @@ -69,7 +69,7 @@ function parseMediaType(str, i) { // get the value, unwrapping quotes var value = val && val[0] === '"' && val[val.length - 1] === '"' - ? val.slice(1, -1) + ? val.substr(1, val.length - 2) : val; if (key === 'q') { @@ -238,8 +238,8 @@ function splitKeyValuePair(str) { if (index === -1) { key = str; } else { - key = str.slice(0, index); - val = str.slice(index + 1); + key = str.substr(0, index); + val = str.substr(index + 1); } return [key, val]; diff --git a/api/node_modules/negotiator/package.json b/api/node_modules/negotiator/package.json index e4bdc1e..297635f 100644 --- a/api/node_modules/negotiator/package.json +++ b/api/node_modules/negotiator/package.json @@ -1,7 +1,7 @@ { "name": "negotiator", "description": "HTTP content negotiation", - "version": "1.0.0", + "version": "0.6.3", "contributors": [ "Douglas Christopher Wilson ", "Federico Romero ", @@ -36,7 +36,6 @@ "scripts": { "lint": "eslint .", "test": "mocha --reporter spec --check-leaks --bail test/", - "test:debug": "mocha --reporter spec --check-leaks --inspect --inspect-brk test/", "test-ci": "nyc --reporter=lcov --reporter=text npm test", "test-cov": "nyc --reporter=html --reporter=text npm test" } diff --git a/api/node_modules/once/LICENSE b/api/node_modules/once/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/api/node_modules/once/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/api/node_modules/once/README.md b/api/node_modules/once/README.md deleted file mode 100644 index 1f1ffca..0000000 --- a/api/node_modules/once/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# once - -Only call a function once. - -## usage - -```javascript -var once = require('once') - -function load (file, cb) { - cb = once(cb) - loader.load('file') - loader.once('load', cb) - loader.once('error', cb) -} -``` - -Or add to the Function.prototype in a responsible way: - -```javascript -// only has to be done once -require('once').proto() - -function load (file, cb) { - cb = cb.once() - loader.load('file') - loader.once('load', cb) - loader.once('error', cb) -} -``` - -Ironically, the prototype feature makes this module twice as -complicated as necessary. - -To check whether you function has been called, use `fn.called`. Once the -function is called for the first time the return value of the original -function is saved in `fn.value` and subsequent calls will continue to -return this value. - -```javascript -var once = require('once') - -function load (cb) { - cb = once(cb) - var stream = createStream() - stream.once('data', cb) - stream.once('end', function () { - if (!cb.called) cb(new Error('not found')) - }) -} -``` - -## `once.strict(func)` - -Throw an error if the function is called twice. - -Some functions are expected to be called only once. Using `once` for them would -potentially hide logical errors. - -In the example below, the `greet` function has to call the callback only once: - -```javascript -function greet (name, cb) { - // return is missing from the if statement - // when no name is passed, the callback is called twice - if (!name) cb('Hello anonymous') - cb('Hello ' + name) -} - -function log (msg) { - console.log(msg) -} - -// this will print 'Hello anonymous' but the logical error will be missed -greet(null, once(msg)) - -// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time -greet(null, once.strict(msg)) -``` diff --git a/api/node_modules/once/once.js b/api/node_modules/once/once.js deleted file mode 100644 index 2354067..0000000 --- a/api/node_modules/once/once.js +++ /dev/null @@ -1,42 +0,0 @@ -var wrappy = require('wrappy') -module.exports = wrappy(once) -module.exports.strict = wrappy(onceStrict) - -once.proto = once(function () { - Object.defineProperty(Function.prototype, 'once', { - value: function () { - return once(this) - }, - configurable: true - }) - - Object.defineProperty(Function.prototype, 'onceStrict', { - value: function () { - return onceStrict(this) - }, - configurable: true - }) -}) - -function once (fn) { - var f = function () { - if (f.called) return f.value - f.called = true - return f.value = fn.apply(this, arguments) - } - f.called = false - return f -} - -function onceStrict (fn) { - var f = function () { - if (f.called) - throw new Error(f.onceError) - f.called = true - return f.value = fn.apply(this, arguments) - } - var name = fn.name || 'Function wrapped with `once`' - f.onceError = name + " shouldn't be called more than once" - f.called = false - return f -} diff --git a/api/node_modules/once/package.json b/api/node_modules/once/package.json deleted file mode 100644 index 16815b2..0000000 --- a/api/node_modules/once/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "once", - "version": "1.4.0", - "description": "Run a function exactly one time", - "main": "once.js", - "directories": { - "test": "test" - }, - "dependencies": { - "wrappy": "1" - }, - "devDependencies": { - "tap": "^7.0.1" - }, - "scripts": { - "test": "tap test/*.js" - }, - "files": [ - "once.js" - ], - "repository": { - "type": "git", - "url": "git://github.com/isaacs/once" - }, - "keywords": [ - "once", - "function", - "one", - "single" - ], - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "ISC" -} diff --git a/api/node_modules/path-to-regexp/Readme.md b/api/node_modules/path-to-regexp/Readme.md index a0f9698..95452a6 100644 --- a/api/node_modules/path-to-regexp/Readme.md +++ b/api/node_modules/path-to-regexp/Readme.md @@ -1,216 +1,35 @@ # Path-to-RegExp -> Turn a path string such as `/user/:name` into a regular expression. +Turn an Express-style path string such as `/user/:name` into a regular expression. -[![NPM version][npm-image]][npm-url] -[![NPM downloads][downloads-image]][downloads-url] -[![Build status][build-image]][build-url] -[![Build coverage][coverage-image]][coverage-url] -[![License][license-image]][license-url] - -## Installation - -``` -npm install path-to-regexp --save -``` +**Note:** This is a legacy branch. You should upgrade to `1.x`. ## Usage -```js -const { - match, - pathToRegexp, - compile, - parse, - stringify, -} = require("path-to-regexp"); +```javascript +var pathToRegexp = require('path-to-regexp'); ``` -### Parameters +### pathToRegexp(path, keys, options) -Parameters match arbitrary strings in a path by matching up to the end of the segment, or up to any proceeding tokens. They are defined by prefixing a colon to the parameter name (`:foo`). Parameter names can use any valid JavaScript identifier, or be double quoted to use other characters (`:"param-name"`). + - **path** A string in the express format, an array of such strings, or a regular expression + - **keys** An array to be populated with the keys present in the url. Once the function completes, this will be an array of strings. + - **options** + - **options.sensitive** Defaults to false, set this to true to make routes case sensitive + - **options.strict** Defaults to false, set this to true to make the trailing slash matter. + - **options.end** Defaults to true, set this to false to only match the prefix of the URL. -```js -const fn = match("/:foo/:bar"); - -fn("/test/route"); -//=> { path: '/test/route', params: { foo: 'test', bar: 'route' } } +```javascript +var keys = []; +var exp = pathToRegexp('/foo/:bar', keys); +//keys = ['bar'] +//exp = /^\/foo\/(?:([^\/]+?))\/?$/i ``` -### Wildcard +## Live Demo -Wildcard parameters match one or more characters across multiple segments. They are defined the same way as regular parameters, but are prefixed with an asterisk (`*foo`). - -```js -const fn = match("/*splat"); - -fn("/bar/baz"); -//=> { path: '/bar/baz', params: { splat: [ 'bar', 'baz' ] } } -``` - -### Optional - -Braces can be used to define parts of the path that are optional. - -```js -const fn = match("/users{/:id}/delete"); - -fn("/users/delete"); -//=> { path: '/users/delete', params: {} } - -fn("/users/123/delete"); -//=> { path: '/users/123/delete', params: { id: '123' } } -``` - -## Match - -The `match` function returns a function for matching strings against a path: - -- **path** String or array of strings. -- **options** _(optional)_ (Extends [pathToRegexp](#pathToRegexp) options) - - **decode** Function for decoding strings to params, or `false` to disable all processing. (default: `decodeURIComponent`) - -```js -const fn = match("/foo/:bar"); -``` - -**Please note:** `path-to-regexp` is intended for ordered data (e.g. paths, hosts). It can not handle arbitrarily ordered data (e.g. query strings, URL fragments, JSON, etc). - -## PathToRegexp - -The `pathToRegexp` function returns a regular expression for matching strings against paths. It - -- **path** String or array of strings. -- **options** _(optional)_ (See [parse](#parse) for more options) - - **sensitive** Regexp will be case sensitive. (default: `false`) - - **end** Validate the match reaches the end of the string. (default: `true`) - - **delimiter** The default delimiter for segments, e.g. `[^/]` for `:named` parameters. (default: `'/'`) - - **trailing** Allows optional trailing delimiter to match. (default: `true`) - -```js -const { regexp, keys } = pathToRegexp("/foo/:bar"); -``` - -## Compile ("Reverse" Path-To-RegExp) - -The `compile` function will return a function for transforming parameters into a valid path: - -- **path** A string. -- **options** (See [parse](#parse) for more options) - - **delimiter** The default delimiter for segments, e.g. `[^/]` for `:named` parameters. (default: `'/'`) - - **encode** Function for encoding input strings for output into the path, or `false` to disable entirely. (default: `encodeURIComponent`) - -```js -const toPath = compile("/user/:id"); - -toPath({ id: "name" }); //=> "/user/name" -toPath({ id: "café" }); //=> "/user/caf%C3%A9" - -const toPathRepeated = compile("/*segment"); - -toPathRepeated({ segment: ["foo"] }); //=> "/foo" -toPathRepeated({ segment: ["a", "b", "c"] }); //=> "/a/b/c" - -// When disabling `encode`, you need to make sure inputs are encoded correctly. No arrays are accepted. -const toPathRaw = compile("/user/:id", { encode: false }); - -toPathRaw({ id: "%3A%2F" }); //=> "/user/%3A%2F" -``` - -## Stringify - -Transform `TokenData` (a sequence of tokens) back into a Path-to-RegExp string. - -- **data** A `TokenData` instance - -```js -const data = new TokenData([ - { type: "text", value: "/" }, - { type: "param", name: "foo" }, -]); - -const path = stringify(data); //=> "/:foo" -``` - -## Developers - -- If you are rewriting paths with match and compile, consider using `encode: false` and `decode: false` to keep raw paths passed around. -- To ensure matches work on paths containing characters usually encoded, such as emoji, consider using [encodeurl](https://github.com/pillarjs/encodeurl) for `encodePath`. - -### Parse - -The `parse` function accepts a string and returns `TokenData`, the set of tokens and other metadata parsed from the input string. `TokenData` is can used with `match` and `compile`. - -- **path** A string. -- **options** _(optional)_ - - **encodePath** A function for encoding input strings. (default: `x => x`, recommended: [`encodeurl`](https://github.com/pillarjs/encodeurl)) - -### Tokens - -`TokenData` is a sequence of tokens, currently of types `text`, `parameter`, `wildcard`, or `group`. - -### Custom path - -In some applications, you may not be able to use the `path-to-regexp` syntax, but still want to use this library for `match` and `compile`. For example: - -```js -import { TokenData, match } from "path-to-regexp"; - -const tokens = [ - { type: "text", value: "/" }, - { type: "parameter", name: "foo" }, -]; -const path = new TokenData(tokens); -const fn = match(path); - -fn("/test"); //=> { path: '/test', index: 0, params: { foo: 'test' } } -``` - -## Errors - -An effort has been made to ensure ambiguous paths from previous releases throw an error. This means you might be seeing an error when things worked before. - -### Unexpected `?` or `+` - -In past releases, `?`, `*`, and `+` were used to denote optional or repeating parameters. As an alternative, try these: - -- For optional (`?`), use an empty segment in a group such as `/:file{.:ext}`. -- For repeating (`+`), only wildcard matching is supported, such as `/*path`. -- For optional repeating (`*`), use a group and a wildcard parameter such as `/files{/*path}`. - -### Unexpected `(`, `)`, `[`, `]`, etc. - -Previous versions of Path-to-RegExp used these for RegExp features. This version no longer supports them so they've been reserved to avoid ambiguity. To use these characters literally, escape them with a backslash, e.g. `"\\("`. - -### Missing parameter name - -Parameter names must be provided after `:` or `*`, and they must be a valid JavaScript identifier. If you want an parameter name that isn't a JavaScript identifier, such as starting with a number, you can wrap the name in quotes like `:"my-name"`. - -### Unterminated quote - -Parameter names can be wrapped in double quote characters, and this error means you forgot to close the quote character. - -### Express <= 4.x - -Path-To-RegExp breaks compatibility with Express <= `4.x` in the following ways: - -- The wildcard `*` must have a name, matching the behavior of parameters `:`. -- The optional character `?` is no longer supported, use braces instead: `/:file{.:ext}`. -- Regexp characters are not supported. -- Some characters have been reserved to avoid confusion during upgrade (`()[]?+!`). -- Parameter names now support valid JavaScript identifiers, or quoted like `:"this"`. +You can see a live demo of this library in use at [express-route-tester](http://forbeslindesay.github.com/express-route-tester/). ## License -MIT - -[npm-image]: https://img.shields.io/npm/v/path-to-regexp -[npm-url]: https://npmjs.org/package/path-to-regexp -[downloads-image]: https://img.shields.io/npm/dm/path-to-regexp -[downloads-url]: https://npmjs.org/package/path-to-regexp -[build-image]: https://img.shields.io/github/actions/workflow/status/pillarjs/path-to-regexp/ci.yml?branch=master -[build-url]: https://github.com/pillarjs/path-to-regexp/actions/workflows/ci.yml?query=branch%3Amaster -[coverage-image]: https://img.shields.io/codecov/c/gh/pillarjs/path-to-regexp -[coverage-url]: https://codecov.io/gh/pillarjs/path-to-regexp -[license-image]: http://img.shields.io/npm/l/path-to-regexp.svg?style=flat -[license-url]: LICENSE.md + MIT diff --git a/api/node_modules/path-to-regexp/dist/index.d.ts b/api/node_modules/path-to-regexp/dist/index.d.ts deleted file mode 100644 index b0f3e93..0000000 --- a/api/node_modules/path-to-regexp/dist/index.d.ts +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Encode a string into another string. - */ -export type Encode = (value: string) => string; -/** - * Decode a string into another string. - */ -export type Decode = (value: string) => string; -export interface ParseOptions { - /** - * A function for encoding input strings. - */ - encodePath?: Encode; -} -export interface PathToRegexpOptions { - /** - * Matches the path completely without trailing characters. (default: `true`) - */ - end?: boolean; - /** - * Allows optional trailing delimiter to match. (default: `true`) - */ - trailing?: boolean; - /** - * Match will be case sensitive. (default: `false`) - */ - sensitive?: boolean; - /** - * The default delimiter for segments. (default: `'/'`) - */ - delimiter?: string; -} -export interface MatchOptions extends PathToRegexpOptions { - /** - * Function for decoding strings for params, or `false` to disable entirely. (default: `decodeURIComponent`) - */ - decode?: Decode | false; -} -export interface CompileOptions { - /** - * Function for encoding input strings for output into the path, or `false` to disable entirely. (default: `encodeURIComponent`) - */ - encode?: Encode | false; - /** - * The default delimiter for segments. (default: `'/'`) - */ - delimiter?: string; -} -/** - * Plain text. - */ -export interface Text { - type: "text"; - value: string; -} -/** - * A parameter designed to match arbitrary text within a segment. - */ -export interface Parameter { - type: "param"; - name: string; -} -/** - * A wildcard parameter designed to match multiple segments. - */ -export interface Wildcard { - type: "wildcard"; - name: string; -} -/** - * A set of possible tokens to expand when matching. - */ -export interface Group { - type: "group"; - tokens: Token[]; -} -/** - * A token that corresponds with a regexp capture. - */ -export type Key = Parameter | Wildcard; -/** - * A sequence of `path-to-regexp` keys that match capturing groups. - */ -export type Keys = Array; -/** - * A sequence of path match characters. - */ -export type Token = Text | Parameter | Wildcard | Group; -/** - * Tokenized path instance. - */ -export declare class TokenData { - readonly tokens: Token[]; - constructor(tokens: Token[]); -} -/** - * Parse a string for the raw tokens. - */ -export declare function parse(str: string, options?: ParseOptions): TokenData; -/** - * Compile a string to a template function for the path. - */ -export declare function compile

(path: Path, options?: CompileOptions & ParseOptions): (data?: P) => string; -export type ParamData = Partial>; -export type PathFunction

= (data?: P) => string; -/** - * A match result contains data about the path match. - */ -export interface MatchResult

{ - path: string; - params: P; -} -/** - * A match is either `false` (no match) or a match result. - */ -export type Match

= false | MatchResult

; -/** - * The match function takes a string and returns whether it matched the path. - */ -export type MatchFunction

= (path: string) => Match

; -/** - * Supported path types. - */ -export type Path = string | TokenData; -/** - * Transform a path into a match function. - */ -export declare function match

(path: Path | Path[], options?: MatchOptions & ParseOptions): MatchFunction

; -export declare function pathToRegexp(path: Path | Path[], options?: PathToRegexpOptions & ParseOptions): { - regexp: RegExp; - keys: Keys; -}; -/** - * Stringify token data into a path string. - */ -export declare function stringify(data: TokenData): string; diff --git a/api/node_modules/path-to-regexp/dist/index.js b/api/node_modules/path-to-regexp/dist/index.js deleted file mode 100644 index 49694bd..0000000 --- a/api/node_modules/path-to-regexp/dist/index.js +++ /dev/null @@ -1,403 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TokenData = void 0; -exports.parse = parse; -exports.compile = compile; -exports.match = match; -exports.pathToRegexp = pathToRegexp; -exports.stringify = stringify; -const DEFAULT_DELIMITER = "/"; -const NOOP_VALUE = (value) => value; -const ID_START = /^[$_\p{ID_Start}]$/u; -const ID_CONTINUE = /^[$\u200c\u200d\p{ID_Continue}]$/u; -const DEBUG_URL = "https://git.new/pathToRegexpError"; -const SIMPLE_TOKENS = { - // Groups. - "{": "{", - "}": "}", - // Reserved. - "(": "(", - ")": ")", - "[": "[", - "]": "]", - "+": "+", - "?": "?", - "!": "!", -}; -/** - * Escape text for stringify to path. - */ -function escapeText(str) { - return str.replace(/[{}()\[\]+?!:*]/g, "\\$&"); -} -/** - * Escape a regular expression string. - */ -function escape(str) { - return str.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&"); -} -/** - * Tokenize input string. - */ -function* lexer(str) { - const chars = [...str]; - let i = 0; - function name() { - let value = ""; - if (ID_START.test(chars[++i])) { - value += chars[i]; - while (ID_CONTINUE.test(chars[++i])) { - value += chars[i]; - } - } - else if (chars[i] === '"') { - let pos = i; - while (i < chars.length) { - if (chars[++i] === '"') { - i++; - pos = 0; - break; - } - if (chars[i] === "\\") { - value += chars[++i]; - } - else { - value += chars[i]; - } - } - if (pos) { - throw new TypeError(`Unterminated quote at ${pos}: ${DEBUG_URL}`); - } - } - if (!value) { - throw new TypeError(`Missing parameter name at ${i}: ${DEBUG_URL}`); - } - return value; - } - while (i < chars.length) { - const value = chars[i]; - const type = SIMPLE_TOKENS[value]; - if (type) { - yield { type, index: i++, value }; - } - else if (value === "\\") { - yield { type: "ESCAPED", index: i++, value: chars[i++] }; - } - else if (value === ":") { - const value = name(); - yield { type: "PARAM", index: i, value }; - } - else if (value === "*") { - const value = name(); - yield { type: "WILDCARD", index: i, value }; - } - else { - yield { type: "CHAR", index: i, value: chars[i++] }; - } - } - return { type: "END", index: i, value: "" }; -} -class Iter { - constructor(tokens) { - this.tokens = tokens; - } - peek() { - if (!this._peek) { - const next = this.tokens.next(); - this._peek = next.value; - } - return this._peek; - } - tryConsume(type) { - const token = this.peek(); - if (token.type !== type) - return; - this._peek = undefined; // Reset after consumed. - return token.value; - } - consume(type) { - const value = this.tryConsume(type); - if (value !== undefined) - return value; - const { type: nextType, index } = this.peek(); - throw new TypeError(`Unexpected ${nextType} at ${index}, expected ${type}: ${DEBUG_URL}`); - } - text() { - let result = ""; - let value; - while ((value = this.tryConsume("CHAR") || this.tryConsume("ESCAPED"))) { - result += value; - } - return result; - } -} -/** - * Tokenized path instance. - */ -class TokenData { - constructor(tokens) { - this.tokens = tokens; - } -} -exports.TokenData = TokenData; -/** - * Parse a string for the raw tokens. - */ -function parse(str, options = {}) { - const { encodePath = NOOP_VALUE } = options; - const it = new Iter(lexer(str)); - function consume(endType) { - const tokens = []; - while (true) { - const path = it.text(); - if (path) - tokens.push({ type: "text", value: encodePath(path) }); - const param = it.tryConsume("PARAM"); - if (param) { - tokens.push({ - type: "param", - name: param, - }); - continue; - } - const wildcard = it.tryConsume("WILDCARD"); - if (wildcard) { - tokens.push({ - type: "wildcard", - name: wildcard, - }); - continue; - } - const open = it.tryConsume("{"); - if (open) { - tokens.push({ - type: "group", - tokens: consume("}"), - }); - continue; - } - it.consume(endType); - return tokens; - } - } - const tokens = consume("END"); - return new TokenData(tokens); -} -/** - * Compile a string to a template function for the path. - */ -function compile(path, options = {}) { - const { encode = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options; - const data = path instanceof TokenData ? path : parse(path, options); - const fn = tokensToFunction(data.tokens, delimiter, encode); - return function path(data = {}) { - const [path, ...missing] = fn(data); - if (missing.length) { - throw new TypeError(`Missing parameters: ${missing.join(", ")}`); - } - return path; - }; -} -function tokensToFunction(tokens, delimiter, encode) { - const encoders = tokens.map((token) => tokenToFunction(token, delimiter, encode)); - return (data) => { - const result = [""]; - for (const encoder of encoders) { - const [value, ...extras] = encoder(data); - result[0] += value; - result.push(...extras); - } - return result; - }; -} -/** - * Convert a single token into a path building function. - */ -function tokenToFunction(token, delimiter, encode) { - if (token.type === "text") - return () => [token.value]; - if (token.type === "group") { - const fn = tokensToFunction(token.tokens, delimiter, encode); - return (data) => { - const [value, ...missing] = fn(data); - if (!missing.length) - return [value]; - return [""]; - }; - } - const encodeValue = encode || NOOP_VALUE; - if (token.type === "wildcard" && encode !== false) { - return (data) => { - const value = data[token.name]; - if (value == null) - return ["", token.name]; - if (!Array.isArray(value) || value.length === 0) { - throw new TypeError(`Expected "${token.name}" to be a non-empty array`); - } - return [ - value - .map((value, index) => { - if (typeof value !== "string") { - throw new TypeError(`Expected "${token.name}/${index}" to be a string`); - } - return encodeValue(value); - }) - .join(delimiter), - ]; - }; - } - return (data) => { - const value = data[token.name]; - if (value == null) - return ["", token.name]; - if (typeof value !== "string") { - throw new TypeError(`Expected "${token.name}" to be a string`); - } - return [encodeValue(value)]; - }; -} -/** - * Transform a path into a match function. - */ -function match(path, options = {}) { - const { decode = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options; - const { regexp, keys } = pathToRegexp(path, options); - const decoders = keys.map((key) => { - if (decode === false) - return NOOP_VALUE; - if (key.type === "param") - return decode; - return (value) => value.split(delimiter).map(decode); - }); - return function match(input) { - const m = regexp.exec(input); - if (!m) - return false; - const path = m[0]; - const params = Object.create(null); - for (let i = 1; i < m.length; i++) { - if (m[i] === undefined) - continue; - const key = keys[i - 1]; - const decoder = decoders[i - 1]; - params[key.name] = decoder(m[i]); - } - return { path, params }; - }; -} -function pathToRegexp(path, options = {}) { - const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true, } = options; - const keys = []; - const sources = []; - const flags = sensitive ? "" : "i"; - const paths = Array.isArray(path) ? path : [path]; - const items = paths.map((path) => path instanceof TokenData ? path : parse(path, options)); - for (const { tokens } of items) { - for (const seq of flatten(tokens, 0, [])) { - const regexp = sequenceToRegExp(seq, delimiter, keys); - sources.push(regexp); - } - } - let pattern = `^(?:${sources.join("|")})`; - if (trailing) - pattern += `(?:${escape(delimiter)}$)?`; - pattern += end ? "$" : `(?=${escape(delimiter)}|$)`; - const regexp = new RegExp(pattern, flags); - return { regexp, keys }; -} -/** - * Generate a flat list of sequence tokens from the given tokens. - */ -function* flatten(tokens, index, init) { - if (index === tokens.length) { - return yield init; - } - const token = tokens[index]; - if (token.type === "group") { - const fork = init.slice(); - for (const seq of flatten(token.tokens, 0, fork)) { - yield* flatten(tokens, index + 1, seq); - } - } - else { - init.push(token); - } - yield* flatten(tokens, index + 1, init); -} -/** - * Transform a flat sequence of tokens into a regular expression. - */ -function sequenceToRegExp(tokens, delimiter, keys) { - let result = ""; - let backtrack = ""; - let isSafeSegmentParam = true; - for (let i = 0; i < tokens.length; i++) { - const token = tokens[i]; - if (token.type === "text") { - result += escape(token.value); - backtrack += token.value; - isSafeSegmentParam || (isSafeSegmentParam = token.value.includes(delimiter)); - continue; - } - if (token.type === "param" || token.type === "wildcard") { - if (!isSafeSegmentParam && !backtrack) { - throw new TypeError(`Missing text after "${token.name}": ${DEBUG_URL}`); - } - if (token.type === "param") { - result += `(${negate(delimiter, isSafeSegmentParam ? "" : backtrack)}+)`; - } - else { - result += `([\\s\\S]+)`; - } - keys.push(token); - backtrack = ""; - isSafeSegmentParam = false; - continue; - } - } - return result; -} -function negate(delimiter, backtrack) { - if (backtrack.length < 2) { - if (delimiter.length < 2) - return `[^${escape(delimiter + backtrack)}]`; - return `(?:(?!${escape(delimiter)})[^${escape(backtrack)}])`; - } - if (delimiter.length < 2) { - return `(?:(?!${escape(backtrack)})[^${escape(delimiter)}])`; - } - return `(?:(?!${escape(backtrack)}|${escape(delimiter)})[\\s\\S])`; -} -/** - * Stringify token data into a path string. - */ -function stringify(data) { - return data.tokens - .map(function stringifyToken(token, index, tokens) { - if (token.type === "text") - return escapeText(token.value); - if (token.type === "group") { - return `{${token.tokens.map(stringifyToken).join("")}}`; - } - const isSafe = isNameSafe(token.name) && isNextNameSafe(tokens[index + 1]); - const key = isSafe ? token.name : JSON.stringify(token.name); - if (token.type === "param") - return `:${key}`; - if (token.type === "wildcard") - return `*${key}`; - throw new TypeError(`Unexpected token: ${token}`); - }) - .join(""); -} -function isNameSafe(name) { - const [first, ...rest] = name; - if (!ID_START.test(first)) - return false; - return rest.every((char) => ID_CONTINUE.test(char)); -} -function isNextNameSafe(token) { - if ((token === null || token === void 0 ? void 0 : token.type) !== "text") - return true; - return !ID_CONTINUE.test(token.value[0]); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/api/node_modules/path-to-regexp/dist/index.js.map b/api/node_modules/path-to-regexp/dist/index.js.map deleted file mode 100644 index d5054f9..0000000 --- a/api/node_modules/path-to-regexp/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAoRA,sBA6CC;AAKD,0BAgBC;AAgHD,sBA+BC;AAED,oCA+BC;AAsFD,8BAiBC;AA7mBD,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC;AAC5C,MAAM,QAAQ,GAAG,qBAAqB,CAAC;AACvC,MAAM,WAAW,GAAG,mCAAmC,CAAC;AACxD,MAAM,SAAS,GAAG,mCAAmC,CAAC;AAkFtD,MAAM,aAAa,GAA8B;IAC/C,UAAU;IACV,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,YAAY;IACZ,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;CACT,CAAC;AAEF;;GAEG;AACH,SAAS,UAAU,CAAC,GAAW;IAC7B,OAAO,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC;AAED;;GAEG;AACH,SAAS,MAAM,CAAC,GAAW;IACzB,OAAO,GAAG,CAAC,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAW;IACzB,MAAM,KAAK,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;IACvB,IAAI,CAAC,GAAG,CAAC,CAAC;IAEV,SAAS,IAAI;QACX,IAAI,KAAK,GAAG,EAAE,CAAC;QAEf,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9B,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;YAClB,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAC5B,IAAI,GAAG,GAAG,CAAC,CAAC;YAEZ,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;gBACxB,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;oBACvB,CAAC,EAAE,CAAC;oBACJ,GAAG,GAAG,CAAC,CAAC;oBACR,MAAM;gBACR,CAAC;gBAED,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;oBACtB,KAAK,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;gBACtB,CAAC;qBAAM,CAAC;oBACN,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;gBACpB,CAAC;YACH,CAAC;YAED,IAAI,GAAG,EAAE,CAAC;gBACR,MAAM,IAAI,SAAS,CAAC,yBAAyB,GAAG,KAAK,SAAS,EAAE,CAAC,CAAC;YACpE,CAAC;QACH,CAAC;QAED,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,SAAS,CAAC,6BAA6B,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC;QACtE,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACvB,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QAElC,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC;QACpC,CAAC;aAAM,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAC1B,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3D,CAAC;aAAM,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;YACzB,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC;YACrB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;QAC3C,CAAC;aAAM,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;YACzB,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC;YACrB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QACtD,CAAC;IACH,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAC9C,CAAC;AAED,MAAM,IAAI;IAGR,YAAoB,MAAqC;QAArC,WAAM,GAAN,MAAM,CAA+B;IAAG,CAAC;IAE7D,IAAI;QACF,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAChC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAC1B,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,UAAU,CAAC,IAAe;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC1B,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO;QAChC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,wBAAwB;QAChD,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IAED,OAAO,CAAC,IAAe;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QACtC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9C,MAAM,IAAI,SAAS,CACjB,cAAc,QAAQ,OAAO,KAAK,cAAc,IAAI,KAAK,SAAS,EAAE,CACrE,CAAC;IACJ,CAAC;IAED,IAAI;QACF,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAI,KAAyB,CAAC;QAC9B,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;YACvE,MAAM,IAAI,KAAK,CAAC;QAClB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAiDD;;GAEG;AACH,MAAa,SAAS;IACpB,YAA4B,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;IAAG,CAAC;CAChD;AAFD,8BAEC;AAED;;GAEG;AACH,SAAgB,KAAK,CAAC,GAAW,EAAE,UAAwB,EAAE;IAC3D,MAAM,EAAE,UAAU,GAAG,UAAU,EAAE,GAAG,OAAO,CAAC;IAC5C,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAEhC,SAAS,OAAO,CAAC,OAAkB;QACjC,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,OAAO,IAAI,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;YACvB,IAAI,IAAI;gBAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAEjE,MAAM,KAAK,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACrC,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,KAAK;iBACZ,CAAC,CAAC;gBACH,SAAS;YACX,CAAC;YAED,MAAM,QAAQ,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YAC3C,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,QAAQ;iBACf,CAAC,CAAC;gBACH,SAAS;YACX,CAAC;YAED,MAAM,IAAI,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YAChC,IAAI,IAAI,EAAE,CAAC;gBACT,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,OAAO;oBACb,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC;iBACrB,CAAC,CAAC;gBACH,SAAS;YACX,CAAC;YAED,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACpB,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,SAAgB,OAAO,CACrB,IAAU,EACV,UAAyC,EAAE;IAE3C,MAAM,EAAE,MAAM,GAAG,kBAAkB,EAAE,SAAS,GAAG,iBAAiB,EAAE,GAClE,OAAO,CAAC;IACV,MAAM,IAAI,GAAG,IAAI,YAAY,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACrE,MAAM,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAE5D,OAAO,SAAS,IAAI,CAAC,OAAU,EAAO;QACpC,MAAM,CAAC,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,SAAS,CAAC,uBAAuB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAKD,SAAS,gBAAgB,CACvB,MAAe,EACf,SAAiB,EACjB,MAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACpC,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAC1C,CAAC;IAEF,OAAO,CAAC,IAAe,EAAE,EAAE;QACzB,MAAM,MAAM,GAAa,CAAC,EAAE,CAAC,CAAC;QAE9B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;YACzC,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;YACnB,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;QACzB,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CACtB,KAAY,EACZ,SAAiB,EACjB,MAAsB;IAEtB,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEtD,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAE7D,OAAO,CAAC,IAAI,EAAE,EAAE;YACd,MAAM,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,CAAC,OAAO,CAAC,MAAM;gBAAE,OAAO,CAAC,KAAK,CAAC,CAAC;YACpC,OAAO,CAAC,EAAE,CAAC,CAAC;QACd,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,IAAI,UAAU,CAAC;IAEzC,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QAClD,OAAO,CAAC,IAAI,EAAE,EAAE;YACd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC/B,IAAI,KAAK,IAAI,IAAI;gBAAE,OAAO,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAE3C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAChD,MAAM,IAAI,SAAS,CAAC,aAAa,KAAK,CAAC,IAAI,2BAA2B,CAAC,CAAC;YAC1E,CAAC;YAED,OAAO;gBACL,KAAK;qBACF,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;oBACpB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;wBAC9B,MAAM,IAAI,SAAS,CACjB,aAAa,KAAK,CAAC,IAAI,IAAI,KAAK,kBAAkB,CACnD,CAAC;oBACJ,CAAC;oBAED,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;gBAC5B,CAAC,CAAC;qBACD,IAAI,CAAC,SAAS,CAAC;aACnB,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,KAAK,IAAI,IAAI;YAAE,OAAO,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAE3C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,SAAS,CAAC,aAAa,KAAK,CAAC,IAAI,kBAAkB,CAAC,CAAC;QACjE,CAAC;QAED,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9B,CAAC,CAAC;AACJ,CAAC;AAyBD;;GAEG;AACH,SAAgB,KAAK,CACnB,IAAmB,EACnB,UAAuC,EAAE;IAEzC,MAAM,EAAE,MAAM,GAAG,kBAAkB,EAAE,SAAS,GAAG,iBAAiB,EAAE,GAClE,OAAO,CAAC;IACV,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAErD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QAChC,IAAI,MAAM,KAAK,KAAK;YAAE,OAAO,UAAU,CAAC;QACxC,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO;YAAE,OAAO,MAAM,CAAC;QACxC,OAAO,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,KAAK,CAAC,KAAa;QACjC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;QAErB,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAClC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS;gBAAE,SAAS;YAEjC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACxB,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAChC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,YAAY,CAC1B,IAAmB,EACnB,UAA8C,EAAE;IAEhD,MAAM,EACJ,SAAS,GAAG,iBAAiB,EAC7B,GAAG,GAAG,IAAI,EACV,SAAS,GAAG,KAAK,EACjB,QAAQ,GAAG,IAAI,GAChB,GAAG,OAAO,CAAC;IACZ,MAAM,IAAI,GAAS,EAAE,CAAC;IACtB,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IACnC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAC/B,IAAI,YAAY,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CACxD,CAAC;IAEF,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,KAAK,EAAE,CAAC;QAC/B,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;YACzC,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;YACtD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAC1C,IAAI,QAAQ;QAAE,OAAO,IAAI,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;IACtD,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;IAEpD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC1C,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAC;AAOD;;GAEG;AACH,QAAQ,CAAC,CAAC,OAAO,CACf,MAAe,EACf,KAAa,EACb,IAAiB;IAEjB,IAAI,KAAK,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;QAC5B,OAAO,MAAM,IAAI,CAAC;IACpB,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE5B,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC1B,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;YACjD,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAC,MAAmB,EAAE,SAAiB,EAAE,IAAU;IAC1E,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAI,kBAAkB,GAAG,IAAI,CAAC;IAE9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAExB,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAC1B,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC9B,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC;YACzB,kBAAkB,KAAlB,kBAAkB,GAAK,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAC;YACvD,SAAS;QACX,CAAC;QAED,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACxD,IAAI,CAAC,kBAAkB,IAAI,CAAC,SAAS,EAAE,CAAC;gBACtC,MAAM,IAAI,SAAS,CAAC,uBAAuB,KAAK,CAAC,IAAI,MAAM,SAAS,EAAE,CAAC,CAAC;YAC1E,CAAC;YAED,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBAC3B,MAAM,IAAI,IAAI,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC;YAC3E,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,aAAa,CAAC;YAC1B,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACjB,SAAS,GAAG,EAAE,CAAC;YACf,kBAAkB,GAAG,KAAK,CAAC;YAC3B,SAAS;QACX,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,MAAM,CAAC,SAAiB,EAAE,SAAiB;IAClD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,KAAK,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC;QACvE,OAAO,SAAS,MAAM,CAAC,SAAS,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;IAC/D,CAAC;IACD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,SAAS,MAAM,CAAC,SAAS,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;IAC/D,CAAC;IACD,OAAO,SAAS,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC;AACrE,CAAC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,IAAe;IACvC,OAAO,IAAI,CAAC,MAAM;SACf,GAAG,CAAC,SAAS,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM;QAC/C,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1D,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC3B,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC;QAC1D,CAAC;QAED,MAAM,MAAM,GACV,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9D,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE7D,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO;YAAE,OAAO,IAAI,GAAG,EAAE,CAAC;QAC7C,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;YAAE,OAAO,IAAI,GAAG,EAAE,CAAC;QAChD,MAAM,IAAI,SAAS,CAAC,qBAAqB,KAAK,EAAE,CAAC,CAAC;IACpD,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAC9B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,cAAc,CAAC,KAAwB;IAC9C,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IACxC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["const DEFAULT_DELIMITER = \"/\";\nconst NOOP_VALUE = (value: string) => value;\nconst ID_START = /^[$_\\p{ID_Start}]$/u;\nconst ID_CONTINUE = /^[$\\u200c\\u200d\\p{ID_Continue}]$/u;\nconst DEBUG_URL = \"https://git.new/pathToRegexpError\";\n\n/**\n * Encode a string into another string.\n */\nexport type Encode = (value: string) => string;\n\n/**\n * Decode a string into another string.\n */\nexport type Decode = (value: string) => string;\n\nexport interface ParseOptions {\n /**\n * A function for encoding input strings.\n */\n encodePath?: Encode;\n}\n\nexport interface PathToRegexpOptions {\n /**\n * Matches the path completely without trailing characters. (default: `true`)\n */\n end?: boolean;\n /**\n * Allows optional trailing delimiter to match. (default: `true`)\n */\n trailing?: boolean;\n /**\n * Match will be case sensitive. (default: `false`)\n */\n sensitive?: boolean;\n /**\n * The default delimiter for segments. (default: `'/'`)\n */\n delimiter?: string;\n}\n\nexport interface MatchOptions extends PathToRegexpOptions {\n /**\n * Function for decoding strings for params, or `false` to disable entirely. (default: `decodeURIComponent`)\n */\n decode?: Decode | false;\n}\n\nexport interface CompileOptions {\n /**\n * Function for encoding input strings for output into the path, or `false` to disable entirely. (default: `encodeURIComponent`)\n */\n encode?: Encode | false;\n /**\n * The default delimiter for segments. (default: `'/'`)\n */\n delimiter?: string;\n}\n\ntype TokenType =\n | \"{\"\n | \"}\"\n | \"WILDCARD\"\n | \"PARAM\"\n | \"CHAR\"\n | \"ESCAPED\"\n | \"END\"\n // Reserved for use or ambiguous due to past use.\n | \"(\"\n | \")\"\n | \"[\"\n | \"]\"\n | \"+\"\n | \"?\"\n | \"!\";\n\n/**\n * Tokenizer results.\n */\ninterface LexToken {\n type: TokenType;\n index: number;\n value: string;\n}\n\nconst SIMPLE_TOKENS: Record = {\n // Groups.\n \"{\": \"{\",\n \"}\": \"}\",\n // Reserved.\n \"(\": \"(\",\n \")\": \")\",\n \"[\": \"[\",\n \"]\": \"]\",\n \"+\": \"+\",\n \"?\": \"?\",\n \"!\": \"!\",\n};\n\n/**\n * Escape text for stringify to path.\n */\nfunction escapeText(str: string) {\n return str.replace(/[{}()\\[\\]+?!:*]/g, \"\\\\$&\");\n}\n\n/**\n * Escape a regular expression string.\n */\nfunction escape(str: string) {\n return str.replace(/[.+*?^${}()[\\]|/\\\\]/g, \"\\\\$&\");\n}\n\n/**\n * Tokenize input string.\n */\nfunction* lexer(str: string): Generator {\n const chars = [...str];\n let i = 0;\n\n function name() {\n let value = \"\";\n\n if (ID_START.test(chars[++i])) {\n value += chars[i];\n while (ID_CONTINUE.test(chars[++i])) {\n value += chars[i];\n }\n } else if (chars[i] === '\"') {\n let pos = i;\n\n while (i < chars.length) {\n if (chars[++i] === '\"') {\n i++;\n pos = 0;\n break;\n }\n\n if (chars[i] === \"\\\\\") {\n value += chars[++i];\n } else {\n value += chars[i];\n }\n }\n\n if (pos) {\n throw new TypeError(`Unterminated quote at ${pos}: ${DEBUG_URL}`);\n }\n }\n\n if (!value) {\n throw new TypeError(`Missing parameter name at ${i}: ${DEBUG_URL}`);\n }\n\n return value;\n }\n\n while (i < chars.length) {\n const value = chars[i];\n const type = SIMPLE_TOKENS[value];\n\n if (type) {\n yield { type, index: i++, value };\n } else if (value === \"\\\\\") {\n yield { type: \"ESCAPED\", index: i++, value: chars[i++] };\n } else if (value === \":\") {\n const value = name();\n yield { type: \"PARAM\", index: i, value };\n } else if (value === \"*\") {\n const value = name();\n yield { type: \"WILDCARD\", index: i, value };\n } else {\n yield { type: \"CHAR\", index: i, value: chars[i++] };\n }\n }\n\n return { type: \"END\", index: i, value: \"\" };\n}\n\nclass Iter {\n private _peek?: LexToken;\n\n constructor(private tokens: Generator) {}\n\n peek(): LexToken {\n if (!this._peek) {\n const next = this.tokens.next();\n this._peek = next.value;\n }\n return this._peek;\n }\n\n tryConsume(type: TokenType): string | undefined {\n const token = this.peek();\n if (token.type !== type) return;\n this._peek = undefined; // Reset after consumed.\n return token.value;\n }\n\n consume(type: TokenType): string {\n const value = this.tryConsume(type);\n if (value !== undefined) return value;\n const { type: nextType, index } = this.peek();\n throw new TypeError(\n `Unexpected ${nextType} at ${index}, expected ${type}: ${DEBUG_URL}`,\n );\n }\n\n text(): string {\n let result = \"\";\n let value: string | undefined;\n while ((value = this.tryConsume(\"CHAR\") || this.tryConsume(\"ESCAPED\"))) {\n result += value;\n }\n return result;\n }\n}\n\n/**\n * Plain text.\n */\nexport interface Text {\n type: \"text\";\n value: string;\n}\n\n/**\n * A parameter designed to match arbitrary text within a segment.\n */\nexport interface Parameter {\n type: \"param\";\n name: string;\n}\n\n/**\n * A wildcard parameter designed to match multiple segments.\n */\nexport interface Wildcard {\n type: \"wildcard\";\n name: string;\n}\n\n/**\n * A set of possible tokens to expand when matching.\n */\nexport interface Group {\n type: \"group\";\n tokens: Token[];\n}\n\n/**\n * A token that corresponds with a regexp capture.\n */\nexport type Key = Parameter | Wildcard;\n\n/**\n * A sequence of `path-to-regexp` keys that match capturing groups.\n */\nexport type Keys = Array;\n\n/**\n * A sequence of path match characters.\n */\nexport type Token = Text | Parameter | Wildcard | Group;\n\n/**\n * Tokenized path instance.\n */\nexport class TokenData {\n constructor(public readonly tokens: Token[]) {}\n}\n\n/**\n * Parse a string for the raw tokens.\n */\nexport function parse(str: string, options: ParseOptions = {}): TokenData {\n const { encodePath = NOOP_VALUE } = options;\n const it = new Iter(lexer(str));\n\n function consume(endType: TokenType): Token[] {\n const tokens: Token[] = [];\n\n while (true) {\n const path = it.text();\n if (path) tokens.push({ type: \"text\", value: encodePath(path) });\n\n const param = it.tryConsume(\"PARAM\");\n if (param) {\n tokens.push({\n type: \"param\",\n name: param,\n });\n continue;\n }\n\n const wildcard = it.tryConsume(\"WILDCARD\");\n if (wildcard) {\n tokens.push({\n type: \"wildcard\",\n name: wildcard,\n });\n continue;\n }\n\n const open = it.tryConsume(\"{\");\n if (open) {\n tokens.push({\n type: \"group\",\n tokens: consume(\"}\"),\n });\n continue;\n }\n\n it.consume(endType);\n return tokens;\n }\n }\n\n const tokens = consume(\"END\");\n return new TokenData(tokens);\n}\n\n/**\n * Compile a string to a template function for the path.\n */\nexport function compile

(\n path: Path,\n options: CompileOptions & ParseOptions = {},\n) {\n const { encode = encodeURIComponent, delimiter = DEFAULT_DELIMITER } =\n options;\n const data = path instanceof TokenData ? path : parse(path, options);\n const fn = tokensToFunction(data.tokens, delimiter, encode);\n\n return function path(data: P = {} as P) {\n const [path, ...missing] = fn(data);\n if (missing.length) {\n throw new TypeError(`Missing parameters: ${missing.join(\", \")}`);\n }\n return path;\n };\n}\n\nexport type ParamData = Partial>;\nexport type PathFunction

= (data?: P) => string;\n\nfunction tokensToFunction(\n tokens: Token[],\n delimiter: string,\n encode: Encode | false,\n) {\n const encoders = tokens.map((token) =>\n tokenToFunction(token, delimiter, encode),\n );\n\n return (data: ParamData) => {\n const result: string[] = [\"\"];\n\n for (const encoder of encoders) {\n const [value, ...extras] = encoder(data);\n result[0] += value;\n result.push(...extras);\n }\n\n return result;\n };\n}\n\n/**\n * Convert a single token into a path building function.\n */\nfunction tokenToFunction(\n token: Token,\n delimiter: string,\n encode: Encode | false,\n): (data: ParamData) => string[] {\n if (token.type === \"text\") return () => [token.value];\n\n if (token.type === \"group\") {\n const fn = tokensToFunction(token.tokens, delimiter, encode);\n\n return (data) => {\n const [value, ...missing] = fn(data);\n if (!missing.length) return [value];\n return [\"\"];\n };\n }\n\n const encodeValue = encode || NOOP_VALUE;\n\n if (token.type === \"wildcard\" && encode !== false) {\n return (data) => {\n const value = data[token.name];\n if (value == null) return [\"\", token.name];\n\n if (!Array.isArray(value) || value.length === 0) {\n throw new TypeError(`Expected \"${token.name}\" to be a non-empty array`);\n }\n\n return [\n value\n .map((value, index) => {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `Expected \"${token.name}/${index}\" to be a string`,\n );\n }\n\n return encodeValue(value);\n })\n .join(delimiter),\n ];\n };\n }\n\n return (data) => {\n const value = data[token.name];\n if (value == null) return [\"\", token.name];\n\n if (typeof value !== \"string\") {\n throw new TypeError(`Expected \"${token.name}\" to be a string`);\n }\n\n return [encodeValue(value)];\n };\n}\n\n/**\n * A match result contains data about the path match.\n */\nexport interface MatchResult

{\n path: string;\n params: P;\n}\n\n/**\n * A match is either `false` (no match) or a match result.\n */\nexport type Match

= false | MatchResult

;\n\n/**\n * The match function takes a string and returns whether it matched the path.\n */\nexport type MatchFunction

= (path: string) => Match

;\n\n/**\n * Supported path types.\n */\nexport type Path = string | TokenData;\n\n/**\n * Transform a path into a match function.\n */\nexport function match

(\n path: Path | Path[],\n options: MatchOptions & ParseOptions = {},\n): MatchFunction

{\n const { decode = decodeURIComponent, delimiter = DEFAULT_DELIMITER } =\n options;\n const { regexp, keys } = pathToRegexp(path, options);\n\n const decoders = keys.map((key) => {\n if (decode === false) return NOOP_VALUE;\n if (key.type === \"param\") return decode;\n return (value: string) => value.split(delimiter).map(decode);\n });\n\n return function match(input: string) {\n const m = regexp.exec(input);\n if (!m) return false;\n\n const path = m[0];\n const params = Object.create(null);\n\n for (let i = 1; i < m.length; i++) {\n if (m[i] === undefined) continue;\n\n const key = keys[i - 1];\n const decoder = decoders[i - 1];\n params[key.name] = decoder(m[i]);\n }\n\n return { path, params };\n };\n}\n\nexport function pathToRegexp(\n path: Path | Path[],\n options: PathToRegexpOptions & ParseOptions = {},\n) {\n const {\n delimiter = DEFAULT_DELIMITER,\n end = true,\n sensitive = false,\n trailing = true,\n } = options;\n const keys: Keys = [];\n const sources: string[] = [];\n const flags = sensitive ? \"\" : \"i\";\n const paths = Array.isArray(path) ? path : [path];\n const items = paths.map((path) =>\n path instanceof TokenData ? path : parse(path, options),\n );\n\n for (const { tokens } of items) {\n for (const seq of flatten(tokens, 0, [])) {\n const regexp = sequenceToRegExp(seq, delimiter, keys);\n sources.push(regexp);\n }\n }\n\n let pattern = `^(?:${sources.join(\"|\")})`;\n if (trailing) pattern += `(?:${escape(delimiter)}$)?`;\n pattern += end ? \"$\" : `(?=${escape(delimiter)}|$)`;\n\n const regexp = new RegExp(pattern, flags);\n return { regexp, keys };\n}\n\n/**\n * Flattened token set.\n */\ntype Flattened = Text | Parameter | Wildcard;\n\n/**\n * Generate a flat list of sequence tokens from the given tokens.\n */\nfunction* flatten(\n tokens: Token[],\n index: number,\n init: Flattened[],\n): Generator {\n if (index === tokens.length) {\n return yield init;\n }\n\n const token = tokens[index];\n\n if (token.type === \"group\") {\n const fork = init.slice();\n for (const seq of flatten(token.tokens, 0, fork)) {\n yield* flatten(tokens, index + 1, seq);\n }\n } else {\n init.push(token);\n }\n\n yield* flatten(tokens, index + 1, init);\n}\n\n/**\n * Transform a flat sequence of tokens into a regular expression.\n */\nfunction sequenceToRegExp(tokens: Flattened[], delimiter: string, keys: Keys) {\n let result = \"\";\n let backtrack = \"\";\n let isSafeSegmentParam = true;\n\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n\n if (token.type === \"text\") {\n result += escape(token.value);\n backtrack += token.value;\n isSafeSegmentParam ||= token.value.includes(delimiter);\n continue;\n }\n\n if (token.type === \"param\" || token.type === \"wildcard\") {\n if (!isSafeSegmentParam && !backtrack) {\n throw new TypeError(`Missing text after \"${token.name}\": ${DEBUG_URL}`);\n }\n\n if (token.type === \"param\") {\n result += `(${negate(delimiter, isSafeSegmentParam ? \"\" : backtrack)}+)`;\n } else {\n result += `([\\\\s\\\\S]+)`;\n }\n\n keys.push(token);\n backtrack = \"\";\n isSafeSegmentParam = false;\n continue;\n }\n }\n\n return result;\n}\n\nfunction negate(delimiter: string, backtrack: string) {\n if (backtrack.length < 2) {\n if (delimiter.length < 2) return `[^${escape(delimiter + backtrack)}]`;\n return `(?:(?!${escape(delimiter)})[^${escape(backtrack)}])`;\n }\n if (delimiter.length < 2) {\n return `(?:(?!${escape(backtrack)})[^${escape(delimiter)}])`;\n }\n return `(?:(?!${escape(backtrack)}|${escape(delimiter)})[\\\\s\\\\S])`;\n}\n\n/**\n * Stringify token data into a path string.\n */\nexport function stringify(data: TokenData) {\n return data.tokens\n .map(function stringifyToken(token, index, tokens): string {\n if (token.type === \"text\") return escapeText(token.value);\n if (token.type === \"group\") {\n return `{${token.tokens.map(stringifyToken).join(\"\")}}`;\n }\n\n const isSafe =\n isNameSafe(token.name) && isNextNameSafe(tokens[index + 1]);\n const key = isSafe ? token.name : JSON.stringify(token.name);\n\n if (token.type === \"param\") return `:${key}`;\n if (token.type === \"wildcard\") return `*${key}`;\n throw new TypeError(`Unexpected token: ${token}`);\n })\n .join(\"\");\n}\n\nfunction isNameSafe(name: string) {\n const [first, ...rest] = name;\n if (!ID_START.test(first)) return false;\n return rest.every((char) => ID_CONTINUE.test(char));\n}\n\nfunction isNextNameSafe(token: Token | undefined) {\n if (token?.type !== \"text\") return true;\n return !ID_CONTINUE.test(token.value[0]);\n}\n"]} \ No newline at end of file diff --git a/api/node_modules/path-to-regexp/package.json b/api/node_modules/path-to-regexp/package.json index d4b35ca..23b4b6a 100644 --- a/api/node_modules/path-to-regexp/package.json +++ b/api/node_modules/path-to-regexp/package.json @@ -1,62 +1,30 @@ { "name": "path-to-regexp", - "version": "8.2.0", "description": "Express style path to RegExp utility", + "version": "0.1.12", + "files": [ + "index.js", + "LICENSE" + ], + "scripts": { + "test": "istanbul cover _mocha -- -R spec" + }, "keywords": [ "express", - "regexp", - "route", - "routing" + "regexp" ], + "component": { + "scripts": { + "path-to-regexp": "index.js" + } + }, + "license": "MIT", "repository": { "type": "git", "url": "https://github.com/pillarjs/path-to-regexp.git" }, - "license": "MIT", - "exports": "./dist/index.js", - "main": "dist/index.js", - "typings": "dist/index.d.ts", - "files": [ - "dist/" - ], - "scripts": { - "bench": "vitest bench", - "build": "ts-scripts build", - "format": "ts-scripts format", - "lint": "ts-scripts lint", - "prepare": "ts-scripts install && npm run build", - "size": "size-limit", - "specs": "ts-scripts specs", - "test": "ts-scripts test && npm run size" - }, "devDependencies": { - "@borderless/ts-scripts": "^0.15.0", - "@size-limit/preset-small-lib": "^11.1.2", - "@types/node": "^22.7.2", - "@types/semver": "^7.3.1", - "@vitest/coverage-v8": "^2.1.1", - "recheck": "^4.4.5", - "size-limit": "^11.1.2", - "typescript": "^5.5.3" - }, - "engines": { - "node": ">=16" - }, - "publishConfig": { - "access": "public" - }, - "size-limit": [ - { - "path": "dist/index.js", - "limit": "2.2 kB" - } - ], - "ts-scripts": { - "dist": [ - "dist" - ], - "project": [ - "tsconfig.build.json" - ] + "mocha": "^1.17.1", + "istanbul": "^0.2.6" } } diff --git a/api/node_modules/qs/.eslintrc b/api/node_modules/qs/.eslintrc index a89f60e..b692761 100644 --- a/api/node_modules/qs/.eslintrc +++ b/api/node_modules/qs/.eslintrc @@ -13,7 +13,6 @@ "func-name-matching": 0, "id-length": [2, { "min": 1, "max": 25, "properties": "never" }], "indent": [2, 4], - "max-lines": 0, "max-lines-per-function": [2, { "max": 150 }], "max-params": [2, 18], "max-statements": [2, 100], diff --git a/api/node_modules/qs/CHANGELOG.md b/api/node_modules/qs/CHANGELOG.md index dc8e879..02a6b50 100644 --- a/api/node_modules/qs/CHANGELOG.md +++ b/api/node_modules/qs/CHANGELOG.md @@ -1,25 +1,3 @@ -## **6.14.0** -- [New] `parse`: add `throwOnParameterLimitExceeded` option (#517) -- [Refactor] `parse`: use `utils.combine` more -- [patch] `parse`: add explicit `throwOnLimitExceeded` default -- [actions] use shared action; re-add finishers -- [meta] Fix changelog formatting bug -- [Deps] update `side-channel` -- [Dev Deps] update `es-value-fixtures`, `has-bigints`, `has-proto`, `has-symbols` -- [Tests] increase coverage - -## **6.13.1** -- [Fix] `stringify`: avoid a crash when a `filter` key is `null` -- [Fix] `utils.merge`: functions should not be stringified into keys -- [Fix] `parse`: avoid a crash with interpretNumericEntities: true, comma: true, and iso charset -- [Fix] `stringify`: ensure a non-string `filter` does not crash -- [Refactor] use `__proto__` syntax instead of `Object.create` for null objects -- [Refactor] misc cleanup -- [Tests] `utils.merge`: add some coverage -- [Tests] fix a test case -- [actions] split out node 10-20, and 20+ -- [Dev Deps] update `es-value-fixtures`, `mock-property`, `object-inspect`, `tape` - ## **6.13.0** - [New] `parse`: add `strictDepth` option (#511) - [Tests] use `npm audit` instead of `aud` diff --git a/api/node_modules/qs/README.md b/api/node_modules/qs/README.md index 22c411d..1e0d9ad 100644 --- a/api/node_modules/qs/README.md +++ b/api/node_modules/qs/README.md @@ -49,7 +49,7 @@ assert.deepEqual(qs.parse('foo[bar]=baz'), { }); ``` -When using the `plainObjects` option the parsed value is returned as a null object, created via `{ __proto__: null }` and as such you should be aware that prototype methods will not exist on it and a user may set those names to whatever value they like: +When using the `plainObjects` option the parsed value is returned as a null object, created via `Object.create(null)` and as such you should be aware that prototype methods will not exist on it and a user may set those names to whatever value they like: ```javascript var nullObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true }); @@ -135,18 +135,6 @@ var limited = qs.parse('a=b&c=d', { parameterLimit: 1 }); assert.deepEqual(limited, { a: 'b' }); ``` -If you want an error to be thrown whenever the a limit is exceeded (eg, `parameterLimit`, `arrayLimit`), set the `throwOnLimitExceeded` option to `true`. This option will generate a descriptive error if the query string exceeds a configured limit. -```javascript -try { - qs.parse('a=1&b=2&c=3&d=4', { parameterLimit: 3, throwOnLimitExceeded: true }); -} catch (err) { - assert(err instanceof Error); - assert.strictEqual(err.message, 'Parameter limit exceeded. Only 3 parameters allowed.'); -} -``` - -When `throwOnLimitExceeded` is set to `false` (default), **qs** will parse up to the specified `parameterLimit` and ignore the rest without throwing an error. - To bypass the leading question mark, use `ignoreQueryPrefix`: ```javascript @@ -298,18 +286,6 @@ var withArrayLimit = qs.parse('a[1]=b', { arrayLimit: 0 }); assert.deepEqual(withArrayLimit, { a: { '1': 'b' } }); ``` -If you want to throw an error whenever the array limit is exceeded, set the `throwOnLimitExceeded` option to `true`. This option will generate a descriptive error if the query string exceeds a configured limit. -```javascript -try { - qs.parse('a[1]=b', { arrayLimit: 0, throwOnLimitExceeded: true }); -} catch (err) { - assert(err instanceof Error); - assert.strictEqual(err.message, 'Array limit exceeded. Only 0 elements allowed in an array.'); -} -``` - -When `throwOnLimitExceeded` is set to `false` (default), **qs** will parse up to the specified `arrayLimit` and if the limit is exceeded, the array will instead be converted to an object with the index as the key - To disable array parsing entirely, set `parseArrays` to `false`. ```javascript diff --git a/api/node_modules/qs/dist/qs.js b/api/node_modules/qs/dist/qs.js index f37989a..154e72e 100644 --- a/api/node_modules/qs/dist/qs.js +++ b/api/node_modules/qs/dist/qs.js @@ -5,137 +5,86 @@ "use strict";var stringify=require(4),parse=require(3),formats=require(1);module.exports={formats:formats,parse:parse,stringify:stringify}; },{"1":1,"3":3,"4":4}],3:[function(require,module,exports){ -"use strict";var utils=require(5),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,defaults={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:utils.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},parseArrayValue=function(e,t,r){if(e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1)return e.split(",");if(t.throwOnLimitExceeded&&r>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function parseQueryStringValues(e,t){var r={__proto__:null},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var a=t.parameterLimit===1/0?void 0:t.parameterLimit,o=i.split(t.delimiter,t.throwOnLimitExceeded?a+1:a);if(t.throwOnLimitExceeded&&o.length>a)throw new RangeError("Parameter limit exceeded. Only "+a+" parameter"+(1===a?"":"s")+" allowed.");var l,n=-1,s=t.charset;if(t.charsetSentinel)for(l=0;l-1&&(p=isArray(p)?[p]:p);var f=has.call(r,d);f&&"combine"===t.duplicates?r[d]=utils.combine(r[d],p):f&&"last"!==t.duplicates||(r[d]=p)}return r},parseObject=function(e,t,r,i){var a=0;if(e.length>0&&"[]"===e[e.length-1]){var o=e.slice(0,-1).join("");a=Array.isArray(t)&&t[o]?t[o].length:0}for(var l=i?t:parseArrayValue(t,r,a),n=e.length-1;n>=0;--n){var s,d=e[n];if("[]"===d&&r.parseArrays)s=r.allowEmptyArrays&&(""===l||r.strictNullHandling&&null===l)?[]:utils.combine([],l);else{s=r.plainObjects?{__proto__:null}:{};var p="["===d.charAt(0)&&"]"===d.charAt(d.length-1)?d.slice(1,-1):d,c=r.decodeDotInKeys?p.replace(/%2E/g,"."):p,u=parseInt(c,10);r.parseArrays||""!==c?!isNaN(u)&&d!==c&&String(u)===c&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(s=[])[u]=l:"__proto__"!==c&&(s[c]=l):s={0:l}}l=s}return l},parseKeys=function parseQueryStringKeys(e,t,r,i){if(e){var a=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/g,l=r.depth>0&&/(\[[^[\]]*])/.exec(a),n=l?a.slice(0,l.index):a,s=[];if(n){if(!r.plainObjects&&has.call(Object.prototype,n)&&!r.allowPrototypes)return;s.push(n)}for(var d=0;r.depth>0&&null!==(l=o.exec(a))&&d-1?e.split(","):e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function parseQueryStringValues(e,t){var r={__proto__:null},a=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;a=a.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var i,o=t.parameterLimit===1/0?void 0:t.parameterLimit,l=a.split(t.delimiter,o),s=-1,n=t.charset;if(t.charsetSentinel)for(i=0;i-1&&(c=isArray(c)?[c]:c);var y=has.call(r,p);y&&"combine"===t.duplicates?r[p]=utils.combine(r[p],c):y&&"last"!==t.duplicates||(r[p]=c)}return r},parseObject=function(e,t,r,a){for(var i=a?t:parseArrayValue(t,r),o=e.length-1;o>=0;--o){var l,s=e[o];if("[]"===s&&r.parseArrays)l=r.allowEmptyArrays&&(""===i||r.strictNullHandling&&null===i)?[]:[].concat(i);else{l=r.plainObjects?Object.create(null):{};var n="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,p=r.decodeDotInKeys?n.replace(/%2E/g,"."):n,c=parseInt(p,10);r.parseArrays||""!==p?!isNaN(c)&&s!==p&&String(c)===p&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(l=[])[c]=i:"__proto__"!==p&&(l[p]=i):l={0:i}}i=l}return i},parseKeys=function parseQueryStringKeys(e,t,r,a){if(e){var i=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/g,l=r.depth>0&&/(\[[^[\]]*])/.exec(i),s=l?i.slice(0,l.index):i,n=[];if(s){if(!r.plainObjects&&has.call(Object.prototype,s)&&!r.allowPrototypes)return;n.push(s)}for(var p=0;r.depth>0&&null!==(l=o.exec(i))&&p0?g.join(",")||null:void 0}];else if(isArray(f))S=f;else{var N=Object.keys(g);S=u?N.sort(u):N}var T=l?String(r).replace(/\./g,"%2E"):String(r),O=o&&isArray(g)&&1===g.length?T+"[]":T;if(a&&isArray(g)&&0===g.length)return O+"[]";for(var k=0;k0?c+y:""}; +"use strict";var getSideChannel=require(29),utils=require(5),formats=require(1),has=Object.prototype.hasOwnProperty,arrayPrefixGenerators={brackets:function brackets(e){return e+"[]"},comma:"comma",indices:function indices(e,r){return e+"["+r+"]"},repeat:function repeat(e){return e}},isArray=Array.isArray,push=Array.prototype.push,pushToArray=function(e,r){push.apply(e,isArray(r)?r:[r])},toISO=Date.prototype.toISOString,defaultFormat=formats.default,defaults={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:utils.encode,encodeValuesOnly:!1,format:defaultFormat,formatter:formats.formatters[defaultFormat],indices:!1,serializeDate:function serializeDate(e){return toISO.call(e)},skipNulls:!1,strictNullHandling:!1},isNonNullishPrimitive=function isNonNullishPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e},sentinel={},stringify=function stringify(e,r,t,o,a,n,i,l,s,f,u,d,y,c,p,m,h,v){for(var w=e,b=v,g=0,A=!1;void 0!==(b=b.get(sentinel))&&!A;){var D=b.get(e);if(g+=1,void 0!==D){if(D===g)throw new RangeError("Cyclic object value");A=!0}void 0===b.get(sentinel)&&(g=0)}if("function"==typeof f?w=f(r,w):w instanceof Date?w=y(w):"comma"===t&&isArray(w)&&(w=utils.maybeMap(w,(function(e){return e instanceof Date?y(e):e}))),null===w){if(n)return s&&!m?s(r,defaults.encoder,h,"key",c):r;w=""}if(isNonNullishPrimitive(w)||utils.isBuffer(w))return s?[p(m?r:s(r,defaults.encoder,h,"key",c))+"="+p(s(w,defaults.encoder,h,"value",c))]:[p(r)+"="+p(String(w))];var E,N=[];if(void 0===w)return N;if("comma"===t&&isArray(w))m&&s&&(w=utils.maybeMap(w,s)),E=[{value:w.length>0?w.join(",")||null:void 0}];else if(isArray(f))E=f;else{var S=Object.keys(w);E=u?S.sort(u):S}var O=l?r.replace(/\./g,"%2E"):r,T=o&&isArray(w)&&1===w.length?O+"[]":O;if(a&&isArray(w)&&0===w.length)return T+"[]";for(var k=0;k0?y+d:""}; -},{"1":1,"46":46,"5":5}],5:[function(require,module,exports){ -"use strict";var formats=require(1),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,hexTable=function(){for(var e=[],r=0;r<256;++r)e.push("%"+((r<16?"0":"")+r.toString(16)).toUpperCase());return e}(),compactQueue=function compactQueue(e){for(;e.length>1;){var r=e.pop(),t=r.obj[r.prop];if(isArray(t)){for(var o=[],n=0;n=limit?a.slice(i,i+limit):a,p=[],f=0;f=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122||n===formats.RFC1738&&(40===s||41===s)?p[p.length]=u.charAt(f):s<128?p[p.length]=hexTable[s]:s<2048?p[p.length]=hexTable[192|s>>6]+hexTable[128|63&s]:s<55296||s>=57344?p[p.length]=hexTable[224|s>>12]+hexTable[128|s>>6&63]+hexTable[128|63&s]:(f+=1,s=65536+((1023&s)<<10|1023&u.charCodeAt(f)),p[p.length]=hexTable[240|s>>18]+hexTable[128|s>>12&63]+hexTable[128|s>>6&63]+hexTable[128|63&s])}c+=p.join("")}return c},compact=function compact(e){for(var r=[{obj:{o:e},prop:"o"}],t=[],o=0;o1;){var r=e.pop(),t=r.obj[r.prop];if(isArray(t)){for(var o=[],n=0;n=limit?a.slice(i,i+limit):a,p=[],s=0;s=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||n===formats.RFC1738&&(40===f||41===f)?p[p.length]=u.charAt(s):f<128?p[p.length]=hexTable[f]:f<2048?p[p.length]=hexTable[192|f>>6]+hexTable[128|63&f]:f<55296||f>=57344?p[p.length]=hexTable[224|f>>12]+hexTable[128|f>>6&63]+hexTable[128|63&f]:(s+=1,f=65536+((1023&f)<<10|1023&u.charCodeAt(s)),p[p.length]=hexTable[240|f>>18]+hexTable[128|f>>12&63]+hexTable[128|f>>6&63]+hexTable[128|63&f])}c+=p.join("")}return c},compact=function compact(e){for(var r=[{obj:{o:e},prop:"o"}],t=[],o=0;o-1?callBind(t):t}; -},{"11":11,"24":24,"8":8,"9":9}],8:[function(require,module,exports){ -"use strict";module.exports=Function.prototype.apply; +},{"20":20,"8":8}],20:[function(require,module,exports){ +"use strict";var undefined,$Error=require(12),$EvalError=require(11),$RangeError=require(13),$ReferenceError=require(14),$SyntaxError=require(15),$TypeError=require(16),$URIError=require(17),$Function=Function,getEvalledConstructor=function(r){try{return $Function('"use strict"; return ('+r+").constructor;")()}catch(r){}},$gOPD=Object.getOwnPropertyDescriptor;if($gOPD)try{$gOPD({},"")}catch(r){$gOPD=null}var throwTypeError=function(){throw new $TypeError},ThrowTypeError=$gOPD?function(){try{return throwTypeError}catch(r){try{return $gOPD(arguments,"callee").get}catch(r){return throwTypeError}}}():throwTypeError,hasSymbols=require(24)(),hasProto=require(23)(),getProto=Object.getPrototypeOf||(hasProto?function(r){return r.__proto__}:null),needsEval={},TypedArray="undefined"!=typeof Uint8Array&&getProto?getProto(Uint8Array):undefined,INTRINSICS={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?undefined:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?undefined:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols&&getProto?getProto([][Symbol.iterator]()):undefined,"%AsyncFromSyncIteratorPrototype%":undefined,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":"undefined"==typeof Atomics?undefined:Atomics,"%BigInt%":"undefined"==typeof BigInt?undefined:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?undefined:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?undefined:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?undefined:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":$Error,"%eval%":eval,"%EvalError%":$EvalError,"%Float32Array%":"undefined"==typeof Float32Array?undefined:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?undefined:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?undefined:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":"undefined"==typeof Int8Array?undefined:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?undefined:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?undefined:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols&&getProto?getProto(getProto([][Symbol.iterator]())):undefined,"%JSON%":"object"==typeof JSON?JSON:undefined,"%Map%":"undefined"==typeof Map?undefined:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&hasSymbols&&getProto?getProto((new Map)[Symbol.iterator]()):undefined,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?undefined:Promise,"%Proxy%":"undefined"==typeof Proxy?undefined:Proxy,"%RangeError%":$RangeError,"%ReferenceError%":$ReferenceError,"%Reflect%":"undefined"==typeof Reflect?undefined:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?undefined:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&hasSymbols&&getProto?getProto((new Set)[Symbol.iterator]()):undefined,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?undefined:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols&&getProto?getProto(""[Symbol.iterator]()):undefined,"%Symbol%":hasSymbols?Symbol:undefined,"%SyntaxError%":$SyntaxError,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError,"%Uint8Array%":"undefined"==typeof Uint8Array?undefined:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?undefined:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?undefined:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?undefined:Uint32Array,"%URIError%":$URIError,"%WeakMap%":"undefined"==typeof WeakMap?undefined:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?undefined:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?undefined:WeakSet};if(getProto)try{null.error}catch(r){var errorProto=getProto(getProto(r));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function doEval(r){var e;if("%AsyncFunction%"===r)e=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===r)e=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===r)e=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===r){var t=doEval("%AsyncGeneratorFunction%");t&&(e=t.prototype)}else if("%AsyncIteratorPrototype%"===r){var o=doEval("%AsyncGenerator%");o&&getProto&&(e=getProto(o.prototype))}return INTRINSICS[r]=e,e},LEGACY_ALIASES={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind=require(19),hasOwn=require(26),$concat=bind.call(Function.call,Array.prototype.concat),$spliceApply=bind.call(Function.apply,Array.prototype.splice),$replace=bind.call(Function.call,String.prototype.replace),$strSlice=bind.call(Function.call,String.prototype.slice),$exec=bind.call(Function.call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function stringToPath(r){var e=$strSlice(r,0,1),t=$strSlice(r,-1);if("%"===e&&"%"!==t)throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");if("%"===t&&"%"!==e)throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");var o=[];return $replace(r,rePropName,(function(r,e,t,n){o[o.length]=t?$replace(n,reEscapeChar,"$1"):e||r})),o},getBaseIntrinsic=function getBaseIntrinsic(r,e){var t,o=r;if(hasOwn(LEGACY_ALIASES,o)&&(o="%"+(t=LEGACY_ALIASES[o])[0]+"%"),hasOwn(INTRINSICS,o)){var n=INTRINSICS[o];if(n===needsEval&&(n=doEval(o)),void 0===n&&!e)throw new $TypeError("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:t,name:o,value:n}}throw new $SyntaxError("intrinsic "+r+" does not exist!")};module.exports=function GetIntrinsic(r,e){if("string"!=typeof r||0===r.length)throw new $TypeError("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new $TypeError('"allowMissing" argument must be a boolean');if(null===$exec(/^%?[^%]*%?$/,r))throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var t=stringToPath(r),o=t.length>0?t[0]:"",n=getBaseIntrinsic("%"+o+"%",e),a=n.name,y=n.value,i=!1,p=n.alias;p&&(o=p[0],$spliceApply(t,$concat([0,1],p)));for(var d=1,s=!0;d=t.length){var c=$gOPD(y,f);y=(s=!!c)&&"get"in c&&!("originalValue"in c.get)?c.get:y[f]}else s=hasOwn(y,f),y=y[f];s&&!i&&(INTRINSICS[a]=y)}}return y}; -},{}],9:[function(require,module,exports){ -"use strict";module.exports=Function.prototype.call; +},{"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"17":17,"19":19,"23":23,"24":24,"26":26}],8:[function(require,module,exports){ +"use strict";var bind=require(19),GetIntrinsic=require(20),setFunctionLength=require(28),$TypeError=require(16),$apply=GetIntrinsic("%Function.prototype.apply%"),$call=GetIntrinsic("%Function.prototype.call%"),$reflectApply=GetIntrinsic("%Reflect.apply%",!0)||bind.call($call,$apply),$defineProperty=require(10),$max=GetIntrinsic("%Math.max%");module.exports=function callBind(e){if("function"!=typeof e)throw new $TypeError("a function is required");var n=$reflectApply(bind,$call,arguments);return setFunctionLength(n,1+$max(0,e.length-(arguments.length-1)),!0)};var applyBind=function applyBind(){return $reflectApply(bind,$apply,arguments)};$defineProperty?$defineProperty(module.exports,"apply",{value:applyBind}):module.exports.apply=applyBind; -},{}],24:[function(require,module,exports){ -"use strict";var implementation=require(23);module.exports=Function.prototype.bind||implementation; - -},{"23":23}],11:[function(require,module,exports){ -"use strict";module.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply; - -},{}],10:[function(require,module,exports){ -"use strict";var bind=require(24),$TypeError=require(20),$call=require(9),$actualApply=require(7);module.exports=function callBindBasic(r){if(r.length<1||"function"!=typeof r[0])throw new $TypeError("a function is required");return $actualApply(bind,$call,r)}; - -},{"20":20,"24":24,"7":7,"9":9}],20:[function(require,module,exports){ +},{"10":10,"16":16,"19":19,"20":20,"28":28}],16:[function(require,module,exports){ "use strict";module.exports=TypeError; -},{}],12:[function(require,module,exports){ -"use strict";var GetIntrinsic=require(25),callBindBasic=require(10),$indexOf=callBindBasic([GetIntrinsic("%String.prototype.indexOf%")]);module.exports=function callBoundIntrinsic(i,n){var t=GetIntrinsic(i,!!n);return"function"==typeof t&&$indexOf(i,".prototype.")>-1?callBindBasic([t]):t}; - -},{"10":10,"25":25}],25:[function(require,module,exports){ -"use strict";var undefined,$Object=require(22),$Error=require(16),$EvalError=require(15),$RangeError=require(17),$ReferenceError=require(18),$SyntaxError=require(19),$TypeError=require(20),$URIError=require(21),abs=require(34),floor=require(35),max=require(37),min=require(38),pow=require(39),round=require(40),sign=require(41),$Function=Function,getEvalledConstructor=function(r){try{return $Function('"use strict"; return ('+r+").constructor;")()}catch(r){}},$gOPD=require(30),$defineProperty=require(14),throwTypeError=function(){throw new $TypeError},ThrowTypeError=$gOPD?function(){try{return throwTypeError}catch(r){try{return $gOPD(arguments,"callee").get}catch(r){return throwTypeError}}}():throwTypeError,hasSymbols=require(31)(),getProto=require(28),$ObjectGPO=require(26),$ReflectGPO=require(27),$apply=require(8),$call=require(9),needsEval={},TypedArray="undefined"!=typeof Uint8Array&&getProto?getProto(Uint8Array):undefined,INTRINSICS={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?undefined:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?undefined:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols&&getProto?getProto([][Symbol.iterator]()):undefined,"%AsyncFromSyncIteratorPrototype%":undefined,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":"undefined"==typeof Atomics?undefined:Atomics,"%BigInt%":"undefined"==typeof BigInt?undefined:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?undefined:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?undefined:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?undefined:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":$Error,"%eval%":eval,"%EvalError%":$EvalError,"%Float32Array%":"undefined"==typeof Float32Array?undefined:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?undefined:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?undefined:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":"undefined"==typeof Int8Array?undefined:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?undefined:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?undefined:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols&&getProto?getProto(getProto([][Symbol.iterator]())):undefined,"%JSON%":"object"==typeof JSON?JSON:undefined,"%Map%":"undefined"==typeof Map?undefined:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&hasSymbols&&getProto?getProto((new Map)[Symbol.iterator]()):undefined,"%Math%":Math,"%Number%":Number,"%Object%":$Object,"%Object.getOwnPropertyDescriptor%":$gOPD,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?undefined:Promise,"%Proxy%":"undefined"==typeof Proxy?undefined:Proxy,"%RangeError%":$RangeError,"%ReferenceError%":$ReferenceError,"%Reflect%":"undefined"==typeof Reflect?undefined:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?undefined:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&hasSymbols&&getProto?getProto((new Set)[Symbol.iterator]()):undefined,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?undefined:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols&&getProto?getProto(""[Symbol.iterator]()):undefined,"%Symbol%":hasSymbols?Symbol:undefined,"%SyntaxError%":$SyntaxError,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError,"%Uint8Array%":"undefined"==typeof Uint8Array?undefined:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?undefined:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?undefined:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?undefined:Uint32Array,"%URIError%":$URIError,"%WeakMap%":"undefined"==typeof WeakMap?undefined:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?undefined:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?undefined:WeakSet,"%Function.prototype.call%":$call,"%Function.prototype.apply%":$apply,"%Object.defineProperty%":$defineProperty,"%Object.getPrototypeOf%":$ObjectGPO,"%Math.abs%":abs,"%Math.floor%":floor,"%Math.max%":max,"%Math.min%":min,"%Math.pow%":pow,"%Math.round%":round,"%Math.sign%":sign,"%Reflect.getPrototypeOf%":$ReflectGPO};if(getProto)try{null.error}catch(r){var errorProto=getProto(getProto(r));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function doEval(r){var e;if("%AsyncFunction%"===r)e=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===r)e=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===r)e=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===r){var t=doEval("%AsyncGeneratorFunction%");t&&(e=t.prototype)}else if("%AsyncIteratorPrototype%"===r){var o=doEval("%AsyncGenerator%");o&&getProto&&(e=getProto(o.prototype))}return INTRINSICS[r]=e,e},LEGACY_ALIASES={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind=require(24),hasOwn=require(33),$concat=bind.call($call,Array.prototype.concat),$spliceApply=bind.call($apply,Array.prototype.splice),$replace=bind.call($call,String.prototype.replace),$strSlice=bind.call($call,String.prototype.slice),$exec=bind.call($call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function stringToPath(r){var e=$strSlice(r,0,1),t=$strSlice(r,-1);if("%"===e&&"%"!==t)throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");if("%"===t&&"%"!==e)throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");var o=[];return $replace(r,rePropName,(function(r,e,t,n){o[o.length]=t?$replace(n,reEscapeChar,"$1"):e||r})),o},getBaseIntrinsic=function getBaseIntrinsic(r,e){var t,o=r;if(hasOwn(LEGACY_ALIASES,o)&&(o="%"+(t=LEGACY_ALIASES[o])[0]+"%"),hasOwn(INTRINSICS,o)){var n=INTRINSICS[o];if(n===needsEval&&(n=doEval(o)),void 0===n&&!e)throw new $TypeError("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:t,name:o,value:n}}throw new $SyntaxError("intrinsic "+r+" does not exist!")};module.exports=function GetIntrinsic(r,e){if("string"!=typeof r||0===r.length)throw new $TypeError("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new $TypeError('"allowMissing" argument must be a boolean');if(null===$exec(/^%?[^%]*%?$/,r))throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var t=stringToPath(r),o=t.length>0?t[0]:"",n=getBaseIntrinsic("%"+o+"%",e),a=n.name,i=n.value,y=!1,p=n.alias;p&&(o=p[0],$spliceApply(t,$concat([0,1],p)));for(var s=1,d=!0;s=t.length){var c=$gOPD(i,f);i=(d=!!c)&&"get"in c&&!("originalValue"in c.get)?c.get:i[f]}else d=hasOwn(i,f),i=i[f];d&&!y&&(INTRINSICS[a]=i)}}return i}; - -},{"14":14,"15":15,"16":16,"17":17,"18":18,"19":19,"20":20,"21":21,"22":22,"24":24,"26":26,"27":27,"28":28,"30":30,"31":31,"33":33,"34":34,"35":35,"37":37,"38":38,"39":39,"40":40,"41":41,"8":8,"9":9}],13:[function(require,module,exports){ -"use strict";var hasProtoAccessor,callBind=require(10),gOPD=require(30);try{hasProtoAccessor=[].__proto__===Array.prototype}catch(t){if(!t||"object"!=typeof t||!("code"in t)||"ERR_PROTO_ACCESS"!==t.code)throw t}var desc=!!hasProtoAccessor&&gOPD&&gOPD(Object.prototype,"__proto__"),$Object=Object,$getPrototypeOf=$Object.getPrototypeOf;module.exports=desc&&"function"==typeof desc.get?callBind([desc.get]):"function"==typeof $getPrototypeOf&&function getDunder(t){return $getPrototypeOf(null==t?t:$Object(t))}; - -},{"10":10,"30":30}],30:[function(require,module,exports){ -"use strict";var $gOPD=require(29);if($gOPD)try{$gOPD([],"length")}catch(g){$gOPD=null}module.exports=$gOPD; - -},{"29":29}],14:[function(require,module,exports){ -"use strict";var $defineProperty=Object.defineProperty||!1;if($defineProperty)try{$defineProperty({},"a",{value:1})}catch(e){$defineProperty=!1}module.exports=$defineProperty; - -},{}],15:[function(require,module,exports){ -"use strict";module.exports=EvalError; - -},{}],16:[function(require,module,exports){ -"use strict";module.exports=Error; - -},{}],17:[function(require,module,exports){ -"use strict";module.exports=RangeError; - -},{}],18:[function(require,module,exports){ -"use strict";module.exports=ReferenceError; - },{}],19:[function(require,module,exports){ +"use strict";var implementation=require(18);module.exports=Function.prototype.bind||implementation; + +},{"18":18}],10:[function(require,module,exports){ +"use strict";var GetIntrinsic=require(20),$defineProperty=GetIntrinsic("%Object.defineProperty%",!0)||!1;if($defineProperty)try{$defineProperty({},"a",{value:1})}catch(e){$defineProperty=!1}module.exports=$defineProperty; + +},{"20":20}],28:[function(require,module,exports){ +"use strict";var GetIntrinsic=require(20),define=require(9),hasDescriptors=require(22)(),gOPD=require(21),$TypeError=require(16),$floor=GetIntrinsic("%Math.floor%");module.exports=function setFunctionLength(e,r){if("function"!=typeof e)throw new $TypeError("`fn` is not a function");if("number"!=typeof r||r<0||r>4294967295||$floor(r)!==r)throw new $TypeError("`length` must be a positive 32-bit integer");var t=arguments.length>2&&!!arguments[2],i=!0,n=!0;if("length"in e&&gOPD){var o=gOPD(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(n=!1)}return(i||n||!t)&&(hasDescriptors?define(e,"length",r,!0,!0):define(e,"length",r)),e}; + +},{"16":16,"20":20,"21":21,"22":22,"9":9}],9:[function(require,module,exports){ +"use strict";var $defineProperty=require(10),$SyntaxError=require(15),$TypeError=require(16),gopd=require(21);module.exports=function defineDataProperty(e,r,o){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new $TypeError("`obj` must be an object or a function`");if("string"!=typeof r&&"symbol"!=typeof r)throw new $TypeError("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new $TypeError("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new $TypeError("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,t=arguments.length>5?arguments[5]:null,i=arguments.length>6&&arguments[6],a=!!gopd&&gopd(e,r);if($defineProperty)$defineProperty(e,r,{configurable:null===t&&a?a.configurable:!t,enumerable:null===n&&a?a.enumerable:!n,value:o,writable:null===l&&a?a.writable:!l});else{if(!i&&(n||l||t))throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[r]=o}}; + +},{"10":10,"15":15,"16":16,"21":21}],15:[function(require,module,exports){ "use strict";module.exports=SyntaxError; },{}],21:[function(require,module,exports){ +"use strict";var GetIntrinsic=require(20),$gOPD=GetIntrinsic("%Object.getOwnPropertyDescriptor%",!0);if($gOPD)try{$gOPD([],"length")}catch(t){$gOPD=null}module.exports=$gOPD; + +},{"20":20}],11:[function(require,module,exports){ +"use strict";module.exports=EvalError; + +},{}],12:[function(require,module,exports){ +"use strict";module.exports=Error; + +},{}],13:[function(require,module,exports){ +"use strict";module.exports=RangeError; + +},{}],14:[function(require,module,exports){ +"use strict";module.exports=ReferenceError; + +},{}],17:[function(require,module,exports){ "use strict";module.exports=URIError; -},{}],22:[function(require,module,exports){ -"use strict";module.exports=Object; - -},{}],23:[function(require,module,exports){ +},{}],18:[function(require,module,exports){ "use strict";var ERROR_MESSAGE="Function.prototype.bind called on incompatible ",toStr=Object.prototype.toString,max=Math.max,funcType="[object Function]",concatty=function concatty(t,n){for(var r=[],o=0;o-1e3&&t<1e3||$test.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var n=t<0?-$floor(-t):$floor(t);if(n!==t){var o=String(n),i=$slice.call(e,o.length+1);return $replace.call(o,r,"$&_")+"."+$replace.call($replace.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return $replace.call(e,r,"$&_")}var utilInspect=require(6),inspectCustom=utilInspect.custom,inspectSymbol=isSymbol(inspectCustom)?inspectCustom:null,quotes={__proto__:null,double:'"',single:"'"},quoteREs={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function wrapQuotes(t,e,r){var n=r.quoteStyle||e,o=quotes[n];return o+t+o}function quote(t){return $replace.call(String(t),/"/g,""")}function isArray(t){return!("[object Array]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isDate(t){return!("[object Date]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isRegExp(t){return!("[object RegExp]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isError(t){return!("[object Error]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isString(t){return!("[object String]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isNumber(t){return!("[object Number]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isBoolean(t){return!("[object Boolean]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isSymbol(t){if(hasShammedSymbols)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!symToString)return!1;try{return symToString.call(t),!0}catch(t){}return!1}function isBigInt(t){if(!t||"object"!=typeof t||!bigIntValueOf)return!1;try{return bigIntValueOf.call(t),!0}catch(t){}return!1}module.exports=function inspect_(t,e,r,n){var o=e||{};if(has(o,"quoteStyle")&&!has(quotes,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(has(o,"maxStringLength")&&("number"==typeof o.maxStringLength?o.maxStringLength<0&&o.maxStringLength!==1/0:null!==o.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var i=!has(o,"customInspect")||o.customInspect;if("boolean"!=typeof i&&"symbol"!==i)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(has(o,"indent")&&null!==o.indent&&"\t"!==o.indent&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(has(o,"numericSeparator")&&"boolean"!=typeof o.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return inspectString(t,o);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var c=String(t);return a?addNumericSeparator(t,c):c}if("bigint"==typeof t){var l=String(t)+"n";return a?addNumericSeparator(t,l):l}var p=void 0===o.depth?5:o.depth;if(void 0===r&&(r=0),r>=p&&p>0&&"object"==typeof t)return isArray(t)?"[Array]":"[Object]";var u=getIndent(o,r);if(void 0===n)n=[];else if(indexOf(n,t)>=0)return"[Circular]";function inspect(t,e,i){if(e&&(n=$arrSlice.call(n)).push(e),i){var a={depth:o.depth};return has(o,"quoteStyle")&&(a.quoteStyle=o.quoteStyle),inspect_(t,a,r+1,n)}return inspect_(t,o,r+1,n)}if("function"==typeof t&&!isRegExp(t)){var s=nameOf(t),f=arrObjKeys(t,inspect);return"[Function"+(s?": "+s:" (anonymous)")+"]"+(f.length>0?" { "+$join.call(f,", ")+" }":"")}if(isSymbol(t)){var y=hasShammedSymbols?$replace.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):symToString.call(t);return"object"!=typeof t||hasShammedSymbols?y:markBoxed(y)}if(isElement(t)){for(var S="<"+$toLowerCase.call(String(t.nodeName)),g=t.attributes||[],b=0;b"}if(isArray(t)){if(0===t.length)return"[]";var m=arrObjKeys(t,inspect);return u&&!singleLineValues(m)?"["+indentedJoin(m,u)+"]":"[ "+$join.call(m,", ")+" ]"}if(isError(t)){var h=arrObjKeys(t,inspect);return"cause"in Error.prototype||!("cause"in t)||isEnumerable.call(t,"cause")?0===h.length?"["+String(t)+"]":"{ ["+String(t)+"] "+$join.call(h,", ")+" }":"{ ["+String(t)+"] "+$join.call($concat.call("[cause]: "+inspect(t.cause),h),", ")+" }"}if("object"==typeof t&&i){if(inspectSymbol&&"function"==typeof t[inspectSymbol]&&utilInspect)return utilInspect(t,{depth:p-r});if("symbol"!==i&&"function"==typeof t.inspect)return t.inspect()}if(isMap(t)){var d=[];return mapForEach&&mapForEach.call(t,(function(e,r){d.push(inspect(r,t,!0)+" => "+inspect(e,t))})),collectionOf("Map",mapSize.call(t),d,u)}if(isSet(t)){var j=[];return setForEach&&setForEach.call(t,(function(e){j.push(inspect(e,t))})),collectionOf("Set",setSize.call(t),j,u)}if(isWeakMap(t))return weakCollectionOf("WeakMap");if(isWeakSet(t))return weakCollectionOf("WeakSet");if(isWeakRef(t))return weakCollectionOf("WeakRef");if(isNumber(t))return markBoxed(inspect(Number(t)));if(isBigInt(t))return markBoxed(inspect(bigIntValueOf.call(t)));if(isBoolean(t))return markBoxed(booleanValueOf.call(t));if(isString(t))return markBoxed(inspect(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||"undefined"!=typeof global&&t===global)return"{ [object globalThis] }";if(!isDate(t)&&!isRegExp(t)){var O=arrObjKeys(t,inspect),w=gPO?gPO(t)===Object.prototype:t instanceof Object||t.constructor===Object,$=t instanceof Object?"":"null prototype",k=!w&&toStringTag&&Object(t)===t&&toStringTag in t?$slice.call(toStr(t),8,-1):$?"Object":"",v=(w||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(k||$?"["+$join.call($concat.call([],k||[],$||[]),": ")+"] ":"");return 0===O.length?v+"{}":u?v+"{"+indentedJoin(O,u)+"}":v+"{ "+$join.call(O,", ")+" }"}return String(t)};var hasOwn=Object.prototype.hasOwnProperty||function(t){return t in this};function has(t,e){return hasOwn.call(t,e)}function toStr(t){return objectToString.call(t)}function nameOf(t){if(t.name)return t.name;var e=$match.call(functionToString.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function indexOf(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return inspectString($slice.call(t,0,e.maxStringLength),e)+n}var o=quoteREs[e.quoteStyle||"single"];return o.lastIndex=0,wrapQuotes($replace.call($replace.call(t,o,"\\$1"),/[\x00-\x1f]/g,lowbyte),"single",e)}function lowbyte(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+$toUpperCase.call(e.toString(16))}function markBoxed(t){return"Object("+t+")"}function weakCollectionOf(t){return t+" { ? }"}function collectionOf(t,e,r,n){return t+" ("+e+") {"+(n?indentedJoin(r,n):$join.call(r,", "))+"}"}function singleLineValues(t){for(var e=0;e=0)return!1;return!0}function getIndent(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=$join.call(Array(t.indent+1)," ")}return{base:r,prev:$join.call(Array(e+1),r)}}function indentedJoin(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+$join.call(t,","+r)+"\n"+e.prev}function arrObjKeys(t,e){var r=isArray(t),n=[];if(r){n.length=t.length;for(var o=0;o-1e3&&t<1e3||$test.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var n=t<0?-$floor(-t):$floor(t);if(n!==t){var o=String(n),i=$slice.call(e,o.length+1);return $replace.call(o,r,"$&_")+"."+$replace.call($replace.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return $replace.call(e,r,"$&_")}var utilInspect=require(6),inspectCustom=utilInspect.custom,inspectSymbol=isSymbol(inspectCustom)?inspectCustom:null;function wrapQuotes(t,e,r){var n="double"===(r.quoteStyle||e)?'"':"'";return n+t+n}function quote(t){return $replace.call(String(t),/"/g,""")}function isArray(t){return!("[object Array]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isDate(t){return!("[object Date]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isRegExp(t){return!("[object RegExp]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isError(t){return!("[object Error]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isString(t){return!("[object String]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isNumber(t){return!("[object Number]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isBoolean(t){return!("[object Boolean]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isSymbol(t){if(hasShammedSymbols)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!symToString)return!1;try{return symToString.call(t),!0}catch(t){}return!1}function isBigInt(t){if(!t||"object"!=typeof t||!bigIntValueOf)return!1;try{return bigIntValueOf.call(t),!0}catch(t){}return!1}module.exports=function inspect_(t,e,r,n){var o=e||{};if(has(o,"quoteStyle")&&"single"!==o.quoteStyle&&"double"!==o.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(has(o,"maxStringLength")&&("number"==typeof o.maxStringLength?o.maxStringLength<0&&o.maxStringLength!==1/0:null!==o.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var i=!has(o,"customInspect")||o.customInspect;if("boolean"!=typeof i&&"symbol"!==i)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(has(o,"indent")&&null!==o.indent&&"\t"!==o.indent&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(has(o,"numericSeparator")&&"boolean"!=typeof o.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return inspectString(t,o);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var c=String(t);return a?addNumericSeparator(t,c):c}if("bigint"==typeof t){var l=String(t)+"n";return a?addNumericSeparator(t,l):l}var p=void 0===o.depth?5:o.depth;if(void 0===r&&(r=0),r>=p&&p>0&&"object"==typeof t)return isArray(t)?"[Array]":"[Object]";var u=getIndent(o,r);if(void 0===n)n=[];else if(indexOf(n,t)>=0)return"[Circular]";function inspect(t,e,i){if(e&&(n=$arrSlice.call(n)).push(e),i){var a={depth:o.depth};return has(o,"quoteStyle")&&(a.quoteStyle=o.quoteStyle),inspect_(t,a,r+1,n)}return inspect_(t,o,r+1,n)}if("function"==typeof t&&!isRegExp(t)){var f=nameOf(t),s=arrObjKeys(t,inspect);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(s.length>0?" { "+$join.call(s,", ")+" }":"")}if(isSymbol(t)){var y=hasShammedSymbols?$replace.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):symToString.call(t);return"object"!=typeof t||hasShammedSymbols?y:markBoxed(y)}if(isElement(t)){for(var S="<"+$toLowerCase.call(String(t.nodeName)),g=t.attributes||[],b=0;b"}if(isArray(t)){if(0===t.length)return"[]";var m=arrObjKeys(t,inspect);return u&&!singleLineValues(m)?"["+indentedJoin(m,u)+"]":"[ "+$join.call(m,", ")+" ]"}if(isError(t)){var h=arrObjKeys(t,inspect);return"cause"in Error.prototype||!("cause"in t)||isEnumerable.call(t,"cause")?0===h.length?"["+String(t)+"]":"{ ["+String(t)+"] "+$join.call(h,", ")+" }":"{ ["+String(t)+"] "+$join.call($concat.call("[cause]: "+inspect(t.cause),h),", ")+" }"}if("object"==typeof t&&i){if(inspectSymbol&&"function"==typeof t[inspectSymbol]&&utilInspect)return utilInspect(t,{depth:p-r});if("symbol"!==i&&"function"==typeof t.inspect)return t.inspect()}if(isMap(t)){var d=[];return mapForEach&&mapForEach.call(t,(function(e,r){d.push(inspect(r,t,!0)+" => "+inspect(e,t))})),collectionOf("Map",mapSize.call(t),d,u)}if(isSet(t)){var j=[];return setForEach&&setForEach.call(t,(function(e){j.push(inspect(e,t))})),collectionOf("Set",setSize.call(t),j,u)}if(isWeakMap(t))return weakCollectionOf("WeakMap");if(isWeakSet(t))return weakCollectionOf("WeakSet");if(isWeakRef(t))return weakCollectionOf("WeakRef");if(isNumber(t))return markBoxed(inspect(Number(t)));if(isBigInt(t))return markBoxed(inspect(bigIntValueOf.call(t)));if(isBoolean(t))return markBoxed(booleanValueOf.call(t));if(isString(t))return markBoxed(inspect(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||"undefined"!=typeof global&&t===global)return"{ [object globalThis] }";if(!isDate(t)&&!isRegExp(t)){var O=arrObjKeys(t,inspect),w=gPO?gPO(t)===Object.prototype:t instanceof Object||t.constructor===Object,$=t instanceof Object?"":"null prototype",k=!w&&toStringTag&&Object(t)===t&&toStringTag in t?$slice.call(toStr(t),8,-1):$?"Object":"",v=(w||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(k||$?"["+$join.call($concat.call([],k||[],$||[]),": ")+"] ":"");return 0===O.length?v+"{}":u?v+"{"+indentedJoin(O,u)+"}":v+"{ "+$join.call(O,", ")+" }"}return String(t)};var hasOwn=Object.prototype.hasOwnProperty||function(t){return t in this};function has(t,e){return hasOwn.call(t,e)}function toStr(t){return objectToString.call(t)}function nameOf(t){if(t.name)return t.name;var e=$match.call(functionToString.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function indexOf(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return inspectString($slice.call(t,0,e.maxStringLength),e)+n}return wrapQuotes($replace.call($replace.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lowbyte),"single",e)}function lowbyte(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+$toUpperCase.call(e.toString(16))}function markBoxed(t){return"Object("+t+")"}function weakCollectionOf(t){return t+" { ? }"}function collectionOf(t,e,r,n){return t+" ("+e+") {"+(n?indentedJoin(r,n):$join.call(r,", "))+"}"}function singleLineValues(t){for(var e=0;e=0)return!1;return!0}function getIndent(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=$join.call(Array(t.indent+1)," ")}return{base:r,prev:$join.call(Array(e+1),r)}}function indentedJoin(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+$join.call(t,","+r)+"\n"+e.prev}function arrObjKeys(t,e){var r=isArray(t),n=[];if(r){n.length=t.length;for(var o=0;o -1) { return val.split(','); } - if (options.throwOnLimitExceeded && currentArrayLength >= options.arrayLimit) { - throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.'); - } - return val; }; @@ -62,17 +57,8 @@ var parseValues = function parseQueryStringValues(str, options) { var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str; cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']'); - var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit; - var parts = cleanStr.split( - options.delimiter, - options.throwOnLimitExceeded ? limit + 1 : limit - ); - - if (options.throwOnLimitExceeded && parts.length > limit) { - throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.'); - } - + var parts = cleanStr.split(options.delimiter, limit); var skipIndex = -1; // Keep track of where the utf8 sentinel was found var i; @@ -100,20 +86,14 @@ var parseValues = function parseQueryStringValues(str, options) { var bracketEqualsPos = part.indexOf(']='); var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1; - var key; - var val; + var key, val; if (pos === -1) { key = options.decoder(part, defaults.decoder, charset, 'key'); val = options.strictNullHandling ? null : ''; } else { key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key'); - val = utils.maybeMap( - parseArrayValue( - part.slice(pos + 1), - options, - isArray(obj[key]) ? obj[key].length : 0 - ), + parseArrayValue(part.slice(pos + 1), options), function (encodedVal) { return options.decoder(encodedVal, defaults.decoder, charset, 'value'); } @@ -121,7 +101,7 @@ var parseValues = function parseQueryStringValues(str, options) { } if (val && options.interpretNumericEntities && charset === 'iso-8859-1') { - val = interpretNumericEntities(String(val)); + val = interpretNumericEntities(val); } if (part.indexOf('[]=') > -1) { @@ -140,13 +120,7 @@ var parseValues = function parseQueryStringValues(str, options) { }; var parseObject = function (chain, val, options, valuesParsed) { - var currentArrayLength = 0; - if (chain.length > 0 && chain[chain.length - 1] === '[]') { - var parentKey = chain.slice(0, -1).join(''); - currentArrayLength = Array.isArray(val) && val[parentKey] ? val[parentKey].length : 0; - } - - var leaf = valuesParsed ? val : parseArrayValue(val, options, currentArrayLength); + var leaf = valuesParsed ? val : parseArrayValue(val, options); for (var i = chain.length - 1; i >= 0; --i) { var obj; @@ -155,9 +129,9 @@ var parseObject = function (chain, val, options, valuesParsed) { if (root === '[]' && options.parseArrays) { obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null)) ? [] - : utils.combine([], leaf); + : [].concat(leaf); } else { - obj = options.plainObjects ? { __proto__: null } : {}; + obj = options.plainObjects ? Object.create(null) : {}; var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot; var index = parseInt(decodedRoot, 10); @@ -260,11 +234,6 @@ var normalizeParseOptions = function normalizeParseOptions(opts) { if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); } - - if (typeof opts.throwOnLimitExceeded !== 'undefined' && typeof opts.throwOnLimitExceeded !== 'boolean') { - throw new TypeError('`throwOnLimitExceeded` option must be a boolean'); - } - var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset; var duplicates = typeof opts.duplicates === 'undefined' ? defaults.duplicates : opts.duplicates; @@ -296,8 +265,7 @@ var normalizeParseOptions = function normalizeParseOptions(opts) { parseArrays: opts.parseArrays !== false, plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects, strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth, - strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling, - throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === 'boolean' ? opts.throwOnLimitExceeded : false + strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling }; }; @@ -305,11 +273,11 @@ module.exports = function (str, opts) { var options = normalizeParseOptions(opts); if (str === '' || str === null || typeof str === 'undefined') { - return options.plainObjects ? { __proto__: null } : {}; + return options.plainObjects ? Object.create(null) : {}; } var tempObj = typeof str === 'string' ? parseValues(str, options) : str; - var obj = options.plainObjects ? { __proto__: null } : {}; + var obj = options.plainObjects ? Object.create(null) : {}; // Iterate over the keys and setup the new object diff --git a/api/node_modules/qs/lib/stringify.js b/api/node_modules/qs/lib/stringify.js index 2666eaf..9b934d6 100644 --- a/api/node_modules/qs/lib/stringify.js +++ b/api/node_modules/qs/lib/stringify.js @@ -34,13 +34,11 @@ var defaults = { arrayFormat: 'indices', charset: 'utf-8', charsetSentinel: false, - commaRoundTrip: false, delimiter: '&', encode: true, encodeDotInKeys: false, encoder: utils.encode, encodeValuesOnly: false, - filter: void undefined, format: defaultFormat, formatter: formats.formatters[defaultFormat], // deprecated @@ -152,7 +150,7 @@ var stringify = function stringify( objKeys = sort ? keys.sort(sort) : keys; } - var encodedPrefix = encodeDotInKeys ? String(prefix).replace(/\./g, '%2E') : String(prefix); + var encodedPrefix = encodeDotInKeys ? prefix.replace(/\./g, '%2E') : prefix; var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + '[]' : encodedPrefix; @@ -162,15 +160,13 @@ var stringify = function stringify( for (var j = 0; j < objKeys.length; ++j) { var key = objKeys[j]; - var value = typeof key === 'object' && key && typeof key.value !== 'undefined' - ? key.value - : obj[key]; + var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key]; if (skipNulls && value === null) { continue; } - var encodedKey = allowDots && encodeDotInKeys ? String(key).replace(/\./g, '%2E') : String(key); + var encodedKey = allowDots && encodeDotInKeys ? key.replace(/\./g, '%2E') : key; var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? '.' + encodedKey : '[' + encodedKey + ']'); @@ -261,7 +257,7 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) { arrayFormat: arrayFormat, charset: charset, charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, - commaRoundTrip: !!opts.commaRoundTrip, + commaRoundTrip: opts.commaRoundTrip, delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter, encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode, encodeDotInKeys: typeof opts.encodeDotInKeys === 'boolean' ? opts.encodeDotInKeys : defaults.encodeDotInKeys, @@ -312,13 +308,12 @@ module.exports = function (object, opts) { var sideChannel = getSideChannel(); for (var i = 0; i < objKeys.length; ++i) { var key = objKeys[i]; - var value = obj[key]; - if (options.skipNulls && value === null) { + if (options.skipNulls && obj[key] === null) { continue; } pushToArray(keys, stringify( - value, + obj[key], key, generateArrayPrefix, commaRoundTrip, diff --git a/api/node_modules/qs/lib/utils.js b/api/node_modules/qs/lib/utils.js index 2905ff0..7c860f1 100644 --- a/api/node_modules/qs/lib/utils.js +++ b/api/node_modules/qs/lib/utils.js @@ -34,7 +34,7 @@ var compactQueue = function compactQueue(queue) { }; var arrayToObject = function arrayToObject(source, options) { - var obj = options && options.plainObjects ? { __proto__: null } : {}; + var obj = options && options.plainObjects ? Object.create(null) : {}; for (var i = 0; i < source.length; ++i) { if (typeof source[i] !== 'undefined') { obj[i] = source[i]; @@ -50,14 +50,11 @@ var merge = function merge(target, source, options) { return target; } - if (typeof source !== 'object' && typeof source !== 'function') { + if (typeof source !== 'object') { if (isArray(target)) { target.push(source); } else if (target && typeof target === 'object') { - if ( - (options && (options.plainObjects || options.allowPrototypes)) - || !has.call(Object.prototype, source) - ) { + if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) { target[source] = true; } } else { @@ -111,7 +108,7 @@ var assign = function assignSingleSource(target, source) { }, target); }; -var decode = function (str, defaultDecoder, charset) { +var decode = function (str, decoder, charset) { var strWithoutPlus = str.replace(/\+/g, ' '); if (charset === 'iso-8859-1') { // unescape never throws, no try...catch needed: diff --git a/api/node_modules/qs/package.json b/api/node_modules/qs/package.json index e4144d0..6dae052 100644 --- a/api/node_modules/qs/package.json +++ b/api/node_modules/qs/package.json @@ -2,7 +2,7 @@ "name": "qs", "description": "A querystring parser that supports nesting and arrays, with a depth limit", "homepage": "https://github.com/ljharb/qs", - "version": "6.14.0", + "version": "6.13.0", "repository": { "type": "git", "url": "https://github.com/ljharb/qs.git" @@ -31,7 +31,7 @@ "node": ">=0.6" }, "dependencies": { - "side-channel": "^1.1.0" + "side-channel": "^1.0.6" }, "devDependencies": { "@browserify/envify": "^6.0.0", @@ -41,29 +41,27 @@ "bundle-collapser": "^1.4.0", "common-shakeify": "~1.0.0", "eclint": "^2.8.1", - "es-value-fixtures": "^1.7.0", + "es-value-fixtures": "^1.4.2", "eslint": "=8.8.0", "evalmd": "^0.0.19", "for-each": "^0.3.3", "glob": "=10.3.7", - "has-bigints": "^1.1.0", "has-override-mistake": "^1.0.1", "has-property-descriptors": "^1.0.2", - "has-proto": "^1.2.0", - "has-symbols": "^1.1.0", + "has-symbols": "^1.0.3", "iconv-lite": "^0.5.1", "in-publish": "^2.0.1", "jackspeak": "=2.1.1", "mkdirp": "^0.5.5", - "mock-property": "^1.1.0", + "mock-property": "^1.0.3", "module-deps": "^6.2.3", "npmignore": "^0.3.1", "nyc": "^10.3.2", - "object-inspect": "^1.13.3", + "object-inspect": "^1.13.2", "qs-iconv": "^1.0.4", "safe-publish-latest": "^2.0.0", "safer-buffer": "^2.1.2", - "tape": "^5.9.0", + "tape": "^5.8.1", "unassertify": "^3.0.1" }, "scripts": { diff --git a/api/node_modules/qs/test/parse.js b/api/node_modules/qs/test/parse.js index 32cdfd8..8a2f487 100644 --- a/api/node_modules/qs/test/parse.js +++ b/api/node_modules/qs/test/parse.js @@ -9,7 +9,6 @@ var SaferBuffer = require('safer-buffer').Buffer; var v = require('es-value-fixtures'); var inspect = require('object-inspect'); var emptyTestCases = require('./empty-keys-cases').emptyTestCases; -var hasProto = require('has-proto')(); var qs = require('../'); var utils = require('../lib/utils'); @@ -118,7 +117,7 @@ test('parse()', function (t) { st.end(); }); - t.test('decodes dot in key of object, and allow enabling dot notation when decodeDotInKeys is set to true and allowDots is undefined', function (st) { + t.test('should decode dot in key of object, and allow enabling dot notation when decodeDotInKeys is set to true and allowDots is undefined', function (st) { st.deepEqual( qs.parse( 'name%252Eobj%252Esubobject.first%252Egodly%252Ename=John&name%252Eobj%252Esubobject.last=Doe', @@ -131,7 +130,7 @@ test('parse()', function (t) { st.end(); }); - t.test('throws when decodeDotInKeys is not of type boolean', function (st) { + t.test('should throw when decodeDotInKeys is not of type boolean', function (st) { st['throws']( function () { qs.parse('foo[]&bar=baz', { decodeDotInKeys: 'foobar' }); }, TypeError @@ -161,7 +160,7 @@ test('parse()', function (t) { st.end(); }); - t.test('throws when allowEmptyArrays is not of type boolean', function (st) { + t.test('should throw when allowEmptyArrays is not of type boolean', function (st) { st['throws']( function () { qs.parse('foo[]&bar=baz', { allowEmptyArrays: 'foobar' }); }, TypeError @@ -444,7 +443,7 @@ test('parse()', function (t) { st.end(); }); - t.test('does not throw when a native prototype has an enumerable property', function (st) { + t.test('should not throw when a native prototype has an enumerable property', function (st) { st.intercept(Object.prototype, 'crash', { value: '' }); st.intercept(Array.prototype, 'crash', { value: '' }); @@ -692,8 +691,9 @@ test('parse()', function (t) { st.end(); }); - t.test('parses null objects correctly', { skip: !hasProto }, function (st) { - var a = { __proto__: null, b: 'c' }; + t.test('parses null objects correctly', { skip: !Object.create }, function (st) { + var a = Object.create(null); + a.b = 'c'; st.deepEqual(qs.parse(a), { b: 'c' }); var result = qs.parse({ a: a }); @@ -870,25 +870,17 @@ test('parse()', function (t) { st.end(); }); - t.test('can return null objects', { skip: !hasProto }, function (st) { - var expected = { - __proto__: null, - a: { - __proto__: null, - b: 'c', - hasOwnProperty: 'd' - } - }; + t.test('can return null objects', { skip: !Object.create }, function (st) { + var expected = Object.create(null); + expected.a = Object.create(null); + expected.a.b = 'c'; + expected.a.hasOwnProperty = 'd'; st.deepEqual(qs.parse('a[b]=c&a[hasOwnProperty]=d', { plainObjects: true }), expected); - st.deepEqual(qs.parse(null, { plainObjects: true }), { __proto__: null }); - var expectedArray = { - __proto__: null, - a: { - __proto__: null, - 0: 'b', - c: 'd' - } - }; + st.deepEqual(qs.parse(null, { plainObjects: true }), Object.create(null)); + var expectedArray = Object.create(null); + expectedArray.a = Object.create(null); + expectedArray.a[0] = 'b'; + expectedArray.a.c = 'd'; st.deepEqual(qs.parse('a[]=b&a[c]=d', { plainObjects: true }), expectedArray); st.end(); }); @@ -965,7 +957,7 @@ test('parse()', function (t) { st.end(); }); - t.test('ignores an utf8 sentinel with an unknown value', function (st) { + t.test('should ignore an utf8 sentinel with an unknown value', function (st) { st.deepEqual(qs.parse('utf8=foo&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true, charset: 'utf-8' }), { ø: 'ø' }); st.end(); }); @@ -1006,15 +998,6 @@ test('parse()', function (t) { st.end(); }); - t.test('interpretNumericEntities with comma:true and iso charset does not crash', function (st) { - st.deepEqual( - qs.parse('b&a[]=1,' + urlEncodedNumSmiley, { comma: true, charset: 'iso-8859-1', interpretNumericEntities: true }), - { b: '', a: ['1,☺'] } - ); - - st.end(); - }); - t.test('does not interpret %uXXXX syntax in iso-8859-1 mode', function (st) { st.deepEqual(qs.parse('%u263A=%u263A', { charset: 'iso-8859-1' }), { '%u263A': '%u263A' }); st.end(); @@ -1035,95 +1018,6 @@ test('parse()', function (t) { st.end(); }); - t.test('parameter limit tests', function (st) { - st.test('does not throw error when within parameter limit', function (sst) { - var result = qs.parse('a=1&b=2&c=3', { parameterLimit: 5, throwOnLimitExceeded: true }); - sst.deepEqual(result, { a: '1', b: '2', c: '3' }, 'parses without errors'); - sst.end(); - }); - - st.test('throws error when throwOnLimitExceeded is present but not boolean', function (sst) { - sst['throws']( - function () { - qs.parse('a=1&b=2&c=3&d=4&e=5&f=6', { parameterLimit: 3, throwOnLimitExceeded: 'true' }); - }, - new TypeError('`throwOnLimitExceeded` option must be a boolean'), - 'throws error when throwOnLimitExceeded is present and not boolean' - ); - sst.end(); - }); - - st.test('throws error when parameter limit exceeded', function (sst) { - sst['throws']( - function () { - qs.parse('a=1&b=2&c=3&d=4&e=5&f=6', { parameterLimit: 3, throwOnLimitExceeded: true }); - }, - new RangeError('Parameter limit exceeded. Only 3 parameters allowed.'), - 'throws error when parameter limit is exceeded' - ); - sst.end(); - }); - - st.test('silently truncates when throwOnLimitExceeded is not given', function (sst) { - var result = qs.parse('a=1&b=2&c=3&d=4&e=5', { parameterLimit: 3 }); - sst.deepEqual(result, { a: '1', b: '2', c: '3' }, 'parses and truncates silently'); - sst.end(); - }); - - st.test('silently truncates when parameter limit exceeded without error', function (sst) { - var result = qs.parse('a=1&b=2&c=3&d=4&e=5', { parameterLimit: 3, throwOnLimitExceeded: false }); - sst.deepEqual(result, { a: '1', b: '2', c: '3' }, 'parses and truncates silently'); - sst.end(); - }); - - st.test('allows unlimited parameters when parameterLimit set to Infinity', function (sst) { - var result = qs.parse('a=1&b=2&c=3&d=4&e=5&f=6', { parameterLimit: Infinity }); - sst.deepEqual(result, { a: '1', b: '2', c: '3', d: '4', e: '5', f: '6' }, 'parses all parameters without truncation'); - sst.end(); - }); - - st.end(); - }); - - t.test('array limit tests', function (st) { - st.test('does not throw error when array is within limit', function (sst) { - var result = qs.parse('a[]=1&a[]=2&a[]=3', { arrayLimit: 5, throwOnLimitExceeded: true }); - sst.deepEqual(result, { a: ['1', '2', '3'] }, 'parses array without errors'); - sst.end(); - }); - - st.test('throws error when throwOnLimitExceeded is present but not boolean for array limit', function (sst) { - sst['throws']( - function () { - qs.parse('a[]=1&a[]=2&a[]=3&a[]=4', { arrayLimit: 3, throwOnLimitExceeded: 'true' }); - }, - new TypeError('`throwOnLimitExceeded` option must be a boolean'), - 'throws error when throwOnLimitExceeded is present and not boolean for array limit' - ); - sst.end(); - }); - - st.test('throws error when array limit exceeded', function (sst) { - sst['throws']( - function () { - qs.parse('a[]=1&a[]=2&a[]=3&a[]=4', { arrayLimit: 3, throwOnLimitExceeded: true }); - }, - new RangeError('Array limit exceeded. Only 3 elements allowed in an array.'), - 'throws error when array limit is exceeded' - ); - sst.end(); - }); - - st.test('converts array to object if length is greater than limit', function (sst) { - var result = qs.parse('a[1]=1&a[2]=2&a[3]=3&a[4]=4&a[5]=5&a[6]=6', { arrayLimit: 5 }); - - sst.deepEqual(result, { a: { 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6' } }, 'parses into object if array length is greater than limit'); - sst.end(); - }); - - st.end(); - }); - t.end(); }); @@ -1182,7 +1076,7 @@ test('qs strictDepth option - throw cases', function (t) { qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1, strictDepth: true }); }, RangeError, - 'throws RangeError' + 'Should throw RangeError' ); st.end(); }); @@ -1193,7 +1087,7 @@ test('qs strictDepth option - throw cases', function (t) { qs.parse('a[0][1][2][3][4]=b', { depth: 3, strictDepth: true }); }, RangeError, - 'throws RangeError' + 'Should throw RangeError' ); st.end(); }); @@ -1204,7 +1098,7 @@ test('qs strictDepth option - throw cases', function (t) { qs.parse('a[b][c][0][d][e]=f', { depth: 3, strictDepth: true }); }, RangeError, - 'throws RangeError' + 'Should throw RangeError' ); st.end(); }); @@ -1215,7 +1109,7 @@ test('qs strictDepth option - throw cases', function (t) { qs.parse('a[b][c][d][e]=true&a[b][c][d][f]=42', { depth: 3, strictDepth: true }); }, RangeError, - 'throws RangeError' + 'Should throw RangeError' ); st.end(); }); @@ -1229,7 +1123,7 @@ test('qs strictDepth option - non-throw cases', function (t) { qs.parse('a[b][c][d][e]=true&a[b][c][d][f]=42', { depth: 0, strictDepth: true }); }, RangeError, - 'does not throw RangeError' + 'Should not throw RangeError' ); st.end(); }); @@ -1238,7 +1132,7 @@ test('qs strictDepth option - non-throw cases', function (t) { st.doesNotThrow( function () { var result = qs.parse('a[b]=c', { depth: 1, strictDepth: true }); - st.deepEqual(result, { a: { b: 'c' } }, 'parses correctly'); + st.deepEqual(result, { a: { b: 'c' } }, 'Should parse correctly'); } ); st.end(); @@ -1248,7 +1142,7 @@ test('qs strictDepth option - non-throw cases', function (t) { st.doesNotThrow( function () { var result = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 }); - st.deepEqual(result, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }, 'parses with depth limit'); + st.deepEqual(result, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }, 'Should parse with depth limit'); } ); st.end(); @@ -1258,7 +1152,7 @@ test('qs strictDepth option - non-throw cases', function (t) { st.doesNotThrow( function () { var result = qs.parse('a[b]=c', { depth: 1 }); - st.deepEqual(result, { a: { b: 'c' } }, 'parses correctly'); + st.deepEqual(result, { a: { b: 'c' } }, 'Should parse correctly'); } ); st.end(); @@ -1268,7 +1162,7 @@ test('qs strictDepth option - non-throw cases', function (t) { st.doesNotThrow( function () { var result = qs.parse('a[b][c]=d', { depth: 2, strictDepth: true }); - st.deepEqual(result, { a: { b: { c: 'd' } } }, 'parses correctly'); + st.deepEqual(result, { a: { b: { c: 'd' } } }, 'Should parse correctly'); } ); st.end(); diff --git a/api/node_modules/qs/test/stringify.js b/api/node_modules/qs/test/stringify.js index 7253144..12b1c71 100644 --- a/api/node_modules/qs/test/stringify.js +++ b/api/node_modules/qs/test/stringify.js @@ -8,8 +8,7 @@ var SaferBuffer = require('safer-buffer').Buffer; var hasSymbols = require('has-symbols'); var mockProperty = require('mock-property'); var emptyTestCases = require('./empty-keys-cases').emptyTestCases; -var hasProto = require('has-proto')(); -var hasBigInt = require('has-bigints')(); +var hasBigInt = typeof BigInt === 'function'; test('stringify()', function (t) { t.test('stringifies a querystring object', function (st) { @@ -651,8 +650,10 @@ test('stringify()', function (t) { st.end(); }); - t.test('stringifies a null object', { skip: !hasProto }, function (st) { - st.equal(qs.stringify({ __proto__: null, a: 'b' }), 'a=b'); + t.test('stringifies a null object', { skip: !Object.create }, function (st) { + var obj = Object.create(null); + obj.a = 'b'; + st.equal(qs.stringify(obj), 'a=b'); st.end(); }); @@ -664,8 +665,11 @@ test('stringify()', function (t) { st.end(); }); - t.test('stringifies an object with a null object as a child', { skip: !hasProto }, function (st) { - st.equal(qs.stringify({ a: { __proto__: null, b: 'c' } }), 'a%5Bb%5D=c'); + t.test('stringifies an object with a null object as a child', { skip: !Object.create }, function (st) { + var obj = { a: Object.create(null) }; + + obj.a.b = 'c'; + st.equal(qs.stringify(obj), 'a%5Bb%5D=c'); st.end(); }); @@ -1250,7 +1254,7 @@ test('stringify()', function (t) { }; st.equal( - qs.stringify(obj, { arrayFormat: 'brackets', charset: 'utf-8' }), + qs.stringify(obj, { arrayFormat: 'bracket', charset: 'utf-8' }), 'foo=' + expected.join('') ); @@ -1291,16 +1295,4 @@ test('stringifies empty keys', function (t) { st.end(); }); - - t.test('stringifies non-string keys', function (st) { - var actual = qs.stringify({ a: 'b', 'false': {} }, { - filter: ['a', false, null], - allowDots: true, - encodeDotInKeys: true - }); - - st.equal(actual, 'a=b', 'stringifies correctly'); - - st.end(); - }); }); diff --git a/api/node_modules/qs/test/utils.js b/api/node_modules/qs/test/utils.js index 3933516..aa84dfd 100644 --- a/api/node_modules/qs/test/utils.js +++ b/api/node_modules/qs/test/utils.js @@ -4,8 +4,6 @@ var test = require('tape'); var inspect = require('object-inspect'); var SaferBuffer = require('safer-buffer').Buffer; var forEach = require('for-each'); -var v = require('es-value-fixtures'); - var utils = require('../lib/utils'); test('merge()', function (t) { @@ -30,20 +28,6 @@ test('merge()', function (t) { var noOptionsNonObjectSource = utils.merge({ foo: 'baz' }, 'bar'); t.deepEqual(noOptionsNonObjectSource, { foo: 'baz', bar: true }); - var func = function f() {}; - t.deepEqual( - utils.merge(func, { foo: 'bar' }), - [func, { foo: 'bar' }], - 'functions can not be merged into' - ); - - func.bar = 'baz'; - t.deepEqual( - utils.merge({ foo: 'bar' }, func), - { foo: 'bar', bar: 'baz' }, - 'functions can be merge sources' - ); - t.test( 'avoids invoking array setters unnecessarily', { skip: typeof Object.defineProperty !== 'function' }, @@ -135,104 +119,6 @@ test('combine()', function (t) { t.end(); }); -test('decode', function (t) { - t.equal( - utils.decode('a+b'), - 'a b', - 'decodes + to space' - ); - - t.equal( - utils.decode('name%2Eobj'), - 'name.obj', - 'decodes a string' - ); - t.equal( - utils.decode('name%2Eobj%2Efoo', null, 'iso-8859-1'), - 'name.obj.foo', - 'decodes a string in iso-8859-1' - ); - - t.end(); -}); - -test('encode', function (t) { - forEach(v.nullPrimitives, function (nullish) { - t['throws']( - function () { utils.encode(nullish); }, - TypeError, - inspect(nullish) + ' is not a string' - ); - }); - - t.equal(utils.encode(''), '', 'empty string returns itself'); - t.deepEqual(utils.encode([]), [], 'empty array returns itself'); - t.deepEqual(utils.encode({ length: 0 }), { length: 0 }, 'empty arraylike returns itself'); - - t.test('symbols', { skip: !v.hasSymbols }, function (st) { - st.equal(utils.encode(Symbol('x')), 'Symbol%28x%29', 'symbol is encoded'); - - st.end(); - }); - - t.equal( - utils.encode('(abc)'), - '%28abc%29', - 'encodes parentheses' - ); - t.equal( - utils.encode({ toString: function () { return '(abc)'; } }), - '%28abc%29', - 'toStrings and encodes parentheses' - ); - - t.equal( - utils.encode('abc 123 💩', null, 'iso-8859-1'), - 'abc%20123%20%26%2355357%3B%26%2356489%3B', - 'encodes in iso-8859-1' - ); - - var longString = ''; - var expectedString = ''; - for (var i = 0; i < 1500; i++) { - longString += ' '; - expectedString += '%20'; - } - - t.equal( - utils.encode(longString), - expectedString, - 'encodes a long string' - ); - - t.equal( - utils.encode('\x28\x29'), - '%28%29', - 'encodes parens normally' - ); - t.equal( - utils.encode('\x28\x29', null, null, null, 'RFC1738'), - '()', - 'does not encode parens in RFC1738' - ); - - // todo RFC1738 format - - t.equal( - utils.encode('Āက豈'), - '%C4%80%E1%80%80%EF%A4%80', - 'encodes multibyte chars' - ); - - t.equal( - utils.encode('\uD83D \uDCA9'), - '%F0%9F%90%A0%F0%BA%90%80', - 'encodes lone surrogates' - ); - - t.end(); -}); - test('isBuffer()', function (t) { forEach([null, undefined, true, false, '', 'abc', 42, 0, NaN, {}, [], function () {}, /a/g], function (x) { t.equal(utils.isBuffer(x), false, inspect(x) + ' is not a buffer'); @@ -248,15 +134,3 @@ test('isBuffer()', function (t) { t.equal(utils.isBuffer(buffer), true, 'real Buffer instance is a buffer'); t.end(); }); - -test('isRegExp()', function (t) { - t.equal(utils.isRegExp(/a/g), true, 'RegExp is a RegExp'); - t.equal(utils.isRegExp(new RegExp('a', 'g')), true, 'new RegExp is a RegExp'); - t.equal(utils.isRegExp(new Date()), false, 'Date is not a RegExp'); - - forEach(v.primitives, function (primitive) { - t.equal(utils.isRegExp(primitive), false, inspect(primitive) + ' is not a RegExp'); - }); - - t.end(); -}); diff --git a/api/node_modules/raw-body/HISTORY.md b/api/node_modules/raw-body/HISTORY.md index a53dc9c..baf0e2d 100644 --- a/api/node_modules/raw-body/HISTORY.md +++ b/api/node_modules/raw-body/HISTORY.md @@ -1,20 +1,3 @@ -3.0.0 / 2024-07-25 -================== - - * deps: iconv-lite@0.6.3 - - Fix HKSCS encoding to prefer Big5 codes - - Fix minor issue in UTF-32 decoder's endianness detection code - - Update 'gb18030' encoding to :2005 edition - -3.0.0-beta.1 / 2023-02-21 -========================= - - * Change TypeScript argument to `NodeJS.ReadableStream` interface - * Drop support for Node.js 0.8 - * deps: iconv-lite@0.5.2 - - Add encoding cp720 - - Add encoding UTF-32 - 2.5.2 / 2023-02-21 ================== diff --git a/api/node_modules/raw-body/index.d.ts b/api/node_modules/raw-body/index.d.ts index b504611..dcbbebd 100644 --- a/api/node_modules/raw-body/index.d.ts +++ b/api/node_modules/raw-body/index.d.ts @@ -1,3 +1,5 @@ +import { Readable } from 'stream'; + declare namespace getRawBody { export type Encoding = string | true; @@ -56,29 +58,29 @@ declare namespace getRawBody { * limit. Ideal for parsing request bodies. */ declare function getRawBody( - stream: NodeJS.ReadableStream, + stream: Readable, callback: (err: getRawBody.RawBodyError, body: Buffer) => void ): void; declare function getRawBody( - stream: NodeJS.ReadableStream, + stream: Readable, options: (getRawBody.Options & { encoding: getRawBody.Encoding }) | getRawBody.Encoding, callback: (err: getRawBody.RawBodyError, body: string) => void ): void; declare function getRawBody( - stream: NodeJS.ReadableStream, + stream: Readable, options: getRawBody.Options, callback: (err: getRawBody.RawBodyError, body: Buffer) => void ): void; declare function getRawBody( - stream: NodeJS.ReadableStream, + stream: Readable, options: (getRawBody.Options & { encoding: getRawBody.Encoding }) | getRawBody.Encoding ): Promise; declare function getRawBody( - stream: NodeJS.ReadableStream, + stream: Readable, options?: getRawBody.Options ): Promise; diff --git a/api/node_modules/raw-body/package.json b/api/node_modules/raw-body/package.json index 5bc7165..aabb1c3 100644 --- a/api/node_modules/raw-body/package.json +++ b/api/node_modules/raw-body/package.json @@ -1,7 +1,7 @@ { "name": "raw-body", "description": "Get and validate the raw body of a readable stream.", - "version": "3.0.0", + "version": "2.5.2", "author": "Jonathan Ong (http://jongleberry.com)", "contributors": [ "Douglas Christopher Wilson ", @@ -12,20 +12,20 @@ "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", - "iconv-lite": "0.6.3", + "iconv-lite": "0.4.24", "unpipe": "1.0.0" }, "devDependencies": { "bluebird": "3.7.2", - "eslint": "8.57.0", + "eslint": "8.34.0", "eslint-config-standard": "15.0.1", - "eslint-plugin-import": "2.29.1", + "eslint-plugin-import": "2.27.5", "eslint-plugin-markdown": "3.0.0", "eslint-plugin-node": "11.1.0", - "eslint-plugin-promise": "6.6.0", + "eslint-plugin-promise": "6.1.1", "eslint-plugin-standard": "4.1.0", - "mocha": "10.7.0", - "nyc": "17.0.0", + "mocha": "10.2.0", + "nyc": "15.1.0", "readable-stream": "2.3.7", "safe-buffer": "5.2.1" }, @@ -44,7 +44,6 @@ "lint": "eslint .", "test": "mocha --trace-deprecation --reporter spec --bail --check-leaks 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" + "test-cov": "nyc --reporter=html --reporter=text npm test" } } diff --git a/api/node_modules/router/HISTORY.md b/api/node_modules/router/HISTORY.md deleted file mode 100644 index b292257..0000000 --- a/api/node_modules/router/HISTORY.md +++ /dev/null @@ -1,228 +0,0 @@ -2.2.0 / 2025-03-26 -================== - -* Remove `setImmediate` support check -* Restore `debug` dependency - -2.1.0 / 2025-02-10 -================== - -* Updated `engines` field to Node@18 or higher -* Remove `Object.setPrototypeOf` polyfill -* Use `Array.flat` instead of `array-flatten` package -* Replace `methods` dependency with standard library -* deps: parseurl@^1.3.3 -* deps: is-promise@^4.0.0 -* Replace `utils-merge` dependency with `Object.assign` -* deps: Remove unused dep `after` - -2.0.0 / 2024-09-09 -================== - -* Drop support for node <18 -* deps: path-to-regexp@^8.0.0 - - Drop support for partial capture group `router.route('/user(s?)/:user/:op')` but still have optional non-capture `/user{s}/:user/:op` - - `:name?` becomes `{:name}` - - `:name*` becomes `*name`. - - The splat change also changes splat from strings to an array of strings - - Optional splats become `{*name}` - - `:name+` becomes `*name` and thus equivalent to `*name` so I dropped those tests - - Strings as regular expressions are fully removed, need to be converted to native regular expressions - -2.0.0-beta.2 / 2024-03-20 -========================= - -This incorporates all changes after 1.3.5 up to 1.3.8. - - * Add support for returned, rejected Promises to `router.param` - -2.0.0-beta.1 / 2020-03-29 -========================= - -This incorporates all changes after 1.3.3 up to 1.3.5. - - * Internalize private `router.process_params` method - * Remove `debug` dependency - * deps: array-flatten@3.0.0 - * deps: parseurl@~1.3.3 - * deps: path-to-regexp@3.2.0 - - Add new `?`, `*`, and `+` parameter modifiers. - - Matching group expressions are only RegExp syntax. - `(*)` is no longer valid and must be written as `(.*)`, for example. - - Named matching groups no longer available by position in `req.params`. - `/:foo(.*)` only captures as `req.params.foo` and not available as - `req.params[0]`. - - Regular expressions can only be used in a matching group. - `/\\d+` is no longer valid and must be written as `/(\\d+)`. - - Matching groups are now literal regular expressions. - `:foo` named captures can no longer be included inside a capture group. - - Special `*` path segment behavior removed. - `/foo/*/bar` will match a literal `*` as the middle segment. - * deps: setprototypeof@1.2.0 - -2.0.0-alpha.1 / 2018-07-27 -========================== - - * Add basic support for returned, rejected Promises - - Rejected Promises from middleware functions `next(error)` - * Drop support for Node.js below 0.10 - * 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 - -1.3.8 / 2023-02-24 -================== - - * Fix routing requests without method - -1.3.7 / 2022-04-28 -================== - - * Fix hanging on large stack of sync routes - -1.3.6 / 2021-11-15 -================== - - * Fix handling very large stacks of sync middleware - * deps: safe-buffer@5.2.1 - -1.3.5 / 2020-03-24 -================== - - * Fix incorrect middleware execution with unanchored `RegExp`s - * perf: use plain object for internal method map - -1.3.4 / 2020-01-24 -================== - - * deps: array-flatten@3.0.0 - * deps: parseurl@~1.3.3 - * deps: setprototypeof@1.2.0 - -1.3.3 / 2018-07-06 -================== - - * Fix JSDoc for `Router` constructor - -1.3.2 / 2017-09-24 -================== - - * deps: debug@2.6.9 - * deps: parseurl@~1.3.2 - - perf: reduce overhead for full URLs - - perf: unroll the "fast-path" `RegExp` - * deps: setprototypeof@1.1.0 - * deps: utils-merge@1.0.1 - -1.3.1 / 2017-05-19 -================== - - * deps: debug@2.6.8 - - Fix `DEBUG_MAX_ARRAY_LENGTH` - - deps: ms@2.0.0 - -1.3.0 / 2017-02-25 -================== - - * Add `next("router")` to exit from router - * Fix case where `router.use` skipped requests routes did not - * Use `%o` in path debug to tell types apart - * deps: setprototypeof@1.0.3 - * perf: add fast match path for `*` route - -1.2.0 / 2017-02-17 -================== - - * Skip routing when `req.url` is not set - * deps: debug@2.6.1 - - Allow colors in workers - - Deprecated `DEBUG_FD` environment variable set to `3` or higher - - Fix error when running under React Native - - Use same color for same namespace - - deps: ms@0.7.2 - -1.1.5 / 2017-01-28 -================== - - * deps: array-flatten@2.1.1 - * deps: setprototypeof@1.0.2 - - Fix using fallback even when native method exists - -1.1.4 / 2016-01-21 -================== - - * deps: array-flatten@2.0.0 - * deps: methods@~1.1.2 - - perf: enable strict mode - * deps: parseurl@~1.3.1 - - perf: enable strict mode - -1.1.3 / 2015-08-02 -================== - - * Fix infinite loop condition using `mergeParams: true` - * Fix inner numeric indices incorrectly altering parent `req.params` - * deps: array-flatten@1.1.1 - - perf: enable strict mode - * deps: path-to-regexp@0.1.7 - - Fix regression with escaped round brackets and matching groups - -1.1.2 / 2015-07-06 -================== - - * Fix hiding platform issues with `decodeURIComponent` - - Only `URIError`s are a 400 - * Fix using `*` before params in routes - * Fix using capture groups before params in routes - * deps: path-to-regexp@0.1.6 - * perf: enable strict mode - * perf: remove argument reassignments in routing - * perf: skip attempting to decode zero length string - * perf: use plain for loops - -1.1.1 / 2015-05-25 -================== - - * Fix issue where `next('route')` in `router.param` would incorrectly skip values - * deps: array-flatten@1.1.0 - * deps: debug@~2.2.0 - - deps: ms@0.7.1 - -1.1.0 / 2015-04-22 -================== - - * Use `setprototypeof` instead of `__proto__` - * deps: debug@~2.1.3 - - Fix high intensity foreground color for bold - - deps: ms@0.7.0 - -1.0.0 / 2015-01-13 -================== - - * Fix crash from error within `OPTIONS` response handler - * deps: array-flatten@1.0.2 - - Remove redundant code path - -1.0.0-beta.3 / 2015-01-11 -========================= - - * Fix duplicate methods appearing in OPTIONS responses - * Fix OPTIONS responses to include the HEAD method properly - * Remove support for leading colon in `router.param(name, fn)` - * Use `array-flatten` for flattening arrays - * deps: debug@~2.1.1 - * deps: methods@~1.1.1 - -1.0.0-beta.2 / 2014-11-19 -========================= - - * Match routes iteratively to prevent stack overflows - -1.0.0-beta.1 / 2014-11-16 -========================= - - * Initial release ported from Express 4.x - - Altered to work without Express diff --git a/api/node_modules/router/LICENSE b/api/node_modules/router/LICENSE deleted file mode 100644 index 237e1b6..0000000 --- a/api/node_modules/router/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -(The MIT License) - -Copyright (c) 2013 Roman Shtylman -Copyright (c) 2014-2022 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/api/node_modules/router/README.md b/api/node_modules/router/README.md deleted file mode 100644 index 218fd57..0000000 --- a/api/node_modules/router/README.md +++ /dev/null @@ -1,416 +0,0 @@ -# router - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][ci-image]][ci-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Simple middleware-style router - -## 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 router -``` - -## API - -```js -var finalhandler = require('finalhandler') -var http = require('http') -var Router = require('router') - -var router = Router() -router.get('/', function (req, res) { - res.setHeader('Content-Type', 'text/plain; charset=utf-8') - res.end('Hello World!') -}) - -var server = http.createServer(function (req, res) { - router(req, res, finalhandler(req, res)) -}) - -server.listen(3000) -``` - -This module is currently an extracted version from the Express project, -but with the main change being it can be used with a plain `http.createServer` -object or other web frameworks by removing Express-specific API calls. - -## Router(options) - -Options - -- `strict` - When `false` trailing slashes are optional (default: `false`) -- `caseSensitive` - When `true` the routing will be case sensitive. (default: `false`) -- `mergeParams` - When `true` any `req.params` passed to the router will be - merged into the router's `req.params`. (default: `false`) ([example](#example-using-mergeparams)) - -Returns a function with the signature `router(req, res, callback)` where -`callback([err])` must be provided to handle errors and fall-through from -not handling requests. - -### router.use([path], ...middleware) - -Use the given [middleware function](#middleware) for all http methods on the -given `path`, defaulting to the root path. - -`router` does not automatically see `use` as a handler. As such, it will not -consider it one for handling `OPTIONS` requests. - -* Note: If a `path` is specified, that `path` is stripped from the start of - `req.url`. - - - -```js -router.use(function (req, res, next) { - // do your things - - // continue to the next middleware - // the request will stall if this is not called - next() - - // note: you should NOT call `next` if you have begun writing to the response -}) -``` - -[Middleware](#middleware) can themselves use `next('router')` at any time to -exit the current router instance completely, invoking the top-level callback. - -### router\[method](path, ...[middleware], handler) - -The [http methods](https://github.com/jshttp/methods/blob/master/index.js) provide -the routing functionality in `router`. - -Method middleware and handlers follow usual [middleware](#middleware) behavior, -except they will only be called when the method and path match the request. - - - -```js -// handle a `GET` request -router.get('/', function (req, res) { - res.setHeader('Content-Type', 'text/plain; charset=utf-8') - res.end('Hello World!') -}) -``` - -[Middleware](#middleware) given before the handler have one additional trick, -they may invoke `next('route')`. Calling `next('route')` bypasses the remaining -middleware and the handler mounted for this route, passing the request to the -next route suitable for handling this request. - -Route handlers and middleware can themselves use `next('router')` at any time -to exit the current router instance completely, invoking the top-level callback. - -### router.param(name, param_middleware) - -Maps the specified path parameter `name` to a specialized param-capturing middleware. - -This function positions the middleware in the same stack as `.use`. - -The function can optionally return a `Promise` object. If a `Promise` object -is returned from the function, the router will attach an `onRejected` callback -using `.then`. If the promise is rejected, `next` will be called with the -rejected value, or an error if the value is falsy. - -Parameter mapping is used to provide pre-conditions to routes -which use normalized placeholders. For example a _:user_id_ parameter -could automatically load a user's information from the database without -any additional code: - - - -```js -router.param('user_id', function (req, res, next, id) { - User.find(id, function (err, user) { - if (err) { - return next(err) - } else if (!user) { - return next(new Error('failed to load user')) - } - req.user = user - - // continue processing the request - next() - }) -}) -``` - -### router.route(path) - -Creates an instance of a single `Route` for the given `path`. -(See `Router.Route` below) - -Routes can be used to handle http `methods` with their own, optional middleware. - -Using `router.route(path)` is a recommended approach to avoiding duplicate -route naming and thus typo errors. - - - -```js -var api = router.route('/api/') -``` - -## Router.Route(path) - -Represents a single route as an instance that can be used to handle http -`methods` with it's own, optional middleware. - -### route\[method](handler) - -These are functions which you can directly call on a route to register a new -`handler` for the `method` on the route. - - - -```js -// handle a `GET` request -var status = router.route('/status') - -status.get(function (req, res) { - res.setHeader('Content-Type', 'text/plain; charset=utf-8') - res.end('All Systems Green!') -}) -``` - -### route.all(handler) - -Adds a handler for all HTTP methods to this route. - -The handler can behave like middleware and call `next` to continue processing -rather than responding. - - - -```js -router.route('/') - .all(function (req, res, next) { - next() - }) - .all(checkSomething) - .get(function (req, res) { - res.setHeader('Content-Type', 'text/plain; charset=utf-8') - res.end('Hello World!') - }) -``` - -## Middleware - -Middleware (and method handlers) are functions that follow specific function -parameters and have defined behavior when used with `router`. The most common -format is with three parameters - "req", "res" and "next". - -- `req` - This is a [HTTP incoming message](https://nodejs.org/api/http.html#http_http_incomingmessage) instance. -- `res` - This is a [HTTP server response](https://nodejs.org/api/http.html#http_class_http_serverresponse) instance. -- `next` - Calling this function that tells `router` to proceed to the next matching middleware or method handler. It accepts an error as the first argument. - -The function can optionally return a `Promise` object. If a `Promise` object -is returned from the function, the router will attach an `onRejected` callback -using `.then`. If the promise is rejected, `next` will be called with the -rejected value, or an error if the value is falsy. - -Middleware and method handlers can also be defined with four arguments. When -the function has four parameters defined, the first argument is an error and -subsequent arguments remain, becoming - "err", "req", "res", "next". These -functions are "error handling middleware", and can be used for handling -errors that occurred in previous handlers (E.g. from calling `next(err)`). -This is most used when you want to define arbitrary rendering of errors. - - - -```js -router.get('/error_route', function (req, res, next) { - return next(new Error('Bad Request')) -}) - -router.use(function (err, req, res, next) { - res.end(err.message) //= > "Bad Request" -}) -``` - -Error handling middleware will **only** be invoked when an error was given. As -long as the error is in the pipeline, normal middleware and handlers will be -bypassed - only error handling middleware will be invoked with an error. - -## Examples - -```js -// import our modules -var http = require('http') -var Router = require('router') -var finalhandler = require('finalhandler') -var compression = require('compression') -var bodyParser = require('body-parser') - -// store our message to display -var message = 'Hello World!' - -// initialize the router & server and add a final callback. -var router = Router() -var server = http.createServer(function onRequest (req, res) { - router(req, res, finalhandler(req, res)) -}) - -// use some middleware and compress all outgoing responses -router.use(compression()) - -// handle `GET` requests to `/message` -router.get('/message', function (req, res) { - res.statusCode = 200 - res.setHeader('Content-Type', 'text/plain; charset=utf-8') - res.end(message + '\n') -}) - -// create and mount a new router for our API -var api = Router() -router.use('/api/', api) - -// add a body parsing middleware to our API -api.use(bodyParser.json()) - -// handle `PATCH` requests to `/api/set-message` -api.patch('/set-message', function (req, res) { - if (req.body.value) { - message = req.body.value - - res.statusCode = 200 - res.setHeader('Content-Type', 'text/plain; charset=utf-8') - res.end(message + '\n') - } else { - res.statusCode = 400 - res.setHeader('Content-Type', 'text/plain; charset=utf-8') - res.end('Invalid API Syntax\n') - } -}) - -// make our http server listen to connections -server.listen(8080) -``` - -You can get the message by running this command in your terminal, - or navigating to `127.0.0.1:8080` in a web browser. -```bash -curl http://127.0.0.1:8080 -``` - -You can set the message by sending it a `PATCH` request via this command: -```bash -curl http://127.0.0.1:8080/api/set-message -X PATCH -H "Content-Type: application/json" -d '{"value":"Cats!"}' -``` - -### Example using mergeParams - -```js -var http = require('http') -var Router = require('router') -var finalhandler = require('finalhandler') - -// this example is about the mergeParams option -var opts = { mergeParams: true } - -// make a router with out special options -var router = Router(opts) -var server = http.createServer(function onRequest (req, res) { - // set something to be passed into the router - req.params = { type: 'kitten' } - - router(req, res, finalhandler(req, res)) -}) - -router.get('/', function (req, res) { - res.statusCode = 200 - res.setHeader('Content-Type', 'text/plain; charset=utf-8') - - // with respond with the the params that were passed in - res.end(req.params.type + '\n') -}) - -// make another router with our options -var handler = Router(opts) - -// mount our new router to a route that accepts a param -router.use('/:path', handler) - -handler.get('/', function (req, res) { - res.statusCode = 200 - res.setHeader('Content-Type', 'text/plain; charset=utf-8') - - // will respond with the param of the router's parent route - res.end(req.params.path + '\n') -}) - -// make our http server listen to connections -server.listen(8080) -``` - -Now you can get the type, or what path you are requesting: -```bash -curl http://127.0.0.1:8080 -> kitten -curl http://127.0.0.1:8080/such_path -> such_path -``` - -### Example of advanced `.route()` usage - -This example shows how to implement routes where there is a custom -handler to execute when the path matched, but no methods matched. -Without any special handling, this would be treated as just a -generic non-match by `router` (which typically results in a 404), -but with a custom handler, a `405 Method Not Allowed` can be sent. - -```js -var http = require('http') -var finalhandler = require('finalhandler') -var Router = require('router') - -// create the router and server -var router = new Router() -var server = http.createServer(function onRequest (req, res) { - router(req, res, finalhandler(req, res)) -}) - -// register a route and add all methods -router.route('/pet/:id') - .get(function (req, res) { - // this is GET /pet/:id - res.setHeader('Content-Type', 'application/json') - res.end(JSON.stringify({ name: 'tobi' })) - }) - .delete(function (req, res) { - // this is DELETE /pet/:id - res.end() - }) - .all(function (req, res) { - // this is called for all other methods not - // defined above for /pet/:id - res.statusCode = 405 - res.end() - }) - -// make our http server listen to connections -server.listen(8080) -``` - -## License - -[MIT](LICENSE) - -[ci-image]: https://badgen.net/github/checks/pillarjs/router/master?label=ci -[ci-url]: https://github.com/pillarjs/router/actions/workflows/ci.yml -[npm-image]: https://img.shields.io/npm/v/router.svg -[npm-url]: https://npmjs.org/package/router -[node-version-image]: https://img.shields.io/node/v/router.svg -[node-version-url]: http://nodejs.org/download/ -[coveralls-image]: https://img.shields.io/coveralls/pillarjs/router/master.svg -[coveralls-url]: https://coveralls.io/r/pillarjs/router?branch=master -[downloads-image]: https://img.shields.io/npm/dm/router.svg -[downloads-url]: https://npmjs.org/package/router diff --git a/api/node_modules/router/index.js b/api/node_modules/router/index.js deleted file mode 100644 index 4358aeb..0000000 --- a/api/node_modules/router/index.js +++ /dev/null @@ -1,748 +0,0 @@ -/*! - * router - * Copyright(c) 2013 Roman Shtylman - * Copyright(c) 2014-2022 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -const isPromise = require('is-promise') -const Layer = require('./lib/layer') -const { METHODS } = require('node:http') -const parseUrl = require('parseurl') -const Route = require('./lib/route') -const debug = require('debug')('router') -const deprecate = require('depd')('router') - -/** - * Module variables. - * @private - */ - -const slice = Array.prototype.slice -const flatten = Array.prototype.flat -const methods = METHODS.map((method) => method.toLowerCase()) - -/** - * Expose `Router`. - */ - -module.exports = Router - -/** - * Expose `Route`. - */ - -module.exports.Route = Route - -/** - * Initialize a new `Router` with the given `options`. - * - * @param {object} [options] - * @return {Router} which is a callable function - * @public - */ - -function Router (options) { - if (!(this instanceof Router)) { - return new Router(options) - } - - const opts = options || {} - - function router (req, res, next) { - router.handle(req, res, next) - } - - // inherit from the correct prototype - Object.setPrototypeOf(router, this) - - router.caseSensitive = opts.caseSensitive - router.mergeParams = opts.mergeParams - router.params = {} - router.strict = opts.strict - router.stack = [] - - return router -} - -/** - * Router prototype inherits from a Function. - */ - -/* istanbul ignore next */ -Router.prototype = function () {} - -/** - * Map the given param placeholder `name`(s) to the given callback. - * - * Parameter mapping is used to provide pre-conditions to routes - * which use normalized placeholders. For example a _:user_id_ parameter - * could automatically load a user's information from the database without - * any additional code. - * - * The callback uses the same signature as middleware, the only difference - * being that the value of the placeholder is passed, in this case the _id_ - * of the user. Once the `next()` function is invoked, just like middleware - * it will continue on to execute the route, or subsequent parameter functions. - * - * Just like in middleware, you must either respond to the request or call next - * to avoid stalling the request. - * - * router.param('user_id', function(req, res, next, id){ - * User.find(id, function(err, user){ - * if (err) { - * return next(err) - * } else if (!user) { - * return next(new Error('failed to load user')) - * } - * req.user = user - * next() - * }) - * }) - * - * @param {string} name - * @param {function} fn - * @public - */ - -Router.prototype.param = function param (name, fn) { - if (!name) { - throw new TypeError('argument name is required') - } - - if (typeof name !== 'string') { - throw new TypeError('argument name must be a string') - } - - if (!fn) { - throw new TypeError('argument fn is required') - } - - if (typeof fn !== 'function') { - throw new TypeError('argument fn must be a function') - } - - let params = this.params[name] - - if (!params) { - params = this.params[name] = [] - } - - params.push(fn) - - return this -} - -/** - * Dispatch a req, res into the router. - * - * @private - */ - -Router.prototype.handle = function handle (req, res, callback) { - if (!callback) { - throw new TypeError('argument callback is required') - } - - debug('dispatching %s %s', req.method, req.url) - - let idx = 0 - let methods - const protohost = getProtohost(req.url) || '' - let removed = '' - const self = this - let slashAdded = false - let sync = 0 - const paramcalled = {} - - // middleware and routes - const stack = this.stack - - // manage inter-router variables - const parentParams = req.params - const parentUrl = req.baseUrl || '' - let done = restore(callback, req, 'baseUrl', 'next', 'params') - - // setup next layer - req.next = next - - // for options requests, respond with a default if nothing else responds - if (req.method === 'OPTIONS') { - methods = [] - done = wrap(done, generateOptionsResponder(res, methods)) - } - - // setup basic req values - req.baseUrl = parentUrl - req.originalUrl = req.originalUrl || req.url - - next() - - function next (err) { - let layerError = err === 'route' - ? null - : err - - // remove added slash - if (slashAdded) { - req.url = req.url.slice(1) - slashAdded = false - } - - // restore altered req.url - if (removed.length !== 0) { - req.baseUrl = parentUrl - req.url = protohost + removed + req.url.slice(protohost.length) - removed = '' - } - - // signal to exit router - if (layerError === 'router') { - setImmediate(done, null) - return - } - - // no more matching layers - if (idx >= stack.length) { - setImmediate(done, layerError) - return - } - - // max sync stack - if (++sync > 100) { - return setImmediate(next, err) - } - - // get pathname of request - const path = getPathname(req) - - if (path == null) { - return done(layerError) - } - - // find next matching layer - let layer - let match - let route - - while (match !== true && idx < stack.length) { - layer = stack[idx++] - match = matchLayer(layer, path) - route = layer.route - - if (typeof match !== 'boolean') { - // hold on to layerError - layerError = layerError || match - } - - if (match !== true) { - continue - } - - if (!route) { - // process non-route handlers normally - continue - } - - if (layerError) { - // routes do not match with a pending error - match = false - continue - } - - const method = req.method - const hasMethod = route._handlesMethod(method) - - // build up automatic options response - if (!hasMethod && method === 'OPTIONS' && methods) { - methods.push.apply(methods, route._methods()) - } - - // don't even bother matching route - if (!hasMethod && method !== 'HEAD') { - match = false - } - } - - // no match - if (match !== true) { - return done(layerError) - } - - // store route for dispatch on change - if (route) { - req.route = route - } - - // Capture one-time layer values - req.params = self.mergeParams - ? mergeParams(layer.params, parentParams) - : layer.params - const layerPath = layer.path - - // this should be done for the layer - processParams(self.params, layer, paramcalled, req, res, function (err) { - if (err) { - next(layerError || err) - } else if (route) { - layer.handleRequest(req, res, next) - } else { - trimPrefix(layer, layerError, layerPath, path) - } - - sync = 0 - }) - } - - function trimPrefix (layer, layerError, layerPath, path) { - if (layerPath.length !== 0) { - // Validate path is a prefix match - if (layerPath !== path.substring(0, layerPath.length)) { - next(layerError) - return - } - - // Validate path breaks on a path separator - const c = path[layerPath.length] - if (c && c !== '/') { - next(layerError) - return - } - - // Trim off the part of the url that matches the route - // middleware (.use stuff) needs to have the path stripped - debug('trim prefix (%s) from url %s', layerPath, req.url) - removed = layerPath - req.url = protohost + req.url.slice(protohost.length + removed.length) - - // Ensure leading slash - if (!protohost && req.url[0] !== '/') { - req.url = '/' + req.url - slashAdded = true - } - - // Setup base URL (no trailing slash) - req.baseUrl = parentUrl + (removed[removed.length - 1] === '/' - ? removed.substring(0, removed.length - 1) - : removed) - } - - debug('%s %s : %s', layer.name, layerPath, req.originalUrl) - - if (layerError) { - layer.handleError(layerError, req, res, next) - } else { - layer.handleRequest(req, res, next) - } - } -} - -/** - * Use the given middleware function, with optional path, defaulting to "/". - * - * Use (like `.all`) will run for any http METHOD, but it will not add - * handlers for those methods so OPTIONS requests will not consider `.use` - * functions even if they could respond. - * - * The other difference is that _route_ path is stripped and not visible - * to the handler function. The main effect of this feature is that mounted - * handlers can operate without any code changes regardless of the "prefix" - * pathname. - * - * @public - */ - -Router.prototype.use = function use (handler) { - let offset = 0 - let path = '/' - - // default path to '/' - // disambiguate router.use([handler]) - if (typeof handler !== 'function') { - let arg = handler - - while (Array.isArray(arg) && arg.length !== 0) { - arg = arg[0] - } - - // first arg is the path - if (typeof arg !== 'function') { - offset = 1 - path = handler - } - } - - const callbacks = flatten.call(slice.call(arguments, offset), Infinity) - - if (callbacks.length === 0) { - throw new TypeError('argument handler is required') - } - - for (let i = 0; i < callbacks.length; i++) { - const fn = callbacks[i] - - if (typeof fn !== 'function') { - throw new TypeError('argument handler must be a function') - } - - // add the middleware - debug('use %o %s', path, fn.name || '') - - const layer = new Layer(path, { - sensitive: this.caseSensitive, - strict: false, - end: false - }, fn) - - layer.route = undefined - - this.stack.push(layer) - } - - return this -} - -/** - * Create a new Route for the given path. - * - * Each route contains a separate middleware stack and VERB handlers. - * - * See the Route api documentation for details on adding handlers - * and middleware to routes. - * - * @param {string} path - * @return {Route} - * @public - */ - -Router.prototype.route = function route (path) { - const route = new Route(path) - - const layer = new Layer(path, { - sensitive: this.caseSensitive, - strict: this.strict, - end: true - }, handle) - - function handle (req, res, next) { - route.dispatch(req, res, next) - } - - layer.route = route - - this.stack.push(layer) - return route -} - -// create Router#VERB functions -methods.concat('all').forEach(function (method) { - Router.prototype[method] = function (path) { - const route = this.route(path) - route[method].apply(route, slice.call(arguments, 1)) - return this - } -}) - -/** - * Generate a callback that will make an OPTIONS response. - * - * @param {OutgoingMessage} res - * @param {array} methods - * @private - */ - -function generateOptionsResponder (res, methods) { - return function onDone (fn, err) { - if (err || methods.length === 0) { - return fn(err) - } - - trySendOptionsResponse(res, methods, fn) - } -} - -/** - * Get pathname of request. - * - * @param {IncomingMessage} req - * @private - */ - -function getPathname (req) { - try { - return parseUrl(req).pathname - } catch (err) { - return undefined - } -} - -/** - * Get get protocol + host for a URL. - * - * @param {string} url - * @private - */ - -function getProtohost (url) { - if (typeof url !== 'string' || url.length === 0 || url[0] === '/') { - return undefined - } - - const searchIndex = url.indexOf('?') - const pathLength = searchIndex !== -1 - ? searchIndex - : url.length - const fqdnIndex = url.substring(0, pathLength).indexOf('://') - - return fqdnIndex !== -1 - ? url.substring(0, url.indexOf('/', 3 + fqdnIndex)) - : undefined -} - -/** - * Match path to a layer. - * - * @param {Layer} layer - * @param {string} path - * @private - */ - -function matchLayer (layer, path) { - try { - return layer.match(path) - } catch (err) { - return err - } -} - -/** - * Merge params with parent params - * - * @private - */ - -function mergeParams (params, parent) { - if (typeof parent !== 'object' || !parent) { - return params - } - - // make copy of parent for base - const obj = Object.assign({}, parent) - - // simple non-numeric merging - if (!(0 in params) || !(0 in parent)) { - return Object.assign(obj, params) - } - - let i = 0 - let o = 0 - - // determine numeric gap in params - while (i in params) { - i++ - } - - // determine numeric gap in parent - while (o in parent) { - o++ - } - - // offset numeric indices in params before merge - for (i--; i >= 0; i--) { - params[i + o] = params[i] - - // create holes for the merge when necessary - if (i < o) { - delete params[i] - } - } - - return Object.assign(obj, params) -} - -/** - * Process any parameters for the layer. - * - * @private - */ - -function processParams (params, layer, called, req, res, done) { - // captured parameters from the layer, keys and values - const keys = layer.keys - - // fast track - if (!keys || keys.length === 0) { - return done() - } - - let i = 0 - let paramIndex = 0 - let key - let paramVal - let paramCallbacks - let paramCalled - - // process params in order - // param callbacks can be async - function param (err) { - if (err) { - return done(err) - } - - if (i >= keys.length) { - return done() - } - - paramIndex = 0 - key = keys[i++] - paramVal = req.params[key] - paramCallbacks = params[key] - paramCalled = called[key] - - if (paramVal === undefined || !paramCallbacks) { - return param() - } - - // param previously called with same value or error occurred - if (paramCalled && (paramCalled.match === paramVal || - (paramCalled.error && paramCalled.error !== 'route'))) { - // restore value - req.params[key] = paramCalled.value - - // next param - return param(paramCalled.error) - } - - called[key] = paramCalled = { - error: null, - match: paramVal, - value: paramVal - } - - paramCallback() - } - - // single param callbacks - function paramCallback (err) { - const fn = paramCallbacks[paramIndex++] - - // store updated value - paramCalled.value = req.params[key] - - if (err) { - // store error - paramCalled.error = err - param(err) - return - } - - if (!fn) return param() - - try { - const ret = fn(req, res, paramCallback, paramVal, key) - if (isPromise(ret)) { - if (!(ret instanceof Promise)) { - deprecate('parameters that are Promise-like are deprecated, use a native Promise instead') - } - - ret.then(null, function (error) { - paramCallback(error || new Error('Rejected promise')) - }) - } - } catch (e) { - paramCallback(e) - } - } - - param() -} - -/** - * Restore obj props after function - * - * @private - */ - -function restore (fn, obj) { - const props = new Array(arguments.length - 2) - const vals = new Array(arguments.length - 2) - - for (let i = 0; i < props.length; i++) { - props[i] = arguments[i + 2] - vals[i] = obj[props[i]] - } - - return function () { - // restore vals - for (let i = 0; i < props.length; i++) { - obj[props[i]] = vals[i] - } - - return fn.apply(this, arguments) - } -} - -/** - * Send an OPTIONS response. - * - * @private - */ - -function sendOptionsResponse (res, methods) { - const options = Object.create(null) - - // build unique method map - for (let i = 0; i < methods.length; i++) { - options[methods[i]] = true - } - - // construct the allow list - const allow = Object.keys(options).sort().join(', ') - - // send response - res.setHeader('Allow', allow) - res.setHeader('Content-Length', Buffer.byteLength(allow)) - res.setHeader('Content-Type', 'text/plain') - res.setHeader('X-Content-Type-Options', 'nosniff') - res.end(allow) -} - -/** - * Try to send an OPTIONS response. - * - * @private - */ - -function trySendOptionsResponse (res, methods, next) { - try { - sendOptionsResponse(res, methods) - } catch (err) { - next(err) - } -} - -/** - * Wrap a function - * - * @private - */ - -function wrap (old, fn) { - return function proxy () { - const args = new Array(arguments.length + 1) - - args[0] = old - for (let i = 0, len = arguments.length; i < len; i++) { - args[i + 1] = arguments[i] - } - - fn.apply(this, args) - } -} diff --git a/api/node_modules/router/lib/layer.js b/api/node_modules/router/lib/layer.js deleted file mode 100644 index 6a4408f..0000000 --- a/api/node_modules/router/lib/layer.js +++ /dev/null @@ -1,247 +0,0 @@ -/*! - * router - * Copyright(c) 2013 Roman Shtylman - * Copyright(c) 2014-2022 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -const isPromise = require('is-promise') -const pathRegexp = require('path-to-regexp') -const debug = require('debug')('router:layer') -const deprecate = require('depd')('router') - -/** - * Module variables. - * @private - */ - -const TRAILING_SLASH_REGEXP = /\/+$/ -const MATCHING_GROUP_REGEXP = /\((?:\?<(.*?)>)?(?!\?)/g - -/** - * Expose `Layer`. - */ - -module.exports = Layer - -function Layer (path, options, fn) { - if (!(this instanceof Layer)) { - return new Layer(path, options, fn) - } - - debug('new %o', path) - const opts = options || {} - - this.handle = fn - this.keys = [] - this.name = fn.name || '' - this.params = undefined - this.path = undefined - this.slash = path === '/' && opts.end === false - - function matcher (_path) { - if (_path instanceof RegExp) { - const keys = [] - let name = 0 - let m - // eslint-disable-next-line no-cond-assign - while (m = MATCHING_GROUP_REGEXP.exec(_path.source)) { - keys.push({ - name: m[1] || name++, - offset: m.index - }) - } - - return function regexpMatcher (p) { - const match = _path.exec(p) - if (!match) { - return false - } - - const params = {} - for (let i = 1; i < match.length; i++) { - const key = keys[i - 1] - const prop = key.name - const val = decodeParam(match[i]) - - if (val !== undefined) { - params[prop] = val - } - } - - return { - params, - path: match[0] - } - } - } - - return pathRegexp.match((opts.strict ? _path : loosen(_path)), { - sensitive: opts.sensitive, - end: opts.end, - trailing: !opts.strict, - decode: decodeParam - }) - } - this.matchers = Array.isArray(path) ? path.map(matcher) : [matcher(path)] -} - -/** - * Handle the error for the layer. - * - * @param {Error} error - * @param {Request} req - * @param {Response} res - * @param {function} next - * @api private - */ - -Layer.prototype.handleError = function handleError (error, req, res, next) { - const fn = this.handle - - if (fn.length !== 4) { - // not a standard error handler - return next(error) - } - - try { - // invoke function - const ret = fn(error, req, res, next) - - // wait for returned promise - if (isPromise(ret)) { - if (!(ret instanceof Promise)) { - deprecate('handlers that are Promise-like are deprecated, use a native Promise instead') - } - - ret.then(null, function (error) { - next(error || new Error('Rejected promise')) - }) - } - } catch (err) { - next(err) - } -} - -/** - * Handle the request for the layer. - * - * @param {Request} req - * @param {Response} res - * @param {function} next - * @api private - */ - -Layer.prototype.handleRequest = function handleRequest (req, res, next) { - const fn = this.handle - - if (fn.length > 3) { - // not a standard request handler - return next() - } - - try { - // invoke function - const ret = fn(req, res, next) - - // wait for returned promise - if (isPromise(ret)) { - if (!(ret instanceof Promise)) { - deprecate('handlers that are Promise-like are deprecated, use a native Promise instead') - } - - ret.then(null, function (error) { - next(error || new Error('Rejected promise')) - }) - } - } catch (err) { - next(err) - } -} - -/** - * Check if this route matches `path`, if so - * populate `.params`. - * - * @param {String} path - * @return {Boolean} - * @api private - */ - -Layer.prototype.match = function match (path) { - let match - - if (path != null) { - // fast path non-ending match for / (any path matches) - if (this.slash) { - this.params = {} - this.path = '' - return true - } - - let i = 0 - while (!match && i < this.matchers.length) { - // match the path - match = this.matchers[i](path) - i++ - } - } - - if (!match) { - this.params = undefined - this.path = undefined - return false - } - - // store values - this.params = match.params - this.path = match.path - this.keys = Object.keys(match.params) - - return true -} - -/** - * Decode param value. - * - * @param {string} val - * @return {string} - * @private - */ - -function decodeParam (val) { - if (typeof val !== 'string' || val.length === 0) { - return val - } - - try { - return decodeURIComponent(val) - } catch (err) { - if (err instanceof URIError) { - err.message = 'Failed to decode param \'' + val + '\'' - err.status = 400 - } - - throw err - } -} - -/** - * Loosens the given path for path-to-regexp matching. - */ -function loosen (path) { - if (path instanceof RegExp || path === '/') { - return path - } - - return Array.isArray(path) - ? path.map(function (p) { return loosen(p) }) - : String(path).replace(TRAILING_SLASH_REGEXP, '') -} diff --git a/api/node_modules/router/lib/route.js b/api/node_modules/router/lib/route.js deleted file mode 100644 index 1887d78..0000000 --- a/api/node_modules/router/lib/route.js +++ /dev/null @@ -1,242 +0,0 @@ -/*! - * router - * Copyright(c) 2013 Roman Shtylman - * Copyright(c) 2014-2022 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -const debug = require('debug')('router:route') -const Layer = require('./layer') -const { METHODS } = require('node:http') - -/** - * Module variables. - * @private - */ - -const slice = Array.prototype.slice -const flatten = Array.prototype.flat -const methods = METHODS.map((method) => method.toLowerCase()) - -/** - * Expose `Route`. - */ - -module.exports = Route - -/** - * Initialize `Route` with the given `path`, - * - * @param {String} path - * @api private - */ - -function Route (path) { - debug('new %o', path) - this.path = path - this.stack = [] - - // route handlers for various http methods - this.methods = Object.create(null) -} - -/** - * @private - */ - -Route.prototype._handlesMethod = function _handlesMethod (method) { - if (this.methods._all) { - return true - } - - // normalize name - let name = typeof method === 'string' - ? method.toLowerCase() - : method - - if (name === 'head' && !this.methods.head) { - name = 'get' - } - - return Boolean(this.methods[name]) -} - -/** - * @return {array} supported HTTP methods - * @private - */ - -Route.prototype._methods = function _methods () { - const methods = Object.keys(this.methods) - - // append automatic head - if (this.methods.get && !this.methods.head) { - methods.push('head') - } - - for (let i = 0; i < methods.length; i++) { - // make upper case - methods[i] = methods[i].toUpperCase() - } - - return methods -} - -/** - * dispatch req, res into this route - * - * @private - */ - -Route.prototype.dispatch = function dispatch (req, res, done) { - let idx = 0 - const stack = this.stack - let sync = 0 - - if (stack.length === 0) { - return done() - } - - let method = typeof req.method === 'string' - ? req.method.toLowerCase() - : req.method - - if (method === 'head' && !this.methods.head) { - method = 'get' - } - - req.route = this - - next() - - function next (err) { - // signal to exit route - if (err && err === 'route') { - return done() - } - - // signal to exit router - if (err && err === 'router') { - return done(err) - } - - // no more matching layers - if (idx >= stack.length) { - return done(err) - } - - // max sync stack - if (++sync > 100) { - return setImmediate(next, err) - } - - let layer - let match - - // find next matching layer - while (match !== true && idx < stack.length) { - layer = stack[idx++] - match = !layer.method || layer.method === method - } - - // no match - if (match !== true) { - return done(err) - } - - if (err) { - layer.handleError(err, req, res, next) - } else { - layer.handleRequest(req, res, next) - } - - sync = 0 - } -} - -/** - * Add a handler for all HTTP verbs to this route. - * - * Behaves just like middleware and can respond or call `next` - * to continue processing. - * - * You can use multiple `.all` call to add multiple handlers. - * - * function check_something(req, res, next){ - * next() - * } - * - * function validate_user(req, res, next){ - * next() - * } - * - * route - * .all(validate_user) - * .all(check_something) - * .get(function(req, res, next){ - * res.send('hello world') - * }) - * - * @param {array|function} handler - * @return {Route} for chaining - * @api public - */ - -Route.prototype.all = function all (handler) { - const callbacks = flatten.call(slice.call(arguments), Infinity) - - if (callbacks.length === 0) { - throw new TypeError('argument handler is required') - } - - for (let i = 0; i < callbacks.length; i++) { - const fn = callbacks[i] - - if (typeof fn !== 'function') { - throw new TypeError('argument handler must be a function') - } - - const layer = Layer('/', {}, fn) - layer.method = undefined - - this.methods._all = true - this.stack.push(layer) - } - - return this -} - -methods.forEach(function (method) { - Route.prototype[method] = function (handler) { - const callbacks = flatten.call(slice.call(arguments), Infinity) - - if (callbacks.length === 0) { - throw new TypeError('argument handler is required') - } - - for (let i = 0; i < callbacks.length; i++) { - const fn = callbacks[i] - - if (typeof fn !== 'function') { - throw new TypeError('argument handler must be a function') - } - - debug('%s %s', method, this.path) - - const layer = Layer('/', {}, fn) - layer.method = method - - this.methods[method] = true - this.stack.push(layer) - } - - return this - } -}) diff --git a/api/node_modules/router/package.json b/api/node_modules/router/package.json deleted file mode 100644 index 123eca2..0000000 --- a/api/node_modules/router/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "router", - "description": "Simple middleware-style router", - "version": "2.2.0", - "author": "Douglas Christopher Wilson ", - "contributors": [ - "Blake Embrey " - ], - "license": "MIT", - "repository": "pillarjs/router", - "dependencies": { - "debug": "^4.4.0", - "depd": "^2.0.0", - "is-promise": "^4.0.0", - "parseurl": "^1.3.3", - "path-to-regexp": "^8.0.0" - }, - "devDependencies": { - "finalhandler": "^2.1.0", - "mocha": "10.2.0", - "nyc": "15.1.0", - "run-series": "^1.1.9", - "standard": "^17.1.0", - "supertest": "6.3.3" - }, - "files": [ - "lib/", - "LICENSE", - "HISTORY.md", - "README.md", - "index.js" - ], - "engines": { - "node": ">= 18" - }, - "scripts": { - "lint": "standard", - "test": "mocha --reporter spec --bail --check-leaks test/", - "test:debug": "mocha --reporter spec --bail --check-leaks test/ --inspect --inspect-brk", - "test-ci": "nyc --reporter=lcov --reporter=text npm test", - "test-cov": "nyc --reporter=text npm test", - "version": "node scripts/version-history.js && git add HISTORY.md" - } -} diff --git a/api/node_modules/send/HISTORY.md b/api/node_modules/send/HISTORY.md index 958b934..0dd29d0 100644 --- a/api/node_modules/send/HISTORY.md +++ b/api/node_modules/send/HISTORY.md @@ -1,57 +1,3 @@ -1.2.0 / 2025-03-27 -================== - - * deps: - * `mime-types@^3.0.1` - * `fresh@^2.0.0` - * removed `destroy` - * remove `getHeaderNames()` polyfill and refactor `clearHeaders()` - -1.1.0 / 2024-09-10 -================== - -* Changes from 0.19.0 - -1.0.0 / 2024-07-25 -================== - - * Drop support for Node.js <18.0 - * `statuses@^2.0.1` - * `range-parser@^1.2.1` - * `on-finished@^2.4.1` - * `ms@^2.1.3` - * `mime-types@^2.1.35` - * `http-errors@^2.0.0` - * `fresh@^0.5.2` - * `etag@^1.8.1` - * `escape-html@^1.0.3` - * `encodeurl@^2.0.0` - * `destroy@^1.2.0` - * `debug@^4.3.5` - -1.0.0-beta.2 / 2024-03-04 -========================= - - * Changes from 0.18.0 - -1.0.0-beta.1 / 2022-02-04 -========================= - - * Drop support for Node.js 0.8 - * Remove `hidden` option -- use `dotfiles` option - * Remove `from` alias to `root` -- use `root` directly - * Remove `send.etag()` -- use `etag` in `options` - * Remove `send.index()` -- use `index` in `options` - * Remove `send.maxage()` -- use `maxAge` in `options` - * Remove `send.root()` -- use `root` in `options` - * Use `mime-types` for file to content type mapping -- removed `send.mime` - * 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 - 0.19.0 / 2024-09-10 =================== diff --git a/api/node_modules/send/README.md b/api/node_modules/send/README.md index 350fccd..fadf838 100644 --- a/api/node_modules/send/README.md +++ b/api/node_modules/send/README.md @@ -2,7 +2,8 @@ [![NPM Version][npm-version-image]][npm-url] [![NPM Downloads][npm-downloads-image]][npm-url] -[![CI][github-actions-ci-image]][github-actions-ci-url] +[![Linux Build][github-actions-ci-image]][github-actions-ci-url] +[![Windows Build][appveyor-image]][appveyor-url] [![Test Coverage][coveralls-image]][coveralls-url] Send is a library for streaming files from the file system as a http response @@ -54,7 +55,7 @@ Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot ("."). Note this check is done on the path itself without checking if the path actually exists on the disk. If `root` is specified, only the dotfiles above the root are -checked (i.e. the root itself can be within a dotfile when set +checked (i.e. the root itself can be within a dotfile when when set to "deny"). - `'allow'` No special treatment for dotfiles. @@ -132,6 +133,15 @@ The `SendStream` is an event emitter and will emit the following events: The `pipe` method is used to pipe the response into the Node.js HTTP response object, typically `send(req, path, options).pipe(res)`. +### .mime + +The `mime` export is the global instance of of the +[`mime` npm module](https://www.npmjs.com/package/mime). + +This is used to configure the MIME types that are associated with file extensions +as well as other options for how to resolve the MIME type of a file (like the +default type to use for an unknown file extension). + ## Error-handling By default when no `error` listeners are present an automatic response will be @@ -200,22 +210,20 @@ server.listen(3000) ### Custom file types ```js -var extname = require('path').extname var http = require('http') var parseUrl = require('parseurl') var send = require('send') +// Default unknown types to text/plain +send.mime.default_type = 'text/plain' + +// Add a custom type +send.mime.define({ + 'application/x-my-type': ['x-mt', 'x-mtt'] +}) + var server = http.createServer(function onRequest (req, res) { send(req, parseUrl(req).pathname, { root: '/www/public' }) - .on('headers', function (res, path) { - switch (extname(path)) { - case '.x-mt': - case '.x-mtt': - // custom type for these extensions - res.setHeader('Content-Type', 'application/x-my-type') - break - } - }) .pipe(res) }) @@ -224,7 +232,7 @@ server.listen(3000) ### Custom directory index view -This is an example of serving up a structure of directories with a +This is a example of serving up a structure of directories with a custom function to render a listing of a directory. ```js @@ -306,6 +314,8 @@ server.listen(3000) [MIT](LICENSE) +[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/send/master?label=windows +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/send [coveralls-image]: https://badgen.net/coveralls/c/github/pillarjs/send/master [coveralls-url]: https://coveralls.io/r/pillarjs/send?branch=master [github-actions-ci-image]: https://badgen.net/github/checks/pillarjs/send/master?label=linux diff --git a/api/node_modules/send/index.js b/api/node_modules/send/index.js index 1655053..768f8ca 100644 --- a/api/node_modules/send/index.js +++ b/api/node_modules/send/index.js @@ -14,12 +14,14 @@ var createError = require('http-errors') var debug = require('debug')('send') +var deprecate = require('depd')('send') +var destroy = require('destroy') var encodeUrl = require('encodeurl') var escapeHtml = require('escape-html') var etag = require('etag') var fresh = require('fresh') var fs = require('fs') -var mime = require('mime-types') +var mime = require('mime') var ms = require('ms') var onFinished = require('on-finished') var parseRange = require('range-parser') @@ -66,6 +68,7 @@ var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/ */ module.exports = send +module.exports.mime = mime /** * Return a `SendStream` for `req` and `path`. @@ -119,6 +122,17 @@ function SendStream (req, path, options) { throw new TypeError('dotfiles option must be "allow", "deny", or "ignore"') } + this._hidden = Boolean(opts.hidden) + + if (opts.hidden !== undefined) { + deprecate('hidden: use dotfiles: \'' + (this._hidden ? 'allow' : 'ignore') + '\' instead') + } + + // legacy support + if (opts.dotfiles === undefined) { + this._dotfiles = undefined + } + this._extensions = opts.extensions !== undefined ? normalizeList(opts.extensions, 'extensions option') : [] @@ -146,6 +160,10 @@ function SendStream (req, path, options) { this._root = opts.root ? resolve(opts.root) : null + + if (!this._root && opts.from) { + this.from(opts.from) + } } /** @@ -154,6 +172,90 @@ function SendStream (req, path, options) { util.inherits(SendStream, Stream) +/** + * Enable or disable etag generation. + * + * @param {Boolean} val + * @return {SendStream} + * @api public + */ + +SendStream.prototype.etag = deprecate.function(function etag (val) { + this._etag = Boolean(val) + debug('etag %s', this._etag) + return this +}, 'send.etag: pass etag as option') + +/** + * Enable or disable "hidden" (dot) files. + * + * @param {Boolean} path + * @return {SendStream} + * @api public + */ + +SendStream.prototype.hidden = deprecate.function(function hidden (val) { + this._hidden = Boolean(val) + this._dotfiles = undefined + debug('hidden %s', this._hidden) + return this +}, 'send.hidden: use dotfiles option') + +/** + * Set index `paths`, set to a falsy + * value to disable index support. + * + * @param {String|Boolean|Array} paths + * @return {SendStream} + * @api public + */ + +SendStream.prototype.index = deprecate.function(function index (paths) { + var index = !paths ? [] : normalizeList(paths, 'paths argument') + debug('index %o', paths) + this._index = index + return this +}, 'send.index: pass index as option') + +/** + * Set root `path`. + * + * @param {String} path + * @return {SendStream} + * @api public + */ + +SendStream.prototype.root = function root (path) { + this._root = resolve(String(path)) + debug('root %s', this._root) + return this +} + +SendStream.prototype.from = deprecate.function(SendStream.prototype.root, + 'send.from: pass root as option') + +SendStream.prototype.root = deprecate.function(SendStream.prototype.root, + 'send.root: pass root as option') + +/** + * Set max-age to `maxAge`. + * + * @param {Number} maxAge + * @return {SendStream} + * @api public + */ + +SendStream.prototype.maxage = deprecate.function(function maxage (maxAge) { + this._maxage = typeof maxAge === 'string' + ? ms(maxAge) + : Number(maxAge) + this._maxage = !isNaN(this._maxage) + ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) + : 0 + debug('max-age %d', this._maxage) + return this +}, 'send.maxage: pass maxAge as option') + /** * Emit error with `status`. * @@ -456,8 +558,17 @@ SendStream.prototype.pipe = function pipe (res) { // dotfile handling if (containsDotFile(parts)) { - debug('%s dotfile "%s"', this._dotfiles, path) - switch (this._dotfiles) { + var access = this._dotfiles + + // legacy support + if (access === undefined) { + access = parts[parts.length - 1][0] === '.' + ? (this._hidden ? 'allow' : 'ignore') + : 'allow' + } + + debug('%s dotfile "%s"', access, path) + switch (access) { case 'allow': break case 'deny': @@ -496,7 +607,7 @@ SendStream.prototype.send = function send (path, stat) { var ranges = req.headers.range var offset = options.start || 0 - if (res.headersSent) { + if (headersSent(res)) { // impossible to send now this.headersAlreadySent() return @@ -603,14 +714,12 @@ SendStream.prototype.sendFile = function sendFile (path) { debug('stat "%s"', path) fs.stat(path, function onstat (err, stat) { - var pathEndsWithSep = path[path.length - 1] === sep - if (err && err.code === 'ENOENT' && !extname(path) && !pathEndsWithSep) { + if (err && err.code === 'ENOENT' && !extname(path) && path[path.length - 1] !== sep) { // not found, check extensions return next(err) } if (err) return self.onStatError(err) if (stat.isDirectory()) return self.redirect(path) - if (pathEndsWithSep) return self.error(404) self.emit('file', path, stat) self.send(path, stat) }) @@ -683,7 +792,7 @@ SendStream.prototype.stream = function stream (path, options) { // cleanup function cleanup () { - stream.destroy() + destroy(stream, true) } // response finished, cleanup @@ -717,11 +826,17 @@ SendStream.prototype.type = function type (path) { if (res.getHeader('Content-Type')) return - var ext = extname(path) - var type = mime.contentType(ext) || 'application/octet-stream' + var type = mime.lookup(path) + + if (!type) { + debug('no content-type') + return + } + + var charset = mime.charsets.lookup(type) debug('content-type %s', type) - res.setHeader('Content-Type', type) + res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : '')) } /** @@ -775,8 +890,10 @@ SendStream.prototype.setHeader = function setHeader (path, stat) { */ function clearHeaders (res) { - for (const header of res.getHeaderNames()) { - res.removeHeader(header) + var headers = getHeaderNames(res) + + for (var i = 0; i < headers.length; i++) { + res.removeHeader(headers[i]) } } @@ -884,10 +1001,24 @@ function decode (path) { } } +/** + * Get the header names on a respnse. + * + * @param {object} res + * @returns {array[string]} + * @private + */ + +function getHeaderNames (res) { + return typeof res.getHeaderNames !== 'function' + ? Object.keys(res._headers || {}) + : res.getHeaderNames() +} + /** * Determine if emitter has listeners of a given type. * - * The way to do this check is done three different ways in Node.js >= 0.10 + * The way to do this check is done three different ways in Node.js >= 0.8 * so this consolidates them into a minimal set using instance methods. * * @param {EventEmitter} emitter @@ -904,6 +1035,20 @@ function hasListeners (emitter, type) { return count > 0 } +/** + * Determine if the response headers have been sent. + * + * @param {object} res + * @returns {boolean} + * @private + */ + +function headersSent (res) { + return typeof res.headersSent !== 'boolean' + ? Boolean(res._header) + : res.headersSent +} + /** * Normalize the index option into an array. * diff --git a/api/node_modules/send/package.json b/api/node_modules/send/package.json index d6a969a..a3233e0 100644 --- a/api/node_modules/send/package.json +++ b/api/node_modules/send/package.json @@ -1,7 +1,7 @@ { "name": "send", "description": "Better streaming static file server with Range and conditional-GET support", - "version": "1.2.0", + "version": "0.19.0", "author": "TJ Holowaychuk ", "contributors": [ "Douglas Christopher Wilson ", @@ -16,20 +16,22 @@ "server" ], "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" + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" }, "devDependencies": { - "after": "^0.8.2", + "after": "0.8.2", "eslint": "7.32.0", "eslint-config-standard": "14.1.1", "eslint-plugin-import": "2.25.4", @@ -37,24 +39,24 @@ "eslint-plugin-node": "11.1.0", "eslint-plugin-promise": "5.2.0", "eslint-plugin-standard": "4.1.0", - "mocha": "^10.7.0", - "nyc": "^17.0.0", + "mocha": "9.2.2", + "nyc": "15.1.0", "supertest": "6.2.2" }, "files": [ "HISTORY.md", "LICENSE", "README.md", + "SECURITY.md", "index.js" ], "engines": { - "node": ">= 18" + "node": ">= 0.8.0" }, "scripts": { "lint": "eslint .", - "test": "mocha --check-leaks --reporter spec", - "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" + "test": "mocha --check-leaks --reporter spec --bail", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" } } diff --git a/api/node_modules/serve-static/HISTORY.md b/api/node_modules/serve-static/HISTORY.md index a3f174e..dccf667 100644 --- a/api/node_modules/serve-static/HISTORY.md +++ b/api/node_modules/serve-static/HISTORY.md @@ -1,48 +1,19 @@ -2.2.0 / 2025-03-27 -================== - -* deps: send@^1.2.0 - -2.1.0 / 2024-09-10 +1.16.2 / 2024-09-11 =================== -* Changes from 1.16.0 -* deps: send@^1.2.0 +* deps: encodeurl@~2.0.0 -2.0.0 / 2024-08-23 -================== +1.16.1 / 2024-09-11 +=================== -* deps: - * parseurl@^1.3.3 - * excape-html@^1.0.3 - * encodeurl@^2.0.0 - * supertest@^6.3.4 - * safe-buffer@^5.2.1 - * nyc@^17.0.0 - * mocha@^10.7.0 -* Changes from 1.x - -2.0.0-beta.2 / 2024-03-20 -========================= - - * deps: send@1.0.0-beta.2 - -2.0.0-beta.1 / 2022-02-05 -========================= - - * Change `dotfiles` option default to `'ignore'` - * Drop support for Node.js 0.8 - * Remove `hidden` option; use `dotfiles` option instead - * Remove `mime` export; use `mime-types` package instead - * deps: send@1.0.0-beta.1 - - Use `mime-types` for file to content type mapping - - deps: debug@3.1.0 +* deps: send@0.19.0 1.16.0 / 2024-09-10 =================== * Remove link renderization in html while redirecting + 1.15.0 / 2022-03-24 =================== diff --git a/api/node_modules/serve-static/README.md b/api/node_modules/serve-static/README.md index 70f01c3..262d944 100644 --- a/api/node_modules/serve-static/README.md +++ b/api/node_modules/serve-static/README.md @@ -2,7 +2,8 @@ [![NPM Version][npm-version-image]][npm-url] [![NPM Downloads][npm-downloads-image]][npm-url] -[![CI][github-actions-ci-image]][github-actions-ci-url] +[![Linux Build][github-actions-ci-image]][github-actions-ci-url] +[![Windows Build][appveyor-image]][appveyor-url] [![Test Coverage][coveralls-image]][coveralls-url] ## Install @@ -44,7 +45,7 @@ true. Disabling this will ignore the `immutable` and `maxAge` options. ##### dotfiles -Set how "dotfiles" are treated when encountered. A dotfile is a file + Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot ("."). Note this check is done on the path itself without checking if the path actually exists on the disk. If `root` is specified, only the dotfiles above the root are @@ -55,7 +56,8 @@ to "deny"). - `'deny'` Deny a request for a dotfile and 403/`next()`. - `'ignore'` Pretend like the dotfile does not exist and 404/`next()`. -The default value is `'ignore'`. +The default value is similar to `'ignore'`, with the exception that this +default will not ignore the files within a directory that begins with a dot. ##### etag @@ -213,7 +215,7 @@ app.listen(3000) #### Different settings for paths This example shows how to set a different max age depending on the served -file. In this example, HTML files are not cached, while everything else +file type. In this example, HTML files are not cached, while everything else is for 1 day. ```js @@ -230,8 +232,8 @@ app.use(serveStatic(path.join(__dirname, 'public'), { app.listen(3000) -function setCustomCacheControl (res, file) { - if (path.extname(file) === '.html') { +function setCustomCacheControl (res, path) { + if (serveStatic.mime.lookup(path) === 'text/html') { // Custom Cache-Control for HTML files res.setHeader('Cache-Control', 'public, max-age=0') } @@ -242,6 +244,8 @@ function setCustomCacheControl (res, file) { [MIT](LICENSE) +[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/serve-static/master?label=windows +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/serve-static [coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/serve-static/master [coveralls-url]: https://coveralls.io/r/expressjs/serve-static?branch=master [github-actions-ci-image]: https://badgen.net/github/checks/expressjs/serve-static/master?label=linux diff --git a/api/node_modules/serve-static/index.js b/api/node_modules/serve-static/index.js index 1bee463..3f3e64e 100644 --- a/api/node_modules/serve-static/index.js +++ b/api/node_modules/serve-static/index.js @@ -26,6 +26,7 @@ var url = require('url') */ module.exports = serveStatic +module.exports.mime = send.mime /** * @param {string} root diff --git a/api/node_modules/serve-static/package.json b/api/node_modules/serve-static/package.json index 38d3365..49d7542 100644 --- a/api/node_modules/serve-static/package.json +++ b/api/node_modules/serve-static/package.json @@ -1,15 +1,15 @@ { "name": "serve-static", "description": "Serve static files", - "version": "2.2.0", + "version": "1.16.2", "author": "Douglas Christopher Wilson ", "license": "MIT", "repository": "expressjs/serve-static", "dependencies": { - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "parseurl": "^1.3.3", - "send": "^1.2.0" + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" }, "devDependencies": { "eslint": "7.32.0", @@ -19,9 +19,10 @@ "eslint-plugin-node": "11.1.0", "eslint-plugin-promise": "5.2.0", "eslint-plugin-standard": "4.1.0", - "mocha": "^10.7.0", - "nyc": "^17.0.0", - "supertest": "^6.3.4" + "mocha": "9.2.2", + "nyc": "15.1.0", + "safe-buffer": "5.2.1", + "supertest": "6.2.2" }, "files": [ "LICENSE", @@ -29,7 +30,7 @@ "index.js" ], "engines": { - "node": ">= 18" + "node": ">= 0.8.0" }, "scripts": { "lint": "eslint .", diff --git a/api/node_modules/type-is/HISTORY.md b/api/node_modules/type-is/HISTORY.md index 6812655..8de21f7 100644 --- a/api/node_modules/type-is/HISTORY.md +++ b/api/node_modules/type-is/HISTORY.md @@ -1,36 +1,3 @@ -2.0.1 / 2025-03-27 -========== - -2.0.0 / 2024-08-31 -========== - - * Drop node <18 - * Use `content-type@^1.0.5` and `media-typer@^1.0.0` for type validation - - No behavior changes, upgrades `media-typer` - * deps: mime-types@^3.0.0 - - Add `application/toml` with extension `.toml` - - Add `application/ubjson` with extension `.ubj` - - Add `application/x-keepass2` with extension `.kdbx` - - Add deprecated iWorks mime types and extensions - - Add extension `.amr` to `audio/amr` - - Add extension `.cjs` to `application/node` - - Add extension `.dbf` to `application/vnd.dbf` - - Add extension `.m4s` to `video/iso.segment` - - Add extension `.mvt` to `application/vnd.mapbox-vector-tile` - - Add extension `.mxmf` to `audio/mobile-xmf` - - Add extension `.opus` to `audio/ogg` - - Add extension `.rar` to `application/vnd.rar` - - Add extension `.td` to `application/urc-targetdesc+xml` - - Add extension `.trig` to `application/trig` - - Add extensions from IANA for `application/*+xml` types - - Add `image/avif` with extension `.avif` - - Add `image/ktx2` with extension `.ktx2` - - Add `image/vnd.ms-dds` with extension `.dds` - - Add new upstream MIME types - - Fix extension of `application/vnd.apple.keynote` to be `.key` - - Remove ambigious extensions from IANA for `application/*+xml` types - - Update primary extension to `.es` for `application/ecmascript` - 1.6.18 / 2019-04-26 =================== diff --git a/api/node_modules/type-is/README.md b/api/node_modules/type-is/README.md index d23946e..b85ef8f 100644 --- a/api/node_modules/type-is/README.md +++ b/api/node_modules/type-is/README.md @@ -3,12 +3,12 @@ [![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][ci-image]][ci-url] +[![Build Status][travis-image]][travis-url] [![Test Coverage][coveralls-image]][coveralls-url] Infer the content-type of a request. -## Install +### Install This is a [Node.js](https://nodejs.org/en/) module available through the [npm registry](https://www.npmjs.com/). Installation is done using the @@ -52,6 +52,8 @@ Each type in the `types` array can be one of the following: Some examples to illustrate the inputs and returned value: + + ```js // req.headers.content-type = 'application/json' @@ -72,6 +74,8 @@ Having a body has no relation to how large the body is (it may be 0 bytes). This is similar to how file existence works. If a body does exist, then this indicates that there is data to read from the Node.js request stream. + + ```js if (typeis.hasBody(req)) { // read the body, since there is one @@ -104,6 +108,8 @@ Each type in the `types` array can be one of the following: Some examples to illustrate the inputs and returned value: + + ```js var mediaType = 'application/json' @@ -115,38 +121,6 @@ typeis.is(mediaType, ['application/json']) // => 'application/json' typeis.is(mediaType, ['html']) // => false ``` -### typeis.match(expected, actual) - -Match the type string `expected` with `actual`, taking in to account wildcards. -A wildcard can only be in the type of the subtype part of a media type and only -in the `expected` value (as `actual` should be the real media type to match). A -suffix can still be included even with a wildcard subtype. If an input is -malformed, `false` will be returned. - -```js -typeis.match('text/html', 'text/html') // => true -typeis.match('*/html', 'text/html') // => true -typeis.match('text/*', 'text/html') // => true -typeis.match('*/*', 'text/html') // => true -typeis.match('*/*+json', 'application/x-custom+json') // => true -``` - -### typeis.normalize(type) - -Normalize a `type` string. This works by performing the following: - -- If the `type` is not a string, `false` is returned. -- If the string starts with `+` (so it is a `+suffix` shorthand like `+json`), - then it is expanded to contain the complete wildcard notation of `*/*+suffix`. -- If the string contains a `/`, then it is returned as the type. -- Else the string is assumed to be a file extension and the mapped media type is - returned, or `false` is there is no mapping. - -This includes two special mappings: - -- `'multipart'` -> `'multipart/*'` -- `'urlencoded'` -> `'application/x-www-form-urlencoded'` - ## Examples ### Example body parser @@ -185,8 +159,6 @@ app.use(function bodyParser (req, res, next) { [MIT](LICENSE) -[ci-image]: https://badgen.net/github/checks/jshttp/type-is/master?label=ci -[ci-url]: https://github.com/jshttp/type-is/actions/workflows/ci.yml [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/type-is/master [coveralls-url]: https://coveralls.io/r/jshttp/type-is?branch=master [node-version-image]: https://badgen.net/npm/node/type-is diff --git a/api/node_modules/type-is/index.js b/api/node_modules/type-is/index.js index e773845..890ad76 100644 --- a/api/node_modules/type-is/index.js +++ b/api/node_modules/type-is/index.js @@ -12,9 +12,8 @@ * @private */ -var contentType = require('content-type') -var mime = require('mime-types') var typer = require('media-typer') +var mime = require('mime-types') /** * Module exports. @@ -116,19 +115,27 @@ function hasbody (req) { * * this.is('html'); // => false * - * @param {Object} req - * @param {(String|Array)} types... - * @return {(String|false|null)} + * @param {String|Array} types... + * @return {String|false|null} * @public */ function typeofrequest (req, types_) { + var types = types_ + // no body - if (!hasbody(req)) return null + if (!hasbody(req)) { + return null + } + // support flattened arguments - var types = arguments.length > 2 - ? Array.prototype.slice.call(arguments, 1) - : types_ + if (arguments.length > 2) { + types = new Array(arguments.length - 1) + for (var i = 0; i < types.length; i++) { + types[i] = arguments[i + 1] + } + } + // request content type var value = req.headers['content-type'] @@ -148,8 +155,7 @@ function typeofrequest (req, types_) { * and are thus ensured to work. * * @param {String} type - * @return {String|false|null} - * @public + * @private */ function normalize (type) { @@ -183,7 +189,7 @@ function normalize (type) { * @param {String} expected * @param {String} actual * @return {Boolean} - * @public + * @private */ function mimeMatch (expected, actual) { @@ -207,9 +213,9 @@ function mimeMatch (expected, actual) { } // validate suffix wildcard - if (expectedParts[1].slice(0, 2) === '*+') { + if (expectedParts[1].substr(0, 2) === '*+') { return expectedParts[1].length <= actualParts[1].length + 1 && - expectedParts[1].slice(1) === actualParts[1].slice(1 - expectedParts[1].length) + expectedParts[1].substr(1) === actualParts[1].substr(1 - expectedParts[1].length) } // validate subtype @@ -224,26 +230,36 @@ function mimeMatch (expected, actual) { * Normalize a type and remove parameters. * * @param {string} value - * @return {(string|null)} + * @return {string} * @private */ -function normalizeType (value) { - // Parse the type - var type = contentType.parse(value).type - return typer.test(type) ? type : null +function normalizeType (value) { + // parse the type + var type = typer.parse(value) + + // remove the parameters + type.parameters = undefined + + // reformat it + return typer.format(type) } /** * Try to normalize a type and remove parameters. * * @param {string} value - * @return {(string|null)} + * @return {string} * @private */ + function tryNormalizeType (value) { + if (!value) { + return null + } + try { - return value ? normalizeType(value) : null + return normalizeType(value) } catch (err) { return null } diff --git a/api/node_modules/type-is/package.json b/api/node_modules/type-is/package.json index 08586d2..97ba5f1 100644 --- a/api/node_modules/type-is/package.json +++ b/api/node_modules/type-is/package.json @@ -1,7 +1,7 @@ { "name": "type-is", "description": "Infer the content-type of a request.", - "version": "2.0.1", + "version": "1.6.18", "contributors": [ "Douglas Christopher Wilson ", "Jonathan Ong (http://jongleberry.com)" @@ -9,20 +9,19 @@ "license": "MIT", "repository": "jshttp/type-is", "dependencies": { - "content-type": "^1.0.5", - "media-typer": "^1.1.0", - "mime-types": "^3.0.0" + "media-typer": "0.3.0", + "mime-types": "~2.1.24" }, "devDependencies": { - "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": "5.2.0", - "eslint-plugin-standard": "4.1.0", - "mocha": "9.2.1", - "nyc": "15.1.0" + "eslint": "5.16.0", + "eslint-config-standard": "12.0.0", + "eslint-plugin-import": "2.17.2", + "eslint-plugin-markdown": "1.0.0", + "eslint-plugin-node": "8.0.1", + "eslint-plugin-promise": "4.1.1", + "eslint-plugin-standard": "4.0.0", + "mocha": "6.1.4", + "nyc": "14.0.0" }, "engines": { "node": ">= 0.6" @@ -33,11 +32,10 @@ "index.js" ], "scripts": { - "lint": "eslint .", + "lint": "eslint --plugin markdown --ext js,md .", "test": "mocha --reporter spec --check-leaks --bail test/", - "test:debug": "mocha --reporter spec --check-leaks --inspect --inspect-brk test/", - "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", - "test-cov": "nyc --reporter=html --reporter=text npm test" + "test-cov": "nyc --reporter=html --reporter=text npm test", + "test-travis": "nyc --reporter=text npm test" }, "keywords": [ "content", diff --git a/api/node_modules/wrappy/LICENSE b/api/node_modules/wrappy/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/api/node_modules/wrappy/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/api/node_modules/wrappy/README.md b/api/node_modules/wrappy/README.md deleted file mode 100644 index 98eab25..0000000 --- a/api/node_modules/wrappy/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# wrappy - -Callback wrapping utility - -## USAGE - -```javascript -var wrappy = require("wrappy") - -// var wrapper = wrappy(wrapperFunction) - -// make sure a cb is called only once -// See also: http://npm.im/once for this specific use case -var once = wrappy(function (cb) { - var called = false - return function () { - if (called) return - called = true - return cb.apply(this, arguments) - } -}) - -function printBoo () { - console.log('boo') -} -// has some rando property -printBoo.iAmBooPrinter = true - -var onlyPrintOnce = once(printBoo) - -onlyPrintOnce() // prints 'boo' -onlyPrintOnce() // does nothing - -// random property is retained! -assert.equal(onlyPrintOnce.iAmBooPrinter, true) -``` diff --git a/api/node_modules/wrappy/package.json b/api/node_modules/wrappy/package.json deleted file mode 100644 index 1307520..0000000 --- a/api/node_modules/wrappy/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "wrappy", - "version": "1.0.2", - "description": "Callback wrapping utility", - "main": "wrappy.js", - "files": [ - "wrappy.js" - ], - "directories": { - "test": "test" - }, - "dependencies": {}, - "devDependencies": { - "tap": "^2.3.1" - }, - "scripts": { - "test": "tap --coverage test/*.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/npm/wrappy" - }, - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "ISC", - "bugs": { - "url": "https://github.com/npm/wrappy/issues" - }, - "homepage": "https://github.com/npm/wrappy" -} diff --git a/api/node_modules/wrappy/wrappy.js b/api/node_modules/wrappy/wrappy.js deleted file mode 100644 index bb7e7d6..0000000 --- a/api/node_modules/wrappy/wrappy.js +++ /dev/null @@ -1,33 +0,0 @@ -// Returns a wrapper function that returns a wrapped callback -// The wrapper function should do some stuff, and return a -// presumably different callback function. -// This makes sure that own properties are retained, so that -// decorations and such are not lost along the way. -module.exports = wrappy -function wrappy (fn, cb) { - if (fn && cb) return wrappy(fn)(cb) - - if (typeof fn !== 'function') - throw new TypeError('need wrapper function') - - Object.keys(fn).forEach(function (k) { - wrapper[k] = fn[k] - }) - - return wrapper - - function wrapper() { - var args = new Array(arguments.length) - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i] - } - var ret = fn.apply(this, args) - var cb = args[args.length-1] - if (typeof ret === 'function' && ret !== cb) { - Object.keys(cb).forEach(function (k) { - ret[k] = cb[k] - }) - } - return ret - } -} diff --git a/api/package-lock.json b/api/package-lock.json index 4980d2f..b6bbfa2 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -1,47 +1,502 @@ { - "name": "api", + "name": "planilla-api", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "api", + "name": "planilla-api", "version": "1.0.0", - "license": "ISC", "dependencies": { - "express": "^5.1.0", - "pg": "^8.15.6" + "@prisma/client": "^6.7.0", + "express": "^4.18.2", + "pg": "^8.8.0", + "prisma": "^6.7.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.4.tgz", + "integrity": "sha512-1VCICWypeQKhVbE9oW/sJaAmjLxhVqacdkvPLEjwlttjfwENRSClS8EjBz0KzRyFSCPDIkuXW34Je/vk7zdB7Q==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.4.tgz", + "integrity": "sha512-QNdQEps7DfFwE3hXiU4BZeOV68HHzYwGd0Nthhd3uCkkEKK7/R6MTgM0P7H7FAs5pU/DIWsviMmEGxEoxIZ+ZQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.4.tgz", + "integrity": "sha512-bBy69pgfhMGtCnwpC/x5QhfxAz/cBgQ9enbtwjf6V9lnPI/hMyT9iWpR1arm0l3kttTr4L0KSLpKmLp/ilKS9A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.4.tgz", + "integrity": "sha512-TVhdVtQIFuVpIIR282btcGC2oGQoSfZfmBdTip2anCaVYcqWlZXGcdcKIUklfX2wj0JklNYgz39OBqh2cqXvcQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.4.tgz", + "integrity": "sha512-Y1giCfM4nlHDWEfSckMzeWNdQS31BQGs9/rouw6Ub91tkK79aIMTH3q9xHvzH8d0wDru5Ci0kWB8b3up/nl16g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.4.tgz", + "integrity": "sha512-CJsry8ZGM5VFVeyUYB3cdKpd/H69PYez4eJh1W/t38vzutdjEjtP7hB6eLKBoOdxcAlCtEYHzQ/PJ/oU9I4u0A==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.4.tgz", + "integrity": "sha512-yYq+39NlTRzU2XmoPW4l5Ifpl9fqSk0nAJYM/V/WUGPEFfek1epLHJIkTQM6bBs1swApjO5nWgvr843g6TjxuQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.4.tgz", + "integrity": "sha512-0FgvOJ6UUMflsHSPLzdfDnnBBVoCDtBTVyn/MrWloUNvq/5SFmh13l3dvgRPkDihRxb77Y17MbqbCAa2strMQQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.4.tgz", + "integrity": "sha512-kro4c0P85GMfFYqW4TWOpvmF8rFShbWGnrLqlzp4X1TNWjRY3JMYUfDCtOxPKOIY8B0WC8HN51hGP4I4hz4AaQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.4.tgz", + "integrity": "sha512-+89UsQTfXdmjIvZS6nUnOOLoXnkUTB9hR5QAeLrQdzOSWZvNSAXAtcRDHWtqAUtAmv7ZM1WPOOeSxDzzzMogiQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.4.tgz", + "integrity": "sha512-yTEjoapy8UP3rv8dB0ip3AfMpRbyhSN3+hY8mo/i4QXFeDxmiYbEKp3ZRjBKcOP862Ua4b1PDfwlvbuwY7hIGQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.4.tgz", + "integrity": "sha512-NeqqYkrcGzFwi6CGRGNMOjWGGSYOpqwCjS9fvaUlX5s3zwOtn1qwg1s2iE2svBe4Q/YOG1q6875lcAoQK/F4VA==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.4.tgz", + "integrity": "sha512-IcvTlF9dtLrfL/M8WgNI/qJYBENP3ekgsHbYUIzEzq5XJzzVEV/fXY9WFPfEEXmu3ck2qJP8LG/p3Q8f7Zc2Xg==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.4.tgz", + "integrity": "sha512-HOy0aLTJTVtoTeGZh4HSXaO6M95qu4k5lJcH4gxv56iaycfz1S8GO/5Jh6X4Y1YiI0h7cRyLi+HixMR+88swag==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.4.tgz", + "integrity": "sha512-i8JUDAufpz9jOzo4yIShCTcXzS07vEgWzyX3NH2G7LEFVgrLEhjwL3ajFE4fZI3I4ZgiM7JH3GQ7ReObROvSUA==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.4.tgz", + "integrity": "sha512-jFnu+6UbLlzIjPQpWCNh5QtrcNfMLjgIavnwPQAfoGx4q17ocOU9MsQ2QVvFxwQoWpZT8DvTLooTvmOQXkO51g==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.4.tgz", + "integrity": "sha512-6e0cvXwzOnVWJHq+mskP8DNSrKBr1bULBvnFLpc1KY+d+irZSgZ02TGse5FsafKS5jg2e4pbvK6TPXaF/A6+CA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.4.tgz", + "integrity": "sha512-vUnkBYxZW4hL/ie91hSqaSNjulOnYXE1VSLusnvHg2u3jewJBz3YzB9+oCw8DABeVqZGg94t9tyZFoHma8gWZQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.4.tgz", + "integrity": "sha512-XAg8pIQn5CzhOB8odIcAm42QsOfa98SBeKUdo4xa8OvX8LbMZqEtgeWE9P/Wxt7MlG2QqvjGths+nq48TrUiKw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.4.tgz", + "integrity": "sha512-Ct2WcFEANlFDtp1nVAXSNBPDxyU+j7+tId//iHXU2f/lN5AmO4zLyhDcpR5Cz1r08mVxzt3Jpyt4PmXQ1O6+7A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.4.tgz", + "integrity": "sha512-xAGGhyOQ9Otm1Xu8NT1ifGLnA6M3sJxZ6ixylb+vIUVzvvd6GOALpwQrYrtlPouMqd/vSbgehz6HaVk4+7Afhw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.4.tgz", + "integrity": "sha512-Mw+tzy4pp6wZEK0+Lwr76pWLjrtjmJyUB23tHKqEDP74R3q95luY/bXqXZeYl4NYlvwOqoRKlInQialgCKy67Q==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.4.tgz", + "integrity": "sha512-AVUP428VQTSddguz9dO9ngb+E5aScyg7nOeJDrF1HPYu555gmza3bDGMPhmVXL8svDSoqPCsCPjb265yG/kLKQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.4.tgz", + "integrity": "sha512-i1sW+1i+oWvQzSgfRcxxG2k4I9n3O9NRqy8U+uugaT2Dy7kLO9Y7wI72haOahxceMX8hZAzgGou1FhndRldxRg==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.4.tgz", + "integrity": "sha512-nOT2vZNw6hJ+z43oP1SPea/G/6AbN6X+bGNhNuq8NtRHy4wsMhw765IKLNmnjek7GvjWBYQ8Q5VBoYTFg9y1UQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@prisma/client": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.7.0.tgz", + "integrity": "sha512-+k61zZn1XHjbZul8q6TdQLpuI/cvyfil87zqK2zpreNIXyXtpUv3+H/oM69hcsFcZXaokHJIzPAt5Z8C8eK2QA==", + "hasInstallScript": true, + "engines": { + "node": ">=18.18" + }, + "peerDependencies": { + "prisma": "*", + "typescript": ">=5.1.0" + }, + "peerDependenciesMeta": { + "prisma": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/@prisma/config": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/config/-/config-6.7.0.tgz", + "integrity": "sha512-di8QDdvSz7DLUi3OOcCHSwxRNeW7jtGRUD2+Z3SdNE3A+pPiNT8WgUJoUyOwJmUr5t+JA2W15P78C/N+8RXrOA==", + "dependencies": { + "esbuild": ">=0.12 <1", + "esbuild-register": "3.6.0" + } + }, + "node_modules/@prisma/debug": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.7.0.tgz", + "integrity": "sha512-RabHn9emKoYFsv99RLxvfG2GHzWk2ZI1BuVzqYtmMSIcuGboHY5uFt3Q3boOREM9de6z5s3bQoyKeWnq8Fz22w==" + }, + "node_modules/@prisma/engines": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.7.0.tgz", + "integrity": "sha512-3wDMesnOxPrOsq++e5oKV9LmIiEazFTRFZrlULDQ8fxdub5w4NgRBoxtWbvXmj2nJVCnzuz6eFix3OhIqsZ1jw==", + "hasInstallScript": true, + "dependencies": { + "@prisma/debug": "6.7.0", + "@prisma/engines-version": "6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed", + "@prisma/fetch-engine": "6.7.0", + "@prisma/get-platform": "6.7.0" + } + }, + "node_modules/@prisma/engines-version": { + "version": "6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed.tgz", + "integrity": "sha512-EvpOFEWf1KkJpDsBCrih0kg3HdHuaCnXmMn7XFPObpFTzagK1N0Q0FMnYPsEhvARfANP5Ok11QyoTIRA2hgJTA==" + }, + "node_modules/@prisma/fetch-engine": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.7.0.tgz", + "integrity": "sha512-zLlAGnrkmioPKJR4Yf7NfW3hftcvqeNNEHleMZK9yX7RZSkhmxacAYyfGsCcqRt47jiZ7RKdgE0Wh2fWnm7WsQ==", + "dependencies": { + "@prisma/debug": "6.7.0", + "@prisma/engines-version": "6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed", + "@prisma/get-platform": "6.7.0" + } + }, + "node_modules/@prisma/get-platform": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.7.0.tgz", + "integrity": "sha512-i9IH5lO4fQwnMLvQLYNdgVh9TK3PuWBfQd7QLk/YurnAIg+VeADcZDbmhAi4XBBDD+hDif9hrKyASu0hbjwabw==", + "dependencies": { + "@prisma/debug": "6.7.0" } }, "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==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "dependencies": { - "mime-types": "^3.0.0", - "negotiator": "^1.0.0" + "mime-types": "~2.1.34", + "negotiator": "0.6.3" }, "engines": { "node": ">= 0.6" } }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, "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==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", "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" + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" }, "engines": { - "node": ">=18" + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" } }, "node_modules/bytes": { @@ -80,9 +535,9 @@ } }, "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==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", "dependencies": { "safe-buffer": "5.2.1" }, @@ -99,35 +554,24 @@ } }, "node_modules/cookie": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", - "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", "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==", - "engines": { - "node": ">=6.6.0" - } + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, "node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "ms": "2.0.0" } }, "node_modules/depd": { @@ -138,6 +582,15 @@ "node": ">= 0.8" } }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -191,6 +644,77 @@ "node": ">= 0.4" } }, + "node_modules/esbuild": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.4.tgz", + "integrity": "sha512-8pgjLUcUjcgDg+2Q4NYXnPbo/vncAY4UmyaCm0jZevERqCHZIaWwdJHkf8XQtu4AxSKCdvrUbT0XUr1IdZzI8Q==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.4", + "@esbuild/android-arm": "0.25.4", + "@esbuild/android-arm64": "0.25.4", + "@esbuild/android-x64": "0.25.4", + "@esbuild/darwin-arm64": "0.25.4", + "@esbuild/darwin-x64": "0.25.4", + "@esbuild/freebsd-arm64": "0.25.4", + "@esbuild/freebsd-x64": "0.25.4", + "@esbuild/linux-arm": "0.25.4", + "@esbuild/linux-arm64": "0.25.4", + "@esbuild/linux-ia32": "0.25.4", + "@esbuild/linux-loong64": "0.25.4", + "@esbuild/linux-mips64el": "0.25.4", + "@esbuild/linux-ppc64": "0.25.4", + "@esbuild/linux-riscv64": "0.25.4", + "@esbuild/linux-s390x": "0.25.4", + "@esbuild/linux-x64": "0.25.4", + "@esbuild/netbsd-arm64": "0.25.4", + "@esbuild/netbsd-x64": "0.25.4", + "@esbuild/openbsd-arm64": "0.25.4", + "@esbuild/openbsd-x64": "0.25.4", + "@esbuild/sunos-x64": "0.25.4", + "@esbuild/win32-arm64": "0.25.4", + "@esbuild/win32-ia32": "0.25.4", + "@esbuild/win32-x64": "0.25.4" + } + }, + "node_modules/esbuild-register": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/esbuild-register/-/esbuild-register-3.6.0.tgz", + "integrity": "sha512-H2/S7Pm8a9CL1uhp9OvjwrBh5Pvx0H8qVOxNu8Wed9Y7qv56MPtq+GGM8RJpq6glYJn9Wspr8uw7l55uyinNeg==", + "dependencies": { + "debug": "^4.3.4" + }, + "peerDependencies": { + "esbuild": ">=0.12 <1" + } + }, + "node_modules/esbuild-register/node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild-register/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -205,40 +729,44 @@ } }, "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==", + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", "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" + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.7.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.12", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" }, "engines": { - "node": ">= 18" + "node": ">= 0.10.0" }, "funding": { "type": "opencollective", @@ -246,16 +774,17 @@ } }, "node_modules/finalhandler": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz", - "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", "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" + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" }, "engines": { "node": ">= 0.8" @@ -270,11 +799,24 @@ } }, "node_modules/fresh": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", - "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", "engines": { - "node": ">= 0.8" + "node": ">= 0.6" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, "node_modules/function-bind": { @@ -369,11 +911,11 @@ } }, "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==", + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" + "safer-buffer": ">= 2.1.2 < 3" }, "engines": { "node": ">=0.10.0" @@ -392,11 +934,6 @@ "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==" - }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", @@ -406,56 +943,80 @@ } }, "node_modules/media-typer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", - "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", "engines": { - "node": ">= 0.8" + "node": ">= 0.6" } }, "node_modules/merge-descriptors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", - "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", - "engines": { - "node": ">=18" - }, + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/mime-db": { - "version": "1.54.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", - "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "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==", + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dependencies": { - "mime-db": "^1.54.0" + "mime-db": "1.52.0" }, "engines": { "node": ">= 0.6" } }, "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==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, "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==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "engines": { "node": ">= 0.6" } }, + "node_modules/node-cron": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/node-cron/-/node-cron-4.0.5.tgz", + "integrity": "sha512-XN5PwNBniFz6y9Ic/VChtrBtlXfAqdKUFou7nid/1pLGNFKO7cXN1nmLKUL7KLnM/Y4nUe5/EC+GsAghCj/N5g==", + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/object-inspect": { "version": "1.13.4", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", @@ -478,14 +1039,6 @@ "node": ">= 0.8" } }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dependencies": { - "wrappy": "1" - } - }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -495,12 +1048,9 @@ } }, "node_modules/path-to-regexp": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz", - "integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==", - "engines": { - "node": ">=16" - } + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==" }, "node_modules/pg": { "version": "8.15.6", @@ -618,6 +1168,33 @@ "node": ">=0.10.0" } }, + "node_modules/prisma": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.7.0.tgz", + "integrity": "sha512-vArg+4UqnQ13CVhc2WUosemwh6hr6cr6FY2uzDvCIFwH8pu8BXVv38PktoMLVjtX7sbYThxbnZF5YiR8sN2clw==", + "hasInstallScript": true, + "dependencies": { + "@prisma/config": "6.7.0", + "@prisma/engines": "6.7.0" + }, + "bin": { + "prisma": "build/index.js" + }, + "engines": { + "node": ">=18.18" + }, + "optionalDependencies": { + "fsevents": "2.3.3" + }, + "peerDependencies": { + "typescript": ">=5.1.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -631,11 +1208,11 @@ } }, "node_modules/qs": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", - "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "dependencies": { - "side-channel": "^1.1.0" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" @@ -653,34 +1230,19 @@ } }, "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==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", - "iconv-lite": "0.6.3", + "iconv-lite": "0.4.24", "unpipe": "1.0.0" }, "engines": { "node": ">= 0.8" } }, - "node_modules/router": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", - "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", - "dependencies": { - "debug": "^4.4.0", - "depd": "^2.0.0", - "is-promise": "^4.0.0", - "parseurl": "^1.3.3", - "path-to-regexp": "^8.0.0" - }, - "engines": { - "node": ">= 18" - } - }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -706,38 +1268,53 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/send": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", - "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "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" + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" }, "engines": { - "node": ">= 18" + "node": ">= 0.8.0" } }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, "node_modules/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==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "dependencies": { - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "parseurl": "^1.3.3", - "send": "^1.2.0" + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" }, "engines": { - "node": ">= 18" + "node": ">= 0.8.0" } }, "node_modules/setprototypeof": { @@ -838,13 +1415,12 @@ } }, "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==", + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", "dependencies": { - "content-type": "^1.0.5", - "media-typer": "^1.1.0", - "mime-types": "^3.0.0" + "media-typer": "0.3.0", + "mime-types": "~2.1.24" }, "engines": { "node": ">= 0.6" @@ -858,6 +1434,14 @@ "node": ">= 0.8" } }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -866,11 +1450,6 @@ "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==" - }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/api/package.json b/api/package.json index 31f0c8e..e3d15db 100644 --- a/api/package.json +++ b/api/package.json @@ -7,7 +7,10 @@ "start": "node server.js" }, "dependencies": { + "@prisma/client": "^6.7.0", "express": "^4.18.2", - "pg": "^8.8.0" + "node-cron": "^4.0.5", + "pg": "^8.8.0", + "prisma": "^6.7.0" } } diff --git a/api/prisma/schema.prisma b/api/prisma/schema.prisma new file mode 100644 index 0000000..e8b9fe9 --- /dev/null +++ b/api/prisma/schema.prisma @@ -0,0 +1,15 @@ +// This is your Prisma schema file, +// learn more about it in the docs: https://pris.ly/d/prisma-schema + +// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? +// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init + +generator client { + provider = "prisma-client-js" + output = "../generated/prisma" +} + +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") +} diff --git a/dev/scripts/estructura.ps1 b/dev/scripts/estructura.ps1 new file mode 100644 index 0000000..e168ee7 --- /dev/null +++ b/dev/scripts/estructura.ps1 @@ -0,0 +1,5 @@ +$excluir = 'node_modules|\.vscode|\.git|dist|\.turbo' +Get-ChildItem -Recurse -Force -ErrorAction SilentlyContinue | Where-Object { + $_.FullName -notmatch $excluir +} | Select-Object -ExpandProperty FullName | Set-Content -Encoding utf8 estructura.txt +Write-Output "Estructura actualizada en estructura.txt" diff --git a/docker-compose.yml b/docker-compose.yml index ac66d75..99e8d53 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,61 +1,50 @@ -version: '3.8' +version: "3.9" services: - db: - container_name: planilla-db - image: postgres:15 - environment: - POSTGRES_USER: usuario - POSTGRES_PASSWORD: clave - POSTGRES_DB: midb - volumes: - - db_data:/var/lib/postgresql/data - networks: - - app-net + agent: + image: gitea.interno.com/nucleo000/planilla-agent:latest + build: ./agent + restart: unless-stopped + networks: [planilla] api: - container_name: planilla-api + image: gitea.interno.com/nucleo000/planilla-api:latest + restart: unless-stopped build: ./api - depends_on: - - db - environment: - DB_HOST: db - DB_USER: usuario - DB_PASSWORD: clave - DB_NAME: midb - expose: - - "4000" - networks: - - app-net - - ui: - container_name: planilla-ui - build: ./ui - depends_on: - - api - expose: - - "80" - networks: - - app-net - - principal - + env_file: .env + depends_on: [db] + networks: [principal, planilla] mcp: - container_name: planilla-mcp + image: gitea.interno.com/nucleo000/planilla-mcp:latest build: ./mcp - depends_on: - - api - expose: - - "5000" - networks: - - app-net + networks: [principal, planilla] + ui: + image: gitea.interno.com/nucleo000/planilla-ui:latest + build: ./ui + restart: unless-stopped + ports: ["3008:80"] + networks: [planilla] + + worker: + image: gitea.interno.com/nucleo000/planilla-worker:latest + build: ./worker + depends_on: [db] + networks: [planilla] + + db: + image: postgres:16 + environment: + POSTGRES_DB: planilla_db + POSTGRES_USER: planilla + POSTGRES_PASSWORD: secret + volumes: [db_data:/var/lib/postgresql/data] + networks: [planilla] volumes: db_data: networks: - app-net: - driver: bridge - principal: - external: true + planilla: + diff --git a/estructura.txt b/estructura.txt new file mode 100644 index 0000000..bfaa6f7 --- /dev/null +++ b/estructura.txt @@ -0,0 +1,54 @@ +C:\no guardar\nucleo V3\planilla\agent +C:\no guardar\nucleo V3\planilla\api +C:\no guardar\nucleo V3\planilla\core +C:\no guardar\nucleo V3\planilla\dev +C:\no guardar\nucleo V3\planilla\mcp +C:\no guardar\nucleo V3\planilla\ui +C:\no guardar\nucleo V3\planilla\worker +C:\no guardar\nucleo V3\planilla\.env +C:\no guardar\nucleo V3\planilla\docker-compose.yml +C:\no guardar\nucleo V3\planilla\Dockerfile +C:\no guardar\nucleo V3\planilla\estructura.txt +C:\no guardar\nucleo V3\planilla\index.js +C:\no guardar\nucleo V3\planilla\Makefile +C:\no guardar\nucleo V3\planilla\package-lock.json +C:\no guardar\nucleo V3\planilla\package.json +C:\no guardar\nucleo V3\planilla\README.md +C:\no guardar\nucleo V3\planilla\api\cron_jobs +C:\no guardar\nucleo V3\planilla\api\prisma +C:\no guardar\nucleo V3\planilla\api\.env +C:\no guardar\nucleo V3\planilla\api\Dockerfile +C:\no guardar\nucleo V3\planilla\api\package-lock.json +C:\no guardar\nucleo V3\planilla\api\package.json +C:\no guardar\nucleo V3\planilla\api\server.js +C:\no guardar\nucleo V3\planilla\api\prisma\schema.prisma +C:\no guardar\nucleo V3\planilla\dev\scripts +C:\no guardar\nucleo V3\planilla\dev\scripts\estructura.ps1 +C:\no guardar\nucleo V3\planilla\mcp\Dockerfile +C:\no guardar\nucleo V3\planilla\mcp\index.js +C:\no guardar\nucleo V3\planilla\mcp\package-lock.json +C:\no guardar\nucleo V3\planilla\mcp\package.json +C:\no guardar\nucleo V3\planilla\ui\public +C:\no guardar\nucleo V3\planilla\ui\src +C:\no guardar\nucleo V3\planilla\ui\Dockerfile +C:\no guardar\nucleo V3\planilla\ui\index.html +C:\no guardar\nucleo V3\planilla\ui\package-lock.json +C:\no guardar\nucleo V3\planilla\ui\package.json +C:\no guardar\nucleo V3\planilla\ui\README.md +C:\no guardar\nucleo V3\planilla\ui\vite.config.js +C:\no guardar\nucleo V3\planilla\ui\public\vite.svg +C:\no guardar\nucleo V3\planilla\ui\src\assets +C:\no guardar\nucleo V3\planilla\ui\src\components +C:\no guardar\nucleo V3\planilla\ui\src\App.vue +C:\no guardar\nucleo V3\planilla\ui\src\main.js +C:\no guardar\nucleo V3\planilla\ui\src\style.css +C:\no guardar\nucleo V3\planilla\ui\src\assets\vue.svg +C:\no guardar\nucleo V3\planilla\ui\src\components\HelloWorld.vue +C:\no guardar\nucleo V3\planilla\worker\cron_jobs +C:\no guardar\nucleo V3\planilla\worker\prisma +C:\no guardar\nucleo V3\planilla\worker\.env +C:\no guardar\nucleo V3\planilla\worker\Dockerfile +C:\no guardar\nucleo V3\planilla\worker\package-lock.json +C:\no guardar\nucleo V3\planilla\worker\package.json +C:\no guardar\nucleo V3\planilla\worker\server.js +C:\no guardar\nucleo V3\planilla\worker\prisma\schema.prisma diff --git a/index.js b/index.js deleted file mode 100644 index d79ef3d..0000000 --- a/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const http = require('http'); - -const server = http.createServer((req, res) => { - res.writeHead(200, { 'Content-Type': 'text/plain' }); - res.end('esta ya seria la mera pija de todo\n'); -}); - -const PORT = 3000; -server.listen(PORT, () => { - console.log(`Servidor corriendo en http://localhost:${PORT}`); -}); diff --git a/mcp/.gitignore b/mcp/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/mcp/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/mcp/index.js b/mcp/index.js new file mode 100644 index 0000000..bbf3ff0 --- /dev/null +++ b/mcp/index.js @@ -0,0 +1,37 @@ +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; + +// Creo la instancia del servidor MCP +const server = new McpServer({ + name: "hello-world", + version: "0.1.0", + capabilities: { + resources: {}, + tools: {} + } +}); + +// Registro un tool “hello-world” que devuelve un saludo +server.tool( + "hello-world", + "Devuelve un saludo de prueba", + {}, // sin parámetros + async () => ({ + content: [ + { type: "text", text: "¡Hola, mundo!" } + ] + }) +); + +async function main() { + // Me conecto por stdio (puede ser stdin/stdout de un cliente MCP) + const transport = new StdioServerTransport(); + await server.connect(transport); + console.log("MCP Hello World Server corriendo por stdio"); + console.error("MCP Hello World Server corriendo por stdio"); +} + +main().catch(err => { + console.error("Error fatal en MCP server:", err); + process.exit(1); +}); diff --git a/mcp/package.json b/mcp/package.json index 0c3a86c..5c5221f 100644 --- a/mcp/package.json +++ b/mcp/package.json @@ -1,18 +1,11 @@ { - "name": "planilla-mcp", - "version": "1.0.0", + "name": "planilla-mcp-server", + "version": "0.1.0", "type": "module", - "main": "server.js", "scripts": { - "start": "node server.js" + "start": "node index.js" }, "dependencies": { - "@modelcontextprotocol/sdk": "^1.11.0", - "express": "^4.18.2", - "zod": "^3.24.3" - }, - "keywords": [], - "author": "", - "license": "ISC", - "description": "" + "@modelcontextprotocol/sdk": "^1.0.0" + } } diff --git a/mcp/server.js b/mcp/server.js deleted file mode 100644 index 6f10996..0000000 --- a/mcp/server.js +++ /dev/null @@ -1,31 +0,0 @@ -import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js"; -import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; -import { z } from "zod"; - -// Inicializamos el servidor MCP -const server = new McpServer({ - name: "planilla-mcp", - version: "1.0.0" -}); - -// Ejemplo de herramienta: suma dos números -server.tool( - "add", - { a: z.number(), b: z.number() }, - async ({ a, b }) => ({ - content: [{ type: "text", text: `Resultado: ${a + b}` }] - }) -); - -// Ejemplo de recurso dinámico -server.resource( - "greeting", - new ResourceTemplate("greeting://{name}", { list: undefined }), - async (uri, { name }) => ({ - contents: [{ uri: uri.href, text: `¡Hola, ${name}!` }] - }) -); - -// Conectamos el transporte STDIO (útil para CLI o Claude Desktop) -const transport = new StdioServerTransport(); -await server.connect(transport); diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index fc0c9cf..0000000 --- a/package-lock.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "hello-world", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "hello-world", - "version": "1.0.0", - "license": "ISC" - } - } - } - \ No newline at end of file diff --git a/package.json b/package.json deleted file mode 100644 index 309f521..0000000 --- a/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "hello-world", - "version": "1.0.0", - "main": "index.js", - "type": "commonjs", - "scripts": { - "start": "node index.js" - } - } - \ No newline at end of file diff --git a/worker/.gitignore b/worker/.gitignore new file mode 100644 index 0000000..11ddd8d --- /dev/null +++ b/worker/.gitignore @@ -0,0 +1,3 @@ +node_modules +# Keep environment variables out of version control +.env diff --git a/worker/Dockerfile b/worker/Dockerfile new file mode 100644 index 0000000..ef719ec --- /dev/null +++ b/worker/Dockerfile @@ -0,0 +1,7 @@ +# planilla/api/Dockerfile +FROM node:18-alpine +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +CMD ["`npm", "start"] diff --git a/worker/package-lock.json b/worker/package-lock.json new file mode 100644 index 0000000..b6bbfa2 --- /dev/null +++ b/worker/package-lock.json @@ -0,0 +1,1462 @@ +{ + "name": "planilla-api", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "planilla-api", + "version": "1.0.0", + "dependencies": { + "@prisma/client": "^6.7.0", + "express": "^4.18.2", + "pg": "^8.8.0", + "prisma": "^6.7.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.4.tgz", + "integrity": "sha512-1VCICWypeQKhVbE9oW/sJaAmjLxhVqacdkvPLEjwlttjfwENRSClS8EjBz0KzRyFSCPDIkuXW34Je/vk7zdB7Q==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.4.tgz", + "integrity": "sha512-QNdQEps7DfFwE3hXiU4BZeOV68HHzYwGd0Nthhd3uCkkEKK7/R6MTgM0P7H7FAs5pU/DIWsviMmEGxEoxIZ+ZQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.4.tgz", + "integrity": "sha512-bBy69pgfhMGtCnwpC/x5QhfxAz/cBgQ9enbtwjf6V9lnPI/hMyT9iWpR1arm0l3kttTr4L0KSLpKmLp/ilKS9A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.4.tgz", + "integrity": "sha512-TVhdVtQIFuVpIIR282btcGC2oGQoSfZfmBdTip2anCaVYcqWlZXGcdcKIUklfX2wj0JklNYgz39OBqh2cqXvcQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.4.tgz", + "integrity": "sha512-Y1giCfM4nlHDWEfSckMzeWNdQS31BQGs9/rouw6Ub91tkK79aIMTH3q9xHvzH8d0wDru5Ci0kWB8b3up/nl16g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.4.tgz", + "integrity": "sha512-CJsry8ZGM5VFVeyUYB3cdKpd/H69PYez4eJh1W/t38vzutdjEjtP7hB6eLKBoOdxcAlCtEYHzQ/PJ/oU9I4u0A==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.4.tgz", + "integrity": "sha512-yYq+39NlTRzU2XmoPW4l5Ifpl9fqSk0nAJYM/V/WUGPEFfek1epLHJIkTQM6bBs1swApjO5nWgvr843g6TjxuQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.4.tgz", + "integrity": "sha512-0FgvOJ6UUMflsHSPLzdfDnnBBVoCDtBTVyn/MrWloUNvq/5SFmh13l3dvgRPkDihRxb77Y17MbqbCAa2strMQQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.4.tgz", + "integrity": "sha512-kro4c0P85GMfFYqW4TWOpvmF8rFShbWGnrLqlzp4X1TNWjRY3JMYUfDCtOxPKOIY8B0WC8HN51hGP4I4hz4AaQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.4.tgz", + "integrity": "sha512-+89UsQTfXdmjIvZS6nUnOOLoXnkUTB9hR5QAeLrQdzOSWZvNSAXAtcRDHWtqAUtAmv7ZM1WPOOeSxDzzzMogiQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.4.tgz", + "integrity": "sha512-yTEjoapy8UP3rv8dB0ip3AfMpRbyhSN3+hY8mo/i4QXFeDxmiYbEKp3ZRjBKcOP862Ua4b1PDfwlvbuwY7hIGQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.4.tgz", + "integrity": "sha512-NeqqYkrcGzFwi6CGRGNMOjWGGSYOpqwCjS9fvaUlX5s3zwOtn1qwg1s2iE2svBe4Q/YOG1q6875lcAoQK/F4VA==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.4.tgz", + "integrity": "sha512-IcvTlF9dtLrfL/M8WgNI/qJYBENP3ekgsHbYUIzEzq5XJzzVEV/fXY9WFPfEEXmu3ck2qJP8LG/p3Q8f7Zc2Xg==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.4.tgz", + "integrity": "sha512-HOy0aLTJTVtoTeGZh4HSXaO6M95qu4k5lJcH4gxv56iaycfz1S8GO/5Jh6X4Y1YiI0h7cRyLi+HixMR+88swag==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.4.tgz", + "integrity": "sha512-i8JUDAufpz9jOzo4yIShCTcXzS07vEgWzyX3NH2G7LEFVgrLEhjwL3ajFE4fZI3I4ZgiM7JH3GQ7ReObROvSUA==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.4.tgz", + "integrity": "sha512-jFnu+6UbLlzIjPQpWCNh5QtrcNfMLjgIavnwPQAfoGx4q17ocOU9MsQ2QVvFxwQoWpZT8DvTLooTvmOQXkO51g==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.4.tgz", + "integrity": "sha512-6e0cvXwzOnVWJHq+mskP8DNSrKBr1bULBvnFLpc1KY+d+irZSgZ02TGse5FsafKS5jg2e4pbvK6TPXaF/A6+CA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.4.tgz", + "integrity": "sha512-vUnkBYxZW4hL/ie91hSqaSNjulOnYXE1VSLusnvHg2u3jewJBz3YzB9+oCw8DABeVqZGg94t9tyZFoHma8gWZQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.4.tgz", + "integrity": "sha512-XAg8pIQn5CzhOB8odIcAm42QsOfa98SBeKUdo4xa8OvX8LbMZqEtgeWE9P/Wxt7MlG2QqvjGths+nq48TrUiKw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.4.tgz", + "integrity": "sha512-Ct2WcFEANlFDtp1nVAXSNBPDxyU+j7+tId//iHXU2f/lN5AmO4zLyhDcpR5Cz1r08mVxzt3Jpyt4PmXQ1O6+7A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.4.tgz", + "integrity": "sha512-xAGGhyOQ9Otm1Xu8NT1ifGLnA6M3sJxZ6ixylb+vIUVzvvd6GOALpwQrYrtlPouMqd/vSbgehz6HaVk4+7Afhw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.4.tgz", + "integrity": "sha512-Mw+tzy4pp6wZEK0+Lwr76pWLjrtjmJyUB23tHKqEDP74R3q95luY/bXqXZeYl4NYlvwOqoRKlInQialgCKy67Q==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.4.tgz", + "integrity": "sha512-AVUP428VQTSddguz9dO9ngb+E5aScyg7nOeJDrF1HPYu555gmza3bDGMPhmVXL8svDSoqPCsCPjb265yG/kLKQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.4.tgz", + "integrity": "sha512-i1sW+1i+oWvQzSgfRcxxG2k4I9n3O9NRqy8U+uugaT2Dy7kLO9Y7wI72haOahxceMX8hZAzgGou1FhndRldxRg==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.4.tgz", + "integrity": "sha512-nOT2vZNw6hJ+z43oP1SPea/G/6AbN6X+bGNhNuq8NtRHy4wsMhw765IKLNmnjek7GvjWBYQ8Q5VBoYTFg9y1UQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@prisma/client": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.7.0.tgz", + "integrity": "sha512-+k61zZn1XHjbZul8q6TdQLpuI/cvyfil87zqK2zpreNIXyXtpUv3+H/oM69hcsFcZXaokHJIzPAt5Z8C8eK2QA==", + "hasInstallScript": true, + "engines": { + "node": ">=18.18" + }, + "peerDependencies": { + "prisma": "*", + "typescript": ">=5.1.0" + }, + "peerDependenciesMeta": { + "prisma": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/@prisma/config": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/config/-/config-6.7.0.tgz", + "integrity": "sha512-di8QDdvSz7DLUi3OOcCHSwxRNeW7jtGRUD2+Z3SdNE3A+pPiNT8WgUJoUyOwJmUr5t+JA2W15P78C/N+8RXrOA==", + "dependencies": { + "esbuild": ">=0.12 <1", + "esbuild-register": "3.6.0" + } + }, + "node_modules/@prisma/debug": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.7.0.tgz", + "integrity": "sha512-RabHn9emKoYFsv99RLxvfG2GHzWk2ZI1BuVzqYtmMSIcuGboHY5uFt3Q3boOREM9de6z5s3bQoyKeWnq8Fz22w==" + }, + "node_modules/@prisma/engines": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.7.0.tgz", + "integrity": "sha512-3wDMesnOxPrOsq++e5oKV9LmIiEazFTRFZrlULDQ8fxdub5w4NgRBoxtWbvXmj2nJVCnzuz6eFix3OhIqsZ1jw==", + "hasInstallScript": true, + "dependencies": { + "@prisma/debug": "6.7.0", + "@prisma/engines-version": "6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed", + "@prisma/fetch-engine": "6.7.0", + "@prisma/get-platform": "6.7.0" + } + }, + "node_modules/@prisma/engines-version": { + "version": "6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed.tgz", + "integrity": "sha512-EvpOFEWf1KkJpDsBCrih0kg3HdHuaCnXmMn7XFPObpFTzagK1N0Q0FMnYPsEhvARfANP5Ok11QyoTIRA2hgJTA==" + }, + "node_modules/@prisma/fetch-engine": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.7.0.tgz", + "integrity": "sha512-zLlAGnrkmioPKJR4Yf7NfW3hftcvqeNNEHleMZK9yX7RZSkhmxacAYyfGsCcqRt47jiZ7RKdgE0Wh2fWnm7WsQ==", + "dependencies": { + "@prisma/debug": "6.7.0", + "@prisma/engines-version": "6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed", + "@prisma/get-platform": "6.7.0" + } + }, + "node_modules/@prisma/get-platform": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.7.0.tgz", + "integrity": "sha512-i9IH5lO4fQwnMLvQLYNdgVh9TK3PuWBfQd7QLk/YurnAIg+VeADcZDbmhAi4XBBDD+hDif9hrKyASu0hbjwabw==", + "dependencies": { + "@prisma/debug": "6.7.0" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/body-parser": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/esbuild": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.4.tgz", + "integrity": "sha512-8pgjLUcUjcgDg+2Q4NYXnPbo/vncAY4UmyaCm0jZevERqCHZIaWwdJHkf8XQtu4AxSKCdvrUbT0XUr1IdZzI8Q==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.4", + "@esbuild/android-arm": "0.25.4", + "@esbuild/android-arm64": "0.25.4", + "@esbuild/android-x64": "0.25.4", + "@esbuild/darwin-arm64": "0.25.4", + "@esbuild/darwin-x64": "0.25.4", + "@esbuild/freebsd-arm64": "0.25.4", + "@esbuild/freebsd-x64": "0.25.4", + "@esbuild/linux-arm": "0.25.4", + "@esbuild/linux-arm64": "0.25.4", + "@esbuild/linux-ia32": "0.25.4", + "@esbuild/linux-loong64": "0.25.4", + "@esbuild/linux-mips64el": "0.25.4", + "@esbuild/linux-ppc64": "0.25.4", + "@esbuild/linux-riscv64": "0.25.4", + "@esbuild/linux-s390x": "0.25.4", + "@esbuild/linux-x64": "0.25.4", + "@esbuild/netbsd-arm64": "0.25.4", + "@esbuild/netbsd-x64": "0.25.4", + "@esbuild/openbsd-arm64": "0.25.4", + "@esbuild/openbsd-x64": "0.25.4", + "@esbuild/sunos-x64": "0.25.4", + "@esbuild/win32-arm64": "0.25.4", + "@esbuild/win32-ia32": "0.25.4", + "@esbuild/win32-x64": "0.25.4" + } + }, + "node_modules/esbuild-register": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/esbuild-register/-/esbuild-register-3.6.0.tgz", + "integrity": "sha512-H2/S7Pm8a9CL1uhp9OvjwrBh5Pvx0H8qVOxNu8Wed9Y7qv56MPtq+GGM8RJpq6glYJn9Wspr8uw7l55uyinNeg==", + "dependencies": { + "debug": "^4.3.4" + }, + "peerDependencies": { + "esbuild": ">=0.12 <1" + } + }, + "node_modules/esbuild-register/node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild-register/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.7.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.12", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/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==", + "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/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "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==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-cron": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/node-cron/-/node-cron-4.0.5.tgz", + "integrity": "sha512-XN5PwNBniFz6y9Ic/VChtrBtlXfAqdKUFou7nid/1pLGNFKO7cXN1nmLKUL7KLnM/Y4nUe5/EC+GsAghCj/N5g==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==" + }, + "node_modules/pg": { + "version": "8.15.6", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.15.6.tgz", + "integrity": "sha512-yvao7YI3GdmmrslNVsZgx9PfntfWrnXwtR+K/DjI0I/sTKif4Z623um+sjVZ1hk5670B+ODjvHDAckKdjmPTsg==", + "dependencies": { + "pg-connection-string": "^2.8.5", + "pg-pool": "^3.9.6", + "pg-protocol": "^1.9.5", + "pg-types": "^2.1.0", + "pgpass": "1.x" + }, + "engines": { + "node": ">= 8.0.0" + }, + "optionalDependencies": { + "pg-cloudflare": "^1.2.5" + }, + "peerDependencies": { + "pg-native": ">=3.0.1" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "node_modules/pg-cloudflare": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.2.5.tgz", + "integrity": "sha512-OOX22Vt0vOSRrdoUPKJ8Wi2OpE/o/h9T8X1s4qSkCedbNah9ei2W2765be8iMVxQUsvgT7zIAT2eIa9fs5+vtg==", + "optional": true + }, + "node_modules/pg-connection-string": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.8.5.tgz", + "integrity": "sha512-Ni8FuZ8yAF+sWZzojvtLE2b03cqjO5jNULcHFfM9ZZ0/JXrgom5pBREbtnAw7oxsxJqHw9Nz/XWORUEL3/IFow==" + }, + "node_modules/pg-int8": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", + "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/pg-pool": { + "version": "3.9.6", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.9.6.tgz", + "integrity": "sha512-rFen0G7adh1YmgvrmE5IPIqbb+IgEzENUm+tzm6MLLDSlPRoZVhzU1WdML9PV2W5GOdRA9qBKURlbt1OsXOsPw==", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "node_modules/pg-protocol": { + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.9.5.tgz", + "integrity": "sha512-DYTWtWpfd5FOro3UnAfwvhD8jh59r2ig8bPtc9H8Ds7MscE/9NYruUQWFAOuraRl29jwcT2kyMFQ3MxeaVjUhg==" + }, + "node_modules/pg-types": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", + "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pgpass": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", + "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", + "dependencies": { + "split2": "^4.1.0" + } + }, + "node_modules/postgres-array": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", + "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-bytea": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", + "integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-date": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", + "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-interval": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", + "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/prisma": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.7.0.tgz", + "integrity": "sha512-vArg+4UqnQ13CVhc2WUosemwh6hr6cr6FY2uzDvCIFwH8pu8BXVv38PktoMLVjtX7sbYThxbnZF5YiR8sN2clw==", + "hasInstallScript": true, + "dependencies": { + "@prisma/config": "6.7.0", + "@prisma/engines": "6.7.0" + }, + "bin": { + "prisma": "build/index.js" + }, + "engines": { + "node": ">=18.18" + }, + "optionalDependencies": { + "fsevents": "2.3.3" + }, + "peerDependencies": { + "typescript": ">=5.1.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/send": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serve-static": { + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + } + } +} diff --git a/worker/package.json b/worker/package.json new file mode 100644 index 0000000..e3d15db --- /dev/null +++ b/worker/package.json @@ -0,0 +1,16 @@ +{ + "name": "planilla-api", + "version": "1.0.0", + "type": "module", + "main": "server.js", + "scripts": { + "start": "node server.js" + }, + "dependencies": { + "@prisma/client": "^6.7.0", + "express": "^4.18.2", + "node-cron": "^4.0.5", + "pg": "^8.8.0", + "prisma": "^6.7.0" + } +} diff --git a/worker/prisma/schema.prisma b/worker/prisma/schema.prisma new file mode 100644 index 0000000..e8b9fe9 --- /dev/null +++ b/worker/prisma/schema.prisma @@ -0,0 +1,15 @@ +// This is your Prisma schema file, +// learn more about it in the docs: https://pris.ly/d/prisma-schema + +// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? +// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init + +generator client { + provider = "prisma-client-js" + output = "../generated/prisma" +} + +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") +} diff --git a/worker/server.js b/worker/server.js new file mode 100644 index 0000000..50d2cc2 --- /dev/null +++ b/worker/server.js @@ -0,0 +1,8 @@ +//cron-worker.js just prints the current date and time every 5 seconds + +import cron from 'node-cron'; + +cron.schedule('*/5 * * * * *', () => { + console.log(new Date().toLocaleString()); +}); +