sonovault 4.5.0 → 4.6.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 CHANGED
@@ -50,6 +50,12 @@ for (const e of release.editions ?? []) {
50
50
  }
51
51
  const deluxe = await sv.releases.get(7, { edition: 16216 });
52
52
 
53
+ // Find an album's UPC from its name, or the release behind a barcode
54
+ const [found] = (await sv.releases.search({ title: "Discovery", artist: "Daft Punk" })).results;
55
+ console.log(found.digital_upc); // 724384960650
56
+ const byBarcode = await sv.releases.byUpc("724384960650"); // UPC-A or EAN-13, 404 if unknown
57
+ console.log(byBarcode.results[0].title); // Discovery
58
+
53
59
  // Recording to composition (ISWC), for royalty and publishing workflows
54
60
  const work = await sv.tracks.iswc({ isrc: "GBDUW0000053" });
55
61
 
@@ -148,7 +154,7 @@ Runnable scripts live in [`examples/`](examples/): find an ISRC, resolve cross-p
148
154
  | `sv.tracks` | `search`, `get`, `byIsrc`, `iswc`, `byIswc`, `links`, `resolve`, `identifyAudio`, `browse` |
149
155
  | `sv.artists` | `search`, `get`, `releases` |
150
156
  | `sv.labels` | `search`, `get`, `releases`, `artists` |
151
- | `sv.releases` | `search`, `get`, `latest` |
157
+ | `sv.releases` | `search`, `get`, `byUpc`, `latest` |
152
158
  | `sv.genres` | `list` |
153
159
  | `sv.suggestions` | `submit`, `list` |
154
160
  | `sv.streams` | `create`, `list`, `get`, `update`, `history`, `report`, `live`, `stop` |
package/dist/index.cjs CHANGED
@@ -50,7 +50,7 @@ var SonoVaultError = class extends Error {
50
50
  };
51
51
 
52
52
  // src/version.ts
53
- var VERSION = "4.4.0";
53
+ var VERSION = "4.6.0";
54
54
 
55
55
  // src/client.ts
56
56
  var SonoVault = class {
@@ -110,6 +110,14 @@ var SonoVault = class {
110
110
  * edition's track numbering instead of the default consensus.
111
111
  */
112
112
  get: (id, params = {}) => this.request(`/v1/releases/${id}`, { query: params }),
113
+ /**
114
+ * The release behind a UPC, EAN or GTIN barcode (GET /v1/releases/upc/:upc).
115
+ * Accepts 8 to 14 digits (spaces and hyphens are ignored); a 12-digit UPC-A
116
+ * and its 13-digit EAN form with a leading zero find the same release.
117
+ * Throws `SonoVaultError` with status 404 when no release carries the
118
+ * barcode. Free tier.
119
+ */
120
+ byUpc: (upc) => this.request(`/v1/releases/upc/${encodeURIComponent(upc)}`),
113
121
  /** Newly released albums (GET /v1/releases/new). Paid tiers. */
114
122
  latest: (params = {}) => this.request("/v1/releases/new", { query: params })
115
123
  };
package/dist/index.d.cts CHANGED
@@ -191,7 +191,7 @@ interface Release {
191
191
  * MusicBrainz and Discogs digital editions whose title matches the release).
192
192
  * 12 digits (UPC-A) when it fits, otherwise the 13-digit EAN. `null` when no
193
193
  * digital edition carries one. Returned by `releases.get()` and
194
- * `releases.new()`.
194
+ * `releases.latest()`, and on every result of `releases.search()`.
195
195
  */
196
196
  digital_upc?: string | null;
197
197
  [key: string]: unknown;
@@ -399,6 +399,35 @@ interface StreamEvent {
399
399
  };
400
400
  [key: string]: unknown;
401
401
  }
402
+ /** One release carrying the barcode you looked up, from `releases.byUpc()`. */
403
+ interface UpcLookupResult {
404
+ id: number;
405
+ title: string;
406
+ artist: {
407
+ id: number;
408
+ name: string;
409
+ };
410
+ label: {
411
+ id: number;
412
+ name: string;
413
+ } | null;
414
+ release_date: string | null;
415
+ /**
416
+ * The UPC the release was delivered to digital stores with. Often the same
417
+ * as the barcode you asked for, but a release can carry several (CD, vinyl,
418
+ * reissue). `null` when no digital edition carries one.
419
+ */
420
+ digital_upc: string | null;
421
+ /** Formats of the editions that carry this barcode (`cd`, `vinyl`, `digital`, ...). */
422
+ formats: string[];
423
+ }
424
+ /** Response of `releases.byUpc()`. */
425
+ interface UpcLookupResponse {
426
+ /** The barcode, normalised: 12 digits (UPC-A) when it fits, otherwise the 13 or 14 digit EAN/GTIN. */
427
+ upc: string;
428
+ /** The releases that carry it, oldest first, at most 25. Usually one. */
429
+ results: UpcLookupResult[];
430
+ }
402
431
 
