Skip to content

Commit

Permalink
Remove deprecated configuration and package exports (#9083)
Browse files Browse the repository at this point in the history
Co-authored-by: mitchellhamilton <mitchell@hamil.town>
Co-authored-by: Daniel Cousens <dcousens@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 4, 2024
1 parent e8fe467 commit d609c6b
Show file tree
Hide file tree
Showing 63 changed files with 201 additions and 394 deletions.
5 changes: 0 additions & 5 deletions .changeset/add-number-id.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/better-relationship-errors.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/boolean-not-false-2.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/boolean-not-false.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/break-list-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': major
---

Removes unused type parameters from types `ListConfig` and `ListAdminUIConfig`
5 changes: 0 additions & 5 deletions .changeset/deprecate-validate-hooks-f.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/deprecate-validate-hooks.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/error-if-wrong-type.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fix-create-express-app.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/fix-list-group-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': major
---

Remove the deprecated type parameters from the `list` and `group` functions
5 changes: 0 additions & 5 deletions .changeset/http-async.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/less-extend-http-param.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': major
---

Removes `graphqlSchema` parameter from `extendHttpServer`, use `context.graphql.schema` instead
5 changes: 0 additions & 5 deletions .changeset/less-extend-http-server.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/less-extend-type.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/less-plimit.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/move-extend-graphql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': major
---

Moves `config.extendGraphqlSchema` to `config.graphql.extendGraphqlSchema`, similar to `db.extendPrismaSchema`
5 changes: 5 additions & 0 deletions .changeset/no-additional-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': major
---

Remove `KeystoneConfig` parameter from getAdditionalFiles function type
5 changes: 5 additions & 0 deletions .changeset/no-exit-sudo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': major
---

Remove the deprecated `context.exitSudo` from `KeystoneContext`
5 changes: 5 additions & 0 deletions .changeset/no-experimental.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': major
---

Remove `context.experimental.initialisedLists`, use `context.__internal.lists` (may break in patch)
5 changes: 5 additions & 0 deletions .changeset/no-extend-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': major
---

Remove `ExtendGraphqlSchema` type alias, use `(schema: GraphQLSchema) => GraphQLSchema` instead (with `import type { GraphQLSchema } from 'graphql'`).
5 changes: 5 additions & 0 deletions .changeset/no-healthcheck.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': major
---

Remove the deprecated (#8721) `config.server.healthCheck`, use `extendExpressApp` instead
5 changes: 5 additions & 0 deletions .changeset/no-list-schema-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': major
---

Removes `ListSchemaConfig` type, use `KeystoneConfig['lists']` instead
5 changes: 5 additions & 0 deletions .changeset/no-prisma-datasource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': major
---

Remove `db.additionalPrismaDatasourceProperties`, use `extendPrismaSchema` if needed
5 changes: 5 additions & 0 deletions .changeset/no-prisma-preview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': major
---

Remove `db.prismaPreviewFeatures`, use `extendPrismaSchema` if needed
5 changes: 5 additions & 0 deletions .changeset/no-session-any.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': major
---

Remove `any` type parameter from `SessionStore`/`SessionStoreFunction` types
5 changes: 0 additions & 5 deletions .changeset/same-field-order.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/text-null-default.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/tests_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ jobs:
run: cd examples/testing; pnpm test

examples_next_app_build:
name: Ensure Nest in App directory builds
name: Ensure Next in App directory builds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
Expand Down
7 changes: 0 additions & 7 deletions docs/pages/blog/embedded-mode-with-sqlite-nextjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ Add the `.keystone` directory to your `.gitignore` file. The contents of `.keyst

To create and edit blog records in Keystone's Admin UI, add a `keystone.ts` [configuration file](/docs/config/config) to your project root with a simple `Post` [list](/docs/config/lists) containing fields for a Title, Slug, and some Content.

{% hint kind="warn" %}
**Note:** We're enabling experimental features to generate the APIs that make embedded mode work. These may change in future versions.
{% /hint %}

```tsx
// keystone.ts

Expand All @@ -125,9 +121,6 @@ const Post: Lists.Post = list({

export default config({
db: { provider: 'sqlite', url: 'file:./app.db' },
experimental: {
generateNextGraphqlAPI: true,
},
lists: { Post },
});
```
Expand Down
34 changes: 1 addition & 33 deletions docs/pages/docs/config/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export default config({
graphql: { /* ... */ },
extendGraphqlSchema: { /* ... */ },
storage: { /* ... */ },
experimental: { /* ... */ },
});
```

Expand All @@ -43,12 +42,10 @@ export default config<TypeInfo>({ /* ... */ });
## lists

The `lists` config option is where you define the data model, or schema, of the Keystone system.
It has a TypeScript type of `ListSchemaConfig`.
This is where you define and configure the `lists` and their `fields` of the data model.
See the [Lists API](./lists) docs for details on how to use this function.

```typescript
import type { ListSchemaConfig } from '@keystone-6/core/types';
import { config } from '@keystone-6/core';
import { TypeInfo } from ".keystone/types";

Expand All @@ -60,12 +57,7 @@ export default config<TypeInfo>({

## db

```
import type { DatabaseConfig } from '@keystone-6/core/types';
```

The `db` config option configures the database used to store data in your Keystone system.
It has a TypeScript type of `DatabaseConfig`.
Keystone supports the database types **PostgreSQL**, **MySQL** and **SQLite**.
These database types are powered by their corresponding Prisma database providers; `postgresql`, `mysql` and `sqlite`.

Expand All @@ -76,8 +68,6 @@ These database types are powered by their corresponding Prisma database provider
- `idField` (default: `{ kind: "cuid" }`): The kind of id field to use, it can be one of: `cuid`, `uuid` or `autoincrement`.
This can also be customised at the list level `db.idField`.
If you are using `autoincrement`, you can also specify `type: 'BigInt'` on PostgreSQL and MySQL to use BigInts.
- `prismaPreviewFeatures` (default: `[]`): Enable [Prisma preview features](https://www.prisma.io/docs/concepts/components/preview-features) by providing an array of strings.
- `additionalPrismaDatasourceProperties` (default: `{}`): Set additional datasource properties like `relationMode = "prisma"` (required for e.g. PlanetScale) by providing an object with key-value pairs.
- `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.

### postgresql
Expand Down Expand Up @@ -142,12 +132,7 @@ The `sqlite` provider is not intended to be used in production systems, and has

## ui

```ts
import type { AdminUIConfig } from '@keystone-6/core/types';
```

The `ui` config option configures the Admin UI which is provided by Keystone.
It has a TypeScript type of `AdminUIConfig`.
This config option is for top level configuration of the Admin UI.
Fine grained configuration of how lists and fields behave in the Admin UI is handled in the `lists` definition (see the [Lists API](./lists) for more details).

Expand Down Expand Up @@ -203,10 +188,6 @@ export default config<TypeInfo>({

## server

```
import type { ServerConfig } from '@keystone-6/core/types';
```

The `dev` and `start` commands from the Keystone [command line](../guides/cli) will start an Express web-server for you.
This server is configured via the `server` configuration option.

Expand Down Expand Up @@ -324,12 +305,7 @@ _Note_: when using `keystone dev`, `extendHttpServer` is only called once on sta

## session

```
import type { SessionStrategy } from '@keystone-6/core/types';
```

The `session` config option allows you to configure session management of your Keystone system.
It has a TypeScript type of `SessionStrategy<any>`.

In general you will use `SessionStrategy` objects from the `@keystone-6/core/session` package, rather than writing this yourself.

Expand All @@ -347,12 +323,7 @@ See the [Session API](./session) for more details on how to configure session ma

## graphql

```ts
import type { GraphQLConfig } from '@keystone-6/core/types';
```

The `graphql` config option allows you to configure certain aspects of your GraphQL API.
It has a TypeScript type of `GraphQLConfig`.

Options:

Expand Down Expand Up @@ -383,6 +354,7 @@ export default config<TypeInfo>({
## extendGraphqlSchema

The `extendGraphqlSchema` config option allows you to extend the GraphQL API which is generated by Keystone based on your schema definition.
It has a TypeScript type of `(schema: import("graphql").GraphQLSchema) => import("graphql").GraphQLSchema`.

`extendGraphqlSchema` expects a function that takes the GraphQL Schema generated by Keystone and returns a valid GraphQL Schema

Expand All @@ -403,10 +375,6 @@ See the [schema extension guide](../guides/schema-extension) for more details an

## storage (images and files)

```ts
import type { StorageConfig } from '@keystone-6/core/types'
```

The `storage` config option provides configuration which is used by the [`file`](../fields/file) field type or the
[`image`](../fields/image) field type. You provide an object whose property is a `StorageConfig` object, fields then reference this `storage` by the key.
Each storage is configured separately using the options below.
Expand Down
6 changes: 4 additions & 2 deletions examples/extend-graphql-schema-graphql-tools/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export default config({
// WARNING: this is only needed for our monorepo examples, dont do this
...fixPrismaPath,
},
graphql: {
extendGraphqlSchema
},
lists,
extendGraphqlSchema,
})
})
4 changes: 3 additions & 1 deletion examples/extend-graphql-schema-graphql-ts/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export default config({
// WARNING: this is only needed for our monorepo examples, dont do this
...fixPrismaPath,
},
graphql: {
extendGraphqlSchema
},
lists,
extendGraphqlSchema,
})
5 changes: 3 additions & 2 deletions examples/extend-graphql-schema-nexus/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ export default config({
// WARNING: this is only needed for our monorepo examples, dont do this
...fixPrismaPath,
},
graphql: {
extendGraphqlSchema
},
lists,
extendGraphqlSchema,

// we use a custom types path for easy integration with nexus
types: {
path: 'keystone-types.ts',
Expand Down
4 changes: 3 additions & 1 deletion examples/extend-graphql-subscriptions/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ export default config({
// WARNING: this is only needed for our monorepo examples, dont do this
...fixPrismaPath,
},
graphql: {
extendGraphqlSchema
},
lists,
server: {
extendHttpServer,
},
extendGraphqlSchema,
})
10 changes: 4 additions & 6 deletions examples/extend-graphql-subscriptions/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { WebSocketServer } from 'ws'
import { PubSub } from 'graphql-subscriptions'
import { parse } from 'graphql'

import { type KeystoneGraphQLAPI } from '@keystone-6/core/types'
import { type Context } from '.keystone/types'

// Setup pubsub as a Global variable in dev so it survives Hot Reloads.
Expand All @@ -17,11 +16,10 @@ declare global {
export const pubSub = global.graphqlSubscriptionPubSub || new PubSub()
globalThis.graphqlSubscriptionPubSub = pubSub

export const extendHttpServer = (
export function extendHttpServer (
httpServer: http.Server,
commonContext: Context,
graphqlSchema: KeystoneGraphQLAPI['schema']
): void => {
) {
// Setup WebSocket server using 'ws'
const wss = new WebSocketServer({
server: httpServer,
Expand All @@ -31,13 +29,13 @@ export const extendHttpServer = (
// Setup the WebSocket to handle GraphQL subscriptions using 'graphql-ws'
wsUseServer(
{
schema: graphqlSchema,
schema: commonContext.graphql.schema,
// run these onSubscribe functions as needed or remove them if you don't need them
onSubscribe: async (ctx: any, msg) => {
const context = await commonContext.withRequest(ctx.extra.request)
// Return the execution args for this subscription passing through the Keystone Context
return {
schema: graphqlSchema,
schema: commonContext.graphql.schema,
operationName: msg.payload.operationName,
document: parse(msg.payload.query),
variableValues: msg.payload.variables,
Expand Down
2 changes: 1 addition & 1 deletion examples/script/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import config from './keystone'
import * as PrismaModule from '.myprisma/client'

// do this instead
// import * as PrismaModule from '@prisma/client';
// import * as PrismaModule from '@prisma/client'

async function main () {
const context = getContext(config, PrismaModule)
Expand Down
Loading

0 comments on commit d609c6b

Please sign in to comment.