Skip to content

Commit c6ce0a7

Browse files
authored
Rename graphql export to g (#9460)
1 parent e725451 commit c6ce0a7

File tree

72 files changed

+1843
-1795
lines changed

Some content is hidden

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

72 files changed

+1843
-1795
lines changed

.changeset/lemon-oranges-promise.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@keystone-6/fields-document": major
3+
"@keystone-6/cloudinary": major
4+
"@keystone-6/auth": major
5+
---
6+
7+
Prefer `g` instead of `graphql` when importing from `@keystone-6/core`

.changeset/small-kiwis-speak.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@keystone-6/core": minor
3+
---
4+
5+
Rename `graphql` export to `g` - `graphql` is still exported but is deprecated and may be removed in a future release

examples/custom-field/1-text-field/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
fieldType,
66
orderDirectionEnum,
77
} from '@keystone-6/core/types'
8-
import { graphql } from '@keystone-6/core'
8+
import { g } from '@keystone-6/core'
99

1010
type TextFieldConfig<ListTypeInfo extends BaseListTypeInfo> = CommonFieldConfig<ListTypeInfo> & {
1111
isIndexed?: boolean | 'unique'
@@ -25,16 +25,16 @@ export function text<ListTypeInfo extends BaseListTypeInfo> ({
2525
...config,
2626
input: {
2727
create: {
28-
arg: graphql.arg({ type: graphql.String }),
28+
arg: g.arg({ type: g.String }),
2929
resolve (value, context) {
3030
return value
3131
},
3232
},
33-
update: { arg: graphql.arg({ type: graphql.String }) },
34-
orderBy: { arg: graphql.arg({ type: orderDirectionEnum }) },
33+
update: { arg: g.arg({ type: g.String }) },
34+
orderBy: { arg: g.arg({ type: orderDirectionEnum }) },
3535
},
36-
output: graphql.field({
37-
type: graphql.String,
36+
output: g.field({
37+
type: g.String,
3838
resolve ({ value, item }, args, context, info) {
3939
return value
4040
},

examples/custom-field/2-stars-field/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
fieldType,
66
orderDirectionEnum,
77
} from '@keystone-6/core/types'
8-
import { graphql } from '@keystone-6/core'
8+
import { g } from '@keystone-6/core'
99

1010
// this field is based on the integer field
1111
// but with validation to ensure the value is within an expected range
@@ -47,7 +47,7 @@ export function stars <ListTypeInfo extends BaseListTypeInfo> ({
4747
// all of these inputs are optional if they don't make sense for a particular field type
4848
input: {
4949
create: {
50-
arg: graphql.arg({ type: graphql.Int }),
50+
arg: g.arg({ type: g.Int }),
5151
// this field type doesn't need to do anything special
5252
// but field types can specify resolvers for inputs like they can for their output GraphQL field
5353
// this function can be omitted, it is here purely to show how you could change it
@@ -67,11 +67,11 @@ export function stars <ListTypeInfo extends BaseListTypeInfo> ({
6767
return val
6868
},
6969
},
70-
update: { arg: graphql.arg({ type: graphql.Int }) },
71-
orderBy: { arg: graphql.arg({ type: orderDirectionEnum }) },
70+
update: { arg: g.arg({ type: g.Int }) },
71+
orderBy: { arg: g.arg({ type: orderDirectionEnum }) },
7272
},
73-
output: graphql.field({
74-
type: graphql.Int,
73+
output: g.field({
74+
type: g.Int,
7575
// like the input resolvers, providing the resolver is unnecessary if you're just returning the value
7676
// it is shown here to show what you could do
7777
resolve ({ value, item }, args, context, info) {

examples/custom-field/3-pair-field-json/index.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
type FieldTypeFunc,
55
fieldType,
66
} from '@keystone-6/core/types'
7-
import { graphql } from '@keystone-6/core'
7+
import { g } from '@keystone-6/core'
88

99
type PairFieldConfig<ListTypeInfo extends BaseListTypeInfo> = CommonFieldConfig<ListTypeInfo>
1010

@@ -14,26 +14,26 @@ type PairInput = {
1414
}
1515
type PairOutput = PairInput
1616

17-
const PairInput = graphql.inputObject({
17+
const PairInput = g.inputObject({
1818
name: 'PairJsonInput',
1919
fields: {
20-
left: graphql.arg({ type: graphql.String }),
21-
right: graphql.arg({ type: graphql.String }),
20+
left: g.arg({ type: g.String }),
21+
right: g.arg({ type: g.String }),
2222
},
2323
})
2424

25-
const PairOutput = graphql.object<PairOutput>()({
25+
const PairOutput = g.object<PairOutput>()({
2626
name: 'PairJsonOutput',
2727
fields: {
28-
left: graphql.field({ type: graphql.String }),
29-
right: graphql.field({ type: graphql.String }),
28+
left: g.field({ type: g.String }),
29+
right: g.field({ type: g.String }),
3030
},
3131
})
3232

33-
const PairFilter = graphql.inputObject({
33+
const PairFilter = g.inputObject({
3434
name: 'PairJsonFilter',
3535
fields: {
36-
equals: graphql.arg({
36+
equals: g.arg({
3737
type: PairInput,
3838
}),
3939
},
@@ -71,25 +71,25 @@ export function pair<ListTypeInfo extends BaseListTypeInfo> (
7171
...config,
7272
input: {
7373
where: {
74-
arg: graphql.arg({ type: PairFilter }),
74+
arg: g.arg({ type: PairFilter }),
7575
resolve (value, context) {
7676
return resolveWhere(value)
7777
},
7878
},
7979
create: {
80-
arg: graphql.arg({ type: PairInput }),
80+
arg: g.arg({ type: PairInput }),
8181
resolve (value, context) {
8282
return resolveInput(value)
8383
},
8484
},
8585
update: {
86-
arg: graphql.arg({ type: PairInput }),
86+
arg: g.arg({ type: PairInput }),
8787
resolve (value, context) {
8888
return resolveInput(value)
8989
},
9090
},
9191
},
92-
output: graphql.field({
92+
output: g.field({
9393
type: PairOutput,
9494
resolve ({ value, item }, args, context, info) {
9595
return resolveOutput(value)

examples/custom-field/3-pair-field-nested/index.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
type FieldTypeFunc,
55
fieldType,
66
} from '@keystone-6/core/types'
7-
import { graphql } from '@keystone-6/core'
7+
import { g } from '@keystone-6/core'
88

99
type PairFieldConfig<ListTypeInfo extends BaseListTypeInfo> = CommonFieldConfig<ListTypeInfo>
1010

@@ -14,26 +14,26 @@ type PairInput = {
1414
}
1515
type PairOutput = PairInput
1616

17-
const PairInput = graphql.inputObject({
17+
const PairInput = g.inputObject({
1818
name: 'PairNestedInput',
1919
fields: {
20-
left: graphql.arg({ type: graphql.String }),
21-
right: graphql.arg({ type: graphql.String }),
20+
left: g.arg({ type: g.String }),
21+
right: g.arg({ type: g.String }),
2222
},
2323
})
2424

25-
const PairOutput = graphql.object<PairOutput>()({
25+
const PairOutput = g.object<PairOutput>()({
2626
name: 'PairNestedOutput',
2727
fields: {
28-
left: graphql.field({ type: graphql.String }),
29-
right: graphql.field({ type: graphql.String }),
28+
left: g.field({ type: g.String }),
29+
right: g.field({ type: g.String }),
3030
},
3131
})
3232

33-
const PairFilter = graphql.inputObject({
33+
const PairFilter = g.inputObject({
3434
name: 'PairNestedFilter',
3535
fields: {
36-
equals: graphql.arg({
36+
equals: g.arg({
3737
type: PairInput,
3838
}),
3939
},
@@ -81,25 +81,25 @@ export function pair<ListTypeInfo extends BaseListTypeInfo> (
8181
...config,
8282
input: {
8383
where: {
84-
arg: graphql.arg({ type: PairFilter }),
84+
arg: g.arg({ type: PairFilter }),
8585
resolve (value, context) {
8686
return resolveWhere(value)
8787
},
8888
},
8989
create: {
90-
arg: graphql.arg({ type: PairInput }),
90+
arg: g.arg({ type: PairInput }),
9191
resolve (value, context) {
9292
return resolveInput(value)
9393
},
9494
},
9595
update: {
96-
arg: graphql.arg({ type: PairInput }),
96+
arg: g.arg({ type: PairInput }),
9797
resolve (value, context) {
9898
return resolveInput(value)
9999
},
100100
},
101101
},
102-
output: graphql.field({
102+
output: g.field({
103103
type: PairOutput,
104104
resolve ({ value, item }, args, context, info) {
105105
return resolveOutput(value)

examples/custom-field/3-pair-field/index.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ import {
44
type FieldTypeFunc,
55
fieldType,
66
} from '@keystone-6/core/types'
7-
import { graphql } from '@keystone-6/core'
7+
import { g } from '@keystone-6/core'
88

99
type PairFieldConfig<ListTypeInfo extends BaseListTypeInfo> = CommonFieldConfig<ListTypeInfo>
1010

1111
type PairInput = string
1212
type PairOutput = string
1313

14-
const PairInput = graphql.String
15-
const PairOutput = graphql.String
14+
const PairInput = g.String
15+
const PairOutput = g.String
1616

17-
const PairFilter = graphql.inputObject({
17+
const PairFilter = g.inputObject({
1818
name: 'PairFilter',
1919
fields: {
20-
equals: graphql.arg({ type: graphql.String }),
20+
equals: g.arg({ type: g.String }),
2121
},
2222
})
2323

@@ -68,25 +68,25 @@ export function pair<ListTypeInfo extends BaseListTypeInfo> (
6868
...config,
6969
input: {
7070
where: {
71-
arg: graphql.arg({ type: PairFilter }),
71+
arg: g.arg({ type: PairFilter }),
7272
resolve (value, context) {
7373
return resolveWhere(value)
7474
},
7575
},
7676
create: {
77-
arg: graphql.arg({ type: PairInput }),
77+
arg: g.arg({ type: PairInput }),
7878
resolve (value, context) {
7979
return resolveInput(value)
8080
},
8181
},
8282
update: {
83-
arg: graphql.arg({ type: PairInput }),
83+
arg: g.arg({ type: PairInput }),
8484
resolve (value, context) {
8585
return resolveInput(value)
8686
},
8787
},
8888
},
89-
output: graphql.field({
89+
output: g.field({
9090
type: PairOutput,
9191
resolve ({ value, item }, args, context, info) {
9292
return resolveOutput(value)

examples/custom-field/4-conditional-field/index.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
fieldType,
66
orderDirectionEnum,
77
} from '@keystone-6/core/types'
8-
import { graphql } from '@keystone-6/core'
8+
import { g } from '@keystone-6/core'
99

1010
type TextFieldConfig<ListTypeInfo extends BaseListTypeInfo> = CommonFieldConfig<ListTypeInfo> & {
1111
isIndexed?: boolean | 'unique'
@@ -30,16 +30,16 @@ export function feedback<ListTypeInfo extends BaseListTypeInfo> ({
3030
...config,
3131
input: {
3232
create: {
33-
arg: graphql.arg({ type: graphql.String }),
33+
arg: g.arg({ type: g.String }),
3434
resolve (value, context) {
3535
return value
3636
},
3737
},
38-
update: { arg: graphql.arg({ type: graphql.String }) },
39-
orderBy: { arg: graphql.arg({ type: orderDirectionEnum }) },
38+
update: { arg: g.arg({ type: g.String }) },
39+
orderBy: { arg: g.arg({ type: orderDirectionEnum }) },
4040
},
41-
output: graphql.field({
42-
type: graphql.String,
41+
output: g.field({
42+
type: g.String,
4343
resolve ({ value, item }, args, context, info) {
4444
return value
4545
},

0 commit comments

Comments
 (0)