Skip to content

Commit 704d46c

Browse files
authored
Update to new GraphQL stack (#1243)
1 parent e322249 commit 704d46c

144 files changed

Lines changed: 11842 additions & 4442 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.knip.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"packages/mergebot": {
8484
"entry": ["src/functions/index.ts", "src/run.ts", "src/commands/create-fixture.ts", "src/commands/update-all-fixtures.ts", "src/commands/update-test-data.ts", "src/scripts/updateJSONFixtures.ts"],
8585
"project": "**/*.ts",
86-
"ignore": ["src/queries/schema/graphql-global-types.ts"]
86+
"ignore": ["src/queries/schema/*.ts"]
8787
}
8888
},
8989
"ignore": ["**/dist/**", "**/fixtures/**", "**/testsource/**", "**/dtslint/test/*/**", "**/*.d.ts"],

packages/mergebot/apollo.config.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/mergebot/codegen.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import type { CodegenConfig } from "@graphql-codegen/cli";
2+
3+
const config: CodegenConfig = {
4+
schema: "./node_modules/@octokit/graphql-schema/schema.graphql",
5+
documents: ["src/queries/**/*.ts"],
6+
ignoreNoDocuments: true,
7+
generates: {
8+
"./src/queries/schema/": {
9+
preset: "client",
10+
config: {
11+
useTypeImports: true,
12+
enumsAsTypes: false,
13+
onlyOperationTypes: true,
14+
scalars: {
15+
URI: "string",
16+
DateTime: "string",
17+
GitObjectID: "string",
18+
HTML: "string",
19+
Date: "string",
20+
PreciseDateTime: "string",
21+
X509Certificate: "string",
22+
GitSSHRemote: "string",
23+
Base64String: "string",
24+
GitTimestamp: "string",
25+
BigInt: "string",
26+
},
27+
},
28+
presetConfig: {
29+
fragmentMasking: false,
30+
},
31+
},
32+
},
33+
};
34+
35+
export default config;

