@internetarchive/search-service
Advanced tools
Comparing version 1.2.5-alpha.20 to 1.2.5-alpha.21
@@ -16,3 +16,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
constructor(body, schema) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; | ||
this.schema = schema; | ||
@@ -35,9 +35,14 @@ const schemaHitType = schema === null || schema === void 0 ? void 0 : schema.hit_type; | ||
} | ||
else if ((_j = this.pageElements) === null || _j === void 0 ? void 0 : _j['web_archives']) { | ||
else if ((_k = (_j = this.pageElements) === null || _j === void 0 ? void 0 : _j['lending']) === null || _k === void 0 ? void 0 : _k['loans']) { | ||
hits = this.pageElements['lending']['loans']; | ||
this.totalResults = (_l = hits.length) !== null && _l !== void 0 ? _l : 0; | ||
this.returnedCount = this.totalResults; | ||
} | ||
else if ((_m = this.pageElements) === null || _m === void 0 ? void 0 : _m['web_archives']) { | ||
hits = convertWebArchivesToSearchHits(this.pageElements['web_archives']); | ||
this.totalResults = (_k = this.pageElements['web_archives'].length) !== null && _k !== void 0 ? _k : 0; | ||
this.totalResults = (_o = this.pageElements['web_archives'].length) !== null && _o !== void 0 ? _o : 0; | ||
this.returnedCount = this.totalResults; | ||
} | ||
this.results = | ||
(_l = hits === null || hits === void 0 ? void 0 : hits.map((hit) => { var _a; return SearchResponseDetails.createResult((_a = hit.hit_type) !== null && _a !== void 0 ? _a : schemaHitType, hit); })) !== null && _l !== void 0 ? _l : []; | ||
(_p = hits === null || hits === void 0 ? void 0 : hits.map((hit) => { var _a; return SearchResponseDetails.createResult((_a = hit.hit_type) !== null && _a !== void 0 ? _a : schemaHitType, hit); })) !== null && _p !== void 0 ? _p : []; | ||
// Use aggregations directly from the body if available. | ||
@@ -59,9 +64,9 @@ // Otherwise, try extracting them from the first page_element. | ||
if (body === null || body === void 0 ? void 0 : body.collection_titles) { | ||
this.collectionTitles = (_m = body.collection_titles) !== null && _m !== void 0 ? _m : {}; | ||
this.collectionTitles = (_q = body.collection_titles) !== null && _q !== void 0 ? _q : {}; | ||
} | ||
if (body === null || body === void 0 ? void 0 : body.collection_extra_info) { | ||
this.collectionExtraInfo = (_o = body.collection_extra_info) !== null && _o !== void 0 ? _o : null; | ||
this.collectionExtraInfo = (_r = body.collection_extra_info) !== null && _r !== void 0 ? _r : null; | ||
} | ||
if (body === null || body === void 0 ? void 0 : body.account_extra_info) { | ||
this.accountExtraInfo = (_p = body.account_extra_info) !== null && _p !== void 0 ? _p : null; | ||
this.accountExtraInfo = (_s = body.account_extra_info) !== null && _s !== void 0 ? _s : null; | ||
} | ||
@@ -68,0 +73,0 @@ } |
{ | ||
"name": "@internetarchive/search-service", | ||
"version": "1.2.5-alpha.20", | ||
"version": "1.2.5-alpha.21", | ||
"description": "A search service for the Internet Archive", | ||
@@ -5,0 +5,0 @@ "license": "AGPL-3.0-only", |
@@ -103,2 +103,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
this.returnedCount = firstPageElement.hits.returned ?? 0; | ||
} else if (this.pageElements?.['lending']?.['loans']) { | ||
hits = this.pageElements['lending']['loans']; | ||
this.totalResults = hits.length ?? 0; | ||
this.returnedCount = this.totalResults; | ||
} else if (this.pageElements?.['web_archives']) { | ||
@@ -105,0 +109,0 @@ hits = convertWebArchivesToSearchHits(this.pageElements['web_archives']); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
936428
13336