founder-schema 0.8.0 → 0.9.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 (61) hide show
  1. package/README.md +39 -0
  2. package/dist/access/capabilities.d.ts +34 -0
  3. package/dist/access/capabilities.d.ts.map +1 -0
  4. package/dist/access/capabilities.js +35 -0
  5. package/dist/access/capabilities.js.map +1 -0
  6. package/dist/access/permissions.d.ts +20 -1
  7. package/dist/access/permissions.d.ts.map +1 -1
  8. package/dist/access/permissions.js +4 -0
  9. package/dist/access/permissions.js.map +1 -1
  10. package/dist/core/errors.d.ts +33 -1
  11. package/dist/core/errors.d.ts.map +1 -1
  12. package/dist/core/errors.js +57 -0
  13. package/dist/core/errors.js.map +1 -1
  14. package/dist/core/limits.d.ts +12 -0
  15. package/dist/core/limits.d.ts.map +1 -1
  16. package/dist/core/limits.js +13 -0
  17. package/dist/core/limits.js.map +1 -1
  18. package/dist/core/responses.d.ts +47 -0
  19. package/dist/core/responses.d.ts.map +1 -1
  20. package/dist/core/responses.js +7 -0
  21. package/dist/core/responses.js.map +1 -1
  22. package/dist/core/validation.d.ts +6 -0
  23. package/dist/core/validation.d.ts.map +1 -1
  24. package/dist/core/validation.js +6 -0
  25. package/dist/core/validation.js.map +1 -1
  26. package/dist/domains/audit/audit.d.ts +47 -3
  27. package/dist/domains/audit/audit.d.ts.map +1 -1
  28. package/dist/domains/audit/audit.js +40 -4
  29. package/dist/domains/audit/audit.js.map +1 -1
  30. package/dist/domains/communities/communities.d.ts +1537 -0
  31. package/dist/domains/communities/communities.d.ts.map +1 -0
  32. package/dist/domains/communities/communities.js +464 -0
  33. package/dist/domains/communities/communities.js.map +1 -0
  34. package/dist/domains/feed/feed.d.ts +479 -0
  35. package/dist/domains/feed/feed.d.ts.map +1 -1
  36. package/dist/domains/feed/feed.js +45 -1
  37. package/dist/domains/feed/feed.js.map +1 -1
  38. package/dist/domains/media/media.d.ts +7 -1
  39. package/dist/domains/media/media.d.ts.map +1 -1
  40. package/dist/domains/media/media.js +5 -0
  41. package/dist/domains/media/media.js.map +1 -1
  42. package/dist/domains/members/members.d.ts +6 -0
  43. package/dist/domains/members/members.d.ts.map +1 -1
  44. package/dist/domains/members/members.js +5 -0
  45. package/dist/domains/members/members.js.map +1 -1
  46. package/dist/domains/moderation/moderation.d.ts +4 -4
  47. package/dist/domains/notifications/notifications.d.ts +82 -2
  48. package/dist/domains/notifications/notifications.d.ts.map +1 -1
  49. package/dist/domains/notifications/notifications.js +45 -0
  50. package/dist/domains/notifications/notifications.js.map +1 -1
  51. package/dist/domains/team/team.d.ts +22 -0
  52. package/dist/domains/team/team.d.ts.map +1 -1
  53. package/dist/domains/team/team.js +22 -0
  54. package/dist/domains/team/team.js.map +1 -1
  55. package/dist/domains/uploads/uploads.d.ts +1 -0
  56. package/dist/domains/uploads/uploads.d.ts.map +1 -1
  57. package/dist/index.d.ts +5 -3
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +6 -3
  60. package/dist/index.js.map +1 -1
  61. package/package.json +1 -1
@@ -34,6 +34,7 @@ import { emptyStringToUndefined, objectIdSchema, paginationQuerySchema, safeUrlS
34
34
  import { LINK_PREVIEW_DESCRIPTION_MAX, LINK_PREVIEW_TITLE_MAX, MEDIA_ALT_MAX, REPORT_NOTE_MAX, } from '../../core/limits.js';
35
35
  import { paginatedSchema } from '../../core/responses.js';
36
36
  import { VALIDATION_MESSAGE } from '../../core/validation.js';
37
+ import { communityChipSchema } from '../communities/communities.js';
37
38
  import { mediaImageSchema } from '../media/media.js';
38
39
  import { topicSchema } from '../onboarding/onboarding.js';
39
40
  import { productAskSchema, productChipSchema } from '../products/products.js';
@@ -298,6 +299,15 @@ export const contentViewerStateSchema = viewerStateSchema.extend({
298
299
  * cannot write yet (no finished, active profile: `ONBOARDING_INCOMPLETE`).
299
300
  */
300
301
  canRepost: z.boolean(),
302
+ /**
303
+ * On content inside a community only (0.9.0): whether this viewer may take
304
+ * part in it now (react, comment, vote, save, report, edit): an active
305
+ * member of a community that is not archived. False for someone who can
306
+ * read it but has not joined (a public community's reader, staff): offer
307
+ * Join instead of the controls. `canEdit` and `canReport` are false too
308
+ * whenever this is.
309
+ */
310
+ canTakePart: z.boolean().optional(),
301
311
  });
302
312
  // ─── Repost ──────────────────────────────────────────────────────────────────
303
313
  /**
@@ -379,6 +389,14 @@ export const feedPostSchema = z.object({
379
389
  product: productChipSchema.optional(),
380
390
  /** What the post asks of the community about its product. Only with `product`. */
381
391
  ask: productAskSchema.optional(),
392
+ /**
393
+ * The community it was posted in (0.9.0): "in AI Builders". Absent on
394
+ * general content. Never alongside `product`, `ask` or `repostOf`:
395
+ * community content carries no product and is never reposted.
396
+ */
397
+ community: communityChipSchema.optional(),
398
+ /** When a moderator pinned it as one of its community's announcements (0.9.0). */
399
+ pinnedAt: z.iso.datetime().optional(),
382
400
  /**
383
401
  * Present only on a REPOST (0.8.0): the item this post shares, with `text`
384
402
  * as the reposter's own words above it (empty for a plain repost) and no
@@ -442,6 +460,9 @@ export const feedPollSchema = z.object({
442
460
  /** As on a post: "which onboarding flow should we ship?", about a product. */
443
461
  product: productChipSchema.optional(),
444
462
  ask: productAskSchema.optional(),
463
+ /** As on a post (0.9.0). */
464
+ community: communityChipSchema.optional(),
465
+ pinnedAt: z.iso.datetime().optional(),
445
466
  commentCount: z.number().int().nonnegative(),
446
467
  reactionCounts: reactionCountsSchema,
447
468
  /** As on a post (0.8.0). */
@@ -566,6 +587,11 @@ export const authorParamsSchema = z.object({ userId: objectIdSchema });
566
587
  * same shape. `nextCursor` is null on the last page.
567
588
  */
568
589
  export const feedPageSchema = paginatedSchema(feedItemSchema);
590
+ /**
591
+ * A community's pinned announcements (0.9.0), most recently pinned first, at
592
+ * most `COMMUNITY_PINS_MAX` (domains/communities). Never paged.
593
+ */
594
+ export const pinnedItemsSchema = z.object({ items: z.array(feedItemSchema) });
569
595
  /** A page of a thread: top-level comments, or one comment's replies. */
570
596
  export const commentPageSchema = paginatedSchema(feedCommentSchema);
571
597
  /**
@@ -642,6 +668,14 @@ const aboutAProduct = {
642
668
  ask: productAskSchema.optional(),
643
669
  };
644
670
  const askNeedsProduct = (b) => b.ask === undefined || b.productId !== undefined;
671
+ /**
672
+ * Which community it is posted in (0.9.0), set when written and never moved.
673
+ * The author must be an active member (`COMMUNITY_JOIN_REQUIRED`) and it must
674
+ * not be archived (`COMMUNITY_ARCHIVED`). Community content carries no product
675
+ * and no ask (`communityWithProduct`); the server checks that too.
676
+ */
677
+ const inACommunity = { communityId: objectIdSchema.optional() };
678
+ const communityWithoutProduct = (b) => b.communityId === undefined || (b.productId === undefined && b.ask === undefined);
645
679
  /**
646
680
  * A post must carry something. Text alone, media alone, or both; empty is
647
681
  * refused here rather than reaching the feed as a blank card.
@@ -654,6 +688,7 @@ export const createPostBodySchema = z
654
688
  /** Absent means untagged, which means interest matching cannot find it. */
655
689
  topics: z.array(topicSchema).max(MAX_TOPICS).optional(),
656
690
  ...aboutAProduct,
691
+ ...inACommunity,
657
692
  })
658
693
  .refine((b) => Boolean(b.text?.length) || Boolean(b.media?.length), {
659
694
  error: VALIDATION_MESSAGE.postEmpty,
@@ -663,7 +698,11 @@ export const createPostBodySchema = z
663
698
  error: VALIDATION_MESSAGE.mediaDuplicate,
664
699
  path: ['media'],
665
700
  })
666
- .refine(askNeedsProduct, { error: VALIDATION_MESSAGE.askWithoutProduct, path: ['ask'] });
701
+ .refine(askNeedsProduct, { error: VALIDATION_MESSAGE.askWithoutProduct, path: ['ask'] })
702
+ .refine(communityWithoutProduct, {
703
+ error: VALIDATION_MESSAGE.communityWithProduct,
704
+ path: ['communityId'],
705
+ });
667
706
  /** Only the text is editable. Changing media after the fact makes every
668
707
  * earlier reply look like a reply to something else. */
669
708
  export const updatePostBodySchema = z.object({
@@ -685,8 +724,13 @@ export const createPollBodySchema = z
685
724
  allowsMultipleChoices: z.boolean(),
686
725
  topics: z.array(topicSchema).max(MAX_TOPICS).optional(),
687
726
  ...aboutAProduct,
727
+ ...inACommunity,
688
728
  })
689
729
  .refine(askNeedsProduct, { error: VALIDATION_MESSAGE.askWithoutProduct, path: ['ask'] })
