Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New core #5665

Merged
merged 320 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
320 commits
Select commit Hold shift + click to select a range
e9989ed
Remove legacy tests (#5669)
timleslie May 11, 2021
2497304
Update @ts-gql/schema with a fix with for the inferred type of enums …
emmatown May 11, 2021
1261b81
Unique tests (#5671)
timleslie May 11, 2021
ac22d92
Merge branch 'next-fields' of https://github.com/keystonejs/keystone …
emmatown May 11, 2021
d30e998
Fix fetching items through a relationship field
emmatown May 11, 2021
88284fd
Add defaultValue to variables in executeGraphQLFieldToRootVal
emmatown May 11, 2021
29fc64f
Fix a type error
emmatown May 11, 2021
00ca78c
Fix updateOne
emmatown May 11, 2021
92e7df3
Use order by (#5678)
timleslie May 12, 2021
e54cf67
Progress on filter things
emmatown May 12, 2021
2aaed05
Merge branch 'master' into next-fields
emmatown May 12, 2021
779448d
WIP on filters
emmatown May 13, 2021
0812847
filters!
emmatown May 13, 2021
8bb27f2
Password filter
emmatown May 13, 2021
71215bb
First pass at filter test updates for new fields (#5696)
timleslie May 13, 2021
4ea26bc
Update filter tests for passwords (#5698)
timleslie May 13, 2021
8b04d39
Fix auth
emmatown May 13, 2021
0e4aa19
Fix .count(), update tests (#5699)
timleslie May 13, 2021
a64a797
Remove itemQueryName
emmatown May 13, 2021
0ca25a6
Merge branch 'master' into next-fields
emmatown May 13, 2021
fd3b799
Make the list function type errors go away
emmatown May 13, 2021
dc49dc0
Fix nested mutations (#5700)
timleslie May 13, 2021
62166ee
Decimal filters and scalar
emmatown May 13, 2021
12bd5ca
Fix type errors in document field
emmatown May 13, 2021
a9552a1
Fix fetching one-sided relationships
emmatown May 13, 2021
e8a9f49
Fix orderBy
emmatown May 13, 2021
2d0a6b3
manypkg fix
emmatown May 13, 2021
fd1b879
Relationship tests for next fields (#5701)
timleslie May 13, 2021
2d84fad
Merge branch 'master' into next-fields
emmatown May 13, 2021
e5ae2c9
Implement decimal field
emmatown May 13, 2021
4eecb4b
Cloudinary field
emmatown May 14, 2021
bb2ceb9
Update more tests to new APIs (#5703)
timleslie May 14, 2021
a9bfec9
Change meta query to count
emmatown May 14, 2021
092babd
Fix displayMode: 'count'
emmatown May 14, 2021
443bf9c
More graphql api changes
emmatown May 14, 2021
cbe0d44
Fix some more things
emmatown May 14, 2021
9552e85
Add endSession with @ts-gql/schema
emmatown May 14, 2021
65c241f
Require that idFields are non null ids
emmatown May 14, 2021
5c00d7c
Update tests, fix minor bugs (#5714)
timleslie May 14, 2021
5dff33d
Merge branch 'master' into next-fields
emmatown May 14, 2021
7888d1b
Try fixing CodeSandbox CI
emmatown May 14, 2021
f1591b5
Filter to-one relationship by null
emmatown May 14, 2021
2120dc6
Fix find one with filter access control
emmatown May 14, 2021
d92ee7f
Get more tests working (#5721)
timleslie May 14, 2021
7cfb647
Fix commands
emmatown May 14, 2021
5b9d149
Move prisma utils
emmatown May 14, 2021
19075bc
Update todo example from default branch
emmatown May 16, 2021
1be79a6
Merge branch 'master' into next-fields
emmatown May 16, 2021
8deb8ec
Fix an error
emmatown May 16, 2021
3d80c64
Update tests to use new APIs (#5730)
timleslie May 17, 2021
5b14826
Merge branch 'master' into next-fields
emmatown May 17, 2021
a89b179
Disconnect fixes (#5731)
timleslie May 17, 2021
3559223
Fix more tests (#5732)
timleslie May 17, 2021
cbbceda
More test updates for new APIs (#5733)
timleslie May 17, 2021
a397a65
Update more tests for new APIs (#5748)
timleslie May 18, 2021
04d5a13
Merge branch 'master' into next-fields
emmatown May 18, 2021
a305625
Make orderBy essentially an input union
emmatown May 18, 2021
c0bd627
manypkg fix
emmatown May 18, 2021
598bbc7
Merge branch 'master' into next-fields
emmatown May 18, 2021
ef151e3
sortBy -> orderBy tests
emmatown May 19, 2021
27c5e67
Add orderBy test
timleslie May 19, 2021
13d262d
Merge branch 'master' into next-fields
emmatown May 19, 2021
f56fb50
Update example schemas (#5762)
timleslie May 19, 2021
4433634
Delete a bunch of old stuff to get rid of a bunch of type errors
emmatown May 20, 2021
bfca660
image and file field using interfaces
emmatown May 21, 2021
59edb3f
Make things nullable
emmatown May 21, 2021
831f9c9
Coerce and validate filters from access control
emmatown May 21, 2021
81ff524
Remove unused import
emmatown May 21, 2021
74dbf14
Change default idField to uuid to test nested mutation behaviour with…
emmatown May 21, 2021
35e745e
Refactor the return type of createSystem
emmatown May 21, 2021
ee275d0
Merge branch 'master' into next-fields
emmatown May 24, 2021
cd0c318
Merge branch 'master' into next-fields
emmatown May 25, 2021
8160acd
Update orderBy things
emmatown May 25, 2021
3da3903
Merge branch 'master' into next-fields
emmatown May 25, 2021
70d7ee0
Start of legacy filters stuff
emmatown May 25, 2021
cacc52c
WIP of legacy filters
emmatown May 25, 2021
8ceeeaa
more progress on legacy filters
emmatown May 25, 2021
4430055
more progress on legacy filters
emmatown May 25, 2021
8f77e8d
Fix things
emmatown May 25, 2021
86b4b00
Relationship filtering
emmatown May 26, 2021
d682461
words
emmatown May 26, 2021
9fc53db
start of defaultValue and isRequired
emmatown May 26, 2021
b55b19b
fix a thing
emmatown May 26, 2021
7abacac
Implement legacy defaultValue and isRequired
emmatown May 26, 2021
85ed6d1
Reset tests from default branch
emmatown May 26, 2021
ab2f7f6
Merge branch 'master' into next-fields
emmatown May 26, 2021
d5ced8d
Change back to isIndexed and isUnique
emmatown May 26, 2021
9e6b03c
Reset server-side-graphql-client
emmatown May 26, 2021
d9df084
Change ordering of fields in generated prisma schema
emmatown May 27, 2021
3c5eb59
Simplify schema construction
emmatown May 27, 2021
5eb0da6
Revert "Simplify schema construction"
emmatown May 27, 2021
62a4ec6
more things
emmatown May 27, 2021
d0f4fd9
more alignment on graphql schema
emmatown May 27, 2021
6441eca
More alignment
emmatown May 27, 2021
855581e
Update generated schemas
emmatown May 27, 2021
0bf076d
more alignment
emmatown May 27, 2021
6096053
orderBy and search
emmatown May 27, 2021
6c4b362
More progress
emmatown May 27, 2021
9136414
Fix a bunch of stuff
emmatown May 27, 2021
97e63be
more progress
emmatown May 27, 2021
e96f341
WIP
emmatown May 27, 2021
1f58ce3
Fix resolveInput
emmatown May 27, 2021
6e7de0a
Remove skipped thing
emmatown May 27, 2021
ec5c2d3
Fix access control
emmatown May 27, 2021
12ab5d6
Fix some more things
emmatown May 27, 2021
3216a65
Update virtual field tests
emmatown May 27, 2021
5fc272a
progress
emmatown May 27, 2021
4f2b76c
a hacky fix
emmatown May 27, 2021
cc3585b
Merge branch 'master' into next-fields
emmatown May 27, 2021
616bbfa
progress on cache hints
emmatown May 27, 2021
395365e
error ordering things
emmatown May 28, 2021
2f63377
a bunch of progress on relationships
emmatown May 28, 2021
39a860f
Fix some more things
emmatown May 28, 2021
10ea0e2
Fix some more things
emmatown May 28, 2021
070fea1
Merge branch 'master' into next-fields
emmatown May 28, 2021
db221db
Fix some things
emmatown May 28, 2021
9019859
Fix some things
emmatown May 28, 2021
e411d86
Fix a thing
emmatown May 28, 2021
46fb925
fix a thing
emmatown May 28, 2021
49701bd
WIP
emmatown May 31, 2021
0dea728
Merge branch 'master' into next-fields
emmatown May 31, 2021
3f0f13c
FIx some more things
emmatown May 31, 2021
69f1787
Revert access control API changes
emmatown May 31, 2021
7348d90
Move some utils
emmatown May 31, 2021
89fe84d
wip
emmatown May 31, 2021
fad10e2
WIP
emmatown May 31, 2021
1813515
refactoring
emmatown May 31, 2021
9c8361d
Fix things
emmatown May 31, 2021
fdc0a6d
Merge branch 'master' into next-fields
emmatown May 31, 2021
54c6d3d
autoIncrement as non-id field
emmatown May 31, 2021
a7c55cd
actually do autoIncrement as non-id field
emmatown May 31, 2021
6ad0d27
Fix autoIncrement
emmatown Jun 1, 2021
afdd16b
Fix a thing
emmatown Jun 1, 2021
7cfb4c1
Fix another autoIncrement thing
emmatown Jun 1, 2021
55bbf40
i think this is it
emmatown Jun 1, 2021
85ebe71
Fix some things
emmatown Jun 1, 2021
1474589
Reset admin ui things
emmatown Jun 1, 2021
31dea31
Fix things
emmatown Jun 1, 2021
4799cab
Fix another thing
emmatown Jun 1, 2021
29f04f5
Fix things
emmatown Jun 1, 2021
50bbd4d
Update schemas
emmatown Jun 1, 2021
20a30a6
ordering things
emmatown Jun 1, 2021
524ab17
Fix some dep things
emmatown Jun 1, 2021
94d1735
Fix cache hints
emmatown Jun 1, 2021
1e1b34c
Cleanup
emmatown Jun 1, 2021
ab60bee
Update @ts-gql/schema
emmatown Jun 1, 2021
7e930fd
Remove another unused dep
emmatown Jun 1, 2021
9f83c72
Reset docs
emmatown Jun 1, 2021
8b3b041
Fix some things
emmatown Jun 1, 2021
9eea802
Experiment with schema reordering for an easier diff
emmatown Jun 1, 2021
8d48480
More reordering
emmatown Jun 1, 2021
67acb02
More changes for the diff
emmatown Jun 1, 2021
ffbe04a
more changes for the diff
emmatown Jun 1, 2021
6ad69bc
WIP
emmatown Jun 1, 2021
44cf8b4
Merge branch 'master' into next-fields
emmatown Jun 2, 2021
4f247e4
More changes to reduce the diff size
emmatown Jun 2, 2021
8928521
More schema diff fixes
emmatown Jun 2, 2021
70d4d00
More schema alignment
emmatown Jun 2, 2021
dbdddf4
Another diff fix
emmatown Jun 2, 2021
1355122
Update snapshots
emmatown Jun 2, 2021
c3f58df
Remove a bunch of dead code
emmatown Jun 2, 2021
a36c33f
explain a thing
emmatown Jun 2, 2021
b5899a0
Merge branch 'master' into next-fields
emmatown Jun 2, 2021
912fcba
New @ts-gql/schema stuff
emmatown Jun 2, 2021
877544b
Fix cloudinary descriptions
emmatown Jun 2, 2021
ab30bde
Fix some uniqueWhere stuff
emmatown Jun 2, 2021
32ef43e
Fix a thing
emmatown Jun 2, 2021
0c7cafe
Fix the condition
emmatown Jun 2, 2021
c467fd6
Align error things
emmatown Jun 2, 2021
b07b717
Fix auth things
emmatown Jun 2, 2021
d226e3d
Fix another usage
emmatown Jun 2, 2021
27c0181
Remove some unused stuff
emmatown Jun 2, 2021
ddafeb7
Start of cleanup
emmatown Jun 2, 2021
016b270
Some refactoring
emmatown Jun 2, 2021
8107f5f
More refactoring
emmatown Jun 2, 2021
2136851
More refactoring
emmatown Jun 2, 2021
954634e
More refactoring
emmatown Jun 2, 2021
660f614
Prisma schema conflicting enum error fix
emmatown Jun 2, 2021
1722b25
More prisma schema error fixes
emmatown Jun 2, 2021
31e7281
More cleanup
emmatown Jun 2, 2021
4f64b5e
More refactoring
emmatown Jun 2, 2021
2102693
More refactoring
emmatown Jun 2, 2021
76923c8
Merge branch 'master' into next-fields
emmatown Jun 2, 2021
abbb276
Add @ts-gql/schema dep back
emmatown Jun 2, 2021
723e8d5
Fix some things
emmatown Jun 2, 2021
839c057
Redorder a thing
emmatown Jun 2, 2021
ac0ee5d
More reordering
emmatown Jun 2, 2021
eccd07a
Fix some things
emmatown Jun 2, 2021
f0c70ab
Remove misleading comments (the mentioned problem won't happen)
emmatown Jun 2, 2021
87a8e6f
More reordering
emmatown Jun 2, 2021
1287da7
Remove a non-null assertion
emmatown Jun 2, 2021
ab1af34
Fix a thing
emmatown Jun 2, 2021
d199407
Fix things
emmatown Jun 2, 2021
5a799d6
Remove more dead code
emmatown Jun 2, 2021
46a5e4a
More reordering
emmatown Jun 2, 2021
c3d301a
More refactoring
emmatown Jun 2, 2021
02b7929
More refactoring
emmatown Jun 2, 2021
ee3e407
Merge branch 'master' into next-fields
emmatown Jun 3, 2021
b4ef08b
More cleanup
emmatown Jun 3, 2021
93e1c73
More cleanup
emmatown Jun 3, 2021
e7526c5
More cleanup
emmatown Jun 3, 2021
28aa5ea
More cleanup
emmatown Jun 3, 2021
1a38262
More cleanup
emmatown Jun 3, 2021
ef74eee
Fix more things
emmatown Jun 4, 2021
94621ef
Start of changesets
emmatown Jun 4, 2021
d9ca068
Merge branch 'master' into next-fields
emmatown Jun 4, 2021
3cda230
Revert "More cleanup"
emmatown Jun 4, 2021
046e738
Remove a thing
emmatown Jun 4, 2021
27cec49
Fix more docs
emmatown Jun 4, 2021
948ed43
words
emmatown Jun 4, 2021
d80220c
Remove a thing that we shouldn't do
emmatown Jun 4, 2021
278b745
Add another changeset
emmatown Jun 4, 2021
9cb481e
changeset
emmatown Jun 4, 2021
7f903ae
changeset
emmatown Jun 4, 2021
bf4e18b
Enable cloudinary field tests for a sec
emmatown Jun 4, 2021
62478e0
More things
emmatown Jun 4, 2021
0e89a80
the long name is good
emmatown Jun 4, 2021
5c87fc5
changeset
emmatown Jun 4, 2021
64e6ebe
some more things
emmatown Jun 4, 2021
99f00c0
changeset
emmatown Jun 4, 2021
794459c
Add cloudinaryImage filters back because why not
emmatown Jun 4, 2021
1771006
Fix more things
emmatown Jun 4, 2021
e647e8d
Stop exporting some things
emmatown Jun 4, 2021
6407554
Use an if
emmatown Jun 4, 2021
bb9fd7d
Fix a comment
emmatown Jun 4, 2021
871eabf
Fix a thing
emmatown Jun 4, 2021
70cfa28
things
emmatown Jun 4, 2021
d7709bf
Remove an unused thing
emmatown Jun 4, 2021
ed28796
Remove an unnecessary thing
emmatown Jun 4, 2021
c1b594c
Remove commented out lines
emmatown Jun 4, 2021
e168ad6
Reset changes to a thing
emmatown Jun 4, 2021
720011a
Remove more dead code
emmatown Jun 4, 2021
c8ac9c7
More dead code
emmatown Jun 4, 2021
1ef4aa8
Remove usages of interfaces file
emmatown Jun 4, 2021
980cf42
Fix a thing
emmatown Jun 4, 2021
f8dcf32
Fix things
emmatown Jun 4, 2021
367130a
words
emmatown Jun 4, 2021
64a9ece
Use the right secret field impls
emmatown Jun 4, 2021
0d8e107
Allow virtual fields that reference other list types
emmatown Jun 7, 2021
d53c22e
Use @graphql-ts/schema
emmatown Jun 8, 2021
b360df1
Rename `types` to `schema`
emmatown Jun 8, 2021
5024488
Merge branch 'master' into next-fields
emmatown Jun 8, 2021
7be9de5
Fix afterChange not being called for nested creates
emmatown Jun 8, 2021
79e7e6a
Merge branch 'master' into next-fields
emmatown Jun 8, 2021
aad881e
Explicitly export
emmatown Jun 8, 2021
4ac1032
Update .changeset/mean-chairs-destroy.md
emmatown Jun 8, 2021
59e783a
Remove added support for plural, label, singular and path options for…
emmatown Jun 8, 2021
a30e860
Update docs
emmatown Jun 8, 2021
1f43689
Remove commented out plugins thing
emmatown Jun 8, 2021
420c025
Fix docs for GraphQL plural and add a changeset for it
emmatown Jun 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bright-eels-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': major
---

The ordering of types in the generated `schema.graphql` has changed due to the re-implementation of the core of Keystone, you will need to run `keystone-next dev`/`keystone-next postinstall --fix` to update it.
5 changes: 5 additions & 0 deletions .changeset/few-hounds-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': major
---

`createSystem` no longer accepts a Prisma client directly and it returns `getKeystone` which accepts the generated Prisma client and returns `connect`, `disconnect` and `createContext` instead of returning a `keystone` instance object.
5 changes: 5 additions & 0 deletions .changeset/little-chicken-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/fields': major
---

The relationship field now returns a `[Item!]` instead of a `[Item!]!`, this is so that if an error occurs when resolving the related items, only the relationship field will be returned as null rather than the whole item being returned as null.
5 changes: 5 additions & 0 deletions .changeset/mean-chairs-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/fields': major
---

The API to configure `virtual` fields has changed to accept a `field` using the `schema` API exported from `@keystone-next/types` rather than GraphQL SDL.
10 changes: 10 additions & 0 deletions .changeset/plenty-flies-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@keystone-next/auth': major
'@keystone-next/cloudinary': major
'@keystone-next/fields': major
'@keystone-next/fields-document': major
'@keystone-next/keystone': major
'@keystone-next/types': major
---

The core of Keystone has been re-implemented to make implementing fields and new features in Keystone easier. While the observable changes for most users should be minimal, there could be breakage. If you implemented a custom field type, you will need to change it to the new API, see fields in the `@keystone-next/fields` package for inspiration on how to do this.
5 changes: 5 additions & 0 deletions .changeset/rare-coats-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': major
---

The ordering of relationships fields in the generated Prisma schema has changed so that it aligns with the order specified in the list config with the opposites to one-sided relationships added at the end. The name of one-to-one and one-to-many relationships has also changed to include `_` between the list key and field key to align with many-to-many relationships. Note that these changes do **not require a migration**, only your `schema.prisma` file will need to be updated with `keystone-next dev`/`keystone-next postinstall --fix`.
5 changes: 5 additions & 0 deletions .changeset/rich-worms-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': major
---

The `id` field on the item returned from `context.db.lists` functions/passed to hooks/field type resolvers is now whatever the actual id field returned from Prisma is rather than a stringified version of it.
6 changes: 6 additions & 0 deletions .changeset/six-colts-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@keystone-next/keystone': major
'@keystone-next/types': major
---

Replaced `graphql.itemQueryName` with always using the list key as the singular name in GraphQL and renamed `graphql.listQueryName` to `graphql.plural`
6 changes: 6 additions & 0 deletions .changeset/slow-camels-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@keystone-next/keystone': major
'@keystone-next/types': major
---

The `KeystoneContext` type no longer has the `keystone` object or functions to run access control.
6 changes: 6 additions & 0 deletions .changeset/small-guests-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@keystone-next/keystone': major
'@keystone-next/types': major
---

List level create, update and delete access control is now called for each operation in a many operation rather than on all of the operations as a whole. This means that rather than recieving originalInput as an array with itemIds, your access control functions will always be called with just an itemId and/or originalInput(depending on which access control function it is). If your access control functions already worked with creating/updating/deleting one item, they will continue working (though you may get TypeScript errors if you were previously handling itemIds and originalInput as an array, to fix that, you should stop handling that case).
15 changes: 15 additions & 0 deletions .changeset/smooth-pears-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'@keystone-next/fields': major
---

The `password` field type now adds a GraphQL type `PasswordState` to the GraphQL output type instead of adding `${fieldKey}_is_set`.

```graphql
type User {
password: PasswordState
}

type PasswordState {
isSet: Boolean!
}
```
6 changes: 6 additions & 0 deletions .changeset/thin-humans-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@keystone-next/auth': major
'@keystone-next/fields': major
---

The way that the implementations of `generateHash` and `compare` are passed from the password field to auth has changed to be in the extensions object of the GraphQL output field. Unless you've written your own password field implementation or you're using mismatching versions of @keystone-next/auth and @keystone-next/fields, this won't affect you.
5 changes: 5 additions & 0 deletions .changeset/wicked-moles-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': major
---

Filters returned from access control now go through GraphQL validation and coercion like filters that you pass in through the GraphQL API, this will produce better errors when you return invalid values.
26 changes: 8 additions & 18 deletions docs/pages/apis/access-control.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,14 @@ export default config({

Imperative access control functions are passed a collection of arguments which can be used to determine whether the operation is allowed.

| Argument | Description |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `listKey` | The key of the list being operated on. |
| `operation` | The CRUD operation being performed (`'create'`, `'read'`, `'update'`, `'delete'`). |
| `session` | The current session object. See the [Sessions API](./session) for details. |
| `originalInput` | For `create` and `update` operations, this is the value of `data` passed into the mutation. For `read` and `delete` operations this value is `undefined`. |
| `gqlName` | The name of the query or mutation being called. |
| `itemId` | The `id` of the item being updated/deleted in singular `update` and `delete` operations. The `id` of the item being searched for in a single item query. `undefined` for other operations. |
| `itemIds` | The `ids` of the items being updated/deleted in multiple `update` and `delete` operations. `undefined` for other operations. |
| `context` | The [`KeystoneContext`](./context) object of the originating GraphQL operation. |

> **Important**: When writing imperative access control functions it is essential to consider both singular and multi-value operations.
> If you check the `itemId` in the singular case, then you also need to check the `itemIds` in the multi-value case.
> Similarly, `originalInput` will be different in the singular and multi-valued cases.
| Argument | Description |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `listKey` | The key of the list being operated on. |
| `operation` | The CRUD operation being performed (`'create'`, `'read'`, `'update'`, `'delete'`). |
| `session` | The current session object. See the [Sessions API](./session) for details. |
| `originalInput` | For `create` and `update` operations, this is the value of `data` passed into the mutation. For `read` and `delete` operations this value is `undefined`. |
| `itemId` | The `id` of the item being updated/deleted in `update` and `delete` operations. `undefined` for other operations. |
| `context` | The [`KeystoneContext`](./context) object of the originating GraphQL operation. |

```typescript
import { config, createSchema, list } from '@keystone-next/keystone/schema';
Expand All @@ -174,9 +168,7 @@ export default config({
operation,
session,
originalInput,
gqlName,
itemId,
itemIds,
context,
}) => {
return true;
Expand Down Expand Up @@ -298,7 +290,6 @@ Imperative access control functions are passed a collection of arguments which c
| `operation` | The CRU operation being performed (`'create'`, `'read'`, `'update'`). |
| `session` | The current session object. See the [Sessions API](./session) for details. |
| `originalInput` | For `create` and `update` operations, this is the value of `data` passed into the mutation. For `read` operations this value is `undefined`. |
| `gqlName` | The name of the query or mutation being called. |
| `context` | The [`KeystoneContext`](./context) object of the originating GraphQL operation. |
| `item` | The item being updated, deleted, or read. This object is an unresolved list item. See the [list item API](./list-items) for more details on unresolved list items. |

Expand All @@ -318,7 +309,6 @@ export default config({
operation,
session,
originalInput,
gqlName,
context,
item,
}) => {
Expand Down
12 changes: 0 additions & 12 deletions docs/pages/apis/context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ context = {
// Database access
prisma,

// Access control helpers
getListAccessControlForUser,
getFieldAccessControlForUser,

// Images API
images: {
getSrc,
Expand All @@ -62,7 +58,6 @@ context = {

// Deprecated
gqlNames,
keystone,
};
```

Expand Down Expand Up @@ -123,11 +118,6 @@ The following functions will create a new `KeystoneContext` object with this beh

The `KeystoneContext` object exposes the underlying database driver directly via `context.prisma`, which is a [Prisma Client](https://www.prisma.io/docs/reference/api-reference/prisma-client-reference) object.

### Access control helpers

The functions `getListAccessControlForUser()` and `getFieldAccessControlForUser()` are used by the internal Keystone resolvers to apply access control.
They should not be called directly.

### Images API

If [support for image fields](./config#images) is enabled in the system, then an `images` API will be made available on the `context` object.
Expand Down Expand Up @@ -171,6 +161,4 @@ They will be removed in future releases.

`gqlNames`: A function which takes a `listKey` and returns an object containing the GraphQL query, mutation and type names related to that list.

`keystone`: An object representing the internal state of the system.

export default ({ children }) => <Markdown>{children}</Markdown>;
20 changes: 9 additions & 11 deletions docs/pages/apis/fields.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -557,29 +557,27 @@ A `virtual` field represents a value which is computed a read time, rather than

Options:

- `resolver` (required):
- `graphQLReturnType` (required):
- `field` (required):
- `graphQLReturnFragment` (default: `undefined` ):
- `extendGraphQLTypes` (default: `[]`):
- `args` (default: `[]`):

```typescript
import { config, createSchema, list } from '@keystone-next/keystone/schema';
import { virtual } from '@keystone-next/fields';
import { schema } from '@keystone-next/types';

export default config({
lists: createSchema({
ListName: list({
fields: {
fieldName: virtual({
resolver: (item, args, context, info) => `/* ... */`,
graphQLReturnType: '...',
field: schema.field({
type: schema.String,
args: { something: schema.arg({ type: schema.Int }) },
resolve(item, args, context, info) {

}
})
graphQLReturnFragment: '...',
extendGraphQLTypes: ['...'],
args: [
{ name: '...', type: 'String' },
/* ... */
],
}),
/* ... */
},
Expand Down
3 changes: 1 addition & 2 deletions docs/pages/apis/schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ Options:

- `description` (default: `undefined`): Sets the description of the associated GraphQL type in the generated GraphQL API documentation.
Overrides the list-level `description` config option.
- `itemQueryName` (default: List key, e.g `'User'`): Overrides the name used in singular mutations and queries (e.g. `User`, `updateUser`, etc).
- `listQueryName`: (default: Pluralised list key, e.g. `'Users'`): Overrides the name used in multiple mutations and queries (e.g. `allUsers`, `updateUsers`, etc).
- `plural`: (default: Pluralised list key, e.g. `'Users'`): Overrides the name used in multiple mutations and queries (e.g. `allUsers`, `updateUsers`, etc).
- `queryLimits` (default: `undefined`): Allows you to limit the number of results returned from a query to this list in the GraphQL API.
See also the global `graphql.queryLimits` option in the [System Configuration API](./config).
- `cacheHint` (default: `undefined`): Allows you to specific the [dynamic cache control hints](https://www.apollographql.com/docs/apollo-server/performance/caching/#in-your-resolvers-dynamic) used for queries to this this list.
Expand Down
Loading