founder-schema 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +67 -0
  2. package/dist/access/permissions.d.ts +24 -2
  3. package/dist/access/permissions.d.ts.map +1 -1
  4. package/dist/access/permissions.js +9 -0
  5. package/dist/access/permissions.js.map +1 -1
  6. package/dist/core/common.d.ts +44 -0
  7. package/dist/core/common.d.ts.map +1 -1
  8. package/dist/core/common.js +76 -0
  9. package/dist/core/common.js.map +1 -1
  10. package/dist/core/errors.d.ts +29 -1
  11. package/dist/core/errors.d.ts.map +1 -1
  12. package/dist/core/errors.js +52 -1
  13. package/dist/core/errors.js.map +1 -1
  14. package/dist/core/limits.d.ts +53 -0
  15. package/dist/core/limits.d.ts.map +1 -1
  16. package/dist/core/limits.js +57 -0
  17. package/dist/core/limits.js.map +1 -1
  18. package/dist/core/responses.d.ts +43 -0
  19. package/dist/core/responses.d.ts.map +1 -1
  20. package/dist/core/responses.js +3 -1
  21. package/dist/core/responses.js.map +1 -1
  22. package/dist/core/validation.d.ts +14 -0
  23. package/dist/core/validation.d.ts.map +1 -1
  24. package/dist/core/validation.js +14 -0
  25. package/dist/core/validation.js.map +1 -1
  26. package/dist/domains/audit/audit.d.ts +4 -0
  27. package/dist/domains/audit/audit.d.ts.map +1 -1
  28. package/dist/domains/audit/audit.js +6 -3
  29. package/dist/domains/audit/audit.js.map +1 -1
  30. package/dist/domains/contributions/contributions.d.ts +165 -0
  31. package/dist/domains/contributions/contributions.d.ts.map +1 -0
  32. package/dist/domains/contributions/contributions.js +103 -0
  33. package/dist/domains/contributions/contributions.js.map +1 -0
  34. package/dist/domains/discover/discover.d.ts +5 -0
  35. package/dist/domains/discover/discover.d.ts.map +1 -1
  36. package/dist/domains/discover/discover.js +3 -13
  37. package/dist/domains/discover/discover.js.map +1 -1
  38. package/dist/domains/feed/feed.d.ts +231 -7
  39. package/dist/domains/feed/feed.d.ts.map +1 -1
  40. package/dist/domains/feed/feed.js +86 -18
  41. package/dist/domains/feed/feed.js.map +1 -1
  42. package/dist/domains/media/media.d.ts +30 -5
  43. package/dist/domains/media/media.d.ts.map +1 -1
  44. package/dist/domains/media/media.js +32 -6
  45. package/dist/domains/media/media.js.map +1 -1
  46. package/dist/domains/members/members.d.ts +5 -5
  47. package/dist/domains/moderation/moderation.d.ts +53 -3
  48. package/dist/domains/moderation/moderation.d.ts.map +1 -1
  49. package/dist/domains/moderation/moderation.js +47 -8
  50. package/dist/domains/moderation/moderation.js.map +1 -1
  51. package/dist/domains/notifications/notifications.d.ts +212 -0
  52. package/dist/domains/notifications/notifications.d.ts.map +1 -0
  53. package/dist/domains/notifications/notifications.js +148 -0
  54. package/dist/domains/notifications/notifications.js.map +1 -0
  55. package/dist/domains/onboarding/onboarding.d.ts +10 -13
  56. package/dist/domains/onboarding/onboarding.d.ts.map +1 -1
  57. package/dist/domains/onboarding/onboarding.js +6 -5
  58. package/dist/domains/onboarding/onboarding.js.map +1 -1
  59. package/dist/domains/products/products.d.ts +1464 -0
  60. package/dist/domains/products/products.d.ts.map +1 -0
  61. package/dist/domains/products/products.js +474 -0
  62. package/dist/domains/products/products.js.map +1 -0
  63. package/dist/domains/profile/founder-profile.d.ts +43 -0
  64. package/dist/domains/profile/founder-profile.d.ts.map +1 -1
  65. package/dist/domains/profile/founder-profile.js +48 -0
  66. package/dist/domains/profile/founder-profile.js.map +1 -1
  67. package/dist/domains/reviews/reviews.d.ts +184 -0
  68. package/dist/domains/reviews/reviews.d.ts.map +1 -0
  69. package/dist/domains/reviews/reviews.js +99 -0
  70. package/dist/domains/reviews/reviews.js.map +1 -0
  71. package/dist/domains/uploads/uploads.d.ts +2 -0
  72. package/dist/domains/uploads/uploads.d.ts.map +1 -1
  73. package/dist/index.d.ts +10 -6
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +14 -6
  76. package/dist/index.js.map +1 -1
  77. package/package.json +1 -1
