Skip to content

Commit 8e1ab42

Browse files
authored
Merge branch 'payloadcms:main' into feat/pass-collection
2 parents fa94940 + ac1e3cf commit 8e1ab42

142 files changed

Lines changed: 4533 additions & 1444 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
MIT License
2+
3+
Copyright (c) 2020-2025 Cameron Little <cameron@camlittle.com>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
'Software'), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23+
24+
---
25+
26+
Modifications made by Payload CMS, Inc. <info@payloadcms.com>, 2025
27+
Details in README.md

.github/actions/release-commenter/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"description": "GitHub Action to automatically comment on PRs and Issues when a fix is released.",
66
"license": "MIT",
7+
"author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
78
"main": "dist/index.js",
89
"scripts": {
910
"build": "pnpm build:typecheck && pnpm build:ncc",

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ jobs:
308308
- fields__collections__Text
309309
- fields__collections__UI
310310
- fields__collections__Upload
311+
- form-state
311312
- live-preview
312313
- localization
313314
- locked-documents

.github/workflows/pr-title.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
plugin-cloud
5454
plugin-cloud-storage
5555
plugin-form-builder
56+
plugin-import-export
5657
plugin-multi-tenant
5758
plugin-nested-docs
5859
plugin-redirects

docs/admin/metadata.mdx

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ desc: Customize the metadata of your pages within the Admin Panel
66
keywords: admin, components, custom, documentation, Content Management System, cms, headless, javascript, node, react, nextjs
77
---
88

9-
Every page within the Admin Panel automatically receives dynamic, auto-generated metadata derived from live document data, the user's current locale, and more, without any additional configuration. This includes the page title, description, og:image and everything in between. Metadata is fully configurable at the root level and cascades down to individual collections, documents, and custom views, allowing for the ability to control metadata on any page with high precision.
9+
Every page within the Admin Panel automatically receives dynamic, auto-generated metadata derived from live document data, the user's current locale, and more. This includes the page title, description, og:image, etc. and requires no additional configuration.
10+
11+
Metadata is fully configurable at the root level and cascades down to individual collections, documents, and custom views. This allows for the ability to control metadata on any page with high precision, while also providing sensible defaults.
12+
13+
All metadata is injected into Next.js' [`generateMetadata`](https://nextjs.org/docs/app/api-reference/functions/generate-metadata) function. This used to generate the `<head>` of pages within the Admin Panel. All metadata options that are available in Next.js are exposed by Payload.
1014

1115
Within the Admin Panel, metadata can be customized at the following levels:
1216

@@ -48,13 +52,10 @@ The following options are available for Root Metadata:
4852

4953
| Key | Type | Description |
5054
| --- | --- | --- |
51-
| **`title`** | `string` | The title of the Admin Panel. |
52-
| **`description`** | `string` | The description of the Admin Panel. |
53-
| **`defaultOGImageType`** | `dynamic` (default), `static`, or `off` | The type of default OG image to use. If set to `dynamic`, Payload will use Next.js image generation to create an image with the title of the page. If set to `static`, Payload will use the `defaultOGImage` URL. If set to `off`, Payload will not generate an OG image. |
54-
| **`icons`** | `IconConfig[]` | An array of icon objects. [More details](#icons) |
55-
| **`keywords`** | `string` | A comma-separated list of keywords to include in the metadata of the Admin Panel. |
56-
| **`openGraph`** | `OpenGraphConfig` | An object containing Open Graph metadata. [More details](#open-graph) |
57-
| **`titleSuffix`** | `string` | A suffix to append to the end of the title of every page. Defaults to "- Payload". |
55+
| `defaultOGImageType` | `dynamic` (default), `static`, or `off` | The type of default OG image to use. If set to `dynamic`, Payload will use Next.js image generation to create an image with the title of the page. If set to `static`, Payload will use the `defaultOGImage` URL. If set to `off`, Payload will not generate an OG image. |
56+
| `icons` | `IconConfig[]` | An array of icon objects. [More details](#icons). |
57+
| `titleSuffix` | `string` | A suffix to append to the end of the title of every page. Defaults to "- Payload". |
58+
| `[keyof Metadata]` | `unknown` | Any other properties that Next.js supports within the `generateMetadata` function. [More details](https://nextjs.org/docs/app/api-reference/functions/generate-metadata). |
5859

5960
<Banner type="success">
6061
**Reminder:**
@@ -93,17 +94,7 @@ To customize icons, use the `icons` key within the `admin.meta` object in your P
9394
}
9495
```
9596

96-
The following options are available for Icons:
97-
98-
| Key | Type | Description |
99-
| --- | --- | --- |
100-
| **`rel`** | `string` | The HTML `rel` attribute of the icon. |
101-
| **`type`** | `string` | The MIME type of the icon. |
102-
| **`color`** | `string` | The color of the icon. |
103-
| **`fetchPriority`** | `string` | The [fetch priority](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/fetchPriority) of the icon. |
104-
| **`media`** | `string` | The [media query](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_media_queries/Using_media_queries) of the icon. |
105-
| **`sizes`** | `string` | The [sizes](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/sizes) of the icon. |
106-
| **`url`** | `string` | The URL pointing the resource of the icon. |
97+
For a full list of all available Icon options, see the [Next.js documentation](https://nextjs.org/docs/app/api-reference/functions/generate-metadata#icons).
10798

10899
### Open Graph
109100

@@ -135,14 +126,7 @@ To customize Open Graph metadata, use the `openGraph` key within the `admin.meta
135126
}
136127
```
137128

138-
The following options are available for Open Graph Metadata:
139-
140-
| Key | Type | Description |
141-
| --- | --- | --- |
142-
| **`description`** | `string` | The description of the Admin Panel. |
143-
| **`images`** | `OGImageConfig` or `OGImageConfig[]` | An array of image objects. |
144-
| **`siteName`** | `string` | The name of the site. |
145-
| **`title`** | `string` | The title of the Admin Panel. |
129+
For a full list of all available Open Graph options, see the [Next.js documentation](https://nextjs.org/docs/app/api-reference/functions/generate-metadata#opengraph).
146130

147131
## Collection Metadata
148132

docs/configuration/collections.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ The following options are available:
121121
| `useAsTitle` | Specify a top-level field to use for a document title throughout the Admin Panel. If no field is defined, the ID of the document is used as the title. A field with `virtual: true` cannot be used as the title. |
122122
| `description` | Text to display below the Collection label in the List View to give editors more information. Alternatively, you can use the `admin.components.Description` to render a React component. [More details](#custom-components). |
123123
| `defaultColumns` | Array of field names that correspond to which columns to show by default in this Collection's List View. |
124+
| `disableCopyToLocale` | Disables the "Copy to Locale" button while editing documents within this Collection. Only applicable when localization is enabled. |
124125
| `hideAPIURL` | Hides the "API URL" meta field while editing documents within this Collection. |
125126
| `enableRichTextLink` | The [Rich Text](../fields/rich-text) field features a `Link` element which allows for users to automatically reference related documents within their rich text. Set to `true` by default. |
126127
| `enableRichTextRelationship` | The [Rich Text](../fields/rich-text) field features a `Relationship` element which allows for users to automatically reference related documents within their rich text. Set to `true` by default. |

docs/database/migrations.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ default, migrations will be named using a timestamp.
118118
npm run payload migrate:create optional-name-here
119119
```
120120

121+
Flags:
122+
* `--skip-empty`: with Postgres, it skips the "no schema changes detected. Would you like to create a blank migration file?" prompt which can be useful for generating migration in CI.
123+
* `--force-accept-warning`: accepts any command prompts, creates a blank migration even if there weren't any changes to the schema.
124+
121125
### Status
122126

123127
The `migrate:status` command will check the status of migrations and output a table of which migrations have been run,

docs/fields/overview.mdx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,15 @@ export const MyField: Field = {
286286

287287
The following additional properties are provided in the `ctx` object:
288288

289-
| Property | Description |
289+
| Property | Description |
290290
| --- | --- |
291-
| `data` | An object containing the full collection or global document currently being edited. |
292-
| `siblingData` | An object containing document data that is scoped to only fields within the same parent of this field. |
293-
| `operation` | Will be `create` or `update` depending on the UI action or API call. |
294-
| `id` | The `id` of the current document being edited. `id` is `undefined` during the `create` operation. |
295-
| `req` | The current HTTP request object. Contains `payload`, `user`, etc. |
296-
| `event` | Either `onChange` or `submit` depending on the current action. Used as a performance opt-in. [More details](#async-field-validations). |
291+
| `data` | An object containing the full collection or global document currently being edited. |
292+
| `siblingData` | An object containing document data that is scoped to only fields within the same parent of this field. |
293+
| `operation` | Will be `create` or `update` depending on the UI action or API call. |
294+
| `path` | The full path to the field in the schema, represented as an array of string segments, including array indexes. I.e `['group', 'myArray', '1', 'textField']`. |
295+
| `id` | The `id` of the current document being edited. `id` is `undefined` during the `create` operation. |
296+
| `req` | The current HTTP request object. Contains `payload`, `user`, etc. |
297+
| `event` | Either `onChange` or `submit` depending on the current action. Used as a performance opt-in. [More details](#async-field-validations). |
297298

298299
#### Reusing Default Field Validations
299300

@@ -522,11 +523,11 @@ You can show and hide fields based on what other fields are doing by utilizing c
522523

523524
The `ctx` object:
524525

525-
| Property | Description |
526+
| Property | Description |
526527
| --- | --- |
527-
| **`blockData`** | The nearest parent block's data. If the field is not inside a block, this will be `undefined`. |
528-
| **`path`** | The full path to the field in the schema, including array indexes. Useful for dynamic lookups. |
529-
| **`user`** | The currently authenticated user object. |
528+
| **`blockData`** | The nearest parent block's data. If the field is not inside a block, this will be `undefined`. |
529+
| **`path`** | The full path to the field in the schema, represented as an array of string segments, including array indexes. I.e `['group', 'myArray', '1', 'textField']`. |
530+
| **`user`** | The currently authenticated user object. |
530531

531532
The `condition` function should return a boolean that will control if the field should be displayed or not.
532533

packages/db-mongodb/src/updateVersion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const updateVersion: UpdateVersion = async function updateVersion(
6767
return null
6868
}
6969

70-
transform({ adapter: this, data: doc, fields, operation: 'write' })
70+
transform({ adapter: this, data: doc, fields, operation: 'read' })
7171

7272
return doc
7373
}

packages/db-postgres/src/connect.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { DrizzleAdapter } from '@payloadcms/drizzle/types'
2-
import type { Connect, Payload } from 'payload'
2+
import type { Connect, Migration, Payload } from 'payload'
33

44
import { pushDevSchema } from '@payloadcms/drizzle'
55
import { drizzle } from 'drizzle-orm/node-postgres'
@@ -75,15 +75,16 @@ export const connect: Connect = async function connect(
7575
this.payload.logger.info('---- DROPPED TABLES ----')
7676
}
7777
}
78-
} catch (err) {
78+
} catch (error) {
79+
const err = error instanceof Error ? error : new Error(String(error))
7980
if (err.message?.match(/database .* does not exist/i) && !this.disableCreateDatabase) {
8081
// capitalize first char of the err msg
8182
this.payload.logger.info(
8283
`${err.message.charAt(0).toUpperCase() + err.message.slice(1)}, creating...`,
8384
)
8485
const isCreated = await this.createDatabase()
8586

86-
if (isCreated) {
87+
if (isCreated && this.connect) {
8788
await this.connect(options)
8889
return
8990
}
@@ -116,6 +117,6 @@ export const connect: Connect = async function connect(
116117
}
117118

118119
if (process.env.NODE_ENV === 'production' && this.prodMigrations) {
119-
await this.migrate({ migrations: this.prodMigrations })
120+
await this.migrate({ migrations: this.prodMigrations as unknown as Migration[] })
120121
}
121122
}

0 commit comments

Comments
 (0)