payload 1.6.13 → 1.6.15

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 (81) hide show
  1. package/dist/admin/components/elements/WhereBuilder/field-types.js +8 -8
  2. package/dist/admin/components/elements/WhereBuilder/field-types.js.map +1 -1
  3. package/dist/admin/components/elements/WhereBuilder/index.js +4 -0
  4. package/dist/admin/components/elements/WhereBuilder/index.js.map +1 -1
  5. package/dist/admin/components/forms/field-types/Code/index.js.map +1 -1
  6. package/dist/admin/components/forms/field-types/RichText/elements/link/LinkDrawer/index.js +5 -13
  7. package/dist/admin/components/forms/field-types/RichText/elements/link/LinkDrawer/index.js.map +1 -1
  8. package/dist/admin/components/forms/withCondition/index.js +1 -0
  9. package/dist/admin/components/forms/withCondition/index.js.map +1 -1
  10. package/dist/admin/components/utilities/I18n/index.js +2 -1
  11. package/dist/admin/components/utilities/I18n/index.js.map +1 -1
  12. package/dist/admin/components/views/ResetPassword/index.js +5 -0
  13. package/dist/admin/components/views/ResetPassword/index.js.map +1 -1
  14. package/dist/admin/components/views/collections/List/index.js +2 -2
  15. package/dist/admin/components/views/collections/List/index.js.map +1 -1
  16. package/dist/admin/utilities/getSupportedMonacoLocale.d.ts +1 -0
  17. package/dist/admin/utilities/getSupportedMonacoLocale.js +19 -0
  18. package/dist/admin/utilities/getSupportedMonacoLocale.js.map +1 -0
  19. package/dist/auth/operations/forgotPassword.js.map +1 -1
  20. package/dist/auth/operations/registerFirstUser.d.ts +1 -1
  21. package/dist/auth/operations/resetPassword.js +3 -0
  22. package/dist/auth/operations/resetPassword.js.map +1 -1
  23. package/dist/auth/strategies/apiKey.js +1 -0
  24. package/dist/auth/strategies/apiKey.js.map +1 -1
  25. package/dist/auth/types.d.ts +1 -0
  26. package/dist/auth/types.js.map +1 -1
  27. package/dist/bin/index.js +16 -4
  28. package/dist/bin/index.js.map +1 -1
  29. package/dist/collections/config/types.d.ts +1 -1
  30. package/dist/collections/graphql/resolvers/create.d.ts +1 -1
  31. package/dist/collections/operations/create.d.ts +1 -1
  32. package/dist/collections/operations/find.d.ts +1 -0
  33. package/dist/collections/operations/find.js +2 -2
  34. package/dist/collections/operations/find.js.map +1 -1
  35. package/dist/collections/operations/local/create.d.ts +1 -1
  36. package/dist/collections/operations/local/find.d.ts +1 -0
  37. package/dist/collections/operations/local/find.js +2 -1
  38. package/dist/collections/operations/local/find.js.map +1 -1
  39. package/dist/config/types.d.ts +4 -1
  40. package/dist/fields/hooks/afterRead/promise.js +3 -3
  41. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  42. package/dist/mongoose/buildQuery.js +5 -4
  43. package/dist/mongoose/buildQuery.js.map +1 -1
  44. package/dist/mongoose/connect.d.ts +2 -2
  45. package/dist/mongoose/connect.js +1 -1
  46. package/dist/mongoose/connect.js.map +1 -1
  47. package/dist/payload.d.ts +1 -0
  48. package/dist/payload.js +1 -0
  49. package/dist/payload.js.map +1 -1
  50. package/dist/translations/cs.json +14 -0
  51. package/dist/translations/de.json +14 -0
  52. package/dist/translations/en.json +14 -0
  53. package/dist/translations/es.json +14 -0
  54. package/dist/translations/fr.json +14 -0
  55. package/dist/translations/hr.json +14 -0
  56. package/dist/translations/index.d.ts +280 -0
  57. package/dist/translations/it.json +14 -0
  58. package/dist/translations/ja.json +14 -0
  59. package/dist/translations/my.json +14 -0
  60. package/dist/translations/nb.json +14 -0
  61. package/dist/translations/nl.json +14 -0
  62. package/dist/translations/pl.json +14 -0
  63. package/dist/translations/pt.json +14 -0
  64. package/dist/translations/ru.json +14 -0
  65. package/dist/translations/sv.json +14 -0
  66. package/dist/translations/th.json +14 -0
  67. package/dist/translations/tr.json +14 -0
  68. package/dist/translations/ua.json +14 -0
  69. package/dist/translations/vi.json +14 -0
  70. package/dist/translations/zh.json +14 -0
  71. package/dist/utilities/entityToJSONSchema.js +11 -1
  72. package/dist/utilities/entityToJSONSchema.js.map +1 -1
  73. package/dist/versions/drafts/queryDrafts.d.ts +2 -1
  74. package/dist/versions/drafts/queryDrafts.js +2 -0
  75. package/dist/versions/drafts/queryDrafts.js.map +1 -1
  76. package/docs/admin/overview.mdx +1 -1
  77. package/docs/fields/code.mdx +1 -1
  78. package/docs/local-api/overview.mdx +147 -91
  79. package/docs/production/deployment.mdx +8 -5
  80. package/docs/upload/overview.mdx +2 -2
  81. package/package.json +3 -2
