@audd/sdk 1.5.11 → 1.5.12
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 +9 -8
- package/dist/index.cjs +165 -143
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -27
- package/dist/index.d.ts +36 -27
- package/dist/index.js +165 -143
- package/dist/index.js.map +1 -1
- package/dist/longpoll.cjs +39 -18
- package/dist/longpoll.cjs.map +1 -1
- package/dist/longpoll.d.cts +2 -2
- package/dist/longpoll.d.ts +2 -2
- package/dist/longpoll.js +39 -18
- package/dist/longpoll.js.map +1 -1
- package/dist/{longpollCore-ZtFOyojP.d.cts → longpollCore-BXx8PRmC.d.cts} +1 -1
- package/dist/{longpollCore-ZtFOyojP.d.ts → longpollCore-BXx8PRmC.d.ts} +1 -1
- package/package.json +19 -10
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
1
|
-
import { c as StreamCallbackMatch, d as StreamCallbackNotification, H as HttpClient, S as Stream, L as LongpollPoll, b as LyricsResult, F as FetchLike, R as RecognitionResult, a as EnterpriseMatch } from './longpollCore-
|
|
2
|
-
export { E as EnterpriseChunkResult, e as StreamCallbackSong, f as StreamingProvider } from './longpollCore-
|
|
1
|
+
import { c as StreamCallbackMatch, d as StreamCallbackNotification, H as HttpClient, S as Stream, L as LongpollPoll, b as LyricsResult, F as FetchLike, R as RecognitionResult, a as EnterpriseMatch } from './longpollCore-BXx8PRmC.cjs';
|
|
2
|
+
export { E as EnterpriseChunkResult, e as StreamCallbackSong, f as StreamingProvider } from './longpollCore-BXx8PRmC.cjs';
|
|
3
3
|
|
|
4
|
-
declare const VERSION = "1.5.
|
|
4
|
+
declare const VERSION = "1.5.12";
|
|
5
|
+
|
|
6
|
+
/** Inspection events emitted around each HTTP request the SDK makes. */
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Inspection event kinds emitted by the SDK request lifecycle.
|
|
10
|
+
* Hooks receive these via the `onEvent` callback.
|
|
11
|
+
*/
|
|
12
|
+
type AudDEventKind = "request" | "response" | "exception";
|
|
13
|
+
/**
|
|
14
|
+
* Inspection event emitted by the SDK request lifecycle.
|
|
15
|
+
* Frozen, plain-data; never includes the api_token or request body bytes.
|
|
16
|
+
*/
|
|
17
|
+
interface AudDEvent {
|
|
18
|
+
kind: AudDEventKind;
|
|
19
|
+
/** AudD method name, e.g. "recognize", "addStream". */
|
|
20
|
+
method: string;
|
|
21
|
+
url: string;
|
|
22
|
+
requestId: string | null;
|
|
23
|
+
httpStatus: number | null;
|
|
24
|
+
elapsedMs: number | null;
|
|
25
|
+
errorCode: number | null;
|
|
26
|
+
extras: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
type OnEventHook = (event: AudDEvent) => void;
|
|
5
29
|
|
|
6
30
|
/**
|
|
7
31
|
* Auto-detect what kind of audio source the caller passed and convert to
|
|
@@ -260,8 +284,12 @@ declare class Streams {
|
|
|
260
284
|
private readonly http;
|
|
261
285
|
private readonly readPolicy;
|
|
262
286
|
private readonly mutatingPolicy;
|
|
287
|
+
/** Live token provider — token rotations on the client propagate here. */
|
|
263
288
|
private readonly apiToken;
|
|
264
|
-
|
|
289
|
+
private readonly onEvent?;
|
|
290
|
+
constructor(http: HttpClient, readPolicy: RetryPolicy, mutatingPolicy: RetryPolicy,
|
|
291
|
+
/** Live token provider — token rotations on the client propagate here. */
|
|
292
|
+
apiToken: () => string, onEvent?: OnEventHook | undefined);
|
|
265
293
|
private post;
|
|
266
294
|
/**
|
|
267
295
|
* Set the callback URL where AudD will POST recognition events.
|
|
@@ -333,7 +361,8 @@ interface CustomCatalogAddOptions {
|
|
|
333
361
|
declare class CustomCatalog {
|
|
334
362
|
private readonly http;
|
|
335
363
|
private readonly noRetryPolicy;
|
|
336
|
-
|
|
364
|
+
private readonly onEvent?;
|
|
365
|
+
constructor(http: HttpClient, noRetryPolicy: RetryPolicy, onEvent?: OnEventHook | undefined);
|
|
337
366
|
/**
|
|
338
367
|
* **This is NOT how you submit audio for music recognition.** For
|
|
339
368
|
* recognition, use `audd.recognize()` (or `audd.recognizeEnterprise()` for
|
|
@@ -357,12 +386,13 @@ declare class CustomCatalog {
|
|
|
357
386
|
declare class Advanced {
|
|
358
387
|
private readonly http;
|
|
359
388
|
private readonly recognitionPolicy;
|
|
389
|
+
private readonly onEvent?;
|
|
360
390
|
/**
|
|
361
391
|
* @param recognitionPolicy The findLyrics endpoint is metered and shouldn't
|
|
362
392
|
* double-bill on post-upload read timeout: Advanced uses RECOGNITION retry
|
|
363
393
|
* policy, not READ.
|
|
364
394
|
*/
|
|
365
|
-
constructor(http: HttpClient, recognitionPolicy: RetryPolicy);
|
|
395
|
+
constructor(http: HttpClient, recognitionPolicy: RetryPolicy, onEvent?: OnEventHook | undefined);
|
|
366
396
|
/** Find lyrics by free-text query. Returns a list of matches (possibly empty). */
|
|
367
397
|
findLyrics(query: string): Promise<LyricsResult[]>;
|
|
368
398
|
/**
|
|
@@ -372,27 +402,6 @@ declare class Advanced {
|
|
|
372
402
|
rawRequest(method: string, params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
|
|
373
403
|
}
|
|
374
404
|
|
|
375
|
-
/**
|
|
376
|
-
* Inspection event kinds emitted by the SDK request lifecycle.
|
|
377
|
-
* Hooks receive these via the `onEvent` callback.
|
|
378
|
-
*/
|
|
379
|
-
type AudDEventKind = "request" | "response" | "exception";
|
|
380
|
-
/**
|
|
381
|
-
* Inspection event emitted by the SDK request lifecycle.
|
|
382
|
-
* Frozen, plain-data; never includes the api_token or request body bytes.
|
|
383
|
-
*/
|
|
384
|
-
interface AudDEvent {
|
|
385
|
-
kind: AudDEventKind;
|
|
386
|
-
/** AudD method name, e.g. "recognize", "addStream". */
|
|
387
|
-
method: string;
|
|
388
|
-
url: string;
|
|
389
|
-
requestId: string | null;
|
|
390
|
-
httpStatus: number | null;
|
|
391
|
-
elapsedMs: number | null;
|
|
392
|
-
errorCode: number | null;
|
|
393
|
-
extras: Record<string, unknown>;
|
|
394
|
-
}
|
|
395
|
-
type OnEventHook = (event: AudDEvent) => void;
|
|
396
405
|
interface AudDOptions {
|
|
397
406
|
/** Required, but may be omitted if `AUDD_API_TOKEN` is in the environment. */
|
|
398
407
|
apiToken?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
1
|
-
import { c as StreamCallbackMatch, d as StreamCallbackNotification, H as HttpClient, S as Stream, L as LongpollPoll, b as LyricsResult, F as FetchLike, R as RecognitionResult, a as EnterpriseMatch } from './longpollCore-
|
|
2
|
-
export { E as EnterpriseChunkResult, e as StreamCallbackSong, f as StreamingProvider } from './longpollCore-
|
|
1
|
+
import { c as StreamCallbackMatch, d as StreamCallbackNotification, H as HttpClient, S as Stream, L as LongpollPoll, b as LyricsResult, F as FetchLike, R as RecognitionResult, a as EnterpriseMatch } from './longpollCore-BXx8PRmC.js';
|
|
2
|
+
export { E as EnterpriseChunkResult, e as StreamCallbackSong, f as StreamingProvider } from './longpollCore-BXx8PRmC.js';
|
|
3
3
|
|
|
4
|
-
declare const VERSION = "1.5.
|
|
4
|
+
declare const VERSION = "1.5.12";
|
|
5
|
+
|
|
6
|
+
/** Inspection events emitted around each HTTP request the SDK makes. */
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Inspection event kinds emitted by the SDK request lifecycle.
|
|
10
|
+
* Hooks receive these via the `onEvent` callback.
|
|
11
|
+
*/
|
|
12
|
+
type AudDEventKind = "request" | "response" | "exception";
|
|
13
|
+
/**
|
|
14
|
+
* Inspection event emitted by the SDK request lifecycle.
|
|
15
|
+
* Frozen, plain-data; never includes the api_token or request body bytes.
|
|
16
|
+
*/
|
|
17
|
+
interface AudDEvent {
|
|
18
|
+
kind: AudDEventKind;
|
|
19
|
+
/** AudD method name, e.g. "recognize", "addStream". */
|
|
20
|
+
method: string;
|
|
21
|
+
url: string;
|
|
22
|
+
requestId: string | null;
|
|
23
|
+
httpStatus: number | null;
|
|
24
|
+
elapsedMs: number | null;
|
|
25
|
+
errorCode: number | null;
|
|
26
|
+
extras: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
type OnEventHook = (event: AudDEvent) => void;
|
|
5
29
|
|
|
6
30
|
/**
|
|
7
31
|
* Auto-detect what kind of audio source the caller passed and convert to
|
|
@@ -260,8 +284,12 @@ declare class Streams {
|
|
|
260
284
|
private readonly http;
|
|
261
285
|
private readonly readPolicy;
|
|
262
286
|
private readonly mutatingPolicy;
|
|
287
|
+
/** Live token provider — token rotations on the client propagate here. */
|
|
263
288
|
private readonly apiToken;
|
|
264
|
-
|
|
289
|
+
private readonly onEvent?;
|
|
290
|
+
constructor(http: HttpClient, readPolicy: RetryPolicy, mutatingPolicy: RetryPolicy,
|
|
291
|
+
/** Live token provider — token rotations on the client propagate here. */
|
|
292
|
+
apiToken: () => string, onEvent?: OnEventHook | undefined);
|
|
265
293
|
private post;
|
|
266
294
|
/**
|
|
267
295
|
* Set the callback URL where AudD will POST recognition events.
|
|
@@ -333,7 +361,8 @@ interface CustomCatalogAddOptions {
|
|
|
333
361
|
declare class CustomCatalog {
|
|
334
362
|
private readonly http;
|
|
335
363
|
private readonly noRetryPolicy;
|
|
336
|
-
|
|
364
|
+
private readonly onEvent?;
|
|
365
|
+
constructor(http: HttpClient, noRetryPolicy: RetryPolicy, onEvent?: OnEventHook | undefined);
|
|
337
366
|
/**
|
|
338
367
|
* **This is NOT how you submit audio for music recognition.** For
|
|
339
368
|
* recognition, use `audd.recognize()` (or `audd.recognizeEnterprise()` for
|
|
@@ -357,12 +386,13 @@ declare class CustomCatalog {
|
|
|
357
386
|
declare class Advanced {
|
|
358
387
|
private readonly http;
|
|
359
388
|
private readonly recognitionPolicy;
|
|
389
|
+
private readonly onEvent?;
|
|
360
390
|
/**
|
|
361
391
|
* @param recognitionPolicy The findLyrics endpoint is metered and shouldn't
|
|
362
392
|
* double-bill on post-upload read timeout: Advanced uses RECOGNITION retry
|
|
363
393
|
* policy, not READ.
|
|
364
394
|
*/
|
|
365
|
-
constructor(http: HttpClient, recognitionPolicy: RetryPolicy);
|
|
395
|
+
constructor(http: HttpClient, recognitionPolicy: RetryPolicy, onEvent?: OnEventHook | undefined);
|
|
366
396
|
/** Find lyrics by free-text query. Returns a list of matches (possibly empty). */
|
|
367
397
|
findLyrics(query: string): Promise<LyricsResult[]>;
|
|
368
398
|
/**
|
|
@@ -372,27 +402,6 @@ declare class Advanced {
|
|
|
372
402
|
rawRequest(method: string, params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
|
|
373
403
|
}
|
|
374
404
|
|
|
375
|
-
/**
|
|
376
|
-
* Inspection event kinds emitted by the SDK request lifecycle.
|
|
377
|
-
* Hooks receive these via the `onEvent` callback.
|
|
378
|
-
*/
|
|
379
|
-
type AudDEventKind = "request" | "response" | "exception";
|
|
380
|
-
/**
|
|
381
|
-
* Inspection event emitted by the SDK request lifecycle.
|
|
382
|
-
* Frozen, plain-data; never includes the api_token or request body bytes.
|
|
383
|
-
*/
|
|
384
|
-
interface AudDEvent {
|
|
385
|
-
kind: AudDEventKind;
|
|
386
|
-
/** AudD method name, e.g. "recognize", "addStream". */
|
|
387
|
-
method: string;
|
|
388
|
-
url: string;
|
|
389
|
-
requestId: string | null;
|
|
390
|
-
httpStatus: number | null;
|
|
391
|
-
elapsedMs: number | null;
|
|
392
|
-
errorCode: number | null;
|
|
393
|
-
extras: Record<string, unknown>;
|
|
394
|
-
}
|
|
395
|
-
type OnEventHook = (event: AudDEvent) => void;
|
|
396
405
|
interface AudDOptions {
|
|
397
406
|
/** Required, but may be omitted if `AUDD_API_TOKEN` is in the environment. */
|
|
398
407
|
apiToken?: string;
|