Skip to content

Commit f16f802

Browse files
committed
Rename bindGraphQLSchemaAPIToContext to initG and include functions that dont need to be bound to context
1 parent 5d2341e commit f16f802

File tree

18 files changed

+628
-615
lines changed

18 files changed

+628
-615
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.

.changeset/silly-eyes-rhyme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"@graphql-ts/schema": major
33
---
44

5-
The `ObjectTypeFunc` and other `*TypeFunc` types are no longer exported. Use `GraphQLSchemaAPIWithContext<Context>['object']`/etc. instead
5+
The `ObjectTypeFunc` and other `*TypeFunc` types are no longer exported. Use `GWithContext<Context>['object']`/etc. instead
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { bindGraphQLSchemaAPIToContext } from "../output";
1+
import { initG } from "../output";
22

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

5-
export const { field, fields, interfaceField, object, union } = __graphql;
5+
export const { field, fields, interfaceField, object, union } = g;
66

7-
const interfaceType = __graphql.interface;
7+
const interfaceType = g.interface;
88

99
export { interfaceType as interface };

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,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { GWithContext } from "../output";
2+
3+
declare const __graphql: GWithContext<unknown>;
4+
5+
export = __graphql;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { initG } from "../output";
2+
3+
const g = initG();
4+
5+
export const {
6+
Boolean,
7+
Float,
8+
ID,
9+
Int,
10+
String,
11+
arg,
12+
enumValues,
13+
inputObject,
14+
list,
15+
nonNull,
16+
scalar,
17+
} = g;
18+
19+
const enumType = g.enum;
20+
21+
export { enumType as enum };

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-without-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)