403
432
  interface SonoVaultOptions {
404
433
  /** Your API key — get a free one at https://sonovault.now (1,000 requests/month). */
@@ -527,6 +556,14 @@ declare class SonoVault {
527
556
  get: (id: number, params?: {
528
557
  edition?: number;
529
558
  }) => Promise<Release>;
559
+ /**
560
+ * The release behind a UPC, EAN or GTIN barcode (GET /v1/releases/upc/:upc).
561
+ * Accepts 8 to 14 digits (spaces and hyphens are ignored); a 12-digit UPC-A
562
+ * and its 13-digit EAN form with a leading zero find the same release.
563
+ * Throws `SonoVaultError` with status 404 when no release carries the
564
+ * barcode. Free tier.
565
+ */
566
+ byUpc: (upc: string) => Promise<UpcLookupResponse>;
530
567
  /** Newly released albums (GET /v1/releases/new). Paid tiers. */
531
568
  latest: (params?: {
532
569
  limit?: number;
@@ -658,4 +695,4 @@ declare function verifyWebhookSignature(options: {
658
695
  */
659
696
  declare function paginate<T>(fetchPage: (cursor: string | undefined) => Promise<Page<T>>): AsyncGenerator<T>;
660
697
 
661
- export { type Artist, type Genre, type IdentifyResponse, type IdentifyResult, type IswcLookupResponse, type KeySource, type Label, type Page, type PlatformLink, type PlatformLinksResponse, type Release, type ReleaseEdition, type ReleaseListParams, type ReleaseTrack, type ResolveInputType, type ResolveRequest, type ResolveResponse, type ResolveResult, SonoVault, SonoVaultError, type SonoVaultOptions, type Stream, type StreamEvent, type StreamStatus, type StreamUpdateResponse, type Track, type TrackArtist, type TrackKey, type TrackRelease, type Webhook, paginate, verifyWebhookSignature };
698
+ export { type Artist, type Genre, type IdentifyResponse, type IdentifyResult, type IswcLookupResponse, type KeySource, type Label, type Page, type PlatformLink, type PlatformLinksResponse, type Release, type ReleaseEdition, type ReleaseListParams, type ReleaseTrack, type ResolveInputType, type ResolveRequest, type ResolveResponse, type ResolveResult, SonoVault, SonoVaultError, type SonoVaultOptions, type Stream, type StreamEvent, type StreamStatus, type StreamUpdateResponse, type Track, type TrackArtist, type TrackKey, type TrackRelease, type UpcLookupResponse, type UpcLookupResult, type Webhook, paginate, verifyWebhookSignature };
package/dist/index.d.ts CHANGED
@@ -191,7 +191,7 @@ interface Release {
191
191
  * MusicBrainz and Discogs digital editions whose title matches the release).
192
192
  * 12 digits (UPC-A) when it fits, otherwise the 13-digit EAN. `null` when no
193
193
  * digital edition carries one. Returned by `releases.get()` and
194
- * `releases.new()`.
194
+ * `releases.latest()`, and on every result of `releases.search()`.
195
195
  */
196
196
  digital_upc?: string | null;
197
197
  [key: string]: unknown;
@@ -399,6 +399,35 @@ interface StreamEvent {
399
399
  };
400
400
  [key: string]: unknown;
401
401
  }
402
+ /** One release carrying the barcode you looked up, from `releases.byUpc()`. */
403
+ interface UpcLookupResult {
404
+ id: number;
405
+ title: string;
406
+ artist: {
407
+ id: number;
408
+ name: string;
409
+ };
410
+ label: {
411
+ id: number;
412
+ name: string;
413
+ } | null;
414
+ release_date: string | null;
415
+ /**
416
+ * The UPC the release was delivered to digital stores with. Often the same
417
+ * as the barcode you asked for, but a release can carry several (CD, vinyl,
418
+ * reissue). `null` when no digital edition carries one.
419
+ */
420
+ digital_upc: string | null;
421
+ /** Formats of the editions that carry this barcode (`cd`, `vinyl`, `digital`, ...). */
422
+ formats: string[];
423
+ }
424
+ /** Response of `releases.byUpc()`. */
425
+ interface UpcLookupResponse {
426
+ /** The barcode, normalised: 12 digits (UPC-A) when it fits, otherwise the 13 or 14 digit EAN/GTIN. */
427
+ upc: string;
428
+ /** The releases that carry it, oldest first, at most 25. Usually one. */
429
+ results: UpcLookupResult[];
430
+ }
402
431
 
403
432
  interface SonoVaultOptions {
404
433
  /** Your API key — get a free one at https://sonovault.now (1,000 requests/month). */
@@ -527,6 +556,14 @@ declare class SonoVault {
527
556
  get: (id: number, params?: {
528
557
  edition?: number;
529
558
  }) => Promise<Release>;
559
+ /**
560
+ * The release behind a UPC, EAN or GTIN barcode (GET /v1/releases/upc/:upc).
561
+ * Accepts 8 to 14 digits (spaces and hyphens are ignored); a 12-digit UPC-A
562
+ * and its 13-digit EAN form with a leading zero find the same release.
563
+ * Throws `SonoVaultError` with status 404 when no release carries the
564
+ * barcode. Free tier.
565
+ */
566
+ byUpc: (upc: string) => Promise<UpcLookupResponse>;
530
567
  /** Newly released albums (GET /v1/releases/new). Paid tiers. */
531
568
  latest: (params?: {
532
569
  limit?: number;
@@ -658,4 +695,4 @@ declare function verifyWebhookSignature(options: {
658
695
  */
659
696
  declare function paginate<T>(fetchPage: (cursor: string | undefined) => Promise<Page<T>>): AsyncGenerator<T>;
660
697
 
661
- export { type Artist, type Genre, type IdentifyResponse, type IdentifyResult, type IswcLookupResponse, type KeySource, type Label, type Page, type PlatformLink, type PlatformLinksResponse, type Release, type ReleaseEdition, type ReleaseListParams, type ReleaseTrack, type ResolveInputType, type ResolveRequest, type ResolveResponse, type ResolveResult, SonoVault, SonoVaultError, type SonoVaultOptions, type Stream, type StreamEvent, type StreamStatus, type StreamUpdateResponse, type Track, type TrackArtist, type TrackKey, type TrackRelease, type Webhook, paginate, verifyWebhookSignature };
698
+ export { type Artist, type Genre, type IdentifyResponse, type IdentifyResult, type IswcLookupResponse, type KeySource, type Label, type Page, type PlatformLink, type PlatformLinksResponse, type Release, type ReleaseEdition, type ReleaseListParams, type ReleaseTrack, type ResolveInputType, type ResolveRequest, type ResolveResponse, type ResolveResult, SonoVault, SonoVaultError, type SonoVaultOptions, type Stream, type StreamEvent, type StreamStatus, type StreamUpdateResponse, type Track, type TrackArtist, type TrackKey, type TrackRelease, type UpcLookupResponse, type UpcLookupResult, type Webhook, paginate, verifyWebhookSignature };
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ var SonoVaultError = class extends Error {
21
21
  };
22
22
 
23
23
  // src/version.ts
24
- var VERSION = "4.4.0";
24
+ var VERSION = "4.6.0";
25
25
 
26
26
  // src/client.ts
27
27
  var SonoVault = class {
@@ -81,6 +81,14 @@ var SonoVault = class {
81
81
  * edition's track numbering instead of the default consensus.
82
82
  */
83
83
  get: (id, params = {}) => this.request(`/v1/releases/${id}`, { query: params }),
84
+ /**
85
+ * The release behind a UPC, EAN or GTIN barcode (GET /v1/releases/upc/:upc).
86
+ * Accepts 8 to 14 digits (spaces and hyphens are ignored); a 12-digit UPC-A
87
+ * and its 13-digit EAN form with a leading zero find the same release.
88
+ * Throws `SonoVaultError` with status 404 when no release carries the
89
+ * barcode. Free tier.
90
+ */
91
+ byUpc: (upc) => this.request(`/v1/releases/upc/${encodeURIComponent(upc)}`),
84
92
  /** Newly released albums (GET /v1/releases/new). Paid tiers. */
85
93
  latest: (params = {}) => this.request("/v1/releases/new", { query: params })
86
94
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonovault",
3
- "version": "4.5.0",
3
+ "version": "4.6.0",
4
4
  "description": "TypeScript/Node client for the SonoVault music metadata API: ISRC, ISWC, genre, BPM, key, labels, release dates, and cross-platform IDs for 93M+ tracks.",
5
5
  "keywords": [
6
6
  "music",