From 28779ba1b66a6c685a40264a8845adeb0a4ab9fe Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Fri, 2 Jun 2023 09:34:39 -0400 Subject: [PATCH 01/28] Get geolocation about a given IP address --- compute-at-edge-test/src/index.js | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 compute-at-edge-test/src/index.js diff --git a/compute-at-edge-test/src/index.js b/compute-at-edge-test/src/index.js new file mode 100644 index 00000000..187f3b02 --- /dev/null +++ b/compute-at-edge-test/src/index.js @@ -0,0 +1,32 @@ +/// + +import { getGeolocationForIpAddress } from "fastly:geolocation" +async function app(event) { + try { + let ip = new URL(event.request.url).searchParams.get('ip') || event.client.address + let geo = getGeolocationForIpAddress(ip); + let respBody = JSON.stringify({ + geo: { + city: geo.city, + continent: geo.continent, + country_code: geo.country_code, + country_code3: geo.country_code3, + country_name: geo.country_name, + region: null, + }, +}) + + return new Response( respBody, { + headers: { + "Content-Type": "application/json", + }, + }); + } catch (error) { + console.error(error); + return new Response("Internal Server Error", { + status: 500 + }); + } +} + +addEventListener("fetch", (event) => event.respondWith(app(event))); From 23df1d17cd79960fe51283ea39ef0859c82bc401 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Tue, 6 Jun 2023 08:25:54 -0400 Subject: [PATCH 02/28] Add necessary bits to run test locally, and move to new location. --- fastly-compute/geoip/.gitignore | 3 + fastly-compute/geoip/README.md | 11 + fastly-compute/geoip/fastly.toml | 12 + fastly-compute/geoip/npm-shrinkwrap.json | 939 +++++++++++++++++++++++ fastly-compute/geoip/package.json | 22 + fastly-compute/geoip/src/index.js | 32 + 6 files changed, 1019 insertions(+) create mode 100644 fastly-compute/geoip/.gitignore create mode 100644 fastly-compute/geoip/README.md create mode 100644 fastly-compute/geoip/fastly.toml create mode 100644 fastly-compute/geoip/npm-shrinkwrap.json create mode 100644 fastly-compute/geoip/package.json create mode 100644 fastly-compute/geoip/src/index.js diff --git a/fastly-compute/geoip/.gitignore b/fastly-compute/geoip/.gitignore new file mode 100644 index 00000000..d8511216 --- /dev/null +++ b/fastly-compute/geoip/.gitignore @@ -0,0 +1,3 @@ +/node_modules +/bin +/pkg diff --git a/fastly-compute/geoip/README.md b/fastly-compute/geoip/README.md new file mode 100644 index 00000000..a752c89d --- /dev/null +++ b/fastly-compute/geoip/README.md @@ -0,0 +1,11 @@ +# Empty Starter Kit for JavaScript + +[![Deploy to Fastly](https://deploy.edgecompute.app/button)](https://deploy.edgecompute.app/deploy) + +An empty application template for the Fastly Compute@Edge environment which simply returns a 200 OK response. + +**For more details about other starter kits for Compute@Edge, see the [Fastly developer hub](https://developer.fastly.com/solutions/starters)** + +## Security issues + +Please see our [SECURITY.md](SECURITY.md) for guidance on reporting security-related issues. diff --git a/fastly-compute/geoip/fastly.toml b/fastly-compute/geoip/fastly.toml new file mode 100644 index 00000000..3fed61f9 --- /dev/null +++ b/fastly-compute/geoip/fastly.toml @@ -0,0 +1,12 @@ +# This file describes a Fastly Compute@Edge package. To learn more visit: +# https://developer.fastly.com/reference/fastly-toml/ + +authors = ["chloe.gerhardson@pyfound.org"] +description = "Test" +language = "javascript" +manifest_version = 3 +name = "Compute@Edge Test" +service_id = "" + +[scripts] + build = "npm run build" diff --git a/fastly-compute/geoip/npm-shrinkwrap.json b/fastly-compute/geoip/npm-shrinkwrap.json new file mode 100644 index 00000000..5fa771de --- /dev/null +++ b/fastly-compute/geoip/npm-shrinkwrap.json @@ -0,0 +1,939 @@ +{ + "name": "compute-starter-kit-javascript-empty", + "version": "0.4.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "compute-starter-kit-javascript-empty", + "version": "0.4.0", + "license": "MIT", + "dependencies": { + "@fastly/js-compute": "^2.0.1" + } + }, + "node_modules/@babel/regjsgen": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==" + }, + "node_modules/@bytecodealliance/jco": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-0.7.0.tgz", + "integrity": "sha512-YPqmvNHfcmDUMz2TC7LEYramGiKhMLjbHaZ2kqEtOrAOSOiFmkDXAyJLHp7j8QzBbotOhZDrvdKrAGlxiQZigQ==", + "dependencies": { + "@bytecodealliance/preview2-shim": "0.0.8" + }, + "bin": { + "jco": "cli.mjs" + } + }, + "node_modules/@bytecodealliance/preview2-shim": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.0.8.tgz", + "integrity": "sha512-yeY8wHpCBlRlHCU4YzvGn41z3UV9svDE7Z3OkEyU5TbzJiy1S9mMB3R43d2YE/f6rPLRZyE141TDDyPf6zdcWQ==" + }, + "node_modules/@bytecodealliance/wizer": { + "version": "1.6.1-beta.4", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer/-/wizer-1.6.1-beta.4.tgz", + "integrity": "sha512-afgV4lyYVMBN/9/yNDgYGTn92D7VrqS0yTZ3WZgDyDTiOWjmSuQimEiX+VzCiYjF9GXsKwzCY1FEOu1pY2Evgw==", + "bin": { + "wizer": "wizer.js" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@bytecodealliance/wizer-darwin-arm64": "1.6.1-beta.4", + "@bytecodealliance/wizer-darwin-x64": "1.6.1-beta.4", + "@bytecodealliance/wizer-linux-x64": "1.6.1-beta.4", + "@bytecodealliance/wizer-win32-x64": "1.6.1-beta.4" + } + }, + "node_modules/@bytecodealliance/wizer-darwin-arm64": { + "version": "1.6.1-beta.4", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-arm64/-/wizer-darwin-arm64-1.6.1-beta.4.tgz", + "integrity": "sha512-NyleEH0GKBqS0DCuKceY3a2ZxF/aNzYa68swbKKljSFh6uo/3Cqr/U5/SuTxval6/VwtZ1eEzRPaLbLlUE5r4w==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "bin": { + "wizer-darwin-arm64": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-darwin-x64": { + "version": "1.6.1-beta.4", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-x64/-/wizer-darwin-x64-1.6.1-beta.4.tgz", + "integrity": "sha512-2s8HPLrttAyYUJNHQlLVi3rDGlnk9IzEJTbw0DApfpVnCZZ1aTLt6MXTIBeOYo9si5Q4cqyDHT5bAoNZvJTk9A==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "bin": { + "wizer-darwin-x64": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-linux-x64": { + "version": "1.6.1-beta.4", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-x64/-/wizer-linux-x64-1.6.1-beta.4.tgz", + "integrity": "sha512-S+oYRGGveuPLtiI6V7SQpZHhw43asLArC+fGrJRQ3OsHs8aj/IVusRLVYgWfKw1HtZm9iIWrjH9WYO6BWak4eQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "bin": { + "wizer-linux-x64": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-win32-x64": { + "version": "1.6.1-beta.4", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-win32-x64/-/wizer-win32-x64-1.6.1-beta.4.tgz", + "integrity": "sha512-NxqrLqFnaMyldkN7lBVS+Em23f84/RKrHjBXt9WnZK2RtJjvwoCXr+so6+qfj4f1K9BhIZ8UaBfYwqPvtLOcZQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "bin": { + "wizer-win32-x64": "wizer" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz", + "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz", + "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz", + "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz", + "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz", + "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz", + "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz", + "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz", + "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz", + "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz", + "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz", + "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz", + "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz", + "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz", + "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz", + "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", + "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz", + "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz", + "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz", + "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz", + "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz", + "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", + "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@fastly/js-compute": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@fastly/js-compute/-/js-compute-2.0.1.tgz", + "integrity": "sha512-JviqOQfd51yjXcdcmXCZ/f1NEnQuMmeEChymc0/8LqmE5s6Ov32Nu+6Cd/ow4EL5Z4XmNwE+z1vylYCCYb+nCw==", + "dependencies": { + "@bytecodealliance/jco": "^0.7.0", + "@bytecodealliance/wizer": "^1.6.1-beta.4", + "acorn": "^8.8.2", + "acorn-walk": "^8.2.0", + "esbuild": "^0.17.18", + "magic-string": "^0.30.0", + "regexpu-core": "^5.3.2" + }, + "bin": { + "js-compute-runtime": "js-compute-runtime-cli.js" + }, + "engines": { + "node": "16 - 20", + "npm": "^8 || ^9" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" + }, + "node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/esbuild": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", + "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.17.19", + "@esbuild/android-arm64": "0.17.19", + "@esbuild/android-x64": "0.17.19", + "@esbuild/darwin-arm64": "0.17.19", + "@esbuild/darwin-x64": "0.17.19", + "@esbuild/freebsd-arm64": "0.17.19", + "@esbuild/freebsd-x64": "0.17.19", + "@esbuild/linux-arm": "0.17.19", + "@esbuild/linux-arm64": "0.17.19", + "@esbuild/linux-ia32": "0.17.19", + "@esbuild/linux-loong64": "0.17.19", + "@esbuild/linux-mips64el": "0.17.19", + "@esbuild/linux-ppc64": "0.17.19", + "@esbuild/linux-riscv64": "0.17.19", + "@esbuild/linux-s390x": "0.17.19", + "@esbuild/linux-x64": "0.17.19", + "@esbuild/netbsd-x64": "0.17.19", + "@esbuild/openbsd-x64": "0.17.19", + "@esbuild/sunos-x64": "0.17.19", + "@esbuild/win32-arm64": "0.17.19", + "@esbuild/win32-ia32": "0.17.19", + "@esbuild/win32-x64": "0.17.19" + } + }, + "node_modules/jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", + "bin": { + "jsesc": "bin/jsesc" + } + }, + "node_modules/magic-string": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.0.tgz", + "integrity": "sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.13" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==" + }, + "node_modules/regenerate-unicode-properties": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz", + "integrity": "sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ==", + "dependencies": { + "regenerate": "^1.4.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regexpu-core": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.3.2.tgz", + "integrity": "sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==", + "dependencies": { + "@babel/regjsgen": "^0.8.0", + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^10.1.0", + "regjsparser": "^0.9.1", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regjsparser": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.9.1.tgz", + "integrity": "sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==", + "dependencies": { + "jsesc": "~0.5.0" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", + "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-value-ecmascript": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz", + "integrity": "sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-property-aliases-ecmascript": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", + "engines": { + "node": ">=4" + } + } + }, + "dependencies": { + "@babel/regjsgen": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==" + }, + "@bytecodealliance/jco": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-0.7.0.tgz", + "integrity": "sha512-YPqmvNHfcmDUMz2TC7LEYramGiKhMLjbHaZ2kqEtOrAOSOiFmkDXAyJLHp7j8QzBbotOhZDrvdKrAGlxiQZigQ==", + "requires": { + "@bytecodealliance/preview2-shim": "0.0.8" + } + }, + "@bytecodealliance/preview2-shim": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.0.8.tgz", + "integrity": "sha512-yeY8wHpCBlRlHCU4YzvGn41z3UV9svDE7Z3OkEyU5TbzJiy1S9mMB3R43d2YE/f6rPLRZyE141TDDyPf6zdcWQ==" + }, + "@bytecodealliance/wizer": { + "version": "1.6.1-beta.4", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer/-/wizer-1.6.1-beta.4.tgz", + "integrity": "sha512-afgV4lyYVMBN/9/yNDgYGTn92D7VrqS0yTZ3WZgDyDTiOWjmSuQimEiX+VzCiYjF9GXsKwzCY1FEOu1pY2Evgw==", + "requires": { + "@bytecodealliance/wizer-darwin-arm64": "1.6.1-beta.4", + "@bytecodealliance/wizer-darwin-x64": "1.6.1-beta.4", + "@bytecodealliance/wizer-linux-x64": "1.6.1-beta.4", + "@bytecodealliance/wizer-win32-x64": "1.6.1-beta.4" + } + }, + "@bytecodealliance/wizer-darwin-arm64": { + "version": "1.6.1-beta.4", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-arm64/-/wizer-darwin-arm64-1.6.1-beta.4.tgz", + "integrity": "sha512-NyleEH0GKBqS0DCuKceY3a2ZxF/aNzYa68swbKKljSFh6uo/3Cqr/U5/SuTxval6/VwtZ1eEzRPaLbLlUE5r4w==", + "optional": true + }, + "@bytecodealliance/wizer-darwin-x64": { + "version": "1.6.1-beta.4", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-x64/-/wizer-darwin-x64-1.6.1-beta.4.tgz", + "integrity": "sha512-2s8HPLrttAyYUJNHQlLVi3rDGlnk9IzEJTbw0DApfpVnCZZ1aTLt6MXTIBeOYo9si5Q4cqyDHT5bAoNZvJTk9A==", + "optional": true + }, + "@bytecodealliance/wizer-linux-x64": { + "version": "1.6.1-beta.4", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-x64/-/wizer-linux-x64-1.6.1-beta.4.tgz", + "integrity": "sha512-S+oYRGGveuPLtiI6V7SQpZHhw43asLArC+fGrJRQ3OsHs8aj/IVusRLVYgWfKw1HtZm9iIWrjH9WYO6BWak4eQ==", + "optional": true + }, + "@bytecodealliance/wizer-win32-x64": { + "version": "1.6.1-beta.4", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-win32-x64/-/wizer-win32-x64-1.6.1-beta.4.tgz", + "integrity": "sha512-NxqrLqFnaMyldkN7lBVS+Em23f84/RKrHjBXt9WnZK2RtJjvwoCXr+so6+qfj4f1K9BhIZ8UaBfYwqPvtLOcZQ==", + "optional": true + }, + "@esbuild/android-arm": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz", + "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", + "optional": true + }, + "@esbuild/android-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz", + "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", + "optional": true + }, + "@esbuild/android-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz", + "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", + "optional": true + }, + "@esbuild/darwin-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz", + "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", + "optional": true + }, + "@esbuild/darwin-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz", + "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", + "optional": true + }, + "@esbuild/freebsd-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz", + "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", + "optional": true + }, + "@esbuild/freebsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz", + "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", + "optional": true + }, + "@esbuild/linux-arm": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz", + "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", + "optional": true + }, + "@esbuild/linux-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz", + "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", + "optional": true + }, + "@esbuild/linux-ia32": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz", + "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", + "optional": true + }, + "@esbuild/linux-loong64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz", + "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", + "optional": true + }, + "@esbuild/linux-mips64el": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz", + "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", + "optional": true + }, + "@esbuild/linux-ppc64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz", + "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", + "optional": true + }, + "@esbuild/linux-riscv64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz", + "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", + "optional": true + }, + "@esbuild/linux-s390x": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz", + "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", + "optional": true + }, + "@esbuild/linux-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", + "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", + "optional": true + }, + "@esbuild/netbsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz", + "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", + "optional": true + }, + "@esbuild/openbsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz", + "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", + "optional": true + }, + "@esbuild/sunos-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz", + "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", + "optional": true + }, + "@esbuild/win32-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz", + "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", + "optional": true + }, + "@esbuild/win32-ia32": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz", + "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", + "optional": true + }, + "@esbuild/win32-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", + "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", + "optional": true + }, + "@fastly/js-compute": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@fastly/js-compute/-/js-compute-2.0.1.tgz", + "integrity": "sha512-JviqOQfd51yjXcdcmXCZ/f1NEnQuMmeEChymc0/8LqmE5s6Ov32Nu+6Cd/ow4EL5Z4XmNwE+z1vylYCCYb+nCw==", + "requires": { + "@bytecodealliance/jco": "^0.7.0", + "@bytecodealliance/wizer": "^1.6.1-beta.4", + "acorn": "^8.8.2", + "acorn-walk": "^8.2.0", + "esbuild": "^0.17.18", + "magic-string": "^0.30.0", + "regexpu-core": "^5.3.2" + } + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" + }, + "acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==" + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" + }, + "esbuild": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", + "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", + "requires": { + "@esbuild/android-arm": "0.17.19", + "@esbuild/android-arm64": "0.17.19", + "@esbuild/android-x64": "0.17.19", + "@esbuild/darwin-arm64": "0.17.19", + "@esbuild/darwin-x64": "0.17.19", + "@esbuild/freebsd-arm64": "0.17.19", + "@esbuild/freebsd-x64": "0.17.19", + "@esbuild/linux-arm": "0.17.19", + "@esbuild/linux-arm64": "0.17.19", + "@esbuild/linux-ia32": "0.17.19", + "@esbuild/linux-loong64": "0.17.19", + "@esbuild/linux-mips64el": "0.17.19", + "@esbuild/linux-ppc64": "0.17.19", + "@esbuild/linux-riscv64": "0.17.19", + "@esbuild/linux-s390x": "0.17.19", + "@esbuild/linux-x64": "0.17.19", + "@esbuild/netbsd-x64": "0.17.19", + "@esbuild/openbsd-x64": "0.17.19", + "@esbuild/sunos-x64": "0.17.19", + "@esbuild/win32-arm64": "0.17.19", + "@esbuild/win32-ia32": "0.17.19", + "@esbuild/win32-x64": "0.17.19" + } + }, + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==" + }, + "magic-string": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.0.tgz", + "integrity": "sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==", + "requires": { + "@jridgewell/sourcemap-codec": "^1.4.13" + } + }, + "regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==" + }, + "regenerate-unicode-properties": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz", + "integrity": "sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ==", + "requires": { + "regenerate": "^1.4.2" + } + }, + "regexpu-core": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.3.2.tgz", + "integrity": "sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==", + "requires": { + "@babel/regjsgen": "^0.8.0", + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^10.1.0", + "regjsparser": "^0.9.1", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.1.0" + } + }, + "regjsparser": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.9.1.tgz", + "integrity": "sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==", + "requires": { + "jsesc": "~0.5.0" + } + }, + "unicode-canonical-property-names-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", + "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==" + }, + "unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", + "requires": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + } + }, + "unicode-match-property-value-ecmascript": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz", + "integrity": "sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA==" + }, + "unicode-property-aliases-ecmascript": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==" + } + } +} diff --git a/fastly-compute/geoip/package.json b/fastly-compute/geoip/package.json new file mode 100644 index 00000000..1b43abd0 --- /dev/null +++ b/fastly-compute/geoip/package.json @@ -0,0 +1,22 @@ +{ + "name": "compute-starter-kit-javascript-empty", + "version": "0.4.0", + "repository": { + "type": "git", + "url": "git+https://github.com/fastly/compute-starter-kit-javascript-empty.git" + }, + "type": "module", + "author": "oss@fastly.com", + "license": "MIT", + "bugs": { + "url": "https://github.com/fastly/compute-starter-kit-javascript-empty/issues" + }, + "homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-empty", + "dependencies": { + "@fastly/js-compute": "^2.0.1" + }, + "scripts": { + "build": "js-compute-runtime ./src/index.js ./bin/main.wasm", + "deploy": "fastly compute publish" + } +} diff --git a/fastly-compute/geoip/src/index.js b/fastly-compute/geoip/src/index.js new file mode 100644 index 00000000..187f3b02 --- /dev/null +++ b/fastly-compute/geoip/src/index.js @@ -0,0 +1,32 @@ +/// + +import { getGeolocationForIpAddress } from "fastly:geolocation" +async function app(event) { + try { + let ip = new URL(event.request.url).searchParams.get('ip') || event.client.address + let geo = getGeolocationForIpAddress(ip); + let respBody = JSON.stringify({ + geo: { + city: geo.city, + continent: geo.continent, + country_code: geo.country_code, + country_code3: geo.country_code3, + country_name: geo.country_name, + region: null, + }, +}) + + return new Response( respBody, { + headers: { + "Content-Type": "application/json", + }, + }); + } catch (error) { + console.error(error); + return new Response("Internal Server Error", { + status: 500 + }); + } +} + +addEventListener("fetch", (event) => event.respondWith(app(event))); From fc08d733ac5fae85041ac33bc27a30d3521c3445 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Tue, 6 Jun 2023 14:19:33 -0400 Subject: [PATCH 03/28] Add Github Actions to deploy Fastly's Compute@Edge: getGeolocationForIpAddress --- .../geoip/.github/workflows/deploy-geoip.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 fastly-compute/geoip/.github/workflows/deploy-geoip.yaml diff --git a/fastly-compute/geoip/.github/workflows/deploy-geoip.yaml b/fastly-compute/geoip/.github/workflows/deploy-geoip.yaml new file mode 100644 index 00000000..e1bc4bc0 --- /dev/null +++ b/fastly-compute/geoip/.github/workflows/deploy-geoip.yaml @@ -0,0 +1,18 @@ +name: Deploy Compute@Edge GeoIp +on: + push: + branches: [main] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install project dependencies + run: npm install + + - name: Deploy to Compute@Edge + uses: fastly/compute-actions@v5 + env: + FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} From 0b966f4f853319d7d6ed934aa456c06811a9198f Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Tue, 6 Jun 2023 15:18:07 -0400 Subject: [PATCH 04/28] Place deploy-geoip.yaml in the correct location to be triggered --- .github/workflows/deploy-geoip.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/deploy-geoip.yaml diff --git a/.github/workflows/deploy-geoip.yaml b/.github/workflows/deploy-geoip.yaml new file mode 100644 index 00000000..43a9243d --- /dev/null +++ b/.github/workflows/deploy-geoip.yaml @@ -0,0 +1,18 @@ +name: Deploy Compute@Edge GeoIp +on: + push: + branches: [*] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install project dependencies + run: npm install + + - name: Deploy to Compute@Edge + uses: fastly/compute-actions@v5 + env: + FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} From 7224f68b0deeac36dd608a5bcb0e978c91639a62 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Tue, 6 Jun 2023 15:38:08 -0400 Subject: [PATCH 05/28] Prepare for testing, and delete old file paths. --- .github/workflows/deploy-geoip.yaml | 3 +- compute-at-edge-test/src/index.js | 32 ------------------- .../geoip/.github/workflows/deploy-geoip.yaml | 18 ----------- 3 files changed, 2 insertions(+), 51 deletions(-) delete mode 100644 compute-at-edge-test/src/index.js delete mode 100644 fastly-compute/geoip/.github/workflows/deploy-geoip.yaml diff --git a/.github/workflows/deploy-geoip.yaml b/.github/workflows/deploy-geoip.yaml index 43a9243d..9ff9ef59 100644 --- a/.github/workflows/deploy-geoip.yaml +++ b/.github/workflows/deploy-geoip.yaml @@ -1,7 +1,8 @@ name: Deploy Compute@Edge GeoIp on: push: - branches: [*] +# branches: [main] +## Note: by removing the branches value, the workflow will run when a push is made to any branch. This is to serve for testing. jobs: deploy: diff --git a/compute-at-edge-test/src/index.js b/compute-at-edge-test/src/index.js deleted file mode 100644 index 187f3b02..00000000 --- a/compute-at-edge-test/src/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/// - -import { getGeolocationForIpAddress } from "fastly:geolocation" -async function app(event) { - try { - let ip = new URL(event.request.url).searchParams.get('ip') || event.client.address - let geo = getGeolocationForIpAddress(ip); - let respBody = JSON.stringify({ - geo: { - city: geo.city, - continent: geo.continent, - country_code: geo.country_code, - country_code3: geo.country_code3, - country_name: geo.country_name, - region: null, - }, -}) - - return new Response( respBody, { - headers: { - "Content-Type": "application/json", - }, - }); - } catch (error) { - console.error(error); - return new Response("Internal Server Error", { - status: 500 - }); - } -} - -addEventListener("fetch", (event) => event.respondWith(app(event))); diff --git a/fastly-compute/geoip/.github/workflows/deploy-geoip.yaml b/fastly-compute/geoip/.github/workflows/deploy-geoip.yaml deleted file mode 100644 index e1bc4bc0..00000000 --- a/fastly-compute/geoip/.github/workflows/deploy-geoip.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: Deploy Compute@Edge GeoIp -on: - push: - branches: [main] - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Install project dependencies - run: npm install - - - name: Deploy to Compute@Edge - uses: fastly/compute-actions@v5 - env: - FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} From e70054b33fcbc7550c7dac73afb2a4c3728c122f Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Tue, 6 Jun 2023 16:07:19 -0400 Subject: [PATCH 06/28] Add project_directory value --- .github/workflows/deploy-geoip.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy-geoip.yaml b/.github/workflows/deploy-geoip.yaml index 9ff9ef59..65706dce 100644 --- a/.github/workflows/deploy-geoip.yaml +++ b/.github/workflows/deploy-geoip.yaml @@ -9,6 +9,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - with: + project_directory: fastly-compute/geoip - name: Install project dependencies run: npm install From 97c4ec67efb78c8dcc32e6d1b755a74059a4670b Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Tue, 6 Jun 2023 16:11:20 -0400 Subject: [PATCH 07/28] Move project_diretory value --- .github/workflows/deploy-geoip.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-geoip.yaml b/.github/workflows/deploy-geoip.yaml index 65706dce..fc82e3e6 100644 --- a/.github/workflows/deploy-geoip.yaml +++ b/.github/workflows/deploy-geoip.yaml @@ -9,13 +9,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - with: - project_directory: fastly-compute/geoip - name: Install project dependencies run: npm install - name: Deploy to Compute@Edge uses: fastly/compute-actions@v5 + with: + project_directory: fastly-compute/geoip env: FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} From f7246fce4d616c420206ef0654ebdf94dec5106f Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Wed, 7 Jun 2023 09:32:17 -0400 Subject: [PATCH 08/28] Trying to fix path bug. --- .github/workflows/deploy-geoip.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy-geoip.yaml b/.github/workflows/deploy-geoip.yaml index fc82e3e6..9de8632b 100644 --- a/.github/workflows/deploy-geoip.yaml +++ b/.github/workflows/deploy-geoip.yaml @@ -12,6 +12,8 @@ jobs: - name: Install project dependencies run: npm install + with: + project_directory: fastly-compute/geoip - name: Deploy to Compute@Edge uses: fastly/compute-actions@v5 From 5a3506c2ed99c8f33654dda8753915345fb1f28a Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Wed, 7 Jun 2023 09:36:09 -0400 Subject: [PATCH 09/28] Trying again --- .github/workflows/deploy-geoip.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-geoip.yaml b/.github/workflows/deploy-geoip.yaml index 9de8632b..14bb6593 100644 --- a/.github/workflows/deploy-geoip.yaml +++ b/.github/workflows/deploy-geoip.yaml @@ -9,11 +9,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + project_directory: fastly-compute/geoip - name: Install project dependencies run: npm install - with: - project_directory: fastly-compute/geoip - name: Deploy to Compute@Edge uses: fastly/compute-actions@v5 From 37271a31625cdbbe135de173e617e82dfbc3ac18 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Wed, 7 Jun 2023 09:52:01 -0400 Subject: [PATCH 10/28] Just trying --- .github/workflows/deploy-geoip.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/deploy-geoip.yaml b/.github/workflows/deploy-geoip.yaml index 14bb6593..5d00cc80 100644 --- a/.github/workflows/deploy-geoip.yaml +++ b/.github/workflows/deploy-geoip.yaml @@ -9,8 +9,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - project_directory: fastly-compute/geoip - name: Install project dependencies run: npm install @@ -18,6 +16,6 @@ jobs: - name: Deploy to Compute@Edge uses: fastly/compute-actions@v5 with: - project_directory: fastly-compute/geoip + project_directory: ./fastly-compute/geoip env: FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} From 447388973f2311034ec21c4d1a3bada8318775df Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Wed, 7 Jun 2023 10:50:12 -0400 Subject: [PATCH 11/28] Fingers-crossed --- .github/workflows/deploy-geoip.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-geoip.yaml b/.github/workflows/deploy-geoip.yaml index 5d00cc80..aa111e27 100644 --- a/.github/workflows/deploy-geoip.yaml +++ b/.github/workflows/deploy-geoip.yaml @@ -12,6 +12,7 @@ jobs: - name: Install project dependencies run: npm install + working-directory: fastly-compute/geoip - name: Deploy to Compute@Edge uses: fastly/compute-actions@v5 From 5a970972af01d4503edf9e403079cc66cbee8c9e Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Wed, 7 Jun 2023 13:30:14 -0400 Subject: [PATCH 12/28] Testing for auth --- .github/workflows/deploy-geoip.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-geoip.yaml b/.github/workflows/deploy-geoip.yaml index aa111e27..7853c2d7 100644 --- a/.github/workflows/deploy-geoip.yaml +++ b/.github/workflows/deploy-geoip.yaml @@ -20,3 +20,4 @@ jobs: project_directory: ./fastly-compute/geoip env: FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} +# Testing for Auth From 77ca31931350dea6d643db94531f002c733f0600 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Wed, 7 Jun 2023 13:37:24 -0400 Subject: [PATCH 13/28] Maybe? --- .github/workflows/deploy-geoip.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deploy-geoip.yaml b/.github/workflows/deploy-geoip.yaml index 7853c2d7..aa111e27 100644 --- a/.github/workflows/deploy-geoip.yaml +++ b/.github/workflows/deploy-geoip.yaml @@ -20,4 +20,3 @@ jobs: project_directory: ./fastly-compute/geoip env: FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} -# Testing for Auth From 6f4f8be3006fe4f9fd479bcaa35efaeb8c70e134 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson <66563430+cegerhardson@users.noreply.github.com> Date: Thu, 8 Jun 2023 10:48:26 -0400 Subject: [PATCH 14/28] Update fastly-compute/geoip/fastly.toml Co-authored-by: Ee Durbin --- fastly-compute/geoip/fastly.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastly-compute/geoip/fastly.toml b/fastly-compute/geoip/fastly.toml index 3fed61f9..e155fb14 100644 --- a/fastly-compute/geoip/fastly.toml +++ b/fastly-compute/geoip/fastly.toml @@ -5,7 +5,7 @@ authors = ["chloe.gerhardson@pyfound.org"] description = "Test" language = "javascript" manifest_version = 3 -name = "Compute@Edge Test" +name = "geoip" service_id = "" [scripts] From 84bd996a67a09a5a2ff5ec7ed83537e4c93f61b2 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson <66563430+cegerhardson@users.noreply.github.com> Date: Thu, 8 Jun 2023 10:48:49 -0400 Subject: [PATCH 15/28] Update fastly-compute/geoip/fastly.toml Co-authored-by: Ee Durbin --- fastly-compute/geoip/fastly.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastly-compute/geoip/fastly.toml b/fastly-compute/geoip/fastly.toml index e155fb14..25c33168 100644 --- a/fastly-compute/geoip/fastly.toml +++ b/fastly-compute/geoip/fastly.toml @@ -6,7 +6,7 @@ description = "Test" language = "javascript" manifest_version = 3 name = "geoip" -service_id = "" +service_id = "q5KEu8R9Q1khWeFbWNPXQ3" [scripts] build = "npm run build" From 3cd7cf2a7989ef1fad8b5e0c1726631d78c7ca39 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Tue, 6 Jun 2023 14:19:33 -0400 Subject: [PATCH 16/28] Add Github Actions to deploy Fastly's Compute@Edge: getGeolocationForIpAddress Place deploy-geoip.yaml in the correct location to be triggered Prepare for testing, and delete old file paths. Add project_directory value Move project_diretory value Trying to fix path bug. Trying again Just trying Fingers-crossed Testing for auth Maybe? Implement a github actions to deploy geoip --- .github/workflows/deploy-geoip.yaml | 22 ++++++++++++++++++++ compute-at-edge-test/src/index.js | 32 ----------------------------- 2 files changed, 22 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/deploy-geoip.yaml delete mode 100644 compute-at-edge-test/src/index.js diff --git a/.github/workflows/deploy-geoip.yaml b/.github/workflows/deploy-geoip.yaml new file mode 100644 index 00000000..aa111e27 --- /dev/null +++ b/.github/workflows/deploy-geoip.yaml @@ -0,0 +1,22 @@ +name: Deploy Compute@Edge GeoIp +on: + push: +# branches: [main] +## Note: by removing the branches value, the workflow will run when a push is made to any branch. This is to serve for testing. + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install project dependencies + run: npm install + working-directory: fastly-compute/geoip + + - name: Deploy to Compute@Edge + uses: fastly/compute-actions@v5 + with: + project_directory: ./fastly-compute/geoip + env: + FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} diff --git a/compute-at-edge-test/src/index.js b/compute-at-edge-test/src/index.js deleted file mode 100644 index 187f3b02..00000000 --- a/compute-at-edge-test/src/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/// - -import { getGeolocationForIpAddress } from "fastly:geolocation" -async function app(event) { - try { - let ip = new URL(event.request.url).searchParams.get('ip') || event.client.address - let geo = getGeolocationForIpAddress(ip); - let respBody = JSON.stringify({ - geo: { - city: geo.city, - continent: geo.continent, - country_code: geo.country_code, - country_code3: geo.country_code3, - country_name: geo.country_name, - region: null, - }, -}) - - return new Response( respBody, { - headers: { - "Content-Type": "application/json", - }, - }); - } catch (error) { - console.error(error); - return new Response("Internal Server Error", { - status: 500 - }); - } -} - -addEventListener("fetch", (event) => event.respondWith(app(event))); From 1dc6920de6379f503b15765163c00d855e6cfdc7 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Thu, 8 Jun 2023 14:26:50 -0400 Subject: [PATCH 17/28] Include region in geolocation return values. --- fastly-compute/geoip/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastly-compute/geoip/src/index.js b/fastly-compute/geoip/src/index.js index 187f3b02..0ff7e686 100644 --- a/fastly-compute/geoip/src/index.js +++ b/fastly-compute/geoip/src/index.js @@ -12,7 +12,7 @@ async function app(event) { country_code: geo.country_code, country_code3: geo.country_code3, country_name: geo.country_name, - region: null, + region: geo.region, }, }) From 96160154e401ca50b5a7d93361a501042dc864c4 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Tue, 13 Jun 2023 10:14:01 -0400 Subject: [PATCH 18/28] Add Service ID --- fastly-compute/geoip/fastly.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastly-compute/geoip/fastly.toml b/fastly-compute/geoip/fastly.toml index 25c33168..175880f1 100644 --- a/fastly-compute/geoip/fastly.toml +++ b/fastly-compute/geoip/fastly.toml @@ -6,7 +6,7 @@ description = "Test" language = "javascript" manifest_version = 3 name = "geoip" -service_id = "q5KEu8R9Q1khWeFbWNPXQ3" +service_id = "CnsNqIdpSj1tZNLTl6PUi4" [scripts] build = "npm run build" From 2a83ae93528e153662c55c1d4d36bc9f8b7cc419 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Thu, 15 Jun 2023 09:21:34 -0400 Subject: [PATCH 19/28] Add authentication configuration via Fastly's ConfigStore. --- fastly-compute/geoip/fastly.toml | 7 +++++++ fastly-compute/geoip/src/index.js | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/fastly-compute/geoip/fastly.toml b/fastly-compute/geoip/fastly.toml index 175880f1..af77fac4 100644 --- a/fastly-compute/geoip/fastly.toml +++ b/fastly-compute/geoip/fastly.toml @@ -10,3 +10,10 @@ service_id = "CnsNqIdpSj1tZNLTl6PUi4" [scripts] build = "npm run build" + +[local_server] + [local_server.config_stores] + [local_server.config_stores.strings] + file = ".secret.json" + format = "json" + diff --git a/fastly-compute/geoip/src/index.js b/fastly-compute/geoip/src/index.js index 0ff7e686..e94f147b 100644 --- a/fastly-compute/geoip/src/index.js +++ b/fastly-compute/geoip/src/index.js @@ -1,8 +1,21 @@ /// import { getGeolocationForIpAddress } from "fastly:geolocation" +import { ConfigStore } from "fastly:config-store"; + async function app(event) { try { + const configStore = new ConfigStore('strings') + const token = await configStore.get('token') + + // If the value doesn't exist or is false, return Unauthorized + if (!token) { + let respBody = JSON.stringify({ Error: "Unauthorized" }); + return new Response(respBody, { + status: 401, + headers: { 'Content-Type': 'application/json' } + }); + } let ip = new URL(event.request.url).searchParams.get('ip') || event.client.address let geo = getGeolocationForIpAddress(ip); let respBody = JSON.stringify({ @@ -14,7 +27,7 @@ async function app(event) { country_name: geo.country_name, region: geo.region, }, -}) +}); return new Response( respBody, { headers: { From 9c5177e92fd8c7fb3cd86c9d6d6618a902500a98 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Thu, 15 Jun 2023 09:26:31 -0400 Subject: [PATCH 20/28] Add necessary file for configuation --- fastly-compute/geoip/.secret.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 fastly-compute/geoip/.secret.json diff --git a/fastly-compute/geoip/.secret.json b/fastly-compute/geoip/.secret.json new file mode 100644 index 00000000..1afdb73c --- /dev/null +++ b/fastly-compute/geoip/.secret.json @@ -0,0 +1,3 @@ +{ + "token" : "1wps9CyJtrdeoDCYW6uUtXmEZNckMsdO" +} From 629c0570c8555e5a8b42c21c08ab132c5aec5653 Mon Sep 17 00:00:00 2001 From: Ee Durbin Date: Thu, 15 Jun 2023 16:03:38 -0400 Subject: [PATCH 21/28] Update fastly-compute/geoip/.secret.json --- fastly-compute/geoip/.secret.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastly-compute/geoip/.secret.json b/fastly-compute/geoip/.secret.json index 1afdb73c..db250181 100644 --- a/fastly-compute/geoip/.secret.json +++ b/fastly-compute/geoip/.secret.json @@ -1,3 +1,3 @@ { - "token" : "1wps9CyJtrdeoDCYW6uUtXmEZNckMsdO" + "token" : "sup3rs3cr3t" } From 665dd7d1a6a50cad748a254061adc919759f7300 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Tue, 27 Jun 2023 15:50:11 -0400 Subject: [PATCH 22/28] Update README --- fastly-compute/geoip/README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fastly-compute/geoip/README.md b/fastly-compute/geoip/README.md index a752c89d..71ca425b 100644 --- a/fastly-compute/geoip/README.md +++ b/fastly-compute/geoip/README.md @@ -1,11 +1,13 @@ -# Empty Starter Kit for JavaScript +# Get Geolocation Information About a Given IP Address -[![Deploy to Fastly](https://deploy.edgecompute.app/button)](https://deploy.edgecompute.app/deploy) +This service using [Fastly's Compute@Edge](https://developer.fastly.com/learning/compute/) to get specific geolcation information about a given IP address, and deploys automagically using Github Actions. -An empty application template for the Fastly Compute@Edge environment which simply returns a 200 OK response. +## Getting started -**For more details about other starter kits for Compute@Edge, see the [Fastly developer hub](https://developer.fastly.com/solutions/starters)** +- Be sure to install [Fastly's CLI](https://developer.fastly.com/learning/tools/cli/) +- As well as the dependencies: `npm install` -## Security issues +## Try it out locally -Please see our [SECURITY.md](SECURITY.md) for guidance on reporting security-related issues. +`fastly compute serve --watch` +- This application should now be running on http://localhost:7676 From 44347b61c37c022051f169900816f1343046aeb4 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Tue, 27 Jun 2023 15:53:05 -0400 Subject: [PATCH 23/28] Update service description --- fastly-compute/geoip/fastly.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastly-compute/geoip/fastly.toml b/fastly-compute/geoip/fastly.toml index af77fac4..e7d79426 100644 --- a/fastly-compute/geoip/fastly.toml +++ b/fastly-compute/geoip/fastly.toml @@ -2,7 +2,7 @@ # https://developer.fastly.com/reference/fastly-toml/ authors = ["chloe.gerhardson@pyfound.org"] -description = "Test" +description = "geoip" language = "javascript" manifest_version = 3 name = "geoip" From d9f127035f59e0543daf9503287eac3cbf6225e8 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Tue, 27 Jun 2023 15:59:18 -0400 Subject: [PATCH 24/28] Reconfigure authentication and prettify --- fastly-compute/geoip/src/index.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/fastly-compute/geoip/src/index.js b/fastly-compute/geoip/src/index.js index e94f147b..c4adc592 100644 --- a/fastly-compute/geoip/src/index.js +++ b/fastly-compute/geoip/src/index.js @@ -1,22 +1,23 @@ /// -import { getGeolocationForIpAddress } from "fastly:geolocation" +import { getGeolocationForIpAddress } from "fastly:geolocation"; import { ConfigStore } from "fastly:config-store"; async function app(event) { try { - const configStore = new ConfigStore('strings') - const token = await configStore.get('token') + const configStore = new ConfigStore("strings"); + const secret = event.request.headers.get("X-Secret"); + const token = await configStore.get(secret); - // If the value doesn't exist or is false, return Unauthorized - if (!token) { - let respBody = JSON.stringify({ Error: "Unauthorized" }); - return new Response(respBody, { - status: 401, - headers: { 'Content-Type': 'application/json' } - }); + if (!token) { + let respBody = JSON.stringify({ Error: "Unauthorized" }); + return new Response(respBody, { + status: 401, + headers: { "Content-Type": "application/json" }, + }); } - let ip = new URL(event.request.url).searchParams.get('ip') || event.client.address + let ip = + new URL(event.request.url).searchParams.get("ip") || event.client.address; let geo = getGeolocationForIpAddress(ip); let respBody = JSON.stringify({ geo: { @@ -27,9 +28,9 @@ async function app(event) { country_name: geo.country_name, region: geo.region, }, -}); + }); - return new Response( respBody, { + return new Response(respBody, { headers: { "Content-Type": "application/json", }, @@ -37,7 +38,7 @@ async function app(event) { } catch (error) { console.error(error); return new Response("Internal Server Error", { - status: 500 + status: 500, }); } } From f284d6711f9426f4d6fdd0493608c7925670b32c Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Wed, 28 Jun 2023 10:48:33 -0400 Subject: [PATCH 25/28] Update --- fastly-compute/geoip/.secret.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastly-compute/geoip/.secret.json b/fastly-compute/geoip/.secret.json index db250181..aba9c2e6 100644 --- a/fastly-compute/geoip/.secret.json +++ b/fastly-compute/geoip/.secret.json @@ -1,3 +1,3 @@ { - "token" : "sup3rs3cr3t" + "sup3rs3cr3t" : "true" } From 262f214a66984e159332314f21a8dde46839d8fd Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Thu, 29 Jun 2023 09:54:36 -0400 Subject: [PATCH 26/28] Update references --- fastly-compute/geoip/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fastly-compute/geoip/package.json b/fastly-compute/geoip/package.json index 1b43abd0..671a218e 100644 --- a/fastly-compute/geoip/package.json +++ b/fastly-compute/geoip/package.json @@ -1,15 +1,15 @@ { - "name": "compute-starter-kit-javascript-empty", + "name": "get-geolocation-for-ip", "version": "0.4.0", "repository": { "type": "git", - "url": "git+https://github.com/fastly/compute-starter-kit-javascript-empty.git" + "url": "git+https://github.com/pypi/infra.git" }, "type": "module", - "author": "oss@fastly.com", + "author": "chloe@python.org", "license": "MIT", "bugs": { - "url": "https://github.com/fastly/compute-starter-kit-javascript-empty/issues" + "url": "https://github.com/pypi/infra/issues" }, "homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-empty", "dependencies": { From 9d67bc57ef15ff4d3a82cb83753aa00cde27c237 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Fri, 30 Jun 2023 11:23:18 -0400 Subject: [PATCH 27/28] change config store name --- fastly-compute/geoip/fastly.toml | 2 +- fastly-compute/geoip/src/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fastly-compute/geoip/fastly.toml b/fastly-compute/geoip/fastly.toml index e7d79426..823c5f27 100644 --- a/fastly-compute/geoip/fastly.toml +++ b/fastly-compute/geoip/fastly.toml @@ -13,7 +13,7 @@ service_id = "CnsNqIdpSj1tZNLTl6PUi4" [local_server] [local_server.config_stores] - [local_server.config_stores.strings] + [local_server.config_stores.geoip_auth] file = ".secret.json" format = "json" diff --git a/fastly-compute/geoip/src/index.js b/fastly-compute/geoip/src/index.js index c4adc592..4cb36cf9 100644 --- a/fastly-compute/geoip/src/index.js +++ b/fastly-compute/geoip/src/index.js @@ -4,8 +4,8 @@ import { getGeolocationForIpAddress } from "fastly:geolocation"; import { ConfigStore } from "fastly:config-store"; async function app(event) { - try { - const configStore = new ConfigStore("strings"); + //try { + const configStore = new ConfigStore("geoip_auth"); const secret = event.request.headers.get("X-Secret"); const token = await configStore.get(secret); From bbafc4687e852e683bf376b1d9eac724390dc146 Mon Sep 17 00:00:00 2001 From: Chloe Gerhardson Date: Fri, 30 Jun 2023 11:25:22 -0400 Subject: [PATCH 28/28] get rid of try/catch --- fastly-compute/geoip/src/index.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/fastly-compute/geoip/src/index.js b/fastly-compute/geoip/src/index.js index 4cb36cf9..b04544c0 100644 --- a/fastly-compute/geoip/src/index.js +++ b/fastly-compute/geoip/src/index.js @@ -4,7 +4,6 @@ import { getGeolocationForIpAddress } from "fastly:geolocation"; import { ConfigStore } from "fastly:config-store"; async function app(event) { - //try { const configStore = new ConfigStore("geoip_auth"); const secret = event.request.headers.get("X-Secret"); const token = await configStore.get(secret); @@ -35,12 +34,6 @@ async function app(event) { "Content-Type": "application/json", }, }); - } catch (error) { - console.error(error); - return new Response("Internal Server Error", { - status: 500, - }); } -} addEventListener("fetch", (event) => event.respondWith(app(event)));