Skip to content

Commit 088cbc9

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

File tree

18 files changed

+625
-616
lines changed

18 files changed

+625
-616
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: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { bindGraphQLSchemaAPIToContext } from "../output";
1+
import * as g from "../schema-api";
22

3-
const __graphql = bindGraphQLSchemaAPIToContext();
3+
export const { field, fields, interfaceField, object, union } = g;
44

5-
export const { field, fields, interfaceField, object, union } = __graphql;
6-
7-
const interfaceType = __graphql.interface;
5+
const interfaceType = g.interface;
86

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