discogs-marketplace-api-nodejs 1.9.1 → 1.9.3

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
@@ -1,4 +1,6 @@
1
- # Discogs Marketplace API NodeJS · [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/KirianCaumes/Discogs-Marketplace-API-NodeJS/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/discogs-marketplace-api-nodejs.svg?style=flat)](https://www.npmjs.com/package/discogs-marketplace-api-nodejs)
1
+ # Discogs Marketplace API NodeJS
2
+
3
+ [![NPM Version](https://img.shields.io/npm/v/discogs-marketplace-api-nodejs?logo=npm&color=CB3837)](https://www.npmjs.com/package/discogs-marketplace-api-nodejs) ![GitHub Repo stars](https://img.shields.io/github/stars/KirianCaumes/Discogs-Marketplace-API-NodeJS?style=flat&logo=github&label=Stars&color=%23181717) [![GitHub License](https://img.shields.io/github/license/KirianCaumes/Discogs-Marketplace-API-NodeJS?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI%2FPg0KPHN2ZyBmaWxsPSIjZmZmIiBhcmlhLWhpZGRlbj0idHJ1ZSIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2IiB2ZXJzaW9uPSIxLjEiIHdpZHRoPSIxNiIgZGF0YS12aWV3LWNvbXBvbmVudD0idHJ1ZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgPg0KICAgIDxwYXRoIGQ9Ik04Ljc1Ljc1VjJoLjk4NWMuMzA0IDAgLjYwMy4wOC44NjcuMjMxbDEuMjkuNzM2Yy4wMzguMDIyLjA4LjAzMy4xMjQuMDMzaDIuMjM0YS43NS43NSAwIDAgMSAw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A0LjVIMS43NWEuNzUuNzUgMCAwIDEgMC0xLjVoMi4yMzRhLjI0OS4yNDkgMCAwIDAgLjEyNS0uMDMzbDEuMjg4LS43MzdjLjI2NS0uMTUuNTY0LS4yMy44NjktLjIzaC45ODRWLjc1YS43NS43NSAwIDAgMSAxLjUgMFptMi45NDUgOC40NzdjLjI4NS4xMzUuNzE4LjI3MyAxLjMwNS4yNzNzMS4wMi0uMTM4IDEuMzA1LS4yNzNMMTMgNi4zMjdabS0xMCAwYy4yODUuMTM1LjcxOC4yNzMgMS4zMDUuMjczczEuMDItLjEzOCAxLjMwNS0uMjczTDMgNi4zMjdaIj48L3BhdGg%2BDQo8L3N2Zz4%3D&logoColor=fff&label=License)](https://github.com/KirianCaumes/Discogs-Marketplace-API-NodeJS/blob/master/LICENSE) [![Support this project](https://img.shields.io/badge/Support%20this%20project-003087?logo=PayPal&logoColor=fff)](https://www.paypal.me/KirianCaumes)
2
4
 
3
5
  Another (better ?) NodeJs library to fetch data from Discogs marketplace. 💿
4
6
 
@@ -41,7 +41,7 @@ class Marketplace {
41
41
  }),
42
42
  ].join('?');
43
43
  /** Result got by different strategy type */
44
- const result = await (async () => {
44
+ const result = await (() => {
45
45
  switch (strategy) {
46
46
  case 'fetch':
47
47
  return this.getResultWithFetch({
@@ -125,13 +125,14 @@ class Marketplace {
125
125
  * @param url Url
126
126
  */
127
127
  static async getResultWithFetch({ input: { page, limit, searchValue, searchType }, dependencies: { url }, }) {
128
- var _a, _b, _c;
128
+ var _a, _b;
129
129
  const { data: bodyHTML, status } = await axios_1.default.get(url, {
130
130
  headers: {
131
131
  // cspell: disable-next-line
132
132
  'X-PJAX': 'true',
133
133
  'User-Agent': new user_agents_1.default({ platform: 'Win32' }).toString(),
134
134
  },
135
+ validateStatus: () => true,
135
136
  });
136
137
  /** Generate document */
137
138
  const { document } = (0, linkedom_1.parseHTML)(bodyHTML);
@@ -139,7 +140,7 @@ class Marketplace {
139
140
  if (status >= 400) {
140
141
  // eslint-disable-next-line @typescript-eslint/no-throw-literal
141
142
  throw {
142
- message: (_c = (_b = (_a = document === null || document === void 0 ? void 0 : document.querySelector('h1 + p')) === null || _a === void 0 ? void 0 : _a.innerHTML) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : 'An error occurred',
143
+ message: ((_b = (_a = document === null || document === void 0 ? void 0 : document.querySelector('h1 + p')) === null || _a === void 0 ? void 0 : _a.innerHTML) === null || _b === void 0 ? void 0 : _b.trim()) || 'An error occurred',
143
144
  code: status,
144
145
  };
145
146
  }
@@ -155,7 +156,6 @@ class Marketplace {
155
156
  * @param url Url
156
157
  */
157
158
  static async getResultWithBrowser({ input: { page, limit, searchValue, searchType }, dependencies: { url }, }) {
158
- var _a;
159
159
  /** Init browser */
160
160
  const browser = await playwright_chromium_1.chromium.launch({
161
161
  args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-gl-drawing-for-tests'],
@@ -195,7 +195,7 @@ class Marketplace {
195
195
  if (status >= 400) {
196
196
  // eslint-disable-next-line @typescript-eslint/no-throw-literal
197
197
  throw {
198
- message: (_a = (await browserPage.evaluate(() => { var _a, _b; return (_b = (_a = document === null || document === void 0 ? void 0 : document.querySelector('h1 + p')) === null || _a === void 0 ? void 0 : _a.innerHTML) === null || _b === void 0 ? void 0 : _b.trim(); }))) !== null && _a !== void 0 ? _a : 'An error occurred',
198
+ message: (await browserPage.evaluate(() => { var _a, _b; return (_b = (_a = document === null || document === void 0 ? void 0 : document.querySelector('h1 + p')) === null || _a === void 0 ? void 0 : _a.innerHTML) === null || _b === void 0 ? void 0 : _b.trim(); })) || 'An error occurred',
199
199
  code: status,
200
200
  };
201
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "discogs-marketplace-api-nodejs",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
4
4
  "description": "Another (better ?) NodeJs library to fetch data from Discogs marketplace",
5
5
  "keywords": [
6
6
  "discogs",
@@ -31,38 +31,44 @@
31
31
  "main": "dist/index.js",
32
32
  "types": "dist/index.d.ts",
33
33
  "engines": {
34
- "node": ">=14.0.0"
34
+ "node": ">=16.0.0"
35
35
  },
36
+ "funding": [
37
+ {
38
+ "type": "paypal",
39
+ "url": "https://www.paypal.me/KirianCaumes"
40
+ }
41
+ ],
36
42
  "dependencies": {
37
- "axios": "^1.6.5",
38
- "linkedom": "^0.16.6",
39
- "playwright-chromium": "^1.40.1",
40
- "user-agents": "^1.1.75"
43
+ "axios": "^1.6.8",
44
+ "linkedom": "^0.16.11",
45
+ "playwright-chromium": "^1.43.1",
46
+ "user-agents": "^1.1.186"
41
47
  },
42
48
  "devDependencies": {
43
- "@types/jest": "^29.5.11",
44
- "@types/node": "^18.19.4",
49
+ "@types/jest": "^29.5.12",
50
+ "@types/node": "^20.12.7",
45
51
  "@types/user-agents": "^1.0.4",
46
- "@typescript-eslint/eslint-plugin": "^6.17.0",
47
- "@typescript-eslint/parser": "^6.17.0",
48
- "cspell": "^8.3.2",
49
- "eslint": "^8.56.0",
52
+ "@typescript-eslint/eslint-plugin": "^7.7.1",
53
+ "@typescript-eslint/parser": "^7.7.1",
54
+ "cspell": "^8.7.0",
55
+ "eslint": "^8.57.0",
50
56
  "eslint-config-airbnb-base": "^15.0.0",
51
- "eslint-config-airbnb-typescript": "^17.1.0",
57
+ "eslint-config-airbnb-typescript": "^18.0.0",
52
58
  "eslint-config-prettier": "^9.1.0",
53
59
  "eslint-import-resolver-typescript": "^3.6.1",
54
60
  "eslint-plugin-import": "^2.29.1",
55
- "eslint-plugin-jsdoc": "^48.0.2",
56
- "husky": "^8.0.3",
61
+ "eslint-plugin-jsdoc": "^48.2.3",
62
+ "husky": "^9.0.11",
57
63
  "jest": "^29.7.0",
58
- "knip": "^3.12.0",
59
- "lint-staged": "^15.2.0",
60
- "nodemon": "^3.0.2",
61
- "prettier": "^3.1.1",
64
+ "knip": "^5.11.0",
65
+ "lint-staged": "^15.2.2",
66
+ "nodemon": "^3.1.0",
67
+ "prettier": "^3.2.5",
62
68
  "rimraf": "^5.0.5",
63
- "ts-jest": "^29.1.1",
69
+ "ts-jest": "^29.1.2",
64
70
  "tsc-alias": "^1.8.8",
65
71
  "tsconfig-paths": "^4.2.0",
66
- "typescript": "^5.3.3"
72
+ "typescript": "^5.4.5"
67
73
  }
68
74
  }