founder-schema 0.2.0 → 0.4.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 +18 -15
- package/dist/access/access.d.ts +76 -0
- package/dist/access/access.d.ts.map +1 -0
- package/dist/access/access.js +66 -0
- package/dist/access/access.js.map +1 -0
- package/dist/access/permissions.d.ts +153 -0
- package/dist/access/permissions.d.ts.map +1 -0
- package/dist/access/permissions.js +80 -0
- package/dist/access/permissions.js.map +1 -0
- package/dist/access/roles.d.ts +71 -0
- package/dist/access/roles.d.ts.map +1 -0
- package/dist/access/roles.js +72 -0
- package/dist/access/roles.js.map +1 -0
- package/dist/account.d.ts +40 -0
- package/dist/account.d.ts.map +1 -0
- package/dist/account.js +39 -0
- package/dist/account.js.map +1 -0
- package/dist/chat.d.ts +4 -4
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +7 -2
- package/dist/chat.js.map +1 -1
- package/dist/core/common.d.ts +304 -0
- package/dist/core/common.d.ts.map +1 -0
- package/dist/core/common.js +340 -0
- package/dist/core/common.js.map +1 -0
- package/dist/core/errors.d.ts +105 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +115 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/limits.d.ts +99 -0
- package/dist/core/limits.d.ts.map +1 -0
- package/dist/core/limits.js +109 -0
- package/dist/core/limits.js.map +1 -0
- package/dist/core/responses.d.ts +195 -0
- package/dist/core/responses.d.ts.map +1 -0
- package/dist/core/responses.js +73 -0
- package/dist/core/responses.js.map +1 -0
- package/dist/core/validation.d.ts +144 -0
- package/dist/core/validation.d.ts.map +1 -0
- package/dist/core/validation.js +150 -0
- package/dist/core/validation.js.map +1 -0
- package/dist/domains/account/account.d.ts +40 -0
- package/dist/domains/account/account.d.ts.map +1 -0
- package/dist/domains/account/account.js +39 -0
- package/dist/domains/account/account.js.map +1 -0
- package/dist/domains/audit/audit.d.ts +169 -0
- package/dist/domains/audit/audit.d.ts.map +1 -0
- package/dist/domains/audit/audit.js +84 -0
- package/dist/domains/audit/audit.js.map +1 -0
- package/dist/domains/chat/chat.d.ts +187 -0
- package/dist/domains/chat/chat.d.ts.map +1 -0
- package/dist/domains/chat/chat.js +189 -0
- package/dist/domains/chat/chat.js.map +1 -0
- package/dist/domains/dashboard/dashboard.d.ts +48 -0
- package/dist/domains/dashboard/dashboard.d.ts.map +1 -0
- package/dist/domains/dashboard/dashboard.js +58 -0
- package/dist/domains/dashboard/dashboard.js.map +1 -0
- package/dist/domains/discover/discover.d.ts +245 -0
- package/dist/domains/discover/discover.d.ts.map +1 -0
- package/dist/domains/discover/discover.js +68 -0
- package/dist/domains/discover/discover.js.map +1 -0
- package/dist/domains/feed/feed.d.ts +1658 -0
- package/dist/domains/feed/feed.d.ts.map +1 -0
- package/dist/domains/feed/feed.js +623 -0
- package/dist/domains/feed/feed.js.map +1 -0
- package/dist/domains/members/members.d.ts +175 -0
- package/dist/domains/members/members.d.ts.map +1 -0
- package/dist/domains/members/members.js +106 -0
- package/dist/domains/members/members.js.map +1 -0
- package/dist/domains/moderation/moderation.d.ts +184 -0
- package/dist/domains/moderation/moderation.d.ts.map +1 -0
- package/dist/domains/moderation/moderation.js +90 -0
- package/dist/domains/moderation/moderation.js.map +1 -0
- package/dist/domains/onboarding/onboarding.d.ts +1018 -0
- package/dist/domains/onboarding/onboarding.d.ts.map +1 -0
- package/dist/domains/onboarding/onboarding.js +717 -0
- package/dist/domains/onboarding/onboarding.js.map +1 -0
- package/dist/domains/profile/founder-profile.d.ts +387 -0
- package/dist/domains/profile/founder-profile.d.ts.map +1 -0
- package/dist/domains/profile/founder-profile.js +180 -0
- package/dist/domains/profile/founder-profile.js.map +1 -0
- package/dist/domains/support/support.d.ts +305 -0
- package/dist/domains/support/support.d.ts.map +1 -0
- package/dist/domains/support/support.js +129 -0
- package/dist/domains/support/support.js.map +1 -0
- package/dist/domains/team/team.d.ts +79 -0
- package/dist/domains/team/team.d.ts.map +1 -0
- package/dist/domains/team/team.js +54 -0
- package/dist/domains/team/team.js.map +1 -0
- package/dist/domains/uploads/uploads.d.ts +113 -0
- package/dist/domains/uploads/uploads.d.ts.map +1 -0
- package/dist/domains/uploads/uploads.js +106 -0
- package/dist/domains/uploads/uploads.js.map +1 -0
- package/dist/env.d.ts +85 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +150 -0
- package/dist/env.js.map +1 -0
- package/dist/index.d.ts +21 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -17
- package/dist/index.js.map +1 -1
- package/dist/onboarding.d.ts +58 -32
- package/dist/onboarding.d.ts.map +1 -1
- package/dist/onboarding.js +155 -32
- package/dist/onboarding.js.map +1 -1
- package/package.json +14 -2
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* founder-schema: moderation
|
|
3
|
+
*
|
|
4
|
+
* GET /api/v1/moderation/queue ?limit&cursor
|
|
5
|
+
* what members reported and nobody has decided on, oldest report first
|
|
6
|
+
* GET /api/v1/moderation/content ?state&limit&cursor
|
|
7
|
+
* by state, newest first: visible is posts and polls by when posted;
|
|
8
|
+
* hidden and removed also hold comments (so a hidden comment can be
|
|
9
|
+
* found and put back), by when hidden or removed
|
|
10
|
+
* A decision that changes nothing (hiding what is already hidden, removing
|
|
11
|
+
* what its author deleted) leaves the reports open and writes nothing: for
|
|
12
|
+
* those, dismiss.
|
|
13
|
+
* POST /api/v1/moderation/:contentKind/:contentId/decision { action, note? }
|
|
14
|
+
* decide on one post, poll or comment; answers the item as it now is
|
|
15
|
+
*
|
|
16
|
+
* ONE ITEM PER THING, NOT PER REPORT. Five members reporting one post is one
|
|
17
|
+
* row with five reports, so a moderator decides once. The queue's order is
|
|
18
|
+
* the oldest open report first: whoever has waited longest is seen first, and
|
|
19
|
+
* a pile-on cannot jump the line.
|
|
20
|
+
*
|
|
21
|
+
* THE DECISIONS
|
|
22
|
+
* dismiss it stays up; its open reports close as dismissed
|
|
23
|
+
* hide out of every feed and thread, kept, restorable; reports actioned
|
|
24
|
+
* restore a hidden item goes back up
|
|
25
|
+
* remove deleted as its author deleting it would (counts move), not
|
|
26
|
+
* restorable from here; reports actioned
|
|
27
|
+
* Every decision on someone else's content is written to the audit log, with
|
|
28
|
+
* the note when there is one.
|
|
29
|
+
*
|
|
30
|
+
* A report's `note` was written by a member: untrusted text, shown as text.
|
|
31
|
+
*
|
|
32
|
+
* @module founder-schema/domains/moderation
|
|
33
|
+
*/
|
|
34
|
+
import { z } from 'zod';
|
|
35
|
+
import { emptyStringToUndefined, objectIdSchema, optionalTrimmedString, paginationQuerySchema, } from '../../core/common.js';
|
|
36
|
+
import { MODERATION_NOTE_MAX } from '../../core/limits.js';
|
|
37
|
+
import { paginatedSchema } from '../../core/responses.js';
|
|
38
|
+
import { contentKindSchema, engagementTargetKindSchema, reportReasonSchema } from '../feed/feed.js';
|
|
39
|
+
/** Where a post, poll or comment stands. */
|
|
40
|
+
export const MODERATION_STATE_VALUES = ['visible', 'hidden', 'removed'];
|
|
41
|
+
export const moderationStateSchema = z.enum(MODERATION_STATE_VALUES);
|
|
42
|
+
export const MODERATION_ACTION_VALUES = ['dismiss', 'hide', 'restore', 'remove'];
|
|
43
|
+
export const moderationActionSchema = z.enum(MODERATION_ACTION_VALUES);
|
|
44
|
+
const count = z.number().int().min(0);
|
|
45
|
+
/** One post, poll or comment as moderation sees it. */
|
|
46
|
+
export const moderationItemSchema = z.object({
|
|
47
|
+
target: z.object({ kind: engagementTargetKindSchema, id: objectIdSchema }),
|
|
48
|
+
/** The post or poll itself, or the one a comment is on: where it is read in the app. */
|
|
49
|
+
content: z.object({ kind: contentKindSchema, id: objectIdSchema }),
|
|
50
|
+
/** Its first words (a poll's question), cut to `MODERATION_EXCERPT_MAX`. */
|
|
51
|
+
excerpt: z.string(),
|
|
52
|
+
author: z.object({
|
|
53
|
+
id: objectIdSchema,
|
|
54
|
+
displayName: z.string(),
|
|
55
|
+
avatarUrl: z.url().nullable(),
|
|
56
|
+
}),
|
|
57
|
+
createdAt: z.iso.datetime(),
|
|
58
|
+
state: moderationStateSchema,
|
|
59
|
+
reports: z.object({
|
|
60
|
+
/** Reports nobody has decided on. */
|
|
61
|
+
open: count,
|
|
62
|
+
/** Every report ever filed about it. */
|
|
63
|
+
total: count,
|
|
64
|
+
/** Why it was reported, among the open ones, most-given first. */
|
|
65
|
+
reasons: z.array(z.object({ reason: reportReasonSchema, count })),
|
|
66
|
+
/** The reporters' notes, among the open ones, newest first (a few, not all). */
|
|
67
|
+
notes: z.array(z.string()),
|
|
68
|
+
/** When the oldest open report was filed. Null when none is open. */
|
|
69
|
+
oldestOpenAt: z.iso.datetime().nullable(),
|
|
70
|
+
}),
|
|
71
|
+
/** What the asking staff member may do to it now. */
|
|
72
|
+
viewer: z.object({
|
|
73
|
+
canDismiss: z.boolean(),
|
|
74
|
+
canHide: z.boolean(),
|
|
75
|
+
canRestore: z.boolean(),
|
|
76
|
+
canRemove: z.boolean(),
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
79
|
+
export const moderationPageSchema = paginatedSchema(moderationItemSchema);
|
|
80
|
+
/** `GET /moderation/content`. Visible when not said. */
|
|
81
|
+
export const moderationContentQuerySchema = paginationQuerySchema.extend({
|
|
82
|
+
state: z.preprocess(emptyStringToUndefined, moderationStateSchema.default('visible')),
|
|
83
|
+
});
|
|
84
|
+
/** `POST /moderation/:contentKind/:contentId/decision`. */
|
|
85
|
+
export const moderationDecisionBodySchema = z.object({
|
|
86
|
+
action: moderationActionSchema,
|
|
87
|
+
/** Why, for the audit log. Optional: an obvious spam removal needs no essay. */
|
|
88
|
+
note: optionalTrimmedString(MODERATION_NOTE_MAX),
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=moderation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moderation.js","sourceRoot":"","sources":["../../../src/domains/moderation/moderation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;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B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,MAAM,EAAE,sBAAsB;IAC9B,gFAAgF;IAChF,IAAI,EAAE,qBAAqB,CAAC,mBAAmB,CAAC;CACjD,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: moderation\n *\n * GET /api/v1/moderation/queue ?limit&cursor\n * what members reported and nobody has decided on, oldest report first\n * GET /api/v1/moderation/content ?state&limit&cursor\n * by state, newest first: visible is posts and polls by when posted;\n * hidden and removed also hold comments (so a hidden comment can be\n * found and put back), by when hidden or removed\n * A decision that changes nothing (hiding what is already hidden, removing\n * what its author deleted) leaves the reports open and writes nothing: for\n * those, dismiss.\n * POST /api/v1/moderation/:contentKind/:contentId/decision { action, note? }\n * decide on one post, poll or comment; answers the item as it now is\n *\n * ONE ITEM PER THING, NOT PER REPORT. Five members reporting one post is one\n * row with five reports, so a moderator decides once. The queue's order is\n * the oldest open report first: whoever has waited longest is seen first, and\n * a pile-on cannot jump the line.\n *\n * THE DECISIONS\n * dismiss it stays up; its open reports close as dismissed\n * hide out of every feed and thread, kept, restorable; reports actioned\n * restore a hidden item goes back up\n * remove deleted as its author deleting it would (counts move), not\n * restorable from here; reports actioned\n * Every decision on someone else's content is written to the audit log, with\n * the note when there is one.\n *\n * A report's `note` was written by a member: untrusted text, shown as text.\n *\n * @module founder-schema/domains/moderation\n */\n\nimport { z } from 'zod';\nimport {\n emptyStringToUndefined,\n objectIdSchema,\n optionalTrimmedString,\n paginationQuerySchema,\n} from '../../core/common.js';\nimport { MODERATION_NOTE_MAX } from '../../core/limits.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { contentKindSchema, engagementTargetKindSchema, reportReasonSchema } from '../feed/feed.js';\n\n/** Where a post, poll or comment stands. */\nexport const MODERATION_STATE_VALUES = ['visible', 'hidden', 'removed'] as const;\nexport const moderationStateSchema = z.enum(MODERATION_STATE_VALUES);\nexport type ModerationState = z.infer<typeof moderationStateSchema>;\n\nexport const MODERATION_ACTION_VALUES = ['dismiss', 'hide', 'restore', 'remove'] as const;\nexport const moderationActionSchema = z.enum(MODERATION_ACTION_VALUES);\nexport type ModerationAction = z.infer<typeof moderationActionSchema>;\n\nconst count = z.number().int().min(0);\n\n/** One post, poll or comment as moderation sees it. */\nexport const moderationItemSchema = z.object({\n target: z.object({ kind: engagementTargetKindSchema, id: objectIdSchema }),\n /** The post or poll itself, or the one a comment is on: where it is read in the app. */\n content: z.object({ kind: contentKindSchema, id: objectIdSchema }),\n /** Its first words (a poll's question), cut to `MODERATION_EXCERPT_MAX`. */\n excerpt: z.string(),\n author: z.object({\n id: objectIdSchema,\n displayName: z.string(),\n avatarUrl: z.url().nullable(),\n }),\n createdAt: z.iso.datetime(),\n state: moderationStateSchema,\n reports: z.object({\n /** Reports nobody has decided on. */\n open: count,\n /** Every report ever filed about it. */\n total: count,\n /** Why it was reported, among the open ones, most-given first. */\n reasons: z.array(z.object({ reason: reportReasonSchema, count })),\n /** The reporters' notes, among the open ones, newest first (a few, not all). */\n notes: z.array(z.string()),\n /** When the oldest open report was filed. Null when none is open. */\n oldestOpenAt: z.iso.datetime().nullable(),\n }),\n /** What the asking staff member may do to it now. */\n viewer: z.object({\n canDismiss: z.boolean(),\n canHide: z.boolean(),\n canRestore: z.boolean(),\n canRemove: z.boolean(),\n }),\n});\nexport type ModerationItem = z.infer<typeof moderationItemSchema>;\n\nexport const moderationPageSchema = paginatedSchema(moderationItemSchema);\nexport type ModerationPage = z.infer<typeof moderationPageSchema>;\n\n/** `GET /moderation/content`. Visible when not said. */\nexport const moderationContentQuerySchema = paginationQuerySchema.extend({\n state: z.preprocess(emptyStringToUndefined, moderationStateSchema.default('visible')),\n});\nexport type ModerationContentQuery = z.infer<typeof moderationContentQuerySchema>;\nexport type ModerationContentQueryInput = z.input<typeof moderationContentQuerySchema>;\n\n/** `POST /moderation/:contentKind/:contentId/decision`. */\nexport const moderationDecisionBodySchema = z.object({\n action: moderationActionSchema,\n /** Why, for the audit log. Optional: an obvious spam removal needs no essay. */\n note: optionalTrimmedString(MODERATION_NOTE_MAX),\n});\nexport type ModerationDecisionBody = z.infer<typeof moderationDecisionBodySchema>;\n"]}
|