You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/docs/config/config.md
+24-20Lines changed: 24 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@ These database types are powered by their corresponding Prisma database provider
64
64
-`url`: The connection URL for your database
65
65
-`onConnect`: which takes a [`KeystoneContext`](../context/overview) object, and lets perform any actions you might need at startup, such as data seeding
66
66
-`enableLogging` (default: `false`): Enable logging from the Prisma client.
67
-
-`idField` (default: `{ kind: "cuid" }`): The kind of id field to use, it can be one of: `cuid`, `uuid` or `autoincrement`.
67
+
-`idField` (default: `{ kind: "cuid" }`): The kind of id field to use, it can be one of: `cuid`, `uuid`, `nanoid`, `ulid`, or `autoincrement`.
68
68
This can also be customised at the list level `db.idField`.
69
69
If you are using `autoincrement`, you can also specify `type: 'BigInt'` on PostgreSQL and MySQL to use BigInts.
70
70
-`shadowDatabaseUrl` (default: `undefined`): Enable [shadow databases](https://www.prisma.io/docs/concepts/components/prisma-migrate/shadow-database#cloud-hosted-shadow-databases-must-be-created-manually) for some cloud providers.
@@ -145,7 +145,7 @@ Advanced configuration:
145
145
146
146
-`publicPages` (default: `[]`): An array of page routes that bypass the `isAccessAllowed` function.
147
147
-`pageMiddleware` (default: `undefined`): An async middleware function that can optionally return a redirect
148
-
-`getAdditionalFiles` (default: `[]`): An async function returns an array of `AdminFileToWrite` objects indicating files to be added to the system at `build` time.
148
+
-`getAdditionalFiles` (default: `undefined`): An async function that returns an array of `AdminFileToWrite` objects indicating files to be added to the system at `build` time.
149
149
If the `mode` is `'write'`, then the code to be written to the file should be provided as the `src` argument.
150
150
If the `mode` is `'copy'` then an `inputPath` value should be provided.
151
151
The `outputPath` indicates where the file should be written or copied to
See the [schema extension guide](../guides/schema-extension) for more details and tooling options on how to extend your GraphQL API.
372
370
371
+
## OpenTelemetry
372
+
373
+
Keystone has built-in support for [OpenTelemetry](https://opentelemetry.io/) tracing via `@opentelemetry/api`. When you configure an OpenTelemetry SDK in your application, Keystone will automatically emit trace spans for its internal operations (such as CRUD resolvers and hooks).
374
+
375
+
No additional Keystone configuration is required — just set up the OpenTelemetry SDK before Keystone starts. See the `logging-opentelemetry` example for a complete setup.
-`access` (**required**): An access control function that determines who can use this action. Receives `{ context, session, listKey, actionKey }`.
107
+
-`resolve` (**required**): The function that performs the action. Receives `{ listKey, actionKey, where }` and `context`. Should return the updated item or `null`.
108
+
-`graphql`: Options for the GraphQL schema output.
109
+
-`singular`: Override the name of the singular mutation (default: `{action}{list.graphql.singular}`, e.g. `votePost`).
110
+
-`plural`: Override the name of the plural mutation (default: `{action}{list.graphql.plural}`, e.g. `votePosts`).
111
+
-`description` (default: `undefined`): Sets the description of the associated GraphQL type in the GraphQL schema output.
112
+
-`ui` (**required**): Controls how the action appears in the Admin UI.
113
+
-`label` (**required**): The label shown on the action button.
114
+
-`icon`: An icon name from `@keystar/ui/icon/all` to display alongside the label.
115
+
-`messages`: Locale messages for prompts and notifications. Supports template tags: `{singular}`, `{plural}`, `{singular|plural}`, `{itemLabel}`, `{count}`, `{countSuccess}`, `{countFail}`.
-`actionMode` (default: `'enabled'`): Can be `'enabled'`, `'disabled'`, or `'hidden'`, or a function that returns one of those values.
122
+
-`navigation` (default: `'follow'`): Controls navigation after the action completes. `'follow'` navigates to the returned item (or list view if `null`), `'refetch'` stays and refreshes the item, `'return'` goes back to the list view.
123
+
-`hidePrompt` (default: `false`): Do not show a confirmation dialog.
124
+
-`hideToast` (default: `false`): Do not show a toast notification.
125
+
-`listView`: Controls for the list view.
126
+
-`actionMode` (default: `'enabled'`): Can be `'enabled'` or `'hidden'`, or a function that returns one of those values.
127
+
64
128
## access
65
129
66
130
The `access` option defines the [Access Control](../guides/auth-and-access-control) rules for the list.
@@ -79,7 +143,6 @@ Options:
79
143
-`searchFields`: The fields used by the Admin UI when searching this list on the list view and in relationship fields. Nominated fields need to support the `contains` filter.
80
144
It is always possible to search by an id and `'id'` should not be specified in this option.
81
145
By default, the `labelField` is used if it has a string `contains` filter, otherwise none.
82
-
-`description` (default: `undefined`): Sets the list description displayed in the Admin UI.
83
146
-`hideNavigation` (default: `false`): Controls whether the list is visible in the navigation elements of the Admin UI.
84
147
Can be either a boolean value or an async function with an argument `{ session, context }` that returns a boolean value.
85
148
-`hideCreate` (default: `false`): Controls whether the `create` button is available in the Admin UI for this list.
@@ -106,6 +169,7 @@ Options:
106
169
Option `field` is the name of the field to sort by, and `direction` is either `'ASC'` or `'DESC'` for ascending and descending sorting respectively.
107
170
If undefined then data will be unsorted.
108
171
-`pageSize` (default: lower of `50` or [`graphql.maxTake`](#graphql)): Sets the number of items to show per page in the list view.
172
+
-`initialFilter` (default: `undefined`): Sets a default filter to apply to the list view. Accepts a where input object (excluding `AND`, `OR`, `NOT`), or an async function with an argument `{ session, context }` that returns a where input object.
109
173
-`label`: The label used to identify the list in navigation etc.
110
174
-`singular`: The singular form of the list key. It is used in sentences like `Are you sure you want to delete this {singular}?`
111
175
-`plural`: The plural form of the list key. It is used in sentences like `Are you sure you want to delete these {plural}?`
@@ -161,12 +225,11 @@ See the [Hooks API](./hooks) for full details on the available hook options.
161
225
162
226
## graphql
163
227
164
-
The `graphql`config option allows you to configure certain aspects of the GraphQL API.
228
+
The `graphql`property allows you to configure certain aspects of the GraphQL API.
165
229
166
230
Options:
167
231
168
-
-`description` (default: `undefined`): Sets the description of the associated GraphQL type in the generated GraphQL API documentation.
169
-
Overrides the list-level `description` config option.
232
+
-`description` (default: `undefined`): Sets the description of the associated GraphQL type in the GraphQL schema output.
170
233
-`singular`: (default: Singular list key, e.g. `'User'`): Overrides the name used in singular mutations and queries (e.g. `user()`, `updateUser()`, etc).
171
234
-`plural`: (default: Pluralised list key, e.g. `'Users'`): Overrides the name used in multiple mutations and queries (e.g. `users()`, `updateUsers()`, etc).
172
235
-`maxTake` (default: `undefined`): Allows you to specify the maximum `take` number for query operations on this list in the GraphQL API.
Copy file name to clipboardExpand all lines: docs/content/docs/context/overview.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@ const context = {
37
37
38
38
// New context creators
39
39
sudo,
40
+
internal,
40
41
withRequest,
41
42
withSession,
42
43
@@ -97,7 +98,9 @@ See the [session API](../config/session#session-context) for more details.
97
98
When using the `context.query`, `context.graphql.run`, and `context.graphql.raw` APIs, access control and session information is passed through to these calls from the `context` object.
98
99
The following functions will create a new `Context` object with this behaviour modified.
99
100
100
-
`sudo()`: A function which returns a new `Context` object with access control limitations removed, bypassing your `access` control configuration.
101
+
`sudo()`: A function which returns a new `Context` object that bypasses your `access` control configuration when using `context.query`, `context.db` or `context.graphql`.
102
+
103
+
`internal()`: A function which returns a new `Context` object that bypasses `graphql.omit` on lists and fields, allowing you to query and mutate data that is otherwise omitted from the GraphQL API.
101
104
102
105
`withRequest(req, res)`: A function which returns a new `Context` object with the `.session` determined by your `sessionStrategy.get` function.
103
106
@@ -107,6 +110,9 @@ The following functions will create a new `Context` object with this behaviour m
107
110
108
111
The `Context` 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.
109
112
113
+
{% hint kind="tip" %}
114
+
**\*Warning** Unlike other data access functions (`context.db`, `context.query` or `context.graphql`), `context.prisma` always bypasses the GraphQL schema and your access control. It is the equivalent of using `.sudo()` always.
115
+
110
116
### Images API
111
117
112
118
If [support for image fields](../config/config#storage-images-and-files) is enabled in the system, then an `images` API will be made available on the `context` object.
Copy file name to clipboardExpand all lines: docs/content/docs/fields/bigint.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Javascript `BigInt`s are used since [integers in Javascript are unsafe beyond 2{
10
10
11
11
Options:
12
12
13
-
-`defaultValue` (default: `undefined`): Can be either a bigint value or `{ kind: 'autoincrement' }`.
13
+
-`defaultValue` (default: `undefined`): Can be either a bigint value, `null`, or `{ kind: 'autoincrement' }`.
14
14
This value will be used for the field when creating items if no explicit value is set.
15
15
`{ kind: 'autoincrement' }` is only supported on PostgreSQL.
16
16
-`db.isNullable` (default: `validation.isRequired ? false : true`): If `false` then this field will be made non-nullable in the database and it will never be possible to set as `null`.
Copy file name to clipboardExpand all lines: docs/content/docs/fields/float.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ A `float` field represents a floating point value.
7
7
8
8
Options:
9
9
10
-
-`defaultValue` (default: `undefined`): Can be a finite float value.
10
+
-`defaultValue` (default: `undefined`): Can be a finite float value, or `null`.
11
11
This value will be used for the field when creating items if no explicit value is set.
12
12
-`db.map`: Adds a [Prisma `@map`](https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#map) attribute to this field which changes the column name in the database
13
13
-`db.isNullable` (default: `validation.isRequired ? false : true`): If `false` then this field will be made non-nullable in the database and it will never be possible to set as `null`.
Copy file name to clipboardExpand all lines: docs/content/docs/fields/integer.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ An `integer` field represents a 32 bit signed integer value.
7
7
8
8
Options:
9
9
10
-
-`defaultValue` (default: `undefined`): Can be either an integer value or `{ kind: 'autoincrement' }`.
10
+
-`defaultValue` (default: `undefined`): Can be either an integer value, `null`, or `{ kind: 'autoincrement' }`.
11
11
This value will be used for the field when creating items if no explicit value is set.
12
12
`{ kind: 'autoincrement' }` is only supported on PostgreSQL.
13
13
-`db.isNullable` (default: `validation.isRequired ? false : true`): If `false` then this field will be made non-nullable in the database and it will never be possible to set as `null`.
0 commit comments