@openpeepshq/core 0.1.34 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/dist/accessTokens/finders.js +5 -6
  2. package/dist/accessTokens/mutations.js +1 -1
  3. package/dist/accessTokens/tokens.js +8 -11
  4. package/dist/accounts/helpers.js +6 -2
  5. package/dist/accounts/mutations.js +13 -8
  6. package/dist/analytics/cache.js +3 -3
  7. package/dist/analytics/clicks.js +14 -22
  8. package/dist/analytics/compile.js +1 -2
  9. package/dist/analytics/dateRange.js +3 -5
  10. package/dist/analytics/jobs.js +3 -4
  11. package/dist/analytics/pdfReport.js +45 -61
  12. package/dist/analytics/privacy.js +1 -1
  13. package/dist/analytics/read.js +116 -135
  14. package/dist/analytics/report.d.ts +2 -1
  15. package/dist/analytics/report.js +2 -3
  16. package/dist/analytics/settings.js +3 -4
  17. package/dist/backups/index.js +13 -16
  18. package/dist/backups/metadata.js +1 -1
  19. package/dist/config/db.js +2 -4
  20. package/dist/config/defaults/community.js +1 -0
  21. package/dist/config/defaults/core.js +13 -8
  22. package/dist/config/defaults/logs.d.ts +4 -0
  23. package/dist/config/defaults/logs.js +5 -0
  24. package/dist/config/index.d.ts +9 -0
  25. package/dist/config/index.js +9 -11
  26. package/dist/db/explorer/query.js +9 -8
  27. package/dist/db/explorer/sql.js +8 -8
  28. package/dist/db/helpers.js +15 -5
  29. package/dist/db/migration/importCollections.js +15 -18
  30. package/dist/db/migration/shared.js +15 -35
  31. package/dist/db/pg/client.js +4 -7
  32. package/dist/db/pg/filters/index.js +1 -1
  33. package/dist/db/pg/filters/posts.d.ts +2 -0
  34. package/dist/db/pg/filters/posts.js +3 -1
  35. package/dist/db/pg/helpers.js +2 -14
  36. package/dist/db/pg/map/filters.js +8 -8
  37. package/dist/db/pg/map/helpers.js +5 -1
  38. package/dist/db/pg/map/index.js +46 -51
  39. package/dist/db/pg/map/mutations.js +56 -21
  40. package/dist/db/pg/map/registry.js +87 -50
  41. package/dist/db/pg/map/relations.js +67 -63
  42. package/dist/db/pg/map/search.js +15 -37
  43. package/dist/db/pg/mappers.js +13 -7
  44. package/dist/db/pg/migrate.js +2 -3
  45. package/dist/db/pg/queries/activity.js +2 -2
  46. package/dist/db/pg/queries/derived.js +8 -12
  47. package/dist/db/pg/schema/documents.js +119 -18
  48. package/dist/db/pg/schema/edges.js +7 -1
  49. package/dist/db/pg/schema/index.js +5 -1
  50. package/dist/db/pg/sql/0016_posts_search_vector_title_tags_path.sql +54 -0
  51. package/dist/db/pg/sql/meta/_journal.json +8 -1
  52. package/dist/db/replaceOrigin.js +1 -1
  53. package/dist/email/queueStats.js +8 -11
  54. package/dist/email/render.js +7 -4
  55. package/dist/email/send.js +19 -17
  56. package/dist/email/smtpTest.js +10 -6
  57. package/dist/errors/index.js +1 -1
  58. package/dist/events/once.js +2 -4
  59. package/dist/federation/activities.js +1 -2
  60. package/dist/groups/finders.d.ts +2 -2
  61. package/dist/groups/helpers.d.ts +6 -6
  62. package/dist/groups/helpers.js +1 -2
  63. package/dist/groups/mapping.d.ts +4 -4
  64. package/dist/groups/mutations.js +1 -1
  65. package/dist/hashtags/finders.js +2 -2
  66. package/dist/inviteLinks/mutations.js +2 -3
  67. package/dist/jams/export.js +5 -7
  68. package/dist/jams/finders.js +4 -1
  69. package/dist/jams/health.d.ts +6 -4
  70. package/dist/jams/health.js +15 -11
  71. package/dist/jams/helpers.d.ts +2 -2
  72. package/dist/jams/helpers.js +6 -2
  73. package/dist/jams/index.js +2 -2
  74. package/dist/jams/jobs.js +1 -2
  75. package/dist/jams/livekit.d.ts +2 -2
  76. package/dist/jams/livekit.js +8 -8
  77. package/dist/jams/mapping.d.ts +10 -10
  78. package/dist/jams/mutations.d.ts +2 -2
  79. package/dist/jams/recording.js +1 -1
  80. package/dist/jams/token.js +13 -17
  81. package/dist/jobs/index.js +7 -6
  82. package/dist/jobs/jobDetail.js +5 -6
  83. package/dist/jobs/jobLog.js +2 -3
  84. package/dist/lib/streams.js +4 -39
  85. package/dist/lib/zodDeepPartial.d.ts +1 -1
  86. package/dist/lib/zodDeepPartial.js +1 -1
  87. package/dist/log/index.d.ts +1 -0
  88. package/dist/log/index.js +14 -29
  89. package/dist/log/retention.d.ts +9 -0
  90. package/dist/log/retention.js +83 -0
  91. package/dist/log/retentionJobs.d.ts +17 -0
  92. package/dist/log/retentionJobs.js +50 -0
  93. package/dist/media/index.js +127 -4
  94. package/dist/media/jobs.js +1 -2
  95. package/dist/media/openpeeps/index.js +11 -46
  96. package/dist/media/processing.js +7 -4
  97. package/dist/media/streaming.js +5 -5
  98. package/dist/media/streamingCleanupJobs.js +1 -2
  99. package/dist/media/streamingJobs.js +3 -4
  100. package/dist/media/streamingPrewarm.js +7 -11
  101. package/dist/mediaAttachments/index.js +6 -2
  102. package/dist/mediaAttachments/mapping.d.ts +1 -1
  103. package/dist/notifications/defaultNotifications/announcement/index.js +15 -18
  104. package/dist/notifications/defaultNotifications/directMessage/index.js +9 -8
  105. package/dist/notifications/defaultNotifications/follow/index.js +14 -17
  106. package/dist/notifications/defaultNotifications/groupAdded/index.js +14 -17
  107. package/dist/notifications/defaultNotifications/groupMemberJoined/index.js +15 -18
  108. package/dist/notifications/defaultNotifications/groupMemberLeft/index.js +15 -18
  109. package/dist/notifications/defaultNotifications/jamModerator/index.js +27 -20
  110. package/dist/notifications/defaultNotifications/jamModerator/recipients.d.ts +2 -0
  111. package/dist/notifications/defaultNotifications/jamModerator/recipients.js +5 -0
  112. package/dist/notifications/defaultNotifications/jamSpeaker/index.js +14 -18
  113. package/dist/notifications/defaultNotifications/jamStarted/index.js +18 -22
  114. package/dist/notifications/defaultNotifications/mention/index.js +20 -24
  115. package/dist/notifications/defaultNotifications/newGroupPost/index.js +9 -10
  116. package/dist/notifications/defaultNotifications/newGroupPost/recipients.d.ts +5 -0
  117. package/dist/notifications/defaultNotifications/newGroupPost/recipients.js +23 -0
  118. package/dist/notifications/defaultNotifications/newProfile/index.js +14 -17
  119. package/dist/notifications/defaultNotifications/pollEnded/index.js +21 -21
  120. package/dist/notifications/defaultNotifications/pollEnded/recipients.js +2 -3
  121. package/dist/notifications/defaultNotifications/pollVote/index.js +14 -17
  122. package/dist/notifications/defaultNotifications/reaction/index.js +18 -21
  123. package/dist/notifications/defaultNotifications/reply/index.js +21 -22
  124. package/dist/notifications/defaultNotifications/repost/index.js +16 -20
  125. package/dist/notifications/defaultNotifications/rsvp/index.js +24 -18
  126. package/dist/notifications/defaultNotifications/rsvpCanceled/index.js +20 -13
  127. package/dist/notifications/eventIcsAttachment.d.ts +6 -0
  128. package/dist/notifications/eventIcsAttachment.js +32 -0
  129. package/dist/notifications/fcmCredential.js +1 -1
  130. package/dist/notifications/finders.js +1 -1
  131. package/dist/notifications/helpers.d.ts +11 -1
  132. package/dist/notifications/helpers.js +38 -9
  133. package/dist/notifications/jobs.js +16 -7
  134. package/dist/notifications/mutations.js +13 -2
  135. package/dist/notifications/push.js +11 -16
  136. package/dist/performance/index.js +3 -3
  137. package/dist/plugins/helpers.js +3 -6
  138. package/dist/plugins/index.js +2 -3
  139. package/dist/plugins/install.js +31 -17
  140. package/dist/plugins/pluginAuth.js +3 -4
  141. package/dist/plugins/state.js +2 -3
  142. package/dist/posts/activity.d.ts +1 -1
  143. package/dist/posts/activity.js +2 -3
  144. package/dist/posts/contextClosure.js +1 -2
  145. package/dist/posts/conversationQueries.js +2 -4
  146. package/dist/posts/eventAgenda.js +12 -7
  147. package/dist/posts/eventOccurrences.js +2 -2
  148. package/dist/posts/finders.d.ts +46 -6
  149. package/dist/posts/finders.js +21 -9
  150. package/dist/posts/helpers/filters.js +2 -3
  151. package/dist/posts/helpers/index.d.ts +170 -18
  152. package/dist/posts/helpers/index.js +43 -27
  153. package/dist/posts/mapping.d.ts +616 -84
  154. package/dist/posts/mapping.js +60 -18
  155. package/dist/posts/mutations.d.ts +85 -9
  156. package/dist/posts/mutations.js +47 -34
  157. package/dist/posts/pollEnd.js +3 -6
  158. package/dist/posts/rsvpConfirmationEmail.js +18 -8
  159. package/dist/posts/threadPreview.js +1 -1
  160. package/dist/processingStats/queries.js +6 -7
  161. package/dist/profileSettings/cache.js +1 -2
  162. package/dist/profileSettings/mapping.d.ts +1 -0
  163. package/dist/profiles/activitySummary.js +23 -28
  164. package/dist/profiles/cache.js +15 -8
  165. package/dist/profiles/export.js +30 -39
  166. package/dist/profiles/finders.js +7 -5
  167. package/dist/profiles/mapping.d.ts +10 -10
  168. package/dist/profiles/mutations.js +3 -5
  169. package/dist/redis/connection.js +1 -1
  170. package/dist/reports/helpers.js +7 -3
  171. package/dist/reports/mapping.d.ts +1 -1
  172. package/dist/roles/mutations.js +20 -21
  173. package/dist/search/finders.js +15 -3
  174. package/dist/search/helpers.js +1 -1
  175. package/dist/sentry/index.js +9 -11
  176. package/dist/seo/index.d.ts +50 -0
  177. package/dist/seo/index.js +145 -0
  178. package/dist/seo/route.d.ts +18 -0
  179. package/dist/seo/route.js +19 -0
  180. package/dist/server/index.d.ts +1 -0
  181. package/dist/server/index.js +16 -11
  182. package/dist/server/status.js +6 -7
  183. package/dist/session/index.js +2 -2
  184. package/dist/stats/finders.js +13 -4
  185. package/dist/stats/helpers.js +4 -1
  186. package/dist/stats/mapping.d.ts +43 -5
  187. package/dist/stats/mapping.js +9 -2
  188. package/dist/stripe/cache.js +5 -6
  189. package/dist/stripe/connection.js +3 -4
  190. package/dist/stripe/helpers.js +15 -20
  191. package/package.json +5 -6
  192. package/LICENSE +0 -674
