discogs-marketplace-api-nodejs 1.6.0 → 1.7.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 -18
- package/dist/data/index.d.ts +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -1
- package/dist/marketplace.d.ts +2 -1
- package/dist/marketplace.js +41 -25
- package/dist/types/commons/index.d.ts +4 -4
- package/dist/types/commons/input.type.d.ts +3 -3
- package/dist/types/commons/output-sucess.type.d.ts +1 -1
- package/dist/types/unions/index.d.ts +12 -12
- package/package.json +24 -17
package/README.MD
CHANGED
|
@@ -16,10 +16,10 @@ Import `DiscogsMarketplace` into your project:
|
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
18
|
// With ECMAScript 6 and +
|
|
19
|
-
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
19
|
+
import { DiscogsMarketplace } from 'discogs-marketplace-api-nodejs'
|
|
20
20
|
|
|
21
21
|
// With CommonJS
|
|
22
|
-
const DiscogsMarketplace = require('discogs-marketplace-api-nodejs').
|
|
22
|
+
const DiscogsMarketplace = require('discogs-marketplace-api-nodejs').DiscogsMarketplace
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
## Examples
|
|
@@ -27,8 +27,6 @@ const DiscogsMarketplace = require('discogs-marketplace-api-nodejs').default
|
|
|
27
27
|
- Get top 250 items, of the 2nd page, filtered by Rock, listed by newest, for a given artist
|
|
28
28
|
|
|
29
29
|
```js
|
|
30
|
-
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
31
|
-
|
|
32
30
|
// https://www.discogs.com/sell/list?sort=listed,desc&limit=250&artist_id=244819&page=2&genre=Rock
|
|
33
31
|
const result = await DiscogsMarketplace.search({
|
|
34
32
|
limit: 250,
|
|
@@ -43,8 +41,6 @@ const result = await DiscogsMarketplace.search({
|
|
|
43
41
|
- Get top 50 items, of the 1st page, listed by price lowest, on a user wantlist
|
|
44
42
|
|
|
45
43
|
```js
|
|
46
|
-
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
47
|
-
|
|
48
44
|
// https://www.discogs.com/sell/mywants?limit=50&user=Kirian_&sort=price,asc
|
|
49
45
|
const result = await DiscogsMarketplace.search({
|
|
50
46
|
limit: 50,
|
|
@@ -57,8 +53,6 @@ const result = await DiscogsMarketplace.search({
|
|
|
57
53
|
- Get top 25 items, of the 1st page, listed by seller A-Z, on a release
|
|
58
54
|
|
|
59
55
|
```js
|
|
60
|
-
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
61
|
-
|
|
62
56
|
// https://www.discogs.com/sell/release/767931?sort=seller,asc&limit=25&page=1
|
|
63
57
|
const result = await DiscogsMarketplace.search({
|
|
64
58
|
sort: 'Seller A-Z',
|
|
@@ -70,8 +64,6 @@ const result = await DiscogsMarketplace.search({
|
|
|
70
64
|
- Get top 100 items, of the 1st page, listed by newest, on a string search
|
|
71
65
|
|
|
72
66
|
```js
|
|
73
|
-
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
74
|
-
|
|
75
67
|
// https://www.discogs.com/sell/list?sort=listed,desc&limit=100&q=in+flames&page=1
|
|
76
68
|
const result = await DiscogsMarketplace.search({
|
|
77
69
|
limit: 100,
|
|
@@ -84,8 +76,6 @@ const result = await DiscogsMarketplace.search({
|
|
|
84
76
|
- Get top 25 items, of the 1st page, listed by newest, on a seller inventory
|
|
85
77
|
|
|
86
78
|
```js
|
|
87
|
-
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
88
|
-
|
|
89
79
|
// https://www.discogs.com/seller/Kirian_/profile?sort=listed,desc&limit=25&page=1
|
|
90
80
|
const result = await DiscogsMarketplace.search({
|
|
91
81
|
sort: 'Listed Newest',
|
|
@@ -98,8 +88,6 @@ const result = await DiscogsMarketplace.search({
|
|
|
98
88
|
- Get top 25 items, of the 1st page, listed by newest, on a user wantlist, on a seller inventory
|
|
99
89
|
|
|
100
90
|
```js
|
|
101
|
-
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
102
|
-
|
|
103
91
|
// https://www.discogs.com/seller/Kirian_/mywants?sort=listed,desc&limit=25&user=Kirian_&page=1
|
|
104
92
|
const result = await DiscogsMarketplace.search({
|
|
105
93
|
sort: 'Listed Newest',
|
|
@@ -114,7 +102,7 @@ const result = await DiscogsMarketplace.search({
|
|
|
114
102
|
You can provide parameters to `DiscogsMarketplace.search` function according to this type:
|
|
115
103
|
|
|
116
104
|
```ts
|
|
117
|
-
type
|
|
105
|
+
type InputType = {
|
|
118
106
|
/**
|
|
119
107
|
* Type of elements to search.
|
|
120
108
|
* Default to `q`.
|
|
@@ -283,13 +271,11 @@ type OutputErrorType = {
|
|
|
283
271
|
}
|
|
284
272
|
```
|
|
285
273
|
|
|
286
|
-
Other interfaces can be found in `src/interfaces`.
|
|
287
|
-
|
|
288
274
|
## How to contribute
|
|
289
275
|
|
|
290
276
|
There is a [devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) on that project already configured, feel free to use it.
|
|
291
277
|
|
|
292
|
-
|
|
278
|
+
Install dependecies with:
|
|
293
279
|
|
|
294
280
|
```sh
|
|
295
281
|
npm install
|
package/dist/data/index.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { InputType, OutputErrorType, OutputSuccessType } from './types/commons/index.js';
|
|
1
|
+
import type { InputType, OutputErrorType, OutputSuccessType } from './types/commons/index.js';
|
|
2
2
|
import DiscogsMarketplace from './marketplace.js';
|
|
3
|
-
export { InputType, OutputErrorType, OutputSuccessType
|
|
4
|
-
export default DiscogsMarketplace;
|
|
3
|
+
export { DiscogsMarketplace, InputType, OutputErrorType, OutputSuccessType };
|
package/dist/index.js
CHANGED
|
@@ -3,5 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DiscogsMarketplace = void 0;
|
|
6
7
|
const marketplace_1 = __importDefault(require("./marketplace.js"));
|
|
7
|
-
exports.
|
|
8
|
+
exports.DiscogsMarketplace = marketplace_1.default;
|
package/dist/marketplace.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { InputType, OutputSuccessType } from './types/commons/index.js';
|
|
1
2
|
/**
|
|
2
3
|
* Discogs Marketplace
|
|
3
4
|
*/
|
|
@@ -6,7 +7,7 @@ export default abstract class Marketplace {
|
|
|
6
7
|
* Search elements on discogs
|
|
7
8
|
* @returns Items found
|
|
8
9
|
*/
|
|
9
|
-
static search({ searchType, searchValue, currency, genre, style, format, formatDescription, condition, year, years, isAudioSample, isMakeAnOfferOnly, from, seller, sort, limit, page, lang, }:
|
|
10
|
+
static search({ searchType, searchValue, currency, genre, style, format, formatDescription, condition, year, years, isAudioSample, isMakeAnOfferOnly, from, seller, sort, limit, page, lang, }: InputType): Promise<OutputSuccessType>;
|
|
10
11
|
/**
|
|
11
12
|
* Generate URL to be parsed
|
|
12
13
|
* @returns Url
|
package/dist/marketplace.js
CHANGED
|
@@ -59,18 +59,22 @@ class Marketplace {
|
|
|
59
59
|
};
|
|
60
60
|
const { data: bodyHTML } = yield axios_1.default.request(config);
|
|
61
61
|
return this.getData((0, linkedom_1.parseHTML)(bodyHTML).document, axios_1.default.getUri(config), {
|
|
62
|
-
searchType,
|
|
62
|
+
searchType,
|
|
63
|
+
searchValue,
|
|
64
|
+
limit,
|
|
65
|
+
page,
|
|
63
66
|
});
|
|
64
67
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
68
|
}
|
|
66
69
|
catch (error) {
|
|
67
70
|
const { response, message } = error;
|
|
68
|
-
if ((response === null || response === void 0 ? void 0 : response.data) && response.status)
|
|
71
|
+
if ((response === null || response === void 0 ? void 0 : response.data) && response.status) {
|
|
69
72
|
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
70
73
|
throw {
|
|
71
74
|
message: (_d = (_c = (_b = (_a = (0, linkedom_1.parseHTML)(response.data).document) === null || _a === void 0 ? void 0 : _a.querySelector('h1 + p')) === null || _b === void 0 ? void 0 : _b.innerHTML) === null || _c === void 0 ? void 0 : _c.trim()) !== null && _d !== void 0 ? _d : 'An error occured',
|
|
72
75
|
code: response.status,
|
|
73
76
|
};
|
|
77
|
+
}
|
|
74
78
|
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
75
79
|
throw {
|
|
76
80
|
message: message || 'An error occured',
|
|
@@ -83,7 +87,7 @@ class Marketplace {
|
|
|
83
87
|
* Generate URL to be parsed
|
|
84
88
|
* @returns Url
|
|
85
89
|
*/
|
|
86
|
-
static generateUrl({ searchType, seller, lang
|
|
90
|
+
static generateUrl({ searchType, seller, lang }) {
|
|
87
91
|
let url = `https://www.discogs.com/${lang}/`;
|
|
88
92
|
if (seller) {
|
|
89
93
|
url += `seller/${seller}/`;
|
|
@@ -104,21 +108,28 @@ class Marketplace {
|
|
|
104
108
|
static serializeParams(params) {
|
|
105
109
|
const param = [];
|
|
106
110
|
// eslint-disable-next-line no-restricted-syntax
|
|
107
|
-
for (const key in params)
|
|
108
|
-
if (params[key] === undefined || params[key] === null)
|
|
111
|
+
for (const key in params) {
|
|
112
|
+
if (params[key] === undefined || params[key] === null) {
|
|
109
113
|
// eslint-disable-next-line no-continue
|
|
110
114
|
continue;
|
|
111
|
-
|
|
115
|
+
}
|
|
116
|
+
else if (Array.isArray(params[key])) {
|
|
112
117
|
/** Custom handle for array */
|
|
113
|
-
if (params[key].length > 0)
|
|
118
|
+
if (params[key].length > 0) {
|
|
114
119
|
// eslint-disable-next-line no-restricted-syntax
|
|
115
|
-
for (const el of params[key])
|
|
120
|
+
for (const el of params[key]) {
|
|
116
121
|
param.push(`${key}=${encodeURIComponent(el)}`);
|
|
117
|
-
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
118
125
|
// eslint-disable-next-line no-continue
|
|
119
126
|
continue;
|
|
120
|
-
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
121
130
|
param.push(`${key}=${encodeURIComponent(params[key])}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
122
133
|
return param.join('&');
|
|
123
134
|
}
|
|
124
135
|
/**
|
|
@@ -128,18 +139,19 @@ class Marketplace {
|
|
|
128
139
|
*/
|
|
129
140
|
static convertCurrency(value) {
|
|
130
141
|
var _a;
|
|
131
|
-
if (!value)
|
|
142
|
+
if (!value) {
|
|
132
143
|
return value;
|
|
144
|
+
}
|
|
133
145
|
const currencyFound = (_a = Object.keys(data_1.CURRENCIES).find(key => value.includes(key))) !== null && _a !== void 0 ? _a : '';
|
|
134
|
-
if (!currencyFound)
|
|
146
|
+
if (!currencyFound) {
|
|
135
147
|
return value;
|
|
148
|
+
}
|
|
136
149
|
const currencyClean = data_1.CURRENCIES[currencyFound];
|
|
137
150
|
const amount = value
|
|
138
151
|
.replace(currencyClean !== 'JPY' ? /[.](?=.*[.])/g : /\./g, '') // Remove all dot but last, except if JPY
|
|
139
152
|
.replace(currencyFound, '') // Remove original currency
|
|
140
153
|
.replace(/\s/g, ''); // Remove spaces
|
|
141
|
-
return `${amount} ${currencyClean}
|
|
142
|
-
.replace(/\s\s+/g, ' '); // Remove useless spaces
|
|
154
|
+
return `${amount} ${currencyClean}`.replace(/\s\s+/g, ' '); // Remove useless spaces
|
|
143
155
|
}
|
|
144
156
|
/**
|
|
145
157
|
* Parse HTML to clean result
|
|
@@ -147,23 +159,24 @@ class Marketplace {
|
|
|
147
159
|
* @param urlGenerated Url generated
|
|
148
160
|
* @returns Items found
|
|
149
161
|
*/
|
|
150
|
-
static getData(document, urlGenerated, { searchType = 'q', searchValue = undefined, limit = 25, page = 1
|
|
162
|
+
static getData(document, urlGenerated, { searchType = 'q', searchValue = undefined, limit = 25, page = 1 }) {
|
|
151
163
|
var _a, _b, _c, _d, _e;
|
|
152
|
-
const totalItems = parseFloat(
|
|
153
|
-
|
|
154
|
-
((_d = (_c = (_b = (_a = document.querySelector('.pagination_total')) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.split(' ')) === null || _c === void 0 ? void 0 : _c.filter((x) => x).pop()) === null || _d === void 0 ? void 0 : _d.replace(/(,|\.|\s)/g, '')) || '0');
|
|
164
|
+
const totalItems = parseFloat(((_d = (_c = (_b = (_a = document
|
|
165
|
+
.querySelector('.pagination_total')) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.split(' ')) === null || _c === void 0 ? void 0 : _c.filter((x) => x).pop()) === null || _d === void 0 ? void 0 : _d.replace(/(,|\.|\s)/g, '')) || '0');
|
|
155
166
|
return {
|
|
156
167
|
items: ((_e = [...document.querySelectorAll('table.table_block tbody tr')]) === null || _e === void 0 ? void 0 : _e.map(el => {
|
|
157
168
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58;
|
|
158
169
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
159
|
-
const shipping = this.convertCurrency((_g = (_f = (_e = (_d = (_c = (_b = (_a = el
|
|
170
|
+
const shipping = this.convertCurrency((_g = (_f = (_e = (_d = (_c = (_b = (_a = el
|
|
171
|
+
.querySelector('.item_shipping')) === null || _a === void 0 ? void 0 : _a.childNodes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.textContent) === null || _d === void 0 ? void 0 : _d.replace(/(\s+|\+)/g, ' ')) === null || _e === void 0 ? void 0 : _e.trim()) === null || _f === void 0 ? void 0 : _f.replace(',', '.')) !== null && _g !== void 0 ? _g : '');
|
|
160
172
|
const have = Number.parseInt((_j = (_h = el.querySelector('.community_summary .community_result:nth-child(1) .community_number')) === null || _h === void 0 ? void 0 : _h.textContent) !== null && _j !== void 0 ? _j : '', 10);
|
|
161
173
|
const want = Number.parseInt((_l = (_k = el.querySelector('.community_summary .community_result:nth-child(2) .community_number')) === null || _k === void 0 ? void 0 : _k.textContent) !== null && _l !== void 0 ? _l : '', 10);
|
|
162
174
|
const countryName = (_q = (_p = (_o = (_m = el.querySelector('.seller_info li:nth-child(3)')) === null || _m === void 0 ? void 0 : _m.textContent) === null || _o === void 0 ? void 0 : _o.split(':')) === null || _p === void 0 ? void 0 : _p.pop()) !== null && _q !== void 0 ? _q : '';
|
|
163
175
|
const countryCode = data_1.COUNTRIES[countryName];
|
|
164
176
|
const releaseId = Number.parseInt((_v = (_u = (_t = (_s = (_r = el.querySelector('a.item_release_link')) === null || _r === void 0 ? void 0 : _r.href.split('release/')) === null || _s === void 0 ? void 0 : _s.pop()) === null || _t === void 0 ? void 0 : _t.split('-')) === null || _u === void 0 ? void 0 : _u.shift()) !== null && _v !== void 0 ? _v : '0', 10);
|
|
165
177
|
const itemId = Number.parseInt((_y = (_x = (_w = el.querySelector('a.item_description_title')) === null || _w === void 0 ? void 0 : _w.href) === null || _x === void 0 ? void 0 : _x.split('/').pop()) !== null && _y !== void 0 ? _y : '0', 10);
|
|
166
|
-
const notes = Number.parseInt((_5 = (_4 = (_3 = (_2 = (_1 = (_0 = (_z = el
|
|
178
|
+
const notes = Number.parseInt((_5 = (_4 = (_3 = (_2 = (_1 = (_0 = (_z = el
|
|
179
|
+
.querySelector('.seller_info li:nth-child(2) .section_link')) === null || _z === void 0 ? void 0 : _z.textContent) === null || _0 === void 0 ? void 0 : _0.replace(/\s+/g, ' ')) === null || _1 === void 0 ? void 0 : _1.trim()) === null || _2 === void 0 ? void 0 : _2.split(' ')) === null || _3 === void 0 ? void 0 : _3[0]) === null || _4 === void 0 ? void 0 : _4.replace(/,/g, '')) !== null && _5 !== void 0 ? _5 : '', 10);
|
|
167
180
|
const originalTitle = (_6 = el.querySelector('a.item_description_title')) === null || _6 === void 0 ? void 0 : _6.textContent;
|
|
168
181
|
const firstIndexOfDash = (_7 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.indexOf(' - ')) !== null && _7 !== void 0 ? _7 : -1;
|
|
169
182
|
const lastIndexOfParenthesis = (_8 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.lastIndexOf(' (')) !== null && _8 !== void 0 ? _8 : -1;
|
|
@@ -176,12 +189,13 @@ class Marketplace {
|
|
|
176
189
|
? (_10 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.substring(firstIndexOfDash + 3, lastIndexOfParenthesis)) !== null && _10 !== void 0 ? _10 : ''
|
|
177
190
|
: '',
|
|
178
191
|
formats: lastIndexOfParenthesis > -1
|
|
179
|
-
? (
|
|
192
|
+
? (_12 = (_11 = originalTitle === null || originalTitle === void 0 ? void 0 : originalTitle.substring(lastIndexOfParenthesis + 2, originalTitle.length - 1)) === null || _11 === void 0 ? void 0 : _11.split(', ')) !== null && _12 !== void 0 ? _12 : []
|
|
180
193
|
: [],
|
|
181
194
|
},
|
|
182
195
|
url: `https://www.discogs.com${(_13 = el.querySelector('a.item_description_title')) === null || _13 === void 0 ? void 0 : _13.href}`,
|
|
183
|
-
labels: (_15 = (_14 = [...el.querySelectorAll(
|
|
184
|
-
catnos: (_20 = (_19 = (_18 = (_17 = (_16 = el
|
|
196
|
+
labels: (_15 = (_14 = [...el.querySelectorAll(".label_and_cat a[href^='https://www.discogs.com/']")]) === null || _14 === void 0 ? void 0 : _14.map(x => { var _a; return (_a = x === null || x === void 0 ? void 0 : x.textContent) !== null && _a !== void 0 ? _a : ''; })) === null || _15 === void 0 ? void 0 : _15.filter((value, index, self) => self.indexOf(value) === index),
|
|
197
|
+
catnos: (_20 = (_19 = (_18 = (_17 = (_16 = el
|
|
198
|
+
.querySelector('.label_and_cat .item_catno')) === null || _16 === void 0 ? void 0 : _16.textContent) === null || _17 === void 0 ? void 0 : _17.replace(/\s+/g, ' ')) === null || _18 === void 0 ? void 0 : _18.split(', ')) === null || _19 === void 0 ? void 0 : _19.filter(x => x !== 'none')) !== null && _20 !== void 0 ? _20 : [],
|
|
185
199
|
imageUrl: (_22 = (_21 = el.querySelector('.marketplace_image')) === null || _21 === void 0 ? void 0 : _21.getAttribute('data-src')) !== null && _22 !== void 0 ? _22 : '',
|
|
186
200
|
description: (_27 = (_26 = (_25 = (_24 = (_23 = el.querySelector('.item_condition')) === null || _23 === void 0 ? void 0 : _23.nextElementSibling) === null || _24 === void 0 ? void 0 : _24.textContent) === null || _25 === void 0 ? void 0 : _25.replace(/\s+/g, ' ')) === null || _26 === void 0 ? void 0 : _26.trim()) !== null && _27 !== void 0 ? _27 : '',
|
|
187
201
|
isAcceptingOffer: ((_31 = (_30 = (_29 = (_28 = el.querySelector('.item_add_to_cart p a strong')) === null || _28 === void 0 ? void 0 : _28.textContent) === null || _29 === void 0 ? void 0 : _29.split('/')) === null || _30 === void 0 ? void 0 : _30.length) !== null && _31 !== void 0 ? _31 : 0) > 1,
|
|
@@ -189,11 +203,13 @@ class Marketplace {
|
|
|
189
203
|
condition: {
|
|
190
204
|
media: {
|
|
191
205
|
full: (_36 = (_35 = (_34 = (_33 = el.querySelector('.item_condition span:nth-child(3)')) === null || _33 === void 0 ? void 0 : _33.textContent) === null || _34 === void 0 ? void 0 : _34.replace(/\s+/g, ' ')) === null || _35 === void 0 ? void 0 : _35.trim()) !== null && _36 !== void 0 ? _36 : '',
|
|
192
|
-
short: (_42 = (_41 = (_40 = (_39 = (_38 = (_37 = el
|
|
206
|
+
short: (_42 = (_41 = (_40 = (_39 = (_38 = (_37 = el
|
|
207
|
+
.querySelector('.item_condition span:nth-child(3)')) === null || _37 === void 0 ? void 0 : _37.textContent) === null || _38 === void 0 ? void 0 : _38.replace(/\s+/g, ' ')) === null || _39 === void 0 ? void 0 : _39.trim()) === null || _40 === void 0 ? void 0 : _40.match(/\(([^)]+)\)/)) === null || _41 === void 0 ? void 0 : _41[1]) !== null && _42 !== void 0 ? _42 : '',
|
|
193
208
|
},
|
|
194
209
|
sleeve: {
|
|
195
210
|
full: (_44 = (_43 = el.querySelector('.item_condition span.item_sleeve_condition')) === null || _43 === void 0 ? void 0 : _43.textContent) !== null && _44 !== void 0 ? _44 : '',
|
|
196
|
-
short: (_48 = (_47 = (_46 = (_45 = el
|
|
211
|
+
short: (_48 = (_47 = (_46 = (_45 = el
|
|
212
|
+
.querySelector('.item_condition span.item_sleeve_condition')) === null || _45 === void 0 ? void 0 : _45.textContent) === null || _46 === void 0 ? void 0 : _46.match(/\(([^)]+)\)/)) === null || _47 === void 0 ? void 0 : _47[1]) !== null && _48 !== void 0 ? _48 : '',
|
|
197
213
|
},
|
|
198
214
|
},
|
|
199
215
|
seller: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import InputType from '../../types/commons/input.type.js';
|
|
2
|
-
import OutputErrorType from '../../types/commons/output-error.type.js';
|
|
3
|
-
import OutputSuccessType from '../../types/commons/output-sucess.type.js';
|
|
4
|
-
export { InputType, OutputErrorType, OutputSuccessType
|
|
1
|
+
import type InputType from '../../types/commons/input.type.js';
|
|
2
|
+
import type OutputErrorType from '../../types/commons/output-error.type.js';
|
|
3
|
+
import type OutputSuccessType from '../../types/commons/output-sucess.type.js';
|
|
4
|
+
export { InputType, OutputErrorType, OutputSuccessType };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { LimitType, GenreType, CurrencyType, FromType, StyleType, FormatType, ConditionType, SortType, LangType, FormatDescriptionType, SearchTypeType } from '../../types/unions/index.js';
|
|
1
|
+
import type { LimitType, GenreType, CurrencyType, FromType, StyleType, FormatType, ConditionType, SortType, LangType, FormatDescriptionType, SearchTypeType } from '../../types/unions/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Element that can be provided by user
|
|
4
4
|
*/
|
|
5
|
-
type
|
|
5
|
+
type InputType = {
|
|
6
6
|
/**
|
|
7
7
|
* Type of elements to search.
|
|
8
8
|
* Default to `q`.
|
|
@@ -92,4 +92,4 @@ type InputCommonType = {
|
|
|
92
92
|
*/
|
|
93
93
|
lang?: LangType;
|
|
94
94
|
};
|
|
95
|
-
export default
|
|
95
|
+
export default InputType;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import LimitType from '../../types/unions/limit.type.js';
|
|
2
|
-
import GenreType from '../../types/unions/genre.type.js';
|
|
3
|
-
import CurrencyType from '../../types/unions/currency.type.js';
|
|
4
|
-
import FromType from '../../types/unions/from.type.js';
|
|
5
|
-
import StyleType from '../../types/unions/style.type.js';
|
|
6
|
-
import FormatType from '../../types/unions/format.type.js';
|
|
7
|
-
import ConditionType from '../../types/unions/condition.type.js';
|
|
8
|
-
import SortType from '../../types/unions/sort.type.js';
|
|
9
|
-
import LangType from '../../types/unions/lang.type.js';
|
|
10
|
-
import FormatDescriptionType from '../../types/unions/format-description.type.js';
|
|
11
|
-
import SearchTypeType from '../../types/unions/search-type.type.js';
|
|
12
|
-
export { LimitType, GenreType, CurrencyType, FromType, StyleType, FormatType, ConditionType, SortType, LangType, FormatDescriptionType, SearchTypeType, };
|
|
1
|
+
import type LimitType from '../../types/unions/limit.type.js';
|
|
2
|
+
import type GenreType from '../../types/unions/genre.type.js';
|
|
3
|
+
import type CurrencyType from '../../types/unions/currency.type.js';
|
|
4
|
+
import type FromType from '../../types/unions/from.type.js';
|
|
5
|
+
import type StyleType from '../../types/unions/style.type.js';
|
|
6
|
+
import type FormatType from '../../types/unions/format.type.js';
|
|
7
|
+
import type ConditionType from '../../types/unions/condition.type.js';
|
|
8
|
+
import type SortType from '../../types/unions/sort.type.js';
|
|
9
|
+
import type LangType from '../../types/unions/lang.type.js';
|
|
10
|
+
import type FormatDescriptionType from '../../types/unions/format-description.type.js';
|
|
11
|
+
import type SearchTypeType from '../../types/unions/search-type.type.js';
|
|
12
|
+
export type { LimitType, GenreType, CurrencyType, FromType, StyleType, FormatType, ConditionType, SortType, LangType, FormatDescriptionType, SearchTypeType, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "discogs-marketplace-api-nodejs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Another (better ?) NodeJs library to fetch data from Discog's marketplace",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"discogs",
|
|
@@ -21,32 +21,39 @@
|
|
|
21
21
|
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
22
22
|
"start:dev": "nodemon -r tsconfig-paths/register ./src/index.ts",
|
|
23
23
|
"test": "jest",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"eslint:fix": "eslint src test --ext .ts,.js --fix",
|
|
25
|
+
"eslint": "eslint src test --ext .ts,.js",
|
|
26
|
+
"prettier": "prettier --check .",
|
|
27
|
+
"prettier:fix": "prettier --write ."
|
|
26
28
|
},
|
|
27
29
|
"main": "dist/index.js",
|
|
28
30
|
"types": "dist/index.d.ts",
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=14.0.0"
|
|
33
|
+
},
|
|
29
34
|
"dependencies": {
|
|
30
|
-
"axios": "^1.
|
|
31
|
-
"linkedom": "^0.14.
|
|
32
|
-
"user-agents": "^1.0.
|
|
35
|
+
"axios": "^1.4.0",
|
|
36
|
+
"linkedom": "^0.14.26",
|
|
37
|
+
"user-agents": "^1.0.1381"
|
|
33
38
|
},
|
|
34
39
|
"devDependencies": {
|
|
35
|
-
"@types/jest": "^29.
|
|
36
|
-
"@types/node": "^18.
|
|
40
|
+
"@types/jest": "^29.5.1",
|
|
41
|
+
"@types/node": "^18.16.10",
|
|
37
42
|
"@types/user-agents": "^1.0.2",
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
39
|
-
"@typescript-eslint/parser": "^5.
|
|
40
|
-
"eslint": "^8.
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^5.59.6",
|
|
44
|
+
"@typescript-eslint/parser": "^5.59.6",
|
|
45
|
+
"eslint": "^8.40.0",
|
|
41
46
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
42
47
|
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
48
|
+
"eslint-config-prettier": "^8.8.0",
|
|
43
49
|
"eslint-plugin-import": "^2.27.5",
|
|
44
|
-
"eslint-plugin-jsdoc": "^
|
|
45
|
-
"jest": "^29.
|
|
46
|
-
"
|
|
50
|
+
"eslint-plugin-jsdoc": "^44.2.4",
|
|
51
|
+
"jest": "^29.5.0",
|
|
52
|
+
"prettier": "^2.8.8",
|
|
53
|
+
"ts-jest": "^29.1.0",
|
|
47
54
|
"ts-node": "^10.9.1",
|
|
48
|
-
"tsc-alias": "^1.8.
|
|
49
|
-
"tsconfig-paths": "^4.
|
|
50
|
-
"typescript": "^
|
|
55
|
+
"tsc-alias": "^1.8.6",
|
|
56
|
+
"tsconfig-paths": "^4.2.0",
|
|
57
|
+
"typescript": "^5.0.4"
|
|
51
58
|
}
|
|
52
59
|
}
|