@openpeepshq/core 0.1.32 → 0.1.34

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 (261) hide show
  1. package/dist/accessTokens/helpers.d.ts +2 -2
  2. package/dist/accessTokens/tokens.js +14 -7
  3. package/dist/accounts/mutations.d.ts +2 -2
  4. package/dist/accounts/mutations.js +33 -35
  5. package/dist/analytics/cache.js +12 -7
  6. package/dist/analytics/compile.js +16 -10
  7. package/dist/analytics/pdfReport.d.ts +1 -0
  8. package/dist/analytics/pdfReport.js +5 -4
  9. package/dist/analytics/privacy.d.ts +18 -0
  10. package/dist/analytics/privacy.js +10 -0
  11. package/dist/analytics/read.js +75 -19
  12. package/dist/analytics/report.d.ts +21 -1
  13. package/dist/analytics/report.js +9 -2
  14. package/dist/backups/index.js +78 -15
  15. package/dist/backups/metadata.d.ts +8 -2
  16. package/dist/backups/metadata.js +6 -2
  17. package/dist/config/defaults/capabilities.js +13 -2
  18. package/dist/config/defaults/community.js +7 -9
  19. package/dist/config/defaults/core.d.ts +1 -1
  20. package/dist/config/defaults/core.js +3 -0
  21. package/dist/config/defaults/db.d.ts +0 -2
  22. package/dist/config/defaults/db.js +0 -2
  23. package/dist/config/index.d.ts +25 -3
  24. package/dist/config/index.js +7 -1
  25. package/dist/db/helpers.d.ts +7 -28
  26. package/dist/db/helpers.js +30 -152
  27. package/dist/db/index.d.ts +3 -1
  28. package/dist/db/index.js +5 -0
  29. package/dist/db/init.js +2 -2
  30. package/dist/db/migration/importCollections.d.ts +15 -10
  31. package/dist/db/migration/importCollections.js +121 -155
  32. package/dist/db/migration/shared.d.ts +2 -37
  33. package/dist/db/migration/shared.js +2 -59
  34. package/dist/db/pg/client.js +4 -0
  35. package/dist/db/pg/collections.d.ts +2 -2
  36. package/dist/db/pg/collections.js +2 -2
  37. package/dist/db/pg/filters/edges.d.ts +1 -1
  38. package/dist/db/pg/filters/edges.js +1 -1
  39. package/dist/db/pg/filters/posts.d.ts +11 -0
  40. package/dist/db/pg/filters/posts.js +37 -3
  41. package/dist/db/pg/filters/profiles.d.ts +1 -0
  42. package/dist/db/pg/filters/profiles.js +2 -1
  43. package/dist/db/pg/map/filters.js +37 -2
  44. package/dist/db/pg/map/mutations.js +13 -8
  45. package/dist/db/pg/map/registry.d.ts +5 -0
  46. package/dist/db/pg/map/registry.js +64 -24
  47. package/dist/db/pg/map/relations.d.ts +1 -1
  48. package/dist/db/pg/map/relations.js +98 -46
  49. package/dist/db/pg/migrate.d.ts +22 -0
  50. package/dist/db/pg/migrate.js +88 -2
  51. package/dist/db/pg/queries/activity.js +3 -3
  52. package/dist/db/pg/queries/sorts.d.ts +1 -0
  53. package/dist/db/pg/queries/sorts.js +4 -0
  54. package/dist/db/pg/schema/documents.d.ts +422 -41
  55. package/dist/db/pg/schema/documents.js +43 -9
  56. package/dist/db/pg/schema/edges.d.ts +117 -7
  57. package/dist/db/pg/schema/edges.js +4 -2
  58. package/dist/db/pg/schema/index.d.ts +505 -15
  59. package/dist/db/pg/sql/0007_shallow_oracle.sql +3 -0
  60. package/dist/db/pg/sql/0008_group_owner_roles.sql +31 -0
  61. package/dist/db/pg/sql/0009_event_occurrences.sql +26 -0
  62. package/dist/db/pg/sql/0010_user_group_membership_roles.sql +16 -0
  63. package/dist/db/pg/sql/0011_drop_data_migrations.sql +1 -0
  64. package/dist/db/pg/sql/0012_posts_last_activity_at.sql +5 -0
  65. package/dist/db/pg/sql/0013_add_blocks_edge.sql +12 -0
  66. package/dist/db/pg/sql/0014_federation_datamodel.sql +59 -0
  67. package/dist/db/pg/sql/0015_profile_hashtags.sql +12 -0
  68. package/dist/db/pg/sql/meta/{0006_snapshot.json → 0015_snapshot.json} +393 -39
  69. package/dist/db/pg/sql/meta/_journal.json +64 -1
  70. package/dist/db/replaceOrigin.js +6 -0
  71. package/dist/db/types.d.ts +0 -4
  72. package/dist/email/render.js +11 -3
  73. package/dist/events/index.d.ts +6 -1
  74. package/dist/events/index.js +55 -33
  75. package/dist/federation/activities.d.ts +17 -0
  76. package/dist/federation/activities.js +26 -0
  77. package/dist/federation/identity.d.ts +16 -0
  78. package/dist/federation/identity.js +52 -0
  79. package/dist/federation/index.d.ts +4 -0
  80. package/dist/federation/index.js +3 -0
  81. package/dist/federation/profiles.d.ts +3 -0
  82. package/dist/federation/profiles.js +14 -0
  83. package/dist/groups/finders.d.ts +3 -2
  84. package/dist/groups/helpers.d.ts +24 -6
  85. package/dist/groups/mapping.d.ts +6 -4
  86. package/dist/groups/mapping.js +2 -2
  87. package/dist/groups/mutations.js +1 -1
  88. package/dist/hashtags/finders.d.ts +6 -3
  89. package/dist/hashtags/finders.js +2 -0
  90. package/dist/hashtags/helpers.d.ts +8 -0
  91. package/dist/hashtags/helpers.js +4 -0
  92. package/dist/hashtags/index.d.ts +2 -0
  93. package/dist/hashtags/index.js +2 -0
  94. package/dist/hashtags/mutations.d.ts +3 -0
  95. package/dist/hashtags/mutations.js +13 -1
  96. package/dist/i18n/index.d.ts +1 -1
  97. package/dist/i18n/index.js +3 -1
  98. package/dist/i18n/pluginLocales.d.ts +6 -0
  99. package/dist/i18n/pluginLocales.js +15 -0
  100. package/dist/inviteLinks/helpers.d.ts +4 -4
  101. package/dist/jams/cache.d.ts +1 -1
  102. package/dist/jams/cache.js +2 -1
  103. package/dist/jams/export.d.ts +19 -0
  104. package/dist/jams/export.js +60 -0
  105. package/dist/jams/finders.d.ts +2 -1
  106. package/dist/jams/finders.js +18 -7
  107. package/dist/jams/health.d.ts +8 -0
  108. package/dist/jams/health.js +46 -0
  109. package/dist/jams/helpers.d.ts +6 -2
  110. package/dist/jams/index.d.ts +6 -3
  111. package/dist/jams/index.js +41 -27
  112. package/dist/jams/jobs.js +1 -1
  113. package/dist/jams/livekit.d.ts +93 -10
  114. package/dist/jams/livekit.js +151 -52
  115. package/dist/jams/mapping.d.ts +17 -7
  116. package/dist/jams/mutations.d.ts +3 -1
  117. package/dist/jams/recording.d.ts +10 -0
  118. package/dist/jams/recording.js +32 -0
  119. package/dist/jams/rtmp.d.ts +5 -0
  120. package/dist/jams/rtmp.js +8 -0
  121. package/dist/jams/token.d.ts +15 -3
  122. package/dist/jams/token.js +30 -16
  123. package/dist/jams/waitingRoom.d.ts +6 -6
  124. package/dist/jams/waitingRoom.js +24 -23
  125. package/dist/jobs/index.d.ts +1 -0
  126. package/dist/jobs/index.js +6 -1
  127. package/dist/jobs/jobDetail.js +1 -6
  128. package/dist/media/index.d.ts +1 -1
  129. package/dist/media/index.js +23 -8
  130. package/dist/media/processing.js +18 -7
  131. package/dist/notifications/defaultNotifications/follow/index.js +2 -2
  132. package/dist/notifications/defaultNotifications/groupMemberJoined/index.js +3 -1
  133. package/dist/notifications/defaultNotifications/groupMemberLeft/index.js +3 -1
  134. package/dist/notifications/defaultNotifications/index.js +4 -0
  135. package/dist/notifications/defaultNotifications/newGroupPost/index.js +12 -6
  136. package/dist/notifications/defaultNotifications/pollEnded/index.d.ts +19 -0
  137. package/dist/notifications/defaultNotifications/pollEnded/index.js +39 -0
  138. package/dist/notifications/defaultNotifications/pollEnded/recipients.d.ts +3 -0
  139. package/dist/notifications/defaultNotifications/pollEnded/recipients.js +18 -0
  140. package/dist/notifications/defaultNotifications/rsvp/index.d.ts +6 -1
  141. package/dist/notifications/defaultNotifications/rsvp/index.js +7 -0
  142. package/dist/notifications/defaultNotifications/rsvpCanceled/index.d.ts +24 -0
  143. package/dist/notifications/defaultNotifications/rsvpCanceled/index.js +75 -0
  144. package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.d.ts +4 -0
  145. package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.js +11 -0
  146. package/dist/notifications/helpers.js +6 -2
  147. package/dist/notifications/jobs.js +3 -1
  148. package/dist/notifications/mutations.js +4 -0
  149. package/dist/notifications/push.js +11 -4
  150. package/dist/plugins/helpers.d.ts +1 -0
  151. package/dist/plugins/helpers.js +1 -8
  152. package/dist/plugins/index.d.ts +5 -0
  153. package/dist/plugins/index.js +78 -5
  154. package/dist/plugins/install.d.ts +39 -0
  155. package/dist/plugins/install.js +455 -0
  156. package/dist/plugins/pluginAuth.d.ts +1 -1
  157. package/dist/plugins/pluginAuth.js +10 -6
  158. package/dist/plugins/state.d.ts +4 -0
  159. package/dist/plugins/state.js +29 -0
  160. package/dist/posts/activity.d.ts +9 -0
  161. package/dist/posts/activity.js +35 -0
  162. package/dist/posts/contextClosure.d.ts +1 -9
  163. package/dist/posts/contextClosure.js +15 -44
  164. package/dist/posts/conversationQueries.d.ts +7 -0
  165. package/dist/posts/conversationQueries.js +76 -2
  166. package/dist/posts/eventAgenda.d.ts +166 -0
  167. package/dist/posts/eventAgenda.js +126 -0
  168. package/dist/posts/eventOccurrenceJobs.d.ts +4 -0
  169. package/dist/posts/eventOccurrenceJobs.js +28 -0
  170. package/dist/posts/eventOccurrences.d.ts +10 -0
  171. package/dist/posts/eventOccurrences.js +61 -0
  172. package/dist/posts/finders.d.ts +47 -16
  173. package/dist/posts/finders.js +93 -62
  174. package/dist/posts/helpers/filters.js +14 -9
  175. package/dist/posts/helpers/index.d.ts +129 -30
  176. package/dist/posts/helpers/index.js +66 -33
  177. package/dist/posts/index.d.ts +7 -1
  178. package/dist/posts/index.js +7 -1
  179. package/dist/posts/mapping.d.ts +491 -13
  180. package/dist/posts/mapping.js +45 -10
  181. package/dist/posts/mutations.d.ts +441 -4
  182. package/dist/posts/mutations.js +177 -43
  183. package/dist/posts/pollEnd.d.ts +3 -0
  184. package/dist/posts/pollEnd.js +7 -0
  185. package/dist/posts/pollEndJobs.d.ts +8 -0
  186. package/dist/posts/pollEndJobs.js +49 -0
  187. package/dist/posts/replyClosure.d.ts +10 -0
  188. package/dist/posts/replyClosure.js +43 -0
  189. package/dist/posts/rsvpConfirmationEmail.js +14 -15
  190. package/dist/posts/threadPreview.d.ts +8 -0
  191. package/dist/posts/threadPreview.js +44 -0
  192. package/dist/posts/unseenCounts.d.ts +2 -0
  193. package/dist/posts/unseenCounts.js +28 -8
  194. package/dist/profileSettings/cache.js +22 -5
  195. package/dist/profileSettings/mapping.d.ts +2 -0
  196. package/dist/profiles/activityQueries.d.ts +5 -0
  197. package/dist/profiles/activityQueries.js +85 -0
  198. package/dist/profiles/activitySummary.d.ts +3 -0
  199. package/dist/profiles/activitySummary.js +87 -0
  200. package/dist/profiles/blocks.d.ts +12 -0
  201. package/dist/profiles/blocks.js +73 -0
  202. package/dist/profiles/cache.d.ts +4 -1
  203. package/dist/profiles/cache.js +28 -7
  204. package/dist/profiles/finders.d.ts +2 -1
  205. package/dist/profiles/finders.js +8 -3
  206. package/dist/profiles/helpers.d.ts +7 -5
  207. package/dist/profiles/index.d.ts +3 -1
  208. package/dist/profiles/index.js +3 -1
  209. package/dist/profiles/mapping.d.ts +10 -5
  210. package/dist/profiles/mapping.js +13 -1
  211. package/dist/profiles/mutations.d.ts +8 -4
  212. package/dist/profiles/mutations.js +42 -15
  213. package/dist/pushSubscriptions/helpers.d.ts +2 -2
  214. package/dist/pushSubscriptions/mutations.js +13 -1
  215. package/dist/redis/connection.d.ts +2 -0
  216. package/dist/redis/connection.js +25 -6
  217. package/dist/reports/helpers.d.ts +6 -6
  218. package/dist/roles/index.d.ts +1 -1
  219. package/dist/roles/index.js +1 -1
  220. package/dist/roles/mapping.d.ts +1 -0
  221. package/dist/roles/mutations.js +86 -3
  222. package/dist/search/mapping.d.ts +1 -1
  223. package/dist/search/mapping.js +6 -2
  224. package/dist/server/index.d.ts +19 -1
  225. package/dist/server/index.js +37 -18
  226. package/dist/server/stablePublicServerInfo.d.ts +17 -0
  227. package/dist/server/stablePublicServerInfo.js +37 -0
  228. package/dist/server/status.d.ts +25 -0
  229. package/dist/server/status.js +98 -0
  230. package/dist/stats/finders.d.ts +1 -16131
  231. package/dist/stats/finders.js +9 -5
  232. package/dist/stats/mapping.d.ts +21 -1
  233. package/dist/stats/mapping.js +0 -3
  234. package/package.json +6 -12
  235. package/dist/db/arango.d.ts +0 -2
  236. package/dist/db/arango.js +0 -110
  237. package/dist/db/migration/autoMigrate.d.ts +0 -2
  238. package/dist/db/migration/autoMigrate.js +0 -111
  239. package/dist/db/migration/cli.d.ts +0 -1
  240. package/dist/db/migration/cli.js +0 -56
  241. package/dist/db/migration/detect.d.ts +0 -6
  242. package/dist/db/migration/detect.js +0 -87
  243. package/dist/db/migration/exportArango.d.ts +0 -4
  244. package/dist/db/migration/exportArango.js +0 -80
  245. package/dist/db/migration/importPostgres.d.ts +0 -3
  246. package/dist/db/migration/importPostgres.js +0 -18
  247. package/dist/db/migration/transform.d.ts +0 -18
  248. package/dist/db/migration/transform.js +0 -209
  249. package/dist/db/migration/validate.d.ts +0 -18
  250. package/dist/db/migration/validate.js +0 -69
  251. package/dist/db/pg/sql/meta/0000_snapshot.json +0 -3380
  252. package/dist/db/pg/sql/meta/0004_snapshot.json +0 -4114
  253. package/dist/db/pg/sql/meta/0005_snapshot.json +0 -4179
  254. package/dist/mastodon/index.d.ts +0 -4
  255. package/dist/mastodon/index.js +0 -51
  256. package/dist/mastodon/types.d.ts +0 -7579
  257. package/dist/mastodon/types.js +0 -523
  258. package/dist/mastodon/typescript.d.ts +0 -1578
  259. package/dist/mastodon/typescript.js +0 -1
  260. package/dist/roles/defaults.d.ts +0 -2
  261. package/dist/roles/defaults.js +0 -94
