diff --git a/.browserslistrc b/.browserslistrc index 7d674db..6cadd2e 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Apr 4, 2024 11:57 PM UTC. +# Last generated Apr 5, 2024 12:10 AM UTC. [production] node >= 20.9.0 diff --git a/.dockerignore b/.dockerignore index 8fd2a2e..18bde3d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Apr 4, 2024 11:57 PM UTC. +# Last generated Apr 5, 2024 12:10 AM UTC. # Locals diff --git a/.env.vault b/.env.vault index cb5e1c6..397b532 100644 --- a/.env.vault +++ b/.env.vault @@ -8,12 +8,12 @@ DOTENV_VAULT_MAIN="3rfi+ClkONvfHPiU9FTBcC1+Um/L8QeM9dRw1jFzEqzZXw==" DOTENV_VAULT_MAIN_VERSION=1 # dev -DOTENV_VAULT_DEV="NiW0LCsWtjzVN2pov11Wl9ZH67lKxZVNmgyoTW2VjbwJJ8Hg4irgsAADBJKqRpQz3Zp5n9ze0wAeClaomqo6EIysqtYxYeZkhvWa6g6TlFga0QrNZlr+eNX4zedU0eCJ+JxFIMgExvdNZCpdTQMCftl3C+wFz2g10DBoPT4cE5qHvWZ3H/HBJ6WgDCm/p6u/onaFcnH2BlWXoOGoVSn1+1wLwksPKpDRj6nwijbZsP0JSYNE54ayeyh81sFcRseNR/II/9J63F4tH2982xbSP8NOeltE7iOwT6L/YWPmN4/1MG2qa8rDnQVesK6NJkksyizS2KNjFTI7+AOTh2Nd81xgo8VLCmkHTcQA7Vmw8xG8EK3hLsKQNzvWtUM12el4/aTIbzHd1vA8VsKzGzxtPQ0y/jknFDDo81mdpazFwRWXSBSqK7sxyzbFoNb2xLGF283UnxvkEDLTfa98VH2aapD99WDmFqahHDgzRpP0Aq7MRRVqGbnhdV5lfEnMWTr0XL84DqRAAXR14AsHuxctrkWpw2HYYBk5xGGyjIAN7tqT+330VNU52xc0sbUQqansJ+RCRSz6GPIvAS+i3Rb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OTENV_VAULT_CI_VERSION=307 +DOTENV_VAULT_CI="f2cK8iitu91w5QUZyQS79XC4M63JJmzWF/f6jLG21XO20zBhPCHd4ovzVvu5MEdmk72bgRZzLNjE1GuZ4ZqtJC7CZVoGdTDOA4qcu0OX2VnCA5nhubyNasEke/62Yw/pMMQ7dW1/1NqvlaNsoRqSQElXomkmqZwf7uKPC5hXRLbdeG42lA99wugqyyVtXMr2W5ZYFRVBy+LeKqAMPKHhFho5hvgAEwkrGmzf0Z6Zmm64By0eXCzKb0DaNPNTA8PbCI6nvWcAah3k2q1jE5BmNfRdM+PoJFHLHznwkEWNSkFRIWdYAA9Y1NmtYL0e8ImX73kYqg5lLKIgaw5r+ApqSUS9n+0o2SBpD/3HocDBf77rHjQKwEWfjupYjkwTjtxN4N0DNFb4eE2M2rVdvkXAUL9vy9bQVa+tj03Yx8Vp5/e1OftFfzfbkp5Muvw51yw1NjKt9y6oQH/6UmlZ04Xcgh8e3aV4qfoK9+8AXElKmK7WQZbLK/eTLuXpWb7kLf7e0GrQc1Dhsft3O5wafRDhoNUdEIcc7PjedLP2zDFGWfgNZ2vz/ZFQiseUuN1OvXeV0eEs0Pp1EAlxcxGACg49bPfUIywyLQnUU8sE6PXZZX4D2SYzGLH3mj1FnELhT7QfKb/YySmPz0m45sEsab0xuWuA9epzqc8UauvmDzEFps/VmlnxbWQf5SPWzA6LU7NWma8yYAvoKwYqk1q5/FtF4vj2ilTuCT5TU36h8DnXkASBRoy3hclRI46RenEzLgSjble5ZJmUdmOtuyR0SjnPsF89mfJWlIAADXz49edK3sK2E4VHLrz6Hdg2ZQ6qC24CMhBhLJZLUMc1fed5gPY3N56GzqERMQV9sQecwHLXLDTrZy7wSdLn3R/9Wr1T" +DOTENV_VAULT_CI_VERSION=309 # stage DOTENV_VAULT_STAGE="bfqZYD8oVLWMZ0JR5LICV+sB/btaXavszxZLxTfwSH8U5fg=" diff --git a/.gitattributes b/.gitattributes index 0f3a1fc..c0e44c2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Apr 4, 2024 11:57 PM UTC. +# Last generated Apr 5, 2024 12:10 AM UTC. # Default diff --git a/.gitignore b/.gitignore index abc7008..3df5838 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Apr 4, 2024 11:57 PM UTC. +# Last generated Apr 5, 2024 12:10 AM UTC. # Locals diff --git a/.npmignore b/.npmignore index fddf777..ba060ca 100644 --- a/.npmignore +++ b/.npmignore @@ -25,7 +25,7 @@ # Generated data. # -# Last generated Apr 4, 2024 11:57 PM UTC. +# Last generated Apr 5, 2024 12:10 AM UTC. # Locals diff --git a/.prettierignore b/.prettierignore index d57a20d..6284956 100644 --- a/.prettierignore +++ b/.prettierignore @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Apr 4, 2024 11:57 PM UTC. +# Last generated Apr 5, 2024 12:10 AM UTC. # Packages diff --git a/.vscode/settings.json b/.vscode/settings.json index 97d91da..c211b16 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 4, 2024 11:57 PM UTC. + * Last generated using `./settings.mjs` Apr 5, 2024 12:10 AM UTC. */ { "editor.formatOnType": false, diff --git a/.vscodeignore b/.vscodeignore index 29a8fbb..8be2758 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Apr 4, 2024 11:57 PM UTC. +# Last generated Apr 5, 2024 12:10 AM UTC. # Locals diff --git a/package-lock.json b/package-lock.json index f0f897b..481afb9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@clevercanyon/utilities.cfw", - "version": "1.0.306", + "version": "1.0.307", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@clevercanyon/utilities.cfw", - "version": "1.0.306", + "version": "1.0.307", "cpu": [ "x64", "arm64" @@ -1033,9 +1033,9 @@ } }, "node_modules/@clevercanyon/utilities.cfw": { - "version": "1.0.306", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfw/-/utilities.cfw-1.0.306.tgz", - "integrity": "sha512-A7Q0zTqbJEdhcJGONPdH+QzMYNCgQOwGgxDOelzKLP3QPM/BldpyPdZEhnJ4re13gFVvU9PjJlmZS3VNRmggcg==", + "version": "1.0.307", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfw/-/utilities.cfw-1.0.307.tgz", + "integrity": "sha512-if7fN2uKFbZghpFk75jsRAQ9uPP9JPbjiWw5tblFgLbmog2LKMn9EdSRUZnadCvQpeffUpx9gtRze72pbu+HVA==", "cpu": [ "x64", "arm64" diff --git a/package.json b/package.json index 644b2f9..97e24e9 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "publishConfig": { "access": "public" }, - "version": "1.0.307", + "version": "1.0.308", "license": "GPL-3.0-or-later", "name": "@clevercanyon/utilities.cfw", "description": "Utilities for JavaScript apps running in a Cloudflare Worker environment.", diff --git a/src/api.ts b/src/api.ts index 5b928ea..ca68d33 100644 --- a/src/api.ts +++ b/src/api.ts @@ -15,10 +15,9 @@ export type JSONResponsePayload = $type.ReadonlyDe data?: Type; }>; export type CatchThrownOptions = { + thrown: unknown; responseType: 'none' | 'json'; responseConfig: $http.ResponseConfig; - - thrown: unknown; expectedCauses: string[]; }; @@ -29,12 +28,12 @@ export type CatchThrownOptions = { * @param thrown Thrown; e.g., error, response. * @param options {@see CatchThrownOptions}. */ -export const catchThrown = async (rcData: $type.$cfw.RequestContextData, thrown: unknown, options: CatchThrownOptions): Promise => { - if ($is.response(thrown)) throw thrown; - +export const catchThrown = async (rcData: $type.$cfw.RequestContextData, options: CatchThrownOptions): Promise => { const { auditLogger } = rcData, opts = $obj.defaults({}, options) as Required, - { responseType, responseConfig, expectedCauses } = opts; + { thrown, responseType, responseConfig, expectedCauses } = opts; + + if ($is.response(thrown)) throw thrown; const message = $error.safeMessageFrom(thrown, { expectedCauses, @@ -49,9 +48,6 @@ export const catchThrown = async (rcData: $type.$cfw.RequestContextData, thrown: responseConfig.sMaxAge = 0; responseConfig.staleAge = 0; - responseConfig.cacheVersion = 'none'; - responseConfig.varyOn = []; - responseConfig.headers = {}; responseConfig.appendHeaders = {}; diff --git a/tsconfig.json b/tsconfig.json index 0af743c..76b6cef 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 4, 2024 11:57 PM UTC. + * Last generated using `./tsconfig.mjs` Apr 5, 2024 12:10 AM UTC. */ { "include": ["./src/**/*", "./dev-types.d.ts"], diff --git a/wrangler.toml b/wrangler.toml index 7d25cbf..abefed4 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 4, 2024 11:57 PM UTC. +# Last generated using `./wrangler.mjs` Apr 5, 2024 12:10 AM UTC. ## send_metrics = false