musicbrainz-api 0.26.0 → 0.27.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 +4 -0
- package/lib/musicbrainz-api.d.ts +12 -1
- package/lib/musicbrainz-api.js +2 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -100,6 +100,10 @@ const config = {
|
|
|
100
100
|
|
|
101
101
|
// Optional: Disable rate limiting (default: false)
|
|
102
102
|
disableRateLimiting: false,
|
|
103
|
+
|
|
104
|
+
// Optional: Set max number of request with X seconds
|
|
105
|
+
// (default: 15 requests every 18 seconds)
|
|
106
|
+
rateLimit: [15, 18]
|
|
103
107
|
};
|
|
104
108
|
|
|
105
109
|
const mbApi = new MusicBrainzApi(config);
|
package/lib/musicbrainz-api.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export type InstrumentIncludes = MiscIncludes | RelationsIncludes;
|
|
|
39
39
|
export type LabelIncludes = MiscIncludes | RelationsIncludes | 'releases';
|
|
40
40
|
export type PlaceIncludes = MiscIncludes | RelationsIncludes;
|
|
41
41
|
export type RecordingIncludes = MiscIncludes | RelationsIncludes | SubQueryIncludes | 'artists' | 'releases' | 'isrcs';
|
|
42
|
-
export type ReleaseIncludes = MiscIncludes | SubQueryIncludes | RelationsIncludes | 'artists' | 'collections' | 'labels' | 'recordings' | 'release-groups';
|
|
42
|
+
export type ReleaseIncludes = MiscIncludes | SubQueryIncludes | RelationsIncludes | 'artists' | 'collections' | 'labels' | 'recordings' | 'release-groups' | 'recording-level-rels';
|
|
43
43
|
export type ReleaseGroupIncludes = MiscIncludes | SubQueryIncludes | RelationsIncludes | 'artists' | 'releases';
|
|
44
44
|
export type SeriesIncludes = MiscIncludes | RelationsIncludes;
|
|
45
45
|
export type WorkIncludes = MiscIncludes | RelationsIncludes;
|
|
@@ -64,6 +64,17 @@ export interface IMusicBrainzConfig {
|
|
|
64
64
|
*/
|
|
65
65
|
appContactInfo?: string;
|
|
66
66
|
disableRateLimiting?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Optional rate limit configuration.
|
|
69
|
+
*
|
|
70
|
+
* [maxRequests, periodSeconds]
|
|
71
|
+
*
|
|
72
|
+
* maxRequests The maximum number of allowed requests within the period
|
|
73
|
+
* periodSeconds The time window in seconds during which requests are counted
|
|
74
|
+
*
|
|
75
|
+
* Default is [15, 18], which allows up to 15 requests every 18 seconds
|
|
76
|
+
*/
|
|
77
|
+
rateLimit?: [number, number];
|
|
67
78
|
}
|
|
68
79
|
interface IInternalConfig extends IMusicBrainzConfig {
|
|
69
80
|
baseUrl: string;
|
package/lib/musicbrainz-api.js
CHANGED
|
@@ -36,7 +36,8 @@ export class MusicBrainzApi {
|
|
|
36
36
|
..._config
|
|
37
37
|
};
|
|
38
38
|
this.httpClient = this.initHttpClient();
|
|
39
|
-
this.
|
|
39
|
+
const limits = this.config.rateLimit ?? [15, 18];
|
|
40
|
+
this.rateLimiter = new RateLimitThreshold(limits[0], limits[1]);
|
|
40
41
|
}
|
|
41
42
|
initHttpClient() {
|
|
42
43
|
return new HttpClient({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "musicbrainz-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "MusicBrainz API client for reading and submitting metadata",
|
|
5
5
|
"exports": {
|
|
6
6
|
"node": {
|
|
@@ -61,16 +61,16 @@
|
|
|
61
61
|
"uuid": "^13.0.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@biomejs/biome": "2.3.
|
|
64
|
+
"@biomejs/biome": "2.3.8",
|
|
65
65
|
"@types/chai": "^5.0.0",
|
|
66
66
|
"@types/jsontoxml": "^1.0.5",
|
|
67
67
|
"@types/mocha": "^10.0.4",
|
|
68
68
|
"@types/node": "^24.0.3",
|
|
69
|
-
"@types/sinon": "^
|
|
69
|
+
"@types/sinon": "^21.0.0",
|
|
70
70
|
"@types/source-map-support": "^0",
|
|
71
71
|
"@types/spark-md5": "^3",
|
|
72
72
|
"@types/tough-cookie": "^4.0.5",
|
|
73
|
-
"@types/uuid": "^
|
|
73
|
+
"@types/uuid": "^11.0.0",
|
|
74
74
|
"c8": "^10.1.2",
|
|
75
75
|
"chai": "^6.2.0",
|
|
76
76
|
"del-cli": "^7.0.0",
|