sonovault 3.0.0 → 4.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 CHANGED
@@ -37,6 +37,18 @@ for (const link of links) {
37
37
  console.log(link.source, link.url); // spotify https://open.spotify.com/track/...
38
38
  }
39
39
 
40
+ // An album's tracklist, in playing order
41
+ const release = await sv.releases.get(7);
42
+ for (const t of release.tracks ?? []) {
43
+ console.log(t.disc_number, t.track_number, t.title); // 1 1 One More Time
44
+ }
45
+
46
+ // One record groups every edition of an album, so pick the one you mean
47
+ for (const e of release.editions ?? []) {
48
+ console.log(e.id, e.format, e.release_date, e.track_count); // 16216 cd 2001-03-12 14
49
+ }
50
+ const deluxe = await sv.releases.get(7, { edition: 16216 });
51
+
40
52
  // Recording to composition (ISWC), for royalty and publishing workflows
41
53
  const work = await sv.tracks.iswc({ isrc: "GBDUW0000053" });
42
54
  ```
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 = "3.0.0";
53
+ var VERSION = "4.1.0";
54
54
 
55
55
  // src/client.ts
56
56
  var SonoVault = class {
@@ -99,7 +99,12 @@ var SonoVault = class {
99
99
  };
100
100
  this.releases = {
101
101
  search: (params) => this.request("/v1/releases/search", { query: params }),
102
- get: (id) => this.request(`/v1/releases/${id}`),
102
+ /**
103
+ * One release with its tracklist and the editions behind it. Pass
104
+ * `edition` (an `id` from the response's `editions`) to render that
105
+ * edition's track numbering instead of the default consensus.
106
+ */
107
+ get: (id, params = {}) => this.request(`/v1/releases/${id}`, { query: params }),
103
108
  /** Newly released albums (GET /v1/releases/new). Paid tiers. */
104
109
  latest: (params = {}) => this.request("/v1/releases/new", { query: params })
105
110
  };
package/dist/index.d.cts CHANGED
@@ -35,6 +35,32 @@ interface Track {
35
35
  /** Canonical subgenres. Empty array when none apply. */
36
36
  subgenre: string[];
37
37
  }
38
+ /**
39
+ * A track as embedded in a release, from `GET /v1/releases/:id`.
40
+ *
41
+ * Same as {@link Track} minus the `releases` array (the release is the object
42
+ * you are already looking at), plus this track's position on that release.
43
+ */
44
+ interface ReleaseTrack {
45
+ id: number;
46
+ title: string;
47
+ artists: TrackArtist[];
48
+ isrc: string | null;
49
+ duration: number | null;
50
+ /** Canonical genres. Empty array when the track is unclassified. */
51
+ genre: string[];
52
+ /** Canonical subgenres. Empty array when none apply. */
53
+ subgenre: string[];
54
+ /** Disc the track sits on, counting from 1. Null when the position is unknown. */
55
+ disc_number: number | null;
56
+ /**
57
+ * Position on this release, counting from 1 within its disc. A position
58
+ * belongs to the pairing of track and release rather than to the track, so
59
+ * the same recording can be track 6 on an album and track 2 on a
60
+ * compilation. Null when the position is unknown.
61
+ */
62
+ track_number: number | null;
63
+ }
38
64
  /** A cursor-paginated page. `next_cursor` is null on the last page. */
39
65
  interface Page<T> {
40
66
  results: T[];
@@ -43,6 +69,18 @@ interface Page<T> {
43
69
  interface Artist {
44
70
  id: number;
45
71
  name: string;
72
+ /** Country of origin, in English. Null when unknown. */
73
+ country?: string | null;
74
+ /** Year the artist or group started, or birth year for a solo act. */
75
+ formation_year?: number | null;
76
+ /** Full ISO date, present only when day-level precision is known. */
77
+ formation_date?: string | null;
78
+ /** Platform to handle or URL. Which keys appear varies by artist. */
79
+ social_links?: Record<string, string> | null;
80
+ /** Wikidata entity ID, e.g. `Q185828`. Null when unmapped. */
81
+ wikidata_id?: string | null;
82
+ /** MusicBrainz artist MBID. Null when unmapped. */
83
+ musicbrainz_id?: string | null;
46
84
  [key: string]: unknown;
47
85
  }
48
86
  interface Label {
@@ -62,9 +100,84 @@ interface Release {
62
100
  name: string;
63
101
  } | null;
64
102
  release_date?: string | null;
65
- tracks?: Track[];
103
+ /**
104
+ * MusicBrainz release MBIDs, sorted. An array rather than a single value
105
+ * because a SonoVault release groups every edition of an album and each
106
+ * edition carries its own MBID, so you can pick the edition you need. Empty
107
+ * when unmapped. Only returned by `releases.get()`.
108
+ */
109
+ musicbrainz_release_ids?: string[];
110
+ /**
111
+ * MusicBrainz release-group MBIDs: the identity of the album across all its
112
+ * editions, as opposed to any one pressing. Usually a single entry. Empty
113
+ * when unmapped. Only returned by `releases.get()`.
114
+ */
115
+ musicbrainz_release_group_ids?: string[];
116
+ /**
117
+ * The tracklist, in playing order (disc, then track number), with any track
118
+ * whose position is unknown last. Numbering comes from the edition named by
119
+ * `edition`, or from a consensus across the release's editions when none was
120
+ * named.
121
+ */
122
+ tracks?: ReleaseTrack[];
123
+ /**
124
+ * The real editions behind this release, at most 20. A SonoVault release
125
+ * groups every edition of an album onto one record, so the single, the
126
+ * album, the deluxe and the box set share one ID; these are the editions
127
+ * behind it. Chosen so each is a genuinely different edition rather than
128
+ * twenty pressings of the same one. Only returned by `releases.get()`.
129
+ */
130
+ editions?: ReleaseEdition[];
131
+ /**
132
+ * The edition whose numbering `tracks` uses. `null` unless an edition was
133
+ * requested. Only returned by `releases.get()`.
134
+ */
135
+ edition?: number | null;
66
136
  [key: string]: unknown;
67
137
  }
138
+ /**
139
+ * One real edition behind a release: a specific pressing, issue or digital
140
+ * album as one provider describes it. Pass its `id` to
141
+ * `releases.get(id, { edition })` to render that edition's track numbering.
142
+ */
143
+ interface ReleaseEdition {
144
+ id: number;
145
+ /** The provider describing this edition. */
146
+ source: "spotify" | "discogs" | "musicbrainz";
147
+ /** The edition's ID at that provider. */
148
+ external_id: string;
149
+ /**
150
+ * The provider's identity for the album across all its editions: a
151
+ * MusicBrainz release-group MBID or a Discogs master ID. `null` for Spotify,
152
+ * which has no such concept.
153
+ */
154
+ group_external_id: string | null;
155
+ /** The edition's own title, which often carries what makes it distinct. */
156
+ title: string | null;
157
+ edition_kind: "album" | "single" | "ep" | "compilation" | "live" | "remix" | "soundtrack" | "other" | null;
158
+ format: "cd" | "vinyl" | "cassette" | "digital" | "dvd" | "mixed" | "other" | null;
159
+ /** `false` for a release the provider marks unofficial, such as a bootleg. */
160
+ official: boolean | null;
161
+ /**
162
+ * The edition's release date, `YYYY-MM-DD`. Read it with `date_precision`: a
163
+ * month-precision date is reported as the first of the month.
164
+ */
165
+ release_date: string | null;
166
+ date_precision: "day" | "month" | "year" | null;
167
+ /** Barcode or UPC, digits only, so editions can be matched across providers. */
168
+ barcode: string | null;
169
+ /** Where the edition was issued, as the provider names it. Not an ISO code. */
170
+ country: string | null;
171
+ /** How many discs, records or tapes the edition spans. */
172
+ medium_count: number | null;
173
+ /**
174
+ * The provider's own total for the edition, including tracks SonoVault does
175
+ * not hold. Compare with `tracks_on_row` to see the gap.
176
+ */
177
+ track_count: number | null;
178
+ /** How many of this release's tracks sit on the edition. */
179
+ tracks_on_row: number;
180
+ }
68
181
  interface Genre {
69
182
  id: number;
70
183
  name: string;
@@ -323,7 +436,14 @@ declare class SonoVault {
323
436
  limit?: number;
324
437
  cursor?: string;
325
438
  }) => Promise<Page<Release>>;
326
- get: (id: number) => Promise<Release>;
439
+ /**
440
+ * One release with its tracklist and the editions behind it. Pass
441
+ * `edition` (an `id` from the response's `editions`) to render that
442
+ * edition's track numbering instead of the default consensus.
443
+ */
444
+ get: (id: number, params?: {
445
+ edition?: number;
446
+ }) => Promise<Release>;
327
447
  /** Newly released albums (GET /v1/releases/new). Paid tiers. */
328
448
  latest: (params?: {
329
449
  limit?: number;
@@ -450,4 +570,4 @@ declare function verifyWebhookSignature(options: {
450
570
  */
451
571
  declare function paginate<T>(fetchPage: (cursor: string | undefined) => Promise<Page<T>>): AsyncGenerator<T>;
452
572
 
453
- export { type Artist, type Genre, type IdentifyResponse, type IdentifyResult, type IswcLookupResponse, type Label, type Page, type PlatformLink, type PlatformLinksResponse, type Release, 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 TrackRelease, type Webhook, paginate, verifyWebhookSignature };
573
+ export { type Artist, type Genre, type IdentifyResponse, type IdentifyResult, type IswcLookupResponse, type Label, type Page, type PlatformLink, type PlatformLinksResponse, type Release, type ReleaseEdition, 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 TrackRelease, type Webhook, paginate, verifyWebhookSignature };
package/dist/index.d.ts CHANGED
@@ -35,6 +35,32 @@ interface Track {
35
35
  /** Canonical subgenres. Empty array when none apply. */
36
36
  subgenre: string[];
37
37
  }
38
+ /**
39
+ * A track as embedded in a release, from `GET /v1/releases/:id`.
40
+ *
41
+ * Same as {@link Track} minus the `releases` array (the release is the object
42
+ * you are already looking at), plus this track's position on that release.
43
+ */
44
+ interface ReleaseTrack {
45
+ id: number;
46
+ title: string;
47
+ artists: TrackArtist[];
48
+ isrc: string | null;
49
+ duration: number | null;
50
+ /** Canonical genres. Empty array when the track is unclassified. */
51
+ genre: string[];
52
+ /** Canonical subgenres. Empty array when none apply. */
53
+ subgenre: string[];
54
+ /** Disc the track sits on, counting from 1. Null when the position is unknown. */
55
+ disc_number: number | null;
56
+ /**
57
+ * Position on this release, counting from 1 within its disc. A position
58
+ * belongs to the pairing of track and release rather than to the track, so
59
+ * the same recording can be track 6 on an album and track 2 on a
60
+ * compilation. Null when the position is unknown.
61
+ */
62
+ track_number: number | null;
63
+ }
38
64
  /** A cursor-paginated page. `next_cursor` is null on the last page. */
39
65
  interface Page<T> {
40
66
  results: T[];
@@ -43,6 +69,18 @@ interface Page<T> {
43
69
  interface Artist {
44
70
  id: number;
45
71
  name: string;
72
+ /** Country of origin, in English. Null when unknown. */
73
+ country?: string | null;
74
+ /** Year the artist or group started, or birth year for a solo act. */
75
+ formation_year?: number | null;
76
+ /** Full ISO date, present only when day-level precision is known. */
77
+ formation_date?: string | null;
78
+ /** Platform to handle or URL. Which keys appear varies by artist. */
79
+ social_links?: Record<string, string> | null;
80
+ /** Wikidata entity ID, e.g. `Q185828`. Null when unmapped. */
81
+ wikidata_id?: string | null;
82
+ /** MusicBrainz artist MBID. Null when unmapped. */
83
+ musicbrainz_id?: string | null;
46
84
  [key: string]: unknown;
47
85
  }
48
86
  interface Label {
@@ -62,9 +100,84 @@ interface Release {
62
100
  name: string;
63
101
  } | null;
64
102
  release_date?: string | null;
65
- tracks?: Track[];
103
+ /**
104
+ * MusicBrainz release MBIDs, sorted. An array rather than a single value
105
+ * because a SonoVault release groups every edition of an album and each
106
+ * edition carries its own MBID, so you can pick the edition you need. Empty
107
+ * when unmapped. Only returned by `releases.get()`.
108
+ */
109
+ musicbrainz_release_ids?: string[];
110
+ /**
111
+ * MusicBrainz release-group MBIDs: the identity of the album across all its
112
+ * editions, as opposed to any one pressing. Usually a single entry. Empty
113
+ * when unmapped. Only returned by `releases.get()`.
114
+ */
115
+ musicbrainz_release_group_ids?: string[];
116
+ /**
117
+ * The tracklist, in playing order (disc, then track number), with any track
118
+ * whose position is unknown last. Numbering comes from the edition named by
119
+ * `edition`, or from a consensus across the release's editions when none was
120
+ * named.
121
+ */
122
+ tracks?: ReleaseTrack[];
123
+ /**
124
+ * The real editions behind this release, at most 20. A SonoVault release
125
+ * groups every edition of an album onto one record, so the single, the
126
+ * album, the deluxe and the box set share one ID; these are the editions
127
+ * behind it. Chosen so each is a genuinely different edition rather than
128
+ * twenty pressings of the same one. Only returned by `releases.get()`.
129
+ */
130
+ editions?: ReleaseEdition[];
131
+ /**
132
+ * The edition whose numbering `tracks` uses. `null` unless an edition was
133
+ * requested. Only returned by `releases.get()`.
134
+ */
135
+ edition?: number | null;
66
136
  [key: string]: unknown;
67
137
  }
138
+ /**
139
+ * One real edition behind a release: a specific pressing, issue or digital
140
+ * album as one provider describes it. Pass its `id` to
141
+ * `releases.get(id, { edition })` to render that edition's track numbering.
142
+ */
143
+ interface ReleaseEdition {
144
+ id: number;
145
+ /** The provider describing this edition. */
146
+ source: "spotify" | "discogs" | "musicbrainz";
147
+ /** The edition's ID at that provider. */
148
+ external_id: string;
149
+ /**
150
+ * The provider's identity for the album across all its editions: a
151
+ * MusicBrainz release-group MBID or a Discogs master ID. `null` for Spotify,
152
+ * which has no such concept.
153
+ */
154
+ group_external_id: string | null;
155
+ /** The edition's own title, which often carries what makes it distinct. */
156
+ title: string | null;
157
+ edition_kind: "album" | "single" | "ep" | "compilation" | "live" | "remix" | "soundtrack" | "other" | null;
158
+ format: "cd" | "vinyl" | "cassette" | "digital" | "dvd" | "mixed" | "other" | null;
159
+ /** `false` for a release the provider marks unofficial, such as a bootleg. */
160
+ official: boolean | null;
161
+ /**
162
+ * The edition's release date, `YYYY-MM-DD`. Read it with `date_precision`: a
163
+ * month-precision date is reported as the first of the month.
164
+ */
165
+ release_date: string | null;
166
+ date_precision: "day" | "month" | "year" | null;
167
+ /** Barcode or UPC, digits only, so editions can be matched across providers. */
168
+ barcode: string | null;
169
+ /** Where the edition was issued, as the provider names it. Not an ISO code. */
170
+ country: string | null;
171
+ /** How many discs, records or tapes the edition spans. */
172
+ medium_count: number | null;
173
+ /**
174
+ * The provider's own total for the edition, including tracks SonoVault does
175
+ * not hold. Compare with `tracks_on_row` to see the gap.
176
+ */
177
+ track_count: number | null;
178
+ /** How many of this release's tracks sit on the edition. */
179
+ tracks_on_row: number;
180
+ }
68
181
  interface Genre {
69
182
  id: number;
70
183
  name: string;
@@ -323,7 +436,14 @@ declare class SonoVault {
323
436
  limit?: number;
324
437
  cursor?: string;
325
438
  }) => Promise<Page<Release>>;
326
- get: (id: number) => Promise<Release>;
439
+ /**
440
+ * One release with its tracklist and the editions behind it. Pass
441
+ * `edition` (an `id` from the response's `editions`) to render that
442
+ * edition's track numbering instead of the default consensus.
443
+ */
444
+ get: (id: number, params?: {
445
+ edition?: number;
446
+ }) => Promise<Release>;
327
447
  /** Newly released albums (GET /v1/releases/new). Paid tiers. */
328
448
  latest: (params?: {
329
449
  limit?: number;
@@ -450,4 +570,4 @@ declare function verifyWebhookSignature(options: {
450
570
  */
451
571
  declare function paginate<T>(fetchPage: (cursor: string | undefined) => Promise<Page<T>>): AsyncGenerator<T>;
452
572
 
453
- export { type Artist, type Genre, type IdentifyResponse, type IdentifyResult, type IswcLookupResponse, type Label, type Page, type PlatformLink, type PlatformLinksResponse, type Release, 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 TrackRelease, type Webhook, paginate, verifyWebhookSignature };
573
+ export { type Artist, type Genre, type IdentifyResponse, type IdentifyResult, type IswcLookupResponse, type Label, type Page, type PlatformLink, type PlatformLinksResponse, type Release, type ReleaseEdition, 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 TrackRelease, 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 = "3.0.0";
24
+ var VERSION = "4.1.0";
25
25
 
26
26
  // src/client.ts
27
27
  var SonoVault = class {
@@ -70,7 +70,12 @@ var SonoVault = class {
70
70
  };
71
71
  this.releases = {
72
72
  search: (params) => this.request("/v1/releases/search", { query: params }),
73
- get: (id) => this.request(`/v1/releases/${id}`),
73
+ /**
74
+ * One release with its tracklist and the editions behind it. Pass
75
+ * `edition` (an `id` from the response's `editions`) to render that
76
+ * edition's track numbering instead of the default consensus.
77
+ */
78
+ get: (id, params = {}) => this.request(`/v1/releases/${id}`, { query: params }),
74
79
  /** Newly released albums (GET /v1/releases/new). Paid tiers. */
75
80
  latest: (params = {}) => this.request("/v1/releases/new", { query: params })
76
81
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sonovault",
3
- "version": "3.0.0",
4
- "description": "TypeScript/Node client for the SonoVault music metadata API ISRC, ISWC, genre, labels, release dates, and cross-platform IDs for 93M+ tracks.",
3
+ "version": "4.1.0",
4
+ "description": "TypeScript/Node client for the SonoVault music metadata API \u2014 ISRC, ISWC, genre, labels, release dates, and cross-platform IDs for 93M+ tracks.",
5
5
  "keywords": [
6
6
  "music",
7
7
  "metadata",