founder-schema 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/errors.d.ts +3 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +5 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/limits.d.ts +8 -0
- package/dist/core/limits.d.ts.map +1 -1
- package/dist/core/limits.js +8 -0
- package/dist/core/limits.js.map +1 -1
- package/dist/core/responses.d.ts +2 -0
- package/dist/core/responses.d.ts.map +1 -1
- package/dist/core/validation.d.ts +5 -0
- package/dist/core/validation.d.ts.map +1 -1
- package/dist/core/validation.js +5 -0
- package/dist/core/validation.js.map +1 -1
- package/dist/domains/audit/audit.d.ts +4 -1
- package/dist/domains/audit/audit.d.ts.map +1 -1
- package/dist/domains/audit/audit.js +6 -0
- package/dist/domains/audit/audit.js.map +1 -1
- package/dist/domains/blocks/blocks.d.ts +64 -0
- package/dist/domains/blocks/blocks.d.ts.map +1 -0
- package/dist/domains/blocks/blocks.js +44 -0
- package/dist/domains/blocks/blocks.js.map +1 -0
- package/dist/domains/communities/communities.d.ts +9 -9
- package/dist/domains/contributions/contributions.d.ts +21 -3
- package/dist/domains/contributions/contributions.d.ts.map +1 -1
- package/dist/domains/contributions/contributions.js +21 -4
- package/dist/domains/contributions/contributions.js.map +1 -1
- package/dist/domains/discover/discover.d.ts +88 -0
- package/dist/domains/discover/discover.d.ts.map +1 -1
- package/dist/domains/feed/feed.d.ts +583 -35
- package/dist/domains/feed/feed.d.ts.map +1 -1
- package/dist/domains/feed/feed.js +214 -28
- package/dist/domains/feed/feed.js.map +1 -1
- package/dist/domains/feed/mentions.d.ts +86 -0
- package/dist/domains/feed/mentions.d.ts.map +1 -0
- package/dist/domains/feed/mentions.js +93 -0
- package/dist/domains/feed/mentions.js.map +1 -0
- package/dist/domains/follows/follows.d.ts +186 -3
- package/dist/domains/follows/follows.d.ts.map +1 -1
- package/dist/domains/follows/follows.js +15 -4
- package/dist/domains/follows/follows.js.map +1 -1
- package/dist/domains/follows/relation.d.ts +24 -0
- package/dist/domains/follows/relation.d.ts.map +1 -1
- package/dist/domains/follows/relation.js +24 -0
- package/dist/domains/follows/relation.js.map +1 -1
- package/dist/domains/moderation/moderation.d.ts +9 -2
- package/dist/domains/moderation/moderation.d.ts.map +1 -1
- package/dist/domains/moderation/moderation.js +6 -2
- package/dist/domains/moderation/moderation.js.map +1 -1
- package/dist/domains/notifications/notifications.d.ts +28 -2
- package/dist/domains/notifications/notifications.d.ts.map +1 -1
- package/dist/domains/notifications/notifications.js +24 -0
- package/dist/domains/notifications/notifications.js.map +1 -1
- package/dist/domains/onboarding/onboarding-answers.d.ts +12 -8
- package/dist/domains/onboarding/onboarding-answers.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding-answers.js +20 -21
- package/dist/domains/onboarding/onboarding-answers.js.map +1 -1
- package/dist/domains/onboarding/onboarding.d.ts +210 -174
- package/dist/domains/onboarding/onboarding.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding.js +104 -70
- package/dist/domains/onboarding/onboarding.js.map +1 -1
- package/dist/domains/products/products.d.ts +3 -3
- package/dist/domains/profile/founder-profile.d.ts +144 -1
- package/dist/domains/profile/founder-profile.d.ts.map +1 -1
- package/dist/domains/profile/founder-profile.js +55 -2
- package/dist/domains/profile/founder-profile.js.map +1 -1
- package/dist/domains/profile/my-profile.d.ts +119 -40
- package/dist/domains/profile/my-profile.d.ts.map +1 -1
- package/dist/domains/profile/my-profile.js +28 -14
- package/dist/domains/profile/my-profile.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* @module founder-schema/domains/follows
|
|
18
18
|
*/
|
|
19
19
|
import { z } from 'zod';
|
|
20
|
-
export { type FollowCounts, type FollowedBy, type FollowRelation, followCountsSchema, followedBySchema, followRelationSchema, } from './relation.js';
|
|
20
|
+
export { type FollowCounts, type FollowedBy, type FollowRelation, followCountsSchema, followedBySchema, followRelationSchema, MUTUALS_SAMPLE_SIZE, type Mutuals, mutualsSchema, } from './relation.js';
|
|
21
21
|
/** Whom to follow or stop following: the MEMBER's id (`userId`), as chats and bylines key on. */
|
|
22
22
|
export declare const followTargetParamsSchema: z.ZodObject<{
|
|
23
23
|
userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -32,8 +32,15 @@ export declare const followAnswerSchema: z.ZodObject<{
|
|
|
32
32
|
export type FollowAnswer = z.infer<typeof followAnswerSchema>;
|
|
33
33
|
/**
|
|
34
34
|
* A person on a list (Discover's People, someone's followers and following):
|
|
35
|
-
* their card, and how the viewer relates to them, for the
|
|
36
|
-
* and its Follow button.
|
|
35
|
+
* their card, their interests, and how the viewer relates to them, for the
|
|
36
|
+
* card's mutuals line and its Follow button.
|
|
37
|
+
*
|
|
38
|
+
* `interests` (2026-11-22, the user's People card): the topics the member
|
|
39
|
+
* picked, in their order, each once. ON THIS CARD ONLY: not on
|
|
40
|
+
* `founderCardSchema` (other cards, the member page) and not on
|
|
41
|
+
* `founderProfileSchema` (the owner reads theirs from `GET /profiles/me/interests`).
|
|
42
|
+
* It lives here and not in `domains/profile` because the topics are
|
|
43
|
+
* onboarding's, and onboarding imports the profile.
|
|
37
44
|
*/
|
|
38
45
|
export declare const personCardSchema: z.ZodObject<{
|
|
39
46
|
id: z.ZodString;
|
|
@@ -88,6 +95,17 @@ export declare const personCardSchema: z.ZodObject<{
|
|
|
88
95
|
profitable: "profitable";
|
|
89
96
|
exited: "exited";
|
|
90
97
|
}>;
|
|
98
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
99
|
+
founder: "founder";
|
|
100
|
+
other: "other";
|
|
101
|
+
co_founder: "co_founder";
|
|
102
|
+
ceo: "ceo";
|
|
103
|
+
cto: "cto";
|
|
104
|
+
coo: "coo";
|
|
105
|
+
cfo: "cfo";
|
|
106
|
+
cmo: "cmo";
|
|
107
|
+
cpo: "cpo";
|
|
108
|
+
}>>>;
|
|
91
109
|
teamSize: z.ZodOptional<z.ZodNumber>;
|
|
92
110
|
foundedYear: z.ZodOptional<z.ZodNumber>;
|
|
93
111
|
}, z.core.$strip>>;
|
|
@@ -128,6 +146,78 @@ export declare const personCardSchema: z.ZodObject<{
|
|
|
128
146
|
find_service_providers: "find_service_providers";
|
|
129
147
|
attend_events: "attend_events";
|
|
130
148
|
}>>>;
|
|
149
|
+
interests: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
150
|
+
ai_ml: "ai_ml";
|
|
151
|
+
b2b_saas: "b2b_saas";
|
|
152
|
+
d2c: "d2c";
|
|
153
|
+
deeptech: "deeptech";
|
|
154
|
+
robotics: "robotics";
|
|
155
|
+
growth: "growth";
|
|
156
|
+
sales: "sales";
|
|
157
|
+
marketing: "marketing";
|
|
158
|
+
supply_chain: "supply_chain";
|
|
159
|
+
fundraising: "fundraising";
|
|
160
|
+
mentoring: "mentoring";
|
|
161
|
+
leadership: "leadership";
|
|
162
|
+
networking: "networking";
|
|
163
|
+
public_speaking: "public_speaking";
|
|
164
|
+
teaching: "teaching";
|
|
165
|
+
hiring_talent: "hiring_talent";
|
|
166
|
+
personal_branding: "personal_branding";
|
|
167
|
+
career_transition: "career_transition";
|
|
168
|
+
remote_work: "remote_work";
|
|
169
|
+
blockchain: "blockchain";
|
|
170
|
+
crypto_web3: "crypto_web3";
|
|
171
|
+
data_science: "data_science";
|
|
172
|
+
cybersecurity: "cybersecurity";
|
|
173
|
+
game_dev: "game_dev";
|
|
174
|
+
ux_design: "ux_design";
|
|
175
|
+
app_development: "app_development";
|
|
176
|
+
open_source: "open_source";
|
|
177
|
+
electronics: "electronics";
|
|
178
|
+
space_exploration: "space_exploration";
|
|
179
|
+
green_tech: "green_tech";
|
|
180
|
+
no_code: "no_code";
|
|
181
|
+
entrepreneurship: "entrepreneurship";
|
|
182
|
+
investing: "investing";
|
|
183
|
+
stock_trading: "stock_trading";
|
|
184
|
+
personal_finance: "personal_finance";
|
|
185
|
+
consulting: "consulting";
|
|
186
|
+
ecommerce: "ecommerce";
|
|
187
|
+
retail: "retail";
|
|
188
|
+
real_estate: "real_estate";
|
|
189
|
+
product_management: "product_management";
|
|
190
|
+
meditation: "meditation";
|
|
191
|
+
journaling: "journaling";
|
|
192
|
+
self_improvement: "self_improvement";
|
|
193
|
+
productivity: "productivity";
|
|
194
|
+
reading: "reading";
|
|
195
|
+
online_courses: "online_courses";
|
|
196
|
+
philosophy: "philosophy";
|
|
197
|
+
psychology: "psychology";
|
|
198
|
+
therapy: "therapy";
|
|
199
|
+
sleep_optimization: "sleep_optimization";
|
|
200
|
+
gym: "gym";
|
|
201
|
+
yoga: "yoga";
|
|
202
|
+
photography: "photography";
|
|
203
|
+
writing: "writing";
|
|
204
|
+
graphic_design: "graphic_design";
|
|
205
|
+
filmmaking: "filmmaking";
|
|
206
|
+
digital_art: "digital_art";
|
|
207
|
+
content_creation: "content_creation";
|
|
208
|
+
blogging: "blogging";
|
|
209
|
+
vlogging: "vlogging";
|
|
210
|
+
podcasts: "podcasts";
|
|
211
|
+
animation: "animation";
|
|
212
|
+
music_production: "music_production";
|
|
213
|
+
volunteering: "volunteering";
|
|
214
|
+
ngo_work: "ngo_work";
|
|
215
|
+
environmental: "environmental";
|
|
216
|
+
women_empowerment: "women_empowerment";
|
|
217
|
+
community_service: "community_service";
|
|
218
|
+
social_enterprise: "social_enterprise";
|
|
219
|
+
education_access: "education_access";
|
|
220
|
+
}>>>;
|
|
131
221
|
follow: z.ZodObject<{
|
|
132
222
|
following: z.ZodBoolean;
|
|
133
223
|
followsYou: z.ZodBoolean;
|
|
@@ -135,6 +225,11 @@ export declare const personCardSchema: z.ZodObject<{
|
|
|
135
225
|
firstName: z.ZodNullable<z.ZodString>;
|
|
136
226
|
others: z.ZodNumber;
|
|
137
227
|
}, z.core.$strip>;
|
|
228
|
+
mutuals: z.ZodOptional<z.ZodObject<{
|
|
229
|
+
count: z.ZodNumber;
|
|
230
|
+
sampleNames: z.ZodArray<z.ZodString>;
|
|
231
|
+
avatars: z.ZodArray<z.ZodNullable<z.ZodURL>>;
|
|
232
|
+
}, z.core.$strip>>;
|
|
138
233
|
}, z.core.$strip>;
|
|
139
234
|
}, z.core.$strip>;
|
|
140
235
|
export type PersonCard = z.infer<typeof personCardSchema>;
|
|
@@ -193,6 +288,17 @@ export declare const personPageSchema: z.ZodObject<{
|
|
|
193
288
|
profitable: "profitable";
|
|
194
289
|
exited: "exited";
|
|
195
290
|
}>;
|
|
291
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
292
|
+
founder: "founder";
|
|
293
|
+
other: "other";
|
|
294
|
+
co_founder: "co_founder";
|
|
295
|
+
ceo: "ceo";
|
|
296
|
+
cto: "cto";
|
|
297
|
+
coo: "coo";
|
|
298
|
+
cfo: "cfo";
|
|
299
|
+
cmo: "cmo";
|
|
300
|
+
cpo: "cpo";
|
|
301
|
+
}>>>;
|
|
196
302
|
teamSize: z.ZodOptional<z.ZodNumber>;
|
|
197
303
|
foundedYear: z.ZodOptional<z.ZodNumber>;
|
|
198
304
|
}, z.core.$strip>>;
|
|
@@ -233,6 +339,78 @@ export declare const personPageSchema: z.ZodObject<{
|
|
|
233
339
|
find_service_providers: "find_service_providers";
|
|
234
340
|
attend_events: "attend_events";
|
|
235
341
|
}>>>;
|
|
342
|
+
interests: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
343
|
+
ai_ml: "ai_ml";
|
|
344
|
+
b2b_saas: "b2b_saas";
|
|
345
|
+
d2c: "d2c";
|
|
346
|
+
deeptech: "deeptech";
|
|
347
|
+
robotics: "robotics";
|
|
348
|
+
growth: "growth";
|
|
349
|
+
sales: "sales";
|
|
350
|
+
marketing: "marketing";
|
|
351
|
+
supply_chain: "supply_chain";
|
|
352
|
+
fundraising: "fundraising";
|
|
353
|
+
mentoring: "mentoring";
|
|
354
|
+
leadership: "leadership";
|
|
355
|
+
networking: "networking";
|
|
356
|
+
public_speaking: "public_speaking";
|
|
357
|
+
teaching: "teaching";
|
|
358
|
+
hiring_talent: "hiring_talent";
|
|
359
|
+
personal_branding: "personal_branding";
|
|
360
|
+
career_transition: "career_transition";
|
|
361
|
+
remote_work: "remote_work";
|
|
362
|
+
blockchain: "blockchain";
|
|
363
|
+
crypto_web3: "crypto_web3";
|
|
364
|
+
data_science: "data_science";
|
|
365
|
+
cybersecurity: "cybersecurity";
|
|
366
|
+
game_dev: "game_dev";
|
|
367
|
+
ux_design: "ux_design";
|
|
368
|
+
app_development: "app_development";
|
|
369
|
+
open_source: "open_source";
|
|
370
|
+
electronics: "electronics";
|
|
371
|
+
space_exploration: "space_exploration";
|
|
372
|
+
green_tech: "green_tech";
|
|
373
|
+
no_code: "no_code";
|
|
374
|
+
entrepreneurship: "entrepreneurship";
|
|
375
|
+
investing: "investing";
|
|
376
|
+
stock_trading: "stock_trading";
|
|
377
|
+
personal_finance: "personal_finance";
|
|
378
|
+
consulting: "consulting";
|
|
379
|
+
ecommerce: "ecommerce";
|
|
380
|
+
retail: "retail";
|
|
381
|
+
real_estate: "real_estate";
|
|
382
|
+
product_management: "product_management";
|
|
383
|
+
meditation: "meditation";
|
|
384
|
+
journaling: "journaling";
|
|
385
|
+
self_improvement: "self_improvement";
|
|
386
|
+
productivity: "productivity";
|
|
387
|
+
reading: "reading";
|
|
388
|
+
online_courses: "online_courses";
|
|
389
|
+
philosophy: "philosophy";
|
|
390
|
+
psychology: "psychology";
|
|
391
|
+
therapy: "therapy";
|
|
392
|
+
sleep_optimization: "sleep_optimization";
|
|
393
|
+
gym: "gym";
|
|
394
|
+
yoga: "yoga";
|
|
395
|
+
photography: "photography";
|
|
396
|
+
writing: "writing";
|
|
397
|
+
graphic_design: "graphic_design";
|
|
398
|
+
filmmaking: "filmmaking";
|
|
399
|
+
digital_art: "digital_art";
|
|
400
|
+
content_creation: "content_creation";
|
|
401
|
+
blogging: "blogging";
|
|
402
|
+
vlogging: "vlogging";
|
|
403
|
+
podcasts: "podcasts";
|
|
404
|
+
animation: "animation";
|
|
405
|
+
music_production: "music_production";
|
|
406
|
+
volunteering: "volunteering";
|
|
407
|
+
ngo_work: "ngo_work";
|
|
408
|
+
environmental: "environmental";
|
|
409
|
+
women_empowerment: "women_empowerment";
|
|
410
|
+
community_service: "community_service";
|
|
411
|
+
social_enterprise: "social_enterprise";
|
|
412
|
+
education_access: "education_access";
|
|
413
|
+
}>>>;
|
|
236
414
|
follow: z.ZodObject<{
|
|
237
415
|
following: z.ZodBoolean;
|
|
238
416
|
followsYou: z.ZodBoolean;
|
|
@@ -240,6 +418,11 @@ export declare const personPageSchema: z.ZodObject<{
|
|
|
240
418
|
firstName: z.ZodNullable<z.ZodString>;
|
|
241
419
|
others: z.ZodNumber;
|
|
242
420
|
}, z.core.$strip>;
|
|
421
|
+
mutuals: z.ZodOptional<z.ZodObject<{
|
|
422
|
+
count: z.ZodNumber;
|
|
423
|
+
sampleNames: z.ZodArray<z.ZodString>;
|
|
424
|
+
avatars: z.ZodArray<z.ZodNullable<z.ZodURL>>;
|
|
425
|
+
}, z.core.$strip>>;
|
|
243
426
|
}, z.core.$strip>;
|
|
244
427
|
}, z.core.$strip>>;
|
|
245
428
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"follows.d.ts","sourceRoot":"","sources":["../../../src/domains/follows/follows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"follows.d.ts","sourceRoot":"","sources":["../../../src/domains/follows/follows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,EACL,KAAK,YAAY,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import { objectIdSchema } from '../../core/common.js';
|
|
21
21
|
import { paginatedSchema } from '../../core/responses.js';
|
|
22
|
+
import { INTERESTS_MAX, topicSchema } from '../onboarding/onboarding.js';
|
|
22
23
|
import { founderCardSchema } from '../profile/founder-profile.js';
|
|
23
24
|
import { followRelationSchema } from './relation.js';
|
|
24
|
-
export { followCountsSchema, followedBySchema, followRelationSchema, } from './relation.js';
|
|
25
|
+
export { followCountsSchema, followedBySchema, followRelationSchema, MUTUALS_SAMPLE_SIZE, mutualsSchema, } from './relation.js';
|
|
25
26
|
/** Whom to follow or stop following: the MEMBER's id (`userId`), as chats and bylines key on. */
|
|
26
27
|
export const followTargetParamsSchema = z.object({ userId: objectIdSchema });
|
|
27
28
|
/** The answer to a follow or an unfollow: the state now, and their follower count now. */
|
|
@@ -32,10 +33,20 @@ export const followAnswerSchema = z.object({
|
|
|
32
33
|
});
|
|
33
34
|
/**
|
|
34
35
|
* A person on a list (Discover's People, someone's followers and following):
|
|
35
|
-
* their card, and how the viewer relates to them, for the
|
|
36
|
-
* and its Follow button.
|
|
36
|
+
* their card, their interests, and how the viewer relates to them, for the
|
|
37
|
+
* card's mutuals line and its Follow button.
|
|
38
|
+
*
|
|
39
|
+
* `interests` (2026-11-22, the user's People card): the topics the member
|
|
40
|
+
* picked, in their order, each once. ON THIS CARD ONLY: not on
|
|
41
|
+
* `founderCardSchema` (other cards, the member page) and not on
|
|
42
|
+
* `founderProfileSchema` (the owner reads theirs from `GET /profiles/me/interests`).
|
|
43
|
+
* It lives here and not in `domains/profile` because the topics are
|
|
44
|
+
* onboarding's, and onboarding imports the profile.
|
|
37
45
|
*/
|
|
38
|
-
export const personCardSchema = founderCardSchema.extend({
|
|
46
|
+
export const personCardSchema = founderCardSchema.extend({
|
|
47
|
+
interests: z.array(topicSchema).max(INTERESTS_MAX).default([]),
|
|
48
|
+
follow: followRelationSchema,
|
|
49
|
+
});
|
|
39
50
|
/** A page of people, newest follow first on the followers and following lists. */
|
|
40
51
|
export const personPageSchema = paginatedSchema(personCardSchema);
|
|
41
52
|
//# sourceMappingURL=follows.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"follows.js","sourceRoot":"","sources":["../../../src/domains/follows/follows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAIL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"follows.js","sourceRoot":"","sources":["../../../src/domains/follows/follows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAIL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EAEnB,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,iGAAiG;AACjG,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;AAG7E,0FAA0F;AAC1F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,cAAc;IACtB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CAC1C,CAAC,CAAC;AAGH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,MAAM,CAAC;IACvD,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9D,MAAM,EAAE,oBAAoB;CAC7B,CAAC,CAAC;AAGH,kFAAkF;AAClF,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: following a member (2026-11-20; Jansathi's one-way follow)\n *\n * One way, no acceptance: following someone puts their posts in your home\n * feed (the ones you may read) and tells you when they post; they hear that\n * you followed them. Never yourself; never a deleted account. Following is\n * taking part: a viewer is refused (MEMBERSHIP_REQUIRED).\n *\n * PUT /api/v1/founders/:userId/follow followTargetParamsSchema -> followAnswerSchema\n * DELETE /api/v1/founders/:userId/follow followTargetParamsSchema -> followAnswerSchema\n * GET /api/v1/founders/:userId/followers paginationQuerySchema -> personPageSchema\n * GET /api/v1/founders/:userId/following paginationQuerySchema -> personPageSchema\n *\n * PUT and DELETE are idempotent (not a toggle): a double tap or a retry\n * cannot flip it back. Both answer the state as it now stands.\n *\n * @module founder-schema/domains/follows\n */\n\nimport { z } from 'zod';\nimport { objectIdSchema } from '../../core/common.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { INTERESTS_MAX, topicSchema } from '../onboarding/onboarding.js';\nimport { founderCardSchema } from '../profile/founder-profile.js';\nimport { followRelationSchema } from './relation.js';\n\nexport {\n type FollowCounts,\n type FollowedBy,\n type FollowRelation,\n followCountsSchema,\n followedBySchema,\n followRelationSchema,\n MUTUALS_SAMPLE_SIZE,\n type Mutuals,\n mutualsSchema,\n} from './relation.js';\n\n/** Whom to follow or stop following: the MEMBER's id (`userId`), as chats and bylines key on. */\nexport const followTargetParamsSchema = z.object({ userId: objectIdSchema });\nexport type FollowTargetParams = z.infer<typeof followTargetParamsSchema>;\n\n/** The answer to a follow or an unfollow: the state now, and their follower count now. */\nexport const followAnswerSchema = z.object({\n userId: objectIdSchema,\n following: z.boolean(),\n followers: z.number().int().nonnegative(),\n});\nexport type FollowAnswer = z.infer<typeof followAnswerSchema>;\n\n/**\n * A person on a list (Discover's People, someone's followers and following):\n * their card, their interests, and how the viewer relates to them, for the\n * card's mutuals line and its Follow button.\n *\n * `interests` (2026-11-22, the user's People card): the topics the member\n * picked, in their order, each once. ON THIS CARD ONLY: not on\n * `founderCardSchema` (other cards, the member page) and not on\n * `founderProfileSchema` (the owner reads theirs from `GET /profiles/me/interests`).\n * It lives here and not in `domains/profile` because the topics are\n * onboarding's, and onboarding imports the profile.\n */\nexport const personCardSchema = founderCardSchema.extend({\n interests: z.array(topicSchema).max(INTERESTS_MAX).default([]),\n follow: followRelationSchema,\n});\nexport type PersonCard = z.infer<typeof personCardSchema>;\n\n/** A page of people, newest follow first on the followers and following lists. */\nexport const personPageSchema = paginatedSchema(personCardSchema);\nexport type PersonPage = z.infer<typeof personPageSchema>;\n"]}
|
|
@@ -16,6 +16,25 @@ export declare const followedBySchema: z.ZodObject<{
|
|
|
16
16
|
others: z.ZodNumber;
|
|
17
17
|
}, z.core.$strip>;
|
|
18
18
|
export type FollowedBy = z.infer<typeof followedBySchema>;
|
|
19
|
+
/** How many faces and names a mutuals line carries (GymMonk's `MUTUALS_SAMPLE_SIZE`). */
|
|
20
|
+
export declare const MUTUALS_SAMPLE_SIZE = 3;
|
|
21
|
+
/**
|
|
22
|
+
* "Followed by Neha, Rohit + 3 more" (2026-11-22, the People card; GymMonk's
|
|
23
|
+
* and Jansathi's mutuals line): the same people as `followedBy`, of the people
|
|
24
|
+
* the VIEWER follows the ones who follow this person, newest follow first,
|
|
25
|
+
* deleted accounts left out.
|
|
26
|
+
*
|
|
27
|
+
* `count` is ALL of them; `sampleNames` and `avatars` only the first
|
|
28
|
+
* `MUTUALS_SAMPLE_SIZE`, in the same order, so face `i` falls back to the
|
|
29
|
+
* initial of name `i`. The line names two and counts the rest. An avatar is
|
|
30
|
+
* null when that person has no photo.
|
|
31
|
+
*/
|
|
32
|
+
export declare const mutualsSchema: z.ZodObject<{
|
|
33
|
+
count: z.ZodNumber;
|
|
34
|
+
sampleNames: z.ZodArray<z.ZodString>;
|
|
35
|
+
avatars: z.ZodArray<z.ZodNullable<z.ZodURL>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type Mutuals = z.infer<typeof mutualsSchema>;
|
|
19
38
|
/** The viewer and this person, both ways. Always all false / none for the viewer themselves. */
|
|
20
39
|
export declare const followRelationSchema: z.ZodObject<{
|
|
21
40
|
following: z.ZodBoolean;
|
|
@@ -24,6 +43,11 @@ export declare const followRelationSchema: z.ZodObject<{
|
|
|
24
43
|
firstName: z.ZodNullable<z.ZodString>;
|
|
25
44
|
others: z.ZodNumber;
|
|
26
45
|
}, z.core.$strip>;
|
|
46
|
+
mutuals: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
count: z.ZodNumber;
|
|
48
|
+
sampleNames: z.ZodArray<z.ZodString>;
|
|
49
|
+
avatars: z.ZodArray<z.ZodNullable<z.ZodURL>>;
|
|
50
|
+
}, z.core.$strip>>;
|
|
27
51
|
}, z.core.$strip>;
|
|
28
52
|
export type FollowRelation = z.infer<typeof followRelationSchema>;
|
|
29
53
|
/** How many follow this person, and how many they follow. Counted when read, never stored. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../../../src/domains/follows/relation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,gGAAgG;AAChG,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../../../src/domains/follows/relation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,yFAAyF;AACzF,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa;;;;iBAIxB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,gGAAgG;AAChG,eAAO,MAAM,oBAAoB;;;;;;;;;;;;iBAY/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -15,6 +15,24 @@ export const followedBySchema = z.object({
|
|
|
15
15
|
firstName: z.string().nullable(),
|
|
16
16
|
others: z.number().int().nonnegative(),
|
|
17
17
|
});
|
|
18
|
+
/** How many faces and names a mutuals line carries (GymMonk's `MUTUALS_SAMPLE_SIZE`). */
|
|
19
|
+
export const MUTUALS_SAMPLE_SIZE = 3;
|
|
20
|
+
/**
|
|
21
|
+
* "Followed by Neha, Rohit + 3 more" (2026-11-22, the People card; GymMonk's
|
|
22
|
+
* and Jansathi's mutuals line): the same people as `followedBy`, of the people
|
|
23
|
+
* the VIEWER follows the ones who follow this person, newest follow first,
|
|
24
|
+
* deleted accounts left out.
|
|
25
|
+
*
|
|
26
|
+
* `count` is ALL of them; `sampleNames` and `avatars` only the first
|
|
27
|
+
* `MUTUALS_SAMPLE_SIZE`, in the same order, so face `i` falls back to the
|
|
28
|
+
* initial of name `i`. The line names two and counts the rest. An avatar is
|
|
29
|
+
* null when that person has no photo.
|
|
30
|
+
*/
|
|
31
|
+
export const mutualsSchema = z.object({
|
|
32
|
+
count: z.number().int().nonnegative(),
|
|
33
|
+
sampleNames: z.array(z.string()).max(MUTUALS_SAMPLE_SIZE),
|
|
34
|
+
avatars: z.array(z.url().nullable()).max(MUTUALS_SAMPLE_SIZE),
|
|
35
|
+
});
|
|
18
36
|
/** The viewer and this person, both ways. Always all false / none for the viewer themselves. */
|
|
19
37
|
export const followRelationSchema = z.object({
|
|
20
38
|
/** The viewer follows them: the button reads "Following". */
|
|
@@ -22,6 +40,12 @@ export const followRelationSchema = z.object({
|
|
|
22
40
|
/** They follow the viewer: "Follows you", and the button reads "Follow back". */
|
|
23
41
|
followsYou: z.boolean(),
|
|
24
42
|
followedBy: followedBySchema,
|
|
43
|
+
/**
|
|
44
|
+
* The People card's mutuals line (2026-11-22). OPTIONAL, and absent means
|
|
45
|
+
* none: added beside `followedBy` without changing it, so a page or a
|
|
46
|
+
* server from before still parses.
|
|
47
|
+
*/
|
|
48
|
+
mutuals: mutualsSchema.optional(),
|
|
25
49
|
});
|
|
26
50
|
/** How many follow this person, and how many they follow. Counted when read, never stored. */
|
|
27
51
|
export const followCountsSchema = z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../../../src/domains/follows/relation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MA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C,CAAC,GAAG,CAAC,mBAAmB,CAAC;CAC9D,CAAC,CAAC;AAGH,gGAAgG;AAChG,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,6DAA6D;IAC7D,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,iFAAiF;IACjF,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;IACvB,UAAU,EAAE,gBAAgB;IAC5B;;;;OAIG;IACH,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAGH,8FAA8F;AAC9F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACzC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CAC1C,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: one member's follow relation to another, as a viewer sees it\n * (2026-11-20). A leaf module, imported by the member page (`domains/profile`)\n * and the people lists (`domains/follows`), so neither imports the other.\n *\n * @module founder-schema/domains/follows/relation\n */\n\nimport { z } from 'zod';\n\n/**\n * \"Followed by Neha + 3\": of the people the VIEWER follows, the ones who\n * follow this person. `firstName` is one of them (null when none), `others`\n * how many more.\n */\nexport const followedBySchema = z.object({\n firstName: z.string().nullable(),\n others: z.number().int().nonnegative(),\n});\nexport type FollowedBy = z.infer<typeof followedBySchema>;\n\n/** How many faces and names a mutuals line carries (GymMonk's `MUTUALS_SAMPLE_SIZE`). */\nexport const MUTUALS_SAMPLE_SIZE = 3;\n\n/**\n * \"Followed by Neha, Rohit + 3 more\" (2026-11-22, the People card; GymMonk's\n * and Jansathi's mutuals line): the same people as `followedBy`, of the people\n * the VIEWER follows the ones who follow this person, newest follow first,\n * deleted accounts left out.\n *\n * `count` is ALL of them; `sampleNames` and `avatars` only the first\n * `MUTUALS_SAMPLE_SIZE`, in the same order, so face `i` falls back to the\n * initial of name `i`. The line names two and counts the rest. An avatar is\n * null when that person has no photo.\n */\nexport const mutualsSchema = z.object({\n count: z.number().int().nonnegative(),\n sampleNames: z.array(z.string()).max(MUTUALS_SAMPLE_SIZE),\n avatars: z.array(z.url().nullable()).max(MUTUALS_SAMPLE_SIZE),\n});\nexport type Mutuals = z.infer<typeof mutualsSchema>;\n\n/** The viewer and this person, both ways. Always all false / none for the viewer themselves. */\nexport const followRelationSchema = z.object({\n /** The viewer follows them: the button reads \"Following\". */\n following: z.boolean(),\n /** They follow the viewer: \"Follows you\", and the button reads \"Follow back\". */\n followsYou: z.boolean(),\n followedBy: followedBySchema,\n /**\n * The People card's mutuals line (2026-11-22). OPTIONAL, and absent means\n * none: added beside `followedBy` without changing it, so a page or a\n * server from before still parses.\n */\n mutuals: mutualsSchema.optional(),\n});\nexport type FollowRelation = z.infer<typeof followRelationSchema>;\n\n/** How many follow this person, and how many they follow. Counted when read, never stored. */\nexport const followCountsSchema = z.object({\n followers: z.number().int().nonnegative(),\n following: z.number().int().nonnegative(),\n});\nexport type FollowCounts = z.infer<typeof followCountsSchema>;\n"]}
|
|
@@ -41,11 +41,12 @@
|
|
|
41
41
|
import { z } from 'zod';
|
|
42
42
|
/**
|
|
43
43
|
* Where something is read in the app: a post or poll, or a product page (for a
|
|
44
|
-
* product, and for a review of it).
|
|
44
|
+
* product, and for a review of it), or the member's page (for a member).
|
|
45
45
|
*/
|
|
46
|
-
export declare const MODERATION_CONTEXT_KIND_VALUES: readonly ["post", "poll", "product"];
|
|
46
|
+
export declare const MODERATION_CONTEXT_KIND_VALUES: readonly ["post", "poll", "product", "member"];
|
|
47
47
|
export declare const moderationContextKindSchema: z.ZodEnum<{
|
|
48
48
|
product: "product";
|
|
49
|
+
member: "member";
|
|
49
50
|
post: "post";
|
|
50
51
|
poll: "poll";
|
|
51
52
|
}>;
|
|
@@ -79,12 +80,14 @@ export declare const MODERATION_ACTIONS_BY_TARGET_KIND: {
|
|
|
79
80
|
readonly comment: readonly ["dismiss", "hide", "restore", "remove"];
|
|
80
81
|
readonly review: readonly ["dismiss", "hide", "restore", "remove"];
|
|
81
82
|
readonly product: readonly ["dismiss", "hide", "restore"];
|
|
83
|
+
readonly member: readonly ["dismiss"];
|
|
82
84
|
};
|
|
83
85
|
/** One post, poll, comment, product or review as moderation sees it. */
|
|
84
86
|
export declare const moderationItemSchema: z.ZodObject<{
|
|
85
87
|
target: z.ZodObject<{
|
|
86
88
|
kind: z.ZodEnum<{
|
|
87
89
|
product: "product";
|
|
90
|
+
member: "member";
|
|
88
91
|
post: "post";
|
|
89
92
|
poll: "poll";
|
|
90
93
|
comment: "comment";
|
|
@@ -95,6 +98,7 @@ export declare const moderationItemSchema: z.ZodObject<{
|
|
|
95
98
|
content: z.ZodObject<{
|
|
96
99
|
kind: z.ZodEnum<{
|
|
97
100
|
product: "product";
|
|
101
|
+
member: "member";
|
|
98
102
|
post: "post";
|
|
99
103
|
poll: "poll";
|
|
100
104
|
}>;
|
|
@@ -146,6 +150,7 @@ export declare const moderationPageSchema: z.ZodObject<{
|
|
|
146
150
|
target: z.ZodObject<{
|
|
147
151
|
kind: z.ZodEnum<{
|
|
148
152
|
product: "product";
|
|
153
|
+
member: "member";
|
|
149
154
|
post: "post";
|
|
150
155
|
poll: "poll";
|
|
151
156
|
comment: "comment";
|
|
@@ -156,6 +161,7 @@ export declare const moderationPageSchema: z.ZodObject<{
|
|
|
156
161
|
content: z.ZodObject<{
|
|
157
162
|
kind: z.ZodEnum<{
|
|
158
163
|
product: "product";
|
|
164
|
+
member: "member";
|
|
159
165
|
post: "post";
|
|
160
166
|
poll: "poll";
|
|
161
167
|
}>;
|
|
@@ -220,6 +226,7 @@ export type ModerationContentQueryInput = z.input<typeof moderationContentQueryS
|
|
|
220
226
|
export declare const moderationTargetParamsSchema: z.ZodObject<{
|
|
221
227
|
contentKind: z.ZodEnum<{
|
|
222
228
|
product: "product";
|
|
229
|
+
member: "member";
|
|
223
230
|
post: "post";
|
|
224
231
|
poll: "poll";
|
|
225
232
|
comment: "comment";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moderation.d.ts","sourceRoot":"","sources":["../../../src/domains/moderation/moderation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB;;;GAGG;AACH,eAAO,MAAM,8BAA8B,
|
|
1
|
+
{"version":3,"file":"moderation.d.ts","sourceRoot":"","sources":["../../../src/domains/moderation/moderation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB;;;GAGG;AACH,eAAO,MAAM,8BAA8B,gDAAiD,CAAC;AAC7F,eAAO,MAAM,2BAA2B;;;;;EAAyC,CAAC;AAClF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,6DAA6D;AAC7D,eAAO,MAAM,uBAAuB,2CAA4C,CAAC;AACjF,eAAO,MAAM,qBAAqB;;;;EAAkC,CAAC;AACrE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,wBAAwB,mDAAoD,CAAC;AAC1F,eAAO,MAAM,sBAAsB;;;;;EAAmC,CAAC;AACvE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC;;;;;;;CAU4B,CAAC;AAI3E,wEAAwE;AACxE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0C/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAwC,CAAC;AAC1E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,wDAAwD;AACxD,eAAO,MAAM,4BAA4B;;;;;;;;iBAEvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAEvF,+EAA+E;AAC/E,eAAO,MAAM,4BAA4B;;;;;;;;;;iBAGvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,2DAA2D;AAC3D,eAAO,MAAM,4BAA4B;;;;;;;;iBAIvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
|
|
@@ -46,9 +46,9 @@ import { reportReasonSchema, reportTargetKindSchema } from '../feed/feed.js';
|
|
|
46
46
|
import { personSchema } from '../people/person.js';
|
|
47
47
|
/**
|
|
48
48
|
* Where something is read in the app: a post or poll, or a product page (for a
|
|
49
|
-
* product, and for a review of it).
|
|
49
|
+
* product, and for a review of it), or the member's page (for a member).
|
|
50
50
|
*/
|
|
51
|
-
export const MODERATION_CONTEXT_KIND_VALUES = ['post', 'poll', 'product'];
|
|
51
|
+
export const MODERATION_CONTEXT_KIND_VALUES = ['post', 'poll', 'product', 'member'];
|
|
52
52
|
export const moderationContextKindSchema = z.enum(MODERATION_CONTEXT_KIND_VALUES);
|
|
53
53
|
/** Where a post, poll, comment, product or review stands. */
|
|
54
54
|
export const MODERATION_STATE_VALUES = ['visible', 'hidden', 'removed'];
|
|
@@ -68,6 +68,10 @@ export const MODERATION_ACTIONS_BY_TARGET_KIND = {
|
|
|
68
68
|
comment: MODERATION_ACTION_VALUES,
|
|
69
69
|
review: MODERATION_ACTION_VALUES,
|
|
70
70
|
product: ['dismiss', 'hide', 'restore'],
|
|
71
|
+
// A member (2026-11-23): staff read the report and dismiss it here; a
|
|
72
|
+
// suspension is the member directory's (`/members/:memberId/suspension`),
|
|
73
|
+
// which the queue links to. Nothing to hide or remove on a person.
|
|
74
|
+
member: ['dismiss'],
|
|
71
75
|
};
|
|
72
76
|
const count = z.number().int().min(0);
|
|
73
77
|
/** One post, poll, comment, product or review as moderation sees it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moderation.js","sourceRoot":"","sources":["../../../src/domains/moderation/moderation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAyB,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AACnF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAA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,2DAA2D;AAC3D,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,MAAM,EAAE,sBAAsB;IAC9B,gFAAgF;IAChF,IAAI,EAAE,qBAAqB,CAAC,mBAAmB,CAAC;CACjD,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: moderation\n *\n * GET /api/v1/moderation/queue ?limit&cursor\n * what members reported and nobody has decided on, oldest report first\n * GET /api/v1/moderation/content ?state&limit&cursor\n * by state, newest first: visible is posts and polls by when posted;\n * hidden and removed also hold comments (so a hidden comment can be\n * found and put back), by when hidden or removed\n * A decision that changes nothing (hiding what is already hidden, removing\n * what its author deleted) leaves the reports open and writes nothing: for\n * those, dismiss.\n * POST /api/v1/moderation/:contentKind/:contentId/decision { action, note? }\n * decide on one post, poll, comment, product or review; answers the\n * item as it now is\n *\n * PRODUCTS AND REVIEWS (0.6.0) are reported and decided here too. A product is\n * hidden or restored, never removed by staff (it is its team's work; hiding\n * takes it out of Discover and off every page but its team's). A review is\n * hidden, restored or removed like a comment. The hidden and removed lists\n * hold them too, so a hidden product can be found and put back.\n *\n * ONE ITEM PER THING, NOT PER REPORT. Five members reporting one post is one\n * row with five reports, so a moderator decides once. The queue's order is\n * the oldest open report first: whoever has waited longest is seen first, and\n * a pile-on cannot jump the line.\n *\n * THE DECISIONS\n * dismiss it stays up; its open reports close as dismissed\n * hide out of every feed and thread, kept, restorable; reports actioned\n * restore a hidden item goes back up\n * remove deleted as its author deleting it would (counts move), not\n * restorable from here; reports actioned\n * Every decision on someone else's content is written to the audit log, with\n * the note when there is one.\n *\n * A report's `note` was written by a member: untrusted text, shown as text.\n *\n * @module founder-schema/domains/moderation\n */\n\nimport { z } from 'zod';\nimport {\n emptyStringToUndefined,\n objectIdSchema,\n optionalTrimmedString,\n paginationQuerySchema,\n} from '../../core/common.js';\nimport { MODERATION_EXCERPT_MAX, MODERATION_NOTE_MAX } from '../../core/limits.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { type ReportTargetKind, reportReasonSchema, reportTargetKindSchema } from '../feed/feed.js';\nimport { personSchema } from '../people/person.js';\n\n/**\n * Where something is read in the app: a post or poll, or a product page (for a\n * product, and for a review of it).\n */\nexport const MODERATION_CONTEXT_KIND_VALUES = ['post', 'poll', 'product'] as const;\nexport const moderationContextKindSchema = z.enum(MODERATION_CONTEXT_KIND_VALUES);\nexport type ModerationContextKind = z.infer<typeof moderationContextKindSchema>;\n\n/** Where a post, poll, comment, product or review stands. */\nexport const MODERATION_STATE_VALUES = ['visible', 'hidden', 'removed'] as const;\nexport const moderationStateSchema = z.enum(MODERATION_STATE_VALUES);\nexport type ModerationState = z.infer<typeof moderationStateSchema>;\n\nexport const MODERATION_ACTION_VALUES = ['dismiss', 'hide', 'restore', 'remove'] as const;\nexport const moderationActionSchema = z.enum(MODERATION_ACTION_VALUES);\nexport type ModerationAction = z.infer<typeof moderationActionSchema>;\n\n/**\n * Which decisions apply to which kind of thing: everything, except that a\n * product is never removed by staff (it is its team's work; hiding it takes it\n * out of Discover and off every page but its team's). The decision dialog\n * offers these, and the server refuses anything else with\n * `MODERATION_ACTION_INVALID`. Exhaustive by type.\n */\nexport const MODERATION_ACTIONS_BY_TARGET_KIND = {\n post: MODERATION_ACTION_VALUES,\n poll: MODERATION_ACTION_VALUES,\n comment: MODERATION_ACTION_VALUES,\n review: MODERATION_ACTION_VALUES,\n product: ['dismiss', 'hide', 'restore'],\n} as const satisfies Record<ReportTargetKind, readonly ModerationAction[]>;\n\nconst count = z.number().int().min(0);\n\n/** One post, poll, comment, product or review as moderation sees it. */\nexport const moderationItemSchema = z.object({\n target: z.object({ kind: reportTargetKindSchema, id: objectIdSchema }),\n /**\n * Where it is read in the app: the post or poll itself, or the one a comment\n * is on; the product page for a product or a review.\n */\n content: z.object({ kind: moderationContextKindSchema, id: objectIdSchema }),\n /**\n * Its first words AS THEY ARE NOW, cut to `MODERATION_EXCERPT_MAX`: a poll's\n * question, a product's name and tagline, a review's stars and text.\n */\n excerpt: z.string().max(MODERATION_EXCERPT_MAX),\n /**\n * The words as they were when first reported, when the author has edited\n * them since (0.8.0): both are shown, so an edit can neither hide what was\n * reported nor slip new words past a moderator judging the old ones.\n * Absent when unedited since the report.\n */\n asReported: z.string().max(MODERATION_EXCERPT_MAX).optional(),\n /** Who wrote it; for a product, its owner (0.20.0: the person, with a handle to link). */\n author: personSchema,\n createdAt: z.iso.datetime(),\n state: moderationStateSchema,\n reports: z.object({\n /** Reports nobody has decided on. */\n open: count,\n /** Every report ever filed about it. */\n total: count,\n /** Why it was reported, among the open ones, most-given first. */\n reasons: z.array(z.object({ reason: reportReasonSchema, count })),\n /** The reporters' notes, among the open ones, newest first (a few, not all). */\n notes: z.array(z.string()),\n /** When the oldest open report was filed. Null when none is open. */\n oldestOpenAt: z.iso.datetime().nullable(),\n }),\n /** What the asking staff member may do to it now. */\n viewer: z.object({\n canDismiss: z.boolean(),\n canHide: z.boolean(),\n canRestore: z.boolean(),\n canRemove: z.boolean(),\n }),\n});\nexport type ModerationItem = z.infer<typeof moderationItemSchema>;\n\nexport const moderationPageSchema = paginatedSchema(moderationItemSchema);\nexport type ModerationPage = z.infer<typeof moderationPageSchema>;\n\n/** `GET /moderation/content`. Visible when not said. */\nexport const moderationContentQuerySchema = paginationQuerySchema.extend({\n state: z.preprocess(emptyStringToUndefined, moderationStateSchema.default('visible')),\n});\nexport type ModerationContentQuery = z.infer<typeof moderationContentQuerySchema>;\nexport type ModerationContentQueryInput = z.input<typeof moderationContentQuerySchema>;\n\n/** `POST /moderation/:contentKind/:contentId/decision`: what is decided on. */\nexport const moderationTargetParamsSchema = z.object({\n contentKind: reportTargetKindSchema,\n contentId: objectIdSchema,\n});\nexport type ModerationTargetParams = z.infer<typeof moderationTargetParamsSchema>;\n\n/** `POST /moderation/:contentKind/:contentId/decision`. */\nexport const moderationDecisionBodySchema = z.object({\n action: moderationActionSchema,\n /** Why, for the audit log. Optional: an obvious spam removal needs no essay. */\n note: optionalTrimmedString(MODERATION_NOTE_MAX),\n});\nexport type ModerationDecisionBody = z.infer<typeof moderationDecisionBodySchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"moderation.js","sourceRoot":"","sources":["../../../src/domains/moderation/moderation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAyB,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAC7F,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;AAGlF,6DAA6D;AAC7D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC;AACjF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AAGrE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAC1F,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;AAGvE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,IAA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AAC;QACjE,gFAAgF;QAChF,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC1B,qEAAqE;QACrE,YAAY,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;KAC1C,CAAC;IACF,qDAAqD;IACrD,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;QACvB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;QACpB,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;QACvB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;KACvB,CAAC;CACH,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC,oBAAoB,CAAC,CAAC;AAG1E,wDAAwD;AACxD,MAAM,CAAC,MAAM,4BAA4B,GAAG,qBAAqB,CAAC,MAAM,CAAC;IACvE,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC,sBAAsB,EAAE,qBAAqB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;CACtF,CAAC,CAAC;AAIH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,WAAW,EAAE,sBAAsB;IACnC,SAAS,EAAE,cAAc;CAC1B,CAAC,CAAC;AAGH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,MAAM,EAAE,sBAAsB;IAC9B,gFAAgF;IAChF,IAAI,EAAE,qBAAqB,CAAC,mBAAmB,CAAC;CACjD,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: moderation\n *\n * GET /api/v1/moderation/queue ?limit&cursor\n * what members reported and nobody has decided on, oldest report first\n * GET /api/v1/moderation/content ?state&limit&cursor\n * by state, newest first: visible is posts and polls by when posted;\n * hidden and removed also hold comments (so a hidden comment can be\n * found and put back), by when hidden or removed\n * A decision that changes nothing (hiding what is already hidden, removing\n * what its author deleted) leaves the reports open and writes nothing: for\n * those, dismiss.\n * POST /api/v1/moderation/:contentKind/:contentId/decision { action, note? }\n * decide on one post, poll, comment, product or review; answers the\n * item as it now is\n *\n * PRODUCTS AND REVIEWS (0.6.0) are reported and decided here too. A product is\n * hidden or restored, never removed by staff (it is its team's work; hiding\n * takes it out of Discover and off every page but its team's). A review is\n * hidden, restored or removed like a comment. The hidden and removed lists\n * hold them too, so a hidden product can be found and put back.\n *\n * ONE ITEM PER THING, NOT PER REPORT. Five members reporting one post is one\n * row with five reports, so a moderator decides once. The queue's order is\n * the oldest open report first: whoever has waited longest is seen first, and\n * a pile-on cannot jump the line.\n *\n * THE DECISIONS\n * dismiss it stays up; its open reports close as dismissed\n * hide out of every feed and thread, kept, restorable; reports actioned\n * restore a hidden item goes back up\n * remove deleted as its author deleting it would (counts move), not\n * restorable from here; reports actioned\n * Every decision on someone else's content is written to the audit log, with\n * the note when there is one.\n *\n * A report's `note` was written by a member: untrusted text, shown as text.\n *\n * @module founder-schema/domains/moderation\n */\n\nimport { z } from 'zod';\nimport {\n emptyStringToUndefined,\n objectIdSchema,\n optionalTrimmedString,\n paginationQuerySchema,\n} from '../../core/common.js';\nimport { MODERATION_EXCERPT_MAX, MODERATION_NOTE_MAX } from '../../core/limits.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { type ReportTargetKind, reportReasonSchema, reportTargetKindSchema } from '../feed/feed.js';\nimport { personSchema } from '../people/person.js';\n\n/**\n * Where something is read in the app: a post or poll, or a product page (for a\n * product, and for a review of it), or the member's page (for a member).\n */\nexport const MODERATION_CONTEXT_KIND_VALUES = ['post', 'poll', 'product', 'member'] as const;\nexport const moderationContextKindSchema = z.enum(MODERATION_CONTEXT_KIND_VALUES);\nexport type ModerationContextKind = z.infer<typeof moderationContextKindSchema>;\n\n/** Where a post, poll, comment, product or review stands. */\nexport const MODERATION_STATE_VALUES = ['visible', 'hidden', 'removed'] as const;\nexport const moderationStateSchema = z.enum(MODERATION_STATE_VALUES);\nexport type ModerationState = z.infer<typeof moderationStateSchema>;\n\nexport const MODERATION_ACTION_VALUES = ['dismiss', 'hide', 'restore', 'remove'] as const;\nexport const moderationActionSchema = z.enum(MODERATION_ACTION_VALUES);\nexport type ModerationAction = z.infer<typeof moderationActionSchema>;\n\n/**\n * Which decisions apply to which kind of thing: everything, except that a\n * product is never removed by staff (it is its team's work; hiding it takes it\n * out of Discover and off every page but its team's). The decision dialog\n * offers these, and the server refuses anything else with\n * `MODERATION_ACTION_INVALID`. Exhaustive by type.\n */\nexport const MODERATION_ACTIONS_BY_TARGET_KIND = {\n post: MODERATION_ACTION_VALUES,\n poll: MODERATION_ACTION_VALUES,\n comment: MODERATION_ACTION_VALUES,\n review: MODERATION_ACTION_VALUES,\n product: ['dismiss', 'hide', 'restore'],\n // A member (2026-11-23): staff read the report and dismiss it here; a\n // suspension is the member directory's (`/members/:memberId/suspension`),\n // which the queue links to. Nothing to hide or remove on a person.\n member: ['dismiss'],\n} as const satisfies Record<ReportTargetKind, readonly ModerationAction[]>;\n\nconst count = z.number().int().min(0);\n\n/** One post, poll, comment, product or review as moderation sees it. */\nexport const moderationItemSchema = z.object({\n target: z.object({ kind: reportTargetKindSchema, id: objectIdSchema }),\n /**\n * Where it is read in the app: the post or poll itself, or the one a comment\n * is on; the product page for a product or a review.\n */\n content: z.object({ kind: moderationContextKindSchema, id: objectIdSchema }),\n /**\n * Its first words AS THEY ARE NOW, cut to `MODERATION_EXCERPT_MAX`: a poll's\n * question, a product's name and tagline, a review's stars and text.\n */\n excerpt: z.string().max(MODERATION_EXCERPT_MAX),\n /**\n * The words as they were when first reported, when the author has edited\n * them since (0.8.0): both are shown, so an edit can neither hide what was\n * reported nor slip new words past a moderator judging the old ones.\n * Absent when unedited since the report.\n */\n asReported: z.string().max(MODERATION_EXCERPT_MAX).optional(),\n /** Who wrote it; for a product, its owner (0.20.0: the person, with a handle to link). */\n author: personSchema,\n createdAt: z.iso.datetime(),\n state: moderationStateSchema,\n reports: z.object({\n /** Reports nobody has decided on. */\n open: count,\n /** Every report ever filed about it. */\n total: count,\n /** Why it was reported, among the open ones, most-given first. */\n reasons: z.array(z.object({ reason: reportReasonSchema, count })),\n /** The reporters' notes, among the open ones, newest first (a few, not all). */\n notes: z.array(z.string()),\n /** When the oldest open report was filed. Null when none is open. */\n oldestOpenAt: z.iso.datetime().nullable(),\n }),\n /** What the asking staff member may do to it now. */\n viewer: z.object({\n canDismiss: z.boolean(),\n canHide: z.boolean(),\n canRestore: z.boolean(),\n canRemove: z.boolean(),\n }),\n});\nexport type ModerationItem = z.infer<typeof moderationItemSchema>;\n\nexport const moderationPageSchema = paginatedSchema(moderationItemSchema);\nexport type ModerationPage = z.infer<typeof moderationPageSchema>;\n\n/** `GET /moderation/content`. Visible when not said. */\nexport const moderationContentQuerySchema = paginationQuerySchema.extend({\n state: z.preprocess(emptyStringToUndefined, moderationStateSchema.default('visible')),\n});\nexport type ModerationContentQuery = z.infer<typeof moderationContentQuerySchema>;\nexport type ModerationContentQueryInput = z.input<typeof moderationContentQuerySchema>;\n\n/** `POST /moderation/:contentKind/:contentId/decision`: what is decided on. */\nexport const moderationTargetParamsSchema = z.object({\n contentKind: reportTargetKindSchema,\n contentId: objectIdSchema,\n});\nexport type ModerationTargetParams = z.infer<typeof moderationTargetParamsSchema>;\n\n/** `POST /moderation/:contentKind/:contentId/decision`. */\nexport const moderationDecisionBodySchema = z.object({\n action: moderationActionSchema,\n /** Why, for the audit log. Optional: an obvious spam removal needs no essay. */\n note: optionalTrimmedString(MODERATION_NOTE_MAX),\n});\nexport type ModerationDecisionBody = z.infer<typeof moderationDecisionBodySchema>;\n"]}
|