@openpeepshq/core 0.2.0 → 0.2.2

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 (74) hide show
  1. package/LICENSE +674 -0
  2. package/dist/accounts/mutations.js +9 -0
  3. package/dist/analytics/cache.js +1 -1
  4. package/dist/config/index.d.ts +3 -336
  5. package/dist/db/explorer/index.d.ts +1 -1
  6. package/dist/db/explorer/index.js +1 -1
  7. package/dist/db/index.d.ts +1 -1
  8. package/dist/db/index.js +1 -1
  9. package/dist/db/pg/map/registry.js +3 -2
  10. package/dist/federation/actors.d.ts +32 -0
  11. package/dist/federation/actors.js +136 -0
  12. package/dist/federation/identity.d.ts +11 -0
  13. package/dist/federation/identity.js +11 -0
  14. package/dist/federation/index.d.ts +8 -1
  15. package/dist/federation/index.js +5 -1
  16. package/dist/federation/ingest.d.ts +9 -0
  17. package/dist/federation/ingest.js +60 -0
  18. package/dist/federation/notes.d.ts +8 -0
  19. package/dist/federation/notes.js +30 -0
  20. package/dist/federation/peers.d.ts +3 -0
  21. package/dist/federation/peers.js +24 -0
  22. package/dist/jams/export.d.ts +2 -0
  23. package/dist/jams/export.js +5 -0
  24. package/dist/jams/finders.d.ts +1 -0
  25. package/dist/jams/finders.js +1 -0
  26. package/dist/jams/health.d.ts +23 -0
  27. package/dist/jams/health.js +79 -7
  28. package/dist/jams/index.d.ts +1 -1
  29. package/dist/jams/index.js +10 -3
  30. package/dist/jams/token.js +6 -2
  31. package/dist/jams/waitingRoom.js +3 -1
  32. package/dist/media/garbageCollection.d.ts +109 -0
  33. package/dist/media/garbageCollection.js +603 -0
  34. package/dist/media/garbageCollectionJobs.d.ts +14 -0
  35. package/dist/media/garbageCollectionJobs.js +55 -0
  36. package/dist/media/index.d.ts +10 -0
  37. package/dist/media/index.js +39 -15
  38. package/dist/media/streaming.d.ts +2 -0
  39. package/dist/media/streaming.js +8 -0
  40. package/dist/notifications/defaultNotifications/index.js +2 -0
  41. package/dist/notifications/defaultNotifications/jamStarted/index.d.ts +1 -0
  42. package/dist/notifications/defaultNotifications/jamStarted/index.js +61 -13
  43. package/dist/notifications/defaultNotifications/waitlistOffer/index.d.ts +24 -0
  44. package/dist/notifications/defaultNotifications/waitlistOffer/index.js +40 -0
  45. package/dist/notifications/index.d.ts +1 -1
  46. package/dist/notifications/index.js +1 -1
  47. package/dist/plugins/pluginAuth.js +1 -0
  48. package/dist/posts/conversationQueries.d.ts +31 -0
  49. package/dist/posts/conversationQueries.js +150 -24
  50. package/dist/posts/finders.d.ts +9 -0
  51. package/dist/posts/finders.js +23 -3
  52. package/dist/posts/helpers/index.d.ts +10 -2
  53. package/dist/posts/helpers/index.js +6 -0
  54. package/dist/posts/index.d.ts +3 -1
  55. package/dist/posts/index.js +3 -1
  56. package/dist/posts/mapping.d.ts +14 -0
  57. package/dist/posts/mutations.d.ts +13 -6
  58. package/dist/posts/mutations.js +271 -72
  59. package/dist/posts/rsvpExport.d.ts +47 -0
  60. package/dist/posts/rsvpExport.js +178 -0
  61. package/dist/posts/unseenCounts.d.ts +6 -0
  62. package/dist/posts/unseenCounts.js +51 -1
  63. package/dist/posts/waitlist.d.ts +13 -0
  64. package/dist/posts/waitlist.js +75 -0
  65. package/dist/posts/waitlistOfferJobs.d.ts +10 -0
  66. package/dist/posts/waitlistOfferJobs.js +91 -0
  67. package/dist/profiles/index.js +6 -1
  68. package/dist/profiles/mutations.js +6 -3
  69. package/dist/reports/mapping.d.ts +1 -1
  70. package/dist/server/index.d.ts +1 -0
  71. package/dist/stats/mapping.d.ts +1 -0
  72. package/dist/stripe/connection.js +1 -1
  73. package/dist/stripe/helpers.js +7 -3
  74. package/package.json +11 -10
