payload 1.2.1 → 1.2.2
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/CHANGELOG.md +40 -2
- package/components/fields/Array.ts +1 -2
- package/components/fields/Blocks.ts +1 -2
- package/components/fields/Cell.ts +1 -1
- package/components/fields/Checkbox.ts +1 -2
- package/components/fields/Code.ts +1 -2
- package/components/fields/DateTime.ts +1 -2
- package/components/fields/Email.ts +1 -2
- package/components/fields/Group.ts +1 -2
- package/components/fields/Number.ts +1 -2
- package/components/fields/Password.ts +1 -2
- package/components/fields/RadioGroup/RadioInput.ts +1 -2
- package/components/fields/RadioGroup/index.ts +1 -2
- package/components/fields/Relationship.ts +1 -2
- package/components/fields/RichText.ts +1 -2
- package/components/fields/Row.ts +1 -2
- package/components/fields/Select.ts +1 -2
- package/components/fields/Text.ts +1 -2
- package/components/fields/Textarea.ts +1 -2
- package/components/fields/Upload.ts +1 -2
- package/components/views/Cell.ts +1 -2
- package/components/views/Edit.ts +1 -2
- package/components/views/List.ts +1 -2
- package/dist/admin/components/elements/ReactSelect/index.js +3 -3
- package/dist/admin/components/elements/ReactSelect/types.d.ts +11 -10
- package/dist/admin/components/elements/Status/index.js +1 -1
- package/dist/admin/components/forms/Form/context.d.ts +15 -0
- package/dist/admin/components/forms/Form/context.js +16 -1
- package/dist/admin/components/forms/field-types/Blocks/SectionTitle/index.scss +3 -2
- package/dist/admin/components/forms/field-types/Blocks/index.js +1 -1
- package/dist/admin/components/forms/field-types/Code/Code.js +3 -4
- package/dist/admin/components/forms/field-types/Code/index.scss +177 -78
- package/dist/admin/components/forms/field-types/Relationship/AddNew/index.js +0 -1
- package/dist/admin/components/forms/field-types/Relationship/GetFilterOptions/index.d.ts +11 -0
- package/dist/admin/components/forms/field-types/Relationship/GetFilterOptions/index.js +37 -0
- package/dist/admin/components/forms/field-types/Relationship/findOptionsByValue.d.ts +8 -0
- package/dist/admin/components/forms/field-types/Relationship/findOptionsByValue.js +29 -0
- package/dist/admin/components/forms/field-types/Relationship/index.js +89 -139
- package/dist/admin/components/forms/field-types/Relationship/optionsReducer.d.ts +2 -2
- package/dist/admin/components/forms/field-types/Relationship/optionsReducer.js +2 -29
- package/dist/admin/components/forms/field-types/Relationship/types.d.ts +14 -2
- package/dist/admin/components/forms/field-types/RichText/elements/link/Element.js +3 -3
- package/dist/admin/components/forms/field-types/RichText/elements/link/index.scss +2 -1
- package/dist/admin/components/forms/field-types/RichText/elements/upload/Button/index.js +1 -1
- package/dist/admin/components/forms/field-types/Row/index.js +1 -1
- package/dist/admin/components/forms/field-types/Select/Input.d.ts +2 -2
- package/dist/admin/components/forms/useField/index.d.ts +5 -0
- package/dist/admin/components/forms/useField/index.js +5 -0
- package/dist/admin/components/utilities/I18n/index.js +1 -1
- package/dist/admin/components/views/Global/index.scss +31 -24
- package/dist/admin/components/views/collections/Edit/index.scss +19 -4
- package/dist/collections/buildSchema.js +5 -1
- package/dist/collections/config/types.d.ts +16 -3
- package/dist/collections/operations/find.js +11 -6
- package/dist/collections/operations/findVersions.js +4 -5
- package/dist/collections/operations/update.js +8 -9
- package/dist/collections/requestHandlers/find.js +4 -3
- package/dist/config/schema.js +2 -2
- package/dist/config/types.d.ts +269 -6
- package/dist/config/types.js +1 -1
- package/dist/email/build.js +2 -2
- package/dist/express/types.d.ts +26 -2
- package/dist/fields/config/sanitize.spec.js +5 -5
- package/dist/fields/config/types.d.ts +3 -3
- package/dist/fields/hooks/afterRead/relationshipPopulationPromise.js +73 -21
- package/dist/globals/operations/findVersions.js +4 -5
- package/dist/globals/operations/update.js +4 -4
- package/dist/graphql/schema/fieldToWhereInputSchemaMap.js +7 -7
- package/dist/graphql/schema/operators.d.ts +1 -0
- package/dist/graphql/schema/operators.js +2 -1
- package/dist/mongoose/types.d.ts +3 -3
- package/dist/translations/de.json +100 -100
- package/dist/translations/en.json +1 -1
- package/dist/translations/es.json +1 -1
- package/dist/translations/fr.json +1 -1
- package/dist/translations/it.json +1 -1
- package/dist/translations/my.json +1 -1
- package/dist/translations/nl.json +1 -1
- package/dist/translations/pl.json +1 -1
- package/dist/translations/pt.json +1 -1
- package/dist/translations/ru.json +1 -1
- package/dist/translations/sv.json +1 -1
- package/dist/translations/vi.json +1 -1
- package/dist/utilities/isNumber.d.ts +1 -0
- package/dist/utilities/isNumber.js +8 -0
- package/dist/versions/getLatestCollectionVersion.d.ts +10 -0
- package/dist/versions/getLatestCollectionVersion.js +27 -0
- package/dist/versions/getLatestGlobalVersion.d.ts +10 -0
- package/dist/versions/getLatestGlobalVersion.js +27 -0
- package/docs/admin/components.mdx +1 -5
- package/docs/configuration/globals.mdx +12 -12
- package/docs/fields/array.mdx +14 -14
- package/docs/fields/blocks.mdx +1 -1
- package/docs/fields/checkbox.mdx +2 -2
- package/docs/fields/code.mdx +1 -1
- package/docs/fields/date.mdx +1 -1
- package/docs/fields/email.mdx +1 -1
- package/docs/fields/number.mdx +1 -1
- package/docs/fields/radio.mdx +1 -1
- package/docs/fields/relationship.mdx +1 -1
- package/docs/fields/rich-text.mdx +1 -1
- package/docs/fields/select.mdx +2 -2
- package/docs/fields/text.mdx +2 -2
- package/docs/fields/textarea.mdx +1 -1
- package/docs/fields/upload.mdx +51 -17
- package/docs/production/preventing-abuse.mdx +6 -6
- package/package.json +3 -2
|
@@ -12,19 +12,19 @@ As with Collection configs, it's often best practice to write your Globals in se
|
|
|
12
12
|
|
|
13
13
|
## Options
|
|
14
14
|
|
|
15
|
-
| Option | Description
|
|
16
|
-
|
|
17
|
-
| **`slug`** * | Unique, URL-friendly string that will act as an identifier for this Global.
|
|
15
|
+
| Option | Description |
|
|
16
|
+
|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
17
|
+
| **`slug`** * | Unique, URL-friendly string that will act as an identifier for this Global. |
|
|
18
18
|
| **`fields`** * | Array of field types that will determine the structure and functionality of the data stored within this Global. [Click here](/docs/fields/overview) for a full list of field types as well as how to configure them. |
|
|
19
|
-
| **`label`** |
|
|
20
|
-
| **`description`** | Text or React component to display below the Global header to give editors more information.
|
|
21
|
-
| **`admin`** | Admin-specific configuration. See below for [more detail](/docs/configuration/globals#admin-options).
|
|
22
|
-
| **`hooks`** | Entry points to "tie in" to collection actions at specific points. [More](/docs/hooks/overview#global-hooks)
|
|
23
|
-
| **`access`** | Provide access control functions to define exactly who should be able to do what with this Global. [More](/docs/access-control/overview/#globals)
|
|
24
|
-
| **`versions`** | Set to true to enable default options, or configure with object properties. [More](/docs/versions/overview#globals-config)|
|
|
25
|
-
| **`endpoints`** | Add custom routes to the REST API. [More](/docs/rest-api/overview#custom-endpoints)|
|
|
26
|
-
| **`graphQL.name`** | Text used in schema generation. Auto-generated from slug if not defined.
|
|
27
|
-
| **`typescript`** | An object with property `interface` as the text used in schema generation. Auto-generated from slug if not defined.
|
|
19
|
+
| **`label`** | Text for the name in the Admin panel or an object with keys for each language. Auto-generated from slug if not defined. |
|
|
20
|
+
| **`description`** | Text or React component to display below the Global header to give editors more information. |
|
|
21
|
+
| **`admin`** | Admin-specific configuration. See below for [more detail](/docs/configuration/globals#admin-options). |
|
|
22
|
+
| **`hooks`** | Entry points to "tie in" to collection actions at specific points. [More](/docs/hooks/overview#global-hooks) |
|
|
23
|
+
| **`access`** | Provide access control functions to define exactly who should be able to do what with this Global. [More](/docs/access-control/overview/#globals) |
|
|
24
|
+
| **`versions`** | Set to true to enable default options, or configure with object properties. [More](/docs/versions/overview#globals-config) |
|
|
25
|
+
| **`endpoints`** | Add custom routes to the REST API. [More](/docs/rest-api/overview#custom-endpoints) |
|
|
26
|
+
| **`graphQL.name`** | Text used in schema generation. Auto-generated from slug if not defined. |
|
|
27
|
+
| **`typescript`** | An object with property `interface` as the text used in schema generation. Auto-generated from slug if not defined. |
|
|
28
28
|
|
|
29
29
|
*\* An asterisk denotes that a property is required.*
|
|
30
30
|
|
package/docs/fields/array.mdx
CHANGED
|
@@ -21,21 +21,21 @@ keywords: array, fields, config, configuration, documentation, Content Managemen
|
|
|
21
21
|
|
|
22
22
|
### Config
|
|
23
23
|
|
|
24
|
-
| Option | Description
|
|
25
|
-
| ----------------
|
|
26
|
-
| **`name`** * | To be used as the property name when stored and retrieved from the database.
|
|
27
|
-
| **`label`** |
|
|
28
|
-
| **`fields`** * | Array of field types to correspond to each row of the Array.
|
|
29
|
-
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation)
|
|
30
|
-
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT.
|
|
31
|
-
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks)
|
|
32
|
-
| **`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)
|
|
33
|
-
| **`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.
|
|
34
|
-
| **`defaultValue`** | Provide an array of row data to be used for this field's default value. [More](/docs/fields/overview#default-values)
|
|
24
|
+
| Option | Description |
|
|
25
|
+
| ---------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
26
|
+
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
|
|
27
|
+
| **`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. |
|
|
28
|
+
| **`fields`** * | Array of field types to correspond to each row of the Array. |
|
|
29
|
+
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
|
|
30
|
+
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
|
|
31
|
+
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
|
|
32
|
+
| **`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) |
|
|
33
|
+
| **`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. |
|
|
34
|
+
| **`defaultValue`** | Provide an array of row data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
|
|
35
35
|
| **`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`. |
|
|
36
|
-
| **`required`** | Require this field to have a value.
|
|
37
|
-
| **`labels`** | Customize the row labels appearing in the Admin dashboard.
|
|
38
|
-
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config).
|
|
36
|
+
| **`required`** | Require this field to have a value. |
|
|
37
|
+
| **`labels`** | Customize the row labels appearing in the Admin dashboard. |
|
|
38
|
+
| **`admin`** | Admin-specific configuration. See below for [more detail](#admin-config). |
|
|
39
39
|
|
|
40
40
|
*\* An asterisk denotes that a property is required.*
|
|
41
41
|
|
package/docs/fields/blocks.mdx
CHANGED
|
@@ -25,7 +25,7 @@ keywords: blocks, fields, config, configuration, documentation, Content Manageme
|
|
|
25
25
|
| Option | Description |
|
|
26
26
|
|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
27
27
|
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
|
|
28
|
-
| **`label`** |
|
|
28
|
+
| **`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. |
|
|
29
29
|
| **`blocks`** * | Array of [block configs](/docs/fields/blocks#block-configs) to be made available to this field. |
|
|
30
30
|
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
|
|
31
31
|
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
|
package/docs/fields/checkbox.mdx
CHANGED
|
@@ -14,8 +14,8 @@ keywords: checkbox, fields, config, configuration, documentation, Content Manage
|
|
|
14
14
|
|
|
15
15
|
| Option | Description |
|
|
16
16
|
| ---------------- | ----------- |
|
|
17
|
-
| **`name`** * | To be used as the property name when stored and retrieved from the database.
|
|
18
|
-
| **`label`** |
|
|
17
|
+
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
|
|
18
|
+
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
|
|
19
19
|
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
|
|
20
20
|
| **`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. |
|
|
21
21
|
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
|
package/docs/fields/code.mdx
CHANGED
|
@@ -18,7 +18,7 @@ This field uses `prismjs` for syntax highlighting and `react-simple-code-editor`
|
|
|
18
18
|
| Option | Description |
|
|
19
19
|
| ---------------- | ----------- |
|
|
20
20
|
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
|
|
21
|
-
| **`label`** |
|
|
21
|
+
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
|
|
22
22
|
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
|
|
23
23
|
| **`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. |
|
|
24
24
|
| **`minLength`** | Used by the default validation function to ensure values are of a minimum character length. |
|
package/docs/fields/date.mdx
CHANGED
|
@@ -18,7 +18,7 @@ This field uses [`react-datepicker`](https://www.npmjs.com/package/react-datepic
|
|
|
18
18
|
| Option | Description |
|
|
19
19
|
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
20
20
|
| **`name`** \* | To be used as the property name when stored and retrieved from the database. |
|
|
21
|
-
| **`label`** |
|
|
21
|
+
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
|
|
22
22
|
| **`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. |
|
|
23
23
|
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
|
|
24
24
|
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
|
package/docs/fields/email.mdx
CHANGED
|
@@ -15,7 +15,7 @@ keywords: email, fields, config, configuration, documentation, Content Managemen
|
|
|
15
15
|
| Option | Description |
|
|
16
16
|
| ---------------- | ----------- |
|
|
17
17
|
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
|
|
18
|
-
| **`label`** |
|
|
18
|
+
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
|
|
19
19
|
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
|
|
20
20
|
| **`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. |
|
|
21
21
|
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
|
package/docs/fields/number.mdx
CHANGED
|
@@ -15,7 +15,7 @@ keywords: number, fields, config, configuration, documentation, Content Manageme
|
|
|
15
15
|
| Option | Description |
|
|
16
16
|
| ---------------- | ----------- |
|
|
17
17
|
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
|
|
18
|
-
| **`label`** |
|
|
18
|
+
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
|
|
19
19
|
| **`min`** | Minimum value accepted. Used in the default `validation` function. |
|
|
20
20
|
| **`max`** | Maximum value accepted. Used in the default `validation` function. |
|
|
21
21
|
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
|
package/docs/fields/radio.mdx
CHANGED
|
@@ -16,7 +16,7 @@ keywords: radio, fields, config, configuration, documentation, Content Managemen
|
|
|
16
16
|
| ---------------- | ----------- |
|
|
17
17
|
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
|
|
18
18
|
| **`options`** * | Array of options to allow the field to store. Can either be an array of strings, or an array of objects containing an `label` string and a `value` string. |
|
|
19
|
-
| **`label`** |
|
|
19
|
+
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
|
|
20
20
|
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
|
|
21
21
|
| **`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. |
|
|
22
22
|
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
|
|
@@ -25,7 +25,7 @@ keywords: relationship, fields, config, configuration, documentation, Content Ma
|
|
|
25
25
|
| **`filterOptions`** | A query to filter which options appear in the UI and validate against. [More](#filtering-relationship-options). |
|
|
26
26
|
| **`hasMany`** | Boolean when, if set to `true`, allows this field to have many relations instead of only one. |
|
|
27
27
|
| **`maxDepth`** | Sets a number limit on iterations of related documents to populate when queried. [Depth](/docs/getting-started/concepts#depth) |
|
|
28
|
-
| **`label`** |
|
|
28
|
+
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
|
|
29
29
|
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
|
|
30
30
|
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
|
|
31
31
|
| **`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. |
|
|
@@ -21,7 +21,7 @@ The Admin component is built on the powerful [`slatejs`](https://docs.slatejs.or
|
|
|
21
21
|
| Option | Description |
|
|
22
22
|
| ---------------- | ----------- |
|
|
23
23
|
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
|
|
24
|
-
| **`label`** |
|
|
24
|
+
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
|
|
25
25
|
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
|
|
26
26
|
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
|
|
27
27
|
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
|
package/docs/fields/select.mdx
CHANGED
|
@@ -14,11 +14,11 @@ keywords: select, multi-select, fields, config, configuration, documentation, Co
|
|
|
14
14
|
### Config
|
|
15
15
|
|
|
16
16
|
| Option | Description |
|
|
17
|
-
| ------------------
|
|
17
|
+
| ------------------ |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
18
18
|
| **`name`** \* | To be used as the property name when stored and retrieved from the database. |
|
|
19
19
|
| **`options`** \* | Array of options to allow the field to store. Can either be an array of strings, or an array of objects containing a `label` string and a `value` string. |
|
|
20
20
|
| **`hasMany`** | Boolean when, if set to `true`, allows this field to have many selections instead of only one. |
|
|
21
|
-
| **`label`** |
|
|
21
|
+
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
|
|
22
22
|
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
|
|
23
23
|
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
|
|
24
24
|
| **`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. |
|
package/docs/fields/text.mdx
CHANGED
|
@@ -14,8 +14,8 @@ keywords: text, fields, config, configuration, documentation, Content Management
|
|
|
14
14
|
|
|
15
15
|
| Option | Description |
|
|
16
16
|
| ---------------- | ----------- |
|
|
17
|
-
| **`name`** * | To be used as the property name when stored and retrieved from the database.
|
|
18
|
-
| **`label`** |
|
|
17
|
+
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
|
|
18
|
+
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
|
|
19
19
|
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
|
|
20
20
|
| **`minLength`** | Used by the default validation function to ensure values are of a minimum character length. |
|
|
21
21
|
| **`maxLength`** | Used by the default validation function to ensure values are of a maximum character length. |
|
package/docs/fields/textarea.mdx
CHANGED
|
@@ -15,7 +15,7 @@ keywords: textarea, fields, config, configuration, documentation, Content Manage
|
|
|
15
15
|
| Option | Description |
|
|
16
16
|
| ---------------- | ----------- |
|
|
17
17
|
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
|
|
18
|
-
| **`label`** |
|
|
18
|
+
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
|
|
19
19
|
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
|
|
20
20
|
| **`minLength`** | Used by the default validation function to ensure values are of a minimum character length. |
|
|
21
21
|
| **`maxLength`** | Used by the default validation function to ensure values are of a maximum character length. |
|
package/docs/fields/upload.mdx
CHANGED
|
@@ -23,24 +23,24 @@ keywords: upload, images media, fields, config, configuration, documentation, Co
|
|
|
23
23
|
|
|
24
24
|
### Config
|
|
25
25
|
|
|
26
|
-
| Option | Description
|
|
27
|
-
| ----------------
|
|
28
|
-
| **`name`** * | To be used as the property name when stored and retrieved from the database.
|
|
29
|
-
| **`*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>
|
|
30
|
-
| **`filterOptions`** | A query to filter which options appear in the UI and validate against. [More](#filtering-
|
|
31
|
-
| **`maxDepth`** | Sets a number limit on iterations of related documents to populate when queried. [Depth](/docs/getting-started/concepts#depth)
|
|
32
|
-
| **`label`** |
|
|
33
|
-
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field.
|
|
34
|
-
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation)
|
|
26
|
+
| Option | Description |
|
|
27
|
+
| ---------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
28
|
+
| **`name`** * | To be used as the property name when stored and retrieved from the database. |
|
|
29
|
+
| **`*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> |
|
|
30
|
+
| **`filterOptions`** | A query to filter which options appear in the UI and validate against. [More](#filtering-upload-options). |
|
|
31
|
+
| **`maxDepth`** | Sets a number limit on iterations of related documents to populate when queried. [Depth](/docs/getting-started/concepts#depth) |
|
|
32
|
+
| **`label`** | Text used as a field label in the Admin panel or an object with keys for each language. |
|
|
33
|
+
| **`unique`** | Enforce that each entry in the Collection has a unique value for this field. |
|
|
34
|
+
| **`validate`** | Provide a custom validation function that will be executed on both the Admin panel and the backend. [More](/docs/fields/overview#validation) |
|
|
35
35
|
| **`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. |
|
|
36
|
-
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT.
|
|
37
|
-
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks)
|
|
38
|
-
| **`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)
|
|
39
|
-
| **`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.
|
|
40
|
-
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values)
|
|
41
|
-
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config.
|
|
42
|
-
| **`required`** | Require this field to have a value.
|
|
43
|
-
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details.
|
|
36
|
+
| **`saveToJWT`** | If this field is top-level and nested in a config supporting [Authentication](/docs/authentication/config), include its data in the user JWT. |
|
|
37
|
+
| **`hooks`** | Provide field-based hooks to control logic for this field. [More](/docs/fields/overview#field-level-hooks) |
|
|
38
|
+
| **`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) |
|
|
39
|
+
| **`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. |
|
|
40
|
+
| **`defaultValue`** | Provide data to be used for this field's default value. [More](/docs/fields/overview#default-values) |
|
|
41
|
+
| **`localized`** | Enable localization for this field. Requires [localization to be enabled](/docs/configuration/localization) in the Base config. |
|
|
42
|
+
| **`required`** | Require this field to have a value. |
|
|
43
|
+
| **`admin`** | Admin-specific configuration. See the [default field admin config](/docs/fields/overview#admin-config) for more details. |
|
|
44
44
|
|
|
45
45
|
*\* An asterisk denotes that a property is required.*
|
|
46
46
|
|
|
@@ -63,3 +63,37 @@ const ExampleCollection: CollectionConfig = {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
```
|
|
66
|
+
|
|
67
|
+
### Filtering upload options
|
|
68
|
+
|
|
69
|
+
Options can be dynamically limited by supplying a [query constraint](/docs/queries/overview), which will be used both for validating input and filtering available uploads in the UI.
|
|
70
|
+
|
|
71
|
+
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:
|
|
72
|
+
|
|
73
|
+
| Property | Description |
|
|
74
|
+
| ------------- | -------------|
|
|
75
|
+
| `relationTo` | The `relationTo` to filter against (as defined on the field) |
|
|
76
|
+
| `data` | An object of the full collection or global document currently being edited |
|
|
77
|
+
| `siblingData` | An object of the document data limited to fields within the same parent to the field |
|
|
78
|
+
| `id` | The value of the collection `id`, will be `undefined` on create request |
|
|
79
|
+
| `user` | The currently authenticated user object |
|
|
80
|
+
|
|
81
|
+
**Example:**
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
const uploadField = {
|
|
85
|
+
name: 'image',
|
|
86
|
+
type: 'upload',
|
|
87
|
+
relationTo: 'media',
|
|
88
|
+
filterOptions: {
|
|
89
|
+
mimeType: { contains: 'image' },
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
You can learn more about writing queries [here](/docs/queries/overview).
|
|
95
|
+
|
|
96
|
+
<Banner type="warning">
|
|
97
|
+
<strong>Note:</strong><br/>
|
|
98
|
+
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.
|
|
99
|
+
</Banner>
|
|
@@ -18,12 +18,12 @@ Set the max number of failed login attempts before a user account is locked out
|
|
|
18
18
|
|
|
19
19
|
To prevent DDoS, brute-force, and similar attacks, you can set IP-based rate limits so that once a certain threshold of requests has been hit by a single IP, further requests from the same IP will be ignored. The Payload config `rateLimit` property accepts an object with the following properties:
|
|
20
20
|
|
|
21
|
-
| Option | Description
|
|
22
|
-
| ---------------------------- |
|
|
23
|
-
| **`window`** | Time in milliseconds to track requests per IP |
|
|
24
|
-
| **`max`** | Number of requests served from a single IP before limiting |
|
|
25
|
-
| **`skip`** | Express middleware function that can return true (or promise resulting in true) that will bypass limit |
|
|
26
|
-
| **`trustProxy`** | True or false, to enable to allow requests to pass through a proxy such as a load balancer or an `nginx` reverse proxy |
|
|
21
|
+
| Option | Description |
|
|
22
|
+
| ---------------------------- | ----------- |
|
|
23
|
+
| **`window`** | Time in milliseconds to track requests per IP. Defaults to `90000` (15 minutes). |
|
|
24
|
+
| **`max`** | Number of requests served from a single IP before limiting. Defaults to `500`. |
|
|
25
|
+
| **`skip`** | Express middleware function that can return true (or promise resulting in true) that will bypass limit. |
|
|
26
|
+
| **`trustProxy`** | True or false, to enable to allow requests to pass through a proxy such as a load balancer or an `nginx` reverse proxy. |
|
|
27
27
|
|
|
28
28
|
<Banner type="warning">
|
|
29
29
|
<strong>Warning:</strong><br/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Node, React and MongoDB Headless CMS and Application Framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"release:minor": "release-it minor",
|
|
53
53
|
"release:major": "release-it major",
|
|
54
54
|
"release:beta": "release-it prepatch --config .release-it.beta.json",
|
|
55
|
+
"fix": "eslint \"src/**/*.ts\" --fix",
|
|
55
56
|
"lint": "eslint \"src/**/*.ts\""
|
|
56
57
|
},
|
|
57
58
|
"bugs": {
|
|
@@ -94,6 +95,7 @@
|
|
|
94
95
|
"@faceless-ui/scroll-info": "^1.2.3",
|
|
95
96
|
"@faceless-ui/window-info": "^2.0.2",
|
|
96
97
|
"@types/is-plain-object": "^2.0.4",
|
|
98
|
+
"@types/sharp": "^0.26.1",
|
|
97
99
|
"babel-jest": "^26.3.0",
|
|
98
100
|
"babel-loader": "^8.1.0",
|
|
99
101
|
"body-parser": "^1.19.0",
|
|
@@ -255,7 +257,6 @@
|
|
|
255
257
|
"@types/react-router-dom": "^5.1.6",
|
|
256
258
|
"@types/react-select": "^3.0.26",
|
|
257
259
|
"@types/sass": "^1.16.0",
|
|
258
|
-
"@types/sharp": "^0.26.1",
|
|
259
260
|
"@types/shelljs": "^0.8.11",
|
|
260
261
|
"@types/testing-library__jest-dom": "^5.9.5",
|
|
261
262
|
"@types/uuid": "^8.3.0",
|