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.
Files changed (107) hide show
  1. package/CHANGELOG.md +40 -2
  2. package/components/fields/Array.ts +1 -2
  3. package/components/fields/Blocks.ts +1 -2
  4. package/components/fields/Cell.ts +1 -1
  5. package/components/fields/Checkbox.ts +1 -2
  6. package/components/fields/Code.ts +1 -2
  7. package/components/fields/DateTime.ts +1 -2
  8. package/components/fields/Email.ts +1 -2
  9. package/components/fields/Group.ts +1 -2
  10. package/components/fields/Number.ts +1 -2
  11. package/components/fields/Password.ts +1 -2
  12. package/components/fields/RadioGroup/RadioInput.ts +1 -2
  13. package/components/fields/RadioGroup/index.ts +1 -2
  14. package/components/fields/Relationship.ts +1 -2
  15. package/components/fields/RichText.ts +1 -2
  16. package/components/fields/Row.ts +1 -2
  17. package/components/fields/Select.ts +1 -2
  18. package/components/fields/Text.ts +1 -2
  19. package/components/fields/Textarea.ts +1 -2
  20. package/components/fields/Upload.ts +1 -2
  21. package/components/views/Cell.ts +1 -2
  22. package/components/views/Edit.ts +1 -2
  23. package/components/views/List.ts +1 -2
  24. package/dist/admin/components/elements/ReactSelect/index.js +3 -3
  25. package/dist/admin/components/elements/ReactSelect/types.d.ts +11 -10
  26. package/dist/admin/components/elements/Status/index.js +1 -1
  27. package/dist/admin/components/forms/Form/context.d.ts +15 -0
  28. package/dist/admin/components/forms/Form/context.js +16 -1
  29. package/dist/admin/components/forms/field-types/Blocks/SectionTitle/index.scss +3 -2
  30. package/dist/admin/components/forms/field-types/Blocks/index.js +1 -1
  31. package/dist/admin/components/forms/field-types/Code/Code.js +3 -4
  32. package/dist/admin/components/forms/field-types/Code/index.scss +177 -78
  33. package/dist/admin/components/forms/field-types/Relationship/AddNew/index.js +0 -1
  34. package/dist/admin/components/forms/field-types/Relationship/GetFilterOptions/index.d.ts +11 -0
  35. package/dist/admin/components/forms/field-types/Relationship/GetFilterOptions/index.js +37 -0
  36. package/dist/admin/components/forms/field-types/Relationship/findOptionsByValue.d.ts +8 -0
  37. package/dist/admin/components/forms/field-types/Relationship/findOptionsByValue.js +29 -0
  38. package/dist/admin/components/forms/field-types/Relationship/index.js +89 -139
  39. package/dist/admin/components/forms/field-types/Relationship/optionsReducer.d.ts +2 -2
  40. package/dist/admin/components/forms/field-types/Relationship/optionsReducer.js +2 -29
  41. package/dist/admin/components/forms/field-types/Relationship/types.d.ts +14 -2
  42. package/dist/admin/components/forms/field-types/RichText/elements/link/Element.js +3 -3
  43. package/dist/admin/components/forms/field-types/RichText/elements/link/index.scss +2 -1
  44. package/dist/admin/components/forms/field-types/RichText/elements/upload/Button/index.js +1 -1
  45. package/dist/admin/components/forms/field-types/Row/index.js +1 -1
  46. package/dist/admin/components/forms/field-types/Select/Input.d.ts +2 -2
  47. package/dist/admin/components/forms/useField/index.d.ts +5 -0
  48. package/dist/admin/components/forms/useField/index.js +5 -0
  49. package/dist/admin/components/utilities/I18n/index.js +1 -1
  50. package/dist/admin/components/views/Global/index.scss +31 -24
  51. package/dist/admin/components/views/collections/Edit/index.scss +19 -4
  52. package/dist/collections/buildSchema.js +5 -1
  53. package/dist/collections/config/types.d.ts +16 -3
  54. package/dist/collections/operations/find.js +11 -6
  55. package/dist/collections/operations/findVersions.js +4 -5
  56. package/dist/collections/operations/update.js +8 -9
  57. package/dist/collections/requestHandlers/find.js +4 -3
  58. package/dist/config/schema.js +2 -2
  59. package/dist/config/types.d.ts +269 -6
  60. package/dist/config/types.js +1 -1
  61. package/dist/email/build.js +2 -2
  62. package/dist/express/types.d.ts +26 -2
  63. package/dist/fields/config/sanitize.spec.js +5 -5
  64. package/dist/fields/config/types.d.ts +3 -3
  65. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.js +73 -21
  66. package/dist/globals/operations/findVersions.js +4 -5
  67. package/dist/globals/operations/update.js +4 -4
  68. package/dist/graphql/schema/fieldToWhereInputSchemaMap.js +7 -7
  69. package/dist/graphql/schema/operators.d.ts +1 -0
  70. package/dist/graphql/schema/operators.js +2 -1
  71. package/dist/mongoose/types.d.ts +3 -3
  72. package/dist/translations/de.json +100 -100
  73. package/dist/translations/en.json +1 -1
  74. package/dist/translations/es.json +1 -1
  75. package/dist/translations/fr.json +1 -1
  76. package/dist/translations/it.json +1 -1
  77. package/dist/translations/my.json +1 -1
  78. package/dist/translations/nl.json +1 -1
  79. package/dist/translations/pl.json +1 -1
  80. package/dist/translations/pt.json +1 -1
  81. package/dist/translations/ru.json +1 -1
  82. package/dist/translations/sv.json +1 -1
  83. package/dist/translations/vi.json +1 -1
  84. package/dist/utilities/isNumber.d.ts +1 -0
  85. package/dist/utilities/isNumber.js +8 -0
  86. package/dist/versions/getLatestCollectionVersion.d.ts +10 -0
  87. package/dist/versions/getLatestCollectionVersion.js +27 -0
  88. package/dist/versions/getLatestGlobalVersion.d.ts +10 -0
  89. package/dist/versions/getLatestGlobalVersion.js +27 -0
  90. package/docs/admin/components.mdx +1 -5
  91. package/docs/configuration/globals.mdx +12 -12
  92. package/docs/fields/array.mdx +14 -14
  93. package/docs/fields/blocks.mdx +1 -1
  94. package/docs/fields/checkbox.mdx +2 -2
  95. package/docs/fields/code.mdx +1 -1
  96. package/docs/fields/date.mdx +1 -1
  97. package/docs/fields/email.mdx +1 -1
  98. package/docs/fields/number.mdx +1 -1
  99. package/docs/fields/radio.mdx +1 -1
  100. package/docs/fields/relationship.mdx +1 -1
  101. package/docs/fields/rich-text.mdx +1 -1
  102. package/docs/fields/select.mdx +2 -2
  103. package/docs/fields/text.mdx +2 -2
  104. package/docs/fields/textarea.mdx +1 -1
  105. package/docs/fields/upload.mdx +51 -17
  106. package/docs/production/preventing-abuse.mdx +6 -6
  107. package/package.json +3 -2
@@ -48,14 +48,16 @@ export declare function hasTransportOptions(emailConfig: EmailOptions): emailCon
48
48
  export declare type InitOptions = {
49
49
  /** Express app for Payload to use */
50
50
  express?: Express;
51
+ /** Mongo connection URL, starts with `mongo` */
51
52
  mongoURL: string | false;
53
+ /** Extra configuration options that will be passed to Mongo */
52
54
  mongoOptions?: ConnectOptions;
53
55
  /** Secure string that Payload will use for any encryption workflows */
54
56
  secret: string;
55
57
  /**
56
58
  * Configuration for Payload's email functionality
57
59
  *
58
- * https://payloadcms.com/docs/email/overview
60
+ * @see https://payloadcms.com/docs/email/overview
59
61
  */
60
62
  email?: EmailOptions;
61
63
  /**
@@ -76,23 +78,65 @@ export declare type InitOptions = {
76
78
  */
77
79
  loggerOptions?: LoggerOptions;
78
80
  };
81
+ /**
82
+ * This result is calculated on the server
83
+ * and then sent to the client allowing the dashboard to show accessible data and actions.
84
+ *
85
+ * If the result is `true`, the user has access.
86
+ * If the result is an object, it is interpreted as a Mongo query.
87
+ *
88
+ * @example `{ createdBy: { equals: id } }`
89
+ *
90
+ * @example `{ tenant: { in: tenantIds } }`
91
+ *
92
+ * @see https://payloadcms.com/docs/access-control/overview
93
+ */
79
94
  export declare type AccessResult = boolean | Where;