@@ -18,12 +18,11 @@ export const updateInviteLink = async (id, inviteLinkData) => {
18
18
  return inviteLinksMapping.update(db, id, inviteLinkData);
19
19
  };
20
20
  export const redeemInviteLink = async (inviteLink, profile) => {
21
- var _a, _b;
22
- if (((_a = inviteLink.profile) === null || _a === void 0 ? void 0 : _a.id) === profile.id) {
21
+ if (inviteLink.profile?.id === profile.id) {
23
22
  throw new Error('Invite link creator and redeemer cannot be the same');
24
23
  }
25
24
  await allpeepDb().then(({ db }) => redeemInviteLinkConnector(db, profile, inviteLink));
26
- const groupIds = [...new Set((_b = inviteLink.groupIds) !== null && _b !== void 0 ? _b : [])];
25
+ const groupIds = [...new Set(inviteLink.groupIds ?? [])];
27
26
  const adder = inviteLink.profile;
28
27
  for (const groupId of groupIds) {
29
28
  const group = await findGroup(groupId);
@@ -12,14 +12,13 @@ export const jamAttendanceExportHeaders = [
12
12
  'Joined At',
13
13
  ];
14
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';
15
+ const isPublic = profile?.type === 'guest';
17
16
  return {
18
17
  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 : '')),
18
+ name: profile?.displayName || (isPublic ? '' : (profile?.handle ?? '')),
20
19
  // 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 : ''),
20
+ email: isPublic ? (profile?.guestData?.email ?? '') : '',
21
+ handle: isPublic ? '' : (profile?.handle ?? ''),
23
22
  joinedAt: join.createdAt,
24
23
  };
25
24
  };
