@audicle/sdk 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.
- package/README.md +244 -0
- package/dist/index.cjs +538 -0
- package/dist/index.d.cts +966 -0
- package/dist/index.d.ts +966 -0
- package/dist/index.js +492 -0
- package/package.json +44 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
// src/client.ts
|
|
2
|
+
import createClient from "openapi-fetch";
|
|
3
|
+
|
|
4
|
+
// src/resources/health.ts
|
|
5
|
+
function createHealthResource(api) {
|
|
6
|
+
return async () => {
|
|
7
|
+
const result = await api.GET("/v1/health");
|
|
8
|
+
return result.data ?? result.error;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// src/errors.ts
|
|
13
|
+
var AudicleError = class extends Error {
|
|
14
|
+
constructor(message) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.name = "AudicleError";
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var AudicleApiError = class extends AudicleError {
|
|
20
|
+
status;
|
|
21
|
+
code;
|
|
22
|
+
requestId;
|
|
23
|
+
details;
|
|
24
|
+
constructor(status, code, message, requestId, details) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = "AudicleApiError";
|
|
27
|
+
this.status = status;
|
|
28
|
+
this.code = code;
|
|
29
|
+
this.requestId = requestId;
|
|
30
|
+
this.details = details;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var AudicleAuthError = class extends AudicleApiError {
|
|
34
|
+
constructor(code, message, requestId, details) {
|
|
35
|
+
super(401, code, message, requestId, details);
|
|
36
|
+
this.name = "AudicleAuthError";
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var AudicleNotFoundError = class extends AudicleApiError {
|
|
40
|
+
constructor(code, message, requestId, details) {
|
|
41
|
+
super(404, code, message, requestId, details);
|
|
42
|
+
this.name = "AudicleNotFoundError";
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var AudicleRateLimitError = class extends AudicleApiError {
|
|
46
|
+
constructor(code, message, requestId, details) {
|
|
47
|
+
super(429, code, message, requestId, details);
|
|
48
|
+
this.name = "AudicleRateLimitError";
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var AudicleTimeoutError = class extends AudicleError {
|
|
52
|
+
constructor(message) {
|
|
53
|
+
super(message);
|
|
54
|
+
this.name = "AudicleTimeoutError";
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
function throwApiError(status, body) {
|
|
58
|
+
const { code, message, request_id, details } = body.error;
|
|
59
|
+
switch (status) {
|
|
60
|
+
case 401:
|
|
61
|
+
throw new AudicleAuthError(code, message, request_id, details);
|
|
62
|
+
case 404:
|
|
63
|
+
throw new AudicleNotFoundError(code, message, request_id, details);
|
|
64
|
+
case 429:
|
|
65
|
+
throw new AudicleRateLimitError(code, message, request_id, details);
|
|
66
|
+
default:
|
|
67
|
+
throw new AudicleApiError(status, code, message, request_id, details);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function unwrapResponse(result) {
|
|
71
|
+
if (result.data !== void 0) return result.data;
|
|
72
|
+
if (result.error && isErrorResponseBody(result.error)) {
|
|
73
|
+
throwApiError(result.response.status, result.error);
|
|
74
|
+
}
|
|
75
|
+
throw new AudicleApiError(
|
|
76
|
+
result.response.status,
|
|
77
|
+
"unknown_error",
|
|
78
|
+
`Unexpected ${result.response.status} response`,
|
|
79
|
+
""
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
function isErrorResponseBody(value) {
|
|
83
|
+
return typeof value === "object" && value !== null && "error" in value && typeof value.error?.code === "string";
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/resources/transcripts.ts
|
|
87
|
+
var TranscriptsResource = class {
|
|
88
|
+
#api;
|
|
89
|
+
#baseUrl;
|
|
90
|
+
#apiKey;
|
|
91
|
+
constructor(api, baseUrl, apiKey) {
|
|
92
|
+
this.#api = api;
|
|
93
|
+
this.#baseUrl = baseUrl;
|
|
94
|
+
this.#apiKey = apiKey;
|
|
95
|
+
}
|
|
96
|
+
async get(id) {
|
|
97
|
+
const result = await this.#api.GET("/v1/transcripts/{id}", {
|
|
98
|
+
params: { path: { id } }
|
|
99
|
+
});
|
|
100
|
+
return unwrapResponse(result);
|
|
101
|
+
}
|
|
102
|
+
async getText(id) {
|
|
103
|
+
return this.getFormatted(id, "text");
|
|
104
|
+
}
|
|
105
|
+
async getSrt(id) {
|
|
106
|
+
return this.getFormatted(id, "srt");
|
|
107
|
+
}
|
|
108
|
+
async getVtt(id) {
|
|
109
|
+
return this.getFormatted(id, "vtt");
|
|
110
|
+
}
|
|
111
|
+
async list(params = {}) {
|
|
112
|
+
const result = await this.#api.GET("/v1/transcripts", {
|
|
113
|
+
params: {
|
|
114
|
+
query: {
|
|
115
|
+
cursor: params.cursor,
|
|
116
|
+
limit: params.limit,
|
|
117
|
+
status: params.status,
|
|
118
|
+
created_after: params.createdAfter,
|
|
119
|
+
created_before: params.createdBefore
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
return unwrapResponse(result);
|
|
124
|
+
}
|
|
125
|
+
async *listAll(params = {}) {
|
|
126
|
+
let cursor;
|
|
127
|
+
do {
|
|
128
|
+
const page = await this.list({ ...params, cursor });
|
|
129
|
+
for (const item of page.data) {
|
|
130
|
+
yield item;
|
|
131
|
+
}
|
|
132
|
+
cursor = page.has_more && page.next_cursor ? page.next_cursor : void 0;
|
|
133
|
+
} while (cursor);
|
|
134
|
+
}
|
|
135
|
+
async delete(id) {
|
|
136
|
+
const result = await this.#api.DELETE("/v1/transcripts/{id}", {
|
|
137
|
+
params: { path: { id } }
|
|
138
|
+
});
|
|
139
|
+
if (result.error) throwApiError(result.response.status, result.error);
|
|
140
|
+
}
|
|
141
|
+
async wait(id, options = {}) {
|
|
142
|
+
const interval = Math.max(options.interval ?? 3e3, 500);
|
|
143
|
+
const timeout = options.timeout ?? 3e5;
|
|
144
|
+
const deadline = Date.now() + timeout;
|
|
145
|
+
while (Date.now() < deadline) {
|
|
146
|
+
const txn = await this.get(id);
|
|
147
|
+
if (txn.status === "completed" || txn.status === "error") return txn;
|
|
148
|
+
const remaining = deadline - Date.now();
|
|
149
|
+
if (remaining <= 0) break;
|
|
150
|
+
await sleep(Math.min(interval, remaining));
|
|
151
|
+
}
|
|
152
|
+
throw new AudicleTimeoutError(
|
|
153
|
+
`Transcription ${id} did not complete within ${timeout}ms`
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
async getFormatted(id, format) {
|
|
157
|
+
const url = `${this.#baseUrl}/v1/transcripts/${encodeURIComponent(id)}?format=${format}`;
|
|
158
|
+
const resp = await fetch(url, {
|
|
159
|
+
headers: { Authorization: `Bearer ${this.#apiKey}` }
|
|
160
|
+
});
|
|
161
|
+
if (!resp.ok) {
|
|
162
|
+
const body = await resp.json();
|
|
163
|
+
throwApiError(resp.status, body);
|
|
164
|
+
}
|
|
165
|
+
return resp.text();
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
function sleep(ms) {
|
|
169
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// src/resources/usage.ts
|
|
173
|
+
var UsageResource = class {
|
|
174
|
+
#api;
|
|
175
|
+
constructor(api) {
|
|
176
|
+
this.#api = api;
|
|
177
|
+
}
|
|
178
|
+
async get(params) {
|
|
179
|
+
const result = await this.#api.GET("/v1/usage", {
|
|
180
|
+
params: {
|
|
181
|
+
query: {
|
|
182
|
+
start_date: params.startDate,
|
|
183
|
+
end_date: params.endDate,
|
|
184
|
+
granularity: params.granularity
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
return unwrapResponse(result);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// src/resources/transcribe.ts
|
|
193
|
+
var TranscribeResource = class {
|
|
194
|
+
#baseUrl;
|
|
195
|
+
#apiKey;
|
|
196
|
+
constructor(baseUrl, apiKey) {
|
|
197
|
+
this.#baseUrl = baseUrl;
|
|
198
|
+
this.#apiKey = apiKey;
|
|
199
|
+
}
|
|
200
|
+
async transcribe(input, options = {}) {
|
|
201
|
+
const url = `${this.#baseUrl}/v1/transcribe`;
|
|
202
|
+
const headers = {
|
|
203
|
+
Authorization: `Bearer ${this.#apiKey}`
|
|
204
|
+
};
|
|
205
|
+
if (options.idempotencyKey) {
|
|
206
|
+
headers["Idempotency-Key"] = options.idempotencyKey;
|
|
207
|
+
}
|
|
208
|
+
const preferParts = [];
|
|
209
|
+
if (options.async) preferParts.push("respond-async");
|
|
210
|
+
if (options.wait !== void 0) preferParts.push(`wait=${options.wait}`);
|
|
211
|
+
if (preferParts.length > 0) headers["Prefer"] = preferParts.join(", ");
|
|
212
|
+
let body;
|
|
213
|
+
if (input.audioUrl) {
|
|
214
|
+
const form = new FormData();
|
|
215
|
+
form.append("audio_url", input.audioUrl);
|
|
216
|
+
appendFormOptions(form, options);
|
|
217
|
+
body = form;
|
|
218
|
+
} else if (input.file) {
|
|
219
|
+
const blob = toBlob(input.file);
|
|
220
|
+
const form = new FormData();
|
|
221
|
+
form.append("file", blob);
|
|
222
|
+
appendFormOptions(form, options);
|
|
223
|
+
body = form;
|
|
224
|
+
} else {
|
|
225
|
+
throw new Error("Either file or audioUrl must be provided");
|
|
226
|
+
}
|
|
227
|
+
const resp = await fetch(url, { method: "POST", headers, body });
|
|
228
|
+
if (!resp.ok) {
|
|
229
|
+
const errBody = await resp.json();
|
|
230
|
+
throwApiError(resp.status, errBody);
|
|
231
|
+
}
|
|
232
|
+
return await resp.json();
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
function toBlob(input) {
|
|
236
|
+
if (input instanceof Blob) return input;
|
|
237
|
+
if (input instanceof ArrayBuffer) return new Blob([input]);
|
|
238
|
+
return new Blob([new Uint8Array(input).buffer]);
|
|
239
|
+
}
|
|
240
|
+
function appendFormOptions(form, options) {
|
|
241
|
+
if (options.model) form.append("model", options.model);
|
|
242
|
+
if (options.language) form.append("language", options.language);
|
|
243
|
+
if (options.speakerLabels !== void 0)
|
|
244
|
+
form.append("speaker_labels", String(options.speakerLabels));
|
|
245
|
+
if (options.wordTimestamps !== void 0)
|
|
246
|
+
form.append("word_timestamps", String(options.wordTimestamps));
|
|
247
|
+
if (options.webhookUrl) form.append("webhook_url", options.webhookUrl);
|
|
248
|
+
if (options.metadata) form.append("metadata", JSON.stringify(options.metadata));
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// src/streaming/emitter.ts
|
|
252
|
+
var TypedEmitter = class {
|
|
253
|
+
listeners = /* @__PURE__ */ new Map();
|
|
254
|
+
on(event, fn) {
|
|
255
|
+
let set = this.listeners.get(event);
|
|
256
|
+
if (!set) {
|
|
257
|
+
set = /* @__PURE__ */ new Set();
|
|
258
|
+
this.listeners.set(event, set);
|
|
259
|
+
}
|
|
260
|
+
set.add(fn);
|
|
261
|
+
return this;
|
|
262
|
+
}
|
|
263
|
+
off(event, fn) {
|
|
264
|
+
this.listeners.get(event)?.delete(fn);
|
|
265
|
+
return this;
|
|
266
|
+
}
|
|
267
|
+
once(event, fn) {
|
|
268
|
+
const wrapped = ((data) => {
|
|
269
|
+
this.off(event, wrapped);
|
|
270
|
+
fn(data);
|
|
271
|
+
});
|
|
272
|
+
return this.on(event, wrapped);
|
|
273
|
+
}
|
|
274
|
+
emit(event, data) {
|
|
275
|
+
const set = this.listeners.get(event);
|
|
276
|
+
if (!set) return;
|
|
277
|
+
for (const fn of set) {
|
|
278
|
+
fn(data);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
removeAllListeners() {
|
|
282
|
+
this.listeners.clear();
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
// src/streaming/stream.ts
|
|
287
|
+
var TranscriptionStream = class extends TypedEmitter {
|
|
288
|
+
#ws = null;
|
|
289
|
+
#closed = false;
|
|
290
|
+
#baseUrl;
|
|
291
|
+
#apiKey;
|
|
292
|
+
#options;
|
|
293
|
+
constructor(baseUrl, apiKey, options = {}) {
|
|
294
|
+
super();
|
|
295
|
+
this.#baseUrl = baseUrl;
|
|
296
|
+
this.#apiKey = apiKey;
|
|
297
|
+
this.#options = options;
|
|
298
|
+
this.#connect();
|
|
299
|
+
}
|
|
300
|
+
sendAudio(data) {
|
|
301
|
+
if (!this.#ws || this.#ws.readyState !== WebSocket.OPEN) {
|
|
302
|
+
throw new Error("WebSocket is not open");
|
|
303
|
+
}
|
|
304
|
+
this.#ws.send(data);
|
|
305
|
+
}
|
|
306
|
+
finalize() {
|
|
307
|
+
this.#send({ type: "finalize" });
|
|
308
|
+
}
|
|
309
|
+
stop() {
|
|
310
|
+
this.#send({ type: "stop" });
|
|
311
|
+
}
|
|
312
|
+
configure(config) {
|
|
313
|
+
const { type: _, ...rest } = config;
|
|
314
|
+
this.#send({ ...rest, type: "configure" });
|
|
315
|
+
}
|
|
316
|
+
close() {
|
|
317
|
+
this.#closed = true;
|
|
318
|
+
this.#ws?.close();
|
|
319
|
+
}
|
|
320
|
+
get readyState() {
|
|
321
|
+
return this.#ws?.readyState ?? WebSocket.CLOSED;
|
|
322
|
+
}
|
|
323
|
+
#connect() {
|
|
324
|
+
const wsUrl = this.#buildUrl();
|
|
325
|
+
this.#ws = new WebSocket(wsUrl);
|
|
326
|
+
this.#ws.binaryType = "arraybuffer";
|
|
327
|
+
this.#ws.addEventListener("open", () => {
|
|
328
|
+
this.emit("open", void 0);
|
|
329
|
+
});
|
|
330
|
+
this.#ws.addEventListener("message", (event) => {
|
|
331
|
+
if (typeof event.data !== "string") return;
|
|
332
|
+
try {
|
|
333
|
+
const msg = JSON.parse(event.data);
|
|
334
|
+
switch (msg.type) {
|
|
335
|
+
case "session.begin":
|
|
336
|
+
this.emit("session.begin", msg);
|
|
337
|
+
break;
|
|
338
|
+
case "transcript":
|
|
339
|
+
this.emit("transcript", msg);
|
|
340
|
+
break;
|
|
341
|
+
case "vad":
|
|
342
|
+
this.emit("vad", msg);
|
|
343
|
+
break;
|
|
344
|
+
case "error":
|
|
345
|
+
this.emit("error", msg);
|
|
346
|
+
break;
|
|
347
|
+
case "session.end":
|
|
348
|
+
this.emit("session.end", msg);
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
} catch {
|
|
352
|
+
this.emit("error", { type: "error", code: "parse_error", message: "Invalid JSON from server" });
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
this.#ws.addEventListener("close", (event) => {
|
|
356
|
+
this.emit("close", { code: event.code, reason: event.reason });
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
/** @internal WebSocket auth requires token in query string (standard WebSocket limitation) */
|
|
360
|
+
#buildUrl() {
|
|
361
|
+
const base = this.#baseUrl.replace(/^https?/, (m) => m === "https" ? "wss" : "ws");
|
|
362
|
+
const params = new URLSearchParams();
|
|
363
|
+
params.set("token", this.#apiKey);
|
|
364
|
+
if (this.#options.model) params.set("model", this.#options.model);
|
|
365
|
+
if (this.#options.language) params.set("language", this.#options.language);
|
|
366
|
+
if (this.#options.sample_rate !== void 0)
|
|
367
|
+
params.set("sample_rate", String(this.#options.sample_rate));
|
|
368
|
+
if (this.#options.encoding) params.set("encoding", this.#options.encoding);
|
|
369
|
+
if (this.#options.interim_results !== void 0)
|
|
370
|
+
params.set("interim_results", String(this.#options.interim_results));
|
|
371
|
+
return `${base}/v1/transcribe?${params.toString()}`;
|
|
372
|
+
}
|
|
373
|
+
#send(msg) {
|
|
374
|
+
if (!this.#ws || this.#ws.readyState !== WebSocket.OPEN) {
|
|
375
|
+
throw new Error("WebSocket is not open");
|
|
376
|
+
}
|
|
377
|
+
this.#ws.send(JSON.stringify(msg));
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
// src/streaming/observer.ts
|
|
382
|
+
var ObserverStream = class extends TypedEmitter {
|
|
383
|
+
#ws = null;
|
|
384
|
+
#baseUrl;
|
|
385
|
+
#apiKey;
|
|
386
|
+
#sessionId;
|
|
387
|
+
constructor(baseUrl, apiKey, sessionId) {
|
|
388
|
+
super();
|
|
389
|
+
this.#baseUrl = baseUrl;
|
|
390
|
+
this.#apiKey = apiKey;
|
|
391
|
+
this.#sessionId = sessionId;
|
|
392
|
+
this.#connect();
|
|
393
|
+
}
|
|
394
|
+
close() {
|
|
395
|
+
this.#ws?.close();
|
|
396
|
+
}
|
|
397
|
+
get readyState() {
|
|
398
|
+
return this.#ws?.readyState ?? WebSocket.CLOSED;
|
|
399
|
+
}
|
|
400
|
+
#connect() {
|
|
401
|
+
const base = this.#baseUrl.replace(/^https?/, (m) => m === "https" ? "wss" : "ws");
|
|
402
|
+
const params = new URLSearchParams({ token: this.#apiKey });
|
|
403
|
+
const url = `${base}/v1/transcribe/${encodeURIComponent(this.#sessionId)}/observe?${params.toString()}`;
|
|
404
|
+
this.#ws = new WebSocket(url);
|
|
405
|
+
this.#ws.addEventListener("open", () => {
|
|
406
|
+
this.emit("open", void 0);
|
|
407
|
+
});
|
|
408
|
+
this.#ws.addEventListener("message", (event) => {
|
|
409
|
+
if (typeof event.data !== "string") return;
|
|
410
|
+
try {
|
|
411
|
+
const msg = JSON.parse(event.data);
|
|
412
|
+
switch (msg.type) {
|
|
413
|
+
case "session.begin":
|
|
414
|
+
this.emit("session.begin", msg);
|
|
415
|
+
break;
|
|
416
|
+
case "transcript":
|
|
417
|
+
this.emit("transcript", msg);
|
|
418
|
+
break;
|
|
419
|
+
case "vad":
|
|
420
|
+
this.emit("vad", msg);
|
|
421
|
+
break;
|
|
422
|
+
case "error":
|
|
423
|
+
this.emit("error", msg);
|
|
424
|
+
break;
|
|
425
|
+
case "session.end":
|
|
426
|
+
this.emit("session.end", msg);
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
} catch {
|
|
430
|
+
this.emit("error", { type: "error", code: "parse_error", message: "Invalid JSON from server" });
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
this.#ws.addEventListener("close", (event) => {
|
|
434
|
+
this.emit("close", { code: event.code, reason: event.reason });
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
// src/client.ts
|
|
440
|
+
var DEFAULT_BASE_URL = "https://api.audicle.ai";
|
|
441
|
+
var Audicle = class {
|
|
442
|
+
transcripts;
|
|
443
|
+
usage;
|
|
444
|
+
streaming;
|
|
445
|
+
#transcribeResource;
|
|
446
|
+
#healthFn;
|
|
447
|
+
constructor(options) {
|
|
448
|
+
const baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
449
|
+
const apiKey = options.apiKey;
|
|
450
|
+
const api = createClient({
|
|
451
|
+
baseUrl,
|
|
452
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
453
|
+
});
|
|
454
|
+
this.#healthFn = createHealthResource(api);
|
|
455
|
+
this.transcripts = new TranscriptsResource(api, baseUrl, apiKey);
|
|
456
|
+
this.usage = new UsageResource(api);
|
|
457
|
+
this.#transcribeResource = new TranscribeResource(baseUrl, apiKey);
|
|
458
|
+
this.streaming = new StreamingNamespace(baseUrl, apiKey);
|
|
459
|
+
}
|
|
460
|
+
health() {
|
|
461
|
+
return this.#healthFn();
|
|
462
|
+
}
|
|
463
|
+
transcribe(input, options) {
|
|
464
|
+
return this.#transcribeResource.transcribe(input, options);
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
var StreamingNamespace = class {
|
|
468
|
+
#baseUrl;
|
|
469
|
+
#apiKey;
|
|
470
|
+
constructor(baseUrl, apiKey) {
|
|
471
|
+
this.#baseUrl = baseUrl;
|
|
472
|
+
this.#apiKey = apiKey;
|
|
473
|
+
}
|
|
474
|
+
transcribe(options) {
|
|
475
|
+
return new TranscriptionStream(this.#baseUrl, this.#apiKey, options);
|
|
476
|
+
}
|
|
477
|
+
observe(sessionId) {
|
|
478
|
+
return new ObserverStream(this.#baseUrl, this.#apiKey, sessionId);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
export {
|
|
482
|
+
Audicle,
|
|
483
|
+
AudicleApiError,
|
|
484
|
+
AudicleAuthError,
|
|
485
|
+
AudicleError,
|
|
486
|
+
AudicleNotFoundError,
|
|
487
|
+
AudicleRateLimitError,
|
|
488
|
+
AudicleTimeoutError,
|
|
489
|
+
ObserverStream,
|
|
490
|
+
TranscriptionStream,
|
|
491
|
+
TypedEmitter
|
|
492
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@audicle/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Official Node.js/TypeScript SDK for the Audicle transcription API",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"main": "./dist/index.cjs",
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsup && dts-bundle-generator -o dist/index.d.ts src/index.ts --project tsconfig.json --no-banner && cp dist/index.d.ts dist/index.d.cts",
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"test": "vitest run"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"openapi-fetch": "^0.13.5"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@audicle/shared": "workspace:*",
|
|
30
|
+
"dts-bundle-generator": "^9.5.1",
|
|
31
|
+
"msw": "^2.7.3",
|
|
32
|
+
"tsup": "^8.4.0",
|
|
33
|
+
"typescript": "^5.7.2",
|
|
34
|
+
"vitest": "~2.1.8"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"audicle",
|
|
38
|
+
"transcription",
|
|
39
|
+
"speech-to-text",
|
|
40
|
+
"audio",
|
|
41
|
+
"api",
|
|
42
|
+
"sdk"
|
|
43
|
+
]
|
|
44
|
+
}
|