@@ -218,6 +218,20 @@
218
218
  "users": "Những người dùng",
219
219
  "welcome": "Xin chào"
220
220
  },
221
+ "operators": {
222
+ "equals": "bằng",
223
+ "isNotEqualTo": "không bằng",
224
+ "isIn": "đang ở",
225
+ "isNotIn": "không có trong",
226
+ "exists": "tồn tại",
227
+ "isGreaterThan": "lớn hơn",
228
+ "isLessThan": "nhỏ hơn",
229
+ "isLessThanOrEqualTo": "nhỏ hơn hoặc bằng",
230
+ "isGreaterThanOrEqualTo": "lớn hơn hoặc bằng",
231
+ "near": "gần",
232
+ "isLike": "giống như",
233
+ "contains": "chứa"
234
+ },
221
235
  "upload": {
222
236
  "dragAndDropHere": "hoặc kéo và thả file vào đây",
223
237
  "fileName": "Tên file",
@@ -226,6 +226,20 @@
226
226
  "users": "用户",
227
227
  "welcome": "欢迎"
228
228
  },
229
+ "operators": {
230
+ "equals": "等于",
231
+ "isNotEqualTo": "不等于",
232
+ "isIn": "在",
233
+ "isNotIn": "不在",
234
+ "exists": "存在",
235
+ "isGreaterThan": "大于",
236
+ "isLessThan": "小于",
237
+ "isLessThanOrEqualTo": "小于或等于",
238
+ "isGreaterThanOrEqualTo": "大于等于",
239
+ "near": "附近",
240
+ "isLike": "就像",
241
+ "contains": "包含"
242
+ },
229
243
  "upload": {
230
244
  "dragAndDropHere": "或在这里拖放一个文件",
231
245
  "fileName": "文件名",
@@ -52,7 +52,17 @@ function generateFieldTypes(config, fields) {
52
52
  break;
53
53
  }
54
54
  case 'json': {
55
- fieldSchema = { type: 'object' };
55
+ // https://www.rfc-editor.org/rfc/rfc7159#section-3
56
+ fieldSchema = {
57
+ oneOf: [
58
+ { type: 'object' },
59
+ { type: 'array' },
60
+ { type: 'string' },
61
+ { type: 'number' },
62
+ { type: 'boolean' },
63
+ { type: 'null' },
64
+ ],
65
+ };
56
66
  break;
57
67
  }
58
68
  case 'richText': {
@@ -1 +1 @@
1
- {"version":3,"file":"entityToJSONSchema.js","sourceRoot":"","sources":["../../src/utilities/entityToJSONSchema.ts"],"names":[],"mappings":";;;;;;AACA,yCAAqC;AAErC,kDAAyG;AAGzG,sEAA8C;AAC9C,iDAAyC;AAGzC,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAE3D,MAAM,kBAAkB,GAAG,CAAC,KAAY,EAAE,EAAE;IAC1C,OAAO,IAAA,wBAAgB,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC,UAAU,IAAI,KAAK,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACrI,CAAC,CAAC;AAEF,SAAS,mBAAmB,CAAC,WAAwC,EAAE,IAAY;IACjF,MAAM,iBAAiB,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACrF,MAAM,aAAa,GAAG,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAEvG,IAAI,aAAa,IAAI,aAAa,CAAC,IAAI,KAAK,QAAQ,EAAE;QACpD,OAAO,QAAQ,CAAC;KACjB;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAiB;IAC1C,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QAC5B,IAAI,OAAO,MAAM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AAI,EAAE;aAC9B;SACF,CAAC,CAAC;QACH,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC;QAC9C,oBAAoB,EAAE,KAAK;KAC5B,CAAC;AACJ,CAAC;AAZD,oDAYC"}
@@ -1,3 +1,4 @@
1
+ import { PaginateOptions } from 'mongoose';
1
2
  import { AccessResult } from '../../config/types';
2
3
  import { Where } from '../../types';
3
4
  import { Payload } from '../../payload';
@@ -7,7 +8,7 @@ type Args = {
7
8
  accessResult: AccessResult;
8
9
  collection: Collection;
9
10
  locale: string;
10
- paginationOptions: any;
11
+ paginationOptions: PaginateOptions;
11
12
  payload: Payload;
12
13
  where: Where;
13
14
  };
@@ -4,6 +4,7 @@ exports.queryDrafts = void 0;
4
4
  const auth_1 = require("../../auth");
5
5
  const appendVersionToQueryKey_1 = require("./appendVersionToQueryKey");
6
6
  const queryDrafts = async ({ accessResult, collection, locale, payload, paginationOptions, where: incomingWhere, }) => {
7
+ var _a;
7
8
  const VersionModel = payload.versions[collection.config.slug];
8
9
  const where = (0, appendVersionToQueryKey_1.appendVersionToQueryKey)(incomingWhere || {});
9
10
  const versionQueryToBuild = {
@@ -43,6 +44,7 @@ const queryDrafts = async ({ accessResult, collection, locale, payload, paginati
43
44
  const result = await VersionModel.aggregatePaginate(aggregate, {
44
45
  ...paginationOptions,
45
46
  sort: paginationSort,
47
+ useFacet: (_a = payload.mongoOptions) === null || _a === void 0 ? void 0 : _a.useFacet,
46
48
  });
47
49
  return {
48
50
  ...result,
@@ -1 +1 @@
1
- {"version":3,"file":"queryDrafts.js","sourceRoot":"","sources":["../../../src/versions/drafts/queryDrafts.ts"],"names":[],"mappings":";;;AAKA,qCAAkD;AAClD,uEAAoE;AAkB7D,MAAM,WAAW,GAAG,KAAK,EAAwB,EACtD,YAAY,EACZ,UAAU,EACV,MAAM,EACN,OAAO,EACP,iBAAiB,EACjB,KA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ACtB,CAAC,CAAC;IAEtB,OAAO;QACL,GAAG,MAAM;QACT,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC9B,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,GAAG,GAAG,CAAC,OAAO;YACd,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,SAAS,EAAE,GAAG,CAAC,SAAS;SACzB,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC,CAAC;AAlEW,QAAA,WAAW,eAkEtB"}
@@ -25,7 +25,7 @@ _Screenshot of the Admin panel while editing a document from an example `AllFiel
25
25
  All options for the Admin panel are defined in your base Payload config file.
26
26
 
27
27
  | Option | Description |
28
- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --- |
28
+ | --------------------- | -------------------------------------------------------------------------------------------------- |
29
29
  | `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) |
30
30
  | `buildPath` | Specify an absolute path for where to store the built Admin panel bundle used in production. Defaults to `path.resolve(process.cwd(), 'build')`. |
31
31
  | `meta` | Base meta data to use for the Admin panel. Included properties are `titleSuffix`, `ogImage`, and `favicon`. |
@@ -42,7 +42,7 @@ In addition to the default [field admin config](/docs/fields/overview#admin-conf
42
42
  | Option | Description |
43
43
  | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
44
44
  | **`language`** | This property can be set to any language listed [here](https://github.com/microsoft/monaco-editor/tree/main/src/basic-languages). |
45
- | **`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). |
45
+ | **`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). |
46
46
 
47
47
  ### Example
48
48
 
@@ -9,8 +9,14 @@ keywords: local api, config, configuration, documentation, Content Management Sy
9
9
  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.
10
10
 
11
11
  <Banner type="success">
12
- <strong>Tip:</strong><br/>
13
- 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.
12
+ <strong>Tip:</strong>
13
+ <br />
14
+ The Local API is incredibly powerful when used with server-side rendering app
15
+ frameworks like NextJS. With other headless CMS, you need to request your data
16
+ from third-party servers which can add significant loading time to your
17
+ server-rendered pages. With Payload, you don't have to leave your server to
18
+ gather the data you need. It can be incredibly fast and is definitely a game
19
+ changer.
14
20
  </Banner>
15
21
 
16
22
  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:
28
34
  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.
29
35
 
30
36
  Example:
37
+
31
38
  ```ts
32
- import payload from 'payload';
33
- import { CollectionAfterChangeHook } from 'payload/types';
39
+ import payload from "payload";
40
+ import { CollectionAfterChangeHook } from "payload/types";
34
41
 
35
42
  const afterChangeHook: CollectionAfterChangeHook = async () => {
36
43
  const posts = await payload.find({
37
- collection: 'posts',
44
+ collection: "posts",
38
45
  });
39
- }
46
+ };
40
47
  ```
41
48
 
42
49
  ##### Accessing from the `req`
@@ -44,35 +51,42 @@ const afterChangeHook: CollectionAfterChangeHook = async () => {
44
51
  Payload is available anywhere you have access to the Express `req` - including within your access control and hook functions.
45
52
 
46
53
  Example:
54
+
47
55
  ```ts
48
- const afterChangeHook: CollectionAfterChangeHook = async ({ req: { payload }}) => {
56
+ const afterChangeHook: CollectionAfterChangeHook = async ({
57
+ req: { payload },
58
+ }) => {
49
59
  const posts = await payload.find({
50
- collection: 'posts',
60
+ collection: "posts",
51
61
  });
52
- }
62
+ };
53
63
  ```
54
64
 
55
65
  ### Local options available
56
66
 
57
67
  You can specify more options within the Local API vs. REST or GraphQL due to the server-only context that they are executed in.
58
68
 
59
- | Local Option | Description |
60
- | -------------------- | ------------ |
61
- | `collection` | Required for Collection operations. Specifies the Collection slug to operate against. |
62
- | `data` | The data to use within the operation. Required for `create`, `update`. |
63
- | `depth` | [Control auto-population](/docs/getting-started/concepts#depth) of nested relationship and upload fields. |
64
- | `locale` | Specify [locale](/docs/configuration/localization) for any returned documents. |
65
- | `fallbackLocale` | Specify a [fallback locale](/docs/configuration/localization) to use for any returned documents. |
66
- | `overrideAccess` | Skip access control. By default, this property is set to true within all Local API operations. |
67
- | `user` | If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks. |
68
- | `showHiddenFields` | Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config. |
69
- | `pagination` | Set to false to return all documents and avoid querying for document counts. |
70
-
71
- *There are more options available on an operation by operation basis outlined below.*
69
+ | Local Option | Description |
70
+ | ------------------- | -------------------------------------------------------------------------------------------------------------------- |
71
+ | `collection` | Required for Collection operations. Specifies the Collection slug to operate against. |
72
+ | `data` | The data to use within the operation. Required for `create`, `update`. |
73
+ | `depth` | [Control auto-population](/docs/getting-started/concepts#depth) of nested relationship and upload fields. |
74
+ | `locale` | Specify [locale](/docs/configuration/localization) for any returned documents. |
75
+ | `fallbackLocale` | Specify a [fallback locale](/docs/configuration/localization) to use for any returned documents. |
76
+ | `overrideAccess` | Skip access control. By default, this property is set to true within all Local API operations. |
77
+ | `user` | If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks. |
78
+ | `showHiddenFields` | Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config. |
79
+ | `queryHiddenFields` | Allow querying by hidden fields. By default, hidden fields are not allowed to be queried on. |
80
+ | `pagination` | Set to false to return all documents and avoid querying for document counts. |
81
+
82
+ _There are more options available on an operation by operation basis outlined below._
72
83
 
73
84
  <Banner type="warning">
74
- <strong>Note:</strong><br/>
75
- 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.
85
+ <strong>Note:</strong>
86
+ <br />
87
+ By default, all access control checks are disabled in the Local API, but you
88
+ can re-enable them if you'd like, as well as pass a specific user to run the
89
+ operation with.
76
90
  </Banner>
77
91
 
78
92
  ## Collections
@@ -84,12 +98,13 @@ The following Collection operations are available through the Local API:
84
98
  ```js
85
99
  // The created Post document is returned
86
100
  const post = await payload.create({
87
- collection: 'posts', // required
88
- data: { // required
89
- title: 'sure',
90
- description: 'maybe',
101
+ collection: "posts", // required
102
+ data: {
103
+ // required
104
+ title: "sure",
105
+ description: "maybe",
91
106
  },
92
- locale: 'en',
107
+ locale: "en",
93
108
  fallbackLocale: false,
94
109
  user: dummyUserDoc,
95
110
  overrideAccess: true,
@@ -102,12 +117,12 @@ const post = await payload.create({
102
117
  // If your collection supports uploads, you can upload
103
118
  // a file directly through the Local API by providing
104
119
  // its full, absolute file path.
105
- filePath: path.resolve(__dirname, './path-to-image.jpg'),
120
+ filePath: path.resolve(__dirname, "./path-to-image.jpg"),
106
121
 
107
122
  // Alternatively, you can directly pass a File,
108
123
  // if file is provided, filePath will be omitted
109
124
  file: uploadedFile,
110
- })
125
+ });
111
126
  ```
112
127
 
113
128
  #### Find
@@ -116,18 +131,19 @@ const post = await payload.create({
116
131
  // Result will be a paginated set of Posts.
117
132
  // See /docs/queries/pagination for more.
118
133
  const result = await payload.find({
119
- collection: 'posts', // required
134
+ collection: "posts", // required
120
135
  depth: 2,
121
136
  page: 1,
122
137
  limit: 10,
123
138
  where: {}, // pass a `where` query here
124
- sort: '-title',
125
- locale: 'en',
139
+ sort: "-title",
140
+ locale: "en",
126
141
  fallbackLocale: false,
127
142
  user: dummyUser,
128
143
  overrideAccess: false,
129
144
  showHiddenFields: true,
130
- })
145
+ queryHiddenFields: false,
146
+ });
131
147
  ```
132
148
 
133
149
  #### Find by ID
@@ -135,15 +151,15 @@ const result = await payload.find({
135
151
  ```js
136
152
  // Result will be a Post document.
137
153
  const result = await payload.findByID({
138
- collection: 'posts', // required
139
- id: '507f1f77bcf86cd799439011', // required
154
+ collection: "posts", // required
155
+ id: "507f1f77bcf86cd799439011", // required
140
156
  depth: 2,
141
- locale: 'en',
157
+ locale: "en",
142
158
  fallbackLocale: false,
143
159
  user: dummyUser,
144
160
  overrideAccess: false,
145
161
  showHiddenFields: true,
146
- })
162
+ });
147
163
  ```
148
164
 
149
165
  #### Update
@@ -151,14 +167,15 @@ const result = await payload.findByID({
151
167
  ```js
152
168
  // Result will be the updated Post document.
153
169
  const result = await payload.update({
154
- collection: 'posts', // required
155
- id: '507f1f77bcf86cd799439011', // required
156
- data: { // required
157
- title: 'sure',
158
- description: 'maybe',
170
+ collection: "posts", // required
171
+ id: "507f1f77bcf86cd799439011", // required
172
+ data: {
173
+ // required
174
+ title: "sure",
175
+ description: "maybe",
159
176
  },
160
177
  depth: 2,
161
- locale: 'en',
178
+ locale: "en",
162
179
  fallbackLocale: false,
163
180
  user: dummyUser,
164
181
  overrideAccess: false,
@@ -167,13 +184,13 @@ const result = await payload.update({
167
184
  // If your collection supports uploads, you can upload
168
185
  // a file directly through the Local API by providing
169
186
  // its full, absolute file path.
170
- filePath: path.resolve(__dirname, './path-to-image.jpg'),
187
+ filePath: path.resolve(__dirname, "./path-to-image.jpg"),
171
188
 
172
189
  // If you are uploading a file and would like to replace
173
190
  // the existing file instead of generating a new filename,
174
191
  // you can set the following property to `true`
175
192
  overwriteExistingFiles: true,
176
- })
193
+ });
177
194
  ```
178
195
 
179
196
  #### Delete
@@ -181,15 +198,15 @@ const result = await payload.update({
181
198
  ```js
182
199
  // Result will be the now-deleted Post document.
183
200
  const result = await payload.delete({
184
- collection: 'posts', // required
185
- id: '507f1f77bcf86cd799439011', // required
201
+ collection: "posts", // required
202
+ id: "507f1f77bcf86cd799439011", // required
186
203
  depth: 2,
187
- locale: 'en',
204
+ locale: "en",
188
205
  fallbackLocale: false,
189
206
  user: dummyUser,
190
207
  overrideAccess: false,
191
208
  showHiddenFields: true,
192
- })
209
+ });
193
210
  ```
194
211
 
195
212
  ## Auth Operations
@@ -207,19 +224,20 @@ If a collection has [`Authentication`](/docs/authentication/overview) enabled, a
207
224
  // }
208
225
 
209
226
  const result = await payload.login({
210
- collection: 'users', // required
211
- data: { // required
212
- email: 'dev@payloadcms.com',
213
- password: 'rip',
227
+ collection: "users", // required
228
+ data: {
229
+ // required
230
+ email: "dev@payloadcms.com",
231
+ password: "rip",
214
232
  },
215
233
  req: req, // pass an Express `req` which will be provided to all hooks
216
234
  res: res, // used to automatically set an HTTP-only auth cookie
217
235
  depth: 2,
218
- locale: 'en',
236
+ locale: "en",
219
237
  fallbackLocale: false,
220
238
  overrideAccess: false,
221
239
  showHiddenFields: true,
222
- })
240
+ });
223
241
  ```
224
242
 
225
243
  #### Forgot Password
@@ -227,12 +245,13 @@ const result = await payload.login({
227
245
  ```js
228
246
  // Returned token will allow for a password reset
229
247
  const token = await payload.forgotPassword({
230
- collection: 'users', // required
231
- data: { // required
232
- email: 'dev@payloadcms.com',
248
+ collection: "users", // required
249
+ data: {
250
+ // required
251
+ email: "dev@payloadcms.com",
233
252
  },
234
253
  req: req, // pass an Express `req` which will be provided to all hooks
235
- })
254
+ });
236
255
  ```
237
256
 
238
257
  #### Reset Password
@@ -244,13 +263,14 @@ const token = await payload.forgotPassword({
244
263
  // user: { ... } // the user document that just logged in
245
264
  // }
246
265
  const result = await payload.forgotPassword({
247
- collection: 'users', // required
248
- data: { // required
249
- token: 'afh3o2jf2p3f...', // the token generated from the forgotPassword operation
266
+ collection: "users", // required
267
+ data: {
268
+ // required
269
+ token: "afh3o2jf2p3f...", // the token generated from the forgotPassword operation
250
270
  },
251
271
  req: req, // pass an Express `req` which will be provided to all hooks
252
272
  res: res, // used to automatically set an HTTP-only auth cookie
253
- })
273
+ });
254
274
  ```
255
275
 
256
276
  #### Unlock
@@ -258,13 +278,14 @@ const result = await payload.forgotPassword({
258
278
  ```js
259
279
  // Returned result will be a boolean representing success or failure
260
280
  const result = await payload.unlock({
261
- collection: 'users', // required
262
- data: { // required
263
- email: 'dev@payloadcms.com',
281
+ collection: "users", // required
282
+ data: {
283
+ // required
284
+ email: "dev@payloadcms.com",
264
285
  },
265
286
  req: req, // pass an Express `req` which will be provided to all hooks
266
287
  overrideAccess: true,
267
- })
288
+ });
268
289
  ```
269
290
 
270
291
  #### Verify
@@ -272,9 +293,9 @@ const result = await payload.unlock({
272
293
  ```js
273
294
  // Returned result will be a boolean representing success or failure
274
295
  const result = await payload.verify({
275
- collection: 'users', // required
276
- token: 'afh3o2jf2p3f...', // the token saved on the user as `_verificationToken`
277
- })
296
+ collection: "users", // required
297
+ token: "afh3o2jf2p3f...", // the token saved on the user as `_verificationToken`
298
+ });
278
299
  ```
279
300
 
280
301
  ## Globals
@@ -286,14 +307,14 @@ The following Global operations are available through the Local API:
286
307
  ```js
287
308
  // Result will be the Header Global.
288
309
  const result = await payload.findGlobal({
289
- slug: 'header', // required
310
+ slug: "header", // required
290
311
  depth: 2,
291
- locale: 'en',
312
+ locale: "en",
292
313
  fallbackLocale: false,
293
314
  user: dummyUser,
294
315
  overrideAccess: false,
295
316
  showHiddenFields: true,
296
- })
317
+ });
297
318
  ```
298
319
 
299
320
  #### Update
@@ -301,44 +322,79 @@ const result = await payload.findGlobal({
301
322
  ```js
302
323
  // Result will be the updated Header Global.
303
324
  const result = await payload.updateGlobal({
304
- slug: 'header', // required
305
- data: { // required
325
+ slug: "header", // required
326
+ data: {
327
+ // required
306
328
  nav: [
307
329
  {
308
- url: 'https://google.com',
330
+ url: "https://google.com",
309
331
  },
310
332
  {
311
- url: 'https://payloadcms.com',
333
+ url: "https://payloadcms.com",
312
334
  },
313
335
  ],
314
336
  },
315
337
  depth: 2,
316
- locale: 'en',
338
+ locale: "en",
317
339
  fallbackLocale: false,
318
340
  user: dummyUser,
319
341
  overrideAccess: false,
320
342
  showHiddenFields: true,
321
- })
343
+ });
344
+ ```
345
+
346
+ ## Example Script using Local API
347
+
348
+ The Local API is especially useful for running scripts
349
+
350
+ ```ts
351
+ import payload from "payload";
352
+ import path from "path";
353
+ import dotenv from "dotenv";
354
+
355
+ dotenv.config({
356
+ path: path.resolve(__dirname, "../.env"),
357
+ });
358
+
359
+ const { PAYLOAD_SECRET, MONGODB_URI } = process.env;
360
+
361
+ const doAction = async (): Promise<void> => {
362
+ await payload.init({
363
+ secret: PAYLOAD_SECRET,
364
+ mongoURL: MONGODB_URI,
365
+ local: true, // Enables local mode, doesn't spin up a server or frontend
366
+ });
367
+
368
+ // Perform any Local API operations here
369
+ await payload.find({
370
+ collection: "posts",
371
+ // where: {} // optional
372
+ });
373
+
374
+ await payload.create({
375
+ collection: "posts",
376
+ data: {},
377
+ });
378
+ };
379
+
380
+ doAction();
322
381
  ```
323
382
 
324
383
  ## TypeScript
325
384
 
326
- 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).
385
+ Local API calls will automatically infer your [generated types](/docs/typescript/generating-types).
327
386
 
328
387
  Here is an example of usage:
329
388
 
330
389
  ```ts
331
- // Our generated types
332
- import { Post } from './payload-types'
333
-
334
- // Add Post types as generic to create function
335
- const post: Post = await payload.create<Post>({
336
- collection: 'posts',
390
+ // Properly inferred as `Post` type
391
+ const post = await payload.create({
392
+ collection: "posts",
337
393
 
338
394
  // Data will now be typed as Post and give you type hints
339
395
  data: {
340
- title: 'my title',
341
- description: 'my description',
396
+ title: "my title",
397
+ description: "my description",
342
398
  },
343
- })
399
+ });
344
400
  ```
@@ -47,7 +47,7 @@ Before running in Production, you need to have built a production-ready copy of
47
47
  {
48
48
  "name": "project-name-here",
49
49
  "scripts": {
50
- "build": "payload build",
50
+ "build": "payload build"
51
51
  },
52
52
  "dependencies": {
53
53
  // your dependencies
@@ -70,6 +70,8 @@ Payload comes with a robust set of built-in anti-abuse measures, such as locking
70
70
 
71
71
  ## MongoDB
72
72
 
73
+ Payload can be used with any MongoDB compatible database including AWS DocumentDB or Azure Cosmos DB.
74
+
73
75
  ##### Managing MongoDB yourself
74
76
 
75
77
  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.
@@ -78,10 +80,11 @@ If you are using a [persistent filesystem-based cloud host](#persistent-vs-ephem
78
80
 
79
81
  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.
80
82
 
81
- <Banner type="warning">
82
- <strong>Note regarding Azure Cosmos:</strong><br/>
83
- 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.
84
- </Banner>
83
+ ##### DocumentDB
84
+ 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.
85
+
86
+ ##### CosmosDB
87
+ 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.
85
88
 
86
89
  ## File storage
87
90