@@ -0,0 +1,4 @@
1
+ import { connector, disconnector } from '../db/helpers.js';
2
+ import { collectionInfos } from '../db/index.js';
3
+ export const profileHashtagConnector = connector(collectionInfos.profilesCollection, collectionInfos.hashtagsCollection, collectionInfos.profileHashtagsCollection);
4
+ export const profileHashtagDisconnector = disconnector(collectionInfos.profilesCollection, collectionInfos.hashtagsCollection, collectionInfos.profileHashtagsCollection);
@@ -1,2 +1,4 @@
1
1
  export * from './finders';
2
2
  export * from './mapping';
3
+ export * from './mutations';
4
+ export * from './helpers';
@@ -1,2 +1,4 @@
1
1
  export * from './finders.js';
2
2
  export * from './mapping.js';
3
+ export * from './mutations.js';
4
+ export * from './helpers.js';
@@ -0,0 +1,3 @@
1
+ import type { Hashtag, Profile } from '@openpeepshq/common/types';
2
+ export declare const followHashtag: (profile: Profile, hashtag: Hashtag) => Promise<void>;
3
+ export declare const unfollowHashtag: (profile: Profile, hashtag: Hashtag) => Promise<void>;
@@ -1 +1,13 @@
1
- "use strict";
1
+ import { allpeepDb } from '../db/index.js';
2
+ import { clearProfileCache } from '../profiles/cache.js';
3
+ import { profileHashtagConnector, profileHashtagDisconnector } from './helpers.js';
4
+ export const followHashtag = async (profile, hashtag) => {
5
+ const { db } = await allpeepDb();
6
+ await profileHashtagConnector(db, profile, hashtag);
7
+ await clearProfileCache(profile);
8
+ };
9
+ export const unfollowHashtag = async (profile, hashtag) => {
10
+ const { db } = await allpeepDb();
11
+ await profileHashtagDisconnector(db, profile, hashtag);
12
+ await clearProfileCache(profile);
13
+ };
@@ -1,5 +1,6 @@
1
1
  import type { Resource, ResourceLanguage } from 'i18next';
