Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

musicbrainz-api

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

musicbrainz-api - npm Package Compare versions

Comparing version 0.7.2 to 0.8.0

.idea/shelf/Uncommitted_changes_before_Checkout_at_28-2-2022_22_59__Default_Changelist_.xml

7

lib/digest-auth.js

@@ -26,8 +26,3 @@ "use strict";

const ha1 = md5(user + ':' + realm + ':' + pass); // lgtm [js/insufficient-password-hash]
if (algorithm && algorithm.toLowerCase() === 'md5-sess') {
return md5(ha1 + ':' + nonce + ':' + cnonce);
}
else {
return ha1;
}
return algorithm && algorithm.toLowerCase() === 'md5-sess' ? md5(ha1 + ':' + nonce + ':' + cnonce) : ha1;
}

@@ -34,0 +29,0 @@ digest(method, path, authHeader) {

@@ -61,3 +61,3 @@ export { XmlMetadata } from './xml/xml-metadata';

*/
getEntity<T>(entity: mb.EntityType, mbid: string, inc?: Includes[]): Promise<T>;
lookupEntity<T>(entity: mb.EntityType, mbid: string, inc?: Includes[]): Promise<T>;
/**

@@ -68,3 +68,3 @@ * Lookup area

*/
getArea(areaId: string, inc?: Includes[]): Promise<mb.IArea>;
lookupArea(areaId: string, inc?: Includes[]): Promise<mb.IArea>;
/**

@@ -75,4 +75,22 @@ * Lookup artist

*/
getArtist(artistId: string, inc?: Includes[]): Promise<mb.IArtist>;
lookupArtist(artistId: string, inc?: Includes[]): Promise<mb.IArtist>;
/**
* Lookup instrument
* @param artistId Instrument MBID
* @param inc Sub-queries
*/
lookupInstrument(instrumentId: string, inc?: Includes[]): Promise<mb.IInstrument>;
/**
* Lookup label
* @param labelId Area MBID
* @param inc Sub-queries
*/
lookupLabel(labelId: string, inc?: Includes[]): Promise<mb.ILabel>;
/**
* Lookup place
* @param placeId Area MBID
* @param inc Sub-queries
*/
lookupPlace(placeId: string, inc?: Includes[]): Promise<mb.IPlace>;
/**
* Lookup release

@@ -83,3 +101,3 @@ * @param releaseId Release MBID

*/
getRelease(releaseId: string, inc?: Includes[]): Promise<mb.IRelease>;
lookupRelease(releaseId: string, inc?: Includes[]): Promise<mb.IRelease>;
/**

@@ -90,19 +108,19 @@ * Lookup release-group

*/
getReleaseGroup(releaseGroupId: string, inc?: Includes[]): Promise<mb.IReleaseGroup>;
lookupReleaseGroup(releaseGroupId: string, inc?: Includes[]): Promise<mb.IReleaseGroup>;
/**
* Lookup recording
* @param recordingId Label MBID
* @param inc Include: artist-credits, isrcs
*/
lookupRecording(recordingId: string, inc?: Includes[]): Promise<mb.IRecording>;
/**
* Lookup work
* @param workId Work MBID
*/
getWork(workId: string): Promise<mb.IWork>;
lookupWork(workId: string): Promise<mb.IWork>;
/**
* Lookup label
* @param labelId Label MBID
* Lookup URL
* @param urlId URL MBID
*/
getLabel(labelId: string): Promise<mb.ILabel>;
/**
* Lookup recording
* @param recordingId Label MBID
* @param inc Include: artist-credits, isrcs
*/
getRecording(recordingId: string, inc?: Includes[]): Promise<mb.IRecording>;
lookupUrl(urlId: string): Promise<mb.IUrl>;
postRecording(xmlMetadata: XmlMetadata): Promise<void>;

@@ -109,0 +127,0 @@ post(entity: mb.EntityType, xmlMetadata: XmlMetadata): Promise<void>;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -137,3 +141,3 @@ if (k2 === undefined) k2 = k;

*/
getEntity(entity, mbid, inc = []) {
lookupEntity(entity, mbid, inc = []) {
return this.restGet(`/${entity}/${mbid}`, { inc: inc.join(' ') });

@@ -146,4 +150,4 @@ }

*/
getArea(areaId, inc = []) {
return this.getEntity('area', areaId, inc);
lookupArea(areaId, inc = []) {
return this.lookupEntity('area', areaId, inc);
}

@@ -155,6 +159,30 @@ /**

*/
getArtist(artistId, inc = []) {
return this.getEntity('artist', artistId, inc);
lookupArtist(artistId, inc = []) {
return this.lookupEntity('artist', artistId, inc);
}
/**
* Lookup instrument
* @param artistId Instrument MBID
* @param inc Sub-queries
*/
lookupInstrument(instrumentId, inc = []) {
return this.lookupEntity('instrument', instrumentId, inc);
}
/**
* Lookup label
* @param labelId Area MBID
* @param inc Sub-queries
*/
lookupLabel(labelId, inc = []) {
return this.lookupEntity('label', labelId, inc);
}
/**
* Lookup place
* @param placeId Area MBID
* @param inc Sub-queries
*/
lookupPlace(placeId, inc = []) {
return this.lookupEntity('place', placeId, inc);
}
/**
* Lookup release

@@ -165,4 +193,4 @@ * @param releaseId Release MBID

*/
getRelease(releaseId, inc = []) {
return this.getEntity('release', releaseId, inc);
lookupRelease(releaseId, inc = []) {
return this.lookupEntity('release', releaseId, inc);
}

@@ -174,26 +202,26 @@ /**

*/
getReleaseGroup(releaseGroupId, inc = []) {
return this.getEntity('release-group', releaseGroupId, inc);
lookupReleaseGroup(releaseGroupId, inc = []) {
return this.lookupEntity('release-group', releaseGroupId, inc);
}
/**
* Lookup work
* @param workId Work MBID
* Lookup recording
* @param recordingId Label MBID
* @param inc Include: artist-credits, isrcs
*/
getWork(workId) {
return this.getEntity('work', workId);
lookupRecording(recordingId, inc = []) {
return this.lookupEntity('recording', recordingId, inc);
}
/**
* Lookup label
* @param labelId Label MBID
* Lookup work
* @param workId Work MBID
*/
getLabel(labelId) {
return this.getEntity('label', labelId);
lookupWork(workId) {
return this.lookupEntity('work', workId);
}
/**
* Lookup recording
* @param recordingId Label MBID
* @param inc Include: artist-credits, isrcs
* Lookup URL
* @param urlId URL MBID
*/
getRecording(recordingId, inc = []) {
return this.getEntity('recording', recordingId, inc);
lookupUrl(urlId) {
return this.lookupEntity('url', urlId);
}

@@ -200,0 +228,0 @@ async postRecording(xmlMetadata) {

@@ -8,4 +8,6 @@ import DateTimeFormat = Intl.DateTimeFormat;

}
export interface IArea {
export interface IEntity {
id: string;
}
export interface IArea extends IEntity {
'iso-3166-1-codes': string[];

@@ -16,3 +18,3 @@ name: string;

}
export interface IAlias {
export interface IAlias extends IEntity {
name: string;

@@ -31,4 +33,3 @@ 'sort-name': string;

}
export interface IArtist {
id: string;
export interface IArtist extends IEntity {
name: string;

@@ -61,5 +62,21 @@ disambiguation: string;

}
export interface IEvent extends IEntity {
cancelled: boolean;
type: string;
'life-span': IPeriod;
disambiguation: string;
'type-id': string;
time: string;
setlist: string;
name: string;
}
export interface IInstrument extends IEntity {
disambiguation: string;
name: string;
'type-id': string;
type: string;
description: string;
}
export declare type ReleaseQuality = 'normal';
export interface IRelease {
id: string;
export interface IRelease extends IEntity {
title: string;

@@ -92,4 +109,3 @@ 'text-representation': {

export declare type MediaFormatType = 'Digital Media';
export interface IRecording {
id: string;
export interface IRecording extends IEntity {
video: boolean;

@@ -100,3 +116,3 @@ length: number;

isrcs?: string[];
releases?: IRelease;
releases?: IRelease[];
relations?: IRelation[];

@@ -106,7 +122,6 @@ 'artist-credit'?: IArtistCredit[];

}
export interface ITrack {
id: string;
export interface ITrack extends IEntity {
position: number;
recording: IRecording;
number: string;
'number': string;
length: number;

@@ -120,6 +135,6 @@ title: string;

'format-id': string;
'tracks': ITrack[];
tracks: ITrack[];
'track-count': number;
'track-offset': number;
'position': number;
position: number;
}

@@ -133,4 +148,3 @@ export interface ICoverArtArchive {

}
export interface IReleaseGroup {
id: string;
export interface IReleaseGroup extends IEntity {
count: number;

@@ -140,5 +154,7 @@ title: string;

'sort-name': string;
'artist-credit': [{
'artist-credit': {
artist: IArtist;
}];
name: string;
joinphrase: string;
}[];
releases?: IRelease[];

@@ -176,3 +192,3 @@ }

export interface IRelation {
'attribute-ids': {};
'attribute-ids': any;
direction: RelationDirection;

@@ -189,24 +205,21 @@ 'target-credit': string;

'type-id': string;
url?: IURL;
url?: IUrl;
release?: IRelease;
}
export interface IURL {
id: string;
resource: string;
}
export interface IRelationList {
relations: IRelation[];
}
export interface IWork {
id: string;
export interface IWork extends IEntity {
title: string;
}
export interface ILabel {
id: string;
export interface ILabel extends IEntity {
name: string;
}
export interface IUrl {
export interface IPlace extends IEntity {
name: string;
}
export interface IUrl extends IEntity {
id: string;
resource: string;
'relation-list': IRelationList[];
'relation-list'?: IRelationList[];
}

@@ -218,3 +231,3 @@ export interface IUrlMatch extends IMatch, IUrl {

}
export interface IIsrcSearchResult {
export interface IIsrcSearchResult extends ISearchResult {
'isrc': string;

@@ -221,0 +234,0 @@ 'recordings': IRecording[];

{
"name": "musicbrainz-api",
"version": "0.7.2",
"version": "0.8.0",
"description": "MusicBrainz API client for reading and submitting metadata",

@@ -27,17 +27,2 @@ "main": "lib/musicbrainz-api",

"private": false,
"devDependencies": {
"@types/chai": "^4.2.5",
"@types/mocha": "^9.0.0",
"@types/node": "^17.0.8",
"chai": "^4.2.0",
"coveralls": "^3.0.9",
"del-cli": "^4.0.1",
"mocha": "^9.0.1",
"nyc": "^15.0.0",
"remark-cli": "^10.0.1",
"remark-preset-lint-recommended": "^6.1.2",
"ts-node": "^10.0.0",
"tslint": "^6.1.1",
"typescript": "^4.0.2"
},
"engines": {

@@ -67,10 +52,34 @@ "node": "*"

},
"devDependencies": {
"@types/chai": "^4.3.0",
"@types/mocha": "^9.0.0",
"@types/node": "^17.0.8",
"@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0",
"chai": "^4.2.0",
"coveralls": "^3.0.9",
"del-cli": "^4.0.1",
"eslint": "^8.10.0",
"eslint-config-prettier": "^8.4.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jsdoc": "^37.9.5",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-unicorn": "^41.0.0",
"mocha": "^9.0.1",
"nyc": "^15.0.0",
"remark-cli": "^10.0.1",
"remark-preset-lint-recommended": "^6.1.2",
"ts-node": "^10.0.0",
"tslint": "^6.1.1",
"typescript": "^4.0.2"
},
"scripts": {
"clean": "del-cli lib/** src/**/*.js src/**/*.js.map src/**/*.d.ts test/**/*.js test/**/*.js.map",
"clean": "del-cli src/**/*.js src/**/*.js.map src/**/*.d.ts test/**/*.js test/**/*.js.map",
"compile-src": "tsc -p src",
"compile-test": "tsc -p test",
"compile": "npm run compile-src && npm run compile-test",
"lint-ts": "tslint 'src/**/*.ts' --exclude 'src/**/*.d.ts' 'test/**/*.ts' --exclude 'test/**/*.d.ts'",
"eslint": "eslint src/**/*.ts --ignore-pattern src/**/*.d.ts test/**/*.ts",
"lint-md": "remark -u preset-lint-recommended .",
"lint": "npm run lint-md && npm run lint-ts",
"lint": "npm run lint-md && npm run eslint",
"test": "mocha --require ts-node/register --require source-map-support/register --full-trace test/test-*.ts",

@@ -85,3 +94,2 @@ "build": "npm run clean && npm run compile",

"exclude": [
"lib/**",
"test/**/*.ts",

@@ -88,0 +96,0 @@ "src/**/*.js"

@@ -97,3 +97,3 @@ [![Node.js CI](https://github.com/Borewit/musicbrainz-api/actions/workflows/nodejs-ci.yml/badge.svg)](https://github.com/Borewit/musicbrainz-api/actions/workflows/nodejs-ci.yml)

```js
const artist = await mbApi.getEntity('artist', {query: 'ab2528d9-719f-4261-8098-21849222a0f2'});
const artist = await mbApi.lookupEntity('artist', {query: 'ab2528d9-719f-4261-8098-21849222a0f2'});
```

@@ -104,3 +104,3 @@

```js
const area = await mbApi.getArea({query: 'ab2528d9-719f-4261-8098-21849222a0f2'});
const area = await mbApi.lookupArea({query: 'ab2528d9-719f-4261-8098-21849222a0f2'});
```

@@ -113,14 +113,30 @@

```js
const artist = await mbApi.getArtist({query: 'ab2528d9-719f-4261-8098-21849222a0f2'});
const artist = await mbApi.lookupArtist({query: 'ab2528d9-719f-4261-8098-21849222a0f2'});
```
or use the browse API:
### Lookup instrument
Lookup an instrument
```js
const artist = await mbApi.getArtist({artist: 'ab2528d9-719f-4261-8098-21849222a0f2'});
const artist = await mbApi.lookupInstrument({query: 'b3eac5f9-7859-4416-ac39-7154e2e8d348'});
```
### Lookup label
Lookup a label
```js
const artist = await mbApi.lookupInstrument({query: '25dda9f9-f069-4898-82f0-59330a106c7f'});
```
### Lookup place
```js
const artist = await mbApi.lookupPlace({query: 'e6cfb74d-d69b-44c3-b890-1b3f509816e4'});
```
The second argument can be used to pass [subqueries](https://wiki.musicbrainz.org/Development/XML_Web_Service/Version_2#Subqueries), which will return more (nested) information:
```js
const artist = await mbApi.getArtist('ab2528d9-719f-4261-8098-21849222a0f2', ['releases', 'recordings', 'url-rels']);
const artist = await mbApi.lookupArtist('ab2528d9-719f-4261-8098-21849222a0f2', ['releases', 'recordings', 'url-rels']);
```

@@ -132,3 +148,3 @@

```js
const artist = await mbApi.getRecording({query: '16afa384-174e-435e-bfa3-5591accda31c'}, ['artists', 'url-rels']);
const artist = await mbApi.lookupRecording({query: '16afa384-174e-435e-bfa3-5591accda31c'}, ['artists', 'url-rels']);
```

@@ -138,3 +154,3 @@

```js
const release = await mbApi.getRelease({query: '976e0677-a480-4a5e-a177-6a86c1900bbf'}, ['artists', 'url-rels']);
const release = await mbApi.lookupRelease({query: '976e0677-a480-4a5e-a177-6a86c1900bbf'}, ['artists', 'url-rels']);
```

@@ -144,3 +160,3 @@

```js
const releaseGroup = await mbApi.getReleaseGroup({query: '19099ea5-3600-4154-b482-2ec68815883e'});
const releaseGroup = await mbApi.lookupReleaseGroup({query: '19099ea5-3600-4154-b482-2ec68815883e'});
```

@@ -150,5 +166,10 @@

```js
const work = await mbApi.getWork({query: 'b2aa02f4-6c95-43be-a426-aedb9f9a3805'});
const work = await mbApi.lookupWork({query: 'b2aa02f4-6c95-43be-a426-aedb9f9a3805'});
```
### Lookup URL
```js
const url = await mbApi.lookupUrl({query: 'c69556a6-7ded-4c54-809c-afb45a1abe7d'});
```
## Search (query)

@@ -261,3 +282,3 @@

const recording = await mbApi.getRecording(mbid_Formidable);
const recording = await mbApi.lookupRecording(mbid_Formidable);

@@ -275,3 +296,3 @@ // Authentication the http-session against MusicBrainz (as defined in config.baseUrl)

```js
const recording = await mbApi.getRecording('16afa384-174e-435e-bfa3-5591accda31c');
const recording = await mbApi.lookupRecording('16afa384-174e-435e-bfa3-5591accda31c');

@@ -289,3 +310,3 @@ const succeed = await mbApi.login();

```js
const recording = await mbApi.getRecording('16afa384-174e-435e-bfa3-5591accda31c');
const recording = await mbApi.lookupRecording('16afa384-174e-435e-bfa3-5591accda31c');

@@ -292,0 +313,0 @@ const succeed = await mbApi.login();

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc