-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.ts
61 lines (51 loc) · 1.65 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { CollectionSlug, GlobalSlug } from "payload";
/**
* Represents the label for audit fields, which can be:
* 1. A string e.g. 'Created by'.
* 2. An object mapping locales to localized labels e.g. { en: 'Created by', it: 'Creato da' }.
* 3. A function that takes the collection/global slug and returns a label or localized labels.
*/
export type AuditFieldLabel =
| string
| Record<string, string>
| ((slug: string) => string | Record<string, string>);
export type AuditFieldsPluginOptions = {
/**
* Enables or disables the plugin. Defaults to true.
*/
enabled?: boolean;
/**
* Collections where audit fields should not be applied.
*/
excludedCollections?: CollectionSlug[];
/**
* Globals where audit fields should not be applied.
*/
excludedGlobals?: GlobalSlug[];
/**
* Field name for the "created by" field. Defaults to 'createdBy'.
*/
createdByFieldName?: string;
/**
* Field name for the "last modified by" field. Defaults to 'lastModifiedBy'.
*/
lastModifiedByFieldName?: string;
/**
* Label for the "created by" field. Defaults to 'Created by'.
* Can be a string, an object mapping locales to localized labels, or a function.
*/
createdByLabel?: AuditFieldLabel;
/**
* Label for the "last modified by" field. Defaults to 'Last modified by'.
* Can be a string, an object mapping locales to localized labels, or a function.
*/
lastModifiedByLabel?: AuditFieldLabel;
/**
* Whether to display audit fields in the sidebar. Defaults to true.
*/
showInSidebar?: boolean;
/**
* Whether to display empty fields. Defaults to false.
*/
showEmptyFields?: boolean;
};