2
2
  import type { i18n } from 'i18next';
3
+ export { clearPluginLocales, mergeHostAndPluginLocales, registerPluginLocales, } from './pluginLocales';
3
4
  interface I18nContext {
4
5
  i18n: i18n;
5
6
  t: i18n['t'];
@@ -11,4 +12,3 @@ export declare const i18nWithPlugins: () => Promise<Resource>;
11
12
  export declare const i18nComplete: () => Promise<Resource>;
12
13
  export declare const updateI18nOverrides: (resources: Resource) => Promise<void>;
13
14
  export declare const initI18nEmailContext: (lng?: string) => Promise<I18nContext>;
14
- export {};
@@ -6,12 +6,14 @@ import { nowIso } from '../db/pg/mappers.js';
6
6
  import { uuidv7 } from 'uuidv7';
7
7
  import i18next from 'i18next';
8
8
  import Backend from 'i18next-fs-backend';
9
+ import { mergeHostAndPluginLocales, registeredPluginLocales, } from './pluginLocales.js';
10
+ export { clearPluginLocales, mergeHostAndPluginLocales, registerPluginLocales, } from './pluginLocales.js';
9
11
  const I18N_NAMESPACE = 'translation';
10
12
  export const i18nOverrides = () => allpeepDb().then(async ({ db }) => {
11
13
  const rows = await db.select().from(i18nEntries);
12
14
  return Object.fromEntries(rows.map((row) => [row.locale, row.body]));
13
15
  });
14
- export const i18nWithPlugins = async () => i18nextResources;
16
+ export const i18nWithPlugins = async () => mergeHostAndPluginLocales(i18nextResources, registeredPluginLocales());
15
17
  export const i18nComplete = async () => deepmerge(await i18nWithPlugins(), await i18nOverrides());
16
18
  export const updateI18nOverrides = async (resources) => allpeepDb().then(async ({ db }) => {
17
19
  const ts = nowIso();
@@ -0,0 +1,6 @@
1
+ import type { Resource } from 'i18next';
2
+ export declare const registerPluginLocales: (pluginKey: string, locales: Resource) => void;
3
+ export declare const clearPluginLocales: () => void;
4
+ export declare const registeredPluginLocales: () => Resource[];
5
+ /** Plugin packs first, host last so plugins cannot overwrite host strings. */
6
+ export declare const mergeHostAndPluginLocales: (host: Resource, pluginLocales: readonly Resource[]) => Resource;
@@ -0,0 +1,15 @@
1
+ import { deepmerge } from 'deepmerge-ts';
2
+ const pluginLocaleRegistry = new Map();
3
+ export const registerPluginLocales = (pluginKey, locales) => {
4
+ pluginLocaleRegistry.set(pluginKey, locales);
5
+ };
6
+ export const clearPluginLocales = () => {
7
+ pluginLocaleRegistry.clear();
8
+ };
9
+ export const registeredPluginLocales = () => [
10
+ ...pluginLocaleRegistry.values(),
11
+ ];
12
+ /** Plugin packs first, host last so plugins cannot overwrite host strings. */
13
+ export const mergeHostAndPluginLocales = (host, pluginLocales) => pluginLocales.length === 0
14
+ ? host
15
+ : deepmerge(...pluginLocales, host);
@@ -2,9 +2,9 @@ export declare const redeemInviteLinkConnector: (db: import("../db").PgDb, from:
2
2
  id: string;
3
3
  }, to: {
4
4
  id: string;
5
- }, data?: {
5
+ }, data?: object & {
6
6
  id?: string;
7
- }) => Promise<import("../db/pg/map").WithId<{
7
+ }) => Promise<import("../db/pg/map").WithId<object & {
8
8
  _from: string;
9
9
  _to: string;
10
10
  }>>;
@@ -12,9 +12,9 @@ export declare const createInviteLinkConnector: (db: import("../db").PgDb, from:
12
12
  id: string;
13
13
  }, to: {
14
14
  id: string;
15
- }, data?: {
15
+ }, data?: object & {
16
16
  id?: string;
17
- }) => Promise<import("../db/pg/map").WithId<{
17
+ }) => Promise<import("../db/pg/map").WithId<object & {
18
18
  _from: string;
19
19
  _to: string;
20
20
  }>>;
