fireflies-api 0.5.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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -0
  3. package/dist/action-items-CC9yUxHY.d.cts +380 -0
  4. package/dist/action-items-CC9yUxHY.d.ts +380 -0
  5. package/dist/cli/index.cjs +3909 -0
  6. package/dist/cli/index.cjs.map +1 -0
  7. package/dist/cli/index.d.cts +2 -0
  8. package/dist/cli/index.d.ts +2 -0
  9. package/dist/cli/index.js +3906 -0
  10. package/dist/cli/index.js.map +1 -0
  11. package/dist/index.cjs +3389 -0
  12. package/dist/index.cjs.map +1 -0
  13. package/dist/index.d.cts +966 -0
  14. package/dist/index.d.ts +966 -0
  15. package/dist/index.js +3344 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/middleware/express.cjs +2491 -0
  18. package/dist/middleware/express.cjs.map +1 -0
  19. package/dist/middleware/express.d.cts +36 -0
  20. package/dist/middleware/express.d.ts +36 -0
  21. package/dist/middleware/express.js +2489 -0
  22. package/dist/middleware/express.js.map +1 -0
  23. package/dist/middleware/fastify.cjs +2501 -0
  24. package/dist/middleware/fastify.cjs.map +1 -0
  25. package/dist/middleware/fastify.d.cts +66 -0
  26. package/dist/middleware/fastify.d.ts +66 -0
  27. package/dist/middleware/fastify.js +2498 -0
  28. package/dist/middleware/fastify.js.map +1 -0
  29. package/dist/middleware/hono.cjs +2493 -0
  30. package/dist/middleware/hono.cjs.map +1 -0
  31. package/dist/middleware/hono.d.cts +37 -0
  32. package/dist/middleware/hono.d.ts +37 -0
  33. package/dist/middleware/hono.js +2490 -0
  34. package/dist/middleware/hono.js.map +1 -0
  35. package/dist/schemas/index.cjs +307 -0
  36. package/dist/schemas/index.cjs.map +1 -0
  37. package/dist/schemas/index.d.cts +926 -0
  38. package/dist/schemas/index.d.ts +926 -0
  39. package/dist/schemas/index.js +268 -0
  40. package/dist/schemas/index.js.map +1 -0
  41. package/dist/speaker-analytics-Dr46LKyP.d.ts +275 -0
  42. package/dist/speaker-analytics-l45LXqO1.d.cts +275 -0
  43. package/dist/types-BX-3JcRI.d.cts +41 -0
  44. package/dist/types-C_XxdRd1.d.cts +1546 -0
  45. package/dist/types-CaHcwnKw.d.ts +41 -0
  46. package/dist/types-DIPZmUl3.d.ts +1546 -0
  47. package/package.json +126 -0
@@ -0,0 +1,275 @@
1
+ import { S as Speaker, T as Transcript } from './action-items-CC9yUxHY.cjs';
2
+
3
+ /**
4
+ * Options for normalizing a Fireflies transcript to provider-agnostic format.
5
+ */
6
+ interface NormalizationOptions {
7
+ /**
8
+ * Time unit for timestamps in sentences.
9
+ * @default 'seconds'
10
+ */
11
+ timeUnit?: 'seconds' | 'milliseconds';
12
+ /**
13
+ * Include original Fireflies data in source.rawData.
14
+ * @default false
15
+ */
16
+ includeRawData?: boolean;
17
+ /**
18
+ * Include AI-detected filters (sentiment, questions, tasks) in sentences.
19
+ * @default true
20
+ */
21
+ includeAIFilters?: boolean;
22
+ /**
23
+ * Include summary data if available.
24
+ * @default true
25
+ */
26
+ includeSummary?: boolean;
27
+ /**
28
+ * Custom speaker name resolver (e.g., map "Speaker 1" to real name).
29
+ */
30
+ resolveSpeakerName?: (speaker: Speaker, transcript: Transcript) => string;
31
+ /**
32
+ * Custom participant enrichment (e.g., add roles from external source).
33
+ */
34
+ enrichParticipant?: (email: string, transcript: Transcript) => Partial<NormalizedParticipant>;
35
+ }
36
+ /**
37
+ * A provider-agnostic normalized meeting transcript.
38
+ */
39
+ interface NormalizedMeeting {
40
+ /** Prefixed ID: "fireflies:abc123" */
41
+ id: string;
42
+ /** Meeting title */
43
+ title: string;
44
+ /** Meeting date */
45
+ date: Date;
46
+ /** Duration in seconds */
47
+ duration: number;
48
+ /** URL to view the transcript */
49
+ url: string;
50
+ /** Speakers identified in the transcript */
51
+ speakers: NormalizedSpeaker[];
52
+ /** Transcribed sentences */
53
+ sentences: NormalizedSentence[];
54
+ /** Meeting participants */
55
+ participants: NormalizedParticipant[];
56
+ /** AI-generated summary (if available and enabled) */
57
+ summary?: NormalizedSummary;
58
+ /** Meeting attendees with join/leave times */
59
+ attendees?: NormalizedAttendee[];
60
+ /** Channels the transcript is shared to */
61
+ channels?: NormalizedChannel[];
62
+ /** Meeting analytics */
63
+ analytics?: NormalizedAnalytics;
64
+ /** Source provider information */
65
+ source: {
66
+ provider: 'fireflies';
67
+ originalId: string;
68
+ rawData?: Transcript;
69
+ };
70
+ }
71
+ /**
72
+ * A normalized speaker in the transcript.
73
+ */
74
+ interface NormalizedSpeaker {
75
+ /** Speaker ID */
76
+ id: string;
77
+ /** Speaker name */
78
+ name: string;
79
+ }
80
+ /**
81
+ * A normalized sentence in the transcript.
82
+ */
83
+ interface NormalizedSentence {
84
+ /** Zero-based index */
85
+ index: number;
86
+ /** Speaker ID */
87
+ speakerId: string;
88
+ /** Speaker name */
89
+ speakerName: string;
90
+ /** Processed text */
91
+ text: string;
92
+ /** Original unprocessed text */
93
+ rawText: string;
94
+ /** Start time (in timeUnit) */
95
+ startTime: number;
96
+ /** End time (in timeUnit) */
97
+ endTime: number;
98
+ /** AI-detected sentiment */
99
+ sentiment?: 'positive' | 'negative' | 'neutral';
100
+ /** Whether this sentence is a question */
101
+ isQuestion?: boolean;
102
+ /** Whether this sentence is an action item */
103
+ isActionItem?: boolean;
104
+ }
105
+ /**
106
+ * A normalized meeting participant.
107
+ */
108
+ interface NormalizedParticipant {
109
+ /** Participant name */
110
+ name: string;
111
+ /** Email address */
112
+ email?: string;
113
+ /** Role in the meeting */
114
+ role?: 'organizer' | 'attendee';
115
+ }
116
+ /**
117
+ * A normalized meeting summary.
118
+ */
119
+ interface NormalizedSummary {
120
+ /** High-level overview */
121
+ overview?: string;
122
+ /** Key points or bullet summary */
123
+ keyPoints?: string[];
124
+ /** Action items text */
125
+ actionItems?: string;
126
+ /** Structured outline */
127
+ outline?: string;
128
+ /** Topics discussed */
129
+ topics?: string[];
130
+ }
131
+ /**
132
+ * A normalized meeting attendee with join/leave times.
133
+ */
134
+ interface NormalizedAttendee {
135
+ /** Attendee name */
136
+ name: string;
137
+ /** Email address */
138
+ email?: string;
139
+ /** Phone number */
140
+ phoneNumber?: string;
141
+ /** Time they joined */
142
+ joinTime?: Date;
143
+ /** Time they left */
144
+ leaveTime?: Date;
145
+ }
146
+ /**
147
+ * A normalized channel.
148
+ */
149
+ interface NormalizedChannel {
150
+ /** Channel ID */
151
+ id: string;
152
+ /** Channel title */
153
+ title: string;
154
+ /** Whether the channel is private */
155
+ isPrivate: boolean;
156
+ }
157
+ /**
158
+ * Normalized meeting analytics.
159
+ */
160
+ interface NormalizedAnalytics {
161
+ /** Sentiment breakdown (percentages 0-100) */
162
+ sentiments?: {
163
+ positive: number;
164
+ neutral: number;
165
+ negative: number;
166
+ };
167
+ }
168
+
169
+ /**
170
+ * Statistics for a single speaker in the meeting.
171
+ */
172
+ interface SpeakerStats {
173
+ /** Speaker name from transcript */
174
+ name: string;
175
+ /** Speaker ID from transcript */
176
+ id: string;
177
+ /** Total talk time in seconds */
178
+ talkTime: number;
179
+ /** Percentage of total meeting talk time (0-100) */
180
+ talkTimePercentage: number;
181
+ /** Number of sentences spoken */
182
+ sentenceCount: number;
183
+ /** Total words spoken */
184
+ wordCount: number;
185
+ /** Words per minute (based on talk time) */
186
+ wordsPerMinute: number;
187
+ /** Average words per sentence */
188
+ averageSentenceLength: number;
189
+ /** Number of speaking turns (consecutive sentence groups) */
190
+ turnCount: number;
191
+ }
192
+ /**
193
+ * Overall meeting speaker analytics.
194
+ */
195
+ interface SpeakerAnalytics {
196
+ /** Per-speaker statistics, sorted by talk time descending */
197
+ speakers: SpeakerStats[];
198
+ /** Total meeting duration from sentences (seconds) */
199
+ totalDuration: number;
200
+ /** Total talk time across all speakers (seconds) */
201
+ totalTalkTime: number;
202
+ /** Total sentences in transcript */
203
+ totalSentences: number;
204
+ /** Total words spoken */
205
+ totalWords: number;
206
+ /** Name of speaker with most talk time */
207
+ dominantSpeaker: string;
208
+ /** Talk time percentage of dominant speaker */
209
+ dominantSpeakerPercentage: number;
210
+ /** Balance indicator: balanced, unbalanced, or dominated */
211
+ balance: 'balanced' | 'unbalanced' | 'dominated';
212
+ }
213
+ /**
214
+ * Options for speaker analysis.
215
+ */
216
+ interface SpeakerAnalyticsOptions {
217
+ /**
218
+ * Merge speakers with identical names into a single entry (default: true).
219
+ *
220
+ * Fireflies' speaker diarization can incorrectly assign multiple speaker IDs
221
+ * to the same person, especially with:
222
+ * - Multiple audio channels/microphones
223
+ * - Short utterances being misattributed
224
+ * - Audio quality issues causing speaker model confusion
225
+ *
226
+ * This commonly manifests as rapid alternation between two IDs for the same
227
+ * speaker name, resulting in inflated turn counts and split statistics.
228
+ *
229
+ * When enabled (default), speakers are grouped by name rather than ID,
230
+ * combining their talk time, word counts, and other metrics. Turn counting
231
+ * uses speaker names, so consecutive sentences from the same person count
232
+ * as one turn regardless of ID changes.
233
+ *
234
+ * Set to `false` to preserve the raw speaker IDs from Fireflies, which may
235
+ * be useful for debugging diarization issues or when you have confirmed that
236
+ * multiple people share the same display name.
237
+ */
238
+ mergeSpeakersByName?: boolean;
239
+ /** Round percentages to integers (default: true) */
240
+ roundPercentages?: boolean;
241
+ /** Threshold for 'unbalanced' classification (default: 40) */
242
+ unbalancedThreshold?: number;
243
+ /** Threshold for 'dominated' classification (default: 60) */
244
+ dominatedThreshold?: number;
245
+ }
246
+ /**
247
+ * Analyze speaker participation in a transcript.
248
+ *
249
+ * Computes talk time percentages, word counts, and participation metrics
250
+ * for each speaker in the meeting.
251
+ *
252
+ * @param transcript - The transcript to analyze
253
+ * @param options - Analysis options
254
+ * @returns Speaker analytics with per-speaker stats and totals
255
+ *
256
+ * @example
257
+ * ```typescript
258
+ * import { FirefliesClient, analyzeSpeakers } from 'fireflies-api';
259
+ *
260
+ * const client = new FirefliesClient({ apiKey: 'your-api-key' });
261
+ * const transcript = await client.transcripts.get({ id: 'transcript-id' });
262
+ *
263
+ * const analytics = analyzeSpeakers(transcript);
264
+ *
265
+ * console.log(`${analytics.speakers.length} speakers`);
266
+ * console.log(`Dominant: ${analytics.dominantSpeaker} (${analytics.dominantSpeakerPercentage}%)`);
267
+ *
268
+ * for (const speaker of analytics.speakers) {
269
+ * console.log(`${speaker.name}: ${speaker.talkTimePercentage}% talk time, ${speaker.wordCount} words`);
270
+ * }
271
+ * ```
272
+ */
273
+ declare function analyzeSpeakers(transcript: Transcript, options?: SpeakerAnalyticsOptions): SpeakerAnalytics;
274
+
275
+ export { type NormalizedMeeting as N, type SpeakerAnalytics as S, type NormalizationOptions as a, type NormalizedAnalytics as b, type NormalizedAttendee as c, type NormalizedChannel as d, type NormalizedParticipant as e, type NormalizedSentence as f, type NormalizedSpeaker as g, type NormalizedSummary as h, type SpeakerAnalyticsOptions as i, type SpeakerStats as j, analyzeSpeakers as k };
@@ -0,0 +1,41 @@
1
+ import { W as WebhookPayload, F as FirefliesClient } from './types-C_XxdRd1.cjs';
2
+ import { T as Transcript } from './action-items-CC9yUxHY.cjs';
3
+
4
+ /**
5
+ * Context provided to webhook event handlers.
6
+ */
7
+ interface WebhookHandlerContext {
8
+ /** The parsed and validated webhook payload */
9
+ payload: WebhookPayload;
10
+ /** The full transcript, if apiKey provided and autoFetch enabled */
11
+ transcript?: Transcript;
12
+ /** FirefliesClient instance, available if apiKey provided */
13
+ client?: FirefliesClient;
14
+ }
15
+ /**
16
+ * Handler function for webhook events.
17
+ */
18
+ type WebhookEventHandler = (context: WebhookHandlerContext) => void | Promise<void>;
19
+ /**
20
+ * Error handler function for webhook processing errors.
21
+ */
22
+ type WebhookErrorHandler = (error: Error, payload?: WebhookPayload) => void | Promise<void>;
23
+ /**
24
+ * Options for configuring webhook middleware.
25
+ */
26
+ interface WebhookMiddlewareOptions {
27
+ /** Webhook secret for signature verification (required) */
28
+ secret: string;
29
+ /** API key for auto-fetching transcripts (optional) */
30
+ apiKey?: string;
31
+ /** Auto-fetch transcript when apiKey is provided (default: true if apiKey provided) */
32
+ autoFetch?: boolean;
33
+ /** Handler called for 'Transcription completed' events */
34
+ onTranscriptionCompleted?: WebhookEventHandler;
35
+ /** Generic handler called for all events (runs before specific handlers) */
36
+ onEvent?: WebhookEventHandler;
37
+ /** Handler called when an error occurs during processing */
38
+ onError?: WebhookErrorHandler;
39
+ }
40
+
41
+ export type { WebhookMiddlewareOptions as W };