From 271ec83d6dcd6a36e2e82c17c4bf9da0adfa2e0e Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Fri, 25 Nov 2022 16:28:00 +0100 Subject: [PATCH 1/6] chore: introduce vitests for ESM unit tests --- .eslintrc.cjs | 1 + .github/workflows/main.yml | 3 + e2e.config.mjs | 2 +- npm-shrinkwrap.json | 1128 ++++++++++++++++- package.json | 11 +- src/commands/dev/dev.mjs | 2 +- .../example-sibling-function-graphql-1.js | 2 - .../example-sibling-function-graphql-2.js | 2 - src/lib/edge-functions/consts.cjs | 10 - src/utils/command-helpers.cjs | 1 - tests/integration/utils/got.cjs | 2 +- .../generate-autocompletion.test.mjs.snap | 3 + .../generate-autocompletion.test.mjs | 35 +- .../completion/get-autocompletion.test.mjs | 132 +- .../snapshots/completion.test.cjs.md | 74 -- .../snapshots/completion.test.cjs.snap | Bin 795 -> 0 bytes .../generate-autocompletion.test.mjs.md | 74 -- .../generate-autocompletion.test.mjs.snap | Bin 795 -> 0 bytes tests/unit/lib/functions/scheduled.test.mjs | 61 +- tests/unit/lib/functions/server.test.cjs | 2 +- tests/unit/lib/http-agent.test.mjs | 63 +- .../utils/functions/get-functions.test.mjs | 105 +- tests/unit/utils/gh-auth.test.cjs | 2 +- tests/unit/utils/read-repo-url.test.mjs | 24 +- .../unit/utils/telemetry/validation.test.mjs | 122 +- vitest.config.mjs | 17 + 26 files changed, 1372 insertions(+), 506 deletions(-) create mode 100644 tests/unit/lib/completion/__snapshots__/generate-autocompletion.test.mjs.snap delete mode 100644 tests/unit/lib/completion/snapshots/completion.test.cjs.md delete mode 100644 tests/unit/lib/completion/snapshots/completion.test.cjs.snap delete mode 100644 tests/unit/lib/completion/snapshots/generate-autocompletion.test.mjs.md delete mode 100644 tests/unit/lib/completion/snapshots/generate-autocompletion.test.mjs.snap create mode 100644 vitest.config.mjs diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 8f5f5542cda..1e3f98f3b9c 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -26,6 +26,7 @@ module.exports = { 'import/extensions': [2, 'ignorePackages'], 'n/no-process-exit': 0, 'n/no-sync': 0, + 'no-magic-numbers': 'off', 'sort-destructure-keys/sort-destructure-keys': 2, 'unicorn/consistent-destructuring': 0, // TODO: harmonize with filename snake_case in other Netlify Dev projects diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 06e4b01f011..0008b329a8a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,6 +45,9 @@ jobs: - name: Run unit tests run: npm run test:ci:ava:unit if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Run vitest unit tests + run: npm run test:ci:vitest:unit + if: '${{!steps.release-check.outputs.IS_RELEASE}}' test: runs-on: ${{ matrix.os }} timeout-minutes: 30 diff --git a/e2e.config.mjs b/e2e.config.mjs index f5154ea0e27..6a5d8f80190 100644 --- a/e2e.config.mjs +++ b/e2e.config.mjs @@ -1,7 +1,7 @@ const config = { files: ['e2e/**/*.e2e.mjs'], cache: true, - // eslint-disable-next-line no-magic-numbers + concurrency: 5, failFast: false, failWithoutAssertions: false, diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index f76aa7089a8..14467a43368 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -123,6 +123,7 @@ "devDependencies": { "@babel/preset-react": "^7.12.13", "@netlify/eslint-config-node": "^7.0.0", + "@vitest/coverage-c8": "^0.25.3", "ava": "^4.0.0", "c8": "^7.11.0", "eslint-plugin-sort-destructure-keys": "^1.3.5", @@ -138,14 +139,15 @@ "rewiremock": "^3.14.3", "serialize-javascript": "^6.0.0", "sinon": "^14.0.0", - "sort-on": "^4.1.0", "strip-ansi": "^6.0.0", "supertest": "^6.1.6", "temp-dir": "^2.0.0", "tomlify-j0.4": "^3.0.0", "tree-kill": "^1.2.2", "typescript": "^4.4.4", - "verdaccio": "^5.10.2" + "verdaccio": "^5.10.2", + "vite": "^3.2.4", + "vitest": "^0.25.3" }, "engines": { "node": "^14.16.0 || >=16.0.0" @@ -1042,6 +1044,38 @@ "kuler": "^2.0.0" } }, + "node_modules/@esbuild/android-arm": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.15.tgz", + "integrity": "sha512-JJjZjJi2eBL01QJuWjfCdZxcIgot+VoK6Fq7eKF9w4YHm9hwl7nhBR1o2Wnt/WcANk5l9SkpvrldW1PLuXxcbw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.15.tgz", + "integrity": "sha512-lhz6UNPMDXUhtXSulw8XlFAtSYO26WmHQnCi2Lg2p+/TMiJKNLtZCYUxV4wG6rZMzXmr8InGpNwk+DLT2Hm0PA==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@eslint/eslintrc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", @@ -5108,6 +5142,21 @@ "@types/responselike": "*" } }, + "node_modules/@types/chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", + "dev": true + }, + "node_modules/@types/chai-subset": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", + "dev": true, + "dependencies": { + "@types/chai": "*" + } + }, "node_modules/@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -5682,6 +5731,19 @@ "integrity": "sha512-koDx4VeTXdAz51XAjrNc3cQO/LeyNl3aQHmYGviozMVPly/nXj2XXqVdPfPZZDMtbmtMRJ+ychCkhqrJPN3Vng==", "dev": true }, + "node_modules/@vitest/coverage-c8": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@vitest/coverage-c8/-/coverage-c8-0.25.3.tgz", + "integrity": "sha512-+tmrB3E7pZTSM+aWKzLk0FpyyaQOoRQf0594hHp+E3Kk0tiFONiEFYf7+9a1Z+C2ffU/0w6KvyBjpNPdashMrg==", + "dev": true, + "dependencies": { + "c8": "^7.12.0", + "vitest": "0.25.3" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -6346,6 +6408,15 @@ "inherits": "2.0.1" } }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/assign-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", @@ -7398,6 +7469,24 @@ "node": ">=12.19" } }, + "node_modules/chai": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", + "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^4.1.2", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -7489,6 +7578,15 @@ "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" }, + "node_modules/check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -9485,6 +9583,18 @@ "node": ">=0.10.0" } }, + "node_modules/deep-eql": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.2.tgz", + "integrity": "sha512-gT18+YW4CcW/DBNTwAmqTtkJh7f9qqScu2qFVlx7kCoeY9tlBu9cUcr7+I+Z/noG8INehS3xQgLpTtd/QUTn4w==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -10482,6 +10592,363 @@ "es6-symbol": "^3.1.1" } }, + "node_modules/esbuild": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.15.tgz", + "integrity": "sha512-TEw/lwK4Zzld9x3FedV6jy8onOUHqcEX3ADFk4k+gzPUwrxn8nWV62tH0udo8jOtjFodlEfc4ypsqX3e+WWO6w==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.15.15", + "@esbuild/linux-loong64": "0.15.15", + "esbuild-android-64": "0.15.15", + "esbuild-android-arm64": "0.15.15", + "esbuild-darwin-64": "0.15.15", + "esbuild-darwin-arm64": "0.15.15", + "esbuild-freebsd-64": "0.15.15", + "esbuild-freebsd-arm64": "0.15.15", + "esbuild-linux-32": "0.15.15", + "esbuild-linux-64": "0.15.15", + "esbuild-linux-arm": "0.15.15", + "esbuild-linux-arm64": "0.15.15", + "esbuild-linux-mips64le": "0.15.15", + "esbuild-linux-ppc64le": "0.15.15", + "esbuild-linux-riscv64": "0.15.15", + "esbuild-linux-s390x": "0.15.15", + "esbuild-netbsd-64": "0.15.15", + "esbuild-openbsd-64": "0.15.15", + "esbuild-sunos-64": "0.15.15", + "esbuild-windows-32": "0.15.15", + "esbuild-windows-64": "0.15.15", + "esbuild-windows-arm64": "0.15.15" + } + }, + "node_modules/esbuild-android-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.15.tgz", + "integrity": "sha512-F+WjjQxO+JQOva3tJWNdVjouFMLK6R6i5gjDvgUthLYJnIZJsp1HlF523k73hELY20WPyEO8xcz7aaYBVkeg5Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.15.tgz", + "integrity": "sha512-attlyhD6Y22jNyQ0fIIQ7mnPvDWKw7k6FKnsXlBvQE6s3z6s6cuEHcSgoirquQc7TmZgVCK5fD/2uxmRN+ZpcQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.15.tgz", + "integrity": "sha512-ohZtF8W1SHJ4JWldsPVdk8st0r9ExbAOSrBOh5L+Mq47i696GVwv1ab/KlmbUoikSTNoXEhDzVpxUR/WIO19FQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.15.tgz", + "integrity": "sha512-P8jOZ5zshCNIuGn+9KehKs/cq5uIniC+BeCykvdVhx/rBXSxmtj3CUIKZz4sDCuESMbitK54drf/2QX9QHG5Ag==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.15.tgz", + "integrity": "sha512-KkTg+AmDXz1IvA9S1gt8dE24C8Thx0X5oM0KGF322DuP+P3evwTL9YyusHAWNsh4qLsR80nvBr/EIYs29VSwuA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.15.tgz", + "integrity": "sha512-FUcML0DRsuyqCMfAC+HoeAqvWxMeq0qXvclZZ/lt2kLU6XBnDA5uKTLUd379WYEyVD4KKFctqWd9tTuk8C/96g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-32": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.15.tgz", + "integrity": "sha512-q28Qn5pZgHNqug02aTkzw5sW9OklSo96b5nm17Mq0pDXrdTBcQ+M6Q9A1B+dalFeynunwh/pvfrNucjzwDXj+Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.15.tgz", + "integrity": "sha512-217KPmWMirkf8liO+fj2qrPwbIbhNTGNVtvqI1TnOWJgcMjUWvd677Gq3fTzXEjilkx2yWypVnTswM2KbXgoAg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.15.tgz", + "integrity": "sha512-RYVW9o2yN8yM7SB1yaWr378CwrjvGCyGybX3SdzPHpikUHkME2AP55Ma20uNwkNyY2eSYFX9D55kDrfQmQBR4w==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.15.tgz", + "integrity": "sha512-/ltmNFs0FivZkYsTzAsXIfLQX38lFnwJTWCJts0IbCqWZQe+jjj0vYBNbI0kmXLb3y5NljiM5USVAO1NVkdh2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.15.tgz", + "integrity": "sha512-PksEPb321/28GFFxtvL33yVPfnMZihxkEv5zME2zapXGp7fA1X2jYeiTUK+9tJ/EGgcNWuwvtawPxJG7Mmn86A==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.15.tgz", + "integrity": "sha512-ek8gJBEIhcpGI327eAZigBOHl58QqrJrYYIZBWQCnH3UnXoeWMrMZLeeZL8BI2XMBhP+sQ6ERctD5X+ajL/AIA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-riscv64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.15.tgz", + "integrity": "sha512-H5ilTZb33/GnUBrZMNJtBk7/OXzDHDXjIzoLXHSutwwsLxSNaLxzAaMoDGDd/keZoS+GDBqNVxdCkpuiRW4OSw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.15.tgz", + "integrity": "sha512-jKaLUg78mua3rrtrkpv4Or2dNTJU7bgHN4bEjT4OX4GR7nLBSA9dfJezQouTxMmIW7opwEC5/iR9mpC18utnxQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.15.tgz", + "integrity": "sha512-aOvmF/UkjFuW6F36HbIlImJTTx45KUCHJndtKo+KdP8Dhq3mgLRKW9+6Ircpm8bX/RcS3zZMMmaBLkvGY06Gvw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.15.tgz", + "integrity": "sha512-HFFX+WYedx1w2yJ1VyR1Dfo8zyYGQZf1cA69bLdrHzu9svj6KH6ZLK0k3A1/LFPhcEY9idSOhsB2UyU0tHPxgQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-sunos-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.15.tgz", + "integrity": "sha512-jOPBudffG4HN8yJXcK9rib/ZTFoTA5pvIKbRrt3IKAGMq1EpBi4xoVoSRrq/0d4OgZLaQbmkHp8RO9eZIn5atA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-32": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.15.tgz", + "integrity": "sha512-MDkJ3QkjnCetKF0fKxCyYNBnOq6dmidcwstBVeMtXSgGYTy8XSwBeIE4+HuKiSsG6I/mXEb++px3IGSmTN0XiA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.15.tgz", + "integrity": "sha512-xaAUIB2qllE888SsMU3j9nrqyLbkqqkpQyWVkfwSil6BBPgcPk3zOFitTTncEKCLTQy3XV9RuH7PDj3aJDljWA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.15.tgz", + "integrity": "sha512-ttuoCYCIJAFx4UUKKWYnFdrVpoXa3+3WWkXVI6s09U+YjhnyM5h96ewTq/WgQj9LFSIlABQvadHSOQyAVjW5xQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -12734,6 +13201,15 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/get-intrinsic": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", @@ -15345,6 +15821,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/local-pkg": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.2.tgz", + "integrity": "sha512-mlERgSPrbxU3BP4qBqAvvwlgW4MTg78iwJdGGnv7kibKjWcJksrG3t6LB5lXI93wXRDvG4NpUgJFmTG4T6rdrg==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -15732,6 +16220,15 @@ "loose-envify": "cli.js" } }, + "node_modules/loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.0" + } + }, "node_modules/lowdb": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lowdb/-/lowdb-1.0.0.tgz", @@ -18574,6 +19071,15 @@ "node": ">=8" } }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/pbkdf2": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", @@ -18832,9 +19338,9 @@ } }, "node_modules/postcss": { - "version": "8.4.14", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", - "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", + "version": "8.4.19", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.19.tgz", + "integrity": "sha512-h+pbPsyhlYj6N2ozBmHhHrs9DzGmbaarbLvWipMRO7RLS+v4onj26MPFXA5OBYFxyqYhUJK456SwDcY9H2/zsA==", "funding": [ { "type": "opencollective", @@ -20030,6 +20536,21 @@ "inherits": "^2.0.1" } }, + "node_modules/rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/rollup-pluginutils": { "version": "2.8.2", "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", @@ -20694,40 +21215,6 @@ "node": ">=0.10.0" } }, - "node_modules/sort-on": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/sort-on/-/sort-on-4.1.1.tgz", - "integrity": "sha512-nj8myvTCEErLMMWnye61z1pV5osa7njoosoQNdylD8WyPYHoHCBQx/xn7mGJL6h4oThvGpYSIAxfm8VUr75qTQ==", - "dev": true, - "dependencies": { - "arrify": "^2.0.1", - "dot-prop": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/sort-on/node_modules/arrify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", - "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/sort-on/node_modules/dot-prop": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", - "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, - "dependencies": { - "is-obj": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -21341,6 +21828,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strip-literal": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-0.4.2.tgz", + "integrity": "sha512-pv48ybn4iE1O9RLgCAN0iU4Xv7RlBTiit6DKmMiErbs9x1wH6vXBs45tWc0H5wUIF6TLTrKweqkmYF/iraQKNw==", + "dev": true, + "dependencies": { + "acorn": "^8.8.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/strip-outer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", @@ -21867,6 +22366,30 @@ "globrex": "^0.1.2" } }, + "node_modules/tinybench": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.3.1.tgz", + "integrity": "sha512-hGYWYBMPr7p4g5IarQE7XhlyWveh1EKhy4wUBS1LrHXCKYgvz+4/jCqgmJqZxxldesn05vccrtME2RLLZNW7iA==", + "dev": true + }, + "node_modules/tinypool": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.3.0.tgz", + "integrity": "sha512-NX5KeqHOBZU6Bc0xj9Vr5Szbb1j8tUHIeD18s41aDJaPeC5QTdEhK0SpdpUrZlj2nv5cctNcSjaKNanXlfcVEQ==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-1.0.2.tgz", + "integrity": "sha512-bSGlgwLBYf7PnUsQ6WOc6SJ3pGOcd+d8AA6EUnLDDM0kWEstC1JIlSZA3UNliDXhd9ABoS7hiRBDCu+XP/sf1Q==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -23378,6 +23901,136 @@ "extsprintf": "^1.2.0" } }, + "node_modules/vite": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.4.tgz", + "integrity": "sha512-Z2X6SRAffOUYTa+sLy3NQ7nlHFU100xwanq1WDwqaiFiCe+25zdxP1TfCS5ojPV2oDDcXudHIoPnI1Z/66B7Yw==", + "dev": true, + "dependencies": { + "esbuild": "^0.15.9", + "postcss": "^8.4.18", + "resolve": "^1.22.1", + "rollup": "^2.79.1" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "@types/node": ">= 14", + "less": "*", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vite/node_modules/resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/vitest": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.25.3.tgz", + "integrity": "sha512-/UzHfXIKsELZhL7OaM2xFlRF8HRZgAHtPctacvNK8H4vOcbJJAMEgbWNGSAK7Y9b1NBe5SeM7VTuz2RsTHFJJA==", + "dev": true, + "dependencies": { + "@types/chai": "^4.3.3", + "@types/chai-subset": "^1.3.3", + "@types/node": "*", + "acorn": "^8.8.0", + "acorn-walk": "^8.2.0", + "chai": "^4.3.6", + "debug": "^4.3.4", + "local-pkg": "^0.4.2", + "source-map": "^0.6.1", + "strip-literal": "^0.4.2", + "tinybench": "^2.3.1", + "tinypool": "^0.3.0", + "tinyspy": "^1.0.2", + "vite": "^3.0.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": ">=v14.16.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@vitest/browser": "*", + "@vitest/ui": "*", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/vm-browserify": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", @@ -24441,6 +25094,20 @@ "kuler": "^2.0.0" } }, + "@esbuild/android-arm": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.15.tgz", + "integrity": "sha512-JJjZjJi2eBL01QJuWjfCdZxcIgot+VoK6Fq7eKF9w4YHm9hwl7nhBR1o2Wnt/WcANk5l9SkpvrldW1PLuXxcbw==", + "dev": true, + "optional": true + }, + "@esbuild/linux-loong64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.15.tgz", + "integrity": "sha512-lhz6UNPMDXUhtXSulw8XlFAtSYO26WmHQnCi2Lg2p+/TMiJKNLtZCYUxV4wG6rZMzXmr8InGpNwk+DLT2Hm0PA==", + "dev": true, + "optional": true + }, "@eslint/eslintrc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", @@ -27034,6 +27701,21 @@ "@types/responselike": "*" } }, + "@types/chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", + "dev": true + }, + "@types/chai-subset": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", + "dev": true, + "requires": { + "@types/chai": "*" + } + }, "@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -27477,6 +28159,16 @@ "integrity": "sha512-koDx4VeTXdAz51XAjrNc3cQO/LeyNl3aQHmYGviozMVPly/nXj2XXqVdPfPZZDMtbmtMRJ+ychCkhqrJPN3Vng==", "dev": true }, + "@vitest/coverage-c8": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@vitest/coverage-c8/-/coverage-c8-0.25.3.tgz", + "integrity": "sha512-+tmrB3E7pZTSM+aWKzLk0FpyyaQOoRQf0594hHp+E3Kk0tiFONiEFYf7+9a1Z+C2ffU/0w6KvyBjpNPdashMrg==", + "dev": true, + "requires": { + "c8": "^7.12.0", + "vitest": "0.25.3" + } + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -27990,6 +28682,12 @@ "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, "assign-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", @@ -28769,6 +29467,21 @@ "nofilter": "^3.1.0" } }, + "chai": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", + "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^4.1.2", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + } + }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -28832,6 +29545,12 @@ "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", + "dev": true + }, "chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -30399,6 +31118,15 @@ } } }, + "deep-eql": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.2.tgz", + "integrity": "sha512-gT18+YW4CcW/DBNTwAmqTtkJh7f9qqScu2qFVlx7kCoeY9tlBu9cUcr7+I+Z/noG8INehS3xQgLpTtd/QUTn4w==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, "deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -31198,6 +31926,176 @@ "es6-symbol": "^3.1.1" } }, + "esbuild": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.15.tgz", + "integrity": "sha512-TEw/lwK4Zzld9x3FedV6jy8onOUHqcEX3ADFk4k+gzPUwrxn8nWV62tH0udo8jOtjFodlEfc4ypsqX3e+WWO6w==", + "dev": true, + "requires": { + "@esbuild/android-arm": "0.15.15", + "@esbuild/linux-loong64": "0.15.15", + "esbuild-android-64": "0.15.15", + "esbuild-android-arm64": "0.15.15", + "esbuild-darwin-64": "0.15.15", + "esbuild-darwin-arm64": "0.15.15", + "esbuild-freebsd-64": "0.15.15", + "esbuild-freebsd-arm64": "0.15.15", + "esbuild-linux-32": "0.15.15", + "esbuild-linux-64": "0.15.15", + "esbuild-linux-arm": "0.15.15", + "esbuild-linux-arm64": "0.15.15", + "esbuild-linux-mips64le": "0.15.15", + "esbuild-linux-ppc64le": "0.15.15", + "esbuild-linux-riscv64": "0.15.15", + "esbuild-linux-s390x": "0.15.15", + "esbuild-netbsd-64": "0.15.15", + "esbuild-openbsd-64": "0.15.15", + "esbuild-sunos-64": "0.15.15", + "esbuild-windows-32": "0.15.15", + "esbuild-windows-64": "0.15.15", + "esbuild-windows-arm64": "0.15.15" + } + }, + "esbuild-android-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.15.tgz", + "integrity": "sha512-F+WjjQxO+JQOva3tJWNdVjouFMLK6R6i5gjDvgUthLYJnIZJsp1HlF523k73hELY20WPyEO8xcz7aaYBVkeg5Q==", + "dev": true, + "optional": true + }, + "esbuild-android-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.15.tgz", + "integrity": "sha512-attlyhD6Y22jNyQ0fIIQ7mnPvDWKw7k6FKnsXlBvQE6s3z6s6cuEHcSgoirquQc7TmZgVCK5fD/2uxmRN+ZpcQ==", + "dev": true, + "optional": true + }, + "esbuild-darwin-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.15.tgz", + "integrity": "sha512-ohZtF8W1SHJ4JWldsPVdk8st0r9ExbAOSrBOh5L+Mq47i696GVwv1ab/KlmbUoikSTNoXEhDzVpxUR/WIO19FQ==", + "dev": true, + "optional": true + }, + "esbuild-darwin-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.15.tgz", + "integrity": "sha512-P8jOZ5zshCNIuGn+9KehKs/cq5uIniC+BeCykvdVhx/rBXSxmtj3CUIKZz4sDCuESMbitK54drf/2QX9QHG5Ag==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.15.tgz", + "integrity": "sha512-KkTg+AmDXz1IvA9S1gt8dE24C8Thx0X5oM0KGF322DuP+P3evwTL9YyusHAWNsh4qLsR80nvBr/EIYs29VSwuA==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.15.tgz", + "integrity": "sha512-FUcML0DRsuyqCMfAC+HoeAqvWxMeq0qXvclZZ/lt2kLU6XBnDA5uKTLUd379WYEyVD4KKFctqWd9tTuk8C/96g==", + "dev": true, + "optional": true + }, + "esbuild-linux-32": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.15.tgz", + "integrity": "sha512-q28Qn5pZgHNqug02aTkzw5sW9OklSo96b5nm17Mq0pDXrdTBcQ+M6Q9A1B+dalFeynunwh/pvfrNucjzwDXj+Q==", + "dev": true, + "optional": true + }, + "esbuild-linux-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.15.tgz", + "integrity": "sha512-217KPmWMirkf8liO+fj2qrPwbIbhNTGNVtvqI1TnOWJgcMjUWvd677Gq3fTzXEjilkx2yWypVnTswM2KbXgoAg==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.15.tgz", + "integrity": "sha512-RYVW9o2yN8yM7SB1yaWr378CwrjvGCyGybX3SdzPHpikUHkME2AP55Ma20uNwkNyY2eSYFX9D55kDrfQmQBR4w==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.15.tgz", + "integrity": "sha512-/ltmNFs0FivZkYsTzAsXIfLQX38lFnwJTWCJts0IbCqWZQe+jjj0vYBNbI0kmXLb3y5NljiM5USVAO1NVkdh2g==", + "dev": true, + "optional": true + }, + "esbuild-linux-mips64le": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.15.tgz", + "integrity": "sha512-PksEPb321/28GFFxtvL33yVPfnMZihxkEv5zME2zapXGp7fA1X2jYeiTUK+9tJ/EGgcNWuwvtawPxJG7Mmn86A==", + "dev": true, + "optional": true + }, + "esbuild-linux-ppc64le": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.15.tgz", + "integrity": "sha512-ek8gJBEIhcpGI327eAZigBOHl58QqrJrYYIZBWQCnH3UnXoeWMrMZLeeZL8BI2XMBhP+sQ6ERctD5X+ajL/AIA==", + "dev": true, + "optional": true + }, + "esbuild-linux-riscv64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.15.tgz", + "integrity": "sha512-H5ilTZb33/GnUBrZMNJtBk7/OXzDHDXjIzoLXHSutwwsLxSNaLxzAaMoDGDd/keZoS+GDBqNVxdCkpuiRW4OSw==", + "dev": true, + "optional": true + }, + "esbuild-linux-s390x": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.15.tgz", + "integrity": "sha512-jKaLUg78mua3rrtrkpv4Or2dNTJU7bgHN4bEjT4OX4GR7nLBSA9dfJezQouTxMmIW7opwEC5/iR9mpC18utnxQ==", + "dev": true, + "optional": true + }, + "esbuild-netbsd-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.15.tgz", + "integrity": "sha512-aOvmF/UkjFuW6F36HbIlImJTTx45KUCHJndtKo+KdP8Dhq3mgLRKW9+6Ircpm8bX/RcS3zZMMmaBLkvGY06Gvw==", + "dev": true, + "optional": true + }, + "esbuild-openbsd-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.15.tgz", + "integrity": "sha512-HFFX+WYedx1w2yJ1VyR1Dfo8zyYGQZf1cA69bLdrHzu9svj6KH6ZLK0k3A1/LFPhcEY9idSOhsB2UyU0tHPxgQ==", + "dev": true, + "optional": true + }, + "esbuild-sunos-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.15.tgz", + "integrity": "sha512-jOPBudffG4HN8yJXcK9rib/ZTFoTA5pvIKbRrt3IKAGMq1EpBi4xoVoSRrq/0d4OgZLaQbmkHp8RO9eZIn5atA==", + "dev": true, + "optional": true + }, + "esbuild-windows-32": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.15.tgz", + "integrity": "sha512-MDkJ3QkjnCetKF0fKxCyYNBnOq6dmidcwstBVeMtXSgGYTy8XSwBeIE4+HuKiSsG6I/mXEb++px3IGSmTN0XiA==", + "dev": true, + "optional": true + }, + "esbuild-windows-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.15.tgz", + "integrity": "sha512-xaAUIB2qllE888SsMU3j9nrqyLbkqqkpQyWVkfwSil6BBPgcPk3zOFitTTncEKCLTQy3XV9RuH7PDj3aJDljWA==", + "dev": true, + "optional": true + }, + "esbuild-windows-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.15.tgz", + "integrity": "sha512-ttuoCYCIJAFx4UUKKWYnFdrVpoXa3+3WWkXVI6s09U+YjhnyM5h96ewTq/WgQj9LFSIlABQvadHSOQyAVjW5xQ==", + "dev": true, + "optional": true + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -32891,6 +33789,12 @@ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "dev": true + }, "get-intrinsic": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", @@ -34779,6 +35683,12 @@ "integrity": "sha512-Gnxj3ev3mB5TkVBGad0JM6dmLiQL+o0t23JPBZ9sd+yvSLk05mFoqKBw5N8gbbkU4TNXyqCgIrl/VM17OgUIgQ==", "dev": true }, + "local-pkg": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.2.tgz", + "integrity": "sha512-mlERgSPrbxU3BP4qBqAvvwlgW4MTg78iwJdGGnv7kibKjWcJksrG3t6LB5lXI93wXRDvG4NpUgJFmTG4T6rdrg==", + "dev": true + }, "locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -35074,6 +35984,15 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, + "loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "dev": true, + "requires": { + "get-func-name": "^2.0.0" + } + }, "lowdb": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lowdb/-/lowdb-1.0.0.tgz", @@ -37223,6 +38142,12 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true + }, "pbkdf2": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", @@ -37399,9 +38324,9 @@ "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=" }, "postcss": { - "version": "8.4.14", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", - "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", + "version": "8.4.19", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.19.tgz", + "integrity": "sha512-h+pbPsyhlYj6N2ozBmHhHrs9DzGmbaarbLvWipMRO7RLS+v4onj26MPFXA5OBYFxyqYhUJK456SwDcY9H2/zsA==", "requires": { "nanoid": "^3.3.4", "picocolors": "^1.0.0", @@ -38297,6 +39222,15 @@ "inherits": "^2.0.1" } }, + "rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, "rollup-pluginutils": { "version": "2.8.2", "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", @@ -38833,33 +39767,6 @@ "sort-keys": "^1.0.0" } }, - "sort-on": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/sort-on/-/sort-on-4.1.1.tgz", - "integrity": "sha512-nj8myvTCEErLMMWnye61z1pV5osa7njoosoQNdylD8WyPYHoHCBQx/xn7mGJL6h4oThvGpYSIAxfm8VUr75qTQ==", - "dev": true, - "requires": { - "arrify": "^2.0.1", - "dot-prop": "^5.0.0" - }, - "dependencies": { - "arrify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", - "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", - "dev": true - }, - "dot-prop": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", - "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, - "requires": { - "is-obj": "^2.0.0" - } - } - } - }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -39354,6 +40261,15 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, + "strip-literal": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-0.4.2.tgz", + "integrity": "sha512-pv48ybn4iE1O9RLgCAN0iU4Xv7RlBTiit6DKmMiErbs9x1wH6vXBs45tWc0H5wUIF6TLTrKweqkmYF/iraQKNw==", + "dev": true, + "requires": { + "acorn": "^8.8.0" + } + }, "strip-outer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", @@ -39765,6 +40681,24 @@ "globrex": "^0.1.2" } }, + "tinybench": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.3.1.tgz", + "integrity": "sha512-hGYWYBMPr7p4g5IarQE7XhlyWveh1EKhy4wUBS1LrHXCKYgvz+4/jCqgmJqZxxldesn05vccrtME2RLLZNW7iA==", + "dev": true + }, + "tinypool": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.3.0.tgz", + "integrity": "sha512-NX5KeqHOBZU6Bc0xj9Vr5Szbb1j8tUHIeD18s41aDJaPeC5QTdEhK0SpdpUrZlj2nv5cctNcSjaKNanXlfcVEQ==", + "dev": true + }, + "tinyspy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-1.0.2.tgz", + "integrity": "sha512-bSGlgwLBYf7PnUsQ6WOc6SJ3pGOcd+d8AA6EUnLDDM0kWEstC1JIlSZA3UNliDXhd9ABoS7hiRBDCu+XP/sf1Q==", + "dev": true + }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -40854,6 +41788,62 @@ "extsprintf": "^1.2.0" } }, + "vite": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.4.tgz", + "integrity": "sha512-Z2X6SRAffOUYTa+sLy3NQ7nlHFU100xwanq1WDwqaiFiCe+25zdxP1TfCS5ojPV2oDDcXudHIoPnI1Z/66B7Yw==", + "dev": true, + "requires": { + "esbuild": "^0.15.9", + "fsevents": "~2.3.2", + "postcss": "^8.4.18", + "resolve": "^1.22.1", + "rollup": "^2.79.1" + }, + "dependencies": { + "resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dev": true, + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + } + } + }, + "vitest": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.25.3.tgz", + "integrity": "sha512-/UzHfXIKsELZhL7OaM2xFlRF8HRZgAHtPctacvNK8H4vOcbJJAMEgbWNGSAK7Y9b1NBe5SeM7VTuz2RsTHFJJA==", + "dev": true, + "requires": { + "@types/chai": "^4.3.3", + "@types/chai-subset": "^1.3.3", + "@types/node": "*", + "acorn": "^8.8.0", + "acorn-walk": "^8.2.0", + "chai": "^4.3.6", + "debug": "^4.3.4", + "local-pkg": "^0.4.2", + "source-map": "^0.6.1", + "strip-literal": "^0.4.2", + "tinybench": "^2.3.1", + "tinypool": "^0.3.0", + "tinyspy": "^1.0.2", + "vite": "^3.0.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, "vm-browserify": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", diff --git a/package.json b/package.json index 35ef17c43b9..334ca7e288c 100644 --- a/package.json +++ b/package.json @@ -211,8 +211,10 @@ "test:init:eleventy-deps": "npm ci --prefix tests/integration/eleventy-site --no-audit", "test:init:hugo-deps": "npm ci --prefix tests/integration/hugo-site --no-audit", "test:dev:ava": "ava --verbose", + "test:dev:vitest": "vitest run", "test:ci:ava:unit": "c8 -r json ava --no-worker-threads tests/unit/ tools/", "test:ci:ava:integration": "c8 -r json ava --concurrency 1 --no-worker-threads tests/integration/", + "test:ci:vitest:unit": "vitest run --coverage tests/unit/", "test:affected": "node ./tools/affected-test.mjs", "e2e": "node ./tools/e2e/run.mjs", "docs": "node ./site/scripts/docs.mjs", @@ -337,6 +339,7 @@ "devDependencies": { "@babel/preset-react": "^7.12.13", "@netlify/eslint-config-node": "^7.0.0", + "@vitest/coverage-c8": "^0.25.3", "ava": "^4.0.0", "c8": "^7.11.0", "eslint-plugin-sort-destructure-keys": "^1.3.5", @@ -352,19 +355,21 @@ "rewiremock": "^3.14.3", "serialize-javascript": "^6.0.0", "sinon": "^14.0.0", - "sort-on": "^4.1.0", "strip-ansi": "^6.0.0", "supertest": "^6.1.6", "temp-dir": "^2.0.0", "tomlify-j0.4": "^3.0.0", "tree-kill": "^1.2.2", "typescript": "^4.4.4", - "verdaccio": "^5.10.2" + "verdaccio": "^5.10.2", + "vite": "^3.2.4", + "vitest": "^0.25.3" }, "ava": { "files": [ "tools/**/*.test.mjs", - "tests/**/*.test.+(c|m)js" + "tests/integration/**/*.test.+(c|m)js", + "tests/unit/**/*.test.cjs" ], "cache": true, "concurrency": 5, diff --git a/src/commands/dev/dev.mjs b/src/commands/dev/dev.mjs index 16eb52846ca..0c9e6cec965 100644 --- a/src/commands/dev/dev.mjs +++ b/src/commands/dev/dev.mjs @@ -516,7 +516,7 @@ const dev = async (options, command) => { const devCommand = async () => { const { ipVersion } = await startFrameworkServer({ settings }) - // eslint-disable-next-line no-magic-numbers + settings.frameworkHost = ipVersion === 6 ? '::1' : '127.0.0.1' } const startDevOptions = getBuildOptions({ diff --git a/src/functions-templates/javascript/graphql-gateway/example-sibling-function-graphql-1.js b/src/functions-templates/javascript/graphql-gateway/example-sibling-function-graphql-1.js index 1a49ed58abc..6225f9ca2fd 100644 --- a/src/functions-templates/javascript/graphql-gateway/example-sibling-function-graphql-1.js +++ b/src/functions-templates/javascript/graphql-gateway/example-sibling-function-graphql-1.js @@ -17,13 +17,11 @@ const typeDefs = gql` } ` -/* eslint-disable no-magic-numbers */ const authors = [ { id: 1, name: 'Terry Pratchett', age: 67 }, { id: 2, name: 'Stephen King', age: 71 }, { id: 3, name: 'JK Rowling', age: 53 }, ] -/* eslint-enable no-magic-numbers */ const resolvers = { Query: { diff --git a/src/functions-templates/javascript/graphql-gateway/example-sibling-function-graphql-2.js b/src/functions-templates/javascript/graphql-gateway/example-sibling-function-graphql-2.js index 5973bf9bbae..7fac975eff3 100644 --- a/src/functions-templates/javascript/graphql-gateway/example-sibling-function-graphql-2.js +++ b/src/functions-templates/javascript/graphql-gateway/example-sibling-function-graphql-2.js @@ -17,7 +17,6 @@ const typeDefs = gql` } ` -/* eslint-disable no-magic-numbers */ const books = [ { id: 1, @@ -62,7 +61,6 @@ const books = [ authorName: 'JK Rowling', }, ] -/* eslint-enable no-magic-numbers */ const resolvers = { Query: { diff --git a/src/lib/edge-functions/consts.cjs b/src/lib/edge-functions/consts.cjs index fa273808850..5c85ee789bf 100644 --- a/src/lib/edge-functions/consts.cjs +++ b/src/lib/edge-functions/consts.cjs @@ -1,21 +1,11 @@ -const DEFAULT_SRC_DIR = 'netlify/edge-functions' const DIST_IMPORT_MAP_PATH = 'edge-functions-import-map.json' const INTERNAL_EDGE_FUNCTIONS_FOLDER = 'edge-functions' const EDGE_FUNCTIONS_FOLDER = 'edge-functions-dist' const PUBLIC_URL_PATH = '.netlify/internal/edge-functions' -// 1 second -const SERVER_POLL_INTERNAL = 1e3 - -// 10 seconds -const SERVER_POLL_TIMEOUT = 1e4 - module.exports = { - DEFAULT_SRC_DIR, DIST_IMPORT_MAP_PATH, INTERNAL_EDGE_FUNCTIONS_FOLDER, EDGE_FUNCTIONS_FOLDER, PUBLIC_URL_PATH, - SERVER_POLL_INTERNAL, - SERVER_POLL_TIMEOUT, } diff --git a/src/utils/command-helpers.cjs b/src/utils/command-helpers.cjs index 4118e050dc1..9e969b5deb7 100644 --- a/src/utils/command-helpers.cjs +++ b/src/utils/command-helpers.cjs @@ -53,7 +53,6 @@ const USER_AGENT = `${name}/${version} ${platform}-${arch} node-${process.versio /** A list of base command flags that needs to be sorted down on documentation and on help pages */ const BASE_FLAGS = new Set(['--debug', '--httpProxy', '--httpProxyCertificateFilename']) -// eslint-disable-next-line no-magic-numbers const NETLIFY_CYAN = chalk.rgb(40, 180, 170) const NETLIFYDEV = `${chalk.greenBright('◈')} ${NETLIFY_CYAN('Netlify Dev')} ${chalk.greenBright('◈')}` diff --git a/tests/integration/utils/got.cjs b/tests/integration/utils/got.cjs index 4f98f41a3b4..2ac00282dc8 100644 --- a/tests/integration/utils/got.cjs +++ b/tests/integration/utils/got.cjs @@ -13,7 +13,7 @@ const isResponseOk = (response) => { const TIMEOUT = 3e5 // Default got retry status code with the addition of 403 -// eslint-disable-next-line no-magic-numbers + const STATUS_CODE = [403, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524] const extendedGot = got.extend({ diff --git a/tests/unit/lib/completion/__snapshots__/generate-autocompletion.test.mjs.snap b/tests/unit/lib/completion/__snapshots__/generate-autocompletion.test.mjs.snap new file mode 100644 index 00000000000..304d5b43697 --- /dev/null +++ b/tests/unit/lib/completion/__snapshots__/generate-autocompletion.test.mjs.snap @@ -0,0 +1,3 @@ +// Vitest Snapshot v1 + +exports[`generateAutocompletion > should generate a completion file 1`] = `undefined`; diff --git a/tests/unit/lib/completion/generate-autocompletion.test.mjs b/tests/unit/lib/completion/generate-autocompletion.test.mjs index 175a336943d..646358b788a 100644 --- a/tests/unit/lib/completion/generate-autocompletion.test.mjs +++ b/tests/unit/lib/completion/generate-autocompletion.test.mjs @@ -1,9 +1,10 @@ // @ts-check import fs from 'fs' -import test from 'ava' import { Argument } from 'commander' -import sinon from 'sinon' +import { describe, expect, test, vi } from 'vitest' + +import generateAutocompletion from '../../../../src/lib/completion/generate-autocompletion.mjs' const createTestCommand = async () => { const { default: BaseCommand } = await import('../../../../src/commands/base-command.mjs') @@ -27,24 +28,22 @@ const createTestCommand = async () => { return program } -test.afterEach(() => { - // eslint-disable-next-line import/no-named-as-default-member - sinon.restore() -}) - -test('should generate a completion file', async (t) => { - // eslint-disable-next-line import/no-named-as-default-member - const stub = sinon.stub(fs, 'writeFileSync').callsFake(() => {}) - const { default: generateAutocompletion } = await import('../../../../src/lib/completion/generate-autocompletion.mjs') - const program = await createTestCommand() +describe('generateAutocompletion', () => { + test('should generate a completion file', async () => { + vi.spyOn(fs, 'writeFileSync').mockImplementation(() => {}) + const program = await createTestCommand() - generateAutocompletion(program) + generateAutocompletion(program) - // @ts-ignore - t.true(stub.getCall(0).args[0].endsWith('autocompletion.json'), 'should write a autocompletion file') + expect(fs.writeFileSync).toHaveBeenCalledOnce() - // @ts-ignore - t.snapshot(JSON.parse(stub.getCall(0).args[1])) + expect(fs.writeFileSync).toHaveBeenCalledWith( + expect.stringMatching(/autocompletion\.json$/), + expect.anything(), + 'utf-8', + ) + expect(fs.writeFileSync.lastCall).toMatchSnapshot() - stub.restore() + fs.writeFileSync.mockRestore() + }) }) diff --git a/tests/unit/lib/completion/get-autocompletion.test.mjs b/tests/unit/lib/completion/get-autocompletion.test.mjs index debd1da4290..299cd2fe299 100644 --- a/tests/unit/lib/completion/get-autocompletion.test.mjs +++ b/tests/unit/lib/completion/get-autocompletion.test.mjs @@ -1,5 +1,5 @@ // @ts-check -import test from 'ava' +import { expect, describe, test } from 'vitest' import getAutocompletion from '../../../../src/lib/completion/get-autocompletion.mjs' @@ -20,76 +20,76 @@ const cookingFixtures = { }, } -test('should not autocomplete anything when completion is turned off', (t) => { - // @ts-ignore - t.is(getAutocompletion({}, cookingFixtures), undefined) - // @ts-ignore - t.is(getAutocompletion({ complete: false }, cookingFixtures), undefined) - // @ts-ignore - t.is(getAutocompletion({ complete: false, words: 2 }, cookingFixtures), undefined) -}) - -test('should get the correct autocompletion for the base command', (t) => { - // @ts-ignore - const completion = getAutocompletion({ complete: true, words: 1, lastPartial: '' }, cookingFixtures) - t.deepEqual(completion, [ - { name: 'cook', description: 'cooking' }, - { name: 'bake', description: 'baking' }, - ]) -}) - -test('should get the correct autocompletion for the base command if there is already a word', (t) => { - // @ts-ignore - const completion = getAutocompletion({ complete: true, words: 1, lastPartial: 'ba' }, cookingFixtures) - t.deepEqual(completion, [{ name: 'bake', description: 'baking' }]) -}) - -test('should get no flags if the command has no flags', (t) => { - const completion = getAutocompletion( +describe('getAutocompletion', () => { + test('should not autocomplete anything when completion is turned off', () => { // @ts-ignore - { complete: true, words: 2, lastPartial: '', line: 'netlify cook' }, - cookingFixtures, - ) - t.deepEqual(completion, []) -}) - -test('should get the correct flags for the command', (t) => { - const completion = getAutocompletion( + expect(getAutocompletion({}, cookingFixtures)).toBeUndefined() // @ts-ignore - { complete: true, words: 2, lastPartial: '', line: 'netlify bake' }, - cookingFixtures, - ) - t.deepEqual(completion, cookingFixtures.bake.options) -}) - -test('should get the correct left over flags for the command', (t) => { - const completion = getAutocompletion( + expect(getAutocompletion({ complete: false }, cookingFixtures)).toBeUndefined() // @ts-ignore - { complete: true, words: 3, lastPartial: '', line: 'netlify bake --heat' }, - cookingFixtures, - ) - t.deepEqual(completion, [ - { name: '--duration', description: 'duration' }, - { name: '--heat-type', description: 'type' }, - ]) -}) + expect(getAutocompletion({ complete: false, words: 2 }, cookingFixtures)).toBeUndefined() + }) -test('should get no results if the command has no left over flags anymore', (t) => { - const completion = getAutocompletion( + test('should get the correct autocompletion for the base command', () => { // @ts-ignore - // eslint-disable-next-line no-magic-numbers - { complete: true, words: 4, lastPartial: '', line: 'netlify bake --heat --heat-type --duration' }, - cookingFixtures, - ) - t.deepEqual(completion, []) -}) + const completion = getAutocompletion({ complete: true, words: 1, lastPartial: '' }, cookingFixtures) + expect(completion).toEqual([ + { name: 'cook', description: 'cooking' }, + { name: 'bake', description: 'baking' }, + ]) + }) -test('should autocomplete flags', (t) => { - const completion = getAutocompletion( + test('should get the correct autocompletion for the base command if there is already a word', () => { // @ts-ignore - // eslint-disable-next-line no-magic-numbers - { complete: true, words: 4, lastPartial: '--hea', line: 'netlify bake --heat --hea' }, - cookingFixtures, - ) - t.deepEqual(completion, [{ name: '--heat-type', description: 'type' }]) + const completion = getAutocompletion({ complete: true, words: 1, lastPartial: 'ba' }, cookingFixtures) + expect(completion).toEqual([{ name: 'bake', description: 'baking' }]) + }) + + test('should get no flags if the command has no flags', () => { + const completion = getAutocompletion( + // @ts-ignore + { complete: true, words: 2, lastPartial: '', line: 'netlify cook' }, + cookingFixtures, + ) + expect(completion).toEqual([]) + }) + + test('should get the correct flags for the command', () => { + const completion = getAutocompletion( + // @ts-ignore + { complete: true, words: 2, lastPartial: '', line: 'netlify bake' }, + cookingFixtures, + ) + expect(completion).toEqual(cookingFixtures.bake.options) + }) + + test('should get the correct left over flags for the command', () => { + const completion = getAutocompletion( + // @ts-ignore + { complete: true, words: 3, lastPartial: '', line: 'netlify bake --heat' }, + cookingFixtures, + ) + expect(completion).toEqual([ + { name: '--duration', description: 'duration' }, + { name: '--heat-type', description: 'type' }, + ]) + }) + + test('should get no results if the command has no left over flags anymore', () => { + const completion = getAutocompletion( + // @ts-ignore + { complete: true, words: 4, lastPartial: '', line: 'netlify bake --heat --heat-type --duration' }, + cookingFixtures, + ) + expect(completion).toEqual([]) + }) + + test('should autocomplete flags', () => { + const completion = getAutocompletion( + // @ts-ignore + { complete: true, words: 4, lastPartial: '--hea', line: 'netlify bake --heat --hea' }, + cookingFixtures, + ) + expect(completion).toEqual([{ name: '--heat-type', description: 'type' }]) + }) }) diff --git a/tests/unit/lib/completion/snapshots/completion.test.cjs.md b/tests/unit/lib/completion/snapshots/completion.test.cjs.md deleted file mode 100644 index 7543d232577..00000000000 --- a/tests/unit/lib/completion/snapshots/completion.test.cjs.md +++ /dev/null @@ -1,74 +0,0 @@ -# Snapshot report for `src/lib/completion/tests/completion.test.cjs` - -The actual snapshot is saved in `completion.test.cjs.snap`. - -Generated by [AVA](https://avajs.dev). - -## should generate a completion file - -> Snapshot 1 - - { - bake: { - description: 'Cooks something', - name: 'bake', - options: [ - { - description: 'cook it fast', - name: '--fast', - }, - { - description: 'Print debugging information', - name: '--debug', - }, - { - description: 'Proxy server address to route requests through.', - name: '--httpProxy', - }, - { - description: 'Certificate file to use when connecting using a proxy server', - name: '--httpProxyCertificateFilename', - }, - ], - }, - 'bake:pizza': { - description: 'bakes a pizza', - name: 'bake:pizza', - options: [ - { - description: 'Type of pizza', - name: '--type', - }, - { - description: 'Print debugging information', - name: '--debug', - }, - { - description: 'Proxy server address to route requests through.', - name: '--httpProxy', - }, - { - description: 'Certificate file to use when connecting using a proxy server', - name: '--httpProxyCertificateFilename', - }, - ], - }, - taste: { - description: 'tastes something', - name: 'taste', - options: [ - { - description: 'Print debugging information', - name: '--debug', - }, - { - description: 'Proxy server address to route requests through.', - name: '--httpProxy', - }, - { - description: 'Certificate file to use when connecting using a proxy server', - name: '--httpProxyCertificateFilename', - }, - ], - }, - } diff --git a/tests/unit/lib/completion/snapshots/completion.test.cjs.snap b/tests/unit/lib/completion/snapshots/completion.test.cjs.snap deleted file mode 100644 index 5e4dc6becbed26e9af7416f88c2b240005ab6397..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 795 zcmV+$1LXWcRzV3HO6{MF^^ishhf_joo zc9LD2?4~;tZA(4$Q1Ij6!Gm~`7QJ}YUc`g{gLe_?QScuS^x18b#@QMd#Dmbllf1n9 zd*_**H#4)*sI|iSf>_(+(w8m1bWC_*x8<@X4|wEA&Ky<`+np93hXHH&E$)lJ>41`A zZNqgP>D(%8=_E(u54EW=h2LrD8Wcc>s5M5dtF=44E-CGYl}d%s5}`Vwqm-@#oQPv{ zj2bm(fhXCw1KC2Hz1Z6Ka3 z_TD}hCIgDhmZf+YfzIx(=I;&FMc@1z+e*@7EmHbGPc{OgH;5=r z!cTFiC1Ktm$#V4z&Ktdg+eW|OkD0s5h$W(qxS5poh*wG`A!p)Y~Fh6*_a&85&wK<1!T6)mLD7eHP?UsSZ1LT#In zQOL0sbR>m71o8y>rlO@3dMZ!ISt!gaXeEU{1@avFs-j~lbfQ4W5oo2LpyR3IM9Z+r zM(Q|Dm@ioa`)Ak&v#Qk{B;&x7^N}A&=JHy%*~I2$e$WV`wi7eMd~(%lQj^)}%zP9s zEi=KRyF6l!>qcA%CPNm5UED_zU+i)rk@1jddZ&k(7pqlI%1$z3<_S#C@<{p(zaC$I z@r@UocLitnJRaaS3oP~`)pWkS* Z1bfir|F6jht@zii_z5@1b~5}5006Wt diff --git a/tests/unit/lib/completion/snapshots/generate-autocompletion.test.mjs.md b/tests/unit/lib/completion/snapshots/generate-autocompletion.test.mjs.md deleted file mode 100644 index e446ebf7b53..00000000000 --- a/tests/unit/lib/completion/snapshots/generate-autocompletion.test.mjs.md +++ /dev/null @@ -1,74 +0,0 @@ -# Snapshot report for `tests/unit/lib/completion/generate-autocompletion.test.mjs` - -The actual snapshot is saved in `generate-autocompletion.test.mjs.snap`. - -Generated by [AVA](https://avajs.dev). - -## should generate a completion file - -> Snapshot 1 - - { - bake: { - description: 'Cooks something', - name: 'bake', - options: [ - { - description: 'cook it fast', - name: '--fast', - }, - { - description: 'Print debugging information', - name: '--debug', - }, - { - description: 'Proxy server address to route requests through.', - name: '--httpProxy', - }, - { - description: 'Certificate file to use when connecting using a proxy server', - name: '--httpProxyCertificateFilename', - }, - ], - }, - 'bake:pizza': { - description: 'bakes a pizza', - name: 'bake:pizza', - options: [ - { - description: 'Type of pizza', - name: '--type', - }, - { - description: 'Print debugging information', - name: '--debug', - }, - { - description: 'Proxy server address to route requests through.', - name: '--httpProxy', - }, - { - description: 'Certificate file to use when connecting using a proxy server', - name: '--httpProxyCertificateFilename', - }, - ], - }, - taste: { - description: 'tastes something', - name: 'taste', - options: [ - { - description: 'Print debugging information', - name: '--debug', - }, - { - description: 'Proxy server address to route requests through.', - name: '--httpProxy', - }, - { - description: 'Certificate file to use when connecting using a proxy server', - name: '--httpProxyCertificateFilename', - }, - ], - }, - } diff --git a/tests/unit/lib/completion/snapshots/generate-autocompletion.test.mjs.snap b/tests/unit/lib/completion/snapshots/generate-autocompletion.test.mjs.snap deleted file mode 100644 index 5e4dc6becbed26e9af7416f88c2b240005ab6397..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 795 zcmV+$1LXWcRzV3HO6{MF^^ishhf_joo zc9LD2?4~;tZA(4$Q1Ij6!Gm~`7QJ}YUc`g{gLe_?QScuS^x18b#@QMd#Dmbllf1n9 zd*_**H#4)*sI|iSf>_(+(w8m1bWC_*x8<@X4|wEA&Ky<`+np93hXHH&E$)lJ>41`A zZNqgP>D(%8=_E(u54EW=h2LrD8Wcc>s5M5dtF=44E-CGYl}d%s5}`Vwqm-@#oQPv{ zj2bm(fhXCw1KC2Hz1Z6Ka3 z_TD}hCIgDhmZf+YfzIx(=I;&FMc@1z+e*@7EmHbGPc{OgH;5=r z!cTFiC1Ktm$#V4z&Ktdg+eW|OkD0s5h$W(qxS5poh*wG`A!p)Y~Fh6*_a&85&wK<1!T6)mLD7eHP?UsSZ1LT#In zQOL0sbR>m71o8y>rlO@3dMZ!ISt!gaXeEU{1@avFs-j~lbfQ4W5oo2LpyR3IM9Z+r zM(Q|Dm@ioa`)Ak&v#Qk{B;&x7^N}A&=JHy%*~I2$e$WV`wi7eMd~(%lQj^)}%zP9s zEi=KRyF6l!>qcA%CPNm5UED_zU+i)rk@1jddZ&k(7pqlI%1$z3<_S#C@<{p(zaC$I z@r@UocLitnJRaaS3oP~`)pWkS* Z1bfir|F6jht@zii_z5@1b~5}5006Wt diff --git a/tests/unit/lib/functions/scheduled.test.mjs b/tests/unit/lib/functions/scheduled.test.mjs index 5b498318a4c..57d9f6173d0 100644 --- a/tests/unit/lib/functions/scheduled.test.mjs +++ b/tests/unit/lib/functions/scheduled.test.mjs @@ -1,6 +1,7 @@ -import test from 'ava' +import { expect, describe, test } from 'vitest' import { buildHelpResponse } from '../../../../src/lib/functions/scheduled.mjs' +import { CLOCKWORK_USERAGENT } from '../../../../src/utils/functions/constants.mjs' const withAccept = (accept) => buildHelpResponse({ @@ -14,31 +15,6 @@ const withAccept = (accept) => }, }) -test('buildHelpResponse does content negotiation', (t) => { - const html = withAccept('text/html') - t.is(html.contentType, 'text/html') - t.true(html.message.includes('')) - - const plain = withAccept('text/plain') - t.is(plain.contentType, 'text/plain') - t.false(plain.message.includes('')) -}) - -test('buildHelpResponse prints errors', (t) => { - const response = buildHelpResponse({ - error: new Error('test'), - headers: {}, - path: '/', - result: { - statusCode: 200, - }, - }) - - t.true(response.message.includes('There was an error')) -}) - const withUserAgent = (userAgent) => buildHelpResponse({ error: new Error('test'), @@ -52,7 +28,34 @@ const withUserAgent = (userAgent) => }, }) -test('buildHelpResponse conditionally prints notice about HTTP x scheduled functions', (t) => { - t.true(withUserAgent('').message.includes("it won't work in production")) - t.false(withUserAgent('Netlify Clockwork').message.includes("it won't work in production")) +describe('buildHelpResponse', () => { + test('buildHelpResponse does content negotiation', () => { + const html = withAccept('text/html') + expect(html.contentType).toBe('text/html') + expect(html.message).toContain('') + + const plain = withAccept('text/plain') + expect(plain.contentType).toBe('text/plain') + expect(plain.message).not.toContain('') + }) + + test('buildHelpResponse prints errors', () => { + const response = buildHelpResponse({ + error: new Error('test'), + headers: {}, + path: '/', + result: { + statusCode: 200, + }, + }) + + expect(response.message).toContain('There was an error') + }) + + test('buildHelpResponse conditionally prints notice about HTTP x scheduled functions', () => { + expect(withUserAgent('').message).toContain("it won't work in production") + expect(withUserAgent(CLOCKWORK_USERAGENT).message).not.toContain("it won't work in production") + }) }) diff --git a/tests/unit/lib/functions/server.test.cjs b/tests/unit/lib/functions/server.test.cjs index 3a9df2b58b9..e7e92afefd4 100644 --- a/tests/unit/lib/functions/server.test.cjs +++ b/tests/unit/lib/functions/server.test.cjs @@ -23,7 +23,7 @@ test.before(async () => { projectRoot, config: {}, timeouts: { syncFunctions: 1, backgroundFunctions: 1 }, - // eslint-disable-next-line no-magic-numbers + settings: { port: 8888 }, }) await functionsRegistry.scan([functionsDirectory]) diff --git a/tests/unit/lib/http-agent.test.mjs b/tests/unit/lib/http-agent.test.mjs index 9a59205114a..662c91a866e 100644 --- a/tests/unit/lib/http-agent.test.mjs +++ b/tests/unit/lib/http-agent.test.mjs @@ -1,49 +1,52 @@ import http from 'http' -import test from 'ava' import ProxyServer from 'http-proxy' import HttpsProxyAgent from 'https-proxy-agent' +import { describe, expect, test } from 'vitest' import { tryGetAgent } from '../../../src/lib/http-agent.mjs' -test(`should return an empty object when there is no httpProxy`, async (t) => { - t.deepEqual(await tryGetAgent({}), {}) -}) +describe('tryGetAgent', () => { + test(`should return an empty object when there is no httpProxy`, async () => { + expect(await tryGetAgent({})).toEqual({}) + }) -test(`should return error on invalid url`, async (t) => { - const httpProxy = 'invalid_url' - const result = await tryGetAgent({ httpProxy }) - t.truthy(result.error) -}) + test(`should return error on invalid url`, async () => { + const httpProxy = 'invalid_url' + const result = await tryGetAgent({ httpProxy }) -test(`should return error when scheme is not http or https`, async (t) => { - const httpProxy = 'file://localhost' - const result = await tryGetAgent({ httpProxy }) + expect(result.error).toBeDefined() + }) - t.truthy(result.error) -}) + test(`should return error when scheme is not http or https`, async () => { + const httpProxy = 'file://localhost' + const result = await tryGetAgent({ httpProxy }) -test(`should return error when proxy is not available`, async (t) => { - const httpProxy = 'https://unknown:7979' - const result = await tryGetAgent({ httpProxy }) + expect(result.error).toBeDefined() + }) - t.truthy(result.error) -}) + test(`should return error when proxy is not available`, async () => { + const httpProxy = 'https://unknown:7979' + const result = await tryGetAgent({ httpProxy }) -test(`should return agent for a valid proxy`, async (t) => { - const proxy = ProxyServer.createProxyServer() - const server = http.createServer(function onRequest(req, res) { - proxy.web(req, res, { target: 'http://localhost:5555' }) + expect(result.error).toBeDefined() }) - await new Promise((resolve) => { - server.listen({ port: 0, hostname: 'localhost' }, resolve) - }) + test(`should return agent for a valid proxy`, async () => { + const proxy = ProxyServer.createProxyServer() + const server = http.createServer(function onRequest(req, res) { + proxy.web(req, res, { target: 'http://localhost:5555' }) + }) - const httpProxyUrl = `http://localhost:${server.address().port}` - const result = await tryGetAgent({ httpProxy: httpProxyUrl }) + await new Promise((resolve) => { + server.listen({ port: 0, hostname: 'localhost' }, resolve) + }) - t.is(result.agent instanceof HttpsProxyAgent, true) + const httpProxyUrl = `http://localhost:${server.address().port}` + const result = await tryGetAgent({ httpProxy: httpProxyUrl }) - server.close() + expect(result.agent).toBeInstanceOf(HttpsProxyAgent) + + server.close() + }) }) diff --git a/tests/unit/utils/functions/get-functions.test.mjs b/tests/unit/utils/functions/get-functions.test.mjs index dd78ff07727..f311619dffd 100644 --- a/tests/unit/utils/functions/get-functions.test.mjs +++ b/tests/unit/utils/functions/get-functions.test.mjs @@ -1,80 +1,81 @@ import path from 'path' -import test from 'ava' -import sortOn from 'sort-on' +import { describe, expect, test } from 'vitest' import { getFunctions } from '../../../../src/utils/functions/get-functions.mjs' import { withSiteBuilder } from '../../../integration/utils/site-builder.cjs' -test('should return empty object when an empty string is provided', async (t) => { - const funcs = await getFunctions('') - t.deepEqual(funcs, []) -}) - -test('should return an empty object for a directory with no js files', async (t) => { - await withSiteBuilder('site-without-functions', async (builder) => { - await builder.buildAsync() - - const funcs = await getFunctions(builder.directory) - t.deepEqual(funcs, []) +describe('getFunctions', () => { + test('should return empty object when an empty string is provided', async () => { + const funcs = await getFunctions('') + expect(funcs).toEqual([]) }) -}) -test('should return object with function details for a directory with js files', async (t) => { - await withSiteBuilder('site-without-functions', async (builder) => { - builder.withFunction({ - path: 'index.js', - handler: '', - }) - await builder.buildAsync() + test('should return an empty object for a directory with no js files', async () => { + await withSiteBuilder('site-without-functions', async (builder) => { + await builder.buildAsync() - const functions = path.join(builder.directory, 'functions') - const funcs = await getFunctions(functions) - t.deepEqual(funcs, [ - { - name: 'index', - mainFile: path.join(builder.directory, 'functions', 'index.js'), - isBackground: false, - runtime: 'js', - schedule: undefined, - urlPath: '/.netlify/functions/index', - }, - ]) + const funcs = await getFunctions(builder.directory) + expect(funcs).toEqual([]) + }) }) -}) -test('should mark background functions based on filenames', async (t) => { - await withSiteBuilder('site-without-functions', async (builder) => { - builder - .withFunction({ - path: 'foo-background.js', + test('should return object with function details for a directory with js files', async () => { + await withSiteBuilder('site-without-functions', async (builder) => { + builder.withFunction({ + path: 'index.js', handler: '', }) - .withFunction({ - path: 'bar-background/bar-background.js', - handler: '', - }) - await builder.buildAsync() + await builder.buildAsync() + + const functions = path.join(builder.directory, 'functions') + const funcs = await getFunctions(functions) + expect(funcs).toEqual([ + { + name: 'index', + mainFile: path.join(builder.directory, 'functions', 'index.js'), + isBackground: false, + runtime: 'js', + schedule: undefined, + urlPath: '/.netlify/functions/index', + }, + ]) + }) + }) + + test('should mark background functions based on filenames', async () => { + await withSiteBuilder('site-without-functions', async (builder) => { + builder + .withFunction({ + path: 'foo-background.js', + handler: '', + }) + .withFunction({ + path: 'bar-background/bar-background.js', + handler: '', + }) + await builder.buildAsync() - const functions = path.join(builder.directory, 'functions') - const funcs = await getFunctions(functions) - t.deepEqual(sortOn(funcs, ['mainFile', 'extension']), [ - { + const functions = path.join(builder.directory, 'functions') + const funcs = await getFunctions(functions) + + expect(funcs).toHaveLength(2) + expect(funcs).toContainEqual({ name: 'bar-background', mainFile: path.join(builder.directory, 'functions', 'bar-background', 'bar-background.js'), isBackground: true, runtime: 'js', schedule: undefined, urlPath: '/.netlify/functions/bar-background', - }, - { + }) + expect(funcs).toContainEqual({ name: 'foo-background', mainFile: path.join(builder.directory, 'functions', 'foo-background.js'), isBackground: true, runtime: 'js', schedule: undefined, urlPath: '/.netlify/functions/foo-background', - }, - ]) + }) + }) }) }) diff --git a/tests/unit/utils/gh-auth.test.cjs b/tests/unit/utils/gh-auth.test.cjs index 6cef23315ee..356bbfe3bdd 100644 --- a/tests/unit/utils/gh-auth.test.cjs +++ b/tests/unit/utils/gh-auth.test.cjs @@ -27,7 +27,7 @@ test('should check if the authWithNetlify is working', async (t) => { await new Promise((resolve, reject) => { const fibonacciBackoff = backoff.fibonacci() const check = () => (host ? resolve() : fibonacciBackoff.backoff()) - // eslint-disable-next-line no-magic-numbers + fibonacciBackoff.failAfter(10) fibonacciBackoff.on('ready', check) fibonacciBackoff.on('fail', reject) diff --git a/tests/unit/utils/read-repo-url.test.mjs b/tests/unit/utils/read-repo-url.test.mjs index 352fef01b27..e8a696aa793 100644 --- a/tests/unit/utils/read-repo-url.test.mjs +++ b/tests/unit/utils/read-repo-url.test.mjs @@ -1,17 +1,19 @@ -import test from 'ava' +import { describe, expect, test } from 'vitest' import { parseRepoURL } from '../../../src/utils/read-repo-url.mjs' -test('parseRepoURL: should parse GitHub URL', (t) => { - const url = new URL('https://github.com/netlify-labs/all-the-functions/tree/master/functions/9-using-middleware') - // parseRepoURL expects the result of url.parse - const [repo, contentPath] = parseRepoURL('GitHub', { path: url.pathname }) +describe('parseRepoURL', () => { + test('should parse GitHub URL', () => { + const url = new URL('https://github.com/netlify-labs/all-the-functions/tree/master/functions/9-using-middleware') + // parseRepoURL expects the result of url.parse + const [repo, contentPath] = parseRepoURL('GitHub', { path: url.pathname }) - t.is(repo, 'netlify-labs/all-the-functions') - t.is(contentPath, 'functions/9-using-middleware') -}) + expect(repo).toBe('netlify-labs/all-the-functions') + expect(contentPath).toBe('functions/9-using-middleware') + }) -test('parseRepoURL: should fail on GitLab URL', (t) => { - const url = new URL('https://gitlab.com/netlify-labs/all-the-functions/-/blob/master/functions/9-using-middleware') - t.throws(() => parseRepoURL('GitLab', { path: url.pathname }), { message: 'Unsupported host GitLab' }) + test('should fail on GitLab URL', () => { + const url = new URL('https://gitlab.com/netlify-labs/all-the-functions/-/blob/master/functions/9-using-middleware') + expect(() => parseRepoURL('GitLab', { path: url.pathname })).toThrowError('Unsupported host GitLab') + }) }) diff --git a/tests/unit/utils/telemetry/validation.test.mjs b/tests/unit/utils/telemetry/validation.test.mjs index 8dc91b3b700..34c6986bffb 100644 --- a/tests/unit/utils/telemetry/validation.test.mjs +++ b/tests/unit/utils/telemetry/validation.test.mjs @@ -1,71 +1,73 @@ -import test from 'ava' +import { describe, expect, test } from 'vitest' import isValidEventName from '../../../../src/utils/telemetry/validation.mjs' const getEventForProject = (projectName, eventName) => `${projectName}:${eventName}` -test('validate failed with eventName without underscore', (t) => { - const projectName = 'testProject' - const event = 'test' - const config = { - projectName, - objects: ['test'], - } - const result = isValidEventName(getEventForProject(projectName, event), config) - t.is(result, false) -}) +describe('isValidEventName', () => { + test('validate failed with eventName without underscore', () => { + const projectName = 'testProject' + const event = 'test' + const config = { + projectName, + objects: ['test'], + } + const result = isValidEventName(getEventForProject(projectName, event), config) + expect(result).toBe(false) + }) -test('validate failed with eventName without colon', (t) => { - const projectName = 'testProject' - const event = 'test_eventName' - const config = { - projectName, - objects: ['test'], - } - const result = isValidEventName(`${projectName}${event}`, config) - t.is(result, false) -}) + test('validate failed with eventName without colon', () => { + const projectName = 'testProject' + const event = 'test_eventName' + const config = { + projectName, + objects: ['test'], + } + const result = isValidEventName(`${projectName}${event}`, config) + expect(result).toBe(false) + }) -test('validate pass with eventName with only underscore', (t) => { - const projectName = 'testProject' - const event = 'test_name' - const config = { - projectName, - objects: ['test'], - } - const result = isValidEventName(getEventForProject(projectName, event), config) - t.is(result, true) -}) + test('validate pass with eventName with only underscore', () => { + const projectName = 'testProject' + const event = 'test_name' + const config = { + projectName, + objects: ['test'], + } + const result = isValidEventName(getEventForProject(projectName, event), config) + expect(result).toBe(true) + }) -test('validate pass with eventName with underscore and camelCase', (t) => { - const projectName = 'testProject' - const event = 'test_eventName' - const config = { - projectName, - objects: ['test'], - } - const result = isValidEventName(getEventForProject(projectName, event), config) - t.is(result, true) -}) + test('validate pass with eventName with underscore and camelCase', () => { + const projectName = 'testProject' + const event = 'test_eventName' + const config = { + projectName, + objects: ['test'], + } + const result = isValidEventName(getEventForProject(projectName, event), config) + expect(result).toBe(true) + }) -test('project in event should be pass in config', (t) => { - const projectName = 'anotherProjectName' - const event = 'test_eventName' - const config = { - projectName: 'projectName', - objects: ['test'], - } - const result = isValidEventName(getEventForProject(projectName, event), config) - t.is(result, false) -}) + test('project in event should be pass in config', () => { + const projectName = 'anotherProjectName' + const event = 'test_eventName' + const config = { + projectName: 'projectName', + objects: ['test'], + } + const result = isValidEventName(getEventForProject(projectName, event), config) + expect(result).toBe(false) + }) -test('object in event should be pass in config.objects', (t) => { - const projectName = 'testProject' - const event = 'event_eventName' - const config = { - projectName, - objects: ['test'], - } - const result = isValidEventName(getEventForProject(projectName, event), config) - t.is(result, false) + test('object in event should be pass in config.objects', () => { + const projectName = 'testProject' + const event = 'event_eventName' + const config = { + projectName, + objects: ['test'], + } + const result = isValidEventName(getEventForProject(projectName, event), config) + expect(result).toBe(false) + }) }) diff --git a/vitest.config.mjs b/vitest.config.mjs new file mode 100644 index 00000000000..753abe4584d --- /dev/null +++ b/vitest.config.mjs @@ -0,0 +1,17 @@ +/// +import { defineConfig } from 'vite' + +export default defineConfig({ + test: { + include: ['tests/unit/**/*.test.mjs'], + testTimeout: 30_000, + deps: { + external: ['**/fixtures/**', '**/node_modules/**'], + interopDefault: false, + }, + coverage: { + provider: 'c8', + reporter: ['text', 'lcov'], + }, + }, +}) From 4fdb2ec982facaa728350cf9b8fb9c8b33f5e021 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Mon, 28 Nov 2022 16:46:50 +0100 Subject: [PATCH 2/6] chore: shard vitest and allow integration tests with vitest --- .github/workflows/main.yml | 97 + package.json | 4 +- tests/integration/530.graph-codegen.test.mjs | 10 +- .../530.graph-codegen.test.mjs.snap | 7246 ++++++++++++++++ .../snapshots/530.graph-codegen.test.mjs.md | 7262 ----------------- .../snapshots/530.graph-codegen.test.mjs.snap | Bin 29336 -> 0 bytes tools/affected-test.mjs | 4 +- vitest.config.mjs | 2 +- 8 files changed, 7353 insertions(+), 7272 deletions(-) create mode 100644 tests/integration/__snapshots__/530.graph-codegen.test.mjs.snap delete mode 100644 tests/integration/snapshots/530.graph-codegen.test.mjs.md delete mode 100644 tests/integration/snapshots/530.graph-codegen.test.mjs.snap diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0008b329a8a..1aa7c39fc83 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,6 +48,103 @@ jobs: - name: Run vitest unit tests run: npm run test:ci:vitest:unit if: '${{!steps.release-check.outputs.IS_RELEASE}}' + vitest: + runs-on: ${{ matrix.os }} + timeout-minutes: 15 + strategy: + matrix: + os: [ubuntu-latest, macOS-latest, windows-latest] + node-version: [14.x, '*'] + shard: ['1/2', '2/2'] + + exclude: + - os: macOS-latest + node-version: '14.x' + - os: windows-latest + node-version: '14.x' + fail-fast: false + steps: + # Sets an output parameter if this is a release PR + - name: Check for release + id: release-check + # For windows we have to use $env: + run: |- + echo "IS_RELEASE=true" >> $GITHUB_OUTPUT + echo "IS_RELEASE=true" >> $env:GITHUB_OUTPUT + if: "${{ startsWith(github.head_ref, 'release-') }}" + # This improves Windows network performance, we need this since we open many ports in our tests + - name: Increase Windows port limit and reduce time wait delay + run: | + netsh int ipv4 set dynamicport tcp start=1025 num=64511 + REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters /v TcpTimedWaitDelay /t REG_DWORD /d 30 /f + if: "${{ matrix.os == 'windows-latest' && !steps.release-check.outputs.IS_RELEASE }}" + - name: Git checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: 'npm-shrinkwrap.json' + check-latest: true + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Setup Deno + uses: denoland/setup-deno@v1 + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + with: + deno-version: v1.x + - name: Install core dependencies + run: npm ci --no-audit + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Determine which tests to run + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' + uses: haya14busa/action-cond@v1 + id: changed + with: + cond: ${{ github.event_name == 'pull_request' }} + if_true: '--changed=${{ github.event.pull_request.base.sha }}' # on pull requests test with the project graph only the affected tests + if_false: '' # on the base branch run all the tests as security measure + - name: Generate self-signed certificates + run: npm run certs + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + shell: bash + - name: Prepare tests + run: npm run test:init + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' + - name: Tests + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' + run: npm run test:ci:vitest:integration -- --shard=${{ matrix.shard }} ${{ steps.changed.outputs.value }} + env: + # GitHub secrets are not available when running on PR from forks + # We set a flag so we can skip tests that access Netlify API + NETLIFY_TEST_DISABLE_LIVE: + ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }} + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + # NETLIFY_TEST_GITHUB_TOKEN is used to avoid reaching GitHub API limits in exec-fetcher.js + NETLIFY_TEST_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Changes the polling interval used by the file watcher + CHOKIDAR_INTERVAL: 20 + CHOKIDAR_USEPOLLING: 1 + - name: Get test coverage flags + id: test-coverage-flags + # For windows we have to use $env: + run: |- + os=${{ matrix.os }} + node=$(node --version) + echo "os=${os/-latest/}" >> $GITHUB_OUTPUT + echo "os=${os/-latest/}" >> $env:GITHUB_OUTPUT + echo "node=node_${node/.*.*/}" >> $GITHUB_OUTPUT + echo "node=node_${node/.*.*/}" >> $env:GITHUB_OUTPUT + shell: bash + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' + - uses: codecov/codecov-action@v3 + continue-on-error: true + with: + flags: ${{ steps.test-coverage-flags.outputs.os }},${{ steps.test-coverage-flags.outputs.node }} + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' test: runs-on: ${{ matrix.os }} timeout-minutes: 30 diff --git a/package.json b/package.json index 334ca7e288c..3376b31c52c 100644 --- a/package.json +++ b/package.json @@ -215,6 +215,7 @@ "test:ci:ava:unit": "c8 -r json ava --no-worker-threads tests/unit/ tools/", "test:ci:ava:integration": "c8 -r json ava --concurrency 1 --no-worker-threads tests/integration/", "test:ci:vitest:unit": "vitest run --coverage tests/unit/", + "test:ci:vitest:integration": "vitest run --coverage --no-threads tests/integration/", "test:affected": "node ./tools/affected-test.mjs", "e2e": "node ./tools/e2e/run.mjs", "docs": "node ./site/scripts/docs.mjs", @@ -368,8 +369,7 @@ "ava": { "files": [ "tools/**/*.test.mjs", - "tests/integration/**/*.test.+(c|m)js", - "tests/unit/**/*.test.cjs" + "tests/**/*.test.cjs" ], "cache": true, "concurrency": 5, diff --git a/tests/integration/530.graph-codegen.test.mjs b/tests/integration/530.graph-codegen.test.mjs index 9f369ee7194..a924fc753ce 100644 --- a/tests/integration/530.graph-codegen.test.mjs +++ b/tests/integration/530.graph-codegen.test.mjs @@ -6,9 +6,9 @@ import path, { dirname } from 'path' import process from 'process' import { fileURLToPath } from 'url' -import test from 'ava' import { CodegenHelpers, GraphQL, IncludedCodegen, NetlifyGraph } from 'netlify-onegraph-internal' import { registerConsole } from 'netlify-onegraph-internal/dist/internalConsole.js' +import { expect, test } from 'vitest' import { generateHandlerSourceByOperationId, @@ -206,8 +206,8 @@ const testGenerateRuntime = async ({ codegenModule }) => { generatedRuntime.forEach((runtimeFile) => { const filepath = runtimeFile.name.map((step) => step.replace(':', '___')).join('/') // @ts-ignore - test(`netlify graph function library runtime codegen library [${codegenModule.id}-${codegenModule.version}]:./${filepath}}`, (t) => { - t.snapshot(runtimeFile.content) + test(`netlify graph function library runtime codegen library [${codegenModule.id}-${codegenModule.version}]:./${filepath}}`, () => { + expect(runtimeFile.content).toMatchSnapshot() }) }) } @@ -254,8 +254,8 @@ const testGenerateHandlerSource = ({ builtInCodegenId, codegenModule, operationI textualSources.forEach(([filename, content]) => { // @ts-ignore - test(`netlify graph handler codegen [${codegen.id}-${codegen.version}]:/${filename}`, (t) => { - t.snapshot(normalize(JSON.stringify(content))) + test(`netlify graph handler codegen [${codegen.id}-${codegen.version}]:/${filename}`, () => { + expect(normalize(JSON.stringify(content))).toMatchSnapshot() }) }) } diff --git a/tests/integration/__snapshots__/530.graph-codegen.test.mjs.snap b/tests/integration/__snapshots__/530.graph-codegen.test.mjs.snap new file mode 100644 index 00000000000..d9766e4eae1 --- /dev/null +++ b/tests/integration/__snapshots__/530.graph-codegen.test.mjs.snap @@ -0,0 +1,7246 @@ +// Vitest Snapshot v1 + +exports[`netlify graph function library runtime codegen library [netlify-builtin:nextjs-0.0.1]:./dummy/index.d.ts} 1`] = ` +"/* eslint-disable */ + // @ts-nocheck + // GENERATED VIA NETLIFY AUTOMATED DEV TOOLS, EDIT WITH CAUTION! + + export type NetlifyGraphFunctionOptions = { + /** + * The accessToken to use for the request + */ + accessToken?: string; + /** + * The siteId to use for the request + * @default process.env.SITE_ID + */ + siteId?: string; + } + + export type WebhookEvent = { + body: string; + headers: Record; + }; + + export type GraphQLError = { + \\"path\\": Array; + \\"message\\": string; + \\"extensions\\": Record; + }; + + /** + * Subset of LoggedInServices + */ + export type LoggedInServicesFragment = { + friendlyServiceName: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + isLoggedIn: boolean; + usedTestFlow: boolean; + serviceInfo: { + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + availableScopes?: Array<{ + category?: string; + scope: string; + display: string; + isDefault: boolean; + isRequired: boolean; + description: string; + title?: string; +}>; +}; + /** + * The scopes that the user granted for this service. This is a best estimate of the scopes that were granted. Most services do not have a way to query the scopes on an auth, and some services do not return information about the scopes that were granted in the auth flow. + */ +grantedScopes?: Array<{ + /** + * The name of the scope that the underlying service uses. + */ +scope: string; +}>; + foreignUserId?: string; +}; + + +/** + * Basic info on a Service Auth + */ + export type ServiceAuthFragment = { + /** + * id for the service auth + */ +id: string; + /** + * The service that the clientId and clientSecret belong to, e.g. \\"gmail\\" + */ +service: string; + /** + * clientId for the serviceAuth. + */ +clientId: string; + /** + * If true, the bearer token that is created fetchable by the user whose account the token grants access to. + */ +revealTokens: boolean; + /** + * Optional scopes to use for the OAuth flow. + */ +scopes?: Array; +}; + + +/** + * Allowed CORS origins for calls to a site's Graph. + */ + export type AppCORSOriginFragment = { + /** + * The id of the OneGraph App + */ +id: string; + /** + * The origins allowed for this OneGraph App from CORS requests + */ +corsOrigins: Array; + /** + * Custom cors origins + */ +customCorsOrigins: Array<{ + /** + * The friendly service name for the cors origin + */ +friendlyServiceName: string; + /** + * The name of the origin that should be displayed, e.g. oneblog for oneblog.netlify.app. + */ +displayName: string; + /** + * The encoded value as a string, used to remove the custom cors origin. + */ +encodedValue: string; +}>; + /** + * Sites on Netlify associated with this app. OneGraph will allow CORS and authentication redirects to all previews, branch, and production deploys of these sites. + */ +netlifySiteNames: Array; +}; + + + export type UpdateCLISessionMetadataMutationInput = { + \\"nfToken\\": string; + /** + * The id of the session + */ + \\"sessionId\\": string; + /** + * Optional metadata for the session + */ + \\"metadata\\": unknown +}; + + export type UpdateCLISessionMetadataMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Update a CLI session. + */ +updateNetlifyCliSession: { + /** + * The session that was updated. + */ +session: { + id: string; + name?: string; + metadata?: unknown; + createdAt: string; + lastEventAt?: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`). + */ + export function executeUpdateCLISessionMetadataMutation ( + variables: UpdateCLISessionMetadataMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type AppSchemaQueryInput = { + \\"nfToken\\": string; + /** + * App id + */ + \\"appId\\": string +}; + + export type AppSchemaQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + app: { + /** + * Customizations to the default GraphQL schema + */ +graphQLSchema?: { + appId: string; + createdAt: string; + id: string; + services: Array<{ + friendlyServiceName: string; + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + /** + * Service string that can be provided in the URL when going through the oauth flow. + */ +slug: string; + supportsCustomRedirectUri: boolean; + supportsCustomServiceAuth: boolean; + supportsOauthLogin: boolean; +}>; + updatedAt: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Get the _metadata_ about a site's current GraphQL schema: +* +* - enabled services +* - schema id +* - creation date +* +* etc. + */ + export function fetchAppSchemaQuery( + variables: AppSchemaQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type DestroyTokenMutationInput = { + \\"nfToken\\": string; + /** + * Any OneGraph access token, refresh token, or JWT + */ + \\"token\\"?: string; + /** + * An Authlify Token identifier + */ + \\"authlifyTokenId\\"?: string +}; + + export type DestroyTokenMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Revokes a OneGraph access token, refresh token, or JWT. After a token is destroyed, it can no longer be used to authenticate with OneGraph. + +If you destroy a JWT, external services that rely on the claims embedded in the JWT may still accept the JWT and you will also have to revoke the JWT though the external service's revocation process. + */ +destroyToken: boolean; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Delete a OneGraph personal token for a user's site + */ + export function executeDestroyTokenMutation ( + variables: DestroyTokenMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type SignOutServicesMutationInput = { + \\"services\\": Array<\\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\">; +\\"nfToken\\": string; +\\"authlifyTokenId\\": string +}; + + export type SignOutServicesMutation = { + /** + * Any data from the function will be returned here + */ +data: { + signoutServices: { + me: { + /** + * Metadata and logged-in state for all OneGraph services + */ +serviceMetadata: { + loggedInServices: Array; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Sign out of a service associated with a Authlify token + */ + export function executeSignOutServicesMutation ( + variables: SignOutServicesMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type AddAuthsMutationInput = { + \\"siteId\\": string; +\\"authlifyTokenId\\"?: string; + /** + * Token that will be destroyed and have its auths moved to the personal token. + */ + \\"sToken\\": string; +\\"nfToken\\": string +}; + + export type AddAuthsMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + addAuthsToPersonalToken: { + /** + * Personal access token that was updated by this mutation + */ +accessToken: { + /** + * Netlify-specific ID for the token + */ +netlifyId?: string; + /** + * Bearer token + */ +token: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Update a service's (i.e. GitHub) enabled scope permissions + */ + export function executeAddAuthsMutation ( + variables: AddAuthsMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CreateNewSchemaMutationInput = { + \\"nfToken\\": string; +\\"input\\": {/** + * Whether to set this schema as the default for the app. Defaults to false. + */ + \\"setAsDefaultForApp\\"?: boolean; /** + * External GraphQL schemas to add + */ + \\"externalGraphQLSchemas\\"?: Array<{/** + * The id of the external GraphQL schema. + */ + \\"externalGraphQLSchemaId\\": string}>; /** + * Optional id of a Salesforce schema to attach to the app. + */ + \\"salesforceSchemaId\\"?: string; /** + * The optional id of the GraphQL schema that this was derived from. + */ + \\"parentId\\"?: string; /** + * The list of services that this schema should use. Leave blank if you want to add support for all supported services. + */ + \\"enabledServices\\"?: Array<\\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\">; /** + * The id of the app that the schema should belong to. + */ + \\"appId\\": string} +}; + + export type CreateNewSchemaMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + createGraphQLSchema: { + app: { + /** + * Customizations to the default GraphQL schema + */ +graphQLSchema?: { + id: string; +}; +}; + graphqlSchema: { + id: string; + services: Array<{ + friendlyServiceName: string; + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + /** + * Service string that can be provided in the URL when going through the oauth flow. + */ +slug: string; + supportsCustomRedirectUri: boolean; + supportsCustomServiceAuth: boolean; + supportsOauthLogin: boolean; +}>; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use. + */ + export function executeCreateNewSchemaMutation ( + variables: CreateNewSchemaMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type DeleteServiceAuthMutationInput = { + \\"siteId\\": string; +\\"serviceAuthId\\": string; +\\"nfToken\\": string +}; + + export type DeleteServiceAuthMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + destroyServiceAuth: { + app: { + /** + * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app + */ +serviceAuths: Array; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Delete a custom service auth + */ + export function executeDeleteServiceAuthMutation ( + variables: DeleteServiceAuthMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CreatePersistedQueryMutationInput = { + \\"nfToken\\": string; +\\"appId\\": string; +\\"query\\": string; + /** + * List of tags to add to the persisted query. Tags are free-form text that can be used to categorize persisted queries. Each tag must be under 256 characters and there can be a maximum of 10 tags on a single persisted query. + */ + \\"tags\\": Array; + /** + * A description for the persisted query. Maximum length is 2096 characters. + */ + \\"description\\": string; + /** + * The parent persisted query. It can be used to track lineage of the query. + */ + \\"parent\\"?: {/** + * An optional list of tags to remove from the parent query. If any of the provided tags aren't present on the parent, the mutation will fail. No persisted queries will be created and no tags will be removed from the parent. + */ + \\"removeTags\\"?: Array; /** + * The id of the parent + */ + \\"id\\": string} +}; + + export type CreatePersistedQueryMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + createPersistedQuery: { + persistedQuery: { + /** + * The persisted query's id. + */ +id: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution. + */ + export function executeCreatePersistedQueryMutation ( + variables: CreatePersistedQueryMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type FindLoggedInServicesQueryInput = { + \\"nfToken\\": string; +\\"authlifyTokenId\\": string +}; + + export type FindLoggedInServicesQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + authlifyToken: { + /** + * Metadata and logged-in state for all OneGraph services + */ +serviceMetadata: { + loggedInServices: Array; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site + */ + export function fetchFindLoggedInServicesQuery( + variables: FindLoggedInServicesQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type SetServiceAuthMutationInput = { + \\"service\\": \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\"; +\\"clientId\\": string; +\\"clientSecret\\": string; +\\"siteId\\": string; +\\"nfToken\\": string +}; + + export type SetServiceAuthMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + createServiceAuth: { + app: { + /** + * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app + */ +serviceAuths: Array; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Create a custom service auth + */ + export function executeSetServiceAuthMutation ( + variables: SetServiceAuthMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CreateCLISessionEventMutationInput = { + \\"nfToken\\": string; +\\"sessionId\\": string; +\\"payload\\": unknown +}; + + export type CreateCLISessionEventMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + createNetlifyCliTestEvent: { + event: { + id: string; + createdAt: string; + sessionId: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Create a new session for the Netlify CLI to communicate with the React UI via events. + */ + export function executeCreateCLISessionEventMutation ( + variables: CreateCLISessionEventMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CliSessionByIdQueryInput = { + \\"nfToken\\": string; +\\"id\\": string +}; + + export type CliSessionByIdQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Get a Netlify CLI session by its id. + */ +netlifyCliSession: { + id: string; + name?: string; + netlifyUserId: string; + events: Array<{ + createdAt: string; +}>; + createdAt: string; + lastEventAt?: string; + metadata?: unknown; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Get a Netlify CLI session by its id + */ + export function fetchCliSessionByIdQuery( + variables: CliSessionByIdQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + + + export type Deprecated_FindLoggedInServicesQuery = { + /** + * Any data from the function will be returned here + */ +data: { + me: { + /** + * Metadata and logged-in state for all OneGraph services + */ +serviceMetadata: { + loggedInServices: Array; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * (Deprecated) Find logged in services + */ + export function fetchDeprecated_FindLoggedInServicesQuery( + /** + * Pass \`{}\` as no variables are defined for this function. + */ + variables: Record, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CreateEmptyPersonalTokenMutationInput = { + \\"nfToken\\": string; +\\"siteId\\": string +}; + + export type CreateEmptyPersonalTokenMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Creates an empty personal token with a Netlify site anchor + */ +createPersonalTokenWithNetlifySiteAnchor: { + /** + * Personal access token that was created by this mutation + */ +accessToken: { + /** + * Bearer token + */ +token: string; + /** + * Token name, if it is a personal access token + */ +name?: string; + /** + * The anchor is like two-factor auth for the token. It ensures that the person who adds auth to the token is the same as the person who created the token. + */ +anchor?: \\"ONEGRAPH_USER\\" | \\"NETLIFY_USER\\" | \\"NETLIFY_SITE\\"; + /** + * Netlify-specific ID for the token + */ +netlifyId?: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Create a new OneGraph personal token for a user's site + */ + export function executeCreateEmptyPersonalTokenMutation ( + variables: CreateEmptyPersonalTokenMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type ServiceListQueryInput = { + \\"logoStyle\\"?: \\"DEFAULT\\" | \\"ROUNDED_RECTANGLE\\" +}; + + export type ServiceListQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + services: Array<{ + friendlyServiceName: string; + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + /** + * Service string that can be provided in the URL when going through the oauth flow. + */ +slug: string; + supportsCustomRedirectUri: boolean; + supportsCustomServiceAuth: boolean; + supportsOauthLogin: boolean; +}>; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Retrieve a list of _all_ supported services from OneGraph + */ + export function fetchServiceListQuery( + variables: ServiceListQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type AuthlifyTokenIdForPersonalTokenInput = { + \\"personalToken\\": string +}; + + export type AuthlifyTokenIdForPersonalToken = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Personal access token lookup + */ +personalToken?: { + /** + * Netlify-specific ID for the token + */ +netlifyId?: string; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * + */ + export function fetchAuthlifyTokenIdForPersonalToken( + variables: AuthlifyTokenIdForPersonalTokenInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type PersistedQueryQueryInput = { + \\"nfToken\\": string; + /** + * The id of the app that the persisted query belongs to. + */ + \\"appId\\": string; + /** + * The id of the persisted query. + */ + \\"id\\": string +}; + + export type PersistedQueryQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Fetch a single persisted query by its id. + */ +persistedQuery: { + /** + * The persisted query's id. + */ +id: string; + /** + * The persisted query's query string. + */ +query: string; + /** + * The list of operation names that the caller of the query is allowed to execute. If the field is null, then all operationNames are allowed. + */ +allowedOperationNames?: Array; + /** + * The user-defined description that was added to the query + */ +description?: string; + /** + * The list of variables that the caller of the query is allowed to provide. + */ +freeVariables?: Array; + /** + * The default variables provided to the query. + */ +fixedVariables?: unknown; + /** + * The list of user-defined tags that were added to the query + */ +tags?: Array; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Retrieve a previously persisted operations doc + */ + export function fetchPersistedQueryQuery( + variables: PersistedQueryQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CliSessionsByAppIdQueryInput = { + \\"nfToken\\": string; +\\"appId\\": string +}; + + export type CliSessionsByAppIdQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Netlify CLI sessions, orderd by createdAt descending. + */ +netlifyCliSessionsByAppId: Array<{ + id: string; + name?: string; + netlifyUserId: string; + events: Array<{ + createdAt: string; +}>; + createdAt: string; + lastEventAt?: string; + metadata?: unknown; +}>; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * List all the CLI sessions belonging to a site + */ + export function fetchCliSessionsByAppIdQuery( + variables: CliSessionsByAppIdQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type ListServicesQueryInput = { + \\"nfToken\\": string; + /** + * App id + */ + \\"siteId\\": string; +\\"logoStyle\\"?: \\"DEFAULT\\" | \\"ROUNDED_RECTANGLE\\" +}; + + export type ListServicesQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + services: Array<{ + friendlyServiceName: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + /** + * Service string that can be provided in the URL when going through the oauth flow. + */ +slug: string; + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + availableScopes?: Array<{ + category?: string; + scope: string; + display: string; + isDefault: boolean; + isRequired: boolean; + description: string; + title?: string; +}>; +}>; + app: { + /** + * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app + */ +serviceAuths: Array; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site. + */ + export function fetchListServicesQuery( + variables: ListServicesQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type UpsertAppForSiteMutationInput = { + \\"nfToken\\": string; +\\"siteId\\": string +}; + + export type UpsertAppForSiteMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + upsertAppForNetlifySite: { + /** + * The app that is associated with the Netlify account. + */ +org: { + /** + * The id of the OneGraph Org + */ +id: string; + /** + * The name of the OneGraph Org + */ +name: string; +}; + /** + * The app that is associated with the Netlify site. + */ +app: { + /** + * The id of the OneGraph App + */ +id: string; + /** + * The name of the OneGraph App + */ +name: string; + /** + * The origins allowed for this OneGraph App from CORS requests + */ +corsOrigins: Array; + /** + * Custom cors origins + */ +customCorsOrigins: Array<{ + /** + * The friendly service name for the cors origin + */ +friendlyServiceName: string; + /** + * The name of the origin that should be displayed, e.g. oneblog for oneblog.netlify.app. + */ +displayName: string; + /** + * The encoded value as a string, used to remove the custom cors origin. + */ +encodedValue: string; +}>; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Ensure that an app resource exists on the OneGraph servers for a given site. + */ + export function executeUpsertAppForSiteMutation ( + variables: UpsertAppForSiteMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type AddCORSOriginMutationInput = { + \\"nfToken\\": string; +\\"input\\": {\\"corsOrigin\\": string; \\"appId\\": string} +}; + + export type AddCORSOriginMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + addCORSOriginToApp: { + app: AppCORSOriginFragment ; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Add additional allowed CORS origins for calls to a site's Graph. + */ + export function executeAddCORSOriginMutation ( + variables: AddCORSOriginMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type RemoveCORSOriginMutationInput = { + \\"nfToken\\": string; +\\"input\\": {\\"corsOrigin\\": string; \\"appId\\": string} +}; + + export type RemoveCORSOriginMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + removeCORSOriginFromApp: { + app: AppCORSOriginFragment ; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Remove the given CORS origins for calls to a site's Graph. + */ + export function executeRemoveCORSOriginMutation ( + variables: RemoveCORSOriginMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CORSOriginsQueryInput = { + /** + * App id + */ + \\"siteId\\": string; +\\"nfToken\\": string +}; + + export type CORSOriginsQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + app: AppCORSOriginFragment ; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * List the allowed CORS origins for calls to a site's Graph. + */ + export function fetchCORSOriginsQuery( + variables: CORSOriginsQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +/** + * A subscription with variables and a fragment to test code generation. + */ + export function subscribeToTestSubscription( + /** + * This will be available in your webhook handler as a query parameter. + * Use this to keep track of which subscription you're receiving + * events for. + */ + variables: { + /** + * How many minutes to wait before re-running the underlying query + */ + \\"minutes\\"?: number +}, + options?: { + /** + * The accessToken to use for the lifetime of the subscription. + */ + accessToken?: string | null | undefined; + /** + * A string id that will be passed to your webhook handler as a query parameter + * along with each event. + * This can be used to keep track of which subscription you're receiving + */ + netlifyGraphWebhookId?: string | null | undefined; + /** + * The absolute URL of your webhook handler to handle events from this subscription. + */ + webhookUrl?: string | null | undefined; + /** + * The secret to use when signing the webhook request. Use this to verify + * that the webhook payload is coming from Netlify Graph. Defaults to the + * value of the NETLIFY_GRAPH_WEBHOOK_SECRET environment variable. + */ + webhookSecret?: string | null | undefined; + }) : void + + export type TestSubscriptionEvent = { + /** + * Any data from the function will be returned here + */ +data: { + poll: { + query: { + me: { + /** + * Metadata and logged-in state for all OneGraph services + */ +serviceMetadata: { + loggedInServices: Array>; +}; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +} + + /** + * Verify the TestSubscription event body is signed securely, and then parse the result. + */ + export function parseAndVerifyTestSubscriptionEvent (/** A Netlify Handler Event */ event : WebhookEvent) : null | TestSubscriptionEvent + + + export interface Functions { + /** + * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`). + */ + executeUpdateCLISessionMetadataMutation : typeof executeUpdateCLISessionMetadataMutation , + /** + * Get the _metadata_ about a site's current GraphQL schema: +* +* - enabled services +* - schema id +* - creation date +* +* etc. + */ + fetchAppSchemaQuery: typeof fetchAppSchemaQuery, + /** + * Delete a OneGraph personal token for a user's site + */ + executeDestroyTokenMutation : typeof executeDestroyTokenMutation , + /** + * Sign out of a service associated with a Authlify token + */ + executeSignOutServicesMutation : typeof executeSignOutServicesMutation , + /** + * Update a service's (i.e. GitHub) enabled scope permissions + */ + executeAddAuthsMutation : typeof executeAddAuthsMutation , + /** + * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use. + */ + executeCreateNewSchemaMutation : typeof executeCreateNewSchemaMutation , + /** + * Delete a custom service auth + */ + executeDeleteServiceAuthMutation : typeof executeDeleteServiceAuthMutation , + /** + * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution. + */ + executeCreatePersistedQueryMutation : typeof executeCreatePersistedQueryMutation , + /** + * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site + */ + fetchFindLoggedInServicesQuery: typeof fetchFindLoggedInServicesQuery, + /** + * Create a custom service auth + */ + executeSetServiceAuthMutation : typeof executeSetServiceAuthMutation , + /** + * Create a new session for the Netlify CLI to communicate with the React UI via events. + */ + executeCreateCLISessionEventMutation : typeof executeCreateCLISessionEventMutation , + /** + * Get a Netlify CLI session by its id + */ + fetchCliSessionByIdQuery: typeof fetchCliSessionByIdQuery, + /** + * (Deprecated) Find logged in services + */ + fetchDeprecated_FindLoggedInServicesQuery: typeof fetchDeprecated_FindLoggedInServicesQuery, + /** + * Create a new OneGraph personal token for a user's site + */ + executeCreateEmptyPersonalTokenMutation : typeof executeCreateEmptyPersonalTokenMutation , + /** + * Retrieve a list of _all_ supported services from OneGraph + */ + fetchServiceListQuery: typeof fetchServiceListQuery, + /** + * + */ + fetchAuthlifyTokenIdForPersonalToken: typeof fetchAuthlifyTokenIdForPersonalToken, + /** + * Retrieve a previously persisted operations doc + */ + fetchPersistedQueryQuery: typeof fetchPersistedQueryQuery, + /** + * List all the CLI sessions belonging to a site + */ + fetchCliSessionsByAppIdQuery: typeof fetchCliSessionsByAppIdQuery, + /** + * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site. + */ + fetchListServicesQuery: typeof fetchListServicesQuery, + /** + * Ensure that an app resource exists on the OneGraph servers for a given site. + */ + executeUpsertAppForSiteMutation : typeof executeUpsertAppForSiteMutation , + /** + * Add additional allowed CORS origins for calls to a site's Graph. + */ + executeAddCORSOriginMutation : typeof executeAddCORSOriginMutation , + /** + * Remove the given CORS origins for calls to a site's Graph. + */ + executeRemoveCORSOriginMutation : typeof executeRemoveCORSOriginMutation , + /** + * List the allowed CORS origins for calls to a site's Graph. + */ + fetchCORSOriginsQuery: typeof fetchCORSOriginsQuery, + /** + * A subscription with variables and a fragment to test code generation. + */ + subscribeToTestSubscription:subscribeToTestSubscription, + /** + * Verify the event body is signed securely, and then parse the result. + */ + parseAndVerifyTestSubscriptionEvent: typeof parseAndVerifyTestSubscriptionEvent + } + + export const functions: Functions; + + export default functions; + " +`; + +exports[`netlify graph function library runtime codegen library [netlify-builtin:nextjs-0.0.1]:./dummy/index.js} 1`] = ` +"/* eslint-disable */ + // @ts-nocheck + // GENERATED VIA NETLIFY AUTOMATED DEV TOOLS, EDIT WITH CAUTION! + + // Basic LRU cache implementation + const makeLRUCache = (max) => { + return { max: max, cache: new Map() }; + }; + + const oldestCacheKey = (lru) => { + return lru.keys().next().value + } + + // Depend on Map keeping track of insertion order + const getFromCache = (lru, key) => { + const item = lru.cache.get(key); + if (item) { + // Delete key and re-insert so key is now at the end, + // and now the last to be gc'd. + lru.cache.delete(key); + lru.cache.set(key, item); + } + return item; + }; + + const setInCache = (lru, key, value) => { + if (lru.cache.has(key)) { + lru.cache.delete(key); + } + if (lru.cache.size == lru.max) { + const cacheKey = oldestCacheKey(lru); + + if (cacheKey) { + lru.cache.delete(cacheKey); + } + } + + lru.cache.set(key, value); + }; + + // Cache the results of the Netlify Graph API for conditional requests + const cache = makeLRUCache(100); + + const calculateCacheKey = (payload) => { + return JSON.stringify(payload); + }; + + const schemaId = 'stable-schema-id'; + + const netlifyGraphHostWithProtocol = + process.env.NETLIFY_GRAPH_HOST_WITH_PROTOCOL || 'https://graph.netlify.com'; + + const makeNetlifyGraphUrl = ({ operationName, siteId }) => { + return ( + netlifyGraphHostWithProtocol + + '/graphql?app_id=' + + siteId + + '&operationName=' + + operationName + + '&schema_id=' + + schemaId + ); + }; + + const httpFetch = (operationName, options) => { + const reqBody = options.body || null; + const userHeaders = options.headers || {}; + const headers = { + ...userHeaders, + 'Content-Type': 'application/json', + }; + + const timeoutMs = 30_000; + + const reqOptions = { + method: 'POST', + headers: headers, + timeout: timeoutMs, + body: reqBody, + }; + + const siteId = options.siteId || process.env.SITE_ID; + const netlifyGraphUrl = makeNetlifyGraphUrl({ operationName: operationName, siteId: siteId }); + + return fetch(netlifyGraphUrl, reqOptions).then((body) => { + return body.text().then((bodyString) => { + const headers = {}; + body.headers.forEach((k, v) => (headers[k] = v)); + + return { + body: bodyString, + headers: headers, + status: body.status, + }; + }); + }); + }; + + const fetchNetlifyGraph = function fetchNetlifyGraph(input) { + const query = input.query; + const docId = input.doc_id; + const operationName = input.operationName; + const variables = input.variables; + + const options = input.options || {}; + const accessToken = options.accessToken; + + const payload = { + query: query, + doc_id: docId, + variables: variables, + operationName: operationName, + }; + + let cachedOrLiveValue = new Promise((resolve) => { + const cacheKey = calculateCacheKey(payload); + + // Check the cache for a previous result + const cachedResultPair = getFromCache(cache, cacheKey); + + let conditionalHeaders = { + 'If-None-Match': '', + }; + let cachedResultValue; + + if (cachedResultPair) { + const [etag, previousResult] = cachedResultPair; + conditionalHeaders = { + 'If-None-Match': etag, + }; + cachedResultValue = previousResult; + } + + const response = httpFetch(operationName, { + ...options, + method: 'POST', + headers: { + ...conditionalHeaders, + Authorization: accessToken ? 'Bearer ' + accessToken : '', + }, + body: JSON.stringify(payload), + }); + + response.then((result) => { + // Check response headers for a 304 Not Modified + if (result.status === 304) { + // Return the cached result + resolve(cachedResultValue); + } else if (result.status === 200) { + // Update the cache with the new etag and result + const etag = result.headers['etag']; + const resultJson = JSON.parse(result.body); + if (etag) { + // Make a note of the new etag for the given payload + setInCache(cache, cacheKey, [etag, resultJson]); + } + resolve(resultJson); + } else { + return result.json().then((json) => { + resolve(json); + }); + } + }); + }); + + return cachedOrLiveValue; + }; + + export const executeUpdateCLISessionMetadataMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation UpdateCLISessionMetadataMutation($nfToken: String!, $sessionId: String!, $metadata: JSON!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + updateNetlifyCliSession(input: {id: $sessionId, metadata: $metadata}) { + session { + id + name + metadata + createdAt + lastEventAt + } + } + } +}\`, + operationName: \\"UpdateCLISessionMetadataMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchAppSchemaQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query AppSchemaQuery($nfToken: String!, $appId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + app(id: $appId) { + graphQLSchema { + appId + createdAt + id + services { + friendlyServiceName + logoUrl + service + slug + supportsCustomRedirectUri + supportsCustomServiceAuth + supportsOauthLogin + } + updatedAt + } + } + } +}\`, + operationName: \\"AppSchemaQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeDestroyTokenMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation DestroyTokenMutation($nfToken: String!, $token: String, $authlifyTokenId: String) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + destroyToken(token: $token, authlifyTokenId: $authlifyTokenId) + } +}\`, + operationName: \\"DestroyTokenMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeSignOutServicesMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation SignOutServicesMutation($services: [OneGraphServiceEnum!]!, $nfToken: String!, $authlifyTokenId: String!) { + signoutServices( + data: {services: $services, anchorAuth: {netlifyAuth: {oauthToken: $nfToken}}, authlifyTokenId: $authlifyTokenId} + ) { + me { + serviceMetadata { + loggedInServices { + ...LoggedInServicesFragment + } + } + } + } +} + +fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: \\"\\"\\"12b5bdea-9bab-4124-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Subset of LoggedInServices\\"\\"\\") { + friendlyServiceName + service + isLoggedIn + usedTestFlow + serviceInfo { + logoUrl + availableScopes { + category + scope + display + isDefault + isRequired + description + title + } + } + grantedScopes { + scope + } + foreignUserId +}\`, + operationName: \\"SignOutServicesMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeAddAuthsMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation AddAuthsMutation($siteId: String!, $authlifyTokenId: String, $sToken: String!, $nfToken: String!) { + oneGraph { + addAuthsToPersonalToken( + input: {anchorAuth: {netlifyAuth: {oauthToken: $nfToken}}, sacrificialToken: $sToken, authlifyTokenId: $authlifyTokenId, appId: $siteId} + ) { + accessToken { + netlifyId + token + } + } + } +}\`, + operationName: \\"AddAuthsMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeCreateNewSchemaMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation CreateNewSchemaMutation($nfToken: String!, $input: OneGraphCreateGraphQLSchemaInput!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createGraphQLSchema(input: $input) { + app { + graphQLSchema { + id + } + } + graphqlSchema { + id + services { + friendlyServiceName + logoUrl + service + slug + supportsCustomRedirectUri + supportsCustomServiceAuth + supportsOauthLogin + } + } + } + } +}\`, + operationName: \\"CreateNewSchemaMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeDeleteServiceAuthMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation DeleteServiceAuthMutation($siteId: String!, $serviceAuthId: String!, $nfToken: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + destroyServiceAuth(data: {appId: $siteId, serviceAuthId: $serviceAuthId}) { + app { + serviceAuths { + ...ServiceAuthFragment + } + } + } + } +} + +fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: \\"\\"\\"12b5bdea-9bab-4164-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Basic info on a Service Auth\\"\\"\\") { + id + service + clientId + revealTokens + scopes +}\`, + operationName: \\"DeleteServiceAuthMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeCreatePersistedQueryMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation CreatePersistedQueryMutation($nfToken: String!, $appId: String!, $query: String!, $tags: [String!]!, $description: String!, $parent: OneGraphCreatePersistedQueryParentInput) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createPersistedQuery( + input: {query: $query, appId: $appId, tags: $tags, description: $description, parent: $parent} + ) { + persistedQuery { + id + } + } + } +}\`, + operationName: \\"CreatePersistedQueryMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchFindLoggedInServicesQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query FindLoggedInServicesQuery($nfToken: String!, $authlifyTokenId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + authlifyToken(authlifyTokenId: $authlifyTokenId) { + serviceMetadata { + loggedInServices { + usedTestFlow + friendlyServiceName + ...LoggedInServicesFragment + } + } + } + } +} + +fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: \\"\\"\\"12b5bdea-9bab-4124-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Subset of LoggedInServices\\"\\"\\") { + friendlyServiceName + service + isLoggedIn + usedTestFlow + serviceInfo { + logoUrl + availableScopes { + category + scope + display + isDefault + isRequired + description + title + } + } + grantedScopes { + scope + } + foreignUserId +}\`, + operationName: \\"FindLoggedInServicesQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeSetServiceAuthMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation SetServiceAuthMutation($service: OneGraphCustomServiceAuthServiceEnum!, $clientId: String!, $clientSecret: String!, $siteId: String!, $nfToken: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createServiceAuth( + data: {service: $service, clientId: $clientId, clientSecret: $clientSecret, appId: $siteId, revealTokens: true} + ) { + app { + serviceAuths { + ...ServiceAuthFragment + } + } + } + } +} + +fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: \\"\\"\\"12b5bdea-9bab-4164-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Basic info on a Service Auth\\"\\"\\") { + id + service + clientId + revealTokens + scopes +}\`, + operationName: \\"SetServiceAuthMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeCreateCLISessionEventMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation CreateCLISessionEventMutation($nfToken: String!, $sessionId: String!, $payload: JSON!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createNetlifyCliTestEvent( + input: {data: {payload: $payload}, sessionId: $sessionId} + ) { + event { + id + createdAt + sessionId + } + } + } +}\`, + operationName: \\"CreateCLISessionEventMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchCliSessionByIdQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query CliSessionByIdQuery($nfToken: String!, $id: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + netlifyCliSession(id: $id) { + id + name + netlifyUserId + events { + createdAt + } + createdAt + lastEventAt + metadata + } + } +}\`, + operationName: \\"CliSessionByIdQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchDeprecated_FindLoggedInServicesQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query Deprecated_FindLoggedInServicesQuery { + me { + serviceMetadata { + loggedInServices { + ...LoggedInServicesFragment + } + } + } +} + +fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: \\"\\"\\"12b5bdea-9bab-4124-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Subset of LoggedInServices\\"\\"\\") { + friendlyServiceName + service + isLoggedIn + usedTestFlow + serviceInfo { + logoUrl + availableScopes { + category + scope + display + isDefault + isRequired + description + title + } + } + grantedScopes { + scope + } + foreignUserId +}\`, + operationName: \\"Deprecated_FindLoggedInServicesQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeCreateEmptyPersonalTokenMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation CreateEmptyPersonalTokenMutation($nfToken: String!, $siteId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createPersonalTokenWithNetlifySiteAnchor( + input: {name: \\"Netlify AuthManager Token\\", netlifySiteId: $siteId} + ) { + accessToken { + token + name + anchor + netlifyId + } + } + } +}\`, + operationName: \\"CreateEmptyPersonalTokenMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchServiceListQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query ServiceListQuery($logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) { + oneGraph { + services { + friendlyServiceName + logoUrl(style: $logoStyle) + service + slug + supportsCustomRedirectUri + supportsCustomServiceAuth + supportsOauthLogin + } + } +}\`, + operationName: \\"ServiceListQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchAuthlifyTokenIdForPersonalToken = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query AuthlifyTokenIdForPersonalToken($personalToken: String!) { + oneGraph { + personalToken(accessToken: $personalToken) { + netlifyId + } + } +}\`, + operationName: \\"AuthlifyTokenIdForPersonalToken\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchPersistedQueryQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query PersistedQueryQuery($nfToken: String!, $appId: String!, $id: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + persistedQuery(appId: $appId, id: $id) { + id + query + allowedOperationNames + description + freeVariables + fixedVariables + tags + } + } +}\`, + operationName: \\"PersistedQueryQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchCliSessionsByAppIdQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query CliSessionsByAppIdQuery($nfToken: String!, $appId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + netlifyCliSessionsByAppId(appId: $appId, first: 10) { + id + name + netlifyUserId + events { + createdAt + } + createdAt + lastEventAt + metadata + } + } +}\`, + operationName: \\"CliSessionsByAppIdQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchListServicesQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query ListServicesQuery($nfToken: String!, $siteId: String!, $logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + services(filter: {supportsOauthLogin: true}) { + friendlyServiceName + service + slug + logoUrl(style: $logoStyle) + availableScopes { + category + scope + display + isDefault + isRequired + description + title + } + } + app(id: $siteId) { + serviceAuths { + ...ServiceAuthFragment + } + } + } +} + +fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: \\"\\"\\"12b5bdea-9bab-4164-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Basic info on a Service Auth\\"\\"\\") { + id + service + clientId + revealTokens + scopes +}\`, + operationName: \\"ListServicesQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeUpsertAppForSiteMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation UpsertAppForSiteMutation($nfToken: String!, $siteId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + upsertAppForNetlifySite(input: {netlifySiteId: $siteId}) { + org { + id + name + } + app { + id + name + corsOrigins + customCorsOrigins { + friendlyServiceName + displayName + encodedValue + } + } + } + } +}\`, + operationName: \\"UpsertAppForSiteMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeAddCORSOriginMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation AddCORSOriginMutation($nfToken: String!, $input: OneGraphAddCORSOriginToAppInput!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + addCORSOriginToApp(input: $input) { + app { + ...AppCORSOriginFragment + } + } + } +} + +fragment AppCORSOriginFragment on OneGraphApp @netlify(id: \\"\\"\\"e3d4bb8b-2fb5-48d8-b051-db6027224145\\"\\"\\", doc: \\"\\"\\"Allowed CORS origins for calls to a site's Graph.\\"\\"\\") { + id + corsOrigins + customCorsOrigins { + friendlyServiceName + displayName + encodedValue + } + netlifySiteNames +}\`, + operationName: \\"AddCORSOriginMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeRemoveCORSOriginMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation RemoveCORSOriginMutation($nfToken: String!, $input: OneGraphRemoveCORSOriginFromAppInput!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + removeCORSOriginFromApp(input: $input) { + app { + ...AppCORSOriginFragment + } + } + } +} + +fragment AppCORSOriginFragment on OneGraphApp @netlify(id: \\"\\"\\"e3d4bb8b-2fb5-48d8-b051-db6027224145\\"\\"\\", doc: \\"\\"\\"Allowed CORS origins for calls to a site's Graph.\\"\\"\\") { + id + corsOrigins + customCorsOrigins { + friendlyServiceName + displayName + encodedValue + } + netlifySiteNames +}\`, + operationName: \\"RemoveCORSOriginMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchCORSOriginsQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query CORSOriginsQuery($siteId: String!, $nfToken: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + app(id: $siteId) { + ...AppCORSOriginFragment + } + } +} + +fragment AppCORSOriginFragment on OneGraphApp @netlify(id: \\"\\"\\"e3d4bb8b-2fb5-48d8-b051-db6027224145\\"\\"\\", doc: \\"\\"\\"Allowed CORS origins for calls to a site's Graph.\\"\\"\\") { + id + corsOrigins + customCorsOrigins { + friendlyServiceName + displayName + encodedValue + } + netlifySiteNames +}\`, + operationName: \\"CORSOriginsQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +const subscribeToTestSubscription = ( + variables, + rawOptions + ) => { + const options = rawOptions || {}; + const netlifyGraphWebhookId = options.netlifyGraphWebhookId; + const netlifyGraphWebhookUrl = options.webhookUrl || \`\${process.env.DEPLOY_URL}/webhooks/TestSubscription?netlifyGraphWebhookId=\${netlifyGraphWebhookId}\`; + const secret = options.webhookSecret || process.env.NETLIFY_GRAPH_WEBHOOK_SECRET + const fullVariables = {...variables, netlifyGraphWebhookUrl: netlifyGraphWebhookUrl, netlifyGraphWebhookSecret: { hmacSha256Key: secret }} + + const subscriptionOperationDoc = \`subscription TestSubscription($minutes: Int = 1, $netlifyGraphWebhookUrl: String!, $netlifyGraphWebhookSecret: OneGraphSubscriptionSecretInput!) @netlify(id: \\"\\"\\"e3d4bb8b-2fb5-9898-b051-db6027224112\\"\\"\\", doc: \\"\\"\\"A subscription with variables and a fragment to test code generation.\\"\\"\\") { + poll( + schedule: {every: {minutes: $minutes}} + onlyTriggerWhenPayloadChanged: true + webhookUrl: $netlifyGraphWebhookUrl + secret: $netlifyGraphWebhookSecret + ) { + query { + me { + serviceMetadata { + loggedInServices { + ...LoggedInServicesFragment + } + } + } + } + } +}\`; + + fetchNetlifyGraph({ + query: subscriptionOperationDoc, + operationName: \\"TestSubscription\\", + variables: fullVariables, + options: options, + fetchStrategy: \\"POST\\", + }) + } + + const parseAndVerifyTestSubscriptionEvent = (event, options) => { + if (!verifyRequestSignature({ event: event }, options)) { + console.warn(\\"Unable to verify signature for TestSubscription\\") + return null + } + + return JSON.parse(event.body || '{}') + } + + /** + * The generated NetlifyGraph library with your operations + */ + const functions = { + /** + * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`). + */ + executeUpdateCLISessionMetadataMutation : executeUpdateCLISessionMetadataMutation , + /** + * Get the _metadata_ about a site's current GraphQL schema: +* +* - enabled services +* - schema id +* - creation date +* +* etc. + */ + fetchAppSchemaQuery: fetchAppSchemaQuery, + /** + * Delete a OneGraph personal token for a user's site + */ + executeDestroyTokenMutation : executeDestroyTokenMutation , + /** + * Sign out of a service associated with a Authlify token + */ + executeSignOutServicesMutation : executeSignOutServicesMutation , + /** + * Update a service's (i.e. GitHub) enabled scope permissions + */ + executeAddAuthsMutation : executeAddAuthsMutation , + /** + * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use. + */ + executeCreateNewSchemaMutation : executeCreateNewSchemaMutation , + /** + * Delete a custom service auth + */ + executeDeleteServiceAuthMutation : executeDeleteServiceAuthMutation , + /** + * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution. + */ + executeCreatePersistedQueryMutation : executeCreatePersistedQueryMutation , + /** + * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site + */ + fetchFindLoggedInServicesQuery: fetchFindLoggedInServicesQuery, + /** + * Create a custom service auth + */ + executeSetServiceAuthMutation : executeSetServiceAuthMutation , + /** + * Create a new session for the Netlify CLI to communicate with the React UI via events. + */ + executeCreateCLISessionEventMutation : executeCreateCLISessionEventMutation , + /** + * Get a Netlify CLI session by its id + */ + fetchCliSessionByIdQuery: fetchCliSessionByIdQuery, + /** + * (Deprecated) Find logged in services + */ + fetchDeprecated_FindLoggedInServicesQuery: fetchDeprecated_FindLoggedInServicesQuery, + /** + * Create a new OneGraph personal token for a user's site + */ + executeCreateEmptyPersonalTokenMutation : executeCreateEmptyPersonalTokenMutation , + /** + * Retrieve a list of _all_ supported services from OneGraph + */ + fetchServiceListQuery: fetchServiceListQuery, + /** + * + */ + fetchAuthlifyTokenIdForPersonalToken: fetchAuthlifyTokenIdForPersonalToken, + /** + * Retrieve a previously persisted operations doc + */ + fetchPersistedQueryQuery: fetchPersistedQueryQuery, + /** + * List all the CLI sessions belonging to a site + */ + fetchCliSessionsByAppIdQuery: fetchCliSessionsByAppIdQuery, + /** + * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site. + */ + fetchListServicesQuery: fetchListServicesQuery, + /** + * Ensure that an app resource exists on the OneGraph servers for a given site. + */ + executeUpsertAppForSiteMutation : executeUpsertAppForSiteMutation , + /** + * Add additional allowed CORS origins for calls to a site's Graph. + */ + executeAddCORSOriginMutation : executeAddCORSOriginMutation , + /** + * Remove the given CORS origins for calls to a site's Graph. + */ + executeRemoveCORSOriginMutation : executeRemoveCORSOriginMutation , + /** + * List the allowed CORS origins for calls to a site's Graph. + */ + fetchCORSOriginsQuery: fetchCORSOriginsQuery, + /** + * A subscription with variables and a fragment to test code generation. + */ + subscribeToTestSubscription:subscribeToTestSubscription, + /** + * Verify the event body is signed securely, and then parse the result. + */ + parseAndVerifyTestSubscriptionEvent: parseAndVerifyTestSubscriptionEvent + } + + export default functions" +`; + +exports[`netlify graph function library runtime codegen library [netlify-builtin:remix-0.0.1]:./dummy/index.d.ts} 1`] = ` +"/* eslint-disable */ + // @ts-nocheck + // GENERATED VIA NETLIFY AUTOMATED DEV TOOLS, EDIT WITH CAUTION! + + export type NetlifyGraphFunctionOptions = { + /** + * The accessToken to use for the request + */ + accessToken?: string; + /** + * The siteId to use for the request + * @default process.env.SITE_ID + */ + siteId?: string; + } + + export type WebhookEvent = { + body: string; + headers: Record; + }; + + export type GraphQLError = { + \\"path\\": Array; + \\"message\\": string; + \\"extensions\\": Record; + }; + + /** + * Subset of LoggedInServices + */ + export type LoggedInServicesFragment = { + friendlyServiceName: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + isLoggedIn: boolean; + usedTestFlow: boolean; + serviceInfo: { + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + availableScopes?: Array<{ + category?: string; + scope: string; + display: string; + isDefault: boolean; + isRequired: boolean; + description: string; + title?: string; +}>; +}; + /** + * The scopes that the user granted for this service. This is a best estimate of the scopes that were granted. Most services do not have a way to query the scopes on an auth, and some services do not return information about the scopes that were granted in the auth flow. + */ +grantedScopes?: Array<{ + /** + * The name of the scope that the underlying service uses. + */ +scope: string; +}>; + foreignUserId?: string; +}; + + +/** + * Basic info on a Service Auth + */ + export type ServiceAuthFragment = { + /** + * id for the service auth + */ +id: string; + /** + * The service that the clientId and clientSecret belong to, e.g. \\"gmail\\" + */ +service: string; + /** + * clientId for the serviceAuth. + */ +clientId: string; + /** + * If true, the bearer token that is created fetchable by the user whose account the token grants access to. + */ +revealTokens: boolean; + /** + * Optional scopes to use for the OAuth flow. + */ +scopes?: Array; +}; + + +/** + * Allowed CORS origins for calls to a site's Graph. + */ + export type AppCORSOriginFragment = { + /** + * The id of the OneGraph App + */ +id: string; + /** + * The origins allowed for this OneGraph App from CORS requests + */ +corsOrigins: Array; + /** + * Custom cors origins + */ +customCorsOrigins: Array<{ + /** + * The friendly service name for the cors origin + */ +friendlyServiceName: string; + /** + * The name of the origin that should be displayed, e.g. oneblog for oneblog.netlify.app. + */ +displayName: string; + /** + * The encoded value as a string, used to remove the custom cors origin. + */ +encodedValue: string; +}>; + /** + * Sites on Netlify associated with this app. OneGraph will allow CORS and authentication redirects to all previews, branch, and production deploys of these sites. + */ +netlifySiteNames: Array; +}; + + + export type UpdateCLISessionMetadataMutationInput = { + \\"nfToken\\": string; + /** + * The id of the session + */ + \\"sessionId\\": string; + /** + * Optional metadata for the session + */ + \\"metadata\\": unknown +}; + + export type UpdateCLISessionMetadataMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Update a CLI session. + */ +updateNetlifyCliSession: { + /** + * The session that was updated. + */ +session: { + id: string; + name?: string; + metadata?: unknown; + createdAt: string; + lastEventAt?: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`). + */ + export function executeUpdateCLISessionMetadataMutation ( + variables: UpdateCLISessionMetadataMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type AppSchemaQueryInput = { + \\"nfToken\\": string; + /** + * App id + */ + \\"appId\\": string +}; + + export type AppSchemaQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + app: { + /** + * Customizations to the default GraphQL schema + */ +graphQLSchema?: { + appId: string; + createdAt: string; + id: string; + services: Array<{ + friendlyServiceName: string; + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + /** + * Service string that can be provided in the URL when going through the oauth flow. + */ +slug: string; + supportsCustomRedirectUri: boolean; + supportsCustomServiceAuth: boolean; + supportsOauthLogin: boolean; +}>; + updatedAt: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Get the _metadata_ about a site's current GraphQL schema: +* +* - enabled services +* - schema id +* - creation date +* +* etc. + */ + export function fetchAppSchemaQuery( + variables: AppSchemaQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type DestroyTokenMutationInput = { + \\"nfToken\\": string; + /** + * Any OneGraph access token, refresh token, or JWT + */ + \\"token\\"?: string; + /** + * An Authlify Token identifier + */ + \\"authlifyTokenId\\"?: string +}; + + export type DestroyTokenMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Revokes a OneGraph access token, refresh token, or JWT. After a token is destroyed, it can no longer be used to authenticate with OneGraph. + +If you destroy a JWT, external services that rely on the claims embedded in the JWT may still accept the JWT and you will also have to revoke the JWT though the external service's revocation process. + */ +destroyToken: boolean; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Delete a OneGraph personal token for a user's site + */ + export function executeDestroyTokenMutation ( + variables: DestroyTokenMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type SignOutServicesMutationInput = { + \\"services\\": Array<\\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\">; +\\"nfToken\\": string; +\\"authlifyTokenId\\": string +}; + + export type SignOutServicesMutation = { + /** + * Any data from the function will be returned here + */ +data: { + signoutServices: { + me: { + /** + * Metadata and logged-in state for all OneGraph services + */ +serviceMetadata: { + loggedInServices: Array; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Sign out of a service associated with a Authlify token + */ + export function executeSignOutServicesMutation ( + variables: SignOutServicesMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type AddAuthsMutationInput = { + \\"siteId\\": string; +\\"authlifyTokenId\\"?: string; + /** + * Token that will be destroyed and have its auths moved to the personal token. + */ + \\"sToken\\": string; +\\"nfToken\\": string +}; + + export type AddAuthsMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + addAuthsToPersonalToken: { + /** + * Personal access token that was updated by this mutation + */ +accessToken: { + /** + * Netlify-specific ID for the token + */ +netlifyId?: string; + /** + * Bearer token + */ +token: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Update a service's (i.e. GitHub) enabled scope permissions + */ + export function executeAddAuthsMutation ( + variables: AddAuthsMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CreateNewSchemaMutationInput = { + \\"nfToken\\": string; +\\"input\\": {/** + * Whether to set this schema as the default for the app. Defaults to false. + */ + \\"setAsDefaultForApp\\"?: boolean; /** + * External GraphQL schemas to add + */ + \\"externalGraphQLSchemas\\"?: Array<{/** + * The id of the external GraphQL schema. + */ + \\"externalGraphQLSchemaId\\": string}>; /** + * Optional id of a Salesforce schema to attach to the app. + */ + \\"salesforceSchemaId\\"?: string; /** + * The optional id of the GraphQL schema that this was derived from. + */ + \\"parentId\\"?: string; /** + * The list of services that this schema should use. Leave blank if you want to add support for all supported services. + */ + \\"enabledServices\\"?: Array<\\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\">; /** + * The id of the app that the schema should belong to. + */ + \\"appId\\": string} +}; + + export type CreateNewSchemaMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + createGraphQLSchema: { + app: { + /** + * Customizations to the default GraphQL schema + */ +graphQLSchema?: { + id: string; +}; +}; + graphqlSchema: { + id: string; + services: Array<{ + friendlyServiceName: string; + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + /** + * Service string that can be provided in the URL when going through the oauth flow. + */ +slug: string; + supportsCustomRedirectUri: boolean; + supportsCustomServiceAuth: boolean; + supportsOauthLogin: boolean; +}>; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use. + */ + export function executeCreateNewSchemaMutation ( + variables: CreateNewSchemaMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type DeleteServiceAuthMutationInput = { + \\"siteId\\": string; +\\"serviceAuthId\\": string; +\\"nfToken\\": string +}; + + export type DeleteServiceAuthMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + destroyServiceAuth: { + app: { + /** + * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app + */ +serviceAuths: Array; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Delete a custom service auth + */ + export function executeDeleteServiceAuthMutation ( + variables: DeleteServiceAuthMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CreatePersistedQueryMutationInput = { + \\"nfToken\\": string; +\\"appId\\": string; +\\"query\\": string; + /** + * List of tags to add to the persisted query. Tags are free-form text that can be used to categorize persisted queries. Each tag must be under 256 characters and there can be a maximum of 10 tags on a single persisted query. + */ + \\"tags\\": Array; + /** + * A description for the persisted query. Maximum length is 2096 characters. + */ + \\"description\\": string; + /** + * The parent persisted query. It can be used to track lineage of the query. + */ + \\"parent\\"?: {/** + * An optional list of tags to remove from the parent query. If any of the provided tags aren't present on the parent, the mutation will fail. No persisted queries will be created and no tags will be removed from the parent. + */ + \\"removeTags\\"?: Array; /** + * The id of the parent + */ + \\"id\\": string} +}; + + export type CreatePersistedQueryMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + createPersistedQuery: { + persistedQuery: { + /** + * The persisted query's id. + */ +id: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution. + */ + export function executeCreatePersistedQueryMutation ( + variables: CreatePersistedQueryMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type FindLoggedInServicesQueryInput = { + \\"nfToken\\": string; +\\"authlifyTokenId\\": string +}; + + export type FindLoggedInServicesQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + authlifyToken: { + /** + * Metadata and logged-in state for all OneGraph services + */ +serviceMetadata: { + loggedInServices: Array; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site + */ + export function fetchFindLoggedInServicesQuery( + variables: FindLoggedInServicesQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type SetServiceAuthMutationInput = { + \\"service\\": \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\"; +\\"clientId\\": string; +\\"clientSecret\\": string; +\\"siteId\\": string; +\\"nfToken\\": string +}; + + export type SetServiceAuthMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + createServiceAuth: { + app: { + /** + * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app + */ +serviceAuths: Array; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Create a custom service auth + */ + export function executeSetServiceAuthMutation ( + variables: SetServiceAuthMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CreateCLISessionEventMutationInput = { + \\"nfToken\\": string; +\\"sessionId\\": string; +\\"payload\\": unknown +}; + + export type CreateCLISessionEventMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + createNetlifyCliTestEvent: { + event: { + id: string; + createdAt: string; + sessionId: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Create a new session for the Netlify CLI to communicate with the React UI via events. + */ + export function executeCreateCLISessionEventMutation ( + variables: CreateCLISessionEventMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CliSessionByIdQueryInput = { + \\"nfToken\\": string; +\\"id\\": string +}; + + export type CliSessionByIdQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Get a Netlify CLI session by its id. + */ +netlifyCliSession: { + id: string; + name?: string; + netlifyUserId: string; + events: Array<{ + createdAt: string; +}>; + createdAt: string; + lastEventAt?: string; + metadata?: unknown; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Get a Netlify CLI session by its id + */ + export function fetchCliSessionByIdQuery( + variables: CliSessionByIdQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + + + export type Deprecated_FindLoggedInServicesQuery = { + /** + * Any data from the function will be returned here + */ +data: { + me: { + /** + * Metadata and logged-in state for all OneGraph services + */ +serviceMetadata: { + loggedInServices: Array; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * (Deprecated) Find logged in services + */ + export function fetchDeprecated_FindLoggedInServicesQuery( + /** + * Pass \`{}\` as no variables are defined for this function. + */ + variables: Record, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CreateEmptyPersonalTokenMutationInput = { + \\"nfToken\\": string; +\\"siteId\\": string +}; + + export type CreateEmptyPersonalTokenMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Creates an empty personal token with a Netlify site anchor + */ +createPersonalTokenWithNetlifySiteAnchor: { + /** + * Personal access token that was created by this mutation + */ +accessToken: { + /** + * Bearer token + */ +token: string; + /** + * Token name, if it is a personal access token + */ +name?: string; + /** + * The anchor is like two-factor auth for the token. It ensures that the person who adds auth to the token is the same as the person who created the token. + */ +anchor?: \\"ONEGRAPH_USER\\" | \\"NETLIFY_USER\\" | \\"NETLIFY_SITE\\"; + /** + * Netlify-specific ID for the token + */ +netlifyId?: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Create a new OneGraph personal token for a user's site + */ + export function executeCreateEmptyPersonalTokenMutation ( + variables: CreateEmptyPersonalTokenMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type ServiceListQueryInput = { + \\"logoStyle\\"?: \\"DEFAULT\\" | \\"ROUNDED_RECTANGLE\\" +}; + + export type ServiceListQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + services: Array<{ + friendlyServiceName: string; + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + /** + * Service string that can be provided in the URL when going through the oauth flow. + */ +slug: string; + supportsCustomRedirectUri: boolean; + supportsCustomServiceAuth: boolean; + supportsOauthLogin: boolean; +}>; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Retrieve a list of _all_ supported services from OneGraph + */ + export function fetchServiceListQuery( + variables: ServiceListQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type AuthlifyTokenIdForPersonalTokenInput = { + \\"personalToken\\": string +}; + + export type AuthlifyTokenIdForPersonalToken = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Personal access token lookup + */ +personalToken?: { + /** + * Netlify-specific ID for the token + */ +netlifyId?: string; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * + */ + export function fetchAuthlifyTokenIdForPersonalToken( + variables: AuthlifyTokenIdForPersonalTokenInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type PersistedQueryQueryInput = { + \\"nfToken\\": string; + /** + * The id of the app that the persisted query belongs to. + */ + \\"appId\\": string; + /** + * The id of the persisted query. + */ + \\"id\\": string +}; + + export type PersistedQueryQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Fetch a single persisted query by its id. + */ +persistedQuery: { + /** + * The persisted query's id. + */ +id: string; + /** + * The persisted query's query string. + */ +query: string; + /** + * The list of operation names that the caller of the query is allowed to execute. If the field is null, then all operationNames are allowed. + */ +allowedOperationNames?: Array; + /** + * The user-defined description that was added to the query + */ +description?: string; + /** + * The list of variables that the caller of the query is allowed to provide. + */ +freeVariables?: Array; + /** + * The default variables provided to the query. + */ +fixedVariables?: unknown; + /** + * The list of user-defined tags that were added to the query + */ +tags?: Array; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Retrieve a previously persisted operations doc + */ + export function fetchPersistedQueryQuery( + variables: PersistedQueryQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CliSessionsByAppIdQueryInput = { + \\"nfToken\\": string; +\\"appId\\": string +}; + + export type CliSessionsByAppIdQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Netlify CLI sessions, orderd by createdAt descending. + */ +netlifyCliSessionsByAppId: Array<{ + id: string; + name?: string; + netlifyUserId: string; + events: Array<{ + createdAt: string; +}>; + createdAt: string; + lastEventAt?: string; + metadata?: unknown; +}>; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * List all the CLI sessions belonging to a site + */ + export function fetchCliSessionsByAppIdQuery( + variables: CliSessionsByAppIdQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type ListServicesQueryInput = { + \\"nfToken\\": string; + /** + * App id + */ + \\"siteId\\": string; +\\"logoStyle\\"?: \\"DEFAULT\\" | \\"ROUNDED_RECTANGLE\\" +}; + + export type ListServicesQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + services: Array<{ + friendlyServiceName: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + /** + * Service string that can be provided in the URL when going through the oauth flow. + */ +slug: string; + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + availableScopes?: Array<{ + category?: string; + scope: string; + display: string; + isDefault: boolean; + isRequired: boolean; + description: string; + title?: string; +}>; +}>; + app: { + /** + * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app + */ +serviceAuths: Array; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site. + */ + export function fetchListServicesQuery( + variables: ListServicesQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type UpsertAppForSiteMutationInput = { + \\"nfToken\\": string; +\\"siteId\\": string +}; + + export type UpsertAppForSiteMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + upsertAppForNetlifySite: { + /** + * The app that is associated with the Netlify account. + */ +org: { + /** + * The id of the OneGraph Org + */ +id: string; + /** + * The name of the OneGraph Org + */ +name: string; +}; + /** + * The app that is associated with the Netlify site. + */ +app: { + /** + * The id of the OneGraph App + */ +id: string; + /** + * The name of the OneGraph App + */ +name: string; + /** + * The origins allowed for this OneGraph App from CORS requests + */ +corsOrigins: Array; + /** + * Custom cors origins + */ +customCorsOrigins: Array<{ + /** + * The friendly service name for the cors origin + */ +friendlyServiceName: string; + /** + * The name of the origin that should be displayed, e.g. oneblog for oneblog.netlify.app. + */ +displayName: string; + /** + * The encoded value as a string, used to remove the custom cors origin. + */ +encodedValue: string; +}>; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Ensure that an app resource exists on the OneGraph servers for a given site. + */ + export function executeUpsertAppForSiteMutation ( + variables: UpsertAppForSiteMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type AddCORSOriginMutationInput = { + \\"nfToken\\": string; +\\"input\\": {\\"corsOrigin\\": string; \\"appId\\": string} +}; + + export type AddCORSOriginMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + addCORSOriginToApp: { + app: AppCORSOriginFragment ; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Add additional allowed CORS origins for calls to a site's Graph. + */ + export function executeAddCORSOriginMutation ( + variables: AddCORSOriginMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type RemoveCORSOriginMutationInput = { + \\"nfToken\\": string; +\\"input\\": {\\"corsOrigin\\": string; \\"appId\\": string} +}; + + export type RemoveCORSOriginMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + removeCORSOriginFromApp: { + app: AppCORSOriginFragment ; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Remove the given CORS origins for calls to a site's Graph. + */ + export function executeRemoveCORSOriginMutation ( + variables: RemoveCORSOriginMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CORSOriginsQueryInput = { + /** + * App id + */ + \\"siteId\\": string; +\\"nfToken\\": string +}; + + export type CORSOriginsQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + app: AppCORSOriginFragment ; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * List the allowed CORS origins for calls to a site's Graph. + */ + export function fetchCORSOriginsQuery( + variables: CORSOriginsQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +/** + * A subscription with variables and a fragment to test code generation. + */ + export function subscribeToTestSubscription( + /** + * This will be available in your webhook handler as a query parameter. + * Use this to keep track of which subscription you're receiving + * events for. + */ + variables: { + /** + * How many minutes to wait before re-running the underlying query + */ + \\"minutes\\"?: number +}, + options?: { + /** + * The accessToken to use for the lifetime of the subscription. + */ + accessToken?: string | null | undefined; + /** + * A string id that will be passed to your webhook handler as a query parameter + * along with each event. + * This can be used to keep track of which subscription you're receiving + */ + netlifyGraphWebhookId?: string | null | undefined; + /** + * The absolute URL of your webhook handler to handle events from this subscription. + */ + webhookUrl?: string | null | undefined; + /** + * The secret to use when signing the webhook request. Use this to verify + * that the webhook payload is coming from Netlify Graph. Defaults to the + * value of the NETLIFY_GRAPH_WEBHOOK_SECRET environment variable. + */ + webhookSecret?: string | null | undefined; + }) : void + + export type TestSubscriptionEvent = { + /** + * Any data from the function will be returned here + */ +data: { + poll: { + query: { + me: { + /** + * Metadata and logged-in state for all OneGraph services + */ +serviceMetadata: { + loggedInServices: Array>; +}; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +} + + /** + * Verify the TestSubscription event body is signed securely, and then parse the result. + */ + export function parseAndVerifyTestSubscriptionEvent (/** A Netlify Handler Event */ event : WebhookEvent) : null | TestSubscriptionEvent + + + export interface Functions { + /** + * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`). + */ + executeUpdateCLISessionMetadataMutation : typeof executeUpdateCLISessionMetadataMutation , + /** + * Get the _metadata_ about a site's current GraphQL schema: +* +* - enabled services +* - schema id +* - creation date +* +* etc. + */ + fetchAppSchemaQuery: typeof fetchAppSchemaQuery, + /** + * Delete a OneGraph personal token for a user's site + */ + executeDestroyTokenMutation : typeof executeDestroyTokenMutation , + /** + * Sign out of a service associated with a Authlify token + */ + executeSignOutServicesMutation : typeof executeSignOutServicesMutation , + /** + * Update a service's (i.e. GitHub) enabled scope permissions + */ + executeAddAuthsMutation : typeof executeAddAuthsMutation , + /** + * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use. + */ + executeCreateNewSchemaMutation : typeof executeCreateNewSchemaMutation , + /** + * Delete a custom service auth + */ + executeDeleteServiceAuthMutation : typeof executeDeleteServiceAuthMutation , + /** + * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution. + */ + executeCreatePersistedQueryMutation : typeof executeCreatePersistedQueryMutation , + /** + * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site + */ + fetchFindLoggedInServicesQuery: typeof fetchFindLoggedInServicesQuery, + /** + * Create a custom service auth + */ + executeSetServiceAuthMutation : typeof executeSetServiceAuthMutation , + /** + * Create a new session for the Netlify CLI to communicate with the React UI via events. + */ + executeCreateCLISessionEventMutation : typeof executeCreateCLISessionEventMutation , + /** + * Get a Netlify CLI session by its id + */ + fetchCliSessionByIdQuery: typeof fetchCliSessionByIdQuery, + /** + * (Deprecated) Find logged in services + */ + fetchDeprecated_FindLoggedInServicesQuery: typeof fetchDeprecated_FindLoggedInServicesQuery, + /** + * Create a new OneGraph personal token for a user's site + */ + executeCreateEmptyPersonalTokenMutation : typeof executeCreateEmptyPersonalTokenMutation , + /** + * Retrieve a list of _all_ supported services from OneGraph + */ + fetchServiceListQuery: typeof fetchServiceListQuery, + /** + * + */ + fetchAuthlifyTokenIdForPersonalToken: typeof fetchAuthlifyTokenIdForPersonalToken, + /** + * Retrieve a previously persisted operations doc + */ + fetchPersistedQueryQuery: typeof fetchPersistedQueryQuery, + /** + * List all the CLI sessions belonging to a site + */ + fetchCliSessionsByAppIdQuery: typeof fetchCliSessionsByAppIdQuery, + /** + * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site. + */ + fetchListServicesQuery: typeof fetchListServicesQuery, + /** + * Ensure that an app resource exists on the OneGraph servers for a given site. + */ + executeUpsertAppForSiteMutation : typeof executeUpsertAppForSiteMutation , + /** + * Add additional allowed CORS origins for calls to a site's Graph. + */ + executeAddCORSOriginMutation : typeof executeAddCORSOriginMutation , + /** + * Remove the given CORS origins for calls to a site's Graph. + */ + executeRemoveCORSOriginMutation : typeof executeRemoveCORSOriginMutation , + /** + * List the allowed CORS origins for calls to a site's Graph. + */ + fetchCORSOriginsQuery: typeof fetchCORSOriginsQuery, + /** + * A subscription with variables and a fragment to test code generation. + */ + subscribeToTestSubscription:subscribeToTestSubscription, + /** + * Verify the event body is signed securely, and then parse the result. + */ + parseAndVerifyTestSubscriptionEvent: typeof parseAndVerifyTestSubscriptionEvent + } + + export const functions: Functions; + + export default functions; + " +`; + +exports[`netlify graph function library runtime codegen library [netlify-builtin:remix-0.0.1]:./dummy/index.js} 1`] = ` +"/* eslint-disable */ + // @ts-nocheck + // GENERATED VIA NETLIFY AUTOMATED DEV TOOLS, EDIT WITH CAUTION! + + // Basic LRU cache implementation + const makeLRUCache = (max) => { + return { max: max, cache: new Map() }; + }; + + const oldestCacheKey = (lru) => { + return lru.keys().next().value + } + + // Depend on Map keeping track of insertion order + const getFromCache = (lru, key) => { + const item = lru.cache.get(key); + if (item) { + // Delete key and re-insert so key is now at the end, + // and now the last to be gc'd. + lru.cache.delete(key); + lru.cache.set(key, item); + } + return item; + }; + + const setInCache = (lru, key, value) => { + if (lru.cache.has(key)) { + lru.cache.delete(key); + } + if (lru.cache.size == lru.max) { + const cacheKey = oldestCacheKey(lru); + + if (cacheKey) { + lru.cache.delete(cacheKey); + } + } + + lru.cache.set(key, value); + }; + + // Cache the results of the Netlify Graph API for conditional requests + const cache = makeLRUCache(100); + + const calculateCacheKey = (payload) => { + return JSON.stringify(payload); + }; + + const schemaId = 'stable-schema-id'; + + const netlifyGraphHostWithProtocol = + process.env.NETLIFY_GRAPH_HOST_WITH_PROTOCOL || 'https://graph.netlify.com'; + + const makeNetlifyGraphUrl = ({ operationName, siteId }) => { + return ( + netlifyGraphHostWithProtocol + + '/graphql?app_id=' + + siteId + + '&operationName=' + + operationName + + '&schema_id=' + + schemaId + ); + }; + + const httpFetch = (operationName, options) => { + const reqBody = options.body || null; + const userHeaders = options.headers || {}; + const headers = { + ...userHeaders, + 'Content-Type': 'application/json', + }; + + const timeoutMs = 30_000; + + const reqOptions = { + method: 'POST', + headers: headers, + timeout: timeoutMs, + body: reqBody, + }; + + const siteId = options.siteId || process.env.SITE_ID; + const netlifyGraphUrl = makeNetlifyGraphUrl({ operationName: operationName, siteId: siteId }); + + return fetch(netlifyGraphUrl, reqOptions).then((body) => { + return body.text().then((bodyString) => { + const headers = {}; + body.headers.forEach((k, v) => (headers[k] = v)); + + return { + body: bodyString, + headers: headers, + status: body.status, + }; + }); + }); + }; + + const fetchNetlifyGraph = function fetchNetlifyGraph(input) { + const query = input.query; + const docId = input.doc_id; + const operationName = input.operationName; + const variables = input.variables; + + const options = input.options || {}; + const accessToken = options.accessToken; + + const payload = { + query: query, + doc_id: docId, + variables: variables, + operationName: operationName, + }; + + let cachedOrLiveValue = new Promise((resolve) => { + const cacheKey = calculateCacheKey(payload); + + // Check the cache for a previous result + const cachedResultPair = getFromCache(cache, cacheKey); + + let conditionalHeaders = { + 'If-None-Match': '', + }; + let cachedResultValue; + + if (cachedResultPair) { + const [etag, previousResult] = cachedResultPair; + conditionalHeaders = { + 'If-None-Match': etag, + }; + cachedResultValue = previousResult; + } + + const response = httpFetch(operationName, { + ...options, + method: 'POST', + headers: { + ...conditionalHeaders, + Authorization: accessToken ? 'Bearer ' + accessToken : '', + }, + body: JSON.stringify(payload), + }); + + response.then((result) => { + // Check response headers for a 304 Not Modified + if (result.status === 304) { + // Return the cached result + resolve(cachedResultValue); + } else if (result.status === 200) { + // Update the cache with the new etag and result + const etag = result.headers['etag']; + const resultJson = JSON.parse(result.body); + if (etag) { + // Make a note of the new etag for the given payload + setInCache(cache, cacheKey, [etag, resultJson]); + } + resolve(resultJson); + } else { + return result.json().then((json) => { + resolve(json); + }); + } + }); + }); + + return cachedOrLiveValue; + }; + + export const executeUpdateCLISessionMetadataMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation UpdateCLISessionMetadataMutation($nfToken: String!, $sessionId: String!, $metadata: JSON!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + updateNetlifyCliSession(input: {id: $sessionId, metadata: $metadata}) { + session { + id + name + metadata + createdAt + lastEventAt + } + } + } +}\`, + operationName: \\"UpdateCLISessionMetadataMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchAppSchemaQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query AppSchemaQuery($nfToken: String!, $appId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + app(id: $appId) { + graphQLSchema { + appId + createdAt + id + services { + friendlyServiceName + logoUrl + service + slug + supportsCustomRedirectUri + supportsCustomServiceAuth + supportsOauthLogin + } + updatedAt + } + } + } +}\`, + operationName: \\"AppSchemaQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeDestroyTokenMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation DestroyTokenMutation($nfToken: String!, $token: String, $authlifyTokenId: String) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + destroyToken(token: $token, authlifyTokenId: $authlifyTokenId) + } +}\`, + operationName: \\"DestroyTokenMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeSignOutServicesMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation SignOutServicesMutation($services: [OneGraphServiceEnum!]!, $nfToken: String!, $authlifyTokenId: String!) { + signoutServices( + data: {services: $services, anchorAuth: {netlifyAuth: {oauthToken: $nfToken}}, authlifyTokenId: $authlifyTokenId} + ) { + me { + serviceMetadata { + loggedInServices { + ...LoggedInServicesFragment + } + } + } + } +} + +fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: \\"\\"\\"12b5bdea-9bab-4124-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Subset of LoggedInServices\\"\\"\\") { + friendlyServiceName + service + isLoggedIn + usedTestFlow + serviceInfo { + logoUrl + availableScopes { + category + scope + display + isDefault + isRequired + description + title + } + } + grantedScopes { + scope + } + foreignUserId +}\`, + operationName: \\"SignOutServicesMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeAddAuthsMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation AddAuthsMutation($siteId: String!, $authlifyTokenId: String, $sToken: String!, $nfToken: String!) { + oneGraph { + addAuthsToPersonalToken( + input: {anchorAuth: {netlifyAuth: {oauthToken: $nfToken}}, sacrificialToken: $sToken, authlifyTokenId: $authlifyTokenId, appId: $siteId} + ) { + accessToken { + netlifyId + token + } + } + } +}\`, + operationName: \\"AddAuthsMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeCreateNewSchemaMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation CreateNewSchemaMutation($nfToken: String!, $input: OneGraphCreateGraphQLSchemaInput!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createGraphQLSchema(input: $input) { + app { + graphQLSchema { + id + } + } + graphqlSchema { + id + services { + friendlyServiceName + logoUrl + service + slug + supportsCustomRedirectUri + supportsCustomServiceAuth + supportsOauthLogin + } + } + } + } +}\`, + operationName: \\"CreateNewSchemaMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeDeleteServiceAuthMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation DeleteServiceAuthMutation($siteId: String!, $serviceAuthId: String!, $nfToken: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + destroyServiceAuth(data: {appId: $siteId, serviceAuthId: $serviceAuthId}) { + app { + serviceAuths { + ...ServiceAuthFragment + } + } + } + } +} + +fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: \\"\\"\\"12b5bdea-9bab-4164-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Basic info on a Service Auth\\"\\"\\") { + id + service + clientId + revealTokens + scopes +}\`, + operationName: \\"DeleteServiceAuthMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeCreatePersistedQueryMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation CreatePersistedQueryMutation($nfToken: String!, $appId: String!, $query: String!, $tags: [String!]!, $description: String!, $parent: OneGraphCreatePersistedQueryParentInput) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createPersistedQuery( + input: {query: $query, appId: $appId, tags: $tags, description: $description, parent: $parent} + ) { + persistedQuery { + id + } + } + } +}\`, + operationName: \\"CreatePersistedQueryMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchFindLoggedInServicesQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query FindLoggedInServicesQuery($nfToken: String!, $authlifyTokenId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + authlifyToken(authlifyTokenId: $authlifyTokenId) { + serviceMetadata { + loggedInServices { + usedTestFlow + friendlyServiceName + ...LoggedInServicesFragment + } + } + } + } +} + +fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: \\"\\"\\"12b5bdea-9bab-4124-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Subset of LoggedInServices\\"\\"\\") { + friendlyServiceName + service + isLoggedIn + usedTestFlow + serviceInfo { + logoUrl + availableScopes { + category + scope + display + isDefault + isRequired + description + title + } + } + grantedScopes { + scope + } + foreignUserId +}\`, + operationName: \\"FindLoggedInServicesQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeSetServiceAuthMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation SetServiceAuthMutation($service: OneGraphCustomServiceAuthServiceEnum!, $clientId: String!, $clientSecret: String!, $siteId: String!, $nfToken: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createServiceAuth( + data: {service: $service, clientId: $clientId, clientSecret: $clientSecret, appId: $siteId, revealTokens: true} + ) { + app { + serviceAuths { + ...ServiceAuthFragment + } + } + } + } +} + +fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: \\"\\"\\"12b5bdea-9bab-4164-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Basic info on a Service Auth\\"\\"\\") { + id + service + clientId + revealTokens + scopes +}\`, + operationName: \\"SetServiceAuthMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeCreateCLISessionEventMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation CreateCLISessionEventMutation($nfToken: String!, $sessionId: String!, $payload: JSON!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createNetlifyCliTestEvent( + input: {data: {payload: $payload}, sessionId: $sessionId} + ) { + event { + id + createdAt + sessionId + } + } + } +}\`, + operationName: \\"CreateCLISessionEventMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchCliSessionByIdQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query CliSessionByIdQuery($nfToken: String!, $id: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + netlifyCliSession(id: $id) { + id + name + netlifyUserId + events { + createdAt + } + createdAt + lastEventAt + metadata + } + } +}\`, + operationName: \\"CliSessionByIdQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchDeprecated_FindLoggedInServicesQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query Deprecated_FindLoggedInServicesQuery { + me { + serviceMetadata { + loggedInServices { + ...LoggedInServicesFragment + } + } + } +} + +fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: \\"\\"\\"12b5bdea-9bab-4124-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Subset of LoggedInServices\\"\\"\\") { + friendlyServiceName + service + isLoggedIn + usedTestFlow + serviceInfo { + logoUrl + availableScopes { + category + scope + display + isDefault + isRequired + description + title + } + } + grantedScopes { + scope + } + foreignUserId +}\`, + operationName: \\"Deprecated_FindLoggedInServicesQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeCreateEmptyPersonalTokenMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation CreateEmptyPersonalTokenMutation($nfToken: String!, $siteId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createPersonalTokenWithNetlifySiteAnchor( + input: {name: \\"Netlify AuthManager Token\\", netlifySiteId: $siteId} + ) { + accessToken { + token + name + anchor + netlifyId + } + } + } +}\`, + operationName: \\"CreateEmptyPersonalTokenMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchServiceListQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query ServiceListQuery($logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) { + oneGraph { + services { + friendlyServiceName + logoUrl(style: $logoStyle) + service + slug + supportsCustomRedirectUri + supportsCustomServiceAuth + supportsOauthLogin + } + } +}\`, + operationName: \\"ServiceListQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchAuthlifyTokenIdForPersonalToken = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query AuthlifyTokenIdForPersonalToken($personalToken: String!) { + oneGraph { + personalToken(accessToken: $personalToken) { + netlifyId + } + } +}\`, + operationName: \\"AuthlifyTokenIdForPersonalToken\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchPersistedQueryQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query PersistedQueryQuery($nfToken: String!, $appId: String!, $id: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + persistedQuery(appId: $appId, id: $id) { + id + query + allowedOperationNames + description + freeVariables + fixedVariables + tags + } + } +}\`, + operationName: \\"PersistedQueryQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchCliSessionsByAppIdQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query CliSessionsByAppIdQuery($nfToken: String!, $appId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + netlifyCliSessionsByAppId(appId: $appId, first: 10) { + id + name + netlifyUserId + events { + createdAt + } + createdAt + lastEventAt + metadata + } + } +}\`, + operationName: \\"CliSessionsByAppIdQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchListServicesQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query ListServicesQuery($nfToken: String!, $siteId: String!, $logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + services(filter: {supportsOauthLogin: true}) { + friendlyServiceName + service + slug + logoUrl(style: $logoStyle) + availableScopes { + category + scope + display + isDefault + isRequired + description + title + } + } + app(id: $siteId) { + serviceAuths { + ...ServiceAuthFragment + } + } + } +} + +fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: \\"\\"\\"12b5bdea-9bab-4164-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Basic info on a Service Auth\\"\\"\\") { + id + service + clientId + revealTokens + scopes +}\`, + operationName: \\"ListServicesQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeUpsertAppForSiteMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation UpsertAppForSiteMutation($nfToken: String!, $siteId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + upsertAppForNetlifySite(input: {netlifySiteId: $siteId}) { + org { + id + name + } + app { + id + name + corsOrigins + customCorsOrigins { + friendlyServiceName + displayName + encodedValue + } + } + } + } +}\`, + operationName: \\"UpsertAppForSiteMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeAddCORSOriginMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation AddCORSOriginMutation($nfToken: String!, $input: OneGraphAddCORSOriginToAppInput!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + addCORSOriginToApp(input: $input) { + app { + ...AppCORSOriginFragment + } + } + } +} + +fragment AppCORSOriginFragment on OneGraphApp @netlify(id: \\"\\"\\"e3d4bb8b-2fb5-48d8-b051-db6027224145\\"\\"\\", doc: \\"\\"\\"Allowed CORS origins for calls to a site's Graph.\\"\\"\\") { + id + corsOrigins + customCorsOrigins { + friendlyServiceName + displayName + encodedValue + } + netlifySiteNames +}\`, + operationName: \\"AddCORSOriginMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeRemoveCORSOriginMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation RemoveCORSOriginMutation($nfToken: String!, $input: OneGraphRemoveCORSOriginFromAppInput!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + removeCORSOriginFromApp(input: $input) { + app { + ...AppCORSOriginFragment + } + } + } +} + +fragment AppCORSOriginFragment on OneGraphApp @netlify(id: \\"\\"\\"e3d4bb8b-2fb5-48d8-b051-db6027224145\\"\\"\\", doc: \\"\\"\\"Allowed CORS origins for calls to a site's Graph.\\"\\"\\") { + id + corsOrigins + customCorsOrigins { + friendlyServiceName + displayName + encodedValue + } + netlifySiteNames +}\`, + operationName: \\"RemoveCORSOriginMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchCORSOriginsQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query CORSOriginsQuery($siteId: String!, $nfToken: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + app(id: $siteId) { + ...AppCORSOriginFragment + } + } +} + +fragment AppCORSOriginFragment on OneGraphApp @netlify(id: \\"\\"\\"e3d4bb8b-2fb5-48d8-b051-db6027224145\\"\\"\\", doc: \\"\\"\\"Allowed CORS origins for calls to a site's Graph.\\"\\"\\") { + id + corsOrigins + customCorsOrigins { + friendlyServiceName + displayName + encodedValue + } + netlifySiteNames +}\`, + operationName: \\"CORSOriginsQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +const subscribeToTestSubscription = ( + variables, + rawOptions + ) => { + const options = rawOptions || {}; + const netlifyGraphWebhookId = options.netlifyGraphWebhookId; + const netlifyGraphWebhookUrl = options.webhookUrl || \`\${process.env.DEPLOY_URL}/webhooks/TestSubscription?netlifyGraphWebhookId=\${netlifyGraphWebhookId}\`; + const secret = options.webhookSecret || process.env.NETLIFY_GRAPH_WEBHOOK_SECRET + const fullVariables = {...variables, netlifyGraphWebhookUrl: netlifyGraphWebhookUrl, netlifyGraphWebhookSecret: { hmacSha256Key: secret }} + + const subscriptionOperationDoc = \`subscription TestSubscription($minutes: Int = 1, $netlifyGraphWebhookUrl: String!, $netlifyGraphWebhookSecret: OneGraphSubscriptionSecretInput!) @netlify(id: \\"\\"\\"e3d4bb8b-2fb5-9898-b051-db6027224112\\"\\"\\", doc: \\"\\"\\"A subscription with variables and a fragment to test code generation.\\"\\"\\") { + poll( + schedule: {every: {minutes: $minutes}} + onlyTriggerWhenPayloadChanged: true + webhookUrl: $netlifyGraphWebhookUrl + secret: $netlifyGraphWebhookSecret + ) { + query { + me { + serviceMetadata { + loggedInServices { + ...LoggedInServicesFragment + } + } + } + } + } +}\`; + + fetchNetlifyGraph({ + query: subscriptionOperationDoc, + operationName: \\"TestSubscription\\", + variables: fullVariables, + options: options, + fetchStrategy: \\"POST\\", + }) + } + + const parseAndVerifyTestSubscriptionEvent = (event, options) => { + if (!verifyRequestSignature({ event: event }, options)) { + console.warn(\\"Unable to verify signature for TestSubscription\\") + return null + } + + return JSON.parse(event.body || '{}') + } + + /** + * The generated NetlifyGraph library with your operations + */ + const functions = { + /** + * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`). + */ + executeUpdateCLISessionMetadataMutation : executeUpdateCLISessionMetadataMutation , + /** + * Get the _metadata_ about a site's current GraphQL schema: +* +* - enabled services +* - schema id +* - creation date +* +* etc. + */ + fetchAppSchemaQuery: fetchAppSchemaQuery, + /** + * Delete a OneGraph personal token for a user's site + */ + executeDestroyTokenMutation : executeDestroyTokenMutation , + /** + * Sign out of a service associated with a Authlify token + */ + executeSignOutServicesMutation : executeSignOutServicesMutation , + /** + * Update a service's (i.e. GitHub) enabled scope permissions + */ + executeAddAuthsMutation : executeAddAuthsMutation , + /** + * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use. + */ + executeCreateNewSchemaMutation : executeCreateNewSchemaMutation , + /** + * Delete a custom service auth + */ + executeDeleteServiceAuthMutation : executeDeleteServiceAuthMutation , + /** + * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution. + */ + executeCreatePersistedQueryMutation : executeCreatePersistedQueryMutation , + /** + * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site + */ + fetchFindLoggedInServicesQuery: fetchFindLoggedInServicesQuery, + /** + * Create a custom service auth + */ + executeSetServiceAuthMutation : executeSetServiceAuthMutation , + /** + * Create a new session for the Netlify CLI to communicate with the React UI via events. + */ + executeCreateCLISessionEventMutation : executeCreateCLISessionEventMutation , + /** + * Get a Netlify CLI session by its id + */ + fetchCliSessionByIdQuery: fetchCliSessionByIdQuery, + /** + * (Deprecated) Find logged in services + */ + fetchDeprecated_FindLoggedInServicesQuery: fetchDeprecated_FindLoggedInServicesQuery, + /** + * Create a new OneGraph personal token for a user's site + */ + executeCreateEmptyPersonalTokenMutation : executeCreateEmptyPersonalTokenMutation , + /** + * Retrieve a list of _all_ supported services from OneGraph + */ + fetchServiceListQuery: fetchServiceListQuery, + /** + * + */ + fetchAuthlifyTokenIdForPersonalToken: fetchAuthlifyTokenIdForPersonalToken, + /** + * Retrieve a previously persisted operations doc + */ + fetchPersistedQueryQuery: fetchPersistedQueryQuery, + /** + * List all the CLI sessions belonging to a site + */ + fetchCliSessionsByAppIdQuery: fetchCliSessionsByAppIdQuery, + /** + * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site. + */ + fetchListServicesQuery: fetchListServicesQuery, + /** + * Ensure that an app resource exists on the OneGraph servers for a given site. + */ + executeUpsertAppForSiteMutation : executeUpsertAppForSiteMutation , + /** + * Add additional allowed CORS origins for calls to a site's Graph. + */ + executeAddCORSOriginMutation : executeAddCORSOriginMutation , + /** + * Remove the given CORS origins for calls to a site's Graph. + */ + executeRemoveCORSOriginMutation : executeRemoveCORSOriginMutation , + /** + * List the allowed CORS origins for calls to a site's Graph. + */ + fetchCORSOriginsQuery: fetchCORSOriginsQuery, + /** + * A subscription with variables and a fragment to test code generation. + */ + subscribeToTestSubscription:subscribeToTestSubscription, + /** + * Verify the event body is signed securely, and then parse the result. + */ + parseAndVerifyTestSubscriptionEvent: parseAndVerifyTestSubscriptionEvent + } + + export default functions" +`; + +exports[`netlify graph function library runtime codegen library [netlify-builtin:serverless-0.0.1]:./dummy/index.d.ts} 1`] = ` +"/* eslint-disable */ + // @ts-nocheck + // GENERATED VIA NETLIFY AUTOMATED DEV TOOLS, EDIT WITH CAUTION! + + export type NetlifyGraphFunctionOptions = { + /** + * The accessToken to use for the request + */ + accessToken?: string; + /** + * The siteId to use for the request + * @default process.env.SITE_ID + */ + siteId?: string; + } + + export type WebhookEvent = { + body: string; + headers: Record; + }; + + export type GraphQLError = { + \\"path\\": Array; + \\"message\\": string; + \\"extensions\\": Record; + }; + + /** + * Subset of LoggedInServices + */ + export type LoggedInServicesFragment = { + friendlyServiceName: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + isLoggedIn: boolean; + usedTestFlow: boolean; + serviceInfo: { + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + availableScopes?: Array<{ + category?: string; + scope: string; + display: string; + isDefault: boolean; + isRequired: boolean; + description: string; + title?: string; +}>; +}; + /** + * The scopes that the user granted for this service. This is a best estimate of the scopes that were granted. Most services do not have a way to query the scopes on an auth, and some services do not return information about the scopes that were granted in the auth flow. + */ +grantedScopes?: Array<{ + /** + * The name of the scope that the underlying service uses. + */ +scope: string; +}>; + foreignUserId?: string; +}; + + +/** + * Basic info on a Service Auth + */ + export type ServiceAuthFragment = { + /** + * id for the service auth + */ +id: string; + /** + * The service that the clientId and clientSecret belong to, e.g. \\"gmail\\" + */ +service: string; + /** + * clientId for the serviceAuth. + */ +clientId: string; + /** + * If true, the bearer token that is created fetchable by the user whose account the token grants access to. + */ +revealTokens: boolean; + /** + * Optional scopes to use for the OAuth flow. + */ +scopes?: Array; +}; + + +/** + * Allowed CORS origins for calls to a site's Graph. + */ + export type AppCORSOriginFragment = { + /** + * The id of the OneGraph App + */ +id: string; + /** + * The origins allowed for this OneGraph App from CORS requests + */ +corsOrigins: Array; + /** + * Custom cors origins + */ +customCorsOrigins: Array<{ + /** + * The friendly service name for the cors origin + */ +friendlyServiceName: string; + /** + * The name of the origin that should be displayed, e.g. oneblog for oneblog.netlify.app. + */ +displayName: string; + /** + * The encoded value as a string, used to remove the custom cors origin. + */ +encodedValue: string; +}>; + /** + * Sites on Netlify associated with this app. OneGraph will allow CORS and authentication redirects to all previews, branch, and production deploys of these sites. + */ +netlifySiteNames: Array; +}; + + + export type UpdateCLISessionMetadataMutationInput = { + \\"nfToken\\": string; + /** + * The id of the session + */ + \\"sessionId\\": string; + /** + * Optional metadata for the session + */ + \\"metadata\\": unknown +}; + + export type UpdateCLISessionMetadataMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Update a CLI session. + */ +updateNetlifyCliSession: { + /** + * The session that was updated. + */ +session: { + id: string; + name?: string; + metadata?: unknown; + createdAt: string; + lastEventAt?: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`). + */ + export function executeUpdateCLISessionMetadataMutation ( + variables: UpdateCLISessionMetadataMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type AppSchemaQueryInput = { + \\"nfToken\\": string; + /** + * App id + */ + \\"appId\\": string +}; + + export type AppSchemaQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + app: { + /** + * Customizations to the default GraphQL schema + */ +graphQLSchema?: { + appId: string; + createdAt: string; + id: string; + services: Array<{ + friendlyServiceName: string; + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + /** + * Service string that can be provided in the URL when going through the oauth flow. + */ +slug: string; + supportsCustomRedirectUri: boolean; + supportsCustomServiceAuth: boolean; + supportsOauthLogin: boolean; +}>; + updatedAt: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Get the _metadata_ about a site's current GraphQL schema: +* +* - enabled services +* - schema id +* - creation date +* +* etc. + */ + export function fetchAppSchemaQuery( + variables: AppSchemaQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type DestroyTokenMutationInput = { + \\"nfToken\\": string; + /** + * Any OneGraph access token, refresh token, or JWT + */ + \\"token\\"?: string; + /** + * An Authlify Token identifier + */ + \\"authlifyTokenId\\"?: string +}; + + export type DestroyTokenMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Revokes a OneGraph access token, refresh token, or JWT. After a token is destroyed, it can no longer be used to authenticate with OneGraph. + +If you destroy a JWT, external services that rely on the claims embedded in the JWT may still accept the JWT and you will also have to revoke the JWT though the external service's revocation process. + */ +destroyToken: boolean; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Delete a OneGraph personal token for a user's site + */ + export function executeDestroyTokenMutation ( + variables: DestroyTokenMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type SignOutServicesMutationInput = { + \\"services\\": Array<\\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\">; +\\"nfToken\\": string; +\\"authlifyTokenId\\": string +}; + + export type SignOutServicesMutation = { + /** + * Any data from the function will be returned here + */ +data: { + signoutServices: { + me: { + /** + * Metadata and logged-in state for all OneGraph services + */ +serviceMetadata: { + loggedInServices: Array; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Sign out of a service associated with a Authlify token + */ + export function executeSignOutServicesMutation ( + variables: SignOutServicesMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type AddAuthsMutationInput = { + \\"siteId\\": string; +\\"authlifyTokenId\\"?: string; + /** + * Token that will be destroyed and have its auths moved to the personal token. + */ + \\"sToken\\": string; +\\"nfToken\\": string +}; + + export type AddAuthsMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + addAuthsToPersonalToken: { + /** + * Personal access token that was updated by this mutation + */ +accessToken: { + /** + * Netlify-specific ID for the token + */ +netlifyId?: string; + /** + * Bearer token + */ +token: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Update a service's (i.e. GitHub) enabled scope permissions + */ + export function executeAddAuthsMutation ( + variables: AddAuthsMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CreateNewSchemaMutationInput = { + \\"nfToken\\": string; +\\"input\\": {/** + * Whether to set this schema as the default for the app. Defaults to false. + */ + \\"setAsDefaultForApp\\"?: boolean; /** + * External GraphQL schemas to add + */ + \\"externalGraphQLSchemas\\"?: Array<{/** + * The id of the external GraphQL schema. + */ + \\"externalGraphQLSchemaId\\": string}>; /** + * Optional id of a Salesforce schema to attach to the app. + */ + \\"salesforceSchemaId\\"?: string; /** + * The optional id of the GraphQL schema that this was derived from. + */ + \\"parentId\\"?: string; /** + * The list of services that this schema should use. Leave blank if you want to add support for all supported services. + */ + \\"enabledServices\\"?: Array<\\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\">; /** + * The id of the app that the schema should belong to. + */ + \\"appId\\": string} +}; + + export type CreateNewSchemaMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + createGraphQLSchema: { + app: { + /** + * Customizations to the default GraphQL schema + */ +graphQLSchema?: { + id: string; +}; +}; + graphqlSchema: { + id: string; + services: Array<{ + friendlyServiceName: string; + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + /** + * Service string that can be provided in the URL when going through the oauth flow. + */ +slug: string; + supportsCustomRedirectUri: boolean; + supportsCustomServiceAuth: boolean; + supportsOauthLogin: boolean; +}>; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use. + */ + export function executeCreateNewSchemaMutation ( + variables: CreateNewSchemaMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type DeleteServiceAuthMutationInput = { + \\"siteId\\": string; +\\"serviceAuthId\\": string; +\\"nfToken\\": string +}; + + export type DeleteServiceAuthMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + destroyServiceAuth: { + app: { + /** + * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app + */ +serviceAuths: Array; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Delete a custom service auth + */ + export function executeDeleteServiceAuthMutation ( + variables: DeleteServiceAuthMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CreatePersistedQueryMutationInput = { + \\"nfToken\\": string; +\\"appId\\": string; +\\"query\\": string; + /** + * List of tags to add to the persisted query. Tags are free-form text that can be used to categorize persisted queries. Each tag must be under 256 characters and there can be a maximum of 10 tags on a single persisted query. + */ + \\"tags\\": Array; + /** + * A description for the persisted query. Maximum length is 2096 characters. + */ + \\"description\\": string; + /** + * The parent persisted query. It can be used to track lineage of the query. + */ + \\"parent\\"?: {/** + * An optional list of tags to remove from the parent query. If any of the provided tags aren't present on the parent, the mutation will fail. No persisted queries will be created and no tags will be removed from the parent. + */ + \\"removeTags\\"?: Array; /** + * The id of the parent + */ + \\"id\\": string} +}; + + export type CreatePersistedQueryMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + createPersistedQuery: { + persistedQuery: { + /** + * The persisted query's id. + */ +id: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution. + */ + export function executeCreatePersistedQueryMutation ( + variables: CreatePersistedQueryMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type FindLoggedInServicesQueryInput = { + \\"nfToken\\": string; +\\"authlifyTokenId\\": string +}; + + export type FindLoggedInServicesQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + authlifyToken: { + /** + * Metadata and logged-in state for all OneGraph services + */ +serviceMetadata: { + loggedInServices: Array; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site + */ + export function fetchFindLoggedInServicesQuery( + variables: FindLoggedInServicesQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type SetServiceAuthMutationInput = { + \\"service\\": \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\"; +\\"clientId\\": string; +\\"clientSecret\\": string; +\\"siteId\\": string; +\\"nfToken\\": string +}; + + export type SetServiceAuthMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + createServiceAuth: { + app: { + /** + * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app + */ +serviceAuths: Array; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Create a custom service auth + */ + export function executeSetServiceAuthMutation ( + variables: SetServiceAuthMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CreateCLISessionEventMutationInput = { + \\"nfToken\\": string; +\\"sessionId\\": string; +\\"payload\\": unknown +}; + + export type CreateCLISessionEventMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + createNetlifyCliTestEvent: { + event: { + id: string; + createdAt: string; + sessionId: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Create a new session for the Netlify CLI to communicate with the React UI via events. + */ + export function executeCreateCLISessionEventMutation ( + variables: CreateCLISessionEventMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CliSessionByIdQueryInput = { + \\"nfToken\\": string; +\\"id\\": string +}; + + export type CliSessionByIdQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Get a Netlify CLI session by its id. + */ +netlifyCliSession: { + id: string; + name?: string; + netlifyUserId: string; + events: Array<{ + createdAt: string; +}>; + createdAt: string; + lastEventAt?: string; + metadata?: unknown; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Get a Netlify CLI session by its id + */ + export function fetchCliSessionByIdQuery( + variables: CliSessionByIdQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + + + export type Deprecated_FindLoggedInServicesQuery = { + /** + * Any data from the function will be returned here + */ +data: { + me: { + /** + * Metadata and logged-in state for all OneGraph services + */ +serviceMetadata: { + loggedInServices: Array; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * (Deprecated) Find logged in services + */ + export function fetchDeprecated_FindLoggedInServicesQuery( + /** + * Pass \`{}\` as no variables are defined for this function. + */ + variables: Record, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CreateEmptyPersonalTokenMutationInput = { + \\"nfToken\\": string; +\\"siteId\\": string +}; + + export type CreateEmptyPersonalTokenMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Creates an empty personal token with a Netlify site anchor + */ +createPersonalTokenWithNetlifySiteAnchor: { + /** + * Personal access token that was created by this mutation + */ +accessToken: { + /** + * Bearer token + */ +token: string; + /** + * Token name, if it is a personal access token + */ +name?: string; + /** + * The anchor is like two-factor auth for the token. It ensures that the person who adds auth to the token is the same as the person who created the token. + */ +anchor?: \\"ONEGRAPH_USER\\" | \\"NETLIFY_USER\\" | \\"NETLIFY_SITE\\"; + /** + * Netlify-specific ID for the token + */ +netlifyId?: string; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Create a new OneGraph personal token for a user's site + */ + export function executeCreateEmptyPersonalTokenMutation ( + variables: CreateEmptyPersonalTokenMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type ServiceListQueryInput = { + \\"logoStyle\\"?: \\"DEFAULT\\" | \\"ROUNDED_RECTANGLE\\" +}; + + export type ServiceListQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + services: Array<{ + friendlyServiceName: string; + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + /** + * Service string that can be provided in the URL when going through the oauth flow. + */ +slug: string; + supportsCustomRedirectUri: boolean; + supportsCustomServiceAuth: boolean; + supportsOauthLogin: boolean; +}>; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Retrieve a list of _all_ supported services from OneGraph + */ + export function fetchServiceListQuery( + variables: ServiceListQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type AuthlifyTokenIdForPersonalTokenInput = { + \\"personalToken\\": string +}; + + export type AuthlifyTokenIdForPersonalToken = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Personal access token lookup + */ +personalToken?: { + /** + * Netlify-specific ID for the token + */ +netlifyId?: string; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * + */ + export function fetchAuthlifyTokenIdForPersonalToken( + variables: AuthlifyTokenIdForPersonalTokenInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type PersistedQueryQueryInput = { + \\"nfToken\\": string; + /** + * The id of the app that the persisted query belongs to. + */ + \\"appId\\": string; + /** + * The id of the persisted query. + */ + \\"id\\": string +}; + + export type PersistedQueryQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Fetch a single persisted query by its id. + */ +persistedQuery: { + /** + * The persisted query's id. + */ +id: string; + /** + * The persisted query's query string. + */ +query: string; + /** + * The list of operation names that the caller of the query is allowed to execute. If the field is null, then all operationNames are allowed. + */ +allowedOperationNames?: Array; + /** + * The user-defined description that was added to the query + */ +description?: string; + /** + * The list of variables that the caller of the query is allowed to provide. + */ +freeVariables?: Array; + /** + * The default variables provided to the query. + */ +fixedVariables?: unknown; + /** + * The list of user-defined tags that were added to the query + */ +tags?: Array; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Retrieve a previously persisted operations doc + */ + export function fetchPersistedQueryQuery( + variables: PersistedQueryQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CliSessionsByAppIdQueryInput = { + \\"nfToken\\": string; +\\"appId\\": string +}; + + export type CliSessionsByAppIdQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + /** + * Netlify CLI sessions, orderd by createdAt descending. + */ +netlifyCliSessionsByAppId: Array<{ + id: string; + name?: string; + netlifyUserId: string; + events: Array<{ + createdAt: string; +}>; + createdAt: string; + lastEventAt?: string; + metadata?: unknown; +}>; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * List all the CLI sessions belonging to a site + */ + export function fetchCliSessionsByAppIdQuery( + variables: CliSessionsByAppIdQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type ListServicesQueryInput = { + \\"nfToken\\": string; + /** + * App id + */ + \\"siteId\\": string; +\\"logoStyle\\"?: \\"DEFAULT\\" | \\"ROUNDED_RECTANGLE\\" +}; + + export type ListServicesQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + services: Array<{ + friendlyServiceName: string; + service: \\"ADROLL\\" | \\"ASANA\\" | \\"BOX\\" | \\"CONTENTFUL\\" | \\"DEV_TO\\" | \\"DOCUSIGN\\" | \\"DRIBBBLE\\" | \\"DROPBOX\\" | \\"EGGHEADIO\\" | \\"EVENTIL\\" | \\"FACEBOOK\\" | \\"FIREBASE\\" | \\"GITHUB\\" | \\"GMAIL\\" | \\"GONG\\" | \\"GOOGLE\\" | \\"GOOGLE_ADS\\" | \\"GOOGLE_ANALYTICS\\" | \\"GOOGLE_CALENDAR\\" | \\"GOOGLE_COMPUTE\\" | \\"GOOGLE_DOCS\\" | \\"GOOGLE_SEARCH_CONSOLE\\" | \\"GOOGLE_TRANSLATE\\" | \\"HUBSPOT\\" | \\"INTERCOM\\" | \\"MAILCHIMP\\" | \\"MEETUP\\" | \\"NETLIFY\\" | \\"NOTION\\" | \\"OUTREACH\\" | \\"PRODUCT_HUNT\\" | \\"QUICKBOOKS\\" | \\"SALESFORCE\\" | \\"SANITY\\" | \\"SLACK\\" | \\"SPOTIFY\\" | \\"STRIPE\\" | \\"TRELLO\\" | \\"TWILIO\\" | \\"TWITTER\\" | \\"TWITCH_TV\\" | \\"YNAB\\" | \\"YOUTUBE\\" | \\"ZEIT\\" | \\"ZENDESK\\" | \\"AIRTABLE\\" | \\"APOLLO\\" | \\"BREX\\" | \\"BUNDLEPHOBIA\\" | \\"CHARGEBEE\\" | \\"CLEARBIT\\" | \\"CLOUDFLARE\\" | \\"CRUNCHBASE\\" | \\"DESCURI\\" | \\"FEDEX\\" | \\"GOOGLE_MAPS\\" | \\"GRAPHCMS\\" | \\"IMMIGRATION_GRAPH\\" | \\"LOGDNA\\" | \\"MIXPANEL\\" | \\"MUX\\" | \\"NPM\\" | \\"ONEGRAPH\\" | \\"ORBIT\\" | \\"OPEN_COLLECTIVE\\" | \\"RSS\\" | \\"UPS\\" | \\"USPS\\" | \\"WORDPRESS\\"; + /** + * Service string that can be provided in the URL when going through the oauth flow. + */ +slug: string; + /** + * A short-lived svg image url of the logo for the service. May be null. + */ +logoUrl?: string; + availableScopes?: Array<{ + category?: string; + scope: string; + display: string; + isDefault: boolean; + isRequired: boolean; + description: string; + title?: string; +}>; +}>; + app: { + /** + * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app + */ +serviceAuths: Array; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site. + */ + export function fetchListServicesQuery( + variables: ListServicesQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type UpsertAppForSiteMutationInput = { + \\"nfToken\\": string; +\\"siteId\\": string +}; + + export type UpsertAppForSiteMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + upsertAppForNetlifySite: { + /** + * The app that is associated with the Netlify account. + */ +org: { + /** + * The id of the OneGraph Org + */ +id: string; + /** + * The name of the OneGraph Org + */ +name: string; +}; + /** + * The app that is associated with the Netlify site. + */ +app: { + /** + * The id of the OneGraph App + */ +id: string; + /** + * The name of the OneGraph App + */ +name: string; + /** + * The origins allowed for this OneGraph App from CORS requests + */ +corsOrigins: Array; + /** + * Custom cors origins + */ +customCorsOrigins: Array<{ + /** + * The friendly service name for the cors origin + */ +friendlyServiceName: string; + /** + * The name of the origin that should be displayed, e.g. oneblog for oneblog.netlify.app. + */ +displayName: string; + /** + * The encoded value as a string, used to remove the custom cors origin. + */ +encodedValue: string; +}>; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Ensure that an app resource exists on the OneGraph servers for a given site. + */ + export function executeUpsertAppForSiteMutation ( + variables: UpsertAppForSiteMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type AddCORSOriginMutationInput = { + \\"nfToken\\": string; +\\"input\\": {\\"corsOrigin\\": string; \\"appId\\": string} +}; + + export type AddCORSOriginMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + addCORSOriginToApp: { + app: AppCORSOriginFragment ; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Add additional allowed CORS origins for calls to a site's Graph. + */ + export function executeAddCORSOriginMutation ( + variables: AddCORSOriginMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type RemoveCORSOriginMutationInput = { + \\"nfToken\\": string; +\\"input\\": {\\"corsOrigin\\": string; \\"appId\\": string} +}; + + export type RemoveCORSOriginMutation = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + removeCORSOriginFromApp: { + app: AppCORSOriginFragment ; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * Remove the given CORS origins for calls to a site's Graph. + */ + export function executeRemoveCORSOriginMutation ( + variables: RemoveCORSOriginMutationInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +export type CORSOriginsQueryInput = { + /** + * App id + */ + \\"siteId\\": string; +\\"nfToken\\": string +}; + + export type CORSOriginsQuery = { + /** + * Any data from the function will be returned here + */ +data: { + oneGraph: { + app: AppCORSOriginFragment ; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +}; + + /** + * List the allowed CORS origins for calls to a site's Graph. + */ + export function fetchCORSOriginsQuery( + variables: CORSOriginsQueryInput, + options?: NetlifyGraphFunctionOptions + ): Promise; + +/** + * A subscription with variables and a fragment to test code generation. + */ + export function subscribeToTestSubscription( + /** + * This will be available in your webhook handler as a query parameter. + * Use this to keep track of which subscription you're receiving + * events for. + */ + variables: { + /** + * How many minutes to wait before re-running the underlying query + */ + \\"minutes\\"?: number +}, + options?: { + /** + * The accessToken to use for the lifetime of the subscription. + */ + accessToken?: string | null | undefined; + /** + * A string id that will be passed to your webhook handler as a query parameter + * along with each event. + * This can be used to keep track of which subscription you're receiving + */ + netlifyGraphWebhookId?: string | null | undefined; + /** + * The absolute URL of your webhook handler to handle events from this subscription. + */ + webhookUrl?: string | null | undefined; + /** + * The secret to use when signing the webhook request. Use this to verify + * that the webhook payload is coming from Netlify Graph. Defaults to the + * value of the NETLIFY_GRAPH_WEBHOOK_SECRET environment variable. + */ + webhookSecret?: string | null | undefined; + }) : void + + export type TestSubscriptionEvent = { + /** + * Any data from the function will be returned here + */ +data: { + poll: { + query: { + me: { + /** + * Metadata and logged-in state for all OneGraph services + */ +serviceMetadata: { + loggedInServices: Array>; +}; +}; +}; +}; +}; + /** + * Any errors from the function will be returned here + */ +errors?: Array; +} + + /** + * Verify the TestSubscription event body is signed securely, and then parse the result. + */ + export function parseAndVerifyTestSubscriptionEvent (/** A Netlify Handler Event */ event : WebhookEvent) : null | TestSubscriptionEvent + + + export interface Functions { + /** + * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`). + */ + executeUpdateCLISessionMetadataMutation : typeof executeUpdateCLISessionMetadataMutation , + /** + * Get the _metadata_ about a site's current GraphQL schema: +* +* - enabled services +* - schema id +* - creation date +* +* etc. + */ + fetchAppSchemaQuery: typeof fetchAppSchemaQuery, + /** + * Delete a OneGraph personal token for a user's site + */ + executeDestroyTokenMutation : typeof executeDestroyTokenMutation , + /** + * Sign out of a service associated with a Authlify token + */ + executeSignOutServicesMutation : typeof executeSignOutServicesMutation , + /** + * Update a service's (i.e. GitHub) enabled scope permissions + */ + executeAddAuthsMutation : typeof executeAddAuthsMutation , + /** + * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use. + */ + executeCreateNewSchemaMutation : typeof executeCreateNewSchemaMutation , + /** + * Delete a custom service auth + */ + executeDeleteServiceAuthMutation : typeof executeDeleteServiceAuthMutation , + /** + * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution. + */ + executeCreatePersistedQueryMutation : typeof executeCreatePersistedQueryMutation , + /** + * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site + */ + fetchFindLoggedInServicesQuery: typeof fetchFindLoggedInServicesQuery, + /** + * Create a custom service auth + */ + executeSetServiceAuthMutation : typeof executeSetServiceAuthMutation , + /** + * Create a new session for the Netlify CLI to communicate with the React UI via events. + */ + executeCreateCLISessionEventMutation : typeof executeCreateCLISessionEventMutation , + /** + * Get a Netlify CLI session by its id + */ + fetchCliSessionByIdQuery: typeof fetchCliSessionByIdQuery, + /** + * (Deprecated) Find logged in services + */ + fetchDeprecated_FindLoggedInServicesQuery: typeof fetchDeprecated_FindLoggedInServicesQuery, + /** + * Create a new OneGraph personal token for a user's site + */ + executeCreateEmptyPersonalTokenMutation : typeof executeCreateEmptyPersonalTokenMutation , + /** + * Retrieve a list of _all_ supported services from OneGraph + */ + fetchServiceListQuery: typeof fetchServiceListQuery, + /** + * + */ + fetchAuthlifyTokenIdForPersonalToken: typeof fetchAuthlifyTokenIdForPersonalToken, + /** + * Retrieve a previously persisted operations doc + */ + fetchPersistedQueryQuery: typeof fetchPersistedQueryQuery, + /** + * List all the CLI sessions belonging to a site + */ + fetchCliSessionsByAppIdQuery: typeof fetchCliSessionsByAppIdQuery, + /** + * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site. + */ + fetchListServicesQuery: typeof fetchListServicesQuery, + /** + * Ensure that an app resource exists on the OneGraph servers for a given site. + */ + executeUpsertAppForSiteMutation : typeof executeUpsertAppForSiteMutation , + /** + * Add additional allowed CORS origins for calls to a site's Graph. + */ + executeAddCORSOriginMutation : typeof executeAddCORSOriginMutation , + /** + * Remove the given CORS origins for calls to a site's Graph. + */ + executeRemoveCORSOriginMutation : typeof executeRemoveCORSOriginMutation , + /** + * List the allowed CORS origins for calls to a site's Graph. + */ + fetchCORSOriginsQuery: typeof fetchCORSOriginsQuery, + /** + * A subscription with variables and a fragment to test code generation. + */ + subscribeToTestSubscription:subscribeToTestSubscription, + /** + * Verify the event body is signed securely, and then parse the result. + */ + parseAndVerifyTestSubscriptionEvent: typeof parseAndVerifyTestSubscriptionEvent + } + + export const functions: Functions; + + export default functions; + " +`; + +exports[`netlify graph function library runtime codegen library [netlify-builtin:serverless-0.0.1]:./dummy/index.js} 1`] = ` +"/* eslint-disable */ + // @ts-nocheck + // GENERATED VIA NETLIFY AUTOMATED DEV TOOLS, EDIT WITH CAUTION! + + // Basic LRU cache implementation + const makeLRUCache = (max) => { + return { max: max, cache: new Map() }; + }; + + const oldestCacheKey = (lru) => { + return lru.keys().next().value + } + + // Depend on Map keeping track of insertion order + const getFromCache = (lru, key) => { + const item = lru.cache.get(key); + if (item) { + // Delete key and re-insert so key is now at the end, + // and now the last to be gc'd. + lru.cache.delete(key); + lru.cache.set(key, item); + } + return item; + }; + + const setInCache = (lru, key, value) => { + if (lru.cache.has(key)) { + lru.cache.delete(key); + } + if (lru.cache.size == lru.max) { + const cacheKey = oldestCacheKey(lru); + + if (cacheKey) { + lru.cache.delete(cacheKey); + } + } + + lru.cache.set(key, value); + }; + + // Cache the results of the Netlify Graph API for conditional requests + const cache = makeLRUCache(100); + + const calculateCacheKey = (payload) => { + return JSON.stringify(payload); + }; + + const schemaId = 'stable-schema-id'; + + const netlifyGraphHostWithProtocol = + process.env.NETLIFY_GRAPH_HOST_WITH_PROTOCOL || 'https://graph.netlify.com'; + + const makeNetlifyGraphUrl = ({ operationName, siteId }) => { + return ( + netlifyGraphHostWithProtocol + + '/graphql?app_id=' + + siteId + + '&operationName=' + + operationName + + '&schema_id=' + + schemaId + ); + }; + + const httpFetch = (operationName, options) => { + const reqBody = options.body || null; + const userHeaders = options.headers || {}; + const headers = { + ...userHeaders, + 'Content-Type': 'application/json', + }; + + const timeoutMs = 30_000; + + const reqOptions = { + method: 'POST', + headers: headers, + timeout: timeoutMs, + body: reqBody, + }; + + const siteId = options.siteId || process.env.SITE_ID; + const netlifyGraphUrl = makeNetlifyGraphUrl({ operationName: operationName, siteId: siteId }); + + return fetch(netlifyGraphUrl, reqOptions).then((body) => { + return body.text().then((bodyString) => { + const headers = {}; + body.headers.forEach((k, v) => (headers[k] = v)); + + return { + body: bodyString, + headers: headers, + status: body.status, + }; + }); + }); + }; + + const fetchNetlifyGraph = function fetchNetlifyGraph(input) { + const query = input.query; + const docId = input.doc_id; + const operationName = input.operationName; + const variables = input.variables; + + const options = input.options || {}; + const accessToken = options.accessToken; + + const payload = { + query: query, + doc_id: docId, + variables: variables, + operationName: operationName, + }; + + let cachedOrLiveValue = new Promise((resolve) => { + const cacheKey = calculateCacheKey(payload); + + // Check the cache for a previous result + const cachedResultPair = getFromCache(cache, cacheKey); + + let conditionalHeaders = { + 'If-None-Match': '', + }; + let cachedResultValue; + + if (cachedResultPair) { + const [etag, previousResult] = cachedResultPair; + conditionalHeaders = { + 'If-None-Match': etag, + }; + cachedResultValue = previousResult; + } + + const response = httpFetch(operationName, { + ...options, + method: 'POST', + headers: { + ...conditionalHeaders, + Authorization: accessToken ? 'Bearer ' + accessToken : '', + }, + body: JSON.stringify(payload), + }); + + response.then((result) => { + // Check response headers for a 304 Not Modified + if (result.status === 304) { + // Return the cached result + resolve(cachedResultValue); + } else if (result.status === 200) { + // Update the cache with the new etag and result + const etag = result.headers['etag']; + const resultJson = JSON.parse(result.body); + if (etag) { + // Make a note of the new etag for the given payload + setInCache(cache, cacheKey, [etag, resultJson]); + } + resolve(resultJson); + } else { + return result.json().then((json) => { + resolve(json); + }); + } + }); + }); + + return cachedOrLiveValue; + }; + + export const executeUpdateCLISessionMetadataMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation UpdateCLISessionMetadataMutation($nfToken: String!, $sessionId: String!, $metadata: JSON!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + updateNetlifyCliSession(input: {id: $sessionId, metadata: $metadata}) { + session { + id + name + metadata + createdAt + lastEventAt + } + } + } +}\`, + operationName: \\"UpdateCLISessionMetadataMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchAppSchemaQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query AppSchemaQuery($nfToken: String!, $appId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + app(id: $appId) { + graphQLSchema { + appId + createdAt + id + services { + friendlyServiceName + logoUrl + service + slug + supportsCustomRedirectUri + supportsCustomServiceAuth + supportsOauthLogin + } + updatedAt + } + } + } +}\`, + operationName: \\"AppSchemaQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeDestroyTokenMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation DestroyTokenMutation($nfToken: String!, $token: String, $authlifyTokenId: String) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + destroyToken(token: $token, authlifyTokenId: $authlifyTokenId) + } +}\`, + operationName: \\"DestroyTokenMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeSignOutServicesMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation SignOutServicesMutation($services: [OneGraphServiceEnum!]!, $nfToken: String!, $authlifyTokenId: String!) { + signoutServices( + data: {services: $services, anchorAuth: {netlifyAuth: {oauthToken: $nfToken}}, authlifyTokenId: $authlifyTokenId} + ) { + me { + serviceMetadata { + loggedInServices { + ...LoggedInServicesFragment + } + } + } + } +} + +fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: \\"\\"\\"12b5bdea-9bab-4124-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Subset of LoggedInServices\\"\\"\\") { + friendlyServiceName + service + isLoggedIn + usedTestFlow + serviceInfo { + logoUrl + availableScopes { + category + scope + display + isDefault + isRequired + description + title + } + } + grantedScopes { + scope + } + foreignUserId +}\`, + operationName: \\"SignOutServicesMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeAddAuthsMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation AddAuthsMutation($siteId: String!, $authlifyTokenId: String, $sToken: String!, $nfToken: String!) { + oneGraph { + addAuthsToPersonalToken( + input: {anchorAuth: {netlifyAuth: {oauthToken: $nfToken}}, sacrificialToken: $sToken, authlifyTokenId: $authlifyTokenId, appId: $siteId} + ) { + accessToken { + netlifyId + token + } + } + } +}\`, + operationName: \\"AddAuthsMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeCreateNewSchemaMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation CreateNewSchemaMutation($nfToken: String!, $input: OneGraphCreateGraphQLSchemaInput!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createGraphQLSchema(input: $input) { + app { + graphQLSchema { + id + } + } + graphqlSchema { + id + services { + friendlyServiceName + logoUrl + service + slug + supportsCustomRedirectUri + supportsCustomServiceAuth + supportsOauthLogin + } + } + } + } +}\`, + operationName: \\"CreateNewSchemaMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeDeleteServiceAuthMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation DeleteServiceAuthMutation($siteId: String!, $serviceAuthId: String!, $nfToken: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + destroyServiceAuth(data: {appId: $siteId, serviceAuthId: $serviceAuthId}) { + app { + serviceAuths { + ...ServiceAuthFragment + } + } + } + } +} + +fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: \\"\\"\\"12b5bdea-9bab-4164-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Basic info on a Service Auth\\"\\"\\") { + id + service + clientId + revealTokens + scopes +}\`, + operationName: \\"DeleteServiceAuthMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeCreatePersistedQueryMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation CreatePersistedQueryMutation($nfToken: String!, $appId: String!, $query: String!, $tags: [String!]!, $description: String!, $parent: OneGraphCreatePersistedQueryParentInput) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createPersistedQuery( + input: {query: $query, appId: $appId, tags: $tags, description: $description, parent: $parent} + ) { + persistedQuery { + id + } + } + } +}\`, + operationName: \\"CreatePersistedQueryMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchFindLoggedInServicesQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query FindLoggedInServicesQuery($nfToken: String!, $authlifyTokenId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + authlifyToken(authlifyTokenId: $authlifyTokenId) { + serviceMetadata { + loggedInServices { + usedTestFlow + friendlyServiceName + ...LoggedInServicesFragment + } + } + } + } +} + +fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: \\"\\"\\"12b5bdea-9bab-4124-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Subset of LoggedInServices\\"\\"\\") { + friendlyServiceName + service + isLoggedIn + usedTestFlow + serviceInfo { + logoUrl + availableScopes { + category + scope + display + isDefault + isRequired + description + title + } + } + grantedScopes { + scope + } + foreignUserId +}\`, + operationName: \\"FindLoggedInServicesQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeSetServiceAuthMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation SetServiceAuthMutation($service: OneGraphCustomServiceAuthServiceEnum!, $clientId: String!, $clientSecret: String!, $siteId: String!, $nfToken: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createServiceAuth( + data: {service: $service, clientId: $clientId, clientSecret: $clientSecret, appId: $siteId, revealTokens: true} + ) { + app { + serviceAuths { + ...ServiceAuthFragment + } + } + } + } +} + +fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: \\"\\"\\"12b5bdea-9bab-4164-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Basic info on a Service Auth\\"\\"\\") { + id + service + clientId + revealTokens + scopes +}\`, + operationName: \\"SetServiceAuthMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeCreateCLISessionEventMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation CreateCLISessionEventMutation($nfToken: String!, $sessionId: String!, $payload: JSON!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createNetlifyCliTestEvent( + input: {data: {payload: $payload}, sessionId: $sessionId} + ) { + event { + id + createdAt + sessionId + } + } + } +}\`, + operationName: \\"CreateCLISessionEventMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchCliSessionByIdQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query CliSessionByIdQuery($nfToken: String!, $id: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + netlifyCliSession(id: $id) { + id + name + netlifyUserId + events { + createdAt + } + createdAt + lastEventAt + metadata + } + } +}\`, + operationName: \\"CliSessionByIdQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchDeprecated_FindLoggedInServicesQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query Deprecated_FindLoggedInServicesQuery { + me { + serviceMetadata { + loggedInServices { + ...LoggedInServicesFragment + } + } + } +} + +fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: \\"\\"\\"12b5bdea-9bab-4124-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Subset of LoggedInServices\\"\\"\\") { + friendlyServiceName + service + isLoggedIn + usedTestFlow + serviceInfo { + logoUrl + availableScopes { + category + scope + display + isDefault + isRequired + description + title + } + } + grantedScopes { + scope + } + foreignUserId +}\`, + operationName: \\"Deprecated_FindLoggedInServicesQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeCreateEmptyPersonalTokenMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation CreateEmptyPersonalTokenMutation($nfToken: String!, $siteId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + createPersonalTokenWithNetlifySiteAnchor( + input: {name: \\"Netlify AuthManager Token\\", netlifySiteId: $siteId} + ) { + accessToken { + token + name + anchor + netlifyId + } + } + } +}\`, + operationName: \\"CreateEmptyPersonalTokenMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchServiceListQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query ServiceListQuery($logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) { + oneGraph { + services { + friendlyServiceName + logoUrl(style: $logoStyle) + service + slug + supportsCustomRedirectUri + supportsCustomServiceAuth + supportsOauthLogin + } + } +}\`, + operationName: \\"ServiceListQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchAuthlifyTokenIdForPersonalToken = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query AuthlifyTokenIdForPersonalToken($personalToken: String!) { + oneGraph { + personalToken(accessToken: $personalToken) { + netlifyId + } + } +}\`, + operationName: \\"AuthlifyTokenIdForPersonalToken\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchPersistedQueryQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query PersistedQueryQuery($nfToken: String!, $appId: String!, $id: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + persistedQuery(appId: $appId, id: $id) { + id + query + allowedOperationNames + description + freeVariables + fixedVariables + tags + } + } +}\`, + operationName: \\"PersistedQueryQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchCliSessionsByAppIdQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query CliSessionsByAppIdQuery($nfToken: String!, $appId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + netlifyCliSessionsByAppId(appId: $appId, first: 10) { + id + name + netlifyUserId + events { + createdAt + } + createdAt + lastEventAt + metadata + } + } +}\`, + operationName: \\"CliSessionsByAppIdQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchListServicesQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query ListServicesQuery($nfToken: String!, $siteId: String!, $logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + services(filter: {supportsOauthLogin: true}) { + friendlyServiceName + service + slug + logoUrl(style: $logoStyle) + availableScopes { + category + scope + display + isDefault + isRequired + description + title + } + } + app(id: $siteId) { + serviceAuths { + ...ServiceAuthFragment + } + } + } +} + +fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: \\"\\"\\"12b5bdea-9bab-4164-a731-5e697b1553be\\"\\"\\", doc: \\"\\"\\"Basic info on a Service Auth\\"\\"\\") { + id + service + clientId + revealTokens + scopes +}\`, + operationName: \\"ListServicesQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeUpsertAppForSiteMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation UpsertAppForSiteMutation($nfToken: String!, $siteId: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + upsertAppForNetlifySite(input: {netlifySiteId: $siteId}) { + org { + id + name + } + app { + id + name + corsOrigins + customCorsOrigins { + friendlyServiceName + displayName + encodedValue + } + } + } + } +}\`, + operationName: \\"UpsertAppForSiteMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeAddCORSOriginMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation AddCORSOriginMutation($nfToken: String!, $input: OneGraphAddCORSOriginToAppInput!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + addCORSOriginToApp(input: $input) { + app { + ...AppCORSOriginFragment + } + } + } +} + +fragment AppCORSOriginFragment on OneGraphApp @netlify(id: \\"\\"\\"e3d4bb8b-2fb5-48d8-b051-db6027224145\\"\\"\\", doc: \\"\\"\\"Allowed CORS origins for calls to a site's Graph.\\"\\"\\") { + id + corsOrigins + customCorsOrigins { + friendlyServiceName + displayName + encodedValue + } + netlifySiteNames +}\`, + operationName: \\"AddCORSOriginMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const executeRemoveCORSOriginMutation = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`mutation RemoveCORSOriginMutation($nfToken: String!, $input: OneGraphRemoveCORSOriginFromAppInput!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + removeCORSOriginFromApp(input: $input) { + app { + ...AppCORSOriginFragment + } + } + } +} + +fragment AppCORSOriginFragment on OneGraphApp @netlify(id: \\"\\"\\"e3d4bb8b-2fb5-48d8-b051-db6027224145\\"\\"\\", doc: \\"\\"\\"Allowed CORS origins for calls to a site's Graph.\\"\\"\\") { + id + corsOrigins + customCorsOrigins { + friendlyServiceName + displayName + encodedValue + } + netlifySiteNames +}\`, + operationName: \\"RemoveCORSOriginMutation\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +export const fetchCORSOriginsQuery = ( + variables, + options + ) => { + return fetchNetlifyGraph({ + query: \`query CORSOriginsQuery($siteId: String!, $nfToken: String!) { + oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) { + app(id: $siteId) { + ...AppCORSOriginFragment + } + } +} + +fragment AppCORSOriginFragment on OneGraphApp @netlify(id: \\"\\"\\"e3d4bb8b-2fb5-48d8-b051-db6027224145\\"\\"\\", doc: \\"\\"\\"Allowed CORS origins for calls to a site's Graph.\\"\\"\\") { + id + corsOrigins + customCorsOrigins { + friendlyServiceName + displayName + encodedValue + } + netlifySiteNames +}\`, + operationName: \\"CORSOriginsQuery\\", + variables: variables, + options: options, + fetchStrategy: \\"POST\\", + }); + } + + +const subscribeToTestSubscription = ( + variables, + rawOptions + ) => { + const options = rawOptions || {}; + const netlifyGraphWebhookId = options.netlifyGraphWebhookId; + const netlifyGraphWebhookUrl = options.webhookUrl || \`\${process.env.DEPLOY_URL}/webhooks/TestSubscription?netlifyGraphWebhookId=\${netlifyGraphWebhookId}\`; + const secret = options.webhookSecret || process.env.NETLIFY_GRAPH_WEBHOOK_SECRET + const fullVariables = {...variables, netlifyGraphWebhookUrl: netlifyGraphWebhookUrl, netlifyGraphWebhookSecret: { hmacSha256Key: secret }} + + const subscriptionOperationDoc = \`subscription TestSubscription($minutes: Int = 1, $netlifyGraphWebhookUrl: String!, $netlifyGraphWebhookSecret: OneGraphSubscriptionSecretInput!) @netlify(id: \\"\\"\\"e3d4bb8b-2fb5-9898-b051-db6027224112\\"\\"\\", doc: \\"\\"\\"A subscription with variables and a fragment to test code generation.\\"\\"\\") { + poll( + schedule: {every: {minutes: $minutes}} + onlyTriggerWhenPayloadChanged: true + webhookUrl: $netlifyGraphWebhookUrl + secret: $netlifyGraphWebhookSecret + ) { + query { + me { + serviceMetadata { + loggedInServices { + ...LoggedInServicesFragment + } + } + } + } + } +}\`; + + fetchNetlifyGraph({ + query: subscriptionOperationDoc, + operationName: \\"TestSubscription\\", + variables: fullVariables, + options: options, + fetchStrategy: \\"POST\\", + }) + } + + const parseAndVerifyTestSubscriptionEvent = (event, options) => { + if (!verifyRequestSignature({ event: event }, options)) { + console.warn(\\"Unable to verify signature for TestSubscription\\") + return null + } + + return JSON.parse(event.body || '{}') + } + + /** + * The generated NetlifyGraph library with your operations + */ + const functions = { + /** + * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`). + */ + executeUpdateCLISessionMetadataMutation : executeUpdateCLISessionMetadataMutation , + /** + * Get the _metadata_ about a site's current GraphQL schema: +* +* - enabled services +* - schema id +* - creation date +* +* etc. + */ + fetchAppSchemaQuery: fetchAppSchemaQuery, + /** + * Delete a OneGraph personal token for a user's site + */ + executeDestroyTokenMutation : executeDestroyTokenMutation , + /** + * Sign out of a service associated with a Authlify token + */ + executeSignOutServicesMutation : executeSignOutServicesMutation , + /** + * Update a service's (i.e. GitHub) enabled scope permissions + */ + executeAddAuthsMutation : executeAddAuthsMutation , + /** + * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use. + */ + executeCreateNewSchemaMutation : executeCreateNewSchemaMutation , + /** + * Delete a custom service auth + */ + executeDeleteServiceAuthMutation : executeDeleteServiceAuthMutation , + /** + * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution. + */ + executeCreatePersistedQueryMutation : executeCreatePersistedQueryMutation , + /** + * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site + */ + fetchFindLoggedInServicesQuery: fetchFindLoggedInServicesQuery, + /** + * Create a custom service auth + */ + executeSetServiceAuthMutation : executeSetServiceAuthMutation , + /** + * Create a new session for the Netlify CLI to communicate with the React UI via events. + */ + executeCreateCLISessionEventMutation : executeCreateCLISessionEventMutation , + /** + * Get a Netlify CLI session by its id + */ + fetchCliSessionByIdQuery: fetchCliSessionByIdQuery, + /** + * (Deprecated) Find logged in services + */ + fetchDeprecated_FindLoggedInServicesQuery: fetchDeprecated_FindLoggedInServicesQuery, + /** + * Create a new OneGraph personal token for a user's site + */ + executeCreateEmptyPersonalTokenMutation : executeCreateEmptyPersonalTokenMutation , + /** + * Retrieve a list of _all_ supported services from OneGraph + */ + fetchServiceListQuery: fetchServiceListQuery, + /** + * + */ + fetchAuthlifyTokenIdForPersonalToken: fetchAuthlifyTokenIdForPersonalToken, + /** + * Retrieve a previously persisted operations doc + */ + fetchPersistedQueryQuery: fetchPersistedQueryQuery, + /** + * List all the CLI sessions belonging to a site + */ + fetchCliSessionsByAppIdQuery: fetchCliSessionsByAppIdQuery, + /** + * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site. + */ + fetchListServicesQuery: fetchListServicesQuery, + /** + * Ensure that an app resource exists on the OneGraph servers for a given site. + */ + executeUpsertAppForSiteMutation : executeUpsertAppForSiteMutation , + /** + * Add additional allowed CORS origins for calls to a site's Graph. + */ + executeAddCORSOriginMutation : executeAddCORSOriginMutation , + /** + * Remove the given CORS origins for calls to a site's Graph. + */ + executeRemoveCORSOriginMutation : executeRemoveCORSOriginMutation , + /** + * List the allowed CORS origins for calls to a site's Graph. + */ + fetchCORSOriginsQuery: fetchCORSOriginsQuery, + /** + * A subscription with variables and a fragment to test code generation. + */ + subscribeToTestSubscription:subscribeToTestSubscription, + /** + * Verify the event body is signed securely, and then parse the result. + */ + parseAndVerifyTestSubscriptionEvent: parseAndVerifyTestSubscriptionEvent + } + + export default functions" +`; diff --git a/tests/integration/snapshots/530.graph-codegen.test.mjs.md b/tests/integration/snapshots/530.graph-codegen.test.mjs.md deleted file mode 100644 index 1d78f92cd87..00000000000 --- a/tests/integration/snapshots/530.graph-codegen.test.mjs.md +++ /dev/null @@ -1,7262 +0,0 @@ -# Snapshot report for `tests/integration/530.graph-codegen.test.cjs` - -The actual snapshot is saved in `530.graph-codegen.test.cjs.snap`. - -Generated by [AVA](https://avajs.dev). - -## netlify graph function library runtime codegen library [netlify-builtin:nextjs-0.0.1]:./dummy/index.js} - -> Snapshot 1 - - `/* eslint-disable */␊ - // @ts-nocheck␊ - // GENERATED VIA NETLIFY AUTOMATED DEV TOOLS, EDIT WITH CAUTION!␊ - ␊ - // Basic LRU cache implementation␊ - const makeLRUCache = (max) => {␊ - return { max: max, cache: new Map() };␊ - };␊ - ␊ - const oldestCacheKey = (lru) => {␊ - return lru.keys().next().value␊ - }␊ - ␊ - // Depend on Map keeping track of insertion order␊ - const getFromCache = (lru, key) => {␊ - const item = lru.cache.get(key);␊ - if (item) {␊ - // Delete key and re-insert so key is now at the end,␊ - // and now the last to be gc'd.␊ - lru.cache.delete(key);␊ - lru.cache.set(key, item);␊ - }␊ - return item;␊ - };␊ - ␊ - const setInCache = (lru, key, value) => {␊ - if (lru.cache.has(key)) {␊ - lru.cache.delete(key);␊ - }␊ - if (lru.cache.size == lru.max) {␊ - const cacheKey = oldestCacheKey(lru);␊ - ␊ - if (cacheKey) {␊ - lru.cache.delete(cacheKey);␊ - }␊ - }␊ - ␊ - lru.cache.set(key, value);␊ - };␊ - ␊ - // Cache the results of the Netlify Graph API for conditional requests␊ - const cache = makeLRUCache(100);␊ - ␊ - const calculateCacheKey = (payload) => {␊ - return JSON.stringify(payload);␊ - };␊ - ␊ - const schemaId = 'stable-schema-id';␊ - ␊ - const netlifyGraphHostWithProtocol =␊ - process.env.NETLIFY_GRAPH_HOST_WITH_PROTOCOL || 'https://graph.netlify.com';␊ - ␊ - const makeNetlifyGraphUrl = ({ operationName, siteId }) => {␊ - return (␊ - netlifyGraphHostWithProtocol +␊ - '/graphql?app_id=' +␊ - siteId +␊ - '&operationName=' +␊ - operationName +␊ - '&schema_id=' +␊ - schemaId␊ - );␊ - };␊ - ␊ - const httpFetch = (operationName, options) => {␊ - const reqBody = options.body || null;␊ - const userHeaders = options.headers || {};␊ - const headers = {␊ - ...userHeaders,␊ - 'Content-Type': 'application/json',␊ - };␊ - ␊ - const timeoutMs = 30_000;␊ - ␊ - const reqOptions = {␊ - method: 'POST',␊ - headers: headers,␊ - timeout: timeoutMs,␊ - body: reqBody,␊ - };␊ - ␊ - const siteId = options.siteId || process.env.SITE_ID;␊ - const netlifyGraphUrl = makeNetlifyGraphUrl({ operationName: operationName, siteId: siteId });␊ - ␊ - return fetch(netlifyGraphUrl, reqOptions).then((body) => {␊ - return body.text().then((bodyString) => {␊ - const headers = {};␊ - body.headers.forEach((k, v) => (headers[k] = v));␊ - ␊ - return {␊ - body: bodyString,␊ - headers: headers,␊ - status: body.status,␊ - };␊ - });␊ - });␊ - };␊ - ␊ - const fetchNetlifyGraph = function fetchNetlifyGraph(input) {␊ - const query = input.query;␊ - const docId = input.doc_id;␊ - const operationName = input.operationName;␊ - const variables = input.variables;␊ - ␊ - const options = input.options || {};␊ - const accessToken = options.accessToken;␊ - ␊ - const payload = {␊ - query: query,␊ - doc_id: docId,␊ - variables: variables,␊ - operationName: operationName,␊ - };␊ - ␊ - let cachedOrLiveValue = new Promise((resolve) => {␊ - const cacheKey = calculateCacheKey(payload);␊ - ␊ - // Check the cache for a previous result␊ - const cachedResultPair = getFromCache(cache, cacheKey);␊ - ␊ - let conditionalHeaders = {␊ - 'If-None-Match': '',␊ - };␊ - let cachedResultValue;␊ - ␊ - if (cachedResultPair) {␊ - const [etag, previousResult] = cachedResultPair;␊ - conditionalHeaders = {␊ - 'If-None-Match': etag,␊ - };␊ - cachedResultValue = previousResult;␊ - }␊ - ␊ - const response = httpFetch(operationName, {␊ - ...options,␊ - method: 'POST',␊ - headers: {␊ - ...conditionalHeaders,␊ - Authorization: accessToken ? 'Bearer ' + accessToken : '',␊ - },␊ - body: JSON.stringify(payload),␊ - });␊ - ␊ - response.then((result) => {␊ - // Check response headers for a 304 Not Modified␊ - if (result.status === 304) {␊ - // Return the cached result␊ - resolve(cachedResultValue);␊ - } else if (result.status === 200) {␊ - // Update the cache with the new etag and result␊ - const etag = result.headers['etag'];␊ - const resultJson = JSON.parse(result.body);␊ - if (etag) {␊ - // Make a note of the new etag for the given payload␊ - setInCache(cache, cacheKey, [etag, resultJson]);␊ - }␊ - resolve(resultJson);␊ - } else {␊ - return result.json().then((json) => {␊ - resolve(json);␊ - });␊ - }␊ - });␊ - });␊ - ␊ - return cachedOrLiveValue;␊ - };␊ - ␊ - export const executeUpdateCLISessionMetadataMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation UpdateCLISessionMetadataMutation($nfToken: String!, $sessionId: String!, $metadata: JSON!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - updateNetlifyCliSession(input: {id: $sessionId, metadata: $metadata}) {␊ - session {␊ - id␊ - name␊ - metadata␊ - createdAt␊ - lastEventAt␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "UpdateCLISessionMetadataMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchAppSchemaQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query AppSchemaQuery($nfToken: String!, $appId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - app(id: $appId) {␊ - graphQLSchema {␊ - appId␊ - createdAt␊ - id␊ - services {␊ - friendlyServiceName␊ - logoUrl␊ - service␊ - slug␊ - supportsCustomRedirectUri␊ - supportsCustomServiceAuth␊ - supportsOauthLogin␊ - }␊ - updatedAt␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "AppSchemaQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeDestroyTokenMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation DestroyTokenMutation($nfToken: String!, $token: String, $authlifyTokenId: String) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - destroyToken(token: $token, authlifyTokenId: $authlifyTokenId)␊ - }␊ - }\`,␊ - operationName: "DestroyTokenMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeSignOutServicesMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation SignOutServicesMutation($services: [OneGraphServiceEnum!]!, $nfToken: String!, $authlifyTokenId: String!) {␊ - signoutServices(␊ - data: {services: $services, anchorAuth: {netlifyAuth: {oauthToken: $nfToken}}, authlifyTokenId: $authlifyTokenId}␊ - ) {␊ - me {␊ - serviceMetadata {␊ - loggedInServices {␊ - ...LoggedInServicesFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: """12b5bdea-9bab-4124-a731-5e697b1553be""", doc: """Subset of LoggedInServices""") {␊ - friendlyServiceName␊ - service␊ - isLoggedIn␊ - usedTestFlow␊ - serviceInfo {␊ - logoUrl␊ - availableScopes {␊ - category␊ - scope␊ - display␊ - isDefault␊ - isRequired␊ - description␊ - title␊ - }␊ - }␊ - grantedScopes {␊ - scope␊ - }␊ - foreignUserId␊ - }\`,␊ - operationName: "SignOutServicesMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeAddAuthsMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation AddAuthsMutation($siteId: String!, $authlifyTokenId: String, $sToken: String!, $nfToken: String!) {␊ - oneGraph {␊ - addAuthsToPersonalToken(␊ - input: {anchorAuth: {netlifyAuth: {oauthToken: $nfToken}}, sacrificialToken: $sToken, authlifyTokenId: $authlifyTokenId, appId: $siteId}␊ - ) {␊ - accessToken {␊ - netlifyId␊ - token␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "AddAuthsMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeCreateNewSchemaMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation CreateNewSchemaMutation($nfToken: String!, $input: OneGraphCreateGraphQLSchemaInput!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createGraphQLSchema(input: $input) {␊ - app {␊ - graphQLSchema {␊ - id␊ - }␊ - }␊ - graphqlSchema {␊ - id␊ - services {␊ - friendlyServiceName␊ - logoUrl␊ - service␊ - slug␊ - supportsCustomRedirectUri␊ - supportsCustomServiceAuth␊ - supportsOauthLogin␊ - }␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "CreateNewSchemaMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeDeleteServiceAuthMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation DeleteServiceAuthMutation($siteId: String!, $serviceAuthId: String!, $nfToken: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - destroyServiceAuth(data: {appId: $siteId, serviceAuthId: $serviceAuthId}) {␊ - app {␊ - serviceAuths {␊ - ...ServiceAuthFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: """12b5bdea-9bab-4164-a731-5e697b1553be""", doc: """Basic info on a Service Auth""") {␊ - id␊ - service␊ - clientId␊ - revealTokens␊ - scopes␊ - }\`,␊ - operationName: "DeleteServiceAuthMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeCreatePersistedQueryMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation CreatePersistedQueryMutation($nfToken: String!, $appId: String!, $query: String!, $tags: [String!]!, $description: String!, $parent: OneGraphCreatePersistedQueryParentInput) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createPersistedQuery(␊ - input: {query: $query, appId: $appId, tags: $tags, description: $description, parent: $parent}␊ - ) {␊ - persistedQuery {␊ - id␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "CreatePersistedQueryMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchFindLoggedInServicesQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query FindLoggedInServicesQuery($nfToken: String!, $authlifyTokenId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - authlifyToken(authlifyTokenId: $authlifyTokenId) {␊ - serviceMetadata {␊ - loggedInServices {␊ - usedTestFlow␊ - friendlyServiceName␊ - ...LoggedInServicesFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: """12b5bdea-9bab-4124-a731-5e697b1553be""", doc: """Subset of LoggedInServices""") {␊ - friendlyServiceName␊ - service␊ - isLoggedIn␊ - usedTestFlow␊ - serviceInfo {␊ - logoUrl␊ - availableScopes {␊ - category␊ - scope␊ - display␊ - isDefault␊ - isRequired␊ - description␊ - title␊ - }␊ - }␊ - grantedScopes {␊ - scope␊ - }␊ - foreignUserId␊ - }\`,␊ - operationName: "FindLoggedInServicesQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeSetServiceAuthMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation SetServiceAuthMutation($service: OneGraphCustomServiceAuthServiceEnum!, $clientId: String!, $clientSecret: String!, $siteId: String!, $nfToken: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createServiceAuth(␊ - data: {service: $service, clientId: $clientId, clientSecret: $clientSecret, appId: $siteId, revealTokens: true}␊ - ) {␊ - app {␊ - serviceAuths {␊ - ...ServiceAuthFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: """12b5bdea-9bab-4164-a731-5e697b1553be""", doc: """Basic info on a Service Auth""") {␊ - id␊ - service␊ - clientId␊ - revealTokens␊ - scopes␊ - }\`,␊ - operationName: "SetServiceAuthMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeCreateCLISessionEventMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation CreateCLISessionEventMutation($nfToken: String!, $sessionId: String!, $payload: JSON!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createNetlifyCliTestEvent(␊ - input: {data: {payload: $payload}, sessionId: $sessionId}␊ - ) {␊ - event {␊ - id␊ - createdAt␊ - sessionId␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "CreateCLISessionEventMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchCliSessionByIdQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query CliSessionByIdQuery($nfToken: String!, $id: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - netlifyCliSession(id: $id) {␊ - id␊ - name␊ - netlifyUserId␊ - events {␊ - createdAt␊ - }␊ - createdAt␊ - lastEventAt␊ - metadata␊ - }␊ - }␊ - }\`,␊ - operationName: "CliSessionByIdQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchDeprecated_FindLoggedInServicesQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query Deprecated_FindLoggedInServicesQuery {␊ - me {␊ - serviceMetadata {␊ - loggedInServices {␊ - ...LoggedInServicesFragment␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: """12b5bdea-9bab-4124-a731-5e697b1553be""", doc: """Subset of LoggedInServices""") {␊ - friendlyServiceName␊ - service␊ - isLoggedIn␊ - usedTestFlow␊ - serviceInfo {␊ - logoUrl␊ - availableScopes {␊ - category␊ - scope␊ - display␊ - isDefault␊ - isRequired␊ - description␊ - title␊ - }␊ - }␊ - grantedScopes {␊ - scope␊ - }␊ - foreignUserId␊ - }\`,␊ - operationName: "Deprecated_FindLoggedInServicesQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeCreateEmptyPersonalTokenMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation CreateEmptyPersonalTokenMutation($nfToken: String!, $siteId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createPersonalTokenWithNetlifySiteAnchor(␊ - input: {name: "Netlify AuthManager Token", netlifySiteId: $siteId}␊ - ) {␊ - accessToken {␊ - token␊ - name␊ - anchor␊ - netlifyId␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "CreateEmptyPersonalTokenMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchServiceListQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query ServiceListQuery($logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) {␊ - oneGraph {␊ - services {␊ - friendlyServiceName␊ - logoUrl(style: $logoStyle)␊ - service␊ - slug␊ - supportsCustomRedirectUri␊ - supportsCustomServiceAuth␊ - supportsOauthLogin␊ - }␊ - }␊ - }\`,␊ - operationName: "ServiceListQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchAuthlifyTokenIdForPersonalToken = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query AuthlifyTokenIdForPersonalToken($personalToken: String!) {␊ - oneGraph {␊ - personalToken(accessToken: $personalToken) {␊ - netlifyId␊ - }␊ - }␊ - }\`,␊ - operationName: "AuthlifyTokenIdForPersonalToken",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchPersistedQueryQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query PersistedQueryQuery($nfToken: String!, $appId: String!, $id: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - persistedQuery(appId: $appId, id: $id) {␊ - id␊ - query␊ - allowedOperationNames␊ - description␊ - freeVariables␊ - fixedVariables␊ - tags␊ - }␊ - }␊ - }\`,␊ - operationName: "PersistedQueryQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchCliSessionsByAppIdQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query CliSessionsByAppIdQuery($nfToken: String!, $appId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - netlifyCliSessionsByAppId(appId: $appId, first: 10) {␊ - id␊ - name␊ - netlifyUserId␊ - events {␊ - createdAt␊ - }␊ - createdAt␊ - lastEventAt␊ - metadata␊ - }␊ - }␊ - }\`,␊ - operationName: "CliSessionsByAppIdQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchListServicesQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query ListServicesQuery($nfToken: String!, $siteId: String!, $logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - services(filter: {supportsOauthLogin: true}) {␊ - friendlyServiceName␊ - service␊ - slug␊ - logoUrl(style: $logoStyle)␊ - availableScopes {␊ - category␊ - scope␊ - display␊ - isDefault␊ - isRequired␊ - description␊ - title␊ - }␊ - }␊ - app(id: $siteId) {␊ - serviceAuths {␊ - ...ServiceAuthFragment␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: """12b5bdea-9bab-4164-a731-5e697b1553be""", doc: """Basic info on a Service Auth""") {␊ - id␊ - service␊ - clientId␊ - revealTokens␊ - scopes␊ - }\`,␊ - operationName: "ListServicesQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeUpsertAppForSiteMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation UpsertAppForSiteMutation($nfToken: String!, $siteId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - upsertAppForNetlifySite(input: {netlifySiteId: $siteId}) {␊ - org {␊ - id␊ - name␊ - }␊ - app {␊ - id␊ - name␊ - corsOrigins␊ - customCorsOrigins {␊ - friendlyServiceName␊ - displayName␊ - encodedValue␊ - }␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "UpsertAppForSiteMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeAddCORSOriginMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation AddCORSOriginMutation($nfToken: String!, $input: OneGraphAddCORSOriginToAppInput!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - addCORSOriginToApp(input: $input) {␊ - app {␊ - ...AppCORSOriginFragment␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment AppCORSOriginFragment on OneGraphApp @netlify(id: """e3d4bb8b-2fb5-48d8-b051-db6027224145""", doc: """Allowed CORS origins for calls to a site's Graph.""") {␊ - id␊ - corsOrigins␊ - customCorsOrigins {␊ - friendlyServiceName␊ - displayName␊ - encodedValue␊ - }␊ - netlifySiteNames␊ - }\`,␊ - operationName: "AddCORSOriginMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeRemoveCORSOriginMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation RemoveCORSOriginMutation($nfToken: String!, $input: OneGraphRemoveCORSOriginFromAppInput!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - removeCORSOriginFromApp(input: $input) {␊ - app {␊ - ...AppCORSOriginFragment␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment AppCORSOriginFragment on OneGraphApp @netlify(id: """e3d4bb8b-2fb5-48d8-b051-db6027224145""", doc: """Allowed CORS origins for calls to a site's Graph.""") {␊ - id␊ - corsOrigins␊ - customCorsOrigins {␊ - friendlyServiceName␊ - displayName␊ - encodedValue␊ - }␊ - netlifySiteNames␊ - }\`,␊ - operationName: "RemoveCORSOriginMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchCORSOriginsQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query CORSOriginsQuery($siteId: String!, $nfToken: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - app(id: $siteId) {␊ - ...AppCORSOriginFragment␊ - }␊ - }␊ - }␊ - ␊ - fragment AppCORSOriginFragment on OneGraphApp @netlify(id: """e3d4bb8b-2fb5-48d8-b051-db6027224145""", doc: """Allowed CORS origins for calls to a site's Graph.""") {␊ - id␊ - corsOrigins␊ - customCorsOrigins {␊ - friendlyServiceName␊ - displayName␊ - encodedValue␊ - }␊ - netlifySiteNames␊ - }\`,␊ - operationName: "CORSOriginsQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - const subscribeToTestSubscription = (␊ - variables,␊ - rawOptions␊ - ) => {␊ - const options = rawOptions || {};␊ - const netlifyGraphWebhookId = options.netlifyGraphWebhookId;␊ - const netlifyGraphWebhookUrl = options.webhookUrl || \`${process.env.DEPLOY_URL}/webhooks/TestSubscription?netlifyGraphWebhookId=${netlifyGraphWebhookId}\`;␊ - const secret = options.webhookSecret || process.env.NETLIFY_GRAPH_WEBHOOK_SECRET␊ - const fullVariables = {...variables, netlifyGraphWebhookUrl: netlifyGraphWebhookUrl, netlifyGraphWebhookSecret: { hmacSha256Key: secret }}␊ - ␊ - const subscriptionOperationDoc = \`subscription TestSubscription($minutes: Int = 1, $netlifyGraphWebhookUrl: String!, $netlifyGraphWebhookSecret: OneGraphSubscriptionSecretInput!) @netlify(id: """e3d4bb8b-2fb5-9898-b051-db6027224112""", doc: """A subscription with variables and a fragment to test code generation.""") {␊ - poll(␊ - schedule: {every: {minutes: $minutes}}␊ - onlyTriggerWhenPayloadChanged: true␊ - webhookUrl: $netlifyGraphWebhookUrl␊ - secret: $netlifyGraphWebhookSecret␊ - ) {␊ - query {␊ - me {␊ - serviceMetadata {␊ - loggedInServices {␊ - ...LoggedInServicesFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - }\`;␊ - ␊ - fetchNetlifyGraph({␊ - query: subscriptionOperationDoc,␊ - operationName: "TestSubscription",␊ - variables: fullVariables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - })␊ - }␊ - ␊ - const parseAndVerifyTestSubscriptionEvent = (event, options) => {␊ - if (!verifyRequestSignature({ event: event }, options)) {␊ - console.warn("Unable to verify signature for TestSubscription")␊ - return null␊ - }␊ - ␊ - return JSON.parse(event.body || '{}')␊ - }␊ - ␊ - /**␊ - * The generated NetlifyGraph library with your operations␊ - */␊ - const functions = {␊ - /**␊ - * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`).␊ - */␊ - executeUpdateCLISessionMetadataMutation : executeUpdateCLISessionMetadataMutation ,␊ - /**␊ - * Get the _metadata_ about a site's current GraphQL schema:␊ - * ␊ - * - enabled services␊ - * - schema id␊ - * - creation date␊ - * ␊ - * etc.␊ - */␊ - fetchAppSchemaQuery: fetchAppSchemaQuery,␊ - /**␊ - * Delete a OneGraph personal token for a user's site␊ - */␊ - executeDestroyTokenMutation : executeDestroyTokenMutation ,␊ - /**␊ - * Sign out of a service associated with a Authlify token␊ - */␊ - executeSignOutServicesMutation : executeSignOutServicesMutation ,␊ - /**␊ - * Update a service's (i.e. GitHub) enabled scope permissions␊ - */␊ - executeAddAuthsMutation : executeAddAuthsMutation ,␊ - /**␊ - * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use.␊ - */␊ - executeCreateNewSchemaMutation : executeCreateNewSchemaMutation ,␊ - /**␊ - * Delete a custom service auth␊ - */␊ - executeDeleteServiceAuthMutation : executeDeleteServiceAuthMutation ,␊ - /**␊ - * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution.␊ - */␊ - executeCreatePersistedQueryMutation : executeCreatePersistedQueryMutation ,␊ - /**␊ - * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site␊ - */␊ - fetchFindLoggedInServicesQuery: fetchFindLoggedInServicesQuery,␊ - /**␊ - * Create a custom service auth␊ - */␊ - executeSetServiceAuthMutation : executeSetServiceAuthMutation ,␊ - /**␊ - * Create a new session for the Netlify CLI to communicate with the React UI via events.␊ - */␊ - executeCreateCLISessionEventMutation : executeCreateCLISessionEventMutation ,␊ - /**␊ - * Get a Netlify CLI session by its id␊ - */␊ - fetchCliSessionByIdQuery: fetchCliSessionByIdQuery,␊ - /**␊ - * (Deprecated) Find logged in services␊ - */␊ - fetchDeprecated_FindLoggedInServicesQuery: fetchDeprecated_FindLoggedInServicesQuery,␊ - /**␊ - * Create a new OneGraph personal token for a user's site␊ - */␊ - executeCreateEmptyPersonalTokenMutation : executeCreateEmptyPersonalTokenMutation ,␊ - /**␊ - * Retrieve a list of _all_ supported services from OneGraph␊ - */␊ - fetchServiceListQuery: fetchServiceListQuery,␊ - /**␊ - * ␊ - */␊ - fetchAuthlifyTokenIdForPersonalToken: fetchAuthlifyTokenIdForPersonalToken,␊ - /**␊ - * Retrieve a previously persisted operations doc␊ - */␊ - fetchPersistedQueryQuery: fetchPersistedQueryQuery,␊ - /**␊ - * List all the CLI sessions belonging to a site␊ - */␊ - fetchCliSessionsByAppIdQuery: fetchCliSessionsByAppIdQuery,␊ - /**␊ - * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site.␊ - */␊ - fetchListServicesQuery: fetchListServicesQuery,␊ - /**␊ - * Ensure that an app resource exists on the OneGraph servers for a given site.␊ - */␊ - executeUpsertAppForSiteMutation : executeUpsertAppForSiteMutation ,␊ - /**␊ - * Add additional allowed CORS origins for calls to a site's Graph.␊ - */␊ - executeAddCORSOriginMutation : executeAddCORSOriginMutation ,␊ - /**␊ - * Remove the given CORS origins for calls to a site's Graph.␊ - */␊ - executeRemoveCORSOriginMutation : executeRemoveCORSOriginMutation ,␊ - /**␊ - * List the allowed CORS origins for calls to a site's Graph.␊ - */␊ - fetchCORSOriginsQuery: fetchCORSOriginsQuery,␊ - /**␊ - * A subscription with variables and a fragment to test code generation.␊ - */␊ - subscribeToTestSubscription:subscribeToTestSubscription,␊ - /**␊ - * Verify the event body is signed securely, and then parse the result.␊ - */␊ - parseAndVerifyTestSubscriptionEvent: parseAndVerifyTestSubscriptionEvent␊ - }␊ - ␊ - export default functions` - -## netlify graph function library runtime codegen library [netlify-builtin:nextjs-0.0.1]:./dummy/index.d.ts} - -> Snapshot 1 - - `/* eslint-disable */␊ - // @ts-nocheck␊ - // GENERATED VIA NETLIFY AUTOMATED DEV TOOLS, EDIT WITH CAUTION!␊ - ␊ - export type NetlifyGraphFunctionOptions = {␊ - /**␊ - * The accessToken to use for the request␊ - */␊ - accessToken?: string;␊ - /**␊ - * The siteId to use for the request␊ - * @default process.env.SITE_ID␊ - */␊ - siteId?: string;␊ - }␊ - ␊ - export type WebhookEvent = {␊ - body: string;␊ - headers: Record;␊ - };␊ - ␊ - export type GraphQLError = {␊ - "path": Array;␊ - "message": string;␊ - "extensions": Record;␊ - };␊ - ␊ - /**␊ - * Subset of LoggedInServices␊ - */␊ - export type LoggedInServicesFragment = {␊ - friendlyServiceName: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - isLoggedIn: boolean;␊ - usedTestFlow: boolean;␊ - serviceInfo: {␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - availableScopes?: Array<{␊ - category?: string;␊ - scope: string;␊ - display: string;␊ - isDefault: boolean;␊ - isRequired: boolean;␊ - description: string;␊ - title?: string;␊ - }>;␊ - };␊ - /**␊ - * The scopes that the user granted for this service. This is a best estimate of the scopes that were granted. Most services do not have a way to query the scopes on an auth, and some services do not return information about the scopes that were granted in the auth flow.␊ - */␊ - grantedScopes?: Array<{␊ - /**␊ - * The name of the scope that the underlying service uses.␊ - */␊ - scope: string;␊ - }>;␊ - foreignUserId?: string;␊ - };␊ - ␊ - ␊ - /**␊ - * Basic info on a Service Auth␊ - */␊ - export type ServiceAuthFragment = {␊ - /**␊ - * id for the service auth␊ - */␊ - id: string;␊ - /**␊ - * The service that the clientId and clientSecret belong to, e.g. "gmail"␊ - */␊ - service: string;␊ - /**␊ - * clientId for the serviceAuth.␊ - */␊ - clientId: string;␊ - /**␊ - * If true, the bearer token that is created fetchable by the user whose account the token grants access to.␊ - */␊ - revealTokens: boolean;␊ - /**␊ - * Optional scopes to use for the OAuth flow.␊ - */␊ - scopes?: Array;␊ - };␊ - ␊ - ␊ - /**␊ - * Allowed CORS origins for calls to a site's Graph.␊ - */␊ - export type AppCORSOriginFragment = {␊ - /**␊ - * The id of the OneGraph App␊ - */␊ - id: string;␊ - /**␊ - * The origins allowed for this OneGraph App from CORS requests␊ - */␊ - corsOrigins: Array;␊ - /**␊ - * Custom cors origins␊ - */␊ - customCorsOrigins: Array<{␊ - /**␊ - * The friendly service name for the cors origin␊ - */␊ - friendlyServiceName: string;␊ - /**␊ - * The name of the origin that should be displayed, e.g. oneblog for oneblog.netlify.app.␊ - */␊ - displayName: string;␊ - /**␊ - * The encoded value as a string, used to remove the custom cors origin.␊ - */␊ - encodedValue: string;␊ - }>;␊ - /**␊ - * Sites on Netlify associated with this app. OneGraph will allow CORS and authentication redirects to all previews, branch, and production deploys of these sites.␊ - */␊ - netlifySiteNames: Array;␊ - };␊ - ␊ - ␊ - export type UpdateCLISessionMetadataMutationInput = {␊ - "nfToken": string; ␊ - /**␊ - * The id of the session␊ - */␊ - "sessionId": string; ␊ - /**␊ - * Optional metadata for the session␊ - */␊ - "metadata": unknown␊ - };␊ - ␊ - export type UpdateCLISessionMetadataMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Update a CLI session.␊ - */␊ - updateNetlifyCliSession: {␊ - /**␊ - * The session that was updated.␊ - */␊ - session: {␊ - id: string;␊ - name?: string;␊ - metadata?: unknown;␊ - createdAt: string;␊ - lastEventAt?: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`).␊ - */␊ - export function executeUpdateCLISessionMetadataMutation (␊ - variables: UpdateCLISessionMetadataMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type AppSchemaQueryInput = {␊ - "nfToken": string; ␊ - /**␊ - * App id␊ - */␊ - "appId": string␊ - };␊ - ␊ - export type AppSchemaQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - app: {␊ - /**␊ - * Customizations to the default GraphQL schema␊ - */␊ - graphQLSchema?: {␊ - appId: string;␊ - createdAt: string;␊ - id: string;␊ - services: Array<{␊ - friendlyServiceName: string;␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - /**␊ - * Service string that can be provided in the URL when going through the oauth flow.␊ - */␊ - slug: string;␊ - supportsCustomRedirectUri: boolean;␊ - supportsCustomServiceAuth: boolean;␊ - supportsOauthLogin: boolean;␊ - }>;␊ - updatedAt: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Get the _metadata_ about a site's current GraphQL schema:␊ - * ␊ - * - enabled services␊ - * - schema id␊ - * - creation date␊ - * ␊ - * etc.␊ - */␊ - export function fetchAppSchemaQuery(␊ - variables: AppSchemaQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type DestroyTokenMutationInput = {␊ - "nfToken": string; ␊ - /**␊ - * Any OneGraph access token, refresh token, or JWT␊ - */␊ - "token"?: string; ␊ - /**␊ - * An Authlify Token identifier␊ - */␊ - "authlifyTokenId"?: string␊ - };␊ - ␊ - export type DestroyTokenMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Revokes a OneGraph access token, refresh token, or JWT. After a token is destroyed, it can no longer be used to authenticate with OneGraph.␊ - ␊ - If you destroy a JWT, external services that rely on the claims embedded in the JWT may still accept the JWT and you will also have to revoke the JWT though the external service's revocation process.␊ - */␊ - destroyToken: boolean;␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Delete a OneGraph personal token for a user's site␊ - */␊ - export function executeDestroyTokenMutation (␊ - variables: DestroyTokenMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type SignOutServicesMutationInput = {␊ - "services": Array<"ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS">; ␊ - "nfToken": string; ␊ - "authlifyTokenId": string␊ - };␊ - ␊ - export type SignOutServicesMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - signoutServices: {␊ - me: {␊ - /**␊ - * Metadata and logged-in state for all OneGraph services␊ - */␊ - serviceMetadata: {␊ - loggedInServices: Array;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Sign out of a service associated with a Authlify token␊ - */␊ - export function executeSignOutServicesMutation (␊ - variables: SignOutServicesMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type AddAuthsMutationInput = {␊ - "siteId": string; ␊ - "authlifyTokenId"?: string; ␊ - /**␊ - * Token that will be destroyed and have its auths moved to the personal token.␊ - */␊ - "sToken": string; ␊ - "nfToken": string␊ - };␊ - ␊ - export type AddAuthsMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - addAuthsToPersonalToken: {␊ - /**␊ - * Personal access token that was updated by this mutation␊ - */␊ - accessToken: {␊ - /**␊ - * Netlify-specific ID for the token␊ - */␊ - netlifyId?: string;␊ - /**␊ - * Bearer token␊ - */␊ - token: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Update a service's (i.e. GitHub) enabled scope permissions␊ - */␊ - export function executeAddAuthsMutation (␊ - variables: AddAuthsMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CreateNewSchemaMutationInput = {␊ - "nfToken": string; ␊ - "input": {/**␊ - * Whether to set this schema as the default for the app. Defaults to false.␊ - */␊ - "setAsDefaultForApp"?: boolean; /**␊ - * External GraphQL schemas to add␊ - */␊ - "externalGraphQLSchemas"?: Array<{/**␊ - * The id of the external GraphQL schema.␊ - */␊ - "externalGraphQLSchemaId": string}>; /**␊ - * Optional id of a Salesforce schema to attach to the app.␊ - */␊ - "salesforceSchemaId"?: string; /**␊ - * The optional id of the GraphQL schema that this was derived from.␊ - */␊ - "parentId"?: string; /**␊ - * The list of services that this schema should use. Leave blank if you want to add support for all supported services.␊ - */␊ - "enabledServices"?: Array<"ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS">; /**␊ - * The id of the app that the schema should belong to.␊ - */␊ - "appId": string}␊ - };␊ - ␊ - export type CreateNewSchemaMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - createGraphQLSchema: {␊ - app: {␊ - /**␊ - * Customizations to the default GraphQL schema␊ - */␊ - graphQLSchema?: {␊ - id: string;␊ - };␊ - };␊ - graphqlSchema: {␊ - id: string;␊ - services: Array<{␊ - friendlyServiceName: string;␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - /**␊ - * Service string that can be provided in the URL when going through the oauth flow.␊ - */␊ - slug: string;␊ - supportsCustomRedirectUri: boolean;␊ - supportsCustomServiceAuth: boolean;␊ - supportsOauthLogin: boolean;␊ - }>;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use.␊ - */␊ - export function executeCreateNewSchemaMutation (␊ - variables: CreateNewSchemaMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type DeleteServiceAuthMutationInput = {␊ - "siteId": string; ␊ - "serviceAuthId": string; ␊ - "nfToken": string␊ - };␊ - ␊ - export type DeleteServiceAuthMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - destroyServiceAuth: {␊ - app: {␊ - /**␊ - * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app␊ - */␊ - serviceAuths: Array;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Delete a custom service auth␊ - */␊ - export function executeDeleteServiceAuthMutation (␊ - variables: DeleteServiceAuthMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CreatePersistedQueryMutationInput = {␊ - "nfToken": string; ␊ - "appId": string; ␊ - "query": string; ␊ - /**␊ - * List of tags to add to the persisted query. Tags are free-form text that can be used to categorize persisted queries. Each tag must be under 256 characters and there can be a maximum of 10 tags on a single persisted query.␊ - */␊ - "tags": Array; ␊ - /**␊ - * A description for the persisted query. Maximum length is 2096 characters.␊ - */␊ - "description": string; ␊ - /**␊ - * The parent persisted query. It can be used to track lineage of the query.␊ - */␊ - "parent"?: {/**␊ - * An optional list of tags to remove from the parent query. If any of the provided tags aren't present on the parent, the mutation will fail. No persisted queries will be created and no tags will be removed from the parent.␊ - */␊ - "removeTags"?: Array; /**␊ - * The id of the parent␊ - */␊ - "id": string}␊ - };␊ - ␊ - export type CreatePersistedQueryMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - createPersistedQuery: {␊ - persistedQuery: {␊ - /**␊ - * The persisted query's id.␊ - */␊ - id: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution.␊ - */␊ - export function executeCreatePersistedQueryMutation (␊ - variables: CreatePersistedQueryMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type FindLoggedInServicesQueryInput = {␊ - "nfToken": string; ␊ - "authlifyTokenId": string␊ - };␊ - ␊ - export type FindLoggedInServicesQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - authlifyToken: {␊ - /**␊ - * Metadata and logged-in state for all OneGraph services␊ - */␊ - serviceMetadata: {␊ - loggedInServices: Array;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site␊ - */␊ - export function fetchFindLoggedInServicesQuery(␊ - variables: FindLoggedInServicesQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type SetServiceAuthMutationInput = {␊ - "service": "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK"; ␊ - "clientId": string; ␊ - "clientSecret": string; ␊ - "siteId": string; ␊ - "nfToken": string␊ - };␊ - ␊ - export type SetServiceAuthMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - createServiceAuth: {␊ - app: {␊ - /**␊ - * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app␊ - */␊ - serviceAuths: Array;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Create a custom service auth␊ - */␊ - export function executeSetServiceAuthMutation (␊ - variables: SetServiceAuthMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CreateCLISessionEventMutationInput = {␊ - "nfToken": string; ␊ - "sessionId": string; ␊ - "payload": unknown␊ - };␊ - ␊ - export type CreateCLISessionEventMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - createNetlifyCliTestEvent: {␊ - event: {␊ - id: string;␊ - createdAt: string;␊ - sessionId: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Create a new session for the Netlify CLI to communicate with the React UI via events.␊ - */␊ - export function executeCreateCLISessionEventMutation (␊ - variables: CreateCLISessionEventMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CliSessionByIdQueryInput = {␊ - "nfToken": string; ␊ - "id": string␊ - };␊ - ␊ - export type CliSessionByIdQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Get a Netlify CLI session by its id.␊ - */␊ - netlifyCliSession: {␊ - id: string;␊ - name?: string;␊ - netlifyUserId: string;␊ - events: Array<{␊ - createdAt: string;␊ - }>;␊ - createdAt: string;␊ - lastEventAt?: string;␊ - metadata?: unknown;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Get a Netlify CLI session by its id␊ - */␊ - export function fetchCliSessionByIdQuery(␊ - variables: CliSessionByIdQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - ␊ - export type Deprecated_FindLoggedInServicesQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - me: {␊ - /**␊ - * Metadata and logged-in state for all OneGraph services␊ - */␊ - serviceMetadata: {␊ - loggedInServices: Array;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * (Deprecated) Find logged in services␊ - */␊ - export function fetchDeprecated_FindLoggedInServicesQuery(␊ - /**␊ - * Pass \`{}\` as no variables are defined for this function.␊ - */␊ - variables: Record,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CreateEmptyPersonalTokenMutationInput = {␊ - "nfToken": string; ␊ - "siteId": string␊ - };␊ - ␊ - export type CreateEmptyPersonalTokenMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Creates an empty personal token with a Netlify site anchor␊ - */␊ - createPersonalTokenWithNetlifySiteAnchor: {␊ - /**␊ - * Personal access token that was created by this mutation␊ - */␊ - accessToken: {␊ - /**␊ - * Bearer token␊ - */␊ - token: string;␊ - /**␊ - * Token name, if it is a personal access token␊ - */␊ - name?: string;␊ - /**␊ - * The anchor is like two-factor auth for the token. It ensures that the person who adds auth to the token is the same as the person who created the token.␊ - */␊ - anchor?: "ONEGRAPH_USER" | "NETLIFY_USER" | "NETLIFY_SITE";␊ - /**␊ - * Netlify-specific ID for the token␊ - */␊ - netlifyId?: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Create a new OneGraph personal token for a user's site␊ - */␊ - export function executeCreateEmptyPersonalTokenMutation (␊ - variables: CreateEmptyPersonalTokenMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type ServiceListQueryInput = {␊ - "logoStyle"?: "DEFAULT" | "ROUNDED_RECTANGLE"␊ - };␊ - ␊ - export type ServiceListQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - services: Array<{␊ - friendlyServiceName: string;␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - /**␊ - * Service string that can be provided in the URL when going through the oauth flow.␊ - */␊ - slug: string;␊ - supportsCustomRedirectUri: boolean;␊ - supportsCustomServiceAuth: boolean;␊ - supportsOauthLogin: boolean;␊ - }>;␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Retrieve a list of _all_ supported services from OneGraph␊ - */␊ - export function fetchServiceListQuery(␊ - variables: ServiceListQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type AuthlifyTokenIdForPersonalTokenInput = {␊ - "personalToken": string␊ - };␊ - ␊ - export type AuthlifyTokenIdForPersonalToken = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Personal access token lookup␊ - */␊ - personalToken?: {␊ - /**␊ - * Netlify-specific ID for the token␊ - */␊ - netlifyId?: string;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * ␊ - */␊ - export function fetchAuthlifyTokenIdForPersonalToken(␊ - variables: AuthlifyTokenIdForPersonalTokenInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type PersistedQueryQueryInput = {␊ - "nfToken": string; ␊ - /**␊ - * The id of the app that the persisted query belongs to.␊ - */␊ - "appId": string; ␊ - /**␊ - * The id of the persisted query.␊ - */␊ - "id": string␊ - };␊ - ␊ - export type PersistedQueryQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Fetch a single persisted query by its id.␊ - */␊ - persistedQuery: {␊ - /**␊ - * The persisted query's id.␊ - */␊ - id: string;␊ - /**␊ - * The persisted query's query string.␊ - */␊ - query: string;␊ - /**␊ - * The list of operation names that the caller of the query is allowed to execute. If the field is null, then all operationNames are allowed.␊ - */␊ - allowedOperationNames?: Array;␊ - /**␊ - * The user-defined description that was added to the query␊ - */␊ - description?: string;␊ - /**␊ - * The list of variables that the caller of the query is allowed to provide.␊ - */␊ - freeVariables?: Array;␊ - /**␊ - * The default variables provided to the query.␊ - */␊ - fixedVariables?: unknown;␊ - /**␊ - * The list of user-defined tags that were added to the query␊ - */␊ - tags?: Array;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Retrieve a previously persisted operations doc␊ - */␊ - export function fetchPersistedQueryQuery(␊ - variables: PersistedQueryQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CliSessionsByAppIdQueryInput = {␊ - "nfToken": string; ␊ - "appId": string␊ - };␊ - ␊ - export type CliSessionsByAppIdQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Netlify CLI sessions, orderd by createdAt descending.␊ - */␊ - netlifyCliSessionsByAppId: Array<{␊ - id: string;␊ - name?: string;␊ - netlifyUserId: string;␊ - events: Array<{␊ - createdAt: string;␊ - }>;␊ - createdAt: string;␊ - lastEventAt?: string;␊ - metadata?: unknown;␊ - }>;␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * List all the CLI sessions belonging to a site␊ - */␊ - export function fetchCliSessionsByAppIdQuery(␊ - variables: CliSessionsByAppIdQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type ListServicesQueryInput = {␊ - "nfToken": string; ␊ - /**␊ - * App id␊ - */␊ - "siteId": string; ␊ - "logoStyle"?: "DEFAULT" | "ROUNDED_RECTANGLE"␊ - };␊ - ␊ - export type ListServicesQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - services: Array<{␊ - friendlyServiceName: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - /**␊ - * Service string that can be provided in the URL when going through the oauth flow.␊ - */␊ - slug: string;␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - availableScopes?: Array<{␊ - category?: string;␊ - scope: string;␊ - display: string;␊ - isDefault: boolean;␊ - isRequired: boolean;␊ - description: string;␊ - title?: string;␊ - }>;␊ - }>;␊ - app: {␊ - /**␊ - * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app␊ - */␊ - serviceAuths: Array;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site.␊ - */␊ - export function fetchListServicesQuery(␊ - variables: ListServicesQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type UpsertAppForSiteMutationInput = {␊ - "nfToken": string; ␊ - "siteId": string␊ - };␊ - ␊ - export type UpsertAppForSiteMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - upsertAppForNetlifySite: {␊ - /**␊ - * The app that is associated with the Netlify account.␊ - */␊ - org: {␊ - /**␊ - * The id of the OneGraph Org␊ - */␊ - id: string;␊ - /**␊ - * The name of the OneGraph Org␊ - */␊ - name: string;␊ - };␊ - /**␊ - * The app that is associated with the Netlify site.␊ - */␊ - app: {␊ - /**␊ - * The id of the OneGraph App␊ - */␊ - id: string;␊ - /**␊ - * The name of the OneGraph App␊ - */␊ - name: string;␊ - /**␊ - * The origins allowed for this OneGraph App from CORS requests␊ - */␊ - corsOrigins: Array;␊ - /**␊ - * Custom cors origins␊ - */␊ - customCorsOrigins: Array<{␊ - /**␊ - * The friendly service name for the cors origin␊ - */␊ - friendlyServiceName: string;␊ - /**␊ - * The name of the origin that should be displayed, e.g. oneblog for oneblog.netlify.app.␊ - */␊ - displayName: string;␊ - /**␊ - * The encoded value as a string, used to remove the custom cors origin.␊ - */␊ - encodedValue: string;␊ - }>;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Ensure that an app resource exists on the OneGraph servers for a given site.␊ - */␊ - export function executeUpsertAppForSiteMutation (␊ - variables: UpsertAppForSiteMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type AddCORSOriginMutationInput = {␊ - "nfToken": string; ␊ - "input": {"corsOrigin": string; "appId": string}␊ - };␊ - ␊ - export type AddCORSOriginMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - addCORSOriginToApp: {␊ - app: AppCORSOriginFragment ;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Add additional allowed CORS origins for calls to a site's Graph.␊ - */␊ - export function executeAddCORSOriginMutation (␊ - variables: AddCORSOriginMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type RemoveCORSOriginMutationInput = {␊ - "nfToken": string; ␊ - "input": {"corsOrigin": string; "appId": string}␊ - };␊ - ␊ - export type RemoveCORSOriginMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - removeCORSOriginFromApp: {␊ - app: AppCORSOriginFragment ;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Remove the given CORS origins for calls to a site's Graph.␊ - */␊ - export function executeRemoveCORSOriginMutation (␊ - variables: RemoveCORSOriginMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CORSOriginsQueryInput = {␊ - /**␊ - * App id␊ - */␊ - "siteId": string; ␊ - "nfToken": string␊ - };␊ - ␊ - export type CORSOriginsQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - app: AppCORSOriginFragment ;␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * List the allowed CORS origins for calls to a site's Graph.␊ - */␊ - export function fetchCORSOriginsQuery(␊ - variables: CORSOriginsQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - /**␊ - * A subscription with variables and a fragment to test code generation.␊ - */␊ - export function subscribeToTestSubscription(␊ - /**␊ - * This will be available in your webhook handler as a query parameter.␊ - * Use this to keep track of which subscription you're receiving␊ - * events for.␊ - */␊ - variables: {␊ - /**␊ - * How many minutes to wait before re-running the underlying query␊ - */␊ - "minutes"?: number␊ - },␊ - options?: {␊ - /**␊ - * The accessToken to use for the lifetime of the subscription.␊ - */␊ - accessToken?: string | null | undefined;␊ - /**␊ - * A string id that will be passed to your webhook handler as a query parameter␊ - * along with each event.␊ - * This can be used to keep track of which subscription you're receiving␊ - */␊ - netlifyGraphWebhookId?: string | null | undefined;␊ - /**␊ - * The absolute URL of your webhook handler to handle events from this subscription.␊ - */␊ - webhookUrl?: string | null | undefined;␊ - /**␊ - * The secret to use when signing the webhook request. Use this to verify␊ - * that the webhook payload is coming from Netlify Graph. Defaults to the␊ - * value of the NETLIFY_GRAPH_WEBHOOK_SECRET environment variable.␊ - */␊ - webhookSecret?: string | null | undefined;␊ - }) : void␊ - ␊ - export type TestSubscriptionEvent = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - poll: {␊ - query: {␊ - me: {␊ - /**␊ - * Metadata and logged-in state for all OneGraph services␊ - */␊ - serviceMetadata: {␊ - loggedInServices: Array>;␊ - };␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - }␊ - ␊ - /**␊ - * Verify the TestSubscription event body is signed securely, and then parse the result.␊ - */␊ - export function parseAndVerifyTestSubscriptionEvent (/** A Netlify Handler Event */ event : WebhookEvent) : null | TestSubscriptionEvent␊ - ␊ - ␊ - export interface Functions {␊ - /**␊ - * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`).␊ - */␊ - executeUpdateCLISessionMetadataMutation : typeof executeUpdateCLISessionMetadataMutation ,␊ - /**␊ - * Get the _metadata_ about a site's current GraphQL schema:␊ - * ␊ - * - enabled services␊ - * - schema id␊ - * - creation date␊ - * ␊ - * etc.␊ - */␊ - fetchAppSchemaQuery: typeof fetchAppSchemaQuery,␊ - /**␊ - * Delete a OneGraph personal token for a user's site␊ - */␊ - executeDestroyTokenMutation : typeof executeDestroyTokenMutation ,␊ - /**␊ - * Sign out of a service associated with a Authlify token␊ - */␊ - executeSignOutServicesMutation : typeof executeSignOutServicesMutation ,␊ - /**␊ - * Update a service's (i.e. GitHub) enabled scope permissions␊ - */␊ - executeAddAuthsMutation : typeof executeAddAuthsMutation ,␊ - /**␊ - * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use.␊ - */␊ - executeCreateNewSchemaMutation : typeof executeCreateNewSchemaMutation ,␊ - /**␊ - * Delete a custom service auth␊ - */␊ - executeDeleteServiceAuthMutation : typeof executeDeleteServiceAuthMutation ,␊ - /**␊ - * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution.␊ - */␊ - executeCreatePersistedQueryMutation : typeof executeCreatePersistedQueryMutation ,␊ - /**␊ - * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site␊ - */␊ - fetchFindLoggedInServicesQuery: typeof fetchFindLoggedInServicesQuery,␊ - /**␊ - * Create a custom service auth␊ - */␊ - executeSetServiceAuthMutation : typeof executeSetServiceAuthMutation ,␊ - /**␊ - * Create a new session for the Netlify CLI to communicate with the React UI via events.␊ - */␊ - executeCreateCLISessionEventMutation : typeof executeCreateCLISessionEventMutation ,␊ - /**␊ - * Get a Netlify CLI session by its id␊ - */␊ - fetchCliSessionByIdQuery: typeof fetchCliSessionByIdQuery,␊ - /**␊ - * (Deprecated) Find logged in services␊ - */␊ - fetchDeprecated_FindLoggedInServicesQuery: typeof fetchDeprecated_FindLoggedInServicesQuery,␊ - /**␊ - * Create a new OneGraph personal token for a user's site␊ - */␊ - executeCreateEmptyPersonalTokenMutation : typeof executeCreateEmptyPersonalTokenMutation ,␊ - /**␊ - * Retrieve a list of _all_ supported services from OneGraph␊ - */␊ - fetchServiceListQuery: typeof fetchServiceListQuery,␊ - /**␊ - * ␊ - */␊ - fetchAuthlifyTokenIdForPersonalToken: typeof fetchAuthlifyTokenIdForPersonalToken,␊ - /**␊ - * Retrieve a previously persisted operations doc␊ - */␊ - fetchPersistedQueryQuery: typeof fetchPersistedQueryQuery,␊ - /**␊ - * List all the CLI sessions belonging to a site␊ - */␊ - fetchCliSessionsByAppIdQuery: typeof fetchCliSessionsByAppIdQuery,␊ - /**␊ - * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site.␊ - */␊ - fetchListServicesQuery: typeof fetchListServicesQuery,␊ - /**␊ - * Ensure that an app resource exists on the OneGraph servers for a given site.␊ - */␊ - executeUpsertAppForSiteMutation : typeof executeUpsertAppForSiteMutation ,␊ - /**␊ - * Add additional allowed CORS origins for calls to a site's Graph.␊ - */␊ - executeAddCORSOriginMutation : typeof executeAddCORSOriginMutation ,␊ - /**␊ - * Remove the given CORS origins for calls to a site's Graph.␊ - */␊ - executeRemoveCORSOriginMutation : typeof executeRemoveCORSOriginMutation ,␊ - /**␊ - * List the allowed CORS origins for calls to a site's Graph.␊ - */␊ - fetchCORSOriginsQuery: typeof fetchCORSOriginsQuery,␊ - /**␊ - * A subscription with variables and a fragment to test code generation.␊ - */␊ - subscribeToTestSubscription:subscribeToTestSubscription,␊ - /**␊ - * Verify the event body is signed securely, and then parse the result.␊ - */␊ - parseAndVerifyTestSubscriptionEvent: typeof parseAndVerifyTestSubscriptionEvent␊ - }␊ - ␊ - export const functions: Functions;␊ - ␊ - export default functions;␊ - ` - -## netlify graph function library runtime codegen library [netlify-builtin:remix-0.0.1]:./dummy/index.js} - -> Snapshot 1 - - `/* eslint-disable */␊ - // @ts-nocheck␊ - // GENERATED VIA NETLIFY AUTOMATED DEV TOOLS, EDIT WITH CAUTION!␊ - ␊ - // Basic LRU cache implementation␊ - const makeLRUCache = (max) => {␊ - return { max: max, cache: new Map() };␊ - };␊ - ␊ - const oldestCacheKey = (lru) => {␊ - return lru.keys().next().value␊ - }␊ - ␊ - // Depend on Map keeping track of insertion order␊ - const getFromCache = (lru, key) => {␊ - const item = lru.cache.get(key);␊ - if (item) {␊ - // Delete key and re-insert so key is now at the end,␊ - // and now the last to be gc'd.␊ - lru.cache.delete(key);␊ - lru.cache.set(key, item);␊ - }␊ - return item;␊ - };␊ - ␊ - const setInCache = (lru, key, value) => {␊ - if (lru.cache.has(key)) {␊ - lru.cache.delete(key);␊ - }␊ - if (lru.cache.size == lru.max) {␊ - const cacheKey = oldestCacheKey(lru);␊ - ␊ - if (cacheKey) {␊ - lru.cache.delete(cacheKey);␊ - }␊ - }␊ - ␊ - lru.cache.set(key, value);␊ - };␊ - ␊ - // Cache the results of the Netlify Graph API for conditional requests␊ - const cache = makeLRUCache(100);␊ - ␊ - const calculateCacheKey = (payload) => {␊ - return JSON.stringify(payload);␊ - };␊ - ␊ - const schemaId = 'stable-schema-id';␊ - ␊ - const netlifyGraphHostWithProtocol =␊ - process.env.NETLIFY_GRAPH_HOST_WITH_PROTOCOL || 'https://graph.netlify.com';␊ - ␊ - const makeNetlifyGraphUrl = ({ operationName, siteId }) => {␊ - return (␊ - netlifyGraphHostWithProtocol +␊ - '/graphql?app_id=' +␊ - siteId +␊ - '&operationName=' +␊ - operationName +␊ - '&schema_id=' +␊ - schemaId␊ - );␊ - };␊ - ␊ - const httpFetch = (operationName, options) => {␊ - const reqBody = options.body || null;␊ - const userHeaders = options.headers || {};␊ - const headers = {␊ - ...userHeaders,␊ - 'Content-Type': 'application/json',␊ - };␊ - ␊ - const timeoutMs = 30_000;␊ - ␊ - const reqOptions = {␊ - method: 'POST',␊ - headers: headers,␊ - timeout: timeoutMs,␊ - body: reqBody,␊ - };␊ - ␊ - const siteId = options.siteId || process.env.SITE_ID;␊ - const netlifyGraphUrl = makeNetlifyGraphUrl({ operationName: operationName, siteId: siteId });␊ - ␊ - return fetch(netlifyGraphUrl, reqOptions).then((body) => {␊ - return body.text().then((bodyString) => {␊ - const headers = {};␊ - body.headers.forEach((k, v) => (headers[k] = v));␊ - ␊ - return {␊ - body: bodyString,␊ - headers: headers,␊ - status: body.status,␊ - };␊ - });␊ - });␊ - };␊ - ␊ - const fetchNetlifyGraph = function fetchNetlifyGraph(input) {␊ - const query = input.query;␊ - const docId = input.doc_id;␊ - const operationName = input.operationName;␊ - const variables = input.variables;␊ - ␊ - const options = input.options || {};␊ - const accessToken = options.accessToken;␊ - ␊ - const payload = {␊ - query: query,␊ - doc_id: docId,␊ - variables: variables,␊ - operationName: operationName,␊ - };␊ - ␊ - let cachedOrLiveValue = new Promise((resolve) => {␊ - const cacheKey = calculateCacheKey(payload);␊ - ␊ - // Check the cache for a previous result␊ - const cachedResultPair = getFromCache(cache, cacheKey);␊ - ␊ - let conditionalHeaders = {␊ - 'If-None-Match': '',␊ - };␊ - let cachedResultValue;␊ - ␊ - if (cachedResultPair) {␊ - const [etag, previousResult] = cachedResultPair;␊ - conditionalHeaders = {␊ - 'If-None-Match': etag,␊ - };␊ - cachedResultValue = previousResult;␊ - }␊ - ␊ - const response = httpFetch(operationName, {␊ - ...options,␊ - method: 'POST',␊ - headers: {␊ - ...conditionalHeaders,␊ - Authorization: accessToken ? 'Bearer ' + accessToken : '',␊ - },␊ - body: JSON.stringify(payload),␊ - });␊ - ␊ - response.then((result) => {␊ - // Check response headers for a 304 Not Modified␊ - if (result.status === 304) {␊ - // Return the cached result␊ - resolve(cachedResultValue);␊ - } else if (result.status === 200) {␊ - // Update the cache with the new etag and result␊ - const etag = result.headers['etag'];␊ - const resultJson = JSON.parse(result.body);␊ - if (etag) {␊ - // Make a note of the new etag for the given payload␊ - setInCache(cache, cacheKey, [etag, resultJson]);␊ - }␊ - resolve(resultJson);␊ - } else {␊ - return result.json().then((json) => {␊ - resolve(json);␊ - });␊ - }␊ - });␊ - });␊ - ␊ - return cachedOrLiveValue;␊ - };␊ - ␊ - export const executeUpdateCLISessionMetadataMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation UpdateCLISessionMetadataMutation($nfToken: String!, $sessionId: String!, $metadata: JSON!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - updateNetlifyCliSession(input: {id: $sessionId, metadata: $metadata}) {␊ - session {␊ - id␊ - name␊ - metadata␊ - createdAt␊ - lastEventAt␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "UpdateCLISessionMetadataMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchAppSchemaQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query AppSchemaQuery($nfToken: String!, $appId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - app(id: $appId) {␊ - graphQLSchema {␊ - appId␊ - createdAt␊ - id␊ - services {␊ - friendlyServiceName␊ - logoUrl␊ - service␊ - slug␊ - supportsCustomRedirectUri␊ - supportsCustomServiceAuth␊ - supportsOauthLogin␊ - }␊ - updatedAt␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "AppSchemaQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeDestroyTokenMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation DestroyTokenMutation($nfToken: String!, $token: String, $authlifyTokenId: String) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - destroyToken(token: $token, authlifyTokenId: $authlifyTokenId)␊ - }␊ - }\`,␊ - operationName: "DestroyTokenMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeSignOutServicesMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation SignOutServicesMutation($services: [OneGraphServiceEnum!]!, $nfToken: String!, $authlifyTokenId: String!) {␊ - signoutServices(␊ - data: {services: $services, anchorAuth: {netlifyAuth: {oauthToken: $nfToken}}, authlifyTokenId: $authlifyTokenId}␊ - ) {␊ - me {␊ - serviceMetadata {␊ - loggedInServices {␊ - ...LoggedInServicesFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: """12b5bdea-9bab-4124-a731-5e697b1553be""", doc: """Subset of LoggedInServices""") {␊ - friendlyServiceName␊ - service␊ - isLoggedIn␊ - usedTestFlow␊ - serviceInfo {␊ - logoUrl␊ - availableScopes {␊ - category␊ - scope␊ - display␊ - isDefault␊ - isRequired␊ - description␊ - title␊ - }␊ - }␊ - grantedScopes {␊ - scope␊ - }␊ - foreignUserId␊ - }\`,␊ - operationName: "SignOutServicesMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeAddAuthsMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation AddAuthsMutation($siteId: String!, $authlifyTokenId: String, $sToken: String!, $nfToken: String!) {␊ - oneGraph {␊ - addAuthsToPersonalToken(␊ - input: {anchorAuth: {netlifyAuth: {oauthToken: $nfToken}}, sacrificialToken: $sToken, authlifyTokenId: $authlifyTokenId, appId: $siteId}␊ - ) {␊ - accessToken {␊ - netlifyId␊ - token␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "AddAuthsMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeCreateNewSchemaMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation CreateNewSchemaMutation($nfToken: String!, $input: OneGraphCreateGraphQLSchemaInput!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createGraphQLSchema(input: $input) {␊ - app {␊ - graphQLSchema {␊ - id␊ - }␊ - }␊ - graphqlSchema {␊ - id␊ - services {␊ - friendlyServiceName␊ - logoUrl␊ - service␊ - slug␊ - supportsCustomRedirectUri␊ - supportsCustomServiceAuth␊ - supportsOauthLogin␊ - }␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "CreateNewSchemaMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeDeleteServiceAuthMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation DeleteServiceAuthMutation($siteId: String!, $serviceAuthId: String!, $nfToken: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - destroyServiceAuth(data: {appId: $siteId, serviceAuthId: $serviceAuthId}) {␊ - app {␊ - serviceAuths {␊ - ...ServiceAuthFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: """12b5bdea-9bab-4164-a731-5e697b1553be""", doc: """Basic info on a Service Auth""") {␊ - id␊ - service␊ - clientId␊ - revealTokens␊ - scopes␊ - }\`,␊ - operationName: "DeleteServiceAuthMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeCreatePersistedQueryMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation CreatePersistedQueryMutation($nfToken: String!, $appId: String!, $query: String!, $tags: [String!]!, $description: String!, $parent: OneGraphCreatePersistedQueryParentInput) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createPersistedQuery(␊ - input: {query: $query, appId: $appId, tags: $tags, description: $description, parent: $parent}␊ - ) {␊ - persistedQuery {␊ - id␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "CreatePersistedQueryMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchFindLoggedInServicesQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query FindLoggedInServicesQuery($nfToken: String!, $authlifyTokenId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - authlifyToken(authlifyTokenId: $authlifyTokenId) {␊ - serviceMetadata {␊ - loggedInServices {␊ - usedTestFlow␊ - friendlyServiceName␊ - ...LoggedInServicesFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: """12b5bdea-9bab-4124-a731-5e697b1553be""", doc: """Subset of LoggedInServices""") {␊ - friendlyServiceName␊ - service␊ - isLoggedIn␊ - usedTestFlow␊ - serviceInfo {␊ - logoUrl␊ - availableScopes {␊ - category␊ - scope␊ - display␊ - isDefault␊ - isRequired␊ - description␊ - title␊ - }␊ - }␊ - grantedScopes {␊ - scope␊ - }␊ - foreignUserId␊ - }\`,␊ - operationName: "FindLoggedInServicesQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeSetServiceAuthMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation SetServiceAuthMutation($service: OneGraphCustomServiceAuthServiceEnum!, $clientId: String!, $clientSecret: String!, $siteId: String!, $nfToken: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createServiceAuth(␊ - data: {service: $service, clientId: $clientId, clientSecret: $clientSecret, appId: $siteId, revealTokens: true}␊ - ) {␊ - app {␊ - serviceAuths {␊ - ...ServiceAuthFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: """12b5bdea-9bab-4164-a731-5e697b1553be""", doc: """Basic info on a Service Auth""") {␊ - id␊ - service␊ - clientId␊ - revealTokens␊ - scopes␊ - }\`,␊ - operationName: "SetServiceAuthMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeCreateCLISessionEventMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation CreateCLISessionEventMutation($nfToken: String!, $sessionId: String!, $payload: JSON!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createNetlifyCliTestEvent(␊ - input: {data: {payload: $payload}, sessionId: $sessionId}␊ - ) {␊ - event {␊ - id␊ - createdAt␊ - sessionId␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "CreateCLISessionEventMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchCliSessionByIdQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query CliSessionByIdQuery($nfToken: String!, $id: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - netlifyCliSession(id: $id) {␊ - id␊ - name␊ - netlifyUserId␊ - events {␊ - createdAt␊ - }␊ - createdAt␊ - lastEventAt␊ - metadata␊ - }␊ - }␊ - }\`,␊ - operationName: "CliSessionByIdQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchDeprecated_FindLoggedInServicesQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query Deprecated_FindLoggedInServicesQuery {␊ - me {␊ - serviceMetadata {␊ - loggedInServices {␊ - ...LoggedInServicesFragment␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: """12b5bdea-9bab-4124-a731-5e697b1553be""", doc: """Subset of LoggedInServices""") {␊ - friendlyServiceName␊ - service␊ - isLoggedIn␊ - usedTestFlow␊ - serviceInfo {␊ - logoUrl␊ - availableScopes {␊ - category␊ - scope␊ - display␊ - isDefault␊ - isRequired␊ - description␊ - title␊ - }␊ - }␊ - grantedScopes {␊ - scope␊ - }␊ - foreignUserId␊ - }\`,␊ - operationName: "Deprecated_FindLoggedInServicesQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeCreateEmptyPersonalTokenMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation CreateEmptyPersonalTokenMutation($nfToken: String!, $siteId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createPersonalTokenWithNetlifySiteAnchor(␊ - input: {name: "Netlify AuthManager Token", netlifySiteId: $siteId}␊ - ) {␊ - accessToken {␊ - token␊ - name␊ - anchor␊ - netlifyId␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "CreateEmptyPersonalTokenMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchServiceListQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query ServiceListQuery($logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) {␊ - oneGraph {␊ - services {␊ - friendlyServiceName␊ - logoUrl(style: $logoStyle)␊ - service␊ - slug␊ - supportsCustomRedirectUri␊ - supportsCustomServiceAuth␊ - supportsOauthLogin␊ - }␊ - }␊ - }\`,␊ - operationName: "ServiceListQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchAuthlifyTokenIdForPersonalToken = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query AuthlifyTokenIdForPersonalToken($personalToken: String!) {␊ - oneGraph {␊ - personalToken(accessToken: $personalToken) {␊ - netlifyId␊ - }␊ - }␊ - }\`,␊ - operationName: "AuthlifyTokenIdForPersonalToken",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchPersistedQueryQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query PersistedQueryQuery($nfToken: String!, $appId: String!, $id: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - persistedQuery(appId: $appId, id: $id) {␊ - id␊ - query␊ - allowedOperationNames␊ - description␊ - freeVariables␊ - fixedVariables␊ - tags␊ - }␊ - }␊ - }\`,␊ - operationName: "PersistedQueryQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchCliSessionsByAppIdQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query CliSessionsByAppIdQuery($nfToken: String!, $appId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - netlifyCliSessionsByAppId(appId: $appId, first: 10) {␊ - id␊ - name␊ - netlifyUserId␊ - events {␊ - createdAt␊ - }␊ - createdAt␊ - lastEventAt␊ - metadata␊ - }␊ - }␊ - }\`,␊ - operationName: "CliSessionsByAppIdQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchListServicesQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query ListServicesQuery($nfToken: String!, $siteId: String!, $logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - services(filter: {supportsOauthLogin: true}) {␊ - friendlyServiceName␊ - service␊ - slug␊ - logoUrl(style: $logoStyle)␊ - availableScopes {␊ - category␊ - scope␊ - display␊ - isDefault␊ - isRequired␊ - description␊ - title␊ - }␊ - }␊ - app(id: $siteId) {␊ - serviceAuths {␊ - ...ServiceAuthFragment␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: """12b5bdea-9bab-4164-a731-5e697b1553be""", doc: """Basic info on a Service Auth""") {␊ - id␊ - service␊ - clientId␊ - revealTokens␊ - scopes␊ - }\`,␊ - operationName: "ListServicesQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeUpsertAppForSiteMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation UpsertAppForSiteMutation($nfToken: String!, $siteId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - upsertAppForNetlifySite(input: {netlifySiteId: $siteId}) {␊ - org {␊ - id␊ - name␊ - }␊ - app {␊ - id␊ - name␊ - corsOrigins␊ - customCorsOrigins {␊ - friendlyServiceName␊ - displayName␊ - encodedValue␊ - }␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "UpsertAppForSiteMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeAddCORSOriginMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation AddCORSOriginMutation($nfToken: String!, $input: OneGraphAddCORSOriginToAppInput!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - addCORSOriginToApp(input: $input) {␊ - app {␊ - ...AppCORSOriginFragment␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment AppCORSOriginFragment on OneGraphApp @netlify(id: """e3d4bb8b-2fb5-48d8-b051-db6027224145""", doc: """Allowed CORS origins for calls to a site's Graph.""") {␊ - id␊ - corsOrigins␊ - customCorsOrigins {␊ - friendlyServiceName␊ - displayName␊ - encodedValue␊ - }␊ - netlifySiteNames␊ - }\`,␊ - operationName: "AddCORSOriginMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeRemoveCORSOriginMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation RemoveCORSOriginMutation($nfToken: String!, $input: OneGraphRemoveCORSOriginFromAppInput!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - removeCORSOriginFromApp(input: $input) {␊ - app {␊ - ...AppCORSOriginFragment␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment AppCORSOriginFragment on OneGraphApp @netlify(id: """e3d4bb8b-2fb5-48d8-b051-db6027224145""", doc: """Allowed CORS origins for calls to a site's Graph.""") {␊ - id␊ - corsOrigins␊ - customCorsOrigins {␊ - friendlyServiceName␊ - displayName␊ - encodedValue␊ - }␊ - netlifySiteNames␊ - }\`,␊ - operationName: "RemoveCORSOriginMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchCORSOriginsQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query CORSOriginsQuery($siteId: String!, $nfToken: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - app(id: $siteId) {␊ - ...AppCORSOriginFragment␊ - }␊ - }␊ - }␊ - ␊ - fragment AppCORSOriginFragment on OneGraphApp @netlify(id: """e3d4bb8b-2fb5-48d8-b051-db6027224145""", doc: """Allowed CORS origins for calls to a site's Graph.""") {␊ - id␊ - corsOrigins␊ - customCorsOrigins {␊ - friendlyServiceName␊ - displayName␊ - encodedValue␊ - }␊ - netlifySiteNames␊ - }\`,␊ - operationName: "CORSOriginsQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - const subscribeToTestSubscription = (␊ - variables,␊ - rawOptions␊ - ) => {␊ - const options = rawOptions || {};␊ - const netlifyGraphWebhookId = options.netlifyGraphWebhookId;␊ - const netlifyGraphWebhookUrl = options.webhookUrl || \`${process.env.DEPLOY_URL}/webhooks/TestSubscription?netlifyGraphWebhookId=${netlifyGraphWebhookId}\`;␊ - const secret = options.webhookSecret || process.env.NETLIFY_GRAPH_WEBHOOK_SECRET␊ - const fullVariables = {...variables, netlifyGraphWebhookUrl: netlifyGraphWebhookUrl, netlifyGraphWebhookSecret: { hmacSha256Key: secret }}␊ - ␊ - const subscriptionOperationDoc = \`subscription TestSubscription($minutes: Int = 1, $netlifyGraphWebhookUrl: String!, $netlifyGraphWebhookSecret: OneGraphSubscriptionSecretInput!) @netlify(id: """e3d4bb8b-2fb5-9898-b051-db6027224112""", doc: """A subscription with variables and a fragment to test code generation.""") {␊ - poll(␊ - schedule: {every: {minutes: $minutes}}␊ - onlyTriggerWhenPayloadChanged: true␊ - webhookUrl: $netlifyGraphWebhookUrl␊ - secret: $netlifyGraphWebhookSecret␊ - ) {␊ - query {␊ - me {␊ - serviceMetadata {␊ - loggedInServices {␊ - ...LoggedInServicesFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - }\`;␊ - ␊ - fetchNetlifyGraph({␊ - query: subscriptionOperationDoc,␊ - operationName: "TestSubscription",␊ - variables: fullVariables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - })␊ - }␊ - ␊ - const parseAndVerifyTestSubscriptionEvent = (event, options) => {␊ - if (!verifyRequestSignature({ event: event }, options)) {␊ - console.warn("Unable to verify signature for TestSubscription")␊ - return null␊ - }␊ - ␊ - return JSON.parse(event.body || '{}')␊ - }␊ - ␊ - /**␊ - * The generated NetlifyGraph library with your operations␊ - */␊ - const functions = {␊ - /**␊ - * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`).␊ - */␊ - executeUpdateCLISessionMetadataMutation : executeUpdateCLISessionMetadataMutation ,␊ - /**␊ - * Get the _metadata_ about a site's current GraphQL schema:␊ - * ␊ - * - enabled services␊ - * - schema id␊ - * - creation date␊ - * ␊ - * etc.␊ - */␊ - fetchAppSchemaQuery: fetchAppSchemaQuery,␊ - /**␊ - * Delete a OneGraph personal token for a user's site␊ - */␊ - executeDestroyTokenMutation : executeDestroyTokenMutation ,␊ - /**␊ - * Sign out of a service associated with a Authlify token␊ - */␊ - executeSignOutServicesMutation : executeSignOutServicesMutation ,␊ - /**␊ - * Update a service's (i.e. GitHub) enabled scope permissions␊ - */␊ - executeAddAuthsMutation : executeAddAuthsMutation ,␊ - /**␊ - * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use.␊ - */␊ - executeCreateNewSchemaMutation : executeCreateNewSchemaMutation ,␊ - /**␊ - * Delete a custom service auth␊ - */␊ - executeDeleteServiceAuthMutation : executeDeleteServiceAuthMutation ,␊ - /**␊ - * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution.␊ - */␊ - executeCreatePersistedQueryMutation : executeCreatePersistedQueryMutation ,␊ - /**␊ - * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site␊ - */␊ - fetchFindLoggedInServicesQuery: fetchFindLoggedInServicesQuery,␊ - /**␊ - * Create a custom service auth␊ - */␊ - executeSetServiceAuthMutation : executeSetServiceAuthMutation ,␊ - /**␊ - * Create a new session for the Netlify CLI to communicate with the React UI via events.␊ - */␊ - executeCreateCLISessionEventMutation : executeCreateCLISessionEventMutation ,␊ - /**␊ - * Get a Netlify CLI session by its id␊ - */␊ - fetchCliSessionByIdQuery: fetchCliSessionByIdQuery,␊ - /**␊ - * (Deprecated) Find logged in services␊ - */␊ - fetchDeprecated_FindLoggedInServicesQuery: fetchDeprecated_FindLoggedInServicesQuery,␊ - /**␊ - * Create a new OneGraph personal token for a user's site␊ - */␊ - executeCreateEmptyPersonalTokenMutation : executeCreateEmptyPersonalTokenMutation ,␊ - /**␊ - * Retrieve a list of _all_ supported services from OneGraph␊ - */␊ - fetchServiceListQuery: fetchServiceListQuery,␊ - /**␊ - * ␊ - */␊ - fetchAuthlifyTokenIdForPersonalToken: fetchAuthlifyTokenIdForPersonalToken,␊ - /**␊ - * Retrieve a previously persisted operations doc␊ - */␊ - fetchPersistedQueryQuery: fetchPersistedQueryQuery,␊ - /**␊ - * List all the CLI sessions belonging to a site␊ - */␊ - fetchCliSessionsByAppIdQuery: fetchCliSessionsByAppIdQuery,␊ - /**␊ - * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site.␊ - */␊ - fetchListServicesQuery: fetchListServicesQuery,␊ - /**␊ - * Ensure that an app resource exists on the OneGraph servers for a given site.␊ - */␊ - executeUpsertAppForSiteMutation : executeUpsertAppForSiteMutation ,␊ - /**␊ - * Add additional allowed CORS origins for calls to a site's Graph.␊ - */␊ - executeAddCORSOriginMutation : executeAddCORSOriginMutation ,␊ - /**␊ - * Remove the given CORS origins for calls to a site's Graph.␊ - */␊ - executeRemoveCORSOriginMutation : executeRemoveCORSOriginMutation ,␊ - /**␊ - * List the allowed CORS origins for calls to a site's Graph.␊ - */␊ - fetchCORSOriginsQuery: fetchCORSOriginsQuery,␊ - /**␊ - * A subscription with variables and a fragment to test code generation.␊ - */␊ - subscribeToTestSubscription:subscribeToTestSubscription,␊ - /**␊ - * Verify the event body is signed securely, and then parse the result.␊ - */␊ - parseAndVerifyTestSubscriptionEvent: parseAndVerifyTestSubscriptionEvent␊ - }␊ - ␊ - export default functions` - -## netlify graph function library runtime codegen library [netlify-builtin:remix-0.0.1]:./dummy/index.d.ts} - -> Snapshot 1 - - `/* eslint-disable */␊ - // @ts-nocheck␊ - // GENERATED VIA NETLIFY AUTOMATED DEV TOOLS, EDIT WITH CAUTION!␊ - ␊ - export type NetlifyGraphFunctionOptions = {␊ - /**␊ - * The accessToken to use for the request␊ - */␊ - accessToken?: string;␊ - /**␊ - * The siteId to use for the request␊ - * @default process.env.SITE_ID␊ - */␊ - siteId?: string;␊ - }␊ - ␊ - export type WebhookEvent = {␊ - body: string;␊ - headers: Record;␊ - };␊ - ␊ - export type GraphQLError = {␊ - "path": Array;␊ - "message": string;␊ - "extensions": Record;␊ - };␊ - ␊ - /**␊ - * Subset of LoggedInServices␊ - */␊ - export type LoggedInServicesFragment = {␊ - friendlyServiceName: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - isLoggedIn: boolean;␊ - usedTestFlow: boolean;␊ - serviceInfo: {␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - availableScopes?: Array<{␊ - category?: string;␊ - scope: string;␊ - display: string;␊ - isDefault: boolean;␊ - isRequired: boolean;␊ - description: string;␊ - title?: string;␊ - }>;␊ - };␊ - /**␊ - * The scopes that the user granted for this service. This is a best estimate of the scopes that were granted. Most services do not have a way to query the scopes on an auth, and some services do not return information about the scopes that were granted in the auth flow.␊ - */␊ - grantedScopes?: Array<{␊ - /**␊ - * The name of the scope that the underlying service uses.␊ - */␊ - scope: string;␊ - }>;␊ - foreignUserId?: string;␊ - };␊ - ␊ - ␊ - /**␊ - * Basic info on a Service Auth␊ - */␊ - export type ServiceAuthFragment = {␊ - /**␊ - * id for the service auth␊ - */␊ - id: string;␊ - /**␊ - * The service that the clientId and clientSecret belong to, e.g. "gmail"␊ - */␊ - service: string;␊ - /**␊ - * clientId for the serviceAuth.␊ - */␊ - clientId: string;␊ - /**␊ - * If true, the bearer token that is created fetchable by the user whose account the token grants access to.␊ - */␊ - revealTokens: boolean;␊ - /**␊ - * Optional scopes to use for the OAuth flow.␊ - */␊ - scopes?: Array;␊ - };␊ - ␊ - ␊ - /**␊ - * Allowed CORS origins for calls to a site's Graph.␊ - */␊ - export type AppCORSOriginFragment = {␊ - /**␊ - * The id of the OneGraph App␊ - */␊ - id: string;␊ - /**␊ - * The origins allowed for this OneGraph App from CORS requests␊ - */␊ - corsOrigins: Array;␊ - /**␊ - * Custom cors origins␊ - */␊ - customCorsOrigins: Array<{␊ - /**␊ - * The friendly service name for the cors origin␊ - */␊ - friendlyServiceName: string;␊ - /**␊ - * The name of the origin that should be displayed, e.g. oneblog for oneblog.netlify.app.␊ - */␊ - displayName: string;␊ - /**␊ - * The encoded value as a string, used to remove the custom cors origin.␊ - */␊ - encodedValue: string;␊ - }>;␊ - /**␊ - * Sites on Netlify associated with this app. OneGraph will allow CORS and authentication redirects to all previews, branch, and production deploys of these sites.␊ - */␊ - netlifySiteNames: Array;␊ - };␊ - ␊ - ␊ - export type UpdateCLISessionMetadataMutationInput = {␊ - "nfToken": string; ␊ - /**␊ - * The id of the session␊ - */␊ - "sessionId": string; ␊ - /**␊ - * Optional metadata for the session␊ - */␊ - "metadata": unknown␊ - };␊ - ␊ - export type UpdateCLISessionMetadataMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Update a CLI session.␊ - */␊ - updateNetlifyCliSession: {␊ - /**␊ - * The session that was updated.␊ - */␊ - session: {␊ - id: string;␊ - name?: string;␊ - metadata?: unknown;␊ - createdAt: string;␊ - lastEventAt?: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`).␊ - */␊ - export function executeUpdateCLISessionMetadataMutation (␊ - variables: UpdateCLISessionMetadataMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type AppSchemaQueryInput = {␊ - "nfToken": string; ␊ - /**␊ - * App id␊ - */␊ - "appId": string␊ - };␊ - ␊ - export type AppSchemaQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - app: {␊ - /**␊ - * Customizations to the default GraphQL schema␊ - */␊ - graphQLSchema?: {␊ - appId: string;␊ - createdAt: string;␊ - id: string;␊ - services: Array<{␊ - friendlyServiceName: string;␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - /**␊ - * Service string that can be provided in the URL when going through the oauth flow.␊ - */␊ - slug: string;␊ - supportsCustomRedirectUri: boolean;␊ - supportsCustomServiceAuth: boolean;␊ - supportsOauthLogin: boolean;␊ - }>;␊ - updatedAt: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Get the _metadata_ about a site's current GraphQL schema:␊ - * ␊ - * - enabled services␊ - * - schema id␊ - * - creation date␊ - * ␊ - * etc.␊ - */␊ - export function fetchAppSchemaQuery(␊ - variables: AppSchemaQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type DestroyTokenMutationInput = {␊ - "nfToken": string; ␊ - /**␊ - * Any OneGraph access token, refresh token, or JWT␊ - */␊ - "token"?: string; ␊ - /**␊ - * An Authlify Token identifier␊ - */␊ - "authlifyTokenId"?: string␊ - };␊ - ␊ - export type DestroyTokenMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Revokes a OneGraph access token, refresh token, or JWT. After a token is destroyed, it can no longer be used to authenticate with OneGraph.␊ - ␊ - If you destroy a JWT, external services that rely on the claims embedded in the JWT may still accept the JWT and you will also have to revoke the JWT though the external service's revocation process.␊ - */␊ - destroyToken: boolean;␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Delete a OneGraph personal token for a user's site␊ - */␊ - export function executeDestroyTokenMutation (␊ - variables: DestroyTokenMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type SignOutServicesMutationInput = {␊ - "services": Array<"ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS">; ␊ - "nfToken": string; ␊ - "authlifyTokenId": string␊ - };␊ - ␊ - export type SignOutServicesMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - signoutServices: {␊ - me: {␊ - /**␊ - * Metadata and logged-in state for all OneGraph services␊ - */␊ - serviceMetadata: {␊ - loggedInServices: Array;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Sign out of a service associated with a Authlify token␊ - */␊ - export function executeSignOutServicesMutation (␊ - variables: SignOutServicesMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type AddAuthsMutationInput = {␊ - "siteId": string; ␊ - "authlifyTokenId"?: string; ␊ - /**␊ - * Token that will be destroyed and have its auths moved to the personal token.␊ - */␊ - "sToken": string; ␊ - "nfToken": string␊ - };␊ - ␊ - export type AddAuthsMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - addAuthsToPersonalToken: {␊ - /**␊ - * Personal access token that was updated by this mutation␊ - */␊ - accessToken: {␊ - /**␊ - * Netlify-specific ID for the token␊ - */␊ - netlifyId?: string;␊ - /**␊ - * Bearer token␊ - */␊ - token: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Update a service's (i.e. GitHub) enabled scope permissions␊ - */␊ - export function executeAddAuthsMutation (␊ - variables: AddAuthsMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CreateNewSchemaMutationInput = {␊ - "nfToken": string; ␊ - "input": {/**␊ - * Whether to set this schema as the default for the app. Defaults to false.␊ - */␊ - "setAsDefaultForApp"?: boolean; /**␊ - * External GraphQL schemas to add␊ - */␊ - "externalGraphQLSchemas"?: Array<{/**␊ - * The id of the external GraphQL schema.␊ - */␊ - "externalGraphQLSchemaId": string}>; /**␊ - * Optional id of a Salesforce schema to attach to the app.␊ - */␊ - "salesforceSchemaId"?: string; /**␊ - * The optional id of the GraphQL schema that this was derived from.␊ - */␊ - "parentId"?: string; /**␊ - * The list of services that this schema should use. Leave blank if you want to add support for all supported services.␊ - */␊ - "enabledServices"?: Array<"ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS">; /**␊ - * The id of the app that the schema should belong to.␊ - */␊ - "appId": string}␊ - };␊ - ␊ - export type CreateNewSchemaMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - createGraphQLSchema: {␊ - app: {␊ - /**␊ - * Customizations to the default GraphQL schema␊ - */␊ - graphQLSchema?: {␊ - id: string;␊ - };␊ - };␊ - graphqlSchema: {␊ - id: string;␊ - services: Array<{␊ - friendlyServiceName: string;␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - /**␊ - * Service string that can be provided in the URL when going through the oauth flow.␊ - */␊ - slug: string;␊ - supportsCustomRedirectUri: boolean;␊ - supportsCustomServiceAuth: boolean;␊ - supportsOauthLogin: boolean;␊ - }>;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use.␊ - */␊ - export function executeCreateNewSchemaMutation (␊ - variables: CreateNewSchemaMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type DeleteServiceAuthMutationInput = {␊ - "siteId": string; ␊ - "serviceAuthId": string; ␊ - "nfToken": string␊ - };␊ - ␊ - export type DeleteServiceAuthMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - destroyServiceAuth: {␊ - app: {␊ - /**␊ - * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app␊ - */␊ - serviceAuths: Array;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Delete a custom service auth␊ - */␊ - export function executeDeleteServiceAuthMutation (␊ - variables: DeleteServiceAuthMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CreatePersistedQueryMutationInput = {␊ - "nfToken": string; ␊ - "appId": string; ␊ - "query": string; ␊ - /**␊ - * List of tags to add to the persisted query. Tags are free-form text that can be used to categorize persisted queries. Each tag must be under 256 characters and there can be a maximum of 10 tags on a single persisted query.␊ - */␊ - "tags": Array; ␊ - /**␊ - * A description for the persisted query. Maximum length is 2096 characters.␊ - */␊ - "description": string; ␊ - /**␊ - * The parent persisted query. It can be used to track lineage of the query.␊ - */␊ - "parent"?: {/**␊ - * An optional list of tags to remove from the parent query. If any of the provided tags aren't present on the parent, the mutation will fail. No persisted queries will be created and no tags will be removed from the parent.␊ - */␊ - "removeTags"?: Array; /**␊ - * The id of the parent␊ - */␊ - "id": string}␊ - };␊ - ␊ - export type CreatePersistedQueryMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - createPersistedQuery: {␊ - persistedQuery: {␊ - /**␊ - * The persisted query's id.␊ - */␊ - id: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution.␊ - */␊ - export function executeCreatePersistedQueryMutation (␊ - variables: CreatePersistedQueryMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type FindLoggedInServicesQueryInput = {␊ - "nfToken": string; ␊ - "authlifyTokenId": string␊ - };␊ - ␊ - export type FindLoggedInServicesQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - authlifyToken: {␊ - /**␊ - * Metadata and logged-in state for all OneGraph services␊ - */␊ - serviceMetadata: {␊ - loggedInServices: Array;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site␊ - */␊ - export function fetchFindLoggedInServicesQuery(␊ - variables: FindLoggedInServicesQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type SetServiceAuthMutationInput = {␊ - "service": "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK"; ␊ - "clientId": string; ␊ - "clientSecret": string; ␊ - "siteId": string; ␊ - "nfToken": string␊ - };␊ - ␊ - export type SetServiceAuthMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - createServiceAuth: {␊ - app: {␊ - /**␊ - * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app␊ - */␊ - serviceAuths: Array;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Create a custom service auth␊ - */␊ - export function executeSetServiceAuthMutation (␊ - variables: SetServiceAuthMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CreateCLISessionEventMutationInput = {␊ - "nfToken": string; ␊ - "sessionId": string; ␊ - "payload": unknown␊ - };␊ - ␊ - export type CreateCLISessionEventMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - createNetlifyCliTestEvent: {␊ - event: {␊ - id: string;␊ - createdAt: string;␊ - sessionId: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Create a new session for the Netlify CLI to communicate with the React UI via events.␊ - */␊ - export function executeCreateCLISessionEventMutation (␊ - variables: CreateCLISessionEventMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CliSessionByIdQueryInput = {␊ - "nfToken": string; ␊ - "id": string␊ - };␊ - ␊ - export type CliSessionByIdQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Get a Netlify CLI session by its id.␊ - */␊ - netlifyCliSession: {␊ - id: string;␊ - name?: string;␊ - netlifyUserId: string;␊ - events: Array<{␊ - createdAt: string;␊ - }>;␊ - createdAt: string;␊ - lastEventAt?: string;␊ - metadata?: unknown;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Get a Netlify CLI session by its id␊ - */␊ - export function fetchCliSessionByIdQuery(␊ - variables: CliSessionByIdQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - ␊ - export type Deprecated_FindLoggedInServicesQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - me: {␊ - /**␊ - * Metadata and logged-in state for all OneGraph services␊ - */␊ - serviceMetadata: {␊ - loggedInServices: Array;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * (Deprecated) Find logged in services␊ - */␊ - export function fetchDeprecated_FindLoggedInServicesQuery(␊ - /**␊ - * Pass \`{}\` as no variables are defined for this function.␊ - */␊ - variables: Record,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CreateEmptyPersonalTokenMutationInput = {␊ - "nfToken": string; ␊ - "siteId": string␊ - };␊ - ␊ - export type CreateEmptyPersonalTokenMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Creates an empty personal token with a Netlify site anchor␊ - */␊ - createPersonalTokenWithNetlifySiteAnchor: {␊ - /**␊ - * Personal access token that was created by this mutation␊ - */␊ - accessToken: {␊ - /**␊ - * Bearer token␊ - */␊ - token: string;␊ - /**␊ - * Token name, if it is a personal access token␊ - */␊ - name?: string;␊ - /**␊ - * The anchor is like two-factor auth for the token. It ensures that the person who adds auth to the token is the same as the person who created the token.␊ - */␊ - anchor?: "ONEGRAPH_USER" | "NETLIFY_USER" | "NETLIFY_SITE";␊ - /**␊ - * Netlify-specific ID for the token␊ - */␊ - netlifyId?: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Create a new OneGraph personal token for a user's site␊ - */␊ - export function executeCreateEmptyPersonalTokenMutation (␊ - variables: CreateEmptyPersonalTokenMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type ServiceListQueryInput = {␊ - "logoStyle"?: "DEFAULT" | "ROUNDED_RECTANGLE"␊ - };␊ - ␊ - export type ServiceListQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - services: Array<{␊ - friendlyServiceName: string;␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - /**␊ - * Service string that can be provided in the URL when going through the oauth flow.␊ - */␊ - slug: string;␊ - supportsCustomRedirectUri: boolean;␊ - supportsCustomServiceAuth: boolean;␊ - supportsOauthLogin: boolean;␊ - }>;␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Retrieve a list of _all_ supported services from OneGraph␊ - */␊ - export function fetchServiceListQuery(␊ - variables: ServiceListQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type AuthlifyTokenIdForPersonalTokenInput = {␊ - "personalToken": string␊ - };␊ - ␊ - export type AuthlifyTokenIdForPersonalToken = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Personal access token lookup␊ - */␊ - personalToken?: {␊ - /**␊ - * Netlify-specific ID for the token␊ - */␊ - netlifyId?: string;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * ␊ - */␊ - export function fetchAuthlifyTokenIdForPersonalToken(␊ - variables: AuthlifyTokenIdForPersonalTokenInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type PersistedQueryQueryInput = {␊ - "nfToken": string; ␊ - /**␊ - * The id of the app that the persisted query belongs to.␊ - */␊ - "appId": string; ␊ - /**␊ - * The id of the persisted query.␊ - */␊ - "id": string␊ - };␊ - ␊ - export type PersistedQueryQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Fetch a single persisted query by its id.␊ - */␊ - persistedQuery: {␊ - /**␊ - * The persisted query's id.␊ - */␊ - id: string;␊ - /**␊ - * The persisted query's query string.␊ - */␊ - query: string;␊ - /**␊ - * The list of operation names that the caller of the query is allowed to execute. If the field is null, then all operationNames are allowed.␊ - */␊ - allowedOperationNames?: Array;␊ - /**␊ - * The user-defined description that was added to the query␊ - */␊ - description?: string;␊ - /**␊ - * The list of variables that the caller of the query is allowed to provide.␊ - */␊ - freeVariables?: Array;␊ - /**␊ - * The default variables provided to the query.␊ - */␊ - fixedVariables?: unknown;␊ - /**␊ - * The list of user-defined tags that were added to the query␊ - */␊ - tags?: Array;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Retrieve a previously persisted operations doc␊ - */␊ - export function fetchPersistedQueryQuery(␊ - variables: PersistedQueryQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CliSessionsByAppIdQueryInput = {␊ - "nfToken": string; ␊ - "appId": string␊ - };␊ - ␊ - export type CliSessionsByAppIdQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Netlify CLI sessions, orderd by createdAt descending.␊ - */␊ - netlifyCliSessionsByAppId: Array<{␊ - id: string;␊ - name?: string;␊ - netlifyUserId: string;␊ - events: Array<{␊ - createdAt: string;␊ - }>;␊ - createdAt: string;␊ - lastEventAt?: string;␊ - metadata?: unknown;␊ - }>;␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * List all the CLI sessions belonging to a site␊ - */␊ - export function fetchCliSessionsByAppIdQuery(␊ - variables: CliSessionsByAppIdQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type ListServicesQueryInput = {␊ - "nfToken": string; ␊ - /**␊ - * App id␊ - */␊ - "siteId": string; ␊ - "logoStyle"?: "DEFAULT" | "ROUNDED_RECTANGLE"␊ - };␊ - ␊ - export type ListServicesQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - services: Array<{␊ - friendlyServiceName: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - /**␊ - * Service string that can be provided in the URL when going through the oauth flow.␊ - */␊ - slug: string;␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - availableScopes?: Array<{␊ - category?: string;␊ - scope: string;␊ - display: string;␊ - isDefault: boolean;␊ - isRequired: boolean;␊ - description: string;␊ - title?: string;␊ - }>;␊ - }>;␊ - app: {␊ - /**␊ - * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app␊ - */␊ - serviceAuths: Array;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site.␊ - */␊ - export function fetchListServicesQuery(␊ - variables: ListServicesQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type UpsertAppForSiteMutationInput = {␊ - "nfToken": string; ␊ - "siteId": string␊ - };␊ - ␊ - export type UpsertAppForSiteMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - upsertAppForNetlifySite: {␊ - /**␊ - * The app that is associated with the Netlify account.␊ - */␊ - org: {␊ - /**␊ - * The id of the OneGraph Org␊ - */␊ - id: string;␊ - /**␊ - * The name of the OneGraph Org␊ - */␊ - name: string;␊ - };␊ - /**␊ - * The app that is associated with the Netlify site.␊ - */␊ - app: {␊ - /**␊ - * The id of the OneGraph App␊ - */␊ - id: string;␊ - /**␊ - * The name of the OneGraph App␊ - */␊ - name: string;␊ - /**␊ - * The origins allowed for this OneGraph App from CORS requests␊ - */␊ - corsOrigins: Array;␊ - /**␊ - * Custom cors origins␊ - */␊ - customCorsOrigins: Array<{␊ - /**␊ - * The friendly service name for the cors origin␊ - */␊ - friendlyServiceName: string;␊ - /**␊ - * The name of the origin that should be displayed, e.g. oneblog for oneblog.netlify.app.␊ - */␊ - displayName: string;␊ - /**␊ - * The encoded value as a string, used to remove the custom cors origin.␊ - */␊ - encodedValue: string;␊ - }>;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Ensure that an app resource exists on the OneGraph servers for a given site.␊ - */␊ - export function executeUpsertAppForSiteMutation (␊ - variables: UpsertAppForSiteMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type AddCORSOriginMutationInput = {␊ - "nfToken": string; ␊ - "input": {"corsOrigin": string; "appId": string}␊ - };␊ - ␊ - export type AddCORSOriginMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - addCORSOriginToApp: {␊ - app: AppCORSOriginFragment ;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Add additional allowed CORS origins for calls to a site's Graph.␊ - */␊ - export function executeAddCORSOriginMutation (␊ - variables: AddCORSOriginMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type RemoveCORSOriginMutationInput = {␊ - "nfToken": string; ␊ - "input": {"corsOrigin": string; "appId": string}␊ - };␊ - ␊ - export type RemoveCORSOriginMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - removeCORSOriginFromApp: {␊ - app: AppCORSOriginFragment ;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Remove the given CORS origins for calls to a site's Graph.␊ - */␊ - export function executeRemoveCORSOriginMutation (␊ - variables: RemoveCORSOriginMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CORSOriginsQueryInput = {␊ - /**␊ - * App id␊ - */␊ - "siteId": string; ␊ - "nfToken": string␊ - };␊ - ␊ - export type CORSOriginsQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - app: AppCORSOriginFragment ;␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * List the allowed CORS origins for calls to a site's Graph.␊ - */␊ - export function fetchCORSOriginsQuery(␊ - variables: CORSOriginsQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - /**␊ - * A subscription with variables and a fragment to test code generation.␊ - */␊ - export function subscribeToTestSubscription(␊ - /**␊ - * This will be available in your webhook handler as a query parameter.␊ - * Use this to keep track of which subscription you're receiving␊ - * events for.␊ - */␊ - variables: {␊ - /**␊ - * How many minutes to wait before re-running the underlying query␊ - */␊ - "minutes"?: number␊ - },␊ - options?: {␊ - /**␊ - * The accessToken to use for the lifetime of the subscription.␊ - */␊ - accessToken?: string | null | undefined;␊ - /**␊ - * A string id that will be passed to your webhook handler as a query parameter␊ - * along with each event.␊ - * This can be used to keep track of which subscription you're receiving␊ - */␊ - netlifyGraphWebhookId?: string | null | undefined;␊ - /**␊ - * The absolute URL of your webhook handler to handle events from this subscription.␊ - */␊ - webhookUrl?: string | null | undefined;␊ - /**␊ - * The secret to use when signing the webhook request. Use this to verify␊ - * that the webhook payload is coming from Netlify Graph. Defaults to the␊ - * value of the NETLIFY_GRAPH_WEBHOOK_SECRET environment variable.␊ - */␊ - webhookSecret?: string | null | undefined;␊ - }) : void␊ - ␊ - export type TestSubscriptionEvent = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - poll: {␊ - query: {␊ - me: {␊ - /**␊ - * Metadata and logged-in state for all OneGraph services␊ - */␊ - serviceMetadata: {␊ - loggedInServices: Array>;␊ - };␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - }␊ - ␊ - /**␊ - * Verify the TestSubscription event body is signed securely, and then parse the result.␊ - */␊ - export function parseAndVerifyTestSubscriptionEvent (/** A Netlify Handler Event */ event : WebhookEvent) : null | TestSubscriptionEvent␊ - ␊ - ␊ - export interface Functions {␊ - /**␊ - * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`).␊ - */␊ - executeUpdateCLISessionMetadataMutation : typeof executeUpdateCLISessionMetadataMutation ,␊ - /**␊ - * Get the _metadata_ about a site's current GraphQL schema:␊ - * ␊ - * - enabled services␊ - * - schema id␊ - * - creation date␊ - * ␊ - * etc.␊ - */␊ - fetchAppSchemaQuery: typeof fetchAppSchemaQuery,␊ - /**␊ - * Delete a OneGraph personal token for a user's site␊ - */␊ - executeDestroyTokenMutation : typeof executeDestroyTokenMutation ,␊ - /**␊ - * Sign out of a service associated with a Authlify token␊ - */␊ - executeSignOutServicesMutation : typeof executeSignOutServicesMutation ,␊ - /**␊ - * Update a service's (i.e. GitHub) enabled scope permissions␊ - */␊ - executeAddAuthsMutation : typeof executeAddAuthsMutation ,␊ - /**␊ - * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use.␊ - */␊ - executeCreateNewSchemaMutation : typeof executeCreateNewSchemaMutation ,␊ - /**␊ - * Delete a custom service auth␊ - */␊ - executeDeleteServiceAuthMutation : typeof executeDeleteServiceAuthMutation ,␊ - /**␊ - * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution.␊ - */␊ - executeCreatePersistedQueryMutation : typeof executeCreatePersistedQueryMutation ,␊ - /**␊ - * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site␊ - */␊ - fetchFindLoggedInServicesQuery: typeof fetchFindLoggedInServicesQuery,␊ - /**␊ - * Create a custom service auth␊ - */␊ - executeSetServiceAuthMutation : typeof executeSetServiceAuthMutation ,␊ - /**␊ - * Create a new session for the Netlify CLI to communicate with the React UI via events.␊ - */␊ - executeCreateCLISessionEventMutation : typeof executeCreateCLISessionEventMutation ,␊ - /**␊ - * Get a Netlify CLI session by its id␊ - */␊ - fetchCliSessionByIdQuery: typeof fetchCliSessionByIdQuery,␊ - /**␊ - * (Deprecated) Find logged in services␊ - */␊ - fetchDeprecated_FindLoggedInServicesQuery: typeof fetchDeprecated_FindLoggedInServicesQuery,␊ - /**␊ - * Create a new OneGraph personal token for a user's site␊ - */␊ - executeCreateEmptyPersonalTokenMutation : typeof executeCreateEmptyPersonalTokenMutation ,␊ - /**␊ - * Retrieve a list of _all_ supported services from OneGraph␊ - */␊ - fetchServiceListQuery: typeof fetchServiceListQuery,␊ - /**␊ - * ␊ - */␊ - fetchAuthlifyTokenIdForPersonalToken: typeof fetchAuthlifyTokenIdForPersonalToken,␊ - /**␊ - * Retrieve a previously persisted operations doc␊ - */␊ - fetchPersistedQueryQuery: typeof fetchPersistedQueryQuery,␊ - /**␊ - * List all the CLI sessions belonging to a site␊ - */␊ - fetchCliSessionsByAppIdQuery: typeof fetchCliSessionsByAppIdQuery,␊ - /**␊ - * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site.␊ - */␊ - fetchListServicesQuery: typeof fetchListServicesQuery,␊ - /**␊ - * Ensure that an app resource exists on the OneGraph servers for a given site.␊ - */␊ - executeUpsertAppForSiteMutation : typeof executeUpsertAppForSiteMutation ,␊ - /**␊ - * Add additional allowed CORS origins for calls to a site's Graph.␊ - */␊ - executeAddCORSOriginMutation : typeof executeAddCORSOriginMutation ,␊ - /**␊ - * Remove the given CORS origins for calls to a site's Graph.␊ - */␊ - executeRemoveCORSOriginMutation : typeof executeRemoveCORSOriginMutation ,␊ - /**␊ - * List the allowed CORS origins for calls to a site's Graph.␊ - */␊ - fetchCORSOriginsQuery: typeof fetchCORSOriginsQuery,␊ - /**␊ - * A subscription with variables and a fragment to test code generation.␊ - */␊ - subscribeToTestSubscription:subscribeToTestSubscription,␊ - /**␊ - * Verify the event body is signed securely, and then parse the result.␊ - */␊ - parseAndVerifyTestSubscriptionEvent: typeof parseAndVerifyTestSubscriptionEvent␊ - }␊ - ␊ - export const functions: Functions;␊ - ␊ - export default functions;␊ - ` - -## netlify graph function library runtime codegen library [netlify-builtin:serverless-0.0.1]:./dummy/index.js} - -> Snapshot 1 - - `/* eslint-disable */␊ - // @ts-nocheck␊ - // GENERATED VIA NETLIFY AUTOMATED DEV TOOLS, EDIT WITH CAUTION!␊ - ␊ - // Basic LRU cache implementation␊ - const makeLRUCache = (max) => {␊ - return { max: max, cache: new Map() };␊ - };␊ - ␊ - const oldestCacheKey = (lru) => {␊ - return lru.keys().next().value␊ - }␊ - ␊ - // Depend on Map keeping track of insertion order␊ - const getFromCache = (lru, key) => {␊ - const item = lru.cache.get(key);␊ - if (item) {␊ - // Delete key and re-insert so key is now at the end,␊ - // and now the last to be gc'd.␊ - lru.cache.delete(key);␊ - lru.cache.set(key, item);␊ - }␊ - return item;␊ - };␊ - ␊ - const setInCache = (lru, key, value) => {␊ - if (lru.cache.has(key)) {␊ - lru.cache.delete(key);␊ - }␊ - if (lru.cache.size == lru.max) {␊ - const cacheKey = oldestCacheKey(lru);␊ - ␊ - if (cacheKey) {␊ - lru.cache.delete(cacheKey);␊ - }␊ - }␊ - ␊ - lru.cache.set(key, value);␊ - };␊ - ␊ - // Cache the results of the Netlify Graph API for conditional requests␊ - const cache = makeLRUCache(100);␊ - ␊ - const calculateCacheKey = (payload) => {␊ - return JSON.stringify(payload);␊ - };␊ - ␊ - const schemaId = 'stable-schema-id';␊ - ␊ - const netlifyGraphHostWithProtocol =␊ - process.env.NETLIFY_GRAPH_HOST_WITH_PROTOCOL || 'https://graph.netlify.com';␊ - ␊ - const makeNetlifyGraphUrl = ({ operationName, siteId }) => {␊ - return (␊ - netlifyGraphHostWithProtocol +␊ - '/graphql?app_id=' +␊ - siteId +␊ - '&operationName=' +␊ - operationName +␊ - '&schema_id=' +␊ - schemaId␊ - );␊ - };␊ - ␊ - const httpFetch = (operationName, options) => {␊ - const reqBody = options.body || null;␊ - const userHeaders = options.headers || {};␊ - const headers = {␊ - ...userHeaders,␊ - 'Content-Type': 'application/json',␊ - };␊ - ␊ - const timeoutMs = 30_000;␊ - ␊ - const reqOptions = {␊ - method: 'POST',␊ - headers: headers,␊ - timeout: timeoutMs,␊ - body: reqBody,␊ - };␊ - ␊ - const siteId = options.siteId || process.env.SITE_ID;␊ - const netlifyGraphUrl = makeNetlifyGraphUrl({ operationName: operationName, siteId: siteId });␊ - ␊ - return fetch(netlifyGraphUrl, reqOptions).then((body) => {␊ - return body.text().then((bodyString) => {␊ - const headers = {};␊ - body.headers.forEach((k, v) => (headers[k] = v));␊ - ␊ - return {␊ - body: bodyString,␊ - headers: headers,␊ - status: body.status,␊ - };␊ - });␊ - });␊ - };␊ - ␊ - const fetchNetlifyGraph = function fetchNetlifyGraph(input) {␊ - const query = input.query;␊ - const docId = input.doc_id;␊ - const operationName = input.operationName;␊ - const variables = input.variables;␊ - ␊ - const options = input.options || {};␊ - const accessToken = options.accessToken;␊ - ␊ - const payload = {␊ - query: query,␊ - doc_id: docId,␊ - variables: variables,␊ - operationName: operationName,␊ - };␊ - ␊ - let cachedOrLiveValue = new Promise((resolve) => {␊ - const cacheKey = calculateCacheKey(payload);␊ - ␊ - // Check the cache for a previous result␊ - const cachedResultPair = getFromCache(cache, cacheKey);␊ - ␊ - let conditionalHeaders = {␊ - 'If-None-Match': '',␊ - };␊ - let cachedResultValue;␊ - ␊ - if (cachedResultPair) {␊ - const [etag, previousResult] = cachedResultPair;␊ - conditionalHeaders = {␊ - 'If-None-Match': etag,␊ - };␊ - cachedResultValue = previousResult;␊ - }␊ - ␊ - const response = httpFetch(operationName, {␊ - ...options,␊ - method: 'POST',␊ - headers: {␊ - ...conditionalHeaders,␊ - Authorization: accessToken ? 'Bearer ' + accessToken : '',␊ - },␊ - body: JSON.stringify(payload),␊ - });␊ - ␊ - response.then((result) => {␊ - // Check response headers for a 304 Not Modified␊ - if (result.status === 304) {␊ - // Return the cached result␊ - resolve(cachedResultValue);␊ - } else if (result.status === 200) {␊ - // Update the cache with the new etag and result␊ - const etag = result.headers['etag'];␊ - const resultJson = JSON.parse(result.body);␊ - if (etag) {␊ - // Make a note of the new etag for the given payload␊ - setInCache(cache, cacheKey, [etag, resultJson]);␊ - }␊ - resolve(resultJson);␊ - } else {␊ - return result.json().then((json) => {␊ - resolve(json);␊ - });␊ - }␊ - });␊ - });␊ - ␊ - return cachedOrLiveValue;␊ - };␊ - ␊ - export const executeUpdateCLISessionMetadataMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation UpdateCLISessionMetadataMutation($nfToken: String!, $sessionId: String!, $metadata: JSON!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - updateNetlifyCliSession(input: {id: $sessionId, metadata: $metadata}) {␊ - session {␊ - id␊ - name␊ - metadata␊ - createdAt␊ - lastEventAt␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "UpdateCLISessionMetadataMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchAppSchemaQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query AppSchemaQuery($nfToken: String!, $appId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - app(id: $appId) {␊ - graphQLSchema {␊ - appId␊ - createdAt␊ - id␊ - services {␊ - friendlyServiceName␊ - logoUrl␊ - service␊ - slug␊ - supportsCustomRedirectUri␊ - supportsCustomServiceAuth␊ - supportsOauthLogin␊ - }␊ - updatedAt␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "AppSchemaQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeDestroyTokenMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation DestroyTokenMutation($nfToken: String!, $token: String, $authlifyTokenId: String) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - destroyToken(token: $token, authlifyTokenId: $authlifyTokenId)␊ - }␊ - }\`,␊ - operationName: "DestroyTokenMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeSignOutServicesMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation SignOutServicesMutation($services: [OneGraphServiceEnum!]!, $nfToken: String!, $authlifyTokenId: String!) {␊ - signoutServices(␊ - data: {services: $services, anchorAuth: {netlifyAuth: {oauthToken: $nfToken}}, authlifyTokenId: $authlifyTokenId}␊ - ) {␊ - me {␊ - serviceMetadata {␊ - loggedInServices {␊ - ...LoggedInServicesFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: """12b5bdea-9bab-4124-a731-5e697b1553be""", doc: """Subset of LoggedInServices""") {␊ - friendlyServiceName␊ - service␊ - isLoggedIn␊ - usedTestFlow␊ - serviceInfo {␊ - logoUrl␊ - availableScopes {␊ - category␊ - scope␊ - display␊ - isDefault␊ - isRequired␊ - description␊ - title␊ - }␊ - }␊ - grantedScopes {␊ - scope␊ - }␊ - foreignUserId␊ - }\`,␊ - operationName: "SignOutServicesMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeAddAuthsMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation AddAuthsMutation($siteId: String!, $authlifyTokenId: String, $sToken: String!, $nfToken: String!) {␊ - oneGraph {␊ - addAuthsToPersonalToken(␊ - input: {anchorAuth: {netlifyAuth: {oauthToken: $nfToken}}, sacrificialToken: $sToken, authlifyTokenId: $authlifyTokenId, appId: $siteId}␊ - ) {␊ - accessToken {␊ - netlifyId␊ - token␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "AddAuthsMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeCreateNewSchemaMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation CreateNewSchemaMutation($nfToken: String!, $input: OneGraphCreateGraphQLSchemaInput!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createGraphQLSchema(input: $input) {␊ - app {␊ - graphQLSchema {␊ - id␊ - }␊ - }␊ - graphqlSchema {␊ - id␊ - services {␊ - friendlyServiceName␊ - logoUrl␊ - service␊ - slug␊ - supportsCustomRedirectUri␊ - supportsCustomServiceAuth␊ - supportsOauthLogin␊ - }␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "CreateNewSchemaMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeDeleteServiceAuthMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation DeleteServiceAuthMutation($siteId: String!, $serviceAuthId: String!, $nfToken: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - destroyServiceAuth(data: {appId: $siteId, serviceAuthId: $serviceAuthId}) {␊ - app {␊ - serviceAuths {␊ - ...ServiceAuthFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: """12b5bdea-9bab-4164-a731-5e697b1553be""", doc: """Basic info on a Service Auth""") {␊ - id␊ - service␊ - clientId␊ - revealTokens␊ - scopes␊ - }\`,␊ - operationName: "DeleteServiceAuthMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeCreatePersistedQueryMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation CreatePersistedQueryMutation($nfToken: String!, $appId: String!, $query: String!, $tags: [String!]!, $description: String!, $parent: OneGraphCreatePersistedQueryParentInput) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createPersistedQuery(␊ - input: {query: $query, appId: $appId, tags: $tags, description: $description, parent: $parent}␊ - ) {␊ - persistedQuery {␊ - id␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "CreatePersistedQueryMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchFindLoggedInServicesQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query FindLoggedInServicesQuery($nfToken: String!, $authlifyTokenId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - authlifyToken(authlifyTokenId: $authlifyTokenId) {␊ - serviceMetadata {␊ - loggedInServices {␊ - usedTestFlow␊ - friendlyServiceName␊ - ...LoggedInServicesFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: """12b5bdea-9bab-4124-a731-5e697b1553be""", doc: """Subset of LoggedInServices""") {␊ - friendlyServiceName␊ - service␊ - isLoggedIn␊ - usedTestFlow␊ - serviceInfo {␊ - logoUrl␊ - availableScopes {␊ - category␊ - scope␊ - display␊ - isDefault␊ - isRequired␊ - description␊ - title␊ - }␊ - }␊ - grantedScopes {␊ - scope␊ - }␊ - foreignUserId␊ - }\`,␊ - operationName: "FindLoggedInServicesQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeSetServiceAuthMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation SetServiceAuthMutation($service: OneGraphCustomServiceAuthServiceEnum!, $clientId: String!, $clientSecret: String!, $siteId: String!, $nfToken: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createServiceAuth(␊ - data: {service: $service, clientId: $clientId, clientSecret: $clientSecret, appId: $siteId, revealTokens: true}␊ - ) {␊ - app {␊ - serviceAuths {␊ - ...ServiceAuthFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: """12b5bdea-9bab-4164-a731-5e697b1553be""", doc: """Basic info on a Service Auth""") {␊ - id␊ - service␊ - clientId␊ - revealTokens␊ - scopes␊ - }\`,␊ - operationName: "SetServiceAuthMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeCreateCLISessionEventMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation CreateCLISessionEventMutation($nfToken: String!, $sessionId: String!, $payload: JSON!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createNetlifyCliTestEvent(␊ - input: {data: {payload: $payload}, sessionId: $sessionId}␊ - ) {␊ - event {␊ - id␊ - createdAt␊ - sessionId␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "CreateCLISessionEventMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchCliSessionByIdQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query CliSessionByIdQuery($nfToken: String!, $id: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - netlifyCliSession(id: $id) {␊ - id␊ - name␊ - netlifyUserId␊ - events {␊ - createdAt␊ - }␊ - createdAt␊ - lastEventAt␊ - metadata␊ - }␊ - }␊ - }\`,␊ - operationName: "CliSessionByIdQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchDeprecated_FindLoggedInServicesQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query Deprecated_FindLoggedInServicesQuery {␊ - me {␊ - serviceMetadata {␊ - loggedInServices {␊ - ...LoggedInServicesFragment␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment LoggedInServicesFragment on OneGraphServiceMetadata @netlify(id: """12b5bdea-9bab-4124-a731-5e697b1553be""", doc: """Subset of LoggedInServices""") {␊ - friendlyServiceName␊ - service␊ - isLoggedIn␊ - usedTestFlow␊ - serviceInfo {␊ - logoUrl␊ - availableScopes {␊ - category␊ - scope␊ - display␊ - isDefault␊ - isRequired␊ - description␊ - title␊ - }␊ - }␊ - grantedScopes {␊ - scope␊ - }␊ - foreignUserId␊ - }\`,␊ - operationName: "Deprecated_FindLoggedInServicesQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeCreateEmptyPersonalTokenMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation CreateEmptyPersonalTokenMutation($nfToken: String!, $siteId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - createPersonalTokenWithNetlifySiteAnchor(␊ - input: {name: "Netlify AuthManager Token", netlifySiteId: $siteId}␊ - ) {␊ - accessToken {␊ - token␊ - name␊ - anchor␊ - netlifyId␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "CreateEmptyPersonalTokenMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchServiceListQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query ServiceListQuery($logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) {␊ - oneGraph {␊ - services {␊ - friendlyServiceName␊ - logoUrl(style: $logoStyle)␊ - service␊ - slug␊ - supportsCustomRedirectUri␊ - supportsCustomServiceAuth␊ - supportsOauthLogin␊ - }␊ - }␊ - }\`,␊ - operationName: "ServiceListQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchAuthlifyTokenIdForPersonalToken = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query AuthlifyTokenIdForPersonalToken($personalToken: String!) {␊ - oneGraph {␊ - personalToken(accessToken: $personalToken) {␊ - netlifyId␊ - }␊ - }␊ - }\`,␊ - operationName: "AuthlifyTokenIdForPersonalToken",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchPersistedQueryQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query PersistedQueryQuery($nfToken: String!, $appId: String!, $id: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - persistedQuery(appId: $appId, id: $id) {␊ - id␊ - query␊ - allowedOperationNames␊ - description␊ - freeVariables␊ - fixedVariables␊ - tags␊ - }␊ - }␊ - }\`,␊ - operationName: "PersistedQueryQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchCliSessionsByAppIdQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query CliSessionsByAppIdQuery($nfToken: String!, $appId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - netlifyCliSessionsByAppId(appId: $appId, first: 10) {␊ - id␊ - name␊ - netlifyUserId␊ - events {␊ - createdAt␊ - }␊ - createdAt␊ - lastEventAt␊ - metadata␊ - }␊ - }␊ - }\`,␊ - operationName: "CliSessionsByAppIdQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchListServicesQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query ListServicesQuery($nfToken: String!, $siteId: String!, $logoStyle: OneGraphAppLogoStyleEnum = ROUNDED_RECTANGLE) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - services(filter: {supportsOauthLogin: true}) {␊ - friendlyServiceName␊ - service␊ - slug␊ - logoUrl(style: $logoStyle)␊ - availableScopes {␊ - category␊ - scope␊ - display␊ - isDefault␊ - isRequired␊ - description␊ - title␊ - }␊ - }␊ - app(id: $siteId) {␊ - serviceAuths {␊ - ...ServiceAuthFragment␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment ServiceAuthFragment on OneGraphServiceAuth @netlify(id: """12b5bdea-9bab-4164-a731-5e697b1553be""", doc: """Basic info on a Service Auth""") {␊ - id␊ - service␊ - clientId␊ - revealTokens␊ - scopes␊ - }\`,␊ - operationName: "ListServicesQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeUpsertAppForSiteMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation UpsertAppForSiteMutation($nfToken: String!, $siteId: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - upsertAppForNetlifySite(input: {netlifySiteId: $siteId}) {␊ - org {␊ - id␊ - name␊ - }␊ - app {␊ - id␊ - name␊ - corsOrigins␊ - customCorsOrigins {␊ - friendlyServiceName␊ - displayName␊ - encodedValue␊ - }␊ - }␊ - }␊ - }␊ - }\`,␊ - operationName: "UpsertAppForSiteMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeAddCORSOriginMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation AddCORSOriginMutation($nfToken: String!, $input: OneGraphAddCORSOriginToAppInput!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - addCORSOriginToApp(input: $input) {␊ - app {␊ - ...AppCORSOriginFragment␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment AppCORSOriginFragment on OneGraphApp @netlify(id: """e3d4bb8b-2fb5-48d8-b051-db6027224145""", doc: """Allowed CORS origins for calls to a site's Graph.""") {␊ - id␊ - corsOrigins␊ - customCorsOrigins {␊ - friendlyServiceName␊ - displayName␊ - encodedValue␊ - }␊ - netlifySiteNames␊ - }\`,␊ - operationName: "AddCORSOriginMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const executeRemoveCORSOriginMutation = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`mutation RemoveCORSOriginMutation($nfToken: String!, $input: OneGraphRemoveCORSOriginFromAppInput!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - removeCORSOriginFromApp(input: $input) {␊ - app {␊ - ...AppCORSOriginFragment␊ - }␊ - }␊ - }␊ - }␊ - ␊ - fragment AppCORSOriginFragment on OneGraphApp @netlify(id: """e3d4bb8b-2fb5-48d8-b051-db6027224145""", doc: """Allowed CORS origins for calls to a site's Graph.""") {␊ - id␊ - corsOrigins␊ - customCorsOrigins {␊ - friendlyServiceName␊ - displayName␊ - encodedValue␊ - }␊ - netlifySiteNames␊ - }\`,␊ - operationName: "RemoveCORSOriginMutation",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - export const fetchCORSOriginsQuery = (␊ - variables,␊ - options␊ - ) => {␊ - return fetchNetlifyGraph({␊ - query: \`query CORSOriginsQuery($siteId: String!, $nfToken: String!) {␊ - oneGraph(auths: {netlifyAuth: {oauthToken: $nfToken}}) {␊ - app(id: $siteId) {␊ - ...AppCORSOriginFragment␊ - }␊ - }␊ - }␊ - ␊ - fragment AppCORSOriginFragment on OneGraphApp @netlify(id: """e3d4bb8b-2fb5-48d8-b051-db6027224145""", doc: """Allowed CORS origins for calls to a site's Graph.""") {␊ - id␊ - corsOrigins␊ - customCorsOrigins {␊ - friendlyServiceName␊ - displayName␊ - encodedValue␊ - }␊ - netlifySiteNames␊ - }\`,␊ - operationName: "CORSOriginsQuery",␊ - variables: variables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - });␊ - }␊ - ␊ - ␊ - const subscribeToTestSubscription = (␊ - variables,␊ - rawOptions␊ - ) => {␊ - const options = rawOptions || {};␊ - const netlifyGraphWebhookId = options.netlifyGraphWebhookId;␊ - const netlifyGraphWebhookUrl = options.webhookUrl || \`${process.env.DEPLOY_URL}/webhooks/TestSubscription?netlifyGraphWebhookId=${netlifyGraphWebhookId}\`;␊ - const secret = options.webhookSecret || process.env.NETLIFY_GRAPH_WEBHOOK_SECRET␊ - const fullVariables = {...variables, netlifyGraphWebhookUrl: netlifyGraphWebhookUrl, netlifyGraphWebhookSecret: { hmacSha256Key: secret }}␊ - ␊ - const subscriptionOperationDoc = \`subscription TestSubscription($minutes: Int = 1, $netlifyGraphWebhookUrl: String!, $netlifyGraphWebhookSecret: OneGraphSubscriptionSecretInput!) @netlify(id: """e3d4bb8b-2fb5-9898-b051-db6027224112""", doc: """A subscription with variables and a fragment to test code generation.""") {␊ - poll(␊ - schedule: {every: {minutes: $minutes}}␊ - onlyTriggerWhenPayloadChanged: true␊ - webhookUrl: $netlifyGraphWebhookUrl␊ - secret: $netlifyGraphWebhookSecret␊ - ) {␊ - query {␊ - me {␊ - serviceMetadata {␊ - loggedInServices {␊ - ...LoggedInServicesFragment␊ - }␊ - }␊ - }␊ - }␊ - }␊ - }\`;␊ - ␊ - fetchNetlifyGraph({␊ - query: subscriptionOperationDoc,␊ - operationName: "TestSubscription",␊ - variables: fullVariables,␊ - options: options,␊ - fetchStrategy: "POST",␊ - })␊ - }␊ - ␊ - const parseAndVerifyTestSubscriptionEvent = (event, options) => {␊ - if (!verifyRequestSignature({ event: event }, options)) {␊ - console.warn("Unable to verify signature for TestSubscription")␊ - return null␊ - }␊ - ␊ - return JSON.parse(event.body || '{}')␊ - }␊ - ␊ - /**␊ - * The generated NetlifyGraph library with your operations␊ - */␊ - const functions = {␊ - /**␊ - * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`).␊ - */␊ - executeUpdateCLISessionMetadataMutation : executeUpdateCLISessionMetadataMutation ,␊ - /**␊ - * Get the _metadata_ about a site's current GraphQL schema:␊ - * ␊ - * - enabled services␊ - * - schema id␊ - * - creation date␊ - * ␊ - * etc.␊ - */␊ - fetchAppSchemaQuery: fetchAppSchemaQuery,␊ - /**␊ - * Delete a OneGraph personal token for a user's site␊ - */␊ - executeDestroyTokenMutation : executeDestroyTokenMutation ,␊ - /**␊ - * Sign out of a service associated with a Authlify token␊ - */␊ - executeSignOutServicesMutation : executeSignOutServicesMutation ,␊ - /**␊ - * Update a service's (i.e. GitHub) enabled scope permissions␊ - */␊ - executeAddAuthsMutation : executeAddAuthsMutation ,␊ - /**␊ - * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use.␊ - */␊ - executeCreateNewSchemaMutation : executeCreateNewSchemaMutation ,␊ - /**␊ - * Delete a custom service auth␊ - */␊ - executeDeleteServiceAuthMutation : executeDeleteServiceAuthMutation ,␊ - /**␊ - * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution.␊ - */␊ - executeCreatePersistedQueryMutation : executeCreatePersistedQueryMutation ,␊ - /**␊ - * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site␊ - */␊ - fetchFindLoggedInServicesQuery: fetchFindLoggedInServicesQuery,␊ - /**␊ - * Create a custom service auth␊ - */␊ - executeSetServiceAuthMutation : executeSetServiceAuthMutation ,␊ - /**␊ - * Create a new session for the Netlify CLI to communicate with the React UI via events.␊ - */␊ - executeCreateCLISessionEventMutation : executeCreateCLISessionEventMutation ,␊ - /**␊ - * Get a Netlify CLI session by its id␊ - */␊ - fetchCliSessionByIdQuery: fetchCliSessionByIdQuery,␊ - /**␊ - * (Deprecated) Find logged in services␊ - */␊ - fetchDeprecated_FindLoggedInServicesQuery: fetchDeprecated_FindLoggedInServicesQuery,␊ - /**␊ - * Create a new OneGraph personal token for a user's site␊ - */␊ - executeCreateEmptyPersonalTokenMutation : executeCreateEmptyPersonalTokenMutation ,␊ - /**␊ - * Retrieve a list of _all_ supported services from OneGraph␊ - */␊ - fetchServiceListQuery: fetchServiceListQuery,␊ - /**␊ - * ␊ - */␊ - fetchAuthlifyTokenIdForPersonalToken: fetchAuthlifyTokenIdForPersonalToken,␊ - /**␊ - * Retrieve a previously persisted operations doc␊ - */␊ - fetchPersistedQueryQuery: fetchPersistedQueryQuery,␊ - /**␊ - * List all the CLI sessions belonging to a site␊ - */␊ - fetchCliSessionsByAppIdQuery: fetchCliSessionsByAppIdQuery,␊ - /**␊ - * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site.␊ - */␊ - fetchListServicesQuery: fetchListServicesQuery,␊ - /**␊ - * Ensure that an app resource exists on the OneGraph servers for a given site.␊ - */␊ - executeUpsertAppForSiteMutation : executeUpsertAppForSiteMutation ,␊ - /**␊ - * Add additional allowed CORS origins for calls to a site's Graph.␊ - */␊ - executeAddCORSOriginMutation : executeAddCORSOriginMutation ,␊ - /**␊ - * Remove the given CORS origins for calls to a site's Graph.␊ - */␊ - executeRemoveCORSOriginMutation : executeRemoveCORSOriginMutation ,␊ - /**␊ - * List the allowed CORS origins for calls to a site's Graph.␊ - */␊ - fetchCORSOriginsQuery: fetchCORSOriginsQuery,␊ - /**␊ - * A subscription with variables and a fragment to test code generation.␊ - */␊ - subscribeToTestSubscription:subscribeToTestSubscription,␊ - /**␊ - * Verify the event body is signed securely, and then parse the result.␊ - */␊ - parseAndVerifyTestSubscriptionEvent: parseAndVerifyTestSubscriptionEvent␊ - }␊ - ␊ - export default functions` - -## netlify graph function library runtime codegen library [netlify-builtin:serverless-0.0.1]:./dummy/index.d.ts} - -> Snapshot 1 - - `/* eslint-disable */␊ - // @ts-nocheck␊ - // GENERATED VIA NETLIFY AUTOMATED DEV TOOLS, EDIT WITH CAUTION!␊ - ␊ - export type NetlifyGraphFunctionOptions = {␊ - /**␊ - * The accessToken to use for the request␊ - */␊ - accessToken?: string;␊ - /**␊ - * The siteId to use for the request␊ - * @default process.env.SITE_ID␊ - */␊ - siteId?: string;␊ - }␊ - ␊ - export type WebhookEvent = {␊ - body: string;␊ - headers: Record;␊ - };␊ - ␊ - export type GraphQLError = {␊ - "path": Array;␊ - "message": string;␊ - "extensions": Record;␊ - };␊ - ␊ - /**␊ - * Subset of LoggedInServices␊ - */␊ - export type LoggedInServicesFragment = {␊ - friendlyServiceName: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - isLoggedIn: boolean;␊ - usedTestFlow: boolean;␊ - serviceInfo: {␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - availableScopes?: Array<{␊ - category?: string;␊ - scope: string;␊ - display: string;␊ - isDefault: boolean;␊ - isRequired: boolean;␊ - description: string;␊ - title?: string;␊ - }>;␊ - };␊ - /**␊ - * The scopes that the user granted for this service. This is a best estimate of the scopes that were granted. Most services do not have a way to query the scopes on an auth, and some services do not return information about the scopes that were granted in the auth flow.␊ - */␊ - grantedScopes?: Array<{␊ - /**␊ - * The name of the scope that the underlying service uses.␊ - */␊ - scope: string;␊ - }>;␊ - foreignUserId?: string;␊ - };␊ - ␊ - ␊ - /**␊ - * Basic info on a Service Auth␊ - */␊ - export type ServiceAuthFragment = {␊ - /**␊ - * id for the service auth␊ - */␊ - id: string;␊ - /**␊ - * The service that the clientId and clientSecret belong to, e.g. "gmail"␊ - */␊ - service: string;␊ - /**␊ - * clientId for the serviceAuth.␊ - */␊ - clientId: string;␊ - /**␊ - * If true, the bearer token that is created fetchable by the user whose account the token grants access to.␊ - */␊ - revealTokens: boolean;␊ - /**␊ - * Optional scopes to use for the OAuth flow.␊ - */␊ - scopes?: Array;␊ - };␊ - ␊ - ␊ - /**␊ - * Allowed CORS origins for calls to a site's Graph.␊ - */␊ - export type AppCORSOriginFragment = {␊ - /**␊ - * The id of the OneGraph App␊ - */␊ - id: string;␊ - /**␊ - * The origins allowed for this OneGraph App from CORS requests␊ - */␊ - corsOrigins: Array;␊ - /**␊ - * Custom cors origins␊ - */␊ - customCorsOrigins: Array<{␊ - /**␊ - * The friendly service name for the cors origin␊ - */␊ - friendlyServiceName: string;␊ - /**␊ - * The name of the origin that should be displayed, e.g. oneblog for oneblog.netlify.app.␊ - */␊ - displayName: string;␊ - /**␊ - * The encoded value as a string, used to remove the custom cors origin.␊ - */␊ - encodedValue: string;␊ - }>;␊ - /**␊ - * Sites on Netlify associated with this app. OneGraph will allow CORS and authentication redirects to all previews, branch, and production deploys of these sites.␊ - */␊ - netlifySiteNames: Array;␊ - };␊ - ␊ - ␊ - export type UpdateCLISessionMetadataMutationInput = {␊ - "nfToken": string; ␊ - /**␊ - * The id of the session␊ - */␊ - "sessionId": string; ␊ - /**␊ - * Optional metadata for the session␊ - */␊ - "metadata": unknown␊ - };␊ - ␊ - export type UpdateCLISessionMetadataMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Update a CLI session.␊ - */␊ - updateNetlifyCliSession: {␊ - /**␊ - * The session that was updated.␊ - */␊ - session: {␊ - id: string;␊ - name?: string;␊ - metadata?: unknown;␊ - createdAt: string;␊ - lastEventAt?: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`).␊ - */␊ - export function executeUpdateCLISessionMetadataMutation (␊ - variables: UpdateCLISessionMetadataMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type AppSchemaQueryInput = {␊ - "nfToken": string; ␊ - /**␊ - * App id␊ - */␊ - "appId": string␊ - };␊ - ␊ - export type AppSchemaQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - app: {␊ - /**␊ - * Customizations to the default GraphQL schema␊ - */␊ - graphQLSchema?: {␊ - appId: string;␊ - createdAt: string;␊ - id: string;␊ - services: Array<{␊ - friendlyServiceName: string;␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - /**␊ - * Service string that can be provided in the URL when going through the oauth flow.␊ - */␊ - slug: string;␊ - supportsCustomRedirectUri: boolean;␊ - supportsCustomServiceAuth: boolean;␊ - supportsOauthLogin: boolean;␊ - }>;␊ - updatedAt: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Get the _metadata_ about a site's current GraphQL schema:␊ - * ␊ - * - enabled services␊ - * - schema id␊ - * - creation date␊ - * ␊ - * etc.␊ - */␊ - export function fetchAppSchemaQuery(␊ - variables: AppSchemaQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type DestroyTokenMutationInput = {␊ - "nfToken": string; ␊ - /**␊ - * Any OneGraph access token, refresh token, or JWT␊ - */␊ - "token"?: string; ␊ - /**␊ - * An Authlify Token identifier␊ - */␊ - "authlifyTokenId"?: string␊ - };␊ - ␊ - export type DestroyTokenMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Revokes a OneGraph access token, refresh token, or JWT. After a token is destroyed, it can no longer be used to authenticate with OneGraph.␊ - ␊ - If you destroy a JWT, external services that rely on the claims embedded in the JWT may still accept the JWT and you will also have to revoke the JWT though the external service's revocation process.␊ - */␊ - destroyToken: boolean;␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Delete a OneGraph personal token for a user's site␊ - */␊ - export function executeDestroyTokenMutation (␊ - variables: DestroyTokenMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type SignOutServicesMutationInput = {␊ - "services": Array<"ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS">; ␊ - "nfToken": string; ␊ - "authlifyTokenId": string␊ - };␊ - ␊ - export type SignOutServicesMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - signoutServices: {␊ - me: {␊ - /**␊ - * Metadata and logged-in state for all OneGraph services␊ - */␊ - serviceMetadata: {␊ - loggedInServices: Array;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Sign out of a service associated with a Authlify token␊ - */␊ - export function executeSignOutServicesMutation (␊ - variables: SignOutServicesMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type AddAuthsMutationInput = {␊ - "siteId": string; ␊ - "authlifyTokenId"?: string; ␊ - /**␊ - * Token that will be destroyed and have its auths moved to the personal token.␊ - */␊ - "sToken": string; ␊ - "nfToken": string␊ - };␊ - ␊ - export type AddAuthsMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - addAuthsToPersonalToken: {␊ - /**␊ - * Personal access token that was updated by this mutation␊ - */␊ - accessToken: {␊ - /**␊ - * Netlify-specific ID for the token␊ - */␊ - netlifyId?: string;␊ - /**␊ - * Bearer token␊ - */␊ - token: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Update a service's (i.e. GitHub) enabled scope permissions␊ - */␊ - export function executeAddAuthsMutation (␊ - variables: AddAuthsMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CreateNewSchemaMutationInput = {␊ - "nfToken": string; ␊ - "input": {/**␊ - * Whether to set this schema as the default for the app. Defaults to false.␊ - */␊ - "setAsDefaultForApp"?: boolean; /**␊ - * External GraphQL schemas to add␊ - */␊ - "externalGraphQLSchemas"?: Array<{/**␊ - * The id of the external GraphQL schema.␊ - */␊ - "externalGraphQLSchemaId": string}>; /**␊ - * Optional id of a Salesforce schema to attach to the app.␊ - */␊ - "salesforceSchemaId"?: string; /**␊ - * The optional id of the GraphQL schema that this was derived from.␊ - */␊ - "parentId"?: string; /**␊ - * The list of services that this schema should use. Leave blank if you want to add support for all supported services.␊ - */␊ - "enabledServices"?: Array<"ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS">; /**␊ - * The id of the app that the schema should belong to.␊ - */␊ - "appId": string}␊ - };␊ - ␊ - export type CreateNewSchemaMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - createGraphQLSchema: {␊ - app: {␊ - /**␊ - * Customizations to the default GraphQL schema␊ - */␊ - graphQLSchema?: {␊ - id: string;␊ - };␊ - };␊ - graphqlSchema: {␊ - id: string;␊ - services: Array<{␊ - friendlyServiceName: string;␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - /**␊ - * Service string that can be provided in the URL when going through the oauth flow.␊ - */␊ - slug: string;␊ - supportsCustomRedirectUri: boolean;␊ - supportsCustomServiceAuth: boolean;␊ - supportsOauthLogin: boolean;␊ - }>;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use.␊ - */␊ - export function executeCreateNewSchemaMutation (␊ - variables: CreateNewSchemaMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type DeleteServiceAuthMutationInput = {␊ - "siteId": string; ␊ - "serviceAuthId": string; ␊ - "nfToken": string␊ - };␊ - ␊ - export type DeleteServiceAuthMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - destroyServiceAuth: {␊ - app: {␊ - /**␊ - * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app␊ - */␊ - serviceAuths: Array;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Delete a custom service auth␊ - */␊ - export function executeDeleteServiceAuthMutation (␊ - variables: DeleteServiceAuthMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CreatePersistedQueryMutationInput = {␊ - "nfToken": string; ␊ - "appId": string; ␊ - "query": string; ␊ - /**␊ - * List of tags to add to the persisted query. Tags are free-form text that can be used to categorize persisted queries. Each tag must be under 256 characters and there can be a maximum of 10 tags on a single persisted query.␊ - */␊ - "tags": Array; ␊ - /**␊ - * A description for the persisted query. Maximum length is 2096 characters.␊ - */␊ - "description": string; ␊ - /**␊ - * The parent persisted query. It can be used to track lineage of the query.␊ - */␊ - "parent"?: {/**␊ - * An optional list of tags to remove from the parent query. If any of the provided tags aren't present on the parent, the mutation will fail. No persisted queries will be created and no tags will be removed from the parent.␊ - */␊ - "removeTags"?: Array; /**␊ - * The id of the parent␊ - */␊ - "id": string}␊ - };␊ - ␊ - export type CreatePersistedQueryMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - createPersistedQuery: {␊ - persistedQuery: {␊ - /**␊ - * The persisted query's id.␊ - */␊ - id: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution.␊ - */␊ - export function executeCreatePersistedQueryMutation (␊ - variables: CreatePersistedQueryMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type FindLoggedInServicesQueryInput = {␊ - "nfToken": string; ␊ - "authlifyTokenId": string␊ - };␊ - ␊ - export type FindLoggedInServicesQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - authlifyToken: {␊ - /**␊ - * Metadata and logged-in state for all OneGraph services␊ - */␊ - serviceMetadata: {␊ - loggedInServices: Array;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site␊ - */␊ - export function fetchFindLoggedInServicesQuery(␊ - variables: FindLoggedInServicesQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type SetServiceAuthMutationInput = {␊ - "service": "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK"; ␊ - "clientId": string; ␊ - "clientSecret": string; ␊ - "siteId": string; ␊ - "nfToken": string␊ - };␊ - ␊ - export type SetServiceAuthMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - createServiceAuth: {␊ - app: {␊ - /**␊ - * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app␊ - */␊ - serviceAuths: Array;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Create a custom service auth␊ - */␊ - export function executeSetServiceAuthMutation (␊ - variables: SetServiceAuthMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CreateCLISessionEventMutationInput = {␊ - "nfToken": string; ␊ - "sessionId": string; ␊ - "payload": unknown␊ - };␊ - ␊ - export type CreateCLISessionEventMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - createNetlifyCliTestEvent: {␊ - event: {␊ - id: string;␊ - createdAt: string;␊ - sessionId: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Create a new session for the Netlify CLI to communicate with the React UI via events.␊ - */␊ - export function executeCreateCLISessionEventMutation (␊ - variables: CreateCLISessionEventMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CliSessionByIdQueryInput = {␊ - "nfToken": string; ␊ - "id": string␊ - };␊ - ␊ - export type CliSessionByIdQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Get a Netlify CLI session by its id.␊ - */␊ - netlifyCliSession: {␊ - id: string;␊ - name?: string;␊ - netlifyUserId: string;␊ - events: Array<{␊ - createdAt: string;␊ - }>;␊ - createdAt: string;␊ - lastEventAt?: string;␊ - metadata?: unknown;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Get a Netlify CLI session by its id␊ - */␊ - export function fetchCliSessionByIdQuery(␊ - variables: CliSessionByIdQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - ␊ - export type Deprecated_FindLoggedInServicesQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - me: {␊ - /**␊ - * Metadata and logged-in state for all OneGraph services␊ - */␊ - serviceMetadata: {␊ - loggedInServices: Array;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * (Deprecated) Find logged in services␊ - */␊ - export function fetchDeprecated_FindLoggedInServicesQuery(␊ - /**␊ - * Pass \`{}\` as no variables are defined for this function.␊ - */␊ - variables: Record,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CreateEmptyPersonalTokenMutationInput = {␊ - "nfToken": string; ␊ - "siteId": string␊ - };␊ - ␊ - export type CreateEmptyPersonalTokenMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Creates an empty personal token with a Netlify site anchor␊ - */␊ - createPersonalTokenWithNetlifySiteAnchor: {␊ - /**␊ - * Personal access token that was created by this mutation␊ - */␊ - accessToken: {␊ - /**␊ - * Bearer token␊ - */␊ - token: string;␊ - /**␊ - * Token name, if it is a personal access token␊ - */␊ - name?: string;␊ - /**␊ - * The anchor is like two-factor auth for the token. It ensures that the person who adds auth to the token is the same as the person who created the token.␊ - */␊ - anchor?: "ONEGRAPH_USER" | "NETLIFY_USER" | "NETLIFY_SITE";␊ - /**␊ - * Netlify-specific ID for the token␊ - */␊ - netlifyId?: string;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Create a new OneGraph personal token for a user's site␊ - */␊ - export function executeCreateEmptyPersonalTokenMutation (␊ - variables: CreateEmptyPersonalTokenMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type ServiceListQueryInput = {␊ - "logoStyle"?: "DEFAULT" | "ROUNDED_RECTANGLE"␊ - };␊ - ␊ - export type ServiceListQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - services: Array<{␊ - friendlyServiceName: string;␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - /**␊ - * Service string that can be provided in the URL when going through the oauth flow.␊ - */␊ - slug: string;␊ - supportsCustomRedirectUri: boolean;␊ - supportsCustomServiceAuth: boolean;␊ - supportsOauthLogin: boolean;␊ - }>;␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Retrieve a list of _all_ supported services from OneGraph␊ - */␊ - export function fetchServiceListQuery(␊ - variables: ServiceListQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type AuthlifyTokenIdForPersonalTokenInput = {␊ - "personalToken": string␊ - };␊ - ␊ - export type AuthlifyTokenIdForPersonalToken = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Personal access token lookup␊ - */␊ - personalToken?: {␊ - /**␊ - * Netlify-specific ID for the token␊ - */␊ - netlifyId?: string;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * ␊ - */␊ - export function fetchAuthlifyTokenIdForPersonalToken(␊ - variables: AuthlifyTokenIdForPersonalTokenInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type PersistedQueryQueryInput = {␊ - "nfToken": string; ␊ - /**␊ - * The id of the app that the persisted query belongs to.␊ - */␊ - "appId": string; ␊ - /**␊ - * The id of the persisted query.␊ - */␊ - "id": string␊ - };␊ - ␊ - export type PersistedQueryQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Fetch a single persisted query by its id.␊ - */␊ - persistedQuery: {␊ - /**␊ - * The persisted query's id.␊ - */␊ - id: string;␊ - /**␊ - * The persisted query's query string.␊ - */␊ - query: string;␊ - /**␊ - * The list of operation names that the caller of the query is allowed to execute. If the field is null, then all operationNames are allowed.␊ - */␊ - allowedOperationNames?: Array;␊ - /**␊ - * The user-defined description that was added to the query␊ - */␊ - description?: string;␊ - /**␊ - * The list of variables that the caller of the query is allowed to provide.␊ - */␊ - freeVariables?: Array;␊ - /**␊ - * The default variables provided to the query.␊ - */␊ - fixedVariables?: unknown;␊ - /**␊ - * The list of user-defined tags that were added to the query␊ - */␊ - tags?: Array;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Retrieve a previously persisted operations doc␊ - */␊ - export function fetchPersistedQueryQuery(␊ - variables: PersistedQueryQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CliSessionsByAppIdQueryInput = {␊ - "nfToken": string; ␊ - "appId": string␊ - };␊ - ␊ - export type CliSessionsByAppIdQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - /**␊ - * Netlify CLI sessions, orderd by createdAt descending.␊ - */␊ - netlifyCliSessionsByAppId: Array<{␊ - id: string;␊ - name?: string;␊ - netlifyUserId: string;␊ - events: Array<{␊ - createdAt: string;␊ - }>;␊ - createdAt: string;␊ - lastEventAt?: string;␊ - metadata?: unknown;␊ - }>;␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * List all the CLI sessions belonging to a site␊ - */␊ - export function fetchCliSessionsByAppIdQuery(␊ - variables: CliSessionsByAppIdQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type ListServicesQueryInput = {␊ - "nfToken": string; ␊ - /**␊ - * App id␊ - */␊ - "siteId": string; ␊ - "logoStyle"?: "DEFAULT" | "ROUNDED_RECTANGLE"␊ - };␊ - ␊ - export type ListServicesQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - services: Array<{␊ - friendlyServiceName: string;␊ - service: "ADROLL" | "ASANA" | "BOX" | "CONTENTFUL" | "DEV_TO" | "DOCUSIGN" | "DRIBBBLE" | "DROPBOX" | "EGGHEADIO" | "EVENTIL" | "FACEBOOK" | "FIREBASE" | "GITHUB" | "GMAIL" | "GONG" | "GOOGLE" | "GOOGLE_ADS" | "GOOGLE_ANALYTICS" | "GOOGLE_CALENDAR" | "GOOGLE_COMPUTE" | "GOOGLE_DOCS" | "GOOGLE_SEARCH_CONSOLE" | "GOOGLE_TRANSLATE" | "HUBSPOT" | "INTERCOM" | "MAILCHIMP" | "MEETUP" | "NETLIFY" | "NOTION" | "OUTREACH" | "PRODUCT_HUNT" | "QUICKBOOKS" | "SALESFORCE" | "SANITY" | "SLACK" | "SPOTIFY" | "STRIPE" | "TRELLO" | "TWILIO" | "TWITTER" | "TWITCH_TV" | "YNAB" | "YOUTUBE" | "ZEIT" | "ZENDESK" | "AIRTABLE" | "APOLLO" | "BREX" | "BUNDLEPHOBIA" | "CHARGEBEE" | "CLEARBIT" | "CLOUDFLARE" | "CRUNCHBASE" | "DESCURI" | "FEDEX" | "GOOGLE_MAPS" | "GRAPHCMS" | "IMMIGRATION_GRAPH" | "LOGDNA" | "MIXPANEL" | "MUX" | "NPM" | "ONEGRAPH" | "ORBIT" | "OPEN_COLLECTIVE" | "RSS" | "UPS" | "USPS" | "WORDPRESS";␊ - /**␊ - * Service string that can be provided in the URL when going through the oauth flow.␊ - */␊ - slug: string;␊ - /**␊ - * A short-lived svg image url of the logo for the service. May be null.␊ - */␊ - logoUrl?: string;␊ - availableScopes?: Array<{␊ - category?: string;␊ - scope: string;␊ - display: string;␊ - isDefault: boolean;␊ - isRequired: boolean;␊ - description: string;␊ - title?: string;␊ - }>;␊ - }>;␊ - app: {␊ - /**␊ - * The custom clientId/clientSecret that have been set for services (e.g. Gmail and Slack) that belong to this OneGraph app␊ - */␊ - serviceAuths: Array;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site.␊ - */␊ - export function fetchListServicesQuery(␊ - variables: ListServicesQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type UpsertAppForSiteMutationInput = {␊ - "nfToken": string; ␊ - "siteId": string␊ - };␊ - ␊ - export type UpsertAppForSiteMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - upsertAppForNetlifySite: {␊ - /**␊ - * The app that is associated with the Netlify account.␊ - */␊ - org: {␊ - /**␊ - * The id of the OneGraph Org␊ - */␊ - id: string;␊ - /**␊ - * The name of the OneGraph Org␊ - */␊ - name: string;␊ - };␊ - /**␊ - * The app that is associated with the Netlify site.␊ - */␊ - app: {␊ - /**␊ - * The id of the OneGraph App␊ - */␊ - id: string;␊ - /**␊ - * The name of the OneGraph App␊ - */␊ - name: string;␊ - /**␊ - * The origins allowed for this OneGraph App from CORS requests␊ - */␊ - corsOrigins: Array;␊ - /**␊ - * Custom cors origins␊ - */␊ - customCorsOrigins: Array<{␊ - /**␊ - * The friendly service name for the cors origin␊ - */␊ - friendlyServiceName: string;␊ - /**␊ - * The name of the origin that should be displayed, e.g. oneblog for oneblog.netlify.app.␊ - */␊ - displayName: string;␊ - /**␊ - * The encoded value as a string, used to remove the custom cors origin.␊ - */␊ - encodedValue: string;␊ - }>;␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Ensure that an app resource exists on the OneGraph servers for a given site.␊ - */␊ - export function executeUpsertAppForSiteMutation (␊ - variables: UpsertAppForSiteMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type AddCORSOriginMutationInput = {␊ - "nfToken": string; ␊ - "input": {"corsOrigin": string; "appId": string}␊ - };␊ - ␊ - export type AddCORSOriginMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - addCORSOriginToApp: {␊ - app: AppCORSOriginFragment ;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Add additional allowed CORS origins for calls to a site's Graph.␊ - */␊ - export function executeAddCORSOriginMutation (␊ - variables: AddCORSOriginMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type RemoveCORSOriginMutationInput = {␊ - "nfToken": string; ␊ - "input": {"corsOrigin": string; "appId": string}␊ - };␊ - ␊ - export type RemoveCORSOriginMutation = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - removeCORSOriginFromApp: {␊ - app: AppCORSOriginFragment ;␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * Remove the given CORS origins for calls to a site's Graph.␊ - */␊ - export function executeRemoveCORSOriginMutation (␊ - variables: RemoveCORSOriginMutationInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - export type CORSOriginsQueryInput = {␊ - /**␊ - * App id␊ - */␊ - "siteId": string; ␊ - "nfToken": string␊ - };␊ - ␊ - export type CORSOriginsQuery = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - oneGraph: {␊ - app: AppCORSOriginFragment ;␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - };␊ - ␊ - /**␊ - * List the allowed CORS origins for calls to a site's Graph.␊ - */␊ - export function fetchCORSOriginsQuery(␊ - variables: CORSOriginsQueryInput,␊ - options?: NetlifyGraphFunctionOptions␊ - ): Promise;␊ - ␊ - /**␊ - * A subscription with variables and a fragment to test code generation.␊ - */␊ - export function subscribeToTestSubscription(␊ - /**␊ - * This will be available in your webhook handler as a query parameter.␊ - * Use this to keep track of which subscription you're receiving␊ - * events for.␊ - */␊ - variables: {␊ - /**␊ - * How many minutes to wait before re-running the underlying query␊ - */␊ - "minutes"?: number␊ - },␊ - options?: {␊ - /**␊ - * The accessToken to use for the lifetime of the subscription.␊ - */␊ - accessToken?: string | null | undefined;␊ - /**␊ - * A string id that will be passed to your webhook handler as a query parameter␊ - * along with each event.␊ - * This can be used to keep track of which subscription you're receiving␊ - */␊ - netlifyGraphWebhookId?: string | null | undefined;␊ - /**␊ - * The absolute URL of your webhook handler to handle events from this subscription.␊ - */␊ - webhookUrl?: string | null | undefined;␊ - /**␊ - * The secret to use when signing the webhook request. Use this to verify␊ - * that the webhook payload is coming from Netlify Graph. Defaults to the␊ - * value of the NETLIFY_GRAPH_WEBHOOK_SECRET environment variable.␊ - */␊ - webhookSecret?: string | null | undefined;␊ - }) : void␊ - ␊ - export type TestSubscriptionEvent = {␊ - /**␊ - * Any data from the function will be returned here␊ - */␊ - data: {␊ - poll: {␊ - query: {␊ - me: {␊ - /**␊ - * Metadata and logged-in state for all OneGraph services␊ - */␊ - serviceMetadata: {␊ - loggedInServices: Array>;␊ - };␊ - };␊ - };␊ - };␊ - };␊ - /**␊ - * Any errors from the function will be returned here␊ - */␊ - errors?: Array;␊ - }␊ - ␊ - /**␊ - * Verify the TestSubscription event body is signed securely, and then parse the result.␊ - */␊ - export function parseAndVerifyTestSubscriptionEvent (/** A Netlify Handler Event */ event : WebhookEvent) : null | TestSubscriptionEvent␊ - ␊ - ␊ - export interface Functions {␊ - /**␊ - * Modify the metadata of an existing CLI session (an intentionally untype bag of \`JSON\`).␊ - */␊ - executeUpdateCLISessionMetadataMutation : typeof executeUpdateCLISessionMetadataMutation ,␊ - /**␊ - * Get the _metadata_ about a site's current GraphQL schema:␊ - * ␊ - * - enabled services␊ - * - schema id␊ - * - creation date␊ - * ␊ - * etc.␊ - */␊ - fetchAppSchemaQuery: typeof fetchAppSchemaQuery,␊ - /**␊ - * Delete a OneGraph personal token for a user's site␊ - */␊ - executeDestroyTokenMutation : typeof executeDestroyTokenMutation ,␊ - /**␊ - * Sign out of a service associated with a Authlify token␊ - */␊ - executeSignOutServicesMutation : typeof executeSignOutServicesMutation ,␊ - /**␊ - * Update a service's (i.e. GitHub) enabled scope permissions␊ - */␊ - executeAddAuthsMutation : typeof executeAddAuthsMutation ,␊ - /**␊ - * Create a new GraphQL schema for an app with a set of services enabled. Note that this just makes the schema _available_ for the app to use, it doesn't set it as the default for all queries to use.␊ - */␊ - executeCreateNewSchemaMutation : typeof executeCreateNewSchemaMutation ,␊ - /**␊ - * Delete a custom service auth␊ - */␊ - executeDeleteServiceAuthMutation : typeof executeDeleteServiceAuthMutation ,␊ - /**␊ - * Given a document with GraphQL operations, persist them to OneGraph (with not specific metadata, e.g. cache TTL or auth) for later retrieval _or_ execution.␊ - */␊ - executeCreatePersistedQueryMutation : typeof executeCreatePersistedQueryMutation ,␊ - /**␊ - * Fetch all logged-in OneGraph services (GitHub, Spotify, etc.) for a user's site␊ - */␊ - fetchFindLoggedInServicesQuery: typeof fetchFindLoggedInServicesQuery,␊ - /**␊ - * Create a custom service auth␊ - */␊ - executeSetServiceAuthMutation : typeof executeSetServiceAuthMutation ,␊ - /**␊ - * Create a new session for the Netlify CLI to communicate with the React UI via events.␊ - */␊ - executeCreateCLISessionEventMutation : typeof executeCreateCLISessionEventMutation ,␊ - /**␊ - * Get a Netlify CLI session by its id␊ - */␊ - fetchCliSessionByIdQuery: typeof fetchCliSessionByIdQuery,␊ - /**␊ - * (Deprecated) Find logged in services␊ - */␊ - fetchDeprecated_FindLoggedInServicesQuery: typeof fetchDeprecated_FindLoggedInServicesQuery,␊ - /**␊ - * Create a new OneGraph personal token for a user's site␊ - */␊ - executeCreateEmptyPersonalTokenMutation : typeof executeCreateEmptyPersonalTokenMutation ,␊ - /**␊ - * Retrieve a list of _all_ supported services from OneGraph␊ - */␊ - fetchServiceListQuery: typeof fetchServiceListQuery,␊ - /**␊ - * ␊ - */␊ - fetchAuthlifyTokenIdForPersonalToken: typeof fetchAuthlifyTokenIdForPersonalToken,␊ - /**␊ - * Retrieve a previously persisted operations doc␊ - */␊ - fetchPersistedQueryQuery: typeof fetchPersistedQueryQuery,␊ - /**␊ - * List all the CLI sessions belonging to a site␊ - */␊ - fetchCliSessionsByAppIdQuery: typeof fetchCliSessionsByAppIdQuery,␊ - /**␊ - * Fetch all available OneGraph services (GitHub, Spotify, etc.), as well as any custom service auths that may be installed for a site.␊ - */␊ - fetchListServicesQuery: typeof fetchListServicesQuery,␊ - /**␊ - * Ensure that an app resource exists on the OneGraph servers for a given site.␊ - */␊ - executeUpsertAppForSiteMutation : typeof executeUpsertAppForSiteMutation ,␊ - /**␊ - * Add additional allowed CORS origins for calls to a site's Graph.␊ - */␊ - executeAddCORSOriginMutation : typeof executeAddCORSOriginMutation ,␊ - /**␊ - * Remove the given CORS origins for calls to a site's Graph.␊ - */␊ - executeRemoveCORSOriginMutation : typeof executeRemoveCORSOriginMutation ,␊ - /**␊ - * List the allowed CORS origins for calls to a site's Graph.␊ - */␊ - fetchCORSOriginsQuery: typeof fetchCORSOriginsQuery,␊ - /**␊ - * A subscription with variables and a fragment to test code generation.␊ - */␊ - subscribeToTestSubscription:subscribeToTestSubscription,␊ - /**␊ - * Verify the event body is signed securely, and then parse the result.␊ - */␊ - parseAndVerifyTestSubscriptionEvent: typeof parseAndVerifyTestSubscriptionEvent␊ - }␊ - ␊ - export const functions: Functions;␊ - ␊ - export default functions;␊ - ` diff --git a/tests/integration/snapshots/530.graph-codegen.test.mjs.snap b/tests/integration/snapshots/530.graph-codegen.test.mjs.snap deleted file mode 100644 index a1abb83c987687d20c4c1693b5ebcec06339e7af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 29336 zcmeF(^LJorx;OmTwr$%LTNT^3S+Q-~728%-Y$p{b72D2R)!j4QJ=1gMne&|WtoMg= z@3rnfVPAWHuh04ls0a`!+UVOkn%O!LxG+Nj11JcUfeIKxv$D9g@O_$KU5oOJHtm2E zwi{p)uTg4Q@WYRQ0QltqpLTw8z!r;VI9UseqW5=w2Ew)uG=TghAQw*>0~=KcC?WnO zm81p0ENXEp7mGjP1kv|%JD|K49NpcXPgv`U*9>3%gqV{e0OZPNLjw>ORaIkUW0UWt zOz-y%?9xy8b?@iz`4T*sqB#=-(?%FMI-sWJZuWSYvV*S@nUMkdt5W?pRN}=u5y}$(1mk`;o@Jab>Py(7y{ej)0yT}O zFYfWy(Ft$vbMO549o9H(E4Ma=><@YB@Nn2`uX`Ez0Z;bL&ivVDY~B!Ul?&d*NGvWH zYn$5j?dT^x&nCwgQV0Hbb+{(>d`q_Y;I9Z=@Y~a08L&ilBtoSCte=KCGC&G0gg~NP z#4}O^+)=z&AauH*s`5k-3a5?IqXR6>?n;B-Rr5OM{q3DFaRSl5N9o-GrN_S`XOZ;_ zB+7{AY>25Yoib#tto8LDg&a^(+bY@nZRNyl*4((-$BtvvT4+PM}vQ}X5ry+#jp}`BbJV(mvJ3FsEpoTL=4ZL(+a3VbzRM68$gU@o0=WDrqUfPp3bk$ zs7BwZ)UJJoA_I;bGavWOeaLN8vrqF#YAipK3XsO)52C(&;;S z48E-y_Z)o4>mfs?FcqM7plUw}&XVv=itKSsx{Lw=w6AD`VSVg3IPIvuJ%A^TNwOhd zw!?yPx0ct84?LVRO&RxFfS9qe8eyONSB|?@T!R^+f>(#G*h` z+~9%|BqQGihN!eoB;%%O$Knh8ifOK(y_Buvi|uU^ybdk&>LrN$@7ivvS5J*W)T+f?}4EBA4B@lB}XY4iaRMl z-cl(mCzp{QHa~r4<3pF>bXP7{E`pyJUvQ1T1c6H&Kbse6(1BjiCk?UB@$I^8ropV9 zO?JxfaOJT}INSwzet)_g-WiN(Tx2Lm1C_({L6MnA0F1N)foPf-G__lJfPc%3l1mV} zWN+bT?XsiWTv`|vF@V>LQmQy-X^%?St7Pz$7mth&%wuQ6;~rNTTHq^e{WcZDH^rT#vI^DyOpR1Y;<3cm%eSn~_NC zd^+r(yx1CqP4baS6Xe-^CK4#6IQMLq4uuL#GZ*cynBm*C1U!$#m-26fZX<>+vq9>i zE)+gC=ET#LCdbA?1q%5X2R2+z^(ZA0AuvP!AgtT3+k-lH&jr18+E8q99ixv$d_Ezp zcqv@Lc%F)kcpm>|E$^`;)^J9K&;OR>R?Wl8Wda^4m}NA>`UJ1*%{7aa#pgqzS2>*X zvZmFxnK%-27K&RGpwfo#6Y1UKhz%f^hJx`*F_G_pDSK@6z&KO063<#upu){pG}ja` z!^wGjh!{=o1wljjgh4(VDFJpz5Wwbck1{|B^LeCDiKi4KJ+Y6JIx`!E_>RT}rlQ%s z%{?`;U_1c94#mBCGaTsjJC!`e5LGJ)CFlrj1mFvbOkaI?DwXvUvpU!7Ec#K%wVo^g z$AKD1_L{AbY$rLTL)mWtO9{{qe!8Kv^E?`)a&~=;b18N$A8~_-OC9~;PTb2o%6Nm; zXCAtTFIb~abij|l$)}2%16=vviLR-o7Q9Gseipk!F3B}O)rB9pryRlJ(ba2HlG6n9U*tm%FA+7KPH=;N)= zT73EjM1k13Qi!>GZKRgkWGmPq_>LVX$Qt*H-=fi z;HPva9jv&ONUQ&<9$>z=gt)x09&TCrVcCdH8wE6|!_NmptvLFEz0=m+t(@Qxyp4)L zz1Sb6q2MFB1lQK{BjwRYazv5vtXC6o3b>&wfMk$yc5p=tQb;)*c6fSs14M5D&`%*1 z#u4xiBPT}bF=ntT-SH)JaDz2f zT=!RlMIKHPB=r5gH>m9j8Gp{yojwQC!dr>B&i&q8#{*ahSnyXMs1!i5$ zizz!f$5)Kr;<`M+l0j17!V)@L!pA9VXp7CpLKjmY1D#^Y#~Cq*wy{&l(Zbkt%-t@y zY7*(n4pd6oO4MR^KeoWyhWw5E2>6Tl5*CghOQKT^2onYcLDF)K(}Sd5lto`{T>EM=_vfjk0uNnL}CSs zh2Y;CapWRlvH8vdMtUxaA=prRP*-82oeIP`lZJC&P?TVghnLk^%%ZvJY@jqIyDr~k zu(IkJn9cXzhAvPKwL&}uo@EYiWSCeozO_ZFjejpeI2pjPlhcPkOM~U) zH?$6uAhle^$t$z;sgzvmfiW^9bUuq0p-gLd?q|D;i+=be3BD-$)MEH|VmNtY@F7U<;CkTzKlre7f%Z@U!x()!yX}b`Iy@$g z4*{j{VB+-Dn>2evJqoGj>?xYLdbajx3Cjm!a4AJgxof)+bBYZ@Q`dopkO_-?0hLCC zxwGc0G3qI-aE5@oDPPnc74WMVBazB_Q~?5}!W~JA8A()0 z1}TC0WVkhXSt)eZzu3yO!S2q49~BxdPZmHZ$jeqc23;Cs2O!b(N{H|hm?>y}!)P#w zZ-9)LREJYJ8bDiKOe(ocLG}d`!tV=BOC|4)L>N{I+8P#A5slkZx~hrRI^ zdJ+(lI_c`KVas7;)TkfUcAyoD9HP@K{4H8RWcx+1lAfnbvmj(k!pQnG1W##)s&3Sj zL{y_a(yf(7%98je1f)awb`z%dj8+J!(pglY$qrfSPLSY%F7knDuuWAzjw)HiP3Ue5 z>LfiJ0~WLl=74(BOm1zMq5+&;4DN*Xm_U_B@`D24pfq4eij&Tfg^4VcetR+Sa1o); zA39^qp1akyVTI|RDHI}A{735 z_ac2}k#uCL>GU?rg2DJm&6#v8^|dEE12&@brDlQn3hbqxrW_=;WZn;pKJ#MW#F?)g8LL~2`q3KRfjs5Rtyom) zRH>vh%scM}pA@s_SDVE`UuTwtu{HO1X2~MLy56gnMru zkK}yK$@hCi@ZtlF8>>w%7o{oXHvXpStTmBz(6O@VihN*G+Jys#+%CJr0zAAwyrWwz zTS0qTHVr#Dgi6u7P$Lp}B3Xljc~D=IASL~M){P@fp`lH48@wa#GRgHFx3=0+YUKmt;tI{g{G~pj}Ns4?Q@>@Z%-2GjWZY=vSc}kq!wab ztpaLfJ1_&YW|8XMV0<-^id?y0Z4ukpZEr)h@nKvvPT{mGlfHC+>qie`T;M$+qmZPb z{=(7FMu(;k6N$4j@)5euVV|9fIRp$1Ii?Gb=lHhk)SCCh>4y!^yVK2Y$xvw1wK7%#cznSgMh%;ILiB!oeq#DbT<3dYNrd?*MjE8{X+89WmpH<+-BE>IIj!%I1Cqgmyj^GqemQX2ee+OS_({1=Jl&4&7 zhLqnvH#H`&efivsaI`y5xHr=a{6-J>K91Y1*Gh6=H z;1pW?g^aW=BTd%v6l$Th_7c}@68r`w*NOX9?I|tSju@#&1Om7B1C8WW7F=}O5| zWX03`iYyHVo|!$!Z!@|lRqqpW`~oLO#DJAOiAS4wu#lv6YO*7Ph~k{{O&kuwqJi@R z*LVp^d}N5KwjP10{L>i^7XGwcbJn$;CmL*tb!0=kQu1Vdm6I7>$&vOl>tXksNP7vR z!Yu7$!HwhgO$6v#`JveA(Is?PIw+hT{`wPVb6AhfMCJ5>|Efn*uWTx7+AYI){*&8< zP-6b#gl}l-L|gzea0j(9waLTN74c(>Og+#}(IY}(a*3zR=^ZN?9B0DDv3h)hzEUU5 ztbMB!4;khcz)ABIl17ljNSw(9fBPLODO`l}1UHM^qRpRl?XR$pDWp*%S z>X|YOs1Fm~io1za{Sm3Vg;CQlt&sJj%K)oTuh!L( z`T1Z^gKU!H+$0d3kj{oBra#T1RGWgHtT0O(?dzidqp#-}=kkDyvD`bPP z(q*3}%6RLCIi==KVX@AB^uXc-QU5NI0v0_bgMn>!h>0-iE4bspuQ|08ex^F>nicA@>brq?(Y$ABD(9eiN7bFrNF>WXp zI8v4z8=F;1lDO>ClW|;=p^!6b=a@+Ak|-sV{3k@10P`yl*c!I>QLk;y797^OOG)st zd0bm8IL|v-h9_}l8F(ZSCrOqby_v9N22&BWCD>P@``$=6Y{2k$VmVLNxDVR16{r`+ zc)|o>x!~N-p~N{0p4wK?#R5IXpG9#?XbK$Jhd|YWS?s7r6{T@Y#aV1C-4xGdz0TB= zu?ID&R~3RPWy~@2u!*Vxy1al$T>1ill7#T*u=p+Dx|`fg2=vBZ)o|6&VfMiD=Ajy| zq$5nt!7!yk6e+Ec9!tO?h*e7Wyb7YjW=T#U!=waGX%0mCjXXt1zS>D8fsZz(qC(F$ zHrp&vz)fyf)cS)T7zg4P0C{{j(8c`FB({aR5E>?+65OkYOS!Ne=p-@eP_xK0Ij_z# zfJp^sL_#L7$F^<`#g9PAE!0m`RmH}hhMN8ve<64Hx@yruvjo9EHgJMlM}@SbRDC9S z0H-T+62b4(QFXvPthyE7lDi(J9tPYX+PQ&kKPwO% zApeQ8vR$~rJim7Ub2=7M6*P+)%fJK{08UXsabAb=LJ@Vv9I&Wcr7%t@GwoSuXiV$! zJLu?kJB1osiL4gs=v!RLkIU{VhMtFY6i0b9S)n;{nP>?Mu~WN|qC-DIKP5!J9Umeg z@Y74A#0lOGwq$!%x3T+WdF}xq-#hcj503QE^+*o& z$hzPfDEuMXDAZfUL5BuVB?nL-eac%u&U0pC!s*wA&!a z_lq>-KF(eoeU#iU&`Ipt?nxA_f!b16V#=cdY!fwfSW2dmE8cyMph_oG3^?MIr zORpO_67FCJ)P17cE#;5M1Sxv5X>aV-^&d_?%6ihzdReh~O?qjcm8Kw}n5%Ki#{#yYmiso#xu!U|;WAvz&9yxXBoRpHfY5x&7QVyJXYYRqVs^ zE$Z}Bi1$0%(2-ll8&667o~>qx?Q+b5CL6-5yTZn)nGfE=z0V1oYeNY4?d!mnO=sl? zOI#dW*TyP6g%#5*(az3#a9Vh7TCXXacJHO->iS8*^$GcMDQ|ZDuPamRkHA|S%a(XJ z)7@B6XN<4IEzqxPf^dS~P0{VAqF$ykFZOdbr+DX1AMc{!%@^O@S63hL(4&Bs{Un^% z8&-&m*sGB#{(@(Qb4UFK*Sc4|u5G>R=}v#v2R{miy$Snv3C5Dz(I-=ECpkU?&9I5u zEZ`@x>&;w9c)QNh#Ymnt+s-xPP@k!nWBJz_fw;5HR2O$QVb^-+rC9t%ki^P@0m99p zH*dq@Z!dm*3ujY+F_kJrjfoA_yT9Vi)p9cr~lX&yAvI3z>I7lJZJ1( zkWvXDspcus_JICE9~jh2PzEEMESF3#@6jH~f35eSSA*~xfx&uN@QvbyIEi1AWO zs+Sh0N~z@~`*9Xj#UV2d1CF2j|@w?i1f=Z z##J~-=oc!|oO0mQIASs>x6w2FTtJw$Nlk9D%8@x3LU(pRjH_>V4`_}73NZ@knI6K7 z!&Ef}1yAL4ogpm@tFcpxhqdS5|uVk>O{d0 zp>IoE1Vy6gw7`~@2wMVno{2N<=1PX*eow`GwpXkPCokpM8xub5Hsp+_mR?#uET^Wf z006HuSY{eC9huw6DNPw@Dsj-uMbcN0EmdLu6M{BO0=3ROd%*~<>3~UKTFO{vn?iPT zs_>v(8)dDWKq;oak5R3(hQZx9t6&;w9P036(I#1+2VHC73bYSw7K63rcrn0UTaPoZ z9KJ57lOBm0jyeYGkjovB3s-+vPXFPkT@qQcM#5HdTMHRaeRyw*by~58^7yvwDySg5 zH@}ODRtU4oEq9hCVUWcPmTuRg!Q(|~i%}_?vW>>ke#=8nmkT1*%JR5Mj5qNFh_W%e zoQfKo4f9+dm+%*ya8YG7z}`lK2IDWV{o!Mb6md=1tU3ZWAKi(26sjMRg^@d^ocjni`98xK^_2QwS;6>-sz z=8;=BYd?*ytOYP0^kUrT!DzHHiiajk6Pc=*Idt7`wEzi%wVoUD#J0WKd*HKhC@mtb zu*iHiWsxOjy!Gz*S|#5}{~lvwe`O5l(4;{BEn-p04z1|@ENQN01w*XcXe-p-2?8;i z*n==m;CvDVK`SmM=qt#QQXV*D0TAVn$xv*bn03v!1@S!EPKQh}R6k?s8pGrt|7paR zfj^x)svt3f_|tC4$slzaM*#P^AfcHUK60cPjBSJDe6DwRo--lyitoTMRB5gau3{6T zEKq~AK)nvhoSw+3QLVP;>d}hEH41RHyXq7-3~1RCIYzjeON(>79odcOH9*80L!_8G zLe!^e{w;+I&M-hgN*q+Z)WxsD9sJH{VumC3$#M~t^7HmG!u`Xoo7Q9$$C&10PG)D7 zM%2|-r9Xn2VP{@yVNO+8d!p(9OSeNe!u74A`CWqST;rrLyIrKNCGfNx0Wz;x301;` zuD+cG_cBd#%d_62_NtoI`uP$$O~bJC+X59W7HAPS`hh@GWFDwTS^#R8cv*hvt#ybf)qBC4*Aow_R`596dR)`#4rKkjouS!U;~S>4YBMp!FthZS2ifTc>Q`IO z*+4bXnrLwjjAq#YqiJHs&Ce9tNF@%;tpN}+BRAi^jY)AeTi83I+s~WFcFzQAjmFF1 zCK1eC@enx~(dLz|Pz%M#*ncQ$rIt1rA*GHxzG)m?XsUdWGk=D}J;XDwgw{S8A=QP} z)=DpqutA&s5QQfrd8<`1qR1~r;swpqw#R*Y#^XQUi%Z7dYjy&zyo9UTxAdXTqQ^iv zboc?~1_hG_j_J5?!ccvkgwkw!2)(6@5O}_IAwL7Dq}-OkrY5n)r2sWyT#`wt|Fj@_ zbxn2uzMP?DnHsX(u4DSGKNq>LtKa|TYZQ0jCnm_}{Y*y*RobdBGx`B}x1v4z#gM-2 z$aep$Gkm5HfkY%`j`%d37&NGxn7-=LgOT#K$1%RBlsErZ2u>$kjA*{idDHxyU=|P@ zm+*}Czy`gIPx2~R@%bgG7f%AU?s8UmC>f~KY&K|;bTHR)^jWl_7jzQKZOx8*sNJ5b z{l3J{KDlf_IPLeoenFsDBDz!^pL9r+4 zpdX}|&mM1r?m+3r>9h&1b+&gmJ=94cn}_J$DKie{c`Vk~*{bCOKjYerFyijD#ne|e zLK9Z00yAX#bC86CSz+#;7O`yYg7EimC*Y~ttY!$@Qf_FGvF&$Dq?wzC*S7v|?y14A zkbBH}u6_Fa3+@n+4~jhL(Foh*F_crg8ZuzBSStkAEzoAFOaWi#H=%ENlQ;JlUf`ED z`^`MTOd+P`X9qV*5w0&2*Eir8LhQmQhaTIo)*&5`hII<+UC`%il5rmYR98UZnZhj zMTTl{Y(m{!9;M#CSlR(4X^6La5pLwD_KdX4WcR1Oo`z< zWASBU*mS*o+7VW)-ecQQ*PDrpuXTKqf1jY?@t_kS$-TXa=u0N%2@aq^5%{;&0Balf zCeFU1R+Z9g8|AMoPBtNUI%>;zyA~Z@TL%KuU9iY2rc^6T9sz@&Rr~BHf zc9!+<&}jM7Z62=YLvSZpdDAEW4sT4KXRY#6#u}=Aq|#fLnQS$zntxW-l?$9^f?946 zI*(o36m5G}crKHuR3qBKNn7_Lq|>qwewS@q> z(A)0nOe~+OOBa8kB^;;2WM<*2t38t(0aLsrFd-v-IpaISz6D1!fZ{v}<*Dw95$MbL zCUTL6ZB|2Me)!_FSmAjwPuzE-ogsOWtgl4&G)Jx&3=W%PJ!@P!_^KP zFuBLlRl$gDiIVM6?6*5!7TV^2OkhI?syX)%ynHpkTfzHXX#MxgHUR)4fOu_JI zO>?%3Z>8eUe&rF!WK$ZXY|6b=I-hRS%0>6J=?|9LF6 zTIT3>rpmHPLu+hsAoJ8-yOhS4Dq^iBlg~G-ExJu4C*?x1UD+^jnZXrdl;K32=-_+- zxlQHEz)|W-))chkyNCZdjnHwtVDc4je!%R)iKEW(!ZNVwD$z_R#c+6j_+zTTunO>b z=-C(&QNYNE6EPCE7#e$YFtAm?He*->Hu7_(ieyT9lp4L3YmrZ5gNqBBxff7LueHN< z0@e^k1vH_A?iVLZCcviNx?0ug{ZZmdZFV&bGUb|O{iTu;$V_%>JPP{3q`c4(VYkIg z@-aJ_XBDLGHj{!%%%}(y$bGN!pz+MK&hrQeg^D3fxMEiZWN_De``I9lwgScO3`uHW z*Z$N4pmnOsXYQ@faO{%7Y13fxk|+Lsn!;u{i5|lnH0Wp{I*kx7R5%*tXa}|$T?`?q zJP$03-NwXs@t#^5gJk;ZtdM-vhIQ0|W|Vg<&>hbvavn8KAJp3LXtcZ8r5171rhT+; z%R(tGj$`_?+@)V7%Q5yL*cRMR5X@JJz6$n5&KFS*JV0U4(+2ix5C)YnIEblI_l3RalG60I`Lg6qZ5l=KHP1aqe#WS zB%%c+=(m>7Za4@ka2l|eI)aIF}P`dUGqj8zs}>ZDGxy~&f&v0<8+D9u15?XK`Se&|&) z_Cqpy5UDA4KpXEuy=X7(k05nyl++<0RnbKIKHtVaWu0q8+}LqmV%VxHNdXqT^$zL_ zom`E_zQh$F2YBohpyU_XqqhzS#aI<``H@9FjtQbN7=Rx9`~&|YM?m|>D;_Wz-3%tD z?rfsFn}P@8c<|%ECq29FTQB7%$-KVKU8Fe={#kjRY*{mh+EE5kW=NH);4}8wLpSM4 zZ4E%Hy;G9iQC`vVS2wOBk;9e9vyRn!%V5Z>WRS&OqnXEHpXwt)6m`2 zc}^r_(!CpDoiJ|#Lt)VOLC~>Ww)pTsv>vaZ6e&vV6dhT0i?M3y5H_NzUqh{Al(Trz zN*9R>hsWSyek-ALo&UJz$1iqrAigDt8PRVZ9tstKF zbw}Q0GJz_j5UQwC0|_vs0#BfvQjTij-||C^e+^>*eM4=}kqQq5X7=YDu4qyAtCOK+ z9F`k2Hf z8l5EX&KkwkW9aWX0UXy*5d-d|#15BapLgspe23wYORrB!snqCOOLB#CnV45oKg%lS zWkaK#nH~H}vAHc|f=kz|iL4GG`Bjo&5#qZ5xd>lLMJcnobCxKZrkJ`YBjX^q7hI0| zt&FajX&k$weO8o{9$Lv;0q`#MonhauWpO~Go-r~mOL=SJ$UXbI>TqsQ(%vn2Yb*tz{!a&@mb-=%)Nu0h#il{Q2gvn0$BG(lG4pfeJao#MF&8Xz zz1rb?*lC1uKf}-oHFKD{RBg}xXV{o5TJSKtw{x^}l#pXNU)k%#(zXIbNbsce zs>v2nZ|@eDMV@ft^XBTC{}|Ih&gXgg-qrK|cBtF+W4-y-yoF|Vvdn<@V+Cd}+Crl~ zTUog|nPBCZ=?k;*51?^>VK~=&)fzXpxIGHr-=@5AqZA}+&4k@;@#GAY`=V=^>m@!d zugU+E0a#nV+iMIZ(9MZ45&_hm4y$dfm+cxgqWzr+F1n4H}E-JmGFMTE% zgAnp{ysYTv-83N0=@J8Oh?b#d=JKJ8C~gIDwohw$HU>sx#XUT z$gs;b=I5|?K+u1LNPj4ZjI;A9SMr3U>ailoCA=@wWeT_HI>iy35c%!mT5FjyrMNJXWvs+Zl%9a!s-&8ef0@?NTtp`1Kc zM1uXMNh{reSkuwtf;QaL&QM;J0T5s?W(mA2k>JOY-1D4`DMrZBAb?B$_1B$WoQ32K}1HY^~>!o1Kvq5>Du3M3cc=HpkGk|!V2@HLvbW+ne;eAc?)3G z*f3xP&<*f(LxR_-icqxznZDX!g-8ruaV+|vtyZAe^tSua($y}ggal5JjciP-;TLo` zaQ#ARD^EK3yiq!P7&L?AJlaWtlN(5_nNv@G(R(Xx?M;{Na8;&KE{UI+QF%`Cg{XTu z2-&9-t)gENZkh;i&Gr?RrP_HVUN-SQdf%EU3rFu=myg%|<)QWt%j9c5Y~rQZ^ezu( z4}_Sn-m&M8|DdS%&BrO3_JAei8ub;*kTxM34(XFlWs(|xk ztg2e$+R5TF1qK;1AqxJ+4HLIVj5AC88S;TWb+V@FRhmu^&hi>vH~UV4+{D`StIK+B zYe3{$UjR8M4hzS0UT?NcA1-!+N4kro3Gptx;&PP|UAwf&ghBhpSPFDi4)L!VeO(7) zNPAa6*Wy5x*&#RQfi34!jFDQJ^W?YaX>!9l%Hq3~8Zbz_{6F5XzJO{8cvaUUtjl_o zv87mm+EQhQvhLwJ5^ZbGbkka>_H&c0Q-6$#Zr#^bAa^8s?_(u?iJ52+-Jis#LZsU+ zhT%^aLeErqoW`v!aGH|57oaB1TL(ZGDWqX5)e=qe`Db1@n&2zO(THp}ikJX%A^>K6 zwM`MJh#{RMQR=1u$wC<GQTQlC zAI80cP?e~CT@1MN3aWC@udqA)c!-S#029w8+xi`gL zA+px*0o!`>PXyz-WDt*Y7+u)2{lU{grxAJ_W1dk+EF87=I+I9fGRcNm5dhQZOaX-A z!a970t%+XTGzSNd`MPV;XI*@T#VOd9Nep1Oa^q*!U!jWqybk4%Tj2S_`N4s>EYh|K z0rsj0Ez%6ztDOmwJ|t`@aTrUf`7G$AbGisOH8yW+Sbk(nlR*~|Ahg}Y2U{p5evvuX z#9OBlfAXt>5??4K0JR=(QDT_^{%U`H!6ax>%6}f)Xmu$dn}(ZqE)vwqBR&$N*6?G+ zL^P9B&RFTjfvmP;+%LC@ZRaOfaTKd!@!8LzBC=vweQ5_B=!Bh8yZ@Qm8;2rNPp zhX7$<4qIL&q(CQ5=7{LkrFtjDAD#6rCPDm|=t(ld$^Y)t#O6Vd`I%5R@d~YjgfEM{ z34)~rbm39pgH8epy>tH`aUgAuOT&cq4q=kPEn^l1`iwNoN$(#}AZLL95(*xux_CV& zMjk=Jg-&V3fIX^$`zYN>`R@kM3zDhRI*}hh3_A^HcH1Kp1)P1r#miJR^xJiQ&spSh zo2aY7v#^)%QgwUkV+Lt#FF#=ESa4ClDv+fTa&*+{tLwPit=eWpdpoo61%RA4NdnmG z7q2fB@`gOPUXRQ~ArahdmjRa&H*KU2ELKcZ*dimP z6(UyU!Op~EU*|q~vWi-j%6wP0wCp23qE(0=VyKM_rRim zT$D{C3WZ^wt#_#VkiDsSm!X|w>J#Qfzipd+5X7EBsk4N<4X^C-WAqtvNU>l%#6I9v zqXQ1ikT^KDMubGFOzKq-tZ?uAOQZKCZ7OB-IHy;o4q@t$^TH(5nAPeg?hO(=_!Eu!r)UA#zJA)%!^$X>6Eu#`plx ztKGIrk9TJ5Oc+!S;cGF4S(&dlSZ$0qrUw3Na$`t7%Z@tQiSI?oe*RQ|a@b7BeZo*jZy=U(SwZ$ZANnqj8t*l@Tu%B5Hwj z@@6GWwkm=Lx&rV4xl{6YkC&3&x#9e_c2Z+^zF8(yay{a) z?#DW>8*{byIpC{wg~j4`Ps^EnQ9vPdG!ITymrpe$JZeb(@hK)MJ_es`F4nRtXE?hU zl&SVpOUX)-r8Zf#3gug4(mPa<^=b3&(2P_+(Uj#=4}KVDqcWbCB-khT+>d`HVdltW zjeshXUJjbzgr)8h1`g;Z54aRnUtawEQB~ty?d8^2esyOOh%b5n;+z>8!1ZCrURaMg zNLe%&2mlUB1BSE^$s*y)K_yA?k;-kh zxqEzS!Qvi3QZ(Um(}L~jk#L#Ft;|JFo54skKQd5+5uG;W0{OV|L)QS+AcEeQpzG;k zyGpsnTm;VRCrE)B(8OCQf(DMfB}nd_O>Vf&bpW*kQp8>KVdJZIG;Hufs< zYS)He&zRoU@Vdk!?boQnni>!c+gCJdAq@3)Cq4;sR;+3Vi0kjE=?xogPcH_TcCI&f zju#hq?q^JP;d-_&d%V01@8#Z)?-cuZKHV%Qm`<{i>2#YP31!tEH|!NK;d`Ye8c(5A zh4t~303{+<*&2=?nGa_~Urh`Rg9{*rGj$t-eoGcr$@aH{Z*cB58x0XGSDD87x^>ov zqPHN`o*_qG4ab-Qhj-xv`CxnYu(tg{ihlp&I`!1LF99sQCT|5hv)6EwMLNA|FqgcG zw8Z0g&zx_d0^pa@YwEVB>e)GtNO9$dI^LAYoM>VT~yURN|ysw2R0D`o!2bLlM|v8?8P}_@aq7#_g>$+*B?%^cbz2Yr zME=d1I}2}qo(=c@)&mWe+&2t!*HW4sQ|-ek9=ZAUI?EZK*9aGR!@|#+S7L|zUk=fs z+f-*`TIP4qkyxQ|dU!i-9c_^P)-p8H@^U!OD>0Fc6Ajh z!+v9-X3$B87qAE$S)8-cHQb72e(cO9<-`=7A7#Kzks2)YPM}E?SCERG7`n8g#bB>u zVuZZzAE}pc&nu)VC}MCIUA{eDZmT29AHiL4Hv$23@J|*`C{`dZl!Q_oNypmVsbn42 zanIt&CYM7Y>}aI2uZYx{hO%d;hiyLUvorFa$hUJW@AWdF<#6Ww;Jg`*>Z_Uik^vRa zeWSURZVRpAshDT4mryGL_t#HQ7G%}MKK(Wza4vH4kNWL(F<7PC2H z-nKpJ$U2^RoU%i?!AR4lmo19=A-oZ_a>m7jb>#&2X3?}=U%x5eczL&rL#pokq5-v5 zm`t=%1=KgwL|x6?hxATVN9gLcj_nnL+lAfjG(X?Q4kF9KFX==WWAK9Is21PTRBFpC zkkCv;8ebGF*y#)R`Wy;EHENH{??1bwXT}xSXz27d6s1Vbf?CG7b|!xl46=hnoq;hQ zQxB-nQ*Qu`$S;i@qYPE)Kw9y4oGR?DCz6#BA|1e+IMIwzO3azH(GE-*_w){8c03doGQ`Hbe z)bkb*!OkOrc?80|+IZ>wSG4CM&#N}Hsl+FG&)51R8cuC+pS^D<6u5?f{Ld@{O_n=x z#`>ayHqP6}{FXomH4z%1rzJUs0er?ZUkP5>a~u6Pb0~8M%wbTj!lPdLKCmddVVS2F zj!YFr*g5Ewf!?yfR=*WG@&1VRsNtl|LCO)bMM#lH6mHCsqK4Hq>-e*x`63fWYk?Vx zj5_XverVt}_J4#RQKMP@LXhUe=bmeS5TwsEmFxLK zjK3133BTAs5F}-G28F*7r2L-*X|M+3CqWYUjUcK0AV`cq2@?Acf&}!FAQAi|NYpd zQy<>>lOU=6LXd!eB}kfoMUV`C5G1<)iXhGWN|3;m)h>H}5~RRC5G4LT5G1)@3DW*g zf&}<0LBje2K??s#kYIfA3Vsr#oc|euB>f9P`tp+?z5XOfq(2GL`N}T@Dd|^&gz%Ff zLHq+j^7{ipD((Ik1j+Z$1ZneEf@JtNf&}w-f)w`~K{_h=3xbsQH-fa2_0I&!N%Z<5 z{Lcgl^1nxr1pk5{rT#mDRQZ!2QT!lC?mr3ADl@c*6MgWn1c?-Y8tNxOD*s84qW?&c zEdPoiRsBnX)Ff;8mjsFX7lO2C_YVY#spF3Ri6E^V|1&{aE&qie zdHjhWq5npZ*!z}P|45Li|A`>&%>A7p(fvY@=Hve@K??dW2vWKK)zKdb(gNfUf@J%5 zg5>%Kf;9dMK?3?4LDKz|AW{4iK{|u}CxXQO3qex)13@bI7X+#BFA0*?9|_XO|B@g< z|3Z-B{xw08_?;k0{3SuE|7U_^{2M{y`5QqZ`)?4W&&+zN|E~#>#6J)ukY5Q>;eSk! zNdAc+?VE8*G z{XY^U(Z3={aepRA2EP-eq<=+_@cxn@DgBWkP5f(ur1qBtslxpa1WEaKf|U7xLXgz{ zZwZpde@Kw@|2;wa_&-9B*8Y+p-Tn6nQr&-tARYb31WDq*O^_)5GlDem7X+ys=szV$ zoqs`)NdH5E6!BLC=?MK7f<*A&BuFd&1wjJ+g&=|bBSGT)6G4jjUxM_%1nGYX(*F{q z|5pSFer!P!npeVOnBlBQ{}XEAEMu+ij!mY>)#JyL_VINVJXr%Zmp%eLzWVXO`N4T| zzQr=lfI~BT!c3nK21WXta_=K$ZY@k26v9=6}T{N7(@yFD+f-(PI| zY307v>+@t=!EHy@Xw=ncYWC)kFYj>x3Us~u@w$EEuxdD78?d<$s-KWa6nJg<#zpYa z6`K!aO~tZX5fZC?+~%Tcc@5fS)2rV3fwW%48uXh!7*xOabE-My<$(bPA>LIWi&Lfi z_W)7u!tv2u9wAWn~9c-ox9dM@B-9xLRz z*c-ds?K#w3GZ5EeK zZUWTAIw?3qDwhJo7D<<66p?m;TLKr7>pfRED9ePl--<*~GKTcI1WEhxN2eF|3S95- zd`>=GH4?)0rzPRQg-I$_e_)n;+>D@A7nO6ACk=2;7>p@0uLex`g(R1Zm)-TiOQ|55oKwB zKm?+c!3S97ai<0k5%#?*H<~IzSa1MeDfT4o2JcrXU%)LJy1qgIc7YLI{+seMd3&7C zR??}D=Cl)_ON~(>Pg3jok`oWzij%X@MWj@z9`YRgjH*q%rXM#0j?-3Nv{=6HDp#r` z@p7c4zWMj0Wgkczl4Fz$ zu(h0SWl2yQTrguv%aPbshKMsDTAw3Md~`q#)p(q(jAA5dltUg=Ul{zMgDcOp(rTG- zRmk$ZCukY^GTNzMN7?UKA2;{^rtz#?Y_WuXl;o4GP(h!rni8_RGO16g8Kd|UNX~)f z19Xf3la482N7kK^HJvl`x)Kkf%K#_bq`1=QMFm|MRnC`-Rd$e2fJ($h1Ad@P4>Uz(R9?9;t#f)Rrk{h~ z?>+O)j?_oC(d&o*aF|;%lhp)RLymp{+>KCN?%p7oyBTO$Lce8~!v!U#un&T}bgkl! zxH~`#g zJWeWwlsXF8bVQ_N#&gCKIgZS1QrY7aam5*#XGPN4*-2K}GB2}Kr!J#1GqUM(OQ@^o zsqgdsygonlf4pDsuuxaqeB~OBDjCkyf(1r3>c#duT$g}eyS)u)rn^D4aum(Wa-CB3 z&W6LMcs;nP(=Rn5b64(FiaLz=+1gyJE$mLP1;q&>uF3XRNYmZZJUtiJTO?Jc6*5h& z&lqw~Q-=0MEIi%v;TA;SAl9s=MZ>$7-KOWQ&n?h#(CYw@hg(PlFfU|S_ml!kh_CWc z@+BYGF@{iWKUYIL%ggNpA-%WC%|RS|MY4iQ1!ME43Rvpvc)UlSs;J2(v(N2CyZr&? z4B4^O$ef{|So<$QMgGf7hbqplfKMV*Dbe7A3Eaxc5e{A}pKUM97=Tpd9&rx{xGGotHc#i27jp+=r8m z*-?jUtGqkX(q8cpC$|)Beu%k)u&fLhwn_sU)OQj!iNw6n)}ni%<_Wr$kbZR`-_-pj zcN;~p7)UOqcJ>$#yYHxc zn(j0%)_ui`NlNR#y%r1_7Tl&J^yMy~J z9TEIWy7b(2*}45obXO5Znv~}%F>jQ_5fPeDz)Q%sVa0m^>7V9kgPv=|HD-2q`|5S- zrE`Slne3-7lP>6DJAFF+to!8s*)nmzs+Mtgrc-XyEiP9_PPnZs z4I9w3@LJwv118FaDJsTRSA$DVj)lu6Y`I(~t=|FgYJ{{*SXFg{Pe22ugxjSm?JGXw z?=bOFIrIvHgkjBVsh5C@f>UL=hiiB;MkpkV>n|ZKg+H=SoajA56_^~;KWNXqoh2)w zQYZAjOC7X1)H_+Y!%nd1RAuj5TrJaflT{F$CsXP#k|`9mE(lYYWAw?Rs86R+u`~q> zpXY1VRxfmU!pJxuS-Xp6$dkIb{`vK;yC@;pe5-H=wU_3K@t*2p;pOQp-k9(>RMS)H z1?Si2Dq*M?j6ZE68$$ie)3cPzbSA)M(EXDO0yf(ftm=H&G7s;+`hI!8HT{7d=a%%9 zAt{fe(ap?lz}-(8Rq{JyE^-Pdw%@rmpQfT(X8xyFFpVu7E?r+lU%cJ$T_fyue*;YP zAg^K!e`O|%R59C(AnIflB}dOBtBZ}F5b%)m61&*WGdxXgB~s7x-F0I14_(p`JtQJr6Im* z-qe5c`$0MtYxhSo#_g$=$eDi?%+f}sO3M~e?wF}~_uy>D_~x7+^k328zSv+moivA? zgk02Ol=ULRjyL7}$#k;u4>?tL`f!a1O{~pdqMI(jZ`1GJJQegRFhjF#t2D|^W4`s0 zQm@L=$DGd@H|a%$>M^Xl2Ga&kCq0VpG#zGUUR>g_&Y_6avT6RXwFu^N<>jvPkpqGB z0+r9-1fFrg@{E;AJ=0Hk+1i)iRL|`&3JH>#KYDxop!3nx{E0(ZgHub#XtS)K#;j@B zv~doXwqiN&3g7uR+3sLWvfsGTK7BJVK;jxQGxa@vSUwg$G0b1q%)j!EpK63L=6+Ji zQVe8UR1*XXh3sfx4Jfv*nbbBf*NoQ|>T^5nJ=Xg+o69-A&T4ZQI=ud|TD*?l3$43x znZ57#v&HH|vb;j{|3Dt1_GEIl_fLo6QsgrThznTC*nBdGN+VL+vXQX}Hk6T^JH(rr ze*cAarrc$x31clcEjVl-g%%^;q-tHVc~Elmm8da_0DeeLs>iNE47NpDoW=ze-j-?wvD!RhN4-dqLl7g~^{Az4Whyfqj&PX&Lhv-lk~gZ(Cg`=#D|X88E})kJBn2hyPRcBOV= zIi<{Ag9k93i{=Yq7rI0Zv+10YW}?F;o90gz0b+-PXW56Zv(tUix5Nw=vuCK!3(TWQbxNv5{Wsgu{vAS0jyWm7%bE2;9M(+7ygXfp-@W3ZDwQZw zybG`&@7a9ZxZAY5dWqMjqSBwTH!`151m>v>-uJ)?VpJvyyw=GOnUjurR9D4rG3jvv zY!3>|h%%NGj0#rXc^E1XibAr*hxYa83frACGhrCK5or-VDXXldIBYx_m_Piiz{yNi zKK(fV%#*Ej{WJohTh)~G$|p@OOQ|QO$-CMlzts^aPcnOJX8^S8 z>cT#uiI2n%B7GN|uU#6lcSlq*W>OWM+IEa_^VQ{|D)?(A{>2p8KJIy>;qa)q<_A^% zKdwd=RSjV514=(Ud@nTO?1QkIEl-Fmuj$pb6X$#DypQu0hefQWXQn0Q!K;i5d$m7m z+4AXTjLy&&_8fmN)b3n8WUF9P(BOHw+pJ0G3FIMb9BaA`&jWN?<%3h3#60*0A%>-H zJ%zQ1?1owqYDyco$Zn&Kwk)7XQN1#Npcqle`~(={HIPk1JxGzfFft131{b+ zD&&#~CC5HO?Si`(lvLc!RXbhh&gUNd~FI{hu2o?+pgYwQM$)WRQyR z4blM4AeH?#NdG$qi9UaQgY@oSF-S+505bRni8G)RjBk)i_yw>@TSbTlslyw!&LAa= z3!hsxNRxPj)SN4fH%Or*gJg?uka%$h35+vHNqB>#gf~dSID;g=eM5tEUPQ!1{;c_x zOnid`U2Bj|Wzf~&8YE#tgS1FANI^}GsWP%7_y&mw*C5S+4Dk(;&`tj;`C5`e;wBg* zkZ55Y&LE94$>-L2kqnX((IBO5Fi5mOT!TbIYLFDx43a6KK}z`2AU%JY_r)O9hu{oS z!L)D?zCn^B+aT2u8>C)BgXHfYdxOv*J)+a{`;kFPJ+Rs!Ig)9RPkRtE~iOuUk8r~qG{vCq^ zAsD0vyg}L$f^U$h@D0){fj#8l-8WL86vgZIG;2 z8zd~rAR)*#NE53D$%kBnq%_6$b%R9xOAV3=8G}^ucLph+&>(5(oo^sCNMZm5KcPA} zp+Qom;M0p$|E#L5r1otvVLHY7OzdN ztT#wZ0DOa#vDzRpe_m^lJ`oHO-Ks%)4I?&4vEMXE+rBYK&xj2Y$6AAw_8o)N|DIff zGgVgZT4U*+I4HDCuLHa<>AgN+j4HCn54U#OOL6Y6rAVL4mAobh)xIr@fVvv;O z2nNY<%^-PvZIE=y8Kk(41_>9)e`%1GzSAIq$QmTrdV|#QeS@S=)*$i2))^$jHG@?1 zPYjaD|J5Mb{iH!M|9gXkZu&PGqzSSHi6ZEi8l)G$Vvxpv+90X@vO!7%{8WSVl#D^* z+w`*rsfvt2a{5Vw#K%IWK|&B4B+g$nNUwijkhBN}X~)+FNp*uk;_Lj~ApLHTem6+J T8>IjL1_`*QViFhJP*eN|TU9N_ diff --git a/tools/affected-test.mjs b/tools/affected-test.mjs index e48a7c4913d..b46e141d400 100755 --- a/tools/affected-test.mjs +++ b/tools/affected-test.mjs @@ -11,7 +11,7 @@ import glob from 'fast-glob' import { DependencyGraph, fileVisitor, visitorPlugins } from './project-graph/index.mjs' -export const TEST_MATCHING_GLOB = /\.test\.(m|c)?(j|t)s$/gm +export const TEST_MATCHING_GLOB = /\.test\.cjs$/gm export const getChangedFiles = async (compareTarget = 'origin/main') => { const { stdout } = await execa('git', ['diff', '--name-only', 'HEAD', compareTarget]) @@ -29,7 +29,7 @@ export const getChangedFiles = async (compareTarget = 'origin/main') => { export const getAffectedFiles = (changedFiles) => { // glob is using only posix file paths on windows we need the `\` // by using join the paths are adjusted to the operating system - const testFiles = glob.sync(['tests/integration/**/*.test.?(c|m)+(j|t)s']).map((filePath) => join(filePath)) + const testFiles = glob.sync(['tests/integration/**/*.test.cjs']).map((filePath) => join(filePath)) // in this case all files are affected if ( diff --git a/vitest.config.mjs b/vitest.config.mjs index 753abe4584d..15ac46db882 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -3,7 +3,7 @@ import { defineConfig } from 'vite' export default defineConfig({ test: { - include: ['tests/unit/**/*.test.mjs'], + include: ['tests/**/*.test.mjs'], testTimeout: 30_000, deps: { external: ['**/fixtures/**', '**/node_modules/**'], From 5c3cb2682e08255c577e7cd5dc0a921093e9925e Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Wed, 30 Nov 2022 17:13:36 +0100 Subject: [PATCH 3/6] chore: test renaming --- .github/workflows/main.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1aa7c39fc83..0195a0926a6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Testing for CLI +name: Testing on: push: @@ -7,7 +7,8 @@ on: branches: [main] jobs: - build: + unit: + name: Unit runs-on: ${{ matrix.os }} strategy: matrix: @@ -48,7 +49,8 @@ jobs: - name: Run vitest unit tests run: npm run test:ci:vitest:unit if: '${{!steps.release-check.outputs.IS_RELEASE}}' - vitest: + integration: + name: Integration runs-on: ${{ matrix.os }} timeout-minutes: 15 strategy: @@ -146,6 +148,7 @@ jobs: flags: ${{ steps.test-coverage-flags.outputs.os }},${{ steps.test-coverage-flags.outputs.node }} if: '${{ !steps.release-check.outputs.IS_RELEASE }}' test: + name: Legacy Integration runs-on: ${{ matrix.os }} timeout-minutes: 30 strategy: @@ -248,7 +251,8 @@ jobs: flags: ${{ steps.test-coverage-flags.outputs.os }},${{ steps.test-coverage-flags.outputs.node }} if: '${{ !steps.release-check.outputs.IS_RELEASE }}' all: - needs: [build, test] + # This is here strictly to make branch protection rules easier, to avoid changing those based on matrix naming + needs: [unit, integration, test] runs-on: ubuntu-latest steps: - name: Log success From 088c6f0ff64fa294487a1ba167f46d71502312d7 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Wed, 30 Nov 2022 17:15:07 +0100 Subject: [PATCH 4/6] chore: rename E2E tests too --- .github/workflows/e2e-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index d58cb76b1d2..1554ee18632 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -1,4 +1,4 @@ -name: E2E Testing for CLI +name: Testing on: push: @@ -11,6 +11,7 @@ on: jobs: e2e: + name: E2E runs-on: ${{ matrix.os }} timeout-minutes: 20 env: From 9b649d88381e1f5c0a957d933bf2008667e0ffe6 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Wed, 30 Nov 2022 17:36:40 +0100 Subject: [PATCH 5/6] Apply suggestions from code review Co-authored-by: Jackie Macharia --- e2e.config.mjs | 1 - tests/integration/utils/got.cjs | 1 - tests/unit/lib/functions/server.test.cjs | 1 - 3 files changed, 3 deletions(-) diff --git a/e2e.config.mjs b/e2e.config.mjs index 6a5d8f80190..30b3b62b9c0 100644 --- a/e2e.config.mjs +++ b/e2e.config.mjs @@ -1,7 +1,6 @@ const config = { files: ['e2e/**/*.e2e.mjs'], cache: true, - concurrency: 5, failFast: false, failWithoutAssertions: false, diff --git a/tests/integration/utils/got.cjs b/tests/integration/utils/got.cjs index 2ac00282dc8..9afa3c2a562 100644 --- a/tests/integration/utils/got.cjs +++ b/tests/integration/utils/got.cjs @@ -13,7 +13,6 @@ const isResponseOk = (response) => { const TIMEOUT = 3e5 // Default got retry status code with the addition of 403 - const STATUS_CODE = [403, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524] const extendedGot = got.extend({ diff --git a/tests/unit/lib/functions/server.test.cjs b/tests/unit/lib/functions/server.test.cjs index e7e92afefd4..9b549b654ca 100644 --- a/tests/unit/lib/functions/server.test.cjs +++ b/tests/unit/lib/functions/server.test.cjs @@ -23,7 +23,6 @@ test.before(async () => { projectRoot, config: {}, timeouts: { syncFunctions: 1, backgroundFunctions: 1 }, - settings: { port: 8888 }, }) await functionsRegistry.scan([functionsDirectory]) From 9a0c9832ff851eec200dee601c7dcfcc267793cc Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Mon, 5 Dec 2022 13:42:26 +0100 Subject: [PATCH 6/6] chore: organize test workflows --- .../workflows/{e2e-test.yml => e2e-tests.yml} | 2 +- .github/workflows/integration-tests.yml | 107 ++++++++ .github/workflows/legacy-tests.yml | 112 ++++++++ .github/workflows/main.yml | 259 ------------------ .github/workflows/unit-tests.yml | 51 ++++ 5 files changed, 271 insertions(+), 260 deletions(-) rename .github/workflows/{e2e-test.yml => e2e-tests.yml} (99%) create mode 100644 .github/workflows/integration-tests.yml create mode 100644 .github/workflows/legacy-tests.yml delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/unit-tests.yml diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-tests.yml similarity index 99% rename from .github/workflows/e2e-test.yml rename to .github/workflows/e2e-tests.yml index 1554ee18632..fe5b45bc592 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-tests.yml @@ -1,4 +1,4 @@ -name: Testing +name: Tests on: push: diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml new file mode 100644 index 00000000000..d7dea14bddb --- /dev/null +++ b/.github/workflows/integration-tests.yml @@ -0,0 +1,107 @@ +name: Tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + integration: + name: Integration + runs-on: ${{ matrix.os }} + timeout-minutes: 15 + strategy: + matrix: + os: [ubuntu-latest, macOS-latest, windows-latest] + node-version: [14.x, '*'] + shard: ['1/2', '2/2'] + + exclude: + - os: macOS-latest + node-version: '14.x' + - os: windows-latest + node-version: '14.x' + fail-fast: false + steps: + # Sets an output parameter if this is a release PR + - name: Check for release + id: release-check + # For windows we have to use $env: + run: |- + echo "IS_RELEASE=true" >> $GITHUB_OUTPUT + echo "IS_RELEASE=true" >> $env:GITHUB_OUTPUT + if: "${{ startsWith(github.head_ref, 'release-') }}" + # This improves Windows network performance, we need this since we open many ports in our tests + - name: Increase Windows port limit and reduce time wait delay + run: | + netsh int ipv4 set dynamicport tcp start=1025 num=64511 + REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters /v TcpTimedWaitDelay /t REG_DWORD /d 30 /f + if: "${{ matrix.os == 'windows-latest' && !steps.release-check.outputs.IS_RELEASE }}" + - name: Git checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: 'npm-shrinkwrap.json' + check-latest: true + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Setup Deno + uses: denoland/setup-deno@v1 + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + with: + deno-version: v1.x + - name: Install core dependencies + run: npm ci --no-audit + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Determine which tests to run + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' + uses: haya14busa/action-cond@v1 + id: changed + with: + cond: ${{ github.event_name == 'pull_request' }} + if_true: '--changed=${{ github.event.pull_request.base.sha }}' # on pull requests test with the project graph only the affected tests + if_false: '' # on the base branch run all the tests as security measure + - name: Generate self-signed certificates + run: npm run certs + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + shell: bash + - name: Prepare tests + run: npm run test:init + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' + - name: Tests + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' + run: npm run test:ci:vitest:integration -- --shard=${{ matrix.shard }} ${{ steps.changed.outputs.value }} + env: + # GitHub secrets are not available when running on PR from forks + # We set a flag so we can skip tests that access Netlify API + NETLIFY_TEST_DISABLE_LIVE: + ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }} + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + # NETLIFY_TEST_GITHUB_TOKEN is used to avoid reaching GitHub API limits in exec-fetcher.js + NETLIFY_TEST_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Changes the polling interval used by the file watcher + CHOKIDAR_INTERVAL: 20 + CHOKIDAR_USEPOLLING: 1 + - name: Get test coverage flags + id: test-coverage-flags + # For windows we have to use $env: + run: |- + os=${{ matrix.os }} + node=$(node --version) + echo "os=${os/-latest/}" >> $GITHUB_OUTPUT + echo "os=${os/-latest/}" >> $env:GITHUB_OUTPUT + echo "node=node_${node/.*.*/}" >> $GITHUB_OUTPUT + echo "node=node_${node/.*.*/}" >> $env:GITHUB_OUTPUT + shell: bash + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' + - uses: codecov/codecov-action@v3 + continue-on-error: true + with: + flags: ${{ steps.test-coverage-flags.outputs.os }},${{ steps.test-coverage-flags.outputs.node }} + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' diff --git a/.github/workflows/legacy-tests.yml b/.github/workflows/legacy-tests.yml new file mode 100644 index 00000000000..67087a68177 --- /dev/null +++ b/.github/workflows/legacy-tests.yml @@ -0,0 +1,112 @@ +name: Tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + integration: + name: Legacy Integration + runs-on: ${{ matrix.os }} + timeout-minutes: 30 + strategy: + matrix: + os: [ubuntu-latest, macOS-latest, windows-latest] + node-version: [14.x, '*'] + machine: ['0', '1', '2', '3', '4', '5', '6'] + + exclude: + - os: macOS-latest + node-version: '14.x' + - os: windows-latest + node-version: '14.x' + fail-fast: false + steps: + # Sets an output parameter if this is a release PR + - name: Check for release + id: release-check + # For windows we have to use $env: + run: |- + echo "IS_RELEASE=true" >> $GITHUB_OUTPUT + echo "IS_RELEASE=true" >> $env:GITHUB_OUTPUT + if: "${{ startsWith(github.head_ref, 'release-') }}" + # This improves Windows network performance, we need this since we open many ports in our tests + - name: Increase Windows port limit and reduce time wait delay + run: | + netsh int ipv4 set dynamicport tcp start=1025 num=64511 + REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters /v TcpTimedWaitDelay /t REG_DWORD /d 30 /f + if: "${{ matrix.os == 'windows-latest' && !steps.release-check.outputs.IS_RELEASE }}" + - name: Git checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: 'npm-shrinkwrap.json' + check-latest: true + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Setup Deno + uses: denoland/setup-deno@v1 + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + with: + deno-version: v1.x + - name: Install core dependencies + run: npm ci --no-audit + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Determine Test Command + uses: haya14busa/action-cond@v1 + id: testCommand + with: + cond: ${{ github.event_name == 'pull_request' }} + if_true: 'npm run test:affected ${{ github.event.pull_request.base.sha }}' # on pull requests test with the project graph only the affected tests + if_false: 'npm run test:ci:ava:integration' # on the base branch run all the tests as security measure + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' + - name: Generate self-signed certificates + run: npm run certs + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + shell: bash + - name: Prepare tests + run: npm run test:init + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' + - name: Tests + run: ${{ steps.testCommand.outputs.value }} + env: + # GitHub secrets are not available when running on PR from forks + # We set a flag so we can skip tests that access Netlify API + NETLIFY_TEST_DISABLE_LIVE: + ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }} + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + # NETLIFY_TEST_GITHUB_TOKEN is used to avoid reaching GitHub API limits in exec-fetcher.js + NETLIFY_TEST_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Changes the polling interval used by the file watcher + CHOKIDAR_INTERVAL: 20 + CHOKIDAR_USEPOLLING: 1 + + # split tests across multiple machines + CI_NODE_INDEX: ${{ matrix.machine }} + CI_NODE_TOTAL: 7 + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' + - name: Get test coverage flags + id: test-coverage-flags + # For windows we have to use $env: + run: |- + os=${{ matrix.os }} + node=$(node --version) + echo "os=${os/-latest/}" >> $GITHUB_OUTPUT + echo "os=${os/-latest/}" >> $env:GITHUB_OUTPUT + echo "node=node_${node/.*.*/}" >> $GITHUB_OUTPUT + echo "node=node_${node/.*.*/}" >> $env:GITHUB_OUTPUT + shell: bash + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' + - uses: codecov/codecov-action@v3 + continue-on-error: true + with: + file: coverage/coverage-final.json + flags: ${{ steps.test-coverage-flags.outputs.os }},${{ steps.test-coverage-flags.outputs.node }} + if: '${{ !steps.release-check.outputs.IS_RELEASE }}' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 0195a0926a6..00000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,259 +0,0 @@ -name: Testing - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - unit: - name: Unit - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] - node-version: ['*'] - steps: - # Sets an output parameter if this is a release PR - - name: Check for release - id: release-check - # For windows we have to use $env: - run: |- - echo "IS_RELEASE=true" >> $GITHUB_OUTPUT - echo "IS_RELEASE=true" >> $env:GITHUB_OUTPUT - if: "${{ startsWith(github.head_ref, 'release-') }}" - - name: Git checkout - uses: actions/checkout@v3 - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - cache-dependency-path: 'npm-shrinkwrap.json' - check-latest: true - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - - name: Install core dependencies - run: npm ci --no-audit - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - - name: Install site dependencies - run: npm run site:build:install - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - - name: Linting - run: npm run format:ci - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - - name: Run unit tests - run: npm run test:ci:ava:unit - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - - name: Run vitest unit tests - run: npm run test:ci:vitest:unit - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - integration: - name: Integration - runs-on: ${{ matrix.os }} - timeout-minutes: 15 - strategy: - matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] - node-version: [14.x, '*'] - shard: ['1/2', '2/2'] - - exclude: - - os: macOS-latest - node-version: '14.x' - - os: windows-latest - node-version: '14.x' - fail-fast: false - steps: - # Sets an output parameter if this is a release PR - - name: Check for release - id: release-check - # For windows we have to use $env: - run: |- - echo "IS_RELEASE=true" >> $GITHUB_OUTPUT - echo "IS_RELEASE=true" >> $env:GITHUB_OUTPUT - if: "${{ startsWith(github.head_ref, 'release-') }}" - # This improves Windows network performance, we need this since we open many ports in our tests - - name: Increase Windows port limit and reduce time wait delay - run: | - netsh int ipv4 set dynamicport tcp start=1025 num=64511 - REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters /v TcpTimedWaitDelay /t REG_DWORD /d 30 /f - if: "${{ matrix.os == 'windows-latest' && !steps.release-check.outputs.IS_RELEASE }}" - - name: Git checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - cache-dependency-path: 'npm-shrinkwrap.json' - check-latest: true - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - - name: Setup Deno - uses: denoland/setup-deno@v1 - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - with: - deno-version: v1.x - - name: Install core dependencies - run: npm ci --no-audit - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - - name: Determine which tests to run - if: '${{ !steps.release-check.outputs.IS_RELEASE }}' - uses: haya14busa/action-cond@v1 - id: changed - with: - cond: ${{ github.event_name == 'pull_request' }} - if_true: '--changed=${{ github.event.pull_request.base.sha }}' # on pull requests test with the project graph only the affected tests - if_false: '' # on the base branch run all the tests as security measure - - name: Generate self-signed certificates - run: npm run certs - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - shell: bash - - name: Prepare tests - run: npm run test:init - if: '${{ !steps.release-check.outputs.IS_RELEASE }}' - - name: Tests - if: '${{ !steps.release-check.outputs.IS_RELEASE }}' - run: npm run test:ci:vitest:integration -- --shard=${{ matrix.shard }} ${{ steps.changed.outputs.value }} - env: - # GitHub secrets are not available when running on PR from forks - # We set a flag so we can skip tests that access Netlify API - NETLIFY_TEST_DISABLE_LIVE: - ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }} - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - # NETLIFY_TEST_GITHUB_TOKEN is used to avoid reaching GitHub API limits in exec-fetcher.js - NETLIFY_TEST_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Changes the polling interval used by the file watcher - CHOKIDAR_INTERVAL: 20 - CHOKIDAR_USEPOLLING: 1 - - name: Get test coverage flags - id: test-coverage-flags - # For windows we have to use $env: - run: |- - os=${{ matrix.os }} - node=$(node --version) - echo "os=${os/-latest/}" >> $GITHUB_OUTPUT - echo "os=${os/-latest/}" >> $env:GITHUB_OUTPUT - echo "node=node_${node/.*.*/}" >> $GITHUB_OUTPUT - echo "node=node_${node/.*.*/}" >> $env:GITHUB_OUTPUT - shell: bash - if: '${{ !steps.release-check.outputs.IS_RELEASE }}' - - uses: codecov/codecov-action@v3 - continue-on-error: true - with: - flags: ${{ steps.test-coverage-flags.outputs.os }},${{ steps.test-coverage-flags.outputs.node }} - if: '${{ !steps.release-check.outputs.IS_RELEASE }}' - test: - name: Legacy Integration - runs-on: ${{ matrix.os }} - timeout-minutes: 30 - strategy: - matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] - node-version: [14.x, '*'] - machine: ['0', '1', '2', '3', '4', '5', '6'] - - exclude: - - os: macOS-latest - node-version: '14.x' - - os: windows-latest - node-version: '14.x' - fail-fast: false - steps: - # Sets an output parameter if this is a release PR - - name: Check for release - id: release-check - # For windows we have to use $env: - run: |- - echo "IS_RELEASE=true" >> $GITHUB_OUTPUT - echo "IS_RELEASE=true" >> $env:GITHUB_OUTPUT - if: "${{ startsWith(github.head_ref, 'release-') }}" - # This improves Windows network performance, we need this since we open many ports in our tests - - name: Increase Windows port limit and reduce time wait delay - run: | - netsh int ipv4 set dynamicport tcp start=1025 num=64511 - REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters /v TcpTimedWaitDelay /t REG_DWORD /d 30 /f - if: "${{ matrix.os == 'windows-latest' && !steps.release-check.outputs.IS_RELEASE }}" - - name: Git checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - cache-dependency-path: 'npm-shrinkwrap.json' - check-latest: true - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - - name: Setup Deno - uses: denoland/setup-deno@v1 - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - with: - deno-version: v1.x - - name: Install core dependencies - run: npm ci --no-audit - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - - name: Determine Test Command - uses: haya14busa/action-cond@v1 - id: testCommand - with: - cond: ${{ github.event_name == 'pull_request' }} - if_true: 'npm run test:affected ${{ github.event.pull_request.base.sha }}' # on pull requests test with the project graph only the affected tests - if_false: 'npm run test:ci:ava:integration' # on the base branch run all the tests as security measure - if: '${{ !steps.release-check.outputs.IS_RELEASE }}' - - name: Generate self-signed certificates - run: npm run certs - if: '${{!steps.release-check.outputs.IS_RELEASE}}' - shell: bash - - name: Prepare tests - run: npm run test:init - if: '${{ !steps.release-check.outputs.IS_RELEASE }}' - - name: Tests - run: ${{ steps.testCommand.outputs.value }} - env: - # GitHub secrets are not available when running on PR from forks - # We set a flag so we can skip tests that access Netlify API - NETLIFY_TEST_DISABLE_LIVE: - ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }} - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - # NETLIFY_TEST_GITHUB_TOKEN is used to avoid reaching GitHub API limits in exec-fetcher.js - NETLIFY_TEST_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Changes the polling interval used by the file watcher - CHOKIDAR_INTERVAL: 20 - CHOKIDAR_USEPOLLING: 1 - - # split tests across multiple machines - CI_NODE_INDEX: ${{ matrix.machine }} - CI_NODE_TOTAL: 7 - if: '${{ !steps.release-check.outputs.IS_RELEASE }}' - - name: Get test coverage flags - id: test-coverage-flags - # For windows we have to use $env: - run: |- - os=${{ matrix.os }} - node=$(node --version) - echo "os=${os/-latest/}" >> $GITHUB_OUTPUT - echo "os=${os/-latest/}" >> $env:GITHUB_OUTPUT - echo "node=node_${node/.*.*/}" >> $GITHUB_OUTPUT - echo "node=node_${node/.*.*/}" >> $env:GITHUB_OUTPUT - shell: bash - if: '${{ !steps.release-check.outputs.IS_RELEASE }}' - - uses: codecov/codecov-action@v3 - continue-on-error: true - with: - file: coverage/coverage-final.json - flags: ${{ steps.test-coverage-flags.outputs.os }},${{ steps.test-coverage-flags.outputs.node }} - if: '${{ !steps.release-check.outputs.IS_RELEASE }}' - all: - # This is here strictly to make branch protection rules easier, to avoid changing those based on matrix naming - needs: [unit, integration, test] - runs-on: ubuntu-latest - steps: - - name: Log success - run: echo "Finished running all tests" diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 00000000000..486fa32beb8 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,51 @@ +name: Tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + unit: + name: Unit + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macOS-latest, windows-latest] + node-version: ['*'] + steps: + # Sets an output parameter if this is a release PR + - name: Check for release + id: release-check + # For windows we have to use $env: + run: |- + echo "IS_RELEASE=true" >> $GITHUB_OUTPUT + echo "IS_RELEASE=true" >> $env:GITHUB_OUTPUT + if: "${{ startsWith(github.head_ref, 'release-') }}" + - name: Git checkout + uses: actions/checkout@v3 + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: 'npm-shrinkwrap.json' + check-latest: true + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Install core dependencies + run: npm ci --no-audit + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Install site dependencies + run: npm run site:build:install + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Linting + run: npm run format:ci + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Run unit tests + run: npm run test:ci:ava:unit + if: '${{!steps.release-check.outputs.IS_RELEASE}}' + - name: Run vitest unit tests + run: npm run test:ci:vitest:unit + if: '${{!steps.release-check.outputs.IS_RELEASE}}'