@audd/sdk 1.5.7 → 1.5.8

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/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { S as StreamCallbackMatch, a as StreamCallbackNotification, H as HttpClient, b as Stream, L as LongpollPoll, c as LyricsResult, F as FetchLike, R as RecognitionResult, E as EnterpriseMatch } from './longpollCore-DMBdcGSM.cjs';
2
2
  export { d as EnterpriseChunkResult, e as StreamCallbackSong, f as StreamingProvider } from './longpollCore-DMBdcGSM.cjs';
3
3
 
4
- declare const VERSION = "1.4.6";
4
+ declare const VERSION = "1.5.8";
5
5
 
6
6
  /**
7
7
  * Auto-detect what kind of audio source the caller passed and convert to
@@ -219,12 +219,22 @@ declare function handleCallback(req: CallbackRequestLike): Promise<ParsedCallbac
219
219
 
220
220
  interface SetCallbackUrlOptions {
221
221
  returnMetadata?: string | string[];
222
+ /**
223
+ * Additional form fields the typed options don't cover. Typed options
224
+ * (`url`) win on collision.
225
+ */
226
+ extraParameters?: Record<string, string>;
222
227
  }
223
228
  interface AddStreamOptions {
224
229
  url: string;
225
230
  radioId: number;
226
231
  /** "before" delivers callbacks at song start; default delivers at song end. */
227
232
  callbacks?: "before" | string;
233
+ /**
234
+ * Additional form fields the typed options don't cover. Typed options
235
+ * (`url`, `radioId`, `callbacks`) win on collision.
236
+ */
237
+ extraParameters?: Record<string, string>;
228
238
  }