@@ -0,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AAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,eAAO,MAAM,0BAA0B;;;;;iBAA4C,CAAC;AACpF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B;;;;;;iBAGxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;;;;iBAAiD,CAAC;AAC7F,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;;iBAAuC,CAAC;AAC9E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -0,0 +1,474 @@
1
+ /**
2
+ * founder-schema — Products: what founders build, and the help around it
3
+ *
4
+ * THE IDEA (the user, 2026-10-06): founders help each other with their
5
+ * products. A founder adds what they build; a post or poll can say which of
6
+ * their products it is about and what they want ("testers wanted"); every
7
+ * comment on it becomes that product's feedback; the community reviews and
8
+ * upvotes it; and the help a member gives is recognised in their contribution
9
+ * score.
10
+ *
11
+ * THE COMPANY STAYS THE PROFILE'S `venture` (one per founder). There are no
12
+ * company pages: co-founders join a PRODUCT's team, as Product Hunt lists a
13
+ * product's makers. Revisit only if one team running many products finds
14
+ * re-inviting each time tedious.
15
+ *
16
+ * VISIBILITY, two states (the user's ruling): `unlisted` by default, a page
17
+ * anyone signed in can open by its link and that shows on its team's profiles;
18
+ * `listed`, also in Discover. Listing needs a logo, a tagline and at least one
19
+ * screenshot (`PRODUCT_NOT_LISTABLE` names what is missing), so Discover never
20
+ * shows an empty card.
21
+ *
22
+ * THE TEAM: an owner, co-founders and team members, joined by invitation and
23
+ * acceptance (nobody is put on a team without saying yes), with no limit on
24
+ * its size (the user's ruling). Who may do what:
25
+ *
26
+ * owner co-founder team
27
+ * edit, images, list, invite ✓ ✓
28
+ * tag posts, reply to reviews, ✓ ✓ ✓
29
+ * mark feedback, confirm testers
30
+ * change roles, remove, hand over ✓
31
+ * archive, delete ✓
32
+ *
33
+ * A product's images belong to the product, not to whoever uploaded them.
34
+ * When the owner deletes their account the product passes to the longest-
35
+ * standing co-founder (else team member); with nobody left it is deleted.
36
+ *
37
+ * Routes (all signed in):
38
+ * GET /api/v1/products Discover: productDiscoverQuerySchema
39
+ * GET /api/v1/products/facets productFacetsSchema
40
+ * POST /api/v1/products createProductBodySchema -> IdResponse
41
+ * GET /api/v1/products/mine myProductsSchema
42
+ * GET /api/v1/products/invites productInvitesSchema
43
+ * PUT /api/v1/products/invites/:productId accept -> productSchema
44
+ * DELETE /api/v1/products/invites/:productId decline -> IdResponse
45
+ * GET /api/v1/products/by-member/:userId productCardPageSchema (their teams)
46
+ * GET /api/v1/products/:productId productSchema
47
+ * PATCH /api/v1/products/:productId updateProductBodySchema -> productSchema
48
+ * DELETE /api/v1/products/:productId -> IdResponse (owner)
49
+ * PUT /api/v1/products/:productId/logo setProductLogoBodySchema -> productSchema
50
+ * DELETE /api/v1/products/:productId/logo -> productSchema
51
+ * PUT /api/v1/products/:productId/screenshots setProductScreenshotsBodySchema -> productSchema
52
+ * PUT /api/v1/products/:productId/visibility setProductVisibilityBodySchema -> productSchema
53
+ * PUT /api/v1/products/:productId/status setProductStatusBodySchema -> productSchema
54
+ * GET /api/v1/products/:productId/team productTeamPageSchema
55
+ * GET /api/v1/products/:productId/invites productPendingInvitePageSchema (managers)
56
+ * POST /api/v1/products/:productId/invites inviteProductMemberBodySchema -> productPendingInviteSchema
57
+ * PUT /api/v1/products/:productId/team/:userId setProductMemberRoleBodySchema -> IdResponse
58
+ * (works on someone still invited too; refetch the team and the invites)
59
+ * DELETE /api/v1/products/:productId/team/:userId remove, cancel an invite, or leave -> IdResponse
60
+ * POST /api/v1/products/:productId/transfer transferProductBodySchema -> productSchema
61
+ * PUT /api/v1/products/:productId/upvote -> productUpvoteResponseSchema
62
+ * DELETE /api/v1/products/:productId/upvote -> productUpvoteResponseSchema
63
+ * GET /api/v1/products/:productId/posts FeedPage (posts and polls tagged with it)
64
+ * GET /api/v1/products/:productId/feedback productFeedbackQuerySchema -> productFeedbackPageSchema (feed)
65
+ * GET /api/v1/products/:productId/testers productTesterPageSchema
66
+ * PUT /api/v1/products/:productId/testers/:userId confirm -> productTesterSchema
67
+ * DELETE /api/v1/products/:productId/testers/:userId withdraw -> IdResponse
68
+ * POST /api/v1/products/:productId/report createReportBodySchema -> CreateReportResponse
69
+ * (reviews: `domains/reviews`)
70
+ *
71
+ * @module founder-schema/domains/products
72
+ */
73
+ import { z } from 'zod';
74
+ import { emptyStringToUndefined, httpUrlOnHosts, httpUrlSchema, industrySchema, multiValueQuery, objectIdSchema, optionalTrimmedString, paginationQuerySchema, productListingRequirementSchema, youtubeVideoId, } from '../../core/common.js';
75
+ import { DISCOVER_FILTER_VALUES_MAX, DISCOVER_TEXT_MAX, PRODUCT_CAPTION_MAX, PRODUCT_DESCRIPTION_MAX, PRODUCT_NAME_MAX, PRODUCT_SCREENSHOTS_MAX, PRODUCT_TAGLINE_MAX, } from '../../core/limits.js';
76
+ import { paginatedSchema } from '../../core/responses.js';
77
+ import { VALIDATION_MESSAGE } from '../../core/validation.js';
78
+ import { mediaImageSchema } from '../media/media.js';
79
+ import { topicSchema } from '../onboarding/onboarding.js';
80
+ import { memberBylineSchema } from '../profile/founder-profile.js';
81
+ /** Topics a product carries, as a post does: what interest matching reads. */
82
+ export const PRODUCT_TOPICS_MAX = 3;
83
+ // ─── Vocabulary ──────────────────────────────────────────────────────────────
84
+ // ⚠ Every list below is STORED. Append only; removing a value orphans rows.
85
+ /**
86
+ * Where the product is in its life. Its own list, deliberately not the
87
+ * venture's funding stage (`startupStageSchema`): "seed" says how a company is
88
+ * funded, "beta" says whether you can use the thing. Ordered earliest first.
89
+ */
90
+ export const PRODUCT_STAGE_VALUES = ['idea', 'building', 'beta', 'live'];
91
+ export const productStageSchema = z.enum(PRODUCT_STAGE_VALUES);
92
+ export const PRODUCT_PLATFORM_VALUES = [
93
+ 'web',
94
+ 'ios',
95
+ 'android',
96
+ 'desktop',
97
+ 'browser_extension',
98
+ 'api',
99
+ 'hardware',
100
+ 'other',
101
+ ];
102
+ export const productPlatformSchema = z.enum(PRODUCT_PLATFORM_VALUES);
103
+ /** `unlisted` (the default) or `listed` in Discover. See the module note. */
104
+ export const PRODUCT_VISIBILITY_VALUES = ['unlisted', 'listed'];
105
+ export const productVisibilitySchema = z.enum(PRODUCT_VISIBILITY_VALUES);
106
+ /**
107
+ * `archived`: kept, readable and still on its team's profiles, but out of
108
+ * Discover and closed to new posts, reviews and upvotes. Restorable.
109
+ */
110
+ export const PRODUCT_STATUS_VALUES = ['active', 'archived'];
111
+ export const productStatusSchema = z.enum(PRODUCT_STATUS_VALUES);
112
+ /** One owner per product; see the module note for what each role may do. */
113
+ export const PRODUCT_TEAM_ROLE_VALUES = ['owner', 'cofounder', 'team'];
114
+ export const productTeamRoleSchema = z.enum(PRODUCT_TEAM_ROLE_VALUES);
115
+ /** The roles an invitation (or a role change) may give. Ownership is handed over, never invited. */
116
+ export const PRODUCT_INVITABLE_ROLE_VALUES = ['cofounder', 'team'];
117
+ export const productInvitableRoleSchema = z.enum(PRODUCT_INVITABLE_ROLE_VALUES);
118
+ /**
119
+ * What a post or poll about a product ASKS of the community. Optional, and
120
+ * only with a product. Each ask keeps the product on that shelf of Discover
121
+ * for `PRODUCT_ASK_OPEN_DAYS`.
122
+ *
123
+ * feedback "tell me what you think"
124
+ * testers "try it": confirmed testers are recognised (`/testers`)
125
+ * launch "it is out"
126
+ * ideas "what should it do next"
127
+ */
128
+ export const PRODUCT_ASK_VALUES = ['feedback', 'testers', 'launch', 'ideas'];
129
+ export const productAskSchema = z.enum(PRODUCT_ASK_VALUES);
130
+ /**
131
+ * Discover's orders.
132
+ *
133
+ * trending recent upvotes, reviews and feedback, newer counting more
134
+ * (recomputed every 15 minutes). The default.
135
+ * new newest first by when it was FIRST listed (unlisting and
136
+ * listing again does not move it back to the top)
137
+ * top_rated best rated, pulled toward a neutral 3 stars by 5 imaginary
138
+ * reviews so a few perfect ratings cannot beat many excellent
139
+ * ones; only products with `REVIEW_AVERAGE_MIN_COUNT` reviews
140
+ */
141
+ export const PRODUCT_SORT_VALUES = ['trending', 'new', 'top_rated'];
142
+ export const productSortSchema = z.enum(PRODUCT_SORT_VALUES);
143
+ /**
144
+ * What listing needs (defined in core, beside the error details that carry it:
145
+ * `PRODUCT_NOT_LISTABLE` returns the missing ones in `details.missing`).
146
+ */
147
+ export { PRODUCT_LISTING_REQUIREMENT_VALUES, productListingRequirementSchema, } from '../../core/common.js';
148
+ // ─── Fields ──────────────────────────────────────────────────────────────────
149
+ /**
150
+ * Where to get it. Every link is member-typed, so every one is
151
+ * `httpUrlSchema`, and the store links must also be ON the store: the
152
+ * hostname is parsed and compared exactly (`httpUrlOnHosts`).
153
+ */
154
+ export const productLinksSchema = z.object({
155
+ website: httpUrlSchema.optional(),
156
+ appStore: httpUrlOnHosts(['apps.apple.com', 'itunes.apple.com'], VALIDATION_MESSAGE.appStoreLinkHost).optional(),
157
+ playStore: httpUrlOnHosts(['play.google.com'], VALIDATION_MESSAGE.playStoreLinkHost).optional(),
158
+ github: httpUrlOnHosts(['github.com', 'www.github.com'], VALIDATION_MESSAGE.githubLinkHost).optional(),
159
+ });
160
+ /**
161
+ * A demo video: a link to one YouTube VIDEO, played in the page (never
162
+ * uploaded). A channel or playlist link is refused: the page cannot embed it
163
+ * (`youtubeVideoId`, 0.7.0).
164
+ */
165
+ export const productVideoUrlSchema = httpUrlSchema.refine((url) => youtubeVideoId(url) !== null, {
166
+ error: VALIDATION_MESSAGE.videoLinkHost,
167
+ });
168
+ const platformsSchema = z
169
+ .array(productPlatformSchema)
170
+ .max(PRODUCT_PLATFORM_VALUES.length)
171
+ .refine((list) => new Set(list).size === list.length, {
172
+ error: VALIDATION_MESSAGE.platformsDuplicate,
173
+ });
174
+ // ─── Read shapes ─────────────────────────────────────────────────────────────
175
+ /**
176
+ * A product named on something else: the chip on a post or poll, a
177
+ * notification, a points entry. `logoUrl` is the logo's smallest size.
178
+ */
179
+ export const productChipSchema = z.object({
180
+ id: objectIdSchema,
181
+ /** For a readable URL, `/products/<id>/<slug>`. The id is what resolves; a renamed product keeps its links. */
182
+ slug: z.string(),
183
+ name: z.string(),
184
+ logoUrl: z.url().optional(),
185
+ });
186
+ /**
187
+ * How it is rated. `average` (one decimal) is null until the product has
188
+ * `REVIEW_AVERAGE_MIN_COUNT` reviews: a client shows "Not enough reviews yet",
189
+ * never a lone 5.0 from one friend.
190
+ */
191
+ export const productRatingSchema = z.object({
192
+ count: z.number().int().nonnegative(),
193
+ average: z.number().min(1).max(5).nullable(),
194
+ });
195
+ /** One screenshot: a processed image (every size, ready for `srcset`) and its caption. */
196
+ export const productScreenshotSchema = mediaImageSchema.extend({
197
+ caption: z.string().max(PRODUCT_CAPTION_MAX).optional(),
198
+ });
199
+ /** What this viewer may do on a Discover card. */
200
+ export const productCardViewerSchema = z.object({
201
+ upvoted: z.boolean(),
202
+ /** Not on its team, and the product is open (not archived). */
203
+ canUpvote: z.boolean(),
204
+ /** Their role on its team, or null. */
205
+ role: productTeamRoleSchema.nullable(),
206
+ /**
207
+ * They may act FOR it now (0.7.0): on its team, and it is neither archived
208
+ * nor hidden by staff. The server's own rule, for a picker such as the
209
+ * composer's "about which product" (the page's `viewer.canRepresent`).
210
+ */
211
+ canRepresent: z.boolean().optional(),
212
+ });
213
+ /**
214
+ * A product on Discover, on a profile, in "my products". `cover` is the first
215
+ * screenshot. `openAsks` are the asks whose window is open now, by the
216
+ * server's clock ("Testers wanted").
217
+ */
218
+ export const productCardSchema = z.object({
219
+ id: objectIdSchema,
220
+ slug: z.string(),
221
+ name: z.string(),
222
+ tagline: z.string().optional(),
223
+ logo: mediaImageSchema.optional(),
224
+ cover: mediaImageSchema.optional(),
225
+ industry: industrySchema,
226
+ stage: productStageSchema,
227
+ platforms: z.array(productPlatformSchema),
228
+ visibility: productVisibilitySchema,
229
+ status: productStatusSchema,
230
+ rating: productRatingSchema,
231
+ upvoteCount: z.number().int().nonnegative(),
232
+ openAsks: z.array(productAskSchema),
233
+ /**
234
+ * Staff hid it (0.7.0). Only ever on a card its team or staff can see (in
235
+ * "my products", on a team member's profile): a "Hidden by moderators" badge.
236
+ */
237
+ hiddenByStaff: z.boolean().optional(),
238
+ viewer: productCardViewerSchema.optional(),
239
+ });
240
+ /** One person on a product's team, live-joined like every byline. */
241
+ export const productTeamMemberSchema = memberBylineSchema.extend({
242
+ role: productTeamRoleSchema,
243
+ /** When they accepted (or, for the owner, created the product). */
244
+ joinedAt: z.iso.datetime(),
245
+ });
246
+ /**
247
+ * What THIS viewer may do on the product page, decided by the server and sent
248
+ * as plain answers (the same rule as `viewerStateSchema` on a post).
249
+ */
250
+ export const productViewerSchema = productCardViewerSchema.extend({
251
+ /** An invitation to the team is waiting for them: offer Accept / Decline. */
252
+ invited: z.boolean(),
253
+ /** Their own review of it, if any, so the page offers Edit instead of Write. */
254
+ reviewId: objectIdSchema.nullable(),
255
+ /** The team confirmed them as a tester. */
256
+ tester: z.boolean(),
257
+ /** Owner and co-founders: details, images, listing, invitations. */
258
+ canEdit: z.boolean(),
259
+ /** Owner: roles, removals, handing over. */
260
+ canManageTeam: z.boolean(),
261
+ /** Owner. */
262
+ canDelete: z.boolean(),
263
+ /** Anyone on the team: tag posts with it, reply to reviews, mark feedback, confirm testers. */
264
+ canRepresent: z.boolean(),
265
+ /** Not on its team, no review yet, and the product is open. */
266
+ canReview: z.boolean(),
267
+ canReport: z.boolean(),
268
+ /**
269
+ * For whoever may edit: what listing still needs. Empty means it can be
270
+ * listed (or already is). Lets the page show a checklist before the member
271
+ * tries and is refused.
272
+ */
273
+ missingForListing: z.array(productListingRequirementSchema),
274
+ });
275
+ /** The product page. */
276
+ export const productSchema = productCardSchema.extend({
277
+ description: z.string().optional(),
278
+ links: productLinksSchema,
279
+ videoUrl: z.string().optional(),
280
+ topics: z.array(topicSchema).max(PRODUCT_TOPICS_MAX),
281
+ screenshots: z.array(productScreenshotSchema).max(PRODUCT_SCREENSHOTS_MAX),
282
+ /** The owner first, then co-founders, then the team, each by when they joined; at most `PRODUCT_TEAM_SHOWN`. */
283
+ team: z.array(productTeamMemberSchema),
284
+ teamCount: z.number().int().nonnegative(),
285
+ counts: z.object({
286
+ /** Posts and polls tagged with it. */
287
+ posts: z.number().int().nonnegative(),
288
+ /** Comments on those from people outside its team: what the Feedback tab lists. */
289
+ feedback: z.number().int().nonnegative(),
290
+ /** Members the team confirmed as testers. */
291
+ testers: z.number().int().nonnegative(),
292
+ }),
293
+ listedAt: z.iso.datetime().nullable(),
294
+ createdAt: z.iso.datetime(),
295
+ updatedAt: z.iso.datetime(),
296
+ /**
297
+ * Only for its team and for staff: staff hid it, so everyone else gets 404.
298
+ * The page tells the team why it vanished from Discover.
299
+ */
300
+ hiddenByStaff: z.boolean().optional(),
301
+ viewer: productViewerSchema.optional(),
302
+ });
303
+ /**
304
+ * An invitation the team sent and nobody has answered yet, as its managers see
305
+ * it (`GET /products/:id/invites`): who, for what role, sent by whom. The owner
306
+ * may change its role (`PUT /team/:userId`) or cancel it (`DELETE /team/:userId`).
307
+ */
308
+ export const productPendingInviteSchema = z.object({
309
+ member: memberBylineSchema,
310
+ role: productInvitableRoleSchema,
311
+ /** Null when whoever invited has since deleted their account. */
312
+ invitedBy: memberBylineSchema.nullable(),
313
+ invitedAt: z.iso.datetime(),
314
+ });
315
+ /** A team invitation waiting for the viewer's answer. */
316
+ export const productInviteSchema = z.object({
317
+ product: productChipSchema.extend({ tagline: z.string().optional() }),
318
+ role: productInvitableRoleSchema,
319
+ /** Null when whoever invited has since deleted their account. */
320
+ invitedBy: memberBylineSchema.nullable(),
321
+ invitedAt: z.iso.datetime(),
322
+ });
323
+ /** `GET /products/invites`. Never paged: invitations are few, and each needs an answer. */
324
+ export const productInvitesSchema = z.object({ items: z.array(productInviteSchema) });
325
+ /**
326
+ * `GET /products/mine`: every product the viewer is on the team of, archived
327
+ * included, owned first. Not paged: a founder owns at most `PRODUCTS_OWNED_MAX`,
328
+ * and joins teams by accepting invitations one at a time, so the list stays
329
+ * short in practice; there is no hard cap on teams joined.
330
+ */
331
+ export const myProductsSchema = z.object({ items: z.array(productCardSchema) });
332
+ /** A member the team confirmed tested the product. */
333
+ export const productTesterSchema = z.object({
334
+ member: memberBylineSchema,
335
+ confirmedAt: z.iso.datetime(),
336
+ });
337
+ export const productCardPageSchema = paginatedSchema(productCardSchema);
338
+ export const productTeamPageSchema = paginatedSchema(productTeamMemberSchema);
339
+ export const productTesterPageSchema = paginatedSchema(productTesterSchema);
340
+ /** Co-founder invitations first, then team; within each, the oldest invitation first. */
341
+ export const productPendingInvitePageSchema = paginatedSchema(productPendingInviteSchema);
342
+ /** `PUT|DELETE /products/:id/upvote`: the state it settled on and the fresh count. */
343
+ export const productUpvoteResponseSchema = z.object({
344
+ productId: objectIdSchema,
345
+ upvoted: z.boolean(),
346
+ upvoteCount: z.number().int().nonnegative(),
347
+ });
348
+ /**
349
+ * Discover's filter drawer for products: every value with how many LISTED
350
+ * products match, zero counts included, in the list's own order.
351
+ */
352
+ const facetSchema = (value) => z.array(z.object({ value, count: z.number().int().nonnegative() }));
353
+ export const productFacetsSchema = z.object({
354
+ industries: facetSchema(industrySchema),
355
+ stages: facetSchema(productStageSchema),
356
+ platforms: facetSchema(productPlatformSchema),
357
+ asks: facetSchema(productAskSchema),
358
+ });
359
+ // ─── Queries and params ──────────────────────────────────────────────────────
360
+ /** A Discover multi-select (`?industry=a&industry=b`): see `multiValueQuery`. */
361
+ const multiValue = (inner) => multiValueQuery(inner, DISCOVER_FILTER_VALUES_MAX);
362
+ /**
363
+ * `GET /api/v1/products`: LISTED products only. Filters of one kind mean "any
364
+ * of", different kinds combine ("fintech AND beta"). `ask` keeps products
365
+ * whose ask is open now. `q` matches the start of the name; an emptied box
366
+ * (`?q=`) is no search, never a 400.
367
+ */
368
+ export const productDiscoverQuerySchema = paginationQuerySchema.extend({
369
+ sort: z.preprocess(emptyStringToUndefined, productSortSchema.default('trending')),
370
+ q: optionalTrimmedString(DISCOVER_TEXT_MAX),
371
+ industry: multiValue(industrySchema),
372
+ stage: multiValue(productStageSchema),
373
+ platform: multiValue(productPlatformSchema),
374
+ ask: z.preprocess(emptyStringToUndefined, productAskSchema.optional()),
375
+ });
376
+ /**
377
+ * `GET /products/:id/feedback`: comments from outside its team on the posts
378
+ * and polls tagged with it, newest first. `helpful=true` narrows to the ones
379
+ * the team marked as having helped.
380
+ */
381
+ export const productFeedbackQuerySchema = paginationQuerySchema.extend({
382
+ helpful: z.preprocess(emptyStringToUndefined, z.stringbool().default(false)),
383
+ });
384
+ export const productParamsSchema = z.object({ productId: objectIdSchema });
385
+ /** `/products/:productId/team/:userId`, `/products/:productId/testers/:userId`. */
386
+ export const productMemberParamsSchema = z.object({
387
+ productId: objectIdSchema,
388
+ userId: objectIdSchema,
389
+ });
390
+ /** `/products/by-member/:userId`. */
391
+ export const productsByMemberParamsSchema = z.object({ userId: objectIdSchema });
392
+ // ─── Write bodies ────────────────────────────────────────────────────────────
393
+ // Each its own object with NO defaults (see `updateFounderProfileBodySchema`).
394
+ /** A screenshot on the way in: an uploaded, processed image id, and its caption. */
395
+ export const productScreenshotInputSchema = z.object({
396
+ mediaId: objectIdSchema,
397
+ caption: z.string().trim().max(PRODUCT_CAPTION_MAX).optional(),
398
+ });
399
+ const screenshotsInputSchema = z
400
+ .array(productScreenshotInputSchema)
401
+ .max(PRODUCT_SCREENSHOTS_MAX)
402
+ .refine((list) => new Set(list.map((s) => s.mediaId)).size === list.length, {
403
+ error: VALIDATION_MESSAGE.screenshotsDuplicate,
404
+ });
405
+ /**
406
+ * `POST /api/v1/products`. Starts `unlisted`, owned by the caller. The logo
407
+ * and screenshots may come now or later (uploaded first, purpose
408
+ * `product_logo` / `product_screenshot`, like a post's images).
409
+ */
410
+ export const createProductBodySchema = z.object({
411
+ name: z.string().trim().min(1).max(PRODUCT_NAME_MAX),
412
+ tagline: z.string().trim().min(1).max(PRODUCT_TAGLINE_MAX).optional(),
413
+ description: z.string().trim().min(1).max(PRODUCT_DESCRIPTION_MAX).optional(),
414
+ industry: industrySchema,
415
+ stage: productStageSchema,
416
+ platforms: platformsSchema.optional(),
417
+ topics: z.array(topicSchema).max(PRODUCT_TOPICS_MAX).optional(),
418
+ links: productLinksSchema.optional(),
419
+ videoUrl: productVideoUrlSchema.optional(),
420
+ logoMediaId: objectIdSchema.optional(),
421
+ screenshots: screenshotsInputSchema.optional(),
422
+ });
423
+ /** Text the editor may empty: absent leaves it, `null` clears it, `""` is refused. */
424
+ const clearable = (inner) => inner.nullable().optional();
425
+ /**
426
+ * `PATCH /api/v1/products/:id`: only the keys that changed. Images, listing
427
+ * and status have their own routes. `links` is sent whole.
428
+ */
429
+ export const updateProductBodySchema = z.object({
430
+ name: z.string().trim().min(1).max(PRODUCT_NAME_MAX).optional(),
431
+ tagline: clearable(z.string().trim().min(1, VALIDATION_MESSAGE.clearWithNull).max(PRODUCT_TAGLINE_MAX)),
432
+ description: clearable(z.string().trim().min(1, VALIDATION_MESSAGE.clearWithNull).max(PRODUCT_DESCRIPTION_MAX)),
433
+ industry: industrySchema.optional(),
434
+ stage: productStageSchema.optional(),
435
+ platforms: platformsSchema.optional(),
436
+ topics: z.array(topicSchema).max(PRODUCT_TOPICS_MAX).optional(),
437
+ links: productLinksSchema.optional(),
438
+ videoUrl: clearable(productVideoUrlSchema),
439
+ });
440
+ /** `PUT /products/:id/logo`: a processed `product_logo` upload. The old logo's files are deleted. */
441
+ export const setProductLogoBodySchema = z.object({ mediaId: objectIdSchema });
442
+ /**
443
+ * `PUT /products/:id/screenshots`: the WHOLE gallery as it should now be, in
444
+ * order. One call adds, removes, reorders and re-captions: screenshots already
445
+ * on the product stay; new ids must be the caller's processed
446
+ * `product_screenshot` uploads; any left out are deleted from storage.
447
+ */
448
+ export const setProductScreenshotsBodySchema = z.object({ screenshots: screenshotsInputSchema });
449
+ export const setProductVisibilityBodySchema = z.object({ visibility: productVisibilitySchema });
450
+ export const setProductStatusBodySchema = z.object({ status: productStatusSchema });
451
+ /**
452
+ * Invite a member to the team; they must accept. `userId` is the member's id
453
+ * as every card carries it (`founderCardSchema.userId`). Someone who cannot
454
+ * join (has not finished onboarding, paused, suspended, deleted) is
455
+ * `PRODUCT_MEMBER_NOT_INVITABLE`; someone already on it or invited,
456
+ * `PRODUCT_ALREADY_MEMBER`.
457
+ */
458
+ export const inviteProductMemberBodySchema = z.object({
459
+ userId: objectIdSchema,
460
+ role: productInvitableRoleSchema,
461
+ });
462
+ /**
463
+ * The owner changes someone's role (on the team or still invited). The
464
+ * owner's own role changes only by handing over (`PRODUCT_OWNER_MUST_TRANSFER`);
465
+ * someone not on the team or invited is `PRODUCT_NOT_ON_TEAM`.
466
+ */
467
+ export const setProductMemberRoleBodySchema = z.object({ role: productInvitableRoleSchema });
468
+ /**
469
+ * The owner hands the product to someone already on its team (not merely
470
+ * invited: `PRODUCT_NOT_ON_TEAM`), who must have room under
471
+ * `PRODUCTS_OWNED_MAX` (`PRODUCT_LIMIT_REACHED`). The old owner becomes a co-founder.
472
+ */
473
+ export const transferProductBodySchema = z.object({ userId: objectIdSchema });
474
+ //# sourceMappingURL=products.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"products.js","sourceRoot":"","sources":["../../../src/domains/products/products.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,aAAa,EACb,cAAc,EACd,e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AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,MAAM,EAAE,cAAc;IACtB,IAAI,EAAE,0BAA0B;CACjC,CAAC,CAAC;AAGH;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC,CAAC;AAG7F;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — Products: what founders build, and the help around it\n *\n * THE IDEA (the user, 2026-10-06): founders help each other with their\n * products. A founder adds what they build; a post or poll can say which of\n * their products it is about and what they want (\"testers wanted\"); every\n * comment on it becomes that product's feedback; the community reviews and\n * upvotes it; and the help a member gives is recognised in their contribution\n * score.\n *\n * THE COMPANY STAYS THE PROFILE'S `venture` (one per founder). There are no\n * company pages: co-founders join a PRODUCT's team, as Product Hunt lists a\n * product's makers. Revisit only if one team running many products finds\n * re-inviting each time tedious.\n *\n * VISIBILITY, two states (the user's ruling): `unlisted` by default, a page\n * anyone signed in can open by its link and that shows on its team's profiles;\n * `listed`, also in Discover. Listing needs a logo, a tagline and at least one\n * screenshot (`PRODUCT_NOT_LISTABLE` names what is missing), so Discover never\n * shows an empty card.\n *\n * THE TEAM: an owner, co-founders and team members, joined by invitation and\n * acceptance (nobody is put on a team without saying yes), with no limit on\n * its size (the user's ruling). Who may do what:\n *\n * owner co-founder team\n * edit, images, list, invite ✓ ✓\n * tag posts, reply to reviews, ✓ ✓ ✓\n * mark feedback, confirm testers\n * change roles, remove, hand over ✓\n * archive, delete ✓\n *\n * A product's images belong to the product, not to whoever uploaded them.\n * When the owner deletes their account the product passes to the longest-\n * standing co-founder (else team member); with nobody left it is deleted.\n *\n * Routes (all signed in):\n * GET /api/v1/products Discover: productDiscoverQuerySchema\n * GET /api/v1/products/facets productFacetsSchema\n * POST /api/v1/products createProductBodySchema -> IdResponse\n * GET /api/v1/products/mine myProductsSchema\n * GET /api/v1/products/invites productInvitesSchema\n * PUT /api/v1/products/invites/:productId accept -> productSchema\n * DELETE /api/v1/products/invites/:productId decline -> IdResponse\n * GET /api/v1/products/by-member/:userId productCardPageSchema (their teams)\n * GET /api/v1/products/:productId productSchema\n * PATCH /api/v1/products/:productId updateProductBodySchema -> productSchema\n * DELETE /api/v1/products/:productId -> IdResponse (owner)\n * PUT /api/v1/products/:productId/logo setProductLogoBodySchema -> productSchema\n * DELETE /api/v1/products/:productId/logo -> productSchema\n * PUT /api/v1/products/:productId/screenshots setProductScreenshotsBodySchema -> productSchema\n * PUT /api/v1/products/:productId/visibility setProductVisibilityBodySchema -> productSchema\n * PUT /api/v1/products/:productId/status setProductStatusBodySchema -> productSchema\n * GET /api/v1/products/:productId/team productTeamPageSchema\n * GET /api/v1/products/:productId/invites productPendingInvitePageSchema (managers)\n * POST /api/v1/products/:productId/invites inviteProductMemberBodySchema -> productPendingInviteSchema\n * PUT /api/v1/products/:productId/team/:userId setProductMemberRoleBodySchema -> IdResponse\n * (works on someone still invited too; refetch the team and the invites)\n * DELETE /api/v1/products/:productId/team/:userId remove, cancel an invite, or leave -> IdResponse\n * POST /api/v1/products/:productId/transfer transferProductBodySchema -> productSchema\n * PUT /api/v1/products/:productId/upvote -> productUpvoteResponseSchema\n * DELETE /api/v1/products/:productId/upvote -> productUpvoteResponseSchema\n * GET /api/v1/products/:productId/posts FeedPage (posts and polls tagged with it)\n * GET /api/v1/products/:productId/feedback productFeedbackQuerySchema -> productFeedbackPageSchema (feed)\n * GET /api/v1/products/:productId/testers productTesterPageSchema\n * PUT /api/v1/products/:productId/testers/:userId confirm -> productTesterSchema\n * DELETE /api/v1/products/:productId/testers/:userId withdraw -> IdResponse\n * POST /api/v1/products/:productId/report createReportBodySchema -> CreateReportResponse\n * (reviews: `domains/reviews`)\n *\n * @module founder-schema/domains/products\n */\n\nimport { z } from 'zod';\nimport {\n emptyStringToUndefined,\n httpUrlOnHosts,\n httpUrlSchema,\n industrySchema,\n multiValueQuery,\n objectIdSchema,\n optionalTrimmedString,\n paginationQuerySchema,\n productListingRequirementSchema,\n youtubeVideoId,\n} from '../../core/common.js';\nimport {\n DISCOVER_FILTER_VALUES_MAX,\n DISCOVER_TEXT_MAX,\n PRODUCT_CAPTION_MAX,\n PRODUCT_DESCRIPTION_MAX,\n PRODUCT_NAME_MAX,\n PRODUCT_SCREENSHOTS_MAX,\n PRODUCT_TAGLINE_MAX,\n} from '../../core/limits.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { VALIDATION_MESSAGE } from '../../core/validation.js';\nimport { mediaImageSchema } from '../media/media.js';\nimport { topicSchema } from '../onboarding/onboarding.js';\nimport { memberBylineSchema } from '../profile/founder-profile.js';\n\n/** Topics a product carries, as a post does: what interest matching reads. */\nexport const PRODUCT_TOPICS_MAX = 3;\n\n// ─── Vocabulary ──────────────────────────────────────────────────────────────\n// ⚠ Every list below is STORED. Append only; removing a value orphans rows.\n\n/**\n * Where the product is in its life. Its own list, deliberately not the\n * venture's funding stage (`startupStageSchema`): \"seed\" says how a company is\n * funded, \"beta\" says whether you can use the thing. Ordered earliest first.\n */\nexport const PRODUCT_STAGE_VALUES = ['idea', 'building', 'beta', 'live'] as const;\nexport const productStageSchema = z.enum(PRODUCT_STAGE_VALUES);\nexport type ProductStage = z.infer<typeof productStageSchema>;\n\nexport const PRODUCT_PLATFORM_VALUES = [\n 'web',\n 'ios',\n 'android',\n 'desktop',\n 'browser_extension',\n 'api',\n 'hardware',\n 'other',\n] as const;\nexport const productPlatformSchema = z.enum(PRODUCT_PLATFORM_VALUES);\nexport type ProductPlatform = z.infer<typeof productPlatformSchema>;\n\n/** `unlisted` (the default) or `listed` in Discover. See the module note. */\nexport const PRODUCT_VISIBILITY_VALUES = ['unlisted', 'listed'] as const;\nexport const productVisibilitySchema = z.enum(PRODUCT_VISIBILITY_VALUES);\nexport type ProductVisibility = z.infer<typeof productVisibilitySchema>;\n\n/**\n * `archived`: kept, readable and still on its team's profiles, but out of\n * Discover and closed to new posts, reviews and upvotes. Restorable.\n */\nexport const PRODUCT_STATUS_VALUES = ['active', 'archived'] as const;\nexport const productStatusSchema = z.enum(PRODUCT_STATUS_VALUES);\nexport type ProductStatus = z.infer<typeof productStatusSchema>;\n\n/** One owner per product; see the module note for what each role may do. */\nexport const PRODUCT_TEAM_ROLE_VALUES = ['owner', 'cofounder', 'team'] as const;\nexport const productTeamRoleSchema = z.enum(PRODUCT_TEAM_ROLE_VALUES);\nexport type ProductTeamRole = z.infer<typeof productTeamRoleSchema>;\n\n/** The roles an invitation (or a role change) may give. Ownership is handed over, never invited. */\nexport const PRODUCT_INVITABLE_ROLE_VALUES = ['cofounder', 'team'] as const;\nexport const productInvitableRoleSchema = z.enum(PRODUCT_INVITABLE_ROLE_VALUES);\nexport type ProductInvitableRole = z.infer<typeof productInvitableRoleSchema>;\n\n/**\n * What a post or poll about a product ASKS of the community. Optional, and\n * only with a product. Each ask keeps the product on that shelf of Discover\n * for `PRODUCT_ASK_OPEN_DAYS`.\n *\n * feedback \"tell me what you think\"\n * testers \"try it\": confirmed testers are recognised (`/testers`)\n * launch \"it is out\"\n * ideas \"what should it do next\"\n */\nexport const PRODUCT_ASK_VALUES = ['feedback', 'testers', 'launch', 'ideas'] as const;\nexport const productAskSchema = z.enum(PRODUCT_ASK_VALUES);\nexport type ProductAsk = z.infer<typeof productAskSchema>;\n\n/**\n * Discover's orders.\n *\n * trending recent upvotes, reviews and feedback, newer counting more\n * (recomputed every 15 minutes). The default.\n * new newest first by when it was FIRST listed (unlisting and\n * listing again does not move it back to the top)\n * top_rated best rated, pulled toward a neutral 3 stars by 5 imaginary\n * reviews so a few perfect ratings cannot beat many excellent\n * ones; only products with `REVIEW_AVERAGE_MIN_COUNT` reviews\n */\nexport const PRODUCT_SORT_VALUES = ['trending', 'new', 'top_rated'] as const;\nexport const productSortSchema = z.enum(PRODUCT_SORT_VALUES);\nexport type ProductSort = z.infer<typeof productSortSchema>;\n\n/**\n * What listing needs (defined in core, beside the error details that carry it:\n * `PRODUCT_NOT_LISTABLE` returns the missing ones in `details.missing`).\n */\nexport {\n PRODUCT_LISTING_REQUIREMENT_VALUES,\n type ProductListingRequirement,\n productListingRequirementSchema,\n} from '../../core/common.js';\n\n// ─── Fields ──────────────────────────────────────────────────────────────────\n\n/**\n * Where to get it. Every link is member-typed, so every one is\n * `httpUrlSchema`, and the store links must also be ON the store: the\n * hostname is parsed and compared exactly (`httpUrlOnHosts`).\n */\nexport const productLinksSchema = z.object({\n website: httpUrlSchema.optional(),\n appStore: httpUrlOnHosts(\n ['apps.apple.com', 'itunes.apple.com'],\n VALIDATION_MESSAGE.appStoreLinkHost,\n ).optional(),\n playStore: httpUrlOnHosts(['play.google.com'], VALIDATION_MESSAGE.playStoreLinkHost).optional(),\n github: httpUrlOnHosts(\n ['github.com', 'www.github.com'],\n VALIDATION_MESSAGE.githubLinkHost,\n ).optional(),\n});\nexport type ProductLinks = z.infer<typeof productLinksSchema>;\n\n/**\n * A demo video: a link to one YouTube VIDEO, played in the page (never\n * uploaded). A channel or playlist link is refused: the page cannot embed it\n * (`youtubeVideoId`, 0.7.0).\n */\nexport const productVideoUrlSchema = httpUrlSchema.refine((url) => youtubeVideoId(url) !== null, {\n error: VALIDATION_MESSAGE.videoLinkHost,\n});\n\nconst platformsSchema = z\n .array(productPlatformSchema)\n .max(PRODUCT_PLATFORM_VALUES.length)\n .refine((list) => new Set(list).size === list.length, {\n error: VALIDATION_MESSAGE.platformsDuplicate,\n });\n\n// ─── Read shapes ─────────────────────────────────────────────────────────────\n\n/**\n * A product named on something else: the chip on a post or poll, a\n * notification, a points entry. `logoUrl` is the logo's smallest size.\n */\nexport const productChipSchema = z.object({\n id: objectIdSchema,\n /** For a readable URL, `/products/<id>/<slug>`. The id is what resolves; a renamed product keeps its links. */\n slug: z.string(),\n name: z.string(),\n logoUrl: z.url().optional(),\n});\nexport type ProductChip = z.infer<typeof productChipSchema>;\n\n/**\n * How it is rated. `average` (one decimal) is null until the product has\n * `REVIEW_AVERAGE_MIN_COUNT` reviews: a client shows \"Not enough reviews yet\",\n * never a lone 5.0 from one friend.\n */\nexport const productRatingSchema = z.object({\n count: z.number().int().nonnegative(),\n average: z.number().min(1).max(5).nullable(),\n});\nexport type ProductRating = z.infer<typeof productRatingSchema>;\n\n/** One screenshot: a processed image (every size, ready for `srcset`) and its caption. */\nexport const productScreenshotSchema = mediaImageSchema.extend({\n caption: z.string().max(PRODUCT_CAPTION_MAX).optional(),\n});\nexport type ProductScreenshot = z.infer<typeof productScreenshotSchema>;\n\n/** What this viewer may do on a Discover card. */\nexport const productCardViewerSchema = z.object({\n upvoted: z.boolean(),\n /** Not on its team, and the product is open (not archived). */\n canUpvote: z.boolean(),\n /** Their role on its team, or null. */\n role: productTeamRoleSchema.nullable(),\n /**\n * They may act FOR it now (0.7.0): on its team, and it is neither archived\n * nor hidden by staff. The server's own rule, for a picker such as the\n * composer's \"about which product\" (the page's `viewer.canRepresent`).\n */\n canRepresent: z.boolean().optional(),\n});\n\n/**\n * A product on Discover, on a profile, in \"my products\". `cover` is the first\n * screenshot. `openAsks` are the asks whose window is open now, by the\n * server's clock (\"Testers wanted\").\n */\nexport const productCardSchema = z.object({\n id: objectIdSchema,\n slug: z.string(),\n name: z.string(),\n tagline: z.string().optional(),\n logo: mediaImageSchema.optional(),\n cover: mediaImageSchema.optional(),\n industry: industrySchema,\n stage: productStageSchema,\n platforms: z.array(productPlatformSchema),\n visibility: productVisibilitySchema,\n status: productStatusSchema,\n rating: productRatingSchema,\n upvoteCount: z.number().int().nonnegative(),\n openAsks: z.array(productAskSchema),\n /**\n * Staff hid it (0.7.0). Only ever on a card its team or staff can see (in\n * \"my products\", on a team member's profile): a \"Hidden by moderators\" badge.\n */\n hiddenByStaff: z.boolean().optional(),\n viewer: productCardViewerSchema.optional(),\n});\nexport type ProductCard = z.infer<typeof productCardSchema>;\n\n/** One person on a product's team, live-joined like every byline. */\nexport const productTeamMemberSchema = memberBylineSchema.extend({\n role: productTeamRoleSchema,\n /** When they accepted (or, for the owner, created the product). */\n joinedAt: z.iso.datetime(),\n});\nexport type ProductTeamMember = z.infer<typeof productTeamMemberSchema>;\n\n/**\n * What THIS viewer may do on the product page, decided by the server and sent\n * as plain answers (the same rule as `viewerStateSchema` on a post).\n */\nexport const productViewerSchema = productCardViewerSchema.extend({\n /** An invitation to the team is waiting for them: offer Accept / Decline. */\n invited: z.boolean(),\n /** Their own review of it, if any, so the page offers Edit instead of Write. */\n reviewId: objectIdSchema.nullable(),\n /** The team confirmed them as a tester. */\n tester: z.boolean(),\n /** Owner and co-founders: details, images, listing, invitations. */\n canEdit: z.boolean(),\n /** Owner: roles, removals, handing over. */\n canManageTeam: z.boolean(),\n /** Owner. */\n canDelete: z.boolean(),\n /** Anyone on the team: tag posts with it, reply to reviews, mark feedback, confirm testers. */\n canRepresent: z.boolean(),\n /** Not on its team, no review yet, and the product is open. */\n canReview: z.boolean(),\n canReport: z.boolean(),\n /**\n * For whoever may edit: what listing still needs. Empty means it can be\n * listed (or already is). Lets the page show a checklist before the member\n * tries and is refused.\n */\n missingForListing: z.array(productListingRequirementSchema),\n});\nexport type ProductViewer = z.infer<typeof productViewerSchema>;\n\n/** The product page. */\nexport const productSchema = productCardSchema.extend({\n description: z.string().optional(),\n links: productLinksSchema,\n videoUrl: z.string().optional(),\n topics: z.array(topicSchema).max(PRODUCT_TOPICS_MAX),\n screenshots: z.array(productScreenshotSchema).max(PRODUCT_SCREENSHOTS_MAX),\n /** The owner first, then co-founders, then the team, each by when they joined; at most `PRODUCT_TEAM_SHOWN`. */\n team: z.array(productTeamMemberSchema),\n teamCount: z.number().int().nonnegative(),\n counts: z.object({\n /** Posts and polls tagged with it. */\n posts: z.number().int().nonnegative(),\n /** Comments on those from people outside its team: what the Feedback tab lists. */\n feedback: z.number().int().nonnegative(),\n /** Members the team confirmed as testers. */\n testers: z.number().int().nonnegative(),\n }),\n listedAt: z.iso.datetime().nullable(),\n createdAt: z.iso.datetime(),\n updatedAt: z.iso.datetime(),\n /**\n * Only for its team and for staff: staff hid it, so everyone else gets 404.\n * The page tells the team why it vanished from Discover.\n */\n hiddenByStaff: z.boolean().optional(),\n viewer: productViewerSchema.optional(),\n});\nexport type Product = z.infer<typeof productSchema>;\n\n/**\n * An invitation the team sent and nobody has answered yet, as its managers see\n * it (`GET /products/:id/invites`): who, for what role, sent by whom. The owner\n * may change its role (`PUT /team/:userId`) or cancel it (`DELETE /team/:userId`).\n */\nexport const productPendingInviteSchema = z.object({\n member: memberBylineSchema,\n role: productInvitableRoleSchema,\n /** Null when whoever invited has since deleted their account. */\n invitedBy: memberBylineSchema.nullable(),\n invitedAt: z.iso.datetime(),\n});\nexport type ProductPendingInvite = z.infer<typeof productPendingInviteSchema>;\n\n/** A team invitation waiting for the viewer's answer. */\nexport const productInviteSchema = z.object({\n product: productChipSchema.extend({ tagline: z.string().optional() }),\n role: productInvitableRoleSchema,\n /** Null when whoever invited has since deleted their account. */\n invitedBy: memberBylineSchema.nullable(),\n invitedAt: z.iso.datetime(),\n});\nexport type ProductInvite = z.infer<typeof productInviteSchema>;\n\n/** `GET /products/invites`. Never paged: invitations are few, and each needs an answer. */\nexport const productInvitesSchema = z.object({ items: z.array(productInviteSchema) });\nexport type ProductInvites = z.infer<typeof productInvitesSchema>;\n\n/**\n * `GET /products/mine`: every product the viewer is on the team of, archived\n * included, owned first. Not paged: a founder owns at most `PRODUCTS_OWNED_MAX`,\n * and joins teams by accepting invitations one at a time, so the list stays\n * short in practice; there is no hard cap on teams joined.\n */\nexport const myProductsSchema = z.object({ items: z.array(productCardSchema) });\nexport type MyProducts = z.infer<typeof myProductsSchema>;\n\n/** A member the team confirmed tested the product. */\nexport const productTesterSchema = z.object({\n member: memberBylineSchema,\n confirmedAt: z.iso.datetime(),\n});\nexport type ProductTester = z.infer<typeof productTesterSchema>;\n\nexport const productCardPageSchema = paginatedSchema(productCardSchema);\nexport type ProductCardPage = z.infer<typeof productCardPageSchema>;\nexport const productTeamPageSchema = paginatedSchema(productTeamMemberSchema);\nexport type ProductTeamPage = z.infer<typeof productTeamPageSchema>;\nexport const productTesterPageSchema = paginatedSchema(productTesterSchema);\nexport type ProductTesterPage = z.infer<typeof productTesterPageSchema>;\n/** Co-founder invitations first, then team; within each, the oldest invitation first. */\nexport const productPendingInvitePageSchema = paginatedSchema(productPendingInviteSchema);\nexport type ProductPendingInvitePage = z.infer<typeof productPendingInvitePageSchema>;\n\n/** `PUT|DELETE /products/:id/upvote`: the state it settled on and the fresh count. */\nexport const productUpvoteResponseSchema = z.object({\n productId: objectIdSchema,\n upvoted: z.boolean(),\n upvoteCount: z.number().int().nonnegative(),\n});\nexport type ProductUpvoteResponse = z.infer<typeof productUpvoteResponseSchema>;\n\n/**\n * Discover's filter drawer for products: every value with how many LISTED\n * products match, zero counts included, in the list's own order.\n */\nconst facetSchema = <T extends z.ZodType>(value: T) =>\n z.array(z.object({ value, count: z.number().int().nonnegative() }));\nexport const productFacetsSchema = z.object({\n industries: facetSchema(industrySchema),\n stages: facetSchema(productStageSchema),\n platforms: facetSchema(productPlatformSchema),\n asks: facetSchema(productAskSchema),\n});\nexport type ProductFacets = z.infer<typeof productFacetsSchema>;\n\n// ─── Queries and params ──────────────────────────────────────────────────────\n\n/** A Discover multi-select (`?industry=a&industry=b`): see `multiValueQuery`. */\nconst multiValue = <T extends z.ZodType>(inner: T) =>\n multiValueQuery(inner, DISCOVER_FILTER_VALUES_MAX);\n\n/**\n * `GET /api/v1/products`: LISTED products only. Filters of one kind mean \"any\n * of\", different kinds combine (\"fintech AND beta\"). `ask` keeps products\n * whose ask is open now. `q` matches the start of the name; an emptied box\n * (`?q=`) is no search, never a 400.\n */\nexport const productDiscoverQuerySchema = paginationQuerySchema.extend({\n sort: z.preprocess(emptyStringToUndefined, productSortSchema.default('trending')),\n q: optionalTrimmedString(DISCOVER_TEXT_MAX),\n industry: multiValue(industrySchema),\n stage: multiValue(productStageSchema),\n platform: multiValue(productPlatformSchema),\n ask: z.preprocess(emptyStringToUndefined, productAskSchema.optional()),\n});\nexport type ProductDiscoverQuery = z.infer<typeof productDiscoverQuerySchema>;\nexport type ProductDiscoverQueryInput = z.input<typeof productDiscoverQuerySchema>;\n\n/**\n * `GET /products/:id/feedback`: comments from outside its team on the posts\n * and polls tagged with it, newest first. `helpful=true` narrows to the ones\n * the team marked as having helped.\n */\nexport const productFeedbackQuerySchema = paginationQuerySchema.extend({\n helpful: z.preprocess(emptyStringToUndefined, z.stringbool().default(false)),\n});\nexport type ProductFeedbackQuery = z.infer<typeof productFeedbackQuerySchema>;\nexport type ProductFeedbackQueryInput = z.input<typeof productFeedbackQuerySchema>;\n\nexport const productParamsSchema = z.object({ productId: objectIdSchema });\nexport type ProductParams = z.infer<typeof productParamsSchema>;\n/** `/products/:productId/team/:userId`, `/products/:productId/testers/:userId`. */\nexport const productMemberParamsSchema = z.object({\n productId: objectIdSchema,\n userId: objectIdSchema,\n});\nexport type ProductMemberParams = z.infer<typeof productMemberParamsSchema>;\n/** `/products/by-member/:userId`. */\nexport const productsByMemberParamsSchema = z.object({ userId: objectIdSchema });\nexport type ProductsByMemberParams = z.infer<typeof productsByMemberParamsSchema>;\n\n// ─── Write bodies ────────────────────────────────────────────────────────────\n// Each its own object with NO defaults (see `updateFounderProfileBodySchema`).\n\n/** A screenshot on the way in: an uploaded, processed image id, and its caption. */\nexport const productScreenshotInputSchema = z.object({\n mediaId: objectIdSchema,\n caption: z.string().trim().max(PRODUCT_CAPTION_MAX).optional(),\n});\nexport type ProductScreenshotInput = z.infer<typeof productScreenshotInputSchema>;\n\nconst screenshotsInputSchema = z\n .array(productScreenshotInputSchema)\n .max(PRODUCT_SCREENSHOTS_MAX)\n .refine((list) => new Set(list.map((s) => s.mediaId)).size === list.length, {\n error: VALIDATION_MESSAGE.screenshotsDuplicate,\n });\n\n/**\n * `POST /api/v1/products`. Starts `unlisted`, owned by the caller. The logo\n * and screenshots may come now or later (uploaded first, purpose\n * `product_logo` / `product_screenshot`, like a post's images).\n */\nexport const createProductBodySchema = z.object({\n name: z.string().trim().min(1).max(PRODUCT_NAME_MAX),\n tagline: z.string().trim().min(1).max(PRODUCT_TAGLINE_MAX).optional(),\n description: z.string().trim().min(1).max(PRODUCT_DESCRIPTION_MAX).optional(),\n industry: industrySchema,\n stage: productStageSchema,\n platforms: platformsSchema.optional(),\n topics: z.array(topicSchema).max(PRODUCT_TOPICS_MAX).optional(),\n links: productLinksSchema.optional(),\n videoUrl: productVideoUrlSchema.optional(),\n logoMediaId: objectIdSchema.optional(),\n screenshots: screenshotsInputSchema.optional(),\n});\nexport type CreateProductBody = z.infer<typeof createProductBodySchema>;\n\n/** Text the editor may empty: absent leaves it, `null` clears it, `\"\"` is refused. */\nconst clearable = <T extends z.ZodType>(inner: T) => inner.nullable().optional();\n\n/**\n * `PATCH /api/v1/products/:id`: only the keys that changed. Images, listing\n * and status have their own routes. `links` is sent whole.\n */\nexport const updateProductBodySchema = z.object({\n name: z.string().trim().min(1).max(PRODUCT_NAME_MAX).optional(),\n tagline: clearable(\n z.string().trim().min(1, VALIDATION_MESSAGE.clearWithNull).max(PRODUCT_TAGLINE_MAX),\n ),\n description: clearable(\n z.string().trim().min(1, VALIDATION_MESSAGE.clearWithNull).max(PRODUCT_DESCRIPTION_MAX),\n ),\n industry: industrySchema.optional(),\n stage: productStageSchema.optional(),\n platforms: platformsSchema.optional(),\n topics: z.array(topicSchema).max(PRODUCT_TOPICS_MAX).optional(),\n links: productLinksSchema.optional(),\n videoUrl: clearable(productVideoUrlSchema),\n});\nexport type UpdateProductBody = z.infer<typeof updateProductBodySchema>;\n\n/** `PUT /products/:id/logo`: a processed `product_logo` upload. The old logo's files are deleted. */\nexport const setProductLogoBodySchema = z.object({ mediaId: objectIdSchema });\nexport type SetProductLogoBody = z.infer<typeof setProductLogoBodySchema>;\n\n/**\n * `PUT /products/:id/screenshots`: the WHOLE gallery as it should now be, in\n * order. One call adds, removes, reorders and re-captions: screenshots already\n * on the product stay; new ids must be the caller's processed\n * `product_screenshot` uploads; any left out are deleted from storage.\n */\nexport const setProductScreenshotsBodySchema = z.object({ screenshots: screenshotsInputSchema });\nexport type SetProductScreenshotsBody = z.infer<typeof setProductScreenshotsBodySchema>;\n\nexport const setProductVisibilityBodySchema = z.object({ visibility: productVisibilitySchema });\nexport type SetProductVisibilityBody = z.infer<typeof setProductVisibilityBodySchema>;\n\nexport const setProductStatusBodySchema = z.object({ status: productStatusSchema });\nexport type SetProductStatusBody = z.infer<typeof setProductStatusBodySchema>;\n\n/**\n * Invite a member to the team; they must accept. `userId` is the member's id\n * as every card carries it (`founderCardSchema.userId`). Someone who cannot\n * join (has not finished onboarding, paused, suspended, deleted) is\n * `PRODUCT_MEMBER_NOT_INVITABLE`; someone already on it or invited,\n * `PRODUCT_ALREADY_MEMBER`.\n */\nexport const inviteProductMemberBodySchema = z.object({\n userId: objectIdSchema,\n role: productInvitableRoleSchema,\n});\nexport type InviteProductMemberBody = z.infer<typeof inviteProductMemberBodySchema>;\n\n/**\n * The owner changes someone's role (on the team or still invited). The\n * owner's own role changes only by handing over (`PRODUCT_OWNER_MUST_TRANSFER`);\n * someone not on the team or invited is `PRODUCT_NOT_ON_TEAM`.\n */\nexport const setProductMemberRoleBodySchema = z.object({ role: productInvitableRoleSchema });\nexport type SetProductMemberRoleBody = z.infer<typeof setProductMemberRoleBodySchema>;\n\n/**\n * The owner hands the product to someone already on its team (not merely\n * invited: `PRODUCT_NOT_ON_TEAM`), who must have room under\n * `PRODUCTS_OWNED_MAX` (`PRODUCT_LIMIT_REACHED`). The old owner becomes a co-founder.\n */\nexport const transferProductBodySchema = z.object({ userId: objectIdSchema });\nexport type TransferProductBody = z.infer<typeof transferProductBodySchema>;\n"]}