jansathi-community-schema 0.13.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/comment.d.ts +1 -0
- package/dist/comment.d.ts.map +1 -1
- package/dist/feed.d.ts +13 -0
- package/dist/feed.d.ts.map +1 -1
- package/dist/post.d.ts +4 -0
- package/dist/post.d.ts.map +1 -1
- package/dist/post.js +17 -0
- package/dist/post.js.map +1 -1
- package/dist/repost.d.ts +2 -0
- package/dist/repost.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/comment.d.ts
CHANGED
package/dist/comment.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../src/comment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,0BAA0B
|
|
1
|
+
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../src/comment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkCrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAI9E,eAAO,MAAM,uBAAuB;;;iBAMlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAIxE,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
package/dist/feed.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export declare const lostFoundFeedItemSchema: z.ZodObject<{
|
|
|
61
61
|
}>>;
|
|
62
62
|
custom: z.ZodNullable<z.ZodString>;
|
|
63
63
|
}, z.core.$strip>>>;
|
|
64
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
64
65
|
}, z.core.$strip>;
|
|
65
66
|
kind: z.ZodEnum<{
|
|
66
67
|
lost: "lost";
|
|
@@ -121,6 +122,7 @@ export declare const donateItemFeedItemSchema: z.ZodObject<{
|
|
|
121
122
|
}>>;
|
|
122
123
|
custom: z.ZodNullable<z.ZodString>;
|
|
123
124
|
}, z.core.$strip>>>;
|
|
125
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
124
126
|
}, z.core.$strip>;
|
|
125
127
|
itemName: z.ZodString;
|
|
126
128
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -178,6 +180,7 @@ export declare const voiceBoxFeedItemSchema: z.ZodObject<{
|
|
|
178
180
|
}>>;
|
|
179
181
|
custom: z.ZodNullable<z.ZodString>;
|
|
180
182
|
}, z.core.$strip>>>;
|
|
183
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
181
184
|
}, z.core.$strip>;
|
|
182
185
|
kind: z.ZodEnum<{
|
|
183
186
|
complaint: "complaint";
|
|
@@ -232,6 +235,7 @@ export declare const feedItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
232
235
|
}>>;
|
|
233
236
|
custom: z.ZodNullable<z.ZodString>;
|
|
234
237
|
}, z.core.$strip>>>;
|
|
238
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
235
239
|
}, z.core.$strip>;
|
|
236
240
|
text: z.ZodString;
|
|
237
241
|
images: z.ZodArray<z.ZodObject<{
|
|
@@ -301,6 +305,7 @@ export declare const feedItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
301
305
|
}>>;
|
|
302
306
|
custom: z.ZodNullable<z.ZodString>;
|
|
303
307
|
}, z.core.$strip>>>;
|
|
308
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
304
309
|
}, z.core.$strip>;
|
|
305
310
|
title: z.ZodString;
|
|
306
311
|
body: z.ZodOptional<z.ZodString>;
|
|
@@ -351,6 +356,7 @@ export declare const feedItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
351
356
|
}>>;
|
|
352
357
|
custom: z.ZodNullable<z.ZodString>;
|
|
353
358
|
}, z.core.$strip>>>;
|
|
359
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
354
360
|
}, z.core.$strip>;
|
|
355
361
|
kind: z.ZodEnum<{
|
|
356
362
|
lost: "lost";
|
|
@@ -404,6 +410,7 @@ export declare const feedItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
404
410
|
}>>;
|
|
405
411
|
custom: z.ZodNullable<z.ZodString>;
|
|
406
412
|
}, z.core.$strip>>>;
|
|
413
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
407
414
|
}, z.core.$strip>;
|
|
408
415
|
kind: z.ZodEnum<{
|
|
409
416
|
complaint: "complaint";
|
|
@@ -456,6 +463,7 @@ export declare const feedItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
456
463
|
}>>;
|
|
457
464
|
custom: z.ZodNullable<z.ZodString>;
|
|
458
465
|
}, z.core.$strip>>>;
|
|
466
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
459
467
|
}, z.core.$strip>;
|
|
460
468
|
itemName: z.ZodString;
|
|
461
469
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -528,6 +536,7 @@ export declare const feedResponseSchema: z.ZodObject<{
|
|
|
528
536
|
}>>;
|
|
529
537
|
custom: z.ZodNullable<z.ZodString>;
|
|
530
538
|
}, z.core.$strip>>>;
|
|
539
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
531
540
|
}, z.core.$strip>;
|
|
532
541
|
text: z.ZodString;
|
|
533
542
|
images: z.ZodArray<z.ZodObject<{
|
|
@@ -597,6 +606,7 @@ export declare const feedResponseSchema: z.ZodObject<{
|
|
|
597
606
|
}>>;
|
|
598
607
|
custom: z.ZodNullable<z.ZodString>;
|
|
599
608
|
}, z.core.$strip>>>;
|
|
609
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
600
610
|
}, z.core.$strip>;
|
|
601
611
|
title: z.ZodString;
|
|
602
612
|
body: z.ZodOptional<z.ZodString>;
|
|
@@ -647,6 +657,7 @@ export declare const feedResponseSchema: z.ZodObject<{
|
|
|
647
657
|
}>>;
|
|
648
658
|
custom: z.ZodNullable<z.ZodString>;
|
|
649
659
|
}, z.core.$strip>>>;
|
|
660
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
650
661
|
}, z.core.$strip>;
|
|
651
662
|
kind: z.ZodEnum<{
|
|
652
663
|
lost: "lost";
|
|
@@ -700,6 +711,7 @@ export declare const feedResponseSchema: z.ZodObject<{
|
|
|
700
711
|
}>>;
|
|
701
712
|
custom: z.ZodNullable<z.ZodString>;
|
|
702
713
|
}, z.core.$strip>>>;
|
|
714
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
703
715
|
}, z.core.$strip>;
|
|
704
716
|
kind: z.ZodEnum<{
|
|
705
717
|
complaint: "complaint";
|
|
@@ -752,6 +764,7 @@ export declare const feedResponseSchema: z.ZodObject<{
|
|
|
752
764
|
}>>;
|
|
753
765
|
custom: z.ZodNullable<z.ZodString>;
|
|
754
766
|
}, z.core.$strip>>>;
|
|
767
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
755
768
|
}, z.core.$strip>;
|
|
756
769
|
itemName: z.ZodString;
|
|
757
770
|
description: z.ZodOptional<z.ZodString>;
|
package/dist/feed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feed.d.ts","sourceRoot":"","sources":["../src/feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAKzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAItD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;iBAShC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/post.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export declare const postAuthorSnapshotSchema: z.ZodObject<{
|
|
|
57
57
|
}>>;
|
|
58
58
|
custom: z.ZodNullable<z.ZodString>;
|
|
59
59
|
}, z.core.$strip>>>;
|
|
60
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
60
61
|
}, z.core.$strip>;
|
|
61
62
|
export type PostAuthorSnapshot = z.infer<typeof postAuthorSnapshotSchema>;
|
|
62
63
|
/**
|
|
@@ -113,6 +114,7 @@ export declare const repostedSourceSchema: z.ZodObject<{
|
|
|
113
114
|
}>>;
|
|
114
115
|
custom: z.ZodNullable<z.ZodString>;
|
|
115
116
|
}, z.core.$strip>>>;
|
|
117
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
116
118
|
}, z.core.$strip>;
|
|
117
119
|
title: z.ZodString;
|
|
118
120
|
body: z.ZodOptional<z.ZodString>;
|
|
@@ -161,6 +163,7 @@ export declare const communityPostWireSchema: z.ZodObject<{
|
|
|
161
163
|
}>>;
|
|
162
164
|
custom: z.ZodNullable<z.ZodString>;
|
|
163
165
|
}, z.core.$strip>>>;
|
|
166
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
164
167
|
}, z.core.$strip>;
|
|
165
168
|
text: z.ZodString;
|
|
166
169
|
images: z.ZodArray<z.ZodObject<{
|
|
@@ -230,6 +233,7 @@ export declare const communityPostWireSchema: z.ZodObject<{
|
|
|
230
233
|
}>>;
|
|
231
234
|
custom: z.ZodNullable<z.ZodString>;
|
|
232
235
|
}, z.core.$strip>>>;
|
|
236
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
233
237
|
}, z.core.$strip>;
|
|
234
238
|
title: z.ZodString;
|
|
235
239
|
body: z.ZodOptional<z.ZodString>;
|
package/dist/post.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../src/post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../src/post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+CnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAI1E;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuB/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAIlE;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyDlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAIxE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;iBAO/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/post.js
CHANGED
|
@@ -63,6 +63,23 @@ export const postAuthorSnapshotSchema = z.object({
|
|
|
63
63
|
* a "current community" context to attach a designation to.
|
|
64
64
|
*/
|
|
65
65
|
designation: communityDesignationSchema.nullable().optional(),
|
|
66
|
+
/**
|
|
67
|
+
* Whether the author's real-world identity has been verified by a
|
|
68
|
+
* Jansathi volunteer / leader (UDP step 9 + the verifiedFields
|
|
69
|
+
* gate on the user-detailed-profile model). **Live-joined** from
|
|
70
|
+
* `User.identityVerified.verified` at read time, the same way
|
|
71
|
+
* `username` / `avatarUrl` / `designation` are — so a verification
|
|
72
|
+
* change propagates instantly to every old post's byline.
|
|
73
|
+
*
|
|
74
|
+
* Drives the green check-badge next to the display name on every
|
|
75
|
+
* feed card, plus client-side gating of leader-only actions like
|
|
76
|
+
* starting a community.
|
|
77
|
+
*
|
|
78
|
+
* Optional so backends that haven't started populating the field
|
|
79
|
+
* yet still serialize a valid wire shape — readers should treat
|
|
80
|
+
* `undefined` as "not verified".
|
|
81
|
+
*/
|
|
82
|
+
identityVerified: z.boolean().optional(),
|
|
66
83
|
});
|
|
67
84
|
// ─── Reposted source snapshot ──────────────────────────────────────────────
|
|
68
85
|
/**
|
package/dist/post.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.js","sourceRoot":"","sources":["../src/post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,8EAA8E;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB;oEACgE;IAChE,QAAQ,EAAE,cAAc;IACxB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACtC;;;;;OAKG;IACH,SAAS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E;CACd,CAAC,CAAC;AAGH,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,mBAAmB,CAAC;IAChD,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE;IAChE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE;IAChE;2DACuD;IACvD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAGH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,mBAAmB,CAAC;CACjD,CAAC,CAAC","sourcesContent":["/**\n * Community post wire shapes.\n *\n * A \"post\" is the native community content kind (text-primary + media).\n * Lost-and-found and voice-box items show up in the same feed via\n * polymorphic union; their shapes live in their own schema packages\n * and are projected into a `FeedItem` envelope (see `./feed.ts`).\n *\n * @module community-schema/post\n */\n\nimport { z } from 'zod';\nimport { areaLineageSnapshotSchema } from './area.js';\nimport { communityDesignationSchema } from './community.js';\nimport { POST_MAX_BODY_CHARS, POST_MAX_IMAGES, POST_MAX_VIDEOS } from './constants.js';\nimport { contentKindSchema } from './enums.js';\nimport { postImageSchema, postVideoSchema } from './media.js';\nimport { usernameSchema } from './username.js';\n\n// ─── Author snapshot (denormalised on every post) ──────────────────────────\n\n/**\n * The author's display info attached to every feed row.\n *\n * Two classes of fields here:\n *\n * - **Live (refreshed at read time)**: `username`, `displayName`,\n * `avatarUrl`. The projector batch-joins these against the User\n * collection per page, so a name or avatar change instantly\n * propagates to old posts and the byline link always targets the\n * CURRENT username (no stale `/oldhandle` 404 after a rename).\n *\n * - **Snapshotted at write time**: `localName`. This is \"where the\n * author was when posting\" — a deliberate snapshot, not a stale\n * read of their current location.\n *\n * @module community-schema/post (postAuthorSnapshotSchema)\n */\nexport const postAuthorSnapshotSchema = z.object({\n userId: z.string(),\n /** Public URL handle. Live-joined from User at read time so the\n * byline links to `/<currentUsername>` even after a rename. */\n username: usernameSchema,\n displayName: z.string(),\n avatarUrl: z.string().url().optional(),\n /**\n * The author's \"local\" area label at post time, e.g. \"Rohini Sector 15\".\n * Powers the byline \"<DisplayName> · <localName> · <relativeTime>\".\n * Snapshotted at write time — does NOT track the author's current\n * location.\n */\n localName: z.string().optional(),\n /**\n * The author's community-scoped representation label, used to\n * render \"Hari Joshi (Chairman)\" suffixes in feed-card bylines\n * inside a community. **Live-joined** from `CommunityMembership`\n * at read time (per the community + author pair), the same way\n * `username` and `avatarUrl` are live-resolved — so a designation\n * change propagates to old posts immediately.\n *\n * Populated only when the post lives inside a community\n * (`communityId` set) AND the author has a designation set in\n * that community. `null` otherwise. Global / cross-community feed\n * surfaces (the feed tab, the profile page) leave this null even\n * if the post is community-scoped — the byline there doesn't have\n * a \"current community\" context to attach a designation to.\n */\n designation: communityDesignationSchema.nullable().optional(),\n});\nexport type PostAuthorSnapshot = z.infer<typeof postAuthorSnapshotSchema>;\n\n// ─── Reposted source snapshot ──────────────────────────────────────────────\n\n/**\n * Compact embed shape used when a CommunityPost is a repost (caption +\n * optional quote of another item). Modelled after Twitter's quote-tweet\n * embed: byline + truncated text/title + first image + kind badge + the\n * moment-of-creation timestamp.\n *\n * Engagement counts are intentionally NOT included — they'd drift\n * relative to the live source. The card embeds this as a static teaser\n * that links to the source for the live numbers.\n *\n * Backend snapshots these fields at repost-create time from the source\n * row (post text / item title / first photo / status badge), so the\n * embed survives source edits / soft-deletes / hides — the user's\n * reaction at repost time is preserved.\n */\nexport const repostedSourceSchema = z.object({\n /** Which kind was reposted. Lets the embed render the right icon. */\n contentKind: contentKindSchema,\n /** Source row's id — tap-embed navigates to its thread / detail page. */\n _id: z.string(),\n /** Author snapshot of the source at repost time. */\n author: postAuthorSnapshotSchema,\n /** Primary text. For posts: the body text (truncated). For lost_found /\n * voice_box / donate_item: the title. */\n title: z.string(),\n /** Optional secondary line. For posts: unused. For legacy kinds: the\n * description (truncated server-side). */\n body: z.string().optional(),\n /** First image if any. */\n imageUrl: z.string().url().optional(),\n /** Small kind-specific badge:\n * - posts → undefined\n * - lost_found → 'lost' | 'found'\n * - voice_box → 'complaint' | 'suggestion'\n * - donate_item → 'PENDING' | 'VERIFIED' | 'AT_CENTER' | 'DONATED'\n */\n kindBadge: z.string().optional(),\n createdAt: z.string().datetime(),\n});\nexport type RepostedSource = z.infer<typeof repostedSourceSchema>;\n\n// ─── Wire shape — what the server returns ──────────────────────────────────\n\n/**\n * A community post as it appears in the feed and on the single-post\n * page. Engagement counts are denormalised onto the document for\n * fast feed sorting; the per-user reaction state (\"did I upvote this?\")\n * is computed at read time and returned in the `viewer` block.\n */\nexport const communityPostWireSchema = z.object({\n _id: z.string(),\n contentKind: z.literal('post'),\n author: postAuthorSnapshotSchema,\n\n // Body — for a repost, this carries the caption (may be empty).\n text: z.string().max(POST_MAX_BODY_CHARS),\n images: z.array(postImageSchema).max(POST_MAX_IMAGES),\n videos: z.array(postVideoSchema).max(POST_MAX_VIDEOS),\n\n // Authorship area\n /** Snapshot of where the author was at write time. Drives the\n * area-proximity cascade and ranking in feed.service. */\n areaLineage: areaLineageSnapshotSchema,\n /** When set, the post is scoped to a topical community and is NOT\n * surfaced via the geo cascade. The community feed adds an explicit\n * `communityId` filter to its read queries. Posts authored from the\n * global composer leave this null. */\n communityId: z.string().optional(),\n\n // Denormalised engagement counters (drive feed sort + card render)\n upvoteCount: z.number().int().nonnegative(),\n commentCount: z.number().int().nonnegative(),\n /** How many times this post has been reposted. Incremented by the\n * repost endpoint; reposts of reposts are blocked server-side. */\n repostCount: z.number().int().nonnegative(),\n /** Map of `ReactionType` → count, e.g. { like: 4, love: 1 }. */\n reactionCounts: z.record(z.string(), z.number().int().nonnegative()),\n\n /** Source-snapshot when this post is a repost. Absent on regular posts.\n * The wrapper post owns its own engagement counters; this embed is\n * a static teaser of the original at repost time. */\n repostOf: repostedSourceSchema.optional(),\n\n // Lifecycle\n createdAt: z.string().datetime(),\n /** Last edit timestamp, or null if never edited. Edit window is\n * enforced by the server at write time, not by this schema. */\n editedAt: z.string().datetime().nullable(),\n deletedAt: z.string().datetime().nullable(),\n\n // Per-viewer state (filled by the server at read time)\n viewer: z\n .object({\n upvoted: z.boolean(),\n /** The reaction the viewer chose, or null. Mutually exclusive\n * with `upvoted` is intentionally NOT enforced — they're two\n * separate axes per the product decision. */\n reaction: z.string().nullable(),\n /** True when the viewer authored the post (controls edit / delete buttons). */\n isAuthor: z.boolean(),\n /** True when the viewer has already reposted this source. The\n * client uses this to render the repost button as \"already\n * reposted\" rather than as a fresh CTA. */\n reposted: z.boolean(),\n })\n .optional(),\n});\nexport type CommunityPostWire = z.infer<typeof communityPostWireSchema>;\n\n// ─── Create / update bodies ────────────────────────────────────────────────\n\n/**\n * What the client sends to `POST /api/v1/community/posts`. The author\n * is taken from the authenticated request; the area lineage is resolved\n * server-side from the user's `currentLocation` (the client cannot\n * spoof a different area).\n */\nexport const createPostBodySchema = z.object({\n text: z.string().min(1).max(POST_MAX_BODY_CHARS),\n images: z.array(postImageSchema).max(POST_MAX_IMAGES).optional(),\n videos: z.array(postVideoSchema).max(POST_MAX_VIDEOS).optional(),\n /** When set, the post is scoped to a topical community. The author\n * must be an active member; non-members get a 403. */\n communityId: z.string().optional(),\n});\nexport type CreatePostBody = z.infer<typeof createPostBodySchema>;\n\n/**\n * What the client sends to `PATCH /api/v1/community/posts/:id`. Only\n * the text body is editable — media additions / removals require a new\n * post (matches Twitter / FB convention).\n */\nexport const updatePostBodySchema = z.object({\n text: z.string().min(1).max(POST_MAX_BODY_CHARS),\n});\nexport type UpdatePostBody = z.infer<typeof updatePostBodySchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"post.js","sourceRoot":"","sources":["../src/post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,8EAA8E;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB;oEACgE;IAChE,QAAQ,EAAE,cAAc;IACxB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACtC;;;;;OAKG;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC;;;;;;;;;;;;;;OAcG;IACH,WAAW,EAAE,0BAA0B,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC7D;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC;AAGH,8EAA8E;AAE9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAA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AAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE;IAChE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE;IAChE;2DACuD;IACvD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAGH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,mBAAmB,CAAC;CACjD,CAAC,CAAC","sourcesContent":["/**\n * Community post wire shapes.\n *\n * A \"post\" is the native community content kind (text-primary + media).\n * Lost-and-found and voice-box items show up in the same feed via\n * polymorphic union; their shapes live in their own schema packages\n * and are projected into a `FeedItem` envelope (see `./feed.ts`).\n *\n * @module community-schema/post\n */\n\nimport { z } from 'zod';\nimport { areaLineageSnapshotSchema } from './area.js';\nimport { communityDesignationSchema } from './community.js';\nimport { POST_MAX_BODY_CHARS, POST_MAX_IMAGES, POST_MAX_VIDEOS } from './constants.js';\nimport { contentKindSchema } from './enums.js';\nimport { postImageSchema, postVideoSchema } from './media.js';\nimport { usernameSchema } from './username.js';\n\n// ─── Author snapshot (denormalised on every post) ──────────────────────────\n\n/**\n * The author's display info attached to every feed row.\n *\n * Two classes of fields here:\n *\n * - **Live (refreshed at read time)**: `username`, `displayName`,\n * `avatarUrl`. The projector batch-joins these against the User\n * collection per page, so a name or avatar change instantly\n * propagates to old posts and the byline link always targets the\n * CURRENT username (no stale `/oldhandle` 404 after a rename).\n *\n * - **Snapshotted at write time**: `localName`. This is \"where the\n * author was when posting\" — a deliberate snapshot, not a stale\n * read of their current location.\n *\n * @module community-schema/post (postAuthorSnapshotSchema)\n */\nexport const postAuthorSnapshotSchema = z.object({\n userId: z.string(),\n /** Public URL handle. Live-joined from User at read time so the\n * byline links to `/<currentUsername>` even after a rename. */\n username: usernameSchema,\n displayName: z.string(),\n avatarUrl: z.string().url().optional(),\n /**\n * The author's \"local\" area label at post time, e.g. \"Rohini Sector 15\".\n * Powers the byline \"<DisplayName> · <localName> · <relativeTime>\".\n * Snapshotted at write time — does NOT track the author's current\n * location.\n */\n localName: z.string().optional(),\n /**\n * The author's community-scoped representation label, used to\n * render \"Hari Joshi (Chairman)\" suffixes in feed-card bylines\n * inside a community. **Live-joined** from `CommunityMembership`\n * at read time (per the community + author pair), the same way\n * `username` and `avatarUrl` are live-resolved — so a designation\n * change propagates to old posts immediately.\n *\n * Populated only when the post lives inside a community\n * (`communityId` set) AND the author has a designation set in\n * that community. `null` otherwise. Global / cross-community feed\n * surfaces (the feed tab, the profile page) leave this null even\n * if the post is community-scoped — the byline there doesn't have\n * a \"current community\" context to attach a designation to.\n */\n designation: communityDesignationSchema.nullable().optional(),\n /**\n * Whether the author's real-world identity has been verified by a\n * Jansathi volunteer / leader (UDP step 9 + the verifiedFields\n * gate on the user-detailed-profile model). **Live-joined** from\n * `User.identityVerified.verified` at read time, the same way\n * `username` / `avatarUrl` / `designation` are — so a verification\n * change propagates instantly to every old post's byline.\n *\n * Drives the green check-badge next to the display name on every\n * feed card, plus client-side gating of leader-only actions like\n * starting a community.\n *\n * Optional so backends that haven't started populating the field\n * yet still serialize a valid wire shape — readers should treat\n * `undefined` as \"not verified\".\n */\n identityVerified: z.boolean().optional(),\n});\nexport type PostAuthorSnapshot = z.infer<typeof postAuthorSnapshotSchema>;\n\n// ─── Reposted source snapshot ──────────────────────────────────────────────\n\n/**\n * Compact embed shape used when a CommunityPost is a repost (caption +\n * optional quote of another item). Modelled after Twitter's quote-tweet\n * embed: byline + truncated text/title + first image + kind badge + the\n * moment-of-creation timestamp.\n *\n * Engagement counts are intentionally NOT included — they'd drift\n * relative to the live source. The card embeds this as a static teaser\n * that links to the source for the live numbers.\n *\n * Backend snapshots these fields at repost-create time from the source\n * row (post text / item title / first photo / status badge), so the\n * embed survives source edits / soft-deletes / hides — the user's\n * reaction at repost time is preserved.\n */\nexport const repostedSourceSchema = z.object({\n /** Which kind was reposted. Lets the embed render the right icon. */\n contentKind: contentKindSchema,\n /** Source row's id — tap-embed navigates to its thread / detail page. */\n _id: z.string(),\n /** Author snapshot of the source at repost time. */\n author: postAuthorSnapshotSchema,\n /** Primary text. For posts: the body text (truncated). For lost_found /\n * voice_box / donate_item: the title. */\n title: z.string(),\n /** Optional secondary line. For posts: unused. For legacy kinds: the\n * description (truncated server-side). */\n body: z.string().optional(),\n /** First image if any. */\n imageUrl: z.string().url().optional(),\n /** Small kind-specific badge:\n * - posts → undefined\n * - lost_found → 'lost' | 'found'\n * - voice_box → 'complaint' | 'suggestion'\n * - donate_item → 'PENDING' | 'VERIFIED' | 'AT_CENTER' | 'DONATED'\n */\n kindBadge: z.string().optional(),\n createdAt: z.string().datetime(),\n});\nexport type RepostedSource = z.infer<typeof repostedSourceSchema>;\n\n// ─── Wire shape — what the server returns ──────────────────────────────────\n\n/**\n * A community post as it appears in the feed and on the single-post\n * page. Engagement counts are denormalised onto the document for\n * fast feed sorting; the per-user reaction state (\"did I upvote this?\")\n * is computed at read time and returned in the `viewer` block.\n */\nexport const communityPostWireSchema = z.object({\n _id: z.string(),\n contentKind: z.literal('post'),\n author: postAuthorSnapshotSchema,\n\n // Body — for a repost, this carries the caption (may be empty).\n text: z.string().max(POST_MAX_BODY_CHARS),\n images: z.array(postImageSchema).max(POST_MAX_IMAGES),\n videos: z.array(postVideoSchema).max(POST_MAX_VIDEOS),\n\n // Authorship area\n /** Snapshot of where the author was at write time. Drives the\n * area-proximity cascade and ranking in feed.service. */\n areaLineage: areaLineageSnapshotSchema,\n /** When set, the post is scoped to a topical community and is NOT\n * surfaced via the geo cascade. The community feed adds an explicit\n * `communityId` filter to its read queries. Posts authored from the\n * global composer leave this null. */\n communityId: z.string().optional(),\n\n // Denormalised engagement counters (drive feed sort + card render)\n upvoteCount: z.number().int().nonnegative(),\n commentCount: z.number().int().nonnegative(),\n /** How many times this post has been reposted. Incremented by the\n * repost endpoint; reposts of reposts are blocked server-side. */\n repostCount: z.number().int().nonnegative(),\n /** Map of `ReactionType` → count, e.g. { like: 4, love: 1 }. */\n reactionCounts: z.record(z.string(), z.number().int().nonnegative()),\n\n /** Source-snapshot when this post is a repost. Absent on regular posts.\n * The wrapper post owns its own engagement counters; this embed is\n * a static teaser of the original at repost time. */\n repostOf: repostedSourceSchema.optional(),\n\n // Lifecycle\n createdAt: z.string().datetime(),\n /** Last edit timestamp, or null if never edited. Edit window is\n * enforced by the server at write time, not by this schema. */\n editedAt: z.string().datetime().nullable(),\n deletedAt: z.string().datetime().nullable(),\n\n // Per-viewer state (filled by the server at read time)\n viewer: z\n .object({\n upvoted: z.boolean(),\n /** The reaction the viewer chose, or null. Mutually exclusive\n * with `upvoted` is intentionally NOT enforced — they're two\n * separate axes per the product decision. */\n reaction: z.string().nullable(),\n /** True when the viewer authored the post (controls edit / delete buttons). */\n isAuthor: z.boolean(),\n /** True when the viewer has already reposted this source. The\n * client uses this to render the repost button as \"already\n * reposted\" rather than as a fresh CTA. */\n reposted: z.boolean(),\n })\n .optional(),\n});\nexport type CommunityPostWire = z.infer<typeof communityPostWireSchema>;\n\n// ─── Create / update bodies ────────────────────────────────────────────────\n\n/**\n * What the client sends to `POST /api/v1/community/posts`. The author\n * is taken from the authenticated request; the area lineage is resolved\n * server-side from the user's `currentLocation` (the client cannot\n * spoof a different area).\n */\nexport const createPostBodySchema = z.object({\n text: z.string().min(1).max(POST_MAX_BODY_CHARS),\n images: z.array(postImageSchema).max(POST_MAX_IMAGES).optional(),\n videos: z.array(postVideoSchema).max(POST_MAX_VIDEOS).optional(),\n /** When set, the post is scoped to a topical community. The author\n * must be an active member; non-members get a 403. */\n communityId: z.string().optional(),\n});\nexport type CreatePostBody = z.infer<typeof createPostBodySchema>;\n\n/**\n * What the client sends to `PATCH /api/v1/community/posts/:id`. Only\n * the text body is editable — media additions / removals require a new\n * post (matches Twitter / FB convention).\n */\nexport const updatePostBodySchema = z.object({\n text: z.string().min(1).max(POST_MAX_BODY_CHARS),\n});\nexport type UpdatePostBody = z.infer<typeof updatePostBodySchema>;\n"]}
|
package/dist/repost.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export declare const createRepostResponseSchema: z.ZodObject<{
|
|
|
70
70
|
}>>;
|
|
71
71
|
custom: z.ZodNullable<z.ZodString>;
|
|
72
72
|
}, z.core.$strip>>>;
|
|
73
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
73
74
|
}, z.core.$strip>;
|
|
74
75
|
text: z.ZodString;
|
|
75
76
|
images: z.ZodArray<z.ZodObject<{
|
|
@@ -139,6 +140,7 @@ export declare const createRepostResponseSchema: z.ZodObject<{
|
|
|
139
140
|
}>>;
|
|
140
141
|
custom: z.ZodNullable<z.ZodString>;
|
|
141
142
|
}, z.core.$strip>>>;
|
|
143
|
+
identityVerified: z.ZodOptional<z.ZodBoolean>;
|
|
142
144
|
}, z.core.$strip>;
|
|
143
145
|
title: z.ZodString;
|
|
144
146
|
body: z.ZodOptional<z.ZodString>;
|
package/dist/repost.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repost.d.ts","sourceRoot":"","sources":["../src/repost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;iBASjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B
|
|
1
|
+
{"version":3,"file":"repost.d.ts","sourceRoot":"","sources":["../src/repost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;iBASjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAErC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jansathi-community-schema",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Shared Zod schemas + TypeScript types for the Jansathi hyperlocal community feature (feed, posts, engagement, social graph, groups, communities).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|