@vocalstack/js-sdk 1.1.0 → 2.0.0-alpha.1

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 (73) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +112 -65
  3. package/SKILL.md +249 -0
  4. package/dist/errors.d.ts +22 -0
  5. package/dist/errors.js +56 -0
  6. package/dist/file.d.ts +2 -0
  7. package/dist/file.js +38 -0
  8. package/dist/http.d.ts +43 -0
  9. package/dist/http.js +124 -0
  10. package/dist/index.d.ts +42 -2
  11. package/dist/index.js +51 -17
  12. package/dist/mic.d.ts +27 -0
  13. package/dist/mic.js +236 -0
  14. package/dist/realtime.d.ts +77 -0
  15. package/dist/realtime.js +490 -0
  16. package/dist/resources.d.ts +374 -0
  17. package/dist/resources.js +712 -0
  18. package/dist/subscription.d.ts +38 -0
  19. package/dist/subscription.js +153 -0
  20. package/dist/ws.d.ts +9 -0
  21. package/dist/ws.js +12 -0
  22. package/package.json +32 -36
  23. package/skills/vocalstack/SKILL.md +249 -0
  24. package/dist/ApiVersion.d.ts +0 -2
  25. package/dist/ApiVersion.js +0 -32
  26. package/dist/RestApi.d.ts +0 -21
  27. package/dist/RestApi.js +0 -95
  28. package/dist/VocalStackApi.d.ts +0 -19
  29. package/dist/VocalStackApi.js +0 -60
  30. package/dist/WebsocketApi.d.ts +0 -38
  31. package/dist/WebsocketApi.js +0 -150
  32. package/dist/apis/Billing.d.ts +0 -59
  33. package/dist/apis/Billing.js +0 -21
  34. package/dist/apis/LiveTranscription.d.ts +0 -58
  35. package/dist/apis/LiveTranscription.js +0 -55
  36. package/dist/apis/Polyglot.d.ts +0 -113
  37. package/dist/apis/Polyglot.js +0 -68
  38. package/dist/apis/Security.d.ts +0 -25
  39. package/dist/apis/Security.js +0 -35
  40. package/dist/apis/Transcriptions.d.ts +0 -60
  41. package/dist/apis/Transcriptions.js +0 -38
  42. package/dist/apis/UrlTranscription.d.ts +0 -59
  43. package/dist/apis/UrlTranscription.js +0 -53
  44. package/dist/apis/index.d.ts +0 -6
  45. package/dist/apis/index.js +0 -22
  46. package/dist/esm/ApiVersion.d.ts +0 -2
  47. package/dist/esm/ApiVersion.js +0 -28
  48. package/dist/esm/RestApi.d.ts +0 -21
  49. package/dist/esm/RestApi.js +0 -91
  50. package/dist/esm/VocalStackApi.d.ts +0 -19
  51. package/dist/esm/VocalStackApi.js +0 -56
  52. package/dist/esm/WebsocketApi.d.ts +0 -38
  53. package/dist/esm/WebsocketApi.js +0 -146
  54. package/dist/esm/apis/Billing.d.ts +0 -59
  55. package/dist/esm/apis/Billing.js +0 -17
  56. package/dist/esm/apis/LiveTranscription.d.ts +0 -58
  57. package/dist/esm/apis/LiveTranscription.js +0 -51
  58. package/dist/esm/apis/Polyglot.d.ts +0 -113
  59. package/dist/esm/apis/Polyglot.js +0 -64
  60. package/dist/esm/apis/Security.d.ts +0 -25
  61. package/dist/esm/apis/Security.js +0 -31
  62. package/dist/esm/apis/Transcriptions.d.ts +0 -60
  63. package/dist/esm/apis/Transcriptions.js +0 -34
  64. package/dist/esm/apis/UrlTranscription.d.ts +0 -59
  65. package/dist/esm/apis/UrlTranscription.js +0 -49
  66. package/dist/esm/apis/index.d.ts +0 -6
  67. package/dist/esm/apis/index.js +0 -6
  68. package/dist/esm/generics.zod.d.ts +0 -83
  69. package/dist/esm/generics.zod.js +0 -47
  70. package/dist/esm/index.d.ts +0 -2
  71. package/dist/esm/index.js +0 -2
  72. package/dist/generics.zod.d.ts +0 -83
  73. package/dist/generics.zod.js +0 -50
@@ -0,0 +1,374 @@
1
+ import type { AppStreamKey, AudioSourceCheck, Batch, BatchPage, AutoTopUpSettings, AutoTopUpView, BillingDetails, BillingView, CheckPromoCode, CheckoutView, CreateCheckout, LowBalanceAlertSettings, LowBalanceAlertView, PaymentDocument, PaymentMethodList, PaymentPage, PortalLink, PromoCodeView, SetInterval, SubscriptionView, YearlyOptIn, UsageChargePage, UsageReport, Broadcast, Correction, CorrectionBatch, CorrectionPage, CreateAppStreamKey, CreateAudioSource, CreateBatch, CreateLiveTranscription, CreateBroadcast, CreateShareLink, CreateTag, CreateTranscription, CreateVoiceFromSpeaker, CreatedAppStreamKey, ChargePage, ExportFormat, ClientApp, ClientPolicy, Health, LanguageLists, LedgerPage, LinkProbe, PatchVoice, PlanList, PublishGrant, Recording, RecordingEvent, RecordingEvents, RecordingPage, RetranscribeLine, RtmpStatus, SearchResults, SettingsPatch, ShareLink, SharedTranscript, StartRecording, StartJob, SummaryStatus, Tag, TagTranscriptions, Transcription, TranscriptionJob, TranscriptionPage, TranscriptSnapshot, UpdateBroadcast, UpdateTag, UpdateTranscription, UpdateShareLink, UploadRecording, Voice, VoiceCatalogue, VoiceTrack, ManyResult } from '@vocalstack/contract';
2
+ import { Transport, type CallOptions, type ReadAs } from './http.js';
3
+ import { RealtimeSession, type ConnectOptions } from './realtime.js';
4
+ import { Subscription, type SubscribeOptions } from './subscription.js';
5
+ import { type WsLike } from './ws.js';
6
+ export type Upload = Blob | Uint8Array | ArrayBuffer | string;
7
+ export type LifecycleFilter = 'active' | 'archived' | 'all';
8
+ export interface RecordingPageOptions extends PageOptions {
9
+ lifecycle?: 'active' | 'archived';
10
+ }
11
+ declare abstract class ParentResource<T, U> {
12
+ protected readonly t: Transport;
13
+ protected abstract readonly base: '/v1/broadcasts' | '/v1/transcriptions';
14
+ protected abstract readonly key: 'broadcasts' | 'transcriptions';
15
+ constructor(t: Transport);
16
+ protected p(id: string, rest?: string): string;
17
+ list(lifecycle?: LifecycleFilter): Promise<T[]>;
18
+ get(id: string): Promise<T>;
19
+ update(id: string, req: U): Promise<T>;
20
+ archive(id: string): Promise<T>;
21
+ restore(id: string): Promise<T>;
22
+ purge(id: string): Promise<void>;
23
+ archiveMany(ids: string[]): Promise<ManyResult>;
24
+ restoreMany(ids: string[]): Promise<ManyResult>;
25
+ purgeMany(ids: string[]): Promise<ManyResult>;
26
+ listRecordings(id: string, lifecycle?: 'active' | 'archived'): Promise<Recording[]>;
27
+ listRecordingsPage(id: string, opts?: RecordingPageOptions): Promise<RecordingPage>;
28
+ startRecording(id: string, req?: StartRecording, call?: CallOptions): Promise<PublishGrant>;
29
+ listShareLinks(id: string): Promise<ShareLink[]>;
30
+ createShareLink(id: string, req: CreateShareLink): Promise<ShareLink>;
31
+ events(id: string, as?: ReadAs & {
32
+ asOwner?: boolean;
33
+ }): Promise<WsLike>;
34
+ }
35
+ export declare class Broadcasts extends ParentResource<Broadcast, UpdateBroadcast> {
36
+ protected readonly base: "/v1/broadcasts";
37
+ protected readonly key: "broadcasts";
38
+ create(req: CreateBroadcast, call?: CallOptions): Promise<Broadcast>;
39
+ addAudioSource(id: string, req: CreateAudioSource): Promise<Broadcast>;
40
+ removeAudioSource(id: string, sourceId: string): Promise<Broadcast>;
41
+ checkAudioSource(id: string, sourceId: string, opts?: {
42
+ fresh?: boolean;
43
+ }): Promise<AudioSourceCheck>;
44
+ }
45
+ export type CreateTranscriptionInput = CreateTranscription & {
46
+ file?: Upload;
47
+ fileName?: string;
48
+ };
49
+ export declare class Transcriptions extends ParentResource<Transcription, UpdateTranscription> {
50
+ protected readonly base: "/v1/transcriptions";
51
+ protected readonly key: "transcriptions";
52
+ listPage(opts?: PageOptions & {
53
+ lifecycle?: LifecycleFilter;
54
+ }): Promise<TranscriptionPage>;
55
+ uploadRecording(id: string, req?: UploadRecording, call?: CallOptions): Promise<PublishGrant>;
56
+ create(req: CreateTranscriptionInput, call?: CallOptions): Promise<Transcription>;
57
+ createFromUrl(url: string, opts?: Omit<CreateTranscription, 'url'>, call?: CallOptions): Promise<Transcription>;
58
+ createLive(req: CreateLiveTranscription, call?: CallOptions): Promise<Transcription>;
59
+ probe(url: string): Promise<LinkProbe>;
60
+ attachBroadcast(id: string, broadcastId: string): Promise<Transcription>;
61
+ detachBroadcast(id: string, broadcastId: string): Promise<Transcription>;
62
+ }
63
+ export type AddBatchFileInput = Pick<CreateTranscription, 'url' | 'name' | 'startS' | 'endS' | 'durationS'> & {
64
+ file?: Upload;
65
+ fileName?: string;
66
+ };
67
+ export declare class Batches {
68
+ #private;
69
+ constructor(t: Transport);
70
+ create(req?: CreateBatch, call?: CallOptions): Promise<Batch>;
71
+ list(): Promise<Batch[]>;
72
+ listPage(opts?: PageOptions): Promise<BatchPage>;
73
+ get(id: string): Promise<Batch>;
74
+ delete(id: string): Promise<void>;
75
+ addFile(id: string, req: AddBatchFileInput, call?: CallOptions): Promise<Transcription>;
76
+ addUrl(id: string, url: string, opts?: Omit<AddBatchFileInput, 'url' | 'file' | 'fileName'>, call?: CallOptions): Promise<Transcription>;
77
+ start(id: string, call?: CallOptions): Promise<Batch>;
78
+ export(id: string, format: ExportFormat): Promise<Response>;
79
+ stop(id: string): Promise<Batch>;
80
+ wait(id: string, opts?: {
81
+ intervalMs?: number;
82
+ timeoutMs?: number;
83
+ signal?: AbortSignal;
84
+ onProgress?(batch: Batch): void;
85
+ }): Promise<Batch>;
86
+ }
87
+ export declare class Recordings {
88
+ #private;
89
+ constructor(t: Transport);
90
+ get(id: string, as?: ReadAs): Promise<Recording>;
91
+ pause(id: string): Promise<Recording>;
92
+ resume(id: string): Promise<Recording>;
93
+ stop(id: string, reason?: string): Promise<Recording>;
94
+ settings(id: string, patch: SettingsPatch): Promise<Recording>;
95
+ publishToken(id: string, opts?: {
96
+ takeover?: boolean;
97
+ }): Promise<PublishGrant>;
98
+ publish(grant: PublishGrant, opts?: ConnectOptions): Promise<RealtimeSession>;
99
+ archive(id: string): Promise<Recording>;
100
+ restore(id: string): Promise<Recording>;
101
+ purge(id: string): Promise<void>;
102
+ archiveMany(ids: string[]): Promise<ManyResult>;
103
+ restoreMany(ids: string[]): Promise<ManyResult>;
104
+ purgeMany(ids: string[]): Promise<ManyResult>;
105
+ transcript(id: string, opts?: {
106
+ after?: number;
107
+ lang?: string;
108
+ asListener?: boolean;
109
+ } & ReadAs): Promise<TranscriptSnapshot>;
110
+ translation(id: string, lang: string, sentences?: number[], as?: ReadAs): Promise<{
111
+ lang: string;
112
+ translations: Record<string, string>;
113
+ }>;
114
+ summarize(id: string, call?: CallOptions): Promise<SummaryStatus>;
115
+ summary(id: string, opts?: {
116
+ lang?: string;
117
+ } & ReadAs): Promise<SummaryStatus>;
118
+ export(id: string, format: ExportFormat, opts?: {
119
+ lang?: string;
120
+ } & ReadAs): Promise<Response>;
121
+ exportUrl(id: string, format: ExportFormat, opts?: {
122
+ lang?: string;
123
+ shareCode?: string;
124
+ listenerToken?: string;
125
+ }): Promise<string>;
126
+ audioUrl(id: string, opts?: {
127
+ kind?: 'delivery' | 'background' | 'speech' | 'master' | 'source' | 'video';
128
+ lang?: string;
129
+ format?: string;
130
+ } & ReadAs): Promise<string>;
131
+ audioSrc(id: string, opts?: {
132
+ kind?: AudioKind;
133
+ lang?: string;
134
+ voice?: string;
135
+ format?: MediaFormat;
136
+ } & MediaAuth): string;
137
+ clipSrc(id: string, startS: number, endS: number, opts?: {
138
+ clean?: boolean;
139
+ } & MediaAuth): string;
140
+ voiceClipSrc(id: string, sentence: number, lang: string, opts?: {
141
+ voice?: string;
142
+ format?: 'ogg' | 'caf';
143
+ part?: number;
144
+ v?: string;
145
+ } & MediaAuth): string;
146
+ clip(id: string, startS: number, endS: number, as?: ReadAs): Promise<Response>;
147
+ voice(id: string, lang?: string, as?: ReadAs): Promise<VoiceTrack[]>;
148
+ renderVoice(id: string, langs: string[], call?: CallOptions): Promise<VoiceTrack[]>;
149
+ renderVoice(id: string, req: RenderVoice & ReadAs, call?: CallOptions): Promise<VoiceTrack[]>;
150
+ voiceClip(id: string, sentence: number, lang: string, opts?: {
151
+ format?: 'ogg' | 'caf';
152
+ } & ReadAs): Promise<Response>;
153
+ mediaToken(id: string): Promise<{
154
+ token: string;
155
+ expiresAt: string;
156
+ }>;
157
+ nameSpeaker(id: string, speaker: number, name: string | null): Promise<void>;
158
+ events(id: string, opts?: {
159
+ after?: number;
160
+ limit?: number;
161
+ }): Promise<RecordingEvent[]>;
162
+ eventsPage(id: string, opts?: {
163
+ cursor?: string;
164
+ after?: number;
165
+ limit?: number;
166
+ }): Promise<RecordingEvents>;
167
+ subscribe(id: string, opts?: SubscribeOptions): Promise<Subscription>;
168
+ }
169
+ export type AudioKind = 'delivery' | 'voice' | 'background' | 'speech' | 'master' | 'source' | 'video';
170
+ export type MediaFormat = 'ogg' | 'caf' | 'mp3';
171
+ export interface RenderVoice {
172
+ langs: string[];
173
+ voice?: string;
174
+ voiceBySpeaker?: Record<string, string>;
175
+ near?: number;
176
+ }
177
+ export interface MediaAuth extends ReadAs {
178
+ token?: string;
179
+ media?: string;
180
+ }
181
+ export declare function playableFormat(): 'ogg' | 'caf';
182
+ export declare class Jobs {
183
+ #private;
184
+ constructor(t: Transport);
185
+ get(recordingId: string): Promise<TranscriptionJob>;
186
+ start(recordingId: string, window?: StartJob): Promise<TranscriptionJob>;
187
+ retry(recordingId: string): Promise<TranscriptionJob>;
188
+ preview(recordingId: string): Promise<Response>;
189
+ wait(recordingId: string, opts?: {
190
+ intervalMs?: number;
191
+ timeoutMs?: number;
192
+ signal?: AbortSignal;
193
+ onProgress?(job: TranscriptionJob): void;
194
+ }): Promise<TranscriptionJob>;
195
+ }
196
+ export declare class Corrections {
197
+ #private;
198
+ constructor(t: Transport);
199
+ list(recordingId: string): Promise<Correction[]>;
200
+ listPage(recordingId: string, opts?: PageOptions): Promise<CorrectionPage>;
201
+ apply(recordingId: string, batch: CorrectionBatch): Promise<Correction[]>;
202
+ retranscribe(recordingId: string, req: RetranscribeLine): Promise<Correction[]>;
203
+ revert(correctionId: string): Promise<Correction>;
204
+ }
205
+ export declare class ShareLinks {
206
+ #private;
207
+ constructor(t: Transport);
208
+ open(code: string): Promise<SharedTranscript>;
209
+ update(id: string, req: UpdateShareLink): Promise<ShareLink>;
210
+ revoke(id: string): Promise<ShareLink>;
211
+ }
212
+ export declare class Tags {
213
+ #private;
214
+ constructor(t: Transport);
215
+ list(): Promise<Tag[]>;
216
+ create(req: CreateTag): Promise<Tag>;
217
+ update(id: string, req: UpdateTag): Promise<Tag>;
218
+ delete(id: string): Promise<void>;
219
+ tagTranscriptions(id: string, req: TagTranscriptions): Promise<Tag>;
220
+ }
221
+ export declare class Voices {
222
+ #private;
223
+ constructor(t: Transport);
224
+ list(opts?: {
225
+ lifecycle?: 'active' | 'archived';
226
+ }): Promise<Voice[]>;
227
+ get(id: string): Promise<Voice>;
228
+ archive(id: string): Promise<Voice>;
229
+ restore(id: string): Promise<Voice>;
230
+ archiveMany(ids: string[]): Promise<ManyResult>;
231
+ restoreMany(ids: string[]): Promise<ManyResult>;
232
+ deleteMany(ids: string[]): Promise<ManyResult>;
233
+ create(req: {
234
+ name: string;
235
+ sample?: Upload;
236
+ sampleUrl?: string;
237
+ fileName?: string;
238
+ gender?: 'male' | 'female';
239
+ color?: string;
240
+ draft?: boolean;
241
+ }, call?: CallOptions): Promise<Voice>;
242
+ createFromSpeaker(req: Omit<CreateVoiceFromSpeaker, 'consent'>, call?: CallOptions): Promise<Voice>;
243
+ setConsent(id: string, consent: 'granted' | 'refused', opts?: {
244
+ name?: string;
245
+ }): Promise<Voice>;
246
+ update(id: string, patch: PatchVoice): Promise<Voice>;
247
+ delete(id: string): Promise<void>;
248
+ available(lang: string, opts?: {
249
+ recording?: string;
250
+ asOwner?: boolean;
251
+ } & ReadAs): Promise<VoiceCatalogue>;
252
+ preview(voice: string, lang: string, opts?: {
253
+ format?: 'ogg' | 'caf';
254
+ }): Promise<Response>;
255
+ clonePreview(id: string, opts?: {
256
+ lang?: string;
257
+ format?: 'ogg' | 'caf';
258
+ recording?: string;
259
+ asOwner?: boolean;
260
+ } & ReadAs): Promise<Response>;
261
+ sample(id: string): Promise<Response>;
262
+ }
263
+ export interface SearchOptions {
264
+ broadcasts?: string[];
265
+ listenerTokens?: string[];
266
+ recording?: string;
267
+ lang?: string;
268
+ limit?: number;
269
+ }
270
+ export declare class Search {
271
+ #private;
272
+ constructor(t: Transport);
273
+ query(q: string, opts?: SearchOptions): Promise<SearchResults>;
274
+ }
275
+ export interface Me {
276
+ userId?: string | null;
277
+ apiKeyId?: string | null;
278
+ displayName: string;
279
+ principalId: string;
280
+ principals: unknown[];
281
+ scopes: string[];
282
+ }
283
+ export declare class MeApi {
284
+ #private;
285
+ constructor(t: Transport);
286
+ get(): Promise<Me>;
287
+ }
288
+ export interface ConnectTokenInput {
289
+ code: string;
290
+ codeVerifier: string;
291
+ redirectUri: string;
292
+ }
293
+ export interface ConnectToken {
294
+ access_token: string;
295
+ token_type: 'api_key';
296
+ key_id: string;
297
+ scope: string;
298
+ account: {
299
+ name: string;
300
+ };
301
+ }
302
+ export declare class Connect {
303
+ #private;
304
+ constructor(t: Transport);
305
+ token(input: ConnectTokenInput, opts?: CallOptions): Promise<ConnectToken>;
306
+ }
307
+ export interface PageOptions {
308
+ cursor?: string;
309
+ limit?: number;
310
+ }
311
+ export interface UsageOptions {
312
+ startDate?: string;
313
+ endDate?: string;
314
+ tz?: string;
315
+ }
316
+ export interface UsageChargesOptions extends UsageOptions, PageOptions {
317
+ kind?: 'file' | 'live';
318
+ source?: string;
319
+ }
320
+ export declare class Billing {
321
+ #private;
322
+ constructor(t: Transport);
323
+ get(): Promise<BillingView>;
324
+ plans(): Promise<PlanList>;
325
+ ledger(opts?: PageOptions): Promise<LedgerPage>;
326
+ charges(opts?: PageOptions): Promise<ChargePage>;
327
+ createCheckout(req: CreateCheckout, opts?: CallOptions): Promise<CheckoutView>;
328
+ getCheckout(id: string): Promise<CheckoutView>;
329
+ cancelSubscription(): Promise<SubscriptionView>;
330
+ uncancelSubscription(): Promise<SubscriptionView>;
331
+ setAutoTopUp(req: AutoTopUpSettings): Promise<AutoTopUpView>;
332
+ portal(): Promise<PortalLink>;
333
+ retryAutoTopUp(): Promise<AutoTopUpView>;
334
+ setLowBalanceAlert(req: LowBalanceAlertSettings): Promise<LowBalanceAlertView>;
335
+ setInterval(req: SetInterval): Promise<SubscriptionView>;
336
+ optInYearly(req: YearlyOptIn): Promise<SubscriptionView>;
337
+ unsetInterval(): Promise<SubscriptionView>;
338
+ usage(opts?: UsageOptions): Promise<UsageReport>;
339
+ usageCharges(opts?: UsageChargesOptions): Promise<UsageChargePage>;
340
+ payments(opts?: PageOptions): Promise<PaymentPage>;
341
+ paymentDocument(id: string): Promise<PaymentDocument>;
342
+ paymentMethods(): Promise<PaymentMethodList>;
343
+ deletePaymentMethod(id: string): Promise<void>;
344
+ managePaymentMethods(): Promise<PortalLink>;
345
+ details(): Promise<BillingDetails>;
346
+ setDetails(req: BillingDetails): Promise<BillingDetails>;
347
+ checkPromoCode(req: CheckPromoCode): Promise<PromoCodeView>;
348
+ }
349
+ export declare class Languages {
350
+ #private;
351
+ constructor(t: Transport);
352
+ list(): Promise<LanguageLists>;
353
+ }
354
+ export declare class Rtmp {
355
+ #private;
356
+ constructor(t: Transport);
357
+ status(): Promise<RtmpStatus>;
358
+ createKey(req: CreateAppStreamKey): Promise<CreatedAppStreamKey>;
359
+ listKeys(): Promise<AppStreamKey[]>;
360
+ deleteKey(id: string): Promise<void>;
361
+ }
362
+ export declare class Events {
363
+ #private;
364
+ constructor(t: Transport);
365
+ account(): Promise<WsLike>;
366
+ }
367
+ export declare class Meta {
368
+ #private;
369
+ constructor(t: Transport);
370
+ health(): Promise<Health>;
371
+ openapi(): Promise<Record<string, unknown>>;
372
+ clientPolicy(client: ClientApp): Promise<ClientPolicy>;
373
+ }
374
+ export {};