229
239
  interface LongpollOptions {
230
240
  sinceTime?: number;
@@ -397,7 +407,7 @@ interface AudDOptions {
397
407
  }
398
408
  type ReturnMetadata = "apple_music" | "spotify" | "deezer" | "napster" | "musicbrainz" | string;
399
409
  interface RecognizeOptions {
400
- return?: ReturnMetadata | ReturnMetadata[];
410
+ returnMetadata?: ReturnMetadata | ReturnMetadata[];
401
411
  market?: string;
402
412
  /** Per-call timeout in ms; overrides the client default. */
403
413
  timeoutMs?: number;
@@ -408,9 +418,14 @@ interface RecognizeOptions {
408
418
  * already done metered work and the credit is consumed regardless.
409
419
  */
410
420
  signal?: AbortSignal;
421
+ /**
422
+ * Additional form fields the typed options don't cover — undocumented
423
+ * parameters, beta features. Typed options win on collision.
424
+ */
425
+ extraParameters?: Record<string, string>;
411
426
  }
412
427
  interface RecognizeEnterpriseOptions {
413
- return?: ReturnMetadata | ReturnMetadata[];
428
+ returnMetadata?: ReturnMetadata | ReturnMetadata[];
414
429
  skip?: number;
415
430
  every?: number;
416
431
  limit?: number;
@@ -423,6 +438,11 @@ interface RecognizeEnterpriseOptions {
423
438
  * For multi-hour enterprise calls, this is the right way to cancel.
424
439
  */
425
440
  signal?: AbortSignal;
441
+ /**
442
+ * Additional form fields the typed options don't cover. Typed options
443
+ * win on collision.
444
+ */
445
+ extraParameters?: Record<string, string>;
426
446
  }
427
447
  /**
428
448
  * The AudD client. Async-only — every method returns a `Promise`.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { S as StreamCallbackMatch, a as StreamCallbackNotification, H as HttpClient, b as Stream, L as LongpollPoll, c as LyricsResult, F as FetchLike, R as RecognitionResult, E as EnterpriseMatch } from './longpollCore-DMBdcGSM.js';
2
2
  export { d as EnterpriseChunkResult, e as StreamCallbackSong, f as StreamingProvider } from './longpollCore-DMBdcGSM.js';
3
3
 
4
- declare const VERSION = "1.4.6";
4
+ declare const VERSION = "1.5.8";
5
5
 
6
6
  /**
7
7
  * Auto-detect what kind of audio source the caller passed and convert to
@@ -219,12 +219,22 @@ declare function handleCallback(req: CallbackRequestLike): Promise<ParsedCallbac
219
219
 
220
220
  interface SetCallbackUrlOptions {
221
221
  returnMetadata?: string | string[];
222
+ /**
223
+ * Additional form fields the typed options don't cover. Typed options
224
+ * (`url`) win on collision.
225
+ */
226
+ extraParameters?: Record<string, string>;
222
227
  }
223
228
  interface AddStreamOptions {
224
229
  url: string;
225
230
  radioId: number;
226
231
  /** "before" delivers callbacks at song start; default delivers at song end. */
227
232
  callbacks?: "before" | string;
233
+ /**
234
+ * Additional form fields the typed options don't cover. Typed options
235
+ * (`url`, `radioId`, `callbacks`) win on collision.
236
+ */
237
+ extraParameters?: Record<string, string>;
228
238
  }
229
239
  interface LongpollOptions {
230
240
  sinceTime?: number;
@@ -397,7 +407,7 @@ interface AudDOptions {
397
407
  }
398
408
  type ReturnMetadata = "apple_music" | "spotify" | "deezer" | "napster" | "musicbrainz" | string;
399
409
  interface RecognizeOptions {
400
- return?: ReturnMetadata | ReturnMetadata[];
410
+ returnMetadata?: ReturnMetadata | ReturnMetadata[];
401
411
  market?: string;
402
412
  /** Per-call timeout in ms; overrides the client default. */
403
413
  timeoutMs?: number;
@@ -408,9 +418,14 @@ interface RecognizeOptions {
408
418
  * already done metered work and the credit is consumed regardless.
409
419
  */
410
420
  signal?: AbortSignal;
421
+ /**
422
+ * Additional form fields the typed options don't cover — undocumented
423
+ * parameters, beta features. Typed options win on collision.
424
+ */
425
+ extraParameters?: Record<string, string>;
411
426
  }
412
427
  interface RecognizeEnterpriseOptions {
413
- return?: ReturnMetadata | ReturnMetadata[];
428
+ returnMetadata?: ReturnMetadata | ReturnMetadata[];
414
429
  skip?: number;
415
430
  every?: number;
416
431
  limit?: number;
@@ -423,6 +438,11 @@ interface RecognizeEnterpriseOptions {
423
438
  * For multi-hour enterprise calls, this is the right way to cancel.
424
439
  */
425
440
  signal?: AbortSignal;
441
+ /**
442
+ * Additional form fields the typed options don't cover. Typed options
443
+ * win on collision.
444
+ */
445
+ extraParameters?: Record<string, string>;
426
446
  }
427
447
  /**
428
448
  * The AudD client. Async-only — every method returns a `Promise`.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import * as path from 'path';
3
3
  import { createHash } from 'crypto';
4
4
 
5
5
  // src/version.ts
6
- var VERSION = "1.4.6";
6
+ var VERSION = "1.5.8";
7
7
 
8
8
  // src/errors.ts
9
9
  var AudDError = class extends Error {
@@ -1105,7 +1105,9 @@ var Streams = class {
1105
1105
  */
1106
1106
  async setCallbackUrl(url, opts = {}) {
1107
1107
  const finalUrl = addReturnToUrl(url, opts.returnMetadata);
1108
- await this.post("setCallbackUrl", { url: finalUrl }, this.mutatingPolicy);
1108
+ const fields = opts.extraParameters ? { ...opts.extraParameters } : {};
1109
+ fields["url"] = finalUrl;
1110
+ await this.post("setCallbackUrl", fields, this.mutatingPolicy);
1109
1111
  }
1110
1112
  /** Get the currently registered callback URL. */
1111
1113
  async getCallbackUrl() {
@@ -1114,10 +1116,9 @@ var Streams = class {
1114
1116
  }
1115
1117
  /** Register a new stream for real-time recognition. */
1116
1118
  async add(opts) {
1117
- const fields = {
1118
- url: opts.url,
1119
- radio_id: String(opts.radioId)
1120
- };
1119
+ const fields = opts.extraParameters ? { ...opts.extraParameters } : {};
1120
+ fields["url"] = opts.url;
1121
+ fields["radio_id"] = String(opts.radioId);
1121
1122
  if (opts.callbacks !== void 0) fields["callbacks"] = opts.callbacks;
1122
1123
  await this.post("addStream", fields, this.mutatingPolicy);
1123
1124
  }
@@ -1371,8 +1372,8 @@ function formatReturn(value) {
1371
1372
  return Array.isArray(value) ? value.join(",") : value;
1372
1373
  }
1373
1374
  function buildEnterpriseFields(opts) {
1374
- const fields = {};
1375
- const ret = formatReturn(opts.return);
1375
+ const fields = opts.extraParameters ? { ...opts.extraParameters } : {};
1376
+ const ret = formatReturn(opts.returnMetadata);
1376
1377
  if (ret !== void 0) fields["return"] = ret;
1377
1378
  if (opts.skip !== void 0) fields["skip"] = String(opts.skip);
1378
1379
  if (opts.every !== void 0) fields["every"] = String(opts.every);
@@ -1541,7 +1542,7 @@ var AudD = class {
1541
1542
  */
1542
1543
  async recognize(source, opts = {}) {
1543
1544
  const reopen = prepareSource(source);
1544
- const ret = formatReturn(opts.return);
1545
+ const ret = formatReturn(opts.returnMetadata);
1545
1546
  const market = opts.market;
1546
1547
  const policy = this.policyFor("recognition");
1547
1548
  const url = `${API_BASE3}/`;
@@ -1561,6 +1562,7 @@ var AudD = class {
1561
1562
  resp = await runRetried4(async () => {
1562
1563
  const prepared = await reopen();
1563
1564
  const fields = { ...prepared.fields };
1565
+ if (opts.extraParameters) Object.assign(fields, opts.extraParameters);
1564
1566
  if (ret !== void 0) fields["return"] = ret;
1565
1567
  if (market !== void 0) fields["market"] = market;
1566
1568
  return this._http.postForm(url, fields, {