diff --git a/.browserslistrc b/.browserslistrc index f778dc8..4468b9a 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Feb 23, 2024 8:48 AM UTC. +# Last generated Feb 23, 2024 10:51 PM UTC. [production] node >= 20.9.0 diff --git a/.dockerignore b/.dockerignore index 9dc4c16..e6d6848 100644 --- a/.dockerignore +++ b/.dockerignore @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Feb 23, 2024 8:48 AM UTC. +# Last generated Feb 23, 2024 10:51 PM UTC. # Locals diff --git a/.env.vault b/.env.vault index f1c4ff8..19b2760 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="A3KkZIjO9zbGJufm4hpZ0qBJdR4ZnqM7DdT2tL7/YXBY6+70pAPfzbNEIkwsg/ePC1a4sfH0KwmPw0q0jMZC8xKsu1loy5LLKDDbC2q3cwGm3MWJfZPyNaCGMeUslL8kZtMzElJ0AYMel3o0nJtHL62s/eL8OXR63ZDlSm08dWrhbIqVqDB11Aed97rIskVklHV61SRfWkIcKJ30CcpfqyENCeCoRx24UGfTJe9Vkb9hxqlIz1ekPGxo6DGpr2XpZvs75Tq5A2abcnjGkUAF/ZIMlVuelpCamXqfFjGbZZpcdkL/zU2K8PzrNiD9OHL4cwkz41Mjr//RCguXNYDqgh6xaVm3MpD7BmGwNLLQb8PNKJnXNTWSaVeJdAk/mw+t9rW4vESifhHwjOhrdIn/+wh8yDNAn5dQXIqdgV9oga+VngxBSZK05cykqXFK4bbp/SsXfttQRTNwSLWw0M+dZflBId5fAXAOadinA3uSnacXiJPMw6JDatdjovWzcmH5K8B4axP5NLa4Q4/cjVvK8fbwidvNixUekOotzMQrU+1yD1mH2pU9QEvrhOpxKSZGrn2rulBZM0wLn88coUQ3j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q9GTwiphM6syIf2" -DOTENV_VAULT_CI_VERSION=181 +DOTENV_VAULT_CI="zh+JTguWG2APafMoQxQDNGP5gh1jCgKBRRVArdr66M6ZE3AcYZjQlYQQEqj0/XGpLJF/Aae/l3Rx7YfEL5NGRILUjsoqK0mv/Q62nbebK314UKHPkEke76XmTlbsBeLKixUv1hk7auLBHOQsQ8v0WG1Vl+LunkXOV6AUv3oS/lmR1WCL6KfPp+jkxE/9XsgT5m7Rq5jSNS4Te07lfHJraaOTa1f/4wcoaFpxR/T4sGEV8eXyqAuRjmKc6FWyNgBNt75T3Wl7AOm3FSC/DqiTUoiKf8KEGv278iHulLFuGcVdmhMlCVaHbRVByx/mafU4UtgJyvs+sOiM/d5SE19HkOxmmXQ+y2QRZNCLXjkOA7J7GYJGjoHwsh3hfDgHZEl9IfectpwiFWj0N+IMNXV94Gd3q8L246hGzi8L/DMzZEYAnLZu5a8bMVQN9qnDqnmk8eWTWZQQPkHmTOZkb6gkcsgNInrADPrKFmPZGMIGCockZkJeT+nFRazc+RD+ZH9RzrNwU6geHdN8iC/wCyhgy2TFzDVxOwTliLI5b6R6sdadAVOW2JiPn9y/4awEY+zbbOVxiMn/gF+MwtmuWpfOzhSj50UYF84RvGuLWYmcSi/qMoZHGeF43ODbjIahHiK6lLQKZdDKvRw3B1xIA0jJkSPcbD+HKIOKJApaowND/shff86xnc6Ot++aqyU56H30mNASBC3avlpwRXPbj15Q/I8p6GLrKXHdeuMe2yWCaxAMrK8njCyABEE5G1oUB895Fvt/h5OCbeeSMsayLhfGZvIQjPe5GxCwLjD/y8YRGgENjtUJMY9rhV64Lycszyq4JgevXoAIJt/fgi7RW5dnNq7TSb2Uynn7ugSHt6qZ2iKDzQVgJs2pKaOVzGLp" +DOTENV_VAULT_CI_VERSION=183 # stage DOTENV_VAULT_STAGE="bfqZYD8oVLWMZ0JR5LICV+sB/btaXavszxZLxTfwSH8U5fg=" diff --git a/.gitattributes b/.gitattributes index 7588751..be7b409 100644 --- a/.gitattributes +++ b/.gitattributes @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Feb 23, 2024 8:48 AM UTC. +# Last generated Feb 23, 2024 10:51 PM UTC. # Default diff --git a/.gitignore b/.gitignore index d61eb3d..51cd397 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Feb 23, 2024 8:48 AM UTC. +# Last generated Feb 23, 2024 10:51 PM UTC. # Locals diff --git a/.npmignore b/.npmignore index 11657fe..821f2d7 100644 --- a/.npmignore +++ b/.npmignore @@ -25,7 +25,7 @@ # Generated data. # -# Last generated Feb 23, 2024 8:48 AM UTC. +# Last generated Feb 23, 2024 10:51 PM UTC. # Locals diff --git a/.prettierignore b/.prettierignore index 74fa776..b7d644b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Feb 23, 2024 8:48 AM UTC. +# Last generated Feb 23, 2024 10:51 PM UTC. # Packages diff --git a/.vscode/settings.json b/.vscode/settings.json index e92dee3..bf2affc 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` Feb 23, 2024 8:48 AM UTC. + * Last generated using `./settings.mjs` Feb 23, 2024 10:51 PM UTC. */ { "editor.formatOnType": false, diff --git a/.vscodeignore b/.vscodeignore index cb02c20..f2afcf6 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -17,7 +17,7 @@ # Generated data. # -# Last generated Feb 23, 2024 8:48 AM UTC. +# Last generated Feb 23, 2024 10:51 PM UTC. # Locals diff --git a/dev/.files/wrangler/settings.mjs b/dev/.files/wrangler/settings.mjs index 699c150..b300a01 100755 --- a/dev/.files/wrangler/settings.mjs +++ b/dev/.files/wrangler/settings.mjs @@ -30,7 +30,7 @@ export default async () => { // This is Clever Canyon’s account ID. ↓ defaultAccountId: 'f1176464a976947aa5665d989814a4b1', - compatibilityDate: '2023-08-15', + compatibilityDate: '2023-12-01', compatibilityFlags: [], // None, for now. defaultLocalIP: '0.0.0.0', diff --git a/package-lock.json b/package-lock.json index 24d08ef..1a35c10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@clevercanyon/utilities.cfw", - "version": "1.0.243", + "version": "1.0.244", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@clevercanyon/utilities.cfw", - "version": "1.0.243", + "version": "1.0.244", "cpu": [ "x64", "arm64" @@ -27,7 +27,7 @@ "url": "https://github.com/sponsors/clevercanyon" }, "peerDependencies": { - "@clevercanyon/utilities": "^1.0.848", + "@clevercanyon/utilities": "^1.0.849", "@upstash/ratelimit": "1.0.0", "@upstash/redis": "1.28.0" } @@ -1016,9 +1016,9 @@ } }, "node_modules/@clevercanyon/utilities": { - "version": "1.0.848", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities/-/utilities-1.0.848.tgz", - "integrity": "sha512-kPVX0lAbr77JjqYSNtYIDNvKGAQu9IaQageRzkFdnWmY1lLSHlppWkWykUep/BNGQediSfcteSXUICWrWG4lag==", + "version": "1.0.849", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities/-/utilities-1.0.849.tgz", + "integrity": "sha512-iOT4q+qxl5dskVqzIJCZqZYDxBSZz8wRrhANVegPJzdjLnInQMEWmvcuDBGum4W7Hcg5tQ0uwjaio0mAYK8ubw==", "cpu": [ "x64", "arm64" @@ -1076,9 +1076,9 @@ } }, "node_modules/@clevercanyon/utilities.cfp": { - "version": "1.0.212", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfp/-/utilities.cfp-1.0.212.tgz", - "integrity": "sha512-ubJDehQkLBuP/pXJqFmwo+wyEIEvq8vD+8SOHBawFqvxX9O9TWdg9+3KC2Q+yImSsiI1wrC4FHoT1IU1GnI0Bw==", + "version": "1.0.213", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfp/-/utilities.cfp-1.0.213.tgz", + "integrity": "sha512-V0ydvn+sPVBgwSCM3V8UW7Wc6HD2l7992dGQXWIUuQaABPVZ/9d0FAiLFwIm8EOEd+9E2W/wPLELCpz7LUrhuQ==", "cpu": [ "x64", "arm64" @@ -1096,15 +1096,15 @@ "url": "https://github.com/sponsors/clevercanyon" }, "peerDependencies": { - "@clevercanyon/utilities": "^1.0.833", - "@clevercanyon/utilities.cfw": "^1.0.227", - "@clevercanyon/utilities.web": "^1.0.141" + "@clevercanyon/utilities": "^1.0.849", + "@clevercanyon/utilities.cfw": "^1.0.244", + "@clevercanyon/utilities.web": "^1.0.142" } }, "node_modules/@clevercanyon/utilities.cfw": { - "version": "1.0.243", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfw/-/utilities.cfw-1.0.243.tgz", - "integrity": "sha512-v1qktZ/EYNChLBV+VcieinVQzn+6YKx1MbWK39qq8fFSclxHUpx3H0FNlLdRkwV+2e3azHkatWMwuBFcN617fA==", + "version": "1.0.244", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfw/-/utilities.cfw-1.0.244.tgz", + "integrity": "sha512-2/Zl4fEyZbxJ1boQ3pP7xrq7+7zLL/3ZbbKPTbWIy1ZenWK0Bk1LxrsvFROMpRlHPBbx3IhPmts68qIPR893hg==", "cpu": [ "x64", "arm64" @@ -1123,7 +1123,7 @@ "url": "https://github.com/sponsors/clevercanyon" }, "peerDependencies": { - "@clevercanyon/utilities": "^1.0.847", + "@clevercanyon/utilities": "^1.0.848", "@upstash/ratelimit": "1.0.0", "@upstash/redis": "1.28.0" } @@ -9491,9 +9491,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.680", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.680.tgz", - "integrity": "sha512-4nToZ5jlPO14W82NkF32wyjhYqQByVaDmLy4J2/tYcAbJfgO2TKJC780Az1V13gzq4l73CJ0yuyalpXvxXXD9A==", + "version": "1.4.681", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.681.tgz", + "integrity": "sha512-1PpuqJUFWoXZ1E54m8bsLPVYwIVCRzvaL+n5cjigGga4z854abDnFRc+cTa2th4S79kyGqya/1xoR7h+Y5G5lg==", "dev": true }, "node_modules/emittery": { @@ -20110,9 +20110,9 @@ "dev": true }, "node_modules/mlly": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.6.0.tgz", - "integrity": "sha512-YOvg9hfYQmnaB56Yb+KrJE2u0Yzz5zR+sLejEvF4fzwzV1Al6hkf2vyHTwqCRyv0hCi9rVCqVoXpyYevQIRwLQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.6.1.tgz", + "integrity": "sha512-vLgaHvaeunuOXHSmEbZ9izxPx3USsk8KCQ8iC+aTlp5sKRSoZvwhHh5L9VbKSaVC6sJDqbyohIS76E2VmHIPAA==", "dev": true, "dependencies": { "acorn": "^8.11.3", diff --git a/package.json b/package.json index e22a035..9f72602 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "publishConfig": { "access": "public" }, - "version": "1.0.244", + "version": "1.0.245", "license": "GPL-3.0-or-later", "name": "@clevercanyon/utilities.cfw", "description": "Utilities for JavaScript apps running in a Cloudflare Worker environment.", @@ -59,7 +59,7 @@ }, "dependencies": {}, "peerDependencies": { - "@clevercanyon/utilities": "^1.0.848", + "@clevercanyon/utilities": "^1.0.849", "@upstash/ratelimit": "1.0.0", "@upstash/redis": "1.28.0" }, diff --git a/src/cfw.ts b/src/cfw.ts index 1713661..5a2b0e0 100644 --- a/src/cfw.ts +++ b/src/cfw.ts @@ -188,14 +188,14 @@ export const serviceBindingRequest = async (rcData: StdRequestContextData, reque const { Request } = cfw, { request: originalRequest } = rcData; - const importantParentRequestInit = { - headers: { 'cf-connecting-ip': await $user.ip(originalRequest) }, - cf: $obj.omit($obj.cloneDeep(await $user.ipGeoData(originalRequest)), ['ip']), - }; - return new Request( - requestInfo, // e.g., Service binding URL. - $obj.mergeDeep(importantParentRequestInit, requestInit) as $type.cfw.RequestInit, - ); + requestInit ??= {}; // Initialize. + requestInit.cf ??= {}; // Initialize. + requestInit.headers = $http.parseHeaders(requestInit.headers || {}) as $type.cfw.Headers; + + (requestInit.headers as $type.cfw.Headers).set('cf-connecting-ip', await $user.ip(originalRequest)); + $obj.updateDeep(requestInit.cf, $obj.omit($obj.cloneDeep(await $user.ipGeoData(originalRequest)), ['ip'])); + + return new Request(requestInfo, requestInit); }; // --- diff --git a/tsconfig.json b/tsconfig.json index 4ace4af..7d17137 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` Feb 23, 2024 8:48 AM UTC. + * Last generated using `./tsconfig.mjs` Feb 23, 2024 10:51 PM UTC. */ { "include": ["./src/**/*", "./dev-types.d.ts"], diff --git a/wrangler.toml b/wrangler.toml index ce853c1..888db27 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -7,9 +7,9 @@ # @note This entire file will be updated automatically. # @note Instead of editing here, please review `./wrangler.mjs`. # -# Last generated using `./wrangler.mjs` Feb 23, 2024 8:48 AM UTC. +# Last generated using `./wrangler.mjs` Feb 23, 2024 10:51 PM UTC. ## send_metrics = false -compatibility_date = "2023-08-15" +compatibility_date = "2023-12-01" compatibility_flags = [ ]