Skip to content

Commit 9fc8206

Browse files
committed
Rename bindGraphQLSchemaAPIToContext to bindG and include functions that dont need to be bound to context
1 parent 5eafeea commit 9fc8206

File tree

14 files changed

+601
-593
lines changed

14 files changed

+601
-593
lines changed

.changeset/pretty-knives-rule.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@graphql-ts/schema": major
3+
---
4+
5+
`bindGraphQLSchemaAPIToContext` and `GraphQLSchemaAPIWithContext` have been replaced with `initG` and `GWithContext` which also include all the APIs that aren't specifically bound to a context.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { GraphQLSchemaAPIWithContext } from "../output";
1+
import { GWithContext } from "../output";
22

3-
declare const __graphql: GraphQLSchemaAPIWithContext<unknown>;
3+
declare const __graphql: GWithContext<unknown>;
44

55
export = __graphql;
Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1-
import { bindGraphQLSchemaAPIToContext } from "../output";
1+
import { initG } from "../output";
22

3-
const __graphql = bindGraphQLSchemaAPIToContext();
3+
const __graphql = initG();
44

5-
export const { field, fields, interfaceField, object, union } = __graphql;
5+
export const {
6+
field,
7+
fields,
8+
interfaceField,
9+
object,
10+
union,
11+
Boolean,
12+
Float,
13+
ID,
14+
Int,
15+
String,
16+
arg,
17+
enumValues,
18+
inputObject,
19+
list,
20+
nonNull,
21+
scalar,
22+
} = __graphql;
623

724
const interfaceType = __graphql.interface;
25+
const enumType = __graphql.enum;
826

9-
export { interfaceType as interface };
27+
export { interfaceType as interface, enumType as enum };

packages/schema/src/api-with-context/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// this is written like this because an export * from './something'
2-
// where ./something uses `export = ` is not allowed
31
export {
42
field,
53
fields,

packages/schema/src/api-without-context/enum.ts

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

packages/schema/src/api-without-context/index.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1-
export { arg, inputObject } from "./input";
2-
export { Boolean, Float, ID, Int, String, scalar } from "./scalars";
3-
export { list, nonNull } from "./list-and-non-null";
4-
export { enum, enumValues } from "./enum";
5-
export type { InferValueFromOutputType } from "../output";
1+
export {
2+
arg,
3+
inputObject,
4+
Boolean,
5+
Float,
6+
ID,
7+
Int,
8+
String,
9+
list,
10+
nonNull,
11+
enum,
12+
enumValues,
13+
scalar,
14+
} from "../api-with-context/api-with-context";
615
export type {
16+
InferValueFromOutputType,
717
InferValueFromArg,
818
InferValueFromArgs,
919
InferValueFromInputType,
10-
} from "./input";
20+
} from "../types";
1121

1222
import type {
1323
GArg,

packages/schema/src/api-without-context/input.ts

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

0 commit comments

Comments
 (0)