packages/mergebot/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,26 @@
1919
"node": ">=20.17.0"
2020
},
2121
"dependencies": {
22-
"@apollo/client": "^3.14.0",
22+
"@apollo/client": "^4.1.3",
2323
"@azure/functions": "^4.11.0",
2424
"@definitelytyped/old-header-parser": "npm:@definitelytyped/header-parser@0.0.178",
2525
"@definitelytyped/utils": "workspace:*",
2626
"@octokit/webhooks-methods": "^4.1.0",
2727
"dayjs": "^1.11.19",
2828
"fast-json-patch": "^3.1.1",
29-
"graphql": "15.10.1",
29+
"graphql": "^16.12.0",
3030
"prettyjson": "^1.2.5",
3131
"yargs": "^17.7.2"
3232
},
3333
"devDependencies": {
34-
"@octokit/graphql-schema": "^14.58.0",
34+
"@graphql-codegen/cli": "^6.1.1",
35+
"@graphql-codegen/client-preset": "^5.2.2",
36+
"@graphql-typed-document-node/core": "^3.2.0",
37+
"@octokit/graphql-schema": "^15.26.1",
3538
"@octokit/webhooks-types": "^7.6.1",
3639
"@types/node": "^25.1.0",
3740
"@types/prettyjson": "^0.0.33",
3841
"@types/yargs": "^17.0.35",
39-
"apollo": "^2.34.0",
4042
"esbuild": "^0.27.2",
4143
"jest-file-snapshot": "^0.7.0",
4244
"rimraf": "^6.1.2",
@@ -49,7 +51,7 @@
4951
"build": "tsc -b",
5052
"bundle": "rimraf dist && esbuild --bundle --platform=node --format=cjs --target=node18 --external:@azure/functions-core --outfile=dist/functions/index.js src/functions/index.ts",
5153
"watch": "tsc --watch",
52-
"graphql-schema": "apollo client:codegen schema --target typescript --globalTypesFile=src/queries/schema/graphql-global-types.ts",
54+
"graphql-schema": "graphql-codegen --config codegen.ts",
5355
"create-fixture": "pnpm run build && node dist/commands/create-fixture.js",
5456
"update-test-data": "pnpm run build && node dist/commands/update-test-data.js",
5557
"update-all-fixtures": "pnpm run build && node dist/commands/update-all-fixtures.js",

packages/mergebot/src/_tests/fixturedActions.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import { ApolloQueryResult } from "@apollo/client/core";
21
import { readdirSync } from "fs";
32
import { join } from "path";
43
import { toMatchFile } from "jest-file-snapshot";
54
import { process } from "../compute-pr-actions";
6-
import { deriveStateForPR } from "../pr-info";
7-
import { PR } from "../queries/schema/PR";
5+
import { deriveStateForPR, PRQueryResponse } from "../pr-info";
86
import { readJsonSync, scrubDiagnosticDetails } from "../util/util";
97
import * as cachedQueries from "./cachedQueries";
108
jest.mock("../util/cachedQueries", () =>
@@ -28,9 +26,9 @@ async function testFixture(dir: string) {
2826
const resultPath = join(dir, "result.json");
2927
const mutationsPath = join(dir, "mutations.json");
3028

31-
const jsonString = (value: any) => scrubDiagnosticDetails(JSON.stringify(value, null, " ") + "\n");
29+
const jsonString = (value: unknown) => scrubDiagnosticDetails(JSON.stringify(value, null, " ") + "\n");
3230

33-
const response: ApolloQueryResult<PR> = readJsonSync(responsePath);
31+
const response: PRQueryResponse = readJsonSync(responsePath);
3432
const files = readJsonSync(filesPath);
3533
const downloads = readJsonSync(downloadsPath);
3634

packages/mergebot/src/_tests/fixtures/38979/mutations.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"mutation": "mutation ($input: UpdateIssueCommentInput!) {\n updateIssueComment(input: $input) {\n __typename\n }\n}\n",
3+
"mutation": "mutation ($input: UpdateIssueCommentInput!) {\n updateIssueComment(input: $input) {\n __typename\n }\n}",
44
"variables": {
55
"input": {
66
"id": "MDEyOklzc3VlQ29tbWVudDYyNzA5NzAxMg==",
@@ -9,7 +9,7 @@
99
}
1010
},
1111
{
12-
"mutation": "mutation ($input: AddLabelsToLabelableInput!) {\n addLabelsToLabelable(input: $input) {\n __typename\n }\n}\n",
12+
"mutation": "mutation ($input: AddLabelsToLabelableInput!) {\n addLabelsToLabelable(input: $input) {\n __typename\n }\n}",
1313
"variables": {
1414
"input": {
1515
"labelIds": [
@@ -21,7 +21,7 @@
2121
}
2222
},
2323
{
24-
"mutation": "mutation ($input: RemoveLabelsFromLabelableInput!) {\n removeLabelsFromLabelable(input: $input) {\n __typename\n }\n}\n",
24+
"mutation": "mutation ($input: RemoveLabelsFromLabelableInput!) {\n removeLabelsFromLabelable(input: $input) {\n __typename\n }\n}",
2525
"variables": {
2626
"input": {
2727
"labelIds": [
@@ -32,7 +32,7 @@
3232
}
3333
},
3434
{
35-
"mutation": "mutation ($input: UpdateProjectV2ItemFieldValueInput!) {\n updateProjectV2ItemFieldValue(input: $input) {\n __typename\n }\n}\n",
35+
"mutation": "mutation ($input: UpdateProjectV2ItemFieldValueInput!) {\n updateProjectV2ItemFieldValue(input: $input) {\n __typename\n }\n}",
3636
"variables": {
3737
"input": {
3838
"itemId": "MDExOlByb2plY3RDYXJkMjc1MTM1NTA=",
@@ -45,7 +45,7 @@
4545
}
4646
},
4747
{
48-
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}\n",
48+
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}",
4949
"variables": {
5050
"input": {
5151
"subjectId": "MDExOlB1bGxSZXF1ZXN0MzI1ODk5Njc0",
@@ -54,7 +54,7 @@
5454
}
5555
},
5656
{
57-
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}\n",
57+
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}",
5858
"variables": {
5959
"input": {
6060
"subjectId": "MDExOlB1bGxSZXF1ZXN0MzI1ODk5Njc0",
@@ -63,7 +63,7 @@
6363
}
6464
},
6565
{
66-
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}\n",
66+
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}",
6767
"variables": {
6868
"input": {
6969
"subjectId": "MDExOlB1bGxSZXF1ZXN0MzI1ODk5Njc0",

packages/mergebot/src/_tests/fixtures/43136/mutations.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}\n",
3+
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}",
44
"variables": {
55
"input": {
66
"subjectId": "MDExOlB1bGxSZXF1ZXN0Mzg4MzgyMzYy",
@@ -9,7 +9,7 @@
99
}
1010
},
1111
{
12-
"mutation": "mutation ($input: AddLabelsToLabelableInput!) {\n addLabelsToLabelable(input: $input) {\n __typename\n }\n}\n",
12+
"mutation": "mutation ($input: AddLabelsToLabelableInput!) {\n addLabelsToLabelable(input: $input) {\n __typename\n }\n}",
1313
"variables": {
1414
"input": {
1515
"labelIds": [
@@ -20,7 +20,7 @@
2020
}
2121
},
2222
{
23-
"mutation": "mutation ($input: RemoveLabelsFromLabelableInput!) {\n removeLabelsFromLabelable(input: $input) {\n __typename\n }\n}\n",
23+
"mutation": "mutation ($input: RemoveLabelsFromLabelableInput!) {\n removeLabelsFromLabelable(input: $input) {\n __typename\n }\n}",
2424
"variables": {
2525
"input": {
2626
"labelIds": [
@@ -32,7 +32,7 @@
3232
}
3333
},
3434
{
35-
"mutation": "mutation ($input: UpdateProjectV2ItemFieldValueInput!) {\n updateProjectV2ItemFieldValue(input: $input) {\n __typename\n }\n}\n",
35+
"mutation": "mutation ($input: UpdateProjectV2ItemFieldValueInput!) {\n updateProjectV2ItemFieldValue(input: $input) {\n __typename\n }\n}",
3636
"variables": {
3737
"input": {
3838
"itemId": "MDExOlByb2plY3RDYXJkMzQ1ODYyMzY=",
@@ -45,7 +45,7 @@
4545
}
4646
},
4747
{
48-
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}\n",
48+
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}",
4949
"variables": {
5050
"input": {
5151
"subjectId": "MDExOlB1bGxSZXF1ZXN0Mzg4MzgyMzYy",
@@ -54,7 +54,7 @@
5454
}
5555
},
5656
{
57-
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}\n",
57+
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}",
5858
"variables": {
5959
"input": {
6060
"subjectId": "MDExOlB1bGxSZXF1ZXN0Mzg4MzgyMzYy",

packages/mergebot/src/_tests/fixtures/43144/mutations.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}\n",
3+
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}",
44
"variables": {
55
"input": {
66
"subjectId": "MDExOlB1bGxSZXF1ZXN0Mzg4NDkxOTI2",
@@ -9,7 +9,7 @@
99
}
1010
},
1111
{
12-
"mutation": "mutation ($input: AddLabelsToLabelableInput!) {\n addLabelsToLabelable(input: $input) {\n __typename\n }\n}\n",
12+
"mutation": "mutation ($input: AddLabelsToLabelableInput!) {\n addLabelsToLabelable(input: $input) {\n __typename\n }\n}",
1313
"variables": {
1414
"input": {
1515
"labelIds": [
@@ -20,7 +20,7 @@
2020
}
2121
},
2222
{
23-
"mutation": "mutation ($input: UpdateProjectV2ItemFieldValueInput!) {\n updateProjectV2ItemFieldValue(input: $input) {\n __typename\n }\n}\n",
23+
"mutation": "mutation ($input: UpdateProjectV2ItemFieldValueInput!) {\n updateProjectV2ItemFieldValue(input: $input) {\n __typename\n }\n}",
2424
"variables": {
2525
"input": {
2626
"itemId": "MDExOlByb2plY3RDYXJkMzQ1OTI2MjI=",
@@ -33,7 +33,7 @@
3333
}
3434
},
3535
{
36-
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}\n",
36+
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}",
3737
"variables": {
3838
"input": {
3939
"subjectId": "MDExOlB1bGxSZXF1ZXN0Mzg4NDkxOTI2",

packages/mergebot/src/_tests/fixtures/43151/mutations.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}\n",
3+
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}",
44
"variables": {
55
"input": {
66
"subjectId": "MDExOlB1bGxSZXF1ZXN0Mzg4Njk0NDU5",
@@ -9,7 +9,7 @@
99
}
1010
},
1111
{
12-
"mutation": "mutation ($input: AddLabelsToLabelableInput!) {\n addLabelsToLabelable(input: $input) {\n __typename\n }\n}\n",
12+
"mutation": "mutation ($input: AddLabelsToLabelableInput!) {\n addLabelsToLabelable(input: $input) {\n __typename\n }\n}",
1313
"variables": {
1414
"input": {
1515
"labelIds": [
@@ -20,7 +20,7 @@
2020
}
2121
},
2222
{
23-
"mutation": "mutation ($input: RemoveLabelsFromLabelableInput!) {\n removeLabelsFromLabelable(input: $input) {\n __typename\n }\n}\n",
23+
"mutation": "mutation ($input: RemoveLabelsFromLabelableInput!) {\n removeLabelsFromLabelable(input: $input) {\n __typename\n }\n}",
2424
"variables": {
2525
"input": {
2626
"labelIds": [
@@ -31,7 +31,7 @@
3131
}
3232
},
3333
{
34-
"mutation": "mutation ($input: UpdateProjectV2ItemFieldValueInput!) {\n updateProjectV2ItemFieldValue(input: $input) {\n __typename\n }\n}\n",
34+
"mutation": "mutation ($input: UpdateProjectV2ItemFieldValueInput!) {\n updateProjectV2ItemFieldValue(input: $input) {\n __typename\n }\n}",
3535
"variables": {
3636
"input": {
3737
"itemId": "MDExOlByb2plY3RDYXJkMzQ2MDI3MDA=",
@@ -44,7 +44,7 @@
4444
}
4545
},
4646
{
47-
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}\n",
47+
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}",
4848
"variables": {
4949
"input": {
5050
"subjectId": "MDExOlB1bGxSZXF1ZXN0Mzg4Njk0NDU5",

packages/mergebot/src/_tests/fixtures/43160/mutations.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}\n",
3+
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}",
44
"variables": {
55
"input": {
66
"subjectId": "MDExOlB1bGxSZXF1ZXN0Mzg5MDYwOTQ4",
@@ -9,7 +9,7 @@
99
}
1010
},
1111
{
12-
"mutation": "mutation ($input: AddLabelsToLabelableInput!) {\n addLabelsToLabelable(input: $input) {\n __typename\n }\n}\n",
12+
"mutation": "mutation ($input: AddLabelsToLabelableInput!) {\n addLabelsToLabelable(input: $input) {\n __typename\n }\n}",
1313
"variables": {
1414
"input": {
1515
"labelIds": [
@@ -20,7 +20,7 @@
2020
}
2121
},
2222
{
23-
"mutation": "mutation ($input: UpdateProjectV2ItemFieldValueInput!) {\n updateProjectV2ItemFieldValue(input: $input) {\n __typename\n }\n}\n",
23+
"mutation": "mutation ($input: UpdateProjectV2ItemFieldValueInput!) {\n updateProjectV2ItemFieldValue(input: $input) {\n __typename\n }\n}",
2424
"variables": {
2525
"input": {
2626
"itemId": "MDExOlByb2plY3RDYXJkMzQ2MzEzMzI=",
@@ -33,7 +33,7 @@
3333
}
3434
},
3535
{
36-
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}\n",
36+
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}",
3737
"variables": {
3838
"input": {
3939
"subjectId": "MDExOlB1bGxSZXF1ZXN0Mzg5MDYwOTQ4",
@@ -42,7 +42,7 @@
4242
}
4343
},
4444
{
45-
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}\n",
45+
"mutation": "mutation ($input: AddCommentInput!) {\n addComment(input: $input) {\n __typename\n }\n}",
4646
"variables": {
4747
"input": {
4848
"subjectId": "MDExOlB1bGxSZXF1ZXN0Mzg5MDYwOTQ4",

0 commit comments

Comments
 (0)