payload 0.14.29-beta.0 → 0.15.0

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +19 -2
  2. package/dist/admin/components/forms/field-types/Select/index.js +1 -1
  3. package/dist/auth/types.js +2 -2
  4. package/dist/collections/operations/create.js +2 -2
  5. package/dist/collections/operations/find.d.ts +1 -0
  6. package/dist/collections/operations/find.js +4 -2
  7. package/dist/collections/operations/local/find.d.ts +1 -0
  8. package/dist/collections/operations/local/find.js +3 -2
  9. package/dist/collections/operations/update.js +3 -3
  10. package/dist/config/sanitize.js +4 -1
  11. package/dist/fields/accessPromise.d.ts +1 -1
  12. package/dist/fields/accessPromise.js +3 -3
  13. package/dist/fields/config/schema.js +5 -5
  14. package/dist/fields/config/types.d.ts +3 -2
  15. package/dist/fields/config/types.js +1 -1
  16. package/dist/fields/relationshipPopulationPromise.js +2 -2
  17. package/dist/fields/richText/populate.js +2 -2
  18. package/dist/fields/validations.js +6 -5
  19. package/dist/fields/validations.spec.js +120 -1
  20. package/dist/globals/operations/update.js +3 -3
  21. package/dist/graphql/errorHandler.d.ts +2 -1
  22. package/dist/graphql/errorHandler.js +9 -6
  23. package/dist/graphql/index.d.ts +2 -1
  24. package/dist/graphql/index.js +13 -4
  25. package/dist/graphql/schema/buildObjectType.js +6 -36
  26. package/dist/graphql/utilities/formatName.js +3 -3
  27. package/dist/graphql/utilities/formatOptions.d.ts +3 -0
  28. package/dist/graphql/utilities/formatOptions.js +27 -0
  29. package/dist/types/index.d.ts +1 -1
  30. package/docs/access-control/collections.mdx +9 -7
  31. package/docs/access-control/fields.mdx +2 -1
  32. package/docs/access-control/globals.mdx +4 -3
  33. package/docs/getting-started/installation.mdx +12 -0
  34. package/docs/local-api/overview.mdx +1 -0
  35. package/package.json +1 -1
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const types_1 = require("../../fields/config/types");
7
+ const formatName_1 = __importDefault(require("./formatName"));
8
+ const formatOptions = (field) => {
9
+ return field.options.reduce((values, option) => {
10
+ if ((0, types_1.optionIsObject)(option)) {
11
+ return {
12
+ ...values,
13
+ [(0, formatName_1.default)(option.value)]: {
14
+ value: option.value,
15
+ },
16
+ };
17
+ }
18
+ return {
19
+ ...values,
20
+ [(0, formatName_1.default)(option)]: {
21
+ value: option,
22
+ },
23
+ };
24
+ }, {});
25
+ };
26
+ exports.default = formatOptions;
27
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybWF0T3B0aW9ucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9ncmFwaHFsL3V0aWxpdGllcy9mb3JtYXRPcHRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEscURBQW9GO0FBQ3BGLDhEQUFzQztBQUV0QyxNQUFNLGFBQWEsR0FBRyxDQUFDLEtBQStCLEVBQUUsRUFBRTtJQUN4RCxPQUFPLEtBQUssQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUMsTUFBTSxFQUFFLE1BQU0sRUFBRSxFQUFFO1FBQzdDLElBQUksSUFBQSxzQkFBYyxFQUFDLE1BQU0sQ0FBQyxFQUFFO1lBQzFCLE9BQU87Z0JBQ0wsR0FBRyxNQUFNO2dCQUNULENBQUMsSUFBQSxvQkFBVSxFQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsQ0FBQyxFQUFFO29CQUMxQixLQUFLLEVBQUUsTUFBTSxDQUFDLEtBQUs7aUJBQ3BCO2FBQ0YsQ0FBQztTQUNIO1FBRUQsT0FBTztZQUNMLEdBQUcsTUFBTTtZQUNULENBQUMsSUFBQSxvQkFBVSxFQUFDLE1BQU0sQ0FBQyxDQUFDLEVBQUU7Z0JBQ3BCLEtBQUssRUFBRSxNQUFNO2FBQ2Q7U0FDRixDQUFDO0lBQ0osQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDO0FBQ1QsQ0FBQyxDQUFDO0FBR0Ysa0JBQWUsYUFBYSxDQUFDIn0=
@@ -1,7 +1,7 @@
1
1
  import { Document as MongooseDocument } from 'mongoose';
2
2
  import { TypeWithTimestamps } from '../collections/config/types';
3
3
  import { FileData } from '../uploads/types';
