founder-schema 0.8.0 → 0.10.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.
- package/README.md +68 -0
- package/dist/access/capabilities.d.ts +34 -0
- package/dist/access/capabilities.d.ts.map +1 -0
- package/dist/access/capabilities.js +35 -0
- package/dist/access/capabilities.js.map +1 -0
- package/dist/access/permissions.d.ts +20 -1
- package/dist/access/permissions.d.ts.map +1 -1
- package/dist/access/permissions.js +4 -0
- package/dist/access/permissions.js.map +1 -1
- package/dist/core/common.d.ts +8 -0
- package/dist/core/common.d.ts.map +1 -1
- package/dist/core/common.js +10 -1
- package/dist/core/common.js.map +1 -1
- package/dist/core/errors.d.ts +33 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +57 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/limits.d.ts +12 -0
- package/dist/core/limits.d.ts.map +1 -1
- package/dist/core/limits.js +13 -0
- package/dist/core/limits.js.map +1 -1
- package/dist/core/responses.d.ts +47 -0
- package/dist/core/responses.d.ts.map +1 -1
- package/dist/core/responses.js +7 -0
- package/dist/core/responses.js.map +1 -1
- package/dist/core/validation.d.ts +6 -0
- package/dist/core/validation.d.ts.map +1 -1
- package/dist/core/validation.js +6 -0
- package/dist/core/validation.js.map +1 -1
- package/dist/domains/audit/audit.d.ts +47 -3
- package/dist/domains/audit/audit.d.ts.map +1 -1
- package/dist/domains/audit/audit.js +40 -4
- package/dist/domains/audit/audit.js.map +1 -1
- package/dist/domains/communities/communities.d.ts +1537 -0
- package/dist/domains/communities/communities.d.ts.map +1 -0
- package/dist/domains/communities/communities.js +464 -0
- package/dist/domains/communities/communities.js.map +1 -0
- package/dist/domains/contributions/contributions.d.ts +53 -4
- package/dist/domains/contributions/contributions.d.ts.map +1 -1
- package/dist/domains/contributions/contributions.js +39 -5
- package/dist/domains/contributions/contributions.js.map +1 -1
- package/dist/domains/feed/feed.d.ts +479 -0
- package/dist/domains/feed/feed.d.ts.map +1 -1
- package/dist/domains/feed/feed.js +45 -1
- package/dist/domains/feed/feed.js.map +1 -1
- package/dist/domains/media/media.d.ts +7 -1
- package/dist/domains/media/media.d.ts.map +1 -1
- package/dist/domains/media/media.js +5 -0
- package/dist/domains/media/media.js.map +1 -1
- package/dist/domains/members/members.d.ts +6 -0
- package/dist/domains/members/members.d.ts.map +1 -1
- package/dist/domains/members/members.js +5 -0
- package/dist/domains/members/members.js.map +1 -1
- package/dist/domains/moderation/moderation.d.ts +4 -4
- package/dist/domains/notifications/notifications.d.ts +82 -2
- package/dist/domains/notifications/notifications.d.ts.map +1 -1
- package/dist/domains/notifications/notifications.js +45 -0
- package/dist/domains/notifications/notifications.js.map +1 -1
- package/dist/domains/onboarding/onboarding.d.ts +11 -11
- package/dist/domains/onboarding/onboarding.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding.js +2 -2
- package/dist/domains/onboarding/onboarding.js.map +1 -1
- package/dist/domains/profile/founder-profile.d.ts +60 -4
- package/dist/domains/profile/founder-profile.d.ts.map +1 -1
- package/dist/domains/profile/founder-profile.js +66 -5
- package/dist/domains/profile/founder-profile.js.map +1 -1
- package/dist/domains/team/team.d.ts +22 -0
- package/dist/domains/team/team.d.ts.map +1 -1
- package/dist/domains/team/team.js +22 -0
- package/dist/domains/team/team.js.map +1 -1
- package/dist/domains/uploads/uploads.d.ts +1 -0
- package/dist/domains/uploads/uploads.d.ts.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* @module founder-schema/domains/audit
|
|
23
23
|
*/
|
|
24
24
|
import { z } from 'zod';
|
|
25
|
-
export declare const AUDIT_ACTION_VALUES: readonly ["role.granted", "role.revoked", "mpin.cleared", "content.removed", "content.hidden", "content.restored", "report.dismissed", "member.suspended", "member.unsuspended", "ticket.claimed", "ticket.resolved"];
|
|
25
|
+
export declare const AUDIT_ACTION_VALUES: readonly ["role.granted", "role.revoked", "mpin.cleared", "content.removed", "content.hidden", "content.restored", "report.dismissed", "member.suspended", "member.unsuspended", "ticket.claimed", "ticket.resolved", "capability.granted", "capability.revoked", "community.created", "community.visibility_changed", "community.archived", "community.restored", "community.deleted", "community_suggestion.declined", "community.orphaned"];
|
|
26
26
|
export declare const auditActionSchema: z.ZodEnum<{
|
|
27
27
|
"role.granted": "role.granted";
|
|
28
28
|
"role.revoked": "role.revoked";
|
|
@@ -35,11 +35,21 @@ export declare const auditActionSchema: z.ZodEnum<{
|
|
|
35
35
|
"member.unsuspended": "member.unsuspended";
|
|
36
36
|
"ticket.claimed": "ticket.claimed";
|
|
37
37
|
"ticket.resolved": "ticket.resolved";
|
|
38
|
+
"capability.granted": "capability.granted";
|
|
39
|
+
"capability.revoked": "capability.revoked";
|
|
40
|
+
"community.created": "community.created";
|
|
41
|
+
"community.visibility_changed": "community.visibility_changed";
|
|
42
|
+
"community.archived": "community.archived";
|
|
43
|
+
"community.restored": "community.restored";
|
|
44
|
+
"community.deleted": "community.deleted";
|
|
45
|
+
"community_suggestion.declined": "community_suggestion.declined";
|
|
46
|
+
"community.orphaned": "community.orphaned";
|
|
38
47
|
}>;
|
|
39
48
|
export type AuditAction = z.infer<typeof auditActionSchema>;
|
|
40
49
|
/**
|
|
41
|
-
* Who did it. A person, acting as one of their roles;
|
|
42
|
-
* is the only way a superadmin is ever made.
|
|
50
|
+
* Who did it. A person, acting as one of their roles; a server script, which
|
|
51
|
+
* is the only way a superadmin is ever made; or (0.9.0) a member acting in a
|
|
52
|
+
* community they run, who is not staff.
|
|
43
53
|
*/
|
|
44
54
|
export declare const auditActorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
45
55
|
kind: z.ZodLiteral<"staff">;
|
|
@@ -55,6 +65,10 @@ export declare const auditActorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
55
65
|
}, z.core.$strip>, z.ZodObject<{
|
|
56
66
|
kind: z.ZodLiteral<"script">;
|
|
57
67
|
name: z.ZodString;
|
|
68
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
69
|
+
kind: z.ZodLiteral<"member">;
|
|
70
|
+
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
71
|
+
displayName: z.ZodString;
|
|
58
72
|
}, z.core.$strip>], "kind">;
|
|
59
73
|
export type AuditActor = z.infer<typeof auditActorSchema>;
|
|
60
74
|
export declare const auditEntrySchema: z.ZodObject<{
|
|
@@ -73,6 +87,10 @@ export declare const auditEntrySchema: z.ZodObject<{
|
|
|
73
87
|
}, z.core.$strip>, z.ZodObject<{
|
|
74
88
|
kind: z.ZodLiteral<"script">;
|
|
75
89
|
name: z.ZodString;
|
|
90
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
91
|
+
kind: z.ZodLiteral<"member">;
|
|
92
|
+
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
93
|
+
displayName: z.ZodString;
|
|
76
94
|
}, z.core.$strip>], "kind">;
|
|
77
95
|
action: z.ZodEnum<{
|
|
78
96
|
"role.granted": "role.granted";
|
|
@@ -86,6 +104,15 @@ export declare const auditEntrySchema: z.ZodObject<{
|
|
|
86
104
|
"member.unsuspended": "member.unsuspended";
|
|
87
105
|
"ticket.claimed": "ticket.claimed";
|
|
88
106
|
"ticket.resolved": "ticket.resolved";
|
|
107
|
+
"capability.granted": "capability.granted";
|
|
108
|
+
"capability.revoked": "capability.revoked";
|
|
109
|
+
"community.created": "community.created";
|
|
110
|
+
"community.visibility_changed": "community.visibility_changed";
|
|
111
|
+
"community.archived": "community.archived";
|
|
112
|
+
"community.restored": "community.restored";
|
|
113
|
+
"community.deleted": "community.deleted";
|
|
114
|
+
"community_suggestion.declined": "community_suggestion.declined";
|
|
115
|
+
"community.orphaned": "community.orphaned";
|
|
89
116
|
}>;
|
|
90
117
|
target: z.ZodObject<{
|
|
91
118
|
subject: z.ZodEnum<{
|
|
@@ -104,6 +131,8 @@ export declare const auditEntrySchema: z.ZodObject<{
|
|
|
104
131
|
PlatformSettings: "PlatformSettings";
|
|
105
132
|
Product: "Product";
|
|
106
133
|
Review: "Review";
|
|
134
|
+
Community: "Community";
|
|
135
|
+
CommunitySuggestion: "CommunitySuggestion";
|
|
107
136
|
}>;
|
|
108
137
|
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
109
138
|
label: z.ZodNullable<z.ZodString>;
|
|
@@ -129,6 +158,10 @@ export declare const auditPageSchema: z.ZodObject<{
|
|
|
129
158
|
}, z.core.$strip>, z.ZodObject<{
|
|
130
159
|
kind: z.ZodLiteral<"script">;
|
|
131
160
|
name: z.ZodString;
|
|
161
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
162
|
+
kind: z.ZodLiteral<"member">;
|
|
163
|
+
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
164
|
+
displayName: z.ZodString;
|
|
132
165
|
}, z.core.$strip>], "kind">;
|
|
133
166
|
action: z.ZodEnum<{
|
|
134
167
|
"role.granted": "role.granted";
|
|
@@ -142,6 +175,15 @@ export declare const auditPageSchema: z.ZodObject<{
|
|
|
142
175
|
"member.unsuspended": "member.unsuspended";
|
|
143
176
|
"ticket.claimed": "ticket.claimed";
|
|
144
177
|
"ticket.resolved": "ticket.resolved";
|
|
178
|
+
"capability.granted": "capability.granted";
|
|
179
|
+
"capability.revoked": "capability.revoked";
|
|
180
|
+
"community.created": "community.created";
|
|
181
|
+
"community.visibility_changed": "community.visibility_changed";
|
|
182
|
+
"community.archived": "community.archived";
|
|
183
|
+
"community.restored": "community.restored";
|
|
184
|
+
"community.deleted": "community.deleted";
|
|
185
|
+
"community_suggestion.declined": "community_suggestion.declined";
|
|
186
|
+
"community.orphaned": "community.orphaned";
|
|
145
187
|
}>;
|
|
146
188
|
target: z.ZodObject<{
|
|
147
189
|
subject: z.ZodEnum<{
|
|
@@ -160,6 +202,8 @@ export declare const auditPageSchema: z.ZodObject<{
|
|
|
160
202
|
PlatformSettings: "PlatformSettings";
|
|
161
203
|
Product: "Product";
|
|
162
204
|
Review: "Review";
|
|
205
|
+
Community: "Community";
|
|
206
|
+
CommunitySuggestion: "CommunitySuggestion";
|
|
163
207
|
}>;
|
|
164
208
|
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
165
209
|
label: z.ZodNullable<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../src/domains/audit/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../src/domains/audit/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,mBAAmB,gbAkDtB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAA8B,CAAC;AAC7D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;2BAyB3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAS3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAoC,CAAC;AACjE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -37,10 +37,12 @@ export const AUDIT_ACTION_VALUES = [
|
|
|
37
37
|
'content.removed',
|
|
38
38
|
/**
|
|
39
39
|
* Staff hid a post, poll, comment, product or review: out of every feed and
|
|
40
|
-
* list, restorable. `detail.note`.
|
|
40
|
+
* list, restorable. `detail.note`. Since 0.9.0 also a community's
|
|
41
|
+
* moderators hiding a post, poll or comment in it (actor kind `member`, or
|
|
42
|
+
* staff), with `detail.communityId`.
|
|
41
43
|
*/
|
|
42
44
|
'content.hidden',
|
|
43
|
-
/**
|
|
45
|
+
/** Hidden content (a product or review too) put back, by staff or (0.9.0) a community's moderators. */
|
|
44
46
|
'content.restored',
|
|
45
47
|
/** Staff looked at what was reported and left it up. `detail.reports`: how many closed. */
|
|
46
48
|
'report.dismissed',
|
|
@@ -52,11 +54,34 @@ export const AUDIT_ACTION_VALUES = [
|
|
|
52
54
|
'ticket.claimed',
|
|
53
55
|
/** A support agent closed a ticket as resolved. */
|
|
54
56
|
'ticket.resolved',
|
|
57
|
+
/** A capability was granted (0.9.0). `detail.capability`. */
|
|
58
|
+
'capability.granted',
|
|
59
|
+
/** A capability was taken away (0.9.0). `detail.capability`. */
|
|
60
|
+
'capability.revoked',
|
|
61
|
+
/** A community was created (0.9.0). `detail.visibility`; `detail.suggestionId` when from a suggestion. */
|
|
62
|
+
'community.created',
|
|
63
|
+
/** A community's type changed (0.9.0). `detail.from`, `detail.to`, `detail.exposed`. */
|
|
64
|
+
'community.visibility_changed',
|
|
65
|
+
/** Staff archived a community (0.9.0). */
|
|
66
|
+
'community.archived',
|
|
67
|
+
/** Staff restored an archived community (0.9.0). */
|
|
68
|
+
'community.restored',
|
|
69
|
+
/** Staff deleted a community (0.9.0). */
|
|
70
|
+
'community.deleted',
|
|
71
|
+
/** Staff declined a community suggestion (0.9.0). `detail.reason`. Approving is `community.created`. */
|
|
72
|
+
'community_suggestion.declined',
|
|
73
|
+
/**
|
|
74
|
+
* A community was left with no admin (0.9.0): its last admin's account was
|
|
75
|
+
* deleted where that cannot be refused. Written by the deletion (actor
|
|
76
|
+
* kind `script`); managers then make a member admin.
|
|
77
|
+
*/
|
|
78
|
+
'community.orphaned',
|
|
55
79
|
];
|
|
56
80
|
export const auditActionSchema = z.enum(AUDIT_ACTION_VALUES);
|
|
57
81
|
/**
|
|
58
|
-
* Who did it. A person, acting as one of their roles;
|
|
59
|
-
* is the only way a superadmin is ever made.
|
|
82
|
+
* Who did it. A person, acting as one of their roles; a server script, which
|
|
83
|
+
* is the only way a superadmin is ever made; or (0.9.0) a member acting in a
|
|
84
|
+
* community they run, who is not staff.
|
|
60
85
|
*/
|
|
61
86
|
export const auditActorSchema = z.discriminatedUnion('kind', [
|
|
62
87
|
z.object({
|
|
@@ -72,6 +97,17 @@ export const auditActorSchema = z.discriminatedUnion('kind', [
|
|
|
72
97
|
/** Which script, e.g. `grant-superadmin`. */
|
|
73
98
|
name: z.string(),
|
|
74
99
|
}),
|
|
100
|
+
/**
|
|
101
|
+
* A member who is not acting as staff (0.9.0): a community's admin changing
|
|
102
|
+
* its type, say. Its own kind, so nobody reading the log mistakes a
|
|
103
|
+
* community admin for staff.
|
|
104
|
+
*/
|
|
105
|
+
z.object({
|
|
106
|
+
kind: z.literal('member'),
|
|
107
|
+
id: objectIdSchema,
|
|
108
|
+
/** Their name when they did it. */
|
|
109
|
+
displayName: z.string(),
|
|
110
|
+
}),
|
|
75
111
|
]);
|
|
76
112
|
export const auditEntrySchema = z.object({
|
|
77
113
|
id: objectIdSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/domains/audit/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,kDAAkD;IAClD,cAAc;IACd,qDAAqD;IACrD,cAAc;IACd,uEAAuE;IACvE,cAAc;IACd,gGAAgG;IAChG,iBAAiB;IACjB
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/domains/audit/audit.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * founder-schema: the audit log\n *\n * GET /api/v1/audit staff actions, newest first\n *\n * Every action a staff member takes on a MEMBER or on what a member wrote\n * (roles, MPIN resets, suspensions, moderation decisions, taking and closing\n * tickets) is written here, at the moment it happens, by the server: who did\n * it, AS WHICH ROLE, what they did, to what, and anything that explains it.\n * The support team's own library (saved replies) is not a member's, so its\n * edits are not entries. Entries are never edited or\n * deleted. It is how a dispute (\"who removed my post, and why\") gets an\n * answer, and how a misused staff account is noticed.\n *\n * WHO READS WHAT is the reader's permissions, applied to the query: a\n * superadmin reads every entry; any other staff role reads the entries it\n * wrote itself (its History).\n *\n * The action list grows with the staff features; it never shrinks, because an\n * old entry must still parse.\n *\n * @module founder-schema/domains/audit\n */\n\nimport { z } from 'zod';\nimport { subjectSchema } from '../../access/permissions.js';\nimport { roleSchema } from '../../access/roles.js';\nimport { objectIdSchema } from '../../core/common.js';\nimport { paginatedSchema } from '../../core/responses.js';\n\nexport const AUDIT_ACTION_VALUES = [\n /** A platform role was granted. `detail.role`. */\n 'role.granted',\n /** A platform role was taken away. `detail.role`. */\n 'role.revoked',\n /** Someone's forgotten MPIN was cleared, so they can set a new one. */\n 'mpin.cleared',\n /** Staff removed someone else's post, poll, comment or review (`target.subject` says which). */\n 'content.removed',\n /**\n * Staff hid a post, poll, comment, product or review: out of every feed and\n * list, restorable. `detail.note`. Since 0.9.0 also a community's\n * moderators hiding a post, poll or comment in it (actor kind `member`, or\n * staff), with `detail.communityId`.\n */\n 'content.hidden',\n /** Hidden content (a product or review too) put back, by staff or (0.9.0) a community's moderators. */\n 'content.restored',\n /** Staff looked at what was reported and left it up. `detail.reports`: how many closed. */\n 'report.dismissed',\n /** A member was suspended from the product. `detail.reason`. */\n 'member.suspended',\n /** A suspension was lifted. */\n 'member.unsuspended',\n /** A support agent took a ticket. */\n 'ticket.claimed',\n /** A support agent closed a ticket as resolved. */\n 'ticket.resolved',\n /** A capability was granted (0.9.0). `detail.capability`. */\n 'capability.granted',\n /** A capability was taken away (0.9.0). `detail.capability`. */\n 'capability.revoked',\n /** A community was created (0.9.0). `detail.visibility`; `detail.suggestionId` when from a suggestion. */\n 'community.created',\n /** A community's type changed (0.9.0). `detail.from`, `detail.to`, `detail.exposed`. */\n 'community.visibility_changed',\n /** Staff archived a community (0.9.0). */\n 'community.archived',\n /** Staff restored an archived community (0.9.0). */\n 'community.restored',\n /** Staff deleted a community (0.9.0). */\n 'community.deleted',\n /** Staff declined a community suggestion (0.9.0). `detail.reason`. Approving is `community.created`. */\n 'community_suggestion.declined',\n /**\n * A community was left with no admin (0.9.0): its last admin's account was\n * deleted where that cannot be refused. Written by the deletion (actor\n * kind `script`); managers then make a member admin.\n */\n 'community.orphaned',\n] as const;\nexport const auditActionSchema = z.enum(AUDIT_ACTION_VALUES);\nexport type AuditAction = z.infer<typeof auditActionSchema>;\n\n/**\n * Who did it. A person, acting as one of their roles; a server script, which\n * is the only way a superadmin is ever made; or (0.9.0) a member acting in a\n * community they run, who is not staff.\n */\nexport const auditActorSchema = z.discriminatedUnion('kind', [\n z.object({\n kind: z.literal('staff'),\n id: objectIdSchema,\n /** Their name when they did it. An entry is a record, so it is not renamed later. */\n displayName: z.string(),\n /** The role they were acting as. */\n actingAs: roleSchema,\n }),\n z.object({\n kind: z.literal('script'),\n /** Which script, e.g. `grant-superadmin`. */\n name: z.string(),\n }),\n /**\n * A member who is not acting as staff (0.9.0): a community's admin changing\n * its type, say. Its own kind, so nobody reading the log mistakes a\n * community admin for staff.\n */\n z.object({\n kind: z.literal('member'),\n id: objectIdSchema,\n /** Their name when they did it. */\n displayName: z.string(),\n }),\n]);\nexport type AuditActor = z.infer<typeof auditActorSchema>;\n\nexport const auditEntrySchema = z.object({\n id: objectIdSchema,\n actor: auditActorSchema,\n action: auditActionSchema,\n /** What it was done to. `label` is its name at the time, when it has one. */\n target: z.object({ subject: subjectSchema, id: objectIdSchema, label: z.string().nullable() }),\n /** The specifics, by action (the role granted, a reason given). Never a secret. */\n detail: z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.null()])),\n at: z.iso.datetime(),\n});\nexport type AuditEntry = z.infer<typeof auditEntrySchema>;\n\nexport const auditPageSchema = paginatedSchema(auditEntrySchema);\nexport type AuditPage = z.infer<typeof auditPageSchema>;\n"]}
|