80
95
  declare type AccessArgs<T = any, U = any> = {
96
+ /** The original request that requires an access check */
81
97
  req: PayloadRequest<U>;
98
+ /** ID of the resource being accessed */
82
99
  id?: string | number;
100
+ /**
101
+ * The relevant resource that is being accessed.
102
+ *
103
+ * `data` is null when a list is requested
104
+ */
83
105
  data?: T;
84
106
  };
85
107
  /**
86
- * Access function
108
+ * Access function runs on the server
109
+ * and is sent to the client allowing the dashboard to show accessible data and actions.
110
+ *
111
+ * @see https://payloadcms.com/docs/access-control/overview
87
112
  */
88
113
  export declare type Access<T = any, U = any> = (args: AccessArgs<T, U>) => AccessResult | Promise<AccessResult>;
114
+ /** Equivalent to express middleware, but with an enhanced request object */
89
115
  export interface PayloadHandler {
90
116
  (req: PayloadRequest, res: Response, next: NextFunction): void;
91
117
  }
118
+ /**
119
+ * Docs: https://payloadcms.com/docs/rest-api/overview#custom-endpoints
120
+ */
92
121
  export declare type Endpoint = {
122
+ /**
123
+ * Pattern that should match the path of the incoming request
124
+ *
125
+ * Compatible with the Express router
126
+ */
93
127
  path: string;
128
+ /** HTTP method (or "all") */
94
129
  method: 'get' | 'head' | 'post' | 'put' | 'patch' | 'delete' | 'connect' | 'options' | string;
130
+ /**
131
+ * Middleware that will be called when the path/method matches
132
+ *
133
+ * Compatible with Express middleware
134
+ */
95
135
  handler: PayloadHandler | PayloadHandler[];
136
+ /**
137
+ * Set to `true` to disable the Payload middleware for this endpoint
138
+ * @default false
139
+ */
96
140
  root?: boolean;
97
141
  };
