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/e2e-test.yml b/.github/workflows/e2e-tests.yml similarity index 98% rename from .github/workflows/e2e-test.yml rename to .github/workflows/e2e-tests.yml index d58cb76b1d2..fe5b45bc592 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-tests.yml @@ -1,4 +1,4 @@ -name: E2E Testing for CLI +name: Tests on: push: @@ -11,6 +11,7 @@ on: jobs: e2e: + name: E2E runs-on: ${{ matrix.os }} timeout-minutes: 20 env: 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/main.yml b/.github/workflows/legacy-tests.yml similarity index 73% rename from .github/workflows/main.yml rename to .github/workflows/legacy-tests.yml index 06e4b01f011..67087a68177 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/legacy-tests.yml @@ -1,4 +1,4 @@ -name: Testing for CLI +name: Tests on: push: @@ -7,45 +7,8 @@ on: branches: [main] jobs: - build: - 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}}' - test: + integration: + name: Legacy Integration runs-on: ${{ matrix.os }} timeout-minutes: 30 strategy: @@ -147,9 +110,3 @@ jobs: 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: - needs: [build, 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}}' diff --git a/e2e.config.mjs b/e2e.config.mjs index f5154ea0e27..30b3b62b9c0 100644 --- a/e2e.config.mjs +++ b/e2e.config.mjs @@ -1,7 +1,6 @@ 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..3376b31c52c 100644 --- a/package.json +++ b/package.json @@ -211,8 +211,11 @@ "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: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", @@ -337,6 +340,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 +356,20 @@ "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/**/*.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/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 a1abb83c987..00000000000 Binary files a/tests/integration/snapshots/530.graph-codegen.test.mjs.snap and /dev/null differ diff --git a/tests/integration/utils/got.cjs b/tests/integration/utils/got.cjs index 4f98f41a3b4..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 -// 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 5e4dc6becbe..00000000000 Binary files a/tests/unit/lib/completion/snapshots/completion.test.cjs.snap and /dev/null differ 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 5e4dc6becbe..00000000000 Binary files a/tests/unit/lib/completion/snapshots/generate-autocompletion.test.mjs.snap and /dev/null differ 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..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 }, - // 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/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 new file mode 100644 index 00000000000..15ac46db882 --- /dev/null +++ b/vitest.config.mjs @@ -0,0 +1,17 @@ +/// +import { defineConfig } from 'vite' + +export default defineConfig({ + test: { + include: ['tests/**/*.test.mjs'], + testTimeout: 30_000, + deps: { + external: ['**/fixtures/**', '**/node_modules/**'], + interopDefault: false, + }, + coverage: { + provider: 'c8', + reporter: ['text', 'lcov'], + }, + }, +})