founder-schema 0.10.0 → 0.12.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/README.md +98 -0
- package/dist/access/access.d.ts +10 -6
- package/dist/access/access.d.ts.map +1 -1
- package/dist/access/access.js +8 -1
- package/dist/access/access.js.map +1 -1
- package/dist/access/permissions.d.ts +60 -3
- package/dist/access/permissions.d.ts.map +1 -1
- package/dist/access/permissions.js +24 -0
- package/dist/access/permissions.js.map +1 -1
- package/dist/access/roles.d.ts +3 -3
- package/dist/access/standing.d.ts +59 -0
- package/dist/access/standing.d.ts.map +1 -0
- package/dist/access/standing.js +52 -0
- package/dist/access/standing.js.map +1 -0
- package/dist/core/errors.d.ts +47 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +82 -1
- package/dist/core/errors.js.map +1 -1
- package/dist/core/limits.d.ts +39 -3
- package/dist/core/limits.d.ts.map +1 -1
- package/dist/core/limits.js +41 -3
- package/dist/core/limits.js.map +1 -1
- package/dist/core/responses.d.ts +55 -0
- package/dist/core/responses.d.ts.map +1 -1
- package/dist/core/responses.js +6 -0
- package/dist/core/responses.js.map +1 -1
- package/dist/core/validation.d.ts +14 -0
- package/dist/core/validation.d.ts.map +1 -1
- package/dist/core/validation.js +14 -0
- package/dist/core/validation.js.map +1 -1
- package/dist/domains/audit/audit.d.ts +28 -7
- package/dist/domains/audit/audit.d.ts.map +1 -1
- package/dist/domains/audit/audit.js +17 -0
- package/dist/domains/audit/audit.js.map +1 -1
- package/dist/domains/billing/billing.d.ts +1179 -0
- package/dist/domains/billing/billing.d.ts.map +1 -0
- package/dist/domains/billing/billing.js +393 -0
- package/dist/domains/billing/billing.js.map +1 -0
- package/dist/domains/billing/gst.d.ts +229 -0
- package/dist/domains/billing/gst.d.ts.map +1 -0
- package/dist/domains/billing/gst.js +117 -0
- package/dist/domains/billing/gst.js.map +1 -0
- package/dist/domains/chat/chat.d.ts +85 -0
- package/dist/domains/chat/chat.d.ts.map +1 -1
- package/dist/domains/chat/chat.js +62 -0
- package/dist/domains/chat/chat.js.map +1 -1
- package/dist/domains/communities/communities.d.ts +11 -11
- package/dist/domains/dashboard/dashboard.d.ts +9 -1
- package/dist/domains/dashboard/dashboard.d.ts.map +1 -1
- package/dist/domains/dashboard/dashboard.js +15 -0
- package/dist/domains/dashboard/dashboard.js.map +1 -1
- package/dist/domains/feed/feed.d.ts.map +1 -1
- package/dist/domains/feed/feed.js +7 -1
- package/dist/domains/feed/feed.js.map +1 -1
- package/dist/domains/members/members.d.ts +30 -5
- package/dist/domains/members/members.d.ts.map +1 -1
- package/dist/domains/members/members.js +23 -0
- package/dist/domains/members/members.js.map +1 -1
- package/dist/domains/membership/membership.d.ts +239 -0
- package/dist/domains/membership/membership.d.ts.map +1 -0
- package/dist/domains/membership/membership.js +153 -0
- package/dist/domains/membership/membership.js.map +1 -0
- package/dist/domains/notifications/notifications.d.ts +43 -1
- package/dist/domains/notifications/notifications.d.ts.map +1 -1
- package/dist/domains/notifications/notifications.js +19 -0
- package/dist/domains/notifications/notifications.js.map +1 -1
- package/dist/domains/products/products.d.ts +44 -12
- package/dist/domains/products/products.d.ts.map +1 -1
- package/dist/domains/products/products.js +33 -3
- package/dist/domains/products/products.js.map +1 -1
- package/dist/domains/profile/founder-profile.d.ts +178 -0
- package/dist/domains/profile/founder-profile.d.ts.map +1 -1
- package/dist/domains/profile/founder-profile.js +77 -0
- package/dist/domains/profile/founder-profile.js.map +1 -1
- package/dist/domains/reviews/reviews.d.ts +3 -0
- package/dist/domains/reviews/reviews.d.ts.map +1 -1
- package/dist/domains/reviews/reviews.js +6 -1
- package/dist/domains/reviews/reviews.js.map +1 -1
- package/dist/domains/team/team.d.ts +4 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -48,12 +48,15 @@ import { z } from 'zod';
|
|
|
48
48
|
* community_invite a community invited you (always delivered)
|
|
49
49
|
* community_announcement a community you are in pinned an announcement for everyone
|
|
50
50
|
* community_suggestion_decided your community suggestion was approved or declined (always delivered)
|
|
51
|
+
* plan_ending your plan ends in 7 days, then in 1 day (0.12.0, always delivered)
|
|
52
|
+
* plan_ended your plan ended; `paused` products were paused (0.12.0, always delivered)
|
|
53
|
+
* payment_refunded staff refunded one of your payments (0.12.0, always delivered)
|
|
51
54
|
*
|
|
52
55
|
* The three 0.8.0 kinds merge per target like the others. A reaction counts
|
|
53
56
|
* once: changing it to another type is not a new event, and taking it back
|
|
54
57
|
* does not take the event back.
|
|
55
58
|
*/
|
|
56
|
-
export declare const NOTIFICATION_KIND_VALUES: readonly ["comment_on_post", "reply_to_comment", "product_invite", "product_invite_accepted", "product_review", "review_reply", "feedback_helpful", "tester_confirmed", "post_reaction", "comment_reaction", "repost", "community_join_request", "community_request_approved", "community_invite", "community_announcement", "community_suggestion_decided"];
|
|
59
|
+
export declare const NOTIFICATION_KIND_VALUES: readonly ["comment_on_post", "reply_to_comment", "product_invite", "product_invite_accepted", "product_review", "review_reply", "feedback_helpful", "tester_confirmed", "post_reaction", "comment_reaction", "repost", "community_join_request", "community_request_approved", "community_invite", "community_announcement", "community_suggestion_decided", "plan_ending", "plan_ended", "payment_refunded"];
|
|
57
60
|
export declare const notificationKindSchema: z.ZodEnum<{
|
|
58
61
|
feedback_helpful: "feedback_helpful";
|
|
59
62
|
tester_confirmed: "tester_confirmed";
|
|
@@ -71,6 +74,9 @@ export declare const notificationKindSchema: z.ZodEnum<{
|
|
|
71
74
|
community_invite: "community_invite";
|
|
72
75
|
community_announcement: "community_announcement";
|
|
73
76
|
community_suggestion_decided: "community_suggestion_decided";
|
|
77
|
+
plan_ending: "plan_ending";
|
|
78
|
+
plan_ended: "plan_ended";
|
|
79
|
+
payment_refunded: "payment_refunded";
|
|
74
80
|
}>;
|
|
75
81
|
export type NotificationKind = z.infer<typeof notificationKindSchema>;
|
|
76
82
|
/** The switches a member has, each covering one or more kinds. */
|
|
@@ -106,6 +112,9 @@ export declare const NOTIFICATION_PREFERENCE_OF: {
|
|
|
106
112
|
readonly community_invite: null;
|
|
107
113
|
readonly community_announcement: "communities";
|
|
108
114
|
readonly community_suggestion_decided: null;
|
|
115
|
+
readonly plan_ending: null;
|
|
116
|
+
readonly plan_ended: null;
|
|
117
|
+
readonly payment_refunded: null;
|
|
109
118
|
};
|
|
110
119
|
/**
|
|
111
120
|
* One row of the bell. Which of the optional targets are present depends on
|
|
@@ -127,6 +136,9 @@ export declare const NOTIFICATION_PREFERENCE_OF: {
|
|
|
127
136
|
* community_invite community
|
|
128
137
|
* community_announcement community, content (the pinned post or poll)
|
|
129
138
|
* community_suggestion_decided suggestion, community (once approved)
|
|
139
|
+
* plan_ending plan (the tier, and when it ends)
|
|
140
|
+
* plan_ended plan (the tier that ended), paused (how many products)
|
|
141
|
+
* payment_refunded payment
|
|
130
142
|
*
|
|
131
143
|
* Any row about something inside a community also carries `community`
|
|
132
144
|
* (0.9.0), whatever its kind. When the recipient leaves the community, is
|
|
@@ -155,6 +167,9 @@ export declare const notificationSchema: z.ZodObject<{
|
|
|
155
167
|
community_invite: "community_invite";
|
|
156
168
|
community_announcement: "community_announcement";
|
|
157
169
|
community_suggestion_decided: "community_suggestion_decided";
|
|
170
|
+
plan_ending: "plan_ending";
|
|
171
|
+
plan_ended: "plan_ended";
|
|
172
|
+
payment_refunded: "payment_refunded";
|
|
158
173
|
}>;
|
|
159
174
|
actor: z.ZodNullable<z.ZodObject<{
|
|
160
175
|
userId: z.ZodString;
|
|
@@ -201,6 +216,18 @@ export declare const notificationSchema: z.ZodObject<{
|
|
|
201
216
|
}>;
|
|
202
217
|
reason: z.ZodOptional<z.ZodString>;
|
|
203
218
|
}, z.core.$strip>>;
|
|
219
|
+
plan: z.ZodOptional<z.ZodObject<{
|
|
220
|
+
tier: z.ZodEnum<{
|
|
221
|
+
premium: "premium";
|
|
222
|
+
business: "business";
|
|
223
|
+
}>;
|
|
224
|
+
endsAt: z.ZodISODateTime;
|
|
225
|
+
}, z.core.$strip>>;
|
|
226
|
+
paused: z.ZodOptional<z.ZodNumber>;
|
|
227
|
+
payment: z.ZodOptional<z.ZodObject<{
|
|
228
|
+
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
229
|
+
title: z.ZodString;
|
|
230
|
+
}, z.core.$strip>>;
|
|
204
231
|
role: z.ZodOptional<z.ZodEnum<{
|
|
205
232
|
team: "team";
|
|
206
233
|
cofounder: "cofounder";
|
|
@@ -240,6 +267,9 @@ export declare const notificationPageSchema: z.ZodObject<{
|
|
|
240
267
|
community_invite: "community_invite";
|
|
241
268
|
community_announcement: "community_announcement";
|
|
242
269
|
community_suggestion_decided: "community_suggestion_decided";
|
|
270
|
+
plan_ending: "plan_ending";
|
|
271
|
+
plan_ended: "plan_ended";
|
|
272
|
+
payment_refunded: "payment_refunded";
|
|
243
273
|
}>;
|
|
244
274
|
actor: z.ZodNullable<z.ZodObject<{
|
|
245
275
|
userId: z.ZodString;
|
|
@@ -286,6 +316,18 @@ export declare const notificationPageSchema: z.ZodObject<{
|
|
|
286
316
|
}>;
|
|
287
317
|
reason: z.ZodOptional<z.ZodString>;
|
|
288
318
|
}, z.core.$strip>>;
|
|
319
|
+
plan: z.ZodOptional<z.ZodObject<{
|
|
320
|
+
tier: z.ZodEnum<{
|
|
321
|
+
premium: "premium";
|
|
322
|
+
business: "business";
|
|
323
|
+
}>;
|
|
324
|
+
endsAt: z.ZodISODateTime;
|
|
325
|
+
}, z.core.$strip>>;
|
|
326
|
+
paused: z.ZodOptional<z.ZodNumber>;
|
|
327
|
+
payment: z.ZodOptional<z.ZodObject<{
|
|
328
|
+
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
329
|
+
title: z.ZodString;
|
|
330
|
+
}, z.core.$strip>>;
|
|
289
331
|
role: z.ZodOptional<z.ZodEnum<{
|
|
290
332
|
team: "team";
|
|
291
333
|
cofounder: "cofounder";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/domains/notifications/notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/domains/notifications/notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,wBAAwB,+YAoB3B,CAAC;AACX,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;EAAmC,CAAC;AACvE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,kEAAkE;AAClE,eAAO,MAAM,8BAA8B,2GAQjC,CAAC;AACX,eAAO,MAAM,4BAA4B;;;;;;;;EAAyC,CAAC;AACnF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;CAoBqC,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyD7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAsC,CAAC;AAC1E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,iBAAiB;AACjB,eAAO,MAAM,6BAA6B;;iBAExC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,wBAAwB;;iBAA+C,CAAC;AACrF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,+CAA+C;AAC/C,eAAO,MAAM,6BAA6B;;;;;;;;iBAWxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,kFAAkF;AAClF,eAAO,MAAM,uCAAuC;;;;;;;;iBAQlD,CAAC;AACH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,uCAAuC,CAC/C,CAAC"}
|
|
@@ -34,6 +34,7 @@ import { NOTIFICATION_EXCERPT_MAX } from '../../core/limits.js';
|
|
|
34
34
|
import { paginatedSchema } from '../../core/responses.js';
|
|
35
35
|
import { communityChipSchema } from '../communities/communities.js';
|
|
36
36
|
import { contentKindSchema, reactionTypeSchema } from '../feed/feed.js';
|
|
37
|
+
import { planTierSchema } from '../membership/membership.js';
|
|
37
38
|
import { productChipSchema, productInvitableRoleSchema } from '../products/products.js';
|
|
38
39
|
import { memberBylineSchema } from '../profile/founder-profile.js';
|
|
39
40
|
/**
|
|
@@ -55,6 +56,9 @@ import { memberBylineSchema } from '../profile/founder-profile.js';
|
|
|
55
56
|
* community_invite a community invited you (always delivered)
|
|
56
57
|
* community_announcement a community you are in pinned an announcement for everyone
|
|
57
58
|
* community_suggestion_decided your community suggestion was approved or declined (always delivered)
|
|
59
|
+
* plan_ending your plan ends in 7 days, then in 1 day (0.12.0, always delivered)
|
|
60
|
+
* plan_ended your plan ended; `paused` products were paused (0.12.0, always delivered)
|
|
61
|
+
* payment_refunded staff refunded one of your payments (0.12.0, always delivered)
|
|
58
62
|
*
|
|
59
63
|
* The three 0.8.0 kinds merge per target like the others. A reaction counts
|
|
60
64
|
* once: changing it to another type is not a new event, and taking it back
|
|
@@ -77,6 +81,9 @@ export const NOTIFICATION_KIND_VALUES = [
|
|
|
77
81
|
'community_invite',
|
|
78
82
|
'community_announcement',
|
|
79
83
|
'community_suggestion_decided',
|
|
84
|
+
'plan_ending',
|
|
85
|
+
'plan_ended',
|
|
86
|
+
'payment_refunded',
|
|
80
87
|
];
|
|
81
88
|
export const notificationKindSchema = z.enum(NOTIFICATION_KIND_VALUES);
|
|
82
89
|
/** The switches a member has, each covering one or more kinds. */
|
|
@@ -111,6 +118,9 @@ export const NOTIFICATION_PREFERENCE_OF = {
|
|
|
111
118
|
community_invite: null,
|
|
112
119
|
community_announcement: 'communities',
|
|
113
120
|
community_suggestion_decided: null,
|
|
121
|
+
plan_ending: null,
|
|
122
|
+
plan_ended: null,
|
|
123
|
+
payment_refunded: null,
|
|
114
124
|
};
|
|
115
125
|
/**
|
|
116
126
|
* One row of the bell. Which of the optional targets are present depends on
|
|
@@ -132,6 +142,9 @@ export const NOTIFICATION_PREFERENCE_OF = {
|
|
|
132
142
|
* community_invite community
|
|
133
143
|
* community_announcement community, content (the pinned post or poll)
|
|
134
144
|
* community_suggestion_decided suggestion, community (once approved)
|
|
145
|
+
* plan_ending plan (the tier, and when it ends)
|
|
146
|
+
* plan_ended plan (the tier that ended), paused (how many products)
|
|
147
|
+
* payment_refunded payment
|
|
135
148
|
*
|
|
136
149
|
* Any row about something inside a community also carries `community`
|
|
137
150
|
* (0.9.0), whatever its kind. When the recipient leaves the community, is
|
|
@@ -176,6 +189,12 @@ export const notificationSchema = z.object({
|
|
|
176
189
|
reason: z.string().optional(),
|
|
177
190
|
})
|
|
178
191
|
.optional(),
|
|
192
|
+
/** For `plan_ending` and `plan_ended` (0.12.0): which tier, and when it ends or ended. */
|
|
193
|
+
plan: z.object({ tier: planTierSchema, endsAt: z.iso.datetime() }).optional(),
|
|
194
|
+
/** For `plan_ended` (0.12.0): products paused because the plan's live places went. */
|
|
195
|
+
paused: z.number().int().nonnegative().optional(),
|
|
196
|
+
/** For `payment_refunded` (0.12.0): which purchase, by its title. */
|
|
197
|
+
payment: z.object({ id: objectIdSchema, title: z.string() }).optional(),
|
|
179
198
|
/** For `product_invite`: the role offered. */
|
|
180
199
|
role: productInvitableRoleSchema.optional(),
|
|
181
200
|
/** For the reaction kinds: the latest reaction, as it is now (0.8.0). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../src/domains/notifications/notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,iBAAiB;IACjB,kBAAkB;IAClB,gBAAgB;IAChB,yBAAyB;IACzB,gBAAgB;IAChB,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AO,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — Notifications: the bell\n *\n * The design the user approved on 2026-10-05 (\"Founder Circle Schema Review\"):\n *\n * - ONE ROW PER RECIPIENT, written when the event happens.\n * - REPEATS MERGE: a second comment on your post updates the same row\n * (\"2 new comments, latest from Asha\"), it never adds one. `count` is how\n * many events it holds and `actor` the latest. A member repeating the same\n * act (reacting, taking it back, reacting again) does not ring it again.\n * - THE ACTOR IS LOOKED UP WHEN READ, never copied in: a renamed member shows\n * their new name, and a deleted one shows as null (\"A former member\").\n * - PREFERENCES ARE CHECKED before writing (Jansathi stores them and never\n * reads them). A team invitation is always delivered: it needs an answer.\n * - KEPT `NOTIFICATION_RETENTION_DAYS`, then deleted.\n * - Nobody is notified of their own action.\n *\n * In-app only. Push stays chat's (async-service) until a channel is designed:\n * a client polls the unread count (on focus, and every minute while visible).\n *\n * Routes (all signed in):\n * GET /api/v1/notifications paginationQuerySchema -> notificationPageSchema\n * GET /api/v1/notifications/unread-count -> notificationUnreadCountSchema\n * POST /api/v1/notifications/read mark every one read -> notificationUnreadCountSchema\n * PUT /api/v1/notifications/:notificationId/read -> notificationSchema\n * GET /api/v1/notifications/preferences -> notificationPreferencesSchema\n * PUT /api/v1/notifications/preferences updateNotificationPreferencesBodySchema -> notificationPreferencesSchema\n *\n * @module founder-schema/domains/notifications\n */\n\nimport { z } from 'zod';\nimport { objectIdSchema } from '../../core/common.js';\nimport { NOTIFICATION_EXCERPT_MAX } from '../../core/limits.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { communityChipSchema } from '../communities/communities.js';\nimport { contentKindSchema, reactionTypeSchema } from '../feed/feed.js';\nimport { productChipSchema, productInvitableRoleSchema } from '../products/products.js';\nimport { memberBylineSchema } from '../profile/founder-profile.js';\n\n/**\n * What happened. ⚠ Stored per row: append only.\n *\n * comment_on_post someone commented on your post or poll\n * reply_to_comment someone replied to your comment\n * product_invite a team invited you (always delivered)\n * product_invite_accepted someone accepted your team's invitation\n * product_review someone reviewed a product you are on the team of\n * review_reply a product's team answered your review\n * feedback_helpful a team marked your feedback as having helped\n * tester_confirmed a team confirmed you tested their product\n * post_reaction someone reacted to your post or poll (0.8.0)\n * comment_reaction someone reacted to your comment (0.8.0)\n * repost someone reposted your post or poll (0.8.0)\n * community_join_request someone asked to join a community you moderate (0.9.0)\n * community_request_approved your request to join was approved (always delivered)\n * community_invite a community invited you (always delivered)\n * community_announcement a community you are in pinned an announcement for everyone\n * community_suggestion_decided your community suggestion was approved or declined (always delivered)\n *\n * The three 0.8.0 kinds merge per target like the others. A reaction counts\n * once: changing it to another type is not a new event, and taking it back\n * does not take the event back.\n */\nexport const NOTIFICATION_KIND_VALUES = [\n 'comment_on_post',\n 'reply_to_comment',\n 'product_invite',\n 'product_invite_accepted',\n 'product_review',\n 'review_reply',\n 'feedback_helpful',\n 'tester_confirmed',\n 'post_reaction',\n 'comment_reaction',\n 'repost',\n 'community_join_request',\n 'community_request_approved',\n 'community_invite',\n 'community_announcement',\n 'community_suggestion_decided',\n] as const;\nexport const notificationKindSchema = z.enum(NOTIFICATION_KIND_VALUES);\nexport type NotificationKind = z.infer<typeof notificationKindSchema>;\n\n/** The switches a member has, each covering one or more kinds. */\nexport const NOTIFICATION_PREFERENCE_VALUES = [\n 'comments',\n 'replies',\n 'productActivity',\n 'recognition',\n 'reactions',\n 'reposts',\n 'communities',\n] as const;\nexport const notificationPreferenceSchema = z.enum(NOTIFICATION_PREFERENCE_VALUES);\nexport type NotificationPreference = z.infer<typeof notificationPreferenceSchema>;\n\n/**\n * Which switch silences which kind. Null: always delivered. Exhaustive by\n * type, so a kind added without a decision here does not compile.\n */\nexport const NOTIFICATION_PREFERENCE_OF = {\n comment_on_post: 'comments',\n reply_to_comment: 'replies',\n product_invite: null,\n product_invite_accepted: 'productActivity',\n product_review: 'productActivity',\n review_reply: 'productActivity',\n feedback_helpful: 'recognition',\n tester_confirmed: 'recognition',\n post_reaction: 'reactions',\n comment_reaction: 'reactions',\n repost: 'reposts',\n community_join_request: 'communities',\n community_request_approved: null,\n community_invite: null,\n community_announcement: 'communities',\n community_suggestion_decided: null,\n} as const satisfies Record<NotificationKind, NotificationPreference | null>;\n\n/**\n * One row of the bell. Which of the optional targets are present depends on\n * `kind`:\n *\n * comment_on_post content, commentId\n * reply_to_comment content, commentId (the reply)\n * product_invite product, role\n * product_invite_accepted product\n * product_review product, reviewId\n * review_reply product, reviewId\n * feedback_helpful product, content, commentId\n * tester_confirmed product\n * post_reaction content, reaction\n * comment_reaction content, commentId, reaction, excerpt (your comment)\n * repost content (yours, the one reposted), repostId (the latest repost, to read their words)\n * community_join_request community\n * community_request_approved community\n * community_invite community\n * community_announcement community, content (the pinned post or poll)\n * community_suggestion_decided suggestion, community (once approved)\n *\n * Any row about something inside a community also carries `community`\n * (0.9.0), whatever its kind. When the recipient leaves the community, is\n * removed or is banned, its rows about that community lose their content,\n * comment, excerpt and repost: what they could read there, they no longer can.\n *\n * A target that no longer exists (a deleted post, product or review) is\n * absent rather than pointing at a 404; the row still says what happened.\n */\nexport const notificationSchema = z.object({\n id: objectIdSchema,\n kind: notificationKindSchema,\n /** The latest person to do it, live; null for a deleted account. */\n actor: memberBylineSchema.nullable(),\n /**\n * How many EVENTS this row merges, at least 1: three comments by one person\n * are 3. Word it as events (\"3 new comments, latest from Asha\"), never as\n * people (\"Asha and 2 others\"), which this count does not know.\n */\n count: z.number().int().positive(),\n content: z.object({ kind: contentKindSchema, id: objectIdSchema }).optional(),\n commentId: objectIdSchema.optional(),\n product: productChipSchema.optional(),\n reviewId: objectIdSchema.optional(),\n /**\n * For `repost` (0.8.0): the latest repost itself, so the row opens the\n * reposter's words above your post. Gone once that repost is.\n */\n repostId: objectIdSchema.optional(),\n /**\n * The community the row is about, or that its content is in (0.9.0). Absent\n * once that community is deleted, or the recipient may no longer see it.\n */\n community: communityChipSchema.optional(),\n /** For `community_suggestion_decided` (0.9.0): which suggestion, and how it went. */\n suggestion: z\n .object({\n id: objectIdSchema,\n name: z.string(),\n status: z.enum(['approved', 'declined']),\n /** Why it was declined. */\n reason: z.string().optional(),\n })\n .optional(),\n /** For `product_invite`: the role offered. */\n role: productInvitableRoleSchema.optional(),\n /** For the reaction kinds: the latest reaction, as it is now (0.8.0). */\n reaction: reactionTypeSchema.optional(),\n /**\n * The first words of what was written, for the comment and review kinds\n * (the latest one, on a merged row), cut to `NOTIFICATION_EXCERPT_MAX`. Gone\n * when that comment or review is deleted or hidden, and when its writer's\n * account is.\n */\n excerpt: z.string().max(NOTIFICATION_EXCERPT_MAX).optional(),\n /** Null until opened (or until \"mark all read\"). A merged repeat makes it unread again. */\n readAt: z.iso.datetime().nullable(),\n /** When it last happened: the list's order. */\n lastAt: z.iso.datetime(),\n createdAt: z.iso.datetime(),\n});\nexport type Notification = z.infer<typeof notificationSchema>;\n\nexport const notificationPageSchema = paginatedSchema(notificationSchema);\nexport type NotificationPage = z.infer<typeof notificationPageSchema>;\n\n/** The badge. */\nexport const notificationUnreadCountSchema = z.object({\n unread: z.number().int().nonnegative(),\n});\nexport type NotificationUnreadCount = z.infer<typeof notificationUnreadCountSchema>;\n\nexport const notificationParamsSchema = z.object({ notificationId: objectIdSchema });\nexport type NotificationParams = z.infer<typeof notificationParamsSchema>;\n\n/** Every switch, as stored (on by default). */\nexport const notificationPreferencesSchema = z.object({\n comments: z.boolean(),\n replies: z.boolean(),\n productActivity: z.boolean(),\n recognition: z.boolean(),\n /** Reactions to your posts, polls and comments (0.8.0). */\n reactions: z.boolean(),\n /** Reposts of your posts and polls (0.8.0). */\n reposts: z.boolean(),\n /** Announcements in your communities, and join requests to communities you moderate (0.9.0). */\n communities: z.boolean(),\n});\nexport type NotificationPreferences = z.infer<typeof notificationPreferencesSchema>;\n\n/** Only the switches that changed; no defaults (a patch states what was sent). */\nexport const updateNotificationPreferencesBodySchema = z.object({\n comments: z.boolean().optional(),\n replies: z.boolean().optional(),\n productActivity: z.boolean().optional(),\n recognition: z.boolean().optional(),\n reactions: z.boolean().optional(),\n reposts: z.boolean().optional(),\n communities: z.boolean().optional(),\n});\nexport type UpdateNotificationPreferencesBody = z.infer<\n typeof updateNotificationPreferencesBodySchema\n>;\n"]}
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../src/domains/notifications/notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,iBAAiB;IACjB,kBAAkB;IAClB,gBAAgB;IAChB,yBAAyB;IACzB,gBAAgB;IAChB,cAAc;IACd,kBAAkB;IAClB,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,QAAQ;IACR,wBAAwB;IACxB,4BAA4B;IAC5B,kBAAkB;IAClB,wBAAwB;IACxB,8BAA8B;IAC9B,aAAa;IACb,YAAY;IACZ,kBAAkB;CACV,CAAC;AACX,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;AAGvE,kEAAkE;AAClE,MAAM,CAAC,MAA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,CAAC,QAAQ,EAAE;IACvC,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACnC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACjC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC/B,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — Notifications: the bell\n *\n * The design the user approved on 2026-10-05 (\"Founder Circle Schema Review\"):\n *\n * - ONE ROW PER RECIPIENT, written when the event happens.\n * - REPEATS MERGE: a second comment on your post updates the same row\n * (\"2 new comments, latest from Asha\"), it never adds one. `count` is how\n * many events it holds and `actor` the latest. A member repeating the same\n * act (reacting, taking it back, reacting again) does not ring it again.\n * - THE ACTOR IS LOOKED UP WHEN READ, never copied in: a renamed member shows\n * their new name, and a deleted one shows as null (\"A former member\").\n * - PREFERENCES ARE CHECKED before writing (Jansathi stores them and never\n * reads them). A team invitation is always delivered: it needs an answer.\n * - KEPT `NOTIFICATION_RETENTION_DAYS`, then deleted.\n * - Nobody is notified of their own action.\n *\n * In-app only. Push stays chat's (async-service) until a channel is designed:\n * a client polls the unread count (on focus, and every minute while visible).\n *\n * Routes (all signed in):\n * GET /api/v1/notifications paginationQuerySchema -> notificationPageSchema\n * GET /api/v1/notifications/unread-count -> notificationUnreadCountSchema\n * POST /api/v1/notifications/read mark every one read -> notificationUnreadCountSchema\n * PUT /api/v1/notifications/:notificationId/read -> notificationSchema\n * GET /api/v1/notifications/preferences -> notificationPreferencesSchema\n * PUT /api/v1/notifications/preferences updateNotificationPreferencesBodySchema -> notificationPreferencesSchema\n *\n * @module founder-schema/domains/notifications\n */\n\nimport { z } from 'zod';\nimport { objectIdSchema } from '../../core/common.js';\nimport { NOTIFICATION_EXCERPT_MAX } from '../../core/limits.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { communityChipSchema } from '../communities/communities.js';\nimport { contentKindSchema, reactionTypeSchema } from '../feed/feed.js';\nimport { planTierSchema } from '../membership/membership.js';\nimport { productChipSchema, productInvitableRoleSchema } from '../products/products.js';\nimport { memberBylineSchema } from '../profile/founder-profile.js';\n\n/**\n * What happened. ⚠ Stored per row: append only.\n *\n * comment_on_post someone commented on your post or poll\n * reply_to_comment someone replied to your comment\n * product_invite a team invited you (always delivered)\n * product_invite_accepted someone accepted your team's invitation\n * product_review someone reviewed a product you are on the team of\n * review_reply a product's team answered your review\n * feedback_helpful a team marked your feedback as having helped\n * tester_confirmed a team confirmed you tested their product\n * post_reaction someone reacted to your post or poll (0.8.0)\n * comment_reaction someone reacted to your comment (0.8.0)\n * repost someone reposted your post or poll (0.8.0)\n * community_join_request someone asked to join a community you moderate (0.9.0)\n * community_request_approved your request to join was approved (always delivered)\n * community_invite a community invited you (always delivered)\n * community_announcement a community you are in pinned an announcement for everyone\n * community_suggestion_decided your community suggestion was approved or declined (always delivered)\n * plan_ending your plan ends in 7 days, then in 1 day (0.12.0, always delivered)\n * plan_ended your plan ended; `paused` products were paused (0.12.0, always delivered)\n * payment_refunded staff refunded one of your payments (0.12.0, always delivered)\n *\n * The three 0.8.0 kinds merge per target like the others. A reaction counts\n * once: changing it to another type is not a new event, and taking it back\n * does not take the event back.\n */\nexport const NOTIFICATION_KIND_VALUES = [\n 'comment_on_post',\n 'reply_to_comment',\n 'product_invite',\n 'product_invite_accepted',\n 'product_review',\n 'review_reply',\n 'feedback_helpful',\n 'tester_confirmed',\n 'post_reaction',\n 'comment_reaction',\n 'repost',\n 'community_join_request',\n 'community_request_approved',\n 'community_invite',\n 'community_announcement',\n 'community_suggestion_decided',\n 'plan_ending',\n 'plan_ended',\n 'payment_refunded',\n] as const;\nexport const notificationKindSchema = z.enum(NOTIFICATION_KIND_VALUES);\nexport type NotificationKind = z.infer<typeof notificationKindSchema>;\n\n/** The switches a member has, each covering one or more kinds. */\nexport const NOTIFICATION_PREFERENCE_VALUES = [\n 'comments',\n 'replies',\n 'productActivity',\n 'recognition',\n 'reactions',\n 'reposts',\n 'communities',\n] as const;\nexport const notificationPreferenceSchema = z.enum(NOTIFICATION_PREFERENCE_VALUES);\nexport type NotificationPreference = z.infer<typeof notificationPreferenceSchema>;\n\n/**\n * Which switch silences which kind. Null: always delivered. Exhaustive by\n * type, so a kind added without a decision here does not compile.\n */\nexport const NOTIFICATION_PREFERENCE_OF = {\n comment_on_post: 'comments',\n reply_to_comment: 'replies',\n product_invite: null,\n product_invite_accepted: 'productActivity',\n product_review: 'productActivity',\n review_reply: 'productActivity',\n feedback_helpful: 'recognition',\n tester_confirmed: 'recognition',\n post_reaction: 'reactions',\n comment_reaction: 'reactions',\n repost: 'reposts',\n community_join_request: 'communities',\n community_request_approved: null,\n community_invite: null,\n community_announcement: 'communities',\n community_suggestion_decided: null,\n plan_ending: null,\n plan_ended: null,\n payment_refunded: null,\n} as const satisfies Record<NotificationKind, NotificationPreference | null>;\n\n/**\n * One row of the bell. Which of the optional targets are present depends on\n * `kind`:\n *\n * comment_on_post content, commentId\n * reply_to_comment content, commentId (the reply)\n * product_invite product, role\n * product_invite_accepted product\n * product_review product, reviewId\n * review_reply product, reviewId\n * feedback_helpful product, content, commentId\n * tester_confirmed product\n * post_reaction content, reaction\n * comment_reaction content, commentId, reaction, excerpt (your comment)\n * repost content (yours, the one reposted), repostId (the latest repost, to read their words)\n * community_join_request community\n * community_request_approved community\n * community_invite community\n * community_announcement community, content (the pinned post or poll)\n * community_suggestion_decided suggestion, community (once approved)\n * plan_ending plan (the tier, and when it ends)\n * plan_ended plan (the tier that ended), paused (how many products)\n * payment_refunded payment\n *\n * Any row about something inside a community also carries `community`\n * (0.9.0), whatever its kind. When the recipient leaves the community, is\n * removed or is banned, its rows about that community lose their content,\n * comment, excerpt and repost: what they could read there, they no longer can.\n *\n * A target that no longer exists (a deleted post, product or review) is\n * absent rather than pointing at a 404; the row still says what happened.\n */\nexport const notificationSchema = z.object({\n id: objectIdSchema,\n kind: notificationKindSchema,\n /** The latest person to do it, live; null for a deleted account. */\n actor: memberBylineSchema.nullable(),\n /**\n * How many EVENTS this row merges, at least 1: three comments by one person\n * are 3. Word it as events (\"3 new comments, latest from Asha\"), never as\n * people (\"Asha and 2 others\"), which this count does not know.\n */\n count: z.number().int().positive(),\n content: z.object({ kind: contentKindSchema, id: objectIdSchema }).optional(),\n commentId: objectIdSchema.optional(),\n product: productChipSchema.optional(),\n reviewId: objectIdSchema.optional(),\n /**\n * For `repost` (0.8.0): the latest repost itself, so the row opens the\n * reposter's words above your post. Gone once that repost is.\n */\n repostId: objectIdSchema.optional(),\n /**\n * The community the row is about, or that its content is in (0.9.0). Absent\n * once that community is deleted, or the recipient may no longer see it.\n */\n community: communityChipSchema.optional(),\n /** For `community_suggestion_decided` (0.9.0): which suggestion, and how it went. */\n suggestion: z\n .object({\n id: objectIdSchema,\n name: z.string(),\n status: z.enum(['approved', 'declined']),\n /** Why it was declined. */\n reason: z.string().optional(),\n })\n .optional(),\n /** For `plan_ending` and `plan_ended` (0.12.0): which tier, and when it ends or ended. */\n plan: z.object({ tier: planTierSchema, endsAt: z.iso.datetime() }).optional(),\n /** For `plan_ended` (0.12.0): products paused because the plan's live places went. */\n paused: z.number().int().nonnegative().optional(),\n /** For `payment_refunded` (0.12.0): which purchase, by its title. */\n payment: z.object({ id: objectIdSchema, title: z.string() }).optional(),\n /** For `product_invite`: the role offered. */\n role: productInvitableRoleSchema.optional(),\n /** For the reaction kinds: the latest reaction, as it is now (0.8.0). */\n reaction: reactionTypeSchema.optional(),\n /**\n * The first words of what was written, for the comment and review kinds\n * (the latest one, on a merged row), cut to `NOTIFICATION_EXCERPT_MAX`. Gone\n * when that comment or review is deleted or hidden, and when its writer's\n * account is.\n */\n excerpt: z.string().max(NOTIFICATION_EXCERPT_MAX).optional(),\n /** Null until opened (or until \"mark all read\"). A merged repeat makes it unread again. */\n readAt: z.iso.datetime().nullable(),\n /** When it last happened: the list's order. */\n lastAt: z.iso.datetime(),\n createdAt: z.iso.datetime(),\n});\nexport type Notification = z.infer<typeof notificationSchema>;\n\nexport const notificationPageSchema = paginatedSchema(notificationSchema);\nexport type NotificationPage = z.infer<typeof notificationPageSchema>;\n\n/** The badge. */\nexport const notificationUnreadCountSchema = z.object({\n unread: z.number().int().nonnegative(),\n});\nexport type NotificationUnreadCount = z.infer<typeof notificationUnreadCountSchema>;\n\nexport const notificationParamsSchema = z.object({ notificationId: objectIdSchema });\nexport type NotificationParams = z.infer<typeof notificationParamsSchema>;\n\n/** Every switch, as stored (on by default). */\nexport const notificationPreferencesSchema = z.object({\n comments: z.boolean(),\n replies: z.boolean(),\n productActivity: z.boolean(),\n recognition: z.boolean(),\n /** Reactions to your posts, polls and comments (0.8.0). */\n reactions: z.boolean(),\n /** Reposts of your posts and polls (0.8.0). */\n reposts: z.boolean(),\n /** Announcements in your communities, and join requests to communities you moderate (0.9.0). */\n communities: z.boolean(),\n});\nexport type NotificationPreferences = z.infer<typeof notificationPreferencesSchema>;\n\n/** Only the switches that changed; no defaults (a patch states what was sent). */\nexport const updateNotificationPreferencesBodySchema = z.object({\n comments: z.boolean().optional(),\n replies: z.boolean().optional(),\n productActivity: z.boolean().optional(),\n recognition: z.boolean().optional(),\n reactions: z.boolean().optional(),\n reposts: z.boolean().optional(),\n communities: z.boolean().optional(),\n});\nexport type UpdateNotificationPreferencesBody = z.infer<\n typeof updateNotificationPreferencesBodySchema\n>;\n"]}
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
* PUT /api/v1/products/:productId/screenshots setProductScreenshotsBodySchema -> productSchema
|
|
52
52
|
* PUT /api/v1/products/:productId/visibility setProductVisibilityBodySchema -> productSchema
|
|
53
53
|
* PUT /api/v1/products/:productId/status setProductStatusBodySchema -> productSchema
|
|
54
|
+
* PUT /api/v1/products/:productId/live setProductLiveBodySchema -> productSchema (0.12.0)
|
|
54
55
|
* GET /api/v1/products/:productId/team productTeamPageSchema
|
|
55
56
|
* GET /api/v1/products/:productId/invites productPendingInvitePageSchema (managers)
|
|
56
57
|
* POST /api/v1/products/:productId/invites inviteProductMemberBodySchema -> productPendingInviteSchema
|
|
@@ -81,9 +82,9 @@ export declare const PRODUCT_TOPICS_MAX = 3;
|
|
|
81
82
|
export declare const PRODUCT_STAGE_VALUES: readonly ["idea", "building", "beta", "live"];
|
|
82
83
|
export declare const productStageSchema: z.ZodEnum<{
|
|
83
84
|
idea: "idea";
|
|
85
|
+
live: "live";
|
|
84
86
|
building: "building";
|
|
85
87
|
beta: "beta";
|
|
86
|
-
live: "live";
|
|
87
88
|
}>;
|
|
88
89
|
export type ProductStage = z.infer<typeof productStageSchema>;
|
|
89
90
|
export declare const PRODUCT_PLATFORM_VALUES: readonly ["web", "ios", "android", "desktop", "browser_extension", "api", "hardware", "other"];
|
|
@@ -295,9 +296,9 @@ export declare const productCardSchema: z.ZodObject<{
|
|
|
295
296
|
}>;
|
|
296
297
|
stage: z.ZodEnum<{
|
|
297
298
|
idea: "idea";
|
|
299
|
+
live: "live";
|
|
298
300
|
building: "building";
|
|
299
301
|
beta: "beta";
|
|
300
|
-
live: "live";
|
|
301
302
|
}>;
|
|
302
303
|
platforms: z.ZodArray<z.ZodEnum<{
|
|
303
304
|
api: "api";
|
|
@@ -329,6 +330,7 @@ export declare const productCardSchema: z.ZodObject<{
|
|
|
329
330
|
ideas: "ideas";
|
|
330
331
|
}>>;
|
|
331
332
|
hiddenByStaff: z.ZodOptional<z.ZodBoolean>;
|
|
333
|
+
paused: z.ZodOptional<z.ZodBoolean>;
|
|
332
334
|
viewer: z.ZodOptional<z.ZodObject<{
|
|
333
335
|
upvoted: z.ZodBoolean;
|
|
334
336
|
canUpvote: z.ZodBoolean;
|
|
@@ -341,6 +343,19 @@ export declare const productCardSchema: z.ZodObject<{
|
|
|
341
343
|
}, z.core.$strip>>;
|
|
342
344
|
}, z.core.$strip>;
|
|
343
345
|
export type ProductCard = z.infer<typeof productCardSchema>;
|
|
346
|
+
/**
|
|
347
|
+
* Why a product is paused (0.12.0). ⚠ Stored: append only.
|
|
348
|
+
* limit over its owner's live places (a plan ended, a refund, joining
|
|
349
|
+
* without one): it comes back by itself when a place frees
|
|
350
|
+
* owner its owner paused it, to free a place for another: it stays
|
|
351
|
+
* paused until they make it live
|
|
352
|
+
*/
|
|
353
|
+
export declare const PRODUCT_PAUSED_BY_VALUES: readonly ["limit", "owner"];
|
|
354
|
+
export declare const productPausedBySchema: z.ZodEnum<{
|
|
355
|
+
limit: "limit";
|
|
356
|
+
owner: "owner";
|
|
357
|
+
}>;
|
|
358
|
+
export type ProductPausedBy = z.infer<typeof productPausedBySchema>;
|
|
344
359
|
/** One person on a product's team, live-joined like every byline. */
|
|
345
360
|
export declare const productTeamMemberSchema: z.ZodObject<{
|
|
346
361
|
userId: z.ZodString;
|
|
@@ -374,6 +389,7 @@ export declare const productViewerSchema: z.ZodObject<{
|
|
|
374
389
|
canEdit: z.ZodBoolean;
|
|
375
390
|
canManageTeam: z.ZodBoolean;
|
|
376
391
|
canDelete: z.ZodBoolean;
|
|
392
|
+
canSetLive: z.ZodBoolean;
|
|
377
393
|
canRepresent: z.ZodBoolean;
|
|
378
394
|
canReview: z.ZodBoolean;
|
|
379
395
|
canReport: z.ZodBoolean;
|
|
@@ -439,9 +455,9 @@ export declare const productSchema: z.ZodObject<{
|
|
|
439
455
|
}>;
|
|
440
456
|
stage: z.ZodEnum<{
|
|
441
457
|
idea: "idea";
|
|
458
|
+
live: "live";
|
|
442
459
|
building: "building";
|
|
443
460
|
beta: "beta";
|
|
444
|
-
live: "live";
|
|
445
461
|
}>;
|
|
446
462
|
platforms: z.ZodArray<z.ZodEnum<{
|
|
447
463
|
api: "api";
|
|
@@ -472,6 +488,11 @@ export declare const productSchema: z.ZodObject<{
|
|
|
472
488
|
launch: "launch";
|
|
473
489
|
ideas: "ideas";
|
|
474
490
|
}>>;
|
|
491
|
+
paused: z.ZodOptional<z.ZodBoolean>;
|
|
492
|
+
pausedBy: z.ZodOptional<z.ZodEnum<{
|
|
493
|
+
limit: "limit";
|
|
494
|
+
owner: "owner";
|
|
495
|
+
}>>;
|
|
475
496
|
description: z.ZodOptional<z.ZodString>;
|
|
476
497
|
links: z.ZodObject<{
|
|
477
498
|
website: z.ZodOptional<z.ZodURL>;
|
|
@@ -602,6 +623,7 @@ export declare const productSchema: z.ZodObject<{
|
|
|
602
623
|
canEdit: z.ZodBoolean;
|
|
603
624
|
canManageTeam: z.ZodBoolean;
|
|
604
625
|
canDelete: z.ZodBoolean;
|
|
626
|
+
canSetLive: z.ZodBoolean;
|
|
605
627
|
canRepresent: z.ZodBoolean;
|
|
606
628
|
canReview: z.ZodBoolean;
|
|
607
629
|
canReport: z.ZodBoolean;
|
|
@@ -690,9 +712,9 @@ export declare const productInvitesSchema: z.ZodObject<{
|
|
|
690
712
|
export type ProductInvites = z.infer<typeof productInvitesSchema>;
|
|
691
713
|
/**
|
|
692
714
|
* `GET /products/mine`: every product the viewer is on the team of, archived
|
|
693
|
-
* included, owned first. Not paged: a founder
|
|
694
|
-
*
|
|
695
|
-
*
|
|
715
|
+
* and paused included, owned first. Not paged: a founder lists few, and joins
|
|
716
|
+
* teams by accepting invitations one at a time, so the list stays short in
|
|
717
|
+
* practice; there is no hard cap on teams joined.
|
|
696
718
|
*/
|
|
697
719
|
export declare const myProductsSchema: z.ZodObject<{
|
|
698
720
|
items: z.ZodArray<z.ZodObject<{
|
|
@@ -749,9 +771,9 @@ export declare const myProductsSchema: z.ZodObject<{
|
|
|
749
771
|
}>;
|
|
750
772
|
stage: z.ZodEnum<{
|
|
751
773
|
idea: "idea";
|
|
774
|
+
live: "live";
|
|
752
775
|
building: "building";
|
|
753
776
|
beta: "beta";
|
|
754
|
-
live: "live";
|
|
755
777
|
}>;
|
|
756
778
|
platforms: z.ZodArray<z.ZodEnum<{
|
|
757
779
|
api: "api";
|
|
@@ -783,6 +805,7 @@ export declare const myProductsSchema: z.ZodObject<{
|
|
|
783
805
|
ideas: "ideas";
|
|
784
806
|
}>>;
|
|
785
807
|
hiddenByStaff: z.ZodOptional<z.ZodBoolean>;
|
|
808
|
+
paused: z.ZodOptional<z.ZodBoolean>;
|
|
786
809
|
viewer: z.ZodOptional<z.ZodObject<{
|
|
787
810
|
upvoted: z.ZodBoolean;
|
|
788
811
|
canUpvote: z.ZodBoolean;
|
|
@@ -863,9 +886,9 @@ export declare const productCardPageSchema: z.ZodObject<{
|
|
|
863
886
|
}>;
|
|
864
887
|
stage: z.ZodEnum<{
|
|
865
888
|
idea: "idea";
|
|
889
|
+
live: "live";
|
|
866
890
|
building: "building";
|
|
867
891
|
beta: "beta";
|
|
868
|
-
live: "live";
|
|
869
892
|
}>;
|
|
870
893
|
platforms: z.ZodArray<z.ZodEnum<{
|
|
871
894
|
api: "api";
|
|
@@ -897,6 +920,7 @@ export declare const productCardPageSchema: z.ZodObject<{
|
|
|
897
920
|
ideas: "ideas";
|
|
898
921
|
}>>;
|
|
899
922
|
hiddenByStaff: z.ZodOptional<z.ZodBoolean>;
|
|
923
|
+
paused: z.ZodOptional<z.ZodBoolean>;
|
|
900
924
|
viewer: z.ZodOptional<z.ZodObject<{
|
|
901
925
|
upvoted: z.ZodBoolean;
|
|
902
926
|
canUpvote: z.ZodBoolean;
|
|
@@ -1005,9 +1029,9 @@ export declare const productFacetsSchema: z.ZodObject<{
|
|
|
1005
1029
|
stages: z.ZodArray<z.ZodObject<{
|
|
1006
1030
|
value: z.ZodEnum<{
|
|
1007
1031
|
idea: "idea";
|
|
1032
|
+
live: "live";
|
|
1008
1033
|
building: "building";
|
|
1009
1034
|
beta: "beta";
|
|
1010
|
-
live: "live";
|
|
1011
1035
|
}>;
|
|
1012
1036
|
count: z.ZodNumber;
|
|
1013
1037
|
}, z.core.$strip>>;
|
|
@@ -1075,9 +1099,9 @@ export declare const productDiscoverQuerySchema: z.ZodObject<{
|
|
|
1075
1099
|
}>>>, unknown>;
|
|
1076
1100
|
stage: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1077
1101
|
idea: "idea";
|
|
1102
|
+
live: "live";
|
|
1078
1103
|
building: "building";
|
|
1079
1104
|
beta: "beta";
|
|
1080
|
-
live: "live";
|
|
1081
1105
|
}>>>, unknown>;
|
|
1082
1106
|
platform: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1083
1107
|
api: "api";
|
|
@@ -1165,9 +1189,9 @@ export declare const createProductBodySchema: z.ZodObject<{
|
|
|
1165
1189
|
}>;
|
|
1166
1190
|
stage: z.ZodEnum<{
|
|
1167
1191
|
idea: "idea";
|
|
1192
|
+
live: "live";
|
|
1168
1193
|
building: "building";
|
|
1169
1194
|
beta: "beta";
|
|
1170
|
-
live: "live";
|
|
1171
1195
|
}>;
|
|
1172
1196
|
platforms: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1173
1197
|
api: "api";
|
|
@@ -1298,9 +1322,9 @@ export declare const updateProductBodySchema: z.ZodObject<{
|
|
|
1298
1322
|
}>>;
|
|
1299
1323
|
stage: z.ZodOptional<z.ZodEnum<{
|
|
1300
1324
|
idea: "idea";
|
|
1325
|
+
live: "live";
|
|
1301
1326
|
building: "building";
|
|
1302
1327
|
beta: "beta";
|
|
1303
|
-
live: "live";
|
|
1304
1328
|
}>>;
|
|
1305
1329
|
platforms: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1306
1330
|
api: "api";
|
|
@@ -1425,6 +1449,14 @@ export declare const setProductStatusBodySchema: z.ZodObject<{
|
|
|
1425
1449
|
}>;
|
|
1426
1450
|
}, z.core.$strip>;
|
|
1427
1451
|
export type SetProductStatusBody = z.infer<typeof setProductStatusBodySchema>;
|
|
1452
|
+
/**
|
|
1453
|
+
* `PUT /products/:productId/live` (0.12.0, owner): `false` pauses it (to free
|
|
1454
|
+
* a live place for another), `true` makes a paused one live again.
|
|
1455
|
+
*/
|
|
1456
|
+
export declare const setProductLiveBodySchema: z.ZodObject<{
|
|
1457
|
+
live: z.ZodBoolean;
|
|
1458
|
+
}, z.core.$strip>;
|
|
1459
|
+
export type SetProductLiveBody = z.infer<typeof setProductLiveBodySchema>;
|
|
1428
1460
|
/**
|
|
1429
1461
|
* Invite a member to the team; they must accept. `userId` is the member's id
|
|
1430
1462
|
* as every card carries it (`founderCardSchema.userId`). Someone who cannot
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../../src/domains/products/products.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../../src/domains/products/products.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4BxB,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAKpC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,+CAAgD,CAAC;AAClF,eAAO,MAAM,kBAAkB;;;;;EAA+B,CAAC;AAC/D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,uBAAuB,gGAS1B,CAAC;AACX,eAAO,MAAM,qBAAqB;;;;;;;;;EAAkC,CAAC;AACrE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,6EAA6E;AAC7E,eAAO,MAAM,yBAAyB,iCAAkC,CAAC;AACzE,eAAO,MAAM,uBAAuB;;;EAAoC,CAAC;AACzE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,iCAAkC,CAAC;AACrE,eAAO,MAAM,mBAAmB;;;EAAgC,CAAC;AACjE,MAAM,MAAM,aAA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,CAAC,CAAC"}
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
* PUT /api/v1/products/:productId/screenshots setProductScreenshotsBodySchema -> productSchema
|
|
52
52
|
* PUT /api/v1/products/:productId/visibility setProductVisibilityBodySchema -> productSchema
|
|
53
53
|
* PUT /api/v1/products/:productId/status setProductStatusBodySchema -> productSchema
|
|
54
|
+
* PUT /api/v1/products/:productId/live setProductLiveBodySchema -> productSchema (0.12.0)
|
|
54
55
|
* GET /api/v1/products/:productId/team productTeamPageSchema
|
|
55
56
|
* GET /api/v1/products/:productId/invites productPendingInvitePageSchema (managers)
|
|
56
57
|
* POST /api/v1/products/:productId/invites inviteProductMemberBodySchema -> productPendingInviteSchema
|
|
@@ -235,8 +236,24 @@ export const productCardSchema = z.object({
|
|
|
235
236
|
* "my products", on a team member's profile): a "Hidden by moderators" badge.
|
|
236
237
|
*/
|
|
237
238
|
hiddenByStaff: z.boolean().optional(),
|
|
239
|
+
/**
|
|
240
|
+
* Paused (0.12.0): its owner owns more products than their plan keeps
|
|
241
|
+
* live. Like a hidden one, only its team and staff see it at all: a
|
|
242
|
+
* "Paused" badge. The owner makes it live again (`PUT .../live`) when a
|
|
243
|
+
* place is free.
|
|
244
|
+
*/
|
|
245
|
+
paused: z.boolean().optional(),
|
|
238
246
|
viewer: productCardViewerSchema.optional(),
|
|
239
247
|
});
|
|
248
|
+
/**
|
|
249
|
+
* Why a product is paused (0.12.0). ⚠ Stored: append only.
|
|
250
|
+
* limit over its owner's live places (a plan ended, a refund, joining
|
|
251
|
+
* without one): it comes back by itself when a place frees
|
|
252
|
+
* owner its owner paused it, to free a place for another: it stays
|
|
253
|
+
* paused until they make it live
|
|
254
|
+
*/
|
|
255
|
+
export const PRODUCT_PAUSED_BY_VALUES = ['limit', 'owner'];
|
|
256
|
+
export const productPausedBySchema = z.enum(PRODUCT_PAUSED_BY_VALUES);
|
|
240
257
|
/** One person on a product's team, live-joined like every byline. */
|
|
241
258
|
export const productTeamMemberSchema = memberBylineSchema.extend({
|
|
242
259
|
role: productTeamRoleSchema,
|
|
@@ -260,6 +277,12 @@ export const productViewerSchema = productCardViewerSchema.extend({
|
|
|
260
277
|
canManageTeam: z.boolean(),
|
|
261
278
|
/** Owner. */
|
|
262
279
|
canDelete: z.boolean(),
|
|
280
|
+
/**
|
|
281
|
+
* Owner (0.12.0): may pause it, or make it live again. Making it live is
|
|
282
|
+
* refused with `PRODUCT_LIMIT_REACHED` when no live place is free; the page
|
|
283
|
+
* says so from `GET /me/membership`.
|
|
284
|
+
*/
|
|
285
|
+
canSetLive: z.boolean(),
|
|
263
286
|
/** Anyone on the team: tag posts with it, reply to reviews, mark feedback, confirm testers. */
|
|
264
287
|
canRepresent: z.boolean(),
|
|
265
288
|
/** Not on its team, no review yet, and the product is open. */
|
|
@@ -274,6 +297,8 @@ export const productViewerSchema = productCardViewerSchema.extend({
|
|
|
274
297
|
});
|
|
275
298
|
/** The product page. */
|
|
276
299
|
export const productSchema = productCardSchema.extend({
|
|
300
|
+
/** Set with `paused` (0.12.0): who paused it, so the page says why. */
|
|
301
|
+
pausedBy: productPausedBySchema.optional(),
|
|
277
302
|
description: z.string().optional(),
|
|
278
303
|
links: productLinksSchema,
|
|
279
304
|
videoUrl: z.string().optional(),
|
|
@@ -324,9 +349,9 @@ export const productInviteSchema = z.object({
|
|
|
324
349
|
export const productInvitesSchema = z.object({ items: z.array(productInviteSchema) });
|
|
325
350
|
/**
|
|
326
351
|
* `GET /products/mine`: every product the viewer is on the team of, archived
|
|
327
|
-
* included, owned first. Not paged: a founder
|
|
328
|
-
*
|
|
329
|
-
*
|
|
352
|
+
* and paused included, owned first. Not paged: a founder lists few, and joins
|
|
353
|
+
* teams by accepting invitations one at a time, so the list stays short in
|
|
354
|
+
* practice; there is no hard cap on teams joined.
|
|
330
355
|
*/
|
|
331
356
|
export const myProductsSchema = z.object({ items: z.array(productCardSchema) });
|
|
332
357
|
/** A member the team confirmed tested the product. */
|
|
@@ -448,6 +473,11 @@ export const setProductLogoBodySchema = z.object({ mediaId: objectIdSchema });
|
|
|
448
473
|
export const setProductScreenshotsBodySchema = z.object({ screenshots: screenshotsInputSchema });
|
|
449
474
|
export const setProductVisibilityBodySchema = z.object({ visibility: productVisibilitySchema });
|
|
450
475
|
export const setProductStatusBodySchema = z.object({ status: productStatusSchema });
|
|
476
|
+
/**
|
|
477
|
+
* `PUT /products/:productId/live` (0.12.0, owner): `false` pauses it (to free
|
|
478
|
+
* a live place for another), `true` makes a paused one live again.
|
|
479
|
+
*/
|
|
480
|
+
export const setProductLiveBodySchema = z.object({ live: z.boolean() });
|
|
451
481
|
/**
|
|
452
482
|
* Invite a member to the team; they must accept. `userId` is the member's id
|
|
453
483
|
* as every card carries it (`founderCardSchema.userId`). Someone who cannot
|