98
142
  export declare type AdminView = React.ComponentType<{
@@ -102,82 +146,232 @@ export declare type AdminView = React.ComponentType<{
102
146
  export declare type AdminRoute = {
103
147
  Component: AdminView;
104
148
  path: string;
149
+ /** Whether the path should be matched exactly or as a prefix */
105
150
  exact?: boolean;
106
151
  strict?: boolean;
107
152
  sensitive?: boolean;
108
153
  };
154
+ /**
155
+ * @see https://payloadcms.com/docs/configuration/localization#localization
156
+ */
109
157
  export declare type LocalizationConfig = {
158
+ /**
159
+ * List of supported locales
160
+ * @exanple `["en", "es", "fr", "nl", "de", "jp"]`
161
+ */
110
162
  locales: string[];
163
+ /**
164
+ * Locale for users that have not expressed their preference for a specific locale
165
+ * @exanple `"en"`
166
+ */
111
167
  defaultLocale: string;
168
+ /** Set to `true` to let missing values in localised fields fall back to the values in `defaultLocale` */
112
169
  fallback?: boolean;
113
170
  };
171
+ /**
172
+ * This is the central configuration
173
+ *
174
+ * @see https://payloadcms.com/docs/configuration/overview
175
+ */
114
176
  export declare type Config = {
177
+ /** Configure admin dashboard */
115
178
  admin?: {
179
+ /** The slug of a Collection that you want be used to log in to the Admin dashboard. */
116
180
  user?: string;
181
+ /** Base meta data to use for the Admin panel. Included properties are titleSuffix, ogImage, and favicon. */
117
182
  meta?: {
183
+ /**
184
+ * String to append to the <title> of admin pages
185
+ * @example `" - My Brand"`
186
+ */
118
187
  titleSuffix?: string;
188
+ /**
189
+ * Public path to an image
190
+ *
191
+ * This image may be displayed as preview when the link is shared on social media
192
+ */
119
193
  ogImage?: string;
194
+ /**
195
+ * Public path to an icon
196
+ *
197
+ * This image may be displayed in the browser next to the title of the page
198
+ */
120
199
  favicon?: string;
121
200
  };
201
+ /** If set to true, the entire Admin panel will be disabled. */
122
202
  disable?: boolean;
203
+ /** Replace the entirety of the index.html file used by the Admin panel. Reference the base index.html file to ensure your replacement has the appropriate HTML elements. */
123
204
  indexHTML?: string;
205
+ /** Absolute path to a stylesheet that you can use to override / customize the Admin panel styling. */
124
206
  css?: string;
207
+ /** Global date format that will be used for all dates in the Admin panel. Any valid date-fns format pattern can be used. */
125
208
  dateFormat?: string;
209
+ /** Set account profile picture. Options: gravatar, default or a custom React component. */
126
210
  avatar?: 'default' | 'gravatar' | React.ComponentType<any>;
211
+ /** The route for the logout page. */
127
212
  logoutRoute?: string;
213
+ /** The route the user will be redirected to after being inactive for too long. */
128
214
  inactivityRoute?: string;
215
+ /**
216
+ * Add extra and/or replace built-in components with custom components
217
+ *
218
+ * @see https://payloadcms.com/docs/admin/components
219
+ */
129
220
  components?: {
221
+ /**
222
+ * Add custom routes in the admin dashboard
223
+ */
130
224
  routes?: AdminRoute[];
225
+ /**
226
+ * Wrap the admin dashboard in custom context providers
227
+ */
131
228
  providers?: React.ComponentType<{
132
229
  children: React.ReactNode;
133
230
  }>[];
231
+ /**
232
+ * Add custom components before the collection overview
233
+ */
134
234
  beforeDashboard?: React.ComponentType<any>[];
235
+ /**
236
+ * Add custom components after the collection overview
237
+ */
135
238
  afterDashboard?: React.ComponentType<any>[];
239
+ /**
240
+ * Add custom components before the email/password field
241
+ */
136
242
  beforeLogin?: React.ComponentType<any>[];
243
+ /**
244
+ * Add custom components after the email/password field
245
+ */
137
246
  afterLogin?: React.ComponentType<any>[];
247
+ /**
248
+ * Add custom components before the navigation links
249
+ */
138
250
  beforeNavLinks?: React.ComponentType<any>[];
251
+ /**
252
+ * Add custom components after the navigation links
253
+ */
139
254
  afterNavLinks?: React.ComponentType<any>[];
255
+ /**
256
+ * Replace the navigation with a custom component
257
+ */
140
258
  Nav?: React.ComponentType<any>;
259
+ /** Replace logout related components */
141
260
  logout?: {
261
+ /** Replace the logout button */
142
262
  Button?: React.ComponentType<any>;
143
263
  };
264
+ /** Replace graphical components */
144
265
  graphics?: {
266
+ /** Replace the icon in the navigation */
145
267
  Icon?: React.ComponentType<any>;
268
+ /** Replace the logo on the login page */
146
269
  Logo?: React.ComponentType<any>;
270
+ v: any;
147
271
  };
148
272
  views?: {
273
+ /** Replace the account screen */
149
274
  Account?: React.ComponentType<any>;
275
+ /** Replace the admin homepage */
150
276
  Dashboard?: React.ComponentType<any>;
277
+ v: any;
151
278
  };
152
279
  };
280
+ /**
281
+ * Control pagination when querying collections.
282
+ *
283
+ * @see https://payloadcms.com/docs/queries/overview
284
+ */
153
285
  pagination?: {
286
+ /**
287
+ * Limit the number of documents that are displayed on 1 page in the list view
288
+ *
289
+ * @default 10
290
+ */
154
291
  defaultLimit?: number;
155
- options?: number[];
292
+ /**
293
+ * Suggest alternative options for the limit of documents on the list view
294
+ *
295
+ * @default [5, 10, 25, 50, 100]
296
+ */
297
+ limits?: number[];
156
298
  };
299
+ /** Customize the Webpack config that's used to generate the Admin panel. */
157
300
  webpack?: (config: Configuration) => Configuration;
158
301
  };
302
+ /**
303
+ * Manage the datamodel of your application
304
+ *
305
+ * @see https://payloadcms.com/docs/configuration/collections#collection-configs
306
+ */
159
307
  collections?: CollectionConfig[];
308
+ /** Custom REST endpoints */
160
309
  endpoints?: Endpoint[];
310
+ /**
311
+ * @see https://payloadcms.com/docs/configuration/globals#global-configs
312
+ */
161
313
  globals?: GlobalConfig[];
314
+ /**
315
+ * Control the behaviour of the admin internationalisation.
316
+ *
317
+ * See i18next options.
318
+ *
319
+ * @default
320
+ * {
321
+ * fallbackLng: 'en',
322
+ * debug: false,
323
+ * supportedLngs: Object.keys(translations),
324
+ * resources: translations,
325
+ * }
326
+ */
162
327
  i18n?: i18nInitOptions;
328
+ /**
329
+ * Define the absolute URL of your app including the protocol, for example `https://example.org`.
330
+ * No paths allowed, only protocol, domain and (optionally) port.
331
+ *
332
+ * @see https://payloadcms.com/docs/configuration/overview#options
333
+ */
163
334
  serverURL?: string;
335
+ /**
336
+ * Prefix a string to all cookies that Payload sets.
337
+ *
338
+ * @default "payload"
339
+ */
164
340
  cookiePrefix?: string;
341
+ /** A whitelist array of URLs to allow Payload cookies to be accepted from as a form of CSRF protection. */
165
342
  csrf?: string[];
343
+ /** Either a whitelist array of URLS to allow CORS requests from, or a wildcard string ('*') to accept incoming requests from any domain. */
166
344
  cors?: string[] | '*';
345
+ /** Control the routing structure that Payload binds itself to. */
167
346
  routes?: {
347
+ /** Defaults to /api */
168
348
  api?: string;
349
+ /** Defaults to /admin */
169
350
  admin?: string;
351
+ /** Defaults to /graphql */
170
352
  graphQL?: string;
353
+ /** Defaults to /playground */
171
354
  graphQLPlayground?: string;
172
355
  };
356
+ /** Control how typescript interfaces are generated from your collections. */
173
357
  typescript?: {
358
+ /** Filename to write the generated types to */
174
359
  outputFile?: string;
175
360
  };
361
+ /** Enable to expose more detailed error information. */
176
362
  debug?: boolean;
363
+ /**
364
+ * Express-specific middleware options such as compression and JSON parsing.
365
+ *
366
+ * @see https://payloadcms.com/docs/configuration/express
367
+ */
177
368
  express?: {
369
+ /** Control the way JSON is parsed */
178
370
  json?: {
371
+ /** Defaults to 2MB */
179
372
  limit?: number;
180
373
  };
374
+ /** Control the way responses are compressed */
181
375
  compression?: {
182
376
  [key: string]: unknown;
183
377
  };
@@ -188,34 +382,103 @@ export declare type Config = {
188
382
  preMiddleware?: any[];
189
383
  postMiddleware?: any[];
190
384
  };
385
+ /**
386
+ * If a user does not specify `depth` while requesting a resource, this depth will be used.
387
+ *
388
+ * @see https://payloadcms.com/docs/getting-started/concepts#depth
389
+ *
390
+ * @default 2
391
+ */
191
392
  defaultDepth?: number;
393
+ /**
394
+ * The maximum allowed depth to be permitted application-wide. This setting helps prevent against malicious queries.
395
+ *
396
+ * @see https://payloadcms.com/docs/getting-started/concepts#depth
397
+ *
398
+ * @default 10
399
+ */
192
400
  maxDepth?: number;
401
+ /**
402
+ * The maximum allowed depth to be permitted application-wide. This setting helps prevent against malicious queries.
403
+ *
404
+ * @default 40000
405
+ */
193
406
  defaultMaxTextLength?: number;
407
+ /** Automatically index all sortable top-level fields in the database to improve sort performance and add database compatibility for Azure Cosmos and similar. */
194
408
  indexSortableFields?: boolean;
409
+ /**
410
+ * Limit heavy usage
411
+ *
412
+ * @default
413
+ * {
414
+ * window: 15 * 60 * 100, // 1.5 minutes,
415
+ * max: 500,
416
+ * }
417
+ */
195
418
  rateLimit?: {
196
419
  window?: number;
197
420
  max?: number;
198
421
  trustProxy?: boolean;
199
422
  skip?: (req: PayloadRequest) => boolean;
200
423
  };
424
+ /**
425
+ * Customize the handling of incoming file uploads for collections that have uploads enabled.
426
+ */
201
427
  upload?: Options;
428
+ /**
429
+ * Translate your content to different languages/locales.
430
+ *
431
+ * @default false // disable localization
432
+ */
202
433
  localization?: LocalizationConfig | false;
434
+ /**
435
+ * Manage the GraphQL API
436
+ *
437
+ * You can add your own GraphQL queries and mutations to Payload, making use of all the types that Payload has defined for you.
438
+ *
439
+ * @see https://payloadcms.com/docs/access-control/overview
440
+ */
203
441
  graphQL?: {
204
- mutations?: ((graphQL: typeof GraphQL, payload: Payload) => Record<string, unknown>);
205
- queries?: ((graphQL: typeof GraphQL, payload: Payload) => Record<string, unknown>);
442
+ /**
443
+ * Function that returns an object containing keys to custom GraphQL mutations
444
+ *
445
+ * @see https://payloadcms.com/docs/access-control/overview
446
+ */
447
+ mutations?: (graphQL: typeof GraphQL, payload: Payload) => Record<string, unknown>;
448
+ /**
449
+ * Function that returns an object containing keys to custom GraphQL queries
450
+ *
451
+ * @see https://payloadcms.com/docs/access-control/overview
452
+ */
453
+ queries?: (graphQL: typeof GraphQL, payload: Payload) => Record<string, unknown>;
206
454
  maxComplexity?: number;
207
455
  disablePlaygroundInProduction?: boolean;
208
456
  disable?: boolean;
209
457
  schemaOutputFile?: string;
210
458
  };
459
+ /**
460
+ * Replace the built-in components with custom ones
461
+ */
211
462
  components?: {
212
463
  [key: string]: JSX.Element | (() => JSX.Element);
213
464
  };
465
+ /**
466
+ * Tap into Payload-wide hooks.
467
+ *
468
+ * @see https://payloadcms.com/docs/hooks/overview
469
+ */
214
470
  hooks?: {
215
471
  afterError?: AfterErrorHook;
216
472
  };
473
+ /**
474
+ * An array of Payload plugins.
475
+ *
476
+ * @see https://payloadcms.com/docs/plugins/overview
477
+ */
217
478
  plugins?: Plugin[];
479
+ /** Send anonymous telemetry data about general usage. */
218
480
  telemetry?: boolean;
481
+ /** A function that is called immediately following startup that receives the Payload instance as its only argument. */
219
482
  onInit?: (payload: Payload) => Promise<void> | void;
220
483
  };
221
484
  export declare type SanitizedConfig = Omit<DeepRequired<Config>, 'collections' | 'globals'> & {
@@ -225,5 +488,5 @@ export declare type SanitizedConfig = Omit<DeepRequired<Config>, 'collections' |
225
488
  [key: string]: string;
226
489
  };
227
490
  };
228
- export declare type EntityDescription = string | Record<string, string> | (() => string) | React.ComponentType<any>;
491
+ export declare type EntityDescription = string | (() => string) | React.ComponentType<any>;
229
492
  export {};
@@ -17,4 +17,4 @@ function hasTransportOptions(emailConfig) {
17
17
  return emailConfig.transportOptions !== undefined;
18
18
  }
19
19
  exports.hasTransportOptions = hasTransportOptions;
20
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uZmlnL3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQThDQTs7O0dBR0c7QUFDSCxTQUFnQixZQUFZLENBQUMsV0FBeUI7SUFDcEQsT0FBUSxXQUE4QixDQUFDLFNBQVMsS0FBSyxTQUFTLENBQUM7QUFDakUsQ0FBQztBQUZELG9DQUVDO0FBRUQ7OztHQUdHO0FBQ0gsU0FBZ0IsbUJBQW1CLENBQUMsV0FBeUI7SUFDM0QsT0FBUSxXQUFxQyxDQUFDLGdCQUFnQixLQUFLLFNBQVMsQ0FBQztBQUMvRSxDQUFDO0FBRkQsa0RBRUMifQ==
20
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uZmlnL3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQXFEQTs7O0dBR0c7QUFDSCxTQUFnQixZQUFZLENBQzFCLFdBQXlCO0lBRXpCLE9BQVEsV0FBOEIsQ0FBQyxTQUFTLEtBQUssU0FBUyxDQUFDO0FBQ2pFLENBQUM7QUFKRCxvQ0FJQztBQUVEOzs7R0FHRztBQUNILFNBQWdCLG1CQUFtQixDQUNqQyxXQUF5QjtJQUV6QixPQUFRLFdBQXFDLENBQUMsZ0JBQWdCLEtBQUssU0FBUyxDQUFDO0FBQy9FLENBQUM7QUFKRCxrREFJQyJ9
@@ -12,7 +12,7 @@ async function handleTransport(transport, email, logger) {
12
12
  await transport.verify();
13
13
  }
14
14
  catch (err) {
15
- logger.error('There is an error with the email configuration you have provided.', err);
15
+ logger.error(`There is an error with the email configuration you have provided. ${err.message}`);
16
16
  }
17
17
  return { ...email, transport };
18
18
  }
@@ -54,4 +54,4 @@ async function buildEmail(emailConfig, logger) {
54
54
  return handleMockAccount(emailConfig, logger);
55
55
  }
56
56
  exports.default = buildEmail;
57
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZW1haWwvYnVpbGQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSw0REFBcUQ7QUFFckQsMkNBQWtHO0FBQ2xHLHNDQUFpRDtBQUNqRCxnRUFBd0M7QUFHeEMsS0FBSyxVQ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DQUFDLElBQUksV0FBVyxDQUFDLGdCQUFnQixFQUFFO1FBQ3BFLG1CQUFtQixDQUFDLFdBQVcsQ0FBQyxDQUFDO1FBQ2pDLE1BQU0sS0FBSyxHQUFHLEVBQUUsR0FBRyxXQUFXLEVBQW9CLENBQUM7UUFDbkQsTUFBTSxTQUFTLEdBQUcsb0JBQVUsQ0FBQyxlQUFlLENBQUMsV0FBVyxDQUFDLGdCQUFnQixDQUFDLENBQUM7UUFDM0UsT0FBTyxlQUFlLENBQUMsU0FBUyxFQUFFLEtBQUssRUFBRSxNQUFNLENBQUMsQ0FBQztLQUNsRDtJQUVELE9BQU8saUJBQWlCLENBQUMsV0FBVyxFQUFFLE1BQU0sQ0FBQyxDQUFDO0FBQ2hELENBQUM7QUFoQkQsNkJBZ0JDIn0=
@@ -8,20 +8,44 @@ import { Collection } from '../collections/config/types';
8
8
  import { User } from '../auth/types';
9
9
  import { Document } from '../types';
10
10
  import { TypeWithID } from '../globals/config/types';
11
- export declare type PayloadRequest<T = any> = Request & {
11
+ /** Express request with some Payload related context added */
12
+ export declare type PayloadRequest<U = any> = Request & {
13
+ /** The global payload object */
12
14
  payload: Payload;
15
+ /** Optimized document loader */
13
16
  payloadDataLoader: DataLoader<string, TypeWithID>;
17
+ /**
18
+ * The requested locale if specified
19
+ * Only available for localised collections
20
+ */
14
21
  locale?: string;
22
+ /** The locale that should be used for a field when it is not translated to the requested locale */
15
23
  fallbackLocale?: string;
24
+ /** Information about the collection that is being accessed
25
+ * - Configuration from payload-config.ts
26
+ * - Mongo model for this collection
27
+ * - GraphQL type metadata
28
+ * */
16
29
  collection?: Collection;
30
+ /** What triggered this request */
17
31
  payloadAPI: 'REST' | 'local' | 'graphQL';
32
+ /** Uploaded files */
18
33
  files?: {
34
+ /**
35
+ * This is the file that Payload will use for the file upload, other files are ignored.
36
+ *
37
+ */
19
38
  file: UploadedFile;
20
39
  };
40
+ /** I18next instance */
21
41
  i18n: Ii18n;
42
+ /** Get a translation for the admin screen */
22
43
  t: TFunction;
23
- user: T & User | null;
44
+ /** The signed in user */
45
+ user: (U & User) | null;
46
+ /** Resized versions of the image that was uploaded during this request */
24
47
  payloadUploadSizes?: Record<string, Buffer>;
48
+ /** Cache of documents related to the current request */
25
49
  findByID?: {
26
50
  [slug: string]: (q: unknown) => Document;
27
51
  };
@@ -19,13 +19,13 @@ describe('sanitizeFields', () => {
19
19
  (0, sanitize_1.default)(fields, []);
20
20
  }).toThrow(errors_1.MissingFieldType);
21
21
  });
22
- it("should throw on invalid field name", () => {
22
+ it('should throw on invalid field name', () => {
23
23
  const fields = [
24
24
  {
25
- label: "some.collection",
26
- name: "some.collection",
27
- type: "text",
28
- }
25
+ label: 'some.collection',
26
+ name: 'some.collection',
27
+ type: 'text',
28
+ },
29
29
  ];
30
30
  expect(() => {
31
31
  (0, sanitize_1.default)(fields, []);
@@ -39,14 +39,14 @@ export declare type FieldAccess<T extends TypeWithID = any, P = any, U = any> =
39
39
  doc?: T;
40
40
  }) => Promise<boolean> | boolean;
41
41
  export declare type Condition<T extends TypeWithID = any, P = any> = (data: Partial<T>, siblingData: Partial<P>) => boolean;
42
- export declare type FilterOptionsProps = {
42
+ export declare type FilterOptionsProps<T = any> = {
43
43
  id: string | number;
44
44
  user: Partial<User>;
45
- data: unknown;
45
+ data: T;
46
46
  siblingData: unknown;
47
47
  relationTo: string | string[];
48
48
  };
49
- export declare type FilterOptions = Where | ((options: FilterOptionsProps) => Where);
49
+ export declare type FilterOptions<T = any> = Where | ((options: FilterOptionsProps<T>) => Where);
50
50
  declare type Admin = {
51
51
  position?: 'sidebar';
52
52
  width?: string;