@@ -38,8 +37,7 @@ const listJamJoinEvents = async (jamId) => {
38
37
  .where(and(eq(jamEvents.postId, jamId), isNull(jamEvents.deletedAt), sql `${jamEvents.body}->>'type' = 'join'`))
39
38
  .orderBy(asc(jamEvents.createdAt), asc(jamEvents.id));
40
39
  return rows.flatMap((row) => {
41
- var _a;
42
- const profileId = (_a = row.body) === null || _a === void 0 ? void 0 : _a.profileId;
40
+ const profileId = row.body?.profileId;
43
41
  if (typeof profileId !== 'string' || !profileId) {
44
42
  return [];
45
43
  }
@@ -10,7 +10,10 @@ export const listJamEvents = (jamId, { start, limit } = {}) => allpeepDb().then(
10
10
  export const listAttendance = (jamId, { start, limit } = {}) => allpeepDb().then(({ db }) => baseListJam({ jamId, type: 'join' }, { start, limit }).all(db));
11
11
  export const findJamState = async (jam, hideParticipants, recurrenceId) => {
12
12
  const state = await getJamState(jam, recurrenceId);
13
- return Object.assign(Object.assign({}, state), { participants: hideParticipants ? [] : state.participants });
13
+ return {
14
+ ...state,
15
+ participants: hideParticipants ? [] : state.participants,
16
+ };
14
17
  };
15
18
  export const findJamRecording = async (recordingId) => allpeepDb()
16
19
  .then(({ db }) => jamRecordingsMapping.find(db, recordingId))
@@ -1,8 +1,10 @@
1
- export declare const LIVEKIT_HEALTH_TIMEOUT_MS = 1500;
1
+ export declare const LIVEKIT_HEALTH_TIMEOUT_MS = 5000;
2
+ export declare const LIVEKIT_HEALTH_MAX_ATTEMPTS = 3;
2
3
  /**
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.
4
+ * True when a LiveKit RoomService call succeeds within maxAttempts. Retries so a
5
+ * single transient failure does not disable jams for a full /server/info bucket.
6
+ * Credentials in config are not enough — invalid keys fail on first RPC.
5
7
  */
6
- export declare const probeLivekitConnection: (listRooms: () => Promise<unknown>, timeoutMs?: number) => Promise<boolean>;
8
+ export declare const probeLivekitConnection: (listRooms: () => Promise<unknown>, timeoutMs?: number, maxAttempts?: number) => Promise<boolean>;
7
9
  /** Cached LiveKit reachability. False when unset, unauthorized, or unreachable. */
8
10
  export declare const isLivekitConnected: () => Promise<boolean>;
@@ -5,7 +5,8 @@ const log = logger('app:jams:livekit');
5
5
  /** Sentinel room name so the probe authenticates without listing every room. */
6
6
  const LIVEKIT_HEALTH_ROOM = '__openpeeps_livekit_health__';
7
7
  const LIVEKIT_HEALTH_CACHE_KEY = 'livekit-health';
8
- export const LIVEKIT_HEALTH_TIMEOUT_MS = 1500;
8
+ export const LIVEKIT_HEALTH_TIMEOUT_MS = 5000;
9
+ export const LIVEKIT_HEALTH_MAX_ATTEMPTS = 3;
9
10
  const livekitHealthCache = createCache({
10
11
  ttl: 20 * 1000,
11
12
  refreshThreshold: 5 * 1000,
@@ -23,18 +24,21 @@ const withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
23
24
  });
24
25
  });
25
26
  /**
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.
27
+ * True when a LiveKit RoomService call succeeds within maxAttempts. Retries so a
28
+ * single transient failure does not disable jams for a full /server/info bucket.
29
+ * Credentials in config are not enough — invalid keys fail on first RPC.
28
30
  */
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;
31
+ export const probeLivekitConnection = async (listRooms, timeoutMs = LIVEKIT_HEALTH_TIMEOUT_MS, maxAttempts = LIVEKIT_HEALTH_MAX_ATTEMPTS) => {
32
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
33
+ try {
34
+ await withTimeout(listRooms(), timeoutMs);
35
+ return true;
36
+ }
37
+ catch (e) {
38
+ log.warn(`LiveKit health check failed (attempt ${attempt}/${maxAttempts}): ${e.message}`);
39
+ }
37
40
  }
41
+ return false;
38
42
  };
39
43
  /** Cached LiveKit reachability. False when unset, unauthorized, or unreachable. */
40
44
  export const isLivekitConnected = () => livekitHealthCache.wrap(LIVEKIT_HEALTH_CACHE_KEY, async () => {
@@ -24,7 +24,7 @@ export declare const connectRecording: (db: import("../db").PgDb, from: ProfileW
24
24
  updatedAt: string;
25
25
  description?: string | undefined;
26
26
  blurhash?: string | undefined;
27
- status?: "failed" | "processing" | "ready" | undefined;
27
+ status?: "failed" | "ready" | "processing" | undefined;
28
28
  error?: string | undefined;
29
29
  deletedAt?: string | null | undefined;
30
30
  } | undefined;
@@ -56,7 +56,7 @@ export declare const connectRecording: (db: import("../db").PgDb, from: ProfileW
56
56
  updatedAt: string;
57
57
  description?: string | undefined;
58
58
  blurhash?: string | undefined;
59
- status?: "failed" | "processing" | "ready" | undefined;
59
+ status?: "failed" | "ready" | "processing" | undefined;
60
60
  error?: string | undefined;
61
61
  deletedAt?: string | null | undefined;
62
62
  } | undefined;
@@ -5,7 +5,11 @@ import { findProfile } from '../profiles/index.js';
5
5
  import { findPost } from '../posts/index.js';
6
6
  import { config } from '../config/index.js';
7
7
  export const connectRecording = connector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.jamRecordingsCollection);
8
- export const transformJamRecordingData = async (recording) => (Object.assign(Object.assign({}, jamRecordingSchema.parse(recording)), { profile: (await findProfile(recording._from.split('/')[1])), post: (await findPost(recording._to.split('/')[1])) }));
8
+ export const transformJamRecordingData = async (recording) => ({
9
+ ...jamRecordingSchema.parse(recording),
10
+ profile: (await findProfile(recording._from.split('/')[1])),
11
+ post: (await findPost(recording._to.split('/')[1])),
12
+ });
9
13
  /** Hostname used when stamping LiveKit room metadata (`instanceDomain`). */
10
14
  export const localInstanceDomain = async () => {
11
15
  const host = (await config()).server.host;
@@ -23,7 +27,7 @@ export const parseRoomInstanceDomain = (metadata) => {
23
27
  ? parsed.instanceDomain.toLowerCase()
24
28
  : undefined;
25
29
  }
26
- catch (_a) {
30
+ catch {
27
31
  return undefined;
28
32
  }
29
33
  };
@@ -89,7 +89,7 @@ export const listLiveJams = async (authData) => {
89
89
  ]);
90
90
  return posts.filter(canReadPost(config, authData));
91
91
  };
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; });
92
+ export const findJamEvent = async (id) => findPost(id).then((post) => post?.data?.type === 'event' && post.data?.jam ? post : undefined);
93
93
  export const closeJam = async (profile, jamEvent, recurrenceId) => {
94
94
  const rs = await roomService();
95
95
  if (rs === undefined) {
@@ -122,5 +122,5 @@ export const muteParticipant = async (jamId, data, recurrenceId) => {
122
122
  if (!result) {
123
123
  return { success: false };
124
124
  }
125
- return { success: result === null || result === void 0 ? void 0 : result.muted };
125
+ return { success: result?.muted };
126
126
  };
package/dist/jams/jobs.js CHANGED
@@ -6,12 +6,11 @@ const log = logger('app:jams:jobs');
6
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
- var _a;
10
9
  // Dynamic import avoids a load-time cycle with livekit.ts (which schedules
11
10
  // this job when a recording starts).
12
11
  const { stopRecording } = await import('./livekit.js');
13
12
  const jamPost = await findPost(job.data.jamPostId);
14
- if (!jamPost || ((_a = jamPost.data) === null || _a === void 0 ? void 0 : _a.type) !== 'event' || !jamPost.data.jam) {
13
+ if (!jamPost || jamPost.data?.type !== 'event' || !jamPost.data.jam) {
15
14
  log.info(`Skipping auto-stop for missing jam ${job.data.jamPostId}`);
16
15
  return;
17
16
  }
@@ -51,7 +51,7 @@ export declare const stopRtmpStream: (jamPost: PostWithMeta) => Promise<{
51
51
  updatedAt: string;
52
52
  description?: string | undefined;
53
53
  blurhash?: string | undefined;
54
- status?: "failed" | "processing" | "ready" | undefined;
54
+ status?: "failed" | "ready" | "processing" | undefined;
55
55
  error?: string | undefined;
56
56
  deletedAt?: string | null | undefined;
57
57
  } | undefined;
@@ -88,7 +88,7 @@ export declare const stopRecording: (jamPost: PostWithMeta, recurrenceId?: strin
88
88
  updatedAt: string;
89
89
  description?: string | undefined;
90
90
  blurhash?: string | undefined;
91
- status?: "failed" | "processing" | "ready" | undefined;
91
+ status?: "failed" | "ready" | "processing" | undefined;
92
92
  error?: string | undefined;
93
93
  deletedAt?: string | null | undefined;
94
94
  } | undefined;
@@ -92,7 +92,7 @@ export const stopEgress = async (egressId) => {
92
92
  try {
93
93
  await egressClient.stopEgress(egressId);
94
94
  }
95
- catch (_a) {
95
+ catch {
96
96
  // LiveKit egress can time out or already be stopped/failed; the user-facing
97
97
  // stop action should not fail because of that.
98
98
  }
@@ -151,7 +151,7 @@ export const startRecording = async (profile, jamPost, recurrenceId) => {
151
151
  profileId: profile.id,
152
152
  recurrenceId,
153
153
  });
154
- await roomService().then(async (rs) => rs === null || rs === void 0 ? void 0 : rs.sendData(roomName, encoder.encode(JSON.stringify(jamEvent)), DataPacket_Kind.LOSSY, {}));
154
+ await roomService().then(async (rs) => rs?.sendData(roomName, encoder.encode(JSON.stringify(jamEvent)), DataPacket_Kind.LOSSY, {}));
155
155
  // BullMQ delayed job survives API/worker restarts (unlike setTimeout).
156
156
  await scheduleRecordingAutoStop(jamId, persistedRecordingId);
157
157
  return recording;
@@ -173,7 +173,7 @@ const assertJamRoomOpen = async (jamId) => {
173
173
  }
174
174
  };
175
175
  const emitJamEvent = async (jamId, jamEvent) => {
176
- await roomService().then(async (rs) => rs === null || rs === void 0 ? void 0 : rs.sendData(jamId, encoder.encode(JSON.stringify(jamEvent)), DataPacket_Kind.LOSSY, {}));
176
+ await roomService().then(async (rs) => rs?.sendData(jamId, encoder.encode(JSON.stringify(jamEvent)), DataPacket_Kind.LOSSY, {}));
177
177
  };
178
178
  export const startRtmpStream = async (profile, jamPost, rtmpUrl, destinationHost) => {
179
179
  await assertLivekitConfigured();
@@ -221,7 +221,7 @@ export const stopRtmpStream = async (jamPost) => {
221
221
  profileId: stream.profile.id,
222
222
  });
223
223
  await emitJamEvent(jamPost.id, jamEvent);
224
- return Object.assign(Object.assign({}, stream), { status: 'completed' });
224
+ return { ...stream, status: 'completed' };
225
225
  };
226
226
  export const stopRecording = async (jamPost, recurrenceId) => {
227
227
  const jamRecording = await findActiveRecording(jamPost);
@@ -243,9 +243,9 @@ export const stopRecording = async (jamPost, recurrenceId) => {
243
243
  profileId: jamRecording.profile.id,
244
244
  recurrenceId,
245
245
  });
246
- await roomService().then(async (rs) => rs === null || rs === void 0 ? void 0 : rs.sendData(jamRoomName(jamPost.id, recurrenceId), encoder.encode(JSON.stringify(jamEvent)), DataPacket_Kind.LOSSY, {}));
246
+ await roomService().then(async (rs) => rs?.sendData(jamRoomName(jamPost.id, recurrenceId), encoder.encode(JSON.stringify(jamEvent)), DataPacket_Kind.LOSSY, {}));
247
247
  await finalizeJamRecording(jamRecording.id);
248
- return Object.assign(Object.assign({}, jamRecording), { status: 'finalizing' });
248
+ return { ...jamRecording, status: 'finalizing' };
249
249
  };
250
250
  /**
251
251
  * Stops leftover egress and deletes an egress-only LiveKit room.
@@ -267,7 +267,7 @@ export const reclaimOrphanJamRoom = async (jam, roomName = jam.id) => {
267
267
  }
268
268
  try {
269
269
  const rs = await roomService();
270
- await (rs === null || rs === void 0 ? void 0 : rs.deleteRoom(roomName));
270
+ await rs?.deleteRoom(roomName);
271
271
  }
272
272
  catch (e) {
273
273
  log.warn(`Failed to delete orphan jam room ${roomName}: ${e.message}`);
@@ -280,7 +280,7 @@ export const finishRecording = async (jamRecording) => {
280
280
  type: 'recordStop',
281
281
  profileId: jamRecording.profile.id,
282
282
  });
283
- await roomService().then(async (rs) => rs === null || rs === void 0 ? void 0 : rs.sendData(jamRoomName(jamRecording.post.id), encoder.encode(JSON.stringify(jamEvent)), DataPacket_Kind.LOSSY, {}));
283
+ await roomService().then(async (rs) => rs?.sendData(jamRoomName(jamRecording.post.id), encoder.encode(JSON.stringify(jamEvent)), DataPacket_Kind.LOSSY, {}));
284
284
  };
285
285
  export const jamState = async (jam, hideParticipants, recurrenceId) => {
286
286
  const inactive = { participants: [], active: false };
@@ -7,7 +7,7 @@ type EdgeMetadata = {
7
7
  export declare const jamEventsMapping: import("../db/pg/map").Mapping<{
8
8
  id: string;
9
9
  jamId: string;
10
- type: "close" | "join" | "message" | "start" | "reaction" | "leave" | "recordStart" | "recordStop" | "streamStart" | "streamStop";
10
+ type: "message" | "join" | "close" | "reaction" | "start" | "leave" | "recordStart" | "recordStop" | "streamStart" | "streamStop";
11
11
  profileId: string;
12
12
  content?: string | undefined;
13
13
  reaction?: "👍" | undefined;
@@ -16,7 +16,7 @@ export declare const jamEventsMapping: import("../db/pg/map").Mapping<{
16
16
  export declare const jamSessionStartsMapping: import("../db/pg/map").Mapping<{
17
17
  id: string;
18
18
  jamId: string;
19
- type: "close" | "join" | "message" | "start" | "reaction" | "leave" | "recordStart" | "recordStop" | "streamStart" | "streamStop";
19
+ type: "message" | "join" | "close" | "reaction" | "start" | "leave" | "recordStart" | "recordStop" | "streamStart" | "streamStop";
20
20
  profileId: string;
21
21
  content?: string | undefined;
22
22
  reaction?: "👍" | undefined;
@@ -25,7 +25,7 @@ export declare const jamSessionStartsMapping: import("../db/pg/map").Mapping<{
25
25
  export declare const jamSessionClosesMapping: import("../db/pg/map").Mapping<{
26
26
  id: string;
27
27
  jamId: string;
28
- type: "close" | "join" | "message" | "start" | "reaction" | "leave" | "recordStart" | "recordStop" | "streamStart" | "streamStop";
28
+ type: "message" | "join" | "close" | "reaction" | "start" | "leave" | "recordStart" | "recordStop" | "streamStart" | "streamStop";
29
29
  profileId: string;
30
30
  content?: string | undefined;
31
31
  reaction?: "👍" | undefined;
@@ -34,7 +34,7 @@ export declare const jamSessionClosesMapping: import("../db/pg/map").Mapping<{
34
34
  export declare const jamParticipantsMapping: import("../db/pg/map").Mapping<{
35
35
  id: string;
36
36
  jamId: string;
37
- type: "close" | "join" | "message" | "start" | "reaction" | "leave" | "recordStart" | "recordStop" | "streamStart" | "streamStop";
37
+ type: "message" | "join" | "close" | "reaction" | "start" | "leave" | "recordStart" | "recordStop" | "streamStart" | "streamStop";
38
38
  profileId: string;
39
39
  content?: string | undefined;
40
40
  reaction?: "👍" | undefined;
@@ -42,7 +42,7 @@ export declare const jamParticipantsMapping: import("../db/pg/map").Mapping<{
42
42
  }, JamEvent, JamEvent>;
43
43
  export declare const jamRecordingRelation: RelationWithMapping<PostWithMeta, JamRecording>;
44
44
  export declare const jamRecordingsMapping: import("../db/pg/map").Mapping<{
45
- status: "active" | "completed" | "failed" | "requested" | "finalizing";
45
+ status: "completed" | "failed" | "active" | "requested" | "finalizing";
46
46
  kind?: "file" | "rtmp" | undefined;
47
47
  destinationHost?: string | undefined;
48
48
  egressId?: string | undefined;
@@ -66,7 +66,7 @@ export declare const jamRecordingsMapping: import("../db/pg/map").Mapping<{
66
66
  updatedAt: string;
67
67
  description?: string | undefined;
68
68
  blurhash?: string | undefined;
69
- status?: "ready" | "failed" | "processing" | undefined;
69
+ status?: "failed" | "ready" | "processing" | undefined;
70
70
  error?: string | undefined;
71
71
  deletedAt?: string | null | undefined;
72
72
  } | undefined;
@@ -76,7 +76,7 @@ export declare const jamRecordingsMapping: import("../db/pg/map").Mapping<{
76
76
  updatedAt: string;
77
77
  deletedAt?: string | null | undefined;
78
78
  } & {
79
- status: "active" | "completed" | "failed" | "requested" | "finalizing";
79
+ status: "completed" | "failed" | "active" | "requested" | "finalizing";
80
80
  kind?: "file" | "rtmp" | undefined;
81
81
  destinationHost?: string | undefined;
82
82
  egressId?: string | undefined;
@@ -100,7 +100,7 @@ export declare const jamRecordingsMapping: import("../db/pg/map").Mapping<{
100
100
  updatedAt: string;
101
101
  description?: string | undefined;
102
102
  blurhash?: string | undefined;
103
- status?: "ready" | "failed" | "processing" | undefined;
103
+ status?: "failed" | "ready" | "processing" | undefined;
104
104
  error?: string | undefined;
105
105
  deletedAt?: string | null | undefined;
106
106
  } | undefined;
@@ -112,7 +112,7 @@ export declare const jamRecordingsMapping: import("../db/pg/map").Mapping<{
112
112
  updatedAt: string;
113
113
  deletedAt?: string | null | undefined;
114
114
  } & {
115
- status: "active" | "completed" | "failed" | "requested" | "finalizing";
115
+ status: "completed" | "failed" | "active" | "requested" | "finalizing";
116
116
  kind?: "file" | "rtmp" | undefined;
117
117
  destinationHost?: string | undefined;
118
118
  egressId?: string | undefined;
@@ -136,7 +136,7 @@ export declare const jamRecordingsMapping: import("../db/pg/map").Mapping<{
136
136
  updatedAt: string;
137
137
  description?: string | undefined;
138
138
  blurhash?: string | undefined;
139
- status?: "ready" | "failed" | "processing" | undefined;
139
+ status?: "failed" | "ready" | "processing" | undefined;
140
140
  error?: string | undefined;
141
141
  deletedAt?: string | null | undefined;
142
142
  } | undefined;
@@ -5,7 +5,7 @@ export declare const updateJamRecording: (recordingId: string, recording: Partia
5
5
  updatedAt: string;
6
6
  deletedAt?: string | null | undefined;
7
7
  } & {
8
- status: "active" | "completed" | "failed" | "requested" | "finalizing";
8
+ status: "completed" | "failed" | "active" | "requested" | "finalizing";
9
9
  kind?: "file" | "rtmp" | undefined;
10
10
  destinationHost?: string | undefined;
11
11
  egressId?: string | undefined;
@@ -29,7 +29,7 @@ export declare const updateJamRecording: (recordingId: string, recording: Partia
29
29
  updatedAt: string;
30
30
  description?: string | undefined;
31
31
  blurhash?: string | undefined;
32
- status?: "ready" | "failed" | "processing" | undefined;
32
+ status?: "failed" | "ready" | "processing" | undefined;
33
33
  error?: string | undefined;
34
34
  deletedAt?: string | null | undefined;
35
35
  } | undefined;
@@ -81,7 +81,7 @@ export const publishJamRecordingReply = async (eventPost, recordingId) => {
81
81
  audience: eventPost.audience,
82
82
  });
83
83
  await updateJamRecording(recordingId, { replyPostId: reply.id });
84
- return jamRecordingSchema.parse(Object.assign(Object.assign({}, recording), { replyPostId: reply.id }));
84
+ return jamRecordingSchema.parse({ ...recording, replyPostId: reply.id });
85
85
  };
86
86
  export const deleteJamRecording = async (eventPost, recordingId) => {
87
87
  const recording = await findJamRecording(recordingId);
@@ -10,26 +10,24 @@ import { createJamEvent } from './mutations.js';
10
10
  import { uuidv7 } from 'uuidv7';
11
11
  import { findProfile } from '../profiles/index.js';
12
12
  const calculateSources = (jam, profile) => {
13
- var _a;
14
13
  const sources = [TrackSource.MICROPHONE];
15
14
  if (jam.videoEnabled) {
16
15
  sources.push(TrackSource.CAMERA, TrackSource.SCREEN_SHARE, TrackSource.SCREEN_SHARE_AUDIO);
17
16
  }
18
- if ((_a = jam.presenters) === null || _a === void 0 ? void 0 : _a.includes(profile.id)) {
17
+ if (jam.presenters?.includes(profile.id)) {
19
18
  sources.push(TrackSource.SCREEN_SHARE, TrackSource.SCREEN_SHARE_AUDIO);
20
19
  }
21
20
  return sources;
22
21
  };
23
22
  export const assertJamRsvpAllowed = (event, profile, recurrenceId) => {
24
- var _a, _b;
25
- const eventData = ((_a = event.data) === null || _a === void 0 ? void 0 : _a.type) === 'event' ? event.data : undefined;
26
- if (!(eventData === null || eventData === void 0 ? void 0 : eventData.maxAttendees)) {
23
+ const eventData = event.data?.type === 'event' ? event.data : undefined;
24
+ if (!eventData?.maxAttendees) {
27
25
  return;
28
26
  }
29
27
  if (canModerateJam(profile, event)) {
30
28
  return;
31
29
  }
32
- if (((_b = getEffectiveRsvp(event, profile.id, recurrenceId)) === null || _b === void 0 ? void 0 : _b.response) === 'yes') {
30
+ if (getEffectiveRsvp(event, profile.id, recurrenceId)?.response === 'yes') {
33
31
  return;
34
32
  }
35
33
  if (countYesRsvps(event, recurrenceId) >= eventData.maxAttendees) {
@@ -38,10 +36,9 @@ export const assertJamRsvpAllowed = (event, profile, recurrenceId) => {
38
36
  throw forbidden({ errorKey: 'error.jamRsvpRequired' });
39
37
  };
40
38
  export const createJamEgressToken = async (event, recurrenceId) => {
41
- var _a, _b;
42
39
  const jamId = event.id;
43
40
  const roomName = jamRoomName(event.id, recurrenceId);
44
- const jam = ((_a = event.data) === null || _a === void 0 ? void 0 : _a.type) === 'event' && ((_b = event.data) === null || _b === void 0 ? void 0 : _b.jam);
41
+ const jam = event.data?.type === 'event' && event.data?.jam;
45
42
  if (!jam) {
46
43
  throw notFound({ errorKey: 'error.jamNotFound', parameters: { jamId } });
47
44
  }
@@ -62,17 +59,16 @@ export const createJamEgressToken = async (event, recurrenceId) => {
62
59
  return accessToken.toJwt();
63
60
  };
64
61
  export const createJamToken = async (event, profile, { external = false, recurrenceId, reconnect = false, } = {}) => {
65
- var _a, _b, _c, _d;
66
62
  if (!profile.id)
67
63
  throw authNeeded({ errorKey: 'error.profileRequired' });
68
64
  const jamId = event.id;
69
65
  const roomName = jamRoomName(event.id, recurrenceId);
70
- const jam = ((_a = event.data) === null || _a === void 0 ? void 0 : _a.type) === 'event' && ((_b = event.data) === null || _b === void 0 ? void 0 : _b.jam);
66
+ const jam = event.data?.type === 'event' && event.data?.jam;
71
67
  if (!jam) {
72
68
  throw notFound({ errorKey: 'error.jamNotFound', parameters: { jamId } });
73
69
  }
74
70
  const joiner = await findProfile(profile.id);
75
- if (joiner && isBlockedPair(joiner, (_c = event.profile) === null || _c === void 0 ? void 0 : _c.id)) {
71
+ if (joiner && isBlockedPair(joiner, event.profile?.id)) {
76
72
  throw notFound({ errorKey: 'error.jamNotFound', parameters: { jamId } });
77
73
  }
78
74
  assertJamRsvpAllowed(event, profile, recurrenceId);
@@ -84,11 +80,11 @@ export const createJamToken = async (event, profile, { external = false, recurre
84
80
  try {
85
81
  rooms = await rs.listRooms([roomName]);
86
82
  }
87
- catch (_e) {
83
+ catch {
88
84
  throw forbidden({ errorKey: 'error.jamsUnavailable' });
89
85
  }
90
86
  const jamOpen = rooms.length === 1;
91
- if (!jamOpen && (reconnect || !(jam === null || jam === void 0 ? void 0 : jam.moderators.includes(profile.id)))) {
87
+ if (!jamOpen && (reconnect || !jam?.moderators.includes(profile.id))) {
92
88
  throw forbidden({ errorKey: 'error.jamNotOpen' });
93
89
  }
94
90
  if (!jamOpen) {
@@ -103,7 +99,7 @@ export const createJamToken = async (event, profile, { external = false, recurre
103
99
  departureTimeout: JAM_ROOM_DEPARTURE_TIMEOUT_SEC,
104
100
  });
105
101
  }
106
- catch (_f) {
102
+ catch {
107
103
  // Concurrent open may have created the room already.
108
104
  }
109
105
  }
@@ -128,9 +124,9 @@ export const createJamToken = async (event, profile, { external = false, recurre
128
124
  accessToken.addGrant({
129
125
  room: roomName,
130
126
  roomJoin: true,
131
- roomAdmin: jam === null || jam === void 0 ? void 0 : jam.moderators.includes(profile.id),
132
- roomRecord: jam === null || jam === void 0 ? void 0 : jam.moderators.includes(profile.id),
133
- canPublish: (jam === null || jam === void 0 ? void 0 : jam.type) === 'video-call' || !!((_d = jam === null || jam === void 0 ? void 0 : jam.speakers) === null || _d === void 0 ? void 0 : _d.includes(profile.id)),
127
+ roomAdmin: jam?.moderators.includes(profile.id),
128
+ roomRecord: jam?.moderators.includes(profile.id),
129
+ canPublish: jam?.type === 'video-call' || !!jam?.speakers?.includes(profile.id),
134
130
  canPublishSources: calculateSources(jam, profile),
135
131
  canPublishData: true,
136
132
  canSubscribe: true,
@@ -18,10 +18,13 @@ export const closeQueues = async () => {
18
18
  export const queueAndWorker = (queueName, processor, queueOptions) => [
19
19
  () => {
20
20
  if (!queues[queueName]) {
21
- const queue = new Queue(queueName, Object.assign({ connection }, queueOptions));
21
+ const queue = new Queue(queueName, {
22
+ connection,
23
+ ...queueOptions,
24
+ });
22
25
  queues[queueName] = queue;
23
26
  // Clean up existing jobs based on defaultJobOptions retention settings
24
- const defaultJobOptions = queueOptions === null || queueOptions === void 0 ? void 0 : queueOptions.defaultJobOptions;
27
+ const defaultJobOptions = queueOptions?.defaultJobOptions;
25
28
  if (defaultJobOptions) {
26
29
  void (async () => {
27
30
  try {
@@ -57,9 +60,7 @@ export const queueAndWorker = (queueName, processor, queueOptions) => [
57
60
  metrics: { maxDataPoints: MetricsTime.ONE_WEEK },
58
61
  }),
59
62
  ];
60
- export const getOrCreateQueue = (queueName) => {
61
- var _a;
62
- return (_a = queues[queueName]) !== null && _a !== void 0 ? _a : (queues[queueName] = new Queue(queueName, { connection }));
63
- };
63
+ export const getOrCreateQueue = (queueName) => queues[queueName] ??
64
+ (queues[queueName] = new Queue(queueName, { connection }));
64
65
  export { getJobDetail } from './jobDetail.js';
65
66
  export { jobLogger, logStep, logFailure, formatErrorDetail, } from './jobLog.js';
@@ -1,6 +1,5 @@
1
1
  import { getOrCreateQueue } from './index.js';
2
2
  export const getJobDetail = async (queueName, jobId) => {
3
- var _a, _b, _c, _d, _e;
4
3
  const queue = getOrCreateQueue(queueName);
5
4
  const job = await queue.getJob(jobId);
6
5
  if (!job || job.id == null) {
@@ -15,11 +14,11 @@ export const getJobDetail = async (queueName, jobId) => {
15
14
  id: String(job.id),
16
15
  name: job.name,
17
16
  state,
18
- failedReason: (_a = job.failedReason) !== null && _a !== void 0 ? _a : null,
19
- finishedOn: (_b = job.finishedOn) !== null && _b !== void 0 ? _b : null,
20
- processedOn: (_c = job.processedOn) !== null && _c !== void 0 ? _c : null,
21
- timestamp: (_d = job.timestamp) !== null && _d !== void 0 ? _d : null,
22
- data: (_e = job.data) !== null && _e !== void 0 ? _e : null,
17
+ failedReason: job.failedReason ?? null,
18
+ finishedOn: job.finishedOn ?? null,
19
+ processedOn: job.processedOn ?? null,
20
+ timestamp: job.timestamp ?? null,
21
+ data: job.data ?? null,
23
22
  logs,
24
23
  logCount: count,
25
24
  };
@@ -6,7 +6,6 @@ export const jobLogger = (job) => (message) => job.log(message).then(() => undef
6
6
  * `code`) so failed deliveries are diagnosable from the job log alone.
7
7
  */
8
8
  export const formatErrorDetail = (error) => {
9
- var _a, _b;
10
9
  if (error instanceof Error) {
11
10
  const e = error;
12
11
  const parts = [e.message];
@@ -24,13 +23,13 @@ export const formatErrorDetail = (error) => {
24
23
  }
25
24
  if (error && typeof error === 'object') {
26
25
  const e = error;
27
- const reason = (_b = (_a = e.reason) !== null && _a !== void 0 ? _a : e.code) !== null && _b !== void 0 ? _b : e.message;
26
+ const reason = e.reason ?? e.code ?? e.message;
28
27
  if (reason != null)
29
28
  return String(reason);
30
29
  try {
31
30
  return JSON.stringify(error);
32
31
  }
33
- catch (_c) {
32
+ catch {
34
33
  return String(error);
35
34
  }
36
35
  }
@@ -1,42 +1,7 @@
1
- var __asyncValues = (this && this.__asyncValues) || function (o) {
2
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
3
- var m = o[Symbol.asyncIterator], i;
4
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
5
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
6
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
7
- };
8
- var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
9
- var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
10
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
11
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
12
- return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
13
- function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
14
- function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
15
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
16
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
17
- function fulfill(value) { resume("next", value); }
18
- function reject(value) { resume("throw", value); }
19
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
20
- };
21
- function nodeStreamToIterator(stream) {
22
- return __asyncGenerator(this, arguments, function* nodeStreamToIterator_1() {
23
- var _a, e_1, _b, _c;
24
- try {
25
- for (var _d = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield __await(stream_1.next()), _a = stream_1_1.done, !_a; _d = true) {
26
- _c = stream_1_1.value;
27
- _d = false;
28
- const chunk = _c;
29
- yield yield __await(chunk);
30
- }
31
- }
32
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
33
- finally {
34
- try {
35
- if (!_d && !_a && (_b = stream_1.return)) yield __await(_b.call(stream_1));
36
- }
37
- finally { if (e_1) throw e_1.error; }
38
- }
39
- });
1
+ async function* nodeStreamToIterator(stream) {
2
+ for await (const chunk of stream) {
3
+ yield chunk;
4
+ }
40
5
  }
41
6
  function iteratorToStream(iterator) {
42
7
  return new ReadableStream({
@@ -1,3 +1,3 @@
1
- import { type ZodTypeAny } from 'zod';
1
+ import { type ZodTypeAny } from '@openpeepshq/common/zod';
2
2
  /** Zod v4 removed `.deepPartial()`; this mirrors the v3 helper for config documents. */
3
3
  export declare const zodDeepPartialSchema: (schema: ZodTypeAny) => ZodTypeAny;
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import { z } from '@openpeepshq/common/zod';
2
2
  const ZodObjectCtor = z.object({}).constructor;
3
3
  const ZodArrayCtor = z.array(z.string()).constructor;
4
4
  const ZodOptionalCtor = z.string().optional().constructor;