730
+ .refine(communityWithoutProduct, {
731
+ error: VALIDATION_MESSAGE.communityWithProduct,
732
+ path: ['communityId'],
733
+ })
690
734
  .refine((b) => {
691
735
  const seen = new Set();
692
736
  for (const o of b.options) {
@@ -1 +1 @@
1
- {"version":3,"file":"feed.js","sourceRoot":"","sources":["../../../src/domains/feed/feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,aAAa,EACb,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,gFAAgF;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACxC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AACjC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAA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B,CAAC,CAAC;AAG/D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE;CACxD,CAAC,CAAC;AAGH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,uEAAuE;IACvE,WAAW,EAAE,sBAAsB;IACnC,SAAS,EAAE,cAAc;IACzB,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE;CAC7B,CAAC,CAAC;AAGH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,SAAS,EAAE,cAAc;IACzB,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC;AAGH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,WAAW,EAAE,iBAAiB;IAC9B,SAAS,EAAE,cAAc;IACzB,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;CACxB,CAAC,CAAC;AAGH;mEACmE;AACnE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,cAAc;CACrB,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — Feed wire shapes: post, poll, comment, reaction\n *\n * ADAPTED FROM `jansathi-community-schema`, NOT DEPENDENT ON IT.\n *\n * The user ruled on 2026-09-21 that Founder Circle is a standalone app, so\n * these shapes are copied and cut down rather than imported. The reason is\n * worth keeping: `jansathi-community-schema` encodes Jansathi's reach levels,\n * community designations, official-area kinds and crowdfunding audiences.\n * Depending on it would put all of that permanently inside our contract for a\n * feed that has none of those concepts, and would mean a Jansathi publish can\n * break this product.\n *\n * DELIBERATELY NOT PORTED, so nobody \"restores\" them:\n * - the five civic verticals (lost_found, suggestions_complaints,\n * donate_item, crowdfunding, event). `contentKind` here is post | poll\n * only; comment threads and bookmarks key off it, reactions off the same\n * union plus `comment`, and reports off that plus a product and a review\n * (`reportTargetKindSchema`, 0.6.0).\n * - official communities, designations, identity verification badges.\n * - social score, and the whole area-proximity ranking vocabulary\n * (local / district / state / national / global).\n * - `areaLineage` as a REQUIRED authorship snapshot. Jansathi gates its\n * composer on a declared residence resolving to Indian district level or\n * deeper; the user ruled location is never mandatory here, so nothing in\n * this file requires one.\n * - anonymous posting, which in Jansathi is gated on identity verification\n * we do not have. A founders' network is an identified network.\n *\n * @module founder-schema/domains/feed\n */\n\nimport { z } from 'zod';\nimport {\n emptyStringToUndefined,\n objectIdSchema,\n paginationQuerySchema,\n safeUrlSchema,\n} from '../../core/common.js';\nimport {\n LINK_PREVIEW_DESCRIPTION_MAX,\n LINK_PREVIEW_TITLE_MAX,\n MEDIA_ALT_MAX,\n REPORT_NOTE_MAX,\n} from '../../core/limits.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { VALIDATION_MESSAGE } from '../../core/validation.js';\nimport { mediaImageSchema } from '../media/media.js';\nimport { topicSchema } from '../onboarding/onboarding.js';\nimport { productAskSchema, productChipSchema } from '../products/products.js';\nimport { memberBylineSchema } from '../profile/founder-profile.js';\n\n// ─── Limits ──────────────────────────────────────────────────────────────────\n\n/**\n * Exported because the composer must count down to the SAME number the server\n * rejects at. A client-side limit that disagrees with the server is a message\n * a member cannot send and cannot see why.\n */\nexport const POST_MAX_BODY_CHARS = 5000;\n/**\n * Total attachments on one post, images and videos together.\n *\n * ONE cap over ONE ordered list, rather than Jansathi's separate image and\n * video arrays. A member who posts a screenshot, then a clip, then another\n * screenshot means that order, and two parallel arrays cannot express it: the\n * card would show both images and then the video, which is not what was\n * written.\n */\nexport const POST_MAX_MEDIA = 10;\n/**\n * Topics per item.\n *\n * Capped low on purpose: a post tagged with everything is about nothing, and\n * one tagged with ten matches every member, which is how a relevance feature\n * turns back into a chronological one.\n */\nexport const MAX_TOPICS = 3;\nexport const COMMENT_MAX_BODY_CHARS = 2000;\n\nexport const POLL_QUESTION_MAX_CHARS = 280;\nexport const POLL_OPTION_MAX_CHARS = 80;\nexport const POLL_MIN_OPTIONS = 2;\nexport const POLL_MAX_OPTIONS = 6;\n/** 5 minutes. Below this a poll closes before anyone sees it. */\nexport const POLL_MIN_DURATION_MS = 5 * 60 * 1000;\n/** 30 days. */\nexport const POLL_MAX_DURATION_MS = 30 * 24 * 60 * 60 * 1000;\n\n/**\n * How long after writing it the author may still edit a post or a comment.\n *\n * A window rather than forever: an edit after people have reacted changes what\n * they reacted to. Deletion has no window, because a member must always be able\n * to remove their own words. The server is the gate (`EDIT_WINDOW_CLOSED`);\n * a client uses this to stop offering Edit at the moment the server would\n * start refusing it, instead of on the next reload.\n */\nexport const EDIT_WINDOW_MS = 15 * 60 * 1000;\n\n// ─── Enums ───────────────────────────────────────────────────────────────────\n\n/**\n * What can appear in the feed. Two kinds, not seven.\n *\n * Engagement is keyed by `(contentKind, contentId)` so one engagement bar\n * serves both, and comments hang off the same pair. Adding a kind later is\n * additive; the union is deliberately narrow now so the client never has to\n * handle a kind this product does not have.\n */\nexport const CONTENT_KIND_VALUES = ['post', 'poll'] as const;\nexport const contentKindSchema = z.enum(CONTENT_KIND_VALUES);\nexport type ContentKind = z.infer<typeof contentKindSchema>;\n\n/**\n * What a reaction or a report can point at: a feed item, or a comment on one.\n *\n * Wider than `ContentKind` on purpose. A comment carries reaction counts and a\n * viewer reaction, and a comment can be abusive, so both reach it. A bookmark\n * and a comment thread cannot: they take `ContentKind`. Until 0.2.0 the\n * reaction and report RESPONSES were typed `ContentKind` while the routes\n * accepted comments, so every answer about a comment broke this contract.\n */\nexport const ENGAGEMENT_TARGET_KIND_VALUES = [...CONTENT_KIND_VALUES, 'comment'] as const;\nexport const engagementTargetKindSchema = z.enum(ENGAGEMENT_TARGET_KIND_VALUES);\nexport type EngagementTargetKind = z.infer<typeof engagementTargetKindSchema>;\n\n/**\n * What a member can REPORT (0.6.0): everything a reaction can reach, plus a\n * product page and a review. Each has its own report route; the answer and the\n * moderation queue use this one list.\n */\nexport const REPORT_TARGET_KIND_VALUES = [\n ...ENGAGEMENT_TARGET_KIND_VALUES,\n 'product',\n 'review',\n] as const;\nexport const reportTargetKindSchema = z.enum(REPORT_TARGET_KIND_VALUES);\nexport type ReportTargetKind = z.infer<typeof reportTargetKindSchema>;\n\n/**\n * Every reaction a row can hold. The first four were Founder Circle's own;\n * `love`, `support` and `haha` came from Jansathi in 0.8.0 (the user's set,\n * 2026-10-07), so the feed feels like the community app members know.\n *\n * ⚠️ These values are stored per reaction row, so removing one orphans data.\n * Append only. A value that should no longer be OFFERED leaves\n * `REACTION_PICKER_VALUES` instead, and stays here so old rows still read.\n */\nexport const REACTION_TYPE_VALUES = [\n 'like',\n 'celebrate',\n 'insightful',\n 'curious',\n 'love',\n 'support',\n 'haha',\n] as const;\nexport const reactionTypeSchema = z.enum(REACTION_TYPE_VALUES);\nexport type ReactionType = z.infer<typeof reactionTypeSchema>;\n\n/**\n * What the picker offers, IN ORDER (the user's set, 2026-10-07). A member can\n * set only these; `curious` is no longer offered, but a member who chose it\n * keeps it, sees it as their reaction, and can clear it.\n *\n * The order is the schema's, not a client literal: the backend accepts only\n * these on a write (`setReactionBodySchema`), and two lists that must agree\n * belong in one place.\n */\nexport const REACTION_PICKER_VALUES = [\n 'like',\n 'love',\n 'celebrate',\n 'insightful',\n 'support',\n 'haha',\n] as const satisfies readonly ReactionType[];\nexport const pickableReactionSchema = z.enum(REACTION_PICKER_VALUES);\nexport type PickableReaction = z.infer<typeof pickableReactionSchema>;\n\n/**\n * Feed ordering.\n *\n * `new` is the default here, unlike Jansathi where `hot` leads. A hot ranking\n * needs volume to be meaningful, and a brand-new network ranking a handful of\n * posts by a blended score mostly hides the newest thing somebody just wrote.\n * Revisit when there is enough content for `hot` to mean anything.\n */\nexport const FEED_SORT_VALUES = ['new', 'top'] as const;\nexport const feedSortSchema = z.enum(FEED_SORT_VALUES);\nexport type FeedSort = z.infer<typeof feedSortSchema>;\n\n/**\n * Counts keyed by reaction type, e.g. `{ like: 4, celebrate: 1 }`. Only the\n * reactions an item actually has need appear.\n *\n * ⚠️ `partialRecord`, NOT `record`. In Zod 4 an enum-keyed `z.record` is\n * EXHAUSTIVE: it demands every key, so `{ like: 4 }` fails with three missing\n * keys and `{}` fails with four. That would force the server to ship a zero for\n * every reaction on every item, and the day a fifth reaction is added every\n * previously stored payload and every older client stops parsing.\n * `partialRecord` keeps the key validation without the exhaustiveness, so an\n * unknown key like Jansathi's `support` is still refused.\n */\nexport const reactionCountsSchema = z.partialRecord(\n reactionTypeSchema,\n z.number().int().nonnegative(),\n);\nexport type ReactionCounts = z.infer<typeof reactionCountsSchema>;\n\n// ─── Author byline ───────────────────────────────────────────────────────────\n\n/**\n * The author as a card renders them: the shared `memberBylineSchema` (0.6.0),\n * which products, reviews and notifications name members with too.\n *\n * Every field here is LIVE, joined against the profile at read time rather\n * than frozen onto the post at write time. So a renamed handle, a new avatar\n * or an edited headline updates on old posts, and the byline link always\n * targets the current username instead of 404ing on a handle that moved.\n *\n * Jansathi additionally snapshots `localName` (\"where the author was when\n * posting\"). Not ported: location is optional here, so a byline that depends\n * on one would be blank for anyone who never set it.\n */\nexport const feedAuthorSchema = memberBylineSchema;\nexport type FeedAuthor = z.infer<typeof feedAuthorSchema>;\n\n// ─── Media ───────────────────────────────────────────────────────────────────\n\n/**\n * A post's image: a processed `mediaImageSchema` (every stored size, ready for\n * `srcset`, plus a placeholder) with the post's own alt text.\n *\n * `width` and `height` are required so a card can reserve the right box before\n * the image loads. Without them every image arrival shifts the feed under the\n * reader's thumb.\n *\n * `thumbnailUrl` is the smallest stored size, for a grid or a notification.\n *\n * URLs here come from our own upload pipeline, so they take a plain `z.url()`\n * rather than `httpUrlSchema`. ⚠️ If a \"paste an image link\" path is ever\n * added, these become member-supplied and must move to `httpUrlSchema`.\n */\nexport const feedImageSchema = mediaImageSchema.extend({\n kind: z.literal('image'),\n thumbnailUrl: z.url().optional(),\n /** Author-supplied alt text. Optional, and worth asking for. */\n alt: z.string().max(MEDIA_ALT_MAX).optional(),\n});\nexport type FeedImage = z.infer<typeof feedImageSchema>;\n\nexport const feedVideoSchema = z.object({\n kind: z.literal('video'),\n url: z.url(),\n /** Poster frame, server-extracted. Required: a video with no poster is a\n * black rectangle in the feed. */\n thumbnailUrl: z.url(),\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n /** Seconds. */\n duration: z.number().positive(),\n});\nexport type FeedVideo = z.infer<typeof feedVideoSchema>;\n\n/**\n * One ordered list, discriminated on `kind`, so the carousel renders\n * attachments in the order they were attached and can switch on the kind\n * without inspecting fields.\n */\nexport const feedMediaSchema = z.discriminatedUnion('kind', [feedImageSchema, feedVideoSchema]);\nexport type FeedMedia = z.infer<typeof feedMediaSchema>;\n\n// ─── Link preview ────────────────────────────────────────────────────────────\n\n/**\n * Preview for the first link in a post body. Server-derived at write time and\n * stored, never re-fetched at render: a card that fetches a third-party page\n * per scroll leaks every reader's address to that site and blocks the feed on\n * somebody else's latency.\n *\n * Both URLs take `safeUrlSchema`: the scheme and host rules, WITHOUT the\n * typed-URL cap. `url` came out of a post body, which is already capped as a\n * whole, and `imageUrl` is whatever the remote page advertised; a long CDN URL\n * is ordinary, and one over `LINK_URL_MAX` would otherwise fail the whole feed\n * page it sits on. Neither is ours, so a consumer still treats both as\n * untrusted at render.\n */\nexport const linkPreviewSchema = z.object({\n url: safeUrlSchema,\n title: z.string().max(LINK_PREVIEW_TITLE_MAX).optional(),\n description: z.string().max(LINK_PREVIEW_DESCRIPTION_MAX).optional(),\n imageUrl: safeUrlSchema.optional(),\n});\nexport type LinkPreview = z.infer<typeof linkPreviewSchema>;\n\n// ─── Viewer state ────────────────────────────────────────────────────────────\n\n/**\n * What THIS viewer has done to this item, computed per request.\n *\n * Optional as a block, because an unauthenticated or server-rendered read has\n * no viewer. ⚠️ A client must treat an absent `viewer` as \"no state known\",\n * never as \"has not reacted\": rendering an empty reaction button off a missing\n * block is how a member sees their own reaction disappear on reload.\n */\nexport const viewerStateSchema = z.object({\n reaction: reactionTypeSchema.nullable(),\n bookmarked: z.boolean(),\n isAuthor: z.boolean(),\n\n /**\n * What this viewer may DO, decided by the server and sent as plain answers.\n *\n * Not role data for the client to reason about. The moment a client derives\n * \"can I edit this\" from roles and ownership, that derivation is a second\n * implementation of the rule, it drifts from the server's, and the drift is\n * invisible until the two disagree: either a button that 403s or a button\n * that should not have been there. `isAuthor` stays because the byline reads\n * differently for your own post, not because the client should compute rights\n * from it.\n *\n * `canEdit` is false once the edit window closes, so it is not simply\n * `isAuthor`.\n */\n canEdit: z.boolean(),\n canDelete: z.boolean(),\n canReport: z.boolean(),\n});\nexport type ViewerState = z.infer<typeof viewerStateSchema>;\n\n/**\n * The viewer's state on a post or a poll: everything above, plus reposting\n * (0.8.0). Comments cannot be reposted, so they keep `viewerStateSchema`.\n */\nexport const contentViewerStateSchema = viewerStateSchema.extend({\n /**\n * The viewer's own ACTIVE repost of this item, or null. An id rather than a\n * boolean because undoing it is deleting that post (`DELETE\n * /api/v1/feed/:contentId`), and a client holding only \"true\" would have to\n * go and find it.\n */\n repostId: objectIdSchema.nullable(),\n /**\n * Whether a repost may be made now, decided by the server: false on your\n * own item, on a repost (repost the original instead), on an item hidden by\n * staff, while you already have one (undo it first), and for a member who\n * cannot write yet (no finished, active profile: `ONBOARDING_INCOMPLETE`).\n */\n canRepost: z.boolean(),\n});\nexport type ContentViewerState = z.infer<typeof contentViewerStateSchema>;\n\n// ─── Repost ──────────────────────────────────────────────────────────────────\n\n/**\n * What a repost carries of the item it shares (0.8.0), computed when READ:\n * the byline is live, and an edit to the original shows in every repost of it.\n *\n * `unavailable` once the original is deleted, hidden by staff, or its\n * author's account is gone. The repost stays (it is its author's post, with\n * their words), and says the original is no longer there, rather than\n * vanishing from under the people who commented on it.\n */\nexport const repostedSourceSchema = z.discriminatedUnion('state', [\n z.object({\n state: z.literal('available'),\n contentKind: contentKindSchema,\n id: objectIdSchema,\n author: feedAuthorSchema,\n /** A post's whole text, or a poll's question. */\n text: z.string().max(POST_MAX_BODY_CHARS),\n /** The original's first attachment, for the card's thumbnail. */\n media: feedMediaSchema.optional(),\n /** The product the original is about, live, as on the original. */\n product: productChipSchema.optional(),\n createdAt: z.iso.datetime(),\n }),\n z.object({\n state: z.literal('unavailable'),\n contentKind: contentKindSchema,\n id: objectIdSchema,\n }),\n]);\nexport type RepostedSource = z.infer<typeof repostedSourceSchema>;\n\n// ─── Post ────────────────────────────────────────────────────────────────────\n\n/**\n * A post as the feed and the single-post page receive it.\n *\n * Counts are denormalised onto the row so one document serves a whole card.\n *\n * No `score` and no up/down vote. Jansathi's signed score exists to rank civic\n * content by community judgement, and a downvote arrow on a founder's first\n * post is a different product. Reactions and comments are the engagement axes\n * here. Adding a score later is additive; removing a visible downvote after\n * members have used it is not.\n */\nexport const feedPostSchema = z.object({\n id: objectIdSchema,\n contentKind: z.literal('post'),\n author: feedAuthorSchema,\n\n /**\n * The WHOLE body, never a server-side truncation.\n *\n * So there is no \"was this shortened\" flag and no second fetch to read the\n * rest: the card clamps visually and expands in place. At a 5,000 character\n * cap a page of twenty posts is small enough that trimming would cost a round\n * trip to save nothing. If that ever stops being true, a truncation flag is\n * an additive change; a client that has been guessing is not.\n */\n text: z.string().max(POST_MAX_BODY_CHARS),\n /** Ordered as the author attached them. */\n media: z.array(feedMediaSchema).max(POST_MAX_MEDIA),\n /** Present only when the body had an embeddable link. */\n linkPreview: linkPreviewSchema.optional(),\n /**\n * What this post is ABOUT, from the same vocabulary a member picks as their\n * interests. This is the whole mechanism behind a relevant feed: matching is\n * an intersection of two lists drawn from one enum, not a guess from who\n * wrote it.\n *\n * ⚠️ An EMPTY array is allowed and means the post is untagged, so interest\n * matching cannot reach it. That is a real consequence, not a nuance: an\n * untagged post is only ever found chronologically.\n */\n topics: z.array(topicSchema).max(MAX_TOPICS),\n\n /**\n * The product this post is about, live-joined (0.6.0). Absent when it names\n * none, and when the product has since been deleted or hidden by staff: the\n * post stays, the chip goes. Every comment on a post with a product is that\n * product's feedback.\n */\n product: productChipSchema.optional(),\n /** What the post asks of the community about its product. Only with `product`. */\n ask: productAskSchema.optional(),\n\n /**\n * Present only on a REPOST (0.8.0): the item this post shares, with `text`\n * as the reposter's own words above it (empty for a plain repost) and no\n * media of its own. A repost cannot be reposted; its own `repostCount` is\n * always 0.\n */\n repostOf: repostedSourceSchema.optional(),\n\n commentCount: z.number().int().nonnegative(),\n reactionCounts: reactionCountsSchema,\n /** Active reposts of this item (0.8.0); an undone or removed one no longer counts. */\n repostCount: z.number().int().nonnegative(),\n\n createdAt: z.iso.datetime(),\n /** Null when never edited. The edit window is the server's to enforce. */\n editedAt: z.iso.datetime().nullable(),\n\n viewer: contentViewerStateSchema.optional(),\n});\nexport type FeedPost = z.infer<typeof feedPostSchema>;\n\n// ─── Poll ────────────────────────────────────────────────────────────────────\n\n/**\n * One choice. `index` is the identifier a vote refers to, not the label:\n * sending indices avoids ambiguity between two options whose labels differ\n * only by case, spacing or an invisible character.\n */\nexport const pollOptionSchema = z.object({\n index: z\n .number()\n .int()\n .min(0)\n .max(POLL_MAX_OPTIONS - 1),\n label: z.string().min(1).max(POLL_OPTION_MAX_CHARS),\n voteCount: z.number().int().nonnegative(),\n});\nexport type PollOption = z.infer<typeof pollOptionSchema>;\n\n/**\n * A poll. Its own kind, not a post with extra fields, because votes are their\n * own records keyed by (poll, voter) and a post has nothing equivalent.\n *\n * Polls are not editable. Changing a question or an option after a vote has\n * been cast silently re-purposes that vote. Closing early is allowed; editing\n * is not.\n */\nexport const feedPollSchema = z.object({\n id: objectIdSchema,\n contentKind: z.literal('poll'),\n author: feedAuthorSchema,\n\n question: z.string().min(1).max(POLL_QUESTION_MAX_CHARS),\n options: z.array(pollOptionSchema).min(POLL_MIN_OPTIONS).max(POLL_MAX_OPTIONS),\n /** Unique voters, not votes: with multi-select the two differ. */\n totalVoters: z.number().int().nonnegative(),\n allowsMultipleChoices: z.boolean(),\n closesAt: z.iso.datetime(),\n /**\n * Whether the poll is closed, decided by the SERVER's clock.\n *\n * Derivable from `closesAt`, and deliberately sent anyway: a device with a\n * wrong clock would otherwise show a live poll as finished, or offer a vote\n * the server then rejects, and the member sees a control that lies. `closesAt`\n * stays for rendering \"closes in 2 days\"; this is what gates the control.\n */\n isClosed: z.boolean(),\n\n /** As on a post. A poll is feed content and is matched the same way. */\n topics: z.array(topicSchema).max(MAX_TOPICS),\n\n /** As on a post: \"which onboarding flow should we ship?\", about a product. */\n product: productChipSchema.optional(),\n ask: productAskSchema.optional(),\n\n commentCount: z.number().int().nonnegative(),\n reactionCounts: reactionCountsSchema,\n /** As on a post (0.8.0). */\n repostCount: z.number().int().nonnegative(),\n\n createdAt: z.iso.datetime(),\n /** Always null. Kept so one byline component renders both kinds. */\n editedAt: z.iso.datetime().nullable(),\n\n viewer: contentViewerStateSchema\n .extend({\n /** Indices this viewer chose. Empty means not voted yet, and it is\n * always populated for the viewer: a voter can always see their own\n * answer even where others' results are hidden. */\n votedOptionIndices: z.array(z.number().int().nonnegative()),\n })\n .optional(),\n});\nexport type FeedPoll = z.infer<typeof feedPollSchema>;\n\n// ─── The feed item union ─────────────────────────────────────────────────────\n\n/**\n * Discriminated on `contentKind`, so a client narrows with a switch and the\n * compiler catches an unhandled kind the day one is added. A plain union would\n * need every field checked by hand and would silently accept a hybrid.\n */\nexport const feedItemSchema = z.discriminatedUnion('contentKind', [feedPostSchema, feedPollSchema]);\nexport type FeedItem = z.infer<typeof feedItemSchema>;\n\n// ─── Comments ────────────────────────────────────────────────────────────────\n\n/**\n * A comment, one level of nesting only: a reply to a comment is allowed, a\n * reply to a reply is not. Two levels stay readable on a phone; three do not,\n * and the server is what enforces it.\n */\nexport const feedCommentSchema = z.object({\n id: objectIdSchema,\n contentKind: contentKindSchema,\n contentId: objectIdSchema,\n /** Null for a top-level comment. A non-null value may only name a top-level\n * comment, never a reply. */\n parentCommentId: objectIdSchema.nullable(),\n author: feedAuthorSchema,\n\n text: z.string().max(COMMENT_MAX_BODY_CHARS),\n\n /** Meaningful only on a top-level comment; always 0 on a reply. */\n replyCount: z.number().int().nonnegative(),\n reactionCounts: reactionCountsSchema,\n\n /**\n * When the product's team marked this comment as feedback that helped\n * (0.6.0), or null. Only a comment on a post tagged with a product, written\n * by someone outside that product's team, can carry it; it earns its writer\n * contribution points.\n */\n helpfulAt: z.iso.datetime().nullable(),\n\n createdAt: z.iso.datetime(),\n editedAt: z.iso.datetime().nullable(),\n\n /** No `bookmarked`: the post is the right thing to save, not a comment. */\n viewer: viewerStateSchema\n .omit({ bookmarked: true })\n .extend({\n /** On the team of the post's product, and the comment is from outside it. */\n canMarkHelpful: z.boolean(),\n })\n .optional(),\n});\nexport type FeedComment = z.infer<typeof feedCommentSchema>;\n\n// ─── Queries ─────────────────────────────────────────────────────────────────\n\n/**\n * `GET /api/v1/feed`. Inherits `limit` and `cursor`, which already tolerate an\n * emptied control rather than answering 400.\n *\n * `interests=true` narrows to the viewer's topics (falling back to the plain\n * feed when they have none). `z.stringbool`, so `true`/`false`/`1`/`0` all\n * read as a person means them; until 0.2.0 the backend read this parameter\n * raw, outside the schema, and only the exact string `true` counted.\n *\n * ⚠ NO `authorId`. It was accepted here and then ignored by the server, so a\n * profile page asking for one founder's posts silently got everybody's. A\n * member's own posts are `GET /api/v1/feed/by-author/:userId`.\n */\nexport const feedQuerySchema = paginationQuerySchema.extend({\n sort: z.preprocess(emptyStringToUndefined, feedSortSchema.default('new')),\n interests: z.preprocess(emptyStringToUndefined, z.stringbool().default(false)),\n});\nexport type FeedQuery = z.infer<typeof feedQuerySchema>;\nexport type FeedQueryInput = z.input<typeof feedQuerySchema>;\n\n/** `GET /api/v1/feed/:contentKind/:contentId/comments`. */\nexport const commentsQuerySchema = paginationQuerySchema.extend({\n /** Omitted lists top-level comments; set, it lists that comment's replies. */\n parentCommentId: z.preprocess(emptyStringToUndefined, objectIdSchema.optional()),\n});\nexport type CommentsQuery = z.infer<typeof commentsQuerySchema>;\nexport type CommentsQueryInput = z.input<typeof commentsQuerySchema>;\n\n/**\n * `GET /api/v1/feed/:contentKind/:contentId/reactions` (0.8.0): who reacted,\n * newest first. `contentKind` is post, poll or comment, as for reacting.\n * `type` narrows to one reaction (a tab); absent lists every reaction (All).\n */\nexport const reactionsQuerySchema = paginationQuerySchema.extend({\n type: z.preprocess(emptyStringToUndefined, reactionTypeSchema.optional()),\n});\nexport type ReactionsQuery = z.infer<typeof reactionsQuerySchema>;\nexport type ReactionsQueryInput = z.input<typeof reactionsQuerySchema>;\n\n// ─── Route parameters ────────────────────────────────────────────────────────\n\n/**\n * Every id and kind in a feed URL, as a schema, so a bad one answers exactly\n * as a bad body field does: 400 `VALIDATION_ERROR`, the issue at\n * `location: 'params'`. Until 0.2.0 these were hand checks that answered\n * \"Invalid id.\" with no issues at all, and the comment routes never looked at\n * `:contentKind`.\n */\n\n/** `GET /feed/:id`, the permalink. */\nexport const feedItemParamsSchema = z.object({ id: objectIdSchema });\n\n/** `PATCH|DELETE /feed/:contentId`. */\nexport const contentParamsSchema = z.object({ contentId: objectIdSchema });\n\n/** A bookmark and a comment thread: a post or a poll. */\nexport const contentTargetParamsSchema = z.object({\n contentKind: contentKindSchema,\n contentId: objectIdSchema,\n});\n\n/** A reaction and a report: a post, a poll or a comment. */\nexport const engagementTargetParamsSchema = z.object({\n contentKind: engagementTargetKindSchema,\n contentId: objectIdSchema,\n});\n\n/** `POST|DELETE /feed/poll/:pollId/vote`. */\nexport const pollParamsSchema = z.object({ pollId: objectIdSchema });\n\n/** `DELETE /feed/comments/:commentId`. */\nexport const commentParamsSchema = z.object({ commentId: objectIdSchema });\n\n/** `GET /feed/by-author/:userId`. */\nexport const authorParamsSchema = z.object({ userId: objectIdSchema });\n\nexport type FeedItemParams = z.infer<typeof feedItemParamsSchema>;\nexport type ContentParams = z.infer<typeof contentParamsSchema>;\nexport type ContentTargetParams = z.infer<typeof contentTargetParamsSchema>;\nexport type EngagementTargetParams = z.infer<typeof engagementTargetParamsSchema>;\nexport type PollParams = z.infer<typeof pollParamsSchema>;\nexport type CommentParams = z.infer<typeof commentParamsSchema>;\nexport type AuthorParams = z.infer<typeof authorParamsSchema>;\n\n// ─── Pages ───────────────────────────────────────────────────────────────────\n\n/**\n * A page of the feed, and of one member's posts (`by-author`), which is the\n * same shape. `nextCursor` is null on the last page.\n */\nexport const feedPageSchema = paginatedSchema(feedItemSchema);\nexport type FeedPage = z.infer<typeof feedPageSchema>;\n\n/** A page of a thread: top-level comments, or one comment's replies. */\nexport const commentPageSchema = paginatedSchema(feedCommentSchema);\nexport type CommentPage = z.infer<typeof commentPageSchema>;\n\n/**\n * One row of \"who reacted\" (0.8.0).\n *\n * `reactedAt` is when they reacted, and the list's order: CHANGING a\n * reaction updates it in place, so the row keeps its position (and moves from\n * one tab to another) instead of jumping to the top under a reader's cursor.\n * Taking it back and reacting again is a new reaction, from then.\n *\n * Only members who can be shown are listed: an erased account's reactions are\n * withdrawn with it, and a paused, suspended or never-onboarded member is\n * left out of the list.\n * `reactionCounts` still counts every reaction, so a tab can list fewer\n * people than its number says. That is deliberate: dropping a suspended\n * member's reaction from the count would make it jump back on reinstatement.\n */\nexport const reactorSchema = z.object({\n member: memberBylineSchema,\n reaction: reactionTypeSchema,\n reactedAt: z.iso.datetime(),\n});\nexport type Reactor = z.infer<typeof reactorSchema>;\nexport const reactorPageSchema = paginatedSchema(reactorSchema);\nexport type ReactorPage = z.infer<typeof reactorPageSchema>;\n\n/**\n * A comment on a product's Feedback tab (`GET /products/:id/feedback`): the\n * comment as a thread shows it, plus whether its writer is already a\n * confirmed tester, so the team's \"Confirm as tester\" knows without paging\n * through `/testers`.\n */\nexport const productFeedbackItemSchema = feedCommentSchema.extend({\n authorIsTester: z.boolean(),\n});\nexport type ProductFeedbackItem = z.infer<typeof productFeedbackItemSchema>;\nexport const productFeedbackPageSchema = paginatedSchema(productFeedbackItemSchema);\nexport type ProductFeedbackPage = z.infer<typeof productFeedbackPageSchema>;\n\n// ─── Write bodies ────────────────────────────────────────────────────────────\n\n/**\n * ⚠️ Every write body below is its own object with NO defaults, and none of\n * them is built with `.pick().partial()`. `.partial()` does not switch off\n * `.default()`, so a patch body built that way rewrites defaulted fields on\n * every request. See `updateFounderProfileBodySchema` for the incident.\n */\n\n/**\n * An attachment on the way IN: the id of an image already uploaded and\n * completed (`media`), and deliberately not a URL.\n *\n * ⚠ The first draft of this took the full read shape, URL included. That is\n * the same hole that was closed on the profile: a URL in a write body is a\n * member-supplied URL, so a post could have carried `javascript:` in an image\n * source, and nothing downstream re-checks a value the server itself stored.\n * Taking an id instead removes the question rather than validating it.\n *\n * `width`, `height` and the URLs are NOT accepted either: the server measured\n * them when it processed the upload, and taking them from the client would let\n * a caller claim a 1x1 image and collapse the card.\n *\n * The server attaches each id only if it is the caller's, processed, uploaded\n * for a post, and not attached anywhere yet (`UPLOAD_NOT_ATTACHABLE`\n * otherwise), so one upload can never appear on two posts.\n */\nexport const attachedMediaSchema = z.object({\n mediaId: objectIdSchema,\n /** Author-supplied alt text, the one media field a member does write. */\n alt: z.string().trim().max(MEDIA_ALT_MAX).optional(),\n});\nexport type AttachedMedia = z.infer<typeof attachedMediaSchema>;\n\n/**\n * Which of the author's products a post or poll is about, and what it asks.\n * Set when it is written and NEVER EDITABLE afterwards: moving a post to\n * another product after people replied would move their feedback with it.\n * The server accepts only a product the author is on the team of\n * (`PRODUCT_NOT_YOURS`) and that is not archived (`PRODUCT_ARCHIVED`).\n */\nconst aboutAProduct = {\n productId: objectIdSchema.optional(),\n /** Only with `productId` (`askWithoutProduct`). */\n ask: productAskSchema.optional(),\n};\nconst askNeedsProduct = (b: { productId?: string; ask?: string }) =>\n b.ask === undefined || b.productId !== undefined;\n\n/**\n * A post must carry something. Text alone, media alone, or both; empty is\n * refused here rather than reaching the feed as a blank card.\n */\nexport const createPostBodySchema = z\n .object({\n text: z.string().trim().max(POST_MAX_BODY_CHARS).optional(),\n /** Already uploaded and completed. See `attachedMediaSchema`. Order is preserved. */\n media: z.array(attachedMediaSchema).max(POST_MAX_MEDIA).optional(),\n /** Absent means untagged, which means interest matching cannot find it. */\n topics: z.array(topicSchema).max(MAX_TOPICS).optional(),\n ...aboutAProduct,\n })\n .refine((b) => Boolean(b.text?.length) || Boolean(b.media?.length), {\n error: VALIDATION_MESSAGE.postEmpty,\n path: ['text'],\n })\n .refine((b) => new Set(b.media?.map((m) => m.mediaId)).size === (b.media?.length ?? 0), {\n error: VALIDATION_MESSAGE.mediaDuplicate,\n path: ['media'],\n })\n .refine(askNeedsProduct, { error: VALIDATION_MESSAGE.askWithoutProduct, path: ['ask'] });\nexport type CreatePostBody = z.infer<typeof createPostBodySchema>;\n\n/** Only the text is editable. Changing media after the fact makes every\n * earlier reply look like a reply to something else. */\nexport const updatePostBodySchema = z.object({\n text: z.string().trim().min(1).max(POST_MAX_BODY_CHARS),\n});\nexport type UpdatePostBody = z.infer<typeof updatePostBodySchema>;\n\nexport const createPollBodySchema = z\n .object({\n question: z.string().trim().min(1).max(POLL_QUESTION_MAX_CHARS),\n options: z\n .array(z.object({ label: z.string().trim().min(1).max(POLL_OPTION_MAX_CHARS) }))\n .min(POLL_MIN_OPTIONS)\n .max(POLL_MAX_OPTIONS),\n /**\n * Duration from now, NOT an absolute closing time. A client whose clock is\n * wrong would otherwise open a poll that is already closed, and the member\n * would have no way to tell why.\n */\n durationMs: z.number().int().min(POLL_MIN_DURATION_MS).max(POLL_MAX_DURATION_MS),\n allowsMultipleChoices: z.boolean(),\n topics: z.array(topicSchema).max(MAX_TOPICS).optional(),\n ...aboutAProduct,\n })\n .refine(askNeedsProduct, { error: VALIDATION_MESSAGE.askWithoutProduct, path: ['ask'] })\n .refine(\n (b) => {\n const seen = new Set<string>();\n for (const o of b.options) {\n const key = o.label.trim().toLowerCase();\n if (seen.has(key)) return false;\n seen.add(key);\n }\n return true;\n },\n { error: VALIDATION_MESSAGE.pollOptionsDuplicate, path: ['options'] },\n );\nexport type CreatePollBody = z.infer<typeof createPollBodySchema>;\n\n/** Cast or change a vote. The server upserts on (poll, voter), so voting\n * twice replaces rather than doubles. */\nexport const castVoteBodySchema = z.object({\n optionIndices: z\n .array(\n z\n .number()\n .int()\n .min(0)\n .max(POLL_MAX_OPTIONS - 1),\n )\n .min(1)\n .max(POLL_MAX_OPTIONS),\n});\nexport type CastVoteBody = z.infer<typeof castVoteBodySchema>;\n\nexport const createCommentBodySchema = z.object({\n text: z.string().trim().min(1).max(COMMENT_MAX_BODY_CHARS),\n /** Null for a top-level comment. */\n parentCommentId: objectIdSchema.nullable(),\n});\nexport type CreateCommentBody = z.infer<typeof createCommentBodySchema>;\n\n/**\n * `PATCH /api/v1/feed/comments/:commentId` (route since 0.8.0): your own\n * comment, within `EDIT_WINDOW_MS` (`EDIT_WINDOW_CLOSED` after), answering\n * `IdResponse`. Sets `editedAt`.\n */\nexport const updateCommentBodySchema = z.object({\n text: z.string().trim().min(1).max(COMMENT_MAX_BODY_CHARS),\n});\nexport type UpdateCommentBody = z.infer<typeof updateCommentBodySchema>;\n\n/**\n * `POST /api/v1/feed/reposts` (0.8.0), answering `IdResponse`: the new repost,\n * which is a post of yours carrying `repostOf`. Undo it by deleting that post.\n *\n * One ACTIVE repost per member per item (`ALREADY_REPOSTED`). Refused on your\n * own item (`CANNOT_REPOST_OWN`), on a repost (`CANNOT_REPOST_A_REPOST`: share\n * the original), on anything deleted or hidden (404), and from a member who\n * cannot write yet (`ONBOARDING_INCOMPLETE`). Undo: `DELETE\n * /api/v1/feed/:contentId` on the repost.\n */\nexport const createRepostBodySchema = z.object({\n sourceKind: contentKindSchema,\n sourceId: objectIdSchema,\n /** Your own words above it. Absent or empty: a plain repost. */\n caption: z.string().trim().max(POST_MAX_BODY_CHARS).optional(),\n});\nexport type CreateRepostBody = z.infer<typeof createRepostBodySchema>;\n\n/**\n * Set or clear a reaction. `null` clears it; at most one per viewer per item.\n * Only an offered reaction can be SET (`REACTION_PICKER_VALUES`): a retired\n * one stays readable on old rows but is not chosen anew.\n */\nexport const setReactionBodySchema = z.object({\n reaction: pickableReactionSchema.nullable(),\n});\nexport type SetReactionBody = z.infer<typeof setReactionBodySchema>;\n\n// ─── Engagement responses ────────────────────────────────────────────────────\n\n/**\n * Returned by the reaction endpoint so the card can render the authoritative\n * result without a follow-up read. Without the fresh counts a client has to\n * guess the new total, and two quick taps leave it showing a number the server\n * never had.\n */\nexport const setReactionResponseSchema = z.object({\n contentKind: engagementTargetKindSchema,\n contentId: objectIdSchema,\n reaction: reactionTypeSchema.nullable(),\n reactionCounts: reactionCountsSchema,\n});\nexport type SetReactionResponse = z.infer<typeof setReactionResponseSchema>;\n\n// ─── Reporting ───────────────────────────────────────────────────────────────\n\n/**\n * Why a member reported something.\n *\n * ⚠️ Stored on every report row, so this is data, not a label: removing a value\n * orphans reports already filed under it, and the counts nobody can recover are\n * exactly the ones a moderation review needs. Append only.\n *\n * ⚠️ A REASON THAT IS MISSING DOES NOT DISAPPEAR, it lands in `other`. Whatever\n * is not named here becomes an undifferentiated pile that no aggregate can see\n * a pattern in, which is the one thing report categories exist for. Worth being\n * deliberate about the absences rather than discovering them later.\n */\nexport const REPORT_REASON_VALUES = [\n 'spam',\n 'harassment',\n 'misinformation',\n 'off_topic',\n 'impersonation',\n 'other',\n] as const;\nexport const reportReasonSchema = z.enum(REPORT_REASON_VALUES);\nexport type ReportReason = z.infer<typeof reportReasonSchema>;\n\n/**\n * What a member sends to report a post, poll or comment.\n *\n * The target is the URL's, not the body's: a report is filed against a specific\n * thing at a specific address, and taking the target from the body would let a\n * caller report one item while the route thinks it is another.\n *\n * `note` is free text and optional, which is the pressure valve for everything\n * the enum does not name. ⚠️ It is written by a member, so it is untrusted at\n * render: a moderation queue displays it, and a moderation queue is a screen\n * staff read quickly.\n */\nexport const createReportBodySchema = z.object({\n reason: reportReasonSchema,\n note: z.string().trim().max(REPORT_NOTE_MAX).optional(),\n});\nexport type CreateReportBody = z.infer<typeof createReportBodySchema>;\n\n/**\n * The answer to filing one.\n *\n * `alreadyReported` distinguishes \"we have taken this\" from \"you already told\n * us\", because one report per member per target means a second press is a\n * no-op, and a silent no-op reads as a failure to somebody who pressed twice\n * deliberately. It is NOT a count: how many OTHER people reported an item is\n * moderation's business and telling a reporter would turn the count into a\n * score anyone could farm.\n */\nexport const createReportResponseSchema = z.object({\n /** A post, poll or comment; since 0.6.0 also a product or a review. */\n contentKind: reportTargetKindSchema,\n contentId: objectIdSchema,\n alreadyReported: z.boolean(),\n});\nexport type CreateReportResponse = z.infer<typeof createReportResponseSchema>;\n\n/**\n * `PUT|DELETE /api/v1/feed/comments/:commentId/helpful`: the product's team\n * marks (or unmarks) a comment as feedback that helped. Answers the state it\n * settled on. `FEEDBACK_NOT_MARKABLE` when the comment is not feedback on a\n * product the caller is on the team of.\n */\nexport const commentHelpfulResponseSchema = z.object({\n commentId: objectIdSchema,\n helpfulAt: z.iso.datetime().nullable(),\n});\nexport type CommentHelpfulResponse = z.infer<typeof commentHelpfulResponseSchema>;\n\n/** The bookmark endpoint is a toggle and returns the state it settled on. */\nexport const toggleBookmarkResponseSchema = z.object({\n contentKind: contentKindSchema,\n contentId: objectIdSchema,\n bookmarked: z.boolean(),\n});\nexport type ToggleBookmarkResponse = z.infer<typeof toggleBookmarkResponseSchema>;\n\n/** A vote returns the whole poll: counts, totals and the viewer's own choices\n * all move together, and reassembling them client-side drifts. */\nexport const castVoteResponseSchema = z.object({\n poll: feedPollSchema,\n});\nexport type CastVoteResponse = z.infer<typeof castVoteResponseSchema>;\n"]}
1
+ {"version":3,"file":"feed.js","sourceRoot":"","sources":["../../../src/domains/feed/feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,O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CAAC,MAAM,CAAC;IACnD,SAAS,EAAE,cAAc;IACzB,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC;AAGH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,WAAW,EAAE,iBAAiB;IAC9B,SAAS,EAAE,cAAc;IACzB,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;CACxB,CAAC,CAAC;AAGH;mEACmE;AACnE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,cAAc;CACrB,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — Feed wire shapes: post, poll, comment, reaction\n *\n * ADAPTED FROM `jansathi-community-schema`, NOT DEPENDENT ON IT.\n *\n * The user ruled on 2026-09-21 that Founder Circle is a standalone app, so\n * these shapes are copied and cut down rather than imported. The reason is\n * worth keeping: `jansathi-community-schema` encodes Jansathi's reach levels,\n * community designations, official-area kinds and crowdfunding audiences.\n * Depending on it would put all of that permanently inside our contract for a\n * feed that has none of those concepts, and would mean a Jansathi publish can\n * break this product.\n *\n * DELIBERATELY NOT PORTED, so nobody \"restores\" them:\n * - the five civic verticals (lost_found, suggestions_complaints,\n * donate_item, crowdfunding, event). `contentKind` here is post | poll\n * only; comment threads and bookmarks key off it, reactions off the same\n * union plus `comment`, and reports off that plus a product and a review\n * (`reportTargetKindSchema`, 0.6.0).\n * - official communities, designations, identity verification badges.\n * - social score, and the whole area-proximity ranking vocabulary\n * (local / district / state / national / global).\n * - `areaLineage` as a REQUIRED authorship snapshot. Jansathi gates its\n * composer on a declared residence resolving to Indian district level or\n * deeper; the user ruled location is never mandatory here, so nothing in\n * this file requires one.\n * - anonymous posting, which in Jansathi is gated on identity verification\n * we do not have. A founders' network is an identified network.\n *\n * @module founder-schema/domains/feed\n */\n\nimport { z } from 'zod';\nimport {\n emptyStringToUndefined,\n objectIdSchema,\n paginationQuerySchema,\n safeUrlSchema,\n} from '../../core/common.js';\nimport {\n LINK_PREVIEW_DESCRIPTION_MAX,\n LINK_PREVIEW_TITLE_MAX,\n MEDIA_ALT_MAX,\n REPORT_NOTE_MAX,\n} from '../../core/limits.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { VALIDATION_MESSAGE } from '../../core/validation.js';\nimport { communityChipSchema } from '../communities/communities.js';\nimport { mediaImageSchema } from '../media/media.js';\nimport { topicSchema } from '../onboarding/onboarding.js';\nimport { productAskSchema, productChipSchema } from '../products/products.js';\nimport { memberBylineSchema } from '../profile/founder-profile.js';\n\n// ─── Limits ──────────────────────────────────────────────────────────────────\n\n/**\n * Exported because the composer must count down to the SAME number the server\n * rejects at. A client-side limit that disagrees with the server is a message\n * a member cannot send and cannot see why.\n */\nexport const POST_MAX_BODY_CHARS = 5000;\n/**\n * Total attachments on one post, images and videos together.\n *\n * ONE cap over ONE ordered list, rather than Jansathi's separate image and\n * video arrays. A member who posts a screenshot, then a clip, then another\n * screenshot means that order, and two parallel arrays cannot express it: the\n * card would show both images and then the video, which is not what was\n * written.\n */\nexport const POST_MAX_MEDIA = 10;\n/**\n * Topics per item.\n *\n * Capped low on purpose: a post tagged with everything is about nothing, and\n * one tagged with ten matches every member, which is how a relevance feature\n * turns back into a chronological one.\n */\nexport const MAX_TOPICS = 3;\nexport const COMMENT_MAX_BODY_CHARS = 2000;\n\nexport const POLL_QUESTION_MAX_CHARS = 280;\nexport const POLL_OPTION_MAX_CHARS = 80;\nexport const POLL_MIN_OPTIONS = 2;\nexport const POLL_MAX_OPTIONS = 6;\n/** 5 minutes. Below this a poll closes before anyone sees it. */\nexport const POLL_MIN_DURATION_MS = 5 * 60 * 1000;\n/** 30 days. */\nexport const POLL_MAX_DURATION_MS = 30 * 24 * 60 * 60 * 1000;\n\n/**\n * How long after writing it the author may still edit a post or a comment.\n *\n * A window rather than forever: an edit after people have reacted changes what\n * they reacted to. Deletion has no window, because a member must always be able\n * to remove their own words. The server is the gate (`EDIT_WINDOW_CLOSED`);\n * a client uses this to stop offering Edit at the moment the server would\n * start refusing it, instead of on the next reload.\n */\nexport const EDIT_WINDOW_MS = 15 * 60 * 1000;\n\n// ─── Enums ───────────────────────────────────────────────────────────────────\n\n/**\n * What can appear in the feed. Two kinds, not seven.\n *\n * Engagement is keyed by `(contentKind, contentId)` so one engagement bar\n * serves both, and comments hang off the same pair. Adding a kind later is\n * additive; the union is deliberately narrow now so the client never has to\n * handle a kind this product does not have.\n */\nexport const CONTENT_KIND_VALUES = ['post', 'poll'] as const;\nexport const contentKindSchema = z.enum(CONTENT_KIND_VALUES);\nexport type ContentKind = z.infer<typeof contentKindSchema>;\n\n/**\n * What a reaction or a report can point at: a feed item, or a comment on one.\n *\n * Wider than `ContentKind` on purpose. A comment carries reaction counts and a\n * viewer reaction, and a comment can be abusive, so both reach it. A bookmark\n * and a comment thread cannot: they take `ContentKind`. Until 0.2.0 the\n * reaction and report RESPONSES were typed `ContentKind` while the routes\n * accepted comments, so every answer about a comment broke this contract.\n */\nexport const ENGAGEMENT_TARGET_KIND_VALUES = [...CONTENT_KIND_VALUES, 'comment'] as const;\nexport const engagementTargetKindSchema = z.enum(ENGAGEMENT_TARGET_KIND_VALUES);\nexport type EngagementTargetKind = z.infer<typeof engagementTargetKindSchema>;\n\n/**\n * What a member can REPORT (0.6.0): everything a reaction can reach, plus a\n * product page and a review. Each has its own report route; the answer and the\n * moderation queue use this one list.\n */\nexport const REPORT_TARGET_KIND_VALUES = [\n ...ENGAGEMENT_TARGET_KIND_VALUES,\n 'product',\n 'review',\n] as const;\nexport const reportTargetKindSchema = z.enum(REPORT_TARGET_KIND_VALUES);\nexport type ReportTargetKind = z.infer<typeof reportTargetKindSchema>;\n\n/**\n * Every reaction a row can hold. The first four were Founder Circle's own;\n * `love`, `support` and `haha` came from Jansathi in 0.8.0 (the user's set,\n * 2026-10-07), so the feed feels like the community app members know.\n *\n * ⚠️ These values are stored per reaction row, so removing one orphans data.\n * Append only. A value that should no longer be OFFERED leaves\n * `REACTION_PICKER_VALUES` instead, and stays here so old rows still read.\n */\nexport const REACTION_TYPE_VALUES = [\n 'like',\n 'celebrate',\n 'insightful',\n 'curious',\n 'love',\n 'support',\n 'haha',\n] as const;\nexport const reactionTypeSchema = z.enum(REACTION_TYPE_VALUES);\nexport type ReactionType = z.infer<typeof reactionTypeSchema>;\n\n/**\n * What the picker offers, IN ORDER (the user's set, 2026-10-07). A member can\n * set only these; `curious` is no longer offered, but a member who chose it\n * keeps it, sees it as their reaction, and can clear it.\n *\n * The order is the schema's, not a client literal: the backend accepts only\n * these on a write (`setReactionBodySchema`), and two lists that must agree\n * belong in one place.\n */\nexport const REACTION_PICKER_VALUES = [\n 'like',\n 'love',\n 'celebrate',\n 'insightful',\n 'support',\n 'haha',\n] as const satisfies readonly ReactionType[];\nexport const pickableReactionSchema = z.enum(REACTION_PICKER_VALUES);\nexport type PickableReaction = z.infer<typeof pickableReactionSchema>;\n\n/**\n * Feed ordering.\n *\n * `new` is the default here, unlike Jansathi where `hot` leads. A hot ranking\n * needs volume to be meaningful, and a brand-new network ranking a handful of\n * posts by a blended score mostly hides the newest thing somebody just wrote.\n * Revisit when there is enough content for `hot` to mean anything.\n */\nexport const FEED_SORT_VALUES = ['new', 'top'] as const;\nexport const feedSortSchema = z.enum(FEED_SORT_VALUES);\nexport type FeedSort = z.infer<typeof feedSortSchema>;\n\n/**\n * Counts keyed by reaction type, e.g. `{ like: 4, celebrate: 1 }`. Only the\n * reactions an item actually has need appear.\n *\n * ⚠️ `partialRecord`, NOT `record`. In Zod 4 an enum-keyed `z.record` is\n * EXHAUSTIVE: it demands every key, so `{ like: 4 }` fails with three missing\n * keys and `{}` fails with four. That would force the server to ship a zero for\n * every reaction on every item, and the day a fifth reaction is added every\n * previously stored payload and every older client stops parsing.\n * `partialRecord` keeps the key validation without the exhaustiveness, so an\n * unknown key like Jansathi's `support` is still refused.\n */\nexport const reactionCountsSchema = z.partialRecord(\n reactionTypeSchema,\n z.number().int().nonnegative(),\n);\nexport type ReactionCounts = z.infer<typeof reactionCountsSchema>;\n\n// ─── Author byline ───────────────────────────────────────────────────────────\n\n/**\n * The author as a card renders them: the shared `memberBylineSchema` (0.6.0),\n * which products, reviews and notifications name members with too.\n *\n * Every field here is LIVE, joined against the profile at read time rather\n * than frozen onto the post at write time. So a renamed handle, a new avatar\n * or an edited headline updates on old posts, and the byline link always\n * targets the current username instead of 404ing on a handle that moved.\n *\n * Jansathi additionally snapshots `localName` (\"where the author was when\n * posting\"). Not ported: location is optional here, so a byline that depends\n * on one would be blank for anyone who never set it.\n */\nexport const feedAuthorSchema = memberBylineSchema;\nexport type FeedAuthor = z.infer<typeof feedAuthorSchema>;\n\n// ─── Media ───────────────────────────────────────────────────────────────────\n\n/**\n * A post's image: a processed `mediaImageSchema` (every stored size, ready for\n * `srcset`, plus a placeholder) with the post's own alt text.\n *\n * `width` and `height` are required so a card can reserve the right box before\n * the image loads. Without them every image arrival shifts the feed under the\n * reader's thumb.\n *\n * `thumbnailUrl` is the smallest stored size, for a grid or a notification.\n *\n * URLs here come from our own upload pipeline, so they take a plain `z.url()`\n * rather than `httpUrlSchema`. ⚠️ If a \"paste an image link\" path is ever\n * added, these become member-supplied and must move to `httpUrlSchema`.\n */\nexport const feedImageSchema = mediaImageSchema.extend({\n kind: z.literal('image'),\n thumbnailUrl: z.url().optional(),\n /** Author-supplied alt text. Optional, and worth asking for. */\n alt: z.string().max(MEDIA_ALT_MAX).optional(),\n});\nexport type FeedImage = z.infer<typeof feedImageSchema>;\n\nexport const feedVideoSchema = z.object({\n kind: z.literal('video'),\n url: z.url(),\n /** Poster frame, server-extracted. Required: a video with no poster is a\n * black rectangle in the feed. */\n thumbnailUrl: z.url(),\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n /** Seconds. */\n duration: z.number().positive(),\n});\nexport type FeedVideo = z.infer<typeof feedVideoSchema>;\n\n/**\n * One ordered list, discriminated on `kind`, so the carousel renders\n * attachments in the order they were attached and can switch on the kind\n * without inspecting fields.\n */\nexport const feedMediaSchema = z.discriminatedUnion('kind', [feedImageSchema, feedVideoSchema]);\nexport type FeedMedia = z.infer<typeof feedMediaSchema>;\n\n// ─── Link preview ────────────────────────────────────────────────────────────\n\n/**\n * Preview for the first link in a post body. Server-derived at write time and\n * stored, never re-fetched at render: a card that fetches a third-party page\n * per scroll leaks every reader's address to that site and blocks the feed on\n * somebody else's latency.\n *\n * Both URLs take `safeUrlSchema`: the scheme and host rules, WITHOUT the\n * typed-URL cap. `url` came out of a post body, which is already capped as a\n * whole, and `imageUrl` is whatever the remote page advertised; a long CDN URL\n * is ordinary, and one over `LINK_URL_MAX` would otherwise fail the whole feed\n * page it sits on. Neither is ours, so a consumer still treats both as\n * untrusted at render.\n */\nexport const linkPreviewSchema = z.object({\n url: safeUrlSchema,\n title: z.string().max(LINK_PREVIEW_TITLE_MAX).optional(),\n description: z.string().max(LINK_PREVIEW_DESCRIPTION_MAX).optional(),\n imageUrl: safeUrlSchema.optional(),\n});\nexport type LinkPreview = z.infer<typeof linkPreviewSchema>;\n\n// ─── Viewer state ────────────────────────────────────────────────────────────\n\n/**\n * What THIS viewer has done to this item, computed per request.\n *\n * Optional as a block, because an unauthenticated or server-rendered read has\n * no viewer. ⚠️ A client must treat an absent `viewer` as \"no state known\",\n * never as \"has not reacted\": rendering an empty reaction button off a missing\n * block is how a member sees their own reaction disappear on reload.\n */\nexport const viewerStateSchema = z.object({\n reaction: reactionTypeSchema.nullable(),\n bookmarked: z.boolean(),\n isAuthor: z.boolean(),\n\n /**\n * What this viewer may DO, decided by the server and sent as plain answers.\n *\n * Not role data for the client to reason about. The moment a client derives\n * \"can I edit this\" from roles and ownership, that derivation is a second\n * implementation of the rule, it drifts from the server's, and the drift is\n * invisible until the two disagree: either a button that 403s or a button\n * that should not have been there. `isAuthor` stays because the byline reads\n * differently for your own post, not because the client should compute rights\n * from it.\n *\n * `canEdit` is false once the edit window closes, so it is not simply\n * `isAuthor`.\n */\n canEdit: z.boolean(),\n canDelete: z.boolean(),\n canReport: z.boolean(),\n});\nexport type ViewerState = z.infer<typeof viewerStateSchema>;\n\n/**\n * The viewer's state on a post or a poll: everything above, plus reposting\n * (0.8.0). Comments cannot be reposted, so they keep `viewerStateSchema`.\n */\nexport const contentViewerStateSchema = viewerStateSchema.extend({\n /**\n * The viewer's own ACTIVE repost of this item, or null. An id rather than a\n * boolean because undoing it is deleting that post (`DELETE\n * /api/v1/feed/:contentId`), and a client holding only \"true\" would have to\n * go and find it.\n */\n repostId: objectIdSchema.nullable(),\n /**\n * Whether a repost may be made now, decided by the server: false on your\n * own item, on a repost (repost the original instead), on an item hidden by\n * staff, while you already have one (undo it first), and for a member who\n * cannot write yet (no finished, active profile: `ONBOARDING_INCOMPLETE`).\n */\n canRepost: z.boolean(),\n /**\n * On content inside a community only (0.9.0): whether this viewer may take\n * part in it now (react, comment, vote, save, report, edit): an active\n * member of a community that is not archived. False for someone who can\n * read it but has not joined (a public community's reader, staff): offer\n * Join instead of the controls. `canEdit` and `canReport` are false too\n * whenever this is.\n */\n canTakePart: z.boolean().optional(),\n});\nexport type ContentViewerState = z.infer<typeof contentViewerStateSchema>;\n\n// ─── Repost ──────────────────────────────────────────────────────────────────\n\n/**\n * What a repost carries of the item it shares (0.8.0), computed when READ:\n * the byline is live, and an edit to the original shows in every repost of it.\n *\n * `unavailable` once the original is deleted, hidden by staff, or its\n * author's account is gone. The repost stays (it is its author's post, with\n * their words), and says the original is no longer there, rather than\n * vanishing from under the people who commented on it.\n */\nexport const repostedSourceSchema = z.discriminatedUnion('state', [\n z.object({\n state: z.literal('available'),\n contentKind: contentKindSchema,\n id: objectIdSchema,\n author: feedAuthorSchema,\n /** A post's whole text, or a poll's question. */\n text: z.string().max(POST_MAX_BODY_CHARS),\n /** The original's first attachment, for the card's thumbnail. */\n media: feedMediaSchema.optional(),\n /** The product the original is about, live, as on the original. */\n product: productChipSchema.optional(),\n createdAt: z.iso.datetime(),\n }),\n z.object({\n state: z.literal('unavailable'),\n contentKind: contentKindSchema,\n id: objectIdSchema,\n }),\n]);\nexport type RepostedSource = z.infer<typeof repostedSourceSchema>;\n\n// ─── Post ────────────────────────────────────────────────────────────────────\n\n/**\n * A post as the feed and the single-post page receive it.\n *\n * Counts are denormalised onto the row so one document serves a whole card.\n *\n * No `score` and no up/down vote. Jansathi's signed score exists to rank civic\n * content by community judgement, and a downvote arrow on a founder's first\n * post is a different product. Reactions and comments are the engagement axes\n * here. Adding a score later is additive; removing a visible downvote after\n * members have used it is not.\n */\nexport const feedPostSchema = z.object({\n id: objectIdSchema,\n contentKind: z.literal('post'),\n author: feedAuthorSchema,\n\n /**\n * The WHOLE body, never a server-side truncation.\n *\n * So there is no \"was this shortened\" flag and no second fetch to read the\n * rest: the card clamps visually and expands in place. At a 5,000 character\n * cap a page of twenty posts is small enough that trimming would cost a round\n * trip to save nothing. If that ever stops being true, a truncation flag is\n * an additive change; a client that has been guessing is not.\n */\n text: z.string().max(POST_MAX_BODY_CHARS),\n /** Ordered as the author attached them. */\n media: z.array(feedMediaSchema).max(POST_MAX_MEDIA),\n /** Present only when the body had an embeddable link. */\n linkPreview: linkPreviewSchema.optional(),\n /**\n * What this post is ABOUT, from the same vocabulary a member picks as their\n * interests. This is the whole mechanism behind a relevant feed: matching is\n * an intersection of two lists drawn from one enum, not a guess from who\n * wrote it.\n *\n * ⚠️ An EMPTY array is allowed and means the post is untagged, so interest\n * matching cannot reach it. That is a real consequence, not a nuance: an\n * untagged post is only ever found chronologically.\n */\n topics: z.array(topicSchema).max(MAX_TOPICS),\n\n /**\n * The product this post is about, live-joined (0.6.0). Absent when it names\n * none, and when the product has since been deleted or hidden by staff: the\n * post stays, the chip goes. Every comment on a post with a product is that\n * product's feedback.\n */\n product: productChipSchema.optional(),\n /** What the post asks of the community about its product. Only with `product`. */\n ask: productAskSchema.optional(),\n\n /**\n * The community it was posted in (0.9.0): \"in AI Builders\". Absent on\n * general content. Never alongside `product`, `ask` or `repostOf`:\n * community content carries no product and is never reposted.\n */\n community: communityChipSchema.optional(),\n /** When a moderator pinned it as one of its community's announcements (0.9.0). */\n pinnedAt: z.iso.datetime().optional(),\n\n /**\n * Present only on a REPOST (0.8.0): the item this post shares, with `text`\n * as the reposter's own words above it (empty for a plain repost) and no\n * media of its own. A repost cannot be reposted; its own `repostCount` is\n * always 0.\n */\n repostOf: repostedSourceSchema.optional(),\n\n commentCount: z.number().int().nonnegative(),\n reactionCounts: reactionCountsSchema,\n /** Active reposts of this item (0.8.0); an undone or removed one no longer counts. */\n repostCount: z.number().int().nonnegative(),\n\n createdAt: z.iso.datetime(),\n /** Null when never edited. The edit window is the server's to enforce. */\n editedAt: z.iso.datetime().nullable(),\n\n viewer: contentViewerStateSchema.optional(),\n});\nexport type FeedPost = z.infer<typeof feedPostSchema>;\n\n// ─── Poll ────────────────────────────────────────────────────────────────────\n\n/**\n * One choice. `index` is the identifier a vote refers to, not the label:\n * sending indices avoids ambiguity between two options whose labels differ\n * only by case, spacing or an invisible character.\n */\nexport const pollOptionSchema = z.object({\n index: z\n .number()\n .int()\n .min(0)\n .max(POLL_MAX_OPTIONS - 1),\n label: z.string().min(1).max(POLL_OPTION_MAX_CHARS),\n voteCount: z.number().int().nonnegative(),\n});\nexport type PollOption = z.infer<typeof pollOptionSchema>;\n\n/**\n * A poll. Its own kind, not a post with extra fields, because votes are their\n * own records keyed by (poll, voter) and a post has nothing equivalent.\n *\n * Polls are not editable. Changing a question or an option after a vote has\n * been cast silently re-purposes that vote. Closing early is allowed; editing\n * is not.\n */\nexport const feedPollSchema = z.object({\n id: objectIdSchema,\n contentKind: z.literal('poll'),\n author: feedAuthorSchema,\n\n question: z.string().min(1).max(POLL_QUESTION_MAX_CHARS),\n options: z.array(pollOptionSchema).min(POLL_MIN_OPTIONS).max(POLL_MAX_OPTIONS),\n /** Unique voters, not votes: with multi-select the two differ. */\n totalVoters: z.number().int().nonnegative(),\n allowsMultipleChoices: z.boolean(),\n closesAt: z.iso.datetime(),\n /**\n * Whether the poll is closed, decided by the SERVER's clock.\n *\n * Derivable from `closesAt`, and deliberately sent anyway: a device with a\n * wrong clock would otherwise show a live poll as finished, or offer a vote\n * the server then rejects, and the member sees a control that lies. `closesAt`\n * stays for rendering \"closes in 2 days\"; this is what gates the control.\n */\n isClosed: z.boolean(),\n\n /** As on a post. A poll is feed content and is matched the same way. */\n topics: z.array(topicSchema).max(MAX_TOPICS),\n\n /** As on a post: \"which onboarding flow should we ship?\", about a product. */\n product: productChipSchema.optional(),\n ask: productAskSchema.optional(),\n /** As on a post (0.9.0). */\n community: communityChipSchema.optional(),\n pinnedAt: z.iso.datetime().optional(),\n\n commentCount: z.number().int().nonnegative(),\n reactionCounts: reactionCountsSchema,\n /** As on a post (0.8.0). */\n repostCount: z.number().int().nonnegative(),\n\n createdAt: z.iso.datetime(),\n /** Always null. Kept so one byline component renders both kinds. */\n editedAt: z.iso.datetime().nullable(),\n\n viewer: contentViewerStateSchema\n .extend({\n /** Indices this viewer chose. Empty means not voted yet, and it is\n * always populated for the viewer: a voter can always see their own\n * answer even where others' results are hidden. */\n votedOptionIndices: z.array(z.number().int().nonnegative()),\n })\n .optional(),\n});\nexport type FeedPoll = z.infer<typeof feedPollSchema>;\n\n// ─── The feed item union ─────────────────────────────────────────────────────\n\n/**\n * Discriminated on `contentKind`, so a client narrows with a switch and the\n * compiler catches an unhandled kind the day one is added. A plain union would\n * need every field checked by hand and would silently accept a hybrid.\n */\nexport const feedItemSchema = z.discriminatedUnion('contentKind', [feedPostSchema, feedPollSchema]);\nexport type FeedItem = z.infer<typeof feedItemSchema>;\n\n// ─── Comments ────────────────────────────────────────────────────────────────\n\n/**\n * A comment, one level of nesting only: a reply to a comment is allowed, a\n * reply to a reply is not. Two levels stay readable on a phone; three do not,\n * and the server is what enforces it.\n */\nexport const feedCommentSchema = z.object({\n id: objectIdSchema,\n contentKind: contentKindSchema,\n contentId: objectIdSchema,\n /** Null for a top-level comment. A non-null value may only name a top-level\n * comment, never a reply. */\n parentCommentId: objectIdSchema.nullable(),\n author: feedAuthorSchema,\n\n text: z.string().max(COMMENT_MAX_BODY_CHARS),\n\n /** Meaningful only on a top-level comment; always 0 on a reply. */\n replyCount: z.number().int().nonnegative(),\n reactionCounts: reactionCountsSchema,\n\n /**\n * When the product's team marked this comment as feedback that helped\n * (0.6.0), or null. Only a comment on a post tagged with a product, written\n * by someone outside that product's team, can carry it; it earns its writer\n * contribution points.\n */\n helpfulAt: z.iso.datetime().nullable(),\n\n createdAt: z.iso.datetime(),\n editedAt: z.iso.datetime().nullable(),\n\n /** No `bookmarked`: the post is the right thing to save, not a comment. */\n viewer: viewerStateSchema\n .omit({ bookmarked: true })\n .extend({\n /** On the team of the post's product, and the comment is from outside it. */\n canMarkHelpful: z.boolean(),\n })\n .optional(),\n});\nexport type FeedComment = z.infer<typeof feedCommentSchema>;\n\n// ─── Queries ─────────────────────────────────────────────────────────────────\n\n/**\n * `GET /api/v1/feed`. Inherits `limit` and `cursor`, which already tolerate an\n * emptied control rather than answering 400.\n *\n * `interests=true` narrows to the viewer's topics (falling back to the plain\n * feed when they have none). `z.stringbool`, so `true`/`false`/`1`/`0` all\n * read as a person means them; until 0.2.0 the backend read this parameter\n * raw, outside the schema, and only the exact string `true` counted.\n *\n * ⚠ NO `authorId`. It was accepted here and then ignored by the server, so a\n * profile page asking for one founder's posts silently got everybody's. A\n * member's own posts are `GET /api/v1/feed/by-author/:userId`.\n */\nexport const feedQuerySchema = paginationQuerySchema.extend({\n sort: z.preprocess(emptyStringToUndefined, feedSortSchema.default('new')),\n interests: z.preprocess(emptyStringToUndefined, z.stringbool().default(false)),\n});\nexport type FeedQuery = z.infer<typeof feedQuerySchema>;\nexport type FeedQueryInput = z.input<typeof feedQuerySchema>;\n\n/** `GET /api/v1/feed/:contentKind/:contentId/comments`. */\nexport const commentsQuerySchema = paginationQuerySchema.extend({\n /** Omitted lists top-level comments; set, it lists that comment's replies. */\n parentCommentId: z.preprocess(emptyStringToUndefined, objectIdSchema.optional()),\n});\nexport type CommentsQuery = z.infer<typeof commentsQuerySchema>;\nexport type CommentsQueryInput = z.input<typeof commentsQuerySchema>;\n\n/**\n * `GET /api/v1/feed/:contentKind/:contentId/reactions` (0.8.0): who reacted,\n * newest first. `contentKind` is post, poll or comment, as for reacting.\n * `type` narrows to one reaction (a tab); absent lists every reaction (All).\n */\nexport const reactionsQuerySchema = paginationQuerySchema.extend({\n type: z.preprocess(emptyStringToUndefined, reactionTypeSchema.optional()),\n});\nexport type ReactionsQuery = z.infer<typeof reactionsQuerySchema>;\nexport type ReactionsQueryInput = z.input<typeof reactionsQuerySchema>;\n\n// ─── Route parameters ────────────────────────────────────────────────────────\n\n/**\n * Every id and kind in a feed URL, as a schema, so a bad one answers exactly\n * as a bad body field does: 400 `VALIDATION_ERROR`, the issue at\n * `location: 'params'`. Until 0.2.0 these were hand checks that answered\n * \"Invalid id.\" with no issues at all, and the comment routes never looked at\n * `:contentKind`.\n */\n\n/** `GET /feed/:id`, the permalink. */\nexport const feedItemParamsSchema = z.object({ id: objectIdSchema });\n\n/** `PATCH|DELETE /feed/:contentId`. */\nexport const contentParamsSchema = z.object({ contentId: objectIdSchema });\n\n/** A bookmark and a comment thread: a post or a poll. */\nexport const contentTargetParamsSchema = z.object({\n contentKind: contentKindSchema,\n contentId: objectIdSchema,\n});\n\n/** A reaction and a report: a post, a poll or a comment. */\nexport const engagementTargetParamsSchema = z.object({\n contentKind: engagementTargetKindSchema,\n contentId: objectIdSchema,\n});\n\n/** `POST|DELETE /feed/poll/:pollId/vote`. */\nexport const pollParamsSchema = z.object({ pollId: objectIdSchema });\n\n/** `DELETE /feed/comments/:commentId`. */\nexport const commentParamsSchema = z.object({ commentId: objectIdSchema });\n\n/** `GET /feed/by-author/:userId`. */\nexport const authorParamsSchema = z.object({ userId: objectIdSchema });\n\nexport type FeedItemParams = z.infer<typeof feedItemParamsSchema>;\nexport type ContentParams = z.infer<typeof contentParamsSchema>;\nexport type ContentTargetParams = z.infer<typeof contentTargetParamsSchema>;\nexport type EngagementTargetParams = z.infer<typeof engagementTargetParamsSchema>;\nexport type PollParams = z.infer<typeof pollParamsSchema>;\nexport type CommentParams = z.infer<typeof commentParamsSchema>;\nexport type AuthorParams = z.infer<typeof authorParamsSchema>;\n\n// ─── Pages ───────────────────────────────────────────────────────────────────\n\n/**\n * A page of the feed, and of one member's posts (`by-author`), which is the\n * same shape. `nextCursor` is null on the last page.\n */\nexport const feedPageSchema = paginatedSchema(feedItemSchema);\nexport type FeedPage = z.infer<typeof feedPageSchema>;\n\n/**\n * A community's pinned announcements (0.9.0), most recently pinned first, at\n * most `COMMUNITY_PINS_MAX` (domains/communities). Never paged.\n */\nexport const pinnedItemsSchema = z.object({ items: z.array(feedItemSchema) });\nexport type PinnedItems = z.infer<typeof pinnedItemsSchema>;\n\n/** A page of a thread: top-level comments, or one comment's replies. */\nexport const commentPageSchema = paginatedSchema(feedCommentSchema);\nexport type CommentPage = z.infer<typeof commentPageSchema>;\n\n/**\n * One row of \"who reacted\" (0.8.0).\n *\n * `reactedAt` is when they reacted, and the list's order: CHANGING a\n * reaction updates it in place, so the row keeps its position (and moves from\n * one tab to another) instead of jumping to the top under a reader's cursor.\n * Taking it back and reacting again is a new reaction, from then.\n *\n * Only members who can be shown are listed: an erased account's reactions are\n * withdrawn with it, and a paused, suspended or never-onboarded member is\n * left out of the list.\n * `reactionCounts` still counts every reaction, so a tab can list fewer\n * people than its number says. That is deliberate: dropping a suspended\n * member's reaction from the count would make it jump back on reinstatement.\n */\nexport const reactorSchema = z.object({\n member: memberBylineSchema,\n reaction: reactionTypeSchema,\n reactedAt: z.iso.datetime(),\n});\nexport type Reactor = z.infer<typeof reactorSchema>;\nexport const reactorPageSchema = paginatedSchema(reactorSchema);\nexport type ReactorPage = z.infer<typeof reactorPageSchema>;\n\n/**\n * A comment on a product's Feedback tab (`GET /products/:id/feedback`): the\n * comment as a thread shows it, plus whether its writer is already a\n * confirmed tester, so the team's \"Confirm as tester\" knows without paging\n * through `/testers`.\n */\nexport const productFeedbackItemSchema = feedCommentSchema.extend({\n authorIsTester: z.boolean(),\n});\nexport type ProductFeedbackItem = z.infer<typeof productFeedbackItemSchema>;\nexport const productFeedbackPageSchema = paginatedSchema(productFeedbackItemSchema);\nexport type ProductFeedbackPage = z.infer<typeof productFeedbackPageSchema>;\n\n// ─── Write bodies ────────────────────────────────────────────────────────────\n\n/**\n * ⚠️ Every write body below is its own object with NO defaults, and none of\n * them is built with `.pick().partial()`. `.partial()` does not switch off\n * `.default()`, so a patch body built that way rewrites defaulted fields on\n * every request. See `updateFounderProfileBodySchema` for the incident.\n */\n\n/**\n * An attachment on the way IN: the id of an image already uploaded and\n * completed (`media`), and deliberately not a URL.\n *\n * ⚠ The first draft of this took the full read shape, URL included. That is\n * the same hole that was closed on the profile: a URL in a write body is a\n * member-supplied URL, so a post could have carried `javascript:` in an image\n * source, and nothing downstream re-checks a value the server itself stored.\n * Taking an id instead removes the question rather than validating it.\n *\n * `width`, `height` and the URLs are NOT accepted either: the server measured\n * them when it processed the upload, and taking them from the client would let\n * a caller claim a 1x1 image and collapse the card.\n *\n * The server attaches each id only if it is the caller's, processed, uploaded\n * for a post, and not attached anywhere yet (`UPLOAD_NOT_ATTACHABLE`\n * otherwise), so one upload can never appear on two posts.\n */\nexport const attachedMediaSchema = z.object({\n mediaId: objectIdSchema,\n /** Author-supplied alt text, the one media field a member does write. */\n alt: z.string().trim().max(MEDIA_ALT_MAX).optional(),\n});\nexport type AttachedMedia = z.infer<typeof attachedMediaSchema>;\n\n/**\n * Which of the author's products a post or poll is about, and what it asks.\n * Set when it is written and NEVER EDITABLE afterwards: moving a post to\n * another product after people replied would move their feedback with it.\n * The server accepts only a product the author is on the team of\n * (`PRODUCT_NOT_YOURS`) and that is not archived (`PRODUCT_ARCHIVED`).\n */\nconst aboutAProduct = {\n productId: objectIdSchema.optional(),\n /** Only with `productId` (`askWithoutProduct`). */\n ask: productAskSchema.optional(),\n};\nconst askNeedsProduct = (b: { productId?: string; ask?: string }) =>\n b.ask === undefined || b.productId !== undefined;\n\n/**\n * Which community it is posted in (0.9.0), set when written and never moved.\n * The author must be an active member (`COMMUNITY_JOIN_REQUIRED`) and it must\n * not be archived (`COMMUNITY_ARCHIVED`). Community content carries no product\n * and no ask (`communityWithProduct`); the server checks that too.\n */\nconst inACommunity = { communityId: objectIdSchema.optional() };\nconst communityWithoutProduct = (b: { communityId?: string; productId?: string; ask?: string }) =>\n b.communityId === undefined || (b.productId === undefined && b.ask === undefined);\n\n/**\n * A post must carry something. Text alone, media alone, or both; empty is\n * refused here rather than reaching the feed as a blank card.\n */\nexport const createPostBodySchema = z\n .object({\n text: z.string().trim().max(POST_MAX_BODY_CHARS).optional(),\n /** Already uploaded and completed. See `attachedMediaSchema`. Order is preserved. */\n media: z.array(attachedMediaSchema).max(POST_MAX_MEDIA).optional(),\n /** Absent means untagged, which means interest matching cannot find it. */\n topics: z.array(topicSchema).max(MAX_TOPICS).optional(),\n ...aboutAProduct,\n ...inACommunity,\n })\n .refine((b) => Boolean(b.text?.length) || Boolean(b.media?.length), {\n error: VALIDATION_MESSAGE.postEmpty,\n path: ['text'],\n })\n .refine((b) => new Set(b.media?.map((m) => m.mediaId)).size === (b.media?.length ?? 0), {\n error: VALIDATION_MESSAGE.mediaDuplicate,\n path: ['media'],\n })\n .refine(askNeedsProduct, { error: VALIDATION_MESSAGE.askWithoutProduct, path: ['ask'] })\n .refine(communityWithoutProduct, {\n error: VALIDATION_MESSAGE.communityWithProduct,\n path: ['communityId'],\n });\nexport type CreatePostBody = z.infer<typeof createPostBodySchema>;\n\n/** Only the text is editable. Changing media after the fact makes every\n * earlier reply look like a reply to something else. */\nexport const updatePostBodySchema = z.object({\n text: z.string().trim().min(1).max(POST_MAX_BODY_CHARS),\n});\nexport type UpdatePostBody = z.infer<typeof updatePostBodySchema>;\n\nexport const createPollBodySchema = z\n .object({\n question: z.string().trim().min(1).max(POLL_QUESTION_MAX_CHARS),\n options: z\n .array(z.object({ label: z.string().trim().min(1).max(POLL_OPTION_MAX_CHARS) }))\n .min(POLL_MIN_OPTIONS)\n .max(POLL_MAX_OPTIONS),\n /**\n * Duration from now, NOT an absolute closing time. A client whose clock is\n * wrong would otherwise open a poll that is already closed, and the member\n * would have no way to tell why.\n */\n durationMs: z.number().int().min(POLL_MIN_DURATION_MS).max(POLL_MAX_DURATION_MS),\n allowsMultipleChoices: z.boolean(),\n topics: z.array(topicSchema).max(MAX_TOPICS).optional(),\n ...aboutAProduct,\n ...inACommunity,\n })\n .refine(askNeedsProduct, { error: VALIDATION_MESSAGE.askWithoutProduct, path: ['ask'] })\n .refine(communityWithoutProduct, {\n error: VALIDATION_MESSAGE.communityWithProduct,\n path: ['communityId'],\n })\n .refine(\n (b) => {\n const seen = new Set<string>();\n for (const o of b.options) {\n const key = o.label.trim().toLowerCase();\n if (seen.has(key)) return false;\n seen.add(key);\n }\n return true;\n },\n { error: VALIDATION_MESSAGE.pollOptionsDuplicate, path: ['options'] },\n );\nexport type CreatePollBody = z.infer<typeof createPollBodySchema>;\n\n/** Cast or change a vote. The server upserts on (poll, voter), so voting\n * twice replaces rather than doubles. */\nexport const castVoteBodySchema = z.object({\n optionIndices: z\n .array(\n z\n .number()\n .int()\n .min(0)\n .max(POLL_MAX_OPTIONS - 1),\n )\n .min(1)\n .max(POLL_MAX_OPTIONS),\n});\nexport type CastVoteBody = z.infer<typeof castVoteBodySchema>;\n\nexport const createCommentBodySchema = z.object({\n text: z.string().trim().min(1).max(COMMENT_MAX_BODY_CHARS),\n /** Null for a top-level comment. */\n parentCommentId: objectIdSchema.nullable(),\n});\nexport type CreateCommentBody = z.infer<typeof createCommentBodySchema>;\n\n/**\n * `PATCH /api/v1/feed/comments/:commentId` (route since 0.8.0): your own\n * comment, within `EDIT_WINDOW_MS` (`EDIT_WINDOW_CLOSED` after), answering\n * `IdResponse`. Sets `editedAt`.\n */\nexport const updateCommentBodySchema = z.object({\n text: z.string().trim().min(1).max(COMMENT_MAX_BODY_CHARS),\n});\nexport type UpdateCommentBody = z.infer<typeof updateCommentBodySchema>;\n\n/**\n * `POST /api/v1/feed/reposts` (0.8.0), answering `IdResponse`: the new repost,\n * which is a post of yours carrying `repostOf`. Undo it by deleting that post.\n *\n * One ACTIVE repost per member per item (`ALREADY_REPOSTED`). Refused on your\n * own item (`CANNOT_REPOST_OWN`), on a repost (`CANNOT_REPOST_A_REPOST`: share\n * the original), on anything deleted or hidden (404), and from a member who\n * cannot write yet (`ONBOARDING_INCOMPLETE`). Undo: `DELETE\n * /api/v1/feed/:contentId` on the repost.\n */\nexport const createRepostBodySchema = z.object({\n sourceKind: contentKindSchema,\n sourceId: objectIdSchema,\n /** Your own words above it. Absent or empty: a plain repost. */\n caption: z.string().trim().max(POST_MAX_BODY_CHARS).optional(),\n});\nexport type CreateRepostBody = z.infer<typeof createRepostBodySchema>;\n\n/**\n * Set or clear a reaction. `null` clears it; at most one per viewer per item.\n * Only an offered reaction can be SET (`REACTION_PICKER_VALUES`): a retired\n * one stays readable on old rows but is not chosen anew.\n */\nexport const setReactionBodySchema = z.object({\n reaction: pickableReactionSchema.nullable(),\n});\nexport type SetReactionBody = z.infer<typeof setReactionBodySchema>;\n\n// ─── Engagement responses ────────────────────────────────────────────────────\n\n/**\n * Returned by the reaction endpoint so the card can render the authoritative\n * result without a follow-up read. Without the fresh counts a client has to\n * guess the new total, and two quick taps leave it showing a number the server\n * never had.\n */\nexport const setReactionResponseSchema = z.object({\n contentKind: engagementTargetKindSchema,\n contentId: objectIdSchema,\n reaction: reactionTypeSchema.nullable(),\n reactionCounts: reactionCountsSchema,\n});\nexport type SetReactionResponse = z.infer<typeof setReactionResponseSchema>;\n\n// ─── Reporting ───────────────────────────────────────────────────────────────\n\n/**\n * Why a member reported something.\n *\n * ⚠️ Stored on every report row, so this is data, not a label: removing a value\n * orphans reports already filed under it, and the counts nobody can recover are\n * exactly the ones a moderation review needs. Append only.\n *\n * ⚠️ A REASON THAT IS MISSING DOES NOT DISAPPEAR, it lands in `other`. Whatever\n * is not named here becomes an undifferentiated pile that no aggregate can see\n * a pattern in, which is the one thing report categories exist for. Worth being\n * deliberate about the absences rather than discovering them later.\n */\nexport const REPORT_REASON_VALUES = [\n 'spam',\n 'harassment',\n 'misinformation',\n 'off_topic',\n 'impersonation',\n 'other',\n] as const;\nexport const reportReasonSchema = z.enum(REPORT_REASON_VALUES);\nexport type ReportReason = z.infer<typeof reportReasonSchema>;\n\n/**\n * What a member sends to report a post, poll or comment.\n *\n * The target is the URL's, not the body's: a report is filed against a specific\n * thing at a specific address, and taking the target from the body would let a\n * caller report one item while the route thinks it is another.\n *\n * `note` is free text and optional, which is the pressure valve for everything\n * the enum does not name. ⚠️ It is written by a member, so it is untrusted at\n * render: a moderation queue displays it, and a moderation queue is a screen\n * staff read quickly.\n */\nexport const createReportBodySchema = z.object({\n reason: reportReasonSchema,\n note: z.string().trim().max(REPORT_NOTE_MAX).optional(),\n});\nexport type CreateReportBody = z.infer<typeof createReportBodySchema>;\n\n/**\n * The answer to filing one.\n *\n * `alreadyReported` distinguishes \"we have taken this\" from \"you already told\n * us\", because one report per member per target means a second press is a\n * no-op, and a silent no-op reads as a failure to somebody who pressed twice\n * deliberately. It is NOT a count: how many OTHER people reported an item is\n * moderation's business and telling a reporter would turn the count into a\n * score anyone could farm.\n */\nexport const createReportResponseSchema = z.object({\n /** A post, poll or comment; since 0.6.0 also a product or a review. */\n contentKind: reportTargetKindSchema,\n contentId: objectIdSchema,\n alreadyReported: z.boolean(),\n});\nexport type CreateReportResponse = z.infer<typeof createReportResponseSchema>;\n\n/**\n * `PUT|DELETE /api/v1/feed/comments/:commentId/helpful`: the product's team\n * marks (or unmarks) a comment as feedback that helped. Answers the state it\n * settled on. `FEEDBACK_NOT_MARKABLE` when the comment is not feedback on a\n * product the caller is on the team of.\n */\nexport const commentHelpfulResponseSchema = z.object({\n commentId: objectIdSchema,\n helpfulAt: z.iso.datetime().nullable(),\n});\nexport type CommentHelpfulResponse = z.infer<typeof commentHelpfulResponseSchema>;\n\n/** The bookmark endpoint is a toggle and returns the state it settled on. */\nexport const toggleBookmarkResponseSchema = z.object({\n contentKind: contentKindSchema,\n contentId: objectIdSchema,\n bookmarked: z.boolean(),\n});\nexport type ToggleBookmarkResponse = z.infer<typeof toggleBookmarkResponseSchema>;\n\n/** A vote returns the whole poll: counts, totals and the viewer's own choices\n * all move together, and reassembling them client-side drifts. */\nexport const castVoteResponseSchema = z.object({\n poll: feedPollSchema,\n});\nexport type CastVoteResponse = z.infer<typeof castVoteResponseSchema>;\n"]}
@@ -39,12 +39,13 @@ import { z } from 'zod';
39
39
  * What an upload is for. It decides the sizes made and where it may be attached.
40
40
  * Append only: every stored upload names one.
41
41
  */
42
- export declare const MEDIA_PURPOSE_VALUES: readonly ["post", "avatar", "product_logo", "product_screenshot"];
42
+ export declare const MEDIA_PURPOSE_VALUES: readonly ["post", "avatar", "product_logo", "product_screenshot", "community_icon"];
43
43
  export declare const mediaPurposeSchema: z.ZodEnum<{
44
44
  post: "post";
45
45
  avatar: "avatar";
46
46
  product_logo: "product_logo";
47
47
  product_screenshot: "product_screenshot";
48
+ community_icon: "community_icon";
48
49
  }>;
49
50
  export type MediaPurpose = z.infer<typeof mediaPurposeSchema>;
50
51
  /**
@@ -82,6 +83,9 @@ export type MediaUploadContentType = z.infer<typeof mediaUploadContentTypeSchema
82
83
  * - product_screenshot: as a post's image (long edge, aspect kept); a phone
83
84
  * screenshot is tall, a desktop one wide. An animated GIF (a short demo)
84
85
  * stays animated, within the same limits as a post's.
86
+ * - community_icon (0.9.0): as a product logo, a SQUARE fitted, never
87
+ * cropped. 96 for the "in <community>" chip, 256 for a card, 512 for the
88
+ * community page. It belongs to the community, not its uploader.
85
89
  *
86
90
  * A client shrinks a photo to the largest size here before uploading: anything
87
91
  * bigger is thrown away by the server anyway, and costs the member data.
@@ -91,6 +95,7 @@ export declare const MEDIA_SIZES: {
91
95
  readonly avatar: readonly [192, 512];
92
96
  readonly product_logo: readonly [96, 256, 512];
93
97
  readonly product_screenshot: readonly [540, 1080, 2048];
98
+ readonly community_icon: readonly [96, 256, 512];
94
99
  };
95
100
  /** The most sizes any purpose stores: the bound on `variants`. */
96
101
  export declare const MEDIA_VARIANTS_MAX: number;
@@ -152,6 +157,7 @@ export declare const uploadedMediaSchema: z.ZodObject<{
152
157
  avatar: "avatar";
153
158
  product_logo: "product_logo";
154
159
  product_screenshot: "product_screenshot";
160
+ community_icon: "community_icon";
155
161
  }>;
156
162
  expiresAt: z.ZodISODateTime;
157
163
  }, z.core.$strip>;
@@ -1 +1 @@
1
- {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/domains/media/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,eAAO,MAAM,oBAAoB,mEAKvB,CAAC;AACX,eAAO,MAAM,kBAAkB;;;;;EAA+B,CAAC;AAC/D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,iEAK7B,CAAC;AACX,eAAO,MAAM,4BAA4B;;;;;EAAqC,CAAC;AAC/E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW;;;;;CAKoC,CAAC;AAE7D,kEAAkE;AAClE,eAAO,MAAM,kBAAkB,QAE9B,CAAC;AAEF,mCAAmC;AACnC,eAAO,MAAM,kBAAkB;;;;iBAI7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gB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AO,gBAAgB,CAAC,CAAC;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;iBAG9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -45,6 +45,7 @@ export const MEDIA_PURPOSE_VALUES = [
45
45
  'avatar',
46
46
  'product_logo',
47
47
  'product_screenshot',
48
+ 'community_icon',
48
49
  ];
49
50
  export const mediaPurposeSchema = z.enum(MEDIA_PURPOSE_VALUES);
50
51
  /**
@@ -81,6 +82,9 @@ export const mediaUploadContentTypeSchema = z.enum(MEDIA_UPLOAD_CONTENT_TYPES);
81
82
  * - product_screenshot: as a post's image (long edge, aspect kept); a phone
82
83
  * screenshot is tall, a desktop one wide. An animated GIF (a short demo)
83
84
  * stays animated, within the same limits as a post's.
85
+ * - community_icon (0.9.0): as a product logo, a SQUARE fitted, never
86
+ * cropped. 96 for the "in <community>" chip, 256 for a card, 512 for the
87
+ * community page. It belongs to the community, not its uploader.
84
88
  *
85
89
  * A client shrinks a photo to the largest size here before uploading: anything
86
90
  * bigger is thrown away by the server anyway, and costs the member data.
@@ -90,6 +94,7 @@ export const MEDIA_SIZES = {
90
94
  avatar: [192, 512],
91
95
  product_logo: [96, 256, 512],
92
96
  product_screenshot: [540, 1080, 2048],
97
+ community_icon: [96, 256, 512],
93
98
  };
94
99
  /** The most sizes any purpose stores: the bound on `variants`. */
95
100
  export const MEDIA_VARIANTS_MAX = Math.max(...Object.values(MEDIA_SIZES).map((sizes) => sizes.length));
@@ -1 +1 @@
1
- {"version":3,"file":"media.js","sourceRoot":"","sources":["../../../src/domains/media/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D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AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE;IACZ,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAClC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACnC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC;IACpE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,QAAQ,EAAE;CAC9D,CAAC,CAAC;AAGH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,MAAM,CAAC;IACzD,OAAO,EAAE,kBAAkB;IAC3B,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — Media: what an uploaded image becomes\n *\n * THE PIPELINE, end to end (0.5.0):\n *\n * 1. The client shrinks the photo (long edge at most the largest size in\n * `MEDIA_SIZES`, WebP or JPEG) and asks for an upload slot:\n * `POST /api/v1/uploads/presign` with a purpose, a content type and the\n * exact byte count (`uploadPresignBodySchema`).\n * 2. It PUTs the bytes straight to storage, with the headers it was given.\n * Nothing passes through the API server.\n * 3. It calls `POST /api/v1/uploads/:mediaId/complete`. The server checks the\n * file, decodes it fully, applies the photo's rotation, REMOVES EVERY\n * PIECE OF METADATA (GPS position, camera, timestamps), re-encodes it as\n * WebP at each size in `MEDIA_SIZES`, deletes the raw upload, and answers\n * with `uploadedMediaSchema`.\n * 4. A post (`attachedMediaSchema`), the avatar (`setAvatarBodySchema`,\n * onboarding's `avatarMediaId`), or a product's logo and screenshots\n * (`setProductLogoBodySchema`, `setProductScreenshotsBodySchema`, 0.6.0)\n * takes the media id. One upload is used once, by its owner, for the\n * purpose it was uploaded for.\n *\n * A product's images belong to the PRODUCT, not to whoever on the team uploaded\n * them: they stay when that person leaves or deletes their account, and go when\n * the product is deleted.\n *\n * What nobody sees: the raw upload. It sits in a folder the CDN cannot reach\n * and is deleted when processing finishes, or by storage itself after a day.\n * Only the re-encoded sizes are ever served.\n *\n * An image never attached is deleted after `MEDIA_UNATTACHED_TTL_HOURS`; a\n * deleted post's images, a replaced avatar, and an erased account's images are\n * deleted from storage by the server, so a copied link stops working.\n *\n * @module founder-schema/domains/media\n */\n\nimport { z } from 'zod';\nimport { MEDIA_PLACEHOLDER_MAX } from '../../core/limits.js';\n\n/**\n * What an upload is for. It decides the sizes made and where it may be attached.\n * Append only: every stored upload names one.\n */\nexport const MEDIA_PURPOSE_VALUES = [\n 'post',\n 'avatar',\n 'product_logo',\n 'product_screenshot',\n] as const;\nexport const mediaPurposeSchema = z.enum(MEDIA_PURPOSE_VALUES);\nexport type MediaPurpose = z.infer<typeof mediaPurposeSchema>;\n\n/**\n * The content types a member may upload. Every one is decoded and re-encoded\n * to WebP before anyone sees it, so this list is about what the server can\n * DECODE safely, not what it serves.\n *\n * Not HEIC: an iPhone's photo picker converts HEIC to JPEG for the web, and a\n * client that shrinks the photo first re-encodes it anyway. SVG never: it is a\n * document that can carry script, not an image.\n */\nexport const MEDIA_UPLOAD_CONTENT_TYPES = [\n 'image/jpeg',\n 'image/png',\n 'image/webp',\n 'image/gif',\n] as const;\nexport const mediaUploadContentTypeSchema = z.enum(MEDIA_UPLOAD_CONTENT_TYPES);\nexport type MediaUploadContentType = z.infer<typeof mediaUploadContentTypeSchema>;\n\n/**\n * The sizes each purpose is stored at, smallest first.\n *\n * - post: the LONG edge, aspect kept. 540 for a feed card on a plain screen,\n * 1080 for the same card on a phone's dense screen, 2048 for the full-screen\n * view. An image smaller than a size is never enlarged, so a small image\n * has fewer sizes.\n * - avatar: a SQUARE, cropped around the most interesting region (usually a\n * face). 192 for every small circle (bylines, lists, chat) up to 64 CSS\n * pixels on a 3x screen, 512 for a profile header.\n * - product_logo: a SQUARE, but NEVER CROPPED: the whole logo is fitted\n * inside it and the rest is transparent, because cropping a wordmark the\n * way an avatar is cropped cuts letters off. Transparency is kept. 96 for\n * the product chip on a post (32 CSS pixels at 3x), 256 for a Discover card,\n * 512 for the product page.\n * - product_screenshot: as a post's image (long edge, aspect kept); a phone\n * screenshot is tall, a desktop one wide. An animated GIF (a short demo)\n * stays animated, within the same limits as a post's.\n *\n * A client shrinks a photo to the largest size here before uploading: anything\n * bigger is thrown away by the server anyway, and costs the member data.\n */\nexport const MEDIA_SIZES = {\n post: [540, 1080, 2048],\n avatar: [192, 512],\n product_logo: [96, 256, 512],\n product_screenshot: [540, 1080, 2048],\n} as const satisfies Record<MediaPurpose, readonly number[]>;\n\n/** The most sizes any purpose stores: the bound on `variants`. */\nexport const MEDIA_VARIANTS_MAX = Math.max(\n ...Object.values(MEDIA_SIZES).map((sizes) => sizes.length),\n);\n\n/** One stored size of an image. */\nexport const mediaVariantSchema = z.object({\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n url: z.url(),\n});\nexport type MediaVariant = z.infer<typeof mediaVariantSchema>;\n\n/**\n * A processed image, as every read shows it.\n *\n * `variants` is a ready-made `srcset`: smallest first, each with its own pixel\n * width. `url`, `width` and `height` repeat the largest one, so a client that\n * ignores `variants` still renders correctly and can reserve the image's box\n * from the aspect ratio before it loads (no layout shift).\n *\n * `placeholder` is a ThumbHash (base64): a ~30 character blurred preview a\n * client can paint instantly while the image loads.\n *\n * URLs point at our media CDN. They come from our own pipeline, never from a\n * member, so a plain `z.url()`.\n */\nexport const mediaImageSchema = z.object({\n id: z.string(),\n url: z.url(),\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n variants: z.array(mediaVariantSchema).min(1).max(MEDIA_VARIANTS_MAX),\n placeholder: z.string().max(MEDIA_PLACEHOLDER_MAX).optional(),\n});\nexport type MediaImage = z.infer<typeof mediaImageSchema>;\n\n/**\n * `POST /api/v1/uploads/:mediaId/complete` answers with this: the image as it\n * will appear, not yet attached to anything.\n *\n * `expiresAt` is when the server deletes it if it is still unattached\n * (`MEDIA_UNATTACHED_TTL_HOURS` after the slot was issued). A composer left\n * open longer than that must upload again.\n */\nexport const uploadedMediaSchema = mediaImageSchema.extend({\n purpose: mediaPurposeSchema,\n expiresAt: z.iso.datetime(),\n});\nexport type UploadedMedia = z.infer<typeof uploadedMediaSchema>;\n"]}
1
+ {"version":3,"file":"media.js","sourceRoot":"","sources":["../../../src/domains/media/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,MAAM;IACN,QAAQ;IACR,cAAc;IACd,oBAAoB;IACpB,gBAAgB;CACR,CAAC;AACX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;AAG/D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,WAAW;CACH,CAAC;AACX,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;AAG/E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC;IACvB,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,YAAY,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG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MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,MAAM,CAAC;IACzD,OAAO,EAAE,kBAAkB;IAC3B,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — Media: what an uploaded image becomes\n *\n * THE PIPELINE, end to end (0.5.0):\n *\n * 1. The client shrinks the photo (long edge at most the largest size in\n * `MEDIA_SIZES`, WebP or JPEG) and asks for an upload slot:\n * `POST /api/v1/uploads/presign` with a purpose, a content type and the\n * exact byte count (`uploadPresignBodySchema`).\n * 2. It PUTs the bytes straight to storage, with the headers it was given.\n * Nothing passes through the API server.\n * 3. It calls `POST /api/v1/uploads/:mediaId/complete`. The server checks the\n * file, decodes it fully, applies the photo's rotation, REMOVES EVERY\n * PIECE OF METADATA (GPS position, camera, timestamps), re-encodes it as\n * WebP at each size in `MEDIA_SIZES`, deletes the raw upload, and answers\n * with `uploadedMediaSchema`.\n * 4. A post (`attachedMediaSchema`), the avatar (`setAvatarBodySchema`,\n * onboarding's `avatarMediaId`), or a product's logo and screenshots\n * (`setProductLogoBodySchema`, `setProductScreenshotsBodySchema`, 0.6.0)\n * takes the media id. One upload is used once, by its owner, for the\n * purpose it was uploaded for.\n *\n * A product's images belong to the PRODUCT, not to whoever on the team uploaded\n * them: they stay when that person leaves or deletes their account, and go when\n * the product is deleted.\n *\n * What nobody sees: the raw upload. It sits in a folder the CDN cannot reach\n * and is deleted when processing finishes, or by storage itself after a day.\n * Only the re-encoded sizes are ever served.\n *\n * An image never attached is deleted after `MEDIA_UNATTACHED_TTL_HOURS`; a\n * deleted post's images, a replaced avatar, and an erased account's images are\n * deleted from storage by the server, so a copied link stops working.\n *\n * @module founder-schema/domains/media\n */\n\nimport { z } from 'zod';\nimport { MEDIA_PLACEHOLDER_MAX } from '../../core/limits.js';\n\n/**\n * What an upload is for. It decides the sizes made and where it may be attached.\n * Append only: every stored upload names one.\n */\nexport const MEDIA_PURPOSE_VALUES = [\n 'post',\n 'avatar',\n 'product_logo',\n 'product_screenshot',\n 'community_icon',\n] as const;\nexport const mediaPurposeSchema = z.enum(MEDIA_PURPOSE_VALUES);\nexport type MediaPurpose = z.infer<typeof mediaPurposeSchema>;\n\n/**\n * The content types a member may upload. Every one is decoded and re-encoded\n * to WebP before anyone sees it, so this list is about what the server can\n * DECODE safely, not what it serves.\n *\n * Not HEIC: an iPhone's photo picker converts HEIC to JPEG for the web, and a\n * client that shrinks the photo first re-encodes it anyway. SVG never: it is a\n * document that can carry script, not an image.\n */\nexport const MEDIA_UPLOAD_CONTENT_TYPES = [\n 'image/jpeg',\n 'image/png',\n 'image/webp',\n 'image/gif',\n] as const;\nexport const mediaUploadContentTypeSchema = z.enum(MEDIA_UPLOAD_CONTENT_TYPES);\nexport type MediaUploadContentType = z.infer<typeof mediaUploadContentTypeSchema>;\n\n/**\n * The sizes each purpose is stored at, smallest first.\n *\n * - post: the LONG edge, aspect kept. 540 for a feed card on a plain screen,\n * 1080 for the same card on a phone's dense screen, 2048 for the full-screen\n * view. An image smaller than a size is never enlarged, so a small image\n * has fewer sizes.\n * - avatar: a SQUARE, cropped around the most interesting region (usually a\n * face). 192 for every small circle (bylines, lists, chat) up to 64 CSS\n * pixels on a 3x screen, 512 for a profile header.\n * - product_logo: a SQUARE, but NEVER CROPPED: the whole logo is fitted\n * inside it and the rest is transparent, because cropping a wordmark the\n * way an avatar is cropped cuts letters off. Transparency is kept. 96 for\n * the product chip on a post (32 CSS pixels at 3x), 256 for a Discover card,\n * 512 for the product page.\n * - product_screenshot: as a post's image (long edge, aspect kept); a phone\n * screenshot is tall, a desktop one wide. An animated GIF (a short demo)\n * stays animated, within the same limits as a post's.\n * - community_icon (0.9.0): as a product logo, a SQUARE fitted, never\n * cropped. 96 for the \"in <community>\" chip, 256 for a card, 512 for the\n * community page. It belongs to the community, not its uploader.\n *\n * A client shrinks a photo to the largest size here before uploading: anything\n * bigger is thrown away by the server anyway, and costs the member data.\n */\nexport const MEDIA_SIZES = {\n post: [540, 1080, 2048],\n avatar: [192, 512],\n product_logo: [96, 256, 512],\n product_screenshot: [540, 1080, 2048],\n community_icon: [96, 256, 512],\n} as const satisfies Record<MediaPurpose, readonly number[]>;\n\n/** The most sizes any purpose stores: the bound on `variants`. */\nexport const MEDIA_VARIANTS_MAX = Math.max(\n ...Object.values(MEDIA_SIZES).map((sizes) => sizes.length),\n);\n\n/** One stored size of an image. */\nexport const mediaVariantSchema = z.object({\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n url: z.url(),\n});\nexport type MediaVariant = z.infer<typeof mediaVariantSchema>;\n\n/**\n * A processed image, as every read shows it.\n *\n * `variants` is a ready-made `srcset`: smallest first, each with its own pixel\n * width. `url`, `width` and `height` repeat the largest one, so a client that\n * ignores `variants` still renders correctly and can reserve the image's box\n * from the aspect ratio before it loads (no layout shift).\n *\n * `placeholder` is a ThumbHash (base64): a ~30 character blurred preview a\n * client can paint instantly while the image loads.\n *\n * URLs point at our media CDN. They come from our own pipeline, never from a\n * member, so a plain `z.url()`.\n */\nexport const mediaImageSchema = z.object({\n id: z.string(),\n url: z.url(),\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n variants: z.array(mediaVariantSchema).min(1).max(MEDIA_VARIANTS_MAX),\n placeholder: z.string().max(MEDIA_PLACEHOLDER_MAX).optional(),\n});\nexport type MediaImage = z.infer<typeof mediaImageSchema>;\n\n/**\n * `POST /api/v1/uploads/:mediaId/complete` answers with this: the image as it\n * will appear, not yet attached to anything.\n *\n * `expiresAt` is when the server deletes it if it is still unattached\n * (`MEDIA_UNATTACHED_TTL_HOURS` after the slot was issued). A composer left\n * open longer than that must upload again.\n */\nexport const uploadedMediaSchema = mediaImageSchema.extend({\n purpose: mediaPurposeSchema,\n expiresAt: z.iso.datetime(),\n});\nexport type UploadedMedia = z.infer<typeof uploadedMediaSchema>;\n"]}
@@ -163,7 +163,13 @@ export declare const memberDetailSchema: z.ZodObject<{
163
163
  support_agent: "support_agent";
164
164
  }>>;
165
165
  canResetMpin: z.ZodBoolean;
166
+ grantableCapabilities: z.ZodArray<z.ZodEnum<{
167
+ create_communities: "create_communities";
168
+ }>>;
166
169
  }, z.core.$strip>;
170
+ capabilities: z.ZodArray<z.ZodEnum<{
171
+ create_communities: "create_communities";
172
+ }>>;
167
173
  mpinSet: z.ZodBoolean;
168
174
  }, z.core.$strip>;
169
175
  export type MemberDetail = z.infer<typeof memberDetailSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"members.d.ts","sourceRoot":"","sources":["../../../src/domains/members/members.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgBxB,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,kCAAmC,CAAC;AACrE,eAAO,MAAM,kBAAkB;;;EAA+B,CAAC;AAC/D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,sCAAsC;AACtC,eAAO,MAAM,kBAAkB;;iBAAyC,CAAC;AACzE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;iBAKrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEnF,gCAAgC;AAChC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;iBAa9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;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MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEnF,gCAAgC;AAChC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;iBAa9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;iBAAuC,CAAC;AAC9E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,6BAA6B;AAC7B,eAAO,MAAM,gBAAgB;;;;;;;iBAK3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,qCAAqC;AACrC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4B7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,sFAAsF;AACtF,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -30,6 +30,7 @@
30
30
  * @module founder-schema/domains/members
31
31
  */
32
32
  import { z } from 'zod';
33
+ import { capabilitySchema } from '../../access/capabilities.js';
33
34
  import { platformRoleSchema } from '../../access/roles.js';
34
35
  import { emptyStringToUndefined, objectIdSchema, optionalTrimmedString, paginationQuerySchema, usernameSchema, } from '../../core/common.js';
35
36
  import { MEMBER_SEARCH_MAX, SUSPENSION_REASON_MAX, SUSPENSION_REASON_MIN, } from '../../core/limits.js';
@@ -95,7 +96,11 @@ export const memberDetailSchema = memberSummarySchema.extend({
95
96
  grantableRoles: z.array(platformRoleSchema),
96
97
  /** May clear this member's forgotten MPIN (superadmin, someone else). */
97
98
  canResetMpin: z.boolean(),
99
+ /** Capabilities the asker may grant or revoke on this member (never their own) (0.9.0). */
100
+ grantableCapabilities: z.array(capabilitySchema),
98
101
  }),
102
+ /** The capabilities they hold (0.9.0), e.g. `create_communities`. */
103
+ capabilities: z.array(capabilitySchema),
99
104
  /** Whether they have set an MPIN. Only meaningful for staff. */
100
105
  mpinSet: z.boolean(),
101
106
  });