jansathi-community-schema 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/community.d.ts +254 -0
- package/dist/community.d.ts.map +1 -0
- package/dist/community.js +173 -0
- package/dist/community.js.map +1 -0
- package/dist/constants.d.ts +17 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +18 -0
- package/dist/constants.js.map +1 -1
- package/dist/enums.d.ts +22 -0
- package/dist/enums.d.ts.map +1 -1
- package/dist/enums.js +19 -0
- package/dist/enums.js.map +1 -1
- package/dist/feed.d.ts +10 -0
- package/dist/feed.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/post.d.ts +10 -0
- package/dist/post.d.ts.map +1 -1
- package/dist/post.js +22 -2
- package/dist/post.js.map +1 -1
- package/dist/repost.d.ts +5 -0
- package/dist/repost.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Topical Community wire shapes.
|
|
3
|
+
*
|
|
4
|
+
* A Community is a Reddit-subreddit / Facebook-group style surface: a
|
|
5
|
+
* named topic users can discover, join, and post into. Distinct from
|
|
6
|
+
* the user-created `Group` (chat-bound, small, private) — each
|
|
7
|
+
* Community auto-owns its own bound `Group` (so members get a
|
|
8
|
+
* Community chat room for free) but they're conceptually different
|
|
9
|
+
* objects with their own roster + permissions.
|
|
10
|
+
*
|
|
11
|
+
* Visibility model
|
|
12
|
+
* ----------------
|
|
13
|
+
* - `public` — anyone can join one-tap; posts are visible to all
|
|
14
|
+
* viewers in the community feed.
|
|
15
|
+
* - `private` — joining requires owner / admin approval; posts and
|
|
16
|
+
* member list are hidden from non-members. Discovery
|
|
17
|
+
* still lists the community card (name + description +
|
|
18
|
+
* member count + join button) so users can request to
|
|
19
|
+
* join.
|
|
20
|
+
*
|
|
21
|
+
* Posts inside a community do NOT participate in the geo cascade or
|
|
22
|
+
* the tier-promotion job — they live and die inside the community
|
|
23
|
+
* surface. Posts authored from the global composer continue to use
|
|
24
|
+
* geo + promotion as before.
|
|
25
|
+
*
|
|
26
|
+
* @module community-schema/community
|
|
27
|
+
*/
|
|
28
|
+
import { z } from 'zod';
|
|
29
|
+
export declare const COMMUNITY_TYPE_VALUES: readonly ["public", "private"];
|
|
30
|
+
export type CommunityType = (typeof COMMUNITY_TYPE_VALUES)[number];
|
|
31
|
+
export declare const communityTypeSchema: z.ZodEnum<{
|
|
32
|
+
public: "public";
|
|
33
|
+
private: "private";
|
|
34
|
+
}>;
|
|
35
|
+
/** Role hierarchy within a single community.
|
|
36
|
+
*
|
|
37
|
+
* owner — creator; cannot be demoted by anyone, can transfer
|
|
38
|
+
* ownership (deferred for v1) and delete the community.
|
|
39
|
+
* admin — granted by owner; can edit metadata, kick members,
|
|
40
|
+
* soft-delete posts authored in the community.
|
|
41
|
+
* member — joined; can post and comment, can leave at any time.
|
|
42
|
+
*/
|
|
43
|
+
export declare const COMMUNITY_ROLE_VALUES: readonly ["owner", "admin", "member"];
|
|
44
|
+
export type CommunityRole = (typeof COMMUNITY_ROLE_VALUES)[number];
|
|
45
|
+
export declare const communityRoleSchema: z.ZodEnum<{
|
|
46
|
+
owner: "owner";
|
|
47
|
+
admin: "admin";
|
|
48
|
+
member: "member";
|
|
49
|
+
}>;
|
|
50
|
+
/** Membership lifecycle.
|
|
51
|
+
*
|
|
52
|
+
* active — currently in the community.
|
|
53
|
+
* pending — for a `private` community: the join request is awaiting
|
|
54
|
+
* owner/admin approval. Pending rows aren't counted toward
|
|
55
|
+
* `memberCount` and the user can't post yet.
|
|
56
|
+
*/
|
|
57
|
+
export declare const COMMUNITY_MEMBERSHIP_STATUS_VALUES: readonly ["active", "pending"];
|
|
58
|
+
export type CommunityMembershipStatus = (typeof COMMUNITY_MEMBERSHIP_STATUS_VALUES)[number];
|
|
59
|
+
export declare const communityMembershipStatusSchema: z.ZodEnum<{
|
|
60
|
+
pending: "pending";
|
|
61
|
+
active: "active";
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* `GET /communities/:slug` / discovery card / search hit.
|
|
65
|
+
*
|
|
66
|
+
* `viewer` is included when the request is authenticated. It carries
|
|
67
|
+
* the viewer's role + membership status so the UI can render the
|
|
68
|
+
* right CTA (Join / Joined / Pending / Owner) without a follow-up
|
|
69
|
+
* round trip.
|
|
70
|
+
*/
|
|
71
|
+
export declare const communityWireSchema: z.ZodObject<{
|
|
72
|
+
_id: z.ZodString;
|
|
73
|
+
slug: z.ZodString;
|
|
74
|
+
name: z.ZodString;
|
|
75
|
+
description: z.ZodOptional<z.ZodString>;
|
|
76
|
+
type: z.ZodEnum<{
|
|
77
|
+
public: "public";
|
|
78
|
+
private: "private";
|
|
79
|
+
}>;
|
|
80
|
+
coverImageUrl: z.ZodOptional<z.ZodString>;
|
|
81
|
+
ownerUserId: z.ZodString;
|
|
82
|
+
memberCount: z.ZodNumber;
|
|
83
|
+
postCount: z.ZodNumber;
|
|
84
|
+
groupId: z.ZodString;
|
|
85
|
+
createdAt: z.ZodString;
|
|
86
|
+
viewer: z.ZodOptional<z.ZodObject<{
|
|
87
|
+
role: z.ZodNullable<z.ZodEnum<{
|
|
88
|
+
owner: "owner";
|
|
89
|
+
admin: "admin";
|
|
90
|
+
member: "member";
|
|
91
|
+
}>>;
|
|
92
|
+
status: z.ZodNullable<z.ZodEnum<{
|
|
93
|
+
pending: "pending";
|
|
94
|
+
active: "active";
|
|
95
|
+
}>>;
|
|
96
|
+
joinedAt: z.ZodNullable<z.ZodString>;
|
|
97
|
+
}, z.core.$strip>>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
export type CommunityWire = z.infer<typeof communityWireSchema>;
|
|
100
|
+
export declare const communityMemberWireSchema: z.ZodObject<{
|
|
101
|
+
userId: z.ZodString;
|
|
102
|
+
displayName: z.ZodString;
|
|
103
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
104
|
+
localName: z.ZodOptional<z.ZodString>;
|
|
105
|
+
role: z.ZodEnum<{
|
|
106
|
+
owner: "owner";
|
|
107
|
+
admin: "admin";
|
|
108
|
+
member: "member";
|
|
109
|
+
}>;
|
|
110
|
+
status: z.ZodEnum<{
|
|
111
|
+
pending: "pending";
|
|
112
|
+
active: "active";
|
|
113
|
+
}>;
|
|
114
|
+
joinedAt: z.ZodString;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
export type CommunityMemberWire = z.infer<typeof communityMemberWireSchema>;
|
|
117
|
+
/**
|
|
118
|
+
* `POST /communities` body. `slug` is optional — when omitted the
|
|
119
|
+
* backend auto-generates one from the name (lowercased, hyphenated,
|
|
120
|
+
* collision-suffixed). When provided it must match the slug pattern
|
|
121
|
+
* and be unique.
|
|
122
|
+
*/
|
|
123
|
+
export declare const createCommunityBodySchema: z.ZodObject<{
|
|
124
|
+
name: z.ZodString;
|
|
125
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
126
|
+
description: z.ZodOptional<z.ZodString>;
|
|
127
|
+
type: z.ZodEnum<{
|
|
128
|
+
public: "public";
|
|
129
|
+
private: "private";
|
|
130
|
+
}>;
|
|
131
|
+
coverImageUrl: z.ZodOptional<z.ZodString>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
export type CreateCommunityBody = z.infer<typeof createCommunityBodySchema>;
|
|
134
|
+
/**
|
|
135
|
+
* `PATCH /communities/:slug` body. All fields optional. Sending
|
|
136
|
+
* `null` for `description` or `coverImageUrl` clears that field.
|
|
137
|
+
* Type changes (`public ↔ private`) are NOT supported in v1 — the
|
|
138
|
+
* decision has implications for already-published posts and pending
|
|
139
|
+
* join requests that we don't want to silently handle. Recreate the
|
|
140
|
+
* community if you need to switch type.
|
|
141
|
+
*/
|
|
142
|
+
export declare const updateCommunityBodySchema: z.ZodObject<{
|
|
143
|
+
name: z.ZodOptional<z.ZodString>;
|
|
144
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
145
|
+
coverImageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
export type UpdateCommunityBody = z.infer<typeof updateCommunityBodySchema>;
|
|
148
|
+
/** Sort order on the discover page. `popular` ranks by active member
|
|
149
|
+
* count, `new` by createdAt desc. `top` is reserved for a future
|
|
150
|
+
* activity-weighted ranking and accepted as a no-op for now. */
|
|
151
|
+
export declare const COMMUNITY_DISCOVER_SORT_VALUES: readonly ["popular", "new", "top"];
|
|
152
|
+
export type CommunityDiscoverSort = (typeof COMMUNITY_DISCOVER_SORT_VALUES)[number];
|
|
153
|
+
export declare const communityDiscoverSortSchema: z.ZodEnum<{
|
|
154
|
+
new: "new";
|
|
155
|
+
top: "top";
|
|
156
|
+
popular: "popular";
|
|
157
|
+
}>;
|
|
158
|
+
export declare const communityListQuerySchema: z.ZodObject<{
|
|
159
|
+
sort: z.ZodOptional<z.ZodEnum<{
|
|
160
|
+
new: "new";
|
|
161
|
+
top: "top";
|
|
162
|
+
popular: "popular";
|
|
163
|
+
}>>;
|
|
164
|
+
q: z.ZodOptional<z.ZodString>;
|
|
165
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
166
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
export type CommunityListQuery = z.infer<typeof communityListQuerySchema>;
|
|
169
|
+
export declare const communityListResponseSchema: z.ZodObject<{
|
|
170
|
+
items: z.ZodArray<z.ZodObject<{
|
|
171
|
+
_id: z.ZodString;
|
|
172
|
+
slug: z.ZodString;
|
|
173
|
+
name: z.ZodString;
|
|
174
|
+
description: z.ZodOptional<z.ZodString>;
|
|
175
|
+
type: z.ZodEnum<{
|
|
176
|
+
public: "public";
|
|
177
|
+
private: "private";
|
|
178
|
+
}>;
|
|
179
|
+
coverImageUrl: z.ZodOptional<z.ZodString>;
|
|
180
|
+
ownerUserId: z.ZodString;
|
|
181
|
+
memberCount: z.ZodNumber;
|
|
182
|
+
postCount: z.ZodNumber;
|
|
183
|
+
groupId: z.ZodString;
|
|
184
|
+
createdAt: z.ZodString;
|
|
185
|
+
viewer: z.ZodOptional<z.ZodObject<{
|
|
186
|
+
role: z.ZodNullable<z.ZodEnum<{
|
|
187
|
+
owner: "owner";
|
|
188
|
+
admin: "admin";
|
|
189
|
+
member: "member";
|
|
190
|
+
}>>;
|
|
191
|
+
status: z.ZodNullable<z.ZodEnum<{
|
|
192
|
+
pending: "pending";
|
|
193
|
+
active: "active";
|
|
194
|
+
}>>;
|
|
195
|
+
joinedAt: z.ZodNullable<z.ZodString>;
|
|
196
|
+
}, z.core.$strip>>;
|
|
197
|
+
}, z.core.$strip>>;
|
|
198
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
199
|
+
}, z.core.$strip>;
|
|
200
|
+
export type CommunityListResponse = z.infer<typeof communityListResponseSchema>;
|
|
201
|
+
/**
|
|
202
|
+
* `POST /communities/:slug/join`. Response carries the new viewer
|
|
203
|
+
* state so the client can update the CTA without a follow-up GET.
|
|
204
|
+
*
|
|
205
|
+
* - public → returns `{ status: 'active', role: 'member' }`
|
|
206
|
+
* - private → returns `{ status: 'pending', role: null }`; the
|
|
207
|
+
* owner / admin approves via the moderation endpoint
|
|
208
|
+
* (`POST /communities/:slug/members/:userId/approve`).
|
|
209
|
+
*/
|
|
210
|
+
export declare const joinCommunityResponseSchema: z.ZodObject<{
|
|
211
|
+
status: z.ZodEnum<{
|
|
212
|
+
pending: "pending";
|
|
213
|
+
active: "active";
|
|
214
|
+
}>;
|
|
215
|
+
role: z.ZodNullable<z.ZodEnum<{
|
|
216
|
+
owner: "owner";
|
|
217
|
+
admin: "admin";
|
|
218
|
+
member: "member";
|
|
219
|
+
}>>;
|
|
220
|
+
joinedAt: z.ZodNullable<z.ZodString>;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
export type JoinCommunityResponse = z.infer<typeof joinCommunityResponseSchema>;
|
|
223
|
+
export declare const communityMembersListResponseSchema: z.ZodObject<{
|
|
224
|
+
items: z.ZodArray<z.ZodObject<{
|
|
225
|
+
userId: z.ZodString;
|
|
226
|
+
displayName: z.ZodString;
|
|
227
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
228
|
+
localName: z.ZodOptional<z.ZodString>;
|
|
229
|
+
role: z.ZodEnum<{
|
|
230
|
+
owner: "owner";
|
|
231
|
+
admin: "admin";
|
|
232
|
+
member: "member";
|
|
233
|
+
}>;
|
|
234
|
+
status: z.ZodEnum<{
|
|
235
|
+
pending: "pending";
|
|
236
|
+
active: "active";
|
|
237
|
+
}>;
|
|
238
|
+
joinedAt: z.ZodString;
|
|
239
|
+
}, z.core.$strip>>;
|
|
240
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
241
|
+
}, z.core.$strip>;
|
|
242
|
+
export type CommunityMembersListResponse = z.infer<typeof communityMembersListResponseSchema>;
|
|
243
|
+
/** Body for `POST /communities/:slug/members/:userId/role` — owner-
|
|
244
|
+
* only. Used to promote a member to admin or demote an admin back
|
|
245
|
+
* to plain member. Owner role can't be set via this endpoint;
|
|
246
|
+
* transferring ownership has its own dedicated route (deferred). */
|
|
247
|
+
export declare const updateMemberRoleBodySchema: z.ZodObject<{
|
|
248
|
+
role: z.ZodEnum<{
|
|
249
|
+
admin: "admin";
|
|
250
|
+
member: "member";
|
|
251
|
+
}>;
|
|
252
|
+
}, z.core.$strip>;
|
|
253
|
+
export type UpdateMemberRoleBody = z.infer<typeof updateMemberRoleBodySchema>;
|
|
254
|
+
//# sourceMappingURL=community.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"community.d.ts","sourceRoot":"","sources":["../src/community.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,qBAAqB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,CAAC,MAAM,CAAC,CAAC;AACpF,eAAO,MAAM,2BAA2B;;;;EAAyC,CAAC;AAElF,eAAO,MAAM,wBAAwB;;;;;;;;;iBAOnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAIhF;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;iBAItC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;iBAG7C,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAE9F;;;qEAGqE;AACrE,eAAO,MAAM,0BAA0B;;;;;iBAErC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Topical Community wire shapes.
|
|
3
|
+
*
|
|
4
|
+
* A Community is a Reddit-subreddit / Facebook-group style surface: a
|
|
5
|
+
* named topic users can discover, join, and post into. Distinct from
|
|
6
|
+
* the user-created `Group` (chat-bound, small, private) — each
|
|
7
|
+
* Community auto-owns its own bound `Group` (so members get a
|
|
8
|
+
* Community chat room for free) but they're conceptually different
|
|
9
|
+
* objects with their own roster + permissions.
|
|
10
|
+
*
|
|
11
|
+
* Visibility model
|
|
12
|
+
* ----------------
|
|
13
|
+
* - `public` — anyone can join one-tap; posts are visible to all
|
|
14
|
+
* viewers in the community feed.
|
|
15
|
+
* - `private` — joining requires owner / admin approval; posts and
|
|
16
|
+
* member list are hidden from non-members. Discovery
|
|
17
|
+
* still lists the community card (name + description +
|
|
18
|
+
* member count + join button) so users can request to
|
|
19
|
+
* join.
|
|
20
|
+
*
|
|
21
|
+
* Posts inside a community do NOT participate in the geo cascade or
|
|
22
|
+
* the tier-promotion job — they live and die inside the community
|
|
23
|
+
* surface. Posts authored from the global composer continue to use
|
|
24
|
+
* geo + promotion as before.
|
|
25
|
+
*
|
|
26
|
+
* @module community-schema/community
|
|
27
|
+
*/
|
|
28
|
+
import { z } from 'zod';
|
|
29
|
+
import { COMMUNITIES_PAGE_SIZE, COMMUNITY_DESCRIPTION_MAX_CHARS, COMMUNITY_NAME_MAX_CHARS, COMMUNITY_NAME_MIN_CHARS, COMMUNITY_SLUG_MAX_CHARS, COMMUNITY_SLUG_MIN_CHARS, COMMUNITY_SLUG_PATTERN, } from './constants.js';
|
|
30
|
+
// ─── Enums ──────────────────────────────────────────────────────────────────
|
|
31
|
+
export const COMMUNITY_TYPE_VALUES = ['public', 'private'];
|
|
32
|
+
export const communityTypeSchema = z.enum(COMMUNITY_TYPE_VALUES);
|
|
33
|
+
/** Role hierarchy within a single community.
|
|
34
|
+
*
|
|
35
|
+
* owner — creator; cannot be demoted by anyone, can transfer
|
|
36
|
+
* ownership (deferred for v1) and delete the community.
|
|
37
|
+
* admin — granted by owner; can edit metadata, kick members,
|
|
38
|
+
* soft-delete posts authored in the community.
|
|
39
|
+
* member — joined; can post and comment, can leave at any time.
|
|
40
|
+
*/
|
|
41
|
+
export const COMMUNITY_ROLE_VALUES = ['owner', 'admin', 'member'];
|
|
42
|
+
export const communityRoleSchema = z.enum(COMMUNITY_ROLE_VALUES);
|
|
43
|
+
/** Membership lifecycle.
|
|
44
|
+
*
|
|
45
|
+
* active — currently in the community.
|
|
46
|
+
* pending — for a `private` community: the join request is awaiting
|
|
47
|
+
* owner/admin approval. Pending rows aren't counted toward
|
|
48
|
+
* `memberCount` and the user can't post yet.
|
|
49
|
+
*/
|
|
50
|
+
export const COMMUNITY_MEMBERSHIP_STATUS_VALUES = ['active', 'pending'];
|
|
51
|
+
export const communityMembershipStatusSchema = z.enum(COMMUNITY_MEMBERSHIP_STATUS_VALUES);
|
|
52
|
+
// ─── Wire shape ─────────────────────────────────────────────────────────────
|
|
53
|
+
/**
|
|
54
|
+
* `GET /communities/:slug` / discovery card / search hit.
|
|
55
|
+
*
|
|
56
|
+
* `viewer` is included when the request is authenticated. It carries
|
|
57
|
+
* the viewer's role + membership status so the UI can render the
|
|
58
|
+
* right CTA (Join / Joined / Pending / Owner) without a follow-up
|
|
59
|
+
* round trip.
|
|
60
|
+
*/
|
|
61
|
+
export const communityWireSchema = z.object({
|
|
62
|
+
_id: z.string(),
|
|
63
|
+
slug: z.string(),
|
|
64
|
+
name: z.string().min(COMMUNITY_NAME_MIN_CHARS).max(COMMUNITY_NAME_MAX_CHARS),
|
|
65
|
+
description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).optional(),
|
|
66
|
+
type: communityTypeSchema,
|
|
67
|
+
coverImageUrl: z.string().url().optional(),
|
|
68
|
+
ownerUserId: z.string(),
|
|
69
|
+
/** Active members only. Pending join-requests don't count. */
|
|
70
|
+
memberCount: z.number().int().nonnegative(),
|
|
71
|
+
/** Denormalised post count. Increments on create, decrements on
|
|
72
|
+
* soft-delete. */
|
|
73
|
+
postCount: z.number().int().nonnegative(),
|
|
74
|
+
/** Bound chat-group id. Auto-created when the Community is created;
|
|
75
|
+
* members are added to both rosters in lockstep. */
|
|
76
|
+
groupId: z.string(),
|
|
77
|
+
createdAt: z.string().datetime(),
|
|
78
|
+
viewer: z
|
|
79
|
+
.object({
|
|
80
|
+
role: communityRoleSchema.nullable(),
|
|
81
|
+
status: communityMembershipStatusSchema.nullable(),
|
|
82
|
+
joinedAt: z.string().datetime().nullable(),
|
|
83
|
+
})
|
|
84
|
+
.optional(),
|
|
85
|
+
});
|
|
86
|
+
// ─── Member roster row ──────────────────────────────────────────────────────
|
|
87
|
+
export const communityMemberWireSchema = z.object({
|
|
88
|
+
userId: z.string(),
|
|
89
|
+
displayName: z.string(),
|
|
90
|
+
avatarUrl: z.string().url().optional(),
|
|
91
|
+
localName: z.string().optional(),
|
|
92
|
+
role: communityRoleSchema,
|
|
93
|
+
status: communityMembershipStatusSchema,
|
|
94
|
+
joinedAt: z.string().datetime(),
|
|
95
|
+
});
|
|
96
|
+
// ─── Create body ────────────────────────────────────────────────────────────
|
|
97
|
+
/**
|
|
98
|
+
* `POST /communities` body. `slug` is optional — when omitted the
|
|
99
|
+
* backend auto-generates one from the name (lowercased, hyphenated,
|
|
100
|
+
* collision-suffixed). When provided it must match the slug pattern
|
|
101
|
+
* and be unique.
|
|
102
|
+
*/
|
|
103
|
+
export const createCommunityBodySchema = z.object({
|
|
104
|
+
name: z.string().min(COMMUNITY_NAME_MIN_CHARS).max(COMMUNITY_NAME_MAX_CHARS),
|
|
105
|
+
slug: z
|
|
106
|
+
.string()
|
|
107
|
+
.min(COMMUNITY_SLUG_MIN_CHARS)
|
|
108
|
+
.max(COMMUNITY_SLUG_MAX_CHARS)
|
|
109
|
+
.regex(COMMUNITY_SLUG_PATTERN)
|
|
110
|
+
.optional(),
|
|
111
|
+
description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).optional(),
|
|
112
|
+
type: communityTypeSchema,
|
|
113
|
+
coverImageUrl: z.string().url().optional(),
|
|
114
|
+
});
|
|
115
|
+
// ─── Update body (owner / admin only) ───────────────────────────────────────
|
|
116
|
+
/**
|
|
117
|
+
* `PATCH /communities/:slug` body. All fields optional. Sending
|
|
118
|
+
* `null` for `description` or `coverImageUrl` clears that field.
|
|
119
|
+
* Type changes (`public ↔ private`) are NOT supported in v1 — the
|
|
120
|
+
* decision has implications for already-published posts and pending
|
|
121
|
+
* join requests that we don't want to silently handle. Recreate the
|
|
122
|
+
* community if you need to switch type.
|
|
123
|
+
*/
|
|
124
|
+
export const updateCommunityBodySchema = z.object({
|
|
125
|
+
name: z.string().min(COMMUNITY_NAME_MIN_CHARS).max(COMMUNITY_NAME_MAX_CHARS).optional(),
|
|
126
|
+
description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).nullable().optional(),
|
|
127
|
+
coverImageUrl: z.string().url().nullable().optional(),
|
|
128
|
+
});
|
|
129
|
+
// ─── List + discover + search responses ─────────────────────────────────────
|
|
130
|
+
/** Sort order on the discover page. `popular` ranks by active member
|
|
131
|
+
* count, `new` by createdAt desc. `top` is reserved for a future
|
|
132
|
+
* activity-weighted ranking and accepted as a no-op for now. */
|
|
133
|
+
export const COMMUNITY_DISCOVER_SORT_VALUES = ['popular', 'new', 'top'];
|
|
134
|
+
export const communityDiscoverSortSchema = z.enum(COMMUNITY_DISCOVER_SORT_VALUES);
|
|
135
|
+
export const communityListQuerySchema = z.object({
|
|
136
|
+
sort: communityDiscoverSortSchema.optional(),
|
|
137
|
+
/** Free-text fragment matched case-insensitively against the
|
|
138
|
+
* community name. */
|
|
139
|
+
q: z.string().max(60).optional(),
|
|
140
|
+
cursor: z.string().optional(),
|
|
141
|
+
pageSize: z.number().int().min(1).max(COMMUNITIES_PAGE_SIZE).optional(),
|
|
142
|
+
});
|
|
143
|
+
export const communityListResponseSchema = z.object({
|
|
144
|
+
items: z.array(communityWireSchema),
|
|
145
|
+
nextCursor: z.string().nullable(),
|
|
146
|
+
});
|
|
147
|
+
// ─── Membership actions ────────────────────────────────────────────────────
|
|
148
|
+
/**
|
|
149
|
+
* `POST /communities/:slug/join`. Response carries the new viewer
|
|
150
|
+
* state so the client can update the CTA without a follow-up GET.
|
|
151
|
+
*
|
|
152
|
+
* - public → returns `{ status: 'active', role: 'member' }`
|
|
153
|
+
* - private → returns `{ status: 'pending', role: null }`; the
|
|
154
|
+
* owner / admin approves via the moderation endpoint
|
|
155
|
+
* (`POST /communities/:slug/members/:userId/approve`).
|
|
156
|
+
*/
|
|
157
|
+
export const joinCommunityResponseSchema = z.object({
|
|
158
|
+
status: communityMembershipStatusSchema,
|
|
159
|
+
role: communityRoleSchema.nullable(),
|
|
160
|
+
joinedAt: z.string().datetime().nullable(),
|
|
161
|
+
});
|
|
162
|
+
export const communityMembersListResponseSchema = z.object({
|
|
163
|
+
items: z.array(communityMemberWireSchema),
|
|
164
|
+
nextCursor: z.string().nullable(),
|
|
165
|
+
});
|
|
166
|
+
/** Body for `POST /communities/:slug/members/:userId/role` — owner-
|
|
167
|
+
* only. Used to promote a member to admin or demote an admin back
|
|
168
|
+
* to plain member. Owner role can't be set via this endpoint;
|
|
169
|
+
* transferring ownership has its own dedicated route (deferred). */
|
|
170
|
+
export const updateMemberRoleBodySchema = z.object({
|
|
171
|
+
role: z.enum(['admin', 'member']),
|
|
172
|
+
});
|
|
173
|
+
//# sourceMappingURL=community.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"community.js","sourceRoot":"","sources":["../src/community.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAExB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAU,CAAC;AAEpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAEjE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AAE3E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,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AAC,QAAQ,EAAE;IACpC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,yBAAyB,CAAC;IACzC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAGH;;;qEAGqE;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;CAClC,CAAC,CAAC","sourcesContent":["/**\n * Topical Community wire shapes.\n *\n * A Community is a Reddit-subreddit / Facebook-group style surface: a\n * named topic users can discover, join, and post into. Distinct from\n * the user-created `Group` (chat-bound, small, private) — each\n * Community auto-owns its own bound `Group` (so members get a\n * Community chat room for free) but they're conceptually different\n * objects with their own roster + permissions.\n *\n * Visibility model\n * ----------------\n * - `public` — anyone can join one-tap; posts are visible to all\n * viewers in the community feed.\n * - `private` — joining requires owner / admin approval; posts and\n * member list are hidden from non-members. Discovery\n * still lists the community card (name + description +\n * member count + join button) so users can request to\n * join.\n *\n * Posts inside a community do NOT participate in the geo cascade or\n * the tier-promotion job — they live and die inside the community\n * surface. Posts authored from the global composer continue to use\n * geo + promotion as before.\n *\n * @module community-schema/community\n */\n\nimport { z } from 'zod';\nimport {\n COMMUNITIES_PAGE_SIZE,\n COMMUNITY_DESCRIPTION_MAX_CHARS,\n COMMUNITY_NAME_MAX_CHARS,\n COMMUNITY_NAME_MIN_CHARS,\n COMMUNITY_SLUG_MAX_CHARS,\n COMMUNITY_SLUG_MIN_CHARS,\n COMMUNITY_SLUG_PATTERN,\n} from './constants.js';\n\n// ─── Enums ──────────────────────────────────────────────────────────────────\n\nexport const COMMUNITY_TYPE_VALUES = ['public', 'private'] as const;\nexport type CommunityType = (typeof COMMUNITY_TYPE_VALUES)[number];\nexport const communityTypeSchema = z.enum(COMMUNITY_TYPE_VALUES);\n\n/** Role hierarchy within a single community.\n *\n * owner — creator; cannot be demoted by anyone, can transfer\n * ownership (deferred for v1) and delete the community.\n * admin — granted by owner; can edit metadata, kick members,\n * soft-delete posts authored in the community.\n * member — joined; can post and comment, can leave at any time.\n */\nexport const COMMUNITY_ROLE_VALUES = ['owner', 'admin', 'member'] as const;\nexport type CommunityRole = (typeof COMMUNITY_ROLE_VALUES)[number];\nexport const communityRoleSchema = z.enum(COMMUNITY_ROLE_VALUES);\n\n/** Membership lifecycle.\n *\n * active — currently in the community.\n * pending — for a `private` community: the join request is awaiting\n * owner/admin approval. Pending rows aren't counted toward\n * `memberCount` and the user can't post yet.\n */\nexport const COMMUNITY_MEMBERSHIP_STATUS_VALUES = ['active', 'pending'] as const;\nexport type CommunityMembershipStatus = (typeof COMMUNITY_MEMBERSHIP_STATUS_VALUES)[number];\nexport const communityMembershipStatusSchema = z.enum(COMMUNITY_MEMBERSHIP_STATUS_VALUES);\n\n// ─── Wire shape ─────────────────────────────────────────────────────────────\n\n/**\n * `GET /communities/:slug` / discovery card / search hit.\n *\n * `viewer` is included when the request is authenticated. It carries\n * the viewer's role + membership status so the UI can render the\n * right CTA (Join / Joined / Pending / Owner) without a follow-up\n * round trip.\n */\nexport const communityWireSchema = z.object({\n _id: z.string(),\n slug: z.string(),\n name: z.string().min(COMMUNITY_NAME_MIN_CHARS).max(COMMUNITY_NAME_MAX_CHARS),\n description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).optional(),\n type: communityTypeSchema,\n coverImageUrl: z.string().url().optional(),\n ownerUserId: z.string(),\n /** Active members only. Pending join-requests don't count. */\n memberCount: z.number().int().nonnegative(),\n /** Denormalised post count. Increments on create, decrements on\n * soft-delete. */\n postCount: z.number().int().nonnegative(),\n /** Bound chat-group id. Auto-created when the Community is created;\n * members are added to both rosters in lockstep. */\n groupId: z.string(),\n createdAt: z.string().datetime(),\n\n viewer: z\n .object({\n role: communityRoleSchema.nullable(),\n status: communityMembershipStatusSchema.nullable(),\n joinedAt: z.string().datetime().nullable(),\n })\n .optional(),\n});\nexport type CommunityWire = z.infer<typeof communityWireSchema>;\n\n// ─── Member roster row ──────────────────────────────────────────────────────\n\nexport const communityMemberWireSchema = z.object({\n userId: z.string(),\n displayName: z.string(),\n avatarUrl: z.string().url().optional(),\n localName: z.string().optional(),\n role: communityRoleSchema,\n status: communityMembershipStatusSchema,\n joinedAt: z.string().datetime(),\n});\nexport type CommunityMemberWire = z.infer<typeof communityMemberWireSchema>;\n\n// ─── Create body ────────────────────────────────────────────────────────────\n\n/**\n * `POST /communities` body. `slug` is optional — when omitted the\n * backend auto-generates one from the name (lowercased, hyphenated,\n * collision-suffixed). When provided it must match the slug pattern\n * and be unique.\n */\nexport const createCommunityBodySchema = z.object({\n name: z.string().min(COMMUNITY_NAME_MIN_CHARS).max(COMMUNITY_NAME_MAX_CHARS),\n slug: z\n .string()\n .min(COMMUNITY_SLUG_MIN_CHARS)\n .max(COMMUNITY_SLUG_MAX_CHARS)\n .regex(COMMUNITY_SLUG_PATTERN)\n .optional(),\n description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).optional(),\n type: communityTypeSchema,\n coverImageUrl: z.string().url().optional(),\n});\nexport type CreateCommunityBody = z.infer<typeof createCommunityBodySchema>;\n\n// ─── Update body (owner / admin only) ───────────────────────────────────────\n\n/**\n * `PATCH /communities/:slug` body. All fields optional. Sending\n * `null` for `description` or `coverImageUrl` clears that field.\n * Type changes (`public ↔ private`) are NOT supported in v1 — the\n * decision has implications for already-published posts and pending\n * join requests that we don't want to silently handle. Recreate the\n * community if you need to switch type.\n */\nexport const updateCommunityBodySchema = z.object({\n name: z.string().min(COMMUNITY_NAME_MIN_CHARS).max(COMMUNITY_NAME_MAX_CHARS).optional(),\n description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).nullable().optional(),\n coverImageUrl: z.string().url().nullable().optional(),\n});\nexport type UpdateCommunityBody = z.infer<typeof updateCommunityBodySchema>;\n\n// ─── List + discover + search responses ─────────────────────────────────────\n\n/** Sort order on the discover page. `popular` ranks by active member\n * count, `new` by createdAt desc. `top` is reserved for a future\n * activity-weighted ranking and accepted as a no-op for now. */\nexport const COMMUNITY_DISCOVER_SORT_VALUES = ['popular', 'new', 'top'] as const;\nexport type CommunityDiscoverSort = (typeof COMMUNITY_DISCOVER_SORT_VALUES)[number];\nexport const communityDiscoverSortSchema = z.enum(COMMUNITY_DISCOVER_SORT_VALUES);\n\nexport const communityListQuerySchema = z.object({\n sort: communityDiscoverSortSchema.optional(),\n /** Free-text fragment matched case-insensitively against the\n * community name. */\n q: z.string().max(60).optional(),\n cursor: z.string().optional(),\n pageSize: z.number().int().min(1).max(COMMUNITIES_PAGE_SIZE).optional(),\n});\nexport type CommunityListQuery = z.infer<typeof communityListQuerySchema>;\n\nexport const communityListResponseSchema = z.object({\n items: z.array(communityWireSchema),\n nextCursor: z.string().nullable(),\n});\nexport type CommunityListResponse = z.infer<typeof communityListResponseSchema>;\n\n// ─── Membership actions ────────────────────────────────────────────────────\n\n/**\n * `POST /communities/:slug/join`. Response carries the new viewer\n * state so the client can update the CTA without a follow-up GET.\n *\n * - public → returns `{ status: 'active', role: 'member' }`\n * - private → returns `{ status: 'pending', role: null }`; the\n * owner / admin approves via the moderation endpoint\n * (`POST /communities/:slug/members/:userId/approve`).\n */\nexport const joinCommunityResponseSchema = z.object({\n status: communityMembershipStatusSchema,\n role: communityRoleSchema.nullable(),\n joinedAt: z.string().datetime().nullable(),\n});\nexport type JoinCommunityResponse = z.infer<typeof joinCommunityResponseSchema>;\n\nexport const communityMembersListResponseSchema = z.object({\n items: z.array(communityMemberWireSchema),\n nextCursor: z.string().nullable(),\n});\nexport type CommunityMembersListResponse = z.infer<typeof communityMembersListResponseSchema>;\n\n/** Body for `POST /communities/:slug/members/:userId/role` — owner-\n * only. Used to promote a member to admin or demote an admin back\n * to plain member. Owner role can't be set via this endpoint;\n * transferring ownership has its own dedicated route (deferred). */\nexport const updateMemberRoleBodySchema = z.object({\n role: z.enum(['admin', 'member']),\n});\nexport type UpdateMemberRoleBody = z.infer<typeof updateMemberRoleBodySchema>;\n"]}
|
package/dist/constants.d.ts
CHANGED
|
@@ -39,4 +39,21 @@ export declare const GROUP_MAX_MEMBERS = 256;
|
|
|
39
39
|
/** Group name length. */
|
|
40
40
|
export declare const GROUP_NAME_MAX_CHARS = 60;
|
|
41
41
|
export declare const GROUP_NAME_MIN_CHARS = 2;
|
|
42
|
+
/** Community name length. Same range as a group, with room for a real
|
|
43
|
+
* topic title. */
|
|
44
|
+
export declare const COMMUNITY_NAME_MAX_CHARS = 60;
|
|
45
|
+
export declare const COMMUNITY_NAME_MIN_CHARS = 2;
|
|
46
|
+
/** Slug is auto-generated from name on create (lowercase, hyphenated)
|
|
47
|
+
* but the user may also pick one explicitly on the create form. Match
|
|
48
|
+
* Reddit's vibes: 3-21 chars, lower alphanumeric + underscore + hyphen. */
|
|
49
|
+
export declare const COMMUNITY_SLUG_MAX_CHARS = 21;
|
|
50
|
+
export declare const COMMUNITY_SLUG_MIN_CHARS = 3;
|
|
51
|
+
/** Slug character class — kept in lockstep with the regex enforced by
|
|
52
|
+
* the create-body Zod schema and the backend's slug normaliser. */
|
|
53
|
+
export declare const COMMUNITY_SLUG_PATTERN: RegExp;
|
|
54
|
+
/** Description shown on the community card + header. */
|
|
55
|
+
export declare const COMMUNITY_DESCRIPTION_MAX_CHARS = 500;
|
|
56
|
+
/** Communities discover + members + posts page sizes. */
|
|
57
|
+
export declare const COMMUNITIES_PAGE_SIZE = 20;
|
|
58
|
+
export declare const COMMUNITY_MEMBERS_PAGE_SIZE = 50;
|
|
42
59
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,mCAAmC;AACnC,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,qCAAqC;AACrC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,0CAA0C;AAC1C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAIvC,2BAA2B;AAC3B,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,2BAA2B;AAC3B,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,QAAU,CAAC;AAE9C,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,QAAmB,CAAC;AAErD,mCAAmC;AACnC,eAAO,MAAM,oBAAoB,QAAoB,CAAC;AAItD;kCACkC;AAClC,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,0CAA0C;AAC1C,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,yCAAyC;AACzC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAIzC,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,QAAgB,CAAC;AAIlD,uDAAuD;AACvD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,yBAAyB;AACzB,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,oBAAoB,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,mCAAmC;AACnC,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,qCAAqC;AACrC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,0CAA0C;AAC1C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAIvC,2BAA2B;AAC3B,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,2BAA2B;AAC3B,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,QAAU,CAAC;AAE9C,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,QAAmB,CAAC;AAErD,mCAAmC;AACnC,eAAO,MAAM,oBAAoB,QAAoB,CAAC;AAItD;kCACkC;AAClC,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,0CAA0C;AAC1C,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,yCAAyC;AACzC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAIzC,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,QAAgB,CAAC;AAIlD,uDAAuD;AACvD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,yBAAyB;AACzB,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAItC;mBACmB;AACnB,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C;;4EAE4E;AAC5E,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAC1C;oEACoE;AACpE,eAAO,MAAM,sBAAsB,QAAkB,CAAC;AAEtD,wDAAwD;AACxD,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD,yDAAyD;AACzD,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,eAAO,MAAM,2BAA2B,KAAK,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -44,4 +44,22 @@ export const GROUP_MAX_MEMBERS = 256;
|
|
|
44
44
|
/** Group name length. */
|
|
45
45
|
export const GROUP_NAME_MAX_CHARS = 60;
|
|
46
46
|
export const GROUP_NAME_MIN_CHARS = 2;
|
|
47
|
+
// ─── Communities ───────────────────────────────────────────────────────────
|
|
48
|
+
/** Community name length. Same range as a group, with room for a real
|
|
49
|
+
* topic title. */
|
|
50
|
+
export const COMMUNITY_NAME_MAX_CHARS = 60;
|
|
51
|
+
export const COMMUNITY_NAME_MIN_CHARS = 2;
|
|
52
|
+
/** Slug is auto-generated from name on create (lowercase, hyphenated)
|
|
53
|
+
* but the user may also pick one explicitly on the create form. Match
|
|
54
|
+
* Reddit's vibes: 3-21 chars, lower alphanumeric + underscore + hyphen. */
|
|
55
|
+
export const COMMUNITY_SLUG_MAX_CHARS = 21;
|
|
56
|
+
export const COMMUNITY_SLUG_MIN_CHARS = 3;
|
|
57
|
+
/** Slug character class — kept in lockstep with the regex enforced by
|
|
58
|
+
* the create-body Zod schema and the backend's slug normaliser. */
|
|
59
|
+
export const COMMUNITY_SLUG_PATTERN = /^[a-z0-9_-]+$/;
|
|
60
|
+
/** Description shown on the community card + header. */
|
|
61
|
+
export const COMMUNITY_DESCRIPTION_MAX_CHARS = 500;
|
|
62
|
+
/** Communities discover + members + posts page sizes. */
|
|
63
|
+
export const COMMUNITIES_PAGE_SIZE = 20;
|
|
64
|
+
export const COMMUNITY_MEMBERS_PAGE_SIZE = 50;
|
|
47
65
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+EAA+E;AAE/E,mCAAmC;AACnC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC,qCAAqC;AACrC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,yEAAyE;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC,8EAA8E;AAE9E,2BAA2B;AAC3B,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,2BAA2B;AAC3B,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AAEjC,0DAA0D;AAC1D,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,GAAG,EAAE,CAAC;AAE9C,sEAAsE;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAErD,mCAAmC;AACnC,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD,+EAA+E;AAE/E;kCACkC;AAClC,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C,yCAAyC;AACzC,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC,+EAA+E;AAE/E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAElD,+EAA+E;AAE/E,uDAAuD;AACvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC,yBAAyB;AACzB,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC","sourcesContent":["/**\n * Tunable constants shared across the community feature.\n *\n * Live here (not inline in feature code) so backend and every frontend\n * agree byte-for-byte on the same limits, paginations, and timeouts.\n * Bump versions of this package when these change.\n *\n * @module community-schema/constants\n */\n\n// ─── Pagination ─────────────────────────────────────────────────────────────\n\n/** Feed list default page size. */\nexport const FEED_PAGE_SIZE = 20;\n\n/** People list default page size. */\nexport const PEOPLE_PAGE_SIZE = 30;\n\n/** Comments per page on a single post. */\nexport const COMMENTS_PAGE_SIZE = 20;\n\n/** Replies per top-level comment loaded with the first comments page. */\nexport const REPLIES_PRELOAD_COUNT = 3;\n\n// ─── Post media limits ─────────────────────────────────────────────────────\n\n/** Max images per post. */\nexport const POST_MAX_IMAGES = 10;\n\n/** Max videos per post. */\nexport const POST_MAX_VIDEOS = 5;\n\n/** Max duration of a single video in seconds (10 min). */\nexport const POST_MAX_VIDEO_SECONDS = 10 * 60;\n\n/** Per-image hard cap (15 MB). The file service compresses to fit. */\nexport const POST_MAX_IMAGE_BYTES = 15 * 1024 * 1024;\n\n/** Per-video hard cap (200 MB). */\nexport const POST_MAX_VIDEO_BYTES = 200 * 1024 * 1024;\n\n// ─── Text limits ────────────────────────────────────────────────────────────\n\n/** Post body character cap. Long enough for long-form, short enough to\n * keep feed rendering snappy. */\nexport const POST_MAX_BODY_CHARS = 5000;\n\n/** Comment + reply body character cap. */\nexport const COMMENT_MAX_BODY_CHARS = 2000;\n\n/** Free-text bio on a public profile. */\nexport const PROFILE_MAX_BIO_CHARS = 280;\n\n// ─── Engagement ─────────────────────────────────────────────────────────────\n\n/** Window during which an author can edit their own post / comment, in ms. */\nexport const EDIT_GRACE_WINDOW_MS = 5 * 60 * 1000;\n\n// ─── Groups ─────────────────────────────────────────────────────────────────\n\n/** Max members in a single user-created group chat. */\nexport const GROUP_MAX_MEMBERS = 256;\n\n/** Group name length. */\nexport const GROUP_NAME_MAX_CHARS = 60;\nexport const GROUP_NAME_MIN_CHARS = 2;\n"]}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+EAA+E;AAE/E,mCAAmC;AACnC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC,qCAAqC;AACrC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,yEAAyE;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC,8EAA8E;AAE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;AACxD,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAEnD,yDAAyD;AACzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACxC,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC","sourcesContent":["/**\n * Tunable constants shared across the community feature.\n *\n * Live here (not inline in feature code) so backend and every frontend\n * agree byte-for-byte on the same limits, paginations, and timeouts.\n * Bump versions of this package when these change.\n *\n * @module community-schema/constants\n */\n\n// ─── Pagination ─────────────────────────────────────────────────────────────\n\n/** Feed list default page size. */\nexport const FEED_PAGE_SIZE = 20;\n\n/** People list default page size. */\nexport const PEOPLE_PAGE_SIZE = 30;\n\n/** Comments per page on a single post. */\nexport const COMMENTS_PAGE_SIZE = 20;\n\n/** Replies per top-level comment loaded with the first comments page. */\nexport const REPLIES_PRELOAD_COUNT = 3;\n\n// ─── Post media limits ─────────────────────────────────────────────────────\n\n/** Max images per post. */\nexport const POST_MAX_IMAGES = 10;\n\n/** Max videos per post. */\nexport const POST_MAX_VIDEOS = 5;\n\n/** Max duration of a single video in seconds (10 min). */\nexport const POST_MAX_VIDEO_SECONDS = 10 * 60;\n\n/** Per-image hard cap (15 MB). The file service compresses to fit. */\nexport const POST_MAX_IMAGE_BYTES = 15 * 1024 * 1024;\n\n/** Per-video hard cap (200 MB). */\nexport const POST_MAX_VIDEO_BYTES = 200 * 1024 * 1024;\n\n// ─── Text limits ────────────────────────────────────────────────────────────\n\n/** Post body character cap. Long enough for long-form, short enough to\n * keep feed rendering snappy. */\nexport const POST_MAX_BODY_CHARS = 5000;\n\n/** Comment + reply body character cap. */\nexport const COMMENT_MAX_BODY_CHARS = 2000;\n\n/** Free-text bio on a public profile. */\nexport const PROFILE_MAX_BIO_CHARS = 280;\n\n// ─── Engagement ─────────────────────────────────────────────────────────────\n\n/** Window during which an author can edit their own post / comment, in ms. */\nexport const EDIT_GRACE_WINDOW_MS = 5 * 60 * 1000;\n\n// ─── Groups ─────────────────────────────────────────────────────────────────\n\n/** Max members in a single user-created group chat. */\nexport const GROUP_MAX_MEMBERS = 256;\n\n/** Group name length. */\nexport const GROUP_NAME_MAX_CHARS = 60;\nexport const GROUP_NAME_MIN_CHARS = 2;\n\n// ─── Communities ───────────────────────────────────────────────────────────\n\n/** Community name length. Same range as a group, with room for a real\n * topic title. */\nexport const COMMUNITY_NAME_MAX_CHARS = 60;\nexport const COMMUNITY_NAME_MIN_CHARS = 2;\n\n/** Slug is auto-generated from name on create (lowercase, hyphenated)\n * but the user may also pick one explicitly on the create form. Match\n * Reddit's vibes: 3-21 chars, lower alphanumeric + underscore + hyphen. */\nexport const COMMUNITY_SLUG_MAX_CHARS = 21;\nexport const COMMUNITY_SLUG_MIN_CHARS = 3;\n/** Slug character class — kept in lockstep with the regex enforced by\n * the create-body Zod schema and the backend's slug normaliser. */\nexport const COMMUNITY_SLUG_PATTERN = /^[a-z0-9_-]+$/;\n\n/** Description shown on the community card + header. */\nexport const COMMUNITY_DESCRIPTION_MAX_CHARS = 500;\n\n/** Communities discover + members + posts page sizes. */\nexport const COMMUNITIES_PAGE_SIZE = 20;\nexport const COMMUNITY_MEMBERS_PAGE_SIZE = 50;\n"]}
|
package/dist/enums.d.ts
CHANGED
|
@@ -104,6 +104,28 @@ export declare const profilePrivacySchema: z.ZodEnum<{
|
|
|
104
104
|
private: "private";
|
|
105
105
|
}>;
|
|
106
106
|
export type ProfilePrivacy = z.infer<typeof profilePrivacySchema>;
|
|
107
|
+
/**
|
|
108
|
+
* Per-post audience override chosen by the author at compose time.
|
|
109
|
+
*
|
|
110
|
+
* `public` — anyone in the matching geo scope (default behaviour, what
|
|
111
|
+
* posts have always been before this field was added).
|
|
112
|
+
* `connections` — only the author's accepted Connections see this post,
|
|
113
|
+
* regardless of the geographic visibility level. The geo
|
|
114
|
+
* cascade still applies on top: a connections-only post at
|
|
115
|
+
* state level is visible only to Connections who are in
|
|
116
|
+
* the same state.
|
|
117
|
+
*
|
|
118
|
+
* Orthogonal to `ProfilePrivacy`: a public-profile user can mark
|
|
119
|
+
* individual posts as `connections`-only; a private-profile user's
|
|
120
|
+
* posts default to connections-only at the profile gate regardless of
|
|
121
|
+
* this value. Effective visibility = most restrictive of the two.
|
|
122
|
+
*/
|
|
123
|
+
export declare const POST_AUDIENCE_VALUES: readonly ["public", "connections"];
|
|
124
|
+
export declare const postAudienceSchema: z.ZodEnum<{
|
|
125
|
+
public: "public";
|
|
126
|
+
connections: "connections";
|
|
127
|
+
}>;
|
|
128
|
+
export type PostAudience = z.infer<typeof postAudienceSchema>;
|
|
107
129
|
/**
|
|
108
130
|
* Reasons a piece of content can be reported. The list is deliberately
|
|
109
131
|
* short — finer categorization can come from the optional `details`
|
package/dist/enums.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,+DAM1B,CAAC;AACX,eAAO,MAAM,qBAAqB;;;;;;EAAkC,CAAC;AACrE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAMjE,CAAC;AAIF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,6DAA8D,CAAC;AAC/F,eAAO,MAAM,iBAAiB;;;;;EAA8B,CAAC;AAC7D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAI5D;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,qEAQvB,CAAC;AACX,eAAO,MAAM,kBAAkB;;;;;;;;EAA+B,CAAC;AAC/D,MAAM,MAAM,YAA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C/D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,6CAA6C;AAC7C,eAAO,MAAM,oBAAoB,4DAA6D,CAAC;AAC/F,eAAO,MAAM,kBAAkB;;;;;EAA+B,CAAC;AAC/D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,gCAAiC,CAAC;AAC/D,eAAO,MAAM,cAAc;;;;EAA2B,CAAC;AACvD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
package/dist/enums.js
CHANGED
|
@@ -97,6 +97,25 @@ export const connectionStatusSchema = z.enum(CONNECTION_STATUS_VALUES);
|
|
|
97
97
|
*/
|
|
98
98
|
export const PROFILE_PRIVACY_VALUES = ['public', 'private'];
|
|
99
99
|
export const profilePrivacySchema = z.enum(PROFILE_PRIVACY_VALUES);
|
|
100
|
+
// ─── Per-post audience ─────────────────────────────────────────────────────
|
|
101
|
+
/**
|
|
102
|
+
* Per-post audience override chosen by the author at compose time.
|
|
103
|
+
*
|
|
104
|
+
* `public` — anyone in the matching geo scope (default behaviour, what
|
|
105
|
+
* posts have always been before this field was added).
|
|
106
|
+
* `connections` — only the author's accepted Connections see this post,
|
|
107
|
+
* regardless of the geographic visibility level. The geo
|
|
108
|
+
* cascade still applies on top: a connections-only post at
|
|
109
|
+
* state level is visible only to Connections who are in
|
|
110
|
+
* the same state.
|
|
111
|
+
*
|
|
112
|
+
* Orthogonal to `ProfilePrivacy`: a public-profile user can mark
|
|
113
|
+
* individual posts as `connections`-only; a private-profile user's
|
|
114
|
+
* posts default to connections-only at the profile gate regardless of
|
|
115
|
+
* this value. Effective visibility = most restrictive of the two.
|
|
116
|
+
*/
|
|
117
|
+
export const POST_AUDIENCE_VALUES = ['public', 'connections'];
|
|
118
|
+
export const postAudienceSchema = z.enum(POST_AUDIENCE_VALUES);
|
|
100
119
|
// ─── Moderation ────────────────────────────────────────────────────────────
|
|
101
120
|
/**
|
|
102
121
|
* Reasons a piece of content can be reported. The list is deliberately
|
package/dist/enums.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAE/E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,OAAO;IACP,UAAU;IACV,OAAO;IACP,UAAU;IACV,QAAQ;CACA,CAAC;AACX,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AAGrE;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAoC;IACpE,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,+EAA+E;AAE/E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,CAAU,CAAC;AAC/F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;AAG7D,+EAA+E;AAE/E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,KAAK;IACL,OAAO;IACP,SAAS;CACD,CAAC;AACX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;AAG/D,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,CAAU,CAAC;AAChG,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;AAGvE,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAU,CAAC;AACrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAGnE,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,MAAM;IACN,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,gBAAgB;IAChB,UAAU;IACV,WAAW;IACX,iBAAiB;IACjB,OAAO;CACC,CAAC;AACX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;AAG/D,6CAA6C;AAC7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,CAAU,CAAC;AAC/F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;AAG/D,8EAA8E;AAE9E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAU,CAAC;AAC/D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["/**\n * Enum value arrays shared across the community feature.\n *\n * Each enum is exported as both a `*_VALUES` tuple and the corresponding\n * Zod schema so backend Mongoose models and frontend forms validate\n * against the exact same set.\n *\n * @module community-schema/enums\n */\n\nimport { z } from 'zod';\n\n// ─── Visibility scope ───────────────────────────────────────────────────────\n\n/**\n * The geographic level at which a piece of content is posted.\n *\n * Cascade-upward semantics: a viewer whose feed filter is set to L\n * sees every post at L and every BROADER level that matches their\n * area lineage. So:\n * - `local` → matches local + district + state + national + global within the viewer's locality / village / urbanBody / etc.\n * - `district` → matches district + state + national + global within the viewer's district\n * - `state` → matches state + national + global within the viewer's state\n * - `national` → matches national + global within the viewer's country\n * - `global` → matches global only\n *\n * The full meaning of \"local\" is \"anything below district\" — i.e., the\n * deepest area-lineage match (locality, village, urbanWard, …).\n */\nexport const VISIBILITY_LEVEL_VALUES = [\n 'local',\n 'district',\n 'state',\n 'national',\n 'global',\n] as const;\nexport const visibilityLevelSchema = z.enum(VISIBILITY_LEVEL_VALUES);\nexport type VisibilityLevel = z.infer<typeof visibilityLevelSchema>;\n\n/**\n * Numeric ranking used for the cascade-upward query and for sorting\n * filter chips. `local` is the deepest (most specific), `global` the\n * shallowest. Higher rank = broader scope.\n */\nexport const VISIBILITY_LEVEL_RANK: Record<VisibilityLevel, number> = {\n local: 0,\n district: 1,\n state: 2,\n national: 3,\n global: 4,\n};\n\n// ─── Polymorphic content kind ───────────────────────────────────────────────\n\n/**\n * The kinds of items that show up in the feed. `post` is the new\n * community-native kind; `lost_found`, `voice_box`, and `donate_item`\n * are existing legacy features surfaced into the feed via polymorphic\n * union.\n *\n * Engagement (upvote / reaction / comment / share) is keyed by\n * (contentKind, contentId) so every kind gets the same engagement bar.\n */\nexport const CONTENT_KIND_VALUES = ['post', 'lost_found', 'voice_box', 'donate_item'] as const;\nexport const contentKindSchema = z.enum(CONTENT_KIND_VALUES);\nexport type ContentKind = z.infer<typeof contentKindSchema>;\n\n// ─── Reactions ──────────────────────────────────────────────────────────────\n\n/**\n * Reaction types available on every feed item.\n *\n * `support` replaces Facebook's \"Care\" — better-suited to a civic /\n * hyperlocal context where reacting to a complaint or lost-and-found\n * post deserves a distinct \"I support you\" signal.\n */\nexport const REACTION_TYPE_VALUES = [\n 'like',\n 'love',\n 'haha',\n 'wow',\n 'sad',\n 'angry',\n 'support',\n] as const;\nexport const reactionTypeSchema = z.enum(REACTION_TYPE_VALUES);\nexport type ReactionType = z.infer<typeof reactionTypeSchema>;\n\n// ─── Social graph ──────────────────────────────────────────────────────────\n\n/**\n * Connection (mutual friend) lifecycle.\n *\n * `pending` — requester sent it, recipient hasn't acted yet.\n * `accepted` — both sides confirmed; full visibility regardless of level.\n * `declined` — recipient rejected; surfaces as \"you can't reconnect for X days\" on the requester side.\n * `blocked` — either side blocked; permanently prevents reconnection.\n */\nexport const CONNECTION_STATUS_VALUES = ['pending', 'accepted', 'declined', 'blocked'] as const;\nexport const connectionStatusSchema = z.enum(CONNECTION_STATUS_VALUES);\nexport type ConnectionStatus = z.infer<typeof connectionStatusSchema>;\n\n// ─── Profile privacy ───────────────────────────────────────────────────────\n\n/**\n * Profile-level privacy (single toggle in Settings).\n *\n * `public` — anyone in the matching geo scope sees this user's posts.\n * `private` — only accepted Connections see this user's posts. Visibility\n * level on each post still applies on top (a private post at\n * state level is visible only to Connections who are in the\n * same state).\n */\nexport const PROFILE_PRIVACY_VALUES = ['public', 'private'] as const;\nexport const profilePrivacySchema = z.enum(PROFILE_PRIVACY_VALUES);\nexport type ProfilePrivacy = z.infer<typeof profilePrivacySchema>;\n\n// ─── Moderation ────────────────────────────────────────────────────────────\n\n/**\n * Reasons a piece of content can be reported. The list is deliberately\n * short — finer categorization can come from the optional `details`\n * free-text field on a report.\n */\nexport const REPORT_REASON_VALUES = [\n 'spam',\n 'harassment',\n 'hate_speech',\n 'misinformation',\n 'sexual_content',\n 'violence',\n 'self_harm',\n 'illegal_content',\n 'other',\n] as const;\nexport const reportReasonSchema = z.enum(REPORT_REASON_VALUES);\nexport type ReportReason = z.infer<typeof reportReasonSchema>;\n\n/** Moderator decision states on a report. */\nexport const REPORT_STATUS_VALUES = ['pending', 'reviewing', 'actioned', 'dismissed'] as const;\nexport const reportStatusSchema = z.enum(REPORT_STATUS_VALUES);\nexport type ReportStatus = z.infer<typeof reportStatusSchema>;\n\n// ─── Feed sort ─────────────────────────────────────────────────────────────\n\n/**\n * Sort options exposed in the feed UI.\n *\n * `hot` — the default. Reddit-style score blending upvotes, comment count,\n * and recency. Best surface for civic / community engagement.\n * `new` — strict reverse-chronological. Useful when the viewer wants to\n * catch up on everything fresh.\n * `top` — highest upvote count over a configurable window (defaults to\n * 24 hours on the client).\n */\nexport const FEED_SORT_VALUES = ['hot', 'new', 'top'] as const;\nexport const feedSortSchema = z.enum(FEED_SORT_VALUES);\nexport type FeedSort = z.infer<typeof feedSortSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAE/E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,OAAO;IACP,UAAU;IACV,OAAO;IACP,UAAU;IACV,QAAQ;CACA,CAAC;AACX,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AAGrE;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAoC;IACpE,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,+EAA+E;AAE/E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,CAAU,CAAC;AAC/F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;AAG7D,+EAA+E;AAE/E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,MAAM;IACN,MAAM;I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;AAG/D,8EAA8E;AAE9E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAU,CAAC;AAC/D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["/**\n * Enum value arrays shared across the community feature.\n *\n * Each enum is exported as both a `*_VALUES` tuple and the corresponding\n * Zod schema so backend Mongoose models and frontend forms validate\n * against the exact same set.\n *\n * @module community-schema/enums\n */\n\nimport { z } from 'zod';\n\n// ─── Visibility scope ───────────────────────────────────────────────────────\n\n/**\n * The geographic level at which a piece of content is posted.\n *\n * Cascade-upward semantics: a viewer whose feed filter is set to L\n * sees every post at L and every BROADER level that matches their\n * area lineage. So:\n * - `local` → matches local + district + state + national + global within the viewer's locality / village / urbanBody / etc.\n * - `district` → matches district + state + national + global within the viewer's district\n * - `state` → matches state + national + global within the viewer's state\n * - `national` → matches national + global within the viewer's country\n * - `global` → matches global only\n *\n * The full meaning of \"local\" is \"anything below district\" — i.e., the\n * deepest area-lineage match (locality, village, urbanWard, …).\n */\nexport const VISIBILITY_LEVEL_VALUES = [\n 'local',\n 'district',\n 'state',\n 'national',\n 'global',\n] as const;\nexport const visibilityLevelSchema = z.enum(VISIBILITY_LEVEL_VALUES);\nexport type VisibilityLevel = z.infer<typeof visibilityLevelSchema>;\n\n/**\n * Numeric ranking used for the cascade-upward query and for sorting\n * filter chips. `local` is the deepest (most specific), `global` the\n * shallowest. Higher rank = broader scope.\n */\nexport const VISIBILITY_LEVEL_RANK: Record<VisibilityLevel, number> = {\n local: 0,\n district: 1,\n state: 2,\n national: 3,\n global: 4,\n};\n\n// ─── Polymorphic content kind ───────────────────────────────────────────────\n\n/**\n * The kinds of items that show up in the feed. `post` is the new\n * community-native kind; `lost_found`, `voice_box`, and `donate_item`\n * are existing legacy features surfaced into the feed via polymorphic\n * union.\n *\n * Engagement (upvote / reaction / comment / share) is keyed by\n * (contentKind, contentId) so every kind gets the same engagement bar.\n */\nexport const CONTENT_KIND_VALUES = ['post', 'lost_found', 'voice_box', 'donate_item'] as const;\nexport const contentKindSchema = z.enum(CONTENT_KIND_VALUES);\nexport type ContentKind = z.infer<typeof contentKindSchema>;\n\n// ─── Reactions ──────────────────────────────────────────────────────────────\n\n/**\n * Reaction types available on every feed item.\n *\n * `support` replaces Facebook's \"Care\" — better-suited to a civic /\n * hyperlocal context where reacting to a complaint or lost-and-found\n * post deserves a distinct \"I support you\" signal.\n */\nexport const REACTION_TYPE_VALUES = [\n 'like',\n 'love',\n 'haha',\n 'wow',\n 'sad',\n 'angry',\n 'support',\n] as const;\nexport const reactionTypeSchema = z.enum(REACTION_TYPE_VALUES);\nexport type ReactionType = z.infer<typeof reactionTypeSchema>;\n\n// ─── Social graph ──────────────────────────────────────────────────────────\n\n/**\n * Connection (mutual friend) lifecycle.\n *\n * `pending` — requester sent it, recipient hasn't acted yet.\n * `accepted` — both sides confirmed; full visibility regardless of level.\n * `declined` — recipient rejected; surfaces as \"you can't reconnect for X days\" on the requester side.\n * `blocked` — either side blocked; permanently prevents reconnection.\n */\nexport const CONNECTION_STATUS_VALUES = ['pending', 'accepted', 'declined', 'blocked'] as const;\nexport const connectionStatusSchema = z.enum(CONNECTION_STATUS_VALUES);\nexport type ConnectionStatus = z.infer<typeof connectionStatusSchema>;\n\n// ─── Profile privacy ───────────────────────────────────────────────────────\n\n/**\n * Profile-level privacy (single toggle in Settings).\n *\n * `public` — anyone in the matching geo scope sees this user's posts.\n * `private` — only accepted Connections see this user's posts. Visibility\n * level on each post still applies on top (a private post at\n * state level is visible only to Connections who are in the\n * same state).\n */\nexport const PROFILE_PRIVACY_VALUES = ['public', 'private'] as const;\nexport const profilePrivacySchema = z.enum(PROFILE_PRIVACY_VALUES);\nexport type ProfilePrivacy = z.infer<typeof profilePrivacySchema>;\n\n// ─── Per-post audience ─────────────────────────────────────────────────────\n\n/**\n * Per-post audience override chosen by the author at compose time.\n *\n * `public` — anyone in the matching geo scope (default behaviour, what\n * posts have always been before this field was added).\n * `connections` — only the author's accepted Connections see this post,\n * regardless of the geographic visibility level. The geo\n * cascade still applies on top: a connections-only post at\n * state level is visible only to Connections who are in\n * the same state.\n *\n * Orthogonal to `ProfilePrivacy`: a public-profile user can mark\n * individual posts as `connections`-only; a private-profile user's\n * posts default to connections-only at the profile gate regardless of\n * this value. Effective visibility = most restrictive of the two.\n */\nexport const POST_AUDIENCE_VALUES = ['public', 'connections'] as const;\nexport const postAudienceSchema = z.enum(POST_AUDIENCE_VALUES);\nexport type PostAudience = z.infer<typeof postAudienceSchema>;\n\n// ─── Moderation ────────────────────────────────────────────────────────────\n\n/**\n * Reasons a piece of content can be reported. The list is deliberately\n * short — finer categorization can come from the optional `details`\n * free-text field on a report.\n */\nexport const REPORT_REASON_VALUES = [\n 'spam',\n 'harassment',\n 'hate_speech',\n 'misinformation',\n 'sexual_content',\n 'violence',\n 'self_harm',\n 'illegal_content',\n 'other',\n] as const;\nexport const reportReasonSchema = z.enum(REPORT_REASON_VALUES);\nexport type ReportReason = z.infer<typeof reportReasonSchema>;\n\n/** Moderator decision states on a report. */\nexport const REPORT_STATUS_VALUES = ['pending', 'reviewing', 'actioned', 'dismissed'] as const;\nexport const reportStatusSchema = z.enum(REPORT_STATUS_VALUES);\nexport type ReportStatus = z.infer<typeof reportStatusSchema>;\n\n// ─── Feed sort ─────────────────────────────────────────────────────────────\n\n/**\n * Sort options exposed in the feed UI.\n *\n * `hot` — the default. Reddit-style score blending upvotes, comment count,\n * and recency. Best surface for civic / community engagement.\n * `new` — strict reverse-chronological. Useful when the viewer wants to\n * catch up on everything fresh.\n * `top` — highest upvote count over a configurable window (defaults to\n * 24 hours on the client).\n */\nexport const FEED_SORT_VALUES = ['hot', 'new', 'top'] as const;\nexport const feedSortSchema = z.enum(FEED_SORT_VALUES);\nexport type FeedSort = z.infer<typeof feedSortSchema>;\n"]}
|
package/dist/feed.d.ts
CHANGED
|
@@ -160,6 +160,11 @@ export declare const feedItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
160
160
|
localId: z.ZodOptional<z.ZodString>;
|
|
161
161
|
localName: z.ZodOptional<z.ZodString>;
|
|
162
162
|
}, z.core.$strip>;
|
|
163
|
+
audience: z.ZodEnum<{
|
|
164
|
+
public: "public";
|
|
165
|
+
connections: "connections";
|
|
166
|
+
}>;
|
|
167
|
+
communityId: z.ZodOptional<z.ZodString>;
|
|
163
168
|
upvoteCount: z.ZodNumber;
|
|
164
169
|
commentCount: z.ZodNumber;
|
|
165
170
|
repostCount: z.ZodNumber;
|
|
@@ -332,6 +337,11 @@ export declare const feedResponseSchema: z.ZodObject<{
|
|
|
332
337
|
localId: z.ZodOptional<z.ZodString>;
|
|
333
338
|
localName: z.ZodOptional<z.ZodString>;
|
|
334
339
|
}, z.core.$strip>;
|
|
340
|
+
audience: z.ZodEnum<{
|
|
341
|
+
public: "public";
|
|
342
|
+
connections: "connections";
|
|
343
|
+
}>;
|
|
344
|
+
communityId: z.ZodOptional<z.ZodString>;
|
|
335
345
|
upvoteCount: z.ZodNumber;
|
|
336
346
|
commentCount: z.ZodNumber;
|
|
337
347
|
repostCount: z.ZodNumber;
|
package/dist/feed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feed.d.ts","sourceRoot":"","sources":["../src/feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMhD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;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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/index.d.ts
CHANGED
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
*/
|
|
17
17
|
export { type AreaLineageSnapshot, areaLineageSnapshotSchema, } from './area.js';
|
|
18
18
|
export { type CommunityCommentWire, type CreateCommentBody, communityCommentWireSchema, createCommentBodySchema, type UpdateCommentBody, updateCommentBodySchema, } from './comment.js';
|
|
19
|
-
export {
|
|
19
|
+
export { COMMUNITY_DISCOVER_SORT_VALUES, COMMUNITY_MEMBERSHIP_STATUS_VALUES, COMMUNITY_ROLE_VALUES, COMMUNITY_TYPE_VALUES, type CommunityDiscoverSort, type CommunityListQuery, type CommunityListResponse, type CommunityMembershipStatus, type CommunityMembersListResponse, type CommunityMemberWire, type CommunityRole, type CommunityType, type CommunityWire, type CreateCommunityBody, communityDiscoverSortSchema, communityListQuerySchema, communityListResponseSchema, communityMembershipStatusSchema, communityMembersListResponseSchema, communityMemberWireSchema, communityRoleSchema, communityTypeSchema, communityWireSchema, createCommunityBodySchema, type JoinCommunityResponse, joinCommunityResponseSchema, type UpdateCommunityBody, type UpdateMemberRoleBody, updateCommunityBodySchema, updateMemberRoleBodySchema, } from './community.js';
|
|
20
|
+
export { COMMENT_MAX_BODY_CHARS, COMMENTS_PAGE_SIZE, COMMUNITIES_PAGE_SIZE, COMMUNITY_DESCRIPTION_MAX_CHARS, COMMUNITY_MEMBERS_PAGE_SIZE, COMMUNITY_NAME_MAX_CHARS, COMMUNITY_NAME_MIN_CHARS, COMMUNITY_SLUG_MAX_CHARS, COMMUNITY_SLUG_MIN_CHARS, COMMUNITY_SLUG_PATTERN, EDIT_GRACE_WINDOW_MS, FEED_PAGE_SIZE, GROUP_MAX_MEMBERS, GROUP_NAME_MAX_CHARS, GROUP_NAME_MIN_CHARS, PEOPLE_PAGE_SIZE, POST_MAX_BODY_CHARS, POST_MAX_IMAGE_BYTES, POST_MAX_IMAGES, POST_MAX_VIDEO_BYTES, POST_MAX_VIDEO_SECONDS, POST_MAX_VIDEOS, PROFILE_MAX_BIO_CHARS, REPLIES_PRELOAD_COUNT, } from './constants.js';
|
|
20
21
|
export { type SetReactionBody, type SetReactionResponse, setReactionBodySchema, setReactionResponseSchema, type ToggleUpvoteResponse, toggleUpvoteResponseSchema, } from './engagement.js';
|
|
21
|
-
export { CONNECTION_STATUS_VALUES, CONTENT_KIND_VALUES, type ConnectionStatus, type ContentKind, connectionStatusSchema, contentKindSchema, FEED_SORT_VALUES, type FeedSort, feedSortSchema, PROFILE_PRIVACY_VALUES, type ProfilePrivacy, profilePrivacySchema, REACTION_TYPE_VALUES, REPORT_REASON_VALUES, REPORT_STATUS_VALUES, type ReactionType, type ReportReason, type ReportStatus, reactionTypeSchema, reportReasonSchema, reportStatusSchema, VISIBILITY_LEVEL_RANK, VISIBILITY_LEVEL_VALUES, type VisibilityLevel, visibilityLevelSchema, } from './enums.js';
|
|
22
|
+
export { CONNECTION_STATUS_VALUES, CONTENT_KIND_VALUES, type ConnectionStatus, type ContentKind, connectionStatusSchema, contentKindSchema, FEED_SORT_VALUES, type FeedSort, feedSortSchema, POST_AUDIENCE_VALUES, type PostAudience, postAudienceSchema, PROFILE_PRIVACY_VALUES, type ProfilePrivacy, profilePrivacySchema, REACTION_TYPE_VALUES, REPORT_REASON_VALUES, REPORT_STATUS_VALUES, type ReactionType, type ReportReason, type ReportStatus, reactionTypeSchema, reportReasonSchema, reportStatusSchema, VISIBILITY_LEVEL_RANK, VISIBILITY_LEVEL_VALUES, type VisibilityLevel, visibilityLevelSchema, } from './enums.js';
|
|
22
23
|
export { type DonateItemFeedItem, donateItemFeedItemSchema, type FeedItem, type FeedQueryParams, type FeedResponse, feedItemSchema, feedQueryParamsSchema, feedResponseSchema, type LostFoundFeedItem, lostFoundFeedItemSchema, type VoiceBoxFeedItem, voiceBoxFeedItemSchema, } from './feed.js';
|
|
23
24
|
export { type AddGroupMembersBody, addGroupMembersBodySchema, type CommunityGroupWire, type CommunityGroupWithMembers, type CreateGroupBody, communityGroupWireSchema, communityGroupWithMembersSchema, createGroupBodySchema, type GroupMembersListResponse, type GroupMemberWire, type GroupRole, type GroupsListResponse, groupMembersListResponseSchema, groupMemberWireSchema, groupRoleSchema, groupsListResponseSchema, type UpdateGroupBody, updateGroupBodySchema, } from './group.js';
|
|
24
25
|
export { type PostImage, type PostVideo, postImageSchema, postVideoSchema, } from './media.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EACL,KAAK,mBAAmB,EACxB,yBAAyB,GAC1B,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,cAAc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}
|
package/dist/index.js
CHANGED
|
@@ -18,12 +18,14 @@
|
|
|
18
18
|
export { areaLineageSnapshotSchema, } from './area.js';
|
|
19
19
|
// ─── Comment ───────────────────────────────────────────────────────────────
|
|
20
20
|
export { communityCommentWireSchema, createCommentBodySchema, updateCommentBodySchema, } from './comment.js';
|
|
21
|
+
// ─── Communities ───────────────────────────────────────────────────────────
|
|
22
|
+
export { COMMUNITY_DISCOVER_SORT_VALUES, COMMUNITY_MEMBERSHIP_STATUS_VALUES, COMMUNITY_ROLE_VALUES, COMMUNITY_TYPE_VALUES, communityDiscoverSortSchema, communityListQuerySchema, communityListResponseSchema, communityMembershipStatusSchema, communityMembersListResponseSchema, communityMemberWireSchema, communityRoleSchema, communityTypeSchema, communityWireSchema, createCommunityBodySchema, joinCommunityResponseSchema, updateCommunityBodySchema, updateMemberRoleBodySchema, } from './community.js';
|
|
21
23
|
// ─── Constants ─────────────────────────────────────────────────────────────
|
|
22
|
-
export { COMMENT_MAX_BODY_CHARS, COMMENTS_PAGE_SIZE, EDIT_GRACE_WINDOW_MS, FEED_PAGE_SIZE, GROUP_MAX_MEMBERS, GROUP_NAME_MAX_CHARS, GROUP_NAME_MIN_CHARS, PEOPLE_PAGE_SIZE, POST_MAX_BODY_CHARS, POST_MAX_IMAGE_BYTES, POST_MAX_IMAGES, POST_MAX_VIDEO_BYTES, POST_MAX_VIDEO_SECONDS, POST_MAX_VIDEOS, PROFILE_MAX_BIO_CHARS, REPLIES_PRELOAD_COUNT, } from './constants.js';
|
|
24
|
+
export { COMMENT_MAX_BODY_CHARS, COMMENTS_PAGE_SIZE, COMMUNITIES_PAGE_SIZE, COMMUNITY_DESCRIPTION_MAX_CHARS, COMMUNITY_MEMBERS_PAGE_SIZE, COMMUNITY_NAME_MAX_CHARS, COMMUNITY_NAME_MIN_CHARS, COMMUNITY_SLUG_MAX_CHARS, COMMUNITY_SLUG_MIN_CHARS, COMMUNITY_SLUG_PATTERN, EDIT_GRACE_WINDOW_MS, FEED_PAGE_SIZE, GROUP_MAX_MEMBERS, GROUP_NAME_MAX_CHARS, GROUP_NAME_MIN_CHARS, PEOPLE_PAGE_SIZE, POST_MAX_BODY_CHARS, POST_MAX_IMAGE_BYTES, POST_MAX_IMAGES, POST_MAX_VIDEO_BYTES, POST_MAX_VIDEO_SECONDS, POST_MAX_VIDEOS, PROFILE_MAX_BIO_CHARS, REPLIES_PRELOAD_COUNT, } from './constants.js';
|
|
23
25
|
// ─── Engagement (upvote + reactions) ───────────────────────────────────────
|
|
24
26
|
export { setReactionBodySchema, setReactionResponseSchema, toggleUpvoteResponseSchema, } from './engagement.js';
|
|
25
27
|
// ─── Enums ─────────────────────────────────────────────────────────────────
|
|
26
|
-
export { CONNECTION_STATUS_VALUES, CONTENT_KIND_VALUES, connectionStatusSchema, contentKindSchema, FEED_SORT_VALUES, feedSortSchema, PROFILE_PRIVACY_VALUES, profilePrivacySchema, REACTION_TYPE_VALUES, REPORT_REASON_VALUES, REPORT_STATUS_VALUES, reactionTypeSchema, reportReasonSchema, reportStatusSchema, VISIBILITY_LEVEL_RANK, VISIBILITY_LEVEL_VALUES, visibilityLevelSchema, } from './enums.js';
|
|
28
|
+
export { CONNECTION_STATUS_VALUES, CONTENT_KIND_VALUES, connectionStatusSchema, contentKindSchema, FEED_SORT_VALUES, feedSortSchema, POST_AUDIENCE_VALUES, postAudienceSchema, PROFILE_PRIVACY_VALUES, profilePrivacySchema, REACTION_TYPE_VALUES, REPORT_REASON_VALUES, REPORT_STATUS_VALUES, reactionTypeSchema, reportReasonSchema, reportStatusSchema, VISIBILITY_LEVEL_RANK, VISIBILITY_LEVEL_VALUES, visibilityLevelSchema, } from './enums.js';
|
|
27
29
|
// ─── Feed (polymorphic union) ──────────────────────────────────────────────
|
|
28
30
|
export { donateItemFeedItemSchema, feedItemSchema, feedQueryParamsSchema, feedResponseSchema, lostFoundFeedItemSchema, voiceBoxFeedItemSchema, } from './feed.js';
|
|
29
31
|
// ─── Groups ────────────────────────────────────────────────────────────────
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,8EAA8E;AAC9E,OAAO,EAEL,yBAAyB,GAC1B,MAAM,WAAW,CAAC;AAEnB,8EAA8E;AAC9E,OAAO,EAGL,0BAA0B,EAC1B,uBAAuB,EAEvB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,8EAA8E;AAC9E,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAExB,8EAA8E;AAC9E,OAAO,EAGL,qBAAqB,EACrB,yBAAyB,EAEzB,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC;AAEzB,8EAA8E;AAC9E,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EAGnB,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAEhB,cAAc,EACd,sBAAsB,EAEtB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EAIpB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EAEvB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAEpB,8EAA8E;AAC9E,OAAO,EAEL,wBAAwB,EAIxB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAElB,uBAAuB,EAEvB,sBAAsB,GACvB,MAAM,WAAW,CAAC;AAEnB,8EAA8E;AAC9E,OAAO,EAEL,yBAAyB,EAIzB,wBAAwB,EACxB,+BAA+B,EAC/B,qBAAqB,EAKrB,8BAA8B,EAC9B,qBAAqB,EACrB,eAAe,EACf,wBAAwB,EAExB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAEpB,8EAA8E;AAC9E,OAAO,EAGL,eAAe,EACf,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,8EAA8E;AAC9E,OAAO,EAGL,uBAAuB,EACvB,oBAAoB,EAEpB,wBAAwB,EAExB,oBAAoB,EAEpB,oBAAoB,GACrB,MAAM,WAAW,CAAC;AACnB,8EAA8E;AAC9E,OAAO,EAKL,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AACtB,8EAA8E;AAC9E,OAAO,EAML,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,8EAA8E;AAC9E,OAAO,EAGL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAErB,8EAA8E;AAC9E,OAAO,EAGL,8BAA8B,EAC9B,qBAAqB,EACrB,2BAA2B,EAE3B,2BAA2B,EAE3B,iCAAiC,GAClC,MAAM,eAAe,CAAC;AAEvB,8EAA8E;AAC9E,OAAO,EAGL,4BAA4B,EAC5B,0BAA0B,EAE1B,mCAAmC,EAEnC,0BAA0B,EAE1B,uBAAuB,GACxB,MAAM,aAAa,CAAC","sourcesContent":["/**\n * community-schema — Shared Zod schemas + TypeScript types for the\n * Jansathi hyperlocal community feature (feed, posts, engagement,\n * social graph, groups, settings).\n *\n * Single source of truth consumed by reform-backend and every product\n * frontend. The schemas mirror MongoDB / Mongoose document shapes\n * 1:1 so the same Zod validation runs at the controller boundary on\n * the backend and in the form handlers on the client.\n *\n * Cascade-upward visibility semantics: a viewer whose feed level is L\n * sees posts at L and every BROADER level matching their area lineage.\n * See `./enums.ts#VISIBILITY_LEVEL_VALUES` for the level rank table.\n *\n * @module community-schema\n */\n\n// ─── Area lineage snapshot ─────────────────────────────────────────────────\nexport {\n type AreaLineageSnapshot,\n areaLineageSnapshotSchema,\n} from './area.js';\n\n// ─── Comment ───────────────────────────────────────────────────────────────\nexport {\n type CommunityCommentWire,\n type CreateCommentBody,\n communityCommentWireSchema,\n createCommentBodySchema,\n type UpdateCommentBody,\n updateCommentBodySchema,\n} from './comment.js';\n\n// ─── Constants ─────────────────────────────────────────────────────────────\nexport {\n COMMENT_MAX_BODY_CHARS,\n COMMENTS_PAGE_SIZE,\n EDIT_GRACE_WINDOW_MS,\n FEED_PAGE_SIZE,\n GROUP_MAX_MEMBERS,\n GROUP_NAME_MAX_CHARS,\n GROUP_NAME_MIN_CHARS,\n PEOPLE_PAGE_SIZE,\n POST_MAX_BODY_CHARS,\n POST_MAX_IMAGE_BYTES,\n POST_MAX_IMAGES,\n POST_MAX_VIDEO_BYTES,\n POST_MAX_VIDEO_SECONDS,\n POST_MAX_VIDEOS,\n PROFILE_MAX_BIO_CHARS,\n REPLIES_PRELOAD_COUNT,\n} from './constants.js';\n\n// ─── Engagement (upvote + reactions) ───────────────────────────────────────\nexport {\n type SetReactionBody,\n type SetReactionResponse,\n setReactionBodySchema,\n setReactionResponseSchema,\n type ToggleUpvoteResponse,\n toggleUpvoteResponseSchema,\n} from './engagement.js';\n\n// ─── Enums ─────────────────────────────────────────────────────────────────\nexport {\n CONNECTION_STATUS_VALUES,\n CONTENT_KIND_VALUES,\n type ConnectionStatus,\n type ContentKind,\n connectionStatusSchema,\n contentKindSchema,\n FEED_SORT_VALUES,\n type FeedSort,\n feedSortSchema,\n PROFILE_PRIVACY_VALUES,\n type ProfilePrivacy,\n profilePrivacySchema,\n REACTION_TYPE_VALUES,\n REPORT_REASON_VALUES,\n REPORT_STATUS_VALUES,\n type ReactionType,\n type ReportReason,\n type ReportStatus,\n reactionTypeSchema,\n reportReasonSchema,\n reportStatusSchema,\n VISIBILITY_LEVEL_RANK,\n VISIBILITY_LEVEL_VALUES,\n type VisibilityLevel,\n visibilityLevelSchema,\n} from './enums.js';\n\n// ─── Feed (polymorphic union) ──────────────────────────────────────────────\nexport {\n type DonateItemFeedItem,\n donateItemFeedItemSchema,\n type FeedItem,\n type FeedQueryParams,\n type FeedResponse,\n feedItemSchema,\n feedQueryParamsSchema,\n feedResponseSchema,\n type LostFoundFeedItem,\n lostFoundFeedItemSchema,\n type VoiceBoxFeedItem,\n voiceBoxFeedItemSchema,\n} from './feed.js';\n\n// ─── Groups ────────────────────────────────────────────────────────────────\nexport {\n type AddGroupMembersBody,\n addGroupMembersBodySchema,\n type CommunityGroupWire,\n type CommunityGroupWithMembers,\n type CreateGroupBody,\n communityGroupWireSchema,\n communityGroupWithMembersSchema,\n createGroupBodySchema,\n type GroupMembersListResponse,\n type GroupMemberWire,\n type GroupRole,\n type GroupsListResponse,\n groupMembersListResponseSchema,\n groupMemberWireSchema,\n groupRoleSchema,\n groupsListResponseSchema,\n type UpdateGroupBody,\n updateGroupBodySchema,\n} from './group.js';\n\n// ─── Media ─────────────────────────────────────────────────────────────────\nexport {\n type PostImage,\n type PostVideo,\n postImageSchema,\n postVideoSchema,\n} from './media.js';\n\n// ─── Post ──────────────────────────────────────────────────────────────────\nexport {\n type CommunityPostWire,\n type CreatePostBody,\n communityPostWireSchema,\n createPostBodySchema,\n type PostAuthorSnapshot,\n postAuthorSnapshotSchema,\n type RepostedSource,\n repostedSourceSchema,\n type UpdatePostBody,\n updatePostBodySchema,\n} from './post.js';\n// ─── Profile + People list ─────────────────────────────────────────────────\nexport {\n type PeopleListItem,\n type PeopleListResponse,\n type PeopleQueryParams,\n type PublicProfileWire,\n peopleListItemSchema,\n peopleListResponseSchema,\n peopleQueryParamsSchema,\n publicProfileWireSchema,\n} from './profile.js';\n// ─── Reports (moderation) ──────────────────────────────────────────────────\nexport {\n type ReportContentBody,\n type ReportContentKind,\n type ReportRecordWire,\n type ReportSubmissionResponse,\n type ReportUserBody,\n reportContentBodySchema,\n reportContentKindSchema,\n reportRecordWireSchema,\n reportSubmissionResponseSchema,\n reportUserBodySchema,\n} from './report.js';\n// ─── Repost (quote / amplify) ──────────────────────────────────────────────\nexport {\n type CreateRepostBody,\n type CreateRepostResponse,\n createRepostBodySchema,\n createRepostResponseSchema,\n} from './repost.js';\n\n// ─── Settings ──────────────────────────────────────────────────────────────\nexport {\n type BlockedUsersListResponse,\n type BlockedUserWire,\n blockedUsersListResponseSchema,\n blockedUserWireSchema,\n COMMUNITY_SETTINGS_DEFAULTS,\n type CommunitySettingsWire,\n communitySettingsWireSchema,\n type UpdateCommunitySettingsBody,\n updateCommunitySettingsBodySchema,\n} from './settings.js';\n\n// ─── Social (follow + connection) ──────────────────────────────────────────\nexport {\n type ConnectionDecisionBody,\n type ConnectionRecordWire,\n connectionDecisionBodySchema,\n connectionRecordWireSchema,\n type SendConnectionRequestResponse,\n sendConnectionRequestResponseSchema,\n type ToggleFollowResponse,\n toggleFollowResponseSchema,\n type ViewerSocialState,\n viewerSocialStateSchema,\n} from './social.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,8EAA8E;AAC9E,OAAO,EAEL,yBAAyB,GAC1B,MAAM,WAAW,CAAC;AAEnB,8EAA8E;AAC9E,OAAO,EAGL,0BAA0B,EAC1B,uBAAuB,EAEvB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,8EAA8E;AAC9E,OAAO,EACL,8BAA8B,EAC9B,kCAAkC,EAClC,qBAAqB,EACrB,qBAAqB,EAWrB,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,+BAA+B,EAC/B,kCAAkC,EAClC,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EAEzB,2BAA2B,EAG3B,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAExB,8EAA8E;AAC9E,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,+BAA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,oBAAoB,GACrB,MAAM,WAAW,CAAC;AACnB,8EAA8E;AAC9E,OAAO,EAKL,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AACtB,8EAA8E;AAC9E,OAAO,EAML,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,8EAA8E;AAC9E,OAAO,EAGL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAErB,8EAA8E;AAC9E,OAAO,EAGL,8BAA8B,EAC9B,qBAAqB,EACrB,2BAA2B,EAE3B,2BAA2B,EAE3B,iCAAiC,GAClC,MAAM,eAAe,CAAC;AAEvB,8EAA8E;AAC9E,OAAO,EAGL,4BAA4B,EAC5B,0BAA0B,EAE1B,mCAAmC,EAEnC,0BAA0B,EAE1B,uBAAuB,GACxB,MAAM,aAAa,CAAC","sourcesContent":["/**\n * community-schema — Shared Zod schemas + TypeScript types for the\n * Jansathi hyperlocal community feature (feed, posts, engagement,\n * social graph, groups, settings).\n *\n * Single source of truth consumed by reform-backend and every product\n * frontend. The schemas mirror MongoDB / Mongoose document shapes\n * 1:1 so the same Zod validation runs at the controller boundary on\n * the backend and in the form handlers on the client.\n *\n * Cascade-upward visibility semantics: a viewer whose feed level is L\n * sees posts at L and every BROADER level matching their area lineage.\n * See `./enums.ts#VISIBILITY_LEVEL_VALUES` for the level rank table.\n *\n * @module community-schema\n */\n\n// ─── Area lineage snapshot ─────────────────────────────────────────────────\nexport {\n type AreaLineageSnapshot,\n areaLineageSnapshotSchema,\n} from './area.js';\n\n// ─── Comment ───────────────────────────────────────────────────────────────\nexport {\n type CommunityCommentWire,\n type CreateCommentBody,\n communityCommentWireSchema,\n createCommentBodySchema,\n type UpdateCommentBody,\n updateCommentBodySchema,\n} from './comment.js';\n\n// ─── Communities ───────────────────────────────────────────────────────────\nexport {\n COMMUNITY_DISCOVER_SORT_VALUES,\n COMMUNITY_MEMBERSHIP_STATUS_VALUES,\n COMMUNITY_ROLE_VALUES,\n COMMUNITY_TYPE_VALUES,\n type CommunityDiscoverSort,\n type CommunityListQuery,\n type CommunityListResponse,\n type CommunityMembershipStatus,\n type CommunityMembersListResponse,\n type CommunityMemberWire,\n type CommunityRole,\n type CommunityType,\n type CommunityWire,\n type CreateCommunityBody,\n communityDiscoverSortSchema,\n communityListQuerySchema,\n communityListResponseSchema,\n communityMembershipStatusSchema,\n communityMembersListResponseSchema,\n communityMemberWireSchema,\n communityRoleSchema,\n communityTypeSchema,\n communityWireSchema,\n createCommunityBodySchema,\n type JoinCommunityResponse,\n joinCommunityResponseSchema,\n type UpdateCommunityBody,\n type UpdateMemberRoleBody,\n updateCommunityBodySchema,\n updateMemberRoleBodySchema,\n} from './community.js';\n\n// ─── Constants ─────────────────────────────────────────────────────────────\nexport {\n COMMENT_MAX_BODY_CHARS,\n COMMENTS_PAGE_SIZE,\n COMMUNITIES_PAGE_SIZE,\n COMMUNITY_DESCRIPTION_MAX_CHARS,\n COMMUNITY_MEMBERS_PAGE_SIZE,\n COMMUNITY_NAME_MAX_CHARS,\n COMMUNITY_NAME_MIN_CHARS,\n COMMUNITY_SLUG_MAX_CHARS,\n COMMUNITY_SLUG_MIN_CHARS,\n COMMUNITY_SLUG_PATTERN,\n EDIT_GRACE_WINDOW_MS,\n FEED_PAGE_SIZE,\n GROUP_MAX_MEMBERS,\n GROUP_NAME_MAX_CHARS,\n GROUP_NAME_MIN_CHARS,\n PEOPLE_PAGE_SIZE,\n POST_MAX_BODY_CHARS,\n POST_MAX_IMAGE_BYTES,\n POST_MAX_IMAGES,\n POST_MAX_VIDEO_BYTES,\n POST_MAX_VIDEO_SECONDS,\n POST_MAX_VIDEOS,\n PROFILE_MAX_BIO_CHARS,\n REPLIES_PRELOAD_COUNT,\n} from './constants.js';\n\n// ─── Engagement (upvote + reactions) ───────────────────────────────────────\nexport {\n type SetReactionBody,\n type SetReactionResponse,\n setReactionBodySchema,\n setReactionResponseSchema,\n type ToggleUpvoteResponse,\n toggleUpvoteResponseSchema,\n} from './engagement.js';\n\n// ─── Enums ─────────────────────────────────────────────────────────────────\nexport {\n CONNECTION_STATUS_VALUES,\n CONTENT_KIND_VALUES,\n type ConnectionStatus,\n type ContentKind,\n connectionStatusSchema,\n contentKindSchema,\n FEED_SORT_VALUES,\n type FeedSort,\n feedSortSchema,\n POST_AUDIENCE_VALUES,\n type PostAudience,\n postAudienceSchema,\n PROFILE_PRIVACY_VALUES,\n type ProfilePrivacy,\n profilePrivacySchema,\n REACTION_TYPE_VALUES,\n REPORT_REASON_VALUES,\n REPORT_STATUS_VALUES,\n type ReactionType,\n type ReportReason,\n type ReportStatus,\n reactionTypeSchema,\n reportReasonSchema,\n reportStatusSchema,\n VISIBILITY_LEVEL_RANK,\n VISIBILITY_LEVEL_VALUES,\n type VisibilityLevel,\n visibilityLevelSchema,\n} from './enums.js';\n\n// ─── Feed (polymorphic union) ──────────────────────────────────────────────\nexport {\n type DonateItemFeedItem,\n donateItemFeedItemSchema,\n type FeedItem,\n type FeedQueryParams,\n type FeedResponse,\n feedItemSchema,\n feedQueryParamsSchema,\n feedResponseSchema,\n type LostFoundFeedItem,\n lostFoundFeedItemSchema,\n type VoiceBoxFeedItem,\n voiceBoxFeedItemSchema,\n} from './feed.js';\n\n// ─── Groups ────────────────────────────────────────────────────────────────\nexport {\n type AddGroupMembersBody,\n addGroupMembersBodySchema,\n type CommunityGroupWire,\n type CommunityGroupWithMembers,\n type CreateGroupBody,\n communityGroupWireSchema,\n communityGroupWithMembersSchema,\n createGroupBodySchema,\n type GroupMembersListResponse,\n type GroupMemberWire,\n type GroupRole,\n type GroupsListResponse,\n groupMembersListResponseSchema,\n groupMemberWireSchema,\n groupRoleSchema,\n groupsListResponseSchema,\n type UpdateGroupBody,\n updateGroupBodySchema,\n} from './group.js';\n\n// ─── Media ─────────────────────────────────────────────────────────────────\nexport {\n type PostImage,\n type PostVideo,\n postImageSchema,\n postVideoSchema,\n} from './media.js';\n\n// ─── Post ──────────────────────────────────────────────────────────────────\nexport {\n type CommunityPostWire,\n type CreatePostBody,\n communityPostWireSchema,\n createPostBodySchema,\n type PostAuthorSnapshot,\n postAuthorSnapshotSchema,\n type RepostedSource,\n repostedSourceSchema,\n type UpdatePostBody,\n updatePostBodySchema,\n} from './post.js';\n// ─── Profile + People list ─────────────────────────────────────────────────\nexport {\n type PeopleListItem,\n type PeopleListResponse,\n type PeopleQueryParams,\n type PublicProfileWire,\n peopleListItemSchema,\n peopleListResponseSchema,\n peopleQueryParamsSchema,\n publicProfileWireSchema,\n} from './profile.js';\n// ─── Reports (moderation) ──────────────────────────────────────────────────\nexport {\n type ReportContentBody,\n type ReportContentKind,\n type ReportRecordWire,\n type ReportSubmissionResponse,\n type ReportUserBody,\n reportContentBodySchema,\n reportContentKindSchema,\n reportRecordWireSchema,\n reportSubmissionResponseSchema,\n reportUserBodySchema,\n} from './report.js';\n// ─── Repost (quote / amplify) ──────────────────────────────────────────────\nexport {\n type CreateRepostBody,\n type CreateRepostResponse,\n createRepostBodySchema,\n createRepostResponseSchema,\n} from './repost.js';\n\n// ─── Settings ──────────────────────────────────────────────────────────────\nexport {\n type BlockedUsersListResponse,\n type BlockedUserWire,\n blockedUsersListResponseSchema,\n blockedUserWireSchema,\n COMMUNITY_SETTINGS_DEFAULTS,\n type CommunitySettingsWire,\n communitySettingsWireSchema,\n type UpdateCommunitySettingsBody,\n updateCommunitySettingsBodySchema,\n} from './settings.js';\n\n// ─── Social (follow + connection) ──────────────────────────────────────────\nexport {\n type ConnectionDecisionBody,\n type ConnectionRecordWire,\n connectionDecisionBodySchema,\n connectionRecordWireSchema,\n type SendConnectionRequestResponse,\n sendConnectionRequestResponseSchema,\n type ToggleFollowResponse,\n toggleFollowResponseSchema,\n type ViewerSocialState,\n viewerSocialStateSchema,\n} from './social.js';\n"]}
|
package/dist/post.d.ts
CHANGED
|
@@ -108,6 +108,11 @@ export declare const communityPostWireSchema: z.ZodObject<{
|
|
|
108
108
|
localId: z.ZodOptional<z.ZodString>;
|
|
109
109
|
localName: z.ZodOptional<z.ZodString>;
|
|
110
110
|
}, z.core.$strip>;
|
|
111
|
+
audience: z.ZodEnum<{
|
|
112
|
+
public: "public";
|
|
113
|
+
connections: "connections";
|
|
114
|
+
}>;
|
|
115
|
+
communityId: z.ZodOptional<z.ZodString>;
|
|
111
116
|
upvoteCount: z.ZodNumber;
|
|
112
117
|
commentCount: z.ZodNumber;
|
|
113
118
|
repostCount: z.ZodNumber;
|
|
@@ -174,6 +179,11 @@ export declare const createPostBodySchema: z.ZodObject<{
|
|
|
174
179
|
national: "national";
|
|
175
180
|
global: "global";
|
|
176
181
|
}>;
|
|
182
|
+
audience: z.ZodDefault<z.ZodEnum<{
|
|
183
|
+
public: "public";
|
|
184
|
+
connections: "connections";
|
|
185
|
+
}>>;
|
|
186
|
+
communityId: z.ZodOptional<z.ZodString>;
|
|
177
187
|
}, z.core.$strip>;
|
|
178
188
|
export type CreatePostBody = z.infer<typeof createPostBodySchema>;
|
|
179
189
|
/**
|
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;AAQxB;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB;;;;;iBAWnC,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
|
|
1
|
+
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../src/post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB;;;;;iBAWnC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6DlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAIxE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgB/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
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { z } from 'zod';
|
|
12
12
|
import { areaLineageSnapshotSchema } from './area.js';
|
|
13
13
|
import { POST_MAX_BODY_CHARS, POST_MAX_IMAGES, POST_MAX_VIDEOS } from './constants.js';
|
|
14
|
-
import { contentKindSchema, visibilityLevelSchema } from './enums.js';
|
|
14
|
+
import { contentKindSchema, postAudienceSchema, visibilityLevelSchema } from './enums.js';
|
|
15
15
|
import { postImageSchema, postVideoSchema } from './media.js';
|
|
16
16
|
// ─── Author snapshot (denormalised on every post) ──────────────────────────
|
|
17
17
|
/**
|
|
@@ -94,6 +94,16 @@ export const communityPostWireSchema = z.object({
|
|
|
94
94
|
// Audience
|
|
95
95
|
visibilityLevel: visibilityLevelSchema,
|
|
96
96
|
areaLineage: areaLineageSnapshotSchema,
|
|
97
|
+
/** Per-post audience override. Defaults to `public` on creation when
|
|
98
|
+
* the client omits it. See `postAudienceSchema` in enums for the
|
|
99
|
+
* full interaction with `ProfilePrivacy`. */
|
|
100
|
+
audience: postAudienceSchema,
|
|
101
|
+
/** When set, the post is scoped to a topical community and is NOT
|
|
102
|
+
* surfaced via the geo cascade or the tier-promotion job. The
|
|
103
|
+
* community feed adds an explicit `communityId` filter to its
|
|
104
|
+
* read queries. Posts authored from the global composer leave
|
|
105
|
+
* this null. */
|
|
106
|
+
communityId: z.string().optional(),
|
|
97
107
|
// Denormalised engagement counters (drive feed sort + card render)
|
|
98
108
|
upvoteCount: z.number().int().nonnegative(),
|
|
99
109
|
commentCount: z.number().int().nonnegative(),
|
|
@@ -140,8 +150,18 @@ export const createPostBodySchema = z.object({
|
|
|
140
150
|
text: z.string().min(1).max(POST_MAX_BODY_CHARS),
|
|
141
151
|
images: z.array(postImageSchema).max(POST_MAX_IMAGES).optional(),
|
|
142
152
|
videos: z.array(postVideoSchema).max(POST_MAX_VIDEOS).optional(),
|
|
143
|
-
/**
|
|
153
|
+
/** Backend ignores client value — every post starts at the deepest
|
|
154
|
+
* tier the author's `currentLocation` resolves and climbs via the
|
|
155
|
+
* tier-promotion job. Kept on the wire for the enum constraint. */
|
|
144
156
|
visibilityLevel: visibilityLevelSchema,
|
|
157
|
+
/** Per-post audience selector chosen by the composer's privacy
|
|
158
|
+
* pill. Optional; defaults to `public` on the server when omitted
|
|
159
|
+
* (the schema applies the default so older clients keep working).
|
|
160
|
+
* See `postAudienceSchema` for the public/connections semantics. */
|
|
161
|
+
audience: postAudienceSchema.default('public'),
|
|
162
|
+
/** When set, the post is scoped to a topical community. The author
|
|
163
|
+
* must be an active member; non-members get a 403. */
|
|
164
|
+
communityId: z.string().optional(),
|
|
145
165
|
});
|
|
146
166
|
/**
|
|
147
167
|
* What the client sends to `PATCH /api/v1/community/posts/:id`. Only
|
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,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE9D,8EAA8E;AAE9E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,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;CACjC,CAAC,CAAC;AAGH,8EAA8E;AAE9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,qEAAqE;IACrE,WAAW,EAAE,iBAAiB;IAC9B,yEAAyE;IACzE,GAAG,EAAE,CAA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AQ,EAAE;IAChE,2EAA2E;IAC3E,eAAe,EAAE,qBAAqB;CACvC,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 { POST_MAX_BODY_CHARS, POST_MAX_IMAGES, POST_MAX_VIDEOS } from './constants.js';\nimport { contentKindSchema, visibilityLevelSchema } from './enums.js';\nimport { postImageSchema, postVideoSchema } from './media.js';\n\n// ─── Author snapshot (denormalised on every post) ──────────────────────────\n\n/**\n * The author's display info captured at post time. Denormalising\n * `displayName` / `avatarUrl` / `localName` here avoids a $lookup\n * against the User collection on every feed read — feed scans 20–40\n * posts per page and population would be a hot path.\n *\n * The User document remains the source of truth; a background job\n * (or a hook on User.findOneAndUpdate) refreshes recent posts when\n * a user changes their display name or avatar.\n */\nexport const postAuthorSnapshotSchema = z.object({\n userId: z.string(),\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 * Hidden when the author has a private profile and the viewer is\n * not an accepted Connection.\n */\n localName: z.string().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 // Audience\n visibilityLevel: visibilityLevelSchema,\n areaLineage: areaLineageSnapshotSchema,\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; visibility area is resolved\n * server-side from the user's primary area lineage (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 /** Default chosen by the client is `local`; the server still validates. */\n visibilityLevel: visibilityLevelSchema,\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,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE9D,8EAA8E;AAE9E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,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;CACjC,CAAC,CAAC;AAGH,8EAA8E;AAE9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,qEAAqE;IACrE,WAAW,EAAE,iBAAiB;IAC9B,yEAAyE;IACzE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,oDAAoD;IACpD,MAAM,EAAE,wBAAwB;IAChC;8CAC0C;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB;+CAC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EAAE;IAChE;;wEAEoE;IACpE,eAAe,EAAE,qBAAqB;IACtC;;;yEAGqE;IACrE,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC9C;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 { POST_MAX_BODY_CHARS, POST_MAX_IMAGES, POST_MAX_VIDEOS } from './constants.js';\nimport { contentKindSchema, postAudienceSchema, visibilityLevelSchema } from './enums.js';\nimport { postImageSchema, postVideoSchema } from './media.js';\n\n// ─── Author snapshot (denormalised on every post) ──────────────────────────\n\n/**\n * The author's display info captured at post time. Denormalising\n * `displayName` / `avatarUrl` / `localName` here avoids a $lookup\n * against the User collection on every feed read — feed scans 20–40\n * posts per page and population would be a hot path.\n *\n * The User document remains the source of truth; a background job\n * (or a hook on User.findOneAndUpdate) refreshes recent posts when\n * a user changes their display name or avatar.\n */\nexport const postAuthorSnapshotSchema = z.object({\n userId: z.string(),\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 * Hidden when the author has a private profile and the viewer is\n * not an accepted Connection.\n */\n localName: z.string().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 // Audience\n visibilityLevel: visibilityLevelSchema,\n areaLineage: areaLineageSnapshotSchema,\n /** Per-post audience override. Defaults to `public` on creation when\n * the client omits it. See `postAudienceSchema` in enums for the\n * full interaction with `ProfilePrivacy`. */\n audience: postAudienceSchema,\n /** When set, the post is scoped to a topical community and is NOT\n * surfaced via the geo cascade or the tier-promotion job. The\n * community feed adds an explicit `communityId` filter to its\n * read queries. Posts authored from the global composer leave\n * 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; visibility area is resolved\n * server-side from the user's primary area lineage (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 /** Backend ignores client value — every post starts at the deepest\n * tier the author's `currentLocation` resolves and climbs via the\n * tier-promotion job. Kept on the wire for the enum constraint. */\n visibilityLevel: visibilityLevelSchema,\n /** Per-post audience selector chosen by the composer's privacy\n * pill. Optional; defaults to `public` on the server when omitted\n * (the schema applies the default so older clients keep working).\n * See `postAudienceSchema` for the public/connections semantics. */\n audience: postAudienceSchema.default('public'),\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
|
@@ -85,6 +85,11 @@ export declare const createRepostResponseSchema: z.ZodObject<{
|
|
|
85
85
|
localId: z.ZodOptional<z.ZodString>;
|
|
86
86
|
localName: z.ZodOptional<z.ZodString>;
|
|
87
87
|
}, z.core.$strip>;
|
|
88
|
+
audience: z.ZodEnum<{
|
|
89
|
+
public: "public";
|
|
90
|
+
connections: "connections";
|
|
91
|
+
}>;
|
|
92
|
+
communityId: z.ZodOptional<z.ZodString>;
|
|
88
93
|
upvoteCount: z.ZodNumber;
|
|
89
94
|
commentCount: z.ZodNumber;
|
|
90
95
|
repostCount: z.ZodNumber;
|
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;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;iBAWjC,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;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;iBAWjC,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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jansathi-community-schema",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Shared Zod schemas + TypeScript types for the Jansathi hyperlocal community feature (feed, posts, engagement, social graph, groups).",
|
|
3
|
+
"version": "0.6.0",
|
|
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",
|
|
7
7
|
"module": "./dist/index.js",
|