4
- export declare type Operator = 'equals' | 'not_equals' | 'in' | 'not_in' | 'exists' | 'greater_than' | 'greater_than_equals' | 'less_than' | 'less_than_equals' | 'like' | 'near';
4
+ export declare type Operator = 'equals' | 'not_equals' | 'in' | 'not_in' | 'exists' | 'greater_than' | 'greater_than_equal' | 'less_than' | 'less_than_equal' | 'like' | 'near';
5
5
  export declare type WhereField = {
6
6
  [key in Operator]?: unknown;
7
7
  };
@@ -48,9 +48,10 @@ Returns a boolean which allows/denies access to the `create` request.
48
48
 
49
49
  **Available argument properties :**
50
50
 
51
- | Option | Description |
52
- | --------- | ----------- |
53
- | **`req`** | The Express `request` object containing the currently authenticated `user` |
51
+ | Option | Description |
52
+ | ---------- | ----------- |
53
+ | **`req`** | The Express `request` object containing the currently authenticated `user` |
54
+ | **`data`** | The data passed to create the document with. |
54
55
 
55
56
  ### Read
56
57
 
@@ -69,10 +70,11 @@ Update access functions can return a boolean result or optionally return a [quer
69
70
 
70
71
  **Available argument properties :**
71
72
 
72
- | Option | Description |
73
- | --------- | ----------- |
74
- | **`req`** | The Express `request` object containing the currently authenticated `user` |
75
- | **`id`** | `id` of document requested to update |
73
+ | Option | Description |
74
+ | ---------- | ----------- |
75
+ | **`req`** | The Express `request` object containing the currently authenticated `user` |
76
+ | **`id`** | `id` of document requested to update |
77
+ | **`data`** | The data passed to update the document with. |
76
78
 
77
79
  ### Delete
78
80
 
@@ -58,7 +58,7 @@ Returns a boolean which allows or denies the ability to read a field's value. If
58
58
  | ----------------- | ----------- |
59
59
  | **`req`** | The Express `request` object containing the currently authenticated `user` |
60
60
  | **`id`** | `id` of the document being read |
61
- | **`data`** | The full data of the document being read. |
61
+ | **`doc`** | The full document data. |
62
62
  | **`siblingData`** | Immediately adjacent field data of the document being read. |
63
63
 
64
64
  ### Update
@@ -73,3 +73,4 @@ Returns a boolean which allows or denies the ability to update a field's value.
73
73
  | **`id`** | `id` of the document being updated |
74
74
  | **`data`** | The full data passed to update the document. |
75
75
  | **`siblingData`** | Immediately adjacent field data passed to update the document with. |
76
+ | **`doc`** | The full document data, before the update is applied. |
@@ -46,6 +46,7 @@ Returns a boolean result or optionally a [query constraint](/docs/queries/overvi
46
46
 
47
47
  **Available argument properties:**
48
48
 
49
- | Option | Description |
50
- | --------- | ----------- |
51
- | **`req`** | The Express `request` object containing the currently authenticated `user` |
49
+ | Option | Description |
50
+ | ---------- | ----------- |
51
+ | **`req`** | The Express `request` object containing the currently authenticated `user` |
52
+ | **`data`** | The data passed to update the global with. |
@@ -114,6 +114,18 @@ This is your Express app as shown above. Payload will tie into your existing `ap
114
114
 
115
115
  Your Payload license key. Not needed for development purposes, but when it's time to deploy to production, you need to add your license key here. More info about how Payload licensing works can be found [here](/docs/production/licensing).
116
116
 
117
+ ##### `email`
118
+
119
+ An Optional object used to configure SMTP. [Read more](/docs/email/overview).
120
+
121
+ ##### `local`
122
+
123
+ A boolean that when set to `true` tells Payload to start in local-only mode which will bypass setting up API routes. When set to `true`, `express` is not required. This is useful when running scripts that need to use Payload's [local-api](/docs/local-api/overview).
124
+
125
+ ##### `onInit`
126
+
127
+ An optional function that is called immediately following startup that receives the Payload instance as it's only argument.
128
+
117
129
  ### Test it out
118
130
 
119
131
  After you've gotten this far, it's time to boot up Payload. At the command line, run `npm install` and then `node server.js` in your application's folder to start up your app and initialize Payload.
@@ -65,6 +65,7 @@ You can specify more options within the Local API vs. REST or GraphQL due to the
65
65
  | `overrideAccess` | Skip access control. By default, this property is set to false. |
66
66
  | `user` | If you re-enable access control, you can specify a user to use against the access control checks. |
67
67
  | `showHiddenFields` | Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config. |
68
+ | `pagination` | Set to false to return all documents and avoid querying for document counts. |
68
69
 
69
70
  *There are more options available on an operation by operation basis outlined below.*
70
71
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload",
3
- "version": "0.14.29-beta.0",
3
+ "version": "0.15.0",
4
4
  "description": "Node, React and MongoDB Headless CMS and Application Framework",
5
5
  "license": "SEE LICENSE IN license.md",
6
6
  "author": {