whisperai-sdk 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -110
- package/dist/client.d.ts +31 -16
- package/dist/constant.d.ts +4 -0
- package/dist/errors.d.ts +17 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +461 -113
- package/dist/types.d.ts +138 -94
- package/package.json +2 -1
package/dist/types.d.ts
CHANGED
|
@@ -4,12 +4,29 @@ export interface ClientOptions {
|
|
|
4
4
|
email: string;
|
|
5
5
|
password: string;
|
|
6
6
|
};
|
|
7
|
-
chunkSize?: number;
|
|
8
7
|
whisperUrl?: string;
|
|
8
|
+
chunkSize?: number;
|
|
9
|
+
maxUploadAttempts?: number;
|
|
10
|
+
initialRetryDelayMs?: number;
|
|
11
|
+
maxRetryDelayMs?: number;
|
|
12
|
+
diagnostics?: boolean;
|
|
13
|
+
pollIntervalMs?: number;
|
|
14
|
+
transcriptionTimeoutMs?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface OperationOptions {
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
onProgress?: (percentage: number) => void;
|
|
19
|
+
diagnosticId?: string;
|
|
20
|
+
diagnostics?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface TranscribeOptions extends OperationOptions {
|
|
23
|
+
pollIntervalMs?: number;
|
|
24
|
+
timeoutMs?: number;
|
|
9
25
|
}
|
|
10
26
|
export interface RequestError {
|
|
11
27
|
message: string;
|
|
12
|
-
path
|
|
28
|
+
path?: string;
|
|
29
|
+
code?: string;
|
|
13
30
|
}
|
|
14
31
|
export interface UserInfo {
|
|
15
32
|
id: number;
|
|
@@ -18,7 +35,7 @@ export interface UserInfo {
|
|
|
18
35
|
firstName: string;
|
|
19
36
|
lastName: string;
|
|
20
37
|
profileImageUrl: string | null;
|
|
21
|
-
subscriptionTier:
|
|
38
|
+
subscriptionTier: string;
|
|
22
39
|
stripeSubscriptionId: string | null;
|
|
23
40
|
stripeCustomerId: string | null;
|
|
24
41
|
trialStartDate: string | null;
|
|
@@ -27,12 +44,12 @@ export interface UserInfo {
|
|
|
27
44
|
monthlyUsageMinutes: number;
|
|
28
45
|
usageResetDate: string;
|
|
29
46
|
deletedMinutesThisCycle: number;
|
|
30
|
-
subscriptionStatus:
|
|
47
|
+
subscriptionStatus: string;
|
|
31
48
|
subscriptionEndDate: string | null;
|
|
32
49
|
cancellationOffered: boolean;
|
|
33
50
|
unsubscribed: boolean;
|
|
34
51
|
hearAboutUs: string | null;
|
|
35
|
-
industry:
|
|
52
|
+
industry: string;
|
|
36
53
|
totalMinutes: number;
|
|
37
54
|
recordingsCount: number;
|
|
38
55
|
subscriptionPausedUntil: string | null;
|
|
@@ -40,7 +57,7 @@ export interface UserInfo {
|
|
|
40
57
|
subscriptionOriginalTier: string | null;
|
|
41
58
|
discountCodeApplied: string | null;
|
|
42
59
|
retentionOfferShown: string | null;
|
|
43
|
-
billingFrequency:
|
|
60
|
+
billingFrequency: string;
|
|
44
61
|
hasSeenTutorial: boolean;
|
|
45
62
|
lastLoginAt: string | null;
|
|
46
63
|
createdAt: string;
|
|
@@ -48,34 +65,91 @@ export interface UserInfo {
|
|
|
48
65
|
}
|
|
49
66
|
export interface UsageInfo {
|
|
50
67
|
monthlyUsageMinutes: number;
|
|
51
|
-
subscriptionTier:
|
|
68
|
+
subscriptionTier: string;
|
|
52
69
|
limits: {
|
|
53
70
|
monthlyMinutes: number;
|
|
54
71
|
dailyMinutes: number;
|
|
55
72
|
maxFileSize: number;
|
|
56
73
|
};
|
|
74
|
+
maxFileSizeBytes: number;
|
|
57
75
|
}
|
|
76
|
+
export type TranscriptionStyle = "standard" | "clean_readable" | (string & {});
|
|
77
|
+
export type SpeakerIdentificationMode = "role" | "name" | (string & {});
|
|
58
78
|
export interface InitMetaFile {
|
|
59
79
|
filename: string;
|
|
60
80
|
durationSeconds: number;
|
|
61
81
|
title?: string;
|
|
62
82
|
mimeType?: string;
|
|
63
83
|
totalSize?: number;
|
|
64
|
-
language?:
|
|
84
|
+
language?: string;
|
|
65
85
|
enableSpeakerDetection?: boolean;
|
|
66
86
|
speakerCount?: "auto" | number;
|
|
87
|
+
transcriptionStyle?: TranscriptionStyle;
|
|
88
|
+
importantTerms?: string;
|
|
89
|
+
customPrompt?: string;
|
|
90
|
+
speakerIdentificationEnabled?: boolean;
|
|
91
|
+
speakerIdentificationMode?: SpeakerIdentificationMode;
|
|
92
|
+
speakerIdentificationValues?: string[];
|
|
93
|
+
folderId?: number;
|
|
94
|
+
}
|
|
95
|
+
export interface SignedUploadResponse {
|
|
96
|
+
recordingId: number;
|
|
97
|
+
objectPath: string;
|
|
98
|
+
signedResumableInitUrl: string;
|
|
99
|
+
requiredHeaders: Record<string, string>;
|
|
100
|
+
ttlSec: number;
|
|
101
|
+
}
|
|
102
|
+
export interface RecordingStatusResponse {
|
|
103
|
+
recordingId: number;
|
|
104
|
+
recordingStatus: `${WhisperStatus}` | "canceled" | "retry_pending" | "retry_processing";
|
|
67
105
|
}
|
|
68
|
-
export interface
|
|
69
|
-
|
|
106
|
+
export interface TranscriptionResponse {
|
|
107
|
+
id: number;
|
|
70
108
|
recordingId: number;
|
|
109
|
+
status: "queued" | "processing" | "completed" | "failed" | "canceled";
|
|
110
|
+
createdAt: string;
|
|
111
|
+
updatedAt: string;
|
|
112
|
+
}
|
|
113
|
+
export interface Translation {
|
|
114
|
+
id: number;
|
|
115
|
+
transcriptionId: number;
|
|
116
|
+
targetLanguage: string;
|
|
117
|
+
content: string;
|
|
118
|
+
status: string;
|
|
119
|
+
createdAt: string;
|
|
71
120
|
}
|
|
72
|
-
export interface
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
121
|
+
export interface Transcription {
|
|
122
|
+
id: number;
|
|
123
|
+
userId: number;
|
|
124
|
+
recordingId: number;
|
|
125
|
+
content: string;
|
|
126
|
+
editedContent: string | null;
|
|
127
|
+
confidence: number;
|
|
128
|
+
segments: Array<{
|
|
129
|
+
id: number;
|
|
130
|
+
start: number;
|
|
131
|
+
end: number;
|
|
132
|
+
text: string;
|
|
133
|
+
}>;
|
|
134
|
+
translations: Translation[];
|
|
135
|
+
timestamps: {
|
|
136
|
+
words: unknown[];
|
|
137
|
+
duration: number;
|
|
138
|
+
language: string;
|
|
139
|
+
segments: Array<{
|
|
140
|
+
id: number;
|
|
141
|
+
start: number;
|
|
142
|
+
end: number;
|
|
143
|
+
text: string;
|
|
144
|
+
}>;
|
|
145
|
+
};
|
|
146
|
+
speakers: unknown | null;
|
|
147
|
+
speakerNames: Record<string, unknown>;
|
|
148
|
+
createdAt: string;
|
|
149
|
+
updatedAt: string;
|
|
150
|
+
summary: unknown | null;
|
|
77
151
|
}
|
|
78
|
-
export interface
|
|
152
|
+
export interface RecordingResponse {
|
|
79
153
|
id: number;
|
|
80
154
|
userId: number;
|
|
81
155
|
title: string;
|
|
@@ -85,33 +159,40 @@ export interface FinalizeChunkResponse {
|
|
|
85
159
|
audioUrl: string;
|
|
86
160
|
duration: number;
|
|
87
161
|
language: string;
|
|
88
|
-
status: WhisperStatus;
|
|
162
|
+
status: `${WhisperStatus}` | "canceled" | "retry_pending" | "retry_processing";
|
|
89
163
|
speakerDetectionEnabled: boolean;
|
|
90
164
|
speakerCount: number | null;
|
|
91
|
-
totalChunks: number;
|
|
165
|
+
totalChunks: number | null;
|
|
166
|
+
acceptedMaxFileSizeBytes?: number;
|
|
167
|
+
format?: string;
|
|
92
168
|
metadata: Record<string, unknown> | null;
|
|
93
169
|
idempotencyKey: string | null;
|
|
94
170
|
uploadSessionId: string;
|
|
171
|
+
source?: string;
|
|
172
|
+
sourceUrl?: string | null;
|
|
173
|
+
transcriptionStyle?: string;
|
|
174
|
+
importantTerms?: string[];
|
|
175
|
+
customPrompt?: string;
|
|
176
|
+
speakerIdentificationEnabled?: boolean;
|
|
177
|
+
speakerIdentificationMode?: string;
|
|
178
|
+
speakerIdentificationValues?: string[];
|
|
179
|
+
organizationId?: number | null;
|
|
180
|
+
folderId?: number | null;
|
|
181
|
+
accessToken?: string;
|
|
182
|
+
accessTokenExpiry?: string;
|
|
95
183
|
createdAt: string;
|
|
96
184
|
updatedAt: string;
|
|
185
|
+
transcription: Transcription | null;
|
|
97
186
|
}
|
|
98
|
-
export interface
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
status: "queued" | "processing" | "completed" | "failed" | "canceled";
|
|
102
|
-
createdAt: string;
|
|
103
|
-
updatedAt: string;
|
|
187
|
+
export interface CompletedRecordingResponse extends RecordingResponse {
|
|
188
|
+
status: WhisperStatus.COMPLETED;
|
|
189
|
+
transcription: Transcription;
|
|
104
190
|
}
|
|
191
|
+
export type FinalizeUploadResponse = RecordingResponse;
|
|
105
192
|
export interface TranslateResponse {
|
|
106
193
|
success: true;
|
|
107
194
|
message: string;
|
|
108
|
-
translation:
|
|
109
|
-
id: number;
|
|
110
|
-
transcriptionId: number;
|
|
111
|
-
targetLanguage: string;
|
|
112
|
-
content: string;
|
|
113
|
-
status: string;
|
|
114
|
-
};
|
|
195
|
+
translation: Translation;
|
|
115
196
|
}
|
|
116
197
|
export interface SummaryResponse {
|
|
117
198
|
usage: {
|
|
@@ -136,78 +217,27 @@ export interface SummaryResponse {
|
|
|
136
217
|
upgradeReason: string;
|
|
137
218
|
};
|
|
138
219
|
}
|
|
139
|
-
export interface RecordingResponse {
|
|
140
|
-
id: number;
|
|
141
|
-
userId: number;
|
|
142
|
-
title: string;
|
|
143
|
-
originalFilename: string;
|
|
144
|
-
fileExtension: string;
|
|
145
|
-
mimeType: string;
|
|
146
|
-
audioUrl: string;
|
|
147
|
-
duration: number;
|
|
148
|
-
language: string;
|
|
149
|
-
status: string;
|
|
150
|
-
speakerDetectionEnabled: boolean;
|
|
151
|
-
speakerCount: number | null;
|
|
152
|
-
totalChunks: number;
|
|
153
|
-
metadata: Record<string, unknown> | null;
|
|
154
|
-
idempotencyKey: string | null;
|
|
155
|
-
uploadSessionId: string;
|
|
156
|
-
accessToken: string;
|
|
157
|
-
accessTokenExpiry: string;
|
|
158
|
-
createdAt: string;
|
|
159
|
-
updatedAt: string;
|
|
160
|
-
transcription: {
|
|
161
|
-
id: number;
|
|
162
|
-
userId: number;
|
|
163
|
-
recordingId: number;
|
|
164
|
-
content: string;
|
|
165
|
-
editedContent: string | null;
|
|
166
|
-
confidence: number;
|
|
167
|
-
segments: Array<{
|
|
168
|
-
id: number;
|
|
169
|
-
start: number;
|
|
170
|
-
end: number;
|
|
171
|
-
text: string;
|
|
172
|
-
}>;
|
|
173
|
-
translations: Array<{
|
|
174
|
-
id: number;
|
|
175
|
-
transcriptionId: number;
|
|
176
|
-
targetLanguage: string;
|
|
177
|
-
content: string;
|
|
178
|
-
status: string;
|
|
179
|
-
createdAt: string;
|
|
180
|
-
}>;
|
|
181
|
-
timestamps: {
|
|
182
|
-
words: unknown[];
|
|
183
|
-
duration: number;
|
|
184
|
-
language: string;
|
|
185
|
-
segments: Array<{
|
|
186
|
-
id: number;
|
|
187
|
-
start: number;
|
|
188
|
-
end: number;
|
|
189
|
-
text: string;
|
|
190
|
-
}>;
|
|
191
|
-
};
|
|
192
|
-
speakers: unknown | null;
|
|
193
|
-
speakerNames: Record<string, unknown>;
|
|
194
|
-
createdAt: string;
|
|
195
|
-
updatedAt: string;
|
|
196
|
-
summary: unknown | null;
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
220
|
export interface RecordingsQuery {
|
|
200
221
|
page?: number;
|
|
201
222
|
limit?: number;
|
|
223
|
+
cursor?: string;
|
|
224
|
+
direction?: "next" | "prev";
|
|
225
|
+
search?: string;
|
|
226
|
+
status?: string;
|
|
227
|
+
sort?: "newest" | "oldest";
|
|
202
228
|
}
|
|
203
229
|
export interface RecordingsResponse {
|
|
204
230
|
data: RecordingResponse[];
|
|
205
|
-
|
|
206
|
-
|
|
231
|
+
sharedItems?: RecordingResponse[];
|
|
232
|
+
total: number | string;
|
|
233
|
+
page?: number;
|
|
207
234
|
limit: number;
|
|
208
|
-
pages
|
|
235
|
+
pages?: number;
|
|
209
236
|
hasNext: boolean;
|
|
210
237
|
hasPrev: boolean;
|
|
238
|
+
nextCursor?: string | null;
|
|
239
|
+
prevCursor?: string | null;
|
|
240
|
+
startIndex?: number;
|
|
211
241
|
}
|
|
212
242
|
export interface SubscriptionDetailsResponse {
|
|
213
243
|
isPaidPlan: boolean;
|
|
@@ -216,3 +246,17 @@ export interface SubscriptionDetailsResponse {
|
|
|
216
246
|
billingAmount: number | null;
|
|
217
247
|
subscriptionStatus: string;
|
|
218
248
|
}
|
|
249
|
+
export interface DiagnosticEvent {
|
|
250
|
+
diagId: string;
|
|
251
|
+
phase: string;
|
|
252
|
+
recordingId?: number;
|
|
253
|
+
chunkIndex?: number;
|
|
254
|
+
attempt?: number;
|
|
255
|
+
httpStatus?: number;
|
|
256
|
+
errorName?: string;
|
|
257
|
+
errorMessage?: string;
|
|
258
|
+
fileName?: string;
|
|
259
|
+
fileSize?: number;
|
|
260
|
+
fileType?: string;
|
|
261
|
+
timestamp: string;
|
|
262
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "whisperai-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "TypeScript SDK for WhisperAI: methods and interfaces for interacting with the service without external runtime dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"whisper",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
38
38
|
"clean": "rm -rf dist",
|
|
39
39
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
40
|
+
"test": "bun test",
|
|
40
41
|
"release": "semantic-release"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {},
|