founder-schema 0.26.0 → 0.27.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.
Files changed (51) hide show
  1. package/dist/core/errors.d.ts +3 -1
  2. package/dist/core/errors.d.ts.map +1 -1
  3. package/dist/core/errors.js +5 -0
  4. package/dist/core/errors.js.map +1 -1
  5. package/dist/core/limits.d.ts +8 -0
  6. package/dist/core/limits.d.ts.map +1 -1
  7. package/dist/core/limits.js +8 -0
  8. package/dist/core/limits.js.map +1 -1
  9. package/dist/core/responses.d.ts +2 -0
  10. package/dist/core/responses.d.ts.map +1 -1
  11. package/dist/core/validation.d.ts +5 -0
  12. package/dist/core/validation.d.ts.map +1 -1
  13. package/dist/core/validation.js +5 -0
  14. package/dist/core/validation.js.map +1 -1
  15. package/dist/domains/audit/audit.d.ts +4 -1
  16. package/dist/domains/audit/audit.d.ts.map +1 -1
  17. package/dist/domains/audit/audit.js +6 -0
  18. package/dist/domains/audit/audit.js.map +1 -1
  19. package/dist/domains/blocks/blocks.d.ts +64 -0
  20. package/dist/domains/blocks/blocks.d.ts.map +1 -0
  21. package/dist/domains/blocks/blocks.js +44 -0
  22. package/dist/domains/blocks/blocks.js.map +1 -0
  23. package/dist/domains/contributions/contributions.d.ts +21 -3
  24. package/dist/domains/contributions/contributions.d.ts.map +1 -1
  25. package/dist/domains/contributions/contributions.js +21 -4
  26. package/dist/domains/contributions/contributions.js.map +1 -1
  27. package/dist/domains/feed/feed.d.ts +572 -24
  28. package/dist/domains/feed/feed.d.ts.map +1 -1
  29. package/dist/domains/feed/feed.js +214 -28
  30. package/dist/domains/feed/feed.js.map +1 -1
  31. package/dist/domains/feed/mentions.d.ts +86 -0
  32. package/dist/domains/feed/mentions.d.ts.map +1 -0
  33. package/dist/domains/feed/mentions.js +93 -0
  34. package/dist/domains/feed/mentions.js.map +1 -0
  35. package/dist/domains/moderation/moderation.d.ts +9 -2
  36. package/dist/domains/moderation/moderation.d.ts.map +1 -1
  37. package/dist/domains/moderation/moderation.js +6 -2
  38. package/dist/domains/moderation/moderation.js.map +1 -1
  39. package/dist/domains/notifications/notifications.d.ts +28 -2
  40. package/dist/domains/notifications/notifications.d.ts.map +1 -1
  41. package/dist/domains/notifications/notifications.js +24 -0
  42. package/dist/domains/notifications/notifications.js.map +1 -1
  43. package/dist/domains/profile/founder-profile.d.ts +1 -0
  44. package/dist/domains/profile/founder-profile.d.ts.map +1 -1
  45. package/dist/domains/profile/founder-profile.js +11 -1
  46. package/dist/domains/profile/founder-profile.js.map +1 -1
  47. package/dist/index.d.ts +5 -3
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +9 -3
  50. package/dist/index.js.map +1 -1
  51. package/package.json +1 -1
@@ -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;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,kDAAkD;IAClD,cAAc;IACd,qDAAqD;IACrD,cAAc;IACd,uEAAuE;IACvE,cAAc;IACd,gGAAgG;IAChG,iBAAiB;IACjB;;;;;OAKG;IACH,gBAAgB;IAChB,uGAAuG;IACvG,kBAAkB;IAClB,2FAA2F;IAC3F,kBAAkB;IAClB,gEAAgE;IAChE,kBAAkB;IAClB,+BAA+B;IAC/B,oBAAoB;IACpB,qCAAqC;IACrC,gBAAgB;IAChB,mDAAmD;IACnD,iB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AC,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC9F,mFAAmF;IACnF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACtF,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;CACrB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC","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';\nimport { personSchema } from '../people/person.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 /** Staff gave someone a membership (0.12.0). `detail.reason`. Target subject `Membership`. */\n 'membership.granted',\n /**\n * Staff took a founding, coupon or granted membership away (0.12.0): a fake\n * or duplicate account. `detail.reason`, `detail.kind`. A paid one is\n * refunded instead (`payment.refunded`).\n */\n 'membership.revoked',\n /**\n * Staff refunded a payment (0.12.0). `detail.reason`, `detail.amount`\n * (paise), `detail.item`. Target subject `Payment`.\n */\n 'payment.refunded',\n /** Staff created a coupon (0.12.0). `detail.code`, `detail.benefit`, `detail.max`. */\n 'coupon.created',\n /** Staff changed a coupon (0.12.0): switched it off or on, its cap, window or label. `detail.changes`. */\n 'coupon.updated',\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 /**\n * The person (0.20.0, `personSchema`). ⚠ `displayName` and `firstName` are\n * their name WHEN THEY DID IT: an entry is a record, so it is not renamed\n * later. The picture and handle are live, and empty once the account is gone.\n */\n personSchema.extend({\n kind: z.literal('staff'),\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 /** The person; their name as it was when they did it, like `staff`. */\n personSchema.extend({ kind: z.literal('member') }),\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"]}
1
+ {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/domains/audit/audit.ts"],"names":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BAAgB,CAAC,CAAC","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';\nimport { personSchema } from '../people/person.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 /** Staff gave someone a membership (0.12.0). `detail.reason`. Target subject `Membership`. */\n 'membership.granted',\n /**\n * Staff took a founding, coupon or granted membership away (0.12.0): a fake\n * or duplicate account. `detail.reason`, `detail.kind`. A paid one is\n * refunded instead (`payment.refunded`).\n */\n 'membership.revoked',\n /**\n * Staff refunded a payment (0.12.0). `detail.reason`, `detail.amount`\n * (paise), `detail.item`. Target subject `Payment`.\n */\n 'payment.refunded',\n /** Staff created a coupon (0.12.0). `detail.code`, `detail.benefit`, `detail.max`. */\n 'coupon.created',\n /** Staff changed a coupon (0.12.0): switched it off or on, its cap, window or label. `detail.changes`. */\n 'coupon.updated',\n /**\n * Staff closed someone else's poll before its time (2026-11-23). Target\n * subject `Poll`; `detail.authorId`, `detail.closesAt` (when it would have\n * closed). Its author closing their own is not audited.\n */\n 'poll.closed',\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 /**\n * The person (0.20.0, `personSchema`). ⚠ `displayName` and `firstName` are\n * their name WHEN THEY DID IT: an entry is a record, so it is not renamed\n * later. The picture and handle are live, and empty once the account is gone.\n */\n personSchema.extend({\n kind: z.literal('staff'),\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 /** The person; their name as it was when they did it, like `staff`. */\n personSchema.extend({ kind: z.literal('member') }),\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"]}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Blocking a member (2026-11-23, the user: bring Jansathi's community features
3
+ * to Founder Circle; Jansathi's `/settings/blocks/:userId`).
4
+ *
5
+ * A block is ONE member's choice about one other, and it works BOTH WAYS for
6
+ * what each of them sees:
7
+ *
8
+ * - neither sees the other's posts, polls or comments (feeds, threads, a
9
+ * member's Posts tab, a post's own page), and a repost of the other's post
10
+ * shows as unavailable
11
+ * - neither finds the other in Discover, followers or following lists, or the
12
+ * @mention suggestions; the blocked member gets "not available" for the
13
+ * blocker's page; the blocker still opens the blocked member's page, which
14
+ * says so and offers Unblock
15
+ * - follows between them end, both ways, and neither can follow the other
16
+ * - neither can react, comment, vote or repost on the other's things, mention
17
+ * the other, start a new chat with the other, or ring the other's bell
18
+ *
19
+ * The blocked member is never told. Unblocking restores what each can see; the
20
+ * follows that ended stay ended.
21
+ *
22
+ * PUT /api/v1/founders/:userId/block -> `BlockAnswer`
23
+ * DELETE /api/v1/founders/:userId/block -> `BlockAnswer`
24
+ * GET /api/v1/blocks -> `BlockedPage` (mine, newest first)
25
+ */
26
+ import { z } from 'zod';
27
+ /** How many members one member may block: a bound on every read's "not these authors". */
28
+ export declare const BLOCKS_MAX = 500;
29
+ export declare const blockTargetParamsSchema: z.ZodObject<{
30
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
31
+ }, z.core.$strip>;
32
+ export type BlockTargetParams = z.infer<typeof blockTargetParamsSchema>;
33
+ /** The state after a block or an unblock. Repeating either is a quiet success. */
34
+ export declare const blockAnswerSchema: z.ZodObject<{
35
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
36
+ blocked: z.ZodBoolean;
37
+ }, z.core.$strip>;
38
+ export type BlockAnswer = z.infer<typeof blockAnswerSchema>;
39
+ /** One member I blocked, as the Blocked list shows them, with when. */
40
+ export declare const blockedMemberSchema: z.ZodObject<{
41
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
42
+ username: z.ZodNullable<z.ZodString>;
43
+ displayName: z.ZodString;
44
+ firstName: z.ZodString;
45
+ avatarUrl: z.ZodNullable<z.ZodURL>;
46
+ former: z.ZodBoolean;
47
+ blockedAt: z.ZodISODateTime;
48
+ }, z.core.$strip>;
49
+ export type BlockedMember = z.infer<typeof blockedMemberSchema>;
50
+ /** My blocked members, newest block first. */
51
+ export declare const blockedPageSchema: z.ZodObject<{
52
+ items: z.ZodArray<z.ZodObject<{
53
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
54
+ username: z.ZodNullable<z.ZodString>;
55
+ displayName: z.ZodString;
56
+ firstName: z.ZodString;
57
+ avatarUrl: z.ZodNullable<z.ZodURL>;
58
+ former: z.ZodBoolean;
59
+ blockedAt: z.ZodISODateTime;
60
+ }, z.core.$strip>>;
61
+ nextCursor: z.ZodNullable<z.ZodString>;
62
+ }, z.core.$strip>;
63
+ export type BlockedPage = z.infer<typeof blockedPageSchema>;
64
+ //# sourceMappingURL=blocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../src/domains/blocks/blocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,0FAA0F;AAC1F,eAAO,MAAM,UAAU,MAAM,CAAC;AAE9B,eAAO,MAAM,uBAAuB;;iBAAuC,CAAC;AAC5E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,kFAAkF;AAClF,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,uEAAuE;AACvE,eAAO,MAAM,mBAAmB;;;;;;;;iBAE9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,8CAA8C;AAC9C,eAAO,MAAM,iBAAiB;;;;;;;;;;;iBAAuC,CAAC;AACtE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Blocking a member (2026-11-23, the user: bring Jansathi's community features
3
+ * to Founder Circle; Jansathi's `/settings/blocks/:userId`).
4
+ *
5
+ * A block is ONE member's choice about one other, and it works BOTH WAYS for
6
+ * what each of them sees:
7
+ *
8
+ * - neither sees the other's posts, polls or comments (feeds, threads, a
9
+ * member's Posts tab, a post's own page), and a repost of the other's post
10
+ * shows as unavailable
11
+ * - neither finds the other in Discover, followers or following lists, or the
12
+ * @mention suggestions; the blocked member gets "not available" for the
13
+ * blocker's page; the blocker still opens the blocked member's page, which
14
+ * says so and offers Unblock
15
+ * - follows between them end, both ways, and neither can follow the other
16
+ * - neither can react, comment, vote or repost on the other's things, mention
17
+ * the other, start a new chat with the other, or ring the other's bell
18
+ *
19
+ * The blocked member is never told. Unblocking restores what each can see; the
20
+ * follows that ended stay ended.
21
+ *
22
+ * PUT /api/v1/founders/:userId/block -> `BlockAnswer`
23
+ * DELETE /api/v1/founders/:userId/block -> `BlockAnswer`
24
+ * GET /api/v1/blocks -> `BlockedPage` (mine, newest first)
25
+ */
26
+ import { z } from 'zod';
27
+ import { objectIdSchema } from '../../core/common.js';
28
+ import { paginatedSchema } from '../../core/responses.js';
29
+ import { personSchema } from '../people/person.js';
30
+ /** How many members one member may block: a bound on every read's "not these authors". */
31
+ export const BLOCKS_MAX = 500;
32
+ export const blockTargetParamsSchema = z.object({ userId: objectIdSchema });
33
+ /** The state after a block or an unblock. Repeating either is a quiet success. */
34
+ export const blockAnswerSchema = z.object({
35
+ userId: objectIdSchema,
36
+ blocked: z.boolean(),
37
+ });
38
+ /** One member I blocked, as the Blocked list shows them, with when. */
39
+ export const blockedMemberSchema = personSchema.extend({
40
+ blockedAt: z.iso.datetime(),
41
+ });
42
+ /** My blocked members, newest block first. */
43
+ export const blockedPageSchema = paginatedSchema(blockedMemberSchema);
44
+ //# sourceMappingURL=blocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../../src/domains/blocks/blocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,0FAA0F;AAC1F,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAC;AAE9B,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;AAG5E,kFAAkF;AAClF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC;AAGH,uEAAuE;AACvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC,MAAM,CAAC;IACrD,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAGH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC,mBAAmB,CAAC,CAAC","sourcesContent":["/**\n * Blocking a member (2026-11-23, the user: bring Jansathi's community features\n * to Founder Circle; Jansathi's `/settings/blocks/:userId`).\n *\n * A block is ONE member's choice about one other, and it works BOTH WAYS for\n * what each of them sees:\n *\n * - neither sees the other's posts, polls or comments (feeds, threads, a\n * member's Posts tab, a post's own page), and a repost of the other's post\n * shows as unavailable\n * - neither finds the other in Discover, followers or following lists, or the\n * @mention suggestions; the blocked member gets \"not available\" for the\n * blocker's page; the blocker still opens the blocked member's page, which\n * says so and offers Unblock\n * - follows between them end, both ways, and neither can follow the other\n * - neither can react, comment, vote or repost on the other's things, mention\n * the other, start a new chat with the other, or ring the other's bell\n *\n * The blocked member is never told. Unblocking restores what each can see; the\n * follows that ended stay ended.\n *\n * PUT /api/v1/founders/:userId/block -> `BlockAnswer`\n * DELETE /api/v1/founders/:userId/block -> `BlockAnswer`\n * GET /api/v1/blocks -> `BlockedPage` (mine, newest first)\n */\n\nimport { z } from 'zod';\nimport { objectIdSchema } from '../../core/common.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { personSchema } from '../people/person.js';\n\n/** How many members one member may block: a bound on every read's \"not these authors\". */\nexport const BLOCKS_MAX = 500;\n\nexport const blockTargetParamsSchema = z.object({ userId: objectIdSchema });\nexport type BlockTargetParams = z.infer<typeof blockTargetParamsSchema>;\n\n/** The state after a block or an unblock. Repeating either is a quiet success. */\nexport const blockAnswerSchema = z.object({\n userId: objectIdSchema,\n blocked: z.boolean(),\n});\nexport type BlockAnswer = z.infer<typeof blockAnswerSchema>;\n\n/** One member I blocked, as the Blocked list shows them, with when. */\nexport const blockedMemberSchema = personSchema.extend({\n blockedAt: z.iso.datetime(),\n});\nexport type BlockedMember = z.infer<typeof blockedMemberSchema>;\n\n/** My blocked members, newest block first. */\nexport const blockedPageSchema = paginatedSchema(blockedMemberSchema);\nexport type BlockedPage = z.infer<typeof blockedPageSchema>;\n"]}
@@ -36,18 +36,20 @@
36
36
  */
