payload 1.6.9 → 1.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/components/elements/DatePicker/DatePicker.js +8 -13
- package/dist/admin/components/elements/DatePicker/DatePicker.js.map +1 -1
- package/dist/admin/components/forms/field-types/Relationship/createRelationMap.d.ts +2 -1
- package/dist/admin/components/forms/field-types/Relationship/createRelationMap.js +6 -5
- package/dist/admin/components/forms/field-types/Relationship/createRelationMap.js.map +1 -1
- package/dist/admin/components/forms/field-types/Relationship/index.js +7 -3
- package/dist/admin/components/forms/field-types/Relationship/index.js.map +1 -1
- package/dist/admin/components/forms/field-types/Relationship/types.d.ts +4 -7
- package/dist/admin/components/forms/field-types/RichText/plugins/withHTML.js +1 -1
- package/dist/admin/components/forms/field-types/RichText/plugins/withHTML.js.map +1 -1
- package/dist/admin/components/utilities/Config/index.js +17 -1
- package/dist/admin/components/utilities/Config/index.js.map +1 -1
- package/dist/admin/components/views/Account/Default.js +3 -3
- package/dist/admin/components/views/Account/Default.js.map +1 -1
- package/dist/admin/components/views/Global/Default.js +2 -2
- package/dist/admin/components/views/Global/Default.js.map +1 -1
- package/dist/admin/components/views/Version/Compare/index.js +2 -2
- package/dist/admin/components/views/Version/Compare/index.js.map +1 -1
- package/dist/admin/components/views/Version/Version.js +4 -4
- package/dist/admin/components/views/Version/Version.js.map +1 -1
- package/dist/admin/components/views/Versions/columns.d.ts +1 -1
- package/dist/admin/components/views/Versions/columns.js +4 -2
- package/dist/admin/components/views/Versions/columns.js.map +1 -1
- package/dist/admin/components/views/collections/Edit/Auth/index.js +9 -8
- package/dist/admin/components/views/collections/Edit/Auth/index.js.map +1 -1
- package/dist/admin/components/views/collections/Edit/Default.js +3 -3
- package/dist/admin/components/views/collections/Edit/Default.js.map +1 -1
- package/dist/admin/components/views/collections/List/Cell/field-types/Date/index.js +4 -2
- package/dist/admin/components/views/collections/List/Cell/field-types/Date/index.js.map +1 -1
- package/dist/admin/hooks/useTitle.js +4 -2
- package/dist/admin/hooks/useTitle.js.map +1 -1
- package/dist/admin/utilities/formatDate/getSupportedDateLocale.d.ts +1 -0
- package/dist/admin/utilities/formatDate/getSupportedDateLocale.js +14 -0
- package/dist/admin/utilities/formatDate/getSupportedDateLocale.js.map +1 -0
- package/dist/admin/utilities/formatDate/index.d.ts +1 -0
- package/dist/admin/utilities/formatDate/index.js +36 -0
- package/dist/admin/utilities/formatDate/index.js.map +1 -0
- package/dist/bin/build.js +1 -1
- package/dist/bin/build.js.map +1 -1
- package/dist/bin/generateGraphQLSchema.js +1 -1
- package/dist/bin/generateGraphQLSchema.js.map +1 -1
- package/dist/bin/generateTypes.d.ts +1 -1
- package/dist/bin/generateTypes.js +2 -2
- package/dist/bin/generateTypes.js.map +1 -1
- package/dist/collections/operations/update.js +27 -27
- package/dist/collections/operations/update.js.map +1 -1
- package/dist/collections/requestHandlers/update.d.ts +1 -0
- package/dist/collections/requestHandlers/update.js.map +1 -1
- package/dist/config/build.d.ts +1 -1
- package/dist/config/build.js +6 -3
- package/dist/config/build.js.map +1 -1
- package/dist/config/load.d.ts +1 -1
- package/dist/config/load.js +6 -6
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/config/types.d.ts +2 -2
- package/dist/config/validate.d.ts +1 -1
- package/dist/config/validate.js +3 -3
- package/dist/config/validate.js.map +1 -1
- package/dist/fields/config/schema.js +1 -0
- package/dist/fields/config/schema.js.map +1 -1
- package/dist/fields/config/types.d.ts +2 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/globals/operations/update.js +20 -20
- package/dist/globals/operations/update.js.map +1 -1
- package/dist/payload.js +3 -3
- package/dist/payload.js.map +1 -1
- package/dist/translations/es.json +30 -17
- package/dist/translations/hr.json +1 -1
- package/dist/translations/index.d.ts +15 -2
- package/dist/versions/saveVersion.js +1 -1
- package/dist/versions/saveVersion.js.map +1 -1
- package/docs/fields/date.mdx +2 -2
- package/docs/fields/radio.mdx +3 -3
- package/docs/fields/relationship.mdx +70 -57
- package/docs/production/deployment.mdx +6 -0
- package/errors.js +34 -1
- package/package.json +1 -1
package/docs/fields/radio.mdx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Radio Field
|
|
2
|
+
title: Radio Group Field
|
|
3
3
|
label: Radio Group
|
|
4
4
|
order: 120
|
|
5
5
|
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,7 +7,7 @@ keywords: radio, fields, config, configuration, documentation, Content Managemen
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
<Banner >
|
|
10
|
-
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.
|
|
10
|
+
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.
|
|
11
11
|
</Banner>
|
|
12
12
|
|
|
13
13
|
### Config
|
|
@@ -37,7 +37,7 @@ keywords: radio, fields, config, configuration, documentation, Content Managemen
|
|
|
37
37
|
|
|
38
38
|
### Admin config
|
|
39
39
|
|
|
40
|
-
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:
|
|
40
|
+
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:
|
|
41
41
|
|
|
42
42
|
**`layout`**
|
|
43
43
|
|
|
@@ -6,8 +6,9 @@ desc: The Relationship field provides the ability to relate documents together.
|
|
|
6
6
|
keywords: relationship, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
<Banner
|
|
10
|
-
The Relationship field is one of the most powerful fields Payload features. It
|
|
9
|
+
<Banner>
|
|
10
|
+
The Relationship field is one of the most powerful fields Payload features. It
|
|
11
|
+
provides for the ability to easily relate documents together.
|
|
11
12
|
</Banner>
|
|
12
13
|
|
|
13
14
|
**Example uses:**
|
|
@@ -18,31 +19,33 @@ keywords: relationship, fields, config, configuration, documentation, Content Ma
|
|
|
18
19
|
|
|
19
20
|
### Config
|
|
20
21
|
|
|
21
|
-
| Option
|
|
22
|
-
|
|
|
23
|
-
| **`name`**
|
|
24
|
-
| **`relationTo`**
|
|
25
|
-
| **`filterOptions`**
|
|
26
|
-
| **`hasMany`**
|
|
27
|
-
| **`maxDepth`**
|
|
28
|
-
| **`label`**
|
|
29
|
-
| **`unique`**
|
|
30
|
-
| **`validate`**
|
|
31
|
-
| **`index`**
|
|
32
|
-
| **`saveToJWT`**
|
|
33
|
-
| **`hooks`**
|
|
34
|
-
| **`access`**
|
|
35
|
-
| **`hidden`**
|
|
36
|
-
| **`defaultValue`**
|
|
37
|
-
| **`localized`**
|
|
38
|
-
| **`required`**
|
|
39
|
-
| **`admin`**
|
|
40
|
-
|
|
41
|
-
|
|
22
|
+
| Option | Description |
|
|
23
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
+
| **`name`** \* | To be used as the property name when stored and retrieved from the database. [More](/docs/fields/overview#field-names) |
|
|
25
|
+
| **`relationTo`** \* | Provide one or many collection `slug`s to be able to assign relationships to. |
|
|
26
|
+
| **`filterOptions`** | A query to filter which options appear in the UI and validate against. [More](#filtering-relationship-options). |
|
|
27
|
+
| **`hasMany`** | Boolean when, if set to `true`, allows this field to have many relations instead of only one. |
|
|
28
|
+
| **`maxDepth`** | Sets a number limit on iterations of related documents to populate when queried. [Depth](/docs/getting-started/concepts#depth) |
|
|
29
|
+
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
|
|
30
|
+
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
|
|
31
|
+
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
|
|
32
|
+
| **`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. |
|
|
33
|
+
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
|
|
34
|
+
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
|
|
35
|
+
| **`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) |
|
|
36
|
+
| **`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. |
|
|
37
|
+
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
|
|
38
|
+
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
|
|
39
|
+
| **`required`** | Require this field to have a value. |
|
|
40
|
+
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
|
|
41
|
+
|
|
42
|
+
_\* An asterisk denotes that a property is required._
|
|
42
43
|
|
|
43
44
|
<Banner type="success">
|
|
44
|
-
<strong>Tip:</strong
|
|
45
|
-
|
|
45
|
+
<strong>Tip:</strong>
|
|
46
|
+
<br />
|
|
47
|
+
The <a href="/docs/getting-started/concepts#depth">Depth</a> parameter can be
|
|
48
|
+
used to automatically populate related documents that are returned by the API.
|
|
46
49
|
</Banner>
|
|
47
50
|
|
|
48
51
|
### Admin config
|
|
@@ -51,7 +54,11 @@ In addition to the default [field admin config](/docs/fields/overview#admin-conf
|
|
|
51
54
|
|
|
52
55
|
**`isSortable`**
|
|
53
56
|
|
|
54
|
-
Set to `true` if you'd like this field to be sortable within the Admin UI using drag and drop
|
|
57
|
+
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`).
|
|
58
|
+
|
|
59
|
+
**`allowCreate`**
|
|
60
|
+
|
|
61
|
+
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).
|
|
55
62
|
|
|
56
63
|
### Filtering relationship options
|
|
57
64
|
|
|
@@ -59,33 +66,33 @@ Options can be dynamically limited by supplying a [query constraint](/docs/queri
|
|
|
59
66
|
|
|
60
67
|
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:
|
|
61
68
|
|
|
62
|
-
| Property | Description
|
|
63
|
-
| ------------- |
|
|
64
|
-
| `relationTo`
|
|
65
|
-
| `data`
|
|
66
|
-
| `siblingData`
|
|
67
|
-
| `id`
|
|
68
|
-
| `user`
|
|
69
|
+
| Property | Description |
|
|
70
|
+
| ------------- | ------------------------------------------------------------------------------------ |
|
|
71
|
+
| `relationTo` | The `relationTo` to filter against (as defined on the field) |
|
|
72
|
+
| `data` | An object of the full collection or global document currently being edited |
|
|
73
|
+
| `siblingData` | An object of the document data limited to fields within the same parent to the field |
|
|
74
|
+
| `id` | The value of the collection `id`, will be `undefined` on create request |
|
|
75
|
+
| `user` | The currently authenticated user object |
|
|
69
76
|
|
|
70
77
|
**Example:**
|
|
71
78
|
|
|
72
79
|
```ts
|
|
73
80
|
const relationshipField = {
|
|
74
|
-
name:
|
|
75
|
-
type:
|
|
76
|
-
relationTo: [
|
|
81
|
+
name: "purchase",
|
|
82
|
+
type: "relationship",
|
|
83
|
+
relationTo: ["products", "services"],
|
|
77
84
|
filterOptions: ({ relationTo, siblingData }) => {
|
|
78
85
|
// returns a Where query dynamically by the type of relationship
|
|
79
|
-
if (relationTo ===
|
|
86
|
+
if (relationTo === "products") {
|
|
80
87
|
return {
|
|
81
|
-
|
|
82
|
-
}
|
|
88
|
+
stock: { greater_than: siblingData.quantity },
|
|
89
|
+
};
|
|
83
90
|
}
|
|
84
91
|
|
|
85
|
-
if (relationTo ===
|
|
92
|
+
if (relationTo === "services") {
|
|
86
93
|
return {
|
|
87
|
-
|
|
88
|
-
}
|
|
94
|
+
isAvailable: { equals: true },
|
|
95
|
+
};
|
|
89
96
|
}
|
|
90
97
|
},
|
|
91
98
|
};
|
|
@@ -94,8 +101,13 @@ const relationshipField = {
|
|
|
94
101
|
You can learn more about writing queries [here](/docs/queries/overview).
|
|
95
102
|
|
|
96
103
|
<Banner type="warning">
|
|
97
|
-
<strong>Note:</strong
|
|
98
|
-
|
|
104
|
+
<strong>Note:</strong>
|
|
105
|
+
<br />
|
|
106
|
+
When a relationship field has both <strong>filterOptions</strong> and a custom{" "}
|
|
107
|
+
<strong>validate</strong> function, the api will not validate{" "}
|
|
108
|
+
<strong>filterOptions</strong> unless you call the default relationship field
|
|
109
|
+
validation function imported from <strong>payload/fields/validations</strong>{" "}
|
|
110
|
+
in your validate function.
|
|
99
111
|
</Banner>
|
|
100
112
|
|
|
101
113
|
### How the data is saved
|
|
@@ -123,10 +135,10 @@ The most simple pattern of a relationship is to use `hasMany: false` with a `rel
|
|
|
123
135
|
The shape of the data to save for a document with the field configured this way would be:
|
|
124
136
|
|
|
125
137
|
```json
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
138
|
+
{
|
|
139
|
+
// Mongo ObjectID of the related user
|
|
140
|
+
"owner": "6031ac9e1289176380734024"
|
|
141
|
+
}
|
|
130
142
|
```
|
|
131
143
|
|
|
132
144
|
When querying documents in this collection via REST API, you could query as follows:
|
|
@@ -154,12 +166,12 @@ Also known as **dynamic references**, in this configuration, the `relationTo` fi
|
|
|
154
166
|
The shape of the data to save for a document with more than one relationship type would be:
|
|
155
167
|
|
|
156
168
|
```json
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
169
|
+
{
|
|
170
|
+
"owner": {
|
|
171
|
+
"relationTo": "organizations",
|
|
172
|
+
"value": "6031ac9e1289176380734024"
|
|
162
173
|
}
|
|
174
|
+
}
|
|
163
175
|
```
|
|
164
176
|
|
|
165
177
|
Here is an example for how to query documents by this data (note the difference in referencing the `owner.value`):
|
|
@@ -193,9 +205,9 @@ The `hasMany` tells Payload that there may be more than one collection saved to
|
|
|
193
205
|
To save the to `hasMany` relationship field we need to send an array of IDs:
|
|
194
206
|
|
|
195
207
|
```json
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
208
|
+
{
|
|
209
|
+
"owners": ["6031ac9e1289176380734024", "602c3c327b811235943ee12b"]
|
|
210
|
+
}
|
|
199
211
|
```
|
|
200
212
|
|
|
201
213
|
When querying documents, the format does not change for arrays:
|
|
@@ -227,7 +239,8 @@ Relationship fields with `hasMany` set to more than one kind of collections save
|
|
|
227
239
|
{
|
|
228
240
|
"relationTo": "users",
|
|
229
241
|
"value": "6031ac9e1289176380734024"
|
|
230
|
-
},
|
|
242
|
+
},
|
|
243
|
+
{
|
|
231
244
|
"relationTo": "organizations",
|
|
232
245
|
"value": "602c3c327b811235943ee12b"
|
|
233
246
|
}
|
|
@@ -12,9 +12,15 @@ keywords: deployment, production, config, configuration, documentation, Content
|
|
|
12
12
|
|
|
13
13
|
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:
|
|
14
14
|
|
|
15
|
+
1. [Basics](#basics)
|
|
15
16
|
1. [Security](#security)
|
|
16
17
|
1. [Your MongoDB](#mongodb)
|
|
17
18
|
1. [Permanent File Storage](#file-storage)
|
|
19
|
+
1. [Docker](#docker)
|
|
20
|
+
|
|
21
|
+
## Basics
|
|
22
|
+
|
|
23
|
+
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.
|
|
18
24
|
|
|
19
25
|
## Security
|
|
20
26
|
|
package/errors.js
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {
|
|
2
|
+
APIError,
|
|
3
|
+
AuthenticationError,
|
|
4
|
+
DuplicateCollection,
|
|
5
|
+
DuplicateGlobal,
|
|
6
|
+
ErrorDeletingFile,
|
|
7
|
+
FileUploadError,
|
|
8
|
+
Forbidden,
|
|
9
|
+
InvalidConfiguration,
|
|
10
|
+
InvalidFieldName,
|
|
11
|
+
InvalidFieldRelationship,
|
|
12
|
+
LockedAuth,
|
|
13
|
+
MissingCollectionLabel,
|
|
14
|
+
MissingFieldInputOptions,
|
|
15
|
+
MissingFieldType,
|
|
16
|
+
MissingFile,
|
|
17
|
+
NotFound,
|
|
18
|
+
ValidationError,
|
|
19
|
+
} = require('./dist/errors');
|
|
2
20
|
|
|
3
21
|
module.exports = {
|
|
4
22
|
APIError,
|
|
23
|
+
AuthenticationError,
|
|
24
|
+
DuplicateCollection,
|
|
25
|
+
DuplicateGlobal,
|
|
26
|
+
ErrorDeletingFile,
|
|
27
|
+
FileUploadError,
|
|
5
28
|
Forbidden,
|
|
29
|
+
InvalidConfiguration,
|
|
30
|
+
InvalidFieldName,
|
|
31
|
+
InvalidFieldRelationship,
|
|
32
|
+
LockedAuth,
|
|
33
|
+
MissingCollectionLabel,
|
|
34
|
+
MissingFieldInputOptions,
|
|
35
|
+
MissingFieldType,
|
|
36
|
+
MissingFile,
|
|
37
|
+
NotFound,
|
|
38
|
+
ValidationError,
|
|
6
39
|
};
|