Skip to content

Commit 10032b5

Browse files
Merge branch 'beta' into replace-jsonwebtoken-with-jose
2 parents 1e1f1f6 + 6d1a287 commit 10032b5

File tree

79 files changed

+1155
-652
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1155
-652
lines changed

docs/hooks/fields.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ user-friendly.
200200
The `beforeDuplicate` field hook is called on each locale (when using localization), when duplicating a document. It may be used when documents having the
201201
exact same properties may cause issue. This gives you a way to avoid duplicate names on `unique`, `required` fields or when external systems expect non-repeating values on documents.
202202

203-
This hook gets called after `beforeChange` hooks are called and before the document is saved to the database.
203+
This hook gets called before the `beforeValidate` and `beforeChange` hooks are called.
204204

205205
By Default, unique and required text fields Payload will append "- Copy" to the original document value. The default is not added if your field has its own, you must return non-unique values from your beforeDuplicate hook to avoid errors or enable the `disableDuplicate` option on the collection.
206206
Here is an example of a number field with a hook that increments the number to avoid unique constraint errors when duplicating a document:

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ const esModules = [
55
'readable-web-to-node-stream',
66
'token-types',
77
'peek-readable',
8-
'find-up',
98
'locate-path',
109
'p-locate',
1110
'p-limit',
1211
'yocto-queue',
1312
'unicorn-magic',
1413
'path-exists',
1514
'qs-esm',
15+
'uint8array-extras',
1616
].join('|')
1717

1818
/** @type {import('jest').Config} */

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "payload-monorepo",
3-
"version": "3.0.0-beta.104",
3+
"version": "3.0.0-beta.106",
44
"private": true,
55
"type": "module",
66
"scripts": {

packages/create-payload-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-payload-app",
3-
"version": "3.0.0-beta.104",
3+
"version": "3.0.0-beta.106",
44
"homepage": "https://payloadcms.com",
55
"repository": {
66
"type": "git",

packages/db-mongodb/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@payloadcms/db-mongodb",
3-
"version": "3.0.0-beta.104",
3+
"version": "3.0.0-beta.106",
44
"description": "The officially supported MongoDB database adapter for Payload",
55
"homepage": "https://payloadcms.com",
66
"repository": {

packages/db-postgres/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@payloadcms/db-postgres",
3-
"version": "3.0.0-beta.104",
3+
"version": "3.0.0-beta.106",
44
"description": "The officially supported Postgres database adapter for Payload",
55
"homepage": "https://payloadcms.com",
66
"repository": {

packages/db-sqlite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@payloadcms/db-sqlite",
3-
"version": "3.0.0-beta.104",
3+
"version": "3.0.0-beta.106",
44
"description": "The officially supported SQLite database adapter for Payload",
55
"homepage": "https://payloadcms.com",
66
"repository": {

packages/db-sqlite/src/schema/traverseFields.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ export const traverseFields = ({
166166
if (field.hasMany) {
167167
const isLocalized =
168168
Boolean(field.localized && adapter.payload.config.localization) ||
169-
withinLocalizedArrayOrBlock
169+
withinLocalizedArrayOrBlock ||
170+
forceLocalized
170171

171172
if (isLocalized) {
172173
hasLocalizedManyTextField = true
@@ -199,7 +200,8 @@ export const traverseFields = ({
199200
if (field.hasMany) {
200201
const isLocalized =
201202
Boolean(field.localized && adapter.payload.config.localization) ||
202-
withinLocalizedArrayOrBlock
203+
withinLocalizedArrayOrBlock ||
204+
forceLocalized
203205

204206
if (isLocalized) {
205207
hasLocalizedManyNumberField = true
@@ -279,7 +281,8 @@ export const traverseFields = ({
279281

280282
const isLocalized =
281283
Boolean(field.localized && adapter.payload.config.localization) ||
282-
withinLocalizedArrayOrBlock
284+
withinLocalizedArrayOrBlock ||
285+
forceLocalized
283286

284287
if (isLocalized) {
285288
baseColumns.locale = text('locale', { enum: locales }).notNull()
@@ -365,7 +368,8 @@ export const traverseFields = ({
365368

366369
const isLocalized =
367370
Boolean(field.localized && adapter.payload.config.localization) ||
368-
withinLocalizedArrayOrBlock
371+
withinLocalizedArrayOrBlock ||
372+
forceLocalized
369373

370374
if (isLocalized) {
371375
baseColumns._locale = text('_locale', { enum: locales }).notNull()
@@ -503,7 +507,8 @@ export const traverseFields = ({
503507

504508
const isLocalized =
505509
Boolean(field.localized && adapter.payload.config.localization) ||
506-
withinLocalizedArrayOrBlock
510+
withinLocalizedArrayOrBlock ||
511+
forceLocalized
507512

508513
if (isLocalized) {
509514
baseColumns._locale = text('_locale', { enum: locales }).notNull()

packages/db-vercel-postgres/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@payloadcms/db-vercel-postgres",
3-
"version": "3.0.0-beta.104",
3+
"version": "3.0.0-beta.106",
44
"description": "Vercel Postgres adapter for Payload",
55
"homepage": "https://payloadcms.com",
66
"repository": {

packages/drizzle/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@payloadcms/drizzle",
3-
"version": "3.0.0-beta.104",
3+
"version": "3.0.0-beta.106",
44
"description": "A library of shared functions used by different payload database adapters",
55
"homepage": "https://payloadcms.com",
66
"repository": {

0 commit comments

Comments
 (0)