37
37
  import { z } from 'zod';
38
38
  /** ⚠ Stored per ledger row: append only. */
39
- export declare const CONTRIBUTION_KIND_VALUES: readonly ["feedback_helpful", "tester_confirmed", "review_helpful", "review_written"];
39
+ export declare const CONTRIBUTION_KIND_VALUES: readonly ["feedback_helpful", "tester_confirmed", "review_helpful", "review_written", "content_upvoted", "comment_upvoted"];
40
40
  export declare const contributionKindSchema: z.ZodEnum<{
41
41
  feedback_helpful: "feedback_helpful";
42
42
  tester_confirmed: "tester_confirmed";
43
43
  review_helpful: "review_helpful";
44
44
  review_written: "review_written";
45
+ content_upvoted: "content_upvoted";
46
+ comment_upvoted: "comment_upvoted";
45
47
  }>;
46
48
  /**
47
49
  * The kinds that are actually awarded (0.7.0): every kind but `review_written`,
48
50
  * which is never awarded any more. "How points are earned" lists these.
49
51
  */
50
- export declare const CONTRIBUTION_AWARDED_KIND_VALUES: ("feedback_helpful" | "tester_confirmed" | "review_helpful")[];
52
+ export declare const CONTRIBUTION_AWARDED_KIND_VALUES: ("feedback_helpful" | "tester_confirmed" | "review_helpful" | "content_upvoted" | "comment_upvoted")[];
51
53
  export type ContributionKind = z.infer<typeof contributionKindSchema>;