@@ -1,6 +1,6 @@
1
1
  import { PostWithMeta } from '@openpeepshq/common/types';
2
2
  export declare const jamStateCache: import("cache-manager").Cache;
3
- export declare const getJamState: (jam: PostWithMeta) => Promise<{
3
+ export declare const getJamState: (jam: PostWithMeta, recurrenceId?: string) => Promise<{
4
4
  active: boolean;
5
5
  participants: string[];
6
6
  }>;
@@ -1,10 +1,11 @@
1
1
  import { createCache } from 'cache-manager';
2
+ import { jamRoomName } from '@openpeepshq/common/lib';
2
3
  import { jamState } from './livekit.js';
3
4
  export const jamStateCache = createCache({
4
5
  ttl: 20 * 1000,
5
6
  refreshThreshold: 5 * 1000,
6
7
  });
7
- export const getJamState = async (jam) => jamStateCache.wrap(jam.id, () => jamState(jam));
8
+ export const getJamState = async (jam, recurrenceId) => jamStateCache.wrap(jamRoomName(jam.id, recurrenceId), () => jamState(jam, undefined, recurrenceId));
8
9
  /** Caches the LiveKit scan for live jam posts (before auth filtering). */
9
10
  export const LIVE_JAMS_CACHE_KEY = 'live-jams';
10
11
  export const liveJamPostsCache = createCache({
@@ -0,0 +1,19 @@
1
+ import type { Profile } from '@openpeepshq/common/types';
2
+ export type JamAttendanceKind = 'community' | 'public';
3
+ export type JamAttendanceExportRow = {
4
+ kind: JamAttendanceKind | '';
5
+ name: string;
6
+ email: string;
7
+ handle: string;
8
+ joinedAt: string;
9
+ };
10
+ type JoinRecord = {
11
+ profileId: string;
12
+ createdAt: string;
13
+ };
14
+ type AttendanceProfile = Pick<Profile, 'type' | 'displayName' | 'handle' | 'guestData'>;
15
+ export declare const jamAttendanceExportHeaders: readonly ["Type", "Name", "Email", "Handle", "Joined At"];
16
+ export declare const jamAttendanceRowFromJoin: (join: JoinRecord, profile: AttendanceProfile | undefined) => JamAttendanceExportRow;
17
+ export declare const jamAttendanceExportCsv: (rows: JamAttendanceExportRow[]) => string;
18
+ export declare const exportJamAttendanceCsv: (jamId: string) => Promise<string>;
19
+ export {};
@@ -0,0 +1,60 @@
1
+ import { and, asc, eq, isNull, sql } from 'drizzle-orm';
2
+ import { toCsvRow } from '@openpeepshq/common/lib';
3
+ import { database } from '../db/index.js';
4
+ import { jamEvents } from '../db/pg/schema/index.js';
5
+ import { normalizeIsoDatetime } from '../db/pg/mappers.js';
6
+ import { getProfiles } from '../profiles/index.js';
7
+ export const jamAttendanceExportHeaders = [
8
+ 'Type',
9
+ 'Name',
10
+ 'Email',
11
+ 'Handle',
12
+ 'Joined At',
13
+ ];
14
+ export const jamAttendanceRowFromJoin = (join, profile) => {
15
+ var _a, _b, _c, _d;
16
+ const isPublic = (profile === null || profile === void 0 ? void 0 : profile.type) === 'guest';
17
+ return {
18
+ kind: profile ? (isPublic ? 'public' : 'community') : '',
19
+ name: (profile === null || profile === void 0 ? void 0 : profile.displayName) || (isPublic ? '' : ((_a = profile === null || profile === void 0 ? void 0 : profile.handle) !== null && _a !== void 0 ? _a : '')),
20
+ // Community emails aren't here: several accounts can control one profile.
21
+ email: isPublic ? ((_c = (_b = profile === null || profile === void 0 ? void 0 : profile.guestData) === null || _b === void 0 ? void 0 : _b.email) !== null && _c !== void 0 ? _c : '') : '',
22
+ handle: isPublic ? '' : ((_d = profile === null || profile === void 0 ? void 0 : profile.handle) !== null && _d !== void 0 ? _d : ''),
23
+ joinedAt: join.createdAt,
24
+ };
25
+ };
26
+ export const jamAttendanceExportCsv = (rows) => [
27
+ toCsvRow([...jamAttendanceExportHeaders]),
28
+ ...rows.map((row) => toCsvRow([row.kind, row.name, row.email, row.handle, row.joinedAt])),
29
+ ].join('\n');
30
+ const listJamJoinEvents = async (jamId) => {
31
+ const db = await database();
32
+ const rows = await db
33
+ .select({
34
+ createdAt: jamEvents.createdAt,
35
+ body: jamEvents.body,
36
+ })
37
+ .from(jamEvents)
38
+ .where(and(eq(jamEvents.postId, jamId), isNull(jamEvents.deletedAt), sql `${jamEvents.body}->>'type' = 'join'`))
39
+ .orderBy(asc(jamEvents.createdAt), asc(jamEvents.id));
40
+ return rows.flatMap((row) => {
41
+ var _a;
42
+ const profileId = (_a = row.body) === null || _a === void 0 ? void 0 : _a.profileId;
43
+ if (typeof profileId !== 'string' || !profileId) {
44
+ return [];
45
+ }
46
+ return [
47
+ {
48
+ profileId,
49
+ createdAt: normalizeIsoDatetime(row.createdAt),
50
+ },
51
+ ];
52
+ });
53
+ };
54
+ export const exportJamAttendanceCsv = async (jamId) => {
55
+ const joins = await listJamJoinEvents(jamId);
56
+ const profileIds = [...new Set(joins.map((join) => join.profileId))];
57
+ const profiles = profileIds.length ? await getProfiles(profileIds) : [];
58
+ const profilesById = new Map(profiles.map((profile) => [profile.id, profile]));
59
+ return jamAttendanceExportCsv(joins.map((join) => jamAttendanceRowFromJoin(join, profilesById.get(join.profileId))));
60
+ };
@@ -14,10 +14,11 @@ export declare const listAttendance: (jamId: string, { start, limit }?: {
14
14
  start?: string;
15
15
  limit?: number;
16
16
  }) => Promise<import("../db/pg/map").WithId<JamEvent>[]>;
17
- export declare const findJamState: (jam: PostWithMeta, hideParticipants?: boolean) => Promise<{
17
+ export declare const findJamState: (jam: PostWithMeta, hideParticipants?: boolean, recurrenceId?: string) => Promise<{
18
18
  participants: string[];
19
19
  active: boolean;
20
20
  }>;
21
21
  export declare const findJamRecording: (recordingId: string) => Promise<import("@openpeepshq/common").JamRecordingWithMeta | undefined>;
22
22
  export declare const findActiveRecording: (jamPost: PostWithMeta) => Promise<import("@openpeepshq/common").JamRecordingWithMeta | undefined>;
23
+ export declare const findActiveRtmpStream: (jamPost: PostWithMeta) => Promise<import("@openpeepshq/common").JamRecordingWithMeta | undefined>;
23
24
  export declare const listPostRecordings: (postId: string) => Promise<JamRecording[]>;
@@ -1,4 +1,5 @@
1
1
  import { jamRecordingSchema, } from '@openpeepshq/common/types';
2
+ import { isFileJamRecording, pickActiveFileRecording, pickActiveRtmpStream, } from '@openpeepshq/common/lib';
2
3
  import { allpeepDb } from '../db/index.js';
3
4
  import { jamEventsMapping, jamRecordingsMapping } from './mapping.js';
4
5
  import { addStartLimit, sortNewestFirst } from '../db/helpers.js';
@@ -7,18 +8,28 @@ import { transformJamRecordingData } from './helpers.js';
7
8
  export const baseListJam = (props, { start, limit = 100 }) => addStartLimit(jamEventsMapping.filter({ matches: props }), start, limit);
8
9
  export const listJamEvents = (jamId, { start, limit } = {}) => allpeepDb().then(({ db }) => baseListJam({ jamId }, { start, limit }).all(db));
9
10
  export const listAttendance = (jamId, { start, limit } = {}) => allpeepDb().then(({ db }) => baseListJam({ jamId, type: 'join' }, { start, limit }).all(db));
10
- export const findJamState = async (jam, hideParticipants) => {
11
- const state = await getJamState(jam);
11
+ export const findJamState = async (jam, hideParticipants, recurrenceId) => {
12
+ const state = await getJamState(jam, recurrenceId);
12
13
  return Object.assign(Object.assign({}, state), { participants: hideParticipants ? [] : state.participants });
13
14
  };
14
15
  export const findJamRecording = async (recordingId) => allpeepDb()
15
16
  .then(({ db }) => jamRecordingsMapping.find(db, recordingId))
16
17
  .then((recording) => recording ? transformJamRecordingData(recording) : undefined);
17
- export const findActiveRecording = async (jamPost) => allpeepDb()
18
- .then(({ db }) => sortNewestFirst(jamRecordingsMapping.filter({
18
+ export const findActiveRecording = async (jamPost) => {
19
+ const recordings = await listActiveJamRecordings(jamPost);
20
+ const recording = pickActiveFileRecording(recordings);
21
+ return recording ? transformJamRecordingData(recording) : undefined;
22
+ };
23
+ export const findActiveRtmpStream = async (jamPost) => {
24
+ const recordings = await listActiveJamRecordings(jamPost);
25
+ const recording = pickActiveRtmpStream(recordings);
26
+ return recording ? transformJamRecordingData(recording) : undefined;
27
+ };
28
+ const listActiveJamRecordings = (jamPost) => allpeepDb().then(({ db }) => sortNewestFirst(jamRecordingsMapping.filter({
19
29
  matches: { _to: `posts/${jamPost.id}`, status: 'active' },
20
- })).first(db))
21
- .then((recording) => recording ? transformJamRecordingData(recording) : undefined);
30
+ })).all(db));
22
31
  export const listPostRecordings = async (postId) => allpeepDb()
23
32
  .then(({ db }) => sortNewestFirst(jamRecordingsMapping.filter({ matches: { _to: `posts/${postId}` } })).all(db))
24
- .then((recordings) => recordings.map((recording) => jamRecordingSchema.parse(recording)));
33
+ .then((recordings) => recordings
34
+ .filter(isFileJamRecording)
35
+ .map((recording) => jamRecordingSchema.parse(recording)));
@@ -0,0 +1,8 @@
1
+ export declare const LIVEKIT_HEALTH_TIMEOUT_MS = 1500;
2
+ /**
3
+ * True when a LiveKit RoomService call succeeds. Credentials in config are not
4
+ * enough — invalid keys still construct a client, then fail on first RPC.
5
+ */
6
+ export declare const probeLivekitConnection: (listRooms: () => Promise<unknown>, timeoutMs?: number) => Promise<boolean>;
7
+ /** Cached LiveKit reachability. False when unset, unauthorized, or unreachable. */
8
+ export declare const isLivekitConnected: () => Promise<boolean>;
@@ -0,0 +1,46 @@
1
+ import { createCache } from 'cache-manager';
2
+ import { logger } from '../log/index.js';
3
+ import { roomService } from './livekit.js';
4
+ const log = logger('app:jams:livekit');
5
+ /** Sentinel room name so the probe authenticates without listing every room. */
6
+ const LIVEKIT_HEALTH_ROOM = '__openpeeps_livekit_health__';
7
+ const LIVEKIT_HEALTH_CACHE_KEY = 'livekit-health';
8
+ export const LIVEKIT_HEALTH_TIMEOUT_MS = 1500;
9
+ const livekitHealthCache = createCache({
10
+ ttl: 20 * 1000,
11
+ refreshThreshold: 5 * 1000,
12
+ });
13
+ const withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
14
+ const timer = setTimeout(() => {
15
+ reject(new Error('LiveKit health check timed out'));
16
+ }, timeoutMs);
17
+ promise.then((value) => {
18
+ clearTimeout(timer);
19
+ resolve(value);
20
+ }, (err) => {
21
+ clearTimeout(timer);
22
+ reject(err);
23
+ });
24
+ });
25
+ /**
26
+ * True when a LiveKit RoomService call succeeds. Credentials in config are not
27
+ * enough — invalid keys still construct a client, then fail on first RPC.
28
+ */
29
+ export const probeLivekitConnection = async (listRooms, timeoutMs = LIVEKIT_HEALTH_TIMEOUT_MS) => {
30
+ try {
31
+ await withTimeout(listRooms(), timeoutMs);
32
+ return true;
33
+ }
34
+ catch (e) {
35
+ log.warn(`LiveKit health check failed: ${e.message}`);
36
+ return false;
37
+ }
38
+ };
39
+ /** Cached LiveKit reachability. False when unset, unauthorized, or unreachable. */
40
+ export const isLivekitConnected = () => livekitHealthCache.wrap(LIVEKIT_HEALTH_CACHE_KEY, async () => {
41
+ const rs = await roomService();
42
+ if (rs === undefined) {
43
+ return false;
44
+ }
45
+ return probeLivekitConnection(() => rs.listRooms([LIVEKIT_HEALTH_ROOM]));
46
+ });
@@ -1,6 +1,8 @@
1
1
  import { JamRecording, JamRecordingWithMeta, PostWithMeta, ProfileWithMeta } from '@openpeepshq/common/types';
2
2
  export declare const connectRecording: (db: import("../db").PgDb, from: ProfileWithMeta, to: PostWithMeta, data?: {
3
- status: "completed" | "failed" | "active" | "requested";
3
+ status: "completed" | "failed" | "active" | "requested" | "finalizing";
4
+ kind?: "file" | "rtmp" | undefined;
5
+ destinationHost?: string | undefined;
4
6
  egressId?: string | undefined;
5
7
  attachment?: {
6
8
  type: string;
@@ -30,7 +32,9 @@ export declare const connectRecording: (db: import("../db").PgDb, from: ProfileW
30
32
  } & {
31
33
  id?: string;
32
34
  }) => Promise<import("../db/pg/map").WithId<{
33
- status: "completed" | "failed" | "active" | "requested";
35
+ status: "completed" | "failed" | "active" | "requested" | "finalizing";
36
+ kind?: "file" | "rtmp" | undefined;
37
+ destinationHost?: string | undefined;
34
38
  egressId?: string | undefined;
35
39
  attachment?: {
36
40
  type: string;
@@ -1,15 +1,18 @@
1
1
  import { type AuthorizationData, type MuteParticipantRequest, type PostWithMeta, type Profile } from '@openpeepshq/common/types';
2
2
  export { createJamToken, createJamEgressToken } from './token';
3
- export { startRecording, stopRecording, stopEgress, listParticipantIds, reclaimOrphanJamRoom, finishRecording, getJamRecordingUrl, getJamObserverPath, JAM_ROOM_EMPTY_TIMEOUT_SEC, JAM_ROOM_DEPARTURE_TIMEOUT_SEC, } from './livekit';
3
+ export { isLivekitConnected } from './health';
4
+ export { startRecording, stopRecording, startRtmpStream, stopRtmpStream, stopEgress, listParticipantIds, reclaimOrphanJamRoom, finishRecording, getJamRecordingUrl, getJamObserverPath, JAM_ROOM_EMPTY_TIMEOUT_SEC, JAM_ROOM_DEPARTURE_TIMEOUT_SEC, } from './livekit';
5
+ export { rtmpStreamOutput } from './rtmp';
4
6
  export { jamRecordingStopQueue, jamRecordingStopWorker, scheduleRecordingAutoStop, cancelRecordingAutoStop, JAM_RECORDING_MAX_DURATION_MS, } from './jobs';
5
7
  export * from './waitingRoom';
6
8
  export * from './mutations';
7
9
  export * from './finders';
10
+ export * from './export';
8
11
  export * from './recording';
9
12
  export { deriveJamRecordingUploadSecret, jamRecordingUploadSecret, } from './recordingUploadAuth';
10
13
  export declare const listLiveJams: (authData: AuthorizationData) => Promise<PostWithMeta[]>;
11
14
  export declare const findJamEvent: (id: string) => Promise<PostWithMeta | undefined>;
12
- export declare const closeJam: (profile: Profile, jamEvent: PostWithMeta) => Promise<import("@openpeepshq/common").JamEvent | undefined>;
13
- export declare const muteParticipant: (jamId: string, data: MuteParticipantRequest) => Promise<{
15
+ export declare const closeJam: (profile: Profile, jamEvent: PostWithMeta, recurrenceId?: string) => Promise<import("@openpeepshq/common").JamEvent | undefined>;
16
+ export declare const muteParticipant: (jamId: string, data: MuteParticipantRequest, recurrenceId?: string) => Promise<{
14
17
  success: boolean;
15
18
  }>;
@@ -1,4 +1,5 @@
1
- import { listParticipantIds, reclaimOrphanJamRoom, roomService, stopRecording, } from './livekit.js';
1
+ import { jamRoomName, postIdFromJamRoomName, uniquePostsById, } from '@openpeepshq/common/lib';
2
+ import { listParticipantIds, reclaimOrphanJamRoom, roomService, shouldReclaimJamRoom, stopRecording, stopRtmpStream, } from './livekit.js';
2
3
  import { jamStateCache, LIVE_JAMS_CACHE_KEY, liveJamPostsCache } from './cache.js';
3
4
  import { localInstanceDomain, parseRoomInstanceDomain } from './helpers.js';
4
5
  import { findPost } from '../posts/index.js';
@@ -7,14 +8,19 @@ import { clearJamAdmittance } from './waitingRoom.js';
7
8
  import { uuidv7 } from 'uuidv7';
8
9
  import { canReadPost } from '../posts/helpers/index.js';
9
10
  import { capabilitiesConfig } from '../config/index.js';
11
+ import { logger } from '../log/index.js';
10
12
  export { createJamToken, createJamEgressToken } from './token.js';
11
- export { startRecording, stopRecording, stopEgress, listParticipantIds, reclaimOrphanJamRoom, finishRecording, getJamRecordingUrl, getJamObserverPath, JAM_ROOM_EMPTY_TIMEOUT_SEC, JAM_ROOM_DEPARTURE_TIMEOUT_SEC, } from './livekit.js';
13
+ export { isLivekitConnected } from './health.js';
14
+ export { startRecording, stopRecording, startRtmpStream, stopRtmpStream, stopEgress, listParticipantIds, reclaimOrphanJamRoom, finishRecording, getJamRecordingUrl, getJamObserverPath, JAM_ROOM_EMPTY_TIMEOUT_SEC, JAM_ROOM_DEPARTURE_TIMEOUT_SEC, } from './livekit.js';
15
+ export { rtmpStreamOutput } from './rtmp.js';
12
16
  export { jamRecordingStopQueue, jamRecordingStopWorker, scheduleRecordingAutoStop, cancelRecordingAutoStop, JAM_RECORDING_MAX_DURATION_MS, } from './jobs.js';
13
17
  export * from './waitingRoom.js';
14
18
  export * from './mutations.js';
15
19
  export * from './finders.js';
20
+ export * from './export.js';
16
21
  export * from './recording.js';
17
22
  export { deriveJamRecordingUploadSecret, jamRecordingUploadSecret, } from './recordingUploadAuth.js';
23
+ const log = logger('app:jams:livekit');
18
24
  const invalidateJamCaches = async (jamId) => {
19
25
  await Promise.all([
20
26
  jamStateCache.del(jamId).catch(() => undefined),
@@ -33,10 +39,18 @@ const fetchLiveJamPosts = async () => {
33
39
  if (rs === undefined) {
34
40
  return [];
35
41
  }
36
- const [rooms, localDomain] = await Promise.all([
37
- rs.listRooms(),
38
- localInstanceDomain(),
39
- ]);
42
+ let rooms;
43
+ let localDomain;
44
+ try {
45
+ [rooms, localDomain] = await Promise.all([
46
+ rs.listRooms(),
47
+ localInstanceDomain(),
48
+ ]);
49
+ }
50
+ catch (e) {
51
+ log.warn(`Failed to list live jam rooms: ${e.message}`);
52
+ return [];
53
+ }
40
54
  const posts = await Promise.all(rooms.map(async (room) => {
41
55
  const roomDomain = parseRoomInstanceDomain(room.metadata);
42
56
  // Shared SFU: ignore other communities' rooms. Untagged rooms (pre-stamp)
@@ -44,22 +58,18 @@ const fetchLiveJamPosts = async () => {
44
58
  if (localDomain && roomDomain && roomDomain !== localDomain) {
45
59
  return undefined;
46
60
  }
47
- // Fast path: Room.numParticipants includes hidden egress — 0 means truly empty.
61
+ const postId = postIdFromJamRoomName(room.name);
62
+ // Zero participants: host may still be connecting after Start, or the
63
+ // room is inside departureTimeout. LiveKit closes these; deleting them
64
+ // drops the host back to the join screen.
48
65
  if (!room.numParticipants) {
49
- const post = await findPost(room.name);
50
- if (post) {
51
- reclaimLocalOrphan(post);
52
- }
53
- else if (!roomDomain || roomDomain === localDomain) {
54
- void rs.deleteRoom(room.name).catch(() => undefined);
55
- }
56
66
  return undefined;
57
67
  }
58
- // Slow path only when someone (human or egress) is connected — distinguish
59
- // egress-only ghosts from real live jams.
68
+ // Someone is connected. Egress counts toward numParticipants, so an
69
+ // egress-only room never hits emptyTimeout and has to be reclaimed.
60
70
  const humans = await listParticipantIds(room.name);
61
- if (humans.length === 0) {
62
- const post = await findPost(room.name);
71
+ if (shouldReclaimJamRoom(room.numParticipants, humans.length)) {
72
+ const post = await findPost(postId);
63
73
  if (post) {
64
74
  reclaimLocalOrphan(post);
65
75
  }
@@ -68,9 +78,9 @@ const fetchLiveJamPosts = async () => {
68
78
  }
69
79
  return undefined;
70
80
  }
71
- return findPost(room.name);
81
+ return findPost(postId);
72
82
  }));
73
- return posts.filter(Boolean);
83
+ return uniquePostsById(posts);
74
84
  };
75
85
  export const listLiveJams = async (authData) => {
76
86
  const [posts, config] = await Promise.all([
@@ -80,31 +90,35 @@ export const listLiveJams = async (authData) => {
80
90
  return posts.filter(canReadPost(config, authData));
81
91
  };
82
92
  export const findJamEvent = async (id) => findPost(id).then((post) => { var _a, _b; return ((_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.type) === 'event' && ((_b = post.data) === null || _b === void 0 ? void 0 : _b.jam) ? post : undefined; });
83
- export const closeJam = async (profile, jamEvent) => {
93
+ export const closeJam = async (profile, jamEvent, recurrenceId) => {
84
94
  const rs = await roomService();
85
95
  if (rs === undefined) {
86
96
  return undefined;
87
97
  }
88
- await stopRecording(jamEvent);
89
- return rs.deleteRoom(jamEvent.id).then(async () => {
98
+ await stopRecording(jamEvent, recurrenceId);
99
+ await stopRtmpStream(jamEvent);
100
+ return rs
101
+ .deleteRoom(jamRoomName(jamEvent.id, recurrenceId))
102
+ .then(async () => {
90
103
  await Promise.all([
91
- invalidateJamCaches(jamEvent.id),
92
- clearJamAdmittance(jamEvent).catch(() => undefined),
104
+ invalidateJamCaches(jamRoomName(jamEvent.id, recurrenceId)),
105
+ clearJamAdmittance(jamEvent, recurrenceId).catch(() => undefined),
93
106
  ]);
94
107
  return createJamEvent({
95
108
  id: uuidv7(),
96
109
  jamId: jamEvent.id,
97
110
  type: 'close',
98
111
  profileId: profile.id,
112
+ recurrenceId,
99
113
  });
100
114
  });
101
115
  };
102
- export const muteParticipant = async (jamId, data) => {
116
+ export const muteParticipant = async (jamId, data, recurrenceId) => {
103
117
  const rs = await roomService();
104
118
  if (rs === undefined) {
105
119
  return { success: false };
106
120
  }
107
- const result = await rs.mutePublishedTrack(jamId, data.identity, data.trackSid, true);
121
+ const result = await rs.mutePublishedTrack(jamRoomName(jamId, recurrenceId), data.identity, data.trackSid, true);
108
122
  if (!result) {
109
123
  return { success: false };
110
124
  }
package/dist/jams/jobs.js CHANGED
@@ -3,7 +3,7 @@ import { logger } from '../log/index.js';
3
3
  import { findPost } from '../posts/index.js';
4
4
  import { findActiveRecording } from './finders.js';
5
5
  const log = logger('app:jams:jobs');
6
- export const JAM_RECORDING_MAX_DURATION_MS = 60 * 60 * 1000;
6
+ export const JAM_RECORDING_MAX_DURATION_MS = 2 * 60 * 60 * 1000;
7
7
  const recordingStopJobId = (recordingId) => `jam-recording-stop:${recordingId}`;
8
8
  const [jamRecordingStopQueue, jamRecordingStopWorker] = queueAndWorker('jam-recording-stop', async (job) => {
9
9
  var _a;
@@ -4,21 +4,104 @@ import { RoomServiceClient } from 'livekit-server-sdk';
4
4
  export declare const JAM_ROOM_EMPTY_TIMEOUT_SEC: number;
5
5
  /** Seconds a room stays open after the last participant leaves. */
6
6
  export declare const JAM_ROOM_DEPARTURE_TIMEOUT_SEC = 60;
7
+ /**
8
+ * LiveKit closes rooms with no participants via emptyTimeout (host still
9
+ * connecting after Start) and departureTimeout (reconnect). Those rooms must
10
+ * not be deleted here. Reclaim only when a non-human participant (egress) is
11
+ * holding the room open — they count toward `numParticipants`, so LiveKit
12
+ * will not time the room out.
13
+ */
14
+ export declare const shouldReclaimJamRoom: (numParticipants: number, humanCount: number) => boolean;
7
15
  export declare const roomService: () => Promise<RoomServiceClient | undefined>;
8
16
  export declare const listParticipantIds: (jamId: string) => Promise<string[]>;
9
17
  /**
10
- * Relative path for the observer view (full jam UI). Used both for human
11
- * moderator observer links and as the page LiveKit web egress records.
18
+ * Relative path for the observer view (full jam UI). Used for human
19
+ * moderator observer links, jam recording web egress, and RTMP web egress.
12
20
  */
13
- export declare const getJamObserverPath: (jamId: string) => Promise<string>;
14
- export declare const getJamRecordingUrl: (jamId: string) => Promise<string>;
15
- export declare const startRecording: (profile: ProfileWithMeta, jamPost: PostWithMeta) => Promise<JamRecording>;
21
+ export declare const getJamObserverPath: (jamId: string, recurrenceId?: string) => Promise<string>;
22
+ export declare const getJamRecordingUrl: (jamId: string, recurrenceId?: string) => Promise<string>;
16
23
  export declare const stopEgress: (egressId: string) => Promise<void>;
17
- export declare const stopRecording: (jamPost: PostWithMeta) => Promise<JamRecordingWithMeta | undefined>;
24
+ export declare const startRecording: (profile: ProfileWithMeta, jamPost: PostWithMeta, recurrenceId?: string) => Promise<JamRecording>;
25
+ export declare const startRtmpStream: (profile: ProfileWithMeta, jamPost: PostWithMeta, rtmpUrl: string, destinationHost?: string) => Promise<JamRecording>;
26
+ export declare const stopRtmpStream: (jamPost: PostWithMeta) => Promise<{
27
+ status: "completed";
28
+ createdAt: string;
29
+ updatedAt: string;
30
+ deletedAt?: string | null | undefined;
31
+ kind?: "file" | "rtmp" | undefined;
32
+ destinationHost?: string | undefined;
33
+ egressId?: string | undefined;
34
+ attachment?: {
35
+ type: string;
36
+ url: string;
37
+ previewUrl: string | null;
38
+ textUrl: null;
39
+ filename: string;
40
+ meta: {
41
+ usage?: string | undefined;
42
+ focus?: {
43
+ x: number;
44
+ y: number;
45
+ } | undefined;
46
+ mimetype?: string | undefined;
47
+ size?: number | undefined;
48
+ };
49
+ id: string;
50
+ createdAt: string;
51
+ updatedAt: string;
52
+ description?: string | undefined;
53
+ blurhash?: string | undefined;
54
+ status?: "failed" | "processing" | "ready" | undefined;
55
+ error?: string | undefined;
56
+ deletedAt?: string | null | undefined;
57
+ } | undefined;
58
+ replyPostId?: string | undefined;
59
+ id: string;
60
+ profile: ProfileWithMeta;
61
+ post: PostWithMeta;
62
+ } | undefined>;
63
+ export declare const stopRecording: (jamPost: PostWithMeta, recurrenceId?: string) => Promise<{
64
+ status: "finalizing";
65
+ createdAt: string;
66
+ updatedAt: string;
67
+ deletedAt?: string | null | undefined;
68
+ kind?: "file" | "rtmp" | undefined;
69
+ destinationHost?: string | undefined;
70
+ egressId?: string | undefined;
71
+ attachment?: {
72
+ type: string;
73
+ url: string;
74
+ previewUrl: string | null;
75
+ textUrl: null;
76
+ filename: string;
77
+ meta: {
78
+ usage?: string | undefined;
79
+ focus?: {
80
+ x: number;
81
+ y: number;
82
+ } | undefined;
83
+ mimetype?: string | undefined;
84
+ size?: number | undefined;
85
+ };
86
+ id: string;
87
+ createdAt: string;
88
+ updatedAt: string;
89
+ description?: string | undefined;
90
+ blurhash?: string | undefined;
91
+ status?: "failed" | "processing" | "ready" | undefined;
92
+ error?: string | undefined;
93
+ deletedAt?: string | null | undefined;
94
+ } | undefined;
95
+ replyPostId?: string | undefined;
96
+ id: string;
97
+ profile: ProfileWithMeta;
98
+ post: PostWithMeta;
99
+ } | undefined>;
18
100
  /**
19
- * Stops leftover egress and deletes a LiveKit room that has no human
20
- * participants (egress-only / orphan rooms). Safe to call repeatedly.
101
+ * Stops leftover egress and deletes an egress-only LiveKit room.
102
+ * Do not call this for a room with zero participants — that room is still
103
+ * inside emptyTimeout or departureTimeout. Safe to call repeatedly.
21
104
  */
22
- export declare const reclaimOrphanJamRoom: (jam: PostWithMeta) => Promise<void>;
105
+ export declare const reclaimOrphanJamRoom: (jam: PostWithMeta, roomName?: string) => Promise<void>;
23
106
  export declare const finishRecording: (jamRecording: JamRecordingWithMeta) => Promise<void>;
24
- export declare const jamState: (jam: PostWithMeta, hideParticipants?: boolean) => Promise<JamState>;
107
+ export declare const jamState: (jam: PostWithMeta, hideParticipants?: boolean, recurrenceId?: string) => Promise<JamState>;