From ff9579bff8a7553ddd791986bb9cd366188f452e Mon Sep 17 00:00:00 2001 From: Jason Caldwell Date: Thu, 11 Apr 2024 05:00:29 -0400 Subject: [PATCH] Project update. [p][robotic] --- .browserslistrc | 2 +- .dockerignore | 2 +- .env.vault | 8 +- .gitattributes | 2 +- .gitignore | 2 +- .npmignore | 2 +- .prettierignore | 2 +- .vscode/settings.json | 2 +- .vscodeignore | 2 +- package-lock.json | 150 ++++++++++++++++++------------------ package.json | 6 +- src/http.ts | 19 +++-- src/tests/http/index.cfw.ts | 4 +- src/tests/http/index.ts | 4 +- tsconfig.json | 2 +- wrangler.toml | 2 +- 16 files changed, 107 insertions(+), 104 deletions(-) diff --git a/.browserslistrc b/.browserslistrc index f79991bc..f06af718 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Apr 11, 2024 6:08 AM UTC. +# Last generated Apr 11, 2024 8:59 AM UTC. [production] node >= 20.9.0 diff --git a/.dockerignore b/.dockerignore index 2a47f70e..e3f2da42 100644 --- a/.dockerignore +++ b/.dockerignore @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Apr 11, 2024 6:08 AM UTC. +# Last generated Apr 11, 2024 8:59 AM UTC. # Locals diff --git a/.env.vault b/.env.vault index 5c0869ff..0bed2b84 100644 --- a/.env.vault +++ b/.env.vault @@ -8,12 +8,12 @@ DOTENV_VAULT_MAIN="7GW98NfL4hM4N6HbfeDXCKreVxKvcVPupFRnZ8XJ+pomaQ==" DOTENV_VAULT_MAIN_VERSION=1 # dev -DOTENV_VAULT_DEV="r6XO4fBHl/bc0LYVvrTNzuJkMq28qfdOmU+4Ogyc6lRaE04mCvz+U/u0FvWIFLbrmCrTsc077zhGZ/tc8bHFERR79gLfoVTmjeKStSRGDrsIMknYQAgvCsyXrjqpL8OKCfl6IZLtc9eDp2UDgNJATngpfgnlVniqukaKw3jO3F/0Gdh4SySLAlZYwKpoDBsthUTsKC7wU1KZEIl8edtxTFce0bGTqSz9wDbBCXI7PJwkw/+otUcM6lEjUoSfCsIsWQ==" -DOTENV_VAULT_DEV_VERSION=535 +DOTENV_VAULT_DEV="kIu9u/NTqrUs80hDQwX9rJh/lRtKiV5B4cBzKN69/KS9DgYpaMABF1THG6Cwn2u1tUzw4k8ZSdbHd3er76iOad2dZeMdd5q87PStodFmBTfv4X9OA1fPZW0CDqXAPM3E/mnTPs75XcMz7NIsKcSeRmJZGcILSJBbYApcXMcMQd2HFg+8xeObaGSmKK0dlUDE5vL9IzHh/n9CtJ+WLyCsftIQhhTAjGfq5rBoDFrLto/MHwHDW0MBByHPEfYJNzyWfA==" +DOTENV_VAULT_DEV_VERSION=537 # ci -DOTENV_VAULT_CI="d6u84M5tEhJfv7NpV1G00C51lljCq5GOnL8ryLAlHIvcukyTyJErrZ/ALpt7ngoi4lW2rOLGgMsSOAR6gG1uvwoNAdsZUIgrM6CgB8hOx3LnssTwCu1qhSDomk1hiak8sgKOO3cFJtTQsnR60OU1vc5LtSmMwQ5swX365kWSZg==" -DOTENV_VAULT_CI_VERSION=535 +DOTENV_VAULT_CI="Edz2bvpt9PnxRdyL8/oucHFk3SQJ9Pfno33dkslLsNoPgNWBZqZSBUjyEleE7btmYJ8lgWr8EYqJtIvanslFFrBXuzSnTzgCZORVVGEdhPYL05ibAG5b4RdRpDCtZr6bld227yVPmQfNr5BQVUDzddL5jT55verd58VuHVV/Uw==" +DOTENV_VAULT_CI_VERSION=537 # stage DOTENV_VAULT_STAGE="aRP8su2YV4jZu3w1HZ/SLaots0IwJDFw75TCpvXEFeNp7tw=" diff --git a/.gitattributes b/.gitattributes index 94883e19..1c789d73 100644 --- a/.gitattributes +++ b/.gitattributes @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Apr 11, 2024 6:08 AM UTC. +# Last generated Apr 11, 2024 8:59 AM UTC. # Default diff --git a/.gitignore b/.gitignore index e77660f7..30c507ec 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Apr 11, 2024 6:08 AM UTC. +# Last generated Apr 11, 2024 8:59 AM UTC. # Locals diff --git a/.npmignore b/.npmignore index 5f3d64d4..68868f11 100644 --- a/.npmignore +++ b/.npmignore @@ -25,7 +25,7 @@ # Generated data. # -# Last generated Apr 11, 2024 6:08 AM UTC. +# Last generated Apr 11, 2024 8:59 AM UTC. # Locals diff --git a/.prettierignore b/.prettierignore index 30dac48a..a52bda10 100644 --- a/.prettierignore +++ b/.prettierignore @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Apr 11, 2024 6:08 AM UTC. +# Last generated Apr 11, 2024 8:59 AM UTC. # Packages diff --git a/.vscode/settings.json b/.vscode/settings.json index 01952ce3..9c9871b5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,7 +7,7 @@ * @note This entire file will be updated automatically. * @note Instead of editing here, please review `./settings.mjs`. * - * Last generated using `./settings.mjs` Apr 11, 2024 6:08 AM UTC. + * Last generated using `./settings.mjs` Apr 11, 2024 8:59 AM UTC. */ { "editor.formatOnType": false, diff --git a/.vscodeignore b/.vscodeignore index 08904640..0fb69877 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Apr 11, 2024 6:08 AM UTC. +# Last generated Apr 11, 2024 8:59 AM UTC. # Locals diff --git a/package-lock.json b/package-lock.json index 8285f0c3..89f53869 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@clevercanyon/utilities", - "version": "1.0.953", + "version": "1.0.954", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@clevercanyon/utilities", - "version": "1.0.953", + "version": "1.0.954", "cpu": [ "x64", "arm64" @@ -17,7 +17,7 @@ "linux" ], "devDependencies": { - "@clevercanyon/dev-deps": "^1.0.380" + "@clevercanyon/dev-deps": "^1.0.381" }, "engines": { "node": "^20.5.0 || ^20.9.0 || ^21.6.2", @@ -34,7 +34,7 @@ "ignore": "5.3.0", "ip-regex": "5.0.0", "micro-memoize": "4.1.2", - "micromatch": "npm:@clevercanyon/micromatch.fork@^4.0.145", + "micromatch": "npm:@clevercanyon/micromatch.fork@^4.0.146", "parse-css-color": "0.2.1", "preact": "10.20.1", "preact-render-to-string": "6.4.1", @@ -777,9 +777,9 @@ "dev": true }, "node_modules/@clevercanyon/dev-deps": { - "version": "1.0.380", - "resolved": "https://registry.npmjs.org/@clevercanyon/dev-deps/-/dev-deps-1.0.380.tgz", - "integrity": "sha512-0w3SzToh8PCgYEChUsh4gHjtFccxCNttBjv2gInwczybAZOPxaBgQ5otsp+wW2zwoOyY0irglopurgMot/AmHA==", + "version": "1.0.381", + "resolved": "https://registry.npmjs.org/@clevercanyon/dev-deps/-/dev-deps-1.0.381.tgz", + "integrity": "sha512-B5or/4HgaeCbOF3k8YaeOAXSrkw6PGJXhGxKaRSJLhjKkl4yxtSl11q01zvbv/J3vMA3NGsQhdvSHusQNPO2qQ==", "cpu": [ "x64", "arm64" @@ -790,11 +790,11 @@ "linux" ], "dependencies": { - "@clevercanyon/madrun": "^1.0.197", - "@clevercanyon/utilities": "^1.0.953", - "@clevercanyon/utilities.bash": "^1.0.211", - "@clevercanyon/utilities.cfp": "^1.0.255", - "@clevercanyon/utilities.node": "^1.0.206", + "@clevercanyon/madrun": "^1.0.198", + "@clevercanyon/utilities": "^1.0.954", + "@clevercanyon/utilities.bash": "^1.0.212", + "@clevercanyon/utilities.cfp": "^1.0.256", + "@clevercanyon/utilities.node": "^1.0.207", "@cloudflare/workers-types": "4.20240208.0", "@eslint/js": "8.48.0", "@iarna/toml": "2.2.5", @@ -906,9 +906,9 @@ } }, "node_modules/@clevercanyon/madrun": { - "version": "1.0.198", - "resolved": "https://registry.npmjs.org/@clevercanyon/madrun/-/madrun-1.0.198.tgz", - "integrity": "sha512-bbar7UQHt7Nny5fyOdJ/9z8LVAkiP/kpPquSnHhgTgnbHvDa2o8K6ScyklJKsBGhJDGgrOz1SKRvGgPOrv2b+Q==", + "version": "1.0.199", + "resolved": "https://registry.npmjs.org/@clevercanyon/madrun/-/madrun-1.0.199.tgz", + "integrity": "sha512-d6XF/NylCYKuEHmJH4d5uQO4YljXrZXxAjF8IRCjewtTv3DZB6TKj3GK05ZgOgXiys3hCQYYyRg3MGdV/gYm8g==", "cpu": [ "x64", "arm64" @@ -919,8 +919,8 @@ "linux" ], "dependencies": { - "@clevercanyon/utilities": "^1.0.953", - "@clevercanyon/utilities.node": "^1.0.206" + "@clevercanyon/utilities": "^1.0.954", + "@clevercanyon/utilities.node": "^1.0.207" }, "bin": { "madrun": "dist/bin/cli.js" @@ -934,9 +934,9 @@ } }, "node_modules/@clevercanyon/split-cmd.fork": { - "version": "1.0.143", - "resolved": "https://registry.npmjs.org/@clevercanyon/split-cmd.fork/-/split-cmd.fork-1.0.143.tgz", - "integrity": "sha512-zCTIMZ7gUFhMbZwxehxapvBo6o6WmtP0O/dpB1tqqoEV2QhhFzXHaGQ/eZe1Qgp+wiSEQTH3KR+c37WYLMIgUQ==", + "version": "1.0.144", + "resolved": "https://registry.npmjs.org/@clevercanyon/split-cmd.fork/-/split-cmd.fork-1.0.144.tgz", + "integrity": "sha512-Cqn2TXUrCNR+GIKQQCvkf+MCFnVnY0Snz+OfpXMFFMVhOHfcDlBG/74uE/AL2RDd162Ml4ByrHng0z8VXPL1og==", "cpu": [ "x64", "arm64" @@ -956,9 +956,9 @@ } }, "node_modules/@clevercanyon/utilities": { - "version": "1.0.953", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities/-/utilities-1.0.953.tgz", - "integrity": "sha512-TjRIqUm/N8QxIzBfG0lPWCR+ZpRV69LU0aJ+uZjEAz9bgBMIllDv5ZVeogqsXCCL4+HFPuE7lvVCdc4hYmCITA==", + "version": "1.0.954", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities/-/utilities-1.0.954.tgz", + "integrity": "sha512-Qu8fI+vVcMS/6BdYweB56SumNP5cI7Ixu/bMRhYJVbE4ayS2F4CIHNVw7X2oXN+m5E+4bMsB3q6HMpvGPxtlQQ==", "cpu": [ "x64", "arm64" @@ -983,7 +983,7 @@ "ignore": "5.3.0", "ip-regex": "5.0.0", "micro-memoize": "4.1.2", - "micromatch": "npm:@clevercanyon/micromatch.fork@^4.0.144", + "micromatch": "npm:@clevercanyon/micromatch.fork@^4.0.145", "parse-css-color": "0.2.1", "preact": "10.20.1", "preact-render-to-string": "6.4.1", @@ -992,9 +992,9 @@ } }, "node_modules/@clevercanyon/utilities.bash": { - "version": "1.0.211", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.bash/-/utilities.bash-1.0.211.tgz", - "integrity": "sha512-izXgwJnpU4uogt3b7KUugSaMljGXmZdu0Dvr7JyrYP7/+ncVvlw7gLIE0Equz/XSqTYotjGfgLcXOyD97mU6eg==", + "version": "1.0.212", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.bash/-/utilities.bash-1.0.212.tgz", + "integrity": "sha512-QTup44cVh+rfJAG+74dxIlhnVcevSb0JmYxxLLcII4r0+Rb+fFj5JTZX4D/PpbzDRQsS0uHNiBE1CvVC2D+5IQ==", "cpu": [ "x64", "arm64" @@ -1012,14 +1012,14 @@ "url": "https://github.com/sponsors/clevercanyon" }, "peerDependencies": { - "@clevercanyon/utilities": "^1.0.953", - "@clevercanyon/utilities.node": "^1.0.206" + "@clevercanyon/utilities": "^1.0.954", + "@clevercanyon/utilities.node": "^1.0.207" } }, "node_modules/@clevercanyon/utilities.cfp": { - "version": "1.0.255", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfp/-/utilities.cfp-1.0.255.tgz", - "integrity": "sha512-NZMWLekaf3Ay3+cjNz+7MBthij0MbmYxwUMdvPZ0Y+G5VcWPW7bRh9tfGXehjL7kP3uO6P4hLmMgwzdI4a9n6w==", + "version": "1.0.256", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfp/-/utilities.cfp-1.0.256.tgz", + "integrity": "sha512-0PIHGlLTqtolcJyM8wBVz22F5pYcPMTWDiA9EIDwBblHItTnllefU/4CSc2U+8TI7tgp19VZPKtoQJbMLiMxLQ==", "cpu": [ "x64", "arm64" @@ -1037,15 +1037,15 @@ "url": "https://github.com/sponsors/clevercanyon" }, "peerDependencies": { - "@clevercanyon/utilities": "^1.0.953", - "@clevercanyon/utilities.cfw": "^1.0.315", - "@clevercanyon/utilities.web": "^1.0.159" + "@clevercanyon/utilities": "^1.0.954", + "@clevercanyon/utilities.cfw": "^1.0.320", + "@clevercanyon/utilities.web": "^1.0.160" } }, "node_modules/@clevercanyon/utilities.cfw": { - "version": "1.0.319", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfw/-/utilities.cfw-1.0.319.tgz", - "integrity": "sha512-s2X+VC2BYUk/gFyWqruP29C6nPCTK6wI3rRjS/TXiM37A2Hmju/mJA1ydrksRTJHlRWAh7FM9+M52ra6zNaR+w==", + "version": "1.0.320", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfw/-/utilities.cfw-1.0.320.tgz", + "integrity": "sha512-imFC3+CNQaI7DR9YI6qITM506mc6clTgLOFAi9PUcqvC6zlOpPtPMsPrR2lEUAWmX0RjR6qkc7sQ11U08h0B6w==", "cpu": [ "x64", "arm64" @@ -1064,16 +1064,16 @@ "url": "https://github.com/sponsors/clevercanyon" }, "peerDependencies": { - "@clevercanyon/utilities": "^1.0.953", + "@clevercanyon/utilities": "^1.0.954", "@cloudflare/ai": "1.0.53", "@upstash/ratelimit": "1.0.0", "@upstash/redis": "1.28.0" } }, "node_modules/@clevercanyon/utilities.node": { - "version": "1.0.206", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.node/-/utilities.node-1.0.206.tgz", - "integrity": "sha512-YaqRIBlRnfPizqq+k+/x5CSb77AGpYCJZtQIPVF21xvtiEXuAWYBkwMZ8lqFv/FbJnpdC26FOZPVnUUN1Y/sXA==", + "version": "1.0.207", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.node/-/utilities.node-1.0.207.tgz", + "integrity": "sha512-2taOn/DivtL0wIUpEm36VUA/A4r+xCNFWGZcb+v9n6sdjsi1hzmuXzJ/5VTKVPlFc4bbVLZrcGWyqkWVSTUJnQ==", "cpu": [ "x64", "arm64" @@ -1091,8 +1091,8 @@ "url": "https://github.com/sponsors/clevercanyon" }, "peerDependencies": { - "@clevercanyon/split-cmd.fork": "^1.0.142", - "@clevercanyon/utilities": "^1.0.953", + "@clevercanyon/split-cmd.fork": "^1.0.143", + "@clevercanyon/utilities": "^1.0.954", "@upstash/ratelimit": "1.0.0", "@upstash/redis": "1.28.0", "archiver": "6.0.1", @@ -1105,16 +1105,16 @@ "globby": "14.0.0", "prettier": "3.1.0", "shescape": "2.0.2", - "spawn-please": "npm:@clevercanyon/spawn-please.fork@^2.0.136", + "spawn-please": "npm:@clevercanyon/spawn-please.fork@^2.0.137", "term-img": "6.0.0", "yargs": "17.7.2", "yargs-parser": "21.1.1" } }, "node_modules/@clevercanyon/utilities.web": { - "version": "1.0.160", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.web/-/utilities.web-1.0.160.tgz", - "integrity": "sha512-zkbylImprkFRuIsI74gwy6A+AUr5V0vMSrWdRACMtCY7kdRGEmknv6XP1DFZOrZnpT5VVmvOv7EFRSK/WRNf/w==", + "version": "1.0.161", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.web/-/utilities.web-1.0.161.tgz", + "integrity": "sha512-Uzd4lTYTX6wKDQhBCG1LJzkKXY/nAhgWrmLG9f6VYkDI/fMtbMy1no1uzQBRQHjcXvfq6lRn9H1tVFx4Yjfnzw==", "cpu": [ "x64", "arm64" @@ -1133,7 +1133,7 @@ "url": "https://github.com/sponsors/clevercanyon" }, "peerDependencies": { - "@clevercanyon/utilities": "^1.0.953" + "@clevercanyon/utilities": "^1.0.954" } }, "node_modules/@cloudflare/ai": { @@ -7817,9 +7817,9 @@ }, "node_modules/braces": { "name": "@clevercanyon/braces.fork", - "version": "3.0.141", - "resolved": "https://registry.npmjs.org/@clevercanyon/braces.fork/-/braces.fork-3.0.141.tgz", - "integrity": "sha512-fzCT6cVWrz4AWdWyDJo5Tgk1P2916jzGWJBlVRYPGgPaniB4jp1hFmDkSFGc54opXs4LdkCwuES2x6k6rAIZVQ==", + "version": "3.0.142", + "resolved": "https://registry.npmjs.org/@clevercanyon/braces.fork/-/braces.fork-3.0.142.tgz", + "integrity": "sha512-oojVToPqZTSFKkJ/azDMBa9f2tUbtp6waewCUawOwLzSpKwWyl1b3efhEuedE5KHATMwgPQxMPZEPNM/PdjNag==", "cpu": [ "x64", "arm64" @@ -7829,7 +7829,7 @@ "linux" ], "dependencies": { - "fill-range": "npm:@clevercanyon/fill-range.fork@^7.0.140" + "fill-range": "npm:@clevercanyon/fill-range.fork@^7.0.141" }, "engines": { "node": "^20.5.0 || ^20.9.0 || ^21.6.2", @@ -12665,9 +12665,9 @@ }, "node_modules/fill-range": { "name": "@clevercanyon/fill-range.fork", - "version": "7.0.140", - "resolved": "https://registry.npmjs.org/@clevercanyon/fill-range.fork/-/fill-range.fork-7.0.140.tgz", - "integrity": "sha512-McYSi3cg1mmXsGHtzIW9jIhiPjRDThcCBUuPtCbVc0rA/oV4gtF2fkjpR+9mppjQK+8G0uW3YATrIcfOVzh1Zw==", + "version": "7.0.141", + "resolved": "https://registry.npmjs.org/@clevercanyon/fill-range.fork/-/fill-range.fork-7.0.141.tgz", + "integrity": "sha512-qK61enXMusIAcoPGZ3LgV8dFjkmZ5y/IP+2hy3KY/dwmoNMl5VfwzP7iIAkY/DMa238bR8Ozha27H8BzEVf7ZQ==", "cpu": [ "x64", "arm64" @@ -12677,7 +12677,7 @@ "linux" ], "dependencies": { - "to-regex-range": "npm:@clevercanyon/to-regex-range.fork@^5.0.140" + "to-regex-range": "npm:@clevercanyon/to-regex-range.fork@^5.0.141" }, "engines": { "node": "^20.5.0 || ^20.9.0 || ^21.6.2", @@ -14260,9 +14260,9 @@ }, "node_modules/is-number": { "name": "@clevercanyon/is-number.fork", - "version": "7.0.143", - "resolved": "https://registry.npmjs.org/@clevercanyon/is-number.fork/-/is-number.fork-7.0.143.tgz", - "integrity": "sha512-fnwwqUYiEuTF898txZHz4WUMzoXTyeWPhSngDsXIyneu9SDVCFDu4cgtN9Hyw/TH/U5x8hNtggTrCiikaahcJg==", + "version": "7.0.144", + "resolved": "https://registry.npmjs.org/@clevercanyon/is-number.fork/-/is-number.fork-7.0.144.tgz", + "integrity": "sha512-04livG+EeQd0pDugWkI1UvMeAfiGi8ojaTm2XYTHLwF/awaa3gEKObUZJV23ejpoDFYJCsHRarrZ2O+LQ0DyeA==", "cpu": [ "x64", "arm64" @@ -19993,9 +19993,9 @@ }, "node_modules/micromatch": { "name": "@clevercanyon/micromatch.fork", - "version": "4.0.145", - "resolved": "https://registry.npmjs.org/@clevercanyon/micromatch.fork/-/micromatch.fork-4.0.145.tgz", - "integrity": "sha512-dWgxDPEjmKDWrkneLKycyo0hIUfWR268BVmHmHmHC9WBEu70n6Q/I5FPJz/bXXAga5t74UGbWyG9KmVG9yVrgQ==", + "version": "4.0.146", + "resolved": "https://registry.npmjs.org/@clevercanyon/micromatch.fork/-/micromatch.fork-4.0.146.tgz", + "integrity": "sha512-VD8DlISMjVOJuoAnDe/idAnKZG75vjA28pcrdggVndLQHJclH29OQIkZJJiHSOBRSNPQtkc8pCALtjyH36SLEw==", "cpu": [ "x64", "arm64" @@ -20005,8 +20005,8 @@ "linux" ], "dependencies": { - "braces": "npm:@clevercanyon/braces.fork@^3.0.141", - "picomatch": "npm:@clevercanyon/picomatch.fork@^2.3.140" + "braces": "npm:@clevercanyon/braces.fork@^3.0.142", + "picomatch": "npm:@clevercanyon/picomatch.fork@^2.3.141" }, "engines": { "node": "^20.5.0 || ^20.9.0 || ^21.6.2", @@ -20018,9 +20018,9 @@ }, "node_modules/micromatch/node_modules/picomatch": { "name": "@clevercanyon/picomatch.fork", - "version": "2.3.140", - "resolved": "https://registry.npmjs.org/@clevercanyon/picomatch.fork/-/picomatch.fork-2.3.140.tgz", - "integrity": "sha512-Tjt0ExNX5MSjZxegMjS/VtSFKhQwyVCey4UqjlAuCjtaMkG7sQPjlTIIVA3F9A3u6EQzOsv7EvC6FjOhXny58g==", + "version": "2.3.141", + "resolved": "https://registry.npmjs.org/@clevercanyon/picomatch.fork/-/picomatch.fork-2.3.141.tgz", + "integrity": "sha512-o2lcV1axDyL3MxfTsDSwSZ8eaaQRcXrTSTG1fQiuzuT67B3XpDfmo2EMnhjm9ZdUgqOrzo0fdASORy3sI5DuCQ==", "cpu": [ "x64", "arm64" @@ -27269,9 +27269,9 @@ }, "node_modules/spawn-please": { "name": "@clevercanyon/spawn-please.fork", - "version": "2.0.137", - "resolved": "https://registry.npmjs.org/@clevercanyon/spawn-please.fork/-/spawn-please.fork-2.0.137.tgz", - "integrity": "sha512-9dcIHAdYbMeTYn4wl6s98t/OE2CNXisMob2GFWGa8P5daL1YFH9IyBTRT/HiPlZ8EZfAplR3iwZ/XfO5VG8k0A==", + "version": "2.0.138", + "resolved": "https://registry.npmjs.org/@clevercanyon/spawn-please.fork/-/spawn-please.fork-2.0.138.tgz", + "integrity": "sha512-E7JU3KlSZTGN69+7t4o3hezFAbSwvzyZYxq/hT6R9UnJKbwnPWP5vnvcMa3yiWF7S6ir3XsZrcjgdkUgL0Enew==", "cpu": [ "x64", "arm64" @@ -28597,9 +28597,9 @@ }, "node_modules/to-regex-range": { "name": "@clevercanyon/to-regex-range.fork", - "version": "5.0.140", - "resolved": "https://registry.npmjs.org/@clevercanyon/to-regex-range.fork/-/to-regex-range.fork-5.0.140.tgz", - "integrity": "sha512-MIFADCCNv2TFuHpOOQfyvdjr+/+W2s9T/nrJ8iqBxPEAfRoYClkhccbJe1WCZ5U3eyDPJzBgAIXea+A5/lv8vw==", + "version": "5.0.141", + "resolved": "https://registry.npmjs.org/@clevercanyon/to-regex-range.fork/-/to-regex-range.fork-5.0.141.tgz", + "integrity": "sha512-QNiqIFp8/63M1o0bmNBKZQW7F6WCifklKfMAQXTrj02Z7TuSyNccldl8bAjBQUFtocdXUPcf137hgsf8mIx24Q==", "cpu": [ "x64", "arm64" @@ -28609,7 +28609,7 @@ "linux" ], "dependencies": { - "is-number": "npm:@clevercanyon/is-number.fork@^7.0.143" + "is-number": "npm:@clevercanyon/is-number.fork@^7.0.144" }, "engines": { "node": "^20.5.0 || ^20.9.0 || ^21.6.2", diff --git a/package.json b/package.json index 056fd666..47351b15 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "publishConfig": { "access": "public" }, - "version": "1.0.954", + "version": "1.0.955", "license": "GPL-3.0-or-later", "name": "@clevercanyon/utilities", "description": "Utilities for JavaScript apps running in any environment.", @@ -326,7 +326,7 @@ "ignore": "5.3.0", "ip-regex": "5.0.0", "micro-memoize": "4.1.2", - "micromatch": "npm:@clevercanyon/micromatch.fork@^4.0.145", + "micromatch": "npm:@clevercanyon/micromatch.fork@^4.0.146", "parse-css-color": "0.2.1", "preact": "10.20.1", "preact-render-to-string": "6.4.1", @@ -337,7 +337,7 @@ "optionalDependencies": {}, "bundleDependencies": [], "devDependencies": { - "@clevercanyon/dev-deps": "^1.0.380" + "@clevercanyon/dev-deps": "^1.0.381" }, "overrides": {}, "cpu": ["x64", "arm64"], diff --git a/src/http.ts b/src/http.ts index 1d5edeb1..a8d796da 100644 --- a/src/http.ts +++ b/src/http.ts @@ -758,20 +758,23 @@ const prepareResponseHeaders = async (request: $type.Request, url: $type.URL, cf sMaxAge?: ResponseConfig['sMaxAge'], // Server max age; e.g., Cloudflare. staleAge?: ResponseConfig['staleAge'], // Browser and server stale age. ): void => { - maxAge = Math.max(maxAge || 0, 0); - maxAge = Math.min(maxAge, $time.yearInSeconds); // 1 year max. + maxAge = Math.max($is.integer(maxAge) ? maxAge : 0, 0); + maxAge = $to.integerBetween(maxAge, 0, $time.yearInSeconds); if (0 === maxAge /* Do not cache. */) { cacheHeaders['cache-control'] = 'no-store'; cacheHeaders['cdn-cache-control'] = 'no-store'; } else { - // 1h minimum on Cloudflare paid workers plan. - // 2h minimum on Cloudflare on free workers plan. - sMaxAge = Math.max($is.integer(sMaxAge) ? sMaxAge : maxAge, 0); - sMaxAge = 0 === sMaxAge ? 0 : Math.max(Math.max(sMaxAge, maxAge), $time.hourInSeconds * 2); - + if ('none' === cfg.cacheVersion) { + sMaxAge = 0; // No server-side cache. + } else { + // 1h minimum on Cloudflare paid workers plan. + // 2h minimum on Cloudflare free workers plan. + sMaxAge = Math.max($is.integer(sMaxAge) ? sMaxAge : maxAge, 0); + sMaxAge = 0 === sMaxAge ? 0 : $to.integerBetween(sMaxAge, $time.hourInSeconds, Math.max($time.hourInSeconds, maxAge)); + } staleAge = Math.max($is.integer(staleAge) ? staleAge : Math.round(maxAge / 2), 0); - staleAge = Math.min(staleAge, $time.dayInSeconds * 90); // 90 days max. + staleAge = 0 === staleAge ? 0 : $to.integerBetween(staleAge, 0, Math.min(maxAge, $time.dayInSeconds * 90)); cacheHeaders['cache-control'] = 'public, must-revalidate, max-age=' + String(maxAge) + ', s-maxage=' + String(sMaxAge) + ', stale-while-revalidate=' + String(staleAge) + ', stale-if-error=' + String(staleAge); // prettier-ignore cacheHeaders['cdn-cache-control'] = 0 === sMaxAge ? 'no-store' : 'public, must-revalidate, max-age=' + String(sMaxAge) + ', stale-while-revalidate=' + String(staleAge) + ', stale-if-error=' + String(staleAge); // prettier-ignore diff --git a/src/tests/http/index.cfw.ts b/src/tests/http/index.cfw.ts index 9c8f7d9d..61a8ba2a 100644 --- a/src/tests/http/index.cfw.ts +++ b/src/tests/http/index.cfw.ts @@ -81,8 +81,8 @@ describe('$http', async () => { }); expect(response3).toBeInstanceOf(Response); expect(response3.headers.get('vary')).toBe('origin'); - expect(response3.headers.get('cache-control')).toBe('public, must-revalidate, max-age=86400, s-maxage=86401, stale-while-revalidate=86402, stale-if-error=86402'); - expect(response3.headers.get('cdn-cache-control')).toBe('public, must-revalidate, max-age=86401, stale-while-revalidate=86402, stale-if-error=86402'); + expect(response3.headers.get('cache-control')).toBe('public, must-revalidate, max-age=86400, s-maxage=86400, stale-while-revalidate=86400, stale-if-error=86400'); + expect(response3.headers.get('cdn-cache-control')).toBe('public, must-revalidate, max-age=86400, stale-while-revalidate=86400, stale-if-error=86400'); const response4 = await $http.prepareResponse(new Request('https://example.com/?abc=abc&xyz=xyz', { headers: { origin: 'https://example.com' } }), { status: 200, diff --git a/src/tests/http/index.ts b/src/tests/http/index.ts index d85d5768..e7546849 100644 --- a/src/tests/http/index.ts +++ b/src/tests/http/index.ts @@ -80,8 +80,8 @@ describe('$http', async () => { }); expect(response3).toBeInstanceOf(Response); expect(response3.headers.get('vary')).toBe(null); - expect(response3.headers.get('cache-control')).toBe('public, must-revalidate, max-age=86400, s-maxage=86401, stale-while-revalidate=86402, stale-if-error=86402'); - expect(response3.headers.get('cdn-cache-control')).toBe('public, must-revalidate, max-age=86401, stale-while-revalidate=86402, stale-if-error=86402'); + expect(response3.headers.get('cache-control')).toBe('public, must-revalidate, max-age=86400, s-maxage=86400, stale-while-revalidate=86400, stale-if-error=86400'); + expect(response3.headers.get('cdn-cache-control')).toBe('public, must-revalidate, max-age=86400, stale-while-revalidate=86400, stale-if-error=86400'); const response4 = await $http.prepareResponse(new Request('https://example.com/?abc=abc&xyz=xyz'), { status: 200, diff --git a/tsconfig.json b/tsconfig.json index e7d4dc2a..f1d3223a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,7 @@ * @note This entire file will be updated automatically. * @note Instead of editing here, please review `./tsconfig.mjs`. * - * Last generated using `./tsconfig.mjs` Apr 11, 2024 6:08 AM UTC. + * Last generated using `./tsconfig.mjs` Apr 11, 2024 8:59 AM UTC. */ { "include": ["./src/**/*", "./dev-types.d.ts"], diff --git a/wrangler.toml b/wrangler.toml index bffdb0ef..a2ed10fd 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -7,7 +7,7 @@ # @note This entire file will be updated automatically. # @note Instead of editing here, please review `./wrangler.mjs`. # -# Last generated using `./wrangler.mjs` Apr 11, 2024 6:08 AM UTC. +# Last generated using `./wrangler.mjs` Apr 11, 2024 8:59 AM UTC. ## send_metrics = false