discogs-marketplace-api-nodejs 1.18.1 → 1.18.2

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
@@ -170,25 +170,37 @@ await context.close()
170
170
  `XAUTHORITY`...), and its language with `LANG` rather than the `locale` option.
171
171
  - **Still blocked?** The IP is the problem: go through a residential proxy (`proxy` option).
172
172
 
173
- On a server, headful Chrome needs a display: run your app under Xvfb (`xvfb-run -a node index.js`). With Docker:
173
+ On a server, headful Chrome needs a display: run your app under Xvfb (`xvfb-run -a node index.js`). With Docker, start
174
+ Xvfb from an entrypoint that then `exec`s your app, so that it gets the stop signal:
174
175
 
175
176
  ```dockerfile
176
177
  FROM node:24-slim
177
178
 
178
179
  RUN apt-get update \
179
- && apt-get install -y --no-install-recommends ca-certificates curl tini xauth xvfb \
180
+ && apt-get install -y --no-install-recommends ca-certificates curl tini xvfb \
180
181
  && rm -rf /var/lib/apt/lists/*
181
182
 
183
+ ENV DISPLAY=:99
184
+
182
185
  WORKDIR /app
183
186
  COPY package*.json ./
184
187
  RUN npm ci && npx patchright install --with-deps chrome
185
188
  COPY . .
186
189
 
187
- # -g passes the stop signal to the app, which xvfb-run does not
188
- ENTRYPOINT ["/usr/bin/tini", "-g", "--", "xvfb-run", "-a"]
190
+ ENTRYPOINT ["/usr/bin/tini", "--", "sh", "/app/entrypoint.sh"]
189
191
  CMD ["node", "index.js"]
190
192
  ```
191
193
 
194
+ ```sh
195
+ # entrypoint.sh
196
+ Xvfb "$DISPLAY" -screen 0 1280x1024x24 -ac -nolisten tcp >/dev/null 2>&1 &
197
+
198
+ # Wait for the display, 6 seconds at most
199
+ for i in $(seq 30); do [ -e "/tmp/.X11-unix/X${DISPLAY#:}" ] && break; sleep 0.2; done
200
+
201
+ exec "$@"
202
+ ```
203
+
192
204
  ## API Reference
193
205
 
194
206
  ### `DiscogsMarketplace.search(searchParams, browserContext?)`
@@ -209,7 +221,7 @@ CMD ["node", "index.js"]
209
221
  | `sleeveConditions` | `SleeveCondition[]` | Filter by sleeve conditions. | `['Mint (M)', 'Generic']` | – |
210
222
  | `from` | `From[]` | Filter by seller’s countries. | `['FR', 'DE']` | – |
211
223
  | `currencies` | `Currency[]` | Filter by currencies. | `['USD', 'EUR']` | – |
212
- | `priceRange.min`/`max` | `number` | Filter by price range. | `{ min: 10, max: 100 }` | – |
224
+ | `priceRange.min`/`max` | `number` | Filter by price range, in US dollars. | `{ min: 10, max: 100 }` | – |
213
225
  | `years.min`/`max` | `number` | Filter by year range. | `{ min: 1980, max: 1990 }` | – |
214
226
  | `sellerRatingMin` | `number (0–100)` | Minimum seller rating (unrated sellers kept). | `99` | `0` |
215
227
  | `sellerRatingCountMin` | `number` | Minimum number of seller ratings. | `50` | `0` |
@@ -286,7 +298,7 @@ interface SearchResult {
286
298
  country: {
287
299
  name: string
288
300
  /** @example 'US' */
289
- code: CountryValues
301
+ code: CountryValues | null
290
302
  }
291
303
  community: {
292
304
  have: number
@@ -9,7 +9,7 @@ declare const Country: {
9
9
  readonly 'Former Czechoslovakia': "CZ";
10
10
  readonly 'Former USSR': "RU";
11
11
  readonly 'France (European Territory)': "FR";
12
- readonly 'French Guyana': "GY";
12
+ readonly 'French Guyana': "GF";
13
13
  readonly 'Guadeloupe (French)': "GP";
14
14
  readonly 'Guam (USA)': "GU";
15
15
  readonly 'Guinea Bissau': "GW";
@@ -34,7 +34,7 @@ declare const Country: {
34
34
  readonly 'Saint Vincent & Grenadines': "VC";
35
35
  readonly 'Slovak Republic': "SK";
36
36
  readonly 'South Korea': "KR";
37
- readonly 'Spain (Canary Islands)': "IC";
37
+ readonly 'Spain (Canary Islands)': "ES";
38
38
  readonly 'Svalbard and Jan Mayen Islands': "SJ";
39
39
  readonly Swaziland: "SZ";
40
40
  readonly Syria: "SY";
@@ -43,7 +43,7 @@ declare const Country: {
43
43
  readonly Tanzania: "TZ";
44
44
  readonly 'United Kingdom': "GB";
45
45
  readonly 'Northern Ireland': "GB";
46
- readonly 'United Kingdom (Channel Islands)': "";
46
+ readonly 'United Kingdom (Channel Islands)': "GB";
47
47
  readonly 'United States': "US";
48
48
  readonly 'USA Minor Outlying Islands': "UM";
49
49
  readonly 'Vatican City State': "VA";
@@ -51,7 +51,7 @@ declare const Country: {
51
51
  readonly Vietnam: "VN";
52
52
  readonly 'Virgin Islands (USA)': "VI";
53
53
  readonly 'Wallis and Futuna Islands': "WF";
54
- readonly Yugoslavia: "GR";
54
+ readonly Yugoslavia: "RS";
55
55
  readonly Zaire: "CD";
56
56
  readonly Afghanistan: "AF";
57
57
  readonly '\u00C5land Islands': "AX";
@@ -279,7 +279,7 @@ const CountryDiscogs = {
279
279
  'Former Czechoslovakia': 'CZ',
280
280
  'Former USSR': 'RU',
281
281
  'France (European Territory)': 'FR',
282
- 'French Guyana': 'GY',
282
+ 'French Guyana': 'GF',
283
283
  'Guadeloupe (French)': 'GP',
284
284
  'Guam (USA)': 'GU',
285
285
  'Guinea Bissau': 'GW',
@@ -296,7 +296,7 @@ const CountryDiscogs = {
296
296
  'New Caledonia (French)': 'NC',
297
297
  'Pitcairn Island': 'PN',
298
298
  'Polynesia (French)': 'PF',
299
- 'Reunion (French)': 'RE', //
299
+ 'Reunion (French)': 'RE',
300
300
  'S. Georgia & S. Sandwich Isls.': 'GS',
301
301
  'Saint Helena': 'SH',
302
302
  'Saint Kitts & Nevis Anguilla': 'KN',
@@ -304,7 +304,7 @@ const CountryDiscogs = {
304
304
  'Saint Vincent & Grenadines': 'VC',
305
305
  'Slovak Republic': 'SK',
306
306
  'South Korea': 'KR',
307
- 'Spain (Canary Islands)': 'IC', //
307
+ 'Spain (Canary Islands)': 'ES',
308
308
  'Svalbard and Jan Mayen Islands': 'SJ',
309
309
  Swaziland: 'SZ',
310
310
  Syria: 'SY',
@@ -313,7 +313,7 @@ const CountryDiscogs = {
313
313
  Tanzania: 'TZ',
314
314
  'United Kingdom': 'GB',
315
315
  'Northern Ireland': 'GB',
316
- 'United Kingdom (Channel Islands)': '',
316
+ 'United Kingdom (Channel Islands)': 'GB',
317
317
  'United States': 'US',
318
318
  'USA Minor Outlying Islands': 'UM',
319
319
  'Vatican City State': 'VA',
@@ -321,7 +321,7 @@ const CountryDiscogs = {
321
321
  Vietnam: 'VN',
322
322
  'Virgin Islands (USA)': 'VI',
323
323
  'Wallis and Futuna Islands': 'WF',
324
- Yugoslavia: 'GR',
324
+ Yugoslavia: 'RS',
325
325
  Zaire: 'CD',
326
326
  };
327
327
  const Country = {
@@ -79,7 +79,7 @@ export interface SearchParams {
79
79
  */
80
80
  currencies?: Array<Currency>;
81
81
  /**
82
- * Price range filter.
82
+ * Price range filter, in US dollars: Discogs converts the price of each listing.
83
83
  */
84
84
  priceRange?: {
85
85
  /** Minimum price */
@@ -114,7 +114,7 @@ export default interface SearchResult {
114
114
  * ISO country code
115
115
  * @example 'US'
116
116
  */
117
- code: CountryValues;
117
+ code: CountryValues | null;
118
118
  };
119
119
  /** Community stats */
120
120
  community: {
@@ -299,7 +299,7 @@ async function scrapeMarketplace({ query, artistIds, labelIds, masterIds, releas
299
299
  },
300
300
  country: {
301
301
  name: node.sellerInfo?.shipsFrom ?? '',
302
- code: country_data_1.default[node.sellerInfo?.shipsFrom],
302
+ code: country_data_1.default[node.sellerInfo?.shipsFrom ?? ''] ?? null,
303
303
  },
304
304
  community: {
305
305
  have: releaseDetail?.inCollectionCount ?? 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "discogs-marketplace-api-nodejs",
3
- "version": "1.18.1",
3
+ "version": "1.18.2",
4
4
  "description": "Another (better ?) NodeJs library to fetch data from Discogs marketplace",
5
5
  "keywords": [
6
6
  "discogs",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@eslint/js": "^9.39.5",
47
- "@types/node": "^24.19.2",
47
+ "@types/node": "^26.6.6",
48
48
  "@typescript-eslint/eslint-plugin": "^8.72.1",
49
49
  "@typescript-eslint/parser": "^8.72.1",
50
50
  "cspell": "^10.4.0",