Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions examples/assets-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"dependencies": {
"@keystone-6/core": "^6.5.1",
"@prisma/client": "6.5.0",
"@types/express": "^4.17.14",
"bytes": "^3.1.1",
"express": "^4.19.2"
"express": "^5.0.0"
},
"devDependencies": {
"@types/bytes": "^3.1.1",
"@types/express": "^5.0.0",
"prisma": "6.5.0",
"typescript": "^5.5.0"
}
Expand Down
4 changes: 2 additions & 2 deletions examples/custom-session-passport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"@keystone-6/core": "^6.5.1",
"@prisma/client": "6.5.0",
"dotenv": "^16.0.0",
"express": "^4.19.2",
"express": "^5.0.0",
"passport": "^0.7.0",
"passport-github2": "^0.1.12"
},
"devDependencies": {
"@types/express": "^4.17.14",
"@types/express": "^5.0.0",
"@types/passport": "^1.0.16",
"@types/passport-github2": "^1.2.9",
"@types/passport-oauth2": "^1.4.16",
Expand Down
4 changes: 2 additions & 2 deletions examples/extend-express-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"dependencies": {
"@keystone-6/core": "^6.5.1",
"@prisma/client": "6.5.0",
"@types/express": "^4.17.14",
"express": "^4.19.2"
"express": "^5.0.0"
},
"devDependencies": {
"@types/express": "^5.0.0",
"prisma": "6.5.0",
"tsx": "^4.0.0",
"typescript": "^5.5.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/cloudinary/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@keystone-6/core": "^6.1.0",
"@types/express": "^4.17.14",
"@types/express": "^5.0.0",
"@types/react": "^19.0.0",
"graphql": "^16.8.1",
"graphql-upload": "^15.0.2"
Expand Down
7 changes: 4 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@
"dependencies": {
"@apollo/cache-control-types": "^1.0.3",
"@apollo/client": "^3.12.2",
"@apollo/server": "^4.10.0",
"@apollo/server": "^4.12.1",
"@as-integrations/express5": "^1.1.1",
"@babel/runtime": "^7.24.7",
"@graphql-ts/extend": "^2.0.0",
"@graphql-ts/schema": "^1.0.0",
Expand Down Expand Up @@ -267,7 +268,7 @@
"decimal.js": "^10.4.1",
"dumb-passwords": "^0.2.1",
"esbuild": "^0.25.0",
"express": "^4.19.2",
"express": "^5.0.0",
"fast-deep-equal": "^3.1.3",
"fs-extra": "^11.0.0",
"graphql": "^16.8.1",
Expand All @@ -291,7 +292,7 @@
"@types/body-parser": "^1.19.2",
"@types/bytes": "^3.1.1",
"@types/cors": "^2.8.13",
"@types/express": "^4.17.14",
"@types/express": "^5.0.0",
"@types/fs-extra": "^11.0.0",
"@types/pluralize": "^0.0.33",
"@types/prompts": "^2.0.14",
Expand Down
12 changes: 7 additions & 5 deletions packages/core/src/lib/createExpressServer.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { type Server, createServer } from 'http'
import cors from 'cors'
import { json } from 'body-parser'
import { expressMiddleware } from '@apollo/server/express4'
import cors from 'cors'
import express from 'express'
import { GraphQLError, type GraphQLFormattedError } from 'graphql'
import { type ApolloServerOptions, ApolloServer } from '@apollo/server'
import { type Server, createServer } from 'http'

import { ApolloServer, type ApolloServerOptions } from '@apollo/server'
import { ApolloServerPluginLandingPageDisabled } from '@apollo/server/plugin/disabled'
import { ApolloServerPluginLandingPageLocalDefault } from '@apollo/server/plugin/landingPage/default'
import { expressMiddleware } from '@as-integrations/express5'

// @ts-expect-error
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.js'
import type { KeystoneContext, KeystoneConfig } from '../types'
import type { KeystoneConfig, KeystoneContext } from '../types'

/*
NOTE: This creates the main Keystone express server, including the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { pkgDir } from '../pkg-dir'

const adminErrorHTMLFilepath = path.join(pkgDir, 'static', 'admin-error.html')

export function createAdminUIMiddlewareWithNextApp(
export function createNextAdminUIMiddleware(
config: KeystoneConfig,
commonContext: KeystoneContext,
nextApp: ReturnType<typeof next>
Expand Down Expand Up @@ -41,8 +41,7 @@ export function createAdminUIMiddlewareWithNextApp(
if (shouldRedirect) {
res.header('Cache-Control', 'no-cache, max-age=0')
res.header('Location', shouldRedirect.to)
res.status(302)
res.send()
res.status(302).send()
return
}

Expand All @@ -51,8 +50,7 @@ export function createAdminUIMiddlewareWithNextApp(
handle(req, res)
} catch (e) {
console.error('An error occurred handling a request for the Admin UI:', e)
res.status(500)
res.format({
res.status(500).format({
'text/html': function () {
res.sendFile(adminErrorHTMLFilepath)
},
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/scripts/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { confirmPrompt } from '../lib/prompts'
import { createSystem } from '../lib/createSystem'
import { getEsbuildConfig } from './esbuild'
import { createExpressServer } from '../lib/createExpressServer'
import { createAdminUIMiddlewareWithNextApp } from '../lib/createAdminUIMiddleware'
import { createNextAdminUIMiddleware } from '../lib/nextjs-admin-middleware'
import { runTelemetry } from '../lib/telemetry'
import {
generateArtifacts,
Expand Down Expand Up @@ -277,7 +277,7 @@ export async function dev(
console.log('✨ Preparing Admin UI')
nextApp = next({ dev: true, dir: paths.admin })
await nextApp.prepare()
expressServer.use(createAdminUIMiddlewareWithNextApp(system.config, context, nextApp))
expressServer.use(createNextAdminUIMiddleware(system.config, context, nextApp))
console.log(`✅ Admin UI ready`)
}

Expand Down Expand Up @@ -349,7 +349,7 @@ export async function dev(
const servers = await createExpressServer(newSystem.config, newContext)
if (nextApp) {
servers.expressServer.use(
createAdminUIMiddlewareWithNextApp(newSystem.config, newContext, nextApp)
createNextAdminUIMiddleware(newSystem.config, newContext, nextApp)
)
}
expressServer = servers.expressServer
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/scripts/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import next from 'next'

import { createSystem } from '../lib/createSystem'
import { createExpressServer } from '../lib/createExpressServer'
import { createAdminUIMiddlewareWithNextApp } from '../lib/createAdminUIMiddleware'
import { createNextAdminUIMiddleware } from '../lib/nextjs-admin-middleware'
import { withMigrate } from '../lib/migrations'
import { importBuiltKeystoneConfiguration } from './utils'
import { type Flags } from './cli'
Expand Down Expand Up @@ -43,7 +43,7 @@ export async function start(
const nextApp = next({ dev: false, dir: paths.admin })
await nextApp.prepare()
expressServer.use(
await createAdminUIMiddlewareWithNextApp(system.config, keystone.context, nextApp)
await createNextAdminUIMiddleware(system.config, keystone.context, nextApp)
)
console.log(`✅ Admin UI ready`)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/fields-document/src/structure-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,6 @@ export function isRelationshipData(value: unknown): value is RelationshipData {
export function validateDocumentStructure(value: unknown): asserts value is Node[] {
const result = zDocument.safeParse(value)
if (!result.success) {
throw new Error(`Invalid document structure: ${result.error.message}`)
throw new TypeError(`Invalid document structure: ${result.error.message}`)
}
}
Loading
Loading