52
54
  /**
53
55
  * Points per kind. Exhaustive by type. Changing a number changes FUTURE rows;
@@ -58,7 +60,18 @@ export declare const CONTRIBUTION_POINTS: {
58
60
  readonly tester_confirmed: 15;
59
61
  readonly review_helpful: 2;
60
62
  readonly review_written: 3;
63
+ readonly content_upvoted: 5;
64
+ readonly comment_upvoted: 5;
61
65
  };
66
+ /**
67
+ * The net score (up minus down votes) at which an item earns its author
68
+ * points (2026-11-23, Jansathi's "qualified" content): ONE award per item. It
69
+ * stands while the score stays at or above the line, and is taken back when it
70
+ * falls below or the item goes (deleted, hidden); climbing back restores that
71
+ * same award, never a second. Nothing for votes on your own item.
72
+ */
73
+ export declare const CONTENT_UPVOTE_MILESTONE = 20;
74
+ export declare const COMMENT_UPVOTE_MILESTONE = 5;
62
75
  /** One line of "how I earned my points". */
63
76
  export declare const contributionEntrySchema: z.ZodObject<{
64
77
  id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
@@ -67,6 +80,8 @@ export declare const contributionEntrySchema: z.ZodObject<{
67
80
  tester_confirmed: "tester_confirmed";
68
81
  review_helpful: "review_helpful";
69
82
  review_written: "review_written";
83
+ content_upvoted: "content_upvoted";
84
+ comment_upvoted: "comment_upvoted";
70
85
  }>;
71
86
  points: z.ZodNumber;
72
87
  actor: z.ZodNullable<z.ZodObject<{
@@ -104,6 +119,8 @@ export declare const contributionPageSchema: z.ZodObject<{
104
119
  tester_confirmed: "tester_confirmed";
105
120
  review_helpful: "review_helpful";
106
121
  review_written: "review_written";
122
+ content_upvoted: "content_upvoted";
123
+ comment_upvoted: "comment_upvoted";
107
124
  }>;
108
125
  points: z.ZodNumber;
109
126
  actor: z.ZodNullable<z.ZodObject<{
@@ -148,11 +165,12 @@ export declare const contributionPeriodSchema: z.ZodEnum<{
148
165
  }>;
149
166
  export type ContributionPeriod = z.infer<typeof contributionPeriodSchema>;
150
167
  /** What a ledger row was earned on: a comment, a product or a review. The backend's storage's own values, from here like every other list (0.20.0). */
151
- export declare const CONTRIBUTION_SOURCE_VALUES: readonly ["comment", "product", "review"];
168
+ export declare const CONTRIBUTION_SOURCE_VALUES: readonly ["comment", "product", "review", "content"];
152
169
  export declare const contributionSourceSchema: z.ZodEnum<{
153
170
  product: "product";
154
171
  comment: "comment";
155
172
  review: "review";
173
+ content: "content";
156
174
  }>;
157
175
  export type ContributionSource = z.infer<typeof contributionSourceSchema>;
158
176
  /** `GET /api/v1/contributions/leaderboard?period=` (0.10.0). A query string, so the default is the server's. */
@@ -1 +1 @@
1
- {"version":3,"file":"contributions.d.ts","sourceRoot":"","sources":["../../../src/domains/contributions/contributions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,4CAA4C;AAC5C,eAAO,MAAM,wBAAwB,uFAK3B,CAAC;AACX,eAAO,MAAM,sBAAsB;;;;;EAAmC,CAAC;AACvE;;;GAGG;AACH,eAAO,MAAM,gCAAgC,gEAG5C,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;CAKqB,CAAC;AAEtD,4CAA4C;AAC5C,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoBlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA2C,CAAC;AAC/E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,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AAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;iBAKxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC"}
@@ -46,6 +46,10 @@ export const CONTRIBUTION_KIND_VALUES = [
46
46
  'tester_confirmed',
47
47
  'review_helpful',
48
48
  'review_written',
49
+ /** A post or poll of yours reached `CONTENT_UPVOTE_MILESTONE` net up votes (2026-11-23). */
50
+ 'content_upvoted',
51
+ /** A comment of yours reached `COMMENT_UPVOTE_MILESTONE` net up votes (2026-11-23). */
52
+ 'comment_upvoted',
49
53
  ];
50
54
  export const contributionKindSchema = z.enum(CONTRIBUTION_KIND_VALUES);
51
55
  /**
@@ -62,7 +66,18 @@ export const CONTRIBUTION_POINTS = {
62
66
  tester_confirmed: 15,
63
67
  review_helpful: 2,
64
68
  review_written: 3,
69
+ content_upvoted: 5,
70
+ comment_upvoted: 5,
65
71
  };
72
+ /**
73
+ * The net score (up minus down votes) at which an item earns its author
74
+ * points (2026-11-23, Jansathi's "qualified" content): ONE award per item. It
75
+ * stands while the score stays at or above the line, and is taken back when it
76
+ * falls below or the item goes (deleted, hidden); climbing back restores that
77
+ * same award, never a second. Nothing for votes on your own item.
78
+ */
79
+ export const CONTENT_UPVOTE_MILESTONE = 20;
80
+ export const COMMENT_UPVOTE_MILESTONE = 5;
66
81
  /** One line of "how I earned my points". */
67
82
  export const contributionEntrySchema = z.object({
68
83
  id: objectIdSchema,
@@ -70,15 +85,17 @@ export const contributionEntrySchema = z.object({
70
85
  /** What it was actually awarded: below the kind's points when a cap applied. */
71
86
  points: z.number().int().positive(),
72
87
  /**
73
- * Who recognised it; null for a deleted account, and for `review_helpful`
74
- * (a Helpful vote is anonymous: the review shows only a count).
88
+ * Who recognised it; null for a deleted account, for `review_helpful` (a
89
+ * Helpful vote is anonymous: the review shows only a count), and for
90
+ * `content_upvoted` / `comment_upvoted` (votes are anonymous too).
75
91
  */
76
92
  actor: memberBylineSchema.nullable(),
77
93
  /** The product it was about, while it exists. */
78
94
  product: productChipSchema.optional(),
79
95
  /**
80
96
  * What earned it, so the row opens it: the post or poll and the comment for
81
- * `feedback_helpful`, the review for `review_helpful`.
97
+ * `feedback_helpful` and `comment_upvoted`, the post or poll for
98
+ * `content_upvoted`, the review for `review_helpful`.
82
99
  */
83
100
  content: z.object({ kind: contentKindSchema, id: objectIdSchema }).optional(),
84
101
  commentId: objectIdSchema.optional(),
@@ -95,7 +112,7 @@ export const contributionPageSchema = paginatedSchema(contributionEntrySchema);
95
112
  export const CONTRIBUTION_PERIOD_VALUES = ['recent', 'all'];
96
113
  export const contributionPeriodSchema = z.enum(CONTRIBUTION_PERIOD_VALUES);
97
114
  /** What a ledger row was earned on: a comment, a product or a review. The backend's storage's own values, from here like every other list (0.20.0). */
98
- export const CONTRIBUTION_SOURCE_VALUES = ['comment', 'product', 'review'];
115
+ export const CONTRIBUTION_SOURCE_VALUES = ['comment', 'product', 'review', 'content'];
99
116
  export const contributionSourceSchema = z.enum(CONTRIBUTION_SOURCE_VALUES);
100
117
  /** `GET /api/v1/contributions/leaderboard?period=` (0.10.0). A query string, so the default is the server's. */
101
118
  export const contributionLeaderboardQuerySchema = z.object({
@@ -1 +1 @@
1
- {"version":3,"file":"contributions.js","sourceRoot":"","sources":["../../../src/domains/contributions/contributions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBA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AAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CACvC,CAAC,CAAC;AAGH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,MAAM,EAAE,wBAAwB,CAAC,QAAQ,EAAE;IAC3C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,6BAA6B,CAAC;IAC7C,GAAG,EAAE,qBAAqB,CAAC,QAAQ,EAAE;IACrC,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — Contribution: the help a member gives, recognised\n *\n * The score counts HELP GIVEN, and only what OTHER members recognise:\n *\n * feedback_helpful a product's team marks your comment \"this helped\" +10\n * tester_confirmed a product's team confirms you tested their product +15\n * review_helpful another member finds your review helpful +2\n * (at most `REVIEW_HELPFUL_POINTS_MAX` per review)\n *\n * `review_written` is still listed so older rows and clients parse, but it is\n * NEVER awarded (0.7.0): writing a review is your own act, and the score\n * counts only what others recognise. A review earns through Helpful votes.\n *\n * Nothing a member does for their OWN product counts, and nothing their own\n * product receives, so the score cannot be bought with a popular product.\n *\n * Against farming: one member can earn at most `CONTRIBUTION_PAIR_POINTS_MAX`\n * points from any ONE other member over `CONTRIBUTION_PAIR_WINDOW_DAYS`, so two founders cannot trade\n * Helpful marks into a high score.\n *\n * EVERY POINT IS A ROW (the ledger), so a score can be explained (\"how did I\n * earn this?\"), checked and re-tuned. A point stands while what earned it\n * stands: unmarking, withdrawing a vote, deleting the review or comment, or\n * staff removing it takes the point back. An hourly job recounts every score\n * from the ledger, so a total can never drift for long.\n *\n * Routes (all signed in):\n * GET /api/v1/contributions/me paginationQuerySchema -> contributionPageSchema\n * GET /api/v1/contributions/leaderboard contributionLeaderboardQuerySchema\n * -> contributionLeaderboardSchema\n *\n * The score itself is on the profile and the card (`contributionSummarySchema`).\n *\n * @module founder-schema/domains/contributions\n */\n\nimport { z } from 'zod';\nimport { emptyStringToUndefined, objectIdSchema } from '../../core/common.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { contentKindSchema } from '../feed/feed.js';\nimport { productChipSchema } from '../products/products.js';\nimport { memberBylineSchema } from '../profile/founder-profile.js';\n\n/** ⚠ Stored per ledger row: append only. */\nexport const CONTRIBUTION_KIND_VALUES = [\n 'feedback_helpful',\n 'tester_confirmed',\n 'review_helpful',\n 'review_written',\n] as const;\nexport const contributionKindSchema = z.enum(CONTRIBUTION_KIND_VALUES);\n/**\n * The kinds that are actually awarded (0.7.0): every kind but `review_written`,\n * which is never awarded any more. \"How points are earned\" lists these.\n */\nexport const CONTRIBUTION_AWARDED_KIND_VALUES = CONTRIBUTION_KIND_VALUES.filter(\n (k): k is Exclude<(typeof CONTRIBUTION_KIND_VALUES)[number], 'review_written'> =>\n k !== 'review_written',\n);\nexport type ContributionKind = z.infer<typeof contributionKindSchema>;\n\n/**\n * Points per kind. Exhaustive by type. Changing a number changes FUTURE rows;\n * the hourly recount sums what each row was actually awarded.\n */\nexport const CONTRIBUTION_POINTS = {\n feedback_helpful: 10,\n tester_confirmed: 15,\n review_helpful: 2,\n review_written: 3,\n} as const satisfies Record<ContributionKind, number>;\n\n/** One line of \"how I earned my points\". */\nexport const contributionEntrySchema = z.object({\n id: objectIdSchema,\n kind: contributionKindSchema,\n /** What it was actually awarded: below the kind's points when a cap applied. */\n points: z.number().int().positive(),\n /**\n * Who recognised it; null for a deleted account, and for `review_helpful`\n * (a Helpful vote is anonymous: the review shows only a count).\n */\n actor: memberBylineSchema.nullable(),\n /** The product it was about, while it exists. */\n product: productChipSchema.optional(),\n /**\n * What earned it, so the row opens it: the post or poll and the comment for\n * `feedback_helpful`, the review for `review_helpful`.\n */\n content: z.object({ kind: contentKindSchema, id: objectIdSchema }).optional(),\n commentId: objectIdSchema.optional(),\n reviewId: objectIdSchema.optional(),\n createdAt: z.iso.datetime(),\n});\nexport type ContributionEntry = z.infer<typeof contributionEntrySchema>;\n\nexport const contributionPageSchema = paginatedSchema(contributionEntrySchema);\nexport type ContributionPage = z.infer<typeof contributionPageSchema>;\n\n/**\n * Which points a board ranks by (0.10.0): `recent`, the last\n * `CONTRIBUTION_RECENT_DAYS` days (the default, so a newer member can still\n * climb), or `all`, every point ever earned. Every board is GLOBAL: one list\n * for the whole circle (the user's ruling, 2026-10-11).\n */\nexport const CONTRIBUTION_PERIOD_VALUES = ['recent', 'all'] as const;\nexport const contributionPeriodSchema = z.enum(CONTRIBUTION_PERIOD_VALUES);\nexport type ContributionPeriod = z.infer<typeof contributionPeriodSchema>;\n\n/** What a ledger row was earned on: a comment, a product or a review. The backend's storage's own values, from here like every other list (0.20.0). */\nexport const CONTRIBUTION_SOURCE_VALUES = ['comment', 'product', 'review'] as const;\nexport const contributionSourceSchema = z.enum(CONTRIBUTION_SOURCE_VALUES);\nexport type ContributionSource = z.infer<typeof contributionSourceSchema>;\n\n/** `GET /api/v1/contributions/leaderboard?period=` (0.10.0). A query string, so the default is the server's. */\nexport const contributionLeaderboardQuerySchema = z.object({\n // `?period=` with nothing after it is no period, as on every other query.\n period: z.preprocess(emptyStringToUndefined, contributionPeriodSchema.default('recent')),\n});\nexport type ContributionLeaderboardQuery = z.infer<typeof contributionLeaderboardQuerySchema>;\n\n/** One row of a board: its rank, who, and their points in the period. */\nexport const contributionLeaderEntrySchema = z.object({\n rank: z.number().int().positive(),\n member: memberBylineSchema,\n /** Points earned in the period. */\n points: z.number().int().positive(),\n});\nexport type ContributionLeaderEntry = z.infer<typeof contributionLeaderEntrySchema>;\n\n/**\n * The signed-in member's own place on the board (0.10.0), on its first page or\n * not. Ranked in the SAME order, among the SAME members, as the list, so their\n * rank is always their position. `rank` is null while they are not on the\n * board: no points in the period (a board ranks help given, and nobody is\n * 40th for nothing), or a profile no longer listed. `points` are theirs either\n * way.\n */\nexport const contributionYouSchema = z.object({\n rank: z.number().int().positive().nullable(),\n points: z.number().int().nonnegative(),\n});\nexport type ContributionYou = z.infer<typeof contributionYouSchema>;\n\n/**\n * Top helpers, best first, at most `CONTRIBUTION_LEADERBOARD_SIZE`. Read from\n * the live counters, which move the moment help is recognised; only points\n * leaving the `recent` window wait for the hourly recount. `computedAt` is the\n * latest recount among the rows shown (null before the first run, and for an\n * empty board).\n *\n * `period` and `you` (0.10.0) are OPTIONAL on read, so this client keeps\n * parsing a server from before them: without `you` the board simply shows no\n * row of the member's own.\n */\nexport const contributionLeaderboardSchema = z.object({\n period: contributionPeriodSchema.optional(),\n items: z.array(contributionLeaderEntrySchema),\n you: contributionYouSchema.optional(),\n computedAt: z.iso.datetime().nullable(),\n});\nexport type ContributionLeaderboard = z.infer<typeof contributionLeaderboardSchema>;\n"]}
1
+ {"version":3,"file":"contributions.js","sourceRoot":"","sources":["../../../src/domains/contributions/contributions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,4CAA4C;AAC5C,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,kBAAkB;IAClB,kBAAkB;IAClB,gBAAgB;IAChB,gBAAgB;IAChB,4FAA4F;IAC5F,iBAAiB;IACjB,uFAAuF;IACvF,iBAAiB;CACT,CAAC;AACX,MAAM,CAAC,MAAM,sBAA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BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,MAAM,EAAE,wBAAwB,CAAC,QAAQ,EAAE;IAC3C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,6BAA6B,CAAC;IAC7C,GAAG,EAAE,qBAAqB,CAAC,QAAQ,EAAE;IACrC,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — Contribution: the help a member gives, recognised\n *\n * The score counts HELP GIVEN, and only what OTHER members recognise:\n *\n * feedback_helpful a product's team marks your comment \"this helped\" +10\n * tester_confirmed a product's team confirms you tested their product +15\n * review_helpful another member finds your review helpful +2\n * (at most `REVIEW_HELPFUL_POINTS_MAX` per review)\n *\n * `review_written` is still listed so older rows and clients parse, but it is\n * NEVER awarded (0.7.0): writing a review is your own act, and the score\n * counts only what others recognise. A review earns through Helpful votes.\n *\n * Nothing a member does for their OWN product counts, and nothing their own\n * product receives, so the score cannot be bought with a popular product.\n *\n * Against farming: one member can earn at most `CONTRIBUTION_PAIR_POINTS_MAX`\n * points from any ONE other member over `CONTRIBUTION_PAIR_WINDOW_DAYS`, so two founders cannot trade\n * Helpful marks into a high score.\n *\n * EVERY POINT IS A ROW (the ledger), so a score can be explained (\"how did I\n * earn this?\"), checked and re-tuned. A point stands while what earned it\n * stands: unmarking, withdrawing a vote, deleting the review or comment, or\n * staff removing it takes the point back. An hourly job recounts every score\n * from the ledger, so a total can never drift for long.\n *\n * Routes (all signed in):\n * GET /api/v1/contributions/me paginationQuerySchema -> contributionPageSchema\n * GET /api/v1/contributions/leaderboard contributionLeaderboardQuerySchema\n * -> contributionLeaderboardSchema\n *\n * The score itself is on the profile and the card (`contributionSummarySchema`).\n *\n * @module founder-schema/domains/contributions\n */\n\nimport { z } from 'zod';\nimport { emptyStringToUndefined, objectIdSchema } from '../../core/common.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { contentKindSchema } from '../feed/feed.js';\nimport { productChipSchema } from '../products/products.js';\nimport { memberBylineSchema } from '../profile/founder-profile.js';\n\n/** ⚠ Stored per ledger row: append only. */\nexport const CONTRIBUTION_KIND_VALUES = [\n 'feedback_helpful',\n 'tester_confirmed',\n 'review_helpful',\n 'review_written',\n /** A post or poll of yours reached `CONTENT_UPVOTE_MILESTONE` net up votes (2026-11-23). */\n 'content_upvoted',\n /** A comment of yours reached `COMMENT_UPVOTE_MILESTONE` net up votes (2026-11-23). */\n 'comment_upvoted',\n] as const;\nexport const contributionKindSchema = z.enum(CONTRIBUTION_KIND_VALUES);\n/**\n * The kinds that are actually awarded (0.7.0): every kind but `review_written`,\n * which is never awarded any more. \"How points are earned\" lists these.\n */\nexport const CONTRIBUTION_AWARDED_KIND_VALUES = CONTRIBUTION_KIND_VALUES.filter(\n (k): k is Exclude<(typeof CONTRIBUTION_KIND_VALUES)[number], 'review_written'> =>\n k !== 'review_written',\n);\nexport type ContributionKind = z.infer<typeof contributionKindSchema>;\n\n/**\n * Points per kind. Exhaustive by type. Changing a number changes FUTURE rows;\n * the hourly recount sums what each row was actually awarded.\n */\nexport const CONTRIBUTION_POINTS = {\n feedback_helpful: 10,\n tester_confirmed: 15,\n review_helpful: 2,\n review_written: 3,\n content_upvoted: 5,\n comment_upvoted: 5,\n} as const satisfies Record<ContributionKind, number>;\n\n/**\n * The net score (up minus down votes) at which an item earns its author\n * points (2026-11-23, Jansathi's \"qualified\" content): ONE award per item. It\n * stands while the score stays at or above the line, and is taken back when it\n * falls below or the item goes (deleted, hidden); climbing back restores that\n * same award, never a second. Nothing for votes on your own item.\n */\nexport const CONTENT_UPVOTE_MILESTONE = 20;\nexport const COMMENT_UPVOTE_MILESTONE = 5;\n\n/** One line of \"how I earned my points\". */\nexport const contributionEntrySchema = z.object({\n id: objectIdSchema,\n kind: contributionKindSchema,\n /** What it was actually awarded: below the kind's points when a cap applied. */\n points: z.number().int().positive(),\n /**\n * Who recognised it; null for a deleted account, for `review_helpful` (a\n * Helpful vote is anonymous: the review shows only a count), and for\n * `content_upvoted` / `comment_upvoted` (votes are anonymous too).\n */\n actor: memberBylineSchema.nullable(),\n /** The product it was about, while it exists. */\n product: productChipSchema.optional(),\n /**\n * What earned it, so the row opens it: the post or poll and the comment for\n * `feedback_helpful` and `comment_upvoted`, the post or poll for\n * `content_upvoted`, the review for `review_helpful`.\n */\n content: z.object({ kind: contentKindSchema, id: objectIdSchema }).optional(),\n commentId: objectIdSchema.optional(),\n reviewId: objectIdSchema.optional(),\n createdAt: z.iso.datetime(),\n});\nexport type ContributionEntry = z.infer<typeof contributionEntrySchema>;\n\nexport const contributionPageSchema = paginatedSchema(contributionEntrySchema);\nexport type ContributionPage = z.infer<typeof contributionPageSchema>;\n\n/**\n * Which points a board ranks by (0.10.0): `recent`, the last\n * `CONTRIBUTION_RECENT_DAYS` days (the default, so a newer member can still\n * climb), or `all`, every point ever earned. Every board is GLOBAL: one list\n * for the whole circle (the user's ruling, 2026-10-11).\n */\nexport const CONTRIBUTION_PERIOD_VALUES = ['recent', 'all'] as const;\nexport const contributionPeriodSchema = z.enum(CONTRIBUTION_PERIOD_VALUES);\nexport type ContributionPeriod = z.infer<typeof contributionPeriodSchema>;\n\n/** What a ledger row was earned on: a comment, a product or a review. The backend's storage's own values, from here like every other list (0.20.0). */\nexport const CONTRIBUTION_SOURCE_VALUES = ['comment', 'product', 'review', 'content'] as const;\nexport const contributionSourceSchema = z.enum(CONTRIBUTION_SOURCE_VALUES);\nexport type ContributionSource = z.infer<typeof contributionSourceSchema>;\n\n/** `GET /api/v1/contributions/leaderboard?period=` (0.10.0). A query string, so the default is the server's. */\nexport const contributionLeaderboardQuerySchema = z.object({\n // `?period=` with nothing after it is no period, as on every other query.\n period: z.preprocess(emptyStringToUndefined, contributionPeriodSchema.default('recent')),\n});\nexport type ContributionLeaderboardQuery = z.infer<typeof contributionLeaderboardQuerySchema>;\n\n/** One row of a board: its rank, who, and their points in the period. */\nexport const contributionLeaderEntrySchema = z.object({\n rank: z.number().int().positive(),\n member: memberBylineSchema,\n /** Points earned in the period. */\n points: z.number().int().positive(),\n});\nexport type ContributionLeaderEntry = z.infer<typeof contributionLeaderEntrySchema>;\n\n/**\n * The signed-in member's own place on the board (0.10.0), on its first page or\n * not. Ranked in the SAME order, among the SAME members, as the list, so their\n * rank is always their position. `rank` is null while they are not on the\n * board: no points in the period (a board ranks help given, and nobody is\n * 40th for nothing), or a profile no longer listed. `points` are theirs either\n * way.\n */\nexport const contributionYouSchema = z.object({\n rank: z.number().int().positive().nullable(),\n points: z.number().int().nonnegative(),\n});\nexport type ContributionYou = z.infer<typeof contributionYouSchema>;\n\n/**\n * Top helpers, best first, at most `CONTRIBUTION_LEADERBOARD_SIZE`. Read from\n * the live counters, which move the moment help is recognised; only points\n * leaving the `recent` window wait for the hourly recount. `computedAt` is the\n * latest recount among the rows shown (null before the first run, and for an\n * empty board).\n *\n * `period` and `you` (0.10.0) are OPTIONAL on read, so this client keeps\n * parsing a server from before them: without `you` the board simply shows no\n * row of the member's own.\n */\nexport const contributionLeaderboardSchema = z.object({\n period: contributionPeriodSchema.optional(),\n items: z.array(contributionLeaderEntrySchema),\n you: contributionYouSchema.optional(),\n computedAt: z.iso.datetime().nullable(),\n});\nexport type ContributionLeaderboard = z.infer<typeof contributionLeaderboardSchema>;\n"]}