@openpeepshq/common 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/dist/lib/eventIcs.d.ts +41 -1
- package/dist/lib/eventIcs.js +174 -16
- package/dist/lib/postHelpers.d.ts +3 -3
- package/dist/lib/postHelpers.js +2 -2
- package/dist/lib/reactions.d.ts +5 -3
- package/dist/lib/reactions.js +5 -9
- package/dist/types/api.d.ts +86 -0
- package/dist/types/api.js +22 -0
- package/dist/types/db.d.ts +42 -0
- package/dist/types/internal.d.ts +60 -0
- package/dist/types/models.d.ts +31 -0
- package/dist/types/models.js +16 -1
- package/dist/types/stats.d.ts +48 -0
- package/package.json +1 -1
- package/src/lib/eventIcs.ts +192 -21
- package/src/lib/postHelpers.ts +2 -2
- package/src/lib/reactions.ts +8 -8
- package/src/types/api.ts +45 -0
- package/src/types/models.ts +17 -1
package/src/types/api.ts
CHANGED
|
@@ -580,6 +580,16 @@ export const jamTokenResponseSchema = tokenResponseSchema.extend({
|
|
|
580
580
|
});
|
|
581
581
|
export type JamTokenResponse = z.infer<typeof jamTokenResponseSchema>;
|
|
582
582
|
|
|
583
|
+
// The calendar-feed mint returns no `checkoutUrl`; a dedicated shape keeps
|
|
584
|
+
// the endpoint's contract exact.
|
|
585
|
+
export const calendarFeedTokenResponseSchema = z.object({
|
|
586
|
+
success: z.literal(true),
|
|
587
|
+
token: z.string(),
|
|
588
|
+
});
|
|
589
|
+
export type CalendarFeedTokenResponse = z.infer<
|
|
590
|
+
typeof calendarFeedTokenResponseSchema
|
|
591
|
+
>;
|
|
592
|
+
|
|
583
593
|
/**
|
|
584
594
|
* Waiting-room entry as stored in Redis and streamed to moderators: the
|
|
585
595
|
* profile's `displayName` (or `handle` when absent) keyed by `profile.id`.
|
|
@@ -775,6 +785,41 @@ export const chronologicalInfiniteQueryParamsSchema = z.object({
|
|
|
775
785
|
export type ChronologicalInfiniteQueryParams =
|
|
776
786
|
| z.infer<typeof chronologicalInfiniteQueryParamsSchema>
|
|
777
787
|
| undefined;
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Notifications feed query. `excludeTypes` is comma-joined because fetch
|
|
791
|
+
* query params only allow string | number; the server splits it back.
|
|
792
|
+
*/
|
|
793
|
+
export type NotificationFeedQueryParams = ChronologicalInfiniteQueryParams &
|
|
794
|
+
NotificationFeedExcludeTypesQuery;
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* The `excludeTypes` query param of the notifications feed `GET` and the
|
|
798
|
+
* mark-all-seen `PUT`, shared by both client endpoint declarations so the two
|
|
799
|
+
* can't drift from each other or from `excludeTypesQuerySchema` (whose parse
|
|
800
|
+
* consumes exactly this comma-joined string).
|
|
801
|
+
*/
|
|
802
|
+
export type NotificationFeedExcludeTypesQuery = { excludeTypes?: string };
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Server-side schema for the notifications `excludeTypes` query param. The
|
|
806
|
+
* client sends a comma-joined string (fetch query params only allow
|
|
807
|
+
* string | number); this splits it back into a list of type keys. Shared by
|
|
808
|
+
* the feed `GET` and the mark-all-seen `PUT` so the two can't drift.
|
|
809
|
+
*
|
|
810
|
+
* The parse must be idempotent: Riddl validates the query before the handler
|
|
811
|
+
* and the handlers re-parse the already-parsed value, so the second pass sees
|
|
812
|
+
* the array this transform produces. Accepting the array (union) in addition
|
|
813
|
+
* to the string keeps both passes stable; a plain `z.string()` would reject
|
|
814
|
+
* the array and 500 the endpoint.
|
|
815
|
+
*/
|
|
816
|
+
export const excludeTypesQuerySchema = z
|
|
817
|
+
.union([z.string(), z.array(z.string())])
|
|
818
|
+
.transform((value) =>
|
|
819
|
+
(Array.isArray(value) ? value : value.split(',')).filter(Boolean),
|
|
820
|
+
)
|
|
821
|
+
.optional();
|
|
822
|
+
|
|
778
823
|
export const offsetInfiniteQueryParamsSchema = z.object({
|
|
779
824
|
offset: z.coerce.number().optional(),
|
|
780
825
|
limit: z.coerce.number().optional(),
|
package/src/types/models.ts
CHANGED
|
@@ -184,6 +184,8 @@ export const profileSettingsDataSchema = z.object({
|
|
|
184
184
|
theme: ThemeOptionsSchema.optional(),
|
|
185
185
|
defaults: profileSettingsDefaultsSchema.optional(),
|
|
186
186
|
notifications: z.record(z.string(), profileNotificationSettings).optional(),
|
|
187
|
+
/** Notification types hidden from the feed (display only; creation is unaffected). */
|
|
188
|
+
hiddenNotificationTypes: z.string().array().optional(),
|
|
187
189
|
/** Per-group level. A missing group id means all activity for that group. */
|
|
188
190
|
groupNotificationLevels: z
|
|
189
191
|
.record(z.string(), groupNotificationLevelSchema)
|
|
@@ -914,7 +916,21 @@ export const pushSubscriptionSchema = z.discriminatedUnion('type', [
|
|
|
914
916
|
modelSchema(pushSubscriptionWebhookDataSchema),
|
|
915
917
|
]);
|
|
916
918
|
export type PushSubscription = z.infer<typeof pushSubscriptionSchema>;
|
|
917
|
-
|
|
919
|
+
/**
|
|
920
|
+
* Reactions users can attach to a post. Single source of truth for the
|
|
921
|
+
* picker UI and the API schema.
|
|
922
|
+
*/
|
|
923
|
+
export const REACTION_TYPES = [
|
|
924
|
+
'👍',
|
|
925
|
+
'👎',
|
|
926
|
+
'❤️',
|
|
927
|
+
'😂',
|
|
928
|
+
'😮',
|
|
929
|
+
'😢',
|
|
930
|
+
'🎉',
|
|
931
|
+
] as const;
|
|
932
|
+
|
|
933
|
+
export const reactionTypeSchema = z.enum(REACTION_TYPES);
|
|
918
934
|
|
|
919
935
|
export const reactionDataSchema = z.object({
|
|
920
936
|
reaction: reactionTypeSchema,
|