wispr-flow-sdk-unofficial 0.1.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.
@@ -0,0 +1,422 @@
1
+ /**
2
+ * Wispr Flow Authentication Module
3
+ *
4
+ * Handles user authentication via Supabase or Wispr API.
5
+ * Supports email/password login and token refresh.
6
+ */
7
+ import { z } from 'zod';
8
+ export { SUPABASE_ANON_KEY } from './constants';
9
+ export declare const SupabaseUserSchema: z.ZodObject<{
10
+ id: z.ZodString;
11
+ aud: z.ZodString;
12
+ role: z.ZodString;
13
+ email: z.ZodString;
14
+ email_confirmed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ phone: z.ZodOptional<z.ZodString>;
16
+ confirmed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
+ last_sign_in_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ app_metadata: z.ZodObject<{
19
+ provider: z.ZodString;
20
+ providers: z.ZodArray<z.ZodString, "many">;
21
+ }, "strip", z.ZodTypeAny, {
22
+ provider: string;
23
+ providers: string[];
24
+ }, {
25
+ provider: string;
26
+ providers: string[];
27
+ }>;
28
+ user_metadata: z.ZodObject<{
29
+ email: z.ZodString;
30
+ email_verified: z.ZodBoolean;
31
+ full_name: z.ZodOptional<z.ZodString>;
32
+ phone_verified: z.ZodOptional<z.ZodBoolean>;
33
+ sub: z.ZodString;
34
+ }, "strip", z.ZodTypeAny, {
35
+ email: string;
36
+ email_verified: boolean;
37
+ sub: string;
38
+ full_name?: string | undefined;
39
+ phone_verified?: boolean | undefined;
40
+ }, {
41
+ email: string;
42
+ email_verified: boolean;
43
+ sub: string;
44
+ full_name?: string | undefined;
45
+ phone_verified?: boolean | undefined;
46
+ }>;
47
+ identities: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
48
+ created_at: z.ZodOptional<z.ZodString>;
49
+ updated_at: z.ZodOptional<z.ZodString>;
50
+ }, "strip", z.ZodTypeAny, {
51
+ email: string;
52
+ role: string;
53
+ id: string;
54
+ aud: string;
55
+ app_metadata: {
56
+ provider: string;
57
+ providers: string[];
58
+ };
59
+ user_metadata: {
60
+ email: string;
61
+ email_verified: boolean;
62
+ sub: string;
63
+ full_name?: string | undefined;
64
+ phone_verified?: boolean | undefined;
65
+ };
66
+ email_confirmed_at?: string | null | undefined;
67
+ phone?: string | undefined;
68
+ confirmed_at?: string | null | undefined;
69
+ last_sign_in_at?: string | null | undefined;
70
+ identities?: unknown[] | undefined;
71
+ created_at?: string | undefined;
72
+ updated_at?: string | undefined;
73
+ }, {
74
+ email: string;
75
+ role: string;
76
+ id: string;
77
+ aud: string;
78
+ app_metadata: {
79
+ provider: string;
80
+ providers: string[];
81
+ };
82
+ user_metadata: {
83
+ email: string;
84
+ email_verified: boolean;
85
+ sub: string;
86
+ full_name?: string | undefined;
87
+ phone_verified?: boolean | undefined;
88
+ };
89
+ email_confirmed_at?: string | null | undefined;
90
+ phone?: string | undefined;
91
+ confirmed_at?: string | null | undefined;
92
+ last_sign_in_at?: string | null | undefined;
93
+ identities?: unknown[] | undefined;
94
+ created_at?: string | undefined;
95
+ updated_at?: string | undefined;
96
+ }>;
97
+ export type SupabaseUser = z.infer<typeof SupabaseUserSchema>;
98
+ export declare const SupabaseSessionSchema: z.ZodObject<{
99
+ access_token: z.ZodString;
100
+ token_type: z.ZodString;
101
+ expires_in: z.ZodNumber;
102
+ expires_at: z.ZodNumber;
103
+ refresh_token: z.ZodString;
104
+ user: z.ZodObject<{
105
+ id: z.ZodString;
106
+ aud: z.ZodString;
107
+ role: z.ZodString;
108
+ email: z.ZodString;
109
+ email_confirmed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
110
+ phone: z.ZodOptional<z.ZodString>;
111
+ confirmed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
112
+ last_sign_in_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
113
+ app_metadata: z.ZodObject<{
114
+ provider: z.ZodString;
115
+ providers: z.ZodArray<z.ZodString, "many">;
116
+ }, "strip", z.ZodTypeAny, {
117
+ provider: string;
118
+ providers: string[];
119
+ }, {
120
+ provider: string;
121
+ providers: string[];
122
+ }>;
123
+ user_metadata: z.ZodObject<{
124
+ email: z.ZodString;
125
+ email_verified: z.ZodBoolean;
126
+ full_name: z.ZodOptional<z.ZodString>;
127
+ phone_verified: z.ZodOptional<z.ZodBoolean>;
128
+ sub: z.ZodString;
129
+ }, "strip", z.ZodTypeAny, {
130
+ email: string;
131
+ email_verified: boolean;
132
+ sub: string;
133
+ full_name?: string | undefined;
134
+ phone_verified?: boolean | undefined;
135
+ }, {
136
+ email: string;
137
+ email_verified: boolean;
138
+ sub: string;
139
+ full_name?: string | undefined;
140
+ phone_verified?: boolean | undefined;
141
+ }>;
142
+ identities: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
143
+ created_at: z.ZodOptional<z.ZodString>;
144
+ updated_at: z.ZodOptional<z.ZodString>;
145
+ }, "strip", z.ZodTypeAny, {
146
+ email: string;
147
+ role: string;
148
+ id: string;
149
+ aud: string;
150
+ app_metadata: {
151
+ provider: string;
152
+ providers: string[];
153
+ };
154
+ user_metadata: {
155
+ email: string;
156
+ email_verified: boolean;
157
+ sub: string;
158
+ full_name?: string | undefined;
159
+ phone_verified?: boolean | undefined;
160
+ };
161
+ email_confirmed_at?: string | null | undefined;
162
+ phone?: string | undefined;
163
+ confirmed_at?: string | null | undefined;
164
+ last_sign_in_at?: string | null | undefined;
165
+ identities?: unknown[] | undefined;
166
+ created_at?: string | undefined;
167
+ updated_at?: string | undefined;
168
+ }, {
169
+ email: string;
170
+ role: string;
171
+ id: string;
172
+ aud: string;
173
+ app_metadata: {
174
+ provider: string;
175
+ providers: string[];
176
+ };
177
+ user_metadata: {
178
+ email: string;
179
+ email_verified: boolean;
180
+ sub: string;
181
+ full_name?: string | undefined;
182
+ phone_verified?: boolean | undefined;
183
+ };
184
+ email_confirmed_at?: string | null | undefined;
185
+ phone?: string | undefined;
186
+ confirmed_at?: string | null | undefined;
187
+ last_sign_in_at?: string | null | undefined;
188
+ identities?: unknown[] | undefined;
189
+ created_at?: string | undefined;
190
+ updated_at?: string | undefined;
191
+ }>;
192
+ }, "strip", z.ZodTypeAny, {
193
+ user: {
194
+ email: string;
195
+ role: string;
196
+ id: string;
197
+ aud: string;
198
+ app_metadata: {
199
+ provider: string;
200
+ providers: string[];
201
+ };
202
+ user_metadata: {
203
+ email: string;
204
+ email_verified: boolean;
205
+ sub: string;
206
+ full_name?: string | undefined;
207
+ phone_verified?: boolean | undefined;
208
+ };
209
+ email_confirmed_at?: string | null | undefined;
210
+ phone?: string | undefined;
211
+ confirmed_at?: string | null | undefined;
212
+ last_sign_in_at?: string | null | undefined;
213
+ identities?: unknown[] | undefined;
214
+ created_at?: string | undefined;
215
+ updated_at?: string | undefined;
216
+ };
217
+ access_token: string;
218
+ token_type: string;
219
+ expires_in: number;
220
+ expires_at: number;
221
+ refresh_token: string;
222
+ }, {
223
+ user: {
224
+ email: string;
225
+ role: string;
226
+ id: string;
227
+ aud: string;
228
+ app_metadata: {
229
+ provider: string;
230
+ providers: string[];
231
+ };
232
+ user_metadata: {
233
+ email: string;
234
+ email_verified: boolean;
235
+ sub: string;
236
+ full_name?: string | undefined;
237
+ phone_verified?: boolean | undefined;
238
+ };
239
+ email_confirmed_at?: string | null | undefined;
240
+ phone?: string | undefined;
241
+ confirmed_at?: string | null | undefined;
242
+ last_sign_in_at?: string | null | undefined;
243
+ identities?: unknown[] | undefined;
244
+ created_at?: string | undefined;
245
+ updated_at?: string | undefined;
246
+ };
247
+ access_token: string;
248
+ token_type: string;
249
+ expires_in: number;
250
+ expires_at: number;
251
+ refresh_token: string;
252
+ }>;
253
+ export type SupabaseSession = z.infer<typeof SupabaseSessionSchema>;
254
+ export declare const WisprSignInResponseSchema: z.ZodObject<{
255
+ message: z.ZodString;
256
+ access_token: z.ZodString;
257
+ refresh_token: z.ZodString;
258
+ first_name: z.ZodNullable<z.ZodString>;
259
+ last_name: z.ZodNullable<z.ZodString>;
260
+ onboarding_completed: z.ZodBoolean;
261
+ error: z.ZodNullable<z.ZodString>;
262
+ }, "strip", z.ZodTypeAny, {
263
+ message: string;
264
+ error: string | null;
265
+ access_token: string;
266
+ refresh_token: string;
267
+ first_name: string | null;
268
+ last_name: string | null;
269
+ onboarding_completed: boolean;
270
+ }, {
271
+ message: string;
272
+ error: string | null;
273
+ access_token: string;
274
+ refresh_token: string;
275
+ first_name: string | null;
276
+ last_name: string | null;
277
+ onboarding_completed: boolean;
278
+ }>;
279
+ export type WisprSignInResponse = z.infer<typeof WisprSignInResponseSchema>;
280
+ export declare const UserStatusSchema: z.ZodObject<{
281
+ exists: z.ZodBoolean;
282
+ provider: z.ZodOptional<z.ZodString>;
283
+ verified: z.ZodOptional<z.ZodBoolean>;
284
+ }, "strip", z.ZodTypeAny, {
285
+ exists: boolean;
286
+ provider?: string | undefined;
287
+ verified?: boolean | undefined;
288
+ }, {
289
+ exists: boolean;
290
+ provider?: string | undefined;
291
+ verified?: boolean | undefined;
292
+ }>;
293
+ export type UserStatus = z.infer<typeof UserStatusSchema>;
294
+ export interface AuthCredentials {
295
+ email: string;
296
+ password: string;
297
+ }
298
+ export interface AuthSession {
299
+ accessToken: string;
300
+ refreshToken: string;
301
+ userUuid: string;
302
+ email: string;
303
+ expiresAt: number;
304
+ firstName?: string;
305
+ lastName?: string;
306
+ }
307
+ /**
308
+ * Wispr Flow Authentication Client
309
+ *
310
+ * Provides methods to authenticate users and manage sessions.
311
+ *
312
+ * @example
313
+ * ```typescript
314
+ * const auth = new WisprAuth();
315
+ *
316
+ * // Sign in with email/password
317
+ * const session = await auth.signIn({
318
+ * email: 'user@example.com',
319
+ * password: 'password123',
320
+ * });
321
+ *
322
+ * console.log('Access token:', session.accessToken);
323
+ * console.log('User ID:', session.userUuid);
324
+ *
325
+ * // Use session with WisprClient
326
+ * const client = new WisprClient({
327
+ * accessToken: session.accessToken,
328
+ * userUuid: session.userUuid,
329
+ * });
330
+ * ```
331
+ */
332
+ export declare class WisprAuth {
333
+ private readonly supabaseUrl;
334
+ private readonly supabaseAnonKey;
335
+ private readonly wisprApiUrl;
336
+ private currentSession;
337
+ constructor(options?: {
338
+ supabaseUrl?: string;
339
+ supabaseAnonKey?: string;
340
+ wisprApiUrl?: string;
341
+ });
342
+ /**
343
+ * Get common headers for Supabase requests
344
+ */
345
+ private getSupabaseHeaders;
346
+ /**
347
+ * Check if a user exists by email
348
+ *
349
+ * @param email - User email address
350
+ * @returns User status
351
+ */
352
+ checkUserStatus(email: string): Promise<UserStatus>;
353
+ /**
354
+ * Sign in with email and password using Supabase directly
355
+ *
356
+ * This is the recommended method as it returns the full session
357
+ * including refresh token and user details.
358
+ *
359
+ * @param credentials - Email and password
360
+ * @returns Authentication session
361
+ */
362
+ signInWithSupabase(credentials: AuthCredentials): Promise<AuthSession>;
363
+ /**
364
+ * Sign in with email and password using Wispr API
365
+ *
366
+ * Alternative method that goes through Wispr's backend.
367
+ *
368
+ * @param credentials - Email and password
369
+ * @returns Authentication session
370
+ */
371
+ signInWithWisprApi(credentials: AuthCredentials): Promise<AuthSession>;
372
+ /**
373
+ * Sign in with email and password (uses Supabase by default)
374
+ *
375
+ * @param credentials - Email and password
376
+ * @returns Authentication session
377
+ */
378
+ signIn(credentials: AuthCredentials): Promise<AuthSession>;
379
+ /**
380
+ * Refresh the access token using the refresh token
381
+ *
382
+ * @param refreshToken - Optional refresh token (uses current session if not provided)
383
+ * @returns New authentication session
384
+ */
385
+ refreshSession(refreshToken?: string): Promise<AuthSession>;
386
+ /**
387
+ * Sign out and clear the current session
388
+ */
389
+ signOut(): Promise<void>;
390
+ /**
391
+ * Get the current session
392
+ *
393
+ * @returns Current session or null if not signed in
394
+ */
395
+ getSession(): AuthSession | null;
396
+ /**
397
+ * Check if the current session is expired
398
+ *
399
+ * @param bufferSeconds - Buffer time in seconds before actual expiry (default: 60)
400
+ * @returns True if session is expired or will expire within buffer time
401
+ */
402
+ isSessionExpired(bufferSeconds?: number): boolean;
403
+ /**
404
+ * Get a valid access token, refreshing if necessary
405
+ *
406
+ * @returns Valid access token
407
+ */
408
+ getValidAccessToken(): Promise<string>;
409
+ /**
410
+ * Decode JWT payload (without verification)
411
+ */
412
+ private decodeJwtPayload;
413
+ }
414
+ /**
415
+ * Create a new auth client instance
416
+ */
417
+ export declare function createAuth(options?: {
418
+ supabaseUrl?: string;
419
+ supabaseAnonKey?: string;
420
+ wisprApiUrl?: string;
421
+ }): WisprAuth;
422
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/core/auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAShD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuB7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;EAQpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC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IhE;;;;;OAKG;IACG,cAAc,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IA0CjE;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB9B;;;;OAIG;IACH,UAAU,IAAI,WAAW,GAAG,IAAI;IAIhC;;;;;OAKG;IACH,gBAAgB,CAAC,aAAa,SAAK,GAAG,OAAO;IAS7C;;;;OAIG;IACG,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC;IAY5C;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAyBzB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,SAAS,CAEZ"}
@@ -0,0 +1,99 @@
1
+ import { type TranscriptionRequest, type TranscriptionResponse, type WarmupResponse, type WisprConfig } from '../types';
2
+ import type { WisprAuth } from './auth';
3
+ /**
4
+ * Configuration options for WisprClient
5
+ */
6
+ export interface WisprClientOptions extends Partial<WisprConfig> {
7
+ /** Supabase JWT access token (required if auth not provided) */
8
+ accessToken?: string;
9
+ /** User UUID from Supabase (required if auth not provided) */
10
+ userUuid?: string;
11
+ /** WisprAuth instance for automatic token refresh */
12
+ auth?: WisprAuth;
13
+ /** Buffer time in seconds before token expiry to trigger refresh (default: 60) */
14
+ tokenRefreshBuffer?: number;
15
+ }
16
+ /**
17
+ * Wispr Flow SDK Client
18
+ *
19
+ * Provides methods to interact with the unofficial Wispr Flow API
20
+ * for voice-to-text transcription.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * // Option 1: Manual token management
25
+ * const client = new WisprClient({
26
+ * accessToken: 'your-supabase-jwt-token',
27
+ * userUuid: 'your-user-uuid',
28
+ * });
29
+ *
30
+ * // Option 2: Automatic token refresh with WisprAuth
31
+ * const auth = new WisprAuth();
32
+ * await auth.signIn({ email: 'user@example.com', password: 'password' });
33
+ * const client = new WisprClient({ auth });
34
+ *
35
+ * // Warmup the service
36
+ * await client.warmup();
37
+ *
38
+ * // Transcribe audio
39
+ * const result = await client.transcribe({
40
+ * audioData: base64AudioData,
41
+ * });
42
+ *
43
+ * console.log(result.pipeline_text);
44
+ * ```
45
+ */
46
+ export declare class WisprClient {
47
+ private config;
48
+ private readonly logger;
49
+ private readonly apiBaseUrl;
50
+ private readonly basetenUrl;
51
+ private readonly basetenApiKey;
52
+ private readonly auth?;
53
+ private readonly tokenRefreshBuffer;
54
+ constructor(options: WisprClientOptions);
55
+ /**
56
+ * Ensure access token is valid, refresh if needed
57
+ */
58
+ private ensureValidToken;
59
+ /**
60
+ * Get common headers for Wispr API requests
61
+ */
62
+ private getWisprHeaders;
63
+ /**
64
+ * Get headers for Baseten API requests
65
+ */
66
+ private getBasetenHeaders;
67
+ /**
68
+ * Make an HTTP request with error handling
69
+ */
70
+ private request;
71
+ /**
72
+ * Warmup the transcription service
73
+ *
74
+ * Call this before making transcription requests to reduce latency.
75
+ *
76
+ * @returns Warmup status response
77
+ */
78
+ warmup(): Promise<WarmupResponse>;
79
+ /**
80
+ * Transcribe audio to text
81
+ *
82
+ * @param request - Transcription request options
83
+ * @returns Transcription response with text results
84
+ */
85
+ transcribe(request?: TranscriptionRequest): Promise<TranscriptionResponse>;
86
+ /**
87
+ * Build context object for transcription
88
+ */
89
+ private buildContext;
90
+ /**
91
+ * Get the current configuration (without sensitive data)
92
+ */
93
+ getConfig(): Omit<WisprConfig, 'accessToken' | 'basetenApiKey'>;
94
+ /**
95
+ * Update the access token (e.g., after token refresh)
96
+ */
97
+ updateAccessToken(newToken: string): void;
98
+ }
99
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,qB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,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAI1C"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Default API endpoints and configuration
3
+ *
4
+ * All sensitive values are loaded from environment variables.
5
+ * Set these in your .env file or environment.
6
+ */
7
+ /** Wispr Flow API base URL */
8
+ export declare const WISPR_API_BASE_URL: string;
9
+ /** Baseten transcription API URL */
10
+ export declare const BASETEN_API_URL: string;
11
+ /** Default Baseten API key */
12
+ export declare const DEFAULT_BASETEN_API_KEY: string;
13
+ /** Supabase instance URL for authentication */
14
+ export declare const SUPABASE_URL: string;
15
+ /** Supabase anonymous key */
16
+ export declare const SUPABASE_ANON_KEY: string;
17
+ /** Default client version to report */
18
+ export declare const DEFAULT_CLIENT_VERSION: string;
19
+ /** Default request timeout in milliseconds */
20
+ export declare const DEFAULT_TIMEOUT_MS = 30000;
21
+ /** API endpoints */
22
+ export declare const ENDPOINTS: {
23
+ /** Warmup endpoint to prepare the service */
24
+ readonly WARMUP: "/warmup";
25
+ /** Baseten transcription endpoint */
26
+ readonly BASETEN_TRANSCRIBE: "/environments/production/run_remote";
27
+ };
28
+ /** Supported audio formats */
29
+ export declare const AUDIO_CONFIG: {
30
+ /** Sample rate in Hz */
31
+ readonly SAMPLE_RATE: 16000;
32
+ /** Number of audio channels */
33
+ readonly CHANNELS: 1;
34
+ /** Bits per sample */
35
+ readonly BITS_PER_SAMPLE: 16;
36
+ /** Audio format */
37
+ readonly FORMAT: "pcm_wav";
38
+ /** Maximum audio duration in seconds */
39
+ readonly MAX_DURATION_SECONDS: 360;
40
+ /** Maximum audio size in bytes */
41
+ readonly MAX_SIZE_BYTES: number;
42
+ };
43
+ /** Supported languages (ISO 639-1 codes) */
44
+ export declare const SUPPORTED_LANGUAGES: readonly ["en", "es", "fr", "de", "it", "pt", "nl", "pl", "ru", "ja", "ko", "zh", "ar", "hi", "tr", "vi", "th", "id", "ms", "sv", "da", "no", "fi", "cs", "sk", "hu", "ro", "bg", "uk", "he", "el"];
45
+ export type SupportedLanguage = (typeof SUPPORTED_LANGUAGES)[number];
46
+ /**
47
+ * Validate that required environment variables are set
48
+ */
49
+ export declare function validateEnvConfig(): {
50
+ valid: boolean;
51
+ missing: string[];
52
+ };
53
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,8BAA8B;AAC9B,eAAO,MAAM,kBAAkB,QAAsD,CAAC;AAEtF,oCAAoC;AACpC,eAAO,MAAM,eAAe,QAAwB,CAAC;AAErD,8BAA8B;AAC9B,eAAO,MAAM,uBAAuB,QAA4B,CAAC;AAEjE,+CAA+C;AAC/C,eAAO,MAAM,YAAY,QAAyB,CAAC;AAEnD,6BAA6B;AAC7B,eAAO,MAAM,iBAAiB,QAA8B,CAAC;AAE7D,uCAAuC;AACvC,eAAO,MAAM,sBAAsB,QAA4C,CAAC;AAEhF,8CAA8C;AAC9C,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAExC,oBAAoB;AACpB,eAAO,MAAM,SAAS;IACpB,6CAA6C;;IAE7C,qCAAqC;;CAE7B,CAAC;AAEX,8BAA8B;AAC9B,eAAO,MAAM,YAAY;IACvB,wBAAwB;;IAExB,+BAA+B;;IAE/B,sBAAsB;;IAEtB,mBAAmB;;IAEnB,wCAAwC;;IAExC,kCAAkC;;CAE1B,CAAC;AAEX,4CAA4C;AAC5C,eAAO,MAAM,mBAAmB,qMAgCtB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE;;GAEG;AACH,wBAAgB,iBAAiB,IAAI;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CASzE"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Wispr Flow SDK - Unofficial TypeScript SDK for Wispr Flow voice-to-text API
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * import { WisprAuth, WisprClient } from 'wispr-flow-sdk';
7
+ *
8
+ * // Authenticate
9
+ * const auth = new WisprAuth();
10
+ * const session = await auth.signIn({
11
+ * email: 'user@example.com',
12
+ * password: 'password123',
13
+ * });
14
+ *
15
+ * // Create client with session
16
+ * const client = new WisprClient({
17
+ * accessToken: session.accessToken,
18
+ * userUuid: session.userUuid,
19
+ * });
20
+ *
21
+ * // Warmup the service (reduces latency)
22
+ * await client.warmup();
23
+ *
24
+ * // Transcribe audio (base64 encoded WAV)
25
+ * const result = await client.transcribe({
26
+ * audioData: base64AudioData,
27
+ * });
28
+ *
29
+ * console.log(result.pipeline_text);
30
+ * ```
31
+ *
32
+ * @packageDocumentation
33
+ */
34
+ export { WisprClient } from './core/client';
35
+ export { WisprAuth, createAuth, SUPABASE_ANON_KEY, type AuthCredentials, type AuthSession, type SupabaseSession, type SupabaseUser, type WisprSignInResponse, type UserStatus, } from './core/auth';
36
+ export { AUDIO_CONFIG, BASETEN_API_URL, DEFAULT_BASETEN_API_KEY, DEFAULT_CLIENT_VERSION, DEFAULT_TIMEOUT_MS, ENDPOINTS, SUPPORTED_LANGUAGES, SUPABASE_URL, WISPR_API_BASE_URL, type SupportedLanguage, } from './core/constants';
37
+ export { WisprConfigSchema, type WisprConfig, AppContextSchema, type AppContext, TextboxContentsSchema, type TextboxContents, ConversationMessageSchema, type ConversationMessage, ConversationSchema, type Conversation, TranscriptionContextSchema, type TranscriptionContext, TranscriptionMetadataSchema, type TranscriptionMetadata, TranscriptionRequestSchema, type TranscriptionRequest, WarmupResponseSchema, type WarmupResponse, ComponentTimesSchema, type ComponentTimes, TranscriptionResponseSchema, type TranscriptionResponse, WisprError, WisprAuthError, WisprApiError, WisprValidationError, WisprTimeoutError, } from './types';
38
+ export { createLogger, createTimeoutSignal, fromBase64, fromBase64ToBytes, generateUuid, retry, sleep, toBase64, type Logger, } from './utils';
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EACL,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,SAAS,EACT,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAEL,iBAAiB,EACjB,KAAK,WAAW,EAEhB,gBAAgB,EAChB,KAAK,UAAU,EACf,qBAAqB,EACrB,KAAK,eAAe,EACpB,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,kBAAkB,EAClB,KAAK,YAAY,EACjB,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,0BAA0B,EAC1B,KAAK,oBAAoB,EAEzB,oBAAoB,EACpB,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,cAAc,EACnB,2BAA2B,EAC3B,KAAK,qBAAqB,EAE1B,UAAU,EACV,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,KAAK,EACL,KAAK,EACL,QAAQ,EACR,KAAK,MAAM,GACZ,MAAM,SAAS,CAAC"}