@payloadcms/next 3.73.0-internal.ff401d9 → 3.74.0-internal.097fb57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -279,7 +279,8 @@ var withPayload = (nextConfig = {}, options = {}) => {
279
279
  "drizzle-kit/api",
280
280
  "sharp",
281
281
  "libsql",
282
- "require-in-the-middle"
282
+ "require-in-the-middle",
283
+ "json-schema-to-typescript"
283
284
  ],
284
285
  plugins: [
285
286
  ...incomingWebpackConfig?.plugins || [],
@@ -336,6 +337,7 @@ var withPayload = (nextConfig = {}, options = {}) => {
336
337
  "sharp",
337
338
  "libsql",
338
339
  "require-in-the-middle",
340
+ "json-schema-to-typescript",
339
341
  // Prevents turbopack build errors by the thread-stream package which is installed by pino
340
342
  "pino"
341
343
  ]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/withPayload/withPayload.js", "../../src/withPayload/withPayload.utils.js", "../../src/withPayload/withPayloadLegacy.js"],
4
- "sourcesContent": ["/**\n * These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are\n * imported directly in next.config.mjs files. Since next.config files run before the build process,\n * TypeScript compilation is not available. This ensures compatibility with all templates and\n * user projects regardless of their TypeScript setup.\n */\nimport {\n getNextjsVersion,\n supportsTurbopackExternalizeTransitiveDependencies,\n} from './withPayload.utils.js'\nimport { withPayloadLegacy } from './withPayloadLegacy.js'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const nextjsVersion = getNextjsVersion()\n\n const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)\n\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n const consoleWarn = console.warn\n const sassWarningText =\n 'SassWarning: Future import deprecation is not yet active, so silencing it is unnecessary'\n console.warn = (...args) => {\n if (\n (typeof args[1] === 'string' && args[1].includes(sassWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(sassWarningText))\n ) {\n // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings\n return\n }\n\n consoleWarn(...args)\n }\n\n /** @type {import('next').NextConfig} */\n const baseConfig = {\n ...nextConfig,\n env,\n sassOptions: {\n ...(nextConfig.sassOptions || {}),\n /**\n * This prevents scss warning spam during pnpm dev that looks like this:\n * ⚠ ./test/admin/components/views/CustomMinimal/index.scss\n * Issue while running loader\n * SassWarning: Deprecation Warning on line 8, column 8 of file:///Users/alessio/Documents/GitHub/ payload/packages/ui/src/scss/styles.scss:8:8:\n * Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.\n *\n * More info and automated migrator: https://sass-lang.com/d/import\n *\n * 8 | @import 'queries';\n *\n *\n * packages/ui/src/scss/styles.scss 9:9 @import\n * test/admin/components/views/CustomMinimal/index.scss 1:9 root stylesheet\n *\n * @todo: update all outdated scss imports to use @use instead of @import. Then, we can remove this.\n */\n silenceDeprecations: [...(nextConfig.sassOptions?.silenceDeprecations || []), 'import'],\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n process.env.NEXT_BASE_PATH = nextConfig.basePath\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n if (!supportsTurbopackBuild) {\n return withPayloadLegacy(baseConfig)\n } else {\n return {\n ...baseConfig,\n serverExternalPackages: [\n ...(baseConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n ],\n }\n }\n}\n\nexport default withPayload\n", " \n/**\n * This was taken and modified from https://github.com/getsentry/sentry-javascript/blob/15256034ee8150a5b7dcb97d23eca1a5486f0cae/packages/nextjs/src/config/util.ts\n *\n * MIT License\n *\n * Copyright (c) 2012 Functional Software, Inc. dba Sentry\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\n * of the Software, and to permit persons to whom the Software is furnished to do\n * so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { readFileSync } from 'fs'\nimport { fileURLToPath } from 'url'\n\n/**\n * @param {string | undefined} input\n * @returns {number}\n */\nfunction _parseInt(input) {\n return parseInt(input || '', 10)\n}\n\n/**\n * Represents Semantic Versioning object\n * @typedef {Object} SemVer\n * @property {string} [buildmetadata]\n * @property {number} [canaryVersion] - undefined if not a canary version\n * @property {number} [major]\n * @property {number} [minor]\n * @property {number} [patch]\n * @property {string} [prerelease]\n */\n\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nconst SEMVER_REGEXP =\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$/i\n\n/**\n * Parses input into a SemVer interface\n * @param {string} input - string representation of a semver version\n * @returns {SemVer}\n */\nexport function parseSemver(input) {\n const match = input.match(SEMVER_REGEXP) || []\n const major = _parseInt(match[1])\n const minor = _parseInt(match[2])\n const patch = _parseInt(match[3])\n\n const prerelease = match[4]\n const canaryVersion = prerelease?.startsWith('canary.')\n ? parseInt(prerelease.split('.')[1] || '0', 10)\n : undefined\n\n return {\n buildmetadata: match[5],\n canaryVersion,\n major: isNaN(major) ? undefined : major,\n minor: isNaN(minor) ? undefined : minor,\n patch: isNaN(patch) ? undefined : patch,\n prerelease: match[4],\n }\n}\n\n/**\n * Returns the version of Next.js installed in the project, or undefined if it cannot be determined.\n * @returns {SemVer | undefined}\n */\nexport function getNextjsVersion() {\n try {\n /** @type {string} */\n let pkgPath\n\n // Check if we're in ESM or CJS environment\n if (typeof import.meta?.resolve === 'function') {\n // ESM environment - use import.meta.resolve\n const pkgUrl = import.meta.resolve('next/package.json')\n // Use fileURLToPath for proper cross-platform path handling (Windows, macOS, Linux)\n // new URL().pathname returns '/C:/path' on Windows which causes path resolution issues\n pkgPath = fileURLToPath(pkgUrl)\n } else {\n // CJS environment - use require.resolve\n pkgPath = require.resolve('next/package.json')\n }\n\n const pkgJson = JSON.parse(readFileSync(pkgPath, 'utf8'))\n return parseSemver(pkgJson.version)\n } catch (e) {\n console.error('Payload: Error getting Next.js version', e)\n return undefined\n }\n}\n\n/**\n * Checks if the current Next.js version supports Turbopack externalize transitive dependencies.\n * This was introduced in Next.js v16.1.0-canary.3\n * @param {SemVer | undefined} version\n * @returns {boolean}\n */\nexport function supportsTurbopackExternalizeTransitiveDependencies(version) {\n if (!version) {\n return false\n }\n\n const { canaryVersion, major, minor, patch } = version\n\n if (major === undefined || minor === undefined) {\n return false\n }\n\n if (major > 16) {\n return true\n }\n\n if (major === 16) {\n if (minor > 1) {\n return true\n }\n if (minor === 1) {\n // 16.1.1+ and canaries support this feature\n if (patch > 0) {\n return true\n }\n if (canaryVersion !== undefined) {\n // 16.1.0-canary.3+\n return canaryVersion >= 3\n } else {\n // Next.js 16.1.0\n return true\n }\n }\n }\n\n return false\n}\n", "/**\n * Applies config options required to support Next.js versions before 16.1.0 and 16.1.0-canary.3.\n * @param {import('next').NextConfig} nextConfig\n * @returns {import('next').NextConfig}\n */\nexport const withPayloadLegacy = (nextConfig = {}) => {\n if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {\n // TODO: This warning is thrown because we cannot externalize the entry-point package for client-s3, so we patch the warning to not show it.\n // We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991\n const turbopackWarningText =\n 'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\\nTry to install it into the project directory by running'\n\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const turbopackConfigWarningText = \"Unrecognized key(s) in object: 'turbopack'\"\n\n const consoleWarn = console.warn\n console.warn = (...args) => {\n // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805\n if (\n (typeof args[1] === 'string' && args[1].includes(turbopackWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackWarningText))\n ) {\n return\n }\n\n // Add Payload-specific message after turbopack config warning in Next.js 15.2.x or lower.\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const hasTurbopackConfigWarning =\n (typeof args[1] === 'string' && args[1].includes(turbopackConfigWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackConfigWarningText))\n\n if (hasTurbopackConfigWarning) {\n consoleWarn(...args)\n consoleWarn(\n 'Payload: You can safely ignore the \"Invalid next.config\" warning above. This only occurs on Next.js 15.2.x or lower. We recommend upgrading to the latest supported Next.js version to resolve this warning.',\n )\n return\n }\n\n consoleWarn(...args)\n }\n }\n\n const isBuild = process.env.NODE_ENV === 'production'\n const isTurbopackNextjs15 = process.env.TURBOPACK === '1'\n const isTurbopackNextjs16 = process.env.TURBOPACK === 'auto'\n\n if (isBuild && (isTurbopackNextjs15 || isTurbopackNextjs16)) {\n throw new Error(\n 'Your Next.js version does not support using Turbopack for production builds. The *minimum* Next.js version required for Turbopack Builds is 16.1.0. Please upgrade to the latest supported Next.js version to resolve this error.',\n )\n }\n\n /** @type {import('next').NextConfig} */\n const toReturn = {\n ...nextConfig,\n serverExternalPackages: [\n // serverExternalPackages = webpack.externals, but with turbopack support and an additional check\n // for whether the package is resolvable from the project root\n ...(nextConfig.serverExternalPackages || []),\n // External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.\n '@sentry/nextjs',\n ],\n }\n\n return toReturn\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;AC2BA,gBAA6B;AAC7B,iBAA8B;AA3B9B;AAiCA,SAASA,UAAUC,OAAK;AACtB,SAAOC,SAASD,SAAS,IAAI,EAAA;AAC/B;AAcA,IAAME,gBACJ;AAOK,SAASC,YAAYH,OAAK;AAC/B,QAAMI,QAAQJ,MAAMI,MAAMF,aAAA,KAAkB,CAAA;AAC5C,QAAMG,QAAQN,UAAUK,MAAM,CAAA,CAAE;AAChC,QAAME,QAAQP,UAAUK,MAAM,CAAA,CAAE;AAChC,QAAMG,QAAQR,UAAUK,MAAM,CAAA,CAAE;AAEhC,QAAMI,aAAaJ,MAAM,CAAA;AACzB,QAAMK,gBAAgBD,YAAYE,WAAW,SAAA,IACzCT,SAASO,WAAWG,MAAM,GAAA,EAAK,CAAA,KAAM,KAAK,EAAA,IAC1CC;AAEJ,SAAO;IACLC,eAAeT,MAAM,CAAA;IACrBK;IACAJ,OAAOS,MAAMT,KAAA,IAASO,SAAYP;IAClCC,OAAOQ,MAAMR,KAAA,IAASM,SAAYN;IAClCC,OAAOO,MAAMP,KAAA,IAASK,SAAYL;IAClCC,YAAYJ,MAAM,CAAA;EACpB;AACF;AAMO,SAASW,mBAAA;AACd,MAAI;AAEF,QAAIC;AA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AAEN,aAAO;QACL,GAAGE;QACHC,WAAW;UAAA,GACLD,uBAAuBC,aAAa,CAAA;;;;;;;;;UASxC;UACA;UACA;UACA;UACA;QAAA;QAEFC,SAAS;UAAA,GACHF,uBAAuBE,WAAW,CAAA;;UAEtC,IAAIH,eAAeF,QAAQM,aAAa;YACtCC,gBAAgB;UAClB,CAAA;QAAA;QAEFC,SAAS;UACP,GAAIL,uBAAuBK,WAAW,CAAC;UACvCC,OAAO;YACL,GAAIN,uBAAuBK,SAASC,SAAS,CAAC;UAChD;UACAC,UAAU;YACR,GAAIP,uBAAuBK,SAASE,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;YAoBjDC,MAAM;UACR;QACF;MACF;IACF;EACF;AAEA,MAAIzC,WAAW0C,UAAU;AACvBf,YAAQrB,IAAIqC,iBAAiB3C,WAAW0C;AACxCzB,eAAWX,IAAIqC,iBAAiB3C,WAAW0C;EAC7C;AAEA,MAAI,CAACtC,wBAAwB;AAC3B,WAAOwC,kBAAkB3B,UAAA;EAC3B,OAAO;AACL,WAAO;MACL,GAAGA;MACHS,wBAAwB;QAAA,GAClBT,WAAWS,0BAA0B,CAAA;QACzC;QACA;QACA;QACA;QACA;;QAEA;MAAA;IAEJ;EACF;AACF;AAEA,IAAA,sBAAe3B;",
4
+ "sourcesContent": ["/**\n * These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are\n * imported directly in next.config.mjs files. Since next.config files run before the build process,\n * TypeScript compilation is not available. This ensures compatibility with all templates and\n * user projects regardless of their TypeScript setup.\n */\nimport {\n getNextjsVersion,\n supportsTurbopackExternalizeTransitiveDependencies,\n} from './withPayload.utils.js'\nimport { withPayloadLegacy } from './withPayloadLegacy.js'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const nextjsVersion = getNextjsVersion()\n\n const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)\n\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n const consoleWarn = console.warn\n const sassWarningText =\n 'SassWarning: Future import deprecation is not yet active, so silencing it is unnecessary'\n console.warn = (...args) => {\n if (\n (typeof args[1] === 'string' && args[1].includes(sassWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(sassWarningText))\n ) {\n // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings\n return\n }\n\n consoleWarn(...args)\n }\n\n /** @type {import('next').NextConfig} */\n const baseConfig = {\n ...nextConfig,\n env,\n sassOptions: {\n ...(nextConfig.sassOptions || {}),\n /**\n * This prevents scss warning spam during pnpm dev that looks like this:\n * ⚠ ./test/admin/components/views/CustomMinimal/index.scss\n * Issue while running loader\n * SassWarning: Deprecation Warning on line 8, column 8 of file:///Users/alessio/Documents/GitHub/ payload/packages/ui/src/scss/styles.scss:8:8:\n * Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.\n *\n * More info and automated migrator: https://sass-lang.com/d/import\n *\n * 8 | @import 'queries';\n *\n *\n * packages/ui/src/scss/styles.scss 9:9 @import\n * test/admin/components/views/CustomMinimal/index.scss 1:9 root stylesheet\n *\n * @todo: update all outdated scss imports to use @use instead of @import. Then, we can remove this.\n */\n silenceDeprecations: [...(nextConfig.sassOptions?.silenceDeprecations || []), 'import'],\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n process.env.NEXT_BASE_PATH = nextConfig.basePath\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n if (!supportsTurbopackBuild) {\n return withPayloadLegacy(baseConfig)\n } else {\n return {\n ...baseConfig,\n serverExternalPackages: [\n ...(baseConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n ],\n }\n }\n}\n\nexport default withPayload\n", " \n/**\n * This was taken and modified from https://github.com/getsentry/sentry-javascript/blob/15256034ee8150a5b7dcb97d23eca1a5486f0cae/packages/nextjs/src/config/util.ts\n *\n * MIT License\n *\n * Copyright (c) 2012 Functional Software, Inc. dba Sentry\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\n * of the Software, and to permit persons to whom the Software is furnished to do\n * so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { readFileSync } from 'fs'\nimport { fileURLToPath } from 'url'\n\n/**\n * @param {string | undefined} input\n * @returns {number}\n */\nfunction _parseInt(input) {\n return parseInt(input || '', 10)\n}\n\n/**\n * Represents Semantic Versioning object\n * @typedef {Object} SemVer\n * @property {string} [buildmetadata]\n * @property {number} [canaryVersion] - undefined if not a canary version\n * @property {number} [major]\n * @property {number} [minor]\n * @property {number} [patch]\n * @property {string} [prerelease]\n */\n\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nconst SEMVER_REGEXP =\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$/i\n\n/**\n * Parses input into a SemVer interface\n * @param {string} input - string representation of a semver version\n * @returns {SemVer}\n */\nexport function parseSemver(input) {\n const match = input.match(SEMVER_REGEXP) || []\n const major = _parseInt(match[1])\n const minor = _parseInt(match[2])\n const patch = _parseInt(match[3])\n\n const prerelease = match[4]\n const canaryVersion = prerelease?.startsWith('canary.')\n ? parseInt(prerelease.split('.')[1] || '0', 10)\n : undefined\n\n return {\n buildmetadata: match[5],\n canaryVersion,\n major: isNaN(major) ? undefined : major,\n minor: isNaN(minor) ? undefined : minor,\n patch: isNaN(patch) ? undefined : patch,\n prerelease: match[4],\n }\n}\n\n/**\n * Returns the version of Next.js installed in the project, or undefined if it cannot be determined.\n * @returns {SemVer | undefined}\n */\nexport function getNextjsVersion() {\n try {\n /** @type {string} */\n let pkgPath\n\n // Check if we're in ESM or CJS environment\n if (typeof import.meta?.resolve === 'function') {\n // ESM environment - use import.meta.resolve\n const pkgUrl = import.meta.resolve('next/package.json')\n // Use fileURLToPath for proper cross-platform path handling (Windows, macOS, Linux)\n // new URL().pathname returns '/C:/path' on Windows which causes path resolution issues\n pkgPath = fileURLToPath(pkgUrl)\n } else {\n // CJS environment - use require.resolve\n pkgPath = require.resolve('next/package.json')\n }\n\n const pkgJson = JSON.parse(readFileSync(pkgPath, 'utf8'))\n return parseSemver(pkgJson.version)\n } catch (e) {\n console.error('Payload: Error getting Next.js version', e)\n return undefined\n }\n}\n\n/**\n * Checks if the current Next.js version supports Turbopack externalize transitive dependencies.\n * This was introduced in Next.js v16.1.0-canary.3\n * @param {SemVer | undefined} version\n * @returns {boolean}\n */\nexport function supportsTurbopackExternalizeTransitiveDependencies(version) {\n if (!version) {\n return false\n }\n\n const { canaryVersion, major, minor, patch } = version\n\n if (major === undefined || minor === undefined) {\n return false\n }\n\n if (major > 16) {\n return true\n }\n\n if (major === 16) {\n if (minor > 1) {\n return true\n }\n if (minor === 1) {\n // 16.1.1+ and canaries support this feature\n if (patch > 0) {\n return true\n }\n if (canaryVersion !== undefined) {\n // 16.1.0-canary.3+\n return canaryVersion >= 3\n } else {\n // Next.js 16.1.0\n return true\n }\n }\n }\n\n return false\n}\n", "/**\n * Applies config options required to support Next.js versions before 16.1.0 and 16.1.0-canary.3.\n * @param {import('next').NextConfig} nextConfig\n * @returns {import('next').NextConfig}\n */\nexport const withPayloadLegacy = (nextConfig = {}) => {\n if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {\n // TODO: This warning is thrown because we cannot externalize the entry-point package for client-s3, so we patch the warning to not show it.\n // We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991\n const turbopackWarningText =\n 'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\\nTry to install it into the project directory by running'\n\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const turbopackConfigWarningText = \"Unrecognized key(s) in object: 'turbopack'\"\n\n const consoleWarn = console.warn\n console.warn = (...args) => {\n // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805\n if (\n (typeof args[1] === 'string' && args[1].includes(turbopackWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackWarningText))\n ) {\n return\n }\n\n // Add Payload-specific message after turbopack config warning in Next.js 15.2.x or lower.\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const hasTurbopackConfigWarning =\n (typeof args[1] === 'string' && args[1].includes(turbopackConfigWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackConfigWarningText))\n\n if (hasTurbopackConfigWarning) {\n consoleWarn(...args)\n consoleWarn(\n 'Payload: You can safely ignore the \"Invalid next.config\" warning above. This only occurs on Next.js 15.2.x or lower. We recommend upgrading to the latest supported Next.js version to resolve this warning.',\n )\n return\n }\n\n consoleWarn(...args)\n }\n }\n\n const isBuild = process.env.NODE_ENV === 'production'\n const isTurbopackNextjs15 = process.env.TURBOPACK === '1'\n const isTurbopackNextjs16 = process.env.TURBOPACK === 'auto'\n\n if (isBuild && (isTurbopackNextjs15 || isTurbopackNextjs16)) {\n throw new Error(\n 'Your Next.js version does not support using Turbopack for production builds. The *minimum* Next.js version required for Turbopack Builds is 16.1.0. Please upgrade to the latest supported Next.js version to resolve this error.',\n )\n }\n\n /** @type {import('next').NextConfig} */\n const toReturn = {\n ...nextConfig,\n serverExternalPackages: [\n // serverExternalPackages = webpack.externals, but with turbopack support and an additional check\n // for whether the package is resolvable from the project root\n ...(nextConfig.serverExternalPackages || []),\n // External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.\n '@sentry/nextjs',\n ],\n }\n\n return toReturn\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;AC2BA,gBAA6B;AAC7B,iBAA8B;AA3B9B;AAiCA,SAASA,UAAUC,OAAK;AACtB,SAAOC,SAASD,SAAS,IAAI,EAAA;AAC/B;AAcA,IAAME,gBACJ;AAOK,SAASC,YAAYH,OAAK;AAC/B,QAAMI,QAAQJ,MAAMI,MAAMF,aAAA,KAAkB,CAAA;AAC5C,QAAMG,QAAQN,UAAUK,MAAM,CAAA,CAAE;AAChC,QAAME,QAAQP,UAAUK,MAAM,CAAA,CAAE;AAChC,QAAMG,QAAQR,UAAUK,MAAM,CAAA,CAAE;AAEhC,QAAMI,aAAaJ,MAAM,CAAA;AACzB,QAAMK,gBAAgBD,YAAYE,WAAW,SAAA,IACzCT,SAASO,WAAWG,MAAM,GAAA,EAAK,CAAA,KAAM,KAAK,EAAA,IAC1CC;AAEJ,SAAO;IACLC,eAAeT,MAAM,CAAA;IACrBK;IACAJ,OAAOS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yBACA,kCACA,4BACA,uBACA,gCACA,4BACA,uBACA,6BACA,8BAAA;UAaF,CAAA;IAAE;IAERC,SAASA,CAACC,eAAeC,mBAAA;AACvB,YAAMC,wBACJ,OAAOjC,WAAW8B,YAAY,aAC1B9B,WAAW8B,QAAQC,eAAeC,cAAA,IAClCD;AAEN,aAAO;QACL,GAAGE;QACHC,WAAW;UAAA,GACLD,uBAAuBC,aAAa,CAAA;;;;;;;;;UASxC;UACA;UACA;UACA;UACA;UACA;QAAA;QAEFC,SAAS;UAAA,GACHF,uBAAuBE,WAAW,CAAA;;UAEtC,IAAIH,eAAeF,QAAQM,aAAa;YACtCC,gBAAgB;UAClB,CAAA;QAAA;QAEFC,SAAS;UACP,GAAIL,uBAAuBK,WAAW,CAAC;UACvCC,OAAO;YACL,GAAIN,uBAAuBK,SAASC,SAAS,CAAC;UAChD;UACAC,UAAU;YACR,GAAIP,uBAAuBK,SAASE,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;YAoBjDC,MAAM;UACR;QACF;MACF;IACF;EACF;AAEA,MAAIzC,WAAW0C,UAAU;AACvBf,YAAQrB,IAAIqC,iBAAiB3C,WAAW0C;AACxCzB,eAAWX,IAAIqC,iBAAiB3C,WAAW0C;EAC7C;AAEA,MAAI,CAACtC,wBAAwB;AAC3B,WAAOwC,kBAAkB3B,UAAA;EAC3B,OAAO;AACL,WAAO;MACL,GAAGA;MACHS,wBAAwB;QAAA,GAClBT,WAAWS,0BAA0B,CAAA;QACzC;QACA;QACA;QACA;QACA;QACA;;QAEA;MAAA;IAEJ;EACF;AACF;AAEA,IAAA,sBAAe3B;",
6
6
  "names": ["_parseInt", "input", "parseInt", "SEMVER_REGEXP", "parseSemver", "match", "major", "minor", "patch", "prerelease", "canaryVersion", "startsWith", "split", "undefined", "buildmetadata", "isNaN", "getNextjsVersion", "pkgPath", "import", "resolve", "pkgUrl", "fileURLToPath", "require", "pkgJson", "JSON", "parse", "readFileSync", "version", "e", "console", "error", "supportsTurbopackExternalizeTransitiveDependencies", "withPayloadLegacy", "nextConfig", "process", "env", "PAYLOAD_PATCH_TURBOPACK_WARNINGS", "turbopackWarningText", "turbopackConfigWarningText", "consoleWarn", "console", "warn", "args", "includes", "hasTurbopackConfigWarning", "isBuild", "NODE_ENV", "isTurbopackNextjs15", "TURBOPACK", "isTurbopackNextjs16", "Error", "toReturn", "serverExternalPackages", "poweredByHeader", "key", "value", "withPayload", "nextConfig", "options", "nextjsVersion", "getNextjsVersion", "supportsTurbopackBuild", "supportsTurbopackExternalizeTransitiveDependencies", "env", "experimental", "staleTimes", "dynamic", "console", "warn", "NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH", "consoleWarn", "sassWarningText", "args", "includes", "baseConfig", "sassOptions", "silenceDeprecations", "outputFileTracingExcludes", "outputFileTracingIncludes", "turbopack", "headers", "headersFromConfig", "source", "serverExternalPackages", "process", "NODE_ENV", "devBundleServerPackages", "webpack", "webpackConfig", "webpackOptions", "incomingWebpackConfig", "externals", "plugins", "IgnorePlugin", "resourceRegExp", "resolve", "alias", "fallback", "aws4", "basePath", "NEXT_BASE_PATH", "withPayloadLegacy"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/List/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAIpB,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EAEvB,gBAAgB,EAGjB,MAAM,SAAS,CAAA;AAehB,OAAO,KAAmB,MAAM,OAAO,CAAA;AASvC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,iBAAiB,CAAC,EACd,gBAAgB,GAChB,KAAK,CAAC,aAAa,CAAC,mBAAmB,GAAG,CAAC,mBAAmB,GAAG,uBAAuB,CAAC,CAAC,CAAA;IAC9F,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACrC,iBAAiB,CAAC,EAAE,OAA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A;IACnB,mBAAmB,EAAE,OAAO,CAAA;IAC5B,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,GAAG,oBAAoB,CAAA;AAExB;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,SACnB,kBAAkB,KACvB,OAAO,CAAC;IACT,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;CACtB,CAiWA,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAYjD,CAAA"}
@@ -56,7 +56,7 @@ export const renderListView = async args => {
56
56
  },
57
57
  visibleEntities
58
58
  } = initPageResult;
59
- if (!permissions?.collections?.[collectionSlug]?.read) {
59
+ if (!collectionConfig || !permissions?.collections?.[collectionSlug]?.read || !visibleEntities.collections.includes(collectionSlug) && !overrideEntityVisibility) {
60
60
  throw new Error('not-found');
61
61
  }
62
62
  const query = queryFromArgs || queryFromReq;
@@ -84,257 +84,251 @@ export const renderListView = async args => {
84
84
  admin: adminRoute
85
85
  }
86
86
  } = config;
87
- if (collectionConfig) {
88
- if (!visibleEntities.collections.includes(collectionSlug) && !overrideEntityVisibility) {
89
- throw new Error('not-found');
90
- }
91
- const baseFilterConstraint = await (collectionConfig.admin?.baseFilter ?? collectionConfig.admin?.baseListFilter)?.({
92
- limit: query.limit,
93
- page: query.page,
94
- req,
95
- sort: query.sort
96
- });
97
- let queryPreset;
98
- let queryPresetPermissions;
99
- let whereWithMergedSearch = mergeListSearchAndWhere({
100
- collectionConfig,
101
- search: typeof query?.search === 'string' ? query.search : undefined,
102
- where: combineWhereConstraints([query?.where, baseFilterConstraint])
103
- });
104
- if (trash === true) {
105
- whereWithMergedSearch = {
106
- and: [whereWithMergedSearch, {
107
- deletedAt: {
108
- exists: true
109
- }
110
- }]
111
- };
112
- }
113
- if (collectionPreferences?.preset) {
114
- try {
115
- queryPreset = await payload.findByID({
116
- id: collectionPreferences?.preset,
117
- collection: 'payload-query-presets',
118
- depth: 0,
119
- overrideAccess: false,
120
- user
121
- });
122
- if (queryPreset) {
123
- queryPresetPermissions = await getDocumentPermissions({
124
- id: queryPreset.id,
125
- collectionConfig: config.collections.find(c => c.slug === 'payload-query-presets'),
126
- data: queryPreset,
127
- req
128
- })?.then(({
129
- docPermissions
130
- }) => docPermissions);
87
+ const baseFilterConstraint = await (collectionConfig.admin?.baseFilter ?? collectionConfig.admin?.baseListFilter)?.({
88
+ limit: query.limit,
89
+ page: query.page,
90
+ req,
91
+ sort: query.sort
92
+ });
93
+ let queryPreset;
94
+ let queryPresetPermissions;
95
+ let whereWithMergedSearch = mergeListSearchAndWhere({
96
+ collectionConfig,
97
+ search: typeof query?.search === 'string' ? query.search : undefined,
98
+ where: combineWhereConstraints([query?.where, baseFilterConstraint])
99
+ });
100
+ if (trash === true) {
101
+ whereWithMergedSearch = {
102
+ and: [whereWithMergedSearch, {
103
+ deletedAt: {
104
+ exists: true
131
105
  }
132
- } catch (err) {
133
- req.payload.logger.error(`Error fetching query preset or preset permissions: ${err}`);
134
- }
135
- }
136
- let Table = null;
137
- let columnState = [];
138
- let data = {
139
- // no results default
140
- docs: [],
141
- hasNextPage: false,
142
- hasPrevPage: false,
143
- limit: query.limit,
144
- nextPage: null,
145
- page: 1,
146
- pagingCounter: 0,
147
- prevPage: null,
148
- totalDocs: 0,
149
- totalPages: 0
106
+ }]
150
107
  };
151
- const clientCollectionConfig = clientConfig.collections.find(c => c.slug === collectionSlug);
152
- const columns = getColumns({
153
- clientConfig,
154
- collectionConfig: clientCollectionConfig,
155
- collectionSlug,
156
- columns: collectionPreferences?.columns,
157
- i18n,
158
- permissions
159
- });
160
- const select = collectionConfig.admin.enableListViewSelectAPI ? transformColumnsToSelect(columns) : undefined;
161
- /** Force select image fields for list view thumbnails */
162
- appendUploadSelectFields({
163
- collectionConfig,
164
- select
165
- });
108
+ }
109
+ if (collectionPreferences?.preset) {
166
110
  try {
167
- if (collectionConfig.admin.groupBy && query.groupBy) {
168
- ({
169
- columnState,
170
- data,
171
- Table
172
- } = await handleGroupBy({
173
- clientCollectionConfig,
174
- clientConfig,
175
- collectionConfig,
176
- collectionSlug,
177
- columns,
178
- customCellProps,
179
- drawerSlug,
180
- enableRowSelections,
181
- fieldPermissions: permissions?.collections?.[collectionSlug]?.fields,
182
- query,
183
- req,
184
- select,
185
- trash,
186
- user,
187
- viewType,
188
- where: whereWithMergedSearch
189
- }));
190
- // Enrich documents with correct display status for drafts
191
- data = await enrichDocsWithVersionStatus({
192
- collectionConfig,
193
- data,
111
+ queryPreset = await payload.findByID({
112
+ id: collectionPreferences?.preset,
113
+ collection: 'payload-query-presets',
114
+ depth: 0,
115
+ overrideAccess: false,
116
+ user
117
+ });
118
+ if (queryPreset) {
119
+ queryPresetPermissions = await getDocumentPermissions({
120
+ id: queryPreset.id,
121
+ collectionConfig: config.collections.find(c => c.slug === 'payload-query-presets'),
122
+ data: queryPreset,
194
123
  req
195
- });
196
- } else {
197
- data = await req.payload.find({
198
- collection: collectionSlug,
199
- depth: 0,
200
- draft: true,
201
- fallbackLocale: false,
202
- includeLockStatus: true,
203
- limit: query?.limit ? Number(query.limit) : undefined,
204
- locale: req.locale,
205
- overrideAccess: false,
206
- page: query?.page ? Number(query.page) : undefined,
207
- req,
208
- select,
209
- sort: query?.sort,
210
- trash,
211
- user,
212
- where: whereWithMergedSearch
213
- });
214
- // Enrich documents with correct display status for drafts
215
- data = await enrichDocsWithVersionStatus({
216
- collectionConfig,
217
- data,
218
- req
219
- });
220
- ({
221
- columnState,
222
- Table
223
- } = renderTable({
224
- clientCollectionConfig,
225
- collectionConfig,
226
- columns,
227
- customCellProps,
228
- data,
229
- drawerSlug,
230
- enableRowSelections,
231
- fieldPermissions: permissions?.collections?.[collectionSlug]?.fields,
232
- i18n: req.i18n,
233
- orderableFieldName: collectionConfig.orderable === true ? '_order' : undefined,
234
- payload: req.payload,
235
- query,
236
- req,
237
- useAsTitle: collectionConfig.admin.useAsTitle,
238
- viewType
239
- }));
124
+ })?.then(({
125
+ docPermissions
126
+ }) => docPermissions);
240
127
  }
241
128
  } catch (err) {
242
- if (err.name !== 'QueryError') {
243
- // QueryErrors are expected when a user filters by a field they do not have access to
244
- req.payload.logger.error({
245
- err,
246
- msg: `There was an error fetching the list view data for collection ${collectionSlug}`
247
- });
248
- throw err;
249
- }
129
+ req.payload.logger.error(`Error fetching query preset or preset permissions: ${err}`);
250
130
  }
251
- const renderedFilters = renderFilters(collectionConfig.fields, req.payload.importMap);
252
- const resolvedFilterOptions = await resolveAllFilterOptions({
253
- fields: collectionConfig.fields,
254
- req
255
- });
256
- const staticDescription = typeof collectionConfig.admin.description === 'function' ? collectionConfig.admin.description({
257
- t: i18n.t
258
- }) : collectionConfig.admin.description;
259
- const newDocumentURL = formatAdminURL({
260
- adminRoute,
261
- path: `/collections/${collectionSlug}/create`
262
- });
263
- const hasCreatePermission = permissions?.collections?.[collectionSlug]?.create;
264
- const hasDeletePermission = permissions?.collections?.[collectionSlug]?.delete;
265
- // Check if there's a notFound query parameter (document ID that wasn't found)
266
- const notFoundDocId = typeof searchParams?.notFound === 'string' ? searchParams.notFound : null;
267
- const serverProps = {
268
- collectionConfig,
269
- data,
270
- i18n,
271
- limit: query.limit,
272
- listPreferences: collectionPreferences,
273
- listSearchableFields: collectionConfig.admin.listSearchableFields,
274
- locale: fullLocale,
275
- params,
276
- payload,
277
- permissions,
278
- searchParams,
279
- user
280
- };
281
- const listViewSlots = renderListViewSlots({
282
- clientProps: {
131
+ }
132
+ let Table = null;
133
+ let columnState = [];
134
+ let data = {
135
+ // no results default
136
+ docs: [],
137
+ hasNextPage: false,
138
+ hasPrevPage: false,
139
+ limit: query.limit,
140
+ nextPage: null,
141
+ page: 1,
142
+ pagingCounter: 0,
143
+ prevPage: null,
144
+ totalDocs: 0,
145
+ totalPages: 0
146
+ };
147
+ const clientCollectionConfig = clientConfig.collections.find(c => c.slug === collectionSlug);
148
+ const columns = getColumns({
149
+ clientConfig,
150
+ collectionConfig: clientCollectionConfig,
151
+ collectionSlug,
152
+ columns: collectionPreferences?.columns,
153
+ i18n,
154
+ permissions
155
+ });
156
+ const select = collectionConfig.admin.enableListViewSelectAPI ? transformColumnsToSelect(columns) : undefined;
157
+ /** Force select image fields for list view thumbnails */
158
+ appendUploadSelectFields({
159
+ collectionConfig,
160
+ select
161
+ });
162
+ try {
163
+ if (collectionConfig.admin.groupBy && query.groupBy) {
164
+ ({
165
+ columnState,
166
+ data,
167
+ Table
168
+ } = await handleGroupBy({
169
+ clientCollectionConfig,
170
+ clientConfig,
171
+ collectionConfig,
283
172
  collectionSlug,
284
- hasCreatePermission,
285
- hasDeletePermission,
286
- newDocumentURL
287
- },
288
- collectionConfig,
289
- description: staticDescription,
290
- notFoundDocId,
291
- payload,
292
- serverProps
293
- });
294
- const isInDrawer = Boolean(drawerSlug);
295
- // Needed to prevent: Only plain objects can be passed to Client Components from Server Components. Objects with toJSON methods are not supported. Convert it manually to a simple value before passing it to props.
296
- // Is there a way to avoid this? The `where` object is already seemingly plain, but is not bc it originates from the params.
297
- query.where = query?.where ? JSON.parse(JSON.stringify(query?.where || {})) : undefined;
298
- return {
299
- List: /*#__PURE__*/_jsxs(Fragment, {
300
- children: [/*#__PURE__*/_jsx(HydrateAuthProvider, {
301
- permissions: permissions
302
- }), /*#__PURE__*/_jsx(ListQueryProvider, {
303
- collectionSlug: collectionSlug,
304
- data: data,
305
- modifySearchParams: !isInDrawer,
306
- orderableFieldName: collectionConfig.orderable === true ? '_order' : undefined,
307
- query: query,
308
- children: RenderServerComponent({
309
- clientProps: {
310
- ...listViewSlots,
311
- collectionSlug,
312
- columnState,
313
- disableBulkDelete,
314
- disableBulkEdit: collectionConfig.disableBulkEdit ?? disableBulkEdit,
315
- disableQueryPresets,
316
- enableRowSelections,
317
- hasCreatePermission,
318
- hasDeletePermission,
319
- listPreferences: collectionPreferences,
320
- newDocumentURL,
321
- queryPreset,
322
- queryPresetPermissions,
323
- renderedFilters,
324
- resolvedFilterOptions,
325
- Table,
326
- viewType
327
- },
328
- Component: ComponentOverride ?? collectionConfig?.admin?.components?.views?.list?.Component,
329
- Fallback: DefaultListView,
330
- importMap: payload.importMap,
331
- serverProps
332
- })
333
- })]
334
- })
335
- };
173
+ columns,
174
+ customCellProps,
175
+ drawerSlug,
176
+ enableRowSelections,
177
+ fieldPermissions: permissions?.collections?.[collectionSlug]?.fields,
178
+ query,
179
+ req,
180
+ select,
181
+ trash,
182
+ user,
183
+ viewType,
184
+ where: whereWithMergedSearch
185
+ }));
186
+ // Enrich documents with correct display status for drafts
187
+ data = await enrichDocsWithVersionStatus({
188
+ collectionConfig,
189
+ data,
190
+ req
191
+ });
192
+ } else {
193
+ data = await req.payload.find({
194
+ collection: collectionSlug,
195
+ depth: 0,
196
+ draft: true,
197
+ fallbackLocale: false,
198
+ includeLockStatus: true,
199
+ limit: query?.limit ? Number(query.limit) : undefined,
200
+ locale: req.locale,
201
+ overrideAccess: false,
202
+ page: query?.page ? Number(query.page) : undefined,
203
+ req,
204
+ select,
205
+ sort: query?.sort,
206
+ trash,
207
+ user,
208
+ where: whereWithMergedSearch
209
+ });
210
+ // Enrich documents with correct display status for drafts
211
+ data = await enrichDocsWithVersionStatus({
212
+ collectionConfig,
213
+ data,
214
+ req
215
+ });
216
+ ({
217
+ columnState,
218
+ Table
219
+ } = renderTable({
220
+ clientCollectionConfig,
221
+ collectionConfig,
222
+ columns,
223
+ customCellProps,
224
+ data,
225
+ drawerSlug,
226
+ enableRowSelections,
227
+ fieldPermissions: permissions?.collections?.[collectionSlug]?.fields,
228
+ i18n: req.i18n,
229
+ orderableFieldName: collectionConfig.orderable === true ? '_order' : undefined,
230
+ payload: req.payload,
231
+ query,
232
+ req,
233
+ useAsTitle: collectionConfig.admin.useAsTitle,
234
+ viewType
235
+ }));
236
+ }
237
+ } catch (err) {
238
+ if (err.name !== 'QueryError') {
239
+ // QueryErrors are expected when a user filters by a field they do not have access to
240
+ req.payload.logger.error({
241
+ err,
242
+ msg: `There was an error fetching the list view data for collection ${collectionSlug}`
243
+ });
244
+ throw err;
245
+ }
336
246
  }
337
- throw new Error('not-found');
247
+ const renderedFilters = renderFilters(collectionConfig.fields, req.payload.importMap);
248
+ const resolvedFilterOptions = await resolveAllFilterOptions({
249
+ fields: collectionConfig.fields,
250
+ req
251
+ });
252
+ const staticDescription = typeof collectionConfig.admin.description === 'function' ? collectionConfig.admin.description({
253
+ t: i18n.t
254
+ }) : collectionConfig.admin.description;
255
+ const newDocumentURL = formatAdminURL({
256
+ adminRoute,
257
+ path: `/collections/${collectionSlug}/create`
258
+ });
259
+ const hasCreatePermission = permissions?.collections?.[collectionSlug]?.create;
260
+ const hasDeletePermission = permissions?.collections?.[collectionSlug]?.delete;
261
+ // Check if there's a notFound query parameter (document ID that wasn't found)
262
+ const notFoundDocId = typeof searchParams?.notFound === 'string' ? searchParams.notFound : null;
263
+ const serverProps = {
264
+ collectionConfig,
265
+ data,
266
+ i18n,
267
+ limit: query.limit,
268
+ listPreferences: collectionPreferences,
269
+ listSearchableFields: collectionConfig.admin.listSearchableFields,
270
+ locale: fullLocale,
271
+ params,
272
+ payload,
273
+ permissions,
274
+ searchParams,
275
+ user
276
+ };
277
+ const listViewSlots = renderListViewSlots({
278
+ clientProps: {
279
+ collectionSlug,
280
+ hasCreatePermission,
281
+ hasDeletePermission,
282
+ newDocumentURL
283
+ },
284
+ collectionConfig,
285
+ description: staticDescription,
286
+ notFoundDocId,
287
+ payload,
288
+ serverProps
289
+ });
290
+ const isInDrawer = Boolean(drawerSlug);
291
+ // Needed to prevent: Only plain objects can be passed to Client Components from Server Components. Objects with toJSON methods are not supported. Convert it manually to a simple value before passing it to props.
292
+ // Is there a way to avoid this? The `where` object is already seemingly plain, but is not bc it originates from the params.
293
+ query.where = query?.where ? JSON.parse(JSON.stringify(query?.where || {})) : undefined;
294
+ return {
295
+ List: /*#__PURE__*/_jsxs(Fragment, {
296
+ children: [/*#__PURE__*/_jsx(HydrateAuthProvider, {
297
+ permissions: permissions
298
+ }), /*#__PURE__*/_jsx(ListQueryProvider, {
299
+ collectionSlug: collectionSlug,
300
+ data: data,
301
+ modifySearchParams: !isInDrawer,
302
+ orderableFieldName: collectionConfig.orderable === true ? '_order' : undefined,
303
+ query: query,
304
+ children: RenderServerComponent({
305
+ clientProps: {
306
+ ...listViewSlots,
307
+ collectionSlug,
308
+ columnState,
309
+ disableBulkDelete,
310
+ disableBulkEdit: collectionConfig.disableBulkEdit ?? disableBulkEdit,
311
+ disableQueryPresets,
312
+ enableRowSelections,
313
+ hasCreatePermission,
314
+ hasDeletePermission,
315
+ listPreferences: collectionPreferences,
316
+ newDocumentURL,
317
+ queryPreset,
318
+ queryPresetPermissions,
319
+ renderedFilters,
320
+ resolvedFilterOptions,
321
+ Table,
322
+ viewType
323
+ },
324
+ Component: ComponentOverride ?? collectionConfig?.admin?.components?.views?.list?.Component,
325
+ Fallback: DefaultListView,
326
+ importMap: payload.importMap,
327
+ serverProps
328
+ })
329
+ })]
330
+ })
331
+ };
338
332
  };
339
333
  export const ListView = async args => {
340
334
  try {
@@ -346,6 +340,7 @@ export const ListView = async args => {
346
340
  });
347
341
  return RenderedList;
348
342
  } catch (error) {
343
+ // Pass through Next.js errors
349
344
  if (error.message === 'not-found') {
350
345
  notFound();
351
346
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["DefaultListView","HydrateAuthProvider","ListQueryProvider","RenderServerComponent","getColumns","renderFilters","renderTable","upsertPreferences","notFound","appendUploadSelectFields","combineWhereConstraints","formatAdminURL","isNumber","mergeListSearchAndWhere","transformColumnsToPreferences","transformColumnsToSearchParams","React","Fragment","getDocumentPermissions","enrichDocsWithVersionStatus","handleGroupBy","renderListViewSlots","resolveAllFilterOptions","transformColumnsToSelect","renderListView","args","clientConfig","ComponentOverride","customCellProps","disableBulkDelete","disableBulkEdit","disableQueryPresets","drawerSlug","enableRowSelections","initPageResult","overrideEntityVisibility","params","query","queryFromArgs","searchParams","trash","viewType","collectionConfig","slug","collectionSlug","locale","fullLocale","permissions","req","i18n","payload","config","queryFromReq","user","visibleEntities","collections","read","Error","columnsFromQuery","columns","queryByGroup","JSON","parse","collectionPreferences","key","value","groupBy","limit","Number","undefined","preset","sort","page","admin","pagination","defaultLimit","defaultSort","routes","adminRoute","includes","baseFilterConstraint","baseFilter","baseListFilter","queryPreset","queryPresetPermissions","whereWithMergedSearch","search","where","and","deletedAt","exists","findByID","id","collection","depth","overrideAccess","find","c","data","then","docPermissions","err","logger","error","Table","columnState","docs","hasNextPage","hasPrevPage","nextPage","pagingCounter","prevPage","totalDocs","totalPages","clientCollectionConfig","select","enableListViewSelectAPI","fieldPermissions","fields","draft","fallbackLocale","includeLockStatus","orderableFieldName","orderable","useAsTitle","name","msg","renderedFilters","importMap","resolvedFilterOptions","staticDescription","description","t","newDocumentURL","path","hasCreatePermission","create","hasDeletePermission","delete","notFoundDocId","serverProps","listPreferences","listSearchableFields","listViewSlots","clientProps","isInDrawer","Boolean","stringify","List","_jsxs","_jsx","modifySearchParams","Component","components","views","list","Fallback","ListView","RenderedList","message","console"],"sources":["../../../src/views/List/index.tsx"],"sourcesContent":["import type {\n AdminViewServerProps,\n CollectionPreferences,\n Column,\n ColumnPreference,\n ListQuery,\n ListViewClientProps,\n ListViewServerPropsOnly,\n PaginatedDocs,\n PayloadComponent,\n QueryPreset,\n SanitizedCollectionPermission,\n} from 'payload'\n\nimport { DefaultListView, HydrateAuthProvider, ListQueryProvider } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { getColumns, renderFilters, renderTable, upsertPreferences } from '@payloadcms/ui/rsc'\nimport { notFound } from 'next/navigation.js'\nimport {\n appendUploadSelectFields,\n combineWhereConstraints,\n formatAdminURL,\n isNumber,\n mergeListSearchAndWhere,\n transformColumnsToPreferences,\n transformColumnsToSearchParams,\n} from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nimport { getDocumentPermissions } from '../Document/getDocumentPermissions.js'\nimport { enrichDocsWithVersionStatus } from './enrichDocsWithVersionStatus.js'\nimport { handleGroupBy } from './handleGroupBy.js'\nimport { renderListViewSlots } from './renderListViewSlots.js'\nimport { resolveAllFilterOptions } from './resolveAllFilterOptions.js'\nimport { transformColumnsToSelect } from './transformColumnsToSelect.js'\n\n/**\n * @internal\n */\nexport type RenderListViewArgs = {\n /**\n * Allows providing your own list view component. This will override the default list view component and\n * the collection's configured list view component (if any).\n */\n ComponentOverride?:\n | PayloadComponent\n | React.ComponentType<ListViewClientProps | (ListViewClientProps & ListViewServerPropsOnly)>\n customCellProps?: Record<string, any>\n disableBulkDelete?: boolean\n disableBulkEdit?: boolean\n disableQueryPresets?: boolean\n drawerSlug?: string\n enableRowSelections: boolean\n overrideEntityVisibility?: boolean\n /**\n * If not ListQuery is provided, `req.query` will be used.\n */\n query?: ListQuery\n redirectAfterDelete?: boolean\n redirectAfterDuplicate?: boolean\n /**\n * @experimental This prop is subject to change in future releases.\n */\n trash?: boolean\n} & AdminViewServerProps\n\n/**\n * This function is responsible for rendering\n * the list view on the server for both:\n * - default list view\n * - list view within drawers\n *\n * @internal\n */\nexport const renderListView = async (\n args: RenderListViewArgs,\n): Promise<{\n List: React.ReactNode\n}> => {\n const {\n clientConfig,\n ComponentOverride,\n customCellProps,\n disableBulkDelete,\n disableBulkEdit,\n disableQueryPresets,\n drawerSlug,\n enableRowSelections,\n initPageResult,\n overrideEntityVisibility,\n params,\n query: queryFromArgs,\n searchParams,\n trash,\n viewType,\n } = args\n\n const {\n collectionConfig,\n collectionConfig: { slug: collectionSlug },\n locale: fullLocale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n query: queryFromReq,\n user,\n },\n visibleEntities,\n } = initPageResult\n\n if (!permissions?.collections?.[collectionSlug]?.read) {\n throw new Error('not-found')\n }\n\n const query: ListQuery = queryFromArgs || queryFromReq\n\n const columnsFromQuery: ColumnPreference[] = transformColumnsToPreferences(query?.columns)\n\n query.queryByGroup =\n query?.queryByGroup && typeof query.queryByGroup === 'string'\n ? JSON.parse(query.queryByGroup)\n : query?.queryByGroup\n\n const collectionPreferences = await upsertPreferences<CollectionPreferences>({\n key: `collection-${collectionSlug}`,\n req,\n value: {\n columns: columnsFromQuery,\n groupBy: query?.groupBy,\n limit: isNumber(query?.limit) ? Number(query.limit) : undefined,\n preset: query?.preset,\n sort: query?.sort as string,\n },\n })\n\n query.preset = collectionPreferences?.preset\n\n query.page = isNumber(query?.page) ? Number(query.page) : 0\n\n query.limit = collectionPreferences?.limit || collectionConfig.admin.pagination.defaultLimit\n\n query.sort =\n collectionPreferences?.sort ||\n (typeof collectionConfig.defaultSort === 'string' ? collectionConfig.defaultSort : undefined)\n\n query.groupBy = collectionPreferences?.groupBy\n\n query.columns = transformColumnsToSearchParams(collectionPreferences?.columns || [])\n\n const {\n routes: { admin: adminRoute },\n } = config\n\n if (collectionConfig) {\n if (!visibleEntities.collections.includes(collectionSlug) && !overrideEntityVisibility) {\n throw new Error('not-found')\n }\n\n const baseFilterConstraint = await (\n collectionConfig.admin?.baseFilter ?? collectionConfig.admin?.baseListFilter\n )?.({\n limit: query.limit,\n page: query.page,\n req,\n sort: query.sort,\n })\n\n let queryPreset: QueryPreset | undefined\n let queryPresetPermissions: SanitizedCollectionPermission | undefined\n\n let whereWithMergedSearch = mergeListSearchAndWhere({\n collectionConfig,\n search: typeof query?.search === 'string' ? query.search : undefined,\n where: combineWhereConstraints([query?.where, baseFilterConstraint]),\n })\n\n if (trash === true) {\n whereWithMergedSearch = {\n and: [\n whereWithMergedSearch,\n {\n deletedAt: {\n exists: true,\n },\n },\n ],\n }\n }\n\n if (collectionPreferences?.preset) {\n try {\n queryPreset = (await payload.findByID({\n id: collectionPreferences?.preset,\n collection: 'payload-query-presets',\n depth: 0,\n overrideAccess: false,\n user,\n })) as QueryPreset\n\n if (queryPreset) {\n queryPresetPermissions = await getDocumentPermissions({\n id: queryPreset.id,\n collectionConfig: config.collections.find((c) => c.slug === 'payload-query-presets'),\n data: queryPreset,\n req,\n })?.then(({ docPermissions }) => docPermissions)\n }\n } catch (err) {\n req.payload.logger.error(`Error fetching query preset or preset permissions: ${err}`)\n }\n }\n\n let Table: React.ReactNode | React.ReactNode[] = null\n let columnState: Column[] = []\n let data: PaginatedDocs = {\n // no results default\n docs: [],\n hasNextPage: false,\n hasPrevPage: false,\n limit: query.limit,\n nextPage: null,\n page: 1,\n pagingCounter: 0,\n prevPage: null,\n totalDocs: 0,\n totalPages: 0,\n }\n\n const clientCollectionConfig = clientConfig.collections.find((c) => c.slug === collectionSlug)\n\n const columns = getColumns({\n clientConfig,\n collectionConfig: clientCollectionConfig,\n collectionSlug,\n columns: collectionPreferences?.columns,\n i18n,\n permissions,\n })\n\n const select = collectionConfig.admin.enableListViewSelectAPI\n ? transformColumnsToSelect(columns)\n : undefined\n\n /** Force select image fields for list view thumbnails */\n appendUploadSelectFields({\n collectionConfig,\n select,\n })\n\n try {\n if (collectionConfig.admin.groupBy && query.groupBy) {\n ;({ columnState, data, Table } = await handleGroupBy({\n clientCollectionConfig,\n clientConfig,\n collectionConfig,\n collectionSlug,\n columns,\n customCellProps,\n drawerSlug,\n enableRowSelections,\n fieldPermissions: permissions?.collections?.[collectionSlug]?.fields,\n query,\n req,\n select,\n trash,\n user,\n viewType,\n where: whereWithMergedSearch,\n }))\n\n // Enrich documents with correct display status for drafts\n data = await enrichDocsWithVersionStatus({\n collectionConfig,\n data,\n req,\n })\n } else {\n data = await req.payload.find({\n collection: collectionSlug,\n depth: 0,\n draft: true,\n fallbackLocale: false,\n includeLockStatus: true,\n limit: query?.limit ? Number(query.limit) : undefined,\n locale: req.locale,\n overrideAccess: false,\n page: query?.page ? Number(query.page) : undefined,\n req,\n select,\n sort: query?.sort,\n trash,\n user,\n where: whereWithMergedSearch,\n })\n\n // Enrich documents with correct display status for drafts\n data = await enrichDocsWithVersionStatus({\n collectionConfig,\n data,\n req,\n })\n ;({ columnState, Table } = renderTable({\n clientCollectionConfig,\n collectionConfig,\n columns,\n customCellProps,\n data,\n drawerSlug,\n enableRowSelections,\n fieldPermissions: permissions?.collections?.[collectionSlug]?.fields,\n i18n: req.i18n,\n orderableFieldName: collectionConfig.orderable === true ? '_order' : undefined,\n payload: req.payload,\n query,\n req,\n useAsTitle: collectionConfig.admin.useAsTitle,\n viewType,\n }))\n }\n } catch (err) {\n if (err.name !== 'QueryError') {\n // QueryErrors are expected when a user filters by a field they do not have access to\n req.payload.logger.error({\n err,\n msg: `There was an error fetching the list view data for collection ${collectionSlug}`,\n })\n throw err\n }\n }\n\n const renderedFilters = renderFilters(collectionConfig.fields, req.payload.importMap)\n\n const resolvedFilterOptions = await resolveAllFilterOptions({\n fields: collectionConfig.fields,\n req,\n })\n\n const staticDescription =\n typeof collectionConfig.admin.description === 'function'\n ? collectionConfig.admin.description({ t: i18n.t })\n : collectionConfig.admin.description\n\n const newDocumentURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/create`,\n })\n\n const hasCreatePermission = permissions?.collections?.[collectionSlug]?.create\n const hasDeletePermission = permissions?.collections?.[collectionSlug]?.delete\n\n // Check if there's a notFound query parameter (document ID that wasn't found)\n const notFoundDocId = typeof searchParams?.notFound === 'string' ? searchParams.notFound : null\n\n const serverProps: ListViewServerPropsOnly = {\n collectionConfig,\n data,\n i18n,\n limit: query.limit,\n listPreferences: collectionPreferences,\n listSearchableFields: collectionConfig.admin.listSearchableFields,\n locale: fullLocale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n }\n\n const listViewSlots = renderListViewSlots({\n clientProps: {\n collectionSlug,\n hasCreatePermission,\n hasDeletePermission,\n newDocumentURL,\n },\n collectionConfig,\n description: staticDescription,\n notFoundDocId,\n payload,\n serverProps,\n })\n\n const isInDrawer = Boolean(drawerSlug)\n\n // Needed to prevent: Only plain objects can be passed to Client Components from Server Components. Objects with toJSON methods are not supported. Convert it manually to a simple value before passing it to props.\n // Is there a way to avoid this? The `where` object is already seemingly plain, but is not bc it originates from the params.\n query.where = query?.where ? JSON.parse(JSON.stringify(query?.where || {})) : undefined\n\n return {\n List: (\n <Fragment>\n <HydrateAuthProvider permissions={permissions} />\n <ListQueryProvider\n collectionSlug={collectionSlug}\n data={data}\n modifySearchParams={!isInDrawer}\n orderableFieldName={collectionConfig.orderable === true ? '_order' : undefined}\n query={query}\n >\n {RenderServerComponent({\n clientProps: {\n ...listViewSlots,\n collectionSlug,\n columnState,\n disableBulkDelete,\n disableBulkEdit: collectionConfig.disableBulkEdit ?? disableBulkEdit,\n disableQueryPresets,\n enableRowSelections,\n hasCreatePermission,\n hasDeletePermission,\n listPreferences: collectionPreferences,\n newDocumentURL,\n queryPreset,\n queryPresetPermissions,\n renderedFilters,\n resolvedFilterOptions,\n Table,\n viewType,\n } satisfies ListViewClientProps,\n Component:\n ComponentOverride ?? collectionConfig?.admin?.components?.views?.list?.Component,\n Fallback: DefaultListView,\n importMap: payload.importMap,\n serverProps,\n })}\n </ListQueryProvider>\n </Fragment>\n ),\n }\n }\n\n throw new Error('not-found')\n}\n\nexport const ListView: React.FC<RenderListViewArgs> = async (args) => {\n try {\n const { List: RenderedList } = await renderListView({ ...args, enableRowSelections: true })\n return RenderedList\n } catch (error) {\n if (error.message === 'not-found') {\n notFound()\n } else {\n console.error(error) // eslint-disable-line no-console\n }\n }\n}\n"],"mappings":";AAcA,SAASA,eAAe,EAAEC,mBAAmB,EAAEC,iBAAiB,QAAQ;AACxE,SAASC,qBAAqB,QAAQ;AACtC,SAASC,UAAU,EAAEC,aAAa,EAAEC,WAAW,EAAEC,iBAAiB,QAAQ;AAC1E,SAASC,QAAQ,QAAQ;AACzB,SACEC,wBAAwB,EACxBC,uBAAuB,EACvBC,cAAc,EACdC,QAAQ,EACRC,uBAAuB,EACvBC,6BAA6B,EAC7BC,8BAA8B,QACzB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AAiB9E,qBAAA;cACjBsE,cAAA;cACAlD,WAAA;cACAC,sBAAA;cACA2C,eAAA;cACAE,qBAAA;cACAzB,KAAA;cACA/D;YACF;YACA+G,SAAA,EACE7H,iBAAA,IAAqBe,gBAAA,EAAkB+B,KAAA,EAAOgF,UAAA,EAAYC,KAAA,EAAOC,IAAA,EAAMH,SAAA;YACzEI,QAAA,EAAU5J,eAAA;YACVgI,SAAA,EAAW9E,OAAA,CAAQ8E,SAAS;YAC5BY;UACF;;;IAIR;EACF;EAEA,MAAM,IAAInF,KAAA,CAAM;AAClB;AAEA,OAAO,MAAMoG,QAAA,GAAyC,MAAOpI,IAAA;EAC3D,IAAI;IACF,MAAM;MAAE2H,IAAA,EAAMU;IAAY,CAAE,GAAG,MAAMtI,cAAA,CAAe;MAAE,GAAGC,IAAI;MAAEQ,mBAAA,EAAqB;IAAK;IACzF,OAAO6H,YAAA;EACT,EAAE,OAAOvD,KAAA,EAAO;IACd,IAAIA,KAAA,CAAMwD,OAAO,KAAK,aAAa;MACjCvJ,QAAA;IACF,OAAO;MACLwJ,OAAA,CAAQzD,KAAK,CAACA,KAAA,GAAO;IACvB;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["DefaultListView","HydrateAuthProvider","ListQueryProvider","RenderServerComponent","getColumns","renderFilters","renderTable","upsertPreferences","notFound","appendUploadSelectFields","combineWhereConstraints","formatAdminURL","isNumber","mergeListSearchAndWhere","transformColumnsToPreferences","transformColumnsToSearchParams","React","Fragment","getDocumentPermissions","enrichDocsWithVersionStatus","handleGroupBy","renderListViewSlots","resolveAllFilterOptions","transformColumnsToSelect","renderListView","args","clientConfig","ComponentOverride","customCellProps","disableBulkDelete","disableBulkEdit","disableQueryPresets","drawerSlug","enableRowSelections","initPageResult","overrideEntityVisibility","params","query","queryFromArgs","searchParams","trash","viewType","collectionConfig","slug","collectionSlug","locale","fullLocale","permissions","req","i18n","payload","config","queryFromReq","user","visibleEntities","collections","read","includes","Error","columnsFromQuery","columns","queryByGroup","JSON","parse","collectionPreferences","key","value","groupBy","limit","Number","undefined","preset","sort","page","admin","pagination","defaultLimit","defaultSort","routes","adminRoute","baseFilterConstraint","baseFilter","baseListFilter","queryPreset","queryPresetPermissions","whereWithMergedSearch","search","where","and","deletedAt","exists","findByID","id","collection","depth","overrideAccess","find","c","data","then","docPermissions","err","logger","error","Table","columnState","docs","hasNextPage","hasPrevPage","nextPage","pagingCounter","prevPage","totalDocs","totalPages","clientCollectionConfig","select","enableListViewSelectAPI","fieldPermissions","fields","draft","fallbackLocale","includeLockStatus","orderableFieldName","orderable","useAsTitle","name","msg","renderedFilters","importMap","resolvedFilterOptions","staticDescription","description","t","newDocumentURL","path","hasCreatePermission","create","hasDeletePermission","delete","notFoundDocId","serverProps","listPreferences","listSearchableFields","listViewSlots","clientProps","isInDrawer","Boolean","stringify","List","_jsxs","_jsx","modifySearchParams","Component","components","views","list","Fallback","ListView","RenderedList","message","console"],"sources":["../../../src/views/List/index.tsx"],"sourcesContent":["import type {\n AdminViewServerProps,\n CollectionPreferences,\n Column,\n ColumnPreference,\n ListQuery,\n ListViewClientProps,\n ListViewServerPropsOnly,\n PaginatedDocs,\n PayloadComponent,\n QueryPreset,\n SanitizedCollectionPermission,\n} from 'payload'\n\nimport { DefaultListView, HydrateAuthProvider, ListQueryProvider } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { getColumns, renderFilters, renderTable, upsertPreferences } from '@payloadcms/ui/rsc'\nimport { notFound } from 'next/navigation.js'\nimport {\n appendUploadSelectFields,\n combineWhereConstraints,\n formatAdminURL,\n isNumber,\n mergeListSearchAndWhere,\n transformColumnsToPreferences,\n transformColumnsToSearchParams,\n} from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nimport { getDocumentPermissions } from '../Document/getDocumentPermissions.js'\nimport { enrichDocsWithVersionStatus } from './enrichDocsWithVersionStatus.js'\nimport { handleGroupBy } from './handleGroupBy.js'\nimport { renderListViewSlots } from './renderListViewSlots.js'\nimport { resolveAllFilterOptions } from './resolveAllFilterOptions.js'\nimport { transformColumnsToSelect } from './transformColumnsToSelect.js'\n\n/**\n * @internal\n */\nexport type RenderListViewArgs = {\n /**\n * Allows providing your own list view component. This will override the default list view component and\n * the collection's configured list view component (if any).\n */\n ComponentOverride?:\n | PayloadComponent\n | React.ComponentType<ListViewClientProps | (ListViewClientProps & ListViewServerPropsOnly)>\n customCellProps?: Record<string, any>\n disableBulkDelete?: boolean\n disableBulkEdit?: boolean\n disableQueryPresets?: boolean\n drawerSlug?: string\n enableRowSelections: boolean\n overrideEntityVisibility?: boolean\n /**\n * If not ListQuery is provided, `req.query` will be used.\n */\n query?: ListQuery\n redirectAfterDelete?: boolean\n redirectAfterDuplicate?: boolean\n /**\n * @experimental This prop is subject to change in future releases.\n */\n trash?: boolean\n} & AdminViewServerProps\n\n/**\n * This function is responsible for rendering\n * the list view on the server for both:\n * - default list view\n * - list view within drawers\n *\n * @internal\n */\nexport const renderListView = async (\n args: RenderListViewArgs,\n): Promise<{\n List: React.ReactNode\n}> => {\n const {\n clientConfig,\n ComponentOverride,\n customCellProps,\n disableBulkDelete,\n disableBulkEdit,\n disableQueryPresets,\n drawerSlug,\n enableRowSelections,\n initPageResult,\n overrideEntityVisibility,\n params,\n query: queryFromArgs,\n searchParams,\n trash,\n viewType,\n } = args\n\n const {\n collectionConfig,\n collectionConfig: { slug: collectionSlug },\n locale: fullLocale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n query: queryFromReq,\n user,\n },\n visibleEntities,\n } = initPageResult\n\n if (\n !collectionConfig ||\n !permissions?.collections?.[collectionSlug]?.read ||\n (!visibleEntities.collections.includes(collectionSlug) && !overrideEntityVisibility)\n ) {\n throw new Error('not-found')\n }\n\n const query: ListQuery = queryFromArgs || queryFromReq\n\n const columnsFromQuery: ColumnPreference[] = transformColumnsToPreferences(query?.columns)\n\n query.queryByGroup =\n query?.queryByGroup && typeof query.queryByGroup === 'string'\n ? JSON.parse(query.queryByGroup)\n : query?.queryByGroup\n\n const collectionPreferences = await upsertPreferences<CollectionPreferences>({\n key: `collection-${collectionSlug}`,\n req,\n value: {\n columns: columnsFromQuery,\n groupBy: query?.groupBy,\n limit: isNumber(query?.limit) ? Number(query.limit) : undefined,\n preset: query?.preset,\n sort: query?.sort as string,\n },\n })\n\n query.preset = collectionPreferences?.preset\n\n query.page = isNumber(query?.page) ? Number(query.page) : 0\n\n query.limit = collectionPreferences?.limit || collectionConfig.admin.pagination.defaultLimit\n\n query.sort =\n collectionPreferences?.sort ||\n (typeof collectionConfig.defaultSort === 'string' ? collectionConfig.defaultSort : undefined)\n\n query.groupBy = collectionPreferences?.groupBy\n\n query.columns = transformColumnsToSearchParams(collectionPreferences?.columns || [])\n\n const {\n routes: { admin: adminRoute },\n } = config\n\n const baseFilterConstraint = await (\n collectionConfig.admin?.baseFilter ?? collectionConfig.admin?.baseListFilter\n )?.({\n limit: query.limit,\n page: query.page,\n req,\n sort: query.sort,\n })\n\n let queryPreset: QueryPreset | undefined\n let queryPresetPermissions: SanitizedCollectionPermission | undefined\n\n let whereWithMergedSearch = mergeListSearchAndWhere({\n collectionConfig,\n search: typeof query?.search === 'string' ? query.search : undefined,\n where: combineWhereConstraints([query?.where, baseFilterConstraint]),\n })\n\n if (trash === true) {\n whereWithMergedSearch = {\n and: [\n whereWithMergedSearch,\n {\n deletedAt: {\n exists: true,\n },\n },\n ],\n }\n }\n\n if (collectionPreferences?.preset) {\n try {\n queryPreset = (await payload.findByID({\n id: collectionPreferences?.preset,\n collection: 'payload-query-presets',\n depth: 0,\n overrideAccess: false,\n user,\n })) as QueryPreset\n\n if (queryPreset) {\n queryPresetPermissions = await getDocumentPermissions({\n id: queryPreset.id,\n collectionConfig: config.collections.find((c) => c.slug === 'payload-query-presets'),\n data: queryPreset,\n req,\n })?.then(({ docPermissions }) => docPermissions)\n }\n } catch (err) {\n req.payload.logger.error(`Error fetching query preset or preset permissions: ${err}`)\n }\n }\n\n let Table: React.ReactNode | React.ReactNode[] = null\n let columnState: Column[] = []\n let data: PaginatedDocs = {\n // no results default\n docs: [],\n hasNextPage: false,\n hasPrevPage: false,\n limit: query.limit,\n nextPage: null,\n page: 1,\n pagingCounter: 0,\n prevPage: null,\n totalDocs: 0,\n totalPages: 0,\n }\n\n const clientCollectionConfig = clientConfig.collections.find((c) => c.slug === collectionSlug)\n\n const columns = getColumns({\n clientConfig,\n collectionConfig: clientCollectionConfig,\n collectionSlug,\n columns: collectionPreferences?.columns,\n i18n,\n permissions,\n })\n\n const select = collectionConfig.admin.enableListViewSelectAPI\n ? transformColumnsToSelect(columns)\n : undefined\n\n /** Force select image fields for list view thumbnails */\n appendUploadSelectFields({\n collectionConfig,\n select,\n })\n\n try {\n if (collectionConfig.admin.groupBy && query.groupBy) {\n ;({ columnState, data, Table } = await handleGroupBy({\n clientCollectionConfig,\n clientConfig,\n collectionConfig,\n collectionSlug,\n columns,\n customCellProps,\n drawerSlug,\n enableRowSelections,\n fieldPermissions: permissions?.collections?.[collectionSlug]?.fields,\n query,\n req,\n select,\n trash,\n user,\n viewType,\n where: whereWithMergedSearch,\n }))\n\n // Enrich documents with correct display status for drafts\n data = await enrichDocsWithVersionStatus({\n collectionConfig,\n data,\n req,\n })\n } else {\n data = await req.payload.find({\n collection: collectionSlug,\n depth: 0,\n draft: true,\n fallbackLocale: false,\n includeLockStatus: true,\n limit: query?.limit ? Number(query.limit) : undefined,\n locale: req.locale,\n overrideAccess: false,\n page: query?.page ? Number(query.page) : undefined,\n req,\n select,\n sort: query?.sort,\n trash,\n user,\n where: whereWithMergedSearch,\n })\n\n // Enrich documents with correct display status for drafts\n data = await enrichDocsWithVersionStatus({\n collectionConfig,\n data,\n req,\n })\n ;({ columnState, Table } = renderTable({\n clientCollectionConfig,\n collectionConfig,\n columns,\n customCellProps,\n data,\n drawerSlug,\n enableRowSelections,\n fieldPermissions: permissions?.collections?.[collectionSlug]?.fields,\n i18n: req.i18n,\n orderableFieldName: collectionConfig.orderable === true ? '_order' : undefined,\n payload: req.payload,\n query,\n req,\n useAsTitle: collectionConfig.admin.useAsTitle,\n viewType,\n }))\n }\n } catch (err) {\n if (err.name !== 'QueryError') {\n // QueryErrors are expected when a user filters by a field they do not have access to\n req.payload.logger.error({\n err,\n msg: `There was an error fetching the list view data for collection ${collectionSlug}`,\n })\n throw err\n }\n }\n\n const renderedFilters = renderFilters(collectionConfig.fields, req.payload.importMap)\n\n const resolvedFilterOptions = await resolveAllFilterOptions({\n fields: collectionConfig.fields,\n req,\n })\n\n const staticDescription =\n typeof collectionConfig.admin.description === 'function'\n ? collectionConfig.admin.description({ t: i18n.t })\n : collectionConfig.admin.description\n\n const newDocumentURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/create`,\n })\n\n const hasCreatePermission = permissions?.collections?.[collectionSlug]?.create\n const hasDeletePermission = permissions?.collections?.[collectionSlug]?.delete\n\n // Check if there's a notFound query parameter (document ID that wasn't found)\n const notFoundDocId = typeof searchParams?.notFound === 'string' ? searchParams.notFound : null\n\n const serverProps: ListViewServerPropsOnly = {\n collectionConfig,\n data,\n i18n,\n limit: query.limit,\n listPreferences: collectionPreferences,\n listSearchableFields: collectionConfig.admin.listSearchableFields,\n locale: fullLocale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n }\n\n const listViewSlots = renderListViewSlots({\n clientProps: {\n collectionSlug,\n hasCreatePermission,\n hasDeletePermission,\n newDocumentURL,\n },\n collectionConfig,\n description: staticDescription,\n notFoundDocId,\n payload,\n serverProps,\n })\n\n const isInDrawer = Boolean(drawerSlug)\n\n // Needed to prevent: Only plain objects can be passed to Client Components from Server Components. Objects with toJSON methods are not supported. Convert it manually to a simple value before passing it to props.\n // Is there a way to avoid this? The `where` object is already seemingly plain, but is not bc it originates from the params.\n query.where = query?.where ? JSON.parse(JSON.stringify(query?.where || {})) : undefined\n\n return {\n List: (\n <Fragment>\n <HydrateAuthProvider permissions={permissions} />\n <ListQueryProvider\n collectionSlug={collectionSlug}\n data={data}\n modifySearchParams={!isInDrawer}\n orderableFieldName={collectionConfig.orderable === true ? '_order' : undefined}\n query={query}\n >\n {RenderServerComponent({\n clientProps: {\n ...listViewSlots,\n collectionSlug,\n columnState,\n disableBulkDelete,\n disableBulkEdit: collectionConfig.disableBulkEdit ?? disableBulkEdit,\n disableQueryPresets,\n enableRowSelections,\n hasCreatePermission,\n hasDeletePermission,\n listPreferences: collectionPreferences,\n newDocumentURL,\n queryPreset,\n queryPresetPermissions,\n renderedFilters,\n resolvedFilterOptions,\n Table,\n viewType,\n } satisfies ListViewClientProps,\n Component:\n ComponentOverride ?? collectionConfig?.admin?.components?.views?.list?.Component,\n Fallback: DefaultListView,\n importMap: payload.importMap,\n serverProps,\n })}\n </ListQueryProvider>\n </Fragment>\n ),\n }\n}\n\nexport const ListView: React.FC<RenderListViewArgs> = async (args) => {\n try {\n const { List: RenderedList } = await renderListView({ ...args, enableRowSelections: true })\n return RenderedList\n } catch (error) {\n // Pass through Next.js errors\n if (error.message === 'not-found') {\n notFound()\n } else {\n console.error(error) // eslint-disable-line no-console\n }\n }\n}\n"],"mappings":";AAcA,SAASA,eAAe,EAAEC,mBAAmB,EAAEC,iBAAiB,QAAQ;AACxE,SAASC,qBAAqB,QAAQ;AACtC,SAASC,UAAU,EAAEC,aAAa,EAAEC,WAAW,EAAEC,iBAAiB,QAAQ;AAC1E,SAASC,QAAQ,QAAQ;AACzB,SACEC,wBAAwB,EACxBC,uBAAuB,EACvBC,cAAc,EACdC,QAAQ,EACRC,uBAAuB,EACvBC,6BAA6B,EAC7BC,8BAA8B,QACzB;AACP,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAEhC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,aAAa,QAAQ;AAC9B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,uBAAuB,QAAQ;AACxC,SAASC,wBAAwB,QAAQ;AAgCzC;;;;;;;;AAQA,OAA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5BY;QACF;;;EAIR;AACF;AAEA,OAAO,MAAMiB,QAAA,GAAyC,MAAOpI,IAAA;EAC3D,IAAI;IACF,MAAM;MAAE2H,IAAA,EAAMU;IAAY,CAAE,GAAG,MAAMtI,cAAA,CAAe;MAAE,GAAGC,IAAI;MAAEQ,mBAAA,EAAqB;IAAK;IACzF,OAAO6H,YAAA;EACT,EAAE,OAAOvD,KAAA,EAAO;IACd;IACA,IAAIA,KAAA,CAAMwD,OAAO,KAAK,aAAa;MACjCvJ,QAAA;IACF,OAAO;MACLwJ,OAAA,CAAQzD,KAAK,CAACA,KAAA,GAAO;IACvB;EACF;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"withPayload.d.ts","sourceRoot":"","sources":["../../src/withPayload/withPayload.js"],"names":[],"mappings":"AAsBO,yCAJI,OAAO,MAAM,EAAE,UAAU,YAEjC;IAA0B,uBAAuB,GAAzC,OAAO;CAA6F,6BAuP9G"}
1
+ {"version":3,"file":"withPayload.d.ts","sourceRoot":"","sources":["../../src/withPayload/withPayload.js"],"names":[],"mappings":"AAsBO,yCAJI,OAAO,MAAM,EAAE,UAAU,YAEjC;IAA0B,uBAAuB,GAAzC,OAAO;CAA6F,6BAyP9G"}
@@ -135,7 +135,7 @@ export const withPayload = (nextConfig = {}, options = {}) => {
135
135
  * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the
136
136
  * entry point packages, as explained in the serverExternalPackages section above.
137
137
  */
138
- 'drizzle-kit', 'drizzle-kit/api', 'sharp', 'libsql', 'require-in-the-middle'],
138
+ 'drizzle-kit', 'drizzle-kit/api', 'sharp', 'libsql', 'require-in-the-middle', 'json-schema-to-typescript'],
139
139
  plugins: [...(incomingWebpackConfig?.plugins || []),
140
140
  // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
141
141
  new webpackOptions.webpack.IgnorePlugin({
@@ -182,7 +182,7 @@ export const withPayload = (nextConfig = {}, options = {}) => {
182
182
  } else {
183
183
  return {
184
184
  ...baseConfig,
185
- serverExternalPackages: [...(baseConfig.serverExternalPackages || []), 'drizzle-kit', 'drizzle-kit/api', 'sharp', 'libsql', 'require-in-the-middle',
185
+ serverExternalPackages: [...(baseConfig.serverExternalPackages || []), 'drizzle-kit', 'drizzle-kit/api', 'sharp', 'libsql', 'require-in-the-middle', 'json-schema-to-typescript',
186
186
  // Prevents turbopack build errors by the thread-stream package which is installed by pino
187
187
  'pino']
188
188
  };
@@ -1 +1 @@
1
- {"version":3,"file":"withPayload.js","names":["getNextjsVersion","supportsTurbopackExternalizeTransitiveDependencies","withPayloadLegacy","poweredByHeader","key","value","withPayload","nextConfig","options","nextjsVersion","supportsTurbopackBuild","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","consoleWarn","sassWarningText","args","includes","baseConfig","sassOptions","silenceDeprecations","outputFileTracingExcludes","outputFileTracingIncludes","turbopack","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","basePath","NEXT_BASE_PATH"],"sources":["../../src/withPayload/withPayload.js"],"sourcesContent":["/**\n * These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are\n * imported directly in next.config.mjs files. Since next.config files run before the build process,\n * TypeScript compilation is not available. This ensures compatibility with all templates and\n * user projects regardless of their TypeScript setup.\n */\nimport {\n getNextjsVersion,\n supportsTurbopackExternalizeTransitiveDependencies,\n} from './withPayload.utils.js'\nimport { withPayloadLegacy } from './withPayloadLegacy.js'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const nextjsVersion = getNextjsVersion()\n\n const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)\n\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n const consoleWarn = console.warn\n const sassWarningText =\n 'SassWarning: Future import deprecation is not yet active, so silencing it is unnecessary'\n console.warn = (...args) => {\n if (\n (typeof args[1] === 'string' && args[1].includes(sassWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(sassWarningText))\n ) {\n // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings\n return\n }\n\n consoleWarn(...args)\n }\n\n /** @type {import('next').NextConfig} */\n const baseConfig = {\n ...nextConfig,\n env,\n sassOptions: {\n ...(nextConfig.sassOptions || {}),\n /**\n * This prevents scss warning spam during pnpm dev that looks like this:\n * ⚠ ./test/admin/components/views/CustomMinimal/index.scss\n * Issue while running loader\n * SassWarning: Deprecation Warning on line 8, column 8 of file:///Users/alessio/Documents/GitHub/ payload/packages/ui/src/scss/styles.scss:8:8:\n * Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.\n *\n * More info and automated migrator: https://sass-lang.com/d/import\n *\n * 8 | @import 'queries';\n *\n *\n * packages/ui/src/scss/styles.scss 9:9 @import\n * test/admin/components/views/CustomMinimal/index.scss 1:9 root stylesheet\n *\n * @todo: update all outdated scss imports to use @use instead of @import. Then, we can remove this.\n */\n silenceDeprecations: [...(nextConfig.sassOptions?.silenceDeprecations || []), 'import'],\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n process.env.NEXT_BASE_PATH = nextConfig.basePath\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n if (!supportsTurbopackBuild) {\n return withPayloadLegacy(baseConfig)\n } else {\n return {\n ...baseConfig,\n serverExternalPackages: [\n ...(baseConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n ],\n }\n }\n}\n\nexport default withPayload\n"],"mappings":"AAAA;;;;;GAMA,SACEA,gBAAgB,EAChBC,kDAAkD,QAC7C;AACP,SAASC,iBAAiB,QAAQ;AAElC,MAAMC,eAAA,GAAkB;EACtBC,GAAA,EAAK;EACLC,KAAA,EAAO;AACT;AAEA;;;;;AAKA,OAAO,MAAMC,WAAA,GAAcA,CAACC,UAAA,GAAa,CAAC,CAAC,EAAEC,OAAA,GAAU,CAAC,CAAC;EACvD,MAAMC,aAAA,GAAgBT,gBAAA;EAEtB,MAAMU,sBAAA,GAAyBT,kDAAA,CAAmDQ,aAAA;EAElF,MAAME,GAAA,GAAMJ,UAAA,CAAWI,GAAG,IAAI,CAAC;EAE/B,IAAIJ,UAAA,CAAWK,YAAY,EAAEC,UAAA,EAAYC,OAAA,EAAS;IAChDC,OAAA,CAAQC,IAAI,CACV;IAEFL,GAAA,CAAIM,uCAAuC,GAAG;EAChD;EAEA,MAAMC,WAAA,GAAcH,OAAA,CAAQC,IAAI;EAChC,MAAMG,eAAA,GACJ;EACFJ,OAAA,CAAQC,IAAI,GAAG,CAAC,GAAGI,IAAA;IACjB,IACE,OAAQA,IAAI,CAAC,EAAE,KAAK,YAAYA,IAAI,CAAC,EAAE,CAACC,QAAQ,CAACF,eAAA,KAChD,OAAOC,IAAI,CAAC,EAAE,KAAK,YAAYA,IAAI,CAAC,EAAE,CAACC,QAAQ,CAACF,eAAA,GACjD;MACA;MACA;IACF;IAEAD,WAAA,IAAeE,IAAA;EACjB;EAEA;EACA,MAAME,UAAA,GAAa;IACjB,GAAGf,UAAU;IACbI,GAAA;IACAY,WAAA,EAAa;MACX,IAAIhB,UAAA,CAAWgB,WAAW,IAAI,CAAC,CAAC;MAChC;;;;;;;;;;;;;;;;;MAiBAC,mBAAA,EAAqB,C,IAAKjB,UAAA,CAAWgB,WAAW,EAAEC,mBAAA,IAAuB,EAAE,GAAG;IAChF;IACAC,yBAAA,E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{"version":3,"file":"withPayload.js","names":["getNextjsVersion","supportsTurbopackExternalizeTransitiveDependencies","withPayloadLegacy","poweredByHeader","key","value","withPayload","nextConfig","options","nextjsVersion","supportsTurbopackBuild","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","consoleWarn","sassWarningText","args","includes","baseConfig","sassOptions","silenceDeprecations","outputFileTracingExcludes","outputFileTracingIncludes","turbopack","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","basePath","NEXT_BASE_PATH"],"sources":["../../src/withPayload/withPayload.js"],"sourcesContent":["/**\n * These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are\n * imported directly in next.config.mjs files. Since next.config files run before the build process,\n * TypeScript compilation is not available. This ensures compatibility with all templates and\n * user projects regardless of their TypeScript setup.\n */\nimport {\n getNextjsVersion,\n supportsTurbopackExternalizeTransitiveDependencies,\n} from './withPayload.utils.js'\nimport { withPayloadLegacy } from './withPayloadLegacy.js'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const nextjsVersion = getNextjsVersion()\n\n const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)\n\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n const consoleWarn = console.warn\n const sassWarningText =\n 'SassWarning: Future import deprecation is not yet active, so silencing it is unnecessary'\n console.warn = (...args) => {\n if (\n (typeof args[1] === 'string' && args[1].includes(sassWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(sassWarningText))\n ) {\n // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings\n return\n }\n\n consoleWarn(...args)\n }\n\n /** @type {import('next').NextConfig} */\n const baseConfig = {\n ...nextConfig,\n env,\n sassOptions: {\n ...(nextConfig.sassOptions || {}),\n /**\n * This prevents scss warning spam during pnpm dev that looks like this:\n * ⚠ ./test/admin/components/views/CustomMinimal/index.scss\n * Issue while running loader\n * SassWarning: Deprecation Warning on line 8, column 8 of file:///Users/alessio/Documents/GitHub/ payload/packages/ui/src/scss/styles.scss:8:8:\n * Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.\n *\n * More info and automated migrator: https://sass-lang.com/d/import\n *\n * 8 | @import 'queries';\n *\n *\n * packages/ui/src/scss/styles.scss 9:9 @import\n * test/admin/components/views/CustomMinimal/index.scss 1:9 root stylesheet\n *\n * @todo: update all outdated scss imports to use @use instead of @import. Then, we can remove this.\n */\n silenceDeprecations: [...(nextConfig.sassOptions?.silenceDeprecations || []), 'import'],\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n process.env.NEXT_BASE_PATH = nextConfig.basePath\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n if (!supportsTurbopackBuild) {\n return withPayloadLegacy(baseConfig)\n } else {\n return {\n ...baseConfig,\n serverExternalPackages: [\n ...(baseConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n ],\n }\n }\n}\n\nexport default withPayload\n"],"mappings":"AAAA;;;;;GAMA,SACEA,gBAAgB,EAChBC,kDAAkD,QAC7C;AACP,SAASC,iBAAiB,QAAQ;AAElC,MAAMC,eAAA,GAAkB;EACtBC,GAAA,EAAK;EACLC,KAAA,EAAO;AACT;AAEA;;;;;AAKA,OAAO,MAAMC,WAAA,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a,EAAE;QAC1C;;;;;;;;QAQA,eACA,mBACA,SACA,UACA,yBACA,4BACD;QACDC,OAAA,EAAS,C,IACHF,qBAAA,EAAuBE,OAAA,IAAW,EAAE;QACxC;QACA,IAAIH,cAAA,CAAeF,OAAO,CAACM,YAAY,CAAC;UACtCC,cAAA,EAAgB;QAClB,GACD;QACDC,OAAA,EAAS;UACP,IAAIL,qBAAA,EAAuBK,OAAA,IAAW,CAAC,CAAC;UACxCC,KAAA,EAAO;YACL,IAAIN,qBAAA,EAAuBK,OAAA,EAASC,KAAA,IAAS,CAAC,CAAC;UACjD;UACAC,QAAA,EAAU;YACR,IAAIP,qBAAA,EAAuBK,OAAA,EAASE,QAAA,IAAY,CAAC,CAAC;YAClD;;;;;;;;;;;;;;;;;;;YAmBAC,IAAA,EAAM;UACR;QACF;MACF;IACF;EACF;EAEA,IAAIvC,UAAA,CAAWwC,QAAQ,EAAE;IACvBf,OAAA,CAAQrB,GAAG,CAACqC,cAAc,GAAGzC,UAAA,CAAWwC,QAAQ;IAChDzB,UAAA,CAAWX,GAAG,CAACqC,cAAc,GAAGzC,UAAA,CAAWwC,QAAQ;EACrD;EAEA,IAAI,CAACrC,sBAAA,EAAwB;IAC3B,OAAOR,iBAAA,CAAkBoB,UAAA;EAC3B,OAAO;IACL,OAAO;MACL,GAAGA,UAAU;MACbS,sBAAA,EAAwB,C,IAClBT,UAAA,CAAWS,sBAAsB,IAAI,EAAE,GAC3C,eACA,mBACA,SACA,UACA,yBACA;MACA;MACA;IAEJ;EACF;AACF;AAEA,eAAezB,WAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/next",
3
- "version": "3.73.0-internal.ff401d9",
3
+ "version": "3.74.0-internal.097fb57",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -99,9 +99,9 @@
99
99
  "qs-esm": "7.0.2",
100
100
  "sass": "1.77.4",
101
101
  "uuid": "10.0.0",
102
- "@payloadcms/graphql": "3.73.0-internal.ff401d9",
103
- "@payloadcms/translations": "3.73.0-internal.ff401d9",
104
- "@payloadcms/ui": "3.73.0-internal.ff401d9"
102
+ "@payloadcms/graphql": "3.74.0-internal.097fb57",
103
+ "@payloadcms/ui": "3.74.0-internal.097fb57",
104
+ "@payloadcms/translations": "3.74.0-internal.097fb57"
105
105
  },
106
106
  "devDependencies": {
107
107
  "@babel/cli": "7.27.2",
@@ -118,13 +118,13 @@
118
118
  "esbuild": "0.27.1",
119
119
  "esbuild-sass-plugin": "3.3.1",
120
120
  "swc-plugin-transform-remove-imports": "8.3.0",
121
- "payload": "3.73.0-internal.ff401d9",
122
- "@payloadcms/eslint-config": "3.28.0"
121
+ "@payloadcms/eslint-config": "3.28.0",
122
+ "payload": "3.74.0-internal.097fb57"
123
123
  },
124
124
  "peerDependencies": {
125
125
  "graphql": "^16.8.1",
126
126
  "next": "^15.4.10 || >=16.1.1-canary.35 <16.2.0 || ^16.2.0",
127
- "payload": "3.73.0-internal.ff401d9"
127
+ "payload": "3.74.0-internal.097fb57"
128
128
  },
129
129
  "engines": {
130
130
  "node": "^18.20.2 || >=20.9.0"