Skip to content

Commit 403fe22

Browse files
committed
chore: fix formatting post-merge
1 parent cfcec60 commit 403fe22

File tree

2 files changed

+233
-226
lines changed

2 files changed

+233
-226
lines changed

src/helpers/introspection.ts

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {buildClientSchema, getIntrospectionQuery, printSchema} from "graphql";
2-
import {readFile} from "node:fs/promises";
1+
import { buildClientSchema, getIntrospectionQuery, printSchema } from "graphql";
2+
import { readFile } from "node:fs/promises";
33

44
/**
55
* Introspect a GraphQL endpoint and return the schema as the GraphQL SDL
@@ -8,30 +8,30 @@ import {readFile} from "node:fs/promises";
88
* @returns The schema
99
*/
1010
export async function introspectEndpoint(
11-
endpoint: string,
12-
headers?: Record<string, string>,
11+
endpoint: string,
12+
headers?: Record<string, string>,
1313
) {
14-
const response = await fetch(endpoint, {
15-
method: "POST",
16-
headers: {
17-
"Content-Type": "application/json",
18-
...headers,
19-
},
20-
body: JSON.stringify({
21-
query: getIntrospectionQuery(),
22-
}),
23-
});
24-
25-
if (!response.ok) {
26-
throw new Error(`GraphQL request failed: ${response.statusText}`);
27-
}
28-
29-
const responseJson = await response.json();
30-
// Transform to a schema object
31-
const schema = buildClientSchema(responseJson.data);
32-
33-
// Print the schema SDL
34-
return printSchema(schema);
14+
const response = await fetch(endpoint, {
15+
method: "POST",
16+
headers: {
17+
"Content-Type": "application/json",
18+
...headers,
19+
},
20+
body: JSON.stringify({
21+
query: getIntrospectionQuery(),
22+
}),
23+
});
24+
25+
if (!response.ok) {
26+
throw new Error(`GraphQL request failed: ${response.statusText}`);
27+
}
28+
29+
const responseJson = await response.json();
30+
// Transform to a schema object
31+
const schema = buildClientSchema(responseJson.data);
32+
33+
// Print the schema SDL
34+
return printSchema(schema);
3535
}
3636

3737
/**
@@ -40,14 +40,14 @@ export async function introspectEndpoint(
4040
* @returns The schema
4141
*/
4242
export async function introspectSchemaFromUrl(url: string) {
43-
const response = await fetch(url);
43+
const response = await fetch(url);
4444

45-
if (!response.ok) {
46-
throw new Error(`Failed to fetch schema from URL: ${response.statusText}`);
47-
}
45+
if (!response.ok) {
46+
throw new Error(`Failed to fetch schema from URL: ${response.statusText}`);
47+
}
4848

49-
const schema = await response.text();
50-
return schema;
49+
const schema = await response.text();
50+
return schema;
5151
}
5252

5353
/**
@@ -56,6 +56,6 @@ export async function introspectSchemaFromUrl(url: string) {
5656
* @returns The schema
5757
*/
5858
export async function introspectLocalSchema(path: string) {
59-
const schema = await readFile(path, "utf8");
60-
return schema;
59+
const schema = await readFile(path, "utf8");
60+
return schema;
6161
}

0 commit comments

Comments
 (0)