@@ -126,6 +126,7 @@ export declare const entryConnector: (db: import("../../db").PgDb, from: Profile
126
126
  image?: string | undefined;
127
127
  end?: string | undefined;
128
128
  maxAttendees?: number | undefined;
129
+ waitlistOfferMinutes?: number | undefined;
129
130
  attendeeListPublic?: boolean | undefined;
130
131
  moderators?: string[] | undefined;
131
132
  jam?: {
@@ -359,6 +360,7 @@ export declare const entryConnector: (db: import("../../db").PgDb, from: Profile
359
360
  image?: string | undefined;
360
361
  end?: string | undefined;
361
362
  maxAttendees?: number | undefined;
363
+ waitlistOfferMinutes?: number | undefined;
362
364
  attendeeListPublic?: boolean | undefined;
363
365
  moderators?: string[] | undefined;
364
366
  jam?: {
@@ -488,8 +490,10 @@ export declare const entryConnector: (db: import("../../db").PgDb, from: Profile
488
490
  } | {
489
491
  type: "rsvp";
490
492
  data: {
491
- response: "no" | "yes" | "tentative" | "removed";
493
+ response: "no" | "yes" | "tentative" | "removed" | "waitlist";
492
494
  recurrenceId?: string | undefined;
495
+ waitlistJoinedAt?: string | undefined;
496
+ offerExpiresAt?: string | undefined;
493
497
  };
494
498
  } | {
495
499
  type: "reaction";
@@ -620,6 +624,7 @@ export declare const entryConnector: (db: import("../../db").PgDb, from: Profile
620
624
  image?: string | undefined;
621
625
  end?: string | undefined;
622
626
  maxAttendees?: number | undefined;
627
+ waitlistOfferMinutes?: number | undefined;
623
628
  attendeeListPublic?: boolean | undefined;
624
629
  moderators?: string[] | undefined;
625
630
  jam?: {
@@ -853,6 +858,7 @@ export declare const entryConnector: (db: import("../../db").PgDb, from: Profile
853
858
  image?: string | undefined;
854
859
  end?: string | undefined;
855
860
  maxAttendees?: number | undefined;
861
+ waitlistOfferMinutes?: number | undefined;
856
862
  attendeeListPublic?: boolean | undefined;
857
863
  moderators?: string[] | undefined;
858
864
  jam?: {
@@ -982,8 +988,10 @@ export declare const entryConnector: (db: import("../../db").PgDb, from: Profile
982
988
  } | {
983
989
  type: "rsvp";
984
990
  data: {
985
- response: "no" | "yes" | "tentative" | "removed";
991
+ response: "no" | "yes" | "tentative" | "removed" | "waitlist";
986
992
  recurrenceId?: string | undefined;
993
+ waitlistJoinedAt?: string | undefined;
994
+ offerExpiresAt?: string | undefined;
987
995
  };
988
996
  } | {
989
997
  type: "reaction";
@@ -137,6 +137,12 @@ export const transformPost = async (post, currentProfile, options = {}) => {
137
137
  profile: entry.profile,
138
138
  response: entry.data.response,
139
139
  recurrenceId: entry.data.recurrenceId,
140
+ ...(entry.data.waitlistJoinedAt
141
+ ? { waitlistJoinedAt: entry.data.waitlistJoinedAt }
142
+ : {}),
143
+ ...(entry.data.offerExpiresAt
144
+ ? { offerExpiresAt: entry.data.offerExpiresAt }
145
+ : {}),
140
146
  createdAt: entry.createdAt,
141
147
  })),
142
148
  audience,
@@ -3,11 +3,13 @@ export * from './mutations';
3
3
  export * from './mapping';
4
4
  export { CONTEXT_NODE_CAP, collectReplyClosureIds, loadReplyContextPosts, } from './contextClosure';
5
5
  export { loadThreadPreviewReplies, THREAD_PREVIEW_LIMIT, } from './threadPreview';
6
- export { listConversationPreviews, getConversationThread, findLatestThreadPostId, listLeftConversations, } from './conversationQueries';
6
+ export { listConversationPreviews, getConversationThread, getOneToOneConversation, listOneToOneConversationPostIds, listOneToOneConversationRootLeaves, findLatestThreadPostId, listLeftConversations, } from './conversationQueries';
7
7
  export * from './helpers';
8
8
  export { bumpConversationActivity, findReplyRootId } from './activity';
9
9
  export { registerRsvpConfirmationEmail } from './rsvpConfirmationEmail';
10
+ export { exportEventRsvpsCsv } from './rsvpExport';
10
11
  export { rebuildEventOccurrences, clearEventOccurrences, backfillMissingEventOccurrences, rebuildRecurringEventOccurrences, } from './eventOccurrences';
11
12
  export { listEventAgenda } from './eventAgenda';
12
13
  export { eventOccurrenceQueue, eventOccurrenceWorker, ensureEventOccurrenceSchedule, } from './eventOccurrenceJobs';
13
14
  export { pollEndQueue, pollEndWorker, schedulePollEnd, cancelPollEnd, } from './pollEndJobs';
15
+ export { waitlistOfferQueue, waitlistOfferWorker } from './waitlistOfferJobs';
@@ -3,11 +3,13 @@ export * from './mutations.js';
3
3
  export * from './mapping.js';
4
4
  export { CONTEXT_NODE_CAP, collectReplyClosureIds, loadReplyContextPosts, } from './contextClosure.js';
5
5
  export { loadThreadPreviewReplies, THREAD_PREVIEW_LIMIT, } from './threadPreview.js';
6
- export { listConversationPreviews, getConversationThread, findLatestThreadPostId, listLeftConversations, } from './conversationQueries.js';
6
+ export { listConversationPreviews, getConversationThread, getOneToOneConversation, listOneToOneConversationPostIds, listOneToOneConversationRootLeaves, findLatestThreadPostId, listLeftConversations, } from './conversationQueries.js';
7
7
  export * from './helpers/index.js';
8
8
  export { bumpConversationActivity, findReplyRootId } from './activity.js';
9
9
  export { registerRsvpConfirmationEmail } from './rsvpConfirmationEmail.js';
10
+ export { exportEventRsvpsCsv } from './rsvpExport.js';
10
11
  export { rebuildEventOccurrences, clearEventOccurrences, backfillMissingEventOccurrences, rebuildRecurringEventOccurrences, } from './eventOccurrences.js';
11
12
  export { listEventAgenda } from './eventAgenda.js';
12
13
  export { eventOccurrenceQueue, eventOccurrenceWorker, ensureEventOccurrenceSchedule, } from './eventOccurrenceJobs.js';
13
14
  export { pollEndQueue, pollEndWorker, schedulePollEnd, cancelPollEnd, } from './pollEndJobs.js';
15
+ export { waitlistOfferQueue, waitlistOfferWorker } from './waitlistOfferJobs.js';
@@ -126,6 +126,7 @@ export declare const threadPreviewMappingForProfile: (profile?: {
126
126
  image?: string | undefined;
127
127
  end?: string | undefined;
128
128
  maxAttendees?: number | undefined;
129
+ waitlistOfferMinutes?: number | undefined;
129
130
  attendeeListPublic?: boolean | undefined;
130
131
  moderators?: string[] | undefined;
131
132
  jam?: {
@@ -371,6 +372,7 @@ export declare const postsWithReplyCountMapping: Mapping<{
371
372
  image?: string | undefined;
372
373
  end?: string | undefined;
373
374
  maxAttendees?: number | undefined;
375
+ waitlistOfferMinutes?: number | undefined;
374
376
  attendeeListPublic?: boolean | undefined;
375
377
  moderators?: string[] | undefined;
376
378
  jam?: {
@@ -611,6 +613,7 @@ export declare const postsWithReplyCountMapping: Mapping<{
611
613
  image?: string | undefined;
612
614
  end?: string | undefined;
613
615
  maxAttendees?: number | undefined;
616
+ waitlistOfferMinutes?: number | undefined;
614
617
  attendeeListPublic?: boolean | undefined;
615
618
  moderators?: string[] | undefined;
616
619
  jam?: {
@@ -855,6 +858,7 @@ export declare const postsWithReplyCountMapping: Mapping<{
855
858
  image?: string | undefined;
856
859
  end?: string | undefined;
857
860
  maxAttendees?: number | undefined;
861
+ waitlistOfferMinutes?: number | undefined;
858
862
  attendeeListPublic?: boolean | undefined;
859
863
  moderators?: string[] | undefined;
860
864
  jam?: {
@@ -1096,6 +1100,7 @@ export declare const postsWithReplyToCountMapping: Mapping<{
1096
1100
  image?: string | undefined;
1097
1101
  end?: string | undefined;
1098
1102
  maxAttendees?: number | undefined;
1103
+ waitlistOfferMinutes?: number | undefined;
1099
1104
  attendeeListPublic?: boolean | undefined;
1100
1105
  moderators?: string[] | undefined;
1101
1106
  jam?: {
@@ -1336,6 +1341,7 @@ export declare const postsWithReplyToCountMapping: Mapping<{
1336
1341
  image?: string | undefined;
1337
1342
  end?: string | undefined;
1338
1343
  maxAttendees?: number | undefined;
1344
+ waitlistOfferMinutes?: number | undefined;
1339
1345
  attendeeListPublic?: boolean | undefined;
1340
1346
  moderators?: string[] | undefined;
1341
1347
  jam?: {
@@ -1580,6 +1586,7 @@ export declare const postsWithReplyToCountMapping: Mapping<{
1580
1586
  image?: string | undefined;
1581
1587
  end?: string | undefined;
1582
1588
  maxAttendees?: number | undefined;
1589
+ waitlistOfferMinutes?: number | undefined;
1583
1590
  attendeeListPublic?: boolean | undefined;
1584
1591
  moderators?: string[] | undefined;
1585
1592
  jam?: {
@@ -1821,6 +1828,7 @@ export declare const postsMapping: Mapping<{
1821
1828
  image?: string | undefined;
1822
1829
  end?: string | undefined;
1823
1830
  maxAttendees?: number | undefined;
1831
+ waitlistOfferMinutes?: number | undefined;
1824
1832
  attendeeListPublic?: boolean | undefined;
1825
1833
  moderators?: string[] | undefined;
1826
1834
  jam?: {
@@ -2059,6 +2067,7 @@ export declare const postsAuthMapping: Mapping<{
2059
2067
  image?: string | undefined;
2060
2068
  end?: string | undefined;
2061
2069
  maxAttendees?: number | undefined;
2070
+ waitlistOfferMinutes?: number | undefined;
2062
2071
  attendeeListPublic?: boolean | undefined;
2063
2072
  moderators?: string[] | undefined;
2064
2073
  jam?: {
@@ -2298,6 +2307,7 @@ export declare const postsMappingForProfile: (profile?: {
2298
2307
  image?: string | undefined;
2299
2308
  end?: string | undefined;
2300
2309
  maxAttendees?: number | undefined;
2310
+ waitlistOfferMinutes?: number | undefined;
2301
2311
  attendeeListPublic?: boolean | undefined;
2302
2312
  moderators?: string[] | undefined;
2303
2313
  jam?: {
@@ -2537,6 +2547,7 @@ export declare const postContextMappingForProfile: (profile?: {
2537
2547
  image?: string | undefined;
2538
2548
  end?: string | undefined;
2539
2549
  maxAttendees?: number | undefined;
2550
+ waitlistOfferMinutes?: number | undefined;
2540
2551
  attendeeListPublic?: boolean | undefined;
2541
2552
  moderators?: string[] | undefined;
2542
2553
  jam?: {
@@ -2775,6 +2786,7 @@ export declare const conversationLeavesMapping: Mapping<{
2775
2786
  image?: string | undefined;
2776
2787
  end?: string | undefined;
2777
2788
  maxAttendees?: number | undefined;
2789
+ waitlistOfferMinutes?: number | undefined;
2778
2790
  attendeeListPublic?: boolean | undefined;
2779
2791
  moderators?: string[] | undefined;
2780
2792
  jam?: {
@@ -3014,6 +3026,7 @@ export declare const conversationLeavesMappingForProfile: (profile?: {
3014
3026
  image?: string | undefined;
3015
3027
  end?: string | undefined;
3016
3028
  maxAttendees?: number | undefined;
3029
+ waitlistOfferMinutes?: number | undefined;
3017
3030
  attendeeListPublic?: boolean | undefined;
3018
3031
  moderators?: string[] | undefined;
3019
3032
  jam?: {
@@ -3251,6 +3264,7 @@ export declare const postIdsMapping: Mapping<{
3251
3264
  image?: string | undefined;
3252
3265
  end?: string | undefined;
3253
3266
  maxAttendees?: number | undefined;
3267
+ waitlistOfferMinutes?: number | undefined;
3254
3268
  attendeeListPublic?: boolean | undefined;
3255
3269
  moderators?: string[] | undefined;
3256
3270
  jam?: {
@@ -123,6 +123,7 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
123
123
  image?: string | undefined;
124
124
  end?: string | undefined;
125
125
  maxAttendees?: number | undefined;
126
+ waitlistOfferMinutes?: number | undefined;
126
127
  attendeeListPublic?: boolean | undefined;
127
128
  moderators?: string[] | undefined;
128
129
  jam?: {
@@ -356,6 +357,7 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
356
357
  image?: string | undefined;
357
358
  end?: string | undefined;
358
359
  maxAttendees?: number | undefined;
360
+ waitlistOfferMinutes?: number | undefined;
359
361
  attendeeListPublic?: boolean | undefined;
360
362
  moderators?: string[] | undefined;
361
363
  jam?: {
@@ -485,8 +487,10 @@ export declare const retractReaction: (post: PostWithMeta, profile: Profile) =>
485
487
  } | {
486
488
  type: "rsvp";
487
489
  data: {
488
- response: "no" | "yes" | "tentative" | "removed";
490
+ response: "no" | "yes" | "tentative" | "removed" | "waitlist";
489
491
  recurrenceId?: string | undefined;
492
+ waitlistJoinedAt?: string | undefined;
493
+ offerExpiresAt?: string | undefined;
490
494
  };
491
495
  } | {
492
496
  type: "reaction";
@@ -511,11 +515,12 @@ export declare const markPostsSeen: (posts: {
511
515
  }[], profile: Profile) => Promise<void>;
512
516
  export declare const markGroupPostsSeen: (authData: AuthorizationData, groupId: string) => Promise<void>;
513
517
  export declare const deletePost: (post: PostWithMeta, profile: Profile) => Promise<import("@openpeepshq/common").DbPost | undefined>;
518
+ export declare const validatePollVote: (post: PostWithMeta, data: Answer) => void;
514
519
  export declare const vote: (profile: Profile, post: PostWithMeta, data: Answer) => Promise<void>;
515
520
  export declare const rsvpRespond: (profile: Profile, post: PostWithMeta, data: RsvpRequest) => Promise<void>;
516
521
  export declare const rsvpManageByOrganizer: (actingProfile: Profile, targetProfile: Profile, post: PostWithMeta, response: Extract<RsvpResponse, "removed" | "yes">, recurrenceId?: string) => Promise<void>;
517
522
  /**
518
- * Remove a profile from a direct-message conversation thread.
523
+ * Remove a profile from a direct-message conversation.
519
524
  *
520
525
  * - Creates a system "X left" post (empty content) with the *remaining*
521
526
  * participants as audience. The leaving user is excluded so future
@@ -526,9 +531,11 @@ export declare const rsvpManageByOrganizer: (actingProfile: Profile, targetProfi
526
531
  * - The conversation post-creation endpoint detects leavers (author not in
527
532
  * their own post's audience) to block further posting and exclude them
528
533
  * from future replies' audience.
529
- * - For 1:1 DMs (no remaining participants), removes the user from every
530
- * post's audience so the thread vanishes from their inbox.
531
- * - The leaving user can still find the thread in the "Archived" conversations
532
- * tab, detected by posts they authored but are not in.
534
+ * - A 1:1 conversation can span several roots, so each root's thread gets
535
+ * its own "left" post — otherwise the leaver's inbox would keep the
536
+ * threads whose newest post is still in their audience.
537
+ * - When the newest post's audience holds no one but the leaver (everyone
538
+ * else already left), removes the leaver from every post's audience of
539
+ * that root's thread instead of posting again.
533
540
  */
534
541
  export declare const leaveConversation: (rootPost: PostWithMeta, profile: ProfileWithMeta) => Promise<void>;