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

feat!: make graphql an optional dependency #9280

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 2 additions & 3 deletions packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@
"@payloadcms/ui": "workspace:*",
"busboy": "^1.6.0",
"file-type": "19.3.0",
"graphql-http": "^1.22.0",
"graphql-playground-html": "1.6.30",
"http-status": "1.6.2",
"path-to-regexp": "^6.2.1",
"qs-esm": "7.0.2",
Expand All @@ -114,11 +112,12 @@
"esbuild": "0.23.1",
"esbuild-sass-plugin": "3.3.1",
"eslint-plugin-react-compiler": "19.0.0-beta-a7bf2bd-20241110",
"graphql": "^16.8.1",
"graphql-http": "^1.22.0",
"payload": "workspace:*",
"swc-plugin-transform-remove-imports": "1.15.0"
},
"peerDependencies": {
"graphql": "^16.8.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be left in as a peerDep

"next": "^15.0.0",
"payload": "workspace:*"
},
Expand Down
29 changes: 27 additions & 2 deletions packages/next/src/routes/graphql/handler.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
import type { GraphQLError, GraphQLFormattedError } from 'graphql'
import type { APIError, Payload, PayloadRequest, SanitizedConfig } from 'payload'

import { configToSchema } from '@payloadcms/graphql'
import { createHandler } from 'graphql-http/lib/use/fetch'
import httpStatus from 'http-status'
import { createRequire } from 'module'

import { addDataAndFileToRequest } from '../../utilities/addDataAndFileToRequest.js'
import { addLocalesToRequestFromData } from '../../utilities/addLocalesToRequest.js'
import { createPayloadRequest } from '../../utilities/createPayloadRequest.js'
import { headersWithCors } from '../../utilities/headersWithCors.js'
import { mergeHeaders } from '../../utilities/mergeHeaders.js'

const require = createRequire(import.meta.url)

let createHandler
let configToSchema
const getDynamicImports = () => {
if (createHandler) {
return createHandler
} else {
createHandler = require('graphql-http/lib/use/fetch').createHandler
configToSchema = require('@payloadcms/graphql').configToSchema
return { configToSchema, createHandler }
}
}

const handleError = async ({
err,
payload,
Expand Down Expand Up @@ -78,7 +91,12 @@
if (!cached.promise) {
const resolvedConfig = await config
cached.promise = new Promise((resolve) => {
if (resolvedConfig.graphQL.disable) {
resolve(null)
return
}
const { configToSchema } = getDynamicImports()
const schema = configToSchema(resolvedConfig)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres

Fields › richText › should respect rich text depth parameter

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (fields/int.spec.ts:2796:24)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres

Localization › Localization with fallback true › Localized - GraphQL › should allow user to login and retrieve populated localized field

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:946:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres

Localization › Localization with fallback true › Localized - GraphQL › should allow retrieval of populated localized fields within meUser

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:972:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres

Localization › Localization with fallback true › Localized - GraphQL › should create and update collections

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:999:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres

Localization › Localization with fallback true › Localized - GraphQL › should query multiple locales

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:1071:46)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres

Versions › Collections - Local › Create › should allow creating a draft with missing required field data

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres

Versions › Collections - Local › Create › should allow a new version to be created and updated

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres

Versions › Collections - Local › Create › should paginate versions

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres

Versions › Collections - Local › Create › should allow saving multiple versions of models with unique fields

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres

Versions › Collections - Local › Create › should allow a version to be retrieved by ID

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-uuid

Fields › richText › should respect rich text depth parameter

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (fields/int.spec.ts:2796:24)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-uuid

Localization › Localization with fallback true › Localized - GraphQL › should allow user to login and retrieve populated localized field

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:946:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-uuid

Localization › Localization with fallback true › Localized - GraphQL › should allow retrieval of populated localized fields within meUser

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:972:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-uuid

Localization › Localization with fallback true › Localized - GraphQL › should create and update collections

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:999:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-uuid

Localization › Localization with fallback true › Localized - GraphQL › should query multiple locales

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:1071:46)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-uuid

Versions › Collections - Local › Create › should allow creating a draft with missing required field data

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-uuid

Versions › Collections - Local › Create › should allow a new version to be created and updated

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-uuid

Versions › Collections - Local › Create › should paginate versions

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-uuid

Versions › Collections - Local › Create › should allow saving multiple versions of models with unique fields

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-uuid

Versions › Collections - Local › Create › should allow a version to be retrieved by ID

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-custom-schema

Fields › richText › should respect rich text depth parameter

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (fields/int.spec.ts:2796:24)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-custom-schema

Localization › Localization with fallback true › Localized - GraphQL › should allow user to login and retrieve populated localized field

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:946:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-custom-schema

Localization › Localization with fallback true › Localized - GraphQL › should allow retrieval of populated localized fields within meUser

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:972:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-custom-schema

Localization › Localization with fallback true › Localized - GraphQL › should create and update collections

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:999:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-custom-schema

Localization › Localization with fallback true › Localized - GraphQL › should query multiple locales

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:1071:46)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-custom-schema

Versions › Collections - Local › Create › should allow creating a draft with missing required field data

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-custom-schema

Versions › Collections - Local › Create › should allow a new version to be created and updated

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-custom-schema

Versions › Collections - Local › Create › should paginate versions

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-custom-schema

Versions › Collections - Local › Create › should allow saving multiple versions of models with unique fields

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-postgres-custom-schema

Versions › Collections - Local › Create › should allow a version to be retrieved by ID

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-sqlite

Fields › richText › should respect rich text depth parameter

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (fields/int.spec.ts:2796:24)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-sqlite

Localization › Localization with fallback true › Localized - GraphQL › should allow user to login and retrieve populated localized field

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:946:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-sqlite

Localization › Localization with fallback true › Localized - GraphQL › should allow retrieval of populated localized fields within meUser

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:972:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-sqlite

Localization › Localization with fallback true › Localized - GraphQL › should create and update collections

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:999:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-sqlite

Localization › Localization with fallback true › Localized - GraphQL › should query multiple locales

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:1071:46)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-sqlite

Versions › Collections - Local › Create › should allow creating a draft with missing required field data

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-sqlite

Versions › Collections - Local › Create › should allow a new version to be created and updated

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-sqlite

Versions › Collections - Local › Create › should paginate versions

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-sqlite

Versions › Collections - Local › Create › should allow saving multiple versions of models with unique fields

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-sqlite

Versions › Collections - Local › Create › should allow a version to be retrieved by ID

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-mongodb

Fields › richText › should respect rich text depth parameter

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (fields/int.spec.ts:2796:24)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-mongodb

Localization › Localization with fallback true › Localized - GraphQL › should allow user to login and retrieve populated localized field

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:946:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-mongodb

Localization › Localization with fallback true › Localized - GraphQL › should allow retrieval of populated localized fields within meUser

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:972:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-mongodb

Localization › Localization with fallback true › Localized - GraphQL › should create and update collections

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:999:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-mongodb

Localization › Localization with fallback true › Localized - GraphQL › should query multiple locales

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:1071:46)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-mongodb

Versions › Collections - Local › Create › should allow creating a draft with missing required field data

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-mongodb

Versions › Collections - Local › Create › should allow a new version to be created and updated

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-mongodb

Versions › Collections - Local › Create › should paginate versions

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-mongodb

Versions › Collections - Local › Create › should allow saving multiple versions of models with unique fields

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-mongodb

Versions › Collections - Local › Create › should allow a version to be retrieved by ID

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-supabase

Fields › richText › should respect rich text depth parameter

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (fields/int.spec.ts:2796:24)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-supabase

Localization › Localization with fallback true › Localized - GraphQL › should allow user to login and retrieve populated localized field

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:946:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-supabase

Localization › Localization with fallback true › Localized - GraphQL › should allow retrieval of populated localized fields within meUser

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:972:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-supabase

Localization › Localization with fallback true › Localized - GraphQL › should create and update collections

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:999:26)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-supabase

Localization › Localization with fallback true › Localized - GraphQL › should query multiple locales

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (localization/int.spec.ts:1071:46)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-supabase

Versions › Collections - Local › Create › should allow creating a draft with missing required field data

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-supabase

Versions › Collections - Local › Create › should allow a new version to be created and updated

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-supabase

Versions › Collections - Local › Create › should paginate versions

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-supabase

Versions › Collections - Local › Create › should allow saving multiple versions of models with unique fields

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)

Check failure on line 99 in packages/next/src/routes/graphql/handler.ts

View workflow job for this annotation

GitHub Actions / int-supabase

Versions › Collections - Local › Create › should allow a version to be retrieved by ID

TypeError: configToSchema is not a function at configToSchema (../packages/next/src/routes/graphql/handler.ts:99:22) at getGraphql (../packages/next/src/routes/graphql/handler.ts:93:22) at NextRESTClient._GRAPHQL_POST (../packages/next/src/routes/graphql/handler.ts:132:41) at Object.<anonymous> (versions/int.spec.ts:73:22)
resolve(cached.graphql || schema)
})
}
Expand All @@ -95,6 +113,13 @@

export const POST =
(config: Promise<SanitizedConfig> | SanitizedConfig) => async (request: Request) => {
if ((await config).graphQL.disable) {
return new Response('GraphQL is disabled', {
status: httpStatus.NOT_FOUND,
})
}

const { createHandler } = getDynamicImports()
const originalRequest = request.clone()
const req = await createPayloadRequest({
config,
Expand Down
15 changes: 14 additions & 1 deletion packages/next/src/routes/graphql/playground.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
import type { SanitizedConfig } from 'payload'

import { renderPlaygroundPage } from 'graphql-playground-html'
import { createRequire } from 'module'

import { createPayloadRequest } from '../../utilities/createPayloadRequest.js'

const require = createRequire(import.meta.url)

let renderPlaygroundPage
const getRenderPlaygroundPage = () => {
if (renderPlaygroundPage) {
return renderPlaygroundPage
} else {
renderPlaygroundPage = require('graphql-playground-html').renderPlaygroundPage
return renderPlaygroundPage
}
}
export const GET = (config: Promise<SanitizedConfig>) => async (request: Request) => {
const req = await createPayloadRequest({
config,
request,
})

const renderPlaygroundPage = getRenderPlaygroundPage()

if (
(!req.payload.config.graphQL.disable &&
!req.payload.config.graphQL.disablePlaygroundInProduction &&
Expand Down
4 changes: 1 addition & 3 deletions packages/payload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,11 @@
"copyfiles": "2.4.1",
"cross-env": "7.0.3",
"esbuild": "0.23.1",
"graphql": "^16.8.1",
"graphql-http": "^1.22.0",
"rimraf": "3.0.2",
"sharp": "0.32.6"
},
"peerDependencies": {
"graphql": "^16.8.1"
},
"engines": {
"node": "^18.20.2 || >=20.9.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/payload/src/collections/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,11 @@ export interface SanitizedCollectionConfig
auth: Auth
endpoints: Endpoint[] | false
fields: Field[]
slug: CollectionSlug
/**
* Object of collections to join 'Join Fields object keyed by collection
*/
joins: SanitizedJoins
slug: CollectionSlug
upload: SanitizedUploadConfig
versions: SanitizedCollectionVersions
}
Expand Down
6 changes: 6 additions & 0 deletions packages/payload/src/config/sanitize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ export const sanitizeConfig = async (incomingConfig: Config): Promise<SanitizedC
},
}

if (configWithDefaults.graphQL.disable) {
configWithDefaults.graphQL = { disable: true }
delete configWithDefaults.routes.graphQL
delete configWithDefaults.routes.graphQLPlayground
}

if (!configWithDefaults?.serverURL) {
configWithDefaults.serverURL = ''
}
Expand Down
13 changes: 6 additions & 7 deletions packages/payload/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ExecutionResult, GraphQLSchema, ValidationRule } from 'graphql'
import type { Request as graphQLRequest, OperationArgs } from 'graphql-http'
import type { Logger } from 'pino'
import type { NonNever } from 'ts-essentials'

import { spawn } from 'child_process'
import crypto from 'crypto'
Expand All @@ -25,12 +26,6 @@ import type {
SelectFromCollectionSlug,
TypeWithID,
} from './collections/config/types.js'

import { generateImportMap, type ImportMap } from './bin/generateImportMap/index.js'
export type { FieldState } from './admin/forms/Form.js'
export type * from './admin/types.js'
import type { NonNever } from 'ts-essentials'

import type { Options as CountOptions } from './collections/operations/local/count.js'
import type { Options as CreateOptions } from './collections/operations/local/create.js'
import type {
Expand Down Expand Up @@ -72,6 +67,7 @@ import type { TypeWithVersion } from './versions/types.js'
import { decrypt, encrypt } from './auth/crypto.js'
import { APIKeyAuthentication } from './auth/strategies/apiKey.js'
import { JWTAuthentication } from './auth/strategies/jwt.js'
import { generateImportMap, type ImportMap } from './bin/generateImportMap/index.js'
import { checkPayloadDependencies } from './checkPayloadDependencies.js'
import localOperations from './collections/operations/local/index.js'
import { consoleEmailAdapter } from './email/consoleEmailAdapter.js'
Expand All @@ -82,6 +78,9 @@ import { getLogger } from './utilities/logger.js'
import { serverInit as serverInitTelemetry } from './utilities/telemetry/events/serverInit.js'
import { traverseFields } from './utilities/traverseFields.js'

export type { FieldState } from './admin/forms/Form.js'
export type * from './admin/types.js'

export interface GeneratedTypes {
authUntyped: {
[slug: string]: {
Expand Down Expand Up @@ -459,7 +458,7 @@ export class BasePayload {
return restoreVersion<TSlug>(this, options)
}

schema: GraphQLSchema
schema?: GraphQLSchema

secret: string

Expand Down
43 changes: 9 additions & 34 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading