Compare commits

...

934 Commits
v1.6.9 ... 1.x

Author SHA1 Message Date
Elliot DeNolf
465acf0123 chore(release): v1.15.12 2025-03-11 09:23:34 -04:00
Elliot DeNolf
a6524720f5 chore: simplify query parsing 2025-03-10 14:38:52 -04:00
Jonathan Wu
59fb70077d chore(examples/form-builder): improves form input accessibility 2023-11-15 17:06:18 -05:00
Patrik
6b3f20d01b fix: ensures compare-version select field cannot be cleared (#3413) 2023-10-27 12:29:07 -04:00
Aleem Isiaka
5f6a0db869 fix: ctrl s on globals (#3342) 2023-10-10 23:32:57 -04:00
Kári Rögnvaldsson
26fcfba8fd fix: hide rich text toolbar if leaves and elements arrays are empty (#3226) 2023-10-10 13:27:07 -04:00
Jarrod Flesch
88ad2ee1e3 chore: adds example code and README for setting up testing with a payload project (#3333) 2023-10-09 14:37:00 -04:00
Elliot DeNolf
b76aea9b9a chore(release): v1.15.8 2023-10-08 17:21:16 -04:00
Elliot DeNolf
d770b40cc5 chore: update yarn.lock 2023-10-08 17:12:27 -04:00
Calvin Chong
3e6718034f chore(templates/website): adds seeded users to readme (#3412)
Co-authored-by: Jacob Fletcher <jacobsfletch@gmail.com>
2023-10-08 16:46:57 -04:00
dependabot[bot]
a7beb1bb8f chore(deps): bump graphql from 16.8.0 to 16.8.1 (#3380)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.8.0 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.8.0...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:42:59 -04:00
dependabot[bot]
6a79efc5f5 chore(deps): bump word-wrap in /examples/redirects/nextjs (#3057)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.5.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.5)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:41:46 -04:00
dependabot[bot]
9697269816 chore(deps): bump semver in /examples/redirects/nextjs (#3058)
Bumps [semver](https://github.com/npm/node-semver) from 7.3.8 to 7.5.4.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.3.8...v7.5.4)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:41:20 -04:00
dependabot[bot]
af375123a8 chore(deps): bump word-wrap in /examples/form-builder/nextjs (#3076)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.5.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.5)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:41:07 -04:00
dependabot[bot]
00b66a70c9 chore(deps): bump semver in /examples/draft-preview/next-app (#3111)
Bumps [semver](https://github.com/npm/node-semver) from 6.3.0 to 6.3.1.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v6.3.1/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v6.3.0...v6.3.1)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:40:29 -04:00
dependabot[bot]
b0135a7ee0 chore(deps): bump postcss from 8.4.27 to 8.4.31 in /templates/blank (#3463)
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.27 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.27...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:39:17 -04:00
dependabot[bot]
fe2940a447 chore(deps): bump postcss from 8.4.27 to 8.4.31 in /examples/whitelabel (#3464)
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.27 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.27...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:36:11 -04:00
dependabot[bot]
c745de15b9 chore(deps): bump postcss in /examples/form-builder/cms (#3465)
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.27 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.27...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:35:55 -04:00
dependabot[bot]
4dcf0bcad6 chore(deps): bump postcss in /examples/multi-tenant (#3466)
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.27 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.27...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:35:44 -04:00
dependabot[bot]
93f043bc79 chore(deps): bump postcss in /examples/redirects/cms (#3467)
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.27 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.27...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:35:32 -04:00
dependabot[bot]
63bceedca4 chore(deps): bump postcss from 8.4.27 to 8.4.31 in /examples/email (#3468)
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.27 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.27...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:35:21 -04:00
dependabot[bot]
0bbb5790d5 chore(deps): bump postcss in /examples/auth/payload (#3469)
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.27 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.27...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:35:09 -04:00
dependabot[bot]
05c8bdc16a chore(deps): bump postcss in /examples/draft-preview/payload (#3470)
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.27 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.27...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:34:53 -04:00
dependabot[bot]
77c14033d6 chore(deps): bump postcss from 8.4.28 to 8.4.31 (#3471)
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.28 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.28...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 15:34:40 -04:00
Jacob Fletcher
0280cdd355 chore: updates README.md (#3430) 2023-10-03 17:54:09 -04:00
Petipois
891ab34a12 chore: updates link to contributing in readme (#3418) 2023-10-03 15:49:49 -04:00
Jarrod Flesch
26939a3331 fix: secures the user response from the me auth route (#3409) 2023-10-03 12:21:41 -04:00
PatrikKozak
9fa4a8fcfb chore(examples/custom-server): updates readme with correct login info (#3422) 2023-10-03 10:08:00 -04:00
Elliot DeNolf
96608a509b chore(release): v1.15.7 2023-10-02 17:38:22 -04:00
Alessio Gravili
8586c85fab fix: hotkey's pressed keys are not unset when window is not focused (#3400)
* fix: hotkey's pressed keys are not unset when window is not focused

* chore: remove unnecessary console.log
2023-10-02 10:41:59 -04:00
dependabot[bot]
1a76e9580f chore(deps): bump graphql from 16.8.0 to 16.8.1 in /templates/ecommerce (#3381)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.8.0 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.8.0...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 07:34:18 -07:00
dependabot[bot]
8127fe39e2 chore(deps): bump graphql in /examples/auth/payload (#3379)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.7.1 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.7.1...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 07:32:21 -07:00
dependabot[bot]
e42c4dec98 chore(deps): bump graphql in /examples/draft-preview/payload (#3378)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.7.1 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.7.1...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 07:31:59 -07:00
dependabot[bot]
2c82ea80de chore(deps): bump graphql from 16.7.1 to 16.8.1 in /examples/email (#3377)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.7.1 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.7.1...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 07:31:44 -07:00
dependabot[bot]
428aebd73e chore(deps): bump graphql from 16.7.1 to 16.8.1 in /templates/blank (#3376)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.7.1 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.7.1...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 07:31:37 -07:00
dependabot[bot]
712bd6e8b1 chore(deps): bump graphql in /examples/form-builder/cms (#3375)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.7.1 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.7.1...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 07:31:31 -07:00
dependabot[bot]
1ca55b41c6 chore(deps): bump graphql in /examples/custom-server (#3374)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.7.1 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.7.1...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 07:31:14 -07:00
dependabot[bot]
81352f3d41 chore(deps): bump graphql in /examples/multi-tenant (#3373)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.7.1 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.7.1...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 07:29:14 -07:00
dependabot[bot]
6fb60cdbe3 chore(deps): bump graphql from 16.7.1 to 16.8.1 in /templates/website (#3372)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.7.1 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.7.1...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 07:29:04 -07:00
dependabot[bot]
e18784dd5b chore(deps): bump graphql in /examples/redirects/cms (#3371)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.7.1 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.7.1...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 07:28:57 -07:00
dependabot[bot]
ff417368ff chore(deps): bump graphql from 16.7.1 to 16.8.1 in /examples/whitelabel (#3370)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.7.1 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.7.1...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 07:28:50 -07:00
dependabot[bot]
e28c77069e chore(deps): bump graphql in /examples/form-builder/nextjs (#3369)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.6.0 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.6.0...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-24 07:28:40 -07:00
Elliot DeNolf
37fe2df2de chore(release): v1.15.6 2023-09-13 10:30:03 -04:00
Jarrod Flesch
8ca67d5aaa fix(#3289): removes HMR plugin from prod webpack configs (#3319) 2023-09-12 13:09:56 -04:00
Jarrod Flesch
096d33718d fix: fields with relationTo[] correctly load returned data from form submission (#3317) 2023-09-12 11:43:45 -04:00
Jessica Chowdhury
0bd335303d fix: greater than equal admin filter not working (#3306) 2023-09-11 13:08:06 -04:00
James
e8e1ba00fe chore(release): v1.15.5 2023-09-09 09:53:57 -04:00
Jarrod Flesch
a7d47c627d fix: corrects hasMany relationships within addFieldStatePromise (#3300) 2023-09-09 00:32:29 -04:00
Jarrod Flesch
5e1bed3177 chore: fixes console errors for checkboxes (#3291) 2023-09-07 09:11:35 -04:00
Elliot DeNolf
364014a1e9 chore(release): v1.15.4 2023-09-06 17:39:02 -04:00
Jarrod Flesch
9cd5e5aefa fix: appends versions key to incoming where query (#3287) 2023-09-06 15:07:46 -04:00
Bas Dalenoord
429a88a5a1 fix: change scoping of force parameter to prevent false negation; (#3278) 2023-09-06 12:54:39 -04:00
Jarrod Flesch
cf12b5fc70 fix(#3274): sets full user data from fetchFullUser instead of partial jwt data (#3279) 2023-09-06 12:52:48 -04:00
Jarrod Flesch
5096c37874 fix: aligns depth behaviour between local api and admin panel (#3276) 2023-09-06 12:51:59 -04:00
Jacob Fletcher
ac592b6d0d chore(templates/ecommerce): misc cleanup 2023-09-06 11:59:03 -04:00
Jacob Fletcher
007f7e7d18 chore(templates/ecommerce): fixes nextjs hmr 2023-09-06 11:49:59 -04:00
Jacob Fletcher
4ba072b0c6 chore(templates/ecommerce): related products 2023-09-06 11:39:18 -04:00
Jacob Fletcher
8a4db150f0 chore(templates/ecommerce): prevents server from restarting when app files change 2023-09-06 11:11:30 -04:00
Jacob Fletcher
b28b9020ea chore(templates/ecommerce): fixes product published dates 2023-09-06 11:07:59 -04:00
Jacob Fletcher
baa73fae62 chore(templates/ecommerce): wires in redirects 2023-09-06 11:03:30 -04:00
Jacob Fletcher
55c27b6d2f chore(templates/website): builds nextjs front-end (#3282) 2023-09-06 08:38:04 -04:00
James
6d148d7309 chore(release): v1.15.3 2023-09-05 16:53:47 -04:00
James Mikrut
8e10ecae4b Merge pull request #3256 from payloadcms/feat/versions-perf
Feat/versions perf
2023-09-05 16:47:48 -04:00
Jarrod Flesch
ef27b9f641 chore: revert changes related to the status displayed by the Status component 2023-09-05 16:33:01 -04:00
Jarrod Flesch
2dcce0339c chore: simplify logic for global status rendering 2023-09-05 16:04:56 -04:00
Jarrod Flesch
b649ad7bb5 chore: ensure not to update the version doc that was just created 2023-09-05 16:04:12 -04:00
Jarrod Flesch
3cee0be314 chore: remove script file example 2023-09-05 16:01:07 -04:00
Jacob Fletcher
8fc953605a chore(templates/ecommerce): properly formats csp and handles post requests in next app (#3260) 2023-09-01 10:52:05 -04:00
Jarrod Flesch
e28dfc0c93 chore: tweak script 2023-08-31 21:34:25 -04:00
Jarrod Flesch
33561a8ea2 chore: adds feature flag to config 2023-08-31 21:16:50 -04:00
Jarrod Flesch
e500b46576 chore: removes console log 2023-08-31 16:57:49 -04:00
Jarrod Flesch
e79a84d200 chore: migration script 2023-08-31 16:56:21 -04:00
Jarrod Flesch
16e94d401b feat: improves query speed for version enabled collections 2023-08-31 16:50:35 -04:00
Jarrod Flesch
9fbabc8fd6 fix: globals not saving updatedAt and createdAt and version dates correctly 2023-08-31 16:49:33 -04:00
Jarrod Flesch
9bc072ccaf fix: draft globals always displaying unpublish button 2023-08-31 16:48:25 -04:00
Jacob Fletcher
45905c312f chore(templates/ecommerce): bypasses next cache (#3254) 2023-08-31 09:34:10 -04:00
Jacob Fletcher
2c7a15ceca chore(templates/ecommerce): uses svg favicon 2023-08-28 16:11:11 -04:00
Jacob Fletcher
28e128241e chore(examples/custom-server): uses getPayloadClient in default server and removes admin redirect 2023-08-28 16:06:45 -04:00
Jacob Fletcher
21336cd61a chore(examples/custom-server): handles front-end post requests (#3221) 2023-08-28 15:58:56 -04:00
Jarrod Flesch
ff1c10c382 chore(examples): simplify getPayloadClient logic 2023-08-28 13:49:40 -04:00
Jarrod Flesch
6e8aa5e8af Merge branch 'master' of https://github.com/payloadcms/payload 2023-08-28 11:24:28 -04:00
Jarrod Flesch
32e7c56a0d chore(example): adjusts custom server example with pattern to utilize local api 2023-08-28 11:24:24 -04:00
Jacob Fletcher
e5c783df5d chore(templates/ecommerce): migrates to @payloadcms/plugin-stripe v0.0.14 (#3231) 2023-08-25 17:49:51 -04:00
Jacob Fletcher
63698e5e88 chore(templates): correctly sets next images domain (#3230) 2023-08-25 15:40:40 -04:00
Dan Ribbens
016ad3afc9 chore(release): v1.15.2 2023-08-25 11:40:42 -04:00
Dan Ribbens
33e1e15ca9 chore: pins swc v1.3.78 (#3228) 2023-08-25 11:00:43 -04:00
Jarrod Flesch
59918aac91 chore(docs): clarifies reason for returning doc in afterChange collection hook 2023-08-25 10:23:27 -04:00
Dan Ribbens
a0c3cbd68d chore(release): v1.15.1 2023-08-25 06:55:22 -04:00
Tylan Davis
3a15e077c6 fix: correct out of order dark-mode color variables (#3197) 2023-08-24 15:09:31 -04:00
Jessica Chowdhury
90a9e14e9d docs: adds custom select example and video (#3223) 2023-08-24 15:07:06 -04:00
Paul
6d3b8636f4 fix: mutation type with tabs missing previous tabs (#3196) 2023-08-24 14:29:25 -04:00
PatrikKozak
cb8e07f852 fix: arrays in richtext uploads (#3222)
Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
2023-08-24 14:12:18 -04:00
Jessica Chowdhury
301be0a5d4 docs: adds minRow and maxRow to array and blocks pages (#3203) 2023-08-24 11:19:49 -04:00
Dan Ribbens
466589b483 chore(release): v1.15.0 2023-08-24 10:22:55 -04:00
Alessio Gravili
6754f55ce0 chore: improve filtering for hasMany number field (#3193)
* chore: improve fiiltering for hasMany number field

* chore: add translation for 'items' and replace rows with items

* chore: new exceededLimit key

* Revert "chore: add translation for 'items' and replace rows with items"

This reverts commit 3a91dabdfd.

* chore: undo adding items key in translation schema

* chore: new limitReached key

* chore: remove unnecessary exceededLimit key
2023-08-21 18:01:10 +02:00
Alessio Gravili
84d2bacb56 chore: improve checkboxes (#3191) 2023-08-21 10:39:40 -04:00
Alessio Gravili
739abdcd81 feat: query support for geo within and intersects + dynamic GraphQL operator types (#3183)
Co-authored-by: Lucas Blancas <lablancas@gmail.com>
2023-08-21 10:12:27 -04:00
Jacob Fletcher
c7cf2d3d2c chore(examples): updates draft-preview next-app example to use revalidateTag (#3199) 2023-08-21 08:45:44 -04:00
Jacob Fletcher
79561497f9 Merge pull request #3200 from payloadcms/chore/ecom-deploy
chore(templates): updates e-commerce template
2023-08-21 08:45:31 -04:00
Jacob Fletcher
600306274e chore(templates): renders static cart page fallback 2023-08-20 18:26:53 -04:00
Jacob Fletcher
398378a867 chore(templates): implements draft preview and on-demand revalidation 2023-08-20 13:20:06 -04:00
Jacob Fletcher
4e755dfde2 chore(templates): safely handles bad network requests 2023-08-20 02:09:51 -04:00
Elliot DeNolf
3634e2cc4d chore(templates): default port on website 2023-08-17 15:01:55 -04:00
Jarrod Flesch
294fb5e574 chore: improve ts typing in sanitization functions (#3194) 2023-08-17 10:47:54 -04:00
Dan Ribbens
f5f2332755 chore(release): v1.14.0 2023-08-16 13:58:20 -04:00
Jarrod Flesch
0acd7b8706 chore: file cleanup (#3190) 2023-08-16 13:03:43 -04:00
James Mikrut
d91b44cbb3 feat: improve field ops (#3172)
Co-authored-by: PatrikKozak <patrik@trbl.design>
2023-08-16 11:00:52 -04:00
Greg Willard
e03a8e6b03 feat: Improve admin dashboard accessibility (#3053)
Co-authored-by: Alessio Gravili <alessio@gravili.de>
2023-08-16 10:26:17 -04:00
Jacob Fletcher
846485388a docs: removes auto-formatting from rich-text.mdx (#3188) 2023-08-16 10:15:27 -04:00
Jacob Fletcher
8d83e05948 docs: fixes syntax error in rich-text.mdx that was breaking build 2023-08-16 03:28:19 -04:00
PatrikKozak
7963d04a27 fix: passes in height to resizeOptions upload option to allow height resize (#3171) 2023-08-15 14:58:16 -04:00
Jessica Chowdhury
20b6b29c79 chore(test): adds test to ensure relationship returns over 10 docs (#3181)
* chore(test): adds test to ensure relationship returns over 10 docs

* chore: remove unnecessary movieDocs variable
2023-08-15 19:48:33 +02:00
Alessio Gravili
fdfdfc83f3 fix: WhereBuilder component does not accept all valid Where queries (#3087)
* chore: add jsDocs for ListControls

* chore: add jsDocs for ListView

* chore: add jsDocs for WhereBuilder

* chore: add comment

* chore: remove unnecessary console log

* chore: improve operator type

* fix: transform where queries which aren't necessarily incorrect, and improve their validation

* chore: add type to import

* fix: do not merge existing old query params with new ones if the existing old ones got transformed and are not valid, as that would cause duplicates

* chore: sort imports and remove extra validation

* fix: transformWhereQuery logic

* chore: add back extra validation

* chore: add e2e tests
2023-08-15 19:22:57 +02:00
Jarrod Flesch
c154eb7e2b chore: remove swc version pin (#3179) 2023-08-15 09:19:18 -04:00
Stef Gootzen
33686c6db8 feat: add afterOperation hook (#2697)
* feat: add afterOperation hook for Find operation

* docs: change #afterOperation to #afteroperation

* chore: extract afterOperation in function

* chore: implement afterChange in operations

* docs: use proper CollectionAfterOperationHook

* chore: remove outdated info

* chore: types afterOperation hook

* chore: improves afterOperation tests

* docs: updates description of afterOperation hook

* chore: improve typings

* chore: improve types

* chore: rename index.tsx => index.ts

---------

Co-authored-by: Jacob Fletcher <jacobsfletch@gmail.com>
Co-authored-by: Alessio Gravili <alessio@gravili.de>
2023-08-15 14:37:01 +02:00
Alessio Gravili
6d6acbcfc1 Merge pull request #3176 from payloadcms/chore/docs-design-contributions
chore: add section for design contributions in contributing.md
2023-08-15 14:25:50 +02:00
Alessio Gravili
4e2f2561ff chore: add section for design contributions in contributing.md 2023-08-15 13:34:11 +02:00
Chingiz Mammadov
63e3063b9e feat: Added Azerbaijani language file (#3164)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-08-14 15:40:53 -04:00
rpfaeffle
942cfec286 feat: add support for hotkeys (#1821)
Co-authored-by: Jacob Fletcher <jacobsfletch@gmail.com>
Co-authored-by: Alessio Gravili <70709113+AlessioGr@users.noreply.github.com>
Co-authored-by: Alessio Gravili <alessio@gravili.de>
Co-authored-by: Jessica Boezwinkle <jessica@trbl.design>
2023-08-14 15:36:49 -04:00
Jarrod Flesch
35dfaab7c2 chore: works around changes in @swc/core 1.3.76 (#3170) 2023-08-14 14:32:42 -04:00
Jordy Alcides
bad363882c feat: allow async relationship filter options (#2951)
* chore: improving relationship filter options;

Updating prop filterOptions from field type "relationship" to allow async functions;

* chore: add failing test case

* fix: translation followingFieldsInvalid_many not getting triggered

* docs: improve documentation

---------

Co-authored-by: Alessio Gravili <alessio@gravili.de>
2023-08-14 17:29:29 +02:00
Alessio Gravili
20a6ce8823 Merge pull request #3166 from payloadcms/fix/external-website-redirects
fix: do not allow redirects to external sites
2023-08-14 17:20:07 +02:00
Alessio Gravili
6797222733 chore: remove duplicate code 2023-08-14 17:19:19 +02:00
Jarrod Flesch
edcb3933cf fix: DatePicker showing only selected day by default (#3169) 2023-08-14 11:18:13 -04:00
Mark Barton
a0b13a5b01 feat: text alignment for richtext editor (#2803)
* Update isActive.tsx

This change allows us to define toggling of custom types in Slate. Specifically, this fixes the ability to toggle Alignment on nodes that use other active elements.

isElementActive(editor, format, TEXT_ALIGN_TYPES.includes(format) ? 'align' : 'type');

Type is the default for elements, allowing us to use a custom field lets us greater extend the functionality of Slate in Payload without causing any breaking changes

* Update toggle.tsx

Added to toggleElement public function

* Update isActive.tsx

* Update toggle.tsx

Added Rich Text Alignment, updated toggle function, added tests and doc updates

* added margin to void elements

* fix: list alignment

* removed textAlign from elements and added docs

* chore: fix typo

---------

Co-authored-by: Alessio Gravili <alessio@gravili.de>
2023-08-14 17:08:50 +02:00
Alessio Gravili
5744de7ec6 feat: make PAYLOAD_CONFIG_PATH optional (#2839)
* feat: make PAYLOAD_CONFIG_PATH optional

* hardcode common search paths

* docs: update docs regarding PAYLOAD_CONFIG_PATH

* make the tsConfig parser less prone to errors
2023-08-14 16:46:10 +02:00
Alessio Gravili
8a6cbf8a4d Merge pull request #2500 from Elliot67/feat/file-caching 2023-08-14 16:37:00 +02:00
Alessio Gravili
0a4730188b chore: update from master 2023-08-14 15:23:28 +02:00
Alessio Gravili
ea46fadc26 Merge remote-tracking branch 'origin/master' into pr/2500 2023-08-14 15:23:19 +02:00
Alessio Gravili
40db0d0462 chore: improve regex 2023-08-14 15:14:54 +02:00
Alessio Gravili
c0f05a1c38 fix: only allow redirects to /admin sub-routes 2023-08-13 16:25:14 +02:00
Elliot DeNolf
52de1f6ab0 chore(release): v1.13.4 2023-08-11 16:58:06 -04:00
Jarrod Flesch
479293fe6f chore: removes duplicative code for getting parent path (#3163) 2023-08-11 13:04:43 -04:00
Jarrod Flesch
3c60abd61a fix: correctly passes block path inside buildFieldSchemaMap (#3162) 2023-08-11 10:49:52 -04:00
Elliot DeNolf
f9807b5bd5 chore(release): v1.13.3 2023-08-11 09:27:27 -04:00
Jarrod Flesch
cb04d4a82a fix: unable to add arrays inside secondary named tabs (#3158) 2023-08-11 09:02:29 -04:00
James
5f7ea17717 chore(release): v1.13.2 2023-08-10 17:43:46 -04:00
Jarrod Flesch
608ae42eff chore: pins @swc/core to 1.3.75 2023-08-10 16:23:43 -04:00
Jacob Fletcher
1da412a9bf chore(templates): fixes orders access control in ecommerce template (#3150) 2023-08-09 12:27:11 -04:00
Dan Ribbens
324b51e778 chore(release): v1.13.1 2023-08-08 16:00:52 -04:00
Jarrod Flesch
f5cf546e19 fix: updates addFieldRow and replaceFieldRow rowIndex insertion (#3145) 2023-08-08 15:35:59 -04:00
Dan Ribbens
510510cc66 chore: update changelog 2023-08-08 12:54:47 -04:00
Dan Ribbens
69cb015e0b chore(release): v1.13.0 2023-08-08 12:54:14 -04:00
Dan Ribbens
c6e0908076 feat: recursive saveToJWT field support (#3130) 2023-08-08 12:38:44 -04:00
Jarrod Flesch
8e188cfe61 fix: adding and replacing similarly shaped block configs (#3140) 2023-08-08 12:38:14 -04:00
Jessica Chowdhury
8ae98503f5 docs: adds images to each field page (#3137) 2023-08-08 10:00:21 -04:00
Jessica Chowdhury
1039f39c09 fix: absolute staticURL admin thumbnails (#3135) 2023-08-08 09:49:03 -04:00
Hristiyan Dodov
463d6bbec6 fix: setPreference() return type (#3125) 2023-08-08 09:17:17 -04:00
Jarrod Flesch
b117e73464 feat: radio and select fields are filterable by options (#3136) 2023-08-07 16:58:42 -04:00
PatrikKozak
fd0f078586 Merge pull request #3134 from leikoilja/fix-form-builder-example
fix: form-builder buildInitialFormState example
2023-08-07 11:14:20 -04:00
Ilja Leiko
0aa494b339 fix: fix form-builder buildInitialFormState example 2023-08-07 12:36:07 +02:00
Dan Ribbens
e8f05165eb feat: default tab labels from name (#3129) 2023-08-05 13:48:56 -04:00
Dan Ribbens
a776e06111 chore(release): v1.12.0 2023-08-04 14:06:10 -04:00
Dan Ribbens
02fc36e988 chore: update devDependencies for supply chain vulnerabilities (#3127) 2023-08-04 13:53:57 -04:00
Alessio Gravili
c5756ed4a1 feat: option to pre-fill login credentials automatically (#3021)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-08-04 13:41:08 -04:00
Dan Ribbens
356f174b9f feat: set JWT token field name with saveToJWT (#3126) 2023-08-04 13:22:05 -04:00
Jarrod Flesch
1c15868b50 chore(translations): removes extra keys from required 2023-08-04 12:59:12 -04:00
Jarrod Flesch
1180c795a3 chore: adds missing translations 2023-08-04 12:52:58 -04:00
Dan Ribbens
da27a8aadb fix: relationship field filter long titles (#3113) 2023-08-04 11:40:47 -04:00
Alessio Gravili
6a189c6548 fix: wrong links in verification and forgot password emails if serverURL not set (#3010) 2023-08-04 11:30:09 -04:00
Jessica Chowdhury
8c4d2514b0 fix: excludes useAsTitle field from searchableFields in collection view (#3105) 2023-08-04 11:27:52 -04:00
Alessio Gravili
a09c4ddc3b chore: improve flaky admin test suite (#3085) 2023-08-04 11:23:17 -04:00
Jarrod Flesch
5ca45987c4 chore: adds error and errors translations (#3121) 2023-08-03 15:14:34 -04:00
Jarrod Flesch
5b07e18ff5 chore: adds missing japanese translations (#3119) 2023-08-03 12:39:10 -04:00
Jessica Chowdhury
ea73e689ac feat: allows for upload relationship drawer to be opened (#3108) 2023-08-03 12:03:27 -04:00
Jacob Fletcher
456f29d689 chore: updates CONTRIBUTING.md (#3073) 2023-08-03 11:57:00 -04:00
Jacob Fletcher
50360b8769 chore: updates PULL_REQUEST_TEMPLATE.md (#3088) 2023-08-03 11:56:38 -04:00
Alessio Gravili
541e41293d chore: add RichTextAdapter interface type (#3117) 2023-08-03 11:31:21 -04:00
Jarrod Flesch
a78c4631b4 feat: programmatic control over array and block rows inside the form (#3110) 2023-08-03 09:39:50 -04:00
Jarrod Flesch
da8ff20616 chore: prevent enter keypress from saving document (#3115) 2023-08-03 08:51:30 -04:00
Jacob Fletcher
037ccdd96e chore(examples): updates preview example (#3099) 2023-08-01 16:53:45 -04:00
Jacob Fletcher
b84496e5da chore(examples): updates auth example (#3100) 2023-08-01 16:53:31 -04:00
dependabot[bot]
62ecf54f85 chore(deps): bump semver in /examples/form-builder/nextjs (#3075)
Bumps [semver](https://github.com/npm/node-semver) from 6.3.0 to 6.3.1.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v6.3.1/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v6.3.0...v6.3.1)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-01 15:24:25 -04:00
Sean Zubrickas
3fdaeb875e removes yarn lock from virtual fields example because of merge conflict 2023-08-01 09:26:47 -04:00
Sean Zubrickas
992be4af44 updates top banner copy 2023-08-01 09:25:17 -04:00
Josef Bredreck
144bb81721 feat: add support for sharp resize options (#2844)
* feat(ImageResize): add support for resize options

* fix(ImageUpload): reuse name for accidental duplicate

* fix(ImageResize): e2e tests for added media size

* chore: simplify fileExists method

* fix: typo

* feat(ImageResize): update name to be more transparent

* fix: use fileExists in file removal

* improve names, comments and clarity of needsResize function

* fix: jsDoc params

* fix: incorrect needsResize condition and add failing test case

* chore: improve comment

* fix: merge conflict error

---------

Co-authored-by: Alessio Gravili <70709113+AlessioGr@users.noreply.github.com>
2023-08-01 09:20:50 -04:00
Dan Ribbens
5ef20e3440 docs: mention virtual fields cannot be sorted (#3107) 2023-08-01 05:10:02 -04:00
James Mikrut
88b56d04f5 Update README.md 2023-07-31 18:31:33 -04:00
James
4b00850e41 chore(release): v1.11.8 2023-07-31 15:00:28 -04:00
James
badf2336ee chore: resolves type conflicts introduced with database folder 2023-07-31 14:55:23 -04:00
James
6220c3d6d9 chore: includes database files for adapter build 2023-07-31 14:46:28 -04:00
Dan Ribbens
455b35dc1b chore: remove console log array field 2023-07-28 07:27:14 -04:00
Sean Zubrickas
b7299ab601 increases font size on top banner 2023-07-27 17:27:22 -04:00
Sean Zubrickas
174f83faf7 adds alternate github banner, removes cloud cta 2023-07-27 17:24:45 -04:00
Sean Zubrickas
5e41e0fb9e removes benefits banner & reverts to unordered list 2023-07-27 16:54:55 -04:00
James
129a9e7675 chore(release): v1.11.7 2023-07-26 21:24:27 -04:00
Sean Zubrickas
eb57c2280e removes benefits h3 in favor of benefits image, reorders helpful links 2023-07-26 18:48:58 -04:00
Sean Zubrickas
e2ad0baaaf refactors benefits list into h3 2023-07-26 17:41:56 -04:00
Jarrod Flesch
7542a92104 chore(tests): adds array row manipulation tests (#3086) 2023-07-26 16:34:13 -04:00
Corfitz
0a91950f05 fix: incorrect image rotation after being processed by sharp (#3081)
* Applying rotation fix for sharp image resizing

* fix: make sure original image is rotated correctly

* chore: explain why rotate() is needed in comments

---------

Co-authored-by: Alessio Gravili <alessio@gravili.de>
2023-07-26 20:57:36 +02:00
James
02809532b4 fix: #3062 2023-07-26 11:34:22 -04:00
Alessio Gravili
67ba131cc6 feat: ability to add context to payload's request object (#2796)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-07-26 09:07:49 -04:00
Jarrod Flesch
cf9795b8d8 fix: array row deletion (#3062) 2023-07-26 09:01:25 -04:00
James
a5f42e6a08 chore(release): v1.11.6 2023-07-25 17:14:59 -04:00
James Mikrut
23e718d4d1 Merge pull request #3068 from sannajammeh/master
fix(admin:upload): Enable adminThumbnail fn execution on all mime types
2023-07-25 17:01:50 -04:00
Sean Zubrickas
e8d9cab046 updates payload logos, updates top banner + cloud banner, adds line to benefits 2023-07-25 16:14:43 -04:00
Tylan Davis
d43c83dad1 fix: threads hasMaxRows into ArrayAction components within blocks and arrays (#3066) 2023-07-25 15:43:20 -04:00
Jarrod Flesch
916f04cba0 chore: better parity for initing admin routes between dev and build (#3074) 2023-07-25 14:27:01 -04:00
Jarrod Flesch
156c3eeb08 chore: adds updated yarn lock files for examples and templates folders 2023-07-25 14:22:53 -04:00
Jarrod Flesch
9755a55672 chore: sets payload to latest within templates and examples 2023-07-25 14:11:33 -04:00
Jacob Fletcher
774ffa14d3 chore: updates e-commerce template (#3072) 2023-07-25 12:47:08 -04:00
James
e30db30b07 chore(release): v1.11.5 2023-07-25 10:27:03 -04:00
Jarrod Flesch
e71866856f fix: admin route not mounting on production serve (#3071) 2023-07-25 10:16:55 -04:00
Elliot DeNolf
242dac5b8e chore(release): v1.11.4 2023-07-25 08:48:16 -04:00
Sanna Jammeh
dda9ff01ca docs(upload): Modify the note under adminThumbnail to reflect changes 2023-07-25 00:35:19 +00:00
Sanna Jammeh
5b7aac08f5 test(uploads): Add test case for adminThumbnail 2023-07-25 00:29:54 +00:00
Sanna Jammeh
2c74e9396a fix(collections:admin): Enable adminThumbnail fn execution on all types 2023-07-24 22:42:41 +00:00
Sean Zubrickas
62b73250b4 changes e-commerce and saas links to h3s, adds icons to each heading 2023-07-24 14:47:20 -04:00
Sean Zubrickas
9953e36f6b updates cloud cta, updates examples & tempaltes block, adds one-click tempaltes block 2023-07-24 14:17:19 -04:00
Sean Zubrickas
532f08c5b8 updates readme with new images, copy and layout 2023-07-24 13:29:04 -04:00
Jessica Boezwinkle
136298ac86 docs: fix useAuth code snippet on admin/react-hooks 2023-07-24 16:53:56 +01:00
Greg Willard
080e6195ef feat: improve keyboard focus styles (#3011)
* feat: Card: add keyboard focus outline

* feat: Button: add keyboard focus styles

* feat: links: add keyboard focus styles

* feat: CopyToClipboard: fix textarea tabbing issue, add keyboard focus style

* chore: fix text getting darker on keyboard focus

* feat: Pill: add keyboard focus styles

* feat: Paginator: fix disabled state, add keyboard focus styles

* feat: Nav: add keyboard focus styles

* feat: Table: add keyboard focus styles

* chore: add jsDocs to (s)css loaders

* fix: update dependency which fixes css bug

* chore: remove unnecessary Card style

* fix: use Button instead of button for DeleteDocument

* chore: override browser default outline

* chore: remove unnecessary outline rule

* fix: list drawer outline

---------

Co-authored-by: Alessio Gravili <alessio@gravili.de>
2023-07-24 17:04:12 +02:00
Jacob Fletcher
074abf4b7d chore: migrates ecommerce template to next.js app router (#2991) 2023-07-24 08:23:51 -04:00
Jarrod Flesch
08377cc5a7 fix: if arrayFieldType rows are undefined, page would crash (#3049) 2023-07-21 17:24:44 -04:00
Jarrod Flesch
641c765fb9 feat: solidifies bundler adapter pattern (#3044) 2023-07-21 17:20:51 -04:00
Jacob Fletcher
9f06253321 chore: fixes ecommerce template .env.example (#3041) 2023-07-20 17:45:55 -04:00
Elliot DeNolf
5476cdfee2 chore: only needed dependabot security alerts enabled, not all deps 2023-07-20 17:44:03 -04:00
Elliot DeNolf
f232434b9a chore: add dependabot (#3027) 2023-07-20 17:12:05 -04:00
Jacob Fletcher
2a932ea28e chore: updates auth example (#3026) 2023-07-20 14:06:26 -04:00
Elliot DeNolf
41d3eee35f feat: bump mongoose and mongoose-paginate versions (#3025) 2023-07-20 12:51:30 -04:00
Elliot DeNolf
7aa57308be chore(release): v1.11.3 2023-07-19 17:54:16 -04:00
Elliot DeNolf
744a79f286 chore: pin mongoose-paginate-v2 2023-07-19 17:29:27 -04:00
Dominik Zogg
cd0bf68a61 feat: support logger destination (#2896)
* add-pino-destination-stream-support

* destinationStream => loggerDestination
2023-07-19 11:48:13 -04:00
Jarrod Flesch
a69c3ec476 chore: updates example folder mongodb uri's to work with node 18 2023-07-18 16:51:22 -04:00
Alessio Gravili
3ac910bf6d chore: improves datepicker styles and functionality (#2347)
Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
2023-07-18 14:32:30 -04:00
Jarrod Flesch
60fca40780 fix: rich text link element not validating on create (#3014) 2023-07-18 08:54:22 -04:00
Alessio Gravili
733fc0b2d0 feat: auto-login in config capability (#3009)
This is useful when developing/testing, where logging after every change can be cumbersome.
2023-07-17 16:35:58 -04:00
Jacob Fletcher
2fc03f196e feat: returns queried user alongside refreshed token (#2813)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-07-17 09:35:34 -04:00
Jessica Chowdhury
7927dd485a docs: adds auth example for useAPIKey and disableLocalStrategy (#3007) 2023-07-17 09:30:30 -04:00
Jessica Chowdhury
42334263bb fix: adds backdrop blur to button (#3006) 2023-07-17 09:24:39 -04:00
James
75fbec21a9 chore(release): v1.11.2 2023-07-14 10:47:37 -04:00
Ritsu
281239db05 chore: fix typo error ua.json (#2995) 2023-07-13 16:11:20 -04:00
Jarrod Flesch
59bc002aed chore: fix protectRoles in auth example 2023-07-12 08:31:21 -04:00
Jarrod Flesch
70f3e6fc3e chore: explicitly import Tab type as type 2023-07-11 23:40:02 -04:00
Jarrod Flesch
4925f90b5f feat: adds array, collapsible, tab and group error states
Co-authored-by: Jessica Boezwinkle <jessica@trbl.design>
Co-authored-by: James <james@trbl.design>
2023-07-11 23:20:27 -04:00
James
fafec05309 chore(release): v1.11.1 2023-07-11 10:13:40 -04:00
Jacob Fletcher
76a71c1af5 chore: adds use-client directive to label component (#2988) 2023-07-11 10:06:25 -04:00
James Mikrut
2854bfebf7 Merge pull request #2987 from payloadcms/fix/#2980
fix: #2980, locale=all was not iterating through arrays / blocks
2023-07-10 13:32:25 -04:00
James
d6bfba72a6 fix: #2980, locale=all was not iterating through arrays / blocks 2023-07-10 11:47:34 -04:00
PatrikKozak
2b0f65a27f docs: fixes admin panel table (#2986) 2023-07-10 10:16:25 -04:00
Jarrod Flesch
4b60845c67 chore: fix auth example protectRoles function 2023-07-07 12:42:27 -04:00
Jessica Boezwinkle
562cd18622 docs: adds authentication video 2023-07-07 17:05:35 +01:00
Jarrod Flesch
584d865d34 chore: improves error messaging for not found collections (#2982) 2023-07-07 11:56:14 -04:00
Jarrod Flesch
5b7756e266 chore: fixes auth example protectRoles function 2023-07-07 11:34:19 -04:00
Jacob Fletcher
cfeeb9758f chore: adds eject script to custom server example (#2979) 2023-07-06 16:36:22 -04:00
Jacob Fletcher
51058f65e5 chore: builds auth example for next.js app router (#2976) 2023-07-06 14:15:28 -04:00
Jacob Fletcher
6bc4dde23c chore: builds preview example for next.js app router (#2718) 2023-07-06 13:18:31 -04:00
PatrikKozak
40d6fe0b09 chore: adjusts custom components docs (#2908) 2023-07-05 17:33:29 -04:00
Jacob Fletcher
9881d322f3 docs: fixes misc cloud typos (#2975) 2023-07-05 16:31:51 -04:00
Dan Ribbens
1877d2247c fix: anchor Button component respect margins (#2648) 2023-07-05 16:20:25 -04:00
Dan Ribbens
1bf81f56ce chore(release): v1.11.0 2023-07-05 16:15:29 -04:00
Jarrod Flesch
606c3cf021 Merge branch 'master' of https://github.com/payloadcms/payload 2023-07-05 15:26:15 -04:00
Jarrod Flesch
d112159d93 docs: fix mdx formatting 2023-07-05 15:26:10 -04:00
Jacob Fletcher
79393e8cf0 fix: properly threads custom react-select props through relationship field (#2973) 2023-07-05 15:11:46 -04:00
Jarrod Flesch
5b79067cc1 fix: ensures fields within blocks respect field level access control (#2969) 2023-07-05 14:41:39 -04:00
Jessica Chowdhury
04851d0dc9 fix: ensures rows always have id's (#2968)
Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
2023-07-05 14:40:50 -04:00
Elliot DeNolf
7c47e4b0d3 feat: improve typing of ExtendableError and APIError (#2864) 2023-07-05 13:39:29 -04:00
Alessio Gravili
b734a1c422 feat: narrow endpoint.method type (#1880)
Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
2023-07-05 13:20:56 -04:00
Jacob Fletcher
9b22c4b654 docs: fixes misc links (#2971) 2023-07-05 12:02:56 -04:00
Elliot DeNolf
03c2b36b84 chore: move cross-env to runtime dep (#2970) 2023-07-05 11:58:19 -04:00
Elliot DeNolf
868823d9e1 chore(templates): change user collection to default access (#2972) 2023-07-05 11:58:07 -04:00
Jessica Boezwinkle
365b91e1b4 docs: misc cloud updates 2023-07-05 16:52:03 +01:00
Jessica Chowdhury
221356f6b9 Merge pull request #2956 from payloadcms/docs/cloud
docs: adds Cloud docs
2023-07-05 16:22:26 +01:00
Jessica Boezwinkle
1db1de1116 docs: misc tweaks to cloud docs 2023-07-05 16:21:22 +01:00
Jessica Chowdhury
801f60939b fix: nested richtext bug and test (#2966)
* fix: nested richtext bug and test

* chore: fix accidentally deleted character
2023-07-05 09:06:02 -04:00
Tylan Davis
dfdd334d16 docs: adds Cloud docs 2023-06-30 19:07:48 -04:00
Jacob Fletcher
a8e47088bb chore: adds front-end to ecommerce template (#2942) 2023-06-30 17:36:58 -04:00
Alessio Gravili
29d8bf0927 fix: GraphQL type for number field (#2954) 2023-06-30 22:52:35 +02:00
Jacob Fletcher
8a32909dcd chore: fixes tsconfig and nodemon in custom server example (#2952) 2023-06-30 11:53:50 -04:00
James
c0eed02924 chore(release): v1.10.5 2023-06-30 10:29:45 -04:00
Alessio Gravili
1d4df99ea7 fix: improve versions test suite (#2941)
* fix: versions test

* fix: restore tests not being effective

* make tests better

* new test: should versions be in correct order
2023-06-30 15:35:59 +02:00
Jarrod Flesch
b36deb4640 fix: incorrect graphql type generation (#2898) 2023-06-30 08:54:19 -04:00
Alessio Gravili
0c2e41c4be fix: fields in drawer cannot be edited (#2949)
Fixes #2945
2023-06-30 14:43:47 +02:00
James
d9dd78ad00 chore(release): v1.10.4 2023-06-29 20:29:09 -04:00
James Mikrut
06711be846 Merge pull request #2939 from AlessioGr/locale-in-apiurl
feat: add locale to displayed API URL
2023-06-29 20:23:19 -04:00
James
bf0b114b70 chore(release): v1.10.3 2023-06-29 20:22:40 -04:00
James Mikrut
68b220ff73 Merge pull request #2943 from payloadcms/fix/#2937
fix: #2937, depth not being respected in graphql rich text fields
2023-06-29 20:13:32 -04:00
James
f84b4323e2 fix: #2937, depth not being respected in graphql rich text fields 2023-06-29 20:08:39 -04:00
Alessio Gravili
064af8acc7 add apiURL for globals 2023-06-29 17:42:49 +02:00
Alessio Gravili
b22d157bd2 feat: add locale to displayed API URL 2023-06-29 17:19:36 +02:00
Jacob Fletcher
0112f4c4ab chore: builds custom server example (#2920) 2023-06-28 16:35:41 -04:00
Jacob Fletcher
6670915323 chore: adds ecommerce template (#2929) 2023-06-28 12:51:17 -04:00
Jacob Fletcher
49f117e220 chore: adds website template (#2928) 2023-06-28 12:48:08 -04:00
James Mikrut
8df4b15116 Merge pull request #2927 from payloadcms/fix/show-updatedAt-date
fix: shows updatedAt date when selecting a version to compare
2023-06-28 12:03:37 -04:00
Jacob Fletcher
766b1b5286 chore: creates templates directory (#2921) 2023-06-28 11:20:59 -04:00
Tylan Davis
3c9dab3b9d fix: shows updatedAt date when selecting a version to compare from dropdown 2023-06-28 10:47:41 -04:00
James Mikrut
7d156ef555 Merge pull request #2910 from payloadcms/chore/error-messages
chore: improves error messaging in unlock/reset/forgot-password
2023-06-28 08:18:28 -04:00
James
1aa38f8fdd chore(release): v1.10.2 2023-06-26 17:58:23 -04:00
Jarrod Flesch
a2d9ef3ca6 fix: adjusts swc loader to only exclude non ts/tsx files - #2888 (#2907) 2023-06-26 13:53:08 -04:00
Jessica Boezwinkle
9fbd7476fb chore: improves error messaging in unlock/reset/forgot-password 2023-06-26 18:39:46 +01:00
Jarrod Flesch
f627277479 fix: correctly scopes data variable within bulk update - #2901 (#2904) 2023-06-26 11:56:53 -04:00
Jessica Chowdhury
0d17d4f38e Merge pull request #2903 from payloadcms/fix/autosave-localized-docs
fix: autosave on localized fields, adds test
2023-06-26 16:00:51 +01:00
Jessica Boezwinkle
7e98cf94f3 chore: remove comments from test 2023-06-26 16:00:21 +01:00
Jessica Boezwinkle
6893231f85 fix: autosave on localized fields, adds test 2023-06-26 15:27:30 +01:00
Elliot DeNolf
8206c0fe8b fix: safely check for tempFilePath when updating media document (#2899) 2023-06-23 15:35:12 -04:00
Teun Mooij
837dcccefe fix: broken export of entityToJSONSchema (#2894) 2023-06-22 16:21:37 -04:00
Dan Ribbens
3e05598b56 chore(release): v1.10.1 2023-06-22 14:38:28 -04:00
Dan Ribbens
8128de64df fix: Relationship hasMany and filterOptions fails above 10 items (#2891) 2023-06-22 14:28:03 -04:00
Jarrod Flesch
b83d788d3c fix: conditional fields perf bug - #2886 (#2890) 2023-06-22 13:51:24 -04:00
PatrikKozak
6e62aab66e Merge pull request #2817 from payloadcms/chore/api-keys-docs
Chore/api keys docs
2023-06-22 11:08:27 -04:00
PatrikKozak
5de3515fc8 chore: re-words portion of api key docs 2023-06-22 10:43:53 -04:00
PatrikKozak
65ac61f300 Merge branch 'master' of https://github.com/payloadcms/payload into chore/api-keys-docs 2023-06-22 10:10:28 -04:00
Jacob Fletcher
10b8d492b3 docs: vercel visual editing (#2883) 2023-06-21 17:56:54 -04:00
Jacob Fletcher
09c6cad3e8 fix: cutoff tooltips in relationship field (#2873) 2023-06-20 17:49:18 -04:00
Dan Ribbens
e4df1293d2 chore(release): v1.10.0 2023-06-20 17:19:31 -04:00
Dan Ribbens
ce84174554 fix: relationship field query pagination (#2871) 2023-06-20 17:03:40 -04:00
Jacob Fletcher
ba9d6336ac fix: mobile loading overlay width #2866 (#2867) 2023-06-20 16:05:48 -04:00
Jacob Fletcher
e90c2c4cb7 chore: simplifies relationship drawer field test (#2872) 2023-06-20 16:04:54 -04:00
Alessio Gravili
8f086e315c feat: hasMany for number field (#2517)
* added custom config extension points

* Added custom field to documentation

* fix: not building due to incorrect typings

* Upload dist

* point to number array test

* feat: hasMany for number field

* fix: types

* Fix: incorrectly styles input for hasMany

* Revert "point to number array test"

This reverts commit 5a5162a803.

* Revert "Merge branch 'production-with-custom' into number-hasmany-v2"

This reverts commit dfc3ac523e, reversing
changes made to a3b1b7dd67.

* test: adds test for numbers with hasMany

* test: add number field e2e

* Fix updated index.tsx

* Fix updated index.tsx

* chore: add jsDocs for hasMany property

* chore: rename isMultiText to isCreatable, as it makes more sense

* fix: incorrect double space in comments

* chore: rename onMultiTextChange to handleHasManyChange

* chore: improve ordering

* docs: add documentation for hasMany

* docs: add more jsdocs for number field

* fix: new value not transformed to number

* improve types

* fix: only allow numbers as input using filterOption

* fix: Option / value type breaking sortable selects

* fix: typings and add id for sorting

* add animation to react select

* undo transitions due to glitches

* fix: keyboard handler for select for empty input values

* fix: validation for hasMany numbers

* feat: perform validation in the filter as well

* attempt to fix duplicate key issue

* add todo

* remove console logs

* fix: stupid key warning

* fix: validation tests

* feat: add filterOption to keydown listener

* feat: numberOnly for react-select

* chore: improve variable naming

* fix: allow numbers for relationship value by stringifying those for sortable react-selects

* feat: generated types for hasMany number field

* graphql typings part 1

* graphql defaults type

* better typing for number in buildObjectType

* fix: default graphql type disregarding hasMany for relationship field

* feat: minRows and maxRows for hasMany numbers

* simplify joi schema

* working minRows and maxRows validation!

* jesus christ: fix incorrect translations for number & relationship fields for greaterThanMax and lessThanMin

* fix weird type error

* move validation tests to validations.spec.ts and fix them

* fix: make sure filterOption only passes a number array to validate function

* fix: adds missing dark-mode styles for version differences view (#2812)

Co-authored-by: Tylan Davis <tylan@Tylans-MacBook-Pro.local>

* fix: #2821 i18n ui field label (#2823)

* chore: version diff styles (#2824)

Co-authored-by: Tylan Davis <tylan@Tylans-MacBook-Pro.local>

* chore: remove --legacy-peer-deps from gh actions workflow (#2814)

* chore: removes cms text from instances of payload name (#2793)

* chore(release): v1.9.2

* chore: update changelog release notes v1.9.2

* chore: cleans up graphql-schema-gen test folder

* fix: adds custom property to ui field in joi validation (#2835)

* adjust validation

* improve isnumber function

* Update number.mdx

---------

Co-authored-by: Teun Mooij <tmooij@infinitaslearning.com>
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
Co-authored-by: Tylan Davis <89618855+tylandavis@users.noreply.github.com>
Co-authored-by: Tylan Davis <tylan@Tylans-MacBook-Pro.local>
Co-authored-by: Dan Ribbens <DanRibbens@users.noreply.github.com>
Co-authored-by: Jacob Fletcher <jacobsfletch@gmail.com>
Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
Co-authored-by: Jarrod Flesch <30633324+JarrodMFlesch@users.noreply.github.com>
2023-06-20 20:21:27 +02:00
Alessio Gravili
542b5362d3 fix: drawer fields are read-only if opened from a hasMany relationship (#2843) 2023-06-20 11:22:49 -04:00
Jacob Fletcher
8626dc6b1a fix: fields in relationship drawer not usable #2815 (#2870) 2023-06-20 11:21:23 -04:00
Alessio Gravili
a110ba2dc0 fix: drawer close on backspace (#2869) 2023-06-20 10:10:29 -04:00
James
85d2467d73 fix: #2831, persists payloadAPI through local operations that accept req 2023-06-19 15:57:04 -04:00
Dan Ribbens
99f38098dd fix: default sort with near operator (#2862) 2023-06-19 15:17:22 -04:00
James Mikrut
b1123a4978 Merge pull request #2856 from payloadcms/feat/conditional-logic-perf
feat: optimizes conditional logic performance
2023-06-19 15:03:50 -04:00
James
4af8d56479 chore: ensures conditions are run in all appropriate cases 2023-06-19 15:03:34 -04:00
digitaledge-git
16118960aa fix: near query sorting by distance and pagination (#2861) 2023-06-19 14:54:40 -04:00
James
2c5a737715 chore: fixes initial state for url field 2023-06-19 13:39:11 -04:00
James Mikrut
5fa77d40b9 Merge pull request #2858 from payloadcms/fix/#2842
fix: #2842, querying number custom ids with in
2023-06-19 11:18:58 -04:00
Alessio Gravili
e9106882f7 feat: automatically redirect a user back to their originally requested URL after login (#2838) 2023-06-19 11:15:58 -04:00
James Mikrut
42f0db4251 Merge pull request #2800 from AlessioGr/improve-error
chore: improve error message during webpack load
2023-06-19 11:13:42 -04:00
James Mikrut
c3533dac2a Merge pull request #2846 from dpnolte/chore/disable_eslint_for_generated_types
chore: disable eslint on generated types
2023-06-19 11:11:48 -04:00
James Mikrut
8d52e5f078 Merge pull request #2830 from payloadcms/chore/depth-docs
chore: updates depth docs with N + 1 concept
2023-06-19 11:10:08 -04:00
James
116e9ffe81 fix: #2842, querying number custom ids with in 2023-06-19 11:02:30 -04:00
James
967f217346 feat: optimizes conditional logic performance 2023-06-19 10:48:17 -04:00
James Mikrut
da2a94d0b2 Merge pull request #2850 from AlessioGr/fix-configToJSONSchema
fix: old entityToJSONSchema being exported
2023-06-19 10:28:02 -04:00
James Mikrut
6c2b726fe1 Merge pull request #2855 from payloadcms/fix/#2832
fix: #2832, slow like queries with lots of records
2023-06-19 10:18:49 -04:00
James
4dd703a6bf fix: slow like queries with lots of records 2023-06-19 10:13:47 -04:00
Alessio Gravili
762b572c51 configToJSONSchema 2023-06-18 17:24:58 +02:00
Derk Nolte
6ca371cb8b chore: disable eslint on generated types 2023-06-18 10:14:21 +02:00
Alessio Gravili
0d8d7f358d fix: deprecate min/max in exchange for minRows and maxRows for relationship field (#2826)
* fix: deprecate min/max in exchange for minRows and maxRows for relationship

* fix: update validations unit tests with minRows and maxRows

* fix: incorrect types

* move to sanitize
2023-06-18 02:09:30 +02:00
James
51c2ab1672 chore(release): v1.9.5 2023-06-16 17:41:40 -04:00
James
a88f86cc3f chore: ensures objectid within works properly 2023-06-16 17:37:15 -04:00
James
451c8c7548 chore(release): v1.9.4 2023-06-16 16:43:40 -04:00
James Mikrut
528645d407 Merge pull request #2791 from no-heroes/fix/pagination-false-totaldocs
fix: totalDocs is always 1 when using payload.find({ pagination: false })
2023-06-16 16:37:50 -04:00
James
70cf8487e7 chore(release): v1.9.3 2023-06-16 16:17:34 -04:00
James
aa09e566e0 Merge branch 'master' of github.com:payloadcms/payload 2023-06-16 15:50:16 -04:00
James
c3d6e1b490 fix: ensures relations to object ids can be queried on 2023-06-16 15:50:09 -04:00
Jarrod Flesch
6580f43e53 chore: relocates configToJSON alongside entityToJSON and fieldsToJSON (#2827) 2023-06-16 12:42:59 -04:00
Jarrod Flesch
56d7745139 fix: adds custom property to ui field in joi validation (#2835) 2023-06-16 09:09:31 -04:00
PatrikKozak
ee1c7db915 chore: updates depth docs with N + 1 concept 2023-06-15 16:59:27 -04:00
Jarrod Flesch
b682c76dc7 chore: cleans up graphql-schema-gen test folder 2023-06-15 09:54:53 -04:00
Dan Ribbens
0d035a9c23 chore: update changelog release notes v1.9.2 2023-06-14 11:33:07 -04:00
Dan Ribbens
8310950f7b chore(release): v1.9.2 2023-06-14 11:32:14 -04:00
Jacob Fletcher
120e2936fe chore: removes cms text from instances of payload name (#2793) 2023-06-14 10:31:29 -04:00
Alessio Gravili
884f7991c4 chore: remove --legacy-peer-deps from gh actions workflow (#2814) 2023-06-14 10:23:48 -04:00
Tylan Davis
9664e4b96f chore: version diff styles (#2824)
Co-authored-by: Tylan Davis <tylan@Tylans-MacBook-Pro.local>
2023-06-14 10:21:23 -04:00
Dan Ribbens
63cd7fbd0c fix: #2821 i18n ui field label (#2823) 2023-06-14 08:39:45 -04:00
Tylan Davis
346a48f871 fix: adds missing dark-mode styles for version differences view (#2812)
Co-authored-by: Tylan Davis <tylan@Tylans-MacBook-Pro.local>
2023-06-14 08:29:13 -04:00
Jessica Boezwinkle
8fe3e59e76 Merge branch 'docs/misc-updates' 2023-06-13 17:35:52 +01:00
Jessica Boezwinkle
74d6156e8d chore: adds credentials to rest api examples 2023-06-13 17:35:39 +01:00
PatrikKozak
e834424a4c Merge branch 'master' of https://github.com/payloadcms/payload into chore/api-keys-docs 2023-06-13 12:25:09 -04:00
PatrikKozak
465d8b0245 chore: updates authentication/api-keys docs 2023-06-13 12:25:02 -04:00
Jessica Boezwinkle
25e9c1a50a fix: adds async await to payload.init example 2023-06-13 17:02:35 +01:00
Jessica Boezwinkle
d601cdd29e fix: adds async await to payload.init example 2023-06-13 17:01:55 +01:00
Jessica Chowdhury
5646ce9d8f Merge pull request #2810 from payloadcms/docs/blocks-table
docs: fix blocks table
2023-06-13 09:28:56 +01:00
Jessica Boezwinkle
f7cacbe932 docs: fix blocks table 2023-06-12 17:27:18 +01:00
Alessio Gravili
abe38520aa fix: user can be created without having to specify an email - #2801 2023-06-12 17:35:06 +02:00
Jarrod Flesch
46a5f41721 fix: sanitize reset password result - #2805 (#2808) 2023-06-12 11:23:24 -04:00
Alessio Gravili
2aea4150a0 improve error message 2023-06-10 21:53:30 +02:00
James
4b2b4c3f9f chore(release): v1.9.1 2023-06-09 16:18:47 -04:00
PatrikKozak
b655809903 Merge pull request #2797 from payloadcms/feat/customize-upload-filename
Feat/customize upload filename
2023-06-09 14:58:06 -04:00
PatrikKozak
2e60830f6a Merge branch 'master' of https://github.com/payloadcms/payload into feat/customize-upload-filename 2023-06-09 14:41:45 -04:00
PatrikKozak
752b5456b9 chore: updates test/uploads test to check for value not text 2023-06-09 14:28:27 -04:00
PatrikKozak
35f7677d48 chore: updates test/fields uploads test to check for value not text 2023-06-09 13:34:24 -04:00
PatrikKozak
a3b7da25bc Merge branch 'master' of https://github.com/payloadcms/payload into feat/customize-upload-filename 2023-06-09 12:39:01 -04:00
PatrikKozak
596eea1f0a feat: adds option to customize filename on upload 2023-06-09 12:38:53 -04:00
Jarrod Flesch
725aa3183d chore: stubs out config for field perf testing 2023-06-09 11:27:18 -04:00
Jarrod Flesch
cf49f53809 Merge remote-tracking branch 'origin' into feat/array-rows 2023-06-09 11:03:41 -04:00
Jarrod Flesch
20c7e37345 chore: block array fixes 2023-06-08 11:49:54 -04:00
Alessio Gravili
38e962f2cb feat: collection list view custom components: BeforeList, BeforeListTable, AfterListTable, AfterList (#2792) 2023-06-08 09:33:16 -04:00
Jarrod Flesch
3efb651589 chore: simplifies get/set doc prefs 2023-06-07 22:47:56 -04:00
Jarrod Flesch
589eb3fa15 chore: removes console logs, accounts for initCollapsed 2023-06-07 22:31:36 -04:00
Jarrod Flesch
87554e9b16 chore: builds rows on init, refactors preferences for documents 2023-06-07 22:21:08 -04:00
Richard van Heuven van Staereling
2e73938534 fix: incorrectly return totalDocs=1 instead of the correct count when pagination=false 2023-06-07 23:36:59 +02:00
Richard van Heuven van Staereling
acf2564c73 chore: adds test to check totalDocs count when querying with pagination=false 2023-06-07 23:36:51 +02:00
Dan Ribbens
91dba7be88 chore(release): v1.9.0 2023-06-07 16:59:38 -04:00
Elliot DeNolf
b49591c236 docs: add troubleshooting section, CORS troubleshoot (#2790) 2023-06-07 16:40:34 -04:00
Jarrod Flesch
8458a98eff feat: custom type interfaces (#2709)
* feat: ability to hoist type interfaces and reuse them

* docs: organizes ts and gql docs, adds section for field interfaces on both
2023-06-07 12:48:41 -04:00
Dan Ribbens
a518480292 chore(release): v1.8.6 2023-06-07 09:36:32 -04:00
Jarrod Flesch
a324feae9d chore: fixes graphql overview mdx file 2023-06-06 21:37:41 -04:00
Jarrod Flesch
551f1bd09f Merge remote-tracking branch 'origin/master' into feat/array-rows 2023-06-06 17:12:28 -04:00
Elliot DeNolf
d5dfe4224d test: entityToJSONSchema test for optional arrays with required fields 2023-06-06 16:35:36 -04:00
James
f1fc305ac4 fix: improperly typing optional arrays with required fields as required 2023-06-06 16:22:06 -04:00
Dan Ribbens
37ca5d827b chore: updated yarn lock 2023-06-06 15:20:14 -04:00
Jacob Fletcher
1aa257df4b chore: uses discord vanity urls (#2786) 2023-06-06 15:07:24 -04:00
Dan Ribbens
e4843061f0 Merge branch 'master' of github.com:payloadcms/payload 2023-06-06 14:50:33 -04:00
Alessio Gravili
3c72f3303c fix: read-only Auth fields (#2781) 2023-06-06 14:50:15 -04:00
Alessio Gravili
60f5522e67 fix: read-only Auth fields (#2781) 2023-06-06 14:50:03 -04:00
Dan Ribbens
576af01b6f fix: #2711 index sortable field global versions fields (#2775) 2023-06-06 14:46:14 -04:00
Dan Ribbens
8b767a166a fix: #2771 relationship field not querying all collections (#2774) 2023-06-06 14:26:13 -04:00
Jarrod Flesch
684c1a81a4 chore: exposes all operator in ts type (#2777) 2023-06-06 13:47:45 -04:00
Dan Ribbens
7a72f2f88d Merge branch 'master' of github.com:payloadcms/payload 2023-06-06 11:32:46 -04:00
James Mikrut
21ddcf07f7 Merge pull request #2779 from payloadcms/fix/#2767-bulk-operation-locales
fix: #2778 bulk operations missing locales in admin requests
2023-06-06 11:17:41 -04:00
James Mikrut
03b1ee0896 chore: remove passport local mongoose (#2713) 2023-06-06 10:07:47 -04:00
Dan Ribbens
e30871a96f fix: #2767 bulk operations missing locales in admin requests 2023-06-05 17:26:08 -04:00
Jacob Fletcher
3677cf688d fix: flattens relationships in the update operation for globals #2766 (#2776) 2023-06-05 17:22:57 -04:00
Jacob Fletcher
863be3d852 fix: adjusts activation constraint of draggable nodes (#2773) 2023-06-05 14:22:40 -04:00
Jarrod Flesch
2b4cf08f3a chore: combines array and block row state into array field attribute 2023-06-05 12:35:20 -04:00
Alessio Gravili
bd017bf56b chore: update launch config (#2772) 2023-06-05 12:22:58 -04:00
Alessio Gravili
ce7acff6d6 chore: add alternative vscode launch config (#2759) 2023-06-05 12:01:51 -04:00
Jarrod Flesch
536d7017ee fix: recursiveNestedPaths not merging existing fields when hoisting row/collapsible fields (#2769) 2023-06-04 08:49:23 -04:00
James
7c03e5510c chore(release): v1.8.5 2023-06-02 17:22:37 -07:00
James
ceb9b87783 Merge branch 'master' of github.com:payloadcms/payload 2023-06-02 17:02:29 -07:00
James
42afa6b48a feat: allows objectid through relationship validation 2023-06-02 17:02:10 -07:00
Dan Ribbens
3c7d57a73b chore: update changelog 2023-06-02 15:10:13 -04:00
Dan Ribbens
dcfd06c425 chore(release): v1.8.4 2023-06-02 15:08:08 -04:00
Alessio Gravili
23be263dd2 fix: RichText link custom fields (#2756)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-06-02 13:55:46 -04:00
Jarrod Flesch
f978299868 fix: graphql where types on rows and collapsible's (#2758)
Co-authored-by: Kári Yngvason <kari@hugsmidjan.is>
Co-authored-by: NikolaGanchev <62907292+NikolaGanchev@users.noreply.github.com>
Co-authored-by: James <james@trbl.design>
2023-06-02 13:50:19 -04:00
Jacob Fletcher
dbb0137ea0 chore: updates README 2023-06-02 12:12:29 -04:00
NikolaGanchev
51108c02ea feat: Add Bulgarian translation (#2753) 2023-06-01 18:43:17 -04:00
Alessio Gravili
69b97bbc59 fix: mongoose connection (#2754) 2023-06-01 12:03:47 -04:00
Dan Ribbens
f2399bc05a chore: fix bad merge 2023-05-31 15:56:57 -04:00
Dan Ribbens
93a85dd937 chore: allow custom mongourl during test (#2743)
Co-authored-by: swenzel <swen.wenzel@thearc.de>
Co-authored-by: PatrikKozak <patrik@trbl.design>
2023-05-31 15:51:49 -04:00
Jessica Chowdhury
8ee9724277 fix: fix locale popup overflow (#2737)
* fix: fix locale popup overflow

* chore: refines locale selector css

---------

Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
2023-05-30 15:49:30 -04:00
PatrikKozak
7c446ec71a Merge pull request #2636 from AlessioGr/test-console-log-admin-url
fix: console log correct admin URL for tests
2023-05-30 15:07:28 -04:00
Jessica Chowdhury
f2451d03c1 chore: formats filesize to KB in upload collection list view (#2734) 2023-05-30 14:45:12 -04:00
Jarrod Flesch
0986282f13 fix: adds timestamps to global schemas (#2738) 2023-05-30 14:37:43 -04:00
Jessica Chowdhury
d3638bcb24 Merge pull request #2730 from StLyn4/typing-fixes
fix: typing of sendEmail function
2023-05-30 18:45:39 +01:00
Jessica Chowdhury
f386d1caad Merge pull request #2731 from payloadcms/fix/2729-code-editor-options
fix: adjusts code field joi schema to allow editorOptions
2023-05-30 18:30:37 +01:00
Jacob Fletcher
480c7b3e21 Merge pull request #2736 from payloadcms/fix/use-as-title
fix: searches on correct useAsTitle field in polymorphic list drawers
2023-05-30 13:11:03 -04:00
Jacob Fletcher
908d5747a8 chore: allows super-admins to view as tenant in multi-tenant example (#2719) 2023-05-30 13:10:14 -04:00
Jacob Fletcher
9ec2a40274 fix: searches on correct useAsTitle field in polymorphic list drawers #2710 2023-05-30 12:41:28 -04:00
James Mikrut
a080a6294c Merge pull request #2733 from payloadcms/chore/ui-field-doc
chore: updates ui field docs to show admin.components.Field is required
2023-05-30 12:05:05 -04:00
PatrikKozak
9be854a1a4 chore: updates ui field docs to show admin.components.Field is required 2023-05-30 12:01:33 -04:00
Jacob Fletcher
c76dc77e64 chore: writes e2e test for list drawer useAsTitle search 2023-05-30 11:28:26 -04:00
Elliot DeNolf
a42f17ca41 chore: use Discord vanity URL 2023-05-30 09:57:02 -04:00
Jarrod Flesch
ed136fbc51 fix: adjusts code field joi schema to allow editorOptions 2023-05-30 08:56:37 -04:00
Vsevolod Volkov
e3ff4c46cb fix: typing of sendMail function
Signed-off-by: Vsevolod Volkov <st.lyn4@gmail.com>
2023-05-30 14:31:19 +03:00
Jacob Fletcher
6125b66286 fix: removes payload dependency inception (#2717) 2023-05-26 16:24:10 -04:00
Jarrod Flesch
8285bac2f5 fix: corrects relationship field schema from pr #2696 (#2714) 2023-05-26 11:03:02 -04:00
James Mikrut
61bb0fae53 fix: username / email inconsistency when creating new users
Fixed UserExistsError error message
2023-05-25 20:47:05 -04:00
Jessica Chowdhury
47b9af970b Merge pull request #2665 from payloadcms/example/emails
example: email
2023-05-25 18:22:45 +01:00
Jarrod Flesch
731c85337b chore: stop tests from re-running when a PR body is edited (#2712) 2023-05-25 09:28:02 -04:00
James Mikrut
4b59fda56f Merge pull request #2708 from payloadcms/jmikrut-patch-1
Update overview.mdx
2023-05-24 15:16:53 -04:00
James Mikrut
2361221198 Update overview.mdx 2023-05-24 15:16:14 -04:00
Dan Ribbens
d931ba9b50 chore: update changelog 2023-05-24 13:12:53 -04:00
Dan Ribbens
51fd1db4eb chore(release): v1.8.3 2023-05-24 12:00:55 -04:00
Dan Ribbens
dbd4dd215a chore: yarn lock 2023-05-24 11:44:31 -04:00
Jarrod Flesch
c716954e89 fix: adds credentials to doc access request (#2705) 2023-05-24 10:39:03 -04:00
TomDo1234
5be247da0a Merge branch 'master' of https://github.com/TomDo1234/payload 2023-05-24 07:18:27 +10:00
TomDo1234
b47e84369c fixed UserExistsError message to say email instead of username 2023-05-24 07:12:58 +10:00
TomDo1234
fe7ddf3e0f Merge branch 'master' of https://github.com/TomDo1234/payload 2023-05-24 06:42:46 +10:00
Jacob Fletcher
2fc9288870 feat: builds multi-tenant example (#2689)
* feat: builds multi-tenant example

* chore: updates seed script logic
2023-05-23 16:40:18 -04:00
Jarrod Flesch
f9de807daa Fix: correct graphql param types (#2696)
* chore: colocates gql schema field types with operators
* chore: adds missing `json` gql field schema
* fix: corrects graphql `id` type from JSON to String
2023-05-23 15:27:35 -04:00
Jacob Fletcher
e85ce4eaf2 Merge pull request #2694 from payloadcms/fix/rel-drawer-save
fix: add new relationship drawer onSave handling
2023-05-23 15:24:22 -04:00
Jacob Fletcher
5fc36333b9 Merge pull request #2699 from payloadcms/fix/mobile-rel
fix: unable to clear relationships or open relationship drawer on mobile
2023-05-23 15:24:01 -04:00
Jacob Fletcher
2809cb910c chore: fixes broken test for externally updated relationships 2023-05-23 10:37:52 -04:00
Jacob Fletcher
782f8ca047 fix: unable to clear relationships or open relationship drawer on mobile #2691 #2692 2023-05-23 10:08:16 -04:00
Quentin Beauperin
8bdbd6b073 docs: fix global hooks intro anchor links (#2695) 2023-05-23 09:31:22 -04:00
James Mikrut
7fbd5adaa2 Merge pull request #2687 from payloadcms/chore/install-doc-mongo-uri-secret
chore: updates installation doc to use envs in server.ts example
2023-05-23 08:46:20 -04:00
James Mikrut
324ca171a3 Merge pull request #2693 from payloadcms/fix/2685-graphql-relations
Fix/2685 graphql relations
2023-05-23 08:37:53 -04:00
Jacob Fletcher
bbf114b822 chore: writes e2e test for relationships created using the document drawer 2023-05-22 23:59:09 -04:00
Jacob Fletcher
a2a8ac9549 fix: prevents add new relationship modal from adding duplicative values to the parent doc #2688 2023-05-22 18:01:23 -04:00
Jacob Fletcher
ae384306eb chore: threads operation through the default edit view onSave handler 2023-05-22 17:13:35 -04:00
James Mikrut
9c4e003315 Merge pull request #2690 from payloadcms/fix/#2662
fix: #2662, draft=true querying by id
2023-05-22 16:43:41 -04:00
James
9bb5470342 fix: #2685, graphql querying relationships with custom id 2023-05-22 16:40:24 -04:00
Elliot DeNolf
2f209e3e9b chore: recreate issue in test dir 2023-05-22 16:14:28 -04:00
James
314ddbd44c chore: tests 2023-05-22 15:50:54 -04:00
James
3b78ab04c7 fix: #2662, draft=true querying by id 2023-05-22 15:46:04 -04:00
Dan Ribbens
bb21f51f74 Merge branch 'fix/safely-validate-relationships' 2023-05-22 13:58:47 -04:00
Dan Ribbens
666c2383ba chore: lint fix 2023-05-22 13:58:25 -04:00
James
2703853edb fix: safely validates null relations 2023-05-22 13:46:11 -04:00
PatrikKozak
f728fca036 chore: updates installation doc to use envs in server.ts example 2023-05-22 11:29:41 -04:00
Dan Ribbens
368103d76d Merge branch 'master' of github.com:payloadcms/payload 2023-05-20 05:00:08 -04:00
Quentin Beauperin
3a2462baba docs: add missing admin.group property in configuration/globals (#2684) 2023-05-20 04:35:50 -04:00
Jessica Boezwinkle
bd2bfbbb93 docs: spacing fix on graphql docs 2023-05-19 16:59:23 +01:00
Jessica Boezwinkle
1300fc864c docs: additional params for find operation rest-api 2023-05-19 15:10:24 +01:00
Jessica Boezwinkle
ef2d17922b docs: adds rest-api examples for real this time 2023-05-19 14:49:06 +01:00
Dan Ribbens
b63dd40512 chore: release-it config update to include pre release on github 2023-05-18 12:00:49 -04:00
Quy Luong
fb82567f03 chore: fix and improve Vietnamese translation (#2651) 2023-05-18 11:57:22 -04:00
James Mikrut
b2c443e866 fix: #2647, slate not reinitializing after row change (#2653) 2023-05-18 11:56:25 -04:00
Jacob Fletcher
07d0324a6d Merge pull request #2677 from payloadcms/docs/node-version
docs: node version
2023-05-17 17:13:47 -04:00
Jacob Fletcher
c1e92ad27d fix: modal overflow caused by unused button tooltips (#2676) 2023-05-17 17:13:04 -04:00
Jacob Fletcher
28e481c2e2 Merge pull request #2656 from payloadcms/feat/peer-dep-conflicts
fix: peer dependencies
2023-05-17 17:12:39 -04:00
Jacob Fletcher
1ceea645b6 chore: replaces instances of the text Mongo with MongoDB 2023-05-17 16:35:55 -04:00
Jacob Fletcher
578e5e7e58 docs: updates node version requirement to v14 in installation docs 2023-05-17 16:29:03 -04:00
Jacob Fletcher
463d00732f chore: removes unused peer dependencies 2023-05-17 15:32:23 -04:00
Jacob Fletcher
698a8abe6e chore: fixes failing e2e test when searching within a relationship field 2023-05-17 12:25:24 -04:00
Roody
776877291f chore: Spelling and Grammar Fixes in German Translations (#2667) 2023-05-17 11:04:11 -04:00
Jacob Fletcher
1c25d965ac fix: react-select styles 2023-05-16 12:03:58 -04:00
Jessica Boezwinkle
bc41f81303 example: adds email example 2023-05-16 11:07:33 +01:00
Jarrod Flesch
648c38414e fix: disabled select fields 2023-05-15 16:49:40 -04:00
PatrikKozak
02b972e1ed fix: corrects sendEmail error logger (#2663) 2023-05-15 16:11:33 -04:00
Jacob Fletcher
dd38a08746 chore: bumps @trbl/eslint-config to v3.0.1 2023-05-12 17:50:29 -04:00
Jacob Fletcher
315b0059da chore: migrates to react-select v5.7.3 2023-05-12 17:50:24 -04:00
James
4d3ea70d2b chore: resolves all peer dep conflicts besides react-select 2023-05-12 11:50:05 -04:00
Dan Ribbens
29a0dcffc7 chore(release): v1.8.2 2023-05-10 18:44:00 -04:00
Dan Ribbens
1732bb877c fix: react webpack alias 2023-05-10 18:35:01 -04:00
Dan Ribbens
fc1fac08c8 chore(release): v1.8.1 2023-05-10 18:25:54 -04:00
Dan Ribbens
1d03de333c Revert "Merge pull request #2572 from wesdimiceli/fix/provide-plugin-package-resolution"
This reverts commit 4f5b811383, reversing
changes made to 776cad427d.
2023-05-10 18:12:39 -04:00
Dan Ribbens
74f086a460 Merge branch 'master' of github.com:payloadcms/payload 2023-05-10 15:00:02 -04:00
Dan Ribbens
6e93e3e25d chore: release v1.8.0 2023-05-10 14:45:42 -04:00
Jessica Boezwinkle
d53d0cb439 chore: updates payload version on example repos 2023-05-10 15:56:57 +01:00
Paul
3f185cb18b feat: export additional graphql types (#2610)
* Add paginatedType to graphQL on collections types

* Refactor config query and mutation extension into a reusable type

* Export paginatedListType and payload's version of graphql

* Revert prettier's automatic changes

* Fix requested changes

* Add additional documentation for extending GraphQL

* Add information about the resolver's first argument
2023-05-10 08:53:46 -04:00
Paul
7963e7540f fix: add dotenv.config() to test/dev.ts (#2646) 2023-05-10 08:47:22 -04:00
Angelo Bartolome
85316879cd feat: allow users to manipulate images without needing to resize them (#2574)
* Refactor imageResizer.ts to allow for keeping original size in certain cases

* revert new property for keeping desired size

* add unit tests for maintained image size feature
2023-05-10 08:44:53 -04:00
Jacob Fletcher
69c4760f37 chore: migrates react-router-dom to v5.1 (#2637) 2023-05-09 10:35:37 -04:00
Dan Ribbens
7d04cf14fb feat: add Arabic translations (#2641) 2023-05-09 10:15:23 -04:00
Quentin Beauperin
9072096495 fix: softens columns and filters pill colors (#2642) 2023-05-08 17:59:41 -04:00
Elliot DeNolf
f6cfe15807 Merge pull request #2639 from payloadcms/chore/eslint-config
chore: migrate eslint config
2023-05-08 17:03:29 -04:00
Elliot DeNolf
e1bad04279 chore: lint fix 2023-05-08 16:49:13 -04:00
Elliot DeNolf
dda3341537 chore: upgrade rules to latest eslint-plugin-jest 2023-05-08 16:33:58 -04:00
Elliot DeNolf
6e27795756 chore: migrate @trbl/eslint-config inline 2023-05-08 16:33:19 -04:00
Dennis Snijder
54fac4a5d7 fix: Row groups in tabs vertical alignment (#2593)
* fix: removes top padding from group in row

---------

Co-authored-by: PatrikKozak <patrik@trbl.design>
2023-05-08 15:55:12 -04:00
Alessio Gravili
2697974694 fix: fix tests by hard-coding the URL in the logger 2023-05-08 19:23:09 +02:00
Elliot Lintz
a9b5dffa00 feat: allow full URL in staticURL (#2562)
* feat: support full URL for upload.staticURL

* feat: Update documentation about upload.staticURL property

* feat: Add reproduction test for absolute staticURL
2023-05-08 13:17:16 -04:00
Alessio Gravili
095ccf7194 chore: set serverURL for tests 2023-05-08 19:04:27 +02:00
James Mikrut
4f5b811383 Merge pull request #2572 from wesdimiceli/fix/provide-plugin-package-resolution
fix: resolve process/browser package in webpack config
2023-05-08 12:52:55 -04:00
James Mikrut
776cad427d Merge pull request #2635 from payloadcms/fix/2611-nested-querying
fix: ensures nested querying works when querying across collections
2023-05-08 12:49:55 -04:00
Jarrod Flesch
d365ba5303 chore: fixes test 2023-05-08 12:24:24 -04:00
Jarrod Flesch
31c0ab7ab7 chore: strengthens int test 2023-05-08 12:22:08 -04:00
Jarrod Flesch
09974fa686 fix: ensures nested querying works when querying across collections 2023-05-08 12:20:06 -04:00
James Mikrut
03cbab6c08 Merge pull request #2548 from payloadcms/docs/upload-example
chore: adds export and fields to upload example
2023-05-08 11:51:44 -04:00
James Mikrut
bbe5bff389 Merge pull request #2625 from payloadcms/fix/#2608-custom-id-text-query
fix: query custom text id fields
2023-05-08 11:51:04 -04:00
James Mikrut
f857da964b Merge pull request #2632 from payloadcms/fix/graphql-type
fix: correct casing on graphql type
2023-05-08 11:50:42 -04:00
James Mikrut
d36916b400 Merge pull request #2631 from payloadcms/fix/uploading-webp
fix: webp upload formatting
2023-05-08 11:50:22 -04:00
James Mikrut
c0568f92e4 Merge pull request #2634 from payloadcms/fix/queryHiddenFields
Fix/query hidden fields
2023-05-08 11:49:22 -04:00
James Mikrut
b17891c170 Merge pull request #2633 from payloadcms/fix/upload-schema
fix: defaultValue missing from Upload field schema
2023-05-08 11:49:04 -04:00
James
164d6e93d0 Merge branch 'master' of github.com:payloadcms/payload 2023-05-08 10:27:04 -04:00
James
733ca324d2 chore: force aliases react to avoid invalid hook call 2023-05-08 10:26:57 -04:00
PatrikKozak
fb4f822d34 fix: removes queryHiddenFields from example Find operation 2023-05-08 09:56:32 -04:00
Jessica Boezwinkle
7b21eaf12d fix: defaultValue missing from Upload field schema 2023-05-08 14:55:51 +01:00
PatrikKozak
02a4e17e41 Merge branch 'master' of https://github.com/payloadcms/payload into fix/queryHiddenFields 2023-05-08 09:53:34 -04:00
PatrikKozak
5f30dbb1a5 fix: removes deprecated queryHiddenFIelds from local API docs 2023-05-08 09:53:27 -04:00
Jessica Boezwinkle
219f50b0bc fix: correct casing on graphql type 2023-05-08 14:45:42 +01:00
Jessica Boezwinkle
ccd6ca298e fix: webp upload formatting 2023-05-08 13:15:18 +01:00
Dan Ribbens
967f2ace0e fix: query custom text id fields 2023-05-06 21:25:41 -04:00
Dan Ribbens
2c36468431 chore(release): v1.7.5 2023-05-04 16:55:46 -04:00
Hristiyan Dodov
8dbf0a2bd8 fix: make incrementName match multiple digits (#2609) 2023-05-04 16:35:55 -04:00
Michel v. Varendorff
967899229f feat: collection admin.enableRichTextLink property (#2560) 2023-05-04 16:31:40 -04:00
Jarrod Flesch
1d58007606 feat: custom admin buttons (#2618)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-05-04 16:04:06 -04:00
Jarrod Flesch
56a1dee3d6 docs: fix ui field example code block config 2023-05-04 09:33:28 -04:00
Quentin Beauperin
28572a978e docs: add hideAPIURL to the collections and globals admin options (#2614)
* fix: add the missing `hideAPIURL` admin option in the collections docs

* fix: add the missing `hideAPIURL` admin option in the globals docs
2023-05-03 19:11:56 -04:00
Jarrod Flesch
acfb9bca45 Feat/custom admin buttons (#2613) 2023-05-03 17:21:38 -04:00
Jacob Fletcher
6f82cefdc5 chore: adds cloud messaging to example READMEs (#2612) 2023-05-03 11:14:11 -04:00
James
d0ea57120c chore(release): v1.7.4 2023-05-01 22:45:37 -04:00
Elliot DeNolf
277beb6587 chore: release-it verbose logging 2023-05-01 22:19:07 -04:00
Elliot DeNolf
802deaca03 fix: properly import SwcMinifyWebpackPlugin (#2600) 2023-05-01 22:00:56 -04:00
Dan Ribbens
3c6461f757 chore(release): v1.7.3 2023-05-01 17:27:29 -04:00
James Mikrut
a0bb13a412 fix: #2592, allows usage of hidden fields within access query constraints (#2599)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-05-01 17:15:14 -04:00
Elliot DeNolf
870838e756 feat: adjust stack trace for api error (#2598) 2023-05-01 16:50:48 -04:00
Jarrod Flesch
8f6f13dc93 fix: addds workaround for slate isBlock function issue (#2596) 2023-05-01 16:30:01 -04:00
Harrison-Blair
13179a9498 chore: misc documentation updates (#2589)
* chore: ensures example configs are being exported when necessary
* chore: adds note regarding updating of hidden fields

---------

Co-authored-by: Jessica Boezwinkle <jessica@trbl.design>
2023-05-01 16:28:13 -04:00
Dan Ribbens
0ba22c3aaf fix: query on id throws 500 (#2587) 2023-05-01 14:36:26 -04:00
Seied Ali Mirkarimi
311f77dd25 chore: translations fa.json (#2590)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-05-01 13:52:27 -04:00
Dan Ribbens
8382faa0af fix: bulk operations result type (#2588) 2023-05-01 13:46:17 -04:00
Dan Ribbens
9c5107e86d fix: timestamp queries (#2583) 2023-05-01 13:45:51 -04:00
Elliot DeNolf
14a6b40bcc chore: bump swc-minify-webpack-plugin (#2571) 2023-05-01 11:50:10 -04:00
Jarrod Flesch
07506ae4d9 Merge branch 'master' of https://github.com/payloadcms/payload 2023-04-28 10:17:45 -04:00
Jarrod Flesch
6abcca1215 chore: adds github-stars md file 2023-04-28 10:17:39 -04:00
Wes DiMiceli
02f27f3de6 fix: resolve process/browser package in webpack config 2023-04-27 12:38:49 -04:00
Paul
fbf3a2a1b4 feat: Add new translation for romanian language (#2556)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-04-26 17:18:09 -04:00
Seied Ali Mirkarimi
c80f68af94 feat: add persian translations (#2553)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-04-26 16:12:11 -04:00
Perry
85b3d579d3 feat: supports collection compound indexes (#2529)
Co-authored-by: Perry Li <yuanping.li@moblab.com>
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-04-26 11:11:01 -04:00
Michel v. Varendorff
bf6522898d feat: allow customizing the link fields (#2559) 2023-04-26 11:08:47 -04:00
Jarrod Flesch
ddb34c3d83 chore: recreates yarn lock file 2023-04-25 19:13:48 -04:00
James
010ea4305b chore(release): v1.7.2 2023-04-25 14:48:57 -04:00
James
c33b226660 chore: yarn 2023-04-25 14:41:26 -04:00
Martin Choutka
8670d387d6 Feat: blocks should only search on singular labels (#2479)
* Blocks now only search on singular labels

* Add types to getBlockLabel params

---------

Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
2023-04-25 11:40:50 -04:00
Jarrod Flesch
a684b8f8bf chore: bumps eslint and related dev deps (#2561) 2023-04-25 11:09:31 -04:00
Jessica Boezwinkle
8270d8a228 docs: typo on REST API page 2023-04-25 12:33:33 +01:00
James
48941dce07 chore: merge conflicts 2023-04-24 17:11:23 -04:00
Jacob Fletcher
d6aa06a8af Merge pull request #2551 from payloadcms/fix/doc-drawer-access
fix: document drawer access control
2023-04-24 16:56:17 -04:00
Jacob Fletcher
7a0511610e chore: prevents document drawer from making get request when creating new 2023-04-24 16:22:10 -04:00
Jacob Fletcher
451ffcd982 chore: adds testing coverage for document drawer access control 2023-04-24 15:32:45 -04:00
Jarrod Flesch
fb2fcf3f66 chore: reduce complexity of block modal state tracking 2023-04-24 15:24:45 -04:00
Jarrod Flesch
b97a0881f1 Merge branch 'master' of https://github.com/payloadcms/payload 2023-04-24 15:23:43 -04:00
James
f9b3486ed1 Merge branch 'master' of github.com:payloadcms/payload 2023-04-24 15:16:54 -04:00
James
8cc900e11f chore: merge conflicts 2023-04-24 15:16:46 -04:00
Jarrod Flesch
904c365b75 Fix/2535 upload field access (#2550) 2023-04-24 15:16:12 -04:00
Jessica Chowdhury
362a4ccece Merge pull request #2533 from mauricewegner/feat/rich-text-blockquote
feat: add rich-text blockquote toggle, change quote node type to blockquote
2023-04-24 19:19:28 +01:00
PatrikKozak
750c6c32fa Merge pull request #2499 from AlessioGr/fix-readonly-styles
fix: read-only styles for textArea and richtext
2023-04-24 14:05:59 -04:00
Jacob Fletcher
439caf815f fix: document drawer access control #2545 2023-04-24 13:44:13 -04:00
Steven Thompson
0406548fe6 feat(imageresizer): add trim options (#2073)
* freat(imageresizer): add trim options

* fix(imageresizer): check for trimOptions config key

* feat: add trimOptions to original file upload, add test config

* chore: adjust sharp file ref

---------

Co-authored-by: Steven Thompson <steven@teamtailor.com>
Co-authored-by: Elliot DeNolf <denolfe@gmail.com>
2023-04-24 13:09:04 -04:00
Jessica Boezwinkle
4fb8b0fa28 chore: updates richText docs 2023-04-24 17:58:49 +01:00
James Mikrut
a0fd26602e Merge pull request #2051 from R0bson/master
Fix read of undefined error when autosave enabled
2023-04-24 12:51:56 -04:00
James
6d8eafd072 Merge branch 'master' of github.com:payloadcms/payload into R0bson/master 2023-04-24 12:29:03 -04:00
James
286193b4ab chore: cleanup 2023-04-24 12:27:00 -04:00
Jarrod Flesch
1808a9b663 Merge branch 'master' of https://github.com/payloadcms/payload 2023-04-24 12:19:01 -04:00
PatrikKozak
0683dd22dd Merge pull request #2539 from DennisSnijder/fix/multivalue-draggable
Multi value Select draggable enhancement
2023-04-24 11:58:18 -04:00
Elliot Lintz
7fcde11fa0 fix: prevent floating point number in image sizes (#1935) 2023-04-24 11:19:26 -04:00
Elliot DeNolf
90dab3c445 fix: prevent sharp toFormat settings fallthrough by using clone (#2547) 2023-04-24 10:42:29 -04:00
Jessica Boezwinkle
e942a18e5a chore: adds export and fields to upload example 2023-04-24 15:32:52 +01:00
James Mikrut
d397fe9af7 Merge pull request #2531 from payloadcms/feat/expose-id-in-condition
feat: exposes id in conditional logic
2023-04-24 09:59:51 -04:00
James Mikrut
cf6f0bfb8b Merge pull request #2532 from payloadcms/fix/#2521
fix: #2521, graphql AND not working with drafts
2023-04-24 09:59:44 -04:00
James Mikrut
b628a19e35 Merge pull request #2542 from payloadcms/fix/localized-field-nonlocalized-project
fix: query localized fields without localization configured
2023-04-24 09:56:24 -04:00
Dan Ribbens
4592d981a7 chore: fields test user config regression 2023-04-21 23:31:43 -04:00
Dan Ribbens
f6db81e431 docs: add user to field conditional logic 2023-04-21 22:55:23 -04:00
Dan Ribbens
274edc74a7 feat: add user to field conditional logic 2023-04-21 22:50:47 -04:00
Dan Ribbens
12edb1cc4b fix: query localized fields without localization configured 2023-04-21 21:12:30 -04:00
Dennis Snijder
269b203ef8 Changed background for multi values on select boxes, added is-dragging property to the multi value select and applied a z-index while dragging 2023-04-21 20:23:13 +02:00
mauricewegner
ed230a42e0 feat: add rich-text blockquote element, change quote node type to blockquote 2023-04-20 21:52:05 +02:00
Elliot DeNolf
c251801b1a chore: proper url path for docker deployment 2023-04-20 13:38:22 -04:00
Elliot DeNolf
8c242450e5 docs: fix docker link from getting started page 2023-04-20 13:31:56 -04:00
James
e67ca20108 fix: #2521, graphql AND not working with drafts 2023-04-20 09:31:29 -05:00
James
c117b32147 feat: exposes id in conditional logic 2023-04-20 09:20:02 -05:00
Dan Ribbens
1c5737b68a chore: add graphql variable to collection-graphql test (#2525) 2023-04-19 09:48:31 -04:00
James
db7acb4edd chore(release): v1.7.1 2023-04-18 17:28:25 -04:00
James
72be80abc4 fix: graphql variables not being passed properly 2023-04-18 17:19:15 -04:00
Teun Mooij
023719d775 feat: configuration extension points
* added custom config extension points

* Added custom field to documentation

* fix deeprequired issue
2023-04-18 15:28:42 -04:00
James
431b04075f Merge branch 'master' of github.com:payloadcms/payload 2023-04-18 14:54:10 -04:00
James
5e02985206 fix: adds 'use client' for next 13 compatibility 2023-04-18 14:53:59 -04:00
Elliot DeNolf
b80478d4b4 chore: remove release script to prevent accidental releases 2023-04-18 09:26:41 -04:00
James
fc7fa8debd chore: changelog formatting 2023-04-17 21:53:04 -04:00
James
a4fd0df69c chore(release): v1.7.0 2023-04-17 21:47:24 -04:00
James
cb9ca3e4c9 chore: type fix 2023-04-17 21:40:56 -04:00
James
5a6447805f Merge branch 'master' of github.com:payloadcms/payload 2023-04-17 21:38:12 -04:00
James
52ae6f06a1 feat: exposes new replaceState form api 2023-04-17 21:38:06 -04:00
James Mikrut
799699894c Merge pull request #2518 from payloadcms/fix/#2494-excess-versions
fix: #2494, reduces versions caused by reverting to published with autosave: true
2023-04-17 20:24:58 -04:00
James
e0c0b2fdf6 fix: #2494, reduces versions caused by reverting to published with autosave: true 2023-04-17 20:23:56 -04:00
James Mikrut
506bf646ba Merge pull request #2515 from payloadcms/feat/abstract-query-engine
Feat/abstract query engine
2023-04-17 19:54:49 -04:00
James Mikrut
e6c94c4f36 Merge pull request #2511 from payloadcms/docs/user-token
docs: adds info on payload secret encryption
2023-04-17 19:40:39 -04:00
James
3f9bbe90bd fix: incorrect version defaults 2023-04-17 19:37:22 -04:00
Elliot DeNolf
042e58ea29 feat: support email configuration in payload config (#2485)
* feat: support email configuration in payload config

* feat: set email defaults if no email config

* chore: leftover line from testing

* feat: add warning if email configure in both init and config
2023-04-17 17:21:28 -04:00
James
7fa27686bb chore: clarity to secret key usage 2023-04-17 17:02:07 -04:00
James
e3e2d513df Merge branch 'docs/user-token' of github.com:payloadcms/payload into docs/user-token 2023-04-17 17:00:46 -04:00
James
086feafcb7 chore: cleans duplicative logic 2023-04-17 16:56:38 -04:00
Quentin Beauperin
f9b8e2dbc5 fix: hides preview button until document is saved #2476 (#2477)
Co-authored-by: Jacob Fletcher <jacobsfletch@gmail.com>
2023-04-17 16:55:17 -04:00
Jacob Fletcher
5eafbefa9f Merge pull request #2507 from payloadcms/fix/preview-null
feat: supports null preview url #2472
2023-04-17 16:54:41 -04:00
James
cfadaf781c chore: merge master 2023-04-17 16:50:46 -04:00
Jacob Fletcher
dab5481fc5 Merge pull request #2513 from payloadcms/fix/sidebar-spacing-2478
fix: sidebar spacing #2478
2023-04-17 16:46:37 -04:00
James
1a681dd97b chore: revises outdated tests 2023-04-17 16:46:08 -04:00
Jacob Fletcher
2074f63333 chore: corrects typo in queries overview documentation (#2475) 2023-04-17 16:45:03 -04:00
Dan Ribbens
959a5d78c7 chore: test coverage queries 2023-04-17 16:43:00 -04:00
James
995054d46b chore: adds tests to validate queries 2023-04-17 16:25:07 -04:00
James
d187b809d7 feat: refactors buildQuery to rely on fields instead of mongoose 2023-04-17 16:08:44 -04:00
Dan Ribbens
81d69d1b64 feat: add admin.hidden to collections and globals (#2487) 2023-04-17 15:21:42 -04:00
Elliot DeNolf
faef4d5f8e docs: export default typo 2023-04-17 14:12:33 -04:00
Dan Ribbens
cd548a6e2d feat: replace deprecated express-graphql dependency (#2484) 2023-04-17 13:48:14 -04:00
Jacob Fletcher
78316d4ddc chore: updates global versions test config 2023-04-17 13:43:31 -04:00
Jacob Fletcher
a45ab8bd76 fix: corrects sidebar spacing in collection and global edit views #2478 2023-04-17 13:39:16 -04:00
Jessica Boezwinkle
cd861c22b7 docs: adds info on payload secret encryption 2023-04-17 18:22:03 +01:00
Alessio Gravili
15442a9cc7 fix: use correct locale when querying relationships for list view (#2438)
* chore: use correct locale when querying relationship for list view

* chore: make sure the relationships are re-queried when the locale changes

* chore: cleans up localization test ts-types

---------

Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
2023-04-17 12:43:33 -04:00
Elliot DeNolf
3c04d43eae docs: add custom express middleware and logging example (#2509) 2023-04-17 11:52:09 -04:00
Jacob Fletcher
63e23bab89 chore: adds translations for error:previewing 2023-04-17 11:48:28 -04:00
Jacob Fletcher
e8a24fd2e5 feat: supports null preview url #2472 2023-04-17 11:41:00 -04:00
Elliot DeNolf
aee6ca05cc fix: proper height data for animated gifs (#2506) 2023-04-17 11:34:31 -04:00
Elliot Lintz
0f8051b577 fix: Clear blocks modal search input when closing the modal (#2501) 2023-04-17 11:26:36 -04:00
Elliot67
56d48885e1 :feat: Improve admin panel file's caching 2023-04-16 00:55:27 +02:00
Alessio Gravili
9d489ed57f actually no, background saves a few bytes 2023-04-15 19:48:28 +02:00
Alessio Gravili
ae88bade03 background => background-color 2023-04-15 19:47:31 +02:00
Alessio Gravili
4be43527e8 disable shadow for read-only textArea field 2023-04-15 19:46:06 +02:00
Alessio Gravili
823d0228c9 fix: read-only styles 2023-04-15 19:37:28 +02:00
James
2d0441a72e chore: begins work to build queries from fields instead of mongoose schema 2023-04-14 15:52:38 -04:00
Jessica Chowdhury
6ceb791891 fix: excess padding on textarea (#2488) 2023-04-13 11:56:04 -04:00
Jarrod Flesch
cd9e0400ac Merge branch 'master' of https://github.com/payloadcms/payload 2023-04-13 08:36:52 -04:00
PatrikKozak
b9a5bb3b8e Merge pull request #2289 from payloadcms/feat/form-builder-example
Feat/form builder example
2023-04-12 11:33:16 -04:00
PatrikKozak
1387ba9ae0 chore: updates form-builder-example nextjs README 2023-04-12 10:39:58 -04:00
PatrikKozak
3dd70483c6 Merge branch 'master' of https://github.com/payloadcms/payload into feat/form-builder-example 2023-04-11 10:49:31 -04:00
James Mikrut
ec2933c49a Merge pull request #2455 from payloadcms/chore/date-docs
chore: updates date field docs
2023-04-11 10:38:57 -04:00
James Mikrut
7eec16ee61 Merge pull request #2448 from AlessioGr/patch-4
docs: explain lifecycle of validate & beforeValidate
2023-04-11 10:38:24 -04:00
James Mikrut
ff89b8f782 Merge pull request #2464 from infonomic/docs/localization-warning
Docs/localization warning
2023-04-11 10:36:58 -04:00
James Mikrut
588a7d0a5b Update overview.mdx 2023-04-11 09:44:01 -04:00
Jessica Chowdhury
19ce0d79ef fix: increase line height for global title (#2465) 2023-04-10 15:42:11 -04:00
Jarrod Flesch
7f2c3d1d0a fix: uses docPermissions to show/hide x button on media collection doc fileDetails - #2428 2023-04-10 15:40:46 -04:00
Jarrod Flesch
13cc669e2c fix: prevents rendering of version actions when a user does not have permission 2023-04-10 15:38:49 -04:00
PatrikKozak
4d515a0d5b chore: improves text-area error rendering 2023-04-10 15:23:37 -04:00
Jacob Fletcher
11a6ce6d3a fix: properly awaits email send to catch potential errors #2444 (#2470) 2023-04-10 13:50:27 -04:00
Jarrod Flesch
048dd89bbc Merge branch 'master' of https://github.com/payloadcms/payload 2023-04-10 13:42:35 -04:00
Jarrod Flesch
48625e0e34 chore: general cleanup on useDocumentInfo hook usage 2023-04-10 13:27:29 -04:00
Anthony Bouch
013c96f0db docs: fixed sentance error in warning 2023-04-10 13:37:27 +07:00
Anthony Bouch
5fa8f69e10 docs: localization warning for existing data 2023-04-10 13:34:52 +07:00
Jessica Boezwinkle
fb89793703 docs: typo in date field and double link in textarea field 2023-04-06 11:35:15 +01:00
PatrikKozak
67098f7a3e chore: updates date field docs 2023-04-05 21:19:26 -04:00
James
299ae4fce5 chore(release): v1.6.32 2023-04-05 13:29:37 -04:00
James Mikrut
09ba58a432 Merge pull request #2454 from payloadcms/feat/only-use-sharp-if-required
feat: only uses sharp if required
2023-04-05 13:24:54 -04:00
James
f9f6ec47d9 feat: only uses sharp if required 2023-04-05 12:59:51 -04:00
Alessio Gravili
b76c25c9e7 docs: explain lifecycle of validate & beforeValida
Caused confusion here: https://discord.com/channels/967097582721572934/1091785894136139808/1092821186959921193

The initial expectation is that beforeValidate runs before any validation happens. However, it seems that client-side validation happens first nonetheless.

Please do check if this is 100% correct before merging.
2023-04-04 17:21:54 +02:00
James
192dac38f8 chore(release): v1.6.31 2023-04-04 08:25:51 -04:00
James
3a6acf322b fix: ensures select hasMany does not get mutated on patch operations 2023-04-04 08:16:10 -04:00
James
a9cd23a883 feat: improves required type accuracy 2023-04-03 22:30:24 -04:00
James
b6dec7af1c chore(release): v1.6.30 2023-04-03 16:14:20 -04:00
James Mikrut
546b7dc20a Merge pull request #2443 from payloadcms/fix/#2442-delete-local-type
fix: incorrect type local api using delete with where
2023-04-03 16:09:19 -04:00
James Mikrut
7cab14353d Merge pull request #2445 from payloadcms/fix/before-change-mutation
fix: originalDoc being mutated in beforeChange field hooks
2023-04-03 16:09:02 -04:00
James
888bbf28e0 fix: originalDoc being mutated in beforeChange field hooks 2023-04-03 15:27:59 -04:00
Dan Ribbens
de5ceb2aca fix: incorrect type local api using delete with where 2023-04-03 12:14:27 -04:00
Dan Ribbens
95719a978c chore(release): v1.6.29 2023-03-31 14:11:22 -04:00
Alessio Gravili
dd16bcffd2 chore: export formatListDrawerSlug (#2422) 2023-03-31 14:00:40 -04:00
Dan Ribbens
02410a0be3 fix: update and delete local API return types (#2434) 2023-03-31 13:58:54 -04:00
James
14f2fbbce7 chore(release): v1.6.28 2023-03-28 11:26:30 -04:00
James
8eea0d6cf4 fix: potential memory leak with probe-image-size 2023-03-28 11:21:56 -04:00
James
752a657a4f chore(release): v1.6.27 2023-03-27 18:05:23 -04:00
James
0ca5851a3c chore: roll back PR #2396 2023-03-27 18:01:40 -04:00
James Mikrut
4bb0bdc4e6 Merge pull request #2397 from zerovox/patch-2
Fix documented imports in the custom element examples
2023-03-27 16:46:27 -05:00
James Mikrut
6865634a6e Merge pull request #2396 from pascalgn/fix/admin-hidden-fields
fix: hide fields with admin.hidden attribute
2023-03-27 16:45:41 -05:00
James
07eb8dd7d2 fix: #2355, select field not fully visible on small screens in certain scenarios 2023-03-27 17:43:18 -04:00
James
789537cc8c docs: previousValue in afterChange field hook, fixes #2383 2023-03-27 16:28:43 -04:00
James
8bbb1a16e3 docs: adds pagination docs, fixes #2376 2023-03-27 16:23:57 -04:00
James
0ff81573b5 Merge branch 'master' of github.com:payloadcms/payload 2023-03-27 16:18:18 -04:00
James
90284ff626 docs: adds more clarity regarding dotenv, fixes #2378 2023-03-27 16:17:51 -04:00
James Mikrut
e4fc1ff47c Merge pull request #2402 from payloadcms/fix/textarea-overlap
fix: textarea field overlap in UI
2023-03-27 15:01:37 -05:00
James
73c7ba4fe5 Merge branch 'master' of github.com:payloadcms/payload 2023-03-27 15:39:57 -04:00
James
72a8b1eebe fix: #2384, preserves manually set verified from admin UI 2023-03-27 15:39:01 -04:00
James Mikrut
c14122a007 Merge pull request #2406 from payloadcms/docs/date-field
docs: expand on date field properties
2023-03-27 14:11:40 -05:00
James
6ca12b1cc0 fix: restoring version did not correctly create new version from result 2023-03-27 14:59:50 -04:00
Elliot DeNolf
e8dc7d462e fix: make update typing a deep partial (#2407) 2023-03-27 12:39:12 -04:00
Jessica Boezwinkle
c2ca499516 docs: update date field 2023-03-27 17:08:20 +01:00
Jessica Boezwinkle
1c8cf24ba6 fix: textarea field overlap in UI 2023-03-27 10:09:53 +01:00
ts
49e4e0c6e7 Fix AfterNavLinks too 2023-03-26 11:24:35 -06:00
ts
bc2e843a83 Fix CustomDefault example imports 2023-03-26 11:16:28 -06:00
Pascal
ad25b096b6 fix: hide fields with admin.hidden attribute 2023-03-26 12:57:06 +02:00
James
1b85f194c5 1.6.26 2023-03-24 13:54:57 -04:00
James
cffc9971c4 fix: order of afterDelete hook 2023-03-24 13:46:22 -04:00
Dan Ribbens
3a6a97618c chore(release): v1.6.25 2023-03-24 12:37:21 -04:00
Dan Ribbens
38e917a3df fix: upload field select existing file (#2392) 2023-03-24 12:19:37 -04:00
Dan Ribbens
3825041393 chore(release): v1.6.24 2023-03-23 13:15:50 -04:00
Dan Ribbens
0fedbabe9e feat: bulk-operations (#2346)
Co-authored-by: PatrikKozak <patrik@trbl.design>
2023-03-23 12:33:13 -04:00
Dan Ribbens
c5cb08c5b8 chore(release): v1.6.23 2023-03-22 14:29:45 -04:00
Jarrod Flesch
833899c893 chore: exposes AccessArgs export from payload/types 2023-03-22 13:22:11 -04:00
Jessica Chowdhury
1f480c4cd5 feat: exposes defaultSort property for collection list view (#2382) 2023-03-22 12:21:04 -04:00
Jarrod Flesch
b74a59947d chore: exports AccessArgs type for granular typing when imported 2023-03-22 11:58:23 -04:00
Dan Ribbens
21b8da7f41 fix: #2363 version tabs and select field comparisons (#2364) 2023-03-22 10:22:14 -04:00
fiona
fb2fd3e9b7 fix: DateField admin type (#2256) 2023-03-22 10:18:37 -04:00
Christian Gil
c0ff75c164 fix: Fix missing Spanish translations (#2372) 2023-03-22 10:17:47 -04:00
Dan Ribbens
e1a6e08aa1 fix: fallback to default locale showing on non-localized fields (#2316) 2023-03-22 10:16:54 -04:00
Jarrod Flesch
ac4cc5548a Update reproduction-guide.md 2023-03-21 23:40:18 -04:00
Jarrod Flesch
e0e1b09b77 chore: adds info in reproduction guide 2023-03-21 23:29:33 -04:00
Jarrod Flesch
fe86707c53 Chore/issue template (#2380) 2023-03-21 23:16:45 -04:00
Jarrod Flesch
2ed7e325b8 Issue template improvements (#2231) 2023-03-21 22:34:01 -04:00
PatrikKozak
e09ebfffa0 fix: allows base64 thumbnails (#2361) 2023-03-21 09:33:16 -04:00
Christian Gil
a8766d00a8 feat: adds title attribute to ThumbnailCard (#2368) 2023-03-20 23:15:03 -04:00
Jacob Fletcher
ef9606bf5b chore: retrofits formatUseAsTitle into ThumbnailCard #2270 (#2367) 2023-03-20 22:51:06 -04:00
Jacob Fletcher
10dd819863 fix: relationship field useAsTitle #2333 (#2350) 2023-03-20 22:21:49 -04:00
Jarrod Flesch
c14db9f94d chore: bumps slate and slate-react 2023-03-20 12:55:51 -04:00
Jarrod Flesch
c8594a7e7a chore: ensures code editor and loading shimmer use height from props 2023-03-20 12:06:36 -04:00
Jacob Fletcher
959567aade docs: middleware order #2327 (#2351) 2023-03-20 09:47:57 -04:00
Jarrod Flesch
7a8c7f3429 chore: ensures monaco editor loader is the same height as it's parent 2023-03-20 08:26:44 -04:00
James
4d578f1bfd fix: #2315 - deleting files if overwriteExistingFiles is true 2023-03-15 17:37:02 -04:00
Dan Ribbens
eabfd91655 chore(release): v1.6.22 2023-03-15 15:39:21 -04:00
Dan Ribbens
a4c6c4891e chore: update webpack dependencies 2023-03-15 15:28:16 -04:00
Dan Ribbens
11c15720d4 chore: update dependencies (#2326) 2023-03-15 14:36:56 -04:00
Franck Martin
24e92cfe69 add: missing french translations for rich-text link editor (#2322) 2023-03-15 14:12:02 -04:00
PatrikKozak
c0ab499a77 chore: adds max-width to confirmation message 2023-03-15 12:04:52 -04:00
PatrikKozak
abf74f1a90 Merge branch 'master' of https://github.com/payloadcms/payload into feat/form-builder-example 2023-03-15 11:58:48 -04:00
PatrikKozak
8e814b1edd chore: style refinements 2023-03-15 11:58:40 -04:00
James
4b243c9007 chore(release): v1.6.21 2023-03-15 10:34:47 -04:00
Jarrod Flesch
8d65ba1efd fix: hidden fields being mutated on patch (#2317) 2023-03-14 15:35:58 -04:00
Dan Ribbens
5f1b0c21eb chore(release): v1.6.20 2023-03-13 17:47:46 -04:00
Dan Ribbens
af164159fb fix: undefined point fields saving as empty object (#2313) 2023-03-13 17:34:51 -04:00
Elliot Lintz
39e303add6 fix: keep drop zone active when hovering inner elements (#2295) 2023-03-13 16:05:56 -04:00
Jarrod Flesch
9b5c889187 Merge pull request #2301 from payloadcms/fix/2270
fix: allow thumbnails in upload gallery to show useAsTitle value
2023-03-13 15:39:54 -04:00
Jarrod Flesch
dd9c15c672 chore: ensures block drawer thumbnail cards render a title properly 2023-03-13 15:26:10 -04:00
Jarrod Flesch
92e9602329 Merge pull request #2310 from payloadcms/fix/2292
fix: allows useListDrawer to work without collectionSlugs defined
2023-03-13 15:12:33 -04:00
James Mikrut
dbf976ee5e Merge pull request #2278 from wkillerud/fix/relationmap-undefined
fix: check relationships indexed access for undefined
2023-03-13 12:08:32 -07:00
James Mikrut
927b3fb6d3 Merge pull request #2291 from joas8211/feat/provide-refresh-permissions
feature: provide refresh permissions
2023-03-13 12:07:10 -07:00
James Mikrut
5e84ca3ce7 Merge pull request #2294 from Elliot67/fix/favicon-404
fix: Prevent browser initial favicon request
2023-03-13 12:05:26 -07:00
James Mikrut
3b2daa1992 Merge pull request #2296 from Firfi/master
chore: rename index.tsx of Pages collection of Preview example into index.ts
2023-03-13 12:04:54 -07:00
James Mikrut
a19c42f1bd fix: tooltip position #2108
fix: tooltip position #2108
2023-03-13 11:47:35 -07:00
PatrikKozak
fc82661b54 Merge pull request #2311 from payloadcms/fix/search-row-titles
Fix/search row titles
2023-03-13 14:46:09 -04:00
James Mikrut
4e95a39132 Merge pull request #2306 from payloadcms/fix/pagination-global-admin-type
Fix/pagination global admin type
2023-03-13 11:38:23 -07:00
PatrikKozak
5a637a8b09 Merge branch 'master' of https://github.com/payloadcms/payload into fix/search-row-titles 2023-03-13 14:30:05 -04:00
PatrikKozak
75e776ddb4 fix: flattens title fields to allow seaching by title if title inside Row field 2023-03-13 14:29:59 -04:00
Jessica Boezwinkle
e1553c2fc8 fix: allows useListDrawer to work without collectionSlugs defined 2023-03-13 18:23:58 +00:00
James Mikrut
db6d35bc03 Merge pull request #2308 from payloadcms/fix/#2265
fix: cancels existing fetches if new fetches are started
2023-03-13 11:19:45 -07:00
James
d5bf957c8e chore: only throws errors in usePayloadAPI if signal is not aborted 2023-03-13 13:54:58 -04:00
Jarrod Flesch
566c45b0b4 fix: ensures documentID exists in doc documentDrawers (#2304) 2023-03-13 12:06:07 -04:00
Jarrod Flesch
39ee306630 chore: adds duplicate caret to track intersection with 2023-03-13 12:04:26 -04:00
PatrikKozak
748475f785 Merge branch 'master' of https://github.com/payloadcms/payload into fix/pagination-global-admin-type 2023-03-13 11:41:58 -04:00
PatrikKozak
bf9929e9a9 fix: removes pagination type from top level admin config types 2023-03-13 11:41:50 -04:00
Jarrod Flesch
9aa1b8ec47 Merge remote-tracking branch 'origin/master' into fix/tooltip-position 2023-03-13 11:28:41 -04:00
James
ccc92fdb75 fix: cancels existing fetches if new fetches are started 2023-03-13 11:22:10 -04:00
James
657aa65e99 fix: removes forced require on array, block, group ts 2023-03-13 11:12:11 -04:00
James
abebde6b12 feat: exposes useTheme hook 2023-03-13 10:58:02 -04:00
Elliot Lintz
1df3d149e0 feat: #2280 Improve UX of paginator (#2293) 2023-03-13 10:12:41 -04:00
James Mikrut
8832d08a22 Merge pull request #2286 from payloadcms/fix/ui-columns
fix: renders presentational table columns
2023-03-13 06:52:07 -07:00
Jacob Fletcher
51dc66b5d9 poc: tooltip position #2108 2023-03-13 09:27:08 -04:00
Jessica Boezwinkle
aae6d716e5 fix: allow thumbnails in upload gallery to show useAsTitle value 2023-03-13 11:29:56 +00:00
Igor Loskutov
32b38439e3 chore: rename index.tsx of Pages collection of Preview example into index.ts 2023-03-12 16:08:50 +07:00
Elliot67
fd8ea88488 fix: Prevent browser initial favicon request 2023-03-12 00:09:07 +01:00
Jesse Sivonen
8d1df96637 docs: add refreshPermissions 2023-03-11 17:18:52 +02:00
Jesse Sivonen
c1f205c2cf test: refresh-permissions 2023-03-11 16:56:22 +02:00
Jesse Sivonen
e9c796e42c feat: provide refresh permissions for auth context 2023-03-11 16:56:01 +02:00
PatrikKozak
b459277c72 feat: updates form-builder example READMEs 2023-03-10 12:03:00 -05:00
PatrikKozak
28ecb0c5eb feat: migrates form builder example nextjs to examples 2023-03-10 11:50:41 -05:00
PatrikKozak
1356b4db40 chore: migrates form builder example cms to examples 2023-03-10 10:55:31 -05:00
Jacob Fletcher
4e1748fb8a fix: renders presentational table columns 2023-03-10 08:59:34 -05:00
William Killerud
959f01739c fix: check relationships indexed access for undefined 2023-03-09 15:09:09 +01:00
James
85dee9a7bc chore(release): v1.6.19 2023-03-08 16:40:05 -08:00
James
057522c5bd fix: ensures nested fields save properly within link, upload rte 2023-03-08 16:36:46 -08:00
James
9a8c6deafb chore(release): v1.6.18 2023-03-08 16:17:38 -08:00
James
7daddf864d fix: #2272, rich text within blocks causing crash on reorder 2023-03-08 16:07:08 -08:00
James
ef826c88ec fix: allows swc/register to transpile files above current workspace 2023-03-08 15:23:38 -08:00
Jarrod Flesch
42fbd96040 Fix/2254 swap relationship (#2261) 2023-03-07 14:27:44 -05:00
Jacob Fletcher
889a55ad99 Merge pull request #2260 from payloadcms/fix/table-column-prefs
fix: column preferences
2023-03-07 14:08:09 -05:00
Jacob Fletcher
3c205bcaba chore: writes e2e test for drawer column retention 2023-03-07 13:52:47 -05:00
Jacob Fletcher
a1ddd2e2e3 fix: table column preferences sync 2023-03-07 13:49:35 -05:00
Jacob Fletcher
5a07b788c7 Merge pull request #2258 from payloadcms/fix/table-columns-2257
Fix/table columns 2257
2023-03-07 10:53:05 -05:00
Jacob Fletcher
5d84a98d7b chore: writes e2e test for duplicative base fields 2023-03-07 10:34:21 -05:00
Jacob Fletcher
b92ad4a2d6 chore: writes e2e test for row fields as table columns 2023-03-07 10:34:12 -05:00
Jacob Fletcher
b10e842e89 fix: renders row fields as table columns #2257 2023-03-07 10:24:27 -05:00
James
bc7d4d8f0e chore(release): v1.6.17 2023-03-06 17:30:25 -05:00
James Mikrut
12c0e09c65 Merge pull request #2248 from payloadcms/fix/2218
Ensure empty objects are preserved within fields with sub schemas
2023-03-06 17:24:40 -05:00
Jarrod Flesch
c447421b05 chore: fixes outdated json field test 2023-03-06 17:06:37 -05:00
James Mikrut
0779f8d73d feat: improves ui performance with thousands of fields
* chore: progress to ui-performance

* chore: removes block load testing
2023-03-06 16:46:07 -05:00
Jarrod Flesch
ace032ef89 fix: minimize not set to false on all field type schemas 2023-03-06 16:08:03 -05:00
Jarrod Flesch
c5f9fa0d97 chore: adds test to empty json objects REST api 2023-03-06 12:27:26 -05:00
James Mikrut
ada9a89cd2 Merge pull request #2237 from payloadcms/feat/relationship-min-max-validation
feat: adds min and max options to relationship with hasMany
2023-03-06 11:48:20 -05:00
James Mikrut
27e538c8c6 Merge pull request #2216 from davidko604/versionsAllowDiskUse
Add allowDiskUse parameter for aggregate query for draft versions
2023-03-06 11:47:31 -05:00
James Mikrut
8bfe63d5b2 Merge pull request #2246 from payloadcms/fix/#2243
fix: Validate typescript signature
2023-03-06 11:39:27 -05:00
James Mikrut
65bbf54b4a Merge pull request #2223 from no-heroes/fix/chaining-hooks
Fix: when chaining hooks, afterRead does not take previous doc but original doc
2023-03-06 11:27:25 -05:00
James
8d31ed6d39 fix: Validate typescript signature 2023-03-06 11:24:36 -05:00
Dan Ribbens
a7f72babe1 test: fix validation options reuse 2023-03-04 16:57:02 -05:00
Dan Ribbens
87a60325cf docs: adds min and max options to relationship with hasMany 2023-03-04 16:23:28 -05:00
Dan Ribbens
0f38a0dcf6 feat: adds min and max options to relationship with hasMany 2023-03-04 16:12:07 -05:00
Jacob Fletcher
812ab9f868 fix: conditionally renders draggable pill (#2224) 2023-03-03 11:36:53 -05:00
Danilo Silva
ea893671d5 chore: refines portuguese translations (#2171) 2023-03-03 11:36:16 -05:00
Jacob Fletcher
474a3cbf7a fix: removes duplicative fields from table columns #2221 (#2226) 2023-03-03 11:35:38 -05:00
Jacob Fletcher
066f5f6d2c fix: versions table (#2235) 2023-03-03 11:23:16 -05:00
Richard van Heuven van Staereling
c661ac2e8a fix: pass result of previous hook into next hook 2023-03-02 17:05:25 +01:00
Richard van Heuven van Staereling
cb005d58eb chore: adds test cases for chaining hooks 2023-03-02 17:05:08 +01:00
Richard van Heuven van Staereling
6c82c1e04f chore: adds collection type to test chaining hooks 2023-03-02 17:04:37 +01:00
davidko604
feebf203b8 Update docs 2023-03-01 12:08:18 -08:00
davidko604
40033c64fb Add allowDiskUse parameter to draft versions aggregate query 2023-03-01 11:27:31 -08:00
Dan Ribbens
ffdbe3c965 Merge branch 'master' of github.com:payloadcms/payload 2023-03-01 12:12:32 -05:00
Dan Ribbens
6e740dbfc1 chore: changelog v1.6.16 2023-03-01 12:11:57 -05:00
Jessica Chowdhury
f6eb0202fe fix: virtual fields example (#2214) 2023-03-01 12:02:24 -05:00
Dan Ribbens
38aa4c45c4 chore: cleanup list unused list files (#2211) 2023-02-28 15:58:15 -05:00
Dan Ribbens
122aa94bdb chore: fix yaml indent (#2210) 2023-02-28 15:21:43 -05:00
PatrikKozak
5aa203d020 fix: redirects example (#2209) 2023-02-28 14:54:13 -05:00
James
aac066d609 chore: version bump 2023-02-28 14:10:37 -05:00
James
70fe14f7af Merge branch 'master' of github.com:payloadcms/payload 2023-02-28 14:10:21 -05:00
James
de2ae5ec15 chore: ensures data is passed to buildStateFromSchema 2023-02-28 14:06:13 -05:00
Jarrod Flesch
45b36ce56d chore: improves empty object json field tests (#2207) 2023-02-28 10:51:38 -05:00
James Mikrut
f7a2ae7e55 Merge pull request #2206 from payloadcms/fix/2189-empty-json
fix: allows empty objects to be retained in db
2023-02-28 10:45:46 -05:00
Jarrod Flesch
0247e2d106 fix: allows empty objects to be retained in db 2023-02-28 10:40:21 -05:00
James Mikrut
237aff9c85 Merge pull request #2200 from payloadcms/fix/#2179
fix: #2179, async default values resetting form state
2023-02-28 09:52:00 -05:00
James Mikrut
51911cdfdf Merge pull request #2196 from payloadcms/fix/#2193-globals-publish
fix: globals publish after draft
2023-02-28 09:51:26 -05:00
James
f64b2b1321 chore: adds back 14.x 2023-02-28 09:47:46 -05:00
James
8caedb19dd Merge branch 'master' of github.com:payloadcms/payload into fix/#2179 2023-02-28 09:47:20 -05:00
Jacob Fletcher
e2c65e3fa5 feat: drag-and-drop columns (#2142) 2023-02-28 09:35:03 -05:00
Jacob Fletcher
523d9d4952 fix: renders rte upload drawer #2178 2023-02-28 09:08:16 -05:00
Dan Ribbens
4cd228a367 chore: split getLatestEntityVersion to separate globals and collections 2023-02-28 09:03:28 -05:00
Dan Ribbens
44651e6ecc fix: globals publish after draft 2023-02-28 09:03:28 -05:00
Elliot DeNolf
b0b82e1f57 ci: playwright artifacts (#2201)
* ci: playwright report

* chore: update playwright report location

* ci: trace file only on failure

* ci: reduce test timeout

* test: up the rateLimit
2023-02-27 21:58:11 -05:00
James
619b49f6f1 chore: attempts to remove node 14.x 2023-02-27 18:18:10 -05:00
James Mikrut
ce3bb96ff7 Merge pull request #2198 from payloadcms/fix/drafts-enabled-validation
fix: skips field validation on submit if skipValidation is set to true
2023-02-27 17:04:05 -05:00
James
a4de51adaa fix: #2179, async default values resetting form state 2023-02-27 17:01:15 -05:00
James Mikrut
861a0fdff9 Merge pull request #2199 from payloadcms/fix/#2150-nth-level-querying
fix: #2150, can now query on N number of levels deep
2023-02-27 16:33:49 -05:00
James Mikrut
c1e8b20f1b Merge pull request #2197 from payloadcms/fix/animated-image-uploads
Fix/animated image uploads
2023-02-27 16:27:07 -05:00
James
ac54b11f9d fix: #2150, can now query on N number of levels deep 2023-02-27 16:17:44 -05:00
PatrikKozak
cf17760735 fix: skips field validation on submit if skipValidation is set to true 2023-02-27 15:35:52 -05:00
PatrikKozak
31488ffdd6 Merge branch 'master' of https://github.com/payloadcms/payload into fix/animated-image-uploads 2023-02-27 15:09:13 -05:00
PatrikKozak
8c4f890af0 fix: properly resizes animated images (#2181) 2023-02-27 15:09:06 -05:00
Elliot DeNolf
5ac436e184 fix: properly set req.payload on forgotPassword in local API (#2194) 2023-02-27 14:31:25 -05:00
Dan Ribbens
387cec9838 fix: clear relationship value (#2188) 2023-02-27 12:44:12 -05:00
Dan Ribbens
a3cc3c3429 fix: version comparison view errors on old select value (#2163) 2023-02-27 12:43:26 -05:00
James Mikrut
bf620fe16f Merge pull request #2172 from philipgher/patch-1
fix: add a mention to the possibility of accessing nested properties
2023-02-27 11:58:51 -05:00
zsoltsimon97
ebd16e8fdf feat: Add Hungarian Translations (#2169)
Co-authored-by: Zsolt Simon <zsolt.simon@telcotrend.hu>
2023-02-27 09:21:42 -05:00
philipgher
ee06515ca9 Update overview.mdx 2023-02-23 22:01:55 +01:00
James
d0abf19037 chore: skips flaky test 2023-02-22 14:03:33 -05:00
James
0d6a27cc69 chore: adds further safety to flaky test 2023-02-22 13:42:35 -05:00
James
164b868dc2 chore: attempts to resolve flaky test 2023-02-22 13:02:40 -05:00
James
c87fd2b649 fix: ensures sorting on drafts works in all cases 2023-02-22 11:09:01 -05:00
James
c4cc283bcd chore(release): v1.6.15 2023-02-21 18:18:32 -05:00
James
cbfabeeb9d chore: fixes bad import 2023-02-21 17:46:56 -05:00
James Mikrut
e84c43a4f6 Merge pull request #2158 from payloadcms/fix/#2092-use-facet-error
fix: mongoose connection error with useFacet
2023-02-21 17:36:49 -05:00
James
83720c8277 chore: adds 'use client' to withCondition 2023-02-21 17:31:59 -05:00
Dan Ribbens
5888fb9b3f fix: mongoose connection error with useFacet 2023-02-21 14:29:42 -05:00
Dan Ribbens
985eb59893 chore(release): v1.6.14 2023-02-21 10:07:11 -05:00
Dan Ribbens
2a4db3896e fix: #2117 collection pagination defaultLimit (#2147) 2023-02-21 09:41:34 -05:00
James Mikrut
9ea1512df9 Merge pull request #2149 from payloadcms/fix/#2148
fix: #2148, adds queryHiddenFields property to find operation
2023-02-20 21:16:27 -05:00
James
15b6bb3d75 fix: #2148, adds queryHiddenFields property to find operation 2023-02-20 21:15:06 -05:00
Christian Gil
d9d2b6c383 docs: Update uploads example based on Sharp types (#2129) 2023-02-20 14:29:28 -05:00
Dan Ribbens
8a8c392095 fix: #2091 admin translations for filter operators (#2143) 2023-02-20 13:54:43 -05:00
Dan Ribbens
b4a20741b2 fix: useFacet config option to disable $facet aggregation (#2141) 2023-02-20 13:54:12 -05:00
Dan Ribbens
007d38be04 chore: locking dependency for compatibility with node 16.x (#2146) 2023-02-20 13:52:50 -05:00
Jessica Chowdhury
40224ed1bc fix: checks locale is valid for monaco code editor (#2144) 2023-02-20 13:52:04 -05:00
Elliot DeNolf
f3f246848a docs: add example local api script 2023-02-20 11:09:22 -05:00
James Mikrut
a6917d8952 Merge pull request #2124 from jmas/patch-2
Fix table in `docs/admin/overview.mdx`
2023-02-20 10:29:16 -05:00
James Mikrut
a60b5acb65 Merge pull request #2140 from payloadcms/fix/#2131
fix: #2131, doesn't log in unverified user after resetting password
2023-02-19 22:12:47 -05:00
James
753de21b12 chore: improves reset password / verification workflow 2023-02-19 22:11:28 -05:00
James
3eb85b1554 fix: #2131, doesn't log in unverified user after resetting password 2023-02-19 22:06:39 -05:00
James Mikrut
7109bfde52 Merge pull request #2139 from payloadcms/fix/#2096
fix: #2096, allows custom ts paths with payload generate:types
2023-02-19 21:37:52 -05:00
James
686a616b4c fix: #2096, allows custom ts paths with payload generate:types 2023-02-19 21:37:10 -05:00
Elliot DeNolf
7e8869858c fix: generate proper json field type according to rfc (#2137) 2023-02-19 21:31:07 -05:00
James Mikrut
a16bad0cc0 Merge pull request #2136 from payloadcms/fix/#2134-rich-text-link-population
fix: #2134, allows links to be populated without having relationship or upload enabled
2023-02-19 21:18:27 -05:00
James
32a0778fc4 fix: #2134, allows links to be populated without having relationship or upload enabled 2023-02-19 21:17:25 -05:00
Jacob Fletcher
6a7663beb5 fix: removes custom header and gutter from rte link drawer #2120 (#2135) 2023-02-19 21:07:32 -05:00
Elliot DeNolf
06fc8cbf4d chore: sizes property optional on create graphql resolver 2023-02-19 21:04:41 -05:00
Daniel Söderling
79d047e64f fix: sizes property optional on upload (#2066)
* omit 'sizes' when uploading files from the inferred collection type

* cleanup

* optional sizes on create and update, instead of omitted
2023-02-19 21:02:37 -05:00
James
ab27b1bfd1 chore(release): v1.6.13 2023-02-18 11:01:39 -05:00
James
42ebf68932 fix: #2125, ensures createdAt and updatedAt are returned in update operations 2023-02-18 10:56:09 -05:00
James
5c5f1f9735 chore: inaccurate group field docs, fixes #2118 2023-02-18 09:33:31 -05:00
Alex Maslakov
3965613154 Fix table in docs/admin/overview.mdx
Found that table in docs Admin > Overview section is broken. I prepared a small fix.
2023-02-18 02:14:11 +02:00
James
8ac0906ff0 chore(release): v1.6.12 2023-02-17 17:07:34 -05:00
James
62879a5bc4 Merge branch 'master' of github.com:payloadcms/payload 2023-02-17 16:59:22 -05:00
James
ff4d1f6ac2 feat: separates admin root component from DOM render logic 2023-02-17 16:45:54 -05:00
James
1930bc260e fix: ensures only valid fields can be queried on 2023-02-17 16:45:18 -05:00
Jacob Fletcher
fa32c27716 feat: adds gql auth example (#2115) 2023-02-16 22:31:41 -05:00
Jacob Fletcher
ebdfd8f69a chore: adds @payloadcms/eslint-config to examples (#2112) 2023-02-16 15:10:41 -05:00
Jessica Chowdhury
2af0c04c8a feat: virtual fields example (#1990) 2023-02-16 10:26:25 -05:00
Jacob Fletcher
cfb3632cbc Merge pull request #2107 from payloadcms/feat/auth-example
feat: auth example
2023-02-16 10:24:36 -05:00
Jacob Fletcher
c076c77db4 feat: auth example 2023-02-15 18:49:08 -05:00
James
f9bcf359a1 chore(release): v1.6.11 2023-02-15 14:52:08 -05:00
James
bf2e5c70f8 Merge branch 'master' of github.com:payloadcms/payload 2023-02-15 14:46:29 -05:00
James
ad3141dc00 chore: updates types for passing async config to InitOptions 2023-02-15 14:46:21 -05:00
Jacob Fletcher
e0eb93bf83 Merge pull request #2105 from payloadcms/example/preview
feat: adds preview example
2023-02-15 14:39:34 -05:00
Jacob Fletcher
7a99b2544a chore: reviews preview example 2023-02-15 14:23:09 -05:00
Jarrod Flesch
2089136671 chore: improves test for max versions (#2102) 2023-02-15 13:10:07 -05:00
Jacob Fletcher
e36f775273 chore: writes test for existing upload deletion (#2103) 2023-02-15 11:39:13 -05:00
Jacob Fletcher
060c3805e5 fix: existing upload deletion #2098 (#2101) 2023-02-15 10:15:30 -05:00
Dan Ribbens
3c3e1f17ef chore(release): v1.6.10 2023-02-14 09:53:16 -05:00
James
8abc9cfbc7 Merge branch 'master' of github.com:payloadcms/payload 2023-02-14 09:40:40 -05:00
James
7bb0984a12 fix: validate type 2023-02-14 09:40:18 -05:00
Dan Ribbens
586b25a54c fix: #2077 useAPIKey UI missing with disableLocalStrategy (#2084) 2023-02-13 22:33:01 -05:00
PatrikKozak
c655ceac9e chore: richtext p tag reference (#2085) 2023-02-13 22:30:04 -05:00
Lucas Levin
d4c1e0deb0 docs: date field pickerAppearance defaults (#2086) 2023-02-13 21:46:30 -05:00
PatrikKozak
e2ed0ccaea chore: removes leftover p tag reference (#2081) 2023-02-13 16:27:18 -05:00
Jarrod Flesch
4999fbaee6 fix: globals not saving drafts unless published first (#2082) 2023-02-13 16:25:43 -05:00
Jarrod Flesch
f80ad26081 Merge pull request #2079 from payloadcms/fix/2064-createdAt-versions
fix: ensures versions createdAt matches the original doc
2023-02-13 15:30:04 -05:00
Christian Gil
b4a7e912b2 fix: Use the user's AdminUI locale for the DatePicker (#2046) (#2057)
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2023-02-13 14:47:26 -05:00
PatrikKozak
0a87f106ec feat: preview example (#1950) 2023-02-13 13:42:28 -05:00
Jacob Fletcher
b0a66ce6d8 chore: e2e tests for relationship default value (#2080) 2023-02-13 12:58:53 -05:00
Jarrod Flesch
8c7e37c56a fix: ensures versions createdAt matches the original doc 2023-02-13 11:03:12 -05:00
Jacob Fletcher
9f30553813 feat: async plugins (#2030)
* feat: async plugins

* wip: async config

* fix: async config
2023-02-13 10:46:55 -05:00
James Mikrut
11532857d2 Merge pull request #2070 from payloadcms/feat/rel-add-new
feat: allows control over relationship add new button
2023-02-13 10:43:56 -05:00
James Mikrut
c975a6c8ba Merge pull request #2061 from payloadcms/feat/export-more-errors
feat: export more errors
2023-02-13 09:30:08 -05:00
Jacob Fletcher
6096044fe0 feat: allows control over relationship add new button 2023-02-13 00:23:31 -05:00
Elliot DeNolf
3ebe7b4a7e docs: add docker link to deployment toc 2023-02-11 14:05:57 -05:00
Elliot DeNolf
a1fd1e07f0 docs: add an initial Basics section to talk about the dist and build directories 2023-02-11 14:03:36 -05:00
Jarrod Flesch
9029dab015 Merge pull request #2050 from behilam/fix/update-document-type
fix: Document type in collection update request handler
2023-02-10 22:41:09 -05:00
Jarrod Flesch
e9e084d933 Merge pull request #2059 from charkour/patch-2
docs: updates radio.mdx for better readability and consistency
2023-02-10 22:38:34 -05:00
Jarrod Flesch
93129f8989 Merge pull request #2060 from ChrisGV04/fix/es-translations
fix: add missing Spanish translations and fix typos
2023-02-10 22:34:43 -05:00
Jarrod Flesch
7e676b4b8d Merge pull request #2062 from nikolicstjepan/master
fix typo in Croatian translation
2023-02-10 22:33:08 -05:00
Stjepan Nikolic
f9cb02026e fix typo in croatian translation 2023-02-10 21:03:43 +01:00
Elliot DeNolf
3a2a41d2b6 feat: export more errors 2023-02-10 14:21:38 -05:00
Christian Gil
c4742e5c30 fix: Add missing Spanish translations and fix typos 2023-02-10 11:06:13 -06:00
Charles Kornoelje
55aec55ef2 Update radio.mdx 2023-02-10 11:54:30 -05:00
Charles Kornoelje
e072dad30c Update radio.mdx
Matches the pattern in the documentation of `title = {label} Field`
2023-02-10 11:50:51 -05:00
Robert
4c22b2a7d9 Fix read of undefined error when autosave enabled
Fixes ERROR (payload): TypeError: Cannot read properties of undefined (reading '<field.name>')
    at promise (...\payload\src\fields\hooks\afterChange\promise.ts:68:23)
    at ...\payload\src\fields\hooks\afterChange\traverseFields.ts:31:26
    at Array.forEach (<anonymous>)
    at traverseFields (...\payload\src\fields\hooks\afterChange\traverseFields.ts:30:10)
    at promise (...\payload\src\fields\hooks\afterChange\promise.ts:154:27)
    at ...\payload\src\fields\hooks\afterChange\traverseFields.ts:31:26
    at Array.forEach (<anonymous>)
    at traverseFields (...\payload\src\fields\hooks\afterChange\traverseFields.ts:30:10)
    at promise (...\payload\src\fields\hooks\afterChange\promise.ts:170:27)
    at ...\payload\src\fields\hooks\afterChange\traverseFields.ts:31:26
2023-02-09 22:26:26 +01:00
Behilam
d5cd9709f7 fix: document type in update request handler 2023-02-09 12:27:08 -05:00
TomDoFuture
5f620a2325 Upgraded the packages to latest minor versions where non breaking 2023-01-15 11:23:42 +11:00
TomDoFuture
01d1f43d45 Upgraded the packages to latest patch versions where non breaking 2023-01-15 11:20:10 +11:00
1907 changed files with 224688 additions and 18049 deletions

View File

@@ -11,7 +11,7 @@ module.exports = {
'@typescript-eslint',
],
extends: [
'@trbl',
'./eslint-config',
],
settings: {
'import/resolver': {

42
.github/ISSUE_TEMPLATE/1.bug_report.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Bug Report
description: Create a bug report for Payload
labels: ["possible-bug"]
body:
- type: markdown
attributes:
value: |
*Note:* Feature requests should be opened as [discussions](https://github.com/payloadcms/payload/discussions/new?category=feature-requests-ideas).
- type: input
id: reproduction-link
attributes:
label: Link to reproduction
description: Please add a link to a reproduction. See the fork [reproduction-guide](https://github.com/payloadcms/payload/blob/master/.github/reproduction-guide.md) for more information.
validations:
required: true
- type: textarea
attributes:
label: To Reproduce
description: Steps to reproduce the behavior, please provide a clear description of how to reproduce the issue, based on the linked minimal reproduction. Screenshots can be provided in the issue body below. If using code blocks, make sure that [syntax highlighting is correct](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#syntax-highlighting) and double check that the rendered preview is not broken.
validations:
required: true
- type: textarea
attributes:
label: Describe the Bug
validations:
required: true
- type: input
id: version
attributes:
label: Payload Version
description: What version of Payload are you running?
validations:
required: true
- type: markdown
attributes:
value: Before submitting the issue, go through the steps you've written down to make sure the steps provided are detailed and clear.
- type: markdown
attributes:
value: Contributors should be able to follow the steps provided in order to reproduce the bug.
- type: markdown
attributes:
value: These steps are used to add integration tests to ensure the same issue does not happen again. Thanks in advance!

View File

@@ -1,22 +0,0 @@
---
name: Bug Report
about: Create a bug report for Payload
labels: 'possible-bug'
---
# Bug Report
<!--- Provide a general summary of the issue in the Title above -->
## Steps to Reproduce
<!--- Steps to reproduce this bug. Include any code, if relevant -->
1.
2.
3.
## Other Details
<!--- Payload version, browser, etc -->
<!--- Possible solution if you're familiar with the code -->

View File

@@ -1,8 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Security Vulnerability
url: https://github.com/payloadcms/payload/blob/master/SECURITY.md
about: See instructions to privately disclose any security concerns
- name: Feature Request
url: https://github.com/payloadcms/payload/discussions
about: Suggest an idea to improve Payload in our GitHub Discussions

View File

@@ -2,15 +2,18 @@
<!-- Please include a summary of the pull request and any related issues it fixes. Please also include relevant motivation and context. -->
- [ ] I have read and understand the CONTRIBUTING.md document in this repository
- [ ] I have read and understand the [CONTRIBUTING.md](../CONTRIBUTING.md) document in this repository.
## Type of change
<!-- Please delete options that are not relevant. -->
- [ ] Chore (non-breaking change which does not add functionality)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Change to the [templates](../templates/) directory (does not affect core functionality)
- [ ] Change to the [examples](../examples/) directory (does not affect core functionality)
- [ ] This change requires a documentation update
## Checklist:

58
.github/reproduction-guide.md vendored Normal file
View File

@@ -0,0 +1,58 @@
# Reproduction Guide
1. [fork](https://github.com/payloadcms/payload/fork) this repo
2. run `yarn` to install dependencies
3. open up the `test/_community` directory
4. add any necessary `collections/globals/fields` in this directory to recreate the issue you are experiencing
5. run `yarn dev _community` to start the admin panel
**NOTE:** The goal is to isolate the problem by reducing the number of `collections/globals/fields` you add to the `test/_community` folder. This folder is _not_ meant for you to copy your project into, but rather recreate the issue you are experiencing with minimal config.
## Example test directory file tree
```text
.
├── config.ts
├── int.spec.ts
├── e2e.spec.ts
└── payload-types.ts
```
- `config.ts` - This is the _granular_ Payload config for testing. It should be as lightweight as possible. Reference existing configs for an example
- `int.spec.ts` [Optional] - This is the test file run by jest. Any test file must have a `*int.spec.ts` suffix.
- `e2e.spec.ts` [Optional] - This is the end-to-end test file that will load up the admin UI using the above config and run Playwright tests.
- `payload-types.ts` - Generated types from `config.ts`. Generate this file by running `yarn dev:generate-types _community`.
The directory split up in this way specifically to reduce friction when creating tests and to add the ability to boot up Payload with that specific config. You should modify the files in `test/_community` to get started.
<br />
## Testing is optional but encouraged
An issue does not need to have failing tests — reproduction steps with your forked repo are enough at this point. Some people like to dive deeper and we want to give you the guidance/tools to do so. Read more below:
### Running integration tests (Payload API tests)
First install [Jest Runner for VSVode](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner).
There are a couple ways run integration tests:
- **Granularly** - you can run individual tests in vscode by installing the Jest Runner plugin and using that to run individual tests. Clicking the `debug` button will run the test in debug mode allowing you to set break points.
<img src="https://raw.githubusercontent.com/payloadcms/payload/master/src/admin/assets/images/github/int-debug.png" />
- **Manually** - you can run all int tests in the `/test/_community/int.spec.ts` file by running the following command:
```bash
yarn test:int _community
```
### Running E2E tests (Admin Panel UI tests)
The easiest way to run E2E tests is to install
- [Playwright Test for VSCode](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright)
- [Playwright Runner](https://marketplace.visualstudio.com/items?itemName=ortoni.ortoni)
Once they are installed you can open the `testing` tab in vscode sidebar and drill down to the test you want to run, i.e. `/test/_community/e2e.spec.ts`
<img src="https://raw.githubusercontent.com/payloadcms/payload/master/src/admin/assets/images/github/e2e-debug.png" />
#### Notes
- It is recommended to add the test credentials (located in `test/credentials.ts`) to your autofill for `localhost:3000/admin` as this will be required on every nodemon restart. The default credentials are `dev@payloadcms.com` as email and `test` as password.

View File

@@ -2,62 +2,63 @@ name: build
on:
pull_request:
types: [opened, reopened, edited, synchronize]
types: [opened, reopened, synchronize]
push:
branches: ['master']
branches: ["master"]
jobs:
build_yarn:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
scope: '@payloadcms'
always-auth: true
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: yarn
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: yarn build
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
scope: "@payloadcms"
always-auth: true
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: yarn
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: yarn build
- name: Component Tests
run: yarn test:components
- name: Integration Tests
run: yarn test:int
- name: Component Tests
run: yarn test:components
- name: Integration Tests
run: yarn test:int
- name: Generate Payload Types
run: yarn dev:generate-types fields
- name: Generate Payload Types
run: yarn dev:generate-types fields
- name: Generate GraphQL schema file
run: yarn dev:generate-graphql-schema
- name: Generate GraphQL schema file
run: yarn dev:generate-graphql-schema graphql-schema-gen
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: E2E Tests
run: yarn test:e2e --bail
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: E2E Tests
run: yarn test:e2e --bail
- uses: actions/upload-artifact@v3
if: always()
with:
name: test-results
path: test-results/
retention-days: 30
# - uses: actions/upload-artifact@v2
# if: always()
# with:
# name: playwright-report
# path: playwright-report/
# retention-days: 30
install_npm:
runs-on: ubuntu-latest
strategy:
@@ -65,23 +66,23 @@ jobs:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
scope: '@payloadcms'
always-auth: true
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ env.cache-name }}-
${{ runner.os }}-npm-
${{ runner.os }}-
- run: npm install --legacy-peer-deps
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
scope: "@payloadcms"
always-auth: true
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ env.cache-name }}-
${{ runner.os }}-npm-
${{ runner.os }}-
- run: npm install
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

3
.gitignore vendored
View File

@@ -2,6 +2,7 @@ coverage
package-lock.json
dist
.idea
test-results
# Created by https://www.gitignore.io/api/node,macos,windows,webstorm,sublimetext,visualstudiocode
@@ -163,7 +164,7 @@ GitHub.sublime-settings
# CMake
cmake-build-debug/
# Mongo Explorer plugin:
# MongoDB Explorer plugin:
.idea/**/mongoSettings.xml
## File-based project format:

View File

@@ -1,16 +1,18 @@
{
"verbose": true,
"git": {
"commitMessage": "chore(release): v${version}",
"requireCleanWorkingDir": true
"requireCleanWorkingDir": false
},
"github": {
"release": true
},
"npm": {
"skipChecks": true
"skipChecks": true,
"tag": "payload-1"
},
"hooks": {
"before:init": ["yarn", "yarn clean", "yarn test"]
"before:init": ["yarn", "yarn clean"]
},
"plugins": {
"@release-it/conventional-changelog": {

View File

@@ -1,4 +1,5 @@
{
"verbose": true,
"git": {
"requireCleanWorkingDir": false,
"commit": false,
@@ -6,11 +7,11 @@
"tag": false
},
"github": {
"release": false
"release": true
},
"npm": {
"skipChecks": true,
"tag": "canary"
"tag": "payload-1"
},
"hooks": {
"before:init": ["yarn", "yarn clean", "yarn test"]

30
.vscode/launch.json vendored
View File

@@ -5,17 +5,25 @@
"version": "0.2.0",
"configurations": [
{
"type": "node",
"command": "yarn run dev _community",
"name": "Run Dev Community",
"request": "launch",
"name": "Launch Program",
"runtimeArgs": [
"-r",
"ts-node/register"
],
"args": [
"${workspaceFolder}/test/dev.ts",
"fields"
]
"type": "node-terminal",
"cwd": "${workspaceFolder}"
},
{
"command": "yarn run dev fields",
"name": "Run Dev Fields",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}"
},
{
"command": "yarn run dev versions",
"name": "Debug Versions",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}"
},
]
}
}

View File

@@ -1,72 +1,859 @@
## [1.15.10](https://github.com/payloadcms/payload/compare/v1.15.9...v1.15.10) (2025-03-10)
## [1.15.8](https://github.com/payloadcms/payload/compare/v1.15.7...v1.15.8) (2023-10-08)
### Bug Fixes
* secures the user response from the me auth route ([#3409](https://github.com/payloadcms/payload/issues/3409)) ([26939a3](https://github.com/payloadcms/payload/commit/26939a333135810f2eebd3ebaf05885d152f6f13))
## [1.15.7](https://github.com/payloadcms/payload/compare/v1.15.6...v1.15.7) (2023-10-02)
### Bug Fixes
* hotkey's pressed keys are not unset when window is not focused ([#3400](https://github.com/payloadcms/payload/issues/3400)) ([8586c85](https://github.com/payloadcms/payload/commit/8586c85fab3009a09be9bf86c22952f85aa0ad82))
## [1.15.6](https://github.com/payloadcms/payload/compare/v1.15.5...v1.15.6) (2023-09-13)
### Bug Fixes
* **#3289:** removes HMR plugin from prod webpack configs ([#3319](https://github.com/payloadcms/payload/issues/3319)) ([8ca67d5](https://github.com/payloadcms/payload/commit/8ca67d5aaa99f0f45eac56766fe42e07ab4a41f1)), closes [#3289](https://github.com/payloadcms/payload/issues/3289)
* fields with relationTo[] correctly load returned data from form submission ([#3317](https://github.com/payloadcms/payload/issues/3317)) ([096d337](https://github.com/payloadcms/payload/commit/096d33718d28cb5207027f6737982b29a0ced90d))
* greater than equal admin filter not working ([#3306](https://github.com/payloadcms/payload/issues/3306)) ([0bd3353](https://github.com/payloadcms/payload/commit/0bd335303dff71977b46b373fbee859d11c33337))
## [1.15.5](https://github.com/payloadcms/payload/compare/v1.15.4...v1.15.5) (2023-09-09)
### Bug Fixes
* corrects hasMany relationships within addFieldStatePromise ([#3300](https://github.com/payloadcms/payload/issues/3300)) ([a7d47c6](https://github.com/payloadcms/payload/commit/a7d47c627d064e92ca541f70caf0ff3d903b2d1d))
## [1.15.4](https://github.com/payloadcms/payload/compare/v1.15.3...v1.15.4) (2023-09-06)
### Bug Fixes
* **#3274:** sets full user data from fetchFullUser instead of partial jwt data ([#3279](https://github.com/payloadcms/payload/issues/3279)) ([cf12b5f](https://github.com/payloadcms/payload/commit/cf12b5fc703be6341b2b23efebd8aa85e8602567)), closes [#3274](https://github.com/payloadcms/payload/issues/3274)
* aligns depth behaviour between local api and admin panel ([#3276](https://github.com/payloadcms/payload/issues/3276)) ([5096c37](https://github.com/payloadcms/payload/commit/5096c378743f4c5eb5f4f2f7e67e5e206cc9da40))
* appends versions key to incoming where query ([#3287](https://github.com/payloadcms/payload/issues/3287)) ([9cd5e5a](https://github.com/payloadcms/payload/commit/9cd5e5aefaf0ee2af4f577da9578bb31bf4b0acb))
* change scoping of `force` parameter to prevent false negation; ([#3278](https://github.com/payloadcms/payload/issues/3278)) ([429a88a](https://github.com/payloadcms/payload/commit/429a88a5a18e8905c63dfe00b78b3e71d56758fd))
## [1.15.3](https://github.com/payloadcms/payload/compare/v1.15.2...v1.15.3) (2023-09-05)
### Bug Fixes
* draft globals always displaying unpublish button ([9bc072c](https://github.com/payloadcms/payload/commit/9bc072ccaf318c61b2c4e2a553604a24ff6a188e))
* globals not saving updatedAt and createdAt and version dates correctly ([9fbabc8](https://github.com/payloadcms/payload/commit/9fbabc8fd6a3bea5628bea8d0acc915ddb33bb5c))
### Features
* improves query speed for version enabled collections ([16e94d4](https://github.com/payloadcms/payload/commit/16e94d401bd7cb82de53142c5f9a325abd31a81a))
## [1.15.2](https://github.com/payloadcms/payload/compare/v1.15.1...v1.15.2) (2023-08-25)
## [1.15.1](https://github.com/payloadcms/payload/compare/v1.15.0...v1.15.1) (2023-08-25)
### Bug Fixes
* arrays in richtext uploads ([#3222](https://github.com/payloadcms/payload/issues/3222)) ([cb8e07f](https://github.com/payloadcms/payload/commit/cb8e07f85232a26c265872faf408644424312af6))
* correct out of order dark-mode color variables ([#3197](https://github.com/payloadcms/payload/issues/3197)) ([3a15e07](https://github.com/payloadcms/payload/commit/3a15e077c6914aba3ef26e453fee23c89f3db829))
* mutation type with tabs missing previous tabs ([#3196](https://github.com/payloadcms/payload/issues/3196)) ([6d3b863](https://github.com/payloadcms/payload/commit/6d3b8636f4e14a4e4155279353fa06e86fe2b25c))
# [1.15.0](https://github.com/payloadcms/payload/compare/v1.14.0...v1.15.0) (2023-08-24)
### Features
* query support for geo within and intersects + dynamic GraphQL operator types ([#3183](https://github.com/payloadcms/payload/issues/3183)) ([739abdc](https://github.com/payloadcms/payload/commit/739abdcd81176b3e812470eeea97b1be0d8c4a27))
# [1.14.0](https://github.com/payloadcms/payload/compare/v1.13.4...v1.14.0) (2023-08-16)
### Bug Fixes
* DatePicker showing only selected day by default ([#3169](https://github.com/payloadcms/payload/issues/3169)) ([edcb393](https://github.com/payloadcms/payload/commit/edcb3933cfb4532180c822135ea6a8be928e0fdc))
* only allow redirects to /admin sub-routes ([c0f05a1](https://github.com/payloadcms/payload/commit/c0f05a1c38fb9c958de920fabb698b5ecfb661f0))
* passes in height to resizeOptions upload option to allow height resize ([#3171](https://github.com/payloadcms/payload/issues/3171)) ([7963d04](https://github.com/payloadcms/payload/commit/7963d04a27888eb5a12d0ab37f2082cd33638abd))
* WhereBuilder component does not accept all valid Where queries ([#3087](https://github.com/payloadcms/payload/issues/3087)) ([fdfdfc8](https://github.com/payloadcms/payload/commit/fdfdfc83f36a958971f8e4e4f9f5e51560cb26e0))
### Features
* add afterOperation hook ([#2697](https://github.com/payloadcms/payload/issues/2697)) ([33686c6](https://github.com/payloadcms/payload/commit/33686c6db8373a16d7f6b0192e0701bf15881aa4))
* add support for hotkeys ([#1821](https://github.com/payloadcms/payload/issues/1821)) ([942cfec](https://github.com/payloadcms/payload/commit/942cfec286ff050e13417b037cca64b9d757d868))
* Added Azerbaijani language file ([#3164](https://github.com/payloadcms/payload/issues/3164)) ([63e3063](https://github.com/payloadcms/payload/commit/63e3063b9ecc1afd62d7a287a798d41215008f2a))
* allow async relationship filter options ([#2951](https://github.com/payloadcms/payload/issues/2951)) ([bad3638](https://github.com/payloadcms/payload/commit/bad363882c9d00d3c73547ca3329eba988e728ff))
* Improve admin dashboard accessibility ([#3053](https://github.com/payloadcms/payload/issues/3053)) ([e03a8e6](https://github.com/payloadcms/payload/commit/e03a8e6b030e82a17e1cdae5b4032433cf9c75a4))
* improve field ops ([#3172](https://github.com/payloadcms/payload/issues/3172)) ([d91b44c](https://github.com/payloadcms/payload/commit/d91b44cbb3fd526caca2a6f4bd30fd06ede3a5da))
* make PAYLOAD_CONFIG_PATH optional ([#2839](https://github.com/payloadcms/payload/issues/2839)) ([5744de7](https://github.com/payloadcms/payload/commit/5744de7ec63e3f17df7e02a7cc827818a79dbbb8))
* text alignment for richtext editor ([#2803](https://github.com/payloadcms/payload/issues/2803)) ([a0b13a5](https://github.com/payloadcms/payload/commit/a0b13a5b01fa0d7f4c4dffd1895bfe507e5c676d))
## [1.13.4](https://github.com/payloadcms/payload/compare/v1.13.3...v1.13.4) (2023-08-11)
### Bug Fixes
* correctly passes block path inside buildFieldSchemaMap ([#3162](https://github.com/payloadcms/payload/issues/3162)) ([3c60abd](https://github.com/payloadcms/payload/commit/3c60abd61aaf24d49712c80bcbd0f1113c22b85a))
## [1.13.3](https://github.com/payloadcms/payload/compare/v1.13.2...v1.13.3) (2023-08-11)
### Bug Fixes
* unable to add arrays inside secondary named tabs ([#3158](https://github.com/payloadcms/payload/issues/3158)) ([cb04d4a](https://github.com/payloadcms/payload/commit/cb04d4a82a68a764330582b93882d422b32c2527))
## [1.13.2](https://github.com/payloadcms/payload/compare/v1.13.1...v1.13.2) (2023-08-10)
## [1.13.1](https://github.com/payloadcms/payload/compare/v1.13.0...v1.13.1) (2023-08-08)
### Bug Fixes
* updates addFieldRow and replaceFieldRow rowIndex insertion ([#3145](https://github.com/payloadcms/payload/issues/3145)) ([f5cf546](https://github.com/payloadcms/payload/commit/f5cf546e1918de66998d5f0e5410bfbc1f054567))
# [1.13.0](https://github.com/payloadcms/payload/compare/v1.12.0...v1.13.0) (2023-08-08)
### Bug Fixes
* `setPreference()` return type ([#3125](https://github.com/payloadcms/payload/issues/3125)) ([463d6bb](https://github.com/payloadcms/payload/commit/463d6bbec66e61523bae3869df88bd98e7617390))
* absolute staticURL admin thumbnails ([#3135](https://github.com/payloadcms/payload/issues/3135)) ([1039f39](https://github.com/payloadcms/payload/commit/1039f39c09260537616b22228080466e8df6e981))
* adding and replacing similarly shaped block configs ([#3140](https://github.com/payloadcms/payload/issues/3140)) ([8e188cf](https://github.com/payloadcms/payload/commit/8e188cfe61db808c94d726967affdadf2e5abb9f))
### Features
* default tab labels from name ([#3129](https://github.com/payloadcms/payload/issues/3129)) ([e8f0516](https://github.com/payloadcms/payload/commit/e8f05165eb3a28c00deb11931db01ad1f8c75c74))
* radio and select fields are filterable by options ([#3136](https://github.com/payloadcms/payload/issues/3136)) ([b117e73](https://github.com/payloadcms/payload/commit/b117e7346434bfc8edbfa92f5db45f63c57bab08))
* recursive saveToJWT field support ([#3130](https://github.com/payloadcms/payload/issues/3130)) ([c6e0908](https://github.com/payloadcms/payload/commit/c6e09080767dad2ab8128ba330b2b344bb25ac6f))
# [1.12.0](https://github.com/payloadcms/payload/compare/v1.11.8...v1.12.0) (2023-08-04)
### Bug Fixes
* excludes useAsTitle field from searchableFields in collection view ([#3105](https://github.com/payloadcms/payload/issues/3105)) ([8c4d251](https://github.com/payloadcms/payload/commit/8c4d2514b0f195e0059c6063346199785979c70c))
* relationship field filter long titles ([#3113](https://github.com/payloadcms/payload/issues/3113)) ([da27a8a](https://github.com/payloadcms/payload/commit/da27a8aadbb103c5f6fe0ccc62c032876851b88f))
* wrong links in verification and forgot password emails if serverURL not set ([#3010](https://github.com/payloadcms/payload/issues/3010)) ([6a189c6](https://github.com/payloadcms/payload/commit/6a189c6548b233aba64598af8804a56ec47e45f0))
### Features
* add support for sharp resize options ([#2844](https://github.com/payloadcms/payload/issues/2844)) ([144bb81](https://github.com/payloadcms/payload/commit/144bb81721814c19eb4957d4c8fcc845c73e2aa4))
* allows for upload relationship drawer to be opened ([#3108](https://github.com/payloadcms/payload/issues/3108)) ([ea73e68](https://github.com/payloadcms/payload/commit/ea73e689ac46f2a7ba3b6c34e7a190944b5d5868))
* option to pre-fill login credentials automatically ([#3021](https://github.com/payloadcms/payload/issues/3021)) ([c5756ed](https://github.com/payloadcms/payload/commit/c5756ed4a13b46bc73ae7b23309d6e9980fc81bf))
* programmatic control over array and block rows inside the form ([#3110](https://github.com/payloadcms/payload/issues/3110)) ([a78c463](https://github.com/payloadcms/payload/commit/a78c4631b4aabb5b57448ab21ef98749b1cf1935))
* set JWT token field name with saveToJWT ([#3126](https://github.com/payloadcms/payload/issues/3126)) ([356f174](https://github.com/payloadcms/payload/commit/356f174b9ff601facb0062d0b65db18803ef2aa2))
## [1.11.8](https://github.com/payloadcms/payload/compare/v1.11.7...v1.11.8) (2023-07-31)
## [1.11.7](https://github.com/payloadcms/payload/compare/v1.11.6...v1.11.7) (2023-07-27)
### Bug Fixes
* [#3062](https://github.com/payloadcms/payload/issues/3062) ([0280953](https://github.com/payloadcms/payload/commit/02809532b484d9018c6528cfbbbb43abfd55a540))
* array row deletion ([#3062](https://github.com/payloadcms/payload/issues/3062)) ([cf9795b](https://github.com/payloadcms/payload/commit/cf9795b8d8b53c48335ff4c32c6c51b3de4f7bc9))
* incorrect image rotation after being processed by sharp ([#3081](https://github.com/payloadcms/payload/issues/3081)) ([0a91950](https://github.com/payloadcms/payload/commit/0a91950f052ce40427801e6561a0f676354a2ca4))
### Features
* ability to add context to payload's request object ([#2796](https://github.com/payloadcms/payload/issues/2796)) ([67ba131](https://github.com/payloadcms/payload/commit/67ba131cc61f3d3b30ef9ef7fc150344ca82da2f))
## [1.11.6](https://github.com/payloadcms/payload/compare/v1.11.5...v1.11.6) (2023-07-25)
### Bug Fixes
* **collections:admin:** Enable adminThumbnail fn execution on all types ([2c74e93](https://github.com/payloadcms/payload/commit/2c74e9396a216a033e2bacdf189b7f28a0f97505))
* threads hasMaxRows into ArrayAction components within blocks and arrays ([#3066](https://github.com/payloadcms/payload/issues/3066)) ([d43c83d](https://github.com/payloadcms/payload/commit/d43c83dad1bab5b05f4fcbae7d41de369905797c))
## [1.11.5](https://github.com/payloadcms/payload/compare/v1.11.4...v1.11.5) (2023-07-25)
### Bug Fixes
* admin route not mounting on production serve ([#3071](https://github.com/payloadcms/payload/issues/3071)) ([e718668](https://github.com/payloadcms/payload/commit/e71866856fffefcfb61dd3d29135cccb66939a62))
## [1.11.4](https://github.com/payloadcms/payload/compare/v1.11.3...v1.11.4) (2023-07-25)
### Bug Fixes
* if arrayFieldType rows are undefined, page would crash ([#3049](https://github.com/payloadcms/payload/issues/3049)) ([08377cc](https://github.com/payloadcms/payload/commit/08377cc5a7ea9d02350177e2e1d69390ee97af78))
### Features
* bump mongoose and mongoose-paginate versions ([#3025](https://github.com/payloadcms/payload/issues/3025)) ([41d3eee](https://github.com/payloadcms/payload/commit/41d3eee35f3855798a5c3372f8ad7c742a7810f7))
* improve keyboard focus styles ([#3011](https://github.com/payloadcms/payload/issues/3011)) ([080e619](https://github.com/payloadcms/payload/commit/080e6195ef39ec858fbb115e8f554a8dfc436438))
* solidifies bundler adapter pattern ([#3044](https://github.com/payloadcms/payload/issues/3044)) ([641c765](https://github.com/payloadcms/payload/commit/641c765fb921e162c98f09218929348037dd0f88))
## [1.11.3](https://github.com/payloadcms/payload/compare/v1.11.2...v1.11.3) (2023-07-19)
### Bug Fixes
* adds backdrop blur to button ([#3006](https://github.com/payloadcms/payload/issues/3006)) ([4233426](https://github.com/payloadcms/payload/commit/42334263bbc6219be92c5728f1a4ac6c8d2d1306))
* rich text link element not validating on create ([#3014](https://github.com/payloadcms/payload/issues/3014)) ([60fca40](https://github.com/payloadcms/payload/commit/60fca40780d4ddd8e684a455de55c566ec91e223))
### Features
* auto-login in config capability ([#3009](https://github.com/payloadcms/payload/issues/3009)) ([733fc0b](https://github.com/payloadcms/payload/commit/733fc0b2d0cf0f2d58c8a28e84776f883774b0e0))
* returns queried user alongside refreshed token ([#2813](https://github.com/payloadcms/payload/issues/2813)) ([2fc03f1](https://github.com/payloadcms/payload/commit/2fc03f196e4e5fa0ad3369ec976c0b6889ebda88))
* support logger destination ([#2896](https://github.com/payloadcms/payload/issues/2896)) ([cd0bf68](https://github.com/payloadcms/payload/commit/cd0bf68a6150b1adbdb9ee318ac0a06c4476aa4d))
## [1.11.2](https://github.com/payloadcms/payload/compare/v1.11.1...v1.11.2) (2023-07-14)
### Features
* adds array, collapsible, tab and group error states ([4925f90](https://github.com/payloadcms/payload/commit/4925f90b5f5c8fb8092bf4e8d88d5e0c1846b094))
## [1.11.1](https://github.com/payloadcms/payload/compare/v1.11.0...v1.11.1) (2023-07-11)
### Bug Fixes
* [#2980](https://github.com/payloadcms/payload/issues/2980), locale=all was not iterating through arrays / blocks ([d6bfba7](https://github.com/payloadcms/payload/commit/d6bfba72a6b1a84bc5bb9dd14c7ce31d7afcbc1c))
* anchor Button component respect margins ([#2648](https://github.com/payloadcms/payload/issues/2648)) ([1877d22](https://github.com/payloadcms/payload/commit/1877d2247c89ca5c8e1f0e1f989154d54768fed8))
# [1.11.0](https://github.com/payloadcms/payload/compare/v1.10.5...v1.11.0) (2023-07-05)
### Bug Fixes
* ensures fields within blocks respect field level access control ([#2969](https://github.com/payloadcms/payload/issues/2969)) ([5b79067](https://github.com/payloadcms/payload/commit/5b79067cc14874abbd1e1a5b6e619d41571b187f))
* ensures rows always have id's ([#2968](https://github.com/payloadcms/payload/issues/2968)) ([04851d0](https://github.com/payloadcms/payload/commit/04851d0dc99e4a3df0a1ac642e9a4b9a3c06d8a1))
* GraphQL type for number field ([#2954](https://github.com/payloadcms/payload/issues/2954)) ([29d8bf0](https://github.com/payloadcms/payload/commit/29d8bf0927038d2305218e5a6b811e0c4039d617))
* nested richtext bug and test ([#2966](https://github.com/payloadcms/payload/issues/2966)) ([801f609](https://github.com/payloadcms/payload/commit/801f60939b1bb4e33fbabe1f9a3c4a04a47912db))
* properly threads custom react-select props through relationship field ([#2973](https://github.com/payloadcms/payload/issues/2973)) ([79393e8](https://github.com/payloadcms/payload/commit/79393e8cf0b79b31fa711536e0bc22b1a251468a))
### Features
* improve typing of ExtendableError and APIError ([#2864](https://github.com/payloadcms/payload/issues/2864)) ([7c47e4b](https://github.com/payloadcms/payload/commit/7c47e4b0d3c63f6f7800daaf424935d6067ffcc4))
* narrow endpoint.method type ([#1880](https://github.com/payloadcms/payload/issues/1880)) ([b734a1c](https://github.com/payloadcms/payload/commit/b734a1c422d200cad1085b7e92f8540df4238e32))
## [1.10.5](https://github.com/payloadcms/payload/compare/v1.10.4...v1.10.5) (2023-06-30)
### Bug Fixes
* fields in drawer cannot be edited ([#2949](https://github.com/payloadcms/payload/issues/2949)) ([0c2e41c](https://github.com/payloadcms/payload/commit/0c2e41c4bef9333c47a9b1db0de807696b3f3872)), closes [#2945](https://github.com/payloadcms/payload/issues/2945)
* improve versions test suite ([#2941](https://github.com/payloadcms/payload/issues/2941)) ([1d4df99](https://github.com/payloadcms/payload/commit/1d4df99ea78c5f682074ae824dcd8dea18b774e0))
* incorrect graphql type generation ([#2898](https://github.com/payloadcms/payload/issues/2898)) ([b36deb4](https://github.com/payloadcms/payload/commit/b36deb4640cad4f494a12ab74b4e4d9a918cd94b))
## [1.10.4](https://github.com/payloadcms/payload/compare/v1.10.3...v1.10.4) (2023-06-30)
### Features
* add locale to displayed API URL ([b22d157](https://github.com/payloadcms/payload/commit/b22d157bd2f1c1a857e2d42bdc5b893549e3db9e))
## [1.10.3](https://github.com/payloadcms/payload/compare/v1.10.2...v1.10.3) (2023-06-30)
### Bug Fixes
* [#2937](https://github.com/payloadcms/payload/issues/2937), depth not being respected in graphql rich text fields ([f84b432](https://github.com/payloadcms/payload/commit/f84b4323e2fce57e2e14b181e486ed72cc09ded5))
* shows updatedAt date when selecting a version to compare from dropdown ([3c9dab3](https://github.com/payloadcms/payload/commit/3c9dab3b9d5302d8bdf5792f0384cd5aeeb13839))
## [1.10.2](https://github.com/payloadcms/payload/compare/v1.10.1...v1.10.2) (2023-06-26)
### Bug Fixes
* adjusts swc loader to only exclude non ts/tsx files - [#2888](https://github.com/payloadcms/payload/issues/2888) ([#2907](https://github.com/payloadcms/payload/issues/2907)) ([a2d9ef3](https://github.com/payloadcms/payload/commit/a2d9ef3ca618934df58102a7e02e86dbe0ed63da))
* autosave on localized fields, adds test ([6893231](https://github.com/payloadcms/payload/commit/6893231f85f702189089a6d78d3f3af63aaa0d82))
* broken export of entityToJSONSchema ([#2894](https://github.com/payloadcms/payload/issues/2894)) ([837dccc](https://github.com/payloadcms/payload/commit/837dcccefeffe7bb6e674713b4184c4eb92db8dc))
* correctly scopes data variable within bulk update - [#2901](https://github.com/payloadcms/payload/issues/2901) ([#2904](https://github.com/payloadcms/payload/issues/2904)) ([f627277](https://github.com/payloadcms/payload/commit/f627277479e6a4a847e79f54c545712a7186abb9))
* safely check for tempFilePath when updating media document ([#2899](https://github.com/payloadcms/payload/issues/2899)) ([8206c0f](https://github.com/payloadcms/payload/commit/8206c0fe8be78a5e0f7c8e64996d73d135b1fcc2))
## [1.10.1](https://github.com/payloadcms/payload/compare/v1.10.0...v1.10.1) (2023-06-22)
### Bug Fixes
* conditional fields perf bug - [#2886](https://github.com/payloadcms/payload/issues/2886) ([#2890](https://github.com/payloadcms/payload/issues/2890)) ([b83d788](https://github.com/payloadcms/payload/commit/b83d788d3cfe12f87dcd63a9df20b939a6f4681e))
* cutoff tooltips in relationship field ([#2873](https://github.com/payloadcms/payload/issues/2873)) ([09c6cad](https://github.com/payloadcms/payload/commit/09c6cad3e8462dc3d8b1b6424aafd336c1d7828c))
* Relationship hasMany and filterOptions fails above 10 items ([#2891](https://github.com/payloadcms/payload/issues/2891)) ([8128de6](https://github.com/payloadcms/payload/commit/8128de64dff98fdbcf053faef9de3c3f9a733071))
# [1.10.0](https://github.com/payloadcms/payload/compare/v1.9.5...v1.10.0) (2023-06-20)
### Bug Fixes
* [#2831](https://github.com/payloadcms/payload/issues/2831), persists payloadAPI through local operations that accept req ([85d2467](https://github.com/payloadcms/payload/commit/85d2467d73582a372ee34e3ce93403847a1f0689))
* [#2842](https://github.com/payloadcms/payload/issues/2842), querying number custom ids with in ([116e9ff](https://github.com/payloadcms/payload/commit/116e9ffe81f44c4b40fa578b4a8fe4bb70fd110c))
* default sort with near operator ([#2862](https://github.com/payloadcms/payload/issues/2862)) ([99f3809](https://github.com/payloadcms/payload/commit/99f38098dd4a386437c469becc975ca86c54601f))
* deprecate min/max in exchange for minRows and maxRows for relationship field ([#2826](https://github.com/payloadcms/payload/issues/2826)) ([0d8d7f3](https://github.com/payloadcms/payload/commit/0d8d7f358d390184f6f888d77858b4a145e94214))
* drawer close on backspace ([#2869](https://github.com/payloadcms/payload/issues/2869)) ([a110ba2](https://github.com/payloadcms/payload/commit/a110ba2dc09cd0824a9b1eb8e011604388277bd8))
* drawer fields are read-only if opened from a hasMany relationship ([#2843](https://github.com/payloadcms/payload/issues/2843)) ([542b536](https://github.com/payloadcms/payload/commit/542b5362d3ec8741aff6b1672fab7d2250e7b854))
* fields in relationship drawer not usable [#2815](https://github.com/payloadcms/payload/issues/2815) ([#2870](https://github.com/payloadcms/payload/issues/2870)) ([8626dc6](https://github.com/payloadcms/payload/commit/8626dc6b1a926143e7ba505f3edd924432168675))
* mobile loading overlay width [#2866](https://github.com/payloadcms/payload/issues/2866) ([#2867](https://github.com/payloadcms/payload/issues/2867)) ([ba9d633](https://github.com/payloadcms/payload/commit/ba9d6336acc779cfec0db312c8e2da912ce58cd4))
* near query sorting by distance and pagination ([#2861](https://github.com/payloadcms/payload/issues/2861)) ([1611896](https://github.com/payloadcms/payload/commit/16118960aa6d63f7a429f168ff4305f336b1b1e6))
* relationship field query pagination ([#2871](https://github.com/payloadcms/payload/issues/2871)) ([ce84174](https://github.com/payloadcms/payload/commit/ce84174554d9d828cbaaaa9548e5defc0feb4e2b))
* slow like queries with lots of records ([4dd703a](https://github.com/payloadcms/payload/commit/4dd703a6bff0ab7d06af234baa975553bd62f176))
### Features
* automatically redirect a user back to their originally requested URL after login ([#2838](https://github.com/payloadcms/payload/issues/2838)) ([e910688](https://github.com/payloadcms/payload/commit/e9106882f721d43bcc05a1690bda7754b450404e))
* hasMany for number field ([#2517](https://github.com/payloadcms/payload/issues/2517)) ([8f086e3](https://github.com/payloadcms/payload/commit/8f086e315cb30be9d399fd3022c16952fb81cb2e)), closes [#2812](https://github.com/payloadcms/payload/issues/2812) [#2821](https://github.com/payloadcms/payload/issues/2821) [#2823](https://github.com/payloadcms/payload/issues/2823) [#2824](https://github.com/payloadcms/payload/issues/2824) [#2814](https://github.com/payloadcms/payload/issues/2814) [#2793](https://github.com/payloadcms/payload/issues/2793) [#2835](https://github.com/payloadcms/payload/issues/2835)
* optimizes conditional logic performance ([967f217](https://github.com/payloadcms/payload/commit/967f21734600de1fec8c1227a354ef5a417e54c5))
## [1.9.5](https://github.com/payloadcms/payload/compare/v1.9.4...v1.9.5) (2023-06-16)
## [1.9.4](https://github.com/payloadcms/payload/compare/v1.9.3...v1.9.4) (2023-06-16)
### Bug Fixes
* incorrectly return totalDocs=1 instead of the correct count when pagination=false ([2e73938](https://github.com/payloadcms/payload/commit/2e7393853447d2da41ddef79f73e9026719a674b))
## [1.9.3](https://github.com/payloadcms/payload/compare/v1.9.2...v1.9.3) (2023-06-16)
### Bug Fixes
* adds custom property to ui field in joi validation ([#2835](https://github.com/payloadcms/payload/issues/2835)) ([56d7745](https://github.com/payloadcms/payload/commit/56d7745139e31c5d42c5191477f409f12589a952))
* ensures relations to object ids can be queried on ([c3d6e1b](https://github.com/payloadcms/payload/commit/c3d6e1b490a69f0aadb00e54e46a8774732e6658))
## [1.9.2](https://github.com/payloadcms/payload/compare/v1.9.1...v1.9.2) (2023-06-14)
### Bug Fixes
* [#2821](https://github.com/payloadcms/payload/issues/2821) i18n ui field label ([#2823](https://github.com/payloadcms/payload/issues/2823)) ([63cd7fb](https://github.com/payloadcms/payload/commit/63cd7fbd0c91bbf5120e95fd33388a38e593b341))
* adds missing dark-mode styles for version differences view ([#2812](https://github.com/payloadcms/payload/issues/2812)) ([346a48f](https://github.com/payloadcms/payload/commit/346a48f871e09a3d5e25b7ff9e45689a104b0f9f))
* sanitize reset password result - [#2805](https://github.com/payloadcms/payload/issues/2805) ([#2808](https://github.com/payloadcms/payload/issues/2808)) ([46a5f41](https://github.com/payloadcms/payload/commit/46a5f417217313b049f4b412abb3319634f27262))
* user can be created without having to specify an email - [#2801](https://github.com/payloadcms/payload/issues/2801) ([abe3852](https://github.com/payloadcms/payload/commit/abe38520aaaefdfaea4c47130eea04a42a82627b))
## [1.9.1](https://github.com/payloadcms/payload/compare/v1.9.0...v1.9.1) (2023-06-09)
### Features
* adds option to customize filename on upload ([596eea1](https://github.com/payloadcms/payload/commit/596eea1f0a42628464e5269c496360b808c35f97))
* collection list view custom components: BeforeList, BeforeListTable, AfterListTable, AfterList ([#2792](https://github.com/payloadcms/payload/issues/2792)) ([38e962f](https://github.com/payloadcms/payload/commit/38e962f2cbcaf9eaa72276969289efdbf670c7c7))
# [1.9.0](https://github.com/payloadcms/payload/compare/v1.8.6...v1.9.0) (2023-06-07)
### Features
* custom type interfaces ([#2709](https://github.com/payloadcms/payload/issues/2709)) ([8458a98](https://github.com/payloadcms/payload/commit/8458a98eff0eedf1abfd9ec065a084955a9b8149))
## [1.8.6](https://github.com/payloadcms/payload/compare/v1.8.5...v1.8.6) (2023-06-07)
### Bug Fixes
* [#2711](https://github.com/payloadcms/payload/issues/2711) index sortable field global versions fields ([#2775](https://github.com/payloadcms/payload/issues/2775)) ([576af01](https://github.com/payloadcms/payload/commit/576af01b6f81d24621d522e8d8b9c496eafa6df0))
* [#2767](https://github.com/payloadcms/payload/issues/2767) bulk operations missing locales in admin requests ([e30871a](https://github.com/payloadcms/payload/commit/e30871a96ff25f12401a3cc3bc5e12c064eeff3f))
* [#2771](https://github.com/payloadcms/payload/issues/2771) relationship field not querying all collections ([#2774](https://github.com/payloadcms/payload/issues/2774)) ([8b767a1](https://github.com/payloadcms/payload/commit/8b767a166aa16659d8880cc68da546251725b20b))
* adjusts activation constraint of draggable nodes ([#2773](https://github.com/payloadcms/payload/issues/2773)) ([863be3d](https://github.com/payloadcms/payload/commit/863be3d852af6c6a76021695f895badf23e776ae))
* flattens relationships in the update operation for globals [#2766](https://github.com/payloadcms/payload/issues/2766) ([#2776](https://github.com/payloadcms/payload/issues/2776)) ([3677cf6](https://github.com/payloadcms/payload/commit/3677cf688d0e456c42068b4eab0086e64407d938))
* improperly typing optional arrays with required fields as required ([f1fc305](https://github.com/payloadcms/payload/commit/f1fc305ac443ecb247622bc89067b129e96146fc))
* read-only Auth fields ([#2781](https://github.com/payloadcms/payload/issues/2781)) ([3c72f33](https://github.com/payloadcms/payload/commit/3c72f3303c57e88256266c343225157e0b081bba))
* read-only Auth fields ([#2781](https://github.com/payloadcms/payload/issues/2781)) ([60f5522](https://github.com/payloadcms/payload/commit/60f5522e67acb353e6d5ce05f0012241c192d4b4))
* recursiveNestedPaths not merging existing fields when hoisting row/collapsible fields ([#2769](https://github.com/payloadcms/payload/issues/2769)) ([536d701](https://github.com/payloadcms/payload/commit/536d7017eebd5a8e14b2936c55a7fccc90d3f530))
## [1.8.5](https://github.com/payloadcms/payload/compare/v1.8.4...v1.8.5) (2023-06-03)
### Features
* allows objectid through relationship validation ([42afa6b](https://github.com/payloadcms/payload/commit/42afa6b48aa924fa0dfc9defadf08ddb029da6c1))
## [1.8.4](https://github.com/payloadcms/payload/compare/v1.8.3...v1.8.4) (2023-06-02)
### Features
* Add Bulgarian translation ([#2753](https://github.com/payloadcms/payload/issues/2753)) ([51108c0](https://github.com/payloadcms/payload/commit/51108c02ea346fd41c1b94ef7c339feec8383dd1))
### Bug Fixes
* group row hoisting ([#2683](https://github.com/payloadcms/payload/issues/2683)) ([1626e17](https://github.com/payloadcms/payload/commit/1626e173b7eced83c59e8eb4f70b0bb68fdb0e7a))
* graphql where types on rows and collapsible's ([#2758](https://github.com/payloadcms/payload/issues/2758)) ([f978299](https://github.com/payloadcms/payload/commit/f978299868bf352e147070afdf556bf1153bac56))
* RichText link custom fields ([#2756](https://github.com/payloadcms/payload/issues/2756)) ([23be263](https://github.com/payloadcms/payload/commit/23be263dd2e75dca448019b1c66d7f6dd3558b37))
* adds timestamps to global schemas ([#2738](https://github.com/payloadcms/payload/issues/2738)) ([0986282](https://github.com/payloadcms/payload/commit/0986282f13d8a3b5596c4a241b4da35e6fac6aa1))
* adjusts code field joi schema to allow editorOptions ([ed136fb](https://github.com/payloadcms/payload/commit/ed136fbc5146889cd30c641d4947da58b66dfb2f))
* fix locale popup overflow ([#2737](https://github.com/payloadcms/payload/issues/2737)) ([8ee9724](https://github.com/payloadcms/payload/commit/8ee9724277d419de78b27a8ffa22f3a599361251))
* fix tests by hard-coding the URL in the logger ([2697974](https://github.com/payloadcms/payload/commit/2697974694112440bf1737c4ce535ba77bf4b194))
* mongoose connection ([#2754](https://github.com/payloadcms/payload/issues/2754)) ([69b97bb](https://github.com/payloadcms/payload/commit/69b97bbc590c62fffbcd03a42f0e9737e3f7ca01))
* removes payload dependency inception ([#2717](https://github.com/payloadcms/payload/issues/2717)) ([6125b66](https://github.com/payloadcms/payload/commit/6125b66286e5315725ca0ae365c81a04c1c1a54c))
* searches on correct useAsTitle field in polymorphic list drawers [#2710](https://github.com/payloadcms/payload/issues/2710) ([9ec2a40](https://github.com/payloadcms/payload/commit/9ec2a40274ea9b3a32e43cb992df3897baf62e63))
* typing of sendMail function ([e3ff4c4](https://github.com/payloadcms/payload/commit/e3ff4c46cbecf731c9a3c688682bcb33012cb234))
* corrects relationship field schema from pr [#2696](https://github.com/payloadcms/payload/issues/2696) ([#2714](https://github.com/payloadcms/payload/issues/2714)) ([8285bac](https://github.com/payloadcms/payload/commit/8285bac2f5eb443b6af160b21726edf3f828a52f))
## [1.8.3](https://github.com/payloadcms/payload/compare/v1.8.3...v1.8.3) (2023-05-24)
### Bug Fixes
* [#2662](https://github.com/payloadcms/payload/issues/2662), draft=true querying by id ([3b78ab0](https://github.com/payloadcms/payload/commit/3b78ab04c7a68e39afa9936ac692169ed2c8fb74))
* [#2685](https://github.com/payloadcms/payload/issues/2685), graphql querying relationships with custom id ([9bb5470](https://github.com/payloadcms/payload/commit/9bb54703423b3f0fdb242a5e63f322d346323b06))
* adds credentials to doc access request ([#2705](https://github.com/payloadcms/payload/issues/2705)) ([c716954](https://github.com/payloadcms/payload/commit/c716954e89b0aef976cbcbef9ece981ec9bab233))
* prevents add new relationship modal from adding duplicative values to the parent doc [#2688](https://github.com/payloadcms/payload/issues/2688) ([a2a8ac9](https://github.com/payloadcms/payload/commit/a2a8ac9549bd67e6ab578772689684fd2bc64872))
* unable to clear relationships or open relationship drawer on mobile [#2691](https://github.com/payloadcms/payload/issues/2691) [#2692](https://github.com/payloadcms/payload/issues/2692) ([782f8ca](https://github.com/payloadcms/payload/commit/782f8ca047178cadb4214702854a0e0cb2d9eaab))
## [1.8.2](https://github.com/payloadcms/payload/compare/v1.8.1...v1.8.2) (2023-05-10)
### Bug Fixes
* react webpack alias ([1732bb8](https://github.com/payloadcms/payload/commit/1732bb877ca9688fc87cf44fbf63d05b6be23de2))
## [1.8.1](https://github.com/payloadcms/payload/compare/v1.8.0...v1.8.1) (2023-05-10)
### Bug Fixes
* add dotenv.config() to test/dev.ts ([#2646](https://github.com/payloadcms/payload/issues/2646)) ([7963e75](https://github.com/payloadcms/payload/commit/7963e7540f4899c16a49b47cf5145f46ea0c71cf))
### Features
* allow users to manipulate images without needing to resize them ([#2574](https://github.com/payloadcms/payload/issues/2574)) ([8531687](https://github.com/payloadcms/payload/commit/85316879cd97933ed34588b0cee72798964de281))
* export additional graphql types ([#2610](https://github.com/payloadcms/payload/issues/2610)) ([3f185cb](https://github.com/payloadcms/payload/commit/3f185cb18b9677654b92921267ffef408388d0d1))
# [1.8.0](https://github.com/payloadcms/payload/compare/v1.7.5...v1.8.0) (2023-05-09)
### Bug Fixes
* correct casing on graphql type ([219f50b](https://github.com/payloadcms/payload/commit/219f50b0bc7a520655a5ae4f1d8b08fd04c8a3dd))
* defaultValue missing from Upload field schema ([7b21eaf](https://github.com/payloadcms/payload/commit/7b21eaf12da64778568b45e56fa8d39e81f11c29))
* ensures nested querying works when querying across collections ([09974fa](https://github.com/payloadcms/payload/commit/09974fa68677586c727943cc234311f87bf6da75))
* query custom text id fields ([967f2ac](https://github.com/payloadcms/payload/commit/967f2ace0ea1a65570f69e85920f2f55626efde0))
* removes deprecated queryHiddenFIelds from local API docs ([5f30dbb](https://github.com/payloadcms/payload/commit/5f30dbb1a5b7c7ab6752c114710f92c159319d3d))
* removes queryHiddenFields from example Find operation ([fb4f822](https://github.com/payloadcms/payload/commit/fb4f822d34d0235a537f96515073e2662680412f))
* resolve process/browser package in webpack config ([02f27f3](https://github.com/payloadcms/payload/commit/02f27f3de6fdaf5dd0023298fc671a8ae9a1b758))
* Row groups in tabs vertical alignment ([#2593](https://github.com/payloadcms/payload/issues/2593)) ([54fac4a](https://github.com/payloadcms/payload/commit/54fac4a5d793b534e25600d2f9470c449f40df1d))
* softens columns and filters pill colors ([#2642](https://github.com/payloadcms/payload/issues/2642)) ([9072096](https://github.com/payloadcms/payload/commit/90720964953d392d85982052b3a4843a5450681e))
* webp upload formatting ([ccd6ca2](https://github.com/payloadcms/payload/commit/ccd6ca298e69faf04709535df3fcb18eb3d40f1b))
### Features
* add Arabic translations ([#2641](https://github.com/payloadcms/payload/issues/2641)) ([7d04cf1](https://github.com/payloadcms/payload/commit/7d04cf14fb0587f2208745bb77ed4fd17e99c8d5))
* allow full URL in staticURL ([#2562](https://github.com/payloadcms/payload/issues/2562)) ([a9b5dff](https://github.com/payloadcms/payload/commit/a9b5dffa00623eb48302d51b88c3449920c10f46))
## [1.7.5](https://github.com/payloadcms/payload/compare/v1.7.4...v1.7.5) (2023-05-04)
### Bug Fixes
* make incrementName match multiple digits ([#2609](https://github.com/payloadcms/payload/issues/2609)) ([8dbf0a2](https://github.com/payloadcms/payload/commit/8dbf0a2bd88db1b361ce16bb730613de489f2ed2))
### Features
* collection admin.enableRichTextLink property ([#2560](https://github.com/payloadcms/payload/issues/2560)) ([9678992](https://github.com/payloadcms/payload/commit/967899229f458d06a3931d086bcc49299dc310b7))
* custom admin buttons ([#2618](https://github.com/payloadcms/payload/issues/2618)) ([1d58007](https://github.com/payloadcms/payload/commit/1d58007606fa7e34007f2a56a3ca653d2cd3404d))
## [1.7.4](https://github.com/payloadcms/payload/compare/v1.7.3...v1.7.4) (2023-05-02)
### Bug Fixes
* properly import SwcMinifyWebpackPlugin ([#2600](https://github.com/payloadcms/payload/issues/2600)) ([802deac](https://github.com/payloadcms/payload/commit/802deaca03f8506fa4a7adb8fc008205c2c4f013))
## [1.7.3](https://github.com/payloadcms/payload/compare/v1.7.2...v1.7.3) (2023-05-01)
### Bug Fixes
* [#2592](https://github.com/payloadcms/payload/issues/2592), allows usage of hidden fields within access query constraints ([#2599](https://github.com/payloadcms/payload/issues/2599)) ([a0bb13a](https://github.com/payloadcms/payload/commit/a0bb13a4123b51d770b364ddaee3dde1c5a3da53))
* addds workaround for slate isBlock function issue ([#2596](https://github.com/payloadcms/payload/issues/2596)) ([8f6f13d](https://github.com/payloadcms/payload/commit/8f6f13dc93f49f5ba5384a9168ced5baec85e1fb))
* bulk operations result type ([#2588](https://github.com/payloadcms/payload/issues/2588)) ([8382faa](https://github.com/payloadcms/payload/commit/8382faa0afc8118f4fb873c657a52c48abb2a6ad))
* query on id throws 500 ([#2587](https://github.com/payloadcms/payload/issues/2587)) ([0ba22c3](https://github.com/payloadcms/payload/commit/0ba22c3aafca67be78814357edc668ed11ec4a97))
* timestamp queries ([#2583](https://github.com/payloadcms/payload/issues/2583)) ([9c5107e](https://github.com/payloadcms/payload/commit/9c5107e86d70e36ac181c9d3ad51edacf9fc529a))
### Features
* Add new translation for romanian language ([#2556](https://github.com/payloadcms/payload/issues/2556)) ([fbf3a2a](https://github.com/payloadcms/payload/commit/fbf3a2a1b4633e704e467d9aec05f3ae0b900bae))
* add persian translations ([#2553](https://github.com/payloadcms/payload/issues/2553)) ([c80f68a](https://github.com/payloadcms/payload/commit/c80f68af943c730996c9cdad87cf84d4d06a5777))
* adjust stack trace for api error ([#2598](https://github.com/payloadcms/payload/issues/2598)) ([870838e](https://github.com/payloadcms/payload/commit/870838e7563b6767c53f4dc0288119087e3f9486))
* allow customizing the link fields ([#2559](https://github.com/payloadcms/payload/issues/2559)) ([bf65228](https://github.com/payloadcms/payload/commit/bf6522898db353e75db11525ea5a1b58243333d8))
* supports collection compound indexes ([#2529](https://github.com/payloadcms/payload/issues/2529)) ([85b3d57](https://github.com/payloadcms/payload/commit/85b3d579d3054aad2de793957cf6454332361327))
## [1.7.2](https://github.com/payloadcms/payload/compare/v1.7.1...v1.7.2) (2023-04-25)
### Bug Fixes
* [#2521](https://github.com/payloadcms/payload/issues/2521), graphql AND not working with drafts ([e67ca20](https://github.com/payloadcms/payload/commit/e67ca2010831c14938d3f639fcb5374ca62747ba))
* document drawer access control [#2545](https://github.com/payloadcms/payload/issues/2545) ([439caf8](https://github.com/payloadcms/payload/commit/439caf815fc99538f14b3a59835dcf49185759dc))
* prevent floating point number in image sizes ([#1935](https://github.com/payloadcms/payload/issues/1935)) ([7fcde11](https://github.com/payloadcms/payload/commit/7fcde11fa0b232537de606e44c0af68b122daed2))
* prevent sharp toFormat settings fallthrough by using clone ([#2547](https://github.com/payloadcms/payload/issues/2547)) ([90dab3c](https://github.com/payloadcms/payload/commit/90dab3c445d4bdbab0eff286a2b66861d04f2a93))
* query localized fields without localization configured ([12edb1c](https://github.com/payloadcms/payload/commit/12edb1cc4b2675d9b0948fb7f3439f61c6e2015d))
* read-only styles ([823d022](https://github.com/payloadcms/payload/commit/823d0228c949fe58a7e0f11f95354b240c3ea876))
### Features
* add rich-text blockquote element, change quote node type to blockquote ([ed230a4](https://github.com/payloadcms/payload/commit/ed230a42e0315dc2492b4a26e3bf8b5334e89380))
* add user to field conditional logic ([274edc7](https://github.com/payloadcms/payload/commit/274edc74a70202e8c771c5111507b585c3f69377))
* exposes id in conditional logic ([c117b32](https://github.com/payloadcms/payload/commit/c117b321474b8318c3a0ddf544e49568e461f0d8))
* **imageresizer:** add trim options ([#2073](https://github.com/payloadcms/payload/issues/2073)) ([0406548](https://github.com/payloadcms/payload/commit/0406548fe6127e091db9926ee42e59f9158eff5a))
## [1.7.1](https://github.com/payloadcms/payload/compare/v1.7.0...v1.7.1) (2023-04-18)
### Bug Fixes
* adds 'use client' for next 13 compatibility ([5e02985](https://github.com/payloadcms/payload/commit/5e029852060d6475eccada35ffbcdd0178d5e690))
* graphql variables not being passed properly ([72be80a](https://github.com/payloadcms/payload/commit/72be80abc4082013e052aef1152a5de749a6f3c4))
### Features
* configuration extension points ([023719d](https://github.com/payloadcms/payload/commit/023719d77554a70493d779ba94bf55058d4caf98))
## [1.7.0](https://github.com/payloadcms/payload/compare/v1.6.32...v1.7.0) (2023-04-17)
### Features
- feat: exposes new replaceState form api (52ae6f06a)
- feat: support email configuration in payload config (#2485) (042e58ea2)
- feat: refactors buildQuery to rely on fields instead of mongoose (d187b809d)
- feat: add admin.hidden to collections and globals (#2487) (81d69d1b6)
- feat: replace deprecated express-graphql dependency (#2484) (cd548a6e2)
- feat: supports null preview url #2472 (e8a24fd2e)
- feat: migrates form builder example nextjs to examples (28ecb0c5e)
### Bug Fixes
- fix: #2494, reduces versions caused by reverting to published with autosave: true (e0c0b2fdf)
- fix: incorrect version defaults (3f9bbe90b)
- fix: hides preview button until document is saved #2476 (#2477) (f9b8e2dbc)
- fix: corrects sidebar spacing in collection and global edit views #2478 (a45ab8bd7)
- fix: use correct locale when querying relationships for list view (#2438) (15442a9cc)
- fix: proper height data for animated gifs (#2506) (aee6ca05c)
- fix: Clear blocks modal search input when closing the modal (#2501) (0f8051b57)
- fix: excess padding on textarea (#2488) (6ceb79189)
- fix: increase line height for global title (#2465) (19ce0d79e)
- fix: uses docPermissions to show/hide x button on media collection doc fileDetails - #2428 (7f2c3d1d0)
- fix: prevents rendering of version actions when a user does not have permission (13cc669e2)
- fix: properly awaits email send to catch potential errors #2444 (#2470) (11a6ce6d3)
## [1.6.32](https://github.com/payloadcms/payload/compare/v1.6.31...v1.6.32) (2023-04-05)
### Features
- only uses sharp if required ([f9f6ec4](https://github.com/payloadcms/payload/commit/f9f6ec47d9a4f9ed94b7f7a4d50f13a8ee881ad0))
## [1.6.31](https://github.com/payloadcms/payload/compare/v1.6.30...v1.6.31) (2023-04-04)
### Bug Fixes
- ensures select hasMany does not get mutated on patch operations ([3a6acf3](https://github.com/payloadcms/payload/commit/3a6acf322b5546ca3cd1d4dcb093af6e3b6ed086))
### Features
- improves required type accuracy ([a9cd23a](https://github.com/payloadcms/payload/commit/a9cd23a883d89c8deb3c1b5386decd50516d69fd))
## [1.6.30](https://github.com/payloadcms/payload/compare/v1.6.29...v1.6.30) (2023-04-03)
### Bug Fixes
- incorrect type local api using delete with where ([de5ceb2](https://github.com/payloadcms/payload/commit/de5ceb2aca624f702ea39556ffe2f689701615c1))
- originalDoc being mutated in beforeChange field hooks ([888bbf2](https://github.com/payloadcms/payload/commit/888bbf28e0b793a2298e27a7e1df235d78b0a718))
## [1.6.29](https://github.com/payloadcms/payload/compare/v1.6.28...v1.6.29) (2023-03-31)
### Bug Fixes
- update and delete local API return types ([#2434](https://github.com/payloadcms/payload/issues/2434)) ([02410a0](https://github.com/payloadcms/payload/commit/02410a0be38004b90d19207071569294fd104a66))
## [1.6.28](https://github.com/payloadcms/payload/compare/v1.6.27...v1.6.28) (2023-03-28)
### Bug Fixes
- potential memory leak with `probe-image-size` ([8eea0d6](https://github.com/payloadcms/payload/commit/8eea0d6cf41dd6360d713f463ad1b48ba253a9e7))
## [1.6.27](https://github.com/payloadcms/payload/compare/v1.6.26...v1.6.27) (2023-03-27)
### Bug Fixes
- [#2355](https://github.com/payloadcms/payload/issues/2355), select field not fully visible on small screens in certain scenarios ([07eb8dd](https://github.com/payloadcms/payload/commit/07eb8dd7d252043c00b79d532736896134204c4c))
- [#2384](https://github.com/payloadcms/payload/issues/2384), preserves manually set verified from admin UI ([72a8b1e](https://github.com/payloadcms/payload/commit/72a8b1eebe6c3b45663a14fa7488772ad13f975d))
- hide fields with admin.hidden attribute ([ad25b09](https://github.com/payloadcms/payload/commit/ad25b096b6efa7e0cba647e82e29e36f7a95934a))
- make update typing a deep partial ([#2407](https://github.com/payloadcms/payload/issues/2407)) ([e8dc7d4](https://github.com/payloadcms/payload/commit/e8dc7d462e21d1021275a95fbf62094f290e37ce))
- restoring version did not correctly create new version from result ([6ca12b1](https://github.com/payloadcms/payload/commit/6ca12b1cc06554b04f3055df8f01d7eee1c09169))
- textarea field overlap in UI ([1c8cf24](https://github.com/payloadcms/payload/commit/1c8cf24ba623746c160007d7c09b3160f2aae8d3))
## [1.6.25](https://github.com/payloadcms/payload/compare/v1.6.24...v1.6.25) (2023-03-24)
### Bug Fixes
- upload field select existing file ([#2392](https://github.com/payloadcms/payload/issues/2392)) ([38e917a](https://github.com/payloadcms/payload/commit/38e917a3dfa70ac3234915a6c8f7424eb22cb000))
## [1.6.24](https://github.com/payloadcms/payload/compare/v1.6.23...v1.6.24) (2023-03-23)
### Features
- bulk-operations ([#2346](https://github.com/payloadcms/payload/issues/2346)) ([0fedbab](https://github.com/payloadcms/payload/commit/0fedbabe9e975f375dc12447fcdab4119bc6a4c4))
## [1.6.23](https://github.com/payloadcms/payload/compare/v1.6.22...v1.6.23) (2023-03-22)
### Bug Fixes
- [#2315](https://github.com/payloadcms/payload/issues/2315) - deleting files if overwriteExistingFiles is true ([4d578f1](https://github.com/payloadcms/payload/commit/4d578f1bfd05efab5cc8db95895eabb776b2d9d1))
- [#2363](https://github.com/payloadcms/payload/issues/2363) version tabs and select field comparisons ([#2364](https://github.com/payloadcms/payload/issues/2364)) ([21b8da7](https://github.com/payloadcms/payload/commit/21b8da7f415cdace9f7d5898c98f9c7a6bb39107))
- allows base64 thumbnails ([#2361](https://github.com/payloadcms/payload/issues/2361)) ([e09ebff](https://github.com/payloadcms/payload/commit/e09ebfffa0a7a7fdb3469f272de0e6930d97a336))
- DateField admin type ([#2256](https://github.com/payloadcms/payload/issues/2256)) ([fb2fd3e](https://github.com/payloadcms/payload/commit/fb2fd3e9b7e302d8069bfcb6f3cb698ac7abf0ca))
- fallback to default locale showing on non-localized fields ([#2316](https://github.com/payloadcms/payload/issues/2316)) ([e1a6e08](https://github.com/payloadcms/payload/commit/e1a6e08aa140cf21597d6009b811f7fdd2106f4f))
- Fix missing Spanish translations ([#2372](https://github.com/payloadcms/payload/issues/2372)) ([c0ff75c](https://github.com/payloadcms/payload/commit/c0ff75c1647a36219549e20fc081883f8cf1d7e4))
- relationship field useAsTitle [#2333](https://github.com/payloadcms/payload/issues/2333) ([#2350](https://github.com/payloadcms/payload/issues/2350)) ([10dd819](https://github.com/payloadcms/payload/commit/10dd819863ecac4a5cea2e13f820df2224ac57f4))
### Features
- adds title attribute to ThumbnailCard ([#2368](https://github.com/payloadcms/payload/issues/2368)) ([a8766d0](https://github.com/payloadcms/payload/commit/a8766d00a8365c8e6ffe507944fbe49aaa39d4bd))
- exposes defaultSort property for collection list view ([#2382](https://github.com/payloadcms/payload/issues/2382)) ([1f480c4](https://github.com/payloadcms/payload/commit/1f480c4cd5673a6fe08360183fe1c7c1d4e05de0))
## [1.6.22](https://github.com/payloadcms/payload/compare/v1.6.21...v1.6.22) (2023-03-15)
## [1.6.21](https://github.com/payloadcms/payload/compare/v1.6.20...v1.6.21) (2023-03-15)
### Bug Fixes
- hidden fields being mutated on patch ([#2317](https://github.com/payloadcms/payload/issues/2317)) ([8d65ba1](https://github.com/payloadcms/payload/commit/8d65ba1efd8744042bbaf669c10b6837a6b972f8))
## [1.6.20](https://github.com/payloadcms/payload/compare/v1.6.19...v1.6.20) (2023-03-13)
### Bug Fixes
- allow thumbnails in upload gallery to show useAsTitle value ([aae6d71](https://github.com/payloadcms/payload/commit/aae6d716e5608270ca142f2f4df214f9e271deb4))
- allows useListDrawer to work without collectionSlugs defined ([e1553c2](https://github.com/payloadcms/payload/commit/e1553c2fc88ac582744cd72d15c9e9ef3b8ec549))
- cancels existing fetches if new fetches are started ([ccc92fd](https://github.com/payloadcms/payload/commit/ccc92fdb7519e14ff1092f19ae4e7060fa413aab))
- check relationships indexed access for undefined ([959f017](https://github.com/payloadcms/payload/commit/959f01739c30450f3a6d052dd6083fdacf1527a4))
- ensures documentID exists in doc documentDrawers ([#2304](https://github.com/payloadcms/payload/issues/2304)) ([566c45b](https://github.com/payloadcms/payload/commit/566c45b0b436a9a3ea8eff27de2ea829dd6a2f0c))
- flattens title fields to allow seaching by title if title inside Row field ([75e776d](https://github.com/payloadcms/payload/commit/75e776ddb43b292eae6c1204589d9dc22deab50c))
- keep drop zone active when hovering inner elements ([#2295](https://github.com/payloadcms/payload/issues/2295)) ([39e303a](https://github.com/payloadcms/payload/commit/39e303add62d2dbd3e72d17e64e1ea5d940b0298))
- Prevent browser initial favicon request ([fd8ea88](https://github.com/payloadcms/payload/commit/fd8ea88488c80627346733e0595a2ef34c964a87))
- removes forced require on array, block, group ts ([657aa65](https://github.com/payloadcms/payload/commit/657aa65e993d13e9a294456b73adcd57f20d7c87))
- removes pagination type from top level admin config types ([bf9929e](https://github.com/payloadcms/payload/commit/bf9929e9a9919488f6de0e172909fa27719ecb04))
- renders presentational table columns ([4e1748f](https://github.com/payloadcms/payload/commit/4e1748fb8a3554586b377e60738130d03ec12f38))
- undefined point fields saving as empty object ([#2313](https://github.com/payloadcms/payload/issues/2313)) ([af16415](https://github.com/payloadcms/payload/commit/af164159fb52f4b0ef97e2fa34b881f97bc07310))
### Features
- [#2280](https://github.com/payloadcms/payload/issues/2280) Improve UX of paginator ([#2293](https://github.com/payloadcms/payload/issues/2293)) ([1df3d14](https://github.com/payloadcms/payload/commit/1df3d149e06cc955a61c4371371b601c0d9aad2b))
- exposes useTheme hook ([abebde6](https://github.com/payloadcms/payload/commit/abebde6b120a9dddc9971325b616b9cb31bcba90))
- provide refresh permissions for auth context ([e9c796e](https://github.com/payloadcms/payload/commit/e9c796e42c1bb1e0ce72d057ee88dee624b94c24))
## [1.6.19](https://github.com/payloadcms/payload/compare/v1.6.18...v1.6.19) (2023-03-09)
### Bug Fixes
- ensures nested fields save properly within link, upload rte ([057522c](https://github.com/payloadcms/payload/commit/057522c5bdade430c6e60f589a32f174739d400c))
## [1.6.18](https://github.com/payloadcms/payload/compare/v1.6.17...v1.6.18) (2023-03-09)
### Bug Fixes
- [#2272](https://github.com/payloadcms/payload/issues/2272), rich text within blocks causing crash on reorder ([7daddf8](https://github.com/payloadcms/payload/commit/7daddf864d71e83fa74bc76768d85d4c7fa93d9a))
- allows swc/register to transpile files above current workspace ([ef826c8](https://github.com/payloadcms/payload/commit/ef826c88ec40878bb36e960c2df2c68ec3c54ef6))
- renders row fields as table columns [#2257](https://github.com/payloadcms/payload/issues/2257) ([b10e842](https://github.com/payloadcms/payload/commit/b10e842e89a4e0839d0f391cfbafa916134c47c8))
- table column preferences sync ([a1ddd2e](https://github.com/payloadcms/payload/commit/a1ddd2e2e37a76471631a90938a9ceaba8f9a394))
## [1.6.17](https://github.com/payloadcms/payload/compare/v1.6.15...v1.6.17) (2023-03-06)
### Bug Fixes
- [#2150](https://github.com/payloadcms/payload/issues/2150), can now query on N number of levels deep ([ac54b11](https://github.com/payloadcms/payload/commit/ac54b11f9d2f9cfde15a4421d13ce26ffd6cdc63))
- [#2179](https://github.com/payloadcms/payload/issues/2179), async default values resetting form state ([a4de51a](https://github.com/payloadcms/payload/commit/a4de51adaaa9399fa9036e485eb2e7f350719638))
- allows empty objects to be retained in db ([0247e2d](https://github.com/payloadcms/payload/commit/0247e2d1068527213f007c71f6efa1aff4c21af6))
- clear relationship value ([#2188](https://github.com/payloadcms/payload/issues/2188)) ([387cec9](https://github.com/payloadcms/payload/commit/387cec983868d6c10c043248b45fc8c1657e4981))
- conditionally renders draggable pill ([#2224](https://github.com/payloadcms/payload/issues/2224)) ([812ab9f](https://github.com/payloadcms/payload/commit/812ab9f86824aca3689ddef8af759a84f59f2148))
- ensures sorting on drafts works in all cases ([c87fd2b](https://github.com/payloadcms/payload/commit/c87fd2b649e59afb6fe7998d04142f3ba246dcef))
- globals publish after draft ([44651e6](https://github.com/payloadcms/payload/commit/44651e6ecc354dbe17a08fccfafd686420d07158))
- minimize not set to false on all field type schemas ([ace032e](https://github.com/payloadcms/payload/commit/ace032ef897dc55131c6cf7cb80dc1a652940748))
- pass result of previous hook into next hook ([c661ac2](https://github.com/payloadcms/payload/commit/c661ac2e8a26251e77c558e00ed3c32741d2d385))
- properly resizes animated images ([#2181](https://github.com/payloadcms/payload/issues/2181)) ([8c4f890](https://github.com/payloadcms/payload/commit/8c4f890af0cbd1f2b3a2dd1980d26ba3e721f154))
- properly set req.payload on forgotPassword in local API ([#2194](https://github.com/payloadcms/payload/issues/2194)) ([5ac436e](https://github.com/payloadcms/payload/commit/5ac436e1843aacc81072992805bdbd1aed41d243))
- redirects example ([#2209](https://github.com/payloadcms/payload/issues/2209)) ([5aa203d](https://github.com/payloadcms/payload/commit/5aa203d020177eb25b7675d6ab30fc8721b9fe0c))
- removes duplicative fields from table columns [#2221](https://github.com/payloadcms/payload/issues/2221) ([#2226](https://github.com/payloadcms/payload/issues/2226)) ([474a3cb](https://github.com/payloadcms/payload/commit/474a3cbf7a90ab02d9e6c86ee018895576cbcab9))
- renders rte upload drawer [#2178](https://github.com/payloadcms/payload/issues/2178) ([523d9d4](https://github.com/payloadcms/payload/commit/523d9d495261b44fdb9c7922bfa9cdd8aaba85fb))
- skips field validation on submit if skipValidation is set to true ([cf17760](https://github.com/payloadcms/payload/commit/cf17760735d466a5817fc37bc3dc6f3ad8c52f7a))
- Validate typescript signature ([8d31ed6](https://github.com/payloadcms/payload/commit/8d31ed6d39d1a4d147e13de5b96073fab5563173))
- version comparison view errors on old select value ([#2163](https://github.com/payloadcms/payload/issues/2163)) ([a3cc3c3](https://github.com/payloadcms/payload/commit/a3cc3c342928e00564a662ba210635d78238fed8))
- versions table ([#2235](https://github.com/payloadcms/payload/issues/2235)) ([066f5f6](https://github.com/payloadcms/payload/commit/066f5f6d2cb48525896366166693af6c92d1814d))
- virtual fields example ([#2214](https://github.com/payloadcms/payload/issues/2214)) ([f6eb020](https://github.com/payloadcms/payload/commit/f6eb0202fec15a0ba0e6c357ecdb9ace62bd2ea9))
### Features
- Add Hungarian Translations ([#2169](https://github.com/payloadcms/payload/issues/2169)) ([ebd16e8](https://github.com/payloadcms/payload/commit/ebd16e8fdf811ec19dd5231b01c91f201d00d3a3))
- adds min and max options to relationship with hasMany ([0f38a0d](https://github.com/payloadcms/payload/commit/0f38a0dcf6a4d993579ed3af55940f28b13f5d3d))
- drag-and-drop columns ([#2142](https://github.com/payloadcms/payload/issues/2142)) ([e2c65e3](https://github.com/payloadcms/payload/commit/e2c65e3fa519fc04c7d1552064980ffee145a3bc))
- improves ui performance with thousands of fields ([0779f8d](https://github.com/payloadcms/payload/commit/0779f8d73da4767e9918b04cc8795e52b2198f4c))
## [1.6.16](https://github.com/payloadcms/payload/compare/v1.6.15...v1.6.16) (2023-02-28)
### Bug Fixes
- [#2150](https://github.com/payloadcms/payload/issues/2150), can now query on N number of levels deep ([ac54b11](https://github.com/payloadcms/payload/commit/ac54b11f9d2f9cfde15a4421d13ce26ffd6cdc63))
- [#2179](https://github.com/payloadcms/payload/issues/2179), async default values resetting form state ([a4de51a](https://github.com/payloadcms/payload/commit/a4de51adaaa9399fa9036e485eb2e7f350719638))
- allows empty objects to be retained in db ([0247e2d](https://github.com/payloadcms/payload/commit/0247e2d1068527213f007c71f6efa1aff4c21af6))
- clear relationship value ([#2188](https://github.com/payloadcms/payload/issues/2188)) ([387cec9](https://github.com/payloadcms/payload/commit/387cec983868d6c10c043248b45fc8c1657e4981))
- ensures sorting on drafts works in all cases ([c87fd2b](https://github.com/payloadcms/payload/commit/c87fd2b649e59afb6fe7998d04142f3ba246dcef))
- globals publish after draft ([44651e6](https://github.com/payloadcms/payload/commit/44651e6ecc354dbe17a08fccfafd686420d07158))
- properly resizes animated images ([#2181](https://github.com/payloadcms/payload/issues/2181)) ([8c4f890](https://github.com/payloadcms/payload/commit/8c4f890af0cbd1f2b3a2dd1980d26ba3e721f154))
- properly set req.payload on forgotPassword in local API ([#2194](https://github.com/payloadcms/payload/issues/2194)) ([5ac436e](https://github.com/payloadcms/payload/commit/5ac436e1843aacc81072992805bdbd1aed41d243))
- redirects example ([#2209](https://github.com/payloadcms/payload/issues/2209)) ([5aa203d](https://github.com/payloadcms/payload/commit/5aa203d020177eb25b7675d6ab30fc8721b9fe0c))
- renders rte upload drawer [#2178](https://github.com/payloadcms/payload/issues/2178) ([523d9d4](https://github.com/payloadcms/payload/commit/523d9d495261b44fdb9c7922bfa9cdd8aaba85fb))
- skips field validation on submit if skipValidation is set to true ([cf17760](https://github.com/payloadcms/payload/commit/cf17760735d466a5817fc37bc3dc6f3ad8c52f7a))
- version comparison view errors on old select value ([#2163](https://github.com/payloadcms/payload/issues/2163)) ([a3cc3c3](https://github.com/payloadcms/payload/commit/a3cc3c342928e00564a662ba210635d78238fed8))
### Features
- Add Hungarian Translations ([#2169](https://github.com/payloadcms/payload/issues/2169)) ([ebd16e8](https://github.com/payloadcms/payload/commit/ebd16e8fdf811ec19dd5231b01c91f201d00d3a3))
- drag-and-drop columns ([#2142](https://github.com/payloadcms/payload/issues/2142)) ([e2c65e3](https://github.com/payloadcms/payload/commit/e2c65e3fa519fc04c7d1552064980ffee145a3bc))
## [1.6.15](https://github.com/payloadcms/payload/compare/v1.6.14...v1.6.15) (2023-02-21)
### Bug Fixes
- mongoose connection error with useFacet ([5888fb9](https://github.com/payloadcms/payload/commit/5888fb9b3f82f49686da27c216b40c38b5a5d6c2))
## [1.6.14](https://github.com/payloadcms/payload/compare/v1.6.13...v1.6.14) (2023-02-21)
### Bug Fixes
- [#2091](https://github.com/payloadcms/payload/issues/2091) admin translations for filter operators ([#2143](https://github.com/payloadcms/payload/issues/2143)) ([8a8c392](https://github.com/payloadcms/payload/commit/8a8c3920950ece5995f81bff717b30a2baf8f219))
- [#2096](https://github.com/payloadcms/payload/issues/2096), allows custom ts paths with payload generate:types ([686a616](https://github.com/payloadcms/payload/commit/686a616b4cf06685fd22b075cf87ceafec455e40))
- [#2117](https://github.com/payloadcms/payload/issues/2117) collection pagination defaultLimit ([#2147](https://github.com/payloadcms/payload/issues/2147)) ([2a4db38](https://github.com/payloadcms/payload/commit/2a4db3896ead2b49c0a7ebc5da6b9825b223ca19))
- [#2131](https://github.com/payloadcms/payload/issues/2131), doesn't log in unverified user after resetting password ([3eb85b1](https://github.com/payloadcms/payload/commit/3eb85b1554ceb705c4a1436af4d9ba982e4cdbdf))
- [#2134](https://github.com/payloadcms/payload/issues/2134), allows links to be populated without having relationship or upload enabled ([32a0778](https://github.com/payloadcms/payload/commit/32a0778fc4311509699b14f9a3f145380ec56e25))
- [#2148](https://github.com/payloadcms/payload/issues/2148), adds queryHiddenFields property to find operation ([15b6bb3](https://github.com/payloadcms/payload/commit/15b6bb3d756697428775df5ece3c6092d0537d82))
- checks locale is valid for monaco code editor ([#2144](https://github.com/payloadcms/payload/issues/2144)) ([40224ed](https://github.com/payloadcms/payload/commit/40224ed1bcd886be8bf2f5b42a272db7615495c1))
- generate proper json field type according to rfc ([#2137](https://github.com/payloadcms/payload/issues/2137)) ([7e88698](https://github.com/payloadcms/payload/commit/7e8869858cfca70b2e996d984e065da75398076b))
- removes custom header and gutter from rte link drawer [#2120](https://github.com/payloadcms/payload/issues/2120) ([#2135](https://github.com/payloadcms/payload/issues/2135)) ([6a7663b](https://github.com/payloadcms/payload/commit/6a7663beb57f624ea52d95a8f26345dcd32d65bc))
- sizes property optional on upload ([#2066](https://github.com/payloadcms/payload/issues/2066)) ([79d047e](https://github.com/payloadcms/payload/commit/79d047e64fd40507abf9de2ced5dab7aeb2bb6fa))
- useFacet config option to disable $facet aggregation ([#2141](https://github.com/payloadcms/payload/issues/2141)) ([b4a2074](https://github.com/payloadcms/payload/commit/b4a20741b2d995e5e46875c2ae1f11ff5b319e6b))
## [1.6.13](https://github.com/payloadcms/payload/compare/v1.6.12...v1.6.13) (2023-02-18)
### Bug Fixes
- [#2125](https://github.com/payloadcms/payload/issues/2125), ensures createdAt and updatedAt are returned in update operations ([42ebf68](https://github.com/payloadcms/payload/commit/42ebf6893257256554a57e6b6684a726d11800b8))
## [1.6.12](https://github.com/payloadcms/payload/compare/v1.6.11...v1.6.12) (2023-02-17)
### Bug Fixes
- ensures only valid fields can be queried on ([1930bc2](https://github.com/payloadcms/payload/commit/1930bc260e721c5c7a10793b5d2a7809694089f3))
### Features
- adds gql auth example ([#2115](https://github.com/payloadcms/payload/issues/2115)) ([fa32c27](https://github.com/payloadcms/payload/commit/fa32c2771637af11d7ef0fb21b2f1f3cceae1ead))
- auth example ([c076c77](https://github.com/payloadcms/payload/commit/c076c77db4a26cf514a040b1048de25b1141f0cb))
- separates admin root component from DOM render logic ([ff4d1f6](https://github.com/payloadcms/payload/commit/ff4d1f6ac26f5cac56b6c5b7b67b99f50067cb8d))
- virtual fields example ([#1990](https://github.com/payloadcms/payload/issues/1990)) ([2af0c04](https://github.com/payloadcms/payload/commit/2af0c04c8ae5892b317af240c1502bc21bb65253))
## [1.6.11](https://github.com/payloadcms/payload/compare/v1.6.10...v1.6.11) (2023-02-15)
### Bug Fixes
- existing upload deletion [#2098](https://github.com/payloadcms/payload/issues/2098) ([#2101](https://github.com/payloadcms/payload/issues/2101)) ([060c380](https://github.com/payloadcms/payload/commit/060c3805e567fe450c4b9aa00fbdbb919427c625))
### Features
- preview example ([#1950](https://github.com/payloadcms/payload/issues/1950)) ([0a87f10](https://github.com/payloadcms/payload/commit/0a87f106ecb5c95738109db5231d72abd281e7e1))
## [1.6.10](https://github.com/payloadcms/payload/compare/v1.6.9...v1.6.10) (2023-02-14)
### Bug Fixes
- [#2077](https://github.com/payloadcms/payload/issues/2077) useAPIKey UI missing with disableLocalStrategy ([#2084](https://github.com/payloadcms/payload/issues/2084)) ([586b25a](https://github.com/payloadcms/payload/commit/586b25a54c6ec8bd134bce05c480cd429e47e252))
- Add missing Spanish translations and fix typos ([c4742e5](https://github.com/payloadcms/payload/commit/c4742e5c303ca4ba41c2fbb45a8e8474608418c1))
- document type in update request handler ([d5cd970](https://github.com/payloadcms/payload/commit/d5cd9709f717b08b930461079b147967d8d7a885))
- ensures versions createdAt matches the original doc ([8c7e37c](https://github.com/payloadcms/payload/commit/8c7e37c56aab2bb28de01cf7d4a91062cbde80de))
- globals not saving drafts unless published first ([#2082](https://github.com/payloadcms/payload/issues/2082)) ([4999fba](https://github.com/payloadcms/payload/commit/4999fbaee680e256ece7083fbe422f25e85de0d5))
- Use the user's AdminUI locale for the DatePicker ([#2046](https://github.com/payloadcms/payload/issues/2046)) ([#2057](https://github.com/payloadcms/payload/issues/2057)) ([b4a7e91](https://github.com/payloadcms/payload/commit/b4a7e912b2117cef3345adb8b514958345838030))
- validate type ([7bb0984](https://github.com/payloadcms/payload/commit/7bb0984a12a0d80d9ac2af82427ac7dbc985ffc5))
### Features
- allows control over relationship add new button ([6096044](https://github.com/payloadcms/payload/commit/6096044fe058113ca47c7f7d833cb788d97df9a2))
- async plugins ([#2030](https://github.com/payloadcms/payload/issues/2030)) ([9f30553](https://github.com/payloadcms/payload/commit/9f3055381337f80229f220c1e6114b4ea56be969))
- export more errors ([3a2a41d](https://github.com/payloadcms/payload/commit/3a2a41d2b6ead4188b432d9e6780764a7c08b2dd))
## [1.6.9](https://github.com/payloadcms/payload/compare/v1.6.7...v1.6.9) (2023-02-10)
### Bug Fixes
* adds query constraint to ensureMaxVersions query ([30688bb](https://github.com/payloadcms/payload/commit/30688bbe4136285af181a5deae5e949b98bea0be))
* translation of "or" -> "ou" in french ([#2047](https://github.com/payloadcms/payload/issues/2047)) ([dddbec2](https://github.com/payloadcms/payload/commit/dddbec268255c41b7ea786bdddc02dfeb7d66fbd))
- adds query constraint to ensureMaxVersions query ([30688bb](https://github.com/payloadcms/payload/commit/30688bbe4136285af181a5deae5e949b98bea0be))
- translation of "or" -> "ou" in french ([#2047](https://github.com/payloadcms/payload/issues/2047)) ([dddbec2](https://github.com/payloadcms/payload/commit/dddbec268255c41b7ea786bdddc02dfeb7d66fbd))
### Features
* allows customization of the folder used to serve admin bundled files in production ([4d259a6](https://github.com/payloadcms/payload/commit/4d259a69f2c9beb1d84f703a08921469e6f1c34b))
- allows customization of the folder used to serve admin bundled files in production ([4d259a6](https://github.com/payloadcms/payload/commit/4d259a69f2c9beb1d84f703a08921469e6f1c34b))
## [1.6.7](https://github.com/payloadcms/payload/compare/v1.6.6...v1.6.7) (2023-02-08)
### Bug Fixes
* drawer state was not set when opened ([e6ac872](https://github.com/payloadcms/payload/commit/e6ac872b0d80470883836ef5aac0bdf4b62d6de9))
- drawer state was not set when opened ([e6ac872](https://github.com/payloadcms/payload/commit/e6ac872b0d80470883836ef5aac0bdf4b62d6de9))
## [1.6.6](https://github.com/payloadcms/payload/compare/v1.6.5...v1.6.6) (2023-02-07)
### Bug Fixes
* [#1887](https://github.com/payloadcms/payload/issues/1887), dataloader rich text population infinite loop ([ac2e174](https://github.com/payloadcms/payload/commit/ac2e174643419e5b01cfbbf53234b0145aeb5e4e))
* enables locales with date field ([aefb655](https://github.com/payloadcms/payload/commit/aefb655769e7998a44cef9f93a19e4aef24c50bb))
- [#1887](https://github.com/payloadcms/payload/issues/1887), dataloader rich text population infinite loop ([ac2e174](https://github.com/payloadcms/payload/commit/ac2e174643419e5b01cfbbf53234b0145aeb5e4e))
- enables locales with date field ([aefb655](https://github.com/payloadcms/payload/commit/aefb655769e7998a44cef9f93a19e4aef24c50bb))
## [1.6.5](https://github.com/payloadcms/payload/compare/v1.6.4...v1.6.5) (2023-02-07)
### Bug Fixes
* allows radio input to be tabbable ([b5880f2](https://github.com/payloadcms/payload/commit/b5880f26af8b97d47eca83a9fc7bd05b006cc54c))
* auth type leaking into type gen ([1f0a1c7](https://github.com/payloadcms/payload/commit/1f0a1c796ab4126a464949f3a1bc34c7360470a5))
* corrects keyboard accessibility for checkbox field ([65b8fd2](https://github.com/payloadcms/payload/commit/65b8fd27af05c25c3ddf86c34e1f181b8a605c27))
* ensures preview is enabled before rendering button ([e968f40](https://github.com/payloadcms/payload/commit/e968f4067c2427965c0f96845aff8eaca36d0df6))
* local API update typing ([#2010](https://github.com/payloadcms/payload/issues/2010)) ([4b0d4f4](https://github.com/payloadcms/payload/commit/4b0d4f4cd59940cace6b6b8cebf3d834d2b88dab)), closes [#2009](https://github.com/payloadcms/payload/issues/2009)
* max versions incorrectly sorting, causing incorrect versions to be held onto ([2e4f7ab](https://github.com/payloadcms/payload/commit/2e4f7ab35c23f25051a5000e7902df7f255ed607))
* named tabs not displaying data in versions view ([a41e295](https://github.com/payloadcms/payload/commit/a41e295e42fbf283733afd8b63bced9555cb1338))
* replaced media not rendering after document save ([827428d](https://github.com/payloadcms/payload/commit/827428d6b57a7abe858ca5ddaad5ba4ec9d3a270))
* webpack css-loader resolve urls ([ade4c01](https://github.com/payloadcms/payload/commit/ade4c011d348249e975a1510ae481018834a2ca2))
- allows radio input to be tabbable ([b5880f2](https://github.com/payloadcms/payload/commit/b5880f26af8b97d47eca83a9fc7bd05b006cc54c))
- auth type leaking into type gen ([1f0a1c7](https://github.com/payloadcms/payload/commit/1f0a1c796ab4126a464949f3a1bc34c7360470a5))
- corrects keyboard accessibility for checkbox field ([65b8fd2](https://github.com/payloadcms/payload/commit/65b8fd27af05c25c3ddf86c34e1f181b8a605c27))
- ensures preview is enabled before rendering button ([e968f40](https://github.com/payloadcms/payload/commit/e968f4067c2427965c0f96845aff8eaca36d0df6))
- local API update typing ([#2010](https://github.com/payloadcms/payload/issues/2010)) ([4b0d4f4](https://github.com/payloadcms/payload/commit/4b0d4f4cd59940cace6b6b8cebf3d834d2b88dab)), closes [#2009](https://github.com/payloadcms/payload/issues/2009)
- max versions incorrectly sorting, causing incorrect versions to be held onto ([2e4f7ab](https://github.com/payloadcms/payload/commit/2e4f7ab35c23f25051a5000e7902df7f255ed607))
- named tabs not displaying data in versions view ([a41e295](https://github.com/payloadcms/payload/commit/a41e295e42fbf283733afd8b63bced9555cb1338))
- replaced media not rendering after document save ([827428d](https://github.com/payloadcms/payload/commit/827428d6b57a7abe858ca5ddaad5ba4ec9d3a270))
- webpack css-loader resolve urls ([ade4c01](https://github.com/payloadcms/payload/commit/ade4c011d348249e975a1510ae481018834a2ca2))
### Features
* deletes old media upon re-upload [#1897](https://github.com/payloadcms/payload/issues/1897) ([02f9be2](https://github.com/payloadcms/payload/commit/02f9be2c4a15eed6bba07f504319a2213ea411df))
* enables document drawers from read-only fields ([#1989](https://github.com/payloadcms/payload/issues/1989)) ([0dbc4fa](https://github.com/payloadcms/payload/commit/0dbc4fa21334e1a17c5aa35d84d78973fb7f54ec))
- deletes old media upon re-upload [#1897](https://github.com/payloadcms/payload/issues/1897) ([02f9be2](https://github.com/payloadcms/payload/commit/02f9be2c4a15eed6bba07f504319a2213ea411df))
- enables document drawers from read-only fields ([#1989](https://github.com/payloadcms/payload/issues/1989)) ([0dbc4fa](https://github.com/payloadcms/payload/commit/0dbc4fa21334e1a17c5aa35d84d78973fb7f54ec))
## [1.6.4](https://github.com/payloadcms/payload/compare/v1.6.3...v1.6.4) (2023-02-03)
### Bug Fixes
* only hoists localized values if localization is enabled ([8c65f6a](https://github.com/payloadcms/payload/commit/8c65f6a93836d80fb22724454f5efb49e11763ad))
- only hoists localized values if localization is enabled ([8c65f6a](https://github.com/payloadcms/payload/commit/8c65f6a93836d80fb22724454f5efb49e11763ad))
### Features
* support large file uploads ([#1981](https://github.com/payloadcms/payload/issues/1981)) ([12ed655](https://github.com/payloadcms/payload/commit/12ed65588131c6db5252a1302a7dd82f0a10bd2e))
- support large file uploads ([#1981](https://github.com/payloadcms/payload/issues/1981)) ([12ed655](https://github.com/payloadcms/payload/commit/12ed65588131c6db5252a1302a7dd82f0a10bd2e))
## [1.6.3](https://github.com/payloadcms/payload/compare/v1.6.2...v1.6.3) (2023-02-01)
### Bug Fixes
* properly await graphql schema generation ([888b3a2](https://github.com/payloadcms/payload/commit/888b3a26727b32d19e39d1a8b672eb1881effad7))
- properly await graphql schema generation ([888b3a2](https://github.com/payloadcms/payload/commit/888b3a26727b32d19e39d1a8b672eb1881effad7))
## [1.6.2](https://github.com/payloadcms/payload/compare/v1.6.1...v1.6.2) (2023-02-01)
@@ -213,7 +1000,7 @@ If not already defined, add the following to your `compilerOptions`:
#### ✋ Versions may need to be migrated
This release includes a substantial simplification / optimization of how Versions work within Payload. They are now significantly more performant and easier to understand behind-the-scenes. We've removed ~600 lines of code and have ensured that Payload can be compatible with all flavors of Mongo - including versions earlier than 4.0, Azure Cosmos MongoDB, AWS' DocumentDB and more.
This release includes a substantial simplification / optimization of how Versions work within Payload. They are now significantly more performant and easier to understand behind-the-scenes. We've removed ~600 lines of code and have ensured that Payload can be compatible with all flavors of MongoDB - including versions earlier than 4.0, Azure Cosmos MongoDB, AWS' DocumentDB and more.
But, some of your draft-enabled documents may need to be migrated.

View File

@@ -1,6 +1,6 @@
# Contributing to Payload CMS
# Contributing to Payload
Below you'll find a set of guidelines for how to contribute to Payload CMS.
Below you'll find a set of guidelines for how to contribute to Payload.
## Opening issues
@@ -20,9 +20,15 @@ Payload documentation can be found directly within its codebase and you can feel
If you're an incredibly awesome person and want to help us make Payload even better through new features or additions, we would be thrilled to work with you.
## Design Contributions
When it comes to design-related changes or additions, it's crucial for us to ensure a cohesive user experience and alignment with our broader design vision. Before embarking on any implementation that would affect the design or UI/UX, we ask that you **first share your design proposal** with us for review and approval.
Our design review ensures that proposed changes fit seamlessly with other components, both existing and planned. This step is meant to prevent unintentional design inconsistencies and to save you from investing time in implementing features that might need significant design alterations later.
### Before Starting
To help us work on new features, you can create a new feature request post in [GitHub Discussion](https://github.com/payloadcms/payload/discussions) or discuss it in our [Discord](https://discord.com/invite/r6sCXqVk3v). New functionality often has large implications across the entire Payload repo, so it is best to discuss the architecture and approach before starting work on a pull request.
To help us work on new features, you can create a new feature request post in [GitHub Discussion](https://github.com/payloadcms/payload/discussions) or discuss it in our [Discord](https://discord.com/invite/payload). New functionality often has large implications across the entire Payload repo, so it is best to discuss the architecture and approach before starting work on a pull request.
### Code
@@ -49,10 +55,37 @@ The directory split up in this way specifically to reduce friction when creating
The following command will start Payload with your config: `yarn dev my-test-dir`. This command will start up Payload using your config and refresh a test database on every restart.
When switching between test directories, you will want to remove your `node_modules/.cache ` manually or by running `yarn clean:cache`.
By default, it will automatically log you in with the default credentials. To disable that, you can either pass in the --no-auto-login flag (example: `yarn dev my-test-dir --no-auto-login`) or set the `PAYLOAD_PUBLIC_DISABLE_AUTO_LOGIN` environment variable to `false`.
If you wish to use to your own Mongo database for the `test` directory instead of using the in memory database, all you need to do is add the following env vars to the `test/dev.ts` file:
- `process.env.NODE_ENV`
- `process.env.PAYLOAD_TEST_MONGO_URL`
- Simply set `process.env.NODE_ENV` to `test` and set `process.env.PAYLOAD_TEST_MONGO_URL` to your mongo url e.g. `mongodb://127.0.0.1/your-test-db`.
NOTE: It is recommended to add the test credentials (located in `test/credentials.ts`) to your autofill for `localhost:3000/admin` as this will be required on every nodemon restart. The default credentials are `dev@payloadcms.com` as E-Mail and `test` as password.
### Commits
We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for our commit messages. Please follow this format when creating commits. Here are some examples:
- `feat: adds new feature`
- `fix: fixes bug`
- `docs: adds documentation`
- `chore: does chore`
Here's a breakdown of the format. At the top-level, we use the following types to categorize our commits:
- `feat`: new feature that adds functionality. These are automatically added to the changelog when creating new releases.
- `fix`: a fix to an existing feature. These are automatically added to the changelog when creating new releases.
- `docs`: changes to [docs](./docs) only. These do not appear in the changelog.
- `chore`: changes to code that is neither a fix nor a feature (e.g. refactoring, adding tests, etc.). These do not appear in the changelog.
If you are committing to [templates](./templates) or [examples](./examples), use the `chore` type with the proper scope, like this:
- `chore(templates): adds feature to template`
- `chore(examples): fixes bug in example`
## Pull Requests
For all Pull Requests, you should be extremely descriptive about both your problem and proposed solution. If there are any affected open or closed issues, please leave the issue number in your PR message.

64
ISSUE_GUIDE.md Normal file
View File

@@ -0,0 +1,64 @@
# Reporting an issue
To report an issue, please follow the steps below:
1. Fork this repository
2. Add necessary collections/globals/fields to the `test/_community` directory to recreate the issue you are experiencing
3. Create an issue and add a link to your forked repo
**The goal is to isolate the problem by reducing the number of fields/collections you add to the test/_community folder. This folder is not meant for you to copy your project into, but to recreate the issue you are experiencing with minimal config.**
## Test directory file tree explanation
```text
.
├── config.ts
├── int.spec.ts
├── e2e.spec.ts
└── payload-types.ts
```
- `config.ts` - This is the _granular_ Payload config for testing. It should be as lightweight as possible. Reference existing configs for an example
- `int.spec.ts` [Optional] - This is the test file run by jest. Any test file must have a `*int.spec.ts` suffix.
- `e2e.spec.ts` [Optional] - This is the end-to-end test file that will load up the admin UI using the above config and run Playwright tests.
- `payload-types.ts` - Generated types from `config.ts`. Generate this file by running `yarn dev:generate-types _community`.
The directory split up in this way specifically to reduce friction when creating tests and to add the ability to boot up Payload with that specific config. You should modify the files in `test/_community` to get started.
## How to start test collection admin UI
To start the admin panel so you can manually recreate your issue, you can run the following command:
```bash
# This command will start up Payload using your config
# NOTE: it will wipe the test database on restart
yarn dev _community
```
## Testing is optional but encouraged
An issue does not need to have failing tests — reproduction steps with your forked repo are enough at this point. Some people like to dive deeper and we want to give you the guidance/tools to do so. Read more below.
### How to run integration tests (Payload API tests)
There are a couple ways to do this:
- **Granularly** - you can run individual tests in vscode by installing the Jest Runner plugin and using that to run individual tests. Clicking the `debug` button will run the test in debug mode allowing you to set break points.
<img src="https://raw.githubusercontent.com/payloadcms/payload/master/src/admin/assets/images/github/int-debug.png" />
- **Manually** - you can run all int tests in the `/test/_community/int.spec.ts` file by running the following command:
```bash
yarn test:int _community
```
### How to run E2E tests (Admin Panel UI tests)
The easiest way to run E2E tests is to install
- [Playwright Test for VSCode](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright)
- [Playwright Runner](https://marketplace.visualstudio.com/items?itemName=ortoni.ortoni)
Once they are installed you can open the `testing` tab in vscode sidebar and drill down to the test you want to run, i.e. `/test/_community/e2e.spec.ts`
<img src="https://raw.githubusercontent.com/payloadcms/payload/master/src/admin/assets/images/github/e2e-debug.png" />
#### Notes
- It is recommended to add the test credentials (located in `test/credentials.ts`) to your autofill for `localhost:3000/admin` as this will be required on every nodemon restart. The default credentials are `dev@payloadcms.com` as email and `test` as password.

121
README.md
View File

@@ -1,38 +1,14 @@
<p style="border: none; margin-bottom:0; padding-bottom: 0;" align="center">
<a href="https://payloadcms.com">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/payloadcms/payload/master/src/admin/assets/images/payload-logo-light.svg">
<img width="350" alt="payload cms logo" src="https://raw.githubusercontent.com/payloadcms/payload/master/src/admin/assets/images/payload-logo-dark.svg">
</picture>
</a>
</p>
<h3 align="center">The most powerful TypeScript CMS</h3>
<p align="center">Code-first Headless CMS that bridges the gap between CMS and application framework</p>
<h3 align="center">
<a target="_blank" href="https://payloadcms.com/docs/getting-started/what-is-payload" rel="dofollow"><strong>Explore the docs</strong></a>
·
<a target="_blank" href="https://demo.payloadcms.com/" rel="dofollow"><strong>Try Live Demo</strong></a>
<br />
</h3>
<a href="https://payloadcms.com">
<img width="100%" src="src/admin/assets/images/github-banner-alt.jpg" alt="Payload headless CMS Admin panel built with React" />
</a>
<br />
<p align="center">
<a href="https://opensource.org/licenses/MIT">
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" />
</a>
&nbsp;
<br />
<p align="left">
<a href="https://github.com/payloadcms/payload/actions">
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/payloadcms/payload/tests.yml?style=flat-square">
</a>
&nbsp;
<a href="https://github.com/payloadcms/payload/commits">
<img src="https://img.shields.io/github/commit-activity/m/payloadcms/payload?style=flat-square" alt="git commit activity"/>
</a>
&nbsp;
<a href="https://discord.com/invite/r6sCXqVk3v">
<a href="https://discord.gg/payload">
<img alt="Discord" src="https://img.shields.io/discord/967097582721572934?label=Discord&color=7289da&style=flat-square" />
</a>
&nbsp;
@@ -41,28 +17,56 @@
</a>
&nbsp;
<a href="https://twitter.com/payloadcms">
<img src="https://img.shields.io/badge/follow-payloadcms-1DA1F2?logo=twitter&style=flat-square" alt="Payload CMS Twitter" />
<img src="https://img.shields.io/badge/follow-payloadcms-1DA1F2?logo=twitter&style=flat-square" alt="Payload Twitter" />
</a>
</p>
<hr/>
<h4>
<a target="_blank" href="https://payloadcms.com/docs/getting-started/what-is-payload" rel="dofollow"><strong>Explore the Docs</strong></a>&nbsp;·&nbsp;<a target="_blank" href="https://payloadcms.com/community-help" rel="dofollow"><strong>Community Help</strong></a>&nbsp;·&nbsp;<a target="_blank" href="https://demo.payloadcms.com/" rel="dofollow"><strong>Try Live Demo</strong></a>&nbsp;·&nbsp;<a target="_blank" href="https://github.com/payloadcms/payload/discussions/1539" rel="dofollow"><strong>Roadmap</strong></a>&nbsp;·&nbsp;<a target="_blank" href="https://www.g2.com/products/payload-cms/reviews#reviews" rel="dofollow"><strong>View G2 Reviews</strong></a>
</h4>
<hr/>
<h3>Benefits over a regular CMS</h3>
<ul>
<li>Dont hit some third-party SaaS API, hit your own API</li>
<li>Use your own database and own your data</li>
<li>It's just Express - do what you want outside of Payload</li>
<li>No need to learn how Payload works - if you know JS, you know Payload</li>
<li>No vendor lock-in</li>
<li>Avoid microservices hell - get everything (even auth) in one place</li>
<li>Never touch ancient WP code again</li>
<li>Build faster, never hit a roadblock</li>
<li>Both admin and backend are 100% extensible</li>
</ul>
<br />
## ☁️ Deploy instantly with Payload Cloud.
Create a cloud account, connect your GitHub, and [deploy in minutes](https://payloadcms.com/new).
<a href="https://payloadcms.com">
<img src="https://cms.payloadcms.com/media/payload-github-header.jpg" alt="Payload headless CMS Admin panel built with React" />
</a>
## 🚀 Get started by self-hosting completely free, forever.
<br />
Before beginning to work with Payload, make sure you have all of the [required software](https://payloadcms.com/docs/getting-started/installation).
## ⭐ Why Payload?
```text
npx create-payload-app
```
Payload is a CMS that has been designed for developers from the ground up to deliver them what they need to build great digital products. If you know JavaScript, you know Payload. It's a _code-first_ CMS, which allows us to do a lot of things right:
Alternatively, it only takes about five minutes to [create an app from scratch](https://payloadcms.com/docs/getting-started/installation#from-scratch).
- Payload gives you everything you need, but then steps back and lets you build what you want in JavaScript or TypeScript - with no unnecessary complexity brought by GUIs. You'll understand how your CMS works because you will have written it exactly how you want it.
- Bring your own Express server and do whatever you need on top of Payload. Payload doesn't impose anything on you or your app.
- Completely control the Admin panel by using your own React components. Swap out fields or even entire views with ease.
- Use your data however and wherever you need thanks to auto-generated, yet fully extensible REST, GraphQL, and Local Node APIs.
## 🖱️ One-click templates
<a target="_blank" href="https://payloadcms.com/" rel="dofollow"><strong>Read more on our website</strong></a>
Jumpstart your next project by starting with a pre-made template. These are production-ready, end-to-end solutions designed to get you to market as fast as possible.
### [🛒 E-Commerce](https://github.com/payloadcms/payload/tree/master/templates/ecommerce)
Eliminate the need to combine Shopify and a CMS, and instead do it all with Payload + Stripe. Comes with a beautiful, fully functional front-end complete with shopping cart, checkout, orders, and much more.
### [🌐 Website](https://github.com/payloadcms/payload/tree/master/templates/website)
Build any kind of website, blog, or portfolio from small to enterprise. Comes with a beautiful, fully functional front-end complete with posts, projects, comments, and much more.
We're constantly adding more templates to our [Templates Directory](https://github.com/payloadcms/payload/tree/master/templates). If you maintain your own template, consider adding the `payload-template` topic to your GitHub repository for others to find.
- [Official Templates](https://github.com/payloadcms/payload/tree/master/templates)
- [Community Templates](https://github.com/topics/payload-template)
## ✨ Features
@@ -85,17 +89,6 @@ Payload is a CMS that has been designed for developers from the ground up to del
- Highly secure thanks to HTTP-only cookies, CSRF protection, and more
<a target="_blank" href="https://github.com/payloadcms/payload/discussions"><strong>Request Feature</strong></a>
## 🚀 Quick Start
Before beginning to work with Payload, make sure you have all of the [required software](https://payloadcms.com/docs/getting-started/installation).
From there, the easiest way to get started with Payload is to use the `create-payload-app` package:
```text
npx create-payload-app
```
Alternatively, it only takes about five minutes to [create an app from scratch](https://payloadcms.com/docs/getting-started/installation#from-scratch).
## 🗒️ Documentation
@@ -103,15 +96,31 @@ Check out the [Payload website](https://payloadcms.com/docs/getting-started/what
## 🙋 Contributing
If you want to add contributions to this repository, please follow the instructions in [contributing.md](./contributing.md).
If you want to add contributions to this repository, please follow the instructions in [contributing.md](./CONTRIBUTING.md).
## 📚 Examples
The [Examples Directory](./examples) is a great resource for learning how to setup Payload in a variety of different ways, but you can also find great examples in our blog and throughout our social media.
- [Examples Directory](./examples)
- [Payload Blog](https://payloadcms.com/blog)
- [Payload YouTube](https://www.youtube.com/@payloadcms)
## 🔌 Plugins
Payload is highly extensible and allows you to install or distribute plugins that add or remove functionality. There are both officially-supported and community-supported plugins available. If you maintain your own plugin, consider adding the `payload-plugin` topic to your GitHub repository for others to find.
- [Official Plugins](https://github.com/orgs/payloadcms/repositories?q=topic%3Apayload-plugin)
- [Community Plugins](https://github.com/topics/payload-plugin)
## 🚨 Need help?
There are lots of good conversations and resources in our Github Discussions board & our Discord Server. If you're struggling with something, chances are, someone's already solved what you're up against. :point_down:
There are lots of good conversations and resources in our Github Discussions board and our Discord Server. If you're struggling with something, chances are, someone's already solved what you're up against. :point_down:
- [GitHub Discussions](https://github.com/payloadcms/payload/discussions)
- [GitHub Issues](https://github.com/payloadcms/payload/issues)
- [Discord](https://t.co/30APlsQUPB)
- [Community Help](https://payloadcms.com/community-help)
## ⭐ Like what we're doing? Give us a star

View File

@@ -4,3 +4,4 @@ exports.useDocumentInfo = require('../dist/admin/components/utilities/DocumentIn
exports.useConfig = require('../dist/admin/components/utilities/Config').useConfig;
exports.useAuth = require('../dist/admin/components/utilities/Auth').useAuth;
exports.useEditDepth = require('../dist/admin/components/utilities/EditDepth').useEditDepth;
exports.useTheme = require('../dist/admin/components/utilities/Theme').useTheme;

View File

@@ -1,2 +1,2 @@
export { default as List } from '../../dist/admin/components/views/collections/List/Default';
export type { Props } from '../../dist/admin/components/views/collections/Edit/types';
export type { Props } from '../../dist/admin/components/views/collections/List/types';

View File

@@ -30,7 +30,7 @@ If a Collection supports [`Authentication`](/docs/authentication/overview), the
```ts
import { CollectionConfig } from 'payload/types';
const Posts: CollectionConfig = {
export const Posts: CollectionConfig = {
slug: "posts",
// highlight-start
access: {
@@ -42,8 +42,6 @@ const Posts: CollectionConfig = {
},
// highlight-end
};
export default Categories;
```
### Create

View File

@@ -20,7 +20,7 @@ Field Access Control is specified with functions inside a field's config. All fi
```ts
import { CollectionConfig } from 'payload/types';
const Posts: CollectionConfig = {
export const Posts: CollectionConfig = {
slug: 'posts',
fields: [
{
@@ -67,6 +67,8 @@ Returns a boolean which allows or denies the ability to read a field's value. If
Returns a boolean which allows or denies the ability to update a field's value. If `false` is returned, any passed values will be discarded.
If `false` is returned and you attempt to update the field's value, the operation will **not** throw an error however the field will be omitted from the update operation and the value will remain unchanged.
**Available argument properties:**
| Option | Description |

View File

@@ -38,7 +38,7 @@ const defaultPayloadAccess = ({ req: { user } }) => {
<Banner type="success">
<strong>Note:</strong><br/>
In the Local API, all Access Control functions are skipped by default, allowing your server to do whatever it needs. But, you can opt back in by setting the option <strong>overrideAccess</strong> to <strong>true</strong>.
In the Local API, all Access Control functions are skipped by default, allowing your server to do whatever it needs. But, you can opt back in by setting the option <strong>overrideAccess</strong> to <strong>false</strong>.
</Banner>
### Access Control Types

View File

@@ -11,32 +11,30 @@ While designing the Payload Admin panel, we determined it should be as minimal a
To swap in your own React component, first, consult the list of available component overrides below. Determine the scope that corresponds to what you are trying to accomplish, and then author your React component accordingly.
<Banner type="success">
<strong>Tip:</strong>
<br />
Custom components will automatically be provided with all props that the
default component would accept.
<strong>Tip:</strong><br />
Custom components will automatically be provided with all props that the default component would accept.
</Banner>
### Base Component Overrides
You can override a set of admin panel-wide components by providing a component to your base Payload config's `admin.components` property. The following options are available:
| Path | Description |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`Nav`** | Contains the sidebar and mobile Nav in its entirety. |
| **`logout.Button`** | A custom React component.
| **`BeforeDashboard`** | Array of components to inject into the built-in Dashboard, _before_ the default dashboard contents. |
| **`AfterDashboard`** | Array of components to inject into the built-in Dashboard, _after_ the default dashboard contents. [Demo](https://github.com/payloadcms/payload/tree/master/test/admin/components/AfterDashboard/index.tsx) |
| **`BeforeLogin`** | Array of components to inject into the built-in Login, _before_ the default login form. |
| **`AfterLogin`** | Array of components to inject into the built-in Login, _after_ the default login form. |
| **`BeforeNavLinks`** | Array of components to inject into the built-in Nav, _before_ the links themselves. |
| **`AfterNavLinks`** | Array of components to inject into the built-in Nav, _after_ the links. |
| **`views.Account`** | The Account view is used to show the currently logged in user's Account page. |
| **`views.Dashboard`** | The main landing page of the Admin panel. |
| **`graphics.Icon`** | Used as a graphic within the `Nav` component. Often represents a condensed version of a full logo. |
| **`graphics.Logo`** | The full logo to be used in contexts like the `Login` view. |
| **`routes`** | Define your own routes to add to the Payload Admin UI. [More](#custom-routes) |
| **`providers`** | Define your own provider components that will wrap the Payload Admin UI. [More](#custom-providers) |
| Path | Description |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`Nav`** | Contains the sidebar and mobile Nav in its entirety. |
| **`logout.Button`** | A custom React component. |
| **`BeforeDashboard`** | Array of components to inject into the built-in Dashboard, _before_ the default dashboard contents. |
| **`AfterDashboard`** | Array of components to inject into the built-in Dashboard, _after_ the default dashboard contents. [Demo](https://github.com/payloadcms/payload/tree/master/test/admin/components/AfterDashboard/index.tsx) |
| **`BeforeLogin`** | Array of components to inject into the built-in Login, _before_ the default login form. |
| **`AfterLogin`** | Array of components to inject into the built-in Login, _after_ the default login form. |
| **`BeforeNavLinks`** | Array of components to inject into the built-in Nav, _before_ the links themselves. |
| **`AfterNavLinks`** | Array of components to inject into the built-in Nav, _after_ the links. |
| **`views.Account`** | The Account view is used to show the currently logged in user's Account page. |
| **`views.Dashboard`** | The main landing page of the Admin panel. |
| **`graphics.Icon`** | Used as a graphic within the `Nav` component. Often represents a condensed version of a full logo. |
| **`graphics.Logo`** | The full logo to be used in contexts like the `Login` view. |
| **`routes`** | Define your own routes to add to the Payload Admin UI. [More](#custom-routes) |
| **`providers`** | Define your own provider components that will wrap the Payload Admin UI. [More](#custom-providers) |
#### Full example:
@@ -77,18 +75,117 @@ _For more examples regarding how to customize components, look at the following
You can override components on a Collection-by-Collection basis via each Collection's `admin` property.
| Path | Description |
| ---------------- | ------------------------------------------------------------------------------------------------ |
| **`views.Edit`** | Used while a document within this Collection is being edited. |
| **`views.List`** | The `List` view is used to render a paginated, filterable table of Documents in this Collection. |
| Path | Description |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **`views.Edit`** | Used while a document within this Collection is being edited. |
| **`views.List`** | The `List` view is used to render a paginated, filterable table of Documents in this Collection. |
| **`edit.SaveButton`** | Replace the default `Save` button with a custom component. Drafts must be disabled |
| **`edit.SaveDraftButton`** | Replace the default `Save Draft` button with a custom component. Drafts must be enabled and autosave must be disabled. |
| **`edit.PublishButton`** | Replace the default `Publish` button with a custom component. Drafts must be enabled. |
| **`edit.PreviewButton`** | Replace the default `Preview` button with a custom component. |
| **`BeforeList`** | Array of components to inject _before_ the built-in List view |
| **`BeforeListTable`** | Array of components to inject _before_ the built-in List view's table |
| **`AfterListTable`** | Array of components to inject _after_ the built-in List view's table |
| **`AfterList`** | Array of components to inject _after_ the built-in List view |
#### Examples
```tsx
// Custom Buttons
import * as React from "react";
import {
CustomSaveButtonProps,
CustomSaveDraftButtonProps,
CustomPublishButtonProps,
CustomPreviewButtonProps,
} from "payload/types";
export const CustomSaveButton: CustomSaveButtonProps = ({
DefaultButton,
label,
}) => {
return <DefaultButton label={label} />;
};
export const CustomSaveDraftButton: CustomSaveDraftButtonProps = ({
DefaultButton,
disabled,
label,
saveDraft,
}) => {
return (
<DefaultButton label={label} disabled={disabled} saveDraft={saveDraft} />
);
};
export const CustomPublishButton: CustomPublishButtonProps = ({
DefaultButton,
disabled,
label,
publish,
}) => {
return <DefaultButton label={label} disabled={disabled} publish={publish} />;
};
export const CustomPreviewButton: CustomPreviewButtonProps = ({
DefaultButton,
disabled,
label,
preview,
}) => {
return <DefaultButton label={label} disabled={disabled} preview={preview} />;
};
```
##### Custom Collection List View Example
Collection.ts
```tsx
import { MyListComponent } from './MyListComponent';
export const MyCollection: CollectionConfig = {
slug: 'mycollection',
admin: {
components: {
views: {
List: MyListComponent,
},
},
},
fields: [
...
],
};
```
MyListComponent.tsx
```tsx
import React from "react";
import { List, type Props } from "payload/components/views/List"; // Payload's default List view component and its props
export const MyListComponent: React.FC<Props> = (props) => (
<div>
<p>
Some text before the default list view component. If you just want to do
that, you can also use the admin.components.list.BeforeList hook
</p>
<List {...props} />
</div>
);
```
### Globals
As with Collections, You can override components on a global-by-global basis via their `admin` property.
| Path | Description |
| ---------------- | --------------------------------------- |
| **`views.Edit`** | Used while this Global is being edited. |
| Path | Description |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **`views.Edit`** | Used while this Global is being edited. |
| **`edit.SaveButton`** | Replace the default `Save` button with a custom component. Drafts must be disabled |
| **`edit.SaveDraftButton`** | Replace the default `Save Draft` button with a custom component. Drafts must be enabled and autosave must be disabled. |
| **`edit.PublishButton`** | Replace the default `Publish` button with a custom component. Drafts must be enabled. |
| **`edit.PreviewButton`** | Replace the default `Preview` button with a custom component. |
### Fields
@@ -163,7 +260,8 @@ const CustomTextField: React.FC<Props> = ({ path }) => {
<Banner type="success">
For more information regarding the hooks that are available to you while you
build custom components, including the <strong>useField</strong> hook, <a href="/docs/admin/hooks" style={{ color: "black" }}>click here</a>.
build custom components, including the <strong>useField</strong> hook, [click
here](/docs/admin/hooks).
</Banner>
## Custom routes
@@ -232,19 +330,20 @@ To make use of Payload SCSS variables / mixins to use directly in your own compo
When developing custom components you can support multiple languages to be consistent with Payload's i18n support. The best way to do this is to add your translation resources to the [i18n configuration](https://payloadcms.com/docs/configuration/i18n) and import `useTranslation` from `react-i18next` in your components.
For example:
```tsx
import { useTranslation } from 'react-i18next';
import { useTranslation } from "react-i18next";
const CustomComponent: React.FC = () => {
// highlight-start
const { t, i18n } = useTranslation('namespace1');
const { t, i18n } = useTranslation("namespace1");
// highlight-end
return (
<ul>
<li>{ t('key', { variable: 'value' }) }</li>
<li>{ t('namespace2:key', { variable: 'value' }) }</li>
<li>{ i18n.language }</li>
<li>{t("key", { variable: "value" })}</li>
<li>{t("namespace2:key", { variable: "value" })}</li>
<li>{i18n.language}</li>
</ul>
);
};

View File

@@ -138,25 +138,487 @@ The `useForm` hook can be used to interact with the form itself, and sends back
This hook is optimized to avoid causing rerenders when fields change, and as such, its `fields` property will be out of date. You should only leverage this hook if you need to perform actions against the form in response to your users' actions. Do not rely on its returned "fields" as being up-to-date. They will be removed from this hook's response in an upcoming version.
</Banner>
The `useForm` hook returns an object with the following properties:
The `useForm` hook returns an object with the following properties: |
| Action | Description |
|----------------------|---------------------------------------------------------------------|
| **`fields`** | Deprecated. This property cannot be relied on as up-to-date. |
| **`submit`** | Method to trigger the form to submit |
| **`dispatchFields`** | Dispatch actions to the form field state |
| **`validateForm`** | Trigger a validation of the form state |
| **`createFormData`** | Create a `multipart/form-data` object from the current form's state |
| **`disabled`** | Boolean denoting whether or not the form is disabled |
| **`getFields`** | Gets all fields from state |
| **`getField`** | Gets a single field from state by path |
| **`getData`** | Returns the data stored in the form |
| **`getSiblingData`** | Returns form sibling data for the given field path |
| **`setModified`** | Set the form's `modified` state |
| **`setProcessing`** | Set the form's `processing` state |
| **`setSubmitted`** | Set the form's `submitted` state |
| **`formRef`** | The ref from the form HTML element |
| **`reset`** | Method to reset the form to its initial state |
<TableWithDrawers
columns={[
'Action',
'Description',
'Example',
]}
rows={[
[
{
value: <strong><code>fields</code></strong>,
},
{
value: "Deprecated. This property cannot be relied on as up-to-date.",
},
{
value: ''
}
],
[
{
value: <strong><code>submit</code></strong>,
},
{
value: "Method to trigger the form to submit",
},
{
value: ''
}
],
[
{
value: <strong><code>dispatchFields</code></strong>,
},
{
value: "Dispatch actions to the form field state",
},
{
value: ''
}
],
[
{
value: <strong><code>validateForm</code></strong>,
},
{
value: "Trigger a validation of the form state",
},
{
value: ''
}
],
[
{
value: <strong><code>createFormData</code></strong>,
},
{
value: <>Create a <code>multipart/form-data</code> object from the current form's state</>,
},
{
value: ''
}
],
[
{
value: <strong><code>disabled</code></strong>,
},
{
value: "Boolean denoting whether or not the form is disabled",
},
{
value: ''
}
],
[
{
value: <strong><code>getFields</code></strong>,
},
{
value: 'Gets all fields from state',
},
{
value: '',
}
],
[
{
value: <strong><code>getField</code></strong>,
},
{
value: 'Gets a single field from state by path',
},
{
value: '',
},
],
[
{
value: <strong><code>getData</code></strong>,
},
{
value: 'Returns the data stored in the form',
},
{
value: '',
},
],
[
{
value: <strong><code>getSiblingData</code></strong>,
},
{
value: 'Returns form sibling data for the given field path',
},
{
value: '',
},
],
[
{
value: <strong><code>setModified</code></strong>,
},
{
value: <>Set the form\'s <code>modified</code> state</>,
},
{
value: '',
},
],
[
{
value: <strong><code>setProcessing</code></strong>,
},
{
value: <>Set the form\'s <code>processing</code> state</>,
},
{
value: '',
},
],
[
{
value: <strong><code>setSubmitted</code></strong>,
},
{
value: <>Set the form\'s <code>submitted</code> state</>,
},
{
value: '',
},
],
[
{
value: <strong><code>formRef</code></strong>,
},
{
value: 'The ref from the form HTML element',
},
{
value: '',
},
],
[
{
value: <strong><code>reset</code></strong>,
},
{
value: 'Method to reset the form to its initial state',
},
{
value: '',
},
],
[
{
value: <strong><code>addFieldRow</code></strong>,
},
{
value: "Method to add a row on an array or block field",
},
{
drawerTitle: 'addFieldRow',
drawerDescription: 'A useful method to programtically add a row to an array or block field.',
drawerSlug: 'addFieldRow',
drawerContent: (
<>
<TableWithDrawers
columns={[
'Prop',
'Description',
]}
rows={[
[
{
value: <strong><code>path</code></strong>,
},
{
value: "The path to the array or block field",
},
],
[
{
value: <strong><code>rowIndex</code></strong>,
},
{
value: "The index of the row to add",
},
],
[
{
value: <strong><code>data</code></strong>,
},
{
value: "The data to add to the row",
},
],
]}
/>
<br />
<pre>
{`import { useForm } from "payload/components/forms";
export const CustomArrayManager = () => {
const { addFieldRow } = useForm()
return (
<button
type="button"
onClick={() => {
addFieldRow({
path: "arrayField",
rowIndex: 0,
data: {
textField: "text",
// blockType: "yourBlockSlug",
// ^ if managing a block array, you need to specify the block type
},
})
}}
>
Add Row
</button>
)
}`}
</pre>
<p>An example config to go along with the custom component</p>
<pre>
{`const ExampleCollection = {
slug: "example-collection",
fields: [
{
name: "arrayField",
type: "array",
fields: [
{
name: "textField",
type: "text",
},
],
},
{
type: "ui",
name: "customArrayManager",
admin: {
components: {
Field: CustomArrayManager,
},
},
},
],
}`}
</pre>
</>
)
}
],
[
{
value: <strong><code>removeFieldRow</code></strong>,
},
{
value: "Method to remove a row from an array or block field",
},
{
drawerTitle: 'removeFieldRow',
drawerDescription: 'A useful method to programtically remove a row from an array or block field.',
drawerSlug: 'removeFieldRow',
drawerContent: (
<>
<TableWithDrawers
columns={[
'Prop',
'Description',
]}
rows={[
[
{
value: <strong><code>path</code></strong>,
},
{
value: "The path to the array or block field",
},
],
[
{
value: <strong><code>rowIndex</code></strong>,
},
{
value: "The index of the row to remove",
},
],
]}
/>
<br />
<pre>
{`import { useForm } from "payload/components/forms";
export const CustomArrayManager = () => {
const { removeFieldRow } = useForm()
return (
<button
type="button"
onClick={() => {
removeFieldRow({
path: "arrayField",
rowIndex: 0,
})
}}
>
Remove Row
</button>
)
}`}
</pre>
<p>An example config to go along with the custom component</p>
<pre>
{`const ExampleCollection = {
slug: "example-collection",
fields: [
{
name: "arrayField",
type: "array",
fields: [
{
name: "textField",
type: "text",
},
],
},
{
type: "ui",
name: "customArrayManager",
admin: {
components: {
Field: CustomArrayManager,
},
},
},
],
}`}
</pre>
</>
)
}
],
[
{
value: <strong><code>replaceFieldRow</code></strong>,
},
{
value: "Method to replace a row from an array or block field",
},
{
drawerTitle: 'replaceFieldRow',
drawerDescription: 'A useful method to programtically replace a row from an array or block field.',
drawerSlug: 'replaceFieldRow',
drawerContent: (
<>
<TableWithDrawers
columns={[
'Prop',
'Description',
]}
rows={[
[
{
value: <strong><code>path</code></strong>,
},
{
value: "The path to the array or block field",
},
],
[
{
value: <strong><code>rowIndex</code></strong>,
},
{
value: "The index of the row to replace",
},
],
[
{
value: <strong><code>data</code></strong>,
},
{
value: "The data to replace within the row",
},
],
]}
/>
<br />
<pre>
{`import { useForm } from "payload/components/forms";
export const CustomArrayManager = () => {
const { replaceFieldRow } = useForm()
return (
<button
type="button"
onClick={() => {
replaceFieldRow({
path: "arrayField",
rowIndex: 0,
data: {
textField: "updated text",
// blockType: "yourBlockSlug",
// ^ if managing a block array, you need to specify the block type
},
})
}}
>
Replace Row
</button>
)
}`}
</pre>
<p>An example config to go along with the custom component</p>
<pre>
{`const ExampleCollection = {
slug: "example-collection",
fields: [
{
name: "arrayField",
type: "array",
fields: [
{
name: "textField",
type: "text",
},
],
},
{
type: "ui",
name: "customArrayManager",
admin: {
components: {
Field: CustomArrayManager,
},
},
},
],
}`}
</pre>
</>
)
}
],
]}
/>
### useDocumentInfo
@@ -166,7 +628,6 @@ The `useDocumentInfo` hook provides lots of information about the document curre
|---------------------------|--------------------------------------------------------------------------------------------------------------------| |
| **`collection`** | If the doc is a collection, its collection config will be returned |
| **`global`** | If the doc is a global, its global config will be returned |
| **`type`** | The type of document being edited (collection or global) |
| **`id`** | If the doc is a collection, its ID will be returned |
| **`preferencesKey`** | The `preferences` key to use when interacting with document-level user preferences |
| **`versions`** | Versions of the current doc |
@@ -226,14 +687,15 @@ const Greeting: React.FC = () => {
Useful to retrieve info about the currently logged in user as well as methods for interacting with it. It sends back an object with the following properties:
| Property | Description |
|---------------------|-----------------------------------------------------------------------------------------|
| **`user`** | The currently logged in user |
| **`logOut`** | A method to log out the currently logged in user |
| **`refreshCookie`** | A method to trigger the silent refreshing of a user's auth token |
| **`setToken`** | Set the token of the user, to be decoded and used to reset the user and token in memory |
| **`token`** | The logged in user's token (useful for creating preview links, etc.) |
| **`permissions`** | The permissions of the current user |
| Property | Description |
|--------------------------|-----------------------------------------------------------------------------------------|
| **`user`** | The currently logged in user |
| **`logOut`** | A method to log out the currently logged in user |
| **`refreshCookie`** | A method to trigger the silent refreshing of a user's auth token |
| **`setToken`** | Set the token of the user, to be decoded and used to reset the user and token in memory |
| **`token`** | The logged in user's token (useful for creating preview links, etc.) |
| **`refreshPermissions`** | Load new permissions (useful when content that effects permissions has been changed) |
| **`permissions`** | The permissions of the current user |
```tsx
import { useAuth } from 'payload/components/utilities';
@@ -241,7 +703,7 @@ import { User } from '../payload-types.ts';
const Greeting: React.FC = () => {
// highlight-start
const { user } = useConfig<User>();
const { user } = useAuth<User>();
// highlight-end
return (

View File

@@ -25,7 +25,7 @@ _Screenshot of the Admin panel while editing a document from an example `AllFiel
All options for the Admin panel are defined in your base Payload config file.
| Option | Description |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --- |
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `user` | The `slug` of a Collection that you want be used to log in to the Admin dashboard. [More](/docs/admin/overview#the-admin-user-collection) |
| `buildPath` | Specify an absolute path for where to store the built Admin panel bundle used in production. Defaults to `path.resolve(process.cwd(), 'build')`. |
| `meta` | Base meta data to use for the Admin panel. Included properties are `titleSuffix`, `ogImage`, and `favicon`. |
@@ -35,8 +35,9 @@ All options for the Admin panel are defined in your base Payload config file.
| `scss` | Absolute path to a Sass variables / mixins stylesheet meant to override Payload styles to make for an easy re-skinning of the Admin panel. [More](/docs/admin/customizing-css#overriding-scss-variables). |
| `dateFormat` | Global date format that will be used for all dates in the Admin panel. Any valid [date-fns](https://date-fns.org/) format pattern can be used. |
| `avatar` | Set account profile picture. Options: `gravatar`, `default` or a custom React component. |
| `autoLogin` | Used to automate admin log-in for dev and demonstration convenience. [More](/docs/authentication/config). |
| `components` | Component overrides that affect the entirety of the Admin panel. [More](/docs/admin/components) |
| `webpack` | Customize the Webpack config that's used to generate the Admin panel. [More](/docs/admin/webpack) | |
| `webpack` | Customize the Webpack config that's used to generate the Admin panel. [More](/docs/admin/webpack) |
| **`logoutRoute`** | The route for the `logout` page. |
| **`inactivityRoute`** | The route for the `logout` inactivity page. |
@@ -45,8 +46,8 @@ All options for the Admin panel are defined in your base Payload config file.
<Banner type="warning">
<strong>Important:</strong>
<br />
The Payload Admin panel can only be used by one Collection that supports{" "}
<a href="/docs/authentication/overview">Authentication</a>.
The Payload Admin panel can only be used by one Collection that supports
[Authentication](/docs/authentication/overview).
</Banner>
To specify which Collection to use to log in to the Admin panel, pass the `admin` options a `user` key equal to the slug of the Collection that you'd like to use.

View File

@@ -56,7 +56,7 @@ You may rely on server-only packages such as the above to perform logic in acces
import { CollectionConfig } from 'payload/types';
import createStripeSubscription from './hooks/createStripeSubscription';
const Subscription: CollectionConfig = {
export const Subscription: CollectionConfig = {
slug: 'subscriptions',
hooks: {
beforeChange: [
@@ -71,8 +71,6 @@ const Subscription: CollectionConfig = {
}
]
};
export default Subscription;
```
The collection above features a `beforeChange` hook that creates a Stripe subscription whenever a Subscription document is created in Payload.

View File

@@ -17,7 +17,7 @@ To enable Authentication on a collection, define an `auth` property and set it t
| **`useAPIKey`** | Payload Authentication provides for API keys to be set on each user within an Authentication-enabled Collection. [More](/docs/authentication/config#api-keys) |
| **`tokenExpiration`** | How long (in seconds) to keep the user logged in. JWTs and HTTP-only cookies will both expire at the same time. |
| **`maxLoginAttempts`** | Only allow a user to attempt logging in X amount of times. Automatically locks out a user from authenticating if this limit is passed. Set to `0` to disable. |
| **`lockTime`** | Set the time (in milliseconds) that a user should be locked out if they fail authentication more times than `maxLoginAttempts` allows for. |
| **`lockTime`** | Set the time (in milliseconds) that a user should be locked out if they fail authentication more times than `maxLoginAttempts` allows for. |
| **`depth`** | How many levels deep a `user` document should be populated when creating the JWT and binding the `user` to the express `req`. Defaults to `0` and should only be modified if absolutely necessary, as this will affect performance. |
| **`cookies`** | Set cookie options, including `secure`, `sameSite`, and `domain`. For advanced users. |
| **`forgotPassword`** | Customize the way that the `forgotPassword` operation functions. [More](/docs/authentication/config#forgot-password) |
@@ -29,10 +29,12 @@ To enable Authentication on a collection, define an `auth` property and set it t
To integrate with third-party APIs or services, you might need the ability to generate API keys that can be used to identify as a certain user within Payload.
In Payload, users are essentially documents within a collection. Just like you can authenticate as a user with an email and password, which is considered as our default local auth strategy, you can also authenticate as a user with an API key. API keys are generated on a user-by-user basis, similar to email and passwords, and are meant to represent a single user.
For example, if you have a third-party service or external app that needs to be able to perform protected actions at its discretion, you have two options:
1. Create a user for the third-party app, and log in each time to receive a token before you attempt to access any protected actions
1. Enable API key support for the Collection, where you can generate a non-expiring API key per user in the collection
1. Enable API key support for the Collection, where you can generate a non-expiring API key per user in the collection. This is particularly useful as you can create a "user" that reflects an integration with a specific external service and assign a "role" or specific access only needed by that service/integration. Alternatively, you could create a "super admin" user and assign an API key to that user so that any requests made with that API key are considered as being made by that super user.
Technically, both of these options will work for third-party integrations but the second option with API key is simpler, because it reduces the amount of work that your integrations need to do to be authenticated properly.
@@ -45,7 +47,7 @@ To enable API keys on a collection, set the `useAPIKey` auth option to `true`. F
#### Authenticating via API Key
To authenticate REST or GraphQL API requests using an API key, set the `Authorization` header. The header is case-sensitive and needs the slug of the `auth.useAPIKey` enabled collection, then " API-Key ", followed by the `apiKey` that has been assigned. Payload's built-in middleware will then assign the user document to `req.user` and handle requests with the proper access control.
To authenticate REST or GraphQL API requests using an API key, set the `Authorization` header. The header is case-sensitive and needs the slug of the `auth.useAPIKey` enabled collection, then " API-Key ", followed by the `apiKey` that has been assigned. Payload's built-in middleware will then assign the user document to `req.user` and handle requests with the proper access control. By doing this, Payload recognizes the request being made as a request by the user associated with that API key.
**For example, using Fetch:**
@@ -59,6 +61,24 @@ const response = await fetch("http://localhost:3000/api/pages", {
});
```
Payload ensures that the same, uniform access control is used across all authentication strategies. This enables you to utilize your existing access control configurations with both API keys and the standard email/password authentication. This consistency can aid in maintaining granular control over your API keys.
#### API Key *Only* Authentication
If you want to use API keys as the only authentication method for a collection, you can disable the default local strategy by setting `disableLocalStrategy` to `true` on the collection's `auth` property. This will disable the ability to authenticate with email and password, and will only allow for authentication via API key.
```ts
import { CollectionConfig } from 'payload/types';
export const Customers: CollectionConfig = {
slug: 'customers',
auth: {
useAPIKey: true,
disableLocalStrategy: true,
}
};
```
### Forgot Password
You can customize how the Forgot Password workflow operates with the following options on the `auth.forgotPassword` property:
@@ -82,7 +102,7 @@ Example:
```ts
import { CollectionConfig } from 'payload/types';
const Customers: CollectionConfig = {
export const Customers: CollectionConfig = {
slug: 'customers',
auth: {
forgotPassword: {
@@ -156,7 +176,7 @@ Example:
import { CollectionConfig } from 'payload/types';
const Customers: CollectionConfig = {
export const Customers: CollectionConfig = {
slug: 'customers',
auth: {
verify: {
@@ -229,3 +249,39 @@ If you pass a strategy to the `strategy` property directly, the `name` property
However, if you pass a function to `strategy`, `name` is a required property.
In either case, Payload will prefix the strategy name with the collection `slug` that the strategy is passed to.
### Admin autologin
For testing and demo purposes you may want to skip forcing the admin user to login in order to access the panel.
The `admin.autologin` property is used to configure the how visitors are handled when accessing the admin panel.
The default is that all users will have to login and this should not be enabled for environments where data needs to protected.
#### autoLogin Options
| Option | Description |
| -------------------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **`email`** | The email address of the user to login as |
| **`password`** | The password of the user to login as |
| **`prefillOnly`** | If set to true, the login credentials will be prefilled but the user will still need to click the login button. |
The recommended way to use this feature is behind an environment variable to ensure it is disabled when in production.
**Example:**
```ts
export default buildConfig({
admin: {
user: 'users',
// highlight-start
autoLogin: process.env.PAYLOAD_PUBLIC_ENABLE_AUTOLOGIN === 'true' ? {
email: 'test@example.com',
password: 'test',
prefillOnly: true,
} : false,
// highlight-end
},
collections: [ /** */],
})
```

View File

@@ -6,6 +6,11 @@ desc: Payload provides highly secure user Authentication out of the box, and you
keywords: authentication, config, configuration, overview, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<YouTube
id="CT4KafeJjTI"
title="Simplified Authentication for Headless CMS: Unlocking Reusability in One Line"
/>
<Banner>
Payload provides for highly secure and customizable user Authentication out of the box, which allows for users to identify themselves to Payload.
</Banner>
@@ -35,8 +40,8 @@ Simple example collection:
```ts
import { CollectionConfig } from 'payload/types';
const Admins: CollectionConfig = {
slug:
export const Admins: CollectionConfig = {
slug: 'admins',
// highlight-start
auth: {
tokenExpiration: 7200, // How many seconds to keep the user logged in
@@ -78,9 +83,11 @@ Once enabled, each document that is created within the Collection can be thought
Successfully logging in returns a `JWT` (JSON web token) which is how a user will identify themselves to Payload. By providing this JWT via either an HTTP-only cookie or an `Authorization` header, Payload will automatically identify the user and add its user JWT data to the Express `req`, which is available throughout Payload including within access control, hooks, and more.
You can specify what data gets encoded to the JWT token by setting `saveToJWT` to true in your auth collection fields. If you wish to use a different key other than the field `name`, you can provide it to `saveToJWT` as a string. It is also possible to use `saveToJWT` on fields that are nested in inside groups and tabs. If a group has a `saveToJWT` set it will include the object with all sub-fields in the token. You can set `saveToJWT: false` for any fields you wish to omit. If a field inside a group has `saveToJWT` set, but the group does not, the field will be included at the top level of the token.
<Banner type="success">
<strong>Tip:</strong><br/>
You can access the logged in user from access control functions and hooks via the Express <strong>req</strong>. The logged in user is automatically added as the <strong>user</strong> property.
You can access the logged-in user from access control functions and hooks via the Express <strong>req</strong>. The logged-in user is automatically added as the <strong>user</strong> property.
</Banner>
### HTTP-only cookies

View File

@@ -11,38 +11,48 @@ Because Payload uses your existing Express server, you are free to add whatever
This approach has a ton of benefits - it's great for isolation of concerns and limiting scope, but it also means that your additional routes won't have access to Payload's user authentication.
<Banner type="success">
You can make full use of Payload's built-in authentication within your own custom Express endpoints by adding Payload's authentication middleware.
You can make full use of Payload's built-in authentication within your own
custom Express endpoints by adding Payload's authentication middleware.
</Banner>
<Banner type="warning">
Payload must be initialized before the `payload.authenticate` middleware can
be used. This is done by calling `payload.init()` prior to adding the
middleware.
</Banner>
Example in `server.js`:
```ts
import express from 'express';
import payload from 'payload';
import express from "express";
import payload from "payload";
const app = express();
payload.init({
secret: 'PAYLOAD_SECRET_KEY',
mongoURL: 'mongodb://localhost/payload',
express: app,
});
const start = async () => {
await payload.init({
secret: "PAYLOAD_SECRET_KEY",
mongoURL: "mongodb://localhost/payload",
express: app,
});
const router = express.Router();
const router = express.Router();
router.use(payload.authenticate); // highlight-line
// Note: Payload must be initialized before the `payload.authenticate` middleware can be used
router.use(payload.authenticate); // highlight-line
router.get('/', (req, res) => {
if (req.user) {
return res.send(`Authenticated successfully as ${req.user.email}.`);
}
router.get("/", (req, res) => {
if (req.user) {
return res.send(`Authenticated successfully as ${req.user.email}.`);
}
return res.send('Not authenticated');
});
return res.send("Not authenticated");
});
app.use('/some-route-here', router);
app.use("/some-route-here", router);
app.listen(3000, async () => {
payload.logger.info(`listening on ${3000}...`);
});
app.listen(3000);
};
start();
```

View File

@@ -0,0 +1,62 @@
---
title: Project Configuration
label: Configuration
order: 20
desc: Quickly configure and deploy your Payload Cloud project in a few simple steps.
keywords: configuration, config, settings, project, cloud, payload cloud, deploy, deployment
---
### Select your plan
Once you have created a project, you will need to select your plan. This will determine the resources that are allocated to your project and the features that are available to you.
<Banner type="success">
Note: All Payload Cloud teams that deploy a project require a card on file.
This helps us prevent fraud and abuse on our platform. If you select a plan
with a free trial, you will not be charged until your trial period is over.
Well remind you 7 days before your trial ends and you can cancel anytime.
</Banner>
### Project Details
| Option | Description |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Region** | Select the region closest to your audience. This will ensure the fastest communication between your data and your client. |
| **Project Name** | A name for your project. You can change this at any time. |
| **Project Slug** | Choose a unique slug to identify your project. This needs to be unique for your team and you can change it any time. |
| **Team** | Select the team you want to create the project under. If this is your first project, a personal team will be created for you automatically. You can modify your team settings and invite new members at any time from the Team Settings page. |
### Build Settings
If you are deploying a new project from a template, the following settings will be automatically configured for you. If you are using your own repository, you need to make sure your build settings are accurate for your project to deploy correctly.
| Option | Description |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Root Directory** | The folder where your `package.json` file lives. |
| **Install Command** | The command used to install your modules, for example: `yarn install` or `npm install` |
| **Build Command** | The command used to build your application, for example: `yarn build` or `npm run build` |
| **Serve Command** | The command used to serve your application, for example: `yarn serve` or `npm run serve` |
| **Branch to Deploy** | Select the branch of your repository that you want to deploy from. This is the branch that will be used to build your project when you commit new changes. |
| **Default Domain** | Set a default domain for your project. This must be unique and you will not able to change it. You can always add a custom domain later in your project settings. |
### Environment Variables
Any of the features in Payload Cloud that require environment variables will automatically be provided to your application. If your app requires any custom environment variables, you can set them here.
<Banner type="warning">
Note: For security reasons, any variables you wish to provide to the Admin
panel must be prefixed with `PAYLOAD_PUBLIC_`.  Learn more
[here](https://payloadcms.com/docs/admin/webpack#admin-environment-vars).
</Banner>
### Payment
Payment methods can be set per project and can be updated any time. You can use teams default payment method, or add a new one. Modify your payment methods in your Project settings / Team settings.
<Banner type="success">
<strong>Note:</strong> All Payload Cloud teams that deploy a project require a
card on file. This helps us prevent fraud and abuse on our platform. If you
select a plan with a free trial, you will not be charged until your trial
period is over. Well remind you 7 days before your trial ends and you can
cancel anytime.
</Banner>

View File

@@ -0,0 +1,53 @@
---
title: Getting Started
label: Getting Started
order: 10
desc: Get started with Payload Cloud, a deployment solution specifically designed for Node + MongoDB applications.
keywords: cloud, hosted, database, storage, email, deployment, serverless, node, mongodb, s3, aws, cloudflare, atlas, resend, payload, cms
---
A deployment solution specifically designed for Node.js + MongoDB applications, offering seamless deployment of your entire stack in one place. You can get started in minutes with a one-click template or bring your own codebase with you.
Payload Cloud offers various plans tailored to meet your specific needs, including a MongoDB Atlas database, S3 file storage, and email delivery powered by [Resend](https://resend.com). To see a full breakdown of features and plans, see our [Cloud Pricing page](https://payloadcms.com/cloud-pricing).
To get started, you first need to create an account. Head over to [the login screen](https://payloadcms.com/login) and **Register for Free**.
<Banner type="success">
To create your first project, you can either select [a
template](#starting-from-a-template) or [import an existing
project](#importing-from-an-existing-codebase) from GitHub.
</Banner>
## Starting from a Template
Templates come preconfigured and provide a one-click solution to quickly deploy a new application.
![Screen for creating a new project from a template](https://payloadcms.com/images/docs/cloud/create-from-template.jpg)
_Creating a new project from a template._
After creating an account, select your desired template from the Projects page. At this point, you need to connect to authorize the Payload Cloud application with your GitHub account. Click Continue with GitHub and follow the prompts to authorize the app.
Next, select your `GitHub Scope`. If you belong to multiple organizations, they will show up here. If you do not see the organization you are looking for, you may need to adjust your GitHub app permissions.
After selecting your scope, create a unique `repository name` and select whether you want your repository to be public or private on GitHub.
<Banner type="warning">
<strong>Note:</strong> Public repositories can be accessed by anyone online,
while private repositories grant access only to you and anyone you explicitly
authorize.
</Banner>
Once you are ready, click **Create Project**. This will clone the selected template to a new repository in your GitHub account, and take you to the configuration page to set up your project for deployment.
## Importing from an Existing Codebase
Payload Cloud works for any Node.js + MongoDB app. From the New Project page, select **import an existing Git codebase**. Choose the organization and select the repository you want to import. From here, you will be taken to the configuration page to set up your project for deployment.
![Screen for creating a new project from an existing repository](https://payloadcms.com/images/docs/cloud/create-from-existing.jpg)
_Creating a new project from an existing repository._
<Banner type="warning">
<strong>Note:</strong> In order to make use of the features of Payload Cloud
in your own codebase, you will need to add the [Cloud
Plugin](https://github.com/payloadcms/plugin-cloud) to your Payload app.
</Banner>

110
docs/cloud/projects.mdx Normal file
View File

@@ -0,0 +1,110 @@
---
title: Cloud Projects
label: Projects
order: 40
desc: Manage your Payload Cloud projects.
keywords: cloud, payload cloud, projects, project, overview, database, file storage, build settings, environment variables, custom domains, email, developing locally
---
### Overview
<Banner>
The overview tab shows your most recent deployment, along with build and
deployment logs. From here, you can see your live URL, deployment details like
timestamps and commit hash, as well as the status of your deployment. You can
also trigger a redeployment manually, which will rebuild your project using
the current configuration.
</Banner>
![Payload Cloud Overview Page](https://payloadcms.com/images/docs/cloud/overview-page.jpg)
_A screenshot of the Overview page for a Cloud project._
### Database
Your Payload Cloud project comes with a MongoDB serverless Atlas DB instance or a Dedicated Atlas cluster, depending on your plan. To interact with your cloud database, you will be provided with a MongoDB connection string. This can be found under the **Database** tab of your project.
`mongodb+srv://your_connection_string`
### File Storage
Payload Cloud gives you S3 file storage backed by Cloudflare as a CDN, and this plugin extends Payload so that all of your media will be stored in S3 rather than locally.
AWS Cognito is used for authentication to your S3 bucket. The [Payload Cloud Plugin](https://github.com/payloadcms/plugin-cloud) will automatically pick up these values. These values are only if you'd like to access your files directly, outside of Payload Cloud.
### Build Settings
You can update settings from your Projects Settings tab. Changes to your build settings will trigger a redeployment of your project.
### Environment Variables
From the Environment Variables page of the Settings tab, you can add, update and delete variables for use in your project. Like build settings, these changes will trigger a redeployment of your project.
<Banner>
Note: For security reasons, any variables you wish to provide to the Admin
panel must be prefixed with `PAYLOAD_PUBLIC_`.  Learn more
[here](https://payloadcms.com/docs/admin/webpack#admin-environment-vars).
</Banner>
### Custom Domains
With Payload Cloud, you can add custom domain names to your project. To do so, first go to the Domains page of the Settings tab of your project. Here you can see your default domain. To add a new domain, type in the domain name you wish to use.
<Banner>
Note: do not include the protocol (http:// or https://) or any routes (/page).
Only include the domain name and extension, and optionally a subdomain. -
your-domain.com - backend.your-domain.com
</Banner>
Once you click save, a DNS record will be generated for your domain name to point to your live project. Add this record into your DNS providers records, and once the records are resolving properly (this can take 1hr to 48hrs in some cases), your domain will now to point to your live project.
You will also need to configure your Payload project to use your specified domain. In your `payload.config.ts` file, specify your `serverURL` with your domain:
```ts
export default buildConfig({
serverURL: "https://example.com",
// the rest of your config,
});
```
### Email
Powered by [Resend](https://resend.com), Payload Cloud comes with integrated email support out of the box. No configuration is needed, and you can use `payload.sendEmail()` to send email right from your Payload app. To learn more about sending email with Payload, checkout the [Email Configuration](https://payloadcms.com/docs/email/overview) overview.
If you are on the Pro or Enterprise plan, you can add your own custom Email domain name. From the Email page of your projects Settings, add the domain you wish to use for email delivery. This will generate a set of DNS records. Add these records to your DNS provider and click verify to check that your records are resolving properly. Once verified, your emails will now be sent from your custom domain name.
### Developing Locally
To make changes to your project, you will need to clone the repository defined in your project settings to your local machine. In order to run your project locally, you will need configure your local environment first. Refer to your repositorys `README.md` file to see the steps needed for your specific template.
From there, you are ready to make updates to your project. When you are ready to make your changes live, commit your changes to the branch you specified in your Project settings, and your application will automatically trigger a redeploy and build from your latest commit.
### Cloud Plugin
Projects generated from a template will come pre-configured with the official Cloud Plugin, but if you are using your own repository you will need to add this into your project. To do so, add the plugin to your Payload config:
`yarn add @payloadcms/plugin-cloud`
```js
import { payloadCloud } from "@payloadcms/plugin-cloud";
import { buildConfig } from "payload/config";
export default buildConfig({
plugins: [payloadCloud()],
// rest of config
});
```
<Banner type="warning">
**Note:** If your Payload config already has an email with transport, this
will take precedence over Payload Cloud's email service.
</Banner>
##### **Optional configuration**
If you wish to opt-out of any Payload cloud features, the plugin also accepts options to do so.
```js
payloadCloud({
storage: false, // Disable file storage
email: false, // Disable email delivery
});
```

35
docs/cloud/teams.mdx Normal file
View File

@@ -0,0 +1,35 @@
---
title: Cloud Teams
label: Teams
order: 30
desc: Manage your Payload Cloud team and billing settings.
keywords: team, teams, billing, subscription, payment, plan, plans, cloud, payload cloud
---
<Banner>
Within Payload Cloud, the team management feature offers you the ability to
manage your organization, team members, billing, and subscription settings.
</Banner>
![Payload Cloud Team Settings](https://payloadcms.com/images/docs/cloud/team-settings.jpg)
_A screenshot of the Team Settings page._
### Members
Each team has members that can interact with your projects. You can invite multiple people to your team and each individual can belong to more than one team. You can assign them either `owner` or `user` permissions. Owners are able to make admin-only changes, such as deleting projects, and editing billing information.
### Adding Members
To add a new member to your team, visit your Teams Settings page, and click “Invite Teammate”. You can then add their email address, and assign their role. Press “Save” to send the invitations, which will send an email to the invited team member where they can create a new account.
### Billing
Users can update billing settings and subscriptions for any teams where they are designated as an `owner`. To make updates to the teams payment methods, visit the Billing page under the Team Settings tab. You can add new cards, delete cards, and set a payment method as a default. The default payment method will be used in the event that another payment method fails.
### Subscriptions
From the Subscriptions page, a team owner can see all current plans for their team. From here, you can see the price of each plan, if there is an active trial, and when you will be billed next.
### Invoices
The Invoices page will you show you the invoices for your account, as well as the status on their payment.

View File

@@ -12,21 +12,25 @@ It's often best practice to write your Collections in separate files and then im
## Options
| Option | Description |
|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **`slug`** * | Unique, URL-friendly string that will act as an identifier for this Collection. |
| **`fields`** * | Array of field types that will determine the structure and functionality of the data stored within this Collection. [Click here](/docs/fields/overview) for a full list of field types as well as how to configure them. |
| **`labels`** | Singular and plural labels for use in identifying this Collection throughout Payload. Auto-generated from slug if not defined. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-options). |
| **`hooks`** | Entry points to "tie in" to Collection actions at specific points. [More](/docs/hooks/overview#collection-hooks) |
| **`access`** | Provide access control functions to define exactly who should be able to do what with Documents in this Collection. [More](/docs/access-control/overview/#collections) |
| **`auth`** | Specify options if you would like this Collection to feature authentication. For more, consult the [Authentication](/docs/authentication/config) documentation. |
| **`upload`** | Specify options if you would like this Collection to support file uploads. For more, consult the [Uploads](/docs/upload/overview) documentation. |
| **`timestamps`** | Set to false to disable documents' automatically generated `createdAt` and `updatedAt` timestamps. |
| **`versions`** | Set to true to enable default options, or configure with object properties. [More](/docs/versions/overview#collection-config) |
| **`endpoints`** | Add custom routes to the REST API. [More](/docs/rest-api/overview#custom-endpoints) |
| **`graphQL`** | An object with `singularName` and `pluralName` strings used in schema generation. Auto-generated from slug if not defined. |
| **`typescript`** | An object with property `interface` as the text used in schema generation. Auto-generated from slug if not defined. |
| Option | Description |
|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **`slug`** * | Unique, URL-friendly string that will act as an identifier for this Collection. |
| **`fields`** * | Array of field types that will determine the structure and functionality of the data stored within this Collection. [Click here](/docs/fields/overview) for a full list of field types as well as how to configure them. |
| **`indexes`** * | Array of database indexes to create, including compound indexes that have multiple fields. |
| **`labels`** | Singular and plural labels for use in identifying this Collection throughout Payload. Auto-generated from slug if not defined. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-options). |
| **`hooks`** | Entry points to "tie in" to Collection actions at specific points. [More](/docs/hooks/overview#collection-hooks) |
| **`access`** | Provide access control functions to define exactly who should be able to do what with Documents in this Collection. [More](/docs/access-control/overview/#collections) |
| **`auth`** | Specify options if you would like this Collection to feature authentication. For more, consult the [Authentication](/docs/authentication/config) documentation. |
| **`upload`** | Specify options if you would like this Collection to support file uploads. For more, consult the [Uploads](/docs/upload/overview) documentation. |
| **`timestamps`** | Set to false to disable documents' automatically generated `createdAt` and `updatedAt` timestamps. |
| **`versions`** | Set to true to enable default options, or configure with object properties. [More](/docs/versions/overview#collection-config) |
| **`endpoints`** | Add custom routes to the REST API. [More](/docs/rest-api/overview#custom-endpoints) |
| **`graphQL`** | An object with `singularName` and `pluralName` strings used in schema generation. Auto-generated from slug if not defined. |
| **`typescript`** | An object with property `interface` as the text used in schema generation. Auto-generated from slug if not defined. |
| **`defaultSort`** | Pass a top-level field to sort by default in the collection List view. Prefix the name of the field with a minus symbol ("-") to sort in descending order. |
| **`pagination`** | Set pagination-specific options for this collection. [More](#pagination) |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -35,7 +39,7 @@ It's often best practice to write your Collections in separate files and then im
```ts
import { CollectionConfig } from 'payload/types';
const Orders: CollectionConfig = {
export const Orders: CollectionConfig = {
slug: 'orders',
fields: [
{
@@ -49,7 +53,7 @@ const Orders: CollectionConfig = {
relationTo: 'customers',
required: true,
}
]
],
};
```
@@ -61,18 +65,21 @@ You can find an assortment of [example collection configs](https://github.com/pa
You can customize the way that the Admin panel behaves on a collection-by-collection basis by defining the `admin` property on a collection's config.
| Option | Description |
| --------------------------- | -------------|
| `group` | Text used as a label for grouping collection links together in the navigation. |
| `hooks` | Admin-specific hooks for this collection. [More](#admin-hooks) |
| `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. |
| `description` | Text or React component to display below the Collection label in the List view to give editors more information. |
| `defaultColumns` | Array of field names that correspond to which columns to show by default in this collection's List view. |
| `disableDuplicate ` | Disables the "Duplicate" button while editing documents within this collection. |
| Option | Description |
|------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `group` | Text used as a label for grouping collection and global links together in the navigation. |
| `hidden` | Set to true or a function, called with the current user, returning true to exclude this collection from navigation and admin routing. |
| `hooks` | Admin-specific hooks for this collection. [More](#admin-hooks) |
| `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. |
| `description` | Text or React component to display below the Collection label in the List view to give editors more information. |
| `defaultColumns` | Array of field names that correspond to which columns to show by default in this collection's List view. |
| `disableDuplicate ` | Disables the "Duplicate" button while editing documents within this collection. |
| `hideAPIURL` | Hides the "API URL" meta field while editing documents within this collection. |
| `enableRichTextLink` | The [Rich Text](/docs/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. |
| `enableRichTextRelationship` | The [Rich Text](/docs/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. |
| `preview` | Function to generate preview URLS within the Admin panel that can point to your app. [More](#preview). |
| `components` | Swap in your own React components to be used within this collection. [More](/docs/admin/components#collections) |
| `listSearchableFields` | Specify which fields should be searched in the List search view. [More](#list-searchable-fields) |
| `preview` | Function to generate preview URLS within the Admin panel that can point to your app. [More](#preview). |
| `components` | Swap in your own React components to be used within this collection. [More](/docs/admin/components#collections) |
| `listSearchableFields` | Specify which fields should be searched in the List search view. [More](#list-searchable-fields) |
### Preview
@@ -90,7 +97,7 @@ If the function is specified, a Preview button will automatically appear in the
```ts
import { CollectionConfig } from 'payload/types';
const Posts: CollectionConfig = {
export const Posts: CollectionConfig = {
slug: 'posts',
fields: [
{
@@ -111,6 +118,15 @@ const Posts: CollectionConfig = {
};
```
### Pagination
Here are a few options that you can specify options for pagination on a collection-by-collection basis:
| Option | Description |
| --------------------------- | -------------|
| `defaultLimit` | Integer that specifies the default per-page limit that should be used. Defaults to 10. |
| `limits` | Provide an array of integers to use as per-page options for admins to choose from in the List view. |
### Access control
You can specify extremely granular access control (what users can do with documents in a collection) on a collection by collection basis. To learn more, go to the [Access Control](/docs/access-control/overview) docs.

View File

@@ -8,6 +8,40 @@ keywords: config, configuration, documentation, Content Management System, cms,
Payload utilizes a few Express-specific middleware packages within its own routers. You can customize how they work by passing in configuration options to the main Payload config's `express` property.
### Custom Middleware
Payload allows you to pass in custom Express middleware to be used on all of the routes it opens. This is useful for adding logging or any other custom functionality to your endpoints.
There are 2 exposed properties. Each property is an array of middleware functions.
- `preMiddleware` - runs before any of the Payload middleware
- `postMiddleware` - runs after all of the Payload middleware
```ts
{
express: {
preMiddleware: [
(req, res, next) => {
// do something
next()
}
],
postMiddleware: [
(req, res, next) => {
// do something
next()
}
]
}
}
// Example logging middleware function
const requestLoggerMiddleware = (req, res, next) => {
req.payload.logger.info(`request: ${req.method} ${req.url}`)
next()
}
```
### JSON
`express.json()` is used to parse JSON body content into JavaScript objects accessible on the Express `req`. Payload allows you to customize all of the `json` method's options. Common examples of customization use-cases are increasing the max allowed JSON body size which defaults to `2MB`.

View File

@@ -25,6 +25,7 @@ As with Collection configs, it's often best practice to write your Globals in se
| **`endpoints`** | Add custom routes to the REST API. [More](/docs/rest-api/overview#custom-endpoints) |
| **`graphQL.name`** | Text used in schema generation. Auto-generated from slug if not defined. |
| **`typescript`** | An object with property `interface` as the text used in schema generation. Auto-generated from slug if not defined. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
_\* An asterisk denotes that a property is required._
@@ -64,10 +65,13 @@ You can find an [example Global config](https://github.com/payloadcms/public-dem
You can customize the way that the Admin panel behaves on a Global-by-Global basis by defining the `admin` property on a Global's config.
| Option | Description |
| ------------ | ----------------------------------------------------------------------------------------------------------------------- |
| `components` | Swap in your own React components to be used within this Global. [More](/docs/admin/components#globals) |
| `preview` | Function to generate a preview URL within the Admin panel for this global that can point to your app. [More](#preview). |
| Option | Description |
|--------------|-----------------------------------------------------------------------------------------------------------------------------------|
| `group` | Text used as a label for grouping collection and global links together in the navigation. |
| `hidden` | Set to true or a function, called with the current user, returning true to exclude this global from navigation and admin routing. |
| `components` | Swap in your own React components to be used within this Global. [More](/docs/admin/components#globals) |
| `preview` | Function to generate a preview URL within the Admin panel for this global that can point to your app. [More](#preview). |
| `hideAPIURL` | Hides the "API URL" meta field while editing documents within this collection. |
### Preview
@@ -85,7 +89,7 @@ If the function is specified, a Preview button will automatically appear in the
```ts
import { GlobalConfig } from "payload/types";
const MyGlobal: GlobalConfig = {
export const MyGlobal: GlobalConfig = {
slug: "my-global",
fields: [
{

View File

@@ -11,42 +11,49 @@ Not only does Payload support managing localized content, it also has internatio
While Payload's built-in features come translated, you may want to also translate parts of your project's configuration too. This is possible in places like collections and globals labels and groups, field labels, descriptions and input placeholder text. The admin UI will display all the correct translations you provide based on the user's language.
Here is an example of a simple collection supporting both English and Spanish editors:
```ts
const Articles: CollectionConfig = {
slug: 'articles',
import { CollectionConfig } from "payload/types";
export const Articles: CollectionConfig = {
slug: "articles",
labels: {
singular: {
en: 'Article', es: 'Artículo',
en: "Article",
es: "Artículo",
},
plural: {
en: 'Articles', es: 'Artículos',
en: "Articles",
es: "Artículos",
},
},
admin: {
group: { en: 'Content', es: 'Contenido' },
group: { en: "Content", es: "Contenido" },
},
fields: [
{
name: 'title',
type: 'text',
name: "title",
type: "text",
label: {
en: 'Title', es: 'Título',
en: "Title",
es: "Título",
},
admin: {
placeholder: { en: 'Enter title', es: 'Introduce el título' }
}
placeholder: { en: "Enter title", es: "Introduce el título" },
},
},
{
name: 'type',
type: 'radio',
options: [{
value: 'news',
label: { en: 'News', es: 'Noticias' },
}, // etc...
name: "type",
type: "radio",
options: [
{
value: "news",
label: { en: "News", es: "Noticias" },
}, // etc...
],
},
],
}
};
```
### Admin UI
@@ -55,8 +62,8 @@ The Payload admin panel reads the language settings of a user's browser and disp
After a user logs in, they can change their language selection in the `/account` view.
<Banner>
<strong>Note:</strong><br/>
If there is a language that Payload does not yet support, we accept code <a href="https://github.com/payloadcms/payload/blob/master/contributing.md">contributions</a>.
<strong>Note:</strong><br />
If there is a language that Payload does not yet support, we accept code [contributions](https://github.com/payloadcms/payload/blob/master/contributing.md).
</Banner>
### Node Express
@@ -74,21 +81,22 @@ In your Payload config, you can add translations and customize the settings in `
**Example Payload config extending i18n:**
```ts
import { buildConfig } from 'payload/config'
import { buildConfig } from "payload/config";
export default buildConfig({
//...
i18n: {
fallbackLng: 'en', // default
fallbackLng: "en", // default
debug: false, // default
resources: {
en: {
custom: { // namespace can be anything you want
key1: 'Translation with {{variable}}', // translation
custom: {
// namespace can be anything you want
key1: "Translation with {{variable}}", // translation
},
// override existing translation keys
general: {
dashboard: 'Home',
dashboard: "Home",
},
},
},

View File

@@ -72,6 +72,15 @@ All field types with a `name` property support the `localized` property—even t
Enabling localization for field types that support nested fields will automatically create localized "sets" of all fields contained within the field. For example, if you have a page layout using a blocks field type, you have the choice of either localizing the full layout, by enabling localization on the top-level blocks field, or only certain fields within the layout.
</Banner>
<Banner type="warning">
<strong>Important:</strong>
<br />
When converting an existing field to or from `localized: true` the data
structure in the document will change for this field and so existing data for
this field will be lost. Before changing the localization setting on fields
with existing data, you may need to consider a field migration strategy.
</Banner>
### Retrieving localized docs
When retrieving documents, you can specify which locale you'd like to receive as well as which fallback locale should be used.

View File

@@ -43,6 +43,7 @@ Payload is a _config-based_, code-first CMS and application framework. The Paylo
| `hooks` | Tap into Payload-wide hooks. [More](/docs/hooks/overview) |
| `plugins` | An array of Payload plugins. [More](/docs/plugins/overview) |
| `endpoints` | An array of custom API endpoints added to the Payload router. [More](/docs/rest-api/overview#custom-endpoints) |
| `custom` | Extension point for adding custom data (e.g. for plugins) |
#### Simple example
@@ -104,6 +105,8 @@ require('dotenv').config()
// the rest of your `server.js` file goes here
```
Note that if you rely on any environment variables in your config itself, you should also call `dotenv()` at the top of your config itself as well. There's no harm in calling it in both your server and your config itself!
**Here is an example project structure w/ `dotenv` and an `.env` file:**
```
@@ -119,27 +122,36 @@ project-name
<br />
If you use an environment variable to configure any properties that are
required for the Admin panel to function (ex. serverURL or any routes), you
need to make sure that your Admin panel code can access it.{" "}
<a href="/docs/admin/webpack#admin-environment-vars">Click here</a> for more
info.
need to make sure that your Admin panel code can access it. [Click
here](/docs/admin/webpack#admin-environment-vars) for more info.
</Banner>
### Customizing & overriding the config location
### Customizing & Automating Config Location Detection
By default, the Payload config must be in the root of your current working directory and named either `payload.config.js` or `payload.config.ts` if you're using TypeScript.
Payload is designed to automatically locate your configuration file. By default, it will first look in the root of your current working directory for a file named `payload.config.js` or `payload.config.ts` if you're using TypeScript.
But, you can specify where your Payload config is located as well as what it's named by using the environment variable `PAYLOAD_CONFIG_PATH`. The path you provide via this environment variable can either be absolute or relative to your current working directory.
In development mode, if the configuration file is not found at the root, Payload will attempt to read your `tsconfig.json`, and search in the directory specified in `compilerOptions.rootDir` (typically "src").
In production mode, Payload will first attempt to find the config file in the output directory specified in `compilerOptions.outDir` of your `tsconfig.json`, then fallback to the source directory (`compilerOptions.rootDir`), and finally will check the 'dist' directory.
Please ensure your `tsconfig.json` is properly configured if you want Payload to accurately auto-detect your configuration file location. If `tsconfig.json` does not exist or doesn't specify `rootDir` or `outDir`, Payload will default to the current working directory.
#### Overriding the Config Location
In addition to the above automated detection, you can specify your own location for the Payload config file. This is done by using the environment variable `PAYLOAD_CONFIG_PATH`. The path you provide via this environment variable can either be absolute or relative to your current working directory. This can be useful in situations where your Payload config is not in a standard location, or you wish to switch between multiple configurations.
**Example in package.json:**
```
```json
{
"scripts": {
"dev": "PAYLOAD_CONFIG_PATH=path/to/custom-config.js node server.js",
}
"scripts": {
"dev": "PAYLOAD_CONFIG_PATH=path/to/custom-config.js node server.js",
}
}
```
When `PAYLOAD_CONFIG_PATH` is set, Payload will use this path to load the configuration, bypassing all automated detection.
### Developing within the Config
Payload comes with `isomorphic-fetch` installed which means that even in Node, you can use the `fetch` API just as you would within the browser. No need to import `axios` or similar, unless you want to!

View File

@@ -25,21 +25,22 @@ in the `email` property object of your payload init call. Payload will make use
The following options are configurable in the `email` property object as part of the options object when calling payload.init().
| Option | Description |
| ---------------------------- | -------------|
| **`fromName`** * | The name part of the From field that will be seen on the delivered email |
| **`fromAddress`** * | The email address part of the From field that will be used when delivering email |
| **`transport`** | The NodeMailer transport object for when you want to do it yourself, not needed when transportOptions is set |
| **`transportOptions`** | An object that configures the transporter that Payload will create. For all the available options see the [NodeMailer documentation](https://nodemailer.com/smtp/) or see the examples below |
| **`logMockCredentials`** | If set to true and no transport/transportOptions, ethereal credentials will be logged to console on startup |
| Option | Description |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`fromName`** \* | The name part of the From field that will be seen on the delivered email |
| **`fromAddress`** \* | The email address part of the From field that will be used when delivering email |
| **`transport`** | The NodeMailer transport object for when you want to do it yourself, not needed when transportOptions is set |
| **`transportOptions`** | An object that configures the transporter that Payload will create. For all the available options see the [NodeMailer documentation](https://nodemailer.com/smtp/) or see the examples below |
| **`logMockCredentials`** | If set to true and no transport/transportOptions, ethereal credentials will be logged to console on startup |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Use SMTP
Simple Mail Transfer Protocol, also known as SMTP can be passed in using the `transportOptions` object on the `email` options.
**Example email part using SMTP:**
```ts
payload.init({
email: {
@@ -47,24 +48,24 @@ payload.init({
host: process.env.SMTP_HOST,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS
pass: process.env.SMTP_PASS,
},
port: 587,
secure: true, // use TLS
tls: {
// do not fail on invalid certs
rejectUnauthorized: false
}
rejectUnauthorized: false,
},
fromName: 'hello',
fromAddress: 'hello@example.com'
}
},
fromName: "hello",
fromAddress: "hello@example.com",
},
// ...
})
});
```
<Banner type="warning">
It is best practice to avoid saving credentials or API keys directly in your code, use <a href="/docs/configuration/overview#using-environment-variables-in-your-config">environment variables</a>.
It is best practice to avoid saving credentials or API keys directly in your code, use [environment variables](/docs/configuration/overview#using-environment-variables-in-your-config).
</Banner>
### Use an email service
@@ -72,57 +73,62 @@ payload.init({
Many third party mail providers are available and offer benefits beyond basic SMTP. As an example your payload init could look this if you wanted to use SendGrid.com though the same approach would work for any other [NodeMailer transports](https://nodemailer.com/transports/) shown here or provided by another third party.
```ts
import payload from 'payload'
import nodemailerSendgrid from 'nodemailer-sendgrid'
import payload from "payload";
import nodemailerSendgrid from "nodemailer-sendgrid";
const sendGridAPIKey = process.env.SENDGRID_API_KEY;
payload.init({
...sendGridAPIKey ? {
email: {
transportOptions: nodemailerSendgrid({
apiKey: sendGridAPIKey,
}),
fromName: 'Admin',
fromAddress: 'admin@example.com',
},
} : {},
...(sendGridAPIKey
? {
email: {
transportOptions: nodemailerSendgrid({
apiKey: sendGridAPIKey,
}),
fromName: "Admin",
fromAddress: "admin@example.com",
},
}
: {}),
});
```
### Use a custom NodeMailer transport
To take full control of the mail transport you may wish to use `nodemailer.createTransport()` on your server and provide it to Payload init.
```ts
import payload from 'payload'
import nodemailer from 'nodemailer'
import payload from "payload";
import nodemailer from "nodemailer";
const payload = require('payload');
const nodemailer = require('nodemailer');
const payload = require("payload");
const nodemailer = require("nodemailer");
const transport = await nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: 587,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS
pass: process.env.SMTP_PASS,
},
});
payload.init({
email: {
fromName: 'Admin',
fromAddress: 'admin@example.com',
transport
fromName: "Admin",
fromAddress: "admin@example.com",
transport,
},
// ...
});
```
### Sending Mail
With a working transport you can call it anywhere you have access to payload by calling `payload.sendEmail(message)`. The `message` will contain the `to`, `subject` and `email` or `text` for the email being sent. To see all available message configuration options see [NodeMailer](https://nodemailer.com/message).
### Mock transport
By default, Payload uses a mock implementation that only sends mail to the [ethereal](https://ethereal.email) capture service that will never reach a user's inbox. While in development you may wish to make use of the captured messages which is why the payload output during server output helpfully logs this out on the server console.
To see ethereal credentials, add `logMockCredentials: true` to the email options. This will cause them to be logged to console on startup.
@@ -130,8 +136,8 @@ To see ethereal credentials, add `logMockCredentials: true` to the email options
```ts
payload.init({
email: {
fromName: 'Admin',
fromAddress: 'admin@example.com',
fromName: "Admin",
fromAddress: "admin@example.com",
logMockCredentials: true, // Optional
},
// ...
@@ -139,11 +145,12 @@ payload.init({
```
**Console output when starting payload with a mock email instance and logMockCredentials: true**
```
[06:37:21] INFO (payload): Starting Payload...
[06:37:22] INFO (payload): Payload Demo Initialized
[06:37:22] INFO (payload): listening on 3000...
[06:37:22] INFO (payload): Connected to Mongo server successfully!
[06:37:22] INFO (payload): Connected to MongoDB server successfully!
[06:37:23] INFO (payload): E-mail configured with mock configuration
[06:37:23] INFO (payload): Log into mock email provider at https://ethereal.email
[06:37:23] INFO (payload): Mock email account username: hhav5jw7doo4euev@ethereal.email

View File

@@ -6,92 +6,104 @@ desc: Array fields are intended for sets of repeating fields, that you define. L
keywords: array, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
The Array field type is used when you need to have a set of "repeating" fields. It stores an array of objects containing the fields that you define. Its uses can be simple or highly complex.
<Banner>
The Array field type is used when you need to have a set of "repeating"
fields. It stores an array of objects containing the fields that you define.
Its uses can be simple or highly complex.
</Banner>
<LightDarkImage
srcLight="https://payloadcms.com/images/docs/fields/array.png"
srcDark="https://payloadcms.com/images/docs/fields/array-dark.png"
alt="Array field with two Rows in Payload admin panel"
caption="Admin panel screenshot of an Array field with two Rows"
/>
**Example uses:**
- A "slider" with an image ([upload field](/docs/fields/upload)) and a caption ([text field](/docs/fields/text))
- Navigational structures where editors can specify nav items containing pages ([relationship field](/docs/fields/relationship)), an "open in new tab" [checkbox field](/docs/fields/checkbox)
- Event agenda "timeslots" where you need to specify start & end time ([date field](/docs/fields/date)), label ([text field](/docs/fields/text)), and Learn More page [relationship](/docs/fields/relationship)
![Array field in Payload admin panel](https://payloadcms.com/images/docs/fields/array.jpg)
*Admin panel screenshot of an Array field with a Row containing two text fields, a read-only text field and a checkbox*
### Config
| Option | Description |
| ---------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as the heading in the Admin panel or an object with keys for each language. Auto-generated from name if not defined. |
| **`fields`** * | Array of field types to correspond to each row of the Array. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`access`** | Provide field-based access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
| **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API or the Admin panel. |
| **`defaultValue`** | Provide an array of row data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. If enabled, a separate, localized set of all data within this Array will be kept, so there is no need to specify each nested field as `localized`. |
| **`required`** | Require this field to have a value. |
| **`labels`** | Customize the row labels appearing in the Admin dashboard. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| Option | Description |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as the heading in the Admin panel or an object with keys for each language. Auto-generated from name if not defined. |
| **`fields`** \* | Array of field types to correspond to each row of the Array. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation)
| **`minRows`** | A number for the fewest allowed items during validation when a value is present. |
| **`maxRows`** | A number for the most allowed items during validation when a value is present. |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`access`** | Provide field-based access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
| **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API or the Admin panel. |
| **`defaultValue`** | Provide an array of row data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. If enabled, a separate, localized set of all data within this Array will be kept, so there is no need to specify each nested field as `localized`. |
| **`required`** | Require this field to have a value. |
| **`labels`** | Customize the row labels appearing in the Admin dashboard. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
| **`interfaceName`** | Create a top level, reusable [Typescript interface](/docs/typescript/generating-types#custom-field-interfaces) & [GraphQL type](/docs/graphql/graphql-schema#custom-field-schemas). |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Admin Config
In addition to the default [field admin config](/docs/fields/overview#admin-config), you can adjust the following properties:
| Option | Description |
| ---------------------- | ------------------------------- |
| **`initCollapsed`** | Set the initial collapsed state |
| **`components.RowLabel`** | Function or React component to be rendered as the label on the array row. Receives `({ data, index, path })` as args |
| Option | Description |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **`initCollapsed`** | Set the initial collapsed state |
| **`components.RowLabel`** | Function or React component to be rendered as the label on the array row. Receives `({ data, index, path })` as args |
### Example
`collections/ExampleCollection.ts`
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
```ts
import { CollectionConfig } from "payload/types";
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
name: 'slider', // required
type: 'array', // required
label: 'Image Slider',
name: "slider", // required
type: "array", // required
label: "Image Slider",
minRows: 2,
maxRows: 10,
interfaceName: "CardSlider", // optional
labels: {
singular: 'Slide',
plural: 'Slides',
singular: "Slide",
plural: "Slides",
},
fields: [ // required
fields: [
// required
{
name: 'title',
type: 'text',
name: "title",
type: "text",
},
{
name: 'image',
type: 'upload',
relationTo: 'media',
name: "image",
type: "upload",
relationTo: "media",
required: true,
},
{
name: 'caption',
type: 'text',
}
name: "caption",
type: "text",
},
],
admin: {
components: {
RowLabel: ({ data, index }) => {
return data?.title || `Slide ${String(index).padStart(2, '0')}`;
return data?.title || `Slide ${String(index).padStart(2, "0")}`;
},
},
},
}
]
},
],
};
```

View File

@@ -6,65 +6,81 @@ desc: The Blocks field type is a great layout build and can be used to construct
keywords: blocks, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
The Blocks field type is <strong>incredibly powerful</strong> and can be used as a <em>layout builder</em> as well as to define any other flexible content model you can think of. It stores an array of objects, where each object must match the shape of one of your provided block configs.
<Banner>
The Blocks field type is <strong>incredibly powerful</strong> and can be used
as a <em>layout builder</em> as well as to define any other flexible content
model you can think of. It stores an array of objects, where each object must
match the shape of one of your provided block configs.
</Banner>
<LightDarkImage
srcLight="https://payloadcms.com/images/docs/fields/blocks.png"
srcDark="https://payloadcms.com/images/docs/fields/blocks-dark.png"
alt="Admin panel screenshot of add Blocks drawer view"
caption="Admin panel screenshot of add Blocks drawer view"
/>
**Example uses:**
- A layout builder tool that grants editors to design highly customizable page or post layouts. Blocks could include configs such as `Quote`, `CallToAction`, `Slider`, `Content`, `Gallery`, or others.
- A form builder tool where available block configs might be `Text`, `Select`, or `Checkbox`.
- Virtual event agenda "timeslots" where a timeslot could either be a `Break`, a `Presentation`, or a `BreakoutSession`.
![Blocks field in Payload admin panel](https://payloadcms.com/images/docs/fields/blocks.jpg)
*Admin panel screenshot of a Blocks field type with Call to Action and Number block examples*
### Field config
| Option | Description |
|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as the heading in the Admin panel or an object with keys for each language. Auto-generated from name if not defined. |
| **`label`** | Text used as the heading in the Admin panel or an object with keys for each language. Auto-generated from name if not defined. |
| **`blocks`** * | Array of [block configs](/docs/fields/blocks#block-configs) to be made available to this field. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation)
| **`minRows`** | A number for the fewest allowed items during validation when a value is present. |
| **`maxRows`** | A number for the most allowed items during validation when a value is present. |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-level hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`access`** | Provide field-level access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
| **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API response or the Admin panel. |
| **`defaultValue`** | Provide an array of block data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. If enabled, a separate, localized set of all data within this field will be kept, so there is no need to specify each nested field as `localized`. || **`required`** | Require this field to have a value. |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. If enabled, a separate, localized set of all data within this field will be kept, so there is no need to specify each nested field as `localized`. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`labels`** | Customize the block row labels appearing in the Admin dashboard. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Admin Config
In addition to the default [field admin config](/docs/fields/overview#admin-config), you can adjust the following properties:
| Option | Description |
| ---------------------- | ------------------------------- |
| **`initCollapsed`** | Set the initial collapsed state |
| Option | Description |
| ------------------- | ------------------------------- |
| **`initCollapsed`** | Set the initial collapsed state |
### Block configs
Blocks are defined as separate configs of their own.
<Banner type="success">
<strong>Tip:</strong><br />
Best practice is to define each block config in its own file, and then import them into your Blocks field as necessary. This way each block config can be easily shared between fields. For instance, using the "layout builder" example, you might want to feature a few of the same blocks in a Post collection as well as a Page collection. Abstracting into their own files trivializes their reusability.
<strong>Tip:</strong>
<br />
Best practice is to define each block config in its own file, and then import
them into your Blocks field as necessary. This way each block config can be
easily shared between fields. For instance, using the "layout builder"
example, you might want to feature a few of the same blocks in a Post
collection as well as a Page collection. Abstracting into their own files
trivializes their reusability.
</Banner>
| Option | Description |
|----------------------------|---------------------------------------------------------------------------------------------------------|
| **`slug`** * | Identifier for this block type. Will be saved on each block as the `blockType` property. |
| **`fields`** * | Array of fields to be stored in this block. |
| **`labels`** | Customize the block labels that appear in the Admin dashboard. Auto-generated from slug if not defined. |
| **`imageURL`** | Provide a custom image thumbnail to help editors identify this block in the Admin UI. |
| **`imageAltText`** | Customize this block's image thumbnail alt text. |
| **`graphQL.singularName`** | Text to use for the GraphQL schema name. Auto-generated from slug if not defined |
| Option | Description |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`slug`** \* | Identifier for this block type. Will be saved on each block as the `blockType` property. |
| **`fields`** \* | Array of fields to be stored in this block. |
| **`labels`** | Customize the block labels that appear in the Admin dashboard. Auto-generated from slug if not defined. |
| **`imageURL`** | Provide a custom image thumbnail to help editors identify this block in the Admin UI. |
| **`imageAltText`** | Customize this block's image thumbnail alt text. |
| **`interfaceName`** | Create a top level, reusable [Typescript interface](/docs/typescript/generating-types#custom-field-interfaces) & [GraphQL type](/docs/graphql/graphql-schema#custom-field-schemas). |
| **`graphQL.singularName`** | Text to use for the GraphQL schema name. Auto-generated from slug if not defined. NOTE: this is set for deprecation, prefer `interfaceName`. |
#### Auto-generated data per block
@@ -81,6 +97,7 @@ The Admin panel provides each block with a `blockName` field which optionally al
### Example
`collections/ExampleCollection.js`
```ts
import { Block, CollectionConfig } from 'payload/types';
@@ -88,7 +105,9 @@ const QuoteBlock: Block = {
slug: 'Quote', // required
imageURL: 'https://google.com/path/to/image.jpg',
imageAltText: 'A nice thumbnail image to show what this block looks like',
fields: [ // required
interfaceName: 'QuoteBlock', // optional
fields: [
// required
{
name: 'quoteHeader',
type: 'text',
@@ -98,10 +117,10 @@ const QuoteBlock: Block = {
name: 'quoteText',
type: 'text',
},
]
],
};
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{
@@ -109,13 +128,13 @@ const ExampleCollection: CollectionConfig = {
type: 'blocks', // required
minRows: 1,
maxRows: 20,
blocks: [ // required
QuoteBlock
]
}
]
}
blocks: [
// required
QuoteBlock,
],
},
],
};
```
### TypeScript
@@ -124,5 +143,4 @@ As you build your own Block configs, you might want to store them in separate fi
```ts
import type { Block } from 'payload/types';
```

View File

@@ -10,6 +10,13 @@ keywords: checkbox, fields, config, configuration, documentation, Content Manage
The Checkbox field type saves a boolean in the database.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/checkbox.png'
srcDark='https://payloadcms.com/images/docs/fields/checkbox-dark.png'
alt='Checkbox field with text field in Payload admin panel'
caption='Admin panel screenshot of Checkbox field with Text field below'
/>
### Config
| Option | Description |
@@ -26,6 +33,7 @@ keywords: checkbox, fields, config, configuration, documentation, Content Manage
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -35,7 +43,7 @@ keywords: checkbox, fields, config, configuration, documentation, Content Manage
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -11,6 +11,13 @@ keywords: code, fields, config, configuration, documentation, Content Management
The Code field type saves a string in the database, but provides the Admin panel with a code editor styled interface.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/code.png'
srcDark='https://payloadcms.com/images/docs/fields/code-dark.png'
alt='Shows a Code field in the Payload admin panel'
caption='Admin panel screenshot of a Code field'
/>
This field uses the `monaco-react` editor syntax highlighting.
### Config
@@ -32,6 +39,7 @@ This field uses the `monaco-react` editor syntax highlighting.
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
_\* An asterisk denotes that a property is required._
@@ -42,7 +50,7 @@ In addition to the default [field admin config](/docs/fields/overview#admin-conf
| Option | Description |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`language`** | This property can be set to any language listed [here](https://github.com/microsoft/monaco-editor/tree/main/src/basic-languages). |
| **`editorOptions`** | Options that can be passed to the monaco editor, [view the full list](https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.IDiffEditorConstructionOptions.html). |
| **`editorOptions`** | Options that can be passed to the monaco editor, [view the full list](https://microsoft.github.io/monaco-editor/typedoc/interfaces/editor.IDiffEditorConstructionOptions.html). |
### Example
@@ -50,7 +58,7 @@ In addition to the default [field admin config](/docs/fields/overview#admin-conf
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -10,6 +10,13 @@ keywords: row, fields, config, configuration, documentation, Content Management
The Collapsible field is presentational-only and only affects the Admin panel. By using it, you can place fields within a nice layout component that can be collapsed / expanded.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/collapsible.png'
srcDark='https://payloadcms.com/images/docs/fields/collapsible-dark.png'
alt='Shows a Collapsible field in the Payload admin panel'
caption='Admin panel screenshot of a Collapsible field'
/>
### Config
| Option | Description |
@@ -17,6 +24,7 @@ keywords: row, fields, config, configuration, documentation, Content Management
| **`label`** * | A label to render within the header of the collapsible component. This can be a string, function or react component. Function/components receive `({ data, path })` as args. |
| **`fields`** * | Array of field types to nest within this Collapsible. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -34,7 +42,7 @@ In addition to the default [field admin config](/docs/fields/overview#admin-conf
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -11,6 +11,13 @@ keywords: date, fields, config, configuration, documentation, Content Management
with a customizable time picker interface.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/date.png'
srcDark='https://payloadcms.com/images/docs/fields/date-dark.png'
alt='Shows a Date field in the Payload admin panel'
caption='Admin panel screenshot of a Date field'
/>
This field uses [`react-datepicker`](https://www.npmjs.com/package/react-datepicker) for the Admin panel component.
### Config
@@ -18,7 +25,7 @@ This field uses [`react-datepicker`](https://www.npmjs.com/package/react-datepic
| Option | Description |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`index`** | Build a [MongoDB index](https://docs.mongodb.com/manual/indexes/) for this field to produce faster queries. Set this field to `true` if your users will perform queries on this field's data often. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
@@ -28,7 +35,8 @@ This field uses [`react-datepicker`](https://www.npmjs.com/package/react-datepic
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
_\* An asterisk denotes that a property is required._
@@ -36,45 +44,72 @@ _\* An asterisk denotes that a property is required._
In addition to the default [field admin config](/docs/fields/overview#admin-config), you can customize the following fields that will adjust how the component displays in the admin panel via the `date` property.
| Option | Description |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`pickerAppearance`** | Determines the appearance of the datepicker: `dayAndTime` `timeOnly` `dayOnly` `monthOnly`. Defaults to `dayAndTime`. |
| **`displayFormat`** | Determines how the date is presented. dayAndTime default to `MMM d, yyy h:mm a` timeOnly defaults to `h:mm a` dayOnly defaults to `MMM d, yyy` and monthOnly defaults to `MM/yyyy`. |
| **`placeholder`** | Placeholder text for the field. |
| **`monthsToShow`** | Number of months to display max is 2. Defaults to 1. |
| **`minDate`** | Passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). |
| **`maxDate`** | Passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). |
| **`minTime`** | Passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). |
| **`maxTime`** | Passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). |
| **`timeIntervals`** | Passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). Defaults to 30 minutes. |
| **`timeFormat`** | Passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). Defaults to `'h:mm aa'`. |
| Property | Description |
| ------------------------------ | ------------------------------------------------------------------------------------------- |
| **`placeholder`** | Placeholder text for the field. |
| **`date`** | Pass options to customize date field appearance. |
| **`date.displayFormat`** | Format date to be shown in field **cell**. |
| **`date.pickerAppearance`** \* | Determines the appearance of the datepicker: `dayAndTime` `timeOnly` `dayOnly` `monthOnly`. |
| **`date.monthsToShow`** \* | Number of months to display max is 2. Defaults to 1. |
| **`date.minDate`** \* | Min date value to allow. |
| **`date.maxDate`** \* | Max date value to allow. |
| **`date.minTime`** \* | Min time value to allow. |
| **`date.maxTime`** \* | Max date value to allow. |
| **`date.timeIntervals`** \* | Time intervals to display. Defaults to 30 minutes. |
| **`date.timeFormat`** \* | Determines time format. Defaults to `'h:mm aa'`. |
_\* An asterisk denotes that a property is required._
_\* This property is passed directly to [react-datepicker](https://github.com/Hacker0x01/react-datepicker/blob/master/docs/datepicker.md). ._
Common use cases for customizing the `date` property are to restrict your field to only show time or day input—but lots more can be done.
#### Display Format and Picker Appearance
These properties only affect how the date is displayed in the UI. The full date is always stored in the format `YYYY-MM-DDTHH:mm:ss.SSSZ` (e.g. `1999-01-01T8:00:00.000+05:00`).
`displayFormat` determines how the date is presented in the field **cell**, you can pass any valid (unicode date format)[https://date-fns.org/v2.29.3/docs/format].
`pickerAppearance` sets the appearance of the **react datepicker**, the options available are `dayAndTime`, `dayOnly`, `timeOnly`, and `monthOnly`. By default, the datepicker will display `dayOnly`.
When only `pickerAppearance` is set, an equivalent format will be rendered in the date field cell. To overwrite this format, set `displayFormat`.
### Example
`collections/ExampleCollection.ts`
```ts
import { CollectionConfig } from 'payload/types';
import { CollectionConfig } from "payload/types";
const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
name: 'time', // required
type: 'date', // required
label: 'Event Start Time',
defaultValue: '1988-11-05T8:00:00.000+05:00',
name: "dateOnly",
type: "date",
admin: {
date: {
// All config options above should be placed here
pickerAppearance: 'timeOnly',
}
}
}
]
pickerAppearance: "dayOnly",
displayFormat: "d MMM yyy",
},
},
},
{
name: "timeOnly",
type: "date",
admin: {
date: {
pickerAppearance: "timeOnly",
displayFormat: "h:mm:ss a",
},
},
},
{
name: "monthOnly",
type: "date",
admin: {
date: {
pickerAppearance: "monthOnly",
displayFormat: "MMMM yyyy",
},
},
},
],
};
```

View File

@@ -6,10 +6,17 @@ desc: The Email field enforces that the value provided is a valid email address.
keywords: email, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
<Banner>
The Email field enforces that the value provided is a valid email address.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/email.png'
srcDark='https://payloadcms.com/images/docs/fields/email-dark.png'
alt='Shows an Email field in the Payload admin panel'
caption='Admin panel screenshot of an Email field'
/>
### Config
| Option | Description |
@@ -27,6 +34,7 @@ keywords: email, fields, config, configuration, documentation, Content Managemen
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -48,7 +56,7 @@ Set this property to a string that will be used for browser autocomplete.
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -6,28 +6,37 @@ desc: The Group field allows other fields to be nested under a common property.
keywords: group, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
The Group field allows fields to be nested under a common property name. It also groups fields together visually in the Admin panel.
<Banner>
The Group field allows fields to be nested under a common property name. It
also groups fields together visually in the Admin panel.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/group.png'
srcDark='https://payloadcms.com/images/docs/fields/group-dark.png'
alt='Shows a Group field in the Payload admin panel'
caption='Admin panel screenshot of a Group field'
/>
### Config
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`fields`** * | Array of field types to nest within this Group. |
| **`label`** | Used as a heading in the Admin panel and to name the generated GraphQL type. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`access`** | Provide field-based access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
| **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API or the Admin panel. |
| **`defaultValue`** | Provide an object of data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. If enabled, a separate, localized set of all data within this Group will be kept, so there is no need to specify each nested field as `localized`. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| Option | Description |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`fields`** \* | Array of field types to nest within this Group. |
| **`label`** | Used as a heading in the Admin panel and to name the generated GraphQL type. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`access`** | Provide field-based access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
| **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API or the Admin panel. |
| **`defaultValue`** | Provide an object of data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. If enabled, a separate, localized set of all data within this Group will be kept, so there is no need to specify each nested field as `localized`. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
| **`interfaceName`** | Create a top level, reusable [Typescript interface](/docs/typescript/generating-types#custom-field-interfaces) & [GraphQL type](/docs/graphql/graphql-schema#custom-field-schemas). |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Admin config
@@ -40,32 +49,35 @@ Set this property to `true` to hide this field's gutter within the admin panel.
### Example
`collections/ExampleCollection.ts`
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
```ts
import { CollectionConfig } from "payload/types";
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
name: 'pageMeta', // required
type: 'group', // required
fields: [ // required
name: "pageMeta", // required
type: "group", // required
interfaceName: "Meta", // optional
fields: [
// required
{
name: 'title',
type: 'text',
name: "title",
type: "text",
required: true,
minLength: 20,
maxLength: 100,
},
{
name: 'description',
type: 'textarea',
name: "description",
type: "textarea",
required: true,
minLength: 40,
maxLength: 160,
}
},
],
}
]
},
],
};
```

View File

@@ -11,6 +11,13 @@ keywords: json, fields, config, configuration, documentation, Content Management
The JSON field type saves actual JSON in the database, which differs from the Code field that saves the value as a string in the database.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/json.png'
srcDark='https://payloadcms.com/images/docs/fields/json-dark.png'
alt='Shows a JSON field in the Payload admin panel'
caption='Admin panel screenshot of a JSON field'
/>
This field uses the `monaco-react` editor syntax highlighting.
### Config
@@ -30,6 +37,7 @@ This field uses the `monaco-react` editor syntax highlighting.
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
_\* An asterisk denotes that a property is required._
@@ -47,7 +55,7 @@ In addition to the default [field admin config](/docs/fields/overview#admin-conf
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -10,6 +10,13 @@ keywords: number, fields, config, configuration, documentation, Content Manageme
The Number field stores and validates numeric entry and supports additional numerical validation and formatting features.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/number.png'
srcDark='https://payloadcms.com/images/docs/fields/number-dark.png'
alt='Shows a Number field in the Payload admin panel'
caption='Admin panel screenshot of a Number field'
/>
### Config
| Option | Description |
@@ -18,6 +25,9 @@ keywords: number, fields, config, configuration, documentation, Content Manageme
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`min`** | Minimum value accepted. Used in the default `validation` function. |
| **`max`** | Maximum value accepted. Used in the default `validation` function. |
| **`hasMany`** | Makes this field an ordered array of numbers instead of just a single number. |
| **`minRows`** | Minimum number of numbers in the numbers array, if `hasMany` is set to true. |
| **`maxRows`** | Maximum number of numbers in the numbers array, if `hasMany` is set to true. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`index`** | Build a [MongoDB index](https://docs.mongodb.com/manual/indexes/) for this field to produce faster queries. Set this field to `true` if your users will perform queries on this field's data often. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
@@ -29,6 +39,7 @@ keywords: number, fields, config, configuration, documentation, Content Manageme
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -54,7 +65,7 @@ Set this property to a string that will be used for browser autocomplete.
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -19,7 +19,7 @@ The required `type` property on a field determines what values it can accept, ho
```ts
import { CollectionConfig } from 'payload/types';
const Page: CollectionConfig = {
export const Page: CollectionConfig = {
slug: 'pages',
fields: [
{
@@ -90,7 +90,7 @@ Example:
```ts
import { CollectionConfig } from 'payload/types';
const Orders: CollectionConfig = {
export const Orders: CollectionConfig = {
slug: 'orders',
fields: [
{
@@ -155,18 +155,19 @@ Example:
In addition to each field's base configuration, you can define specific traits and properties for fields that only have effect on how they are rendered in the Admin panel. The following properties are available for all fields within the `admin` property:
| Option | Description |
| ------------- | -------------|
| `condition` | You can programmatically show / hide fields based on what other fields are doing. [Click here](#conditional-logic) for more info. |
| `components` | All field components can be completely and easily swapped out for custom components that you define. [Click here](#custom-components) for more info. |
| `description` | Helper text to display with the field to provide more information for the editor user. [Click here](#description) for more info. |
| `position` | Specify if the field should be rendered in the sidebar by defining `position: 'sidebar'`. |
| `width` | Restrict the width of a field. you can pass any string-based value here, be it pixels, percentages, etc. This property is especially useful when fields are nested within a `Row` type where they can be organized horizontally. |
| `style` | Attach raw CSS style properties to the root DOM element of a field. |
| `className` | Attach a CSS class name to the root DOM element of a field. |
| `readOnly` | Setting a field to `readOnly` has no effect on the API whatsoever but disables the admin component's editability to prevent editors from modifying the field's value. |
| `disabled` | If a field is `disabled`, it is completely omitted from the Admin panel. |
| `hidden` | Setting a field's `hidden` property on its `admin` config will transform it into a `hidden` input type. Its value will still submit with the Admin panel's requests, but the field itself will not be visible to editors. |
| Option | Description |
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `condition` | You can programmatically show / hide fields based on what other fields are doing. [Click here](#conditional-logic) for more info. |
| `components` | All field components can be completely and easily swapped out for custom components that you define. [Click here](#custom-components) for more info. |
| `description` | Helper text to display with the field to provide more information for the editor user. [Click here](#description) for more info. |
| `position` | Specify if the field should be rendered in the sidebar by defining `position: 'sidebar'`. |
| `width` | Restrict the width of a field. you can pass any string-based value here, be it pixels, percentages, etc. This property is especially useful when fields are nested within a `Row` type where they can be organized horizontally. |
| `style` | Attach raw CSS style properties to the root DOM element of a field. |
| `className` | Attach a CSS class name to the root DOM element of a field. |
| `readOnly` | Setting a field to `readOnly` has no effect on the API whatsoever but disables the admin component's editability to prevent editors from modifying the field's value. |
| `disabled` | If a field is `disabled`, it is completely omitted from the Admin panel. |
| `disableBulkEdit` | Set `disableBulkEdit` to `true` to prevent fields from appearing in the select options when making edits for multiple documents. |
| `hidden` | Setting a field's `hidden` property on its `admin` config will transform it into a `hidden` input type. Its value will still submit with the Admin panel's requests, but the field itself will not be visible to editors. |
### Custom components
@@ -174,10 +175,11 @@ All Payload fields support the ability to swap in your own React components with
### Conditional logic
You can show and hide fields based on what other fields are doing by utilizing conditional logic on a field by field basis. The `condition` property on a field's admin config accepts a function which takes two arguments:
You can show and hide fields based on what other fields are doing by utilizing conditional logic on a field by field basis. The `condition` property on a field's admin config accepts a function which takes three arguments:
- `data` - the entire document's data that is currently being edited
- `siblingData` - only the fields that are direct siblings to the field with the condition
- `{ user }` - the final argument is an object containing the currently authenticated user
The `condition` function should return a boolean that will control if the field should be displayed or not.
@@ -196,7 +198,7 @@ The `condition` function should return a boolean that will control if the field
type: 'text',
admin: {
// highlight-start
condition: (data, siblingData) => {
condition: (data, siblingData, { user }) => {
if (data.enableGreeting) {
return true;
} else {

View File

@@ -11,6 +11,13 @@ keywords: point, geolocation, geospatial, geojson, 2dsphere, config, configurati
The Point field type saves a pair of coordinates in the database and assigns an index for location related queries.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/point.png'
srcDark='https://payloadcms.com/images/docs/fields/point-dark.png'
alt='Shows a Point field in the Payload admin panel'
caption='Admin panel screenshot of a Point field'
/>
The data structure in the database matches the GeoJSON structure to represent point. The Payload APIs simplifies the object data to only the [longitude, latitude] location.
### Config
@@ -30,6 +37,7 @@ The data structure in the database matches the GeoJSON structure to represent po
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -39,7 +47,7 @@ The data structure in the database matches the GeoJSON structure to represent po
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -1,5 +1,5 @@
---
title: Radio Field
title: Radio Group Field
label: Radio Group
order: 120
desc: The Radio field type allows for the selection of one value from a predefined set of possible values. Learn how to use Radio fields, see examples and options.
@@ -7,9 +7,16 @@ keywords: radio, fields, config, configuration, documentation, Content Managemen
---
<Banner >
The Radio field type allows for the selection of one value from a predefined set of possible values and presents a radio group-style set of inputs to the Admin panel.
The Radio Group field type allows for the selection of one value from a predefined set of possible values and presents a radio group-style set of inputs to the Admin panel.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/radio.png'
srcDark='https://payloadcms.com/images/docs/fields/radio-dark.png'
alt='Shows a Radio field in the Payload admin panel'
caption='Admin panel screenshot of a Radio field'
/>
### Config
| Option | Description |
@@ -27,6 +34,7 @@ keywords: radio, fields, config, configuration, documentation, Content Managemen
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -37,7 +45,7 @@ keywords: radio, fields, config, configuration, documentation, Content Managemen
### Admin config
In addition to the default [field admin config](/docs/fields/overview#admin-config), the Radio field type allows for the specification of the following `admin` properties:
In addition to the default [field admin config](/docs/fields/overview#admin-config), the Radio Group field type allows for the specification of the following `admin` properties:
**`layout`**
@@ -49,7 +57,7 @@ The `layout` property allows for the radio group to be styled as a horizonally o
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{
@@ -72,5 +80,4 @@ const ExampleCollection: CollectionConfig = {
}
]
}
```

View File

@@ -6,10 +6,18 @@ desc: The Relationship field provides the ability to relate documents together.
keywords: relationship, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
The Relationship field is one of the most powerful fields Payload features. It provides for the ability to easily relate documents together.
<Banner>
The Relationship field is one of the most powerful fields Payload features. It
provides for the ability to easily relate documents together.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/relationship.png'
srcDark='https://payloadcms.com/images/docs/fields/relationship-dark.png'
alt='Shows a relationship field in the Payload admin panel'
caption='Admin panel screenshot of a Relationship field'
/>
**Example uses:**
- To add `Product` documents to an `Order` document
@@ -18,31 +26,36 @@ keywords: relationship, fields, config, configuration, documentation, Content Ma
### Config
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`relationTo`** * | Provide one or many collection `slug`s to be able to assign relationships to. |
| **`filterOptions`** | A query to filter which options appear in the UI and validate against. [More](#filtering-relationship-options). |
| **`hasMany`** | Boolean when, if set to `true`, allows this field to have many relations instead of only one. |
| **`maxDepth`** | Sets a number limit on iterations of related documents to populate when queried. [Depth](/docs/getting-started/concepts#depth) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`index`** | Build a [MongoDB index](https://docs.mongodb.com/manual/indexes/) for this field to produce faster queries. Set this field to `true` if your users will perform queries on this field's data often. |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`access`** | Provide field-based access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
| **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API or the Admin panel. |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| Option | Description |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`relationTo`** \* | Provide one or many collection `slug`s to be able to assign relationships to. |
| **`filterOptions`** | A query to filter which options appear in the UI and validate against. [More](#filtering-relationship-options). |
| **`hasMany`** | Boolean when, if set to `true`, allows this field to have many relations instead of only one. |
| **`minRows`** | A number for the fewest allowed items during validation when a value is present. Used with `hasMany`. |
| **`maxRows`** | A number for the most allowed items during validation when a value is present. Used with `hasMany`. |
| **`maxDepth`** | Sets a number limit on iterations of related documents to populate when queried. [Depth](/docs/getting-started/concepts#depth) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`index`** | Build a [MongoDB index](https://docs.mongodb.com/manual/indexes/) for this field to produce faster queries. Set this field to `true` if your users will perform queries on this field's data often. |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`access`** | Provide field-based access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
| **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API or the Admin panel. |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
<Banner type="success">
<strong>Tip:</strong><br/>
The <a href="/docs/getting-started/concepts#depth">Depth</a> parameter can be used to automatically populate related documents that are returned by the API.
<strong>Tip:</strong>
<br />
The [Depth](/docs/getting-started/concepts#depth) parameter can be used to
automatically populate related documents that are returned by the API.
</Banner>
### Admin config
@@ -51,51 +64,67 @@ In addition to the default [field admin config](/docs/fields/overview#admin-conf
**`isSortable`**
Set to `true` if you'd like this field to be sortable within the Admin UI using drag and drop. (Only works when `hasMany` is set to `true`)
Set to `true` if you'd like this field to be sortable within the Admin UI using drag and drop (only works when `hasMany` is set to `true`).
**`allowCreate`**
Set to `false` if you'd like to disable the ability to create new documents from within the relationship field (hides the "Add new" button in the admin UI).
### Filtering relationship options
Options can be dynamically limited by supplying a [query constraint](/docs/queries/overview), which will be used both for validating input and filtering available relationships in the UI.
The `filterOptions` property can either be a `Where` query directly, or a function that returns one. When using a function, it will be called with an argument object with the following properties:
The `filterOptions` property can either be a `Where` query directly, or a function (synchronous or asynchronous) that returns one. When using a function, it will be called with an argument object containing the following properties:
| Property | Description |
| ------------- | -------------|
| `relationTo` | The `relationTo` to filter against (as defined on the field) |
| `data` | An object of the full collection or global document currently being edited |
| `siblingData` | An object of the document data limited to fields within the same parent to the field |
| `id` | The value of the collection `id`, will be `undefined` on create request |
| `user` | The currently authenticated user object |
| Property | Description |
| ------------- | ------------------------------------------------------------------------------------ |
| `relationTo` | The `relationTo` to filter against (as defined on the field) |
| `data` | An object of the full collection or global document currently being edited |
| `siblingData` | An object of the document data limited to fields within the same parent to the field |
| `id` | The value of the collection `id`, will be `undefined` on create request |
| `user` | The currently authenticated user object |
**Example:**
### Example
```ts
const relationshipField = {
name: 'purchase',
type: 'relationship',
relationTo: ['products', 'services'],
filterOptions: ({ relationTo, siblingData }) => {
// returns a Where query dynamically by the type of relationship
if (relationTo === 'products') {
return {
'stock': { greater_than: siblingData.quantity }
}
}
import { CollectionConfig } from "payload/types";
if (relationTo === 'services') {
return {
'isAvailable': { equals: true }
}
}
},
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
name: "purchase",
type: "relationship",
relationTo: ["products", "services"],
filterOptions: ({ relationTo, siblingData }) => {
// returns a Where query dynamically by the type of relationship
if (relationTo === "products") {
return {
stock: { greater_than: siblingData.quantity },
};
}
if (relationTo === "services") {
return {
isAvailable: { equals: true },
};
}
},
},
],
};
```
You can learn more about writing queries [here](/docs/queries/overview).
<Banner type="warning">
<strong>Note:</strong><br/>
When a relationship field has both <strong>filterOptions</strong> and a custom <strong>validate</strong> function, the api will not validate <strong>filterOptions</strong> unless you call the default relationship field validation function imported from <strong>payload/fields/validations</strong> in your validate function.
<strong>Note:</strong>
<br />
When a relationship field has both <strong>filterOptions</strong> and a custom{" "}
<strong>validate</strong> function, the api will not validate{" "}
<strong>filterOptions</strong> unless you call the default relationship field
validation function imported from <strong>payload/fields/validations</strong>{" "}
in your validate function.
</Banner>
### How the data is saved
@@ -123,10 +152,10 @@ The most simple pattern of a relationship is to use `hasMany: false` with a `rel
The shape of the data to save for a document with the field configured this way would be:
```json
{
// Mongo ObjectID of the related user
"owner": "6031ac9e1289176380734024"
}
{
// MongoDB ObjectID of the related user
"owner": "6031ac9e1289176380734024"
}
```
When querying documents in this collection via REST API, you could query as follows:
@@ -154,12 +183,12 @@ Also known as **dynamic references**, in this configuration, the `relationTo` fi
The shape of the data to save for a document with more than one relationship type would be:
```json
{
"owner": {
"relationTo": "organizations",
"value": "6031ac9e1289176380734024"
}
{
"owner": {
"relationTo": "organizations",
"value": "6031ac9e1289176380734024"
}
}
```
Here is an example for how to query documents by this data (note the difference in referencing the `owner.value`):
@@ -193,9 +222,9 @@ The `hasMany` tells Payload that there may be more than one collection saved to
To save the to `hasMany` relationship field we need to send an array of IDs:
```json
{
"owners": [ "6031ac9e1289176380734024", "602c3c327b811235943ee12b" ]
}
{
"owners": ["6031ac9e1289176380734024", "602c3c327b811235943ee12b"]
}
```
When querying documents, the format does not change for arrays:
@@ -227,7 +256,8 @@ Relationship fields with `hasMany` set to more than one kind of collections save
{
"relationTo": "users",
"value": "6031ac9e1289176380734024"
}, {
},
{
"relationTo": "organizations",
"value": "602c3c327b811235943ee12b"
}

View File

@@ -6,10 +6,17 @@ desc: The Rich Text field allows dynamic content to be written through the Admin
keywords: rich text, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
<Banner>
The Rich Text field is a powerful way to allow editors to write dynamic content. The content is saved as JSON in the database and can be converted into any format, including HTML, that you need.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/richtext.png'
srcDark='https://payloadcms.com/images/docs/fields/richtext-dark.png'
alt='Shows a Rich Text field in the Payload admin panel'
caption='Admin panel screenshot of a Rich Text field'
/>
The Admin component is built on the powerful [`slatejs`](https://docs.slatejs.org/) editor and is meant to be as extensible and customizable as possible.
<Banner type="success">
@@ -18,21 +25,22 @@ The Admin component is built on the powerful [`slatejs`](https://docs.slatejs.or
### Config
| Option | Description |
| ---------------- | ----------- |
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`access`** | Provide field-based access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
| **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API or the Admin panel. |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| Option | Description |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`access`** | Provide field-based access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
| **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API or the Admin panel. |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Admin config
@@ -54,12 +62,15 @@ The default `elements` available in Payload are:
- `h4`
- `h5`
- `h6`
- `blockquote`
- `link`
- `ol`
- `ul`
- `textAlign`
- `indent`
- [`relationship`](#relationship-element)
- [`upload`](#upload-element)
- [`textAlign`](#text-align)
**`leaves`**
@@ -81,18 +92,20 @@ Set this property to `true` to hide this field's gutter within the admin panel.
This allows [fields](/docs/fields/overview) to be saved as extra fields on a link inside the Rich Text Editor. When this is present, the fields will render inside a modal that can be opened by clicking the "edit" button on the link element.
`link.fields` may either be an array of fields (in which case all fields defined in it will be appended below the default fields) or a function that accepts the default fields as only argument and returns an array defining the entirety of fields to be used (thus providing a mechanism of overriding the default fields).
![RichText link fields](https://payloadcms.com/images/docs/fields/richText/rte-link-fields-modal.jpg)
*RichText link with custom fields*
_RichText link with custom fields_
**`upload.collections[collection-name].fields`**
This allows [fields](/docs/fields/overview) to be saved as meta data on an upload field inside the Rich Text Editor. When this is present, the fields will render inside a modal that can be opened by clicking the "edit" button on the upload element.
![RichText upload element](https://payloadcms.com/images/docs/fields/richText/rte-upload-element.jpg)
*RichText field using the upload element*
_RichText field using the upload element_
![RichText upload element modal](https://payloadcms.com/images/docs/fields/richText/rte-upload-fields-modal.jpg)
*RichText upload element modal displaying fields from the config*
_RichText upload element modal displaying fields from the config_
### Relationship element
@@ -103,12 +116,15 @@ The built-in `relationship` element is a powerful way to reference other Documen
Similar to the `relationship` element, the `upload` element is a user-friendly way to reference [Upload-enabled collections](/docs/upload/overview) with a UI specifically designed for media / image-based uploads.
<Banner type="success">
<strong>Tip:</strong><br/>
Collections are automatically allowed to be selected within the Rich Text relationship and upload elements by default. If you want to disable a collection from being able to be referenced in Rich Text fields, set the collection admin option of <strong>enableRichTextRelationship</strong> to false.
<strong>Tip:</strong><br />Collections are automatically allowed to be selected within the Rich Text relationship and upload elements by default. If you want to disable a collection from being able to be referenced in Rich Text fields, set the collection admin options of <strong>enableRichTextLink</strong> and <strong>enableRichTextRelationship</strong> to false.
</Banner>
Relationship and Upload elements are populated dynamically into your Rich Text field' content. Within the REST and Local APIs, any present RichText `relationship` or `upload` elements will respect the `depth` option that you pass, and will be populated accordingly. In GraphQL, each `richText` field accepts an argument of `depth` for you to utilize.
### TextAlign element
Text Alignment is not included by default and can be added to a Rich Text Editor by adding `textAlign` to the list of elements. TextAlign will alter the existing element to include a new `textAlign` field in the resulting JSON. This field can be used in combination with other elements and leaves to position content to the left, center or right.
### Specifying which elements and leaves to allow
To specify which default elements or leaves should be allowed to be used for this field, define arrays that contain string names for each element or leaf you wish to enable. To specify a custom element or leaf, pass an object with all corresponding properties as outlined below. View the [example](#example) to reference how this all works.
@@ -121,70 +137,75 @@ Once you're up to speed with the general concepts involved, you can pass in your
**Both custom elements and leaves are defined via the following config:**
| Property | Description |
| ---------------- | ----------- |
| **`name`** * | The name to be used as a `type` for this element. |
| **`Button`** * | A React component to be rendered in the Rich Text toolbar. |
| **`plugins`** | An array of plugins to provide to the Rich Text editor. |
| Property | Description |
| --------------- | ---------------------------------------------------------- |
| **`name`** \* | The default name to be used as a `type` for this element. |
| **`Button`** \* | A React component to be rendered in the Rich Text toolbar. |
| **`plugins`** | An array of plugins to provide to the Rich Text editor. |
| **`type`** | A type that overrides the default type used by `name` |
Custom `Element`s also require the `Element` property set to a React component to be rendered as the `Element` within the rich text editor itself.
Custom `Leaf` objects follow a similar pattern but require you to define the `Leaf` property instead.
Specifying custom `Type`s let you extend your custom elements by adding additional fields to your JSON object.
### Example
`collections/ExampleCollection.ts`
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
```ts
import { CollectionConfig } from "payload/types";
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
name: 'content', // required
type: 'richText', // required
defaultValue: [{
children: [{ text: 'Here is some default content for this field' }],
}],
name: "content", // required
type: "richText", // required
defaultValue: [
{
children: [{ text: "Here is some default content for this field" }],
},
],
required: true,
admin: {
elements: [
'h2',
'h3',
'h4',
'link',
"h2",
"h3",
"h4",
"link",
"blockquote",
{
name: 'cta',
name: "cta",
Button: CustomCallToActionButton,
Element: CustomCallToActionElement,
plugins: [
// any plugins that are required by this element go here
]
}
],
},
],
leaves: [
'bold',
'italic',
"bold",
"italic",
{
name: 'highlight',
name: "highlight",
Button: CustomHighlightButton,
Leaf: CustomHighlightLeaf,
plugins: [
// any plugins that are required by this leaf go here
]
}
],
},
],
link: {
// Inject your own fields into the Link element
fields: [
{
name: 'rel',
label: 'Rel Attribute',
type: 'select',
name: "rel",
label: "Rel Attribute",
type: "select",
hasMany: true,
options: [
'noopener', 'noreferrer', 'nofollow',
],
options: ["noopener", "noreferrer", "nofollow"],
},
],
},
@@ -198,9 +219,9 @@ const ExampleCollection: CollectionConfig = {
},
},
},
}
}
]
},
},
],
};
```
@@ -211,112 +232,67 @@ For more examples regarding how to define your own elements and leaves, check ou
As the Rich Text field saves its content in a JSON format, you'll need to render it as HTML yourself. Here is an example for how to generate JSX / HTML from Rich Text content:
```ts
import React, { Fragment } from 'react';
import escapeHTML from 'escape-html';
import { Text } from 'slate';
import React, { Fragment } from "react";
import escapeHTML from "escape-html";
import { Text } from "slate";
const serialize = (children) => children.map((node, i) => {
if (Text.isText(node)) {
let text = <span dangerouslySetInnerHTML={{ __html: escapeHTML(node.text) }} />;
if (node.bold) {
text = (
<strong key={i}>
{text}
</strong>
const serialize = (children) =>
children.map((node, i) => {
if (Text.isText(node)) {
let text = (
<span dangerouslySetInnerHTML={{ __html: escapeHTML(node.text) }} />
);
if (node.bold) {
text = <strong key={i}>{text}</strong>;
}
if (node.code) {
text = <code key={i}>{text}</code>;
}
if (node.italic) {
text = <em key={i}>{text}</em>;
}
// Handle other leaf types here...
return <Fragment key={i}>{text}</Fragment>;
}
if (node.code) {
text = (
<code key={i}>
{text}
</code>
);
if (!node) {
return null;
}
if (node.italic) {
text = (
<em key={i}>
{text}
</em>
);
switch (node.type) {
case "h1":
return <h1 key={i}>{serialize(node.children)}</h1>;
// Iterate through all headings here...
case "h6":
return <h6 key={i}>{serialize(node.children)}</h6>;
case "blockquote":
return <blockquote key={i}>{serialize(node.children)}</blockquote>;
case "ul":
return <ul key={i}>{serialize(node.children)}</ul>;
case "ol":
return <ol key={i}>{serialize(node.children)}</ol>;
case "li":
return <li key={i}>{serialize(node.children)}</li>;
case "link":
return (
<a href={escapeHTML(node.url)} key={i}>
{serialize(node.children)}
</a>
);
default:
return <p key={i}>{serialize(node.children)}</p>;
}
// Handle other leaf types here...
return (
<Fragment key={i}>
{text}
</Fragment>
);
}
if (!node) {
return null;
}
switch (node.type) {
case 'h1':
return (
<h1 key={i}>
{serialize(node.children)}
</h1>
);
// Iterate through all headings here...
case 'h6':
return (
<h6 key={i}>
{serialize(node.children)}
</h6>
);
case 'quote':
return (
<blockquote key={i}>
{serialize(node.children)}
</blockquote>
);
case 'ul':
return (
<ul key={i}>
{serialize(node.children)}
</ul>
);
case 'ol':
return (
<ol key={i}>
{serialize(node.children)}
</ol>
);
case 'li':
return (
<li key={i}>
{serialize(node.children)}
</li>
);
case 'link':
return (
<a
href={escapeHTML(node.url)}
key={i}
>
{serialize(node.children)}
</a>
);
default:
return (
<p key={i}>
{serialize(node.children)}
</p>
);
}
});
});
```
<Banner>
<strong>Note:</strong><br/>
The above example is for how to render to JSX, although for plain HTML the pattern is similar. Just remove the JSX and return HTML strings instead!
<strong>Note:</strong><br />The above example is for how to render to JSX, although for plain HTML the pattern is similar. Just remove the JSX and return HTML strings instead!
</Banner>
### Built-in SlateJS Plugins
@@ -332,12 +308,12 @@ If you want to utilize this functionality within your own custom elements, you c
`customLargeBodyElement.js`:
```ts
import Button from './Button';
import Element from './Element';
import withLargeBody from './plugin';
import Button from "./Button";
import Element from "./Element";
import withLargeBody from "./plugin";
export default {
name: 'large-body',
name: "large-body",
Button,
Element,
plugins: [
@@ -345,10 +321,11 @@ export default {
const editor = incomingEditor;
const { shouldBreakOutOnEnter } = editor;
editor.shouldBreakOutOnEnter = (element) => (element.type === 'large-body' ? true : shouldBreakOutOnEnter(element));
editor.shouldBreakOutOnEnter = (element) =>
element.type === "large-body" ? true : shouldBreakOutOnEnter(element);
return editor;
}
},
],
};
```
@@ -362,9 +339,5 @@ The plugin itself extends Payload's built-in `shouldBreakOutOnEnter` Slate funct
If you are building your own custom Rich Text elements or leaves, you may benefit from importing the following types:
```ts
import type {
RichTextCustomElement,
RichTextCustomLeaf,
} from 'payload/types';
import type { RichTextCustomElement, RichTextCustomLeaf } from "payload/types";
```

View File

@@ -10,12 +10,20 @@ keywords: row, fields, config, configuration, documentation, Content Management
The Row field is presentational-only and only affects the Admin panel. By using it, you can arrange fields next to each other horizontally.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/row.png'
srcDark='https://payloadcms.com/images/docs/fields/row-dark.png'
alt='Shows a row field in the Payload admin panel'
caption='Admin panel screenshot of a Row field'
/>
### Config
| Option | Description |
| ---------------- | ----------- |
| **`fields`** * | Array of field types to nest within this Row. |
| **`admin`** | Admin-specific configuration excluding `description`, `readOnly`, and `hidden`. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -25,7 +33,7 @@ keywords: row, fields, config, configuration, documentation, Content Management
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -10,6 +10,12 @@ keywords: select, multi-select, fields, config, configuration, documentation, Co
The Select field provides a dropdown-style interface for choosing options from
a predefined list as an enumeration.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/select.png'
srcDark='https://payloadcms.com/images/docs/fields/select-dark.png'
alt='Shows a Select field in the Payload admin panel'
caption='Admin panel screenshot of a Select field'
/>
### Config
@@ -30,6 +36,7 @@ keywords: select, multi-select, fields, config, configuration, documentation, Co
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
_\* An asterisk denotes that a property is required._
@@ -61,7 +68,7 @@ Set to `true` if you'd like this field to be sortable within the Admin UI using
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{
@@ -91,3 +98,85 @@ const ExampleCollection: CollectionConfig = {
}
```
### Customization
The Select field UI component can be customized by providing a custom React component to the `components` object in the Base config.
```ts
export const CustomSelectField: Field = {
name: 'customSelectField',
type: 'select', // or 'text' if you have dynamic options
admin: {
components: {
Field: CustomSelectComponent({
options: [
{
label: 'Option 1',
value: '1',
},
{
label: 'Option 2',
value: '2',
},
],
}),
},
}
}
```
You can import the existing Select component directly from Payload, then extend and customize it as needed.
```ts
import * as React from 'react';
import { SelectInput, useField } from 'payload/components/forms';
import { useAuth } from 'payload/components/utilities';
type customSelectProps = {
path: string;
options: {
label: string;
value: string;
}[];
}
export const CustomSelectComponent: React.FC<CustomSelectProps> = ({ path, options }) => {
const { value, setValue } = useField<string>({ path });
const { user } = useAuth();
const adjustedOptions = options.filter((option) => {
/*
A common use case for a custom select
is to show different options based on
the current user's role.
*/
return option;
});
return (
<div>
<label className="field-label">
Custom Select
</label>
<SelectInput
path={path}
name={path}
options={adjustedOptions}
value={value}
onChange={() => setValue(e.value)}
/>
</div>
);
};
```
If you are looking to create a dynamic select field, the following tutorial will walk you through the process of creating a custom select field that fetches its options from an external API.
<VideoDrawer
id='Efn9OxSjA6Y'
label='How to Create a Custom Select Field'
drawerTitle='How to Create a Custom Select Field: A Step-by-Step Guide'
/>
If you want to learn more about custom components check out the [Admin > Custom Component](/docs/admin/components#field-component) docs.

View File

@@ -6,70 +6,83 @@ desc: The Tabs field is a great way to organize complex editing experiences into
keywords: tabs, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
The Tabs field is presentational-only and only affects the Admin panel (unless a tab is named). By using it, you can place fields within a nice layout component that separates certain sub-fields by a tabbed interface.
<Banner>
The Tabs field is presentational-only and only affects the Admin panel (unless
a tab is named). By using it, you can place fields within a nice layout
component that separates certain sub-fields by a tabbed interface.
</Banner>
![Tabs field type used to separate Hero fields from Page Layout](https://payloadcms.com/images/docs/fields/tabs/tabs.jpg)
*Tabs field type used to separate Hero fields from Page Layout*
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/tabs.png'
srcDark='https://payloadcms.com/images/docs/fields/tabs-dark.png'
alt='Shows a tabs field used to separate Hero and Page layout in the Payload admin panel'
caption='Tabs field type used to separate Hero fields from Page Layout'
/>
### Config
| Option | Description |
| ---------------- | ----------- |
| **`tabs`** * | Array of tabs to render within this Tabs field. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| Option | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------------ |
| **`tabs`** \* | Array of tabs to render within this Tabs field. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
#### Tab-specific Config
Each tab has its own required `label` and `fields` array. You can also optionally pass a `description` to render within each individual tab.
Each tab must have either a `name` or `label` and the required `fields` array. You can also optionally pass a `description` to render within each individual tab.
| Option | Description |
| ----------------- | ----------- |
| **`name`** | An optional property name to be used when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** * | The label to render on the tab itself. |
| **`fields`** * | The fields to render within this tab. |
| **`description`** | Optionally render a description within this tab to describe the contents of the tab itself. |
| Option | Description |
| ---------------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **`name`** | Groups field data into an object when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`label`** | The label to render on the tab itself. Required when name is undefined, defaults to name converted to words. |
| **`fields`** \* | The fields to render within this tab. |
| **`description`** | Optionally render a description within this tab to describe the contents of the tab itself. |
| **`interfaceName`** | Create a top level, reusable [Typescript interface](/docs/typescript/generating-types#custom-field-interfaces) & [GraphQL type](/docs/graphql/graphql-schema#custom-field-schemas). (`name` must be present) |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Example
`collections/ExampleCollection.ts`
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
```ts
import { CollectionConfig } from "payload/types";
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
type: 'tabs', // required
tabs: [ // required
type: "tabs", // required
tabs: [
// required
{
label: 'Tab One Label', // required
description: 'This will appear within the tab above the fields.',
fields: [ // required
label: "Tab One Label", // required
description: "This will appear within the tab above the fields.",
fields: [
// required
{
name: 'someTextField',
type: 'text',
name: "someTextField",
type: "text",
required: true,
},
],
},
{
name: 'tabTwo',
label: 'Tab Two Label', // required
fields: [ // required
name: "tabTwo",
label: "Tab Two Label", // required
interfaceName: "TabTwo", // optional (`name` must be present)
fields: [
// required
{
name: 'numberField', // accessible via tabTwo.numberField
type: 'number',
name: "numberField", // accessible via tabTwo.numberField
type: "number",
required: true,
},
],
}
]
}
]
}
},
],
},
],
};
```

View File

@@ -10,6 +10,13 @@ keywords: text, fields, config, configuration, documentation, Content Management
The Text field type is one of the most commonly used fields. It saves a string to the database and provides the Admin panel with a simple text input.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/text.png'
srcDark='https://payloadcms.com/images/docs/fields/text-dark.png'
alt='Shows a text field and read-only text field in the Payload admin panel'
caption='Admin panel screenshot of a Text field and read-only Text field'
/>
### Config
| Option | Description |
@@ -29,6 +36,7 @@ keywords: text, fields, config, configuration, documentation, Content Management
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -50,7 +58,7 @@ Set this property to a string that will be used for browser autocomplete.
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -10,6 +10,13 @@ keywords: textarea, fields, config, configuration, documentation, Content Manage
The Textarea field is almost identical to the Text field but it features a slightly larger input that is better suited to edit longer text.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/textarea.png'
srcDark='https://payloadcms.com/images/docs/fields/textarea-dark.png'
alt='Shows a textarea field and read-only textarea field in the Payload admin panel'
caption='Admin panel screenshot of a Textarea field and read-only Textarea field'
/>
### Config
| Option | Description |
@@ -25,10 +32,11 @@ keywords: textarea, fields, config, configuration, documentation, Content Manage
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
| **`access`** | Provide field-based access control to denote what users can see and do with this field's data. [More](/docs/fields/overview#field-level-access-control) |
| **`hidden`** | Restrict this field's visibility from all APIs entirely. Will still be saved to the database, but will not appear in any API or the Admin panel. |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) [More](/docs/fields/overview#default-values) |
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values)|
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
@@ -50,7 +58,7 @@ Set this property to a string that will be used for browser autocomplete.
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
export const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
fields: [
{

View File

@@ -6,8 +6,11 @@ desc: UI fields are purely presentational and allow developers to customize the
keywords: custom field, react component, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
The UI (user interface) field gives you a ton of power to add your own React components directly into the Admin panel, nested directly within your other fields. It has absolutely no effect on the data of your documents. It is presentational-only.
<Banner>
The UI (user interface) field gives you a ton of power to add your own React
components directly into the Admin panel, nested directly within your other
fields. It has absolutely no effect on the data of your documents. It is
presentational-only.
</Banner>
This field is helpful if you need to build in custom functionality via React components within the Admin panel. Think of it as a way for you to "plug in" your own React components directly within your other fields, so you can provide your editors with new controls exactly where you want them to go.
@@ -23,34 +26,36 @@ With this field, you can also inject custom `Cell` components that appear as add
### Config
| Option | Description |
| ---------------------------- |-------------------------------------------------------------------------------------------------------------------|
| **`name`** * | A unique identifier for this field. |
| **`label`** | Human-readable label for this UI field. |
| **`admin.components.Field`** | React component to be rendered for this field within the Edit view. [More](/docs/admin/components/#field-component) |
| **`admin.components.Cell`** | React component to be rendered as a Cell within collection List views. [More](/docs/admin/components/#field-component) |
| Option | Description |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **`name`** \* | A unique identifier for this field. |
| **`label`** | Human-readable label for this UI field. |
| **`admin.components.Field`** \* | React component to be rendered for this field within the Edit view. [More](/docs/admin/components/#field-component) |
| **`admin.components.Cell`** | React component to be rendered as a Cell within collection List views. [More](/docs/admin/components/#field-component) |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Example
`collections/ExampleCollection.ts`
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
```ts
import { CollectionConfig } from "payload/types";
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
type: 'ui', // required
name: "myCustomUIField", // required
type: "ui", // required
admin: {
components: {
Field: MyCustomUIField,
Cell: MyCustomUICell,
}
}
}
]
}
},
},
},
],
};
```

View File

@@ -6,15 +6,22 @@ desc: Upload fields will allow a file to be uploaded, only from a collection sup
keywords: upload, images media, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
<Banner >
<Banner>
The Upload field allows for the selection of a Document from a collection supporting Uploads, and formats the selection as a thumbnail in the Admin panel.
</Banner>
<Banner type="warning">
<strong>Important:</strong><br/>
To use this field, you need to have a Collection configured to allow Uploads. For more information, <a href="/docs/upload/overview">click here</a> to read about how to enable Uploads on a collection by collection basis.
<strong>Important:</strong><br />
To use this field, you need to have a Collection configured to allow Uploads. For more information, [click here](/docs/upload/overview) to read about how to enable Uploads on a collection by collection basis.
</Banner>
<LightDarkImage
srcLight='https://payloadcms.com/images/docs/fields/upload.png'
srcDark='https://payloadcms.com/images/docs/fields/upload-dark.png'
alt='Shows an upload field in the Payload admin panel'
caption='Admin panel screenshot of an Upload field'
/>
**Example uses:**
- To provide a `Page` with a featured image
@@ -23,10 +30,10 @@ keywords: upload, images media, fields, config, configuration, documentation, Co
### Config
| Option | Description |
| ---------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **`name`** * | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`*relationTo`** * | Provide a single collection `slug` to allow this field to accept a relation to. <strong>Note: the related collection must be configured to support Uploads.</strong> |
| Option | Description |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
| **`*relationTo`** \* | Provide a single collection `slug` to allow this field to accept a relation to. <strong>Note: the related collection must be configured to support Uploads.</strong> |
| **`filterOptions`** | A query to filter which options appear in the UI and validate against. [More](#filtering-upload-options). |
| **`maxDepth`** | Sets a number limit on iterations of related documents to populate when queried. [Depth](/docs/getting-started/concepts#depth) |
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
@@ -41,27 +48,28 @@ keywords: upload, images media, fields, config, configuration, documentation, Co
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
| **`required`** | Require this field to have a value. |
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
*\* An asterisk denotes that a property is required.*
_\* An asterisk denotes that a property is required._
### Example
`collections/ExampleCollection.ts`
```ts
import { CollectionConfig } from 'payload/types';
const ExampleCollection: CollectionConfig = {
slug: 'example-collection',
```ts
import { CollectionConfig } from "payload/types";
export const ExampleCollection: CollectionConfig = {
slug: "example-collection",
fields: [
{
name: 'backgroundImage', // required
type: 'upload', // required
relationTo: 'media', // required
name: "backgroundImage", // required
type: "upload", // required
relationTo: "media", // required
required: true,
}
]
}
},
],
};
```
### Filtering upload options
@@ -70,23 +78,23 @@ Options can be dynamically limited by supplying a [query constraint](/docs/queri
The `filterOptions` property can either be a `Where` query directly, or a function that returns one. When using a function, it will be called with an argument object with the following properties:
| Property | Description |
| ------------- | -------------|
| `relationTo` | The `relationTo` to filter against (as defined on the field) |
| `data` | An object of the full collection or global document currently being edited |
| `siblingData` | An object of the document data limited to fields within the same parent to the field |
| `id` | The value of the collection `id`, will be `undefined` on create request |
| `user` | The currently authenticated user object |
| Property | Description |
| ------------- | ------------------------------------------------------------------------------------ |
| `relationTo` | The `relationTo` to filter against (as defined on the field) |
| `data` | An object of the full collection or global document currently being edited |
| `siblingData` | An object of the document data limited to fields within the same parent to the field |
| `id` | The value of the collection `id`, will be `undefined` on create request |
| `user` | The currently authenticated user object |
**Example:**
```ts
const uploadField = {
name: 'image',
type: 'upload',
relationTo: 'media',
name: "image",
type: "upload",
relationTo: "media",
filterOptions: {
mimeType: { contains: 'image' },
mimeType: { contains: "image" },
},
};
```
@@ -94,6 +102,6 @@ const uploadField = {
You can learn more about writing queries [here](/docs/queries/overview).
<Banner type="warning">
<strong>Note:</strong><br/>
<strong>Note:</strong><br />
When an upload field has both <strong>filterOptions</strong> and a custom <strong>validate</strong> function, the api will not validate <strong>filterOptions</strong> unless you call the default upload field validation function imported from <strong>payload/fields/validations</strong> in your validate function.
</Banner>

View File

@@ -117,7 +117,7 @@ It is also possible to limit the depth for specific `relation` and `upload` fiel
}
```
If you were to query the Posts endpoint at, say, `http://localhost:3000/api/posts?depth=1`, you will retrieve Posts with populations one level deep. A returned result may look like the following:
If you were to query the Posts endpoint at, say, `http://localhost:3000/api/posts?depth=1`, you will retrieve Posts with populations one level deep. This depth parameter can be thought of as N, where N is the number of levels you want to populate. To populate one level further, you would simply specify N+1 as the depth. A returned result may look like the following:
```
// ?depth=1

View File

@@ -11,8 +11,8 @@ keywords: documentation, getting started, guide, Content Management System, cms,
Payload requires the following software:
- Yarn or NPM
- NodeJS version 10+
- A Mongo Database
- Node.js version 14+
- A MongoDB Database
<Banner type="warning">
Before proceeding any further, please ensure that you have the above
@@ -77,12 +77,13 @@ To initialize Payload, update your `server.ts` file to reflect the following cod
import express from "express";
import payload from "payload";
require("dotenv").config();
const app = express();
const start = async () => {
await payload.init({
secret: "SECRET_KEY",
mongoURL: "mongodb://localhost/payload",
secret: process.env.PAYLOAD_SECRET,
mongoURL: process.env.MONGODB_URI,
express: app,
});
@@ -96,6 +97,13 @@ const start = async () => {
start();
```
A quick reminder: in this configuration, we're making use of two environmental variables, `process.env.PAYLOAD_SECRET` and `process.env.MONGODB_URI`. Often, it's smart to store these values in an `.env` file at the root of your directory and set different values for each of your environments (local, stage, prod, etc). The `dotenv` package is very handy and works well alongside of Payload. A typical `.env` file will look like this:
```
MONGODB_URI=mongodb://127.0.0.1/your-payload-app
PAYLOAD_SECRET=your-payload-secret
```
Here is a list of all properties available to pass through `payload.init`:
##### `express`
@@ -104,19 +112,21 @@ Here is a list of all properties available to pass through `payload.init`:
##### `secret`
**Required**. This is a secure string that will be used to authenticate with Payload. It can be random but should be at least 14 characters and be very difficult to guess. Often, it's smart to store this value in an `env` and set different values for each of your environments (local, stage, prod, etc). The `dotenv` package is very handy and works well alongside of Payload.
**Required**. This is a secure string that will be used to authenticate with Payload. It can be random but should be at least 14 characters and be very difficult to guess.
Payload uses this secret key to generate secure user tokens (JWT). Behind the scenes, we do not use your secret key to encrypt directly - instead, we first take the secret key and create an encrypted string using the SHA-256 hash function. Then, we reduce the encrypted string to its first 32 characters. This final value is what Payload uses for encryption.
##### `mongoURL`
**Required**. This is a fully qualified MongoDB connection string that points to your Mongo database. If you don't have Mongo installed locally, you can [follow these steps for Mac OSX](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/) and [these steps](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/) for Windows 10. If you want to use a local database and you know you have MongoDB installed locally, a typical connection string will look like this:
**Required**. This is a fully qualified MongoDB connection string that points to your MongoDB database. If you don't have MongoDB installed locally, you can [follow these steps for Mac OSX](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/) and [these steps](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/) for Windows 10. If you want to use a local database and you know you have MongoDB installed locally, a typical connection string will look like this:
`mongodb://localhost/payload`
`mongodb://127.0.0.1/payload`
In contrast to running Mongo locally, a popular option is to sign up for a free [MongoDB Atlas account](https://www.mongodb.com/cloud/atlas), which is a fully hosted and cloud-based installation of Mongo that you don't need to ever worry about.
In contrast to running MongoDB locally, a popular option is to sign up for a free [MongoDB Atlas account](https://www.mongodb.com/cloud/atlas), which is a fully hosted and cloud-based installation of MongoDB that you don't need to ever worry about.
##### `mongoOptions`
Customize Mongo connection options. Payload will connect to your MongoDB database using default options which you can override and extend to include all the [options](https://mongoosejs.com/docs/connections.html#options) available to mongoose.
Customize MongoDB connection options. Payload will connect to your MongoDB database using default options which you can override and extend to include all the [options](https://mongoosejs.com/docs/connections.html#options) available to mongoose.
##### `email`
@@ -130,6 +140,10 @@ A boolean that when set to `true` tells Payload to start in local-only mode whic
Specify options for the built-in Pino logger that Payload uses for internal logging. See [Pino Docs](https://getpino.io/#/docs/api?id=options) for more info on what is available.
##### `loggerDestination`
Specify destination stream for the built-in Pino logger that Payload uses for internal logging. See [Pino Docs](https://getpino.io/#/docs/api?id=pino-destination) for more info on what is available.
##### `onInit`
A function that is called immediately following startup that receives the Payload instance as it's only argument.
@@ -142,4 +156,4 @@ After it starts, you can go to `http://localhost:3000/admin` to create your firs
### Docker
Looking to deploy Payload with Docker? New projects with `create-payload-app` come with a Dockerfile and docker-compose.yml file ready to go. Examples of these files can be seen in our [Deployment docs](/docs/deployment#Docker).
Looking to deploy Payload with Docker? New projects with `create-payload-app` come with a Dockerfile and docker-compose.yml file ready to go. Examples of these files can be seen in our [Deployment docs](/docs/production/deployment#docker).

View File

@@ -8,7 +8,7 @@ keywords: documentation, getting started, guide, Content Management System, cms,
<YouTube
id="In_lFhzmbME"
title="Payload CMS Introduction - Closing the Gap Between Headless CMS and Application Frameworks"
title="Payload Introduction - Closing the Gap Between Headless CMS and Application Frameworks"
/>
<Banner type="success">
@@ -19,7 +19,7 @@ keywords: documentation, getting started, guide, Content Management System, cms,
Out of the box, Payload gives you a lot of the things that you often need when developing a new website, web app, or native app:
- A Mongo database to store your data
- A MongoDB database to store your data
- A way to store, retrieve, and manipulate data of any shape via full REST and GraphQL APIs
- Authentication—complete with commonly required functionality like registration, email verification, login, & password reset
- Deep access control to your data, based on document or field-level functions

View File

@@ -67,3 +67,90 @@ export default buildConfig({
}
})
```
### Resolver function
In your resolver, make sure you set `depth: 0` if you're returning data directly from the local API so that GraphQL can correctly resolve queries to nested values such as relationship data.
Your function will receive four arguments you can make use of:
Example
```ts
async (obj, args, context, info) => { }
```
**`obj`**
The previous object. Not very often used and usually discarded.
**`args`**
The available arguments from your query or mutation will be available to you here, these must be configured via the custom operation first.
**`context`**
An object containing the `req` and `res` objects that will provide you with the `payload`, `user` instances and more, like any other Payload API handler.
**`info`**
Contextual information about the currently running GraphQL operation. You can get schema information from this as well as contextual information about where this resolver function is being run.
### Types
We've exposed a few types and utilities to help you extend the API further. Payload uses the GraphQL.js package for which you can view the full list of available types in the [official documentation](https://graphql.org/graphql-js/type/).
**`GraphQL`**
You can directly import the GraphQL package used by Payload, most useful for typing. For queries, mutations and handlers make sure you use the `GraphQL` and `payload` instances provided via arguments.
**`buildPaginatedListType`**
This is a utility function that allows you to build a new GraphQL type for a paginated result similar to the Payload's generated schema.
It takes in two arguments, the first for the name of this new schema type and the second for the GraphQL type to be used in the docs parameter.
Example
```ts
export const getMyPosts = (GraphQL, payload) => {
return {
args: {},
resolve: Resolver,
// The name of your new type has to be unique
type: buildPaginatedListType('AuthorPosts', payload.collections['posts'].graphQL?.type),
}
}
```
**`payload.collections.slug.graphQL`**
If you want to extend more of the provided API then the `graphQL` object on your collection slug will contain additional types to help you re-use code for types, mutations and queries.
```ts
graphQL?: {
type: GraphQLObjectType
paginatedType: GraphQLObjectType
JWT: GraphQLObjectType
versionType: GraphQLObjectType
whereInputType: GraphQLInputObjectType
mutationInputType: GraphQLNonNull<any>
updateMutationInputType: GraphQLNonNull<any>
}
```
### Best practices
There are a few ways to structure your code, we recommend using a dedicated `graphql` directory so you can keep all of your logic in one place. You have total freedom of how you want to structure this but a common pattern is to group functions by type and with their resolver.
Example
```
src/graphql
---- queries/
index.ts
-- myCustomQuery/
index.ts
resolver.ts
---- mutations/
```

View File

@@ -8,7 +8,7 @@ keywords: headless cms, typescript, documentation, Content Management System, cm
When working with GraphQL it is useful to have the schema for development of other projects that need to call on your GraphQL endpoint. In Payload the schema is controlled by your collections and globals and is made available to the developer or third parties, it is not necessary for developers using Payload to write schema types manually.
### GraphQL Schema generate script
### Schema generatation script
Run the following command in a Payload project to generate your project's GraphQL schema from Payload:
@@ -16,9 +16,9 @@ Run the following command in a Payload project to generate your project's GraphQ
payload generate:graphQLSchema
```
You can run this command whenever you need to regenerate your graphQL schema and output it to a file, and then you can use the schema for writing your own graphQL elsewhere in other projects.
You can run this command whenever you need to regenerate your GraphQL schema and output it to a file, and then you can use the schema for writing your own GraphQL elsewhere in other projects.
### GraphQL schema output file
### Custom output file path
```js
{
@@ -29,12 +29,51 @@ You can run this command whenever you need to regenerate your graphQL schema and
}
```
### Custom Field Schemas
For `array`, `block`, `group` and named `tab` fields, you can generate top level reusable interfaces. The following group field config:
```ts
{
type: 'group',
name: 'meta',
interfaceName: 'SharedMeta', <-- here!!
fields: [
{
name: 'title',
type: 'text',
},
{
name: 'description',
type: 'text',
},
],
}
```
will generate:
```ts
// a top level reusable type!!
type SharedMeta {
title: String
description: String
}
// example usage inside collection schema
type Collection1 {
// ...other fields
meta: SharedMeta
}
```
The above example outputs all your definitions to a file relative from your payload config as `./graphql/schema.graphql`. By default, the file will be output to your current working directory as `schema.graphql`.
#### Adding an NPM script
<Banner type="warning">
<strong>Important:</strong><br/>
<strong>Important</strong>
<br />
Payload needs to be able to find your config to generate your GraphQL schema.
</Banner>
@@ -45,8 +84,8 @@ To add an NPM script to generate your types and show Payload where to find your
```json
{
"scripts": {
"generate:graphQLSchema": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:graphQLSchema",
},
"generate:graphQLSchema": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:graphQLSchema"
}
}
```

View File

@@ -16,13 +16,13 @@ The labels you provide for your Collections and Globals are used to name the Gra
At the top of your Payload config you can define all the options to manage GraphQL.
| Option | Description |
| -------------------- | -------------|
| `mutations` | Any custom Mutations to be added in addition to what Payload provides. [More](/docs/graphql/extending) |
| `queries` | Any custom Queries to be added in addition to what Payload provides. [More](/docs/graphql/extending) |
| `maxComplexity` | A number used to set the maximum allowed complexity allowed by requests [More](/docs/graphql/overview#query-complexity-limits) |
| `disablePlaygroundInProduction` | A boolean that if false will enable the graphQL playground, defaults to true. [More](/docs/graphql/overview#graphql-playground) |
| `disable` | A boolean that if true will disable the graphQL entirely, defaults to false. |
| Option | Description |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mutations` | Any custom Mutations to be added in addition to what Payload provides. [More](/docs/graphql/extending) |
| `queries` | Any custom Queries to be added in addition to what Payload provides. [More](/docs/graphql/extending) |
| `maxComplexity` | A number used to set the maximum allowed complexity allowed by requests [More](/docs/graphql/overview#query-complexity-limits) |
| `disablePlaygroundInProduction` | A boolean that if false will enable the GraphQL playground, defaults to true. [More](/docs/graphql/overview#graphql-playground) |
| `disable` | A boolean that if true will disable the GraphQL entirely, defaults to false. |
| `schemaOutputFile` | A string for the file path used by the generate schema command. Defaults to `graphql.schema` next to `payload.config.ts` [More](/docs/graphql/graphql-schema) |
## Collections
@@ -32,7 +32,7 @@ Everything that can be done to a Collection via the REST or Local API can be don
```ts
import { CollectionConfig } from 'payload/types';
const PublicUser: CollectionConfig = {
export const PublicUser: CollectionConfig = {
slug: 'public-users',
auth: true, // Auth is enabled
fields: [
@@ -43,26 +43,26 @@ const PublicUser: CollectionConfig = {
**Payload will automatically open up the following queries:**
| Query Name | Operation |
| ---------------------- | -------------|
| **`PublicUser`** | `findByID` |
| **`PublicUsers`** | `find` |
| **`mePublicUser`** | `me` auth operation |
| Query Name | Operation |
| ------------------ | ------------------- |
| **`PublicUser`** | `findByID` |
| **`PublicUsers`** | `find` |
| **`mePublicUser`** | `me` auth operation |
**And the following mutations:**
| Query Name | Operation |
| ------------------------------ | -------------|
| **`createPublicUser`** | `create` |
| **`updatePublicUser`** | `update` |
| **`deletePublicUser`** | `delete` |
| Query Name | Operation |
| ------------------------------ | ------------------------------- |
| **`createPublicUser`** | `create` |
| **`updatePublicUser`** | `update` |
| **`deletePublicUser`** | `delete` |
| **`forgotPasswordPublicUser`** | `forgotPassword` auth operation |
| **`resetPasswordPublicUser`** | `resetPassword` auth operation |
| **`unlockPublicUser`** | `unlock` auth operation |
| **`verifyPublicUser`** | `verify` auth operation |
| **`loginPublicUser`** | `login` auth operation |
| **`logoutPublicUser`** | `logout` auth operation |
| **`refreshTokenPublicUser`** | `refresh` auth operation |
| **`resetPasswordPublicUser`** | `resetPassword` auth operation |
| **`unlockPublicUser`** | `unlock` auth operation |
| **`verifyPublicUser`** | `verify` auth operation |
| **`loginPublicUser`** | `login` auth operation |
| **`logoutPublicUser`** | `logout` auth operation |
| **`refreshTokenPublicUser`** | `refresh` auth operation |
## Globals
@@ -81,32 +81,32 @@ const Header: GlobalConfig = {
**Payload will open the following query:**
| Query Name | Operation |
| ---------------------- | -------------|
| **`Header`** | `findOne` |
| Query Name | Operation |
| ------------ | --------- |
| **`Header`** | `findOne` |
**And the following mutation:**
| Query Name | Operation |
| ---------------------- | -------------|
| **`updateHeader`** | `update` |
| Query Name | Operation |
| ------------------ | --------- |
| **`updateHeader`** | `update` |
## Preferences
User [preferences](/docs/admin/overview#preferences) for the admin panel are also available to GraphQL. To query preferences you must supply an authorization token in the header and only the preferences of that user will be accessible and of the `key` argument.
User [preferences](/docs/admin/overview#preferences) for the admin panel are also available to GraphQL. To query preferences you must supply an authorization token in the header and only the preferences of that user will be accessible and of the `key` argument.
**Payload will open the following query:**
| Query Name | Operation |
| ---------------------- | -------------|
| **`Preference`** | `findOne` |
| Query Name | Operation |
| ---------------- | --------- |
| **`Preference`** | `findOne` |
**And the following mutations:**
| Query Name | Operation |
| ---------------------- | -------------|
| **`updatePreference`** | `update` |
| **`deletePreference`** | `delete` |
| Query Name | Operation |
| ---------------------- | --------- |
| **`updatePreference`** | `update` |
| **`deletePreference`** | `delete` |
## GraphQL Playground
@@ -115,8 +115,8 @@ GraphQL Playground is enabled by default for development purposes, but disabled
You can even log in using the `login[collection-singular-label-here]` mutation to use the Playground as an authenticated user.
<Banner type="success">
<strong>Tip:</strong><br/>
To see more regarding how the above queries and mutations are used, visit your GraphQL playground (by default at <a href="http://localhost:3000/api/graphql-playground">(http://localhost:3000/api/graphql-playground</a>) while your server is running. There, you can use the "Schema" and "Docs" buttons on the right to see a ton of detail about how GraphQL operates within Payload.
<strong>Tip:</strong><br />
To see more regarding how the above queries and mutations are used, visit your GraphQL playground (by default at [http://localhost:3000/api/graphql-playground](http://localhost:3000/api/graphql-playground)) while your server is running. There, you can use the "Schema" and "Docs" buttons on the right to see a ton of detail about how GraphQL operates within Payload.
</Banner>
## Query complexity limits

View File

@@ -16,6 +16,7 @@ Collections feature the ability to define the following hooks:
- [afterRead](#afterread)
- [beforeDelete](#beforedelete)
- [afterDelete](#afterdelete)
- [afterOperation](#afteroperation)
Additionally, `auth`-enabled collections feature the following hooks:
@@ -31,10 +32,11 @@ Additionally, `auth`-enabled collections feature the following hooks:
All collection Hook properties accept arrays of synchronous or asynchronous functions. Each Hook type receives specific arguments and has the ability to modify specific outputs.
`collections/exampleHooks.js`
```ts
import { CollectionConfig } from 'payload/types';
const ExampleHooks: CollectionConfig = {
export const ExampleHooks: CollectionConfig = {
slug: 'example-hooks',
fields: [
{ name: 'name', type: 'text'},
@@ -48,6 +50,7 @@ const ExampleHooks: CollectionConfig = {
afterChange: [(args) => {...}],
afterRead: [(args) => {...}],
afterDelete: [(args) => {...}],
afterOperation: [(args) => {...}],
// Auth-enabled hooks
beforeLogin: [(args) => {...}],
@@ -62,27 +65,33 @@ const ExampleHooks: CollectionConfig = {
### beforeOperation
The `beforeOperation` Hook type can be used to modify the arguments that operations accept or execute side-effects that run before an operation begins.
The `beforeOperation` hook can be used to modify the arguments that operations accept or execute side-effects that run before an operation begins.
Available Collection operations include `create`, `read`, `update`, `delete`, `login`, `refresh` and `forgotPassword`.
Available Collection operations include `create`, `read`, `update`, `delete`, `login`, `refresh`, and `forgotPassword`.
```ts
import { CollectionBeforeOperationHook } from 'payload/types';
import { CollectionBeforeOperationHook } from "payload/types";
const beforeOperationHook: CollectionBeforeOperationHook = async ({
args, // Original arguments passed into the operation
args, // original arguments passed into the operation
operation, // name of the operation
}) => {
return args; // Return operation arguments as necessary
}
return args; // return modified operation arguments as necessary
};
```
### beforeValidate
Runs before the `create` and `update` operations. This hook allows you to add or format data before the incoming data is validated.
Runs before the `create` and `update` operations. This hook allows you to add or format data before the incoming data is validated server-side.
Please do note that this does not run before the client-side validation. If you added a `validate` function, this would be the lifecycle:
1. `validate` runs on the client
2. if successful, `beforeValidate` runs on the server
3. `validate` runs on the server
```ts
import { CollectionBeforeOperationHook } from 'payload/types';
import { CollectionBeforeOperationHook } from "payload/types";
const beforeValidateHook: CollectionBeforeValidateHook = async ({
data, // incoming data to update or create with
@@ -91,7 +100,7 @@ const beforeValidateHook: CollectionBeforeValidateHook = async ({
originalDoc, // original document
}) => {
return data; // Return data to either create or update a document with
}
};
```
### beforeChange
@@ -99,7 +108,7 @@ const beforeValidateHook: CollectionBeforeValidateHook = async ({
Immediately following validation, `beforeChange` hooks will run within `create` and `update` operations. At this stage, you can be confident that the data that will be saved to the document is valid in accordance to your field validations. You can optionally modify the shape of data to be saved.
```ts
import { CollectionBeforeChangeHook } from 'payload/types';
import { CollectionBeforeChangeHook } from "payload/types";
const beforeChangeHook: CollectionBeforeChangeHook = async ({
data, // incoming data to update or create with
@@ -108,7 +117,7 @@ const beforeChangeHook: CollectionBeforeChangeHook = async ({
originalDoc, // original document
}) => {
return data; // Return data to either create or update a document with
}
};
```
### afterChange
@@ -116,7 +125,7 @@ const beforeChangeHook: CollectionBeforeChangeHook = async ({
After a document is created or updated, the `afterChange` hook runs. This hook is helpful to recalculate statistics such as total sales within a global, syncing user profile changes to a CRM, and more.
```ts
import { CollectionAfterChangeHook } from 'payload/types';
import { CollectionAfterChangeHook } from "payload/types";
const afterChangeHook: CollectionAfterChangeHook = async ({
doc, // full document data
@@ -124,8 +133,8 @@ const afterChangeHook: CollectionAfterChangeHook = async ({
previousDoc, // document data before updating the collection
operation, // name of the operation ie. 'create', 'update'
}) => {
return doc;
}
return doc; // value to be used in subsequent afterChange hooks
};
```
### beforeRead
@@ -133,7 +142,7 @@ const afterChangeHook: CollectionAfterChangeHook = async ({
Runs before `find` and `findByID` operations are transformed for output by `afterRead`. This hook fires before hidden fields are removed and before localized fields are flattened into the requested locale. Using this Hook will provide you with all locales and all hidden fields via the `doc` argument.
```ts
import { CollectionBeforeReadHook } from 'payload/types';
import { CollectionBeforeReadHook } from "payload/types";
const beforeReadHook: CollectionBeforeReadHook = async ({
doc, // full document data
@@ -141,7 +150,7 @@ const beforeReadHook: CollectionBeforeReadHook = async ({
query, // JSON formatted query
}) => {
return doc;
}
};
```
### afterRead
@@ -149,7 +158,7 @@ const beforeReadHook: CollectionBeforeReadHook = async ({
Runs as the last step before documents are returned. Flattens locales, hides protected fields, and removes fields that users do not have access to.
```ts
import { CollectionAfterReadHook } from 'payload/types';
import { CollectionAfterReadHook } from "payload/types";
const afterReadHook: CollectionAfterReadHook = async ({
doc, // full document data
@@ -158,7 +167,7 @@ const afterReadHook: CollectionAfterReadHook = async ({
findMany, // boolean to denote if this hook is running against finding one, or finding many
}) => {
return doc;
}
};
```
### beforeDelete
@@ -188,19 +197,37 @@ const afterDeleteHook: CollectionAfterDeleteHook = async ({
}) => {...}
```
### afterOperation
The `afterOperation` hook can be used to modify the result of operations or execute side-effects that run after an operation has completed.
Available Collection operations include `create`, `find`, `findByID`, `update`, `updateByID`, `delete`, `deleteByID`, `login`, `refresh`, and `forgotPassword`.
```ts
import { CollectionAfterOperationHook } from "payload/types";
const afterOperationHook: CollectionAfterOperationHook = async ({
args, // arguments passed into the operation
operation, // name of the operation
result, // the result of the operation, before modifications
}) => {
return result; // return modified result as necessary
};
```
### beforeLogin
For auth-enabled Collections, this hook runs during `login` operations where a user with the provided credentials exist, but before a token is generated and added to the response. You can optionally modify the user that is returned, or throw an error in order to deny the login operation.
```ts
import { CollectionBeforeLoginHook } from 'payload/types';
import { CollectionBeforeLoginHook } from "payload/types";
const beforeLoginHook: CollectionBeforeLoginHook = async ({
req, // full express request
user, // user being logged in
}) => {
return user;
}
};
```
### afterLogin
@@ -261,7 +288,7 @@ const afterMeHook: CollectionAfterMeHook = async ({
For auth-enabled Collections, this hook runs after successful `forgotPassword` operations. Returned values are discarded.
```ts
import { CollectionAfterForgotPasswordHook } from 'payload/types';
import { CollectionAfterForgotPasswordHook } from "payload/types";
const afterLoginHook: CollectionAfterForgotPasswordHook = async ({
req, // full express request
@@ -269,7 +296,7 @@ const afterLoginHook: CollectionAfterForgotPasswordHook = async ({
token, // user token
}) => {
return user;
}
};
```
## TypeScript
@@ -292,5 +319,5 @@ import type {
CollectionAfterRefreshHook,
CollectionAfterMeHook,
CollectionAfterForgotPasswordHook,
} from 'payload/types';
} from "payload/types";
```

127
docs/hooks/context.mdx Normal file
View File

@@ -0,0 +1,127 @@
---
title: Context
label: Context
order: 50
desc: Context allows you to pass in extra data that can be shared between hooks
keywords: hooks, context, payload context, payloadcontext, data, extra data, shared data, shared, extra
---
The `context` object in hooks is used to share data across different hooks. The persists throughout the entire lifecycle of a request and is available within every hook. This allows you to add logic to your hooks based on the request state by setting properties to `req.context` and using them elsewhere.
## When to use Context
Context gives you a way forward on otherwise difficult problems such as:
1. **Passing data between hooks**: Needing data in multiple hooks from a 3rd party API, it could be retrieved and used in `beforeChange` and later used again in an `afterChange` hook without having to fetch it twice.
2. **Preventing infinite loops**: Calling `payload.update()` on the same document that triggered an `afterChange` hook will create an infinite loop, control the flow by assigning a no-op condition to context
3. **Passing data to local API**: Setting values on the `req.context` and pass it to `payload.create()` you can provide additional data to hooks without adding extraneous fields.
4. **Passing data between hooks and middleware or custom endpoints**: Hooks could set context across multiple collections and then be used in a final `postMiddleware`.
## How to Use Context
Let's see examples on how context can be used in the first two scenarios mentioned above:
### Passing data between hooks
To pass data between hooks, you can assign values to context in an earlier hook in the lifecycle of a request and expect it the context in a later hook.
For example:
```ts
const Customer: CollectionConfig = {
slug: 'customers',
hooks: {
beforeChange: [async ({ context, data }) => {
// assign the customerData to context for use later
context.customerData = await fetchCustomerData(data.customerID);
return {
...data,
// some data we use here
name: context.customerData.name
};
}],
afterChange: [async ({ context, doc, req }) => {
// use context.customerData without needing to fetch it again
if (context.customerData.contacted === false) {
createTodo('Call Customer', context.customerData)
}
}],
},
fields: [ /* ... */ ],
};
```
### Preventing infinite loops
Let's say you have an `afterChange` hook, and you want to do a calculation inside the hook (as the document ID needed for the calculation is available in the `afterChange` hook, but not in the `beforeChange` hook). Once that's done, you want to update the document with the result of the calculation.
Bad example:
```ts
const Customer: CollectionConfig = {
slug: 'customers',
hooks: {
afterChange: [async ({ doc }) => {
await payload.update({
// DANGER: updating the same slug as the collection in an afterChange will create an infinite loop!
collection: 'customers',
id: doc.id,
data: {
...(await fetchCustomerData(data.customerID))
},
});
}],
},
fields: [ /* ... */ ],
};
```
Instead of the above, we need to tell the `afterChange` hook to not run again if it performs the update (and thus not update itself again). We can solve that with context.
Fixed example:
```ts
const MyCollection: CollectionConfig = {
slug: 'slug',
hooks: {
afterChange: [async ({ context, doc }) => {
// return if flag was previously set
if (context.triggerAfterChange === false) {
return;
}
await payload.update({
collection: contextHooksSlug,
id: doc.id,
data: {
...(await fetchCustomerData(data.customerID))
},
context: {
// set a flag to prevent from running again
triggerAfterChange: false,
},
});
}],
},
fields: [ /* ... */ ],
};
```
## Typing context
The default typescript interface for `context` is `{ [key: string]: unknown }`. If you prefer a more strict typing in your project or when authoring plugins for others, you can override this using the `declare` syntax.
This is known as "type augmentation" - a TypeScript feature which allows us to add types to existing objects. Simply put this in any .ts or .d.ts file:
```ts
import { RequestContext as OriginalRequestContext } from 'payload';
declare module 'payload' {
// Create a new interface that merges your additional fields with the original one
export interface RequestContext extends OriginalRequestContext {
myObject?: string;
// ...
}
}
```
This will add a the property `myObject` with a type of string to every context object. Make sure to follow this example correctly, as type augmentation can mess up your types if you do it wrong.

View File

@@ -67,6 +67,7 @@ Field Hooks receive one `args` argument that contains the following properties:
| **`previousSiblingDoc`** | The sibling data from the previous document in `afterChange` hook. |
| **`req`** | The Express `request` object. It is mocked for Local API operations. |
| **`value`** | The value of the field. |
| **`previousValue`** | The previous value of the field, before changes were applied, only in `afterChange` hooks. |
#### Return value

View File

@@ -8,11 +8,11 @@ keywords: hooks, globals, config, configuration, documentation, Content Manageme
Globals feature the ability to define the following hooks:
- [beforeValidate](#beforeValidate)
- [beforeChange](#beforeChange)
- [afterChange](#afterChange)
- [beforeRead](#beforeRead)
- [afterRead](#afterRead)
- [beforeValidate](#beforevalidate)
- [beforeChange](#beforechange)
- [afterChange](#afterchange)
- [beforeRead](#beforeread)
- [afterRead](#afterread)
## Config

View File

@@ -0,0 +1,104 @@
---
title: Vercel Visual Editing
label: Vercel Visual Editing
order: 10
desc: Payload + Vercel Visual Editing allows yours editors to navigate directly from the content rendered on your front-end to the fields in Payload that control it.
keywords: vercel, vercel visual editing, visual editing, content source maps, Content Management System, cms, headless, javascript, node, react, express
---
[Vercel Visual Editing](https://vercel.com/docs/workflow-collaboration/visual-editing) will allow your editors to navigate directly from the content rendered on your front-end to the fields in Payload that control it. This requires no changes to your front-end code and very few changes to your Payload config.
![Versions](/images/docs/vercel-visual-editing.jpg)
<Banner type="warning">
Vercel Visual Editing is an enterprise-only feature and only available for
deployments hosted on Vercel. If you are an existing enterprise customer,
[contact our sales team](https://payloadcms.com/for-enterprise) for help with
your integration.
</Banner>
### How it works
To power Vercel Visual Editing, Payload embeds Content Source Maps into its API responses. Content Source Maps are invisible, encoded JSON values that include a link back to the field in the CMS that generated the content. When rendered on the page, Vercel detects and decodes these values to display the Visual Editing interface.
For full details on how the encoding and decoding algorithm works, check out [`@vercel/stega`](https://www.npmjs.com/package/@vercel/stega).
### Getting Started
Setting up Payload with Vercel Visual Editing is easy. First, install the `@payloadcms/plugin-csm` plugin into your project. This plugin requires an API key to install, [contact our sales team](https://payloadcms.com/for-enterprise) if you don't already have one.
```bash
npm i @payloadcms/plugin-csm
```
Then in the `plugins` array of your Payload config, call the plugin and enable any collections that require Content Source Maps.
```ts
import { buildConfig } from "payload/config"
import contentSourceMaps from "@payloadcms/plugin-csm"
const config = buildConfig({
collections: [
{
slug: "pages",
fields: [
{
name: 'slug',
type: 'text',
},
{
name: 'title,'
type: 'text',
},
],
},
],
plugins: [
contentSourceMaps({
collections: ["pages"],
}),
],
})
export default config
```
Now in your Next.js app, include the `?encodeSourceMaps=true` parameter in any of your API requests. For performance reasons, this should only be done when in draft mode or on preview deployments.
```ts
if (isDraftMode || process.env.VERCEL_ENV === "preview") {
const res = await fetch(
`${process.env.NEXT_PUBLIC_PAYLOAD_CMS_URL}/api/pages?where[slug][equals]=${slug}&encodeSourceMaps=true`
);
}
```
And that's it! You are now ready to enter Edit Mode and begin visually editing your content.
##### Edit Mode
To see Visual Editing on your site, you first need to visit any preview deployment on Vercel and login using the Vercel Toolbar. When Content Source Maps are detected on the page, a pencil icon will appear in the toolbar. Clicking this icon will enable Edit Mode, highlighting all editable fields on the page in blue.
![Versions](/images/docs/vercel-toolbar.jpg)
### Troubleshooting
##### Dates
The plugin does not encode `date` fields by default, but for some cases like text that uses negative CSS letter-spacing, it may be necessary to split the encoded data out from the rendered text. This way you can safely use the cleaned data as expected.
```ts
import { vercelStegaSplit } from "@vercel/stega";
const { cleaned, encoded } = vercelStegaSplit(text);
```
##### Blocks
All `blocks` fields by definition do not have plain text strings to encode. For this reason, blocks are given an additional `encodedSourceMap` key, which you can use to enable Visual Editing on entire sections of your site. You can then specify the editing container by adding the `data-vercel-edit-target` HTML attribute to any top-level element of your block.
```ts
<div data-vercel-edit-target>
<span style={{ display: "none" }}>{encodedSourceMap}</span>
{children}
</div>
```

View File

@@ -9,8 +9,14 @@ keywords: local api, config, configuration, documentation, Content Management Sy
The Payload Local API gives you the ability to execute the same operations that are available through REST and GraphQL within Node, directly on your server. Here, you don't need to deal with server latency or network speed whatsoever and can interact directly with your database.
<Banner type="success">
<strong>Tip:</strong><br/>
The Local API is incredibly powerful when used with server-side rendering app frameworks like NextJS. With other headless CMS, you need to request your data from third-party servers which can add significant loading time to your server-rendered pages. With Payload, you don't have to leave your server to gather the data you need. It can be incredibly fast and is definitely a game changer.
<strong>Tip:</strong>
<br />
The Local API is incredibly powerful when used with server-side rendering app
frameworks like NextJS. With other headless CMS, you need to request your data
from third-party servers which can add significant loading time to your
server-rendered pages. With Payload, you don't have to leave your server to
gather the data you need. It can be incredibly fast and is definitely a game
changer.
</Banner>
Here are some common examples of how you can use the Local API:
@@ -28,15 +34,16 @@ You can gain access to the currently running `payload` object via two ways:
You can import or require `payload` into your own files after it's been initialized, but you need to make sure that your `import` / `require` statements come **after** you call `payload.init()`—otherwise Payload won't have been initialized yet. That might be obvious. To us, it's usually not.
Example:
```ts
import payload from 'payload';
import { CollectionAfterChangeHook } from 'payload/types';
import payload from "payload";
import { CollectionAfterChangeHook } from "payload/types";
const afterChangeHook: CollectionAfterChangeHook = async () => {
const posts = await payload.find({
collection: 'posts',
collection: "posts",
});
}
};
```
##### Accessing from the `req`
@@ -44,35 +51,42 @@ const afterChangeHook: CollectionAfterChangeHook = async () => {
Payload is available anywhere you have access to the Express `req` - including within your access control and hook functions.
Example:
```ts
const afterChangeHook: CollectionAfterChangeHook = async ({ req: { payload }}) => {
const afterChangeHook: CollectionAfterChangeHook = async ({
req: { payload },
}) => {
const posts = await payload.find({
collection: 'posts',
collection: "posts",
});
}
};
```
### Local options available
You can specify more options within the Local API vs. REST or GraphQL due to the server-only context that they are executed in.
| Local Option | Description |
| -------------------- | ------------ |
| `collection` | Required for Collection operations. Specifies the Collection slug to operate against. |
| `data` | The data to use within the operation. Required for `create`, `update`. |
| `depth` | [Control auto-population](/docs/getting-started/concepts#depth) of nested relationship and upload fields. |
| `locale` | Specify [locale](/docs/configuration/localization) for any returned documents. |
| `fallbackLocale` | Specify a [fallback locale](/docs/configuration/localization) to use for any returned documents. |
| `overrideAccess` | Skip access control. By default, this property is set to true within all Local API operations. |
| `user` | If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks. |
| `showHiddenFields` | Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config. |
| `pagination` | Set to false to return all documents and avoid querying for document counts. |
| Local Option | Description |
| ------------------ | -------------------------------------------------------------------------------------------------------------------- |
| `collection` | Required for Collection operations. Specifies the Collection slug to operate against. |
| `data` | The data to use within the operation. Required for `create`, `update`. |
| `depth` | [Control auto-population](/docs/getting-started/concepts#depth) of nested relationship and upload fields. |
| `locale` | Specify [locale](/docs/configuration/localization) for any returned documents. |
| `fallbackLocale` | Specify a [fallback locale](/docs/configuration/localization) to use for any returned documents. |
| `overrideAccess` | Skip access control. By default, this property is set to true within all Local API operations. |
| `user` | If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks. |
| `showHiddenFields` | Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config. |
| `pagination` | Set to false to return all documents and avoid querying for document counts. |
| `context` | [Context](/docs/hooks/context), which will then be passed to `context` and `req.context`, which can be read by hooks. Useful if you want to pass additional information to the hooks which shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook to determine if it should run or not. |
*There are more options available on an operation by operation basis outlined below.*
_There are more options available on an operation by operation basis outlined below._
<Banner type="warning">
<strong>Note:</strong><br/>
By default, all access control checks are disabled in the Local API, but you can re-enable them if you'd like, as well as pass a specific user to run the operation with.
<strong>Note:</strong>
<br />
By default, all access control checks are disabled in the Local API, but you
can re-enable them if you'd like, as well as pass a specific user to run the
operation with.
</Banner>
## Collections
@@ -84,12 +98,13 @@ The following Collection operations are available through the Local API:
```js
// The created Post document is returned
const post = await payload.create({
collection: 'posts', // required
data: { // required
title: 'sure',
description: 'maybe',
collection: "posts", // required
data: {
// required
title: "sure",
description: "maybe",
},
locale: 'en',
locale: "en",
fallbackLocale: false,
user: dummyUserDoc,
overrideAccess: true,
@@ -102,12 +117,12 @@ const post = await payload.create({
// If your collection supports uploads, you can upload
// a file directly through the Local API by providing
// its full, absolute file path.
filePath: path.resolve(__dirname, './path-to-image.jpg'),
filePath: path.resolve(__dirname, "./path-to-image.jpg"),
// Alternatively, you can directly pass a File,
// if file is provided, filePath will be omitted
file: uploadedFile,
})
});
```
#### Find
@@ -116,18 +131,18 @@ const post = await payload.create({
// Result will be a paginated set of Posts.
// See /docs/queries/pagination for more.
const result = await payload.find({
collection: 'posts', // required
collection: "posts", // required
depth: 2,
page: 1,
limit: 10,
where: {}, // pass a `where` query here
sort: '-title',
locale: 'en',
sort: "-title",
locale: "en",
fallbackLocale: false,
user: dummyUser,
overrideAccess: false,
showHiddenFields: true,
})
});
```
#### Find by ID
@@ -135,30 +150,31 @@ const result = await payload.find({
```js
// Result will be a Post document.
const result = await payload.findByID({
collection: 'posts', // required
id: '507f1f77bcf86cd799439011', // required
collection: "posts", // required
id: "507f1f77bcf86cd799439011", // required
depth: 2,
locale: 'en',
locale: "en",
fallbackLocale: false,
user: dummyUser,
overrideAccess: false,
showHiddenFields: true,
})
});
```
#### Update
#### Update by ID
```js
// Result will be the updated Post document.
const result = await payload.update({
collection: 'posts', // required
id: '507f1f77bcf86cd799439011', // required
data: { // required
title: 'sure',
description: 'maybe',
collection: "posts", // required
id: "507f1f77bcf86cd799439011", // required
data: {
// required
title: "sure",
description: "maybe",
},
depth: 2,
locale: 'en',
locale: "en",
fallbackLocale: false,
user: dummyUser,
overrideAccess: false,
@@ -167,13 +183,51 @@ const result = await payload.update({
// If your collection supports uploads, you can upload
// a file directly through the Local API by providing
// its full, absolute file path.
filePath: path.resolve(__dirname, './path-to-image.jpg'),
filePath: path.resolve(__dirname, "./path-to-image.jpg"),
// If you are uploading a file and would like to replace
// the existing file instead of generating a new filename,
// you can set the following property to `true`
overwriteExistingFiles: true,
})
});
```
#### Update Many
```js
// Result will be an object with:
// {
// docs: [], // each document that was updated
// errors: [], // each error also includes the id of the document
// }
const result = await payload.update({
collection: "posts", // required
where: {
// required
fieldName: { equals: "value" },
},
data: {
// required
title: "sure",
description: "maybe",
},
depth: 0,
locale: "en",
fallbackLocale: false,
user: dummyUser,
overrideAccess: false,
showHiddenFields: true,
// If your collection supports uploads, you can upload
// a file directly through the Local API by providing
// its full, absolute file path.
filePath: path.resolve(__dirname, "./path-to-image.jpg"),
// If you are uploading a file and would like to replace
// the existing file instead of generating a new filename,
// you can set the following property to `true`
overwriteExistingFiles: true,
});
```
#### Delete
@@ -181,15 +235,38 @@ const result = await payload.update({
```js
// Result will be the now-deleted Post document.
const result = await payload.delete({
collection: 'posts', // required
id: '507f1f77bcf86cd799439011', // required
collection: "posts", // required
id: "507f1f77bcf86cd799439011", // required
depth: 2,
locale: 'en',
locale: "en",
fallbackLocale: false,
user: dummyUser,
overrideAccess: false,
showHiddenFields: true,
})
});
```
#### Delete Many
```js
// Result will be an object with:
// {
// docs: [], // each document that is now deleted
// errors: [], // any errors that occurred, including the id of the errored on document
// }
const result = await payload.delete({
collection: "posts", // required
where: {
// required
fieldName: { equals: "value" },
},
depth: 0,
locale: "en",
fallbackLocale: false,
user: dummyUser,
overrideAccess: false,
showHiddenFields: true,
});
```
## Auth Operations
@@ -207,19 +284,20 @@ If a collection has [`Authentication`](/docs/authentication/overview) enabled, a
// }
const result = await payload.login({
collection: 'users', // required
data: { // required
email: 'dev@payloadcms.com',
password: 'rip',
collection: "users", // required
data: {
// required
email: "dev@payloadcms.com",
password: "rip",
},
req: req, // pass an Express `req` which will be provided to all hooks
res: res, // used to automatically set an HTTP-only auth cookie
depth: 2,
locale: 'en',
locale: "en",
fallbackLocale: false,
overrideAccess: false,
showHiddenFields: true,
})
});
```
#### Forgot Password
@@ -227,12 +305,13 @@ const result = await payload.login({
```js
// Returned token will allow for a password reset
const token = await payload.forgotPassword({
collection: 'users', // required
data: { // required
email: 'dev@payloadcms.com',
collection: "users", // required
data: {
// required
email: "dev@payloadcms.com",
},
req: req, // pass an Express `req` which will be provided to all hooks
})
});
```
#### Reset Password
@@ -244,13 +323,14 @@ const token = await payload.forgotPassword({
// user: { ... } // the user document that just logged in
// }
const result = await payload.forgotPassword({
collection: 'users', // required
data: { // required
token: 'afh3o2jf2p3f...', // the token generated from the forgotPassword operation
collection: "users", // required
data: {
// required
token: "afh3o2jf2p3f...", // the token generated from the forgotPassword operation
},
req: req, // pass an Express `req` which will be provided to all hooks
res: res, // used to automatically set an HTTP-only auth cookie
})
});
```
#### Unlock
@@ -258,13 +338,14 @@ const result = await payload.forgotPassword({
```js
// Returned result will be a boolean representing success or failure
const result = await payload.unlock({
collection: 'users', // required
data: { // required
email: 'dev@payloadcms.com',
collection: "users", // required
data: {
// required
email: "dev@payloadcms.com",
},
req: req, // pass an Express `req` which will be provided to all hooks
overrideAccess: true,
})
});
```
#### Verify
@@ -272,9 +353,9 @@ const result = await payload.unlock({
```js
// Returned result will be a boolean representing success or failure
const result = await payload.verify({
collection: 'users', // required
token: 'afh3o2jf2p3f...', // the token saved on the user as `_verificationToken`
})
collection: "users", // required
token: "afh3o2jf2p3f...", // the token saved on the user as `_verificationToken`
});
```
## Globals
@@ -286,14 +367,14 @@ The following Global operations are available through the Local API:
```js
// Result will be the Header Global.
const result = await payload.findGlobal({
slug: 'header', // required
slug: "header", // required
depth: 2,
locale: 'en',
locale: "en",
fallbackLocale: false,
user: dummyUser,
overrideAccess: false,
showHiddenFields: true,
})
});
```
#### Update
@@ -301,44 +382,79 @@ const result = await payload.findGlobal({
```js
// Result will be the updated Header Global.
const result = await payload.updateGlobal({
slug: 'header', // required
data: { // required
slug: "header", // required
data: {
// required
nav: [
{
url: 'https://google.com',
url: "https://google.com",
},
{
url: 'https://payloadcms.com',
url: "https://payloadcms.com",
},
],
},
depth: 2,
locale: 'en',
locale: "en",
fallbackLocale: false,
user: dummyUser,
overrideAccess: false,
showHiddenFields: true,
})
});
```
## Example Script using Local API
The Local API is especially useful for running scripts
```ts
import payload from "payload";
import path from "path";
import dotenv from "dotenv";
dotenv.config({
path: path.resolve(__dirname, "../.env"),
});
const { PAYLOAD_SECRET, MONGODB_URI } = process.env;
const doAction = async (): Promise<void> => {
await payload.init({
secret: PAYLOAD_SECRET,
mongoURL: MONGODB_URI,
local: true, // Enables local mode, doesn't spin up a server or frontend
});
// Perform any Local API operations here
await payload.find({
collection: "posts",
// where: {} // optional
});
await payload.create({
collection: "posts",
data: {},
});
};
doAction();
```
## TypeScript
Local API calls also support passing in a generic. This is especially useful if you generate your TS types using a [generate types script](/docs/typescript/generating-types).
Local API calls will automatically infer your [generated types](/docs/typescript/generating-types).
Here is an example of usage:
```ts
// Our generated types
import { Post } from './payload-types'
// Add Post types as generic to create function
const post: Post = await payload.create<Post>({
collection: 'posts',
// Properly inferred as `Post` type
const post = await payload.create({
collection: "posts",
// Data will now be typed as Post and give you type hints
data: {
title: 'my title',
description: 'my description',
title: "my title",
description: "my description",
},
})
});
```

View File

@@ -12,9 +12,15 @@ keywords: deployment, production, config, configuration, documentation, Content
There are many ways to deploy Payload to a production environment. When evaluating how you will deploy Payload, you need to consider these main aspects:
1. [Basics](#basics)
1. [Security](#security)
1. [Your MongoDB](#mongodb)
1. [Permanent File Storage](#file-storage)
1. [Docker](#docker)
## Basics
In order for Payload to run, it requires both the server code and the built admin panel. These will be the `dist` and `build` directories by default. If you've used `create-payload-app` to create your project, executing the `build` npm script will build both and output these directories.
## Security
@@ -37,15 +43,17 @@ Because _**you**_ are in complete control of who can do what with your data, you
Before running in Production, you need to have built a production-ready copy of the Payload Admin panel. To do this, Payload provides the `build` NPM script. You can use it by adding a `script` to your `package.json` file like this:
`package.json`:
```json
{
"name": "project-name-here",
"scripts": {
"build": "payload build",
"build": "payload build"
},
"dependencies": {
// your dependencies
},
}
}
```
Then, to build Payload, you would run `npm run build` in your project folder. A production-ready Admin bundle will be created in the `build` directory.
@@ -64,6 +72,8 @@ Payload comes with a robust set of built-in anti-abuse measures, such as locking
## MongoDB
Payload can be used with any MongoDB compatible database including AWS DocumentDB or Azure Cosmos DB.
##### Managing MongoDB yourself
If you are using a [persistent filesystem-based cloud host](#persistent-vs-ephemeral-filesystems) such as a [DigitalOcean Droplet](https://www.digitalocean.com/products/droplets/) or an [Amazon EC2](https://aws.amazon.com/ec2/?ec2-whats-new.sort-by=item.additionalFields.postDateTime&ec2-whats-new.sort-order=desc) server, you might opt to install MongoDB directly on that server itself so that Node can communicate with it locally. With this approach, you can benefit from faster response times, but scaling can become more involved as your app's user base grows.
@@ -73,10 +83,18 @@ If you are using a [persistent filesystem-based cloud host](#persistent-vs-ephem
Alternatively, you can rely on a third-party MongoDB host such as [MongoDB Atlas](https://www.mongodb.com/). With Atlas or a similar cloud provider, you can trust them to take care of your database's availability, security, redundancy, and backups.
<Banner type="warning">
<strong>Note regarding Azure Cosmos:</strong><br/>
When using Azure Cosmos, MongoDB requires an index on any field being sorted on. To make this easier, see the <a href="/docs/configuration/overview">indexSortableFields</a> configuration option.
<strong>Note:</strong><br />
If versions are enabled and a collection has many documents you may need a minimum of an m10 mongoDB atlas cluster if you reach a sorting `exceeded memory limit` error to view a collection list in the admin UI. The limitations of the m2 and m5 tier clusters are here: [Atlas M0 (Free Cluster), M2, and M5 Limitations](https://www.mongodb.com/docs/atlas/reference/free-shared-limitations/?_ga=2.176267877.1329169847.1677683154-860992573.1647438381#operational-limitations).
</Banner>
##### DocumentDB
When using AWS DocumentDB, you will need to configure connection options for authentication in the `mongoOptions` passed to `payload.init`. You also need to set `mongoOptions.useFacet` to `false` to disable use of the unsupported `$facet` aggregation.
##### CosmosDB
When using Azure Cosmos DB, an index is needed for any field you may want to sort on. To add the sort index for all fields that may be sorted in the admin UI use the <a href="/docs/configuration/overview">indexSortableFields</a> configuration option.
## File storage
If you are using Payload to [manage file uploads](/docs/upload/overview), you need to consider where your uploaded files will be permanently stored. If you do not use Payload for file uploads, then this section does not impact your app whatsoever.
@@ -100,7 +118,7 @@ Alternatively, persistent filesystems will never delete your files and can be tr
- Many other more traditional web hosts
<Banner type="error">
<strong>Warning:</strong><br/>
<strong>Warning:</strong><br />
If you rely on Payload's <strong>Upload</strong> functionality, make sure you either use a host with a persistent filesystem or have an integration with a third-party file host like Amazon S3.
</Banner>
@@ -108,7 +126,7 @@ Alternatively, persistent filesystems will never delete your files and can be tr
If you don't use Payload's `upload` functionality, you can go ahead and use Heroku or similar platform easily. Everything will work exactly as you want it to.
But, if you do, and you still want to use an ephemeral filesystem provider, you can write a hook-based solution to *copy* the files your users upload to a more permanent storage solution like Amazon S3 or DigitalOcean Spaces.
But, if you do, and you still want to use an ephemeral filesystem provider, you can write a hook-based solution to _copy_ the files your users upload to a more permanent storage solution like Amazon S3 or DigitalOcean Spaces.
**To automatically send uploaded files to S3 or similar, you could:**
@@ -166,10 +184,9 @@ CMD ["node", "dist/server.js"]
Here is an example of a docker-compose.yml file that can be used for development
```yml
version: '3'
version: "3"
services:
payload:
image: node:18-alpine
ports:

View File

@@ -9,7 +9,7 @@ keywords: query, documents, overview, documentation, Content Management System,
Payload provides an extremely granular querying language through all APIs. Each API takes the same syntax and fully supports all options.
<Banner>
<strong>Here, "querying" relates to filtering or searching through documents within a Collection.</strong> You can build queries to pass to Find operations as well as to <a href="/docs/access-control/overview">restrict which documents certain users can access</a> via access control functions.
<strong>Here, "querying" relates to filtering or searching through documents within a Collection.</strong> You can build queries to pass to Find operations as well as to [restrict which documents certain users can access](/docs/access-control/overview) via access control functions.
</Banner>
### Simple queries
@@ -17,94 +17,107 @@ Payload provides an extremely granular querying language through all APIs. Each
For example, say you have a collection as follows:
```ts
import { CollectionConfig } from 'payload/types';
import { CollectionConfig } from "payload/types";
const Post: CollectionConfig = {
slug: 'posts',
export const Post: CollectionConfig = {
slug: "posts",
fields: [
{
name: 'color',
type: 'select',
options: [
'mint',
'dark-gray',
'white',
],
name: "color",
type: "select",
options: ["mint", "dark-gray", "white"],
},
{
name: 'featured',
type: 'checkbox',
}
]
}
name: "featured",
type: "checkbox",
},
],
};
```
You may eventually have a lot of documents within this Collection. If you wanted to find only documents with `color` equal to `mint`, you could write a query as follows:
```js
const query = {
color: { // property name to filter on
equals: 'mint', // operator to use and value to compare against
color: {
// property name to filter on
equals: "mint", // operator to use and value to compare against
},
}
};
```
The above example demonstrates a simple query but you can get much more complex.
### Operators
| Operator | Description |
| -------------------- | ------------ |
| `equals` | The value must be exactly equal. |
| `not_equals` | The query will return all documents where the value is not equal. |
| `greater_than` | For numeric or date-based fields. |
| `greater_than_equal` | For numeric or date-based fields. |
| `less_than` | For numeric or date-based fields. |
| `less_than_equal` | For numeric or date-based fields. |
| `like` | Case-insensitive string must be present. If string of words, all words must be present, in any order. |
| `contains` | Must contain the value entered, case-insensitive. |
| `in` | The value must be found within the provided comma-delimited list of values. |
| `not_in` | The value must NOT be within the provided comma-delimited list of values. |
| `exists` | Only return documents where the value either exists (`true`) or does not exist (`false`). |
| Operator | Description |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `equals` | The value must be exactly equal. |
| `not_equals` | The query will return all documents where the value is not equal. |
| `greater_than` | For numeric or date-based fields. |
| `greater_than_equal` | For numeric or date-based fields. |
| `less_than` | For numeric or date-based fields. |
| `less_than_equal` | For numeric or date-based fields. |
| `like` | Case-insensitive string must be present. If string of words, all words must be present, in any order. |
| `contains` | Must contain the value entered, case-insensitive. |
| `in` | The value must be found within the provided comma-delimited list of values. |
| `not_in` | The value must NOT be within the provided comma-delimited list of values. |
| `all` | The value must contain all values provided in the comma-delimited list. |
| `exists` | Only return documents where the value either exists (`true`) or does not exist (`false`). |
| `near` | For distance related to a [point field](/docs/fields/point) comma separated as `<longitude>, <latitude>, <maxDistance in meters (nullable)>, <minDistance in meters (nullable)>`. |
<Banner type="success">
<strong>Tip</strong>:<br/>
<strong>Tip</strong>:<br />
If you know your users will be querying on certain fields a lot, you can add <strong>index: true</strong> to a field's config which will speed up searches using that field immensely.
</Banner>
### And / Or Logic
In addition to defining simple queries, you can join multiple queries together using simple AND / OR logic. Let's take the above `Post` collection for example and write a more complex query usnig AND / OR:
In addition to defining simple queries, you can join multiple queries together using simple AND / OR logic. Let's take the above `Post` collection for example and write a more complex query using AND / OR:
```js
const query = {
or: [ // array of OR conditions
or: [
// array of OR conditions
{
color: {
equals: 'mint',
equals: "mint",
},
},
{
and: [ // nested array of AND conditions
and: [
// nested array of AND conditions
{
color: {
equals: 'white',
}
equals: "white",
},
},
{
featured: {
equals: false,
}
}
]
}
]
}
},
},
],
},
],
};
```
Written in plain English, if the above query were passed to a `find` operation, it would translate to finding posts where either the `color` is `mint` OR the `color` is `white` AND `featured` is set to false.
### Nested properties
When working with nested properties, which can happen when using relational fields, it is possible to use the dot notation to access the nested property. For example, when working with a `Song` collection that has a `artists` field which is related to an `Artists` collection using the `name: 'artists'`. You can access a property within the collection `Artists` like so:
```js
const query = {
"artists.featured": {
// nested property name to filter on
exists: true, // operator to use and boolean value that needs to be true
},
};
```
### GraphQL Find Queries
All GraphQL `find` queries support the `where` argument, which accepts queries exactly as detailed above.
@@ -135,24 +148,29 @@ This one isn't too bad, but more complex queries get unavoidably more difficult
**For example, using fetch:**
```js
import qs from 'qs';
import qs from "qs";
const query = {
color: {
equals: 'mint',
equals: "mint",
},
// This query could be much more complex
// and QS would handle it beautifully
}
};
const getPosts = async () => {
const stringifiedQuery = qs.stringify({
where: query // ensure that `qs` adds the `where` property, too!
}, { addQueryPrefix: true });
const stringifiedQuery = qs.stringify(
{
where: query, // ensure that `qs` adds the `where` property, too!
},
{ addQueryPrefix: true }
);
const response = await fetch(`http://localhost:3000/api/posts${stringifiedQuery}`);
const response = await fetch(
`http://localhost:3000/api/posts${stringifiedQuery}`
);
// Continue to handle the response below...
}
};
```
### Local API Queries
@@ -162,27 +180,27 @@ The Local API's `find` operation accepts an object exactly how you write it. For
```js
const getPosts = async () => {
const posts = await payload.find({
collection: 'posts',
collection: "posts",
where: {
color: {
equals: 'mint',
equals: "mint",
},
},
});
return posts;
}
};
```
## Sort
Payload `find` queries support a `sort` parameter through all APIs. Pass the `name` of a top-level field to sort by that field in ascending order. Prefix the name of the field with a minus symbol ("-") to sort in descending order.
Payload `find` queries support a `sort` parameter through all APIs. Pass the `name` of a top-level field to sort by that field in ascending order. Prefix the name of the field with a minus symbol ("-") to sort in descending order. Because sorting is handled by the database, the field you wish to sort on must be stored in the database to work; not a [virtual field](https://payloadcms.com/blog/learn-how-virtual-fields-can-help-solve-common-cms-challenges). It is recommended to enable indexing for the fields where sorting is used.
**REST example:**
**`https://localhost:3000/api/posts?sort=-createdAt`**
**GraphQL example:**
```
query {
Posts(sort: "-createdAt") {
@@ -198,10 +216,10 @@ query {
```js
const getPosts = async () => {
const posts = await payload.find({
collection: 'posts',
sort: '-createdAt',
collection: "posts",
sort: "-createdAt",
});
return posts;
}
};
```

View File

@@ -7,7 +7,8 @@ keywords: rest, api, documentation, Content Management System, cms, headless, ja
---
<Banner>
A fully functional REST API is automatically generated from your Collection and Global configs.
A fully functional REST API is automatically generated from your Collection
and Global configs.
</Banner>
All Payload API routes are mounted prefixed to your config's `routes.api` URL segment (default: `/api`).
@@ -26,56 +27,534 @@ Note: Collection slugs must be formatted in kebab-case
**All CRUD operations are exposed as follows:**
| Method | Path | Description |
| -------- | --------------------------- | -------------------------------------- |
| `GET` | `/api/{collection-slug}` | Find paginated documents |
| `GET` | `/api/{collection-slug}/:id` | Find a specific document by ID |
| `POST` | `/api/{collection-slug}` | Create a new document |
| `PATCH` | `/api/{collection-slug}/:id` | Update a document by ID |
| `DELETE` | `/api/{collection-slug}/:id` | Delete an existing document by ID |
<RestExamples
data={[
{
operation: "Find",
method: "GET",
path: "/api/{collection-slug}",
description: "Find paginated documents",
example: {
slug: "getCollection",
req: true,
res: {
paginated: true,
data: {
id: "644a5c24cc1383022535fc7c",
title: "Home",
content: "REST API examples",
slug: "home",
createdAt: "2023-04-27T11:27:32.419Z",
updatedAt: "2023-04-27T11:27:32.419Z",
},
},
drawerContent: (
<>
<h6>Additional <code>find</code> query parameters</h6>
The <code>find</code> endpoint supports the following additional query parameters:
<ul>
<li>
<a href="/docs/queries/overview#sort">sort</a> - sort by field
</li>
<li>
<a href="/docs/queries/overview">where</a> - pass a where query to constrain returned
documents
</li>
<li>
<a href="/docs/queries/pagination#pagination-controls">limit</a> - limit the returned
documents to a certain number
</li>
<li>
<a href="/docs/queries/pagination#pagination-controls">page</a> - get a specific page of
documents
</li>
</ul>
</>
),
},
},
{
operation: "Find By ID",
method: "GET",
path: "/api/{collection-slug}/{id}",
description: "Find a specific document by ID",
example: {
slug: "findByID",
req: true,
res: {
id: "644a5c24cc1383022535fc7c",
title: "Home",
content: "REST API examples",
slug: "home",
createdAt: "2023-04-27T11:27:32.419Z",
updatedAt: "2023-04-27T11:27:32.419Z",
},
},
},
{
operation: "Create",
method: "POST",
path: "/api/{collection-slug}",
description: "Create a new document",
example: {
slug: "createDocument",
req: {
credentials: true,
headers: true,
body: {
title: "New page",
content: "Here is some content",
},
},
res: {
message: "Page successfully created.",
doc: {
id: "644ba34c86359864f9535932",
title: "New page",
content: "Here is some content",
slug: "new-page",
createdAt: "2023-04-28T10:43:24.466Z",
updatedAt: "2023-04-28T10:43:24.466Z",
},
},
},
},
{
operation: "Update",
method: "PATCH",
path: "/api/{collection-slug}",
description: "Update all documents matching the where query",
example: {
slug: "updateDocument",
req: {
credentials: true,
query: true,
headers: true,
body: {
title: "I have been updated!",
},
},
res: {
docs: [
{
id: "644ba34c86359864f9535932",
title: "I have been updated!",
content: "Here is some content",
slug: "new-page",
createdAt: "2023-04-28T10:43:24.466Z",
updatedAt: "2023-04-28T10:45:23.724Z",
},
],
errors: [],
},
},
},
{
operation: "Update By ID",
method: "PATCH",
path: "/api/{collection-slug}/{id}",
description: "Update a document by ID",
example: {
slug: "updateDocumentByID",
req: {
credentials: true,
headers: true,
body: {
title: "I have been updated by ID!",
categories: "example-uuid",
tags: {
relationTo: "location",
value: "another-example-uuid",
},
},
},
res: {
message: "Updated successfully.",
doc: {
id: "644a5c24cc1383022535fc7c",
title: "I have been updated by ID!",
content: "REST API examples",
categories: {
id: "example-uuid",
name: "Test Category",
},
tags: [
{
relationTo: "location",
value: {
id: "another-example-uuid",
name: "Test Location",
},
},
],
slug: "home",
createdAt: "2023-04-27T11:27:32.419Z",
updatedAt: "2023-04-28T10:47:59.259Z",
},
},
},
},
{
operation: "Delete",
method: "DELETE",
path: "/api/{collection-slug}",
description: "Delete all documents matching the where query",
example: {
slug: "deleteDocuments",
req: {
credentials: true,
query: true,
headers: true,
},
res: {
docs: [
{
id: "644ba4cf86359864f953594b",
title: "New page",
content: "Here is some content",
slug: "new-page",
createdAt: "2023-04-28T10:49:51.359Z",
updatedAt: "2023-04-28T10:49:51.359Z",
},
],
errors: [],
},
},
},
{
operation: "Delete by ID",
method: "DELETE",
path: "/api/{collection-slug}/{id}",
description: "Delete an existing document by ID",
example: {
slug: "deleteByID",
req: {
credentials: true,
headers: true,
},
res: {
id: "644ba51786359864f9535954",
title: "New page",
content: "Here is some content",
slug: "new-page",
createdAt: "2023-04-28T10:51:03.028Z",
updatedAt: "2023-04-28T10:51:03.028Z",
},
},
},
##### Additional `find` query parameters
The `find` endpoint supports the following additional query parameters:
- [sort](/docs/queries/overview#sort) - sort by field
- [where](/docs/queries/overview) - pass a `where` query to constrain returned documents
- [limit](/docs/queries/pagination#pagination-controls) - limit the returned documents to a certain number
- [page](/docs/queries/pagination#pagination-controls) - get a specific page of documents
]}
/>
## Auth Operations
Auth enabled collections are also given the following endpoints:
| Method | Path | Description |
| -------- | --------------------------- | ----------- |
| `POST` | `/api/{collection-slug}/verify/:token` | [Email verification](/docs/authentication/operations#verify-by-email), if enabled. |
| `POST` | `/api/{collection-slug}/unlock` | [Unlock a user's account](/docs/authentication/operations#unlock), if enabled. |
| `POST` | `/api/{collection-slug}/login` | [Logs in](/docs/authentication/operations#login) a user with email / password. |
| `POST` | `/api/{collection-slug}/logout` | [Logs out](/docs/authentication/operations#logout) a user. |
| `POST` | `/api/{collection-slug}/refresh-token` | [Refreshes a token](/docs/authentication/operations#refresh) that has not yet expired. |
| `GET` | `/api/{collection-slug}/me` | [Returns the currently logged in user with token](/docs/authentication/operations#me). |
| `POST` | `/api/{collection-slug}/forgot-password` | [Password reset workflow](/docs/authentication/operations#forgot-password) entry point. |
| `POST` | `/api/{collection-slug}/reset-password` | [To reset the user's password](/docs/authentication/operations#reset-password). |
<RestExamples
data={[
{
operation: "Login",
method: "POST",
path: "/api/{user-collection}/login",
description: "Logs in a user with email / password",
example: {
slug: "login",
req: {
credentials: true,
headers: true,
body: {
email: "dev@payloadcms.com",
password: "password",
},
},
res: {
message: "Auth Passed",
user: {
id: "644b8453cd20c7857da5a9b0",
email: "dev@payloadcms.com",
_verified: true,
createdAt: "2023-04-28T08:31:15.788Z",
updatedAt: "2023-04-28T11:11:03.716Z",
},
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
exp: 1682689147,
},
},
},
{
operation: "Logout",
method: "POST",
path: "/api/{user-collection}/logout",
description: "Logs out a user",
example: {
slug: "logout",
req: {
headers: true,
credentials: true,
},
res: {
message: "You have been logged out successfully.",
},
},
},
{
operation: "Unlock",
method: "POST",
path: "/api/{user-collection}/unlock",
description: "Unlock a user account",
example: {
slug: "unlockCollection",
req: {
credentials: true,
headers: true,
body: {
email: "dev@payloadcms.com",
},
},
res: {
message: "Success",
},
},
},
{
operation: "Refresh",
method: "POST",
path: "/api/{user-collection}/refresh-token",
description: "Refreshes a token that has not yet expired",
example: {
slug: "refreshToken",
req: {
credentials: true,
headers: true,
},
res: {
message: "Token refresh successful",
refreshedToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
exp: 1682689362,
user: {
email: "dev@payloadcms.com",
id: "644b8453cd20c7857da5a9b0",
collection: "users",
},
},
},
},
{
operation: "Verify User",
method: "POST",
path: "/api/{user-collection}/verify/{token}",
description: "User verification",
example: {
slug: "verifyUser",
req: {
credentials: true,
headers: true,
},
res: {
message: "Email verified successfully.",
},
},
},
{
operation: "Current User",
method: "GET",
path: "/api/{user-collection}/me",
description: "Returns the currently logged in user with token",
example: {
slug: "currentUser",
req: {
credentials: true,
headers: true,
},
res: {
user: {
id: "644b8453cd20c7857da5a9b0",
email: "dev@payloadcms.com",
_verified: true,
createdAt: "2023-04-28T08:31:15.788Z",
updatedAt: "2023-04-28T11:45:23.926Z",
_strategy: "local-jwt",
},
collection: "users",
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
exp: 1682689523,
},
},
},
{
operation: "Forgot Password",
method: "POST",
path: "/api/{user-collection}/forgot-password",
description: "Password reset workflow entry point",
example: {
slug: "forgotPassword",
req: {
headers: true,
credentials: true,
body: {
email: "dev@payloadcms.com",
},
},
res: {
message: "Success",
},
},
},
{
operation: "Reset Password",
method: "POST",
path: "/api/{user-collection}/reset-password",
description: "Reset user password",
example: {
slug: "resetPassword",
req: {
credentials: true,
headers: true,
body: {
token: "7eac3830ffcfc7f9f66c00315dabeb11575dba91",
password: "newPassword",
},
},
res: {
message: "Password reset successfully.",
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
user: {
id: "644baa473ea9538765cc30fc",
email: "dev@payloadcms.com",
_verified: true,
createdAt: "2023-04-28T11:13:11.569Z",
updatedAt: "2023-04-28T11:49:23.860Z",
},
},
},
},
]}
/>
## Globals
Globals cannot be created or deleted, so there are only two REST endpoints opened:
| Method | Path | Description |
| -------- | --------------------------- | ----------------------- |
| `GET` | `/api/globals/{globalSlug}` | Get a global by slug |
| `POST` | `/api/globals/{globalSlug}` | Update a global by slug |
<RestExamples
data={[
{
operation: "Get Global",
method: "GET",
path: "/api/globals/{global-slug}",
description: "Get a global by slug",
example: {
slug: "getGlobal",
req: {
credentials: true,
headers: true,
},
res: {
announcement: "Here is an announcement!",
globalType: "announcement",
createdAt: "2023-04-28T08:53:56.066Z",
updatedAt: "2023-04-28T08:53:56.066Z",
id: "644b89a496c64a833fe579c9",
},
},
},
{
operation: "Update Global",
method: "POST",
path: "/api/globals/{global-slug}",
description: "Update a global by slug",
example: {
slug: "updateGlobal",
req: {
headers: true,
credentials: true,
body: {
announcement: "Paging Doctor Scrunt",
},
},
res: {
announcement: "Paging Doctor Scrunt",
globalType: "announcement",
createdAt: "2023-04-28T08:53:56.066Z",
updatedAt: "2023-04-28T08:53:56.066Z",
id: "644b89a496c64a833fe579c9",
},
},
},
]}
/>
## Preferences
In addition to the dynamically generated endpoints above Payload also has REST endpoints to manage the admin user [preferences](/docs/admin/overview#preferences) for data specific to the authenticated user.
| Method | Path | Description |
| -------- | --------------------------- | ----------------------- |
| `GET` | `/api/_preferences/{key}` | Get a preference by key |
| `POST` | `/api/_preferences/{key}` | Create or update by key |
| `DELETE` | `/api/_preferences/{key}` | Delete a user preference by key |
<RestExamples
data={[
{
operation: "Get Preference",
method: "GET",
path: "/api/_preferences/{key}",
description: "Get a preference by key",
example: {
slug: "getPreference",
req: {
headers: true,
credentials: true,
},
res: {
_id: "644bb7a8307b3d363c6edf2c",
key: "region",
user: "644b8453cd20c7857da5a9b0",
userCollection: "users",
__v: 0,
createdAt: "2023-04-28T12:10:16.689Z",
updatedAt: "2023-04-28T12:10:16.689Z",
value: "Europe/London",
},
},
},
{
operation: "Create Preference",
method: "POST",
path: "/api/_preferences/{key}",
description: "Create or update a preference by key",
example: {
slug: "createPreference",
req: {
headers: true,
credentials: true,
body: {
value: "Europe/London",
},
},
res: {
message: "Updated successfully.",
doc: {
user: "644b8453cd20c7857da5a9b0",
key: "region",
userCollection: "users",
value: "Europe/London",
},
},
},
},
{
operation: "Delete Preference",
method: "DELETE",
path: "/api/_preferences/{key}",
description: "Delete a preference by key",
example: {
slug: "deletePreference",
req: {
headers: true,
},
res: {
message: "deletedSuccessfully",
},
},
},
]}
/>
## Custom Endpoints
@@ -83,42 +562,48 @@ Additional REST API endpoints can be added to your application by providing an a
Each endpoint object needs to have:
| Property | Description |
| ---------- | ----------------------------------------- |
| **`path`** | A string for the endpoint route after the collection or globals slug |
| **`method`** | The lowercase HTTP verb to use: 'get', 'head', 'post', 'put', 'delete', 'connect' or 'options' |
| **`handler`** | A function or array of functions to be called with **req**, **res** and **next** arguments. [Express](https://expressjs.com/en/guide/routing.html#route-handlers) |
| **`root`** | When `true`, defines the endpoint on the root Express app, bypassing Payload handlers and the `routes.api` subpath. Note: this only applies to top-level endpoints of your Payload config, endpoints defined on `collections` or `globals` cannot be root. |
| Property | Description |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`path`** | A string for the endpoint route after the collection or globals slug |
| **`method`** | The lowercase HTTP verb to use: 'get', 'head', 'post', 'put', 'delete', 'connect' or 'options' |
| **`handler`** | A function or array of functions to be called with **req**, **res** and **next** arguments. [Express](https://expressjs.com/en/guide/routing.html#route-handlers) |
| **`root`** | When `true`, defines the endpoint on the root Express app, bypassing Payload handlers and the `routes.api` subpath. Note: this only applies to top-level endpoints of your Payload config, endpoints defined on `collections` or `globals` cannot be root. |
| **`custom`** | Extension point for adding custom data (e.g. for plugins) |
Example:
```ts
import { CollectionConfig } from 'payload/types';
import { CollectionConfig } from "payload/types";
// a collection of 'orders' with an additional route for tracking details, reachable at /api/orders/:id/tracking
const Orders: CollectionConfig = {
slug: 'orders',
fields: [ /* ... */ ],
export const Orders: CollectionConfig = {
slug: "orders",
fields: [
/* ... */
],
// highlight-start
endpoints: [
{
path: '/:id/tracking',
method: 'get',
path: "/:id/tracking",
method: "get",
handler: async (req, res, next) => {
const tracking = await getTrackingInfo(req.params.id);
if (tracking) {
res.status(200).send({ tracking });
} else {
res.status(404).send({ error: 'not found' });
res.status(404).send({ error: "not found" });
}
}
}
},
},
],
// highlight-end
}
};
```
<Banner>
<strong>Note:</strong><br/>
**req** will have the **payload** object and can be used inside your endpoint handlers for making calls like req.payload.find() that will make use of access control and hooks.
<strong>Note:</strong>
<br />
**req** will have the **payload** object and can be used inside your endpoint
handlers for making calls like req.payload.find() that will make use of access
control and hooks.
</Banner>

View File

@@ -0,0 +1,25 @@
---
title: Troubleshooting
label: Troubleshooting
order: 10
desc: Troubleshooting Common Issues in Payload
keywords: admin, components, custom, customize, documentation, Content Management System, cms, headless, javascript, node, react, express, troubleshooting
---
## Common Issues
### "Unauthorized, you must be logged in to make this request" when attempting to log in
This means that your auth cookie is not being set or accepted correctly upon logging in. To resolve heck the following settings in your Payload config:
- CORS - If you are using the '*', try to explicitly only allow certain domains instead including the one you have specified.
- CSRF - Do you have this set? if so, make sure your domain is whitelisted within the csrf domains. If not, probably not the issue, but probably can't hurt to whitelist it anyway.
- Cookie settings. If these are completely undefined, then that's fine. but if you have cookie domain set, or anything similar, make sure you don't have the domain misconfigured
This error likely means that the auth cookie that Payload sets after logging in successfully is being rejected because of misconfiguration.
To further investigate the issue:
- Go to the login screen. Open your inspector. Go to the Network tab.
- Log in and then find the login request that should appear in your network panel. Click the login request.
- The login request should have a Set-Cookie header on the response, and the cookie should be getting set successfully. If it is not, most browsers generally have a little yellow ⚠️ symbol that you can hover over to see why the cookie was rejected.

View File

@@ -8,7 +8,9 @@ keywords: headless cms, typescript, documentation, Content Management System, cm
While building your own custom functionality into Payload, like plugins, hooks, access control functions, custom routes, GraphQL queries / mutations, or anything else, you may benefit from generating your own TypeScript types dynamically from your Payload config itself.
Run the following command in a Payload project to generate types:
### Types generatation script
Run the following command in a Payload project to generate types based on your Payload config:
```
payload generate:types
@@ -16,6 +18,46 @@ payload generate:types
You can run this command whenever you need to regenerate your types, and then you can use these types in your Payload code directly.
### Configuration
In order for Payload to properly infer these types when using local operations, you'll need to alias the following in your tsconfig.json file:
```json
// tsconfig.json
{
"compilerOptions": {
// ...
"paths": {
"payload/generated-types": [
"./src/payload-types.ts" // Ensure this matches the path to your typescript outputFile
]
}
}
// ...
}
```
#### Custom output file path
You can specify where you want your types to be generated by adding a property to your Payload config:
```ts
// payload.config.ts
{
// ...
typescript: {
// defaults to: path.resolve(__dirname, './payload-types.ts')
outputFile: path.resolve(__dirname, './generated-types.ts'),
},
}
```
The above example places your types next to your Payload config itself as the file `generated-types.ts`.
### Example Usage
For example, let's look at the following simple Payload config:
```ts
@@ -74,44 +116,65 @@ export interface Post {
title?: string;
author?: string | User;
}
```
In order for Payload to properly infer these types when using local operations, you'll need to alias the following in your tsconfig.json file:
### Custom Field Interfaces
```json
{
"compilerOptions": {
// ...
"paths": {
"payload/generated-types": [
"./src/payload-types.ts", // Ensure this matches the path to your typescript outputFile
],
}
},
// ...
}
```
#### Customizing the output path of your generated types
You can specify where you want your types to be generated by adding a property to your Payload config:
For `array`, `block`, `group` and named `tab` fields, you can generate top level reusable interfaces. The following group field config:
```ts
{
// the remainder of your config
typescript: {
outputFile: path.resolve(__dirname, './payload-types.ts'),
},
type: 'group',
name: 'meta',
interfaceName: 'SharedMeta', <-- here!!
fields: [
{
name: 'title',
type: 'text',
},
{
name: 'description',
type: 'text',
},
],
}
```
The above example places your types next to your Payload config itself as the file `generated-types.ts`. By default, the file will be output to your current working directory as `payload-types.ts`.
will generate:
```ts
// a top level reusable interface!!
export interface SharedMeta {
title?: string;
description?: string;
}
// example usage inside collection interface
export interface Collection1 {
// ...other fields
meta?: SharedMeta;
}
```
<Banner type="warning">
<strong>Naming Collisions</strong>
<br />
Since these types are hoisted to the top level, you need to be aware that
naming collisions can occur. For example, if you have a collection with the
name of `Meta` and you also create a interface with the name `Meta` they will
collide. It is recommended to scope your interfaces by appending the field
type to the end, i.e. `MetaGroup` or similar.
</Banner>
### Using your types
Now that your types have been generated, payloads local API will now be typed. It is common for users to want to use this in their frontend code, we recommend generating them with payload and then copying the file over to your frontend codebase. This is the simplest way to get your types into your frontend codebase.
#### Adding an NPM script
<Banner type="warning">
<strong>Important:</strong><br/>
<strong>Important</strong>
<br />
Payload needs to be able to find your config to generate your types.
</Banner>

View File

@@ -42,7 +42,7 @@ Every Payload Collection can opt-in to supporting Uploads by specifying the `upl
| Option | Description |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| **`staticURL`** \* | The base URL path to use to access your uploads. Example: `/media` |
| **`staticURL`** \* | The URL path to use to access your uploads. Relative path like `/media` will be served by payload. Full path like `https://example.com/media` needs to be served by another web server. |
| **`staticDir`** \* | The folder directory to use to store media in. Can be either an absolute path or relative to the directory that contains your config. |
| **`imageSizes`** | If specified, image uploads will be automatically resized in accordance to these image sizes. [More](#image-sizes) |
| **`formatOptions`** | An object with `format` and `options` that are used with the Sharp image library to format the upload file. [More](https://sharp.pixelplumbing.com/api-output#toformat) |
@@ -60,7 +60,7 @@ _An asterisk denotes that a property above is required._
```ts
import { CollectionConfig } from 'payload/types';
const Media: CollectionConfig = {
export const Media: CollectionConfig = {
slug: 'media',
upload: {
staticURL: '/media',
@@ -81,17 +81,23 @@ const Media: CollectionConfig = {
{
name: 'tablet',
width: 1024,
// By specifying `null` or leaving a height undefined,
// By specifying `undefined` or leaving a height undefined,
// the image will be sized to a certain width,
// but it will retain its original aspect ratio
// and calculate a height automatically.
height: null,
height: undefined,
position: 'centre',
},
],
adminThumbnail: 'thumbnail',
mimeTypes: ['image/*'],
},
fields: [
{
name: 'alt',
type: 'text',
},
],
};
```
@@ -165,7 +171,7 @@ You can specify how Payload retrieves admin thumbnails for your upload-enabled C
```ts
import { CollectionConfig } from 'payload/types';
const Media: CollectionConfig = {
export const Media: CollectionConfig = {
slug: 'media',
upload: {
staticURL: '/media',
@@ -184,9 +190,7 @@ const Media: CollectionConfig = {
<Banner>
<strong>Note:</strong>
<br />
If you specify a function to return an admin thumbnail, but your upload is not
an image file type (for example, PDF or TXT) your function will not be used.
Instead, Payload will display its generic file upload graphic.
This function runs in the browser. If your function returns `null` or `false` Payload will show the default generic file thumbnail instead.
</Banner>
### MimeTypes
@@ -200,7 +204,7 @@ Some example values are: `image/*`, `audio/*`, `video/*`, `image/png`, `applicat
```ts
import { CollectionConfig } from 'payload/types';
const Media: CollectionConfig = {
export const Media: CollectionConfig = {
slug: 'media',
upload: {
staticURL: '/media',

View File

@@ -28,7 +28,7 @@ Collections and Globals both support the same options for configuring autosave.
```ts
import { CollectionConfig } from 'payload/types';
const Pages: CollectionConfig = {
export const Pages: CollectionConfig = {
slug: 'pages',
access: {
read: ({ req }) => {

View File

@@ -84,7 +84,7 @@ Here is an example that utilizes the `_status` field to require a user to be log
```ts
import { CollectionConfig } from 'payload/types';
const Pages: CollectionConfig = {
export const Pages: CollectionConfig = {
slug: 'pages',
access: {
read: ({ req }) => {
@@ -119,7 +119,7 @@ Here is an example for how to write an access control function that grants acces
```ts
import { CollectionConfig } from 'payload/types';
const Pages: CollectionConfig = {
export const Pages: CollectionConfig = {
slug: 'pages',
access: {
read: ({ req }) => {

View File

@@ -1,6 +1,39 @@
const { APIError, Forbidden } = require('./dist/errors');
const {
APIError,
AuthenticationError,
DuplicateCollection,
DuplicateGlobal,
ErrorDeletingFile,
FileUploadError,
Forbidden,
InvalidConfiguration,
InvalidFieldName,
InvalidFieldRelationship,
LockedAuth,
MissingCollectionLabel,
MissingFieldInputOptions,
MissingFieldType,
MissingFile,
NotFound,
ValidationError,
} = require('./dist/errors');
module.exports = {
APIError,
AuthenticationError,
DuplicateCollection,
DuplicateGlobal,
ErrorDeletingFile,
FileUploadError,
Forbidden,
InvalidConfiguration,
InvalidFieldName,
InvalidFieldRelationship,
LockedAuth,
MissingCollectionLabel,
MissingFieldInputOptions,
MissingFieldType,
MissingFile,
NotFound,
ValidationError,
};

View File

@@ -0,0 +1,17 @@
module.exports = {
plugins: [
'node',
],
env: {
node: true,
},
extends: [
'./rules/best-practices',
'./rules/errors',
'./rules/es6',
'./rules/imports',
'./rules/style',
'./rules/variables',
].map(require.resolve),
rules: {},
};

View File

@@ -0,0 +1,356 @@
module.exports = {
rules: {
// enforces getter/setter pairs in objects
'accessor-pairs': 'off',
// enforces return statements in callbacks of array's methods
// https://eslint.org/docs/rules/array-callback-return
'array-callback-return': ['error', { allowImplicit: true }],
// treat var statements as if they were block scoped
'block-scoped-var': 'error',
// specify the maximum cyclomatic complexity allowed in a program
complexity: ['off', 11],
// enforce that class methods use "this"
// https://eslint.org/docs/rules/class-methods-use-this
'class-methods-use-this': ['error', {
exceptMethods: [],
}],
// require return statements to either always or never specify values
'consistent-return': 'error',
// specify curly brace conventions for all control statements
curly: ['error', 'multi-line'], // multiline
// require default case in switch statements
'default-case': ['error', { commentPattern: '^no default$' }],
// https://eslint.org/docs/rules/default-param-last
// TODO: enable, semver-minor, when eslint v6.4 is required (which is a major)
'default-param-last': 'off',
// encourages use of dot notation whenever possible
'dot-notation': ['error', { allowKeywords: true }],
// enforces consistent newlines before or after dots
// https://eslint.org/docs/rules/dot-location
'dot-location': ['error', 'property'],
// require the use of === and !==
// https://eslint.org/docs/rules/eqeqeq
eqeqeq: ['error', 'always', { null: 'ignore' }],
// Require grouped accessor pairs in object literals and classes
// https://eslint.org/docs/rules/grouped-accessor-pairs
// TODO: enable in next major, altho the guide forbids getters/setters anyways
'grouped-accessor-pairs': 'off',
// make sure for-in loops have an if statement
'guard-for-in': 'error',
// enforce a maximum number of classes per file
// https://eslint.org/docs/rules/max-classes-per-file
'max-classes-per-file': ['error', 1],
// disallow the use of alert, confirm, and prompt
'no-alert': 'warn',
// disallow use of arguments.caller or arguments.callee
'no-caller': 'error',
// disallow lexical declarations in case/default clauses
// https://eslint.org/docs/rules/no-case-declarations.html
'no-case-declarations': 'error',
// Disallow returning value in constructor
// https://eslint.org/docs/rules/no-constructor-return
// TODO: enable, semver-major
'no-constructor-return': 'off',
// disallow division operators explicitly at beginning of regular expression
// https://eslint.org/docs/rules/no-div-regex
'no-div-regex': 'off',
// disallow else after a return in an if
// https://eslint.org/docs/rules/no-else-return
'no-else-return': ['error', { allowElseIf: false }],
// disallow empty functions, except for standalone funcs/arrows
// https://eslint.org/docs/rules/no-empty-function
'no-empty-function': ['error', {
allow: [
'arrowFunctions',
'functions',
'methods',
],
}],
// disallow empty destructuring patterns
// https://eslint.org/docs/rules/no-empty-pattern
'no-empty-pattern': 'error',
// disallow comparisons to null without a type-checking operator
'no-eq-null': 'off',
// disallow use of eval()
'no-eval': 'error',
// disallow adding to native types
'no-extend-native': 'error',
// disallow unnecessary function binding
'no-extra-bind': 'error',
// disallow Unnecessary Labels
// https://eslint.org/docs/rules/no-extra-label
'no-extra-label': 'error',
// disallow fallthrough of case statements
'no-fallthrough': 'error',
// disallow the use of leading or trailing decimal points in numeric literals
'no-floating-decimal': 'error',
// disallow reassignments of native objects or read-only globals
// https://eslint.org/docs/rules/no-global-assign
'no-global-assign': ['error', { exceptions: [] }],
// deprecated in favor of no-global-assign
'no-native-reassign': 'off',
// disallow implicit type conversions
// https://eslint.org/docs/rules/no-implicit-coercion
'no-implicit-coercion': ['off', {
boolean: false,
number: true,
string: true,
allow: [],
}],
// disallow var and named functions in global scope
// https://eslint.org/docs/rules/no-implicit-globals
'no-implicit-globals': 'off',
// disallow use of eval()-like methods
'no-implied-eval': 'error',
// disallow this keywords outside of classes or class-like objects
'no-invalid-this': 'off',
// disallow usage of __iterator__ property
'no-iterator': 'error',
// disallow use of labels for anything other then loops and switches
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
// disallow unnecessary nested blocks
'no-lone-blocks': 'error',
// disallow creation of functions within loops
'no-loop-func': 'error',
// disallow magic numbers
// https://eslint.org/docs/rules/no-magic-numbers
'no-magic-numbers': ['off', {
ignore: [],
ignoreArrayIndexes: true,
enforceConst: true,
detectObjects: false,
}],
// disallow use of multiple spaces
'no-multi-spaces': ['error', {
ignoreEOLComments: false,
}],
// disallow use of multiline strings
'no-multi-str': 'error',
// disallow use of new operator when not part of the assignment or comparison
'no-new': 'error',
// disallow use of new operator for Function object
'no-new-func': 'error',
// disallows creating new instances of String, Number, and Boolean
'no-new-wrappers': 'error',
// disallow use of (old style) octal literals
'no-octal': 'error',
// disallow use of octal escape sequences in string literals, such as
// var foo = 'Copyright \251';
'no-octal-escape': 'error',
// disallow reassignment of function parameters
// disallow parameter object manipulation except for specific exclusions
// rule: https://eslint.org/docs/rules/no-param-reassign.html
'no-param-reassign': ['error', {
props: true,
ignorePropertyModificationsFor: [
'acc', // for reduce accumulators
'accumulator', // for reduce accumulators
'e', // for e.returnvalue
'ctx', // for Koa routing
'req', // for Express requests
'request', // for Express requests
'res', // for Express responses
'response', // for Express responses
'$scope', // for Angular 1 scopes
'staticContext', // for ReactRouter context
],
}],
// disallow usage of __proto__ property
'no-proto': 'error',
// disallow declaring the same variable more then once
'no-redeclare': 'error',
// disallow certain object properties
// https://eslint.org/docs/rules/no-restricted-properties
'no-restricted-properties': ['error',
{
object: 'arguments',
property: 'callee',
message: 'arguments.callee is deprecated',
}, {
object: 'global',
property: 'isFinite',
message: 'Please use Number.isFinite instead',
}, {
object: 'self',
property: 'isFinite',
message: 'Please use Number.isFinite instead',
}, {
object: 'window',
property: 'isFinite',
message: 'Please use Number.isFinite instead',
}, {
object: 'global',
property: 'isNaN',
message: 'Please use Number.isNaN instead',
}, {
object: 'self',
property: 'isNaN',
message: 'Please use Number.isNaN instead',
}, {
object: 'window',
property: 'isNaN',
message: 'Please use Number.isNaN instead',
}, {
property: '__defineGetter__',
message: 'Please use Object.defineProperty instead.',
}, {
property: '__defineSetter__',
message: 'Please use Object.defineProperty instead.',
}, {
object: 'Math',
property: 'pow',
message: 'Use the exponentiation operator (**) instead.',
}],
// disallow use of assignment in return statement
'no-return-assign': ['error', 'always'],
// disallow redundant `return await`
'no-return-await': 'error',
// disallow use of `javascript:` urls.
'no-script-url': 'error',
// disallow self assignment
// https://eslint.org/docs/rules/no-self-assign
'no-self-assign': ['error', {
props: true,
}],
// disallow comparisons where both sides are exactly the same
'no-self-compare': 'error',
// disallow use of comma operator
'no-sequences': 'error',
// restrict what can be thrown as an exception
'no-throw-literal': 'error',
// disallow unmodified conditions of loops
// https://eslint.org/docs/rules/no-unmodified-loop-condition
'no-unmodified-loop-condition': 'off',
// disallow usage of expressions in statement position
'no-unused-expressions': ['error', {
allowShortCircuit: false,
allowTernary: false,
allowTaggedTemplates: false,
}],
// disallow unused labels
// https://eslint.org/docs/rules/no-unused-labels
'no-unused-labels': 'error',
// disallow unnecessary .call() and .apply()
'no-useless-call': 'off',
// Disallow unnecessary catch clauses
// https://eslint.org/docs/rules/no-useless-catch
'no-useless-catch': 'error',
// disallow useless string concatenation
// https://eslint.org/docs/rules/no-useless-concat
'no-useless-concat': 'error',
// disallow unnecessary string escaping
// https://eslint.org/docs/rules/no-useless-escape
'no-useless-escape': 'error',
// disallow redundant return; keywords
// https://eslint.org/docs/rules/no-useless-return
'no-useless-return': 'error',
// disallow use of void operator
// https://eslint.org/docs/rules/no-void
'no-void': 'error',
// disallow usage of configurable warning terms in comments: e.g. todo
'no-warning-comments': ['off', { terms: ['todo', 'fixme', 'xxx'], location: 'start' }],
// disallow use of the with statement
'no-with': 'error',
// require using Error objects as Promise rejection reasons
// https://eslint.org/docs/rules/prefer-promise-reject-errors
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
// Suggest using named capture group in regular expression
// https://eslint.org/docs/rules/prefer-named-capture-group
'prefer-named-capture-group': 'off',
// https://eslint.org/docs/rules/prefer-regex-literals
// TODO; enable, semver-minor, once eslint v6.4 is required (which is a major)
'prefer-regex-literals': 'off',
// require use of the second argument for parseInt()
radix: 'error',
// require `await` in `async function` (note: this is a horrible rule that should never be used)
// https://eslint.org/docs/rules/require-await
'require-await': 'off',
// Enforce the use of u flag on RegExp
// https://eslint.org/docs/rules/require-unicode-regexp
'require-unicode-regexp': 'off',
// requires to declare all vars on top of their containing scope
'vars-on-top': 'error',
// require immediate function invocation to be wrapped in parentheses
// https://eslint.org/docs/rules/wrap-iife.html
'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }],
// require or disallow Yoda conditions
yoda: 'error',
},
};

View File

@@ -0,0 +1,154 @@
module.exports = {
rules: {
// Enforce “for” loop update clause moving the counter in the right direction
// https://eslint.org/docs/rules/for-direction
'for-direction': 'error',
// Enforces that a return statement is present in property getters
// https://eslint.org/docs/rules/getter-return
'getter-return': ['error', { allowImplicit: true }],
// disallow using an async function as a Promise executor
// https://eslint.org/docs/rules/no-async-promise-executor
'no-async-promise-executor': 'error',
// Disallow await inside of loops
// https://eslint.org/docs/rules/no-await-in-loop
'no-await-in-loop': 'error',
// Disallow comparisons to negative zero
// https://eslint.org/docs/rules/no-compare-neg-zero
'no-compare-neg-zero': 'error',
// disallow assignment in conditional expressions
'no-cond-assign': ['error', 'always'],
// disallow use of console
'no-console': ['warn', { allow: ['warn', 'error'] }],
// disallow use of constant expressions in conditions
'no-constant-condition': 'warn',
// disallow control characters in regular expressions
'no-control-regex': 'error',
// disallow use of debugger
'no-debugger': 'error',
// disallow duplicate arguments in functions
'no-dupe-args': 'error',
// Disallow duplicate conditions in if-else-if chains
// https://eslint.org/docs/rules/no-dupe-else-if
// TODO: enable, semver-major
'no-dupe-else-if': 'off',
// disallow duplicate keys when creating object literals
'no-dupe-keys': 'error',
// disallow a duplicate case label.
'no-duplicate-case': 'error',
// disallow empty statements
'no-empty': 'error',
// disallow the use of empty character classes in regular expressions
'no-empty-character-class': 'error',
// disallow assigning to the exception in a catch block
'no-ex-assign': 'error',
// disallow double-negation boolean casts in a boolean context
// https://eslint.org/docs/rules/no-extra-boolean-cast
'no-extra-boolean-cast': 'error',
// disallow unnecessary parentheses
// https://eslint.org/docs/rules/no-extra-parens
'no-extra-parens': ['off', 'all', {
conditionalAssign: true,
nestedBinaryExpressions: false,
returnAssign: false,
ignoreJSX: 'all', // delegate to eslint-plugin-react
enforceForArrowConditionals: false,
}],
// disallow unnecessary semicolons
'no-extra-semi': 'error',
// disallow overwriting functions written as function declarations
'no-func-assign': 'error',
// https://eslint.org/docs/rules/no-import-assign
// TODO: enable, semver-minor, once eslint v6.4 is required (which is a major)
'no-import-assign': 'off',
// disallow function or variable declarations in nested blocks
'no-inner-declarations': 'error',
// disallow invalid regular expression strings in the RegExp constructor
'no-invalid-regexp': 'error',
// disallow irregular whitespace outside of strings and comments
'no-irregular-whitespace': 'error',
// Disallow characters which are made with multiple code points in character class syntax
// https://eslint.org/docs/rules/no-misleading-character-class
'no-misleading-character-class': 'error',
// disallow the use of object properties of the global object (Math and JSON) as functions
'no-obj-calls': 'error',
// disallow use of Object.prototypes builtins directly
// https://eslint.org/docs/rules/no-prototype-builtins
'no-prototype-builtins': 'error',
// disallow multiple spaces in a regular expression literal
'no-regex-spaces': 'error',
// Disallow returning values from setters
// https://eslint.org/docs/rules/no-setter-return
// TODO: enable, semver-major (altho the guide forbids getters/setters already)
'no-setter-return': 'off',
// disallow sparse arrays
'no-sparse-arrays': 'error',
// Disallow template literal placeholder syntax in regular strings
// https://eslint.org/docs/rules/no-template-curly-in-string
'no-template-curly-in-string': 'error',
// Avoid code that looks like two expressions but is actually one
// https://eslint.org/docs/rules/no-unexpected-multiline
'no-unexpected-multiline': 'error',
// disallow unreachable statements after a return, throw, continue, or break statement
'no-unreachable': 'error',
// disallow return/throw/break/continue inside finally blocks
// https://eslint.org/docs/rules/no-unsafe-finally
'no-unsafe-finally': 'error',
// disallow negating the left operand of relational operators
// https://eslint.org/docs/rules/no-unsafe-negation
'no-unsafe-negation': 'error',
// disallow negation of the left operand of an in expression
// deprecated in favor of no-unsafe-negation
'no-negated-in-lhs': 'off',
// Disallow assignments that can lead to race conditions due to usage of await or yield
// https://eslint.org/docs/rules/require-atomic-updates
// TODO: enable, semver-major
'require-atomic-updates': 'off',
// disallow comparisons with the value NaN
'use-isnan': 'error',
// ensure JSDoc comments are valid
// https://eslint.org/docs/rules/valid-jsdoc
'valid-jsdoc': 'off',
// ensure that the results of typeof are compared against a valid string
// https://eslint.org/docs/rules/valid-typeof
'valid-typeof': ['error', { requireStringLiterals: true }],
},
};

View File

@@ -0,0 +1,176 @@
module.exports = {
env: {
es6: true,
},
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
generators: false,
objectLiteralDuplicateProperties: false,
},
},
rules: {
// enforces no braces where they can be omitted
// https://eslint.org/docs/rules/arrow-body-style
'arrow-body-style': ['error', 'as-needed', {
requireReturnForObjectLiteral: false,
}],
// require parens in arrow function arguments
// https://eslint.org/docs/rules/arrow-parens
'arrow-parens': ['error', 'always'],
// require space before/after arrow function's arrow
// https://eslint.org/docs/rules/arrow-spacing
'arrow-spacing': ['error', { before: true, after: true }],
// verify super() callings in constructors
'constructor-super': 'error',
// enforce the spacing around the * in generator functions
// https://eslint.org/docs/rules/generator-star-spacing
'generator-star-spacing': ['error', { before: false, after: true }],
// disallow modifying variables of class declarations
// https://eslint.org/docs/rules/no-class-assign
'no-class-assign': 'error',
// disallow arrow functions where they could be confused with comparisons
// https://eslint.org/docs/rules/no-confusing-arrow
'no-confusing-arrow': ['error', {
allowParens: true,
}],
// disallow modifying variables that are declared using const
'no-const-assign': 'error',
// disallow duplicate class members
// https://eslint.org/docs/rules/no-dupe-class-members
'no-dupe-class-members': 'error',
// disallow importing from the same path more than once
// https://eslint.org/docs/rules/no-duplicate-imports
// replaced by https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
'no-duplicate-imports': 'off',
// disallow symbol constructor
// https://eslint.org/docs/rules/no-new-symbol
'no-new-symbol': 'error',
// disallow specific imports
// https://eslint.org/docs/rules/no-restricted-imports
'no-restricted-imports': ['off', {
paths: [],
patterns: [],
}],
// disallow to use this/super before super() calling in constructors.
// https://eslint.org/docs/rules/no-this-before-super
'no-this-before-super': 'error',
// disallow useless computed property keys
// https://eslint.org/docs/rules/no-useless-computed-key
'no-useless-computed-key': 'error',
// disallow unnecessary constructor
// https://eslint.org/docs/rules/no-useless-constructor
'no-useless-constructor': 'error',
// disallow renaming import, export, and destructured assignments to the same name
// https://eslint.org/docs/rules/no-useless-rename
'no-useless-rename': ['error', {
ignoreDestructuring: false,
ignoreImport: false,
ignoreExport: false,
}],
// require let or const instead of var
'no-var': 'error',
// require method and property shorthand syntax for object literals
// https://eslint.org/docs/rules/object-shorthand
'object-shorthand': ['error', 'always', {
ignoreConstructors: false,
avoidQuotes: true,
}],
// suggest using arrow functions as callbacks
'prefer-arrow-callback': ['error', {
allowNamedFunctions: false,
allowUnboundThis: true,
}],
// suggest using of const declaration for variables that are never modified after declared
'prefer-const': ['error', {
destructuring: 'any',
ignoreReadBeforeAssign: true,
}],
// Prefer destructuring from arrays and objects
// https://eslint.org/docs/rules/prefer-destructuring
'prefer-destructuring': ['error',
{
VariableDeclarator: {
array: false,
object: true,
},
AssignmentExpression: {
array: true,
object: false,
},
}, {
enforceForRenamedProperties: false,
},
],
// disallow parseInt() in favor of binary, octal, and hexadecimal literals
// https://eslint.org/docs/rules/prefer-numeric-literals
'prefer-numeric-literals': 'error',
// suggest using Reflect methods where applicable
// https://eslint.org/docs/rules/prefer-reflect
'prefer-reflect': 'off',
// use rest parameters instead of arguments
// https://eslint.org/docs/rules/prefer-rest-params
'prefer-rest-params': 'error',
// suggest using the spread operator instead of .apply()
// https://eslint.org/docs/rules/prefer-spread
'prefer-spread': 'error',
// suggest using template literals instead of string concatenation
// https://eslint.org/docs/rules/prefer-template
'prefer-template': 'error',
// disallow generator functions that do not have yield
// https://eslint.org/docs/rules/require-yield
'require-yield': 'error',
// enforce spacing between object rest-spread
// https://eslint.org/docs/rules/rest-spread-spacing
'rest-spread-spacing': ['error', 'never'],
// import sorting
// https://eslint.org/docs/rules/sort-imports
'sort-imports': ['off', {
ignoreCase: false,
ignoreDeclarationSort: false,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
}],
// require a Symbol description
// https://eslint.org/docs/rules/symbol-description
'symbol-description': 'error',
// enforce usage of spacing in template strings
// https://eslint.org/docs/rules/template-curly-spacing
'template-curly-spacing': 'error',
// enforce spacing around the * in yield* expressions
// https://eslint.org/docs/rules/yield-star-spacing
'yield-star-spacing': ['error', 'after'],
},
};

View File

@@ -0,0 +1,234 @@
module.exports = {
env: {
es6: true,
},
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
},
plugins: [
'import',
],
settings: {
'import/resolver': {
node: {
extensions: ['.mjs', '.js', '.json'],
},
},
'import/extensions': [
'.js',
'.mjs',
'.jsx',
],
'import/core-modules': [],
'import/ignore': [
'node_modules',
'\\.(coffee|scss|css|less|hbs|svg|json)$',
],
},
rules: {
// Static analysis:
// ensure imports point to files/modules that can be resolved
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }],
// ensure named imports coupled with named exports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
'import/named': 'error',
// ensure default import coupled with default export
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
'import/default': 'off',
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md
'import/namespace': 'off',
// Helpful warnings:
// disallow invalid exports, e.g. multiple defaults
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md
'import/export': 'error',
// do not allow a default import name to match a named export
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
'import/no-named-as-default': 'error',
// warn on accessing default export property names that are also named exports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
'import/no-named-as-default-member': 'error',
// disallow use of jsdoc-marked-deprecated imports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
'import/no-deprecated': 'off',
// Forbid the use of extraneous packages
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
// paths are treated both as absolute paths, and relative to process.cwd()
'import/no-extraneous-dependencies': ['error'],
// Forbid mutable exports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
'import/no-mutable-exports': 'error',
// Module systems:
// disallow require()
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
'import/no-commonjs': 'off',
// disallow AMD require/define
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md
'import/no-amd': 'error',
// No Node.js builtin modules
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
// TODO: enable?
'import/no-nodejs-modules': 'off',
// Style guide:
// disallow non-import statements appearing before import statements
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md
'import/first': 'error',
// disallow non-import statements appearing before import statements
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md
// deprecated: use `import/first`
'import/imports-first': 'off',
// disallow duplicate imports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
'import/no-duplicates': 'error',
// disallow namespace imports
// TODO: enable?
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
'import/no-namespace': 'off',
// Ensure consistent use of file extension within the import path
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
'import/extensions': ['error', 'ignorePackages', {
js: 'never',
mjs: 'never',
jsx: 'never',
}],
// ensure absolute imports are above relative imports and that unassigned imports are ignored
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
// TODO: enforce a stricter convention in module import order?
'import/order': ['error', { groups: [['builtin', 'external', 'internal']] }],
// Require a newline after the last import/require in a group
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
'import/newline-after-import': 'error',
// Require modules with a single export to use a default export
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
'import/prefer-default-export': 'error',
// Restrict which files can be imported in a given folder
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md
'import/no-restricted-paths': 'off',
// Forbid modules to have too many dependencies
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md
'import/max-dependencies': ['off', { max: 10 }],
// Forbid import of modules using absolute paths
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
'import/no-absolute-path': 'error',
// Forbid require() calls with expressions
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
'import/no-dynamic-require': 'error',
// prevent importing the submodules of other modules
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md
'import/no-internal-modules': ['off', {
allow: [],
}],
// Warn if a module could be mistakenly parsed as a script by a consumer
// leveraging Unambiguous JavaScript Grammar
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md
// this should not be enabled until this proposal has at least been *presented* to TC39.
// At the moment, it's not a thing.
'import/unambiguous': 'off',
// Forbid Webpack loader syntax in imports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
'import/no-webpack-loader-syntax': 'error',
// Prevent unassigned imports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md
// importing for side effects is perfectly acceptable, if you need side effects.
'import/no-unassigned-import': 'off',
// Prevent importing the default as if it were named
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md
'import/no-named-default': 'error',
// Reports if a module's default export is unnamed
// https://github.com/benmosher/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md
'import/no-anonymous-default-export': ['off', {
allowArray: false,
allowArrowFunction: false,
allowAnonymousClass: false,
allowAnonymousFunction: false,
allowLiteral: false,
allowObject: false,
}],
// This rule enforces that all exports are declared at the bottom of the file.
// https://github.com/benmosher/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md
// TODO: enable?
'import/exports-last': 'off',
// Reports when named exports are not grouped together in a single export declaration
// or when multiple assignments to CommonJS module.exports or exports object are present
// in a single file.
// https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md
'import/group-exports': 'off',
// forbid default exports. this is a terrible rule, do not use it.
// https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md
'import/no-default-export': 'off',
// Prohibit named exports. this is a terrible rule, do not use it.
// https://github.com/benmosher/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md
'import/no-named-export': 'off',
// Forbid a module from importing itself
// https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md
'import/no-self-import': 'error',
// Forbid cyclical dependencies between modules
// https://github.com/benmosher/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md
'import/no-cycle': ['error', { maxDepth: Infinity }],
// Ensures that there are no useless path segments
// https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md
'import/no-useless-path-segments': ['error', { commonjs: true }],
// dynamic imports require a leading comment with a webpackChunkName
// https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md
'import/dynamic-import-chunkname': ['off', {
importFunctions: [],
webpackChunknameFormat: '[0-9a-zA-Z-_/.]+',
}],
// Use this rule to prevent imports to folders in relative parent paths.
// https://github.com/benmosher/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md
'import/no-relative-parent-imports': 'off',
// Reports modules without any exports, or with unused exports
// https://github.com/benmosher/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md
// TODO: enable, semver-major
'import/no-unused-modules': ['off', {
ignoreExports: [],
missingExports: true,
unusedExports: true,
}],
},
};

View File

@@ -0,0 +1,525 @@
module.exports = {
rules: {
// enforce line breaks after opening and before closing array brackets
// https://eslint.org/docs/rules/array-bracket-newline
// TODO: enable? semver-major
'array-bracket-newline': ['off', 'consistent'], // object option alternative: { multiline: true, minItems: 3 }
// enforce line breaks between array elements
// https://eslint.org/docs/rules/array-element-newline
// TODO: enable? semver-major
'array-element-newline': ['off', { multiline: true, minItems: 3 }],
// enforce spacing inside array brackets
'array-bracket-spacing': ['error', 'never'],
// enforce spacing inside single-line blocks
// https://eslint.org/docs/rules/block-spacing
'block-spacing': ['error', 'always'],
// enforce one true brace style
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
// require camel case names
camelcase: ['error', { properties: 'never', ignoreDestructuring: false }],
// enforce or disallow capitalization of the first letter of a comment
// https://eslint.org/docs/rules/capitalized-comments
'capitalized-comments': ['off', 'never', {
line: {
ignorePattern: '.*',
ignoreInlineComments: true,
ignoreConsecutiveComments: true,
},
block: {
ignorePattern: '.*',
ignoreInlineComments: true,
ignoreConsecutiveComments: true,
},
}],
// require trailing commas in multiline object literals
'comma-dangle': ['error', {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'always-multiline',
}],
// enforce spacing before and after comma
'comma-spacing': ['error', { before: false, after: true }],
// enforce one true comma style
'comma-style': ['error', 'last', {
exceptions: {
ArrayExpression: false,
ArrayPattern: false,
ArrowFunctionExpression: false,
CallExpression: false,
FunctionDeclaration: false,
FunctionExpression: false,
ImportDeclaration: false,
ObjectExpression: false,
ObjectPattern: false,
VariableDeclaration: false,
NewExpression: false,
},
}],
// disallow padding inside computed properties
'computed-property-spacing': ['error', 'never'],
// enforces consistent naming when capturing the current execution context
'consistent-this': 'off',
// enforce newline at the end of file, with no multiple empty lines
'eol-last': ['error', 'always'],
// https://eslint.org/docs/rules/function-call-argument-newline
// TODO: enable, semver-minor, once eslint v6.2 is required (which is a major)
'function-call-argument-newline': ['off', 'consistent'],
// enforce spacing between functions and their invocations
// https://eslint.org/docs/rules/func-call-spacing
'func-call-spacing': ['error', 'never'],
// requires function names to match the name of the variable or property to which they are
// assigned
// https://eslint.org/docs/rules/func-name-matching
'func-name-matching': ['off', 'always', {
includeCommonJSModuleExports: false,
considerPropertyDescriptor: true,
}],
// require function expressions to have a name
// https://eslint.org/docs/rules/func-names
'func-names': 'warn',
// enforces use of function declarations or expressions
// https://eslint.org/docs/rules/func-style
// TODO: enable
'func-style': ['off', 'expression'],
// enforce consistent line breaks inside function parentheses
// https://eslint.org/docs/rules/function-paren-newline
'function-paren-newline': ['error', 'consistent'],
// Blacklist certain identifiers to prevent them being used
// https://eslint.org/docs/rules/id-blacklist
'id-blacklist': 'off',
// this option enforces minimum and maximum identifier lengths
// (variable names, property names etc.)
'id-length': 'off',
// require identifiers to match the provided regular expression
'id-match': 'off',
// Enforce the location of arrow function bodies with implicit returns
// https://eslint.org/docs/rules/implicit-arrow-linebreak
'implicit-arrow-linebreak': ['error', 'beside'],
// this option sets a specific tab width for your code
// https://eslint.org/docs/rules/indent
indent: ['error', 2, {
SwitchCase: 1,
VariableDeclarator: 1,
outerIIFEBody: 1,
// MemberExpression: null,
FunctionDeclaration: {
parameters: 1,
body: 1,
},
FunctionExpression: {
parameters: 1,
body: 1,
},
CallExpression: {
arguments: 1,
},
ArrayExpression: 1,
ObjectExpression: 1,
ImportDeclaration: 1,
flatTernaryExpressions: false,
// list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js
ignoredNodes: ['JSXElement', 'JSXElement > *', 'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName', 'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer', 'JSXOpeningElement', 'JSXClosingElement', 'JSXText', 'JSXEmptyExpression', 'JSXSpreadChild'],
ignoreComments: false,
}],
// specify whether double or single quotes should be used in JSX attributes
// https://eslint.org/docs/rules/jsx-quotes
'jsx-quotes': ['off', 'prefer-double'],
// enforces spacing between keys and values in object literal properties
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
// require a space before & after certain keywords
'keyword-spacing': ['error', {
before: true,
after: true,
overrides: {
return: { after: true },
throw: { after: true },
case: { after: true },
},
}],
// enforce position of line comments
// https://eslint.org/docs/rules/line-comment-position
// TODO: enable?
'line-comment-position': ['off', {
position: 'above',
ignorePattern: '',
applyDefaultPatterns: true,
}],
// disallow mixed 'LF' and 'CRLF' as linebreaks
// https://eslint.org/docs/rules/linebreak-style
'linebreak-style': ['error', 'unix'],
// require or disallow an empty line between class members
// https://eslint.org/docs/rules/lines-between-class-members
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: false }],
// enforces empty lines around comments
'lines-around-comment': 'off',
// require or disallow newlines around directives
// https://eslint.org/docs/rules/lines-around-directive
'lines-around-directive': ['error', {
before: 'always',
after: 'always',
}],
// specify the maximum depth that blocks can be nested
'max-depth': ['off', 4],
// specify the maximum length of a line in your program
// https://eslint.org/docs/rules/max-len
'max-len': ['off'],
// specify the max number of lines in a file
// https://eslint.org/docs/rules/max-lines
'max-lines': ['off', {
max: 300,
skipBlankLines: true,
skipComments: true,
}],
// enforce a maximum function length
// https://eslint.org/docs/rules/max-lines-per-function
'max-lines-per-function': ['off', {
max: 50,
skipBlankLines: true,
skipComments: true,
IIFEs: true,
}],
// specify the maximum depth callbacks can be nested
'max-nested-callbacks': 'off',
// limits the number of parameters that can be used in the function declaration.
'max-params': ['off', 3],
// specify the maximum number of statement allowed in a function
'max-statements': ['off', 10],
// restrict the number of statements per line
// https://eslint.org/docs/rules/max-statements-per-line
'max-statements-per-line': ['off', { max: 1 }],
// enforce a particular style for multiline comments
// https://eslint.org/docs/rules/multiline-comment-style
'multiline-comment-style': ['off', 'starred-block'],
// require multiline ternary
// https://eslint.org/docs/rules/multiline-ternary
// TODO: enable?
'multiline-ternary': ['off', 'never'],
// require a capital letter for constructors
'new-cap': ['error', {
newIsCap: true,
newIsCapExceptions: [],
capIsNew: false,
capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'],
}],
// disallow the omission of parentheses when invoking a constructor with no arguments
// https://eslint.org/docs/rules/new-parens
'new-parens': 'error',
// allow/disallow an empty newline after var statement
'newline-after-var': 'off',
// https://eslint.org/docs/rules/newline-before-return
'newline-before-return': 'off',
// enforces new line after each method call in the chain to make it
// more readable and easy to maintain
// https://eslint.org/docs/rules/newline-per-chained-call
'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }],
// disallow use of the Array constructor
'no-array-constructor': 'error',
// disallow use of bitwise operators
// https://eslint.org/docs/rules/no-bitwise
'no-bitwise': 'error',
// disallow use of the continue statement
// https://eslint.org/docs/rules/no-continue
'no-continue': 'error',
// disallow comments inline after code
'no-inline-comments': 'off',
// disallow if as the only statement in an else block
// https://eslint.org/docs/rules/no-lonely-if
'no-lonely-if': 'error',
// disallow un-paren'd mixes of different operators
// https://eslint.org/docs/rules/no-mixed-operators
'no-mixed-operators': ['error', {
// the list of arthmetic groups disallows mixing `%` and `**`
// with other arithmetic operators.
groups: [
['%', '**'],
['%', '+'],
['%', '-'],
['%', '*'],
['%', '/'],
['/', '*'],
['&', '|', '<<', '>>', '>>>'],
['==', '!=', '===', '!=='],
['&&', '||'],
],
allowSamePrecedence: false,
}],
// disallow mixed spaces and tabs for indentation
'no-mixed-spaces-and-tabs': 'error',
// disallow use of chained assignment expressions
// https://eslint.org/docs/rules/no-multi-assign
'no-multi-assign': ['error'],
// disallow multiple empty lines, only one newline at the end, and no new lines at the beginning
// https://eslint.org/docs/rules/no-multiple-empty-lines
'no-multiple-empty-lines': ['error', { max: 2, maxBOF: 1, maxEOF: 0 }],
// disallow negated conditions
// https://eslint.org/docs/rules/no-negated-condition
'no-negated-condition': 'off',
// disallow nested ternary expressions
'no-nested-ternary': 'error',
// disallow use of the Object constructor
'no-new-object': 'error',
// disallow use of unary operators, ++ and --
// https://eslint.org/docs/rules/no-plusplus
'no-plusplus': 'error',
// disallow certain syntax forms
// https://eslint.org/docs/rules/no-restricted-syntax
'no-restricted-syntax': [
'error',
{
selector: 'ForInStatement',
message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
},
{
selector: 'ForOfStatement',
message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
},
{
selector: 'LabeledStatement',
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
},
{
selector: 'WithStatement',
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
},
],
// disallow space between function identifier and application
'no-spaced-func': 'error',
// disallow tab characters entirely
'no-tabs': 'error',
// disallow the use of ternary operators
'no-ternary': 'off',
// disallow trailing whitespace at the end of lines
'no-trailing-spaces': ['error', {
skipBlankLines: false,
ignoreComments: false,
}],
// disallow dangling underscores in identifiers
// https://eslint.org/docs/rules/no-underscore-dangle
'no-underscore-dangle': ['error', {
allow: [],
allowAfterThis: false,
allowAfterSuper: false,
enforceInMethodNames: true,
}],
// disallow the use of Boolean literals in conditional expressions
// also, prefer `a || b` over `a ? a : b`
// https://eslint.org/docs/rules/no-unneeded-ternary
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
// disallow whitespace before properties
// https://eslint.org/docs/rules/no-whitespace-before-property
'no-whitespace-before-property': 'error',
// enforce the location of single-line statements
// https://eslint.org/docs/rules/nonblock-statement-body-position
'nonblock-statement-body-position': ['error', 'beside', { overrides: {} }],
// require padding inside curly braces
'object-curly-spacing': ['error', 'always'],
// enforce line breaks between braces
// https://eslint.org/docs/rules/object-curly-newline
'object-curly-newline': ['error', {
ObjectExpression: { multiline: true, consistent: true },
ObjectPattern: { multiline: true, consistent: true },
ImportDeclaration: { multiline: true, consistent: true },
ExportDeclaration: { multiline: true, consistent: true },
}],
// enforce "same line" or "multiple line" on object properties.
// https://eslint.org/docs/rules/object-property-newline
'object-property-newline': ['error', {
allowAllPropertiesOnSameLine: true,
}],
// allow just one var statement per function
'one-var': ['error', 'never'],
// require a newline around variable declaration
// https://eslint.org/docs/rules/one-var-declaration-per-line
'one-var-declaration-per-line': ['error', 'always'],
// require assignment operator shorthand where possible or prohibit it entirely
// https://eslint.org/docs/rules/operator-assignment
'operator-assignment': ['error', 'always'],
// Requires operator at the beginning of the line in multiline statements
// https://eslint.org/docs/rules/operator-linebreak
'operator-linebreak': ['error', 'before', { overrides: { '=': 'none' } }],
// disallow padding within blocks
'padded-blocks': ['error',
{
blocks: 'never',
classes: 'never',
switches: 'never',
},
{
allowSingleLineBlocks: true,
},
],
// Require or disallow padding lines between statements
// https://eslint.org/docs/rules/padding-line-between-statements
'padding-line-between-statements': 'off',
// Disallow the use of Math.pow in favor of the ** operator
// https://eslint.org/docs/rules/prefer-exponentiation-operator
// TODO: enable, semver-major when eslint 5 is dropped
'prefer-exponentiation-operator': 'off',
// Prefer use of an object spread over Object.assign
// https://eslint.org/docs/rules/prefer-object-spread
'prefer-object-spread': 'error',
// require quotes around object literal property names
// https://eslint.org/docs/rules/quote-props.html
'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
// specify whether double or single quotes should be used
quotes: ['error', 'single', { avoidEscape: true }],
// do not require jsdoc
// https://eslint.org/docs/rules/require-jsdoc
'require-jsdoc': 'off',
// require or disallow use of semicolons instead of ASI
semi: ['error', 'always'],
// enforce spacing before and after semicolons
'semi-spacing': ['error', { before: false, after: true }],
// Enforce location of semicolons
// https://eslint.org/docs/rules/semi-style
'semi-style': ['error', 'last'],
// requires object keys to be sorted
'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }],
// sort variables within the same declaration block
'sort-vars': 'off',
// require or disallow space before blocks
'space-before-blocks': 'error',
// require or disallow space before function opening parenthesis
// https://eslint.org/docs/rules/space-before-function-paren
'space-before-function-paren': ['error', {
anonymous: 'always',
named: 'never',
asyncArrow: 'always',
}],
// require or disallow spaces inside parentheses
'space-in-parens': ['error', 'never'],
// require spaces around operators
'space-infix-ops': 'error',
// Require or disallow spaces before/after unary operators
// https://eslint.org/docs/rules/space-unary-ops
'space-unary-ops': ['error', {
words: true,
nonwords: false,
overrides: {
},
}],
// require or disallow a space immediately following the // or /* in a comment
// https://eslint.org/docs/rules/spaced-comment
'spaced-comment': ['error', 'always', {
line: {
exceptions: ['-', '+'],
markers: ['=', '!'], // space here to support sprockets directives
},
block: {
exceptions: ['-', '+'],
markers: ['=', '!', ':', '::'], // space here to support sprockets directives and flow comment types
balanced: true,
},
}],
// Enforce spacing around colons of switch statements
// https://eslint.org/docs/rules/switch-colon-spacing
'switch-colon-spacing': ['error', { after: true, before: false }],
// Require or disallow spacing between template tags and their literals
// https://eslint.org/docs/rules/template-tag-spacing
'template-tag-spacing': ['error', 'never'],
// require or disallow the Unicode Byte Order Mark
// https://eslint.org/docs/rules/unicode-bom
'unicode-bom': ['error', 'never'],
// require regex literals to be wrapped in parentheses
'wrap-regex': 'off',
},
};

View File

@@ -0,0 +1,44 @@
const confusingBrowserGlobals = require('confusing-browser-globals');
module.exports = {
rules: {
// enforce or disallow variable initializations at definition
'init-declarations': 'off',
// disallow the catch clause parameter name being the same as a variable in the outer scope
'no-catch-shadow': 'off',
// disallow deletion of variables
'no-delete-var': 'error',
// disallow labels that share a name with a variable
// https://eslint.org/docs/rules/no-label-var
'no-label-var': 'error',
// disallow specific globals
'no-restricted-globals': ['error', 'isFinite', 'isNaN'].concat(confusingBrowserGlobals),
// disallow declaration of variables already declared in the outer scope
'no-shadow': 'error',
// disallow shadowing of names such as arguments
'no-shadow-restricted-names': 'error',
// disallow use of undeclared variables unless mentioned in a /*global */ block
'no-undef': 'error',
// disallow use of undefined when initializing variables
'no-undef-init': 'error',
// disallow use of undefined variable
// https://eslint.org/docs/rules/no-undefined
// TODO: enable?
'no-undefined': 'off',
// disallow declaration of variables that are not used in the code
'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
// disallow use of variables before they are defined
'no-use-before-define': ['error', { functions: true, classes: true, variables: true }],
},
};

View File

@@ -0,0 +1,14 @@
module.exports = {
env: {
jest: true,
},
plugins: [
'jest',
'jest-dom',
],
extends: [
'./rules/jest',
'./rules/jest-dom',
].map(require.resolve),
rules: {},
};

View File

@@ -0,0 +1,9 @@
module.exports = {
rules: {
'jest-dom/prefer-checked': 'error',
'jest-dom/prefer-enabled-disabled': 'error',
'jest-dom/prefer-focus': 'error',
'jest-dom/prefer-required': 'error',
'jest-dom/prefer-to-have-attribute': 'error',
},
};

View File

@@ -0,0 +1,37 @@
module.exports = {
rules: {
'jest/consistent-test-it': ['error', { fn: 'it' }],
'jest/expect-expect': 'error',
'jest/prefer-lowercase-title': ['error', { ignore: ['describe'] }],
'jest/no-alias-methods': 'error',
'jest/no-commented-out-tests': 'off',
'jest/no-disabled-tests': 'off',
'jest/no-duplicate-hooks': 'error',
'jest/no-export': 'error',
'jest/no-focused-tests': 'error',
'jest/no-hooks': 'off',
'jest/no-identical-title': 'error',
'jest/no-if': 'error',
'jest/no-jasmine-globals': 'error',
'jest/no-large-snapshots': 'error',
'jest/no-mocks-import': 'error',
'jest/no-standalone-expect': 'error',
'jest/no-done-callback': 'error',
'jest/no-test-prefixes': 'error',
'jest/no-test-return-statement': 'error',
'jest/prefer-called-with': 'error',
'jest/prefer-expect-assertions': 'off',
'jest/prefer-hooks-on-top': 'error',
'jest/prefer-spy-on': 'error',
'jest/prefer-strict-equal': 'error',
'jest/prefer-to-contain': 'error',
'jest/prefer-to-have-length': 'error',
'jest/prefer-todo': 'error',
'jest/require-top-level-describe': 'error',
'jest/require-to-throw-message': 'error',
'jest/valid-describe-callback': 'error',
'jest/valid-expect-in-promise': 'error',
'jest/valid-expect': 'error',
'jest/valid-title': 'error',
},
};

View File

@@ -0,0 +1,26 @@
module.exports = {
env: {
browser: true,
},
plugins: [
'jsx-a11y',
'react-hooks',
'react',
],
settings: {
react: {
version: 'detect',
},
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
extends: [
'./rules/react-a11y',
'./rules/react-hooks',
'./rules/react',
].map(require.resolve),
rules: {},
};

View File

@@ -0,0 +1,229 @@
module.exports = {
rules: {
// Enforce that anchors have content
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md
'jsx-a11y/anchor-has-content': ['error', { components: [] }],
// Require ARIA roles to be valid and non-abstract
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md
'jsx-a11y/aria-role': ['error', { ignoreNonDom: false }],
// Enforce all aria-* props are valid.
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md
'jsx-a11y/aria-props': 'error',
// Enforce ARIA state and property values are valid.
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md
'jsx-a11y/aria-proptypes': 'error',
// Enforce that elements that do not support ARIA roles, states, and
// properties do not have those attributes.
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md
'jsx-a11y/aria-unsupported-elements': 'error',
// Enforce that all elements that require alternative text have meaningful information
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md
'jsx-a11y/alt-text': ['error', {
elements: ['img', 'object', 'area', 'input[type="image"]'],
img: [],
object: [],
area: [],
'input[type="image"]': [],
}],
// Prevent img alt text from containing redundant words like "image", "picture", or "photo"
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md
'jsx-a11y/img-redundant-alt': 'error',
// require that JSX labels use "htmlFor"
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md
// deprecated: replaced by `label-has-associated-control` rule
'jsx-a11y/label-has-for': ['off', {
components: [],
required: {
every: ['nesting', 'id'],
},
allowChildren: false,
}],
// Enforce that a label tag has a text label and an associated control.
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/b800f40a2a69ad48015ae9226fbe879f946757ed/docs/rules/label-has-associated-control.md
'jsx-a11y/label-has-associated-control': ['error', {
labelComponents: [],
labelAttributes: [],
controlComponents: [],
assert: 'both',
depth: 25,
}],
// Enforce that a control (an interactive element) has a text label.
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/control-has-associated-label.md
'jsx-a11y/control-has-associated-label': ['error', {
labelAttributes: ['label'],
controlComponents: [],
ignoreElements: [
'audio',
'canvas',
'embed',
'input',
'textarea',
'tr',
'video',
],
ignoreRoles: [
'grid',
'listbox',
'menu',
'menubar',
'radiogroup',
'row',
'tablist',
'toolbar',
'tree',
'treegrid',
],
depth: 5,
}],
// require that mouseover/out come with focus/blur, for keyboard-only users
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md
'jsx-a11y/mouse-events-have-key-events': 'error',
// Prevent use of `accessKey`
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md
'jsx-a11y/no-access-key': 'error',
// require onBlur instead of onChange
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md
'jsx-a11y/no-onchange': 'off',
// Elements with an interactive role and interaction handlers must be focusable
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md
'jsx-a11y/interactive-supports-focus': 'error',
// Enforce that elements with ARIA roles must have all required attributes
// for that role.
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md
'jsx-a11y/role-has-required-aria-props': 'error',
// Enforce that elements with explicit or implicit roles defined contain
// only aria-* properties supported by that role.
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md
'jsx-a11y/role-supports-aria-props': 'error',
// Enforce tabIndex value is not greater than zero.
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md
'jsx-a11y/tabindex-no-positive': 'error',
// ensure <hX> tags have content and are not aria-hidden
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md
'jsx-a11y/heading-has-content': ['error', { components: [''] }],
// require HTML elements to have a "lang" prop
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md
'jsx-a11y/html-has-lang': 'error',
// require HTML element's lang prop to be valid
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md
'jsx-a11y/lang': 'error',
// prevent distracting elements, like <marquee> and <blink>
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md
'jsx-a11y/no-distracting-elements': ['error', {
elements: ['marquee', 'blink'],
}],
// only allow <th> to have the "scope" attr
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md
'jsx-a11y/scope': 'error',
// require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md
'jsx-a11y/click-events-have-key-events': 'error',
// Enforce that DOM elements without semantic behavior not have interaction handlers
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md
'jsx-a11y/no-static-element-interactions': ['error', {
handlers: [
'onClick',
'onMouseDown',
'onMouseUp',
'onKeyPress',
'onKeyDown',
'onKeyUp',
],
}],
// A non-interactive element does not support event handlers (mouse and key handlers)
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-interactions.md
'jsx-a11y/no-noninteractive-element-interactions': ['error', {
handlers: [
'onClick',
'onMouseDown',
'onMouseUp',
'onKeyPress',
'onKeyDown',
'onKeyUp',
],
}],
// ensure emoji are accessible
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md
'jsx-a11y/accessible-emoji': 'error',
// elements with aria-activedescendant must be tabbable
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
// ensure iframe elements have a unique title
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md
'jsx-a11y/iframe-has-title': 'error',
// prohibit autoFocus prop
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md
'jsx-a11y/no-autofocus': ['error', { ignoreNonDOM: true }],
// ensure HTML elements do not specify redundant ARIA roles
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md
'jsx-a11y/no-redundant-roles': 'error',
// media elements must have captions
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/media-has-caption.md
'jsx-a11y/media-has-caption': ['error', {
audio: [],
video: [],
track: [],
}],
// WAI-ARIA roles should not be used to convert an interactive element to non-interactive
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-interactive-element-to-noninteractive-role.md
'jsx-a11y/no-interactive-element-to-noninteractive-role': ['error', {
tr: ['none', 'presentation'],
}],
// WAI-ARIA roles should not be used to convert a non-interactive element to interactive
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-to-interactive-role.md
'jsx-a11y/no-noninteractive-element-to-interactive-role': ['error', {
ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
table: ['grid'],
td: ['gridcell'],
}],
// Tab key navigation should be limited to elements on the page that can be interacted with.
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-tabindex.md
'jsx-a11y/no-noninteractive-tabindex': ['error', {
tags: [],
roles: ['tabpanel'],
}],
// ensure <a> tags are valid
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/0745af376cdc8686d85a361ce36952b1fb1ccf6e/docs/rules/anchor-is-valid.md
'jsx-a11y/anchor-is-valid': ['error', {
components: ['Link'],
specialLink: ['to'],
aspects: ['noHref', 'invalidHref', 'preferButton'],
}],
},
};

View File

@@ -0,0 +1,11 @@
module.exports = {
rules: {
// Enforce Rules of Hooks
// https://github.com/facebook/react/blob/c11015ff4f610ac2924d1fc6d569a17657a404fd/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js
'react-hooks/rules-of-hooks': 'error',
// Verify the list of the dependencies for Hooks like useEffect and similar
// https://github.com/facebook/react/blob/1204c789776cb01fbaf3e9f032e7e2ba85a44137/packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
'react-hooks/exhaustive-deps': 'error',
},
};

View File

@@ -0,0 +1,499 @@
module.exports = {
rules: {
// View link below for react rules documentation
// https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
// Specify whether double or single quotes should be used in JSX attributes
// https://eslint.org/docs/rules/jsx-quotes
'jsx-quotes': ['error', 'prefer-double'],
'class-methods-use-this': ['error', {
exceptMethods: [
'render',
'getInitialState',
'getDefaultProps',
'getChildContext',
'componentWillMount',
'UNSAFE_componentWillMount',
'componentDidMount',
'componentWillReceiveProps',
'UNSAFE_componentWillReceiveProps',
'shouldComponentUpdate',
'componentWillUpdate',
'UNSAFE_componentWillUpdate',
'componentDidUpdate',
'componentWillUnmount',
'componentDidCatch',
'getSnapshotBeforeUpdate',
],
}],
// Prevent missing displayName in a React component definition
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
'react/display-name': ['off', { ignoreTranspilerName: false }],
// Forbid certain propTypes (any, array, object)
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-prop-types.md
'react/forbid-prop-types': ['error', {
forbid: ['any', 'array', 'object'],
checkContextTypes: true,
checkChildContextTypes: true,
}],
// Forbid certain props on DOM Nodes
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-dom-props.md
'react/forbid-dom-props': ['off', { forbid: [] }],
// Enforce boolean attributes notation in JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
'react/jsx-boolean-value': ['error', 'never', { always: [] }],
// Validate closing bracket location in JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
// Validate closing tag location in JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
'react/jsx-closing-tag-location': 'error',
// Enforce or disallow spaces inside of curly braces in JSX attributes
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }],
// Enforce event handler naming conventions in JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
'react/jsx-handler-names': ['off', {
eventHandlerPrefix: 'handle',
eventHandlerPropPrefix: 'on',
}],
// Validate props indentation in JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
'react/jsx-indent-props': ['error', 2],
// Validate JSX has key prop when in array or iterator
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
'react/jsx-key': 'off',
// Limit maximum of props on a single line in JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
'react/jsx-max-props-per-line': ['error', { maximum: 1 }],
// Prevent usage of .bind() in JSX props
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
'react/jsx-no-bind': ['error', {
ignoreRefs: true,
allowArrowFunctions: true,
allowFunctions: false,
allowBind: false,
ignoreDOMComponents: true,
}],
// Prevent duplicate props in JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
// Prevent usage of unwrapped JSX strings
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
'react/jsx-no-literals': ['off', { noStrings: true }],
// Disallow undeclared variables in JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
'react/jsx-no-undef': 'error',
// Enforce PascalCase for user-defined JSX components
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
'react/jsx-pascal-case': ['error', {
allowAllCaps: true,
ignore: [],
}],
// Enforce propTypes declarations alphabetical sorting
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
'react/sort-prop-types': ['off', {
ignoreCase: true,
callbacksLast: false,
requiredFirst: false,
sortShapeProp: true,
}],
// Deprecated in favor of react/jsx-sort-props
'react/jsx-sort-prop-types': 'off',
// Enforce props alphabetical sorting
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
'react/jsx-sort-props': ['off', {
ignoreCase: true,
callbacksLast: false,
shorthandFirst: false,
shorthandLast: false,
noSortAlphabetically: false,
reservedFirst: true,
}],
// Enforce defaultProps declarations alphabetical sorting
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-sort-default-props.md
'react/jsx-sort-default-props': ['off', {
ignoreCase: true,
}],
// Prevent React to be incorrectly marked as unused
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
'react/jsx-uses-react': ['error'],
// Prevent variables used in JSX to be incorrectly marked as unused
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
'react/jsx-uses-vars': 'error',
// Prevent usage of dangerous JSX properties
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md
'react/no-danger': 'off',
// Prevent usage of deprecated methods
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
'react/no-deprecated': ['error'],
// Prevent usage of setState in componentDidMount
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
// this is necessary for server-rendering
'react/no-did-mount-set-state': 'off',
// Prevent usage of setState in componentDidUpdate
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
'react/no-did-update-set-state': 'off',
// Prevent usage of setState in componentWillUpdate
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
'react/no-will-update-set-state': 'error',
// Prevent direct mutation of this.state
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
'react/no-direct-mutation-state': 'off',
// Prevent usage of isMounted
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
'react/no-is-mounted': 'error',
// Prevent multiple component definition per file
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
'react/no-multi-comp': 'off',
// Prevent usage of setState
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
'react/no-set-state': 'off',
// Prevent using string references
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
'react/no-string-refs': 'error',
// Prevent usage of unknown DOM property
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
'react/no-unknown-property': 'error',
// Require ES6 class declarations over React.createClass
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
'react/prefer-es6-class': ['error', 'always'],
// Require stateless functions when not using lifecycle methods, setState or ref
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
'react/prefer-stateless-function': ['error', { ignorePureComponents: true }],
// Prevent missing props validation in a React component definition
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
'react/prop-types': ['error', {
ignore: [],
customValidators: [],
skipUndeclared: false,
}],
// Prevent missing React when using JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
'react/react-in-jsx-scope': 'error',
// Require render() methods to return something
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
'react/require-render-return': 'error',
// Prevent extra closing tags for components without children
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
'react/self-closing-comp': 'error',
// Enforce component methods order
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md
'react/sort-comp': ['error', {
order: [
'static-variables',
'static-methods',
'instance-variables',
'lifecycle',
'/^on.+$/',
'getters',
'setters',
'/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
'instance-methods',
'everything-else',
'rendering',
],
groups: {
lifecycle: [
'displayName',
'propTypes',
'contextTypes',
'childContextTypes',
'mixins',
'statics',
'defaultProps',
'constructor',
'getDefaultProps',
'getInitialState',
'state',
'getChildContext',
'getDerivedStateFromProps',
'componentWillMount',
'UNSAFE_componentWillMount',
'componentDidMount',
'componentWillReceiveProps',
'UNSAFE_componentWillReceiveProps',
'shouldComponentUpdate',
'componentWillUpdate',
'UNSAFE_componentWillUpdate',
'getSnapshotBeforeUpdate',
'componentDidUpdate',
'componentDidCatch',
'componentWillUnmount',
],
rendering: [
'/^render.+$/',
'render',
],
},
}],
// Prevent missing parentheses around multilines JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-wrap-multilines.md
'react/jsx-wrap-multilines': ['error', {
declaration: 'parens-new-line',
assignment: 'parens-new-line',
return: 'parens-new-line',
arrow: 'parens-new-line',
condition: 'parens-new-line',
logical: 'parens-new-line',
prop: 'parens-new-line',
}],
// Require that the first prop in a JSX element be on a new line when the element is multiline
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
// Enforce spacing around jsx equals signs
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
'react/jsx-equals-spacing': ['error', 'never'],
// Enforce JSX indentation
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
'react/jsx-indent': ['error', 2],
// Disallow target="_blank" on links
// https://github.com/yannickcr/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-no-target-blank.md
'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
// only .jsx files may have JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
// prevent accidental JS comments from being injected into JSX as text
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
'react/jsx-no-comment-textnodes': 'error',
// disallow using React.render/ReactDOM.render's return value
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
'react/no-render-return-value': 'error',
// require a shouldComponentUpdate method, or PureRenderMixin
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
'react/require-optimization': ['off', { allowDecorators: [] }],
// warn against using findDOMNode()
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
'react/no-find-dom-node': 'error',
// Forbid certain props on Components
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
'react/forbid-component-props': ['off', { forbid: [] }],
// Forbid certain elements
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
'react/forbid-elements': ['off', { forbid: [] }],
// Prevent problem with children and props.dangerouslySetInnerHTML
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
'react/no-danger-with-children': 'error',
// Prevent unused propType definitions
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
'react/no-unused-prop-types': ['error', {
customValidators: [
],
skipShapeProps: true,
}],
// Require style prop value be an object or var
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
'react/style-prop-object': 'error',
// Prevent invalid characters from appearing in markup
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
'react/no-unescaped-entities': 'error',
// Prevent passing of children as props
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
'react/no-children-prop': 'error',
// Validate whitespace in and around the JSX opening and closing brackets
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md
'react/jsx-tag-spacing': ['error', {
closingSlash: 'never',
beforeSelfClosing: 'always',
afterOpening: 'never',
beforeClosing: 'never',
}],
// Enforce spaces before the closing bracket of self-closing JSX elements
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md
// Deprecated in favor of jsx-tag-spacing
'react/jsx-space-before-closing': ['off', 'always'],
// Prevent usage of Array index in keys
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
'react/no-array-index-key': 'off',
// Enforce a defaultProps definition for every prop that is not a required prop
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/require-default-props.md
'react/require-default-props': ['error', {
forbidDefaultForRequired: true,
}],
// Forbids using non-exported propTypes
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
// this is intentionally set to "warn". it would be "error",
// but it's only critical if you're stripping propTypes in production.
'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
// Prevent void DOM elements from receiving children
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
'react/void-dom-elements-no-children': 'error',
// Enforce all defaultProps have a corresponding non-required PropType
// https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/default-props-match-prop-types.md
'react/default-props-match-prop-types': ['error', { allowRequiredDefaults: false }],
// Prevent usage of shouldComponentUpdate when extending React.PureComponent
// https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/no-redundant-should-component-update.md
'react/no-redundant-should-component-update': 'error',
// Prevent unused state values
// https://github.com/yannickcr/eslint-plugin-react/pull/1103/
'react/no-unused-state': 'error',
// Enforces consistent naming for boolean props
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/boolean-prop-naming.md
'react/boolean-prop-naming': ['off', {
propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'],
rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+',
message: '',
}],
// Prevents common casing typos
// https://github.com/yannickcr/eslint-plugin-react/blob/73abadb697034b5ccb514d79fb4689836fe61f91/docs/rules/no-typos.md
'react/no-typos': 'error',
// Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
// One JSX Element Per Line
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-one-expression-per-line.md
'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
// Enforce consistent usage of destructuring assignment of props, state, and context
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md
'react/destructuring-assignment': ['error', 'always'],
// Prevent using this.state within a this.setState
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-access-state-in-setstate.md
'react/no-access-state-in-setstate': 'error',
// Prevent usage of button elements without an explicit type attribute
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/button-has-type.md
'react/button-has-type': ['error', {
button: true,
submit: true,
reset: false,
}],
// Ensures inline tags are not rendered without spaces between them
'react/jsx-child-element-spacing': 'off',
// Prevent this from being used in stateless functional components
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-this-in-sfc.md
'react/no-this-in-sfc': 'error',
// Validate JSX maximum depth
// https://github.com/yannickcr/eslint-plugin-react/blob/abe8381c0d6748047224c430ce47f02e40160ed0/docs/rules/jsx-max-depth.md
'react/jsx-max-depth': 'off',
// Disallow multiple spaces between inline JSX props
// https://github.com/yannickcr/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-props-no-multi-spaces.md
'react/jsx-props-no-multi-spaces': 'error',
// Prevent usage of UNSAFE_ methods
// https://github.com/yannickcr/eslint-plugin-react/blob/157cc932be2cfaa56b3f5b45df6f6d4322a2f660/docs/rules/no-unsafe.md
'react/no-unsafe': 'off',
// Enforce shorthand or standard form for React fragments
// https://github.com/yannickcr/eslint-plugin-react/blob/bc976b837abeab1dffd90ac6168b746a83fc83cc/docs/rules/jsx-fragments.md
'react/jsx-fragments': ['error', 'element'],
// Enforce linebreaks in curly braces in JSX attributes and expressions.
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
'react/jsx-curly-newline': ['error', {
multiline: 'consistent',
singleline: 'consistent',
}],
// Enforce state initialization style
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
// TODO: set to "never" once babel-preset-airbnb supports public class fields
'react/state-in-constructor': ['error', 'always'],
// Enforces where React component static properties should be positioned
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
// TODO: set to "static public field" once babel-preset-airbnb supports public class fields
'react/static-property-placement': ['error', 'property assignment'],
// Disallow JSX props spreading
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
'react/jsx-props-no-spreading': 'off',
// Enforce that props are read-only
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md
'react/prefer-read-only-props': 'off',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.json'],
},
},
react: {
pragma: 'React',
version: 'detect',
},
propWrapperFunctions: [
'forbidExtraProps', // https://www.npmjs.com/package/airbnb-prop-types
'exact', // https://www.npmjs.com/package/prop-types-exact
'Object.freeze', // https://tc39.github.io/ecma262/#sec-object.freeze
],
},
};

8
eslint-config/index.js Normal file
View File

@@ -0,0 +1,8 @@
module.exports = {
extends: [
'./configs/base',
'./configs/jest',
'./configs/react',
].map(require.resolve),
rules: {},
};

View File

@@ -0,0 +1 @@
NEXT_PUBLIC_CMS_URL=http://localhost:3000

View File

@@ -0,0 +1,7 @@
module.exports = {
root: true,
extends: ['plugin:@next/next/recommended', '@payloadcms'],
rules: {
'import/extensions': 'off',
},
}

6
examples/auth/next-app/.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
.next
dist
build
node_modules
.env
package-lock.json

View File

@@ -0,0 +1,8 @@
module.exports = {
printWidth: 100,
parser: "typescript",
semi: false,
singleQuote: true,
trailingComma: "all",
arrowParens: "avoid",
};

Some files were not shown because too many files have changed in this diff Show More