@audd/sdk 1.5.6 → 1.5.7

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 CHANGED
@@ -286,9 +286,9 @@ callback URL set, and the preflight surfaces that as an actionable
286
286
  error. Pass `skipCallbackCheck: true` to bypass.
287
287
 
288
288
  ```ts
289
- const category = audd.streams.deriveLongpollCategory(12345); // pure, no network call
290
- const poll = await audd.streams.longpoll(category, { timeout: 30 });
289
+ const radioId = 1; // any integer you choose — your handle for this stream
291
290
 
291
+ const poll = await audd.streams.longpoll({ radioId, timeout: 30 });
292
292
  for await (const m of poll.matches) {
293
293
  console.log(m.song.artist, m.song.title);
294
294
  }
package/dist/index.cjs CHANGED
@@ -684,6 +684,8 @@ function shouldRetryResponse(resp, retryClass) {
684
684
  return s >= HTTP_SERVER_ERROR_FLOOR;
685
685
  case "mutating":
686
686
  return false;
687
+ case "none":
688
+ return false;
687
689
  }
688
690
  }
689
691
  function shouldRetryError(err, retryClass) {
@@ -694,6 +696,8 @@ function shouldRetryError(err, retryClass) {
694
696
  return isPreUploadConnectionError(err);
695
697
  case "mutating":
696
698
  return isPreUploadConnectionError(err);
699
+ case "none":
700
+ return false;
697
701
  }
698
702
  }
699
703
  function sleep(ms) {
@@ -1266,12 +1270,12 @@ async function runRetried2(fn, policy) {
1266
1270
  }
1267
1271
  }
1268
1272
  var CustomCatalog = class {
1269
- constructor(http, mutatingPolicy) {
1273
+ constructor(http, noRetryPolicy) {
1270
1274
  this.http = http;
1271
- this.mutatingPolicy = mutatingPolicy;
1275
+ this.noRetryPolicy = noRetryPolicy;
1272
1276
  }
1273
1277
  http;
1274
- mutatingPolicy;
1278
+ noRetryPolicy;
1275
1279
  /**
1276
1280
  * **This is NOT how you submit audio for music recognition.** For
1277
1281
  * recognition, use `audd.recognize()` (or `audd.recognizeEnterprise()` for
@@ -1283,6 +1287,11 @@ var CustomCatalog = class {
1283
1287
  * Calling this again with the same `audioId` re-fingerprints that slot.
1284
1288
  * There is no public list/delete endpoint; track `audioId` ↔ song
1285
1289
  * mappings on your side.
1290
+ *
1291
+ * **No automatic retry.** Custom-catalog upload is metered, and a transport
1292
+ * failure could otherwise cause a silent re-upload that double-charges. Any
1293
+ * 5xx or pre-upload connection error surfaces as a clean exception — the
1294
+ * caller decides whether to retry.
1286
1295
  */
1287
1296
  async add(opts) {
1288
1297
  const reopen = prepareSource(opts.source);
@@ -1291,7 +1300,7 @@ var CustomCatalog = class {
1291
1300
  const prepared = await reopen();
1292
1301
  const fields = { ...prepared.fields, audio_id: audioId };
1293
1302
  return this.http.postForm(UPLOAD_URL, fields);
1294
- }, this.mutatingPolicy);
1303
+ }, this.noRetryPolicy);
1295
1304
  decodeSuccess2(resp.jsonBody, resp.httpStatus, resp.requestId);
1296
1305
  }
1297
1306
  };
@@ -1535,7 +1544,7 @@ var AudD = class {
1535
1544
  /** Sub-namespace for the private fingerprint catalog. NOT for recognition. */
1536
1545
  get customCatalog() {
1537
1546
  if (this._customCatalog === void 0) {
1538
- this._customCatalog = new CustomCatalog(this._http, this.policyFor("mutating"));
1547
+ this._customCatalog = new CustomCatalog(this._http, this.policyFor("none"));
1539
1548
  }
1540
1549
  return this._customCatalog;
1541
1550
  }