discogs-marketplace-api-nodejs 1.14.2 → 1.14.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.
@@ -28,6 +28,6 @@ export default interface ShopDetailsResultApi {
28
28
  };
29
29
  /** DiscogsId */
30
30
  discogsId?: number;
31
- }>;
31
+ } | null>;
32
32
  };
33
33
  }
@@ -100,14 +100,19 @@ async function scrape({ currencies, genres, formats, formatDescriptions, conditi
100
100
  throw new Error(detailsResponse.statusText || `An error ${detailsResponse.status} occurred.`);
101
101
  }
102
102
  const detailsResult = (await detailsResponse.json());
103
- const details = Object.fromEntries(detailsResult.data?.releases?.map(release => [
104
- release.discogsId ?? 0,
105
- {
106
- imageUrl: release.images?.edges?.[0]?.node?.thumbnail?.webpUrl ?? null,
107
- want: release.inWantlistCount ?? 0,
108
- have: release.inCollectionCount ?? 0,
109
- },
110
- ]) ?? []);
103
+ const details = Object.fromEntries(detailsResult.data?.releases?.map(release => {
104
+ if (!release?.discogsId) {
105
+ return [0, { imageUrl: null, want: 0, have: 0 }];
106
+ }
107
+ return [
108
+ release.discogsId ?? 0,
109
+ {
110
+ imageUrl: release.images?.edges?.[0]?.node?.thumbnail?.webpUrl ?? null,
111
+ want: release.inWantlistCount ?? 0,
112
+ have: release.inCollectionCount ?? 0,
113
+ },
114
+ ];
115
+ }) ?? []);
111
116
  const items = result.items?.map(item => {
112
117
  const detail = details[item.release?.releaseId ?? 0];
113
118
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "discogs-marketplace-api-nodejs",
3
- "version": "1.14.2",
3
+ "version": "1.14.3",
4
4
  "description": "Another (better ?) NodeJs library to fetch data from Discogs marketplace",
5
5
  "keywords": [
6
6
  "discogs",