@internetarchive/collection-browser 2.1.5 → 2.1.6-alpha.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/dist/src/data-source/collection-browser-data-source-interface.d.ts +5 -1
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.d.ts +5 -1
- package/dist/src/data-source/collection-browser-data-source.js +1 -0
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/test/mocks/mock-search-responses.js +20 -0
- package/dist/test/mocks/mock-search-responses.js.map +1 -1
- package/package.json +3 -3
- package/src/data-source/collection-browser-data-source-interface.ts +6 -0
- package/src/data-source/collection-browser-data-source.ts +7 -0
- package/test/mocks/mock-search-responses.ts +20 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FilterMap, Aggregation, CollectionExtraInfo, AccountExtraInfo, PageElementMap } from '@internetarchive/search-service';
|
|
1
|
+
import type { FilterMap, Aggregation, CollectionExtraInfo, AccountExtraInfo, PageElementMap, SearchResponseSessionContext } from '@internetarchive/search-service';
|
|
2
2
|
import type { ReactiveController } from 'lit';
|
|
3
3
|
import type { PrefixFilterType, PrefixFilterCounts, TileModel } from '../models';
|
|
4
4
|
import type { PageSpecifierParams, CollectionTitles } from './models';
|
|
@@ -73,6 +73,10 @@ export interface CollectionBrowserDataSourceInterface extends ReactiveController
|
|
|
73
73
|
* used to populate the profile header.
|
|
74
74
|
*/
|
|
75
75
|
readonly accountExtraInfo?: AccountExtraInfo;
|
|
76
|
+
/**
|
|
77
|
+
* Context about the user session that produced the search response, from the PPS.
|
|
78
|
+
*/
|
|
79
|
+
readonly sessionContext?: SearchResponseSessionContext;
|
|
76
80
|
/**
|
|
77
81
|
* The set of requested page elements for profile pages, if applicable. These represent
|
|
78
82
|
* any content specific to the current profile tab.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-browser-data-source-interface.js","sourceRoot":"","sources":["../../../src/data-source/collection-browser-data-source-interface.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n FilterMap,\n Aggregation,\n CollectionExtraInfo,\n AccountExtraInfo,\n PageElementMap,\n} from '@internetarchive/search-service';\nimport type { ReactiveController } from 'lit';\nimport type {\n PrefixFilterType,\n PrefixFilterCounts,\n TileModel,\n} from '../models';\nimport type { PageSpecifierParams, CollectionTitles } from './models';\n\nexport interface CollectionBrowserDataSourceInterface\n extends ReactiveController {\n /**\n * How many tile models are present in this data source\n */\n readonly size: number;\n\n /**\n * How many results there are in the full result set for the current query\n * (not necessarily all loaded yet).\n */\n readonly totalResults: number;\n\n /**\n * Whether the host has a valid set of properties for performing a search.\n * For instance, on the search page this requires a valid search service and a\n * non-empty query, while collection pages allow searching with an empty query\n * for MDS but not FTS.\n */\n readonly canPerformSearch: boolean;\n\n /**\n * Whether the end of the set of results for the current query state has been\n * encountered (i.e., the last page of results).\n */\n readonly endOfDataReached: boolean;\n\n /**\n * True if the initial work for a new query state has been completed (i.e., firing initial\n * page/facet requests). False otherwise.\n */\n readonly queryInitialized: boolean;\n\n /**\n * A string key compactly representing the current full search state, which can\n * be used to determine, e.g., when a new search is required or whether an arriving\n * response is outdated.\n */\n readonly pageFetchQueryKey: string;\n\n /**\n * Similar to `pageFetchQueryKey`, but excluding properties that do not affect\n * the validity of a set of facets (e.g., sort).\n */\n readonly facetFetchQueryKey: string;\n\n /**\n * An object representing any collection- or profile-specific properties to be passed along\n * to the search service, specifying the exact page/tab to fetch results for.\n */\n readonly pageSpecifierParams: PageSpecifierParams | null;\n\n /**\n * A FilterMap object representing all filters applied to the current search,\n * including any facets, letter filters, and date ranges.\n */\n readonly filterMap: FilterMap;\n\n /**\n * The full set of aggregations retrieved for the current search.\n */\n readonly aggregations?: Record<string, Aggregation>;\n\n /**\n * The `year_histogram` aggregation retrieved for the current search.\n */\n readonly yearHistogramAggregation?: Aggregation;\n\n /**\n * A map from collection identifiers that appear on hits or aggregations for the\n * current search, to their human-readable collection titles.\n */\n readonly collectionTitles: CollectionTitles;\n\n /**\n * The \"extra info\" package provided by the PPS for collection pages, including details\n * used to populate the target collection header & About tab content.\n */\n readonly collectionExtraInfo?: CollectionExtraInfo;\n\n /**\n * The \"extra info\" package provided by the PPS for profile pages, including details\n * used to populate the profile header.\n */\n readonly accountExtraInfo?: AccountExtraInfo;\n\n /**\n * The set of requested page elements for profile pages, if applicable. These represent\n * any content specific to the current profile tab.\n */\n readonly pageElements?: PageElementMap;\n\n /**\n * An array of the current target collection's parent collections. Should include *all*\n * ancestors in the collection hierarchy, not just the immediate parent.\n */\n readonly parentCollections?: string[];\n\n /**\n * An object storing result counts for the current search bucketed by letter prefix.\n * Keys are the result field on which the prefixes are considered (e.g., title/creator)\n * and values are a Record mapping letters to their counts.\n */\n readonly prefixFilterCountMap: Partial<\n Record<PrefixFilterType, PrefixFilterCounts>\n >;\n\n /**\n * Any error message from the most recent search results response.\n */\n readonly queryErrorMessage?: string;\n\n /**\n * An array of all the tile models whose management checkboxes are checked\n */\n readonly checkedTileModels: TileModel[];\n\n /**\n * An array of all the tile models whose management checkboxes are unchecked\n */\n readonly uncheckedTileModels: TileModel[];\n\n /**\n * A Promise which, after each query change, resolves once the fetches for the initial\n * search have completed. Waits for *both* the hits and aggregations fetches to finish.\n *\n * Ensure you await this component's `updateComplete` promise before awaiting this\n * one, to ensure you do not await an obsolete promise from the previous update.\n */\n readonly initialSearchComplete: Promise<boolean>;\n\n /**\n * Resets the data source to its empty state, with no result pages, aggregations, etc.\n */\n reset(): void;\n\n /**\n * Adds the given page of tile models to the data source.\n * If the given page number already exists, that page will be overwritten.\n * This method expects that the provided tiles already fit the configured page size; it\n * will not split them into multiple pages.\n * @param pageNum Which page number to add (indexed starting from 1)\n * @param pageTiles The array of tile models for the new page\n */\n addPage(pageNum: number, pageTiles: TileModel[]): void;\n\n /**\n * Adds all of the given pages of tile models to the data source, splitting them into\n * multiple pages according to the configured page size if necessary. Any pages that\n * have tiles added by this method will have any existing content overwritten.\n * @param firstPageNum Which page number to start adding pages from (pages are indexed starting from 1)\n * @param tiles The full array of tile models to add across one or more pages\n */\n addMultiplePages(firstPageNum: number, tiles: TileModel[]): void;\n\n /**\n * Returns the given page of tile models from the data source.\n * @param pageNum Which page number to get (indexed starting from 1)\n */\n getPage(pageNum: number): TileModel[];\n\n /**\n * Returns the full set of paged tile models stored in this data source.\n */\n getAllPages(): Record<string, TileModel[]>;\n\n /**\n * Whether the data source contains any tiles for the given page number.\n * @param pageNum Which page number to query (indexed starting from 1)\n */\n hasPage(pageNum: number): boolean;\n\n /**\n * Returns the single tile model appearing at the given index in the\n * data source, with respect to the current page size. Returns `undefined` if\n * the corresponding page is not present on the data source or if it does not\n * contain a tile model at the corresponding index.\n * @param index The 0-based index (within the full data source) of the tile to get\n */\n getTileModelAt(index: number): TileModel | undefined;\n\n /**\n * Returns the first numeric tile index corresponding to the given tile model object,\n * or -1 if the given tile model is not present.\n * @param tile The tile model to search for in the data source\n */\n indexOf(tile: TileModel): number;\n\n /**\n * Requests that the data source fire a backend request for the given page of results.\n * @param pageNum Which page number to fetch results for\n * @param numInitialPages How many pages should be batched together on an initial fetch\n */\n fetchPage(pageNum: number, numInitialPages?: number): Promise<void>;\n\n /**\n * Requests that the data source update its prefix bucket result counts for the given\n * type of prefix filter.\n * @param filterType Which prefixable field to update the buckets for (e.g., title/creator)\n */\n updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void>;\n\n /**\n * Fetches and caches the prefix filter counts for the current sort type,\n * provided it is one that permits prefix filtering. (If not, this does nothing).\n */\n updatePrefixFiltersForCurrentSort(): Promise<void>;\n\n /**\n * Clears the cached letter counts for both title and creator, and\n * fetches a new set of counts for whichever of them is the currently\n * selected sort option (which may be neither).\n *\n * Call this whenever the counts are invalidated (e.g., by a query change).\n */\n refreshLetterCounts(): void;\n\n /**\n * Returns the current page size of the data source.\n */\n getPageSize(): number;\n\n /**\n * Changes the page size used by the data source, discarding any previously-fetched pages.\n *\n * **Note: this operation will reset any data stored in the data source!**\n * @param pageSize\n */\n setPageSize(pageSize: number): void;\n\n /**\n * Sets the total result count for this data source to the given value.\n * @param count The number of total results to set\n */\n setTotalResultCount(count: number): void;\n\n /**\n * Sets whether this data source should suppress further data fetches, i.e. ignore any\n * future query changes on its host that would trigger a page/facet fetch.\n * @param suppressed Whether further fetches for this data source should be suppressed\n */\n setFetchesSuppressed(suppressed: boolean): void;\n\n /**\n * Notifies the data source that a query change has occurred, which may trigger a data\n * reset & new fetches.\n */\n handleQueryChange(): void;\n\n /**\n * Applies the given map function to all of the tile models in every page of the data\n * source.\n * @param callback A callback function to apply on each tile model, as with Array.map\n */\n map(\n callback: (model: TileModel, index: number, array: TileModel[]) => TileModel\n ): void;\n\n /**\n * Checks every tile's management checkbox\n */\n checkAllTiles(): void;\n\n /**\n * Unchecks every tile's management checkbox\n */\n uncheckAllTiles(): void;\n\n /**\n * Removes all tile models that are currently checked & adjusts the paging\n * of the data source to account for any new gaps in the data.\n */\n removeCheckedTiles(): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"collection-browser-data-source-interface.js","sourceRoot":"","sources":["../../../src/data-source/collection-browser-data-source-interface.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n FilterMap,\n Aggregation,\n CollectionExtraInfo,\n AccountExtraInfo,\n PageElementMap,\n SearchResponseSessionContext,\n} from '@internetarchive/search-service';\nimport type { ReactiveController } from 'lit';\nimport type {\n PrefixFilterType,\n PrefixFilterCounts,\n TileModel,\n} from '../models';\nimport type { PageSpecifierParams, CollectionTitles } from './models';\n\nexport interface CollectionBrowserDataSourceInterface\n extends ReactiveController {\n /**\n * How many tile models are present in this data source\n */\n readonly size: number;\n\n /**\n * How many results there are in the full result set for the current query\n * (not necessarily all loaded yet).\n */\n readonly totalResults: number;\n\n /**\n * Whether the host has a valid set of properties for performing a search.\n * For instance, on the search page this requires a valid search service and a\n * non-empty query, while collection pages allow searching with an empty query\n * for MDS but not FTS.\n */\n readonly canPerformSearch: boolean;\n\n /**\n * Whether the end of the set of results for the current query state has been\n * encountered (i.e., the last page of results).\n */\n readonly endOfDataReached: boolean;\n\n /**\n * True if the initial work for a new query state has been completed (i.e., firing initial\n * page/facet requests). False otherwise.\n */\n readonly queryInitialized: boolean;\n\n /**\n * A string key compactly representing the current full search state, which can\n * be used to determine, e.g., when a new search is required or whether an arriving\n * response is outdated.\n */\n readonly pageFetchQueryKey: string;\n\n /**\n * Similar to `pageFetchQueryKey`, but excluding properties that do not affect\n * the validity of a set of facets (e.g., sort).\n */\n readonly facetFetchQueryKey: string;\n\n /**\n * An object representing any collection- or profile-specific properties to be passed along\n * to the search service, specifying the exact page/tab to fetch results for.\n */\n readonly pageSpecifierParams: PageSpecifierParams | null;\n\n /**\n * A FilterMap object representing all filters applied to the current search,\n * including any facets, letter filters, and date ranges.\n */\n readonly filterMap: FilterMap;\n\n /**\n * The full set of aggregations retrieved for the current search.\n */\n readonly aggregations?: Record<string, Aggregation>;\n\n /**\n * The `year_histogram` aggregation retrieved for the current search.\n */\n readonly yearHistogramAggregation?: Aggregation;\n\n /**\n * A map from collection identifiers that appear on hits or aggregations for the\n * current search, to their human-readable collection titles.\n */\n readonly collectionTitles: CollectionTitles;\n\n /**\n * The \"extra info\" package provided by the PPS for collection pages, including details\n * used to populate the target collection header & About tab content.\n */\n readonly collectionExtraInfo?: CollectionExtraInfo;\n\n /**\n * The \"extra info\" package provided by the PPS for profile pages, including details\n * used to populate the profile header.\n */\n readonly accountExtraInfo?: AccountExtraInfo;\n\n /**\n * Context about the user session that produced the search response, from the PPS.\n */\n readonly sessionContext?: SearchResponseSessionContext;\n\n /**\n * The set of requested page elements for profile pages, if applicable. These represent\n * any content specific to the current profile tab.\n */\n readonly pageElements?: PageElementMap;\n\n /**\n * An array of the current target collection's parent collections. Should include *all*\n * ancestors in the collection hierarchy, not just the immediate parent.\n */\n readonly parentCollections?: string[];\n\n /**\n * An object storing result counts for the current search bucketed by letter prefix.\n * Keys are the result field on which the prefixes are considered (e.g., title/creator)\n * and values are a Record mapping letters to their counts.\n */\n readonly prefixFilterCountMap: Partial<\n Record<PrefixFilterType, PrefixFilterCounts>\n >;\n\n /**\n * Any error message from the most recent search results response.\n */\n readonly queryErrorMessage?: string;\n\n /**\n * An array of all the tile models whose management checkboxes are checked\n */\n readonly checkedTileModels: TileModel[];\n\n /**\n * An array of all the tile models whose management checkboxes are unchecked\n */\n readonly uncheckedTileModels: TileModel[];\n\n /**\n * A Promise which, after each query change, resolves once the fetches for the initial\n * search have completed. Waits for *both* the hits and aggregations fetches to finish.\n *\n * Ensure you await this component's `updateComplete` promise before awaiting this\n * one, to ensure you do not await an obsolete promise from the previous update.\n */\n readonly initialSearchComplete: Promise<boolean>;\n\n /**\n * Resets the data source to its empty state, with no result pages, aggregations, etc.\n */\n reset(): void;\n\n /**\n * Adds the given page of tile models to the data source.\n * If the given page number already exists, that page will be overwritten.\n * This method expects that the provided tiles already fit the configured page size; it\n * will not split them into multiple pages.\n * @param pageNum Which page number to add (indexed starting from 1)\n * @param pageTiles The array of tile models for the new page\n */\n addPage(pageNum: number, pageTiles: TileModel[]): void;\n\n /**\n * Adds all of the given pages of tile models to the data source, splitting them into\n * multiple pages according to the configured page size if necessary. Any pages that\n * have tiles added by this method will have any existing content overwritten.\n * @param firstPageNum Which page number to start adding pages from (pages are indexed starting from 1)\n * @param tiles The full array of tile models to add across one or more pages\n */\n addMultiplePages(firstPageNum: number, tiles: TileModel[]): void;\n\n /**\n * Returns the given page of tile models from the data source.\n * @param pageNum Which page number to get (indexed starting from 1)\n */\n getPage(pageNum: number): TileModel[];\n\n /**\n * Returns the full set of paged tile models stored in this data source.\n */\n getAllPages(): Record<string, TileModel[]>;\n\n /**\n * Whether the data source contains any tiles for the given page number.\n * @param pageNum Which page number to query (indexed starting from 1)\n */\n hasPage(pageNum: number): boolean;\n\n /**\n * Returns the single tile model appearing at the given index in the\n * data source, with respect to the current page size. Returns `undefined` if\n * the corresponding page is not present on the data source or if it does not\n * contain a tile model at the corresponding index.\n * @param index The 0-based index (within the full data source) of the tile to get\n */\n getTileModelAt(index: number): TileModel | undefined;\n\n /**\n * Returns the first numeric tile index corresponding to the given tile model object,\n * or -1 if the given tile model is not present.\n * @param tile The tile model to search for in the data source\n */\n indexOf(tile: TileModel): number;\n\n /**\n * Requests that the data source fire a backend request for the given page of results.\n * @param pageNum Which page number to fetch results for\n * @param numInitialPages How many pages should be batched together on an initial fetch\n */\n fetchPage(pageNum: number, numInitialPages?: number): Promise<void>;\n\n /**\n * Requests that the data source update its prefix bucket result counts for the given\n * type of prefix filter.\n * @param filterType Which prefixable field to update the buckets for (e.g., title/creator)\n */\n updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void>;\n\n /**\n * Fetches and caches the prefix filter counts for the current sort type,\n * provided it is one that permits prefix filtering. (If not, this does nothing).\n */\n updatePrefixFiltersForCurrentSort(): Promise<void>;\n\n /**\n * Clears the cached letter counts for both title and creator, and\n * fetches a new set of counts for whichever of them is the currently\n * selected sort option (which may be neither).\n *\n * Call this whenever the counts are invalidated (e.g., by a query change).\n */\n refreshLetterCounts(): void;\n\n /**\n * Returns the current page size of the data source.\n */\n getPageSize(): number;\n\n /**\n * Changes the page size used by the data source, discarding any previously-fetched pages.\n *\n * **Note: this operation will reset any data stored in the data source!**\n * @param pageSize\n */\n setPageSize(pageSize: number): void;\n\n /**\n * Sets the total result count for this data source to the given value.\n * @param count The number of total results to set\n */\n setTotalResultCount(count: number): void;\n\n /**\n * Sets whether this data source should suppress further data fetches, i.e. ignore any\n * future query changes on its host that would trigger a page/facet fetch.\n * @param suppressed Whether further fetches for this data source should be suppressed\n */\n setFetchesSuppressed(suppressed: boolean): void;\n\n /**\n * Notifies the data source that a query change has occurred, which may trigger a data\n * reset & new fetches.\n */\n handleQueryChange(): void;\n\n /**\n * Applies the given map function to all of the tile models in every page of the data\n * source.\n * @param callback A callback function to apply on each tile model, as with Array.map\n */\n map(\n callback: (model: TileModel, index: number, array: TileModel[]) => TileModel\n ): void;\n\n /**\n * Checks every tile's management checkbox\n */\n checkAllTiles(): void;\n\n /**\n * Unchecks every tile's management checkbox\n */\n uncheckAllTiles(): void;\n\n /**\n * Removes all tile models that are currently checked & adjusts the paging\n * of the data source to account for any new gaps in the data.\n */\n removeCheckedTiles(): void;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactiveControllerHost } from 'lit';
|
|
2
|
-
import { AccountExtraInfo, Aggregation, CollectionExtraInfo, FilterMap, PageElementMap, SearchParams } from '@internetarchive/search-service';
|
|
2
|
+
import { AccountExtraInfo, Aggregation, CollectionExtraInfo, FilterMap, PageElementMap, SearchParams, SearchResponseSessionContext } from '@internetarchive/search-service';
|
|
3
3
|
import { type PrefixFilterType, TileModel, PrefixFilterCounts, RequestKind } from '../models';
|
|
4
4
|
import { type PageSpecifierParams } from './models';
|
|
5
5
|
import type { CollectionBrowserDataSourceInterface } from './collection-browser-data-source-interface';
|
|
@@ -78,6 +78,10 @@ export declare class CollectionBrowserDataSource implements CollectionBrowserDat
|
|
|
78
78
|
* @inheritdoc
|
|
79
79
|
*/
|
|
80
80
|
accountExtraInfo?: AccountExtraInfo;
|
|
81
|
+
/**
|
|
82
|
+
* @inheritdoc
|
|
83
|
+
*/
|
|
84
|
+
sessionContext?: SearchResponseSessionContext;
|
|
81
85
|
/**
|
|
82
86
|
* @inheritdoc
|
|
83
87
|
*/
|
|
@@ -793,6 +793,7 @@ export class CollectionBrowserDataSource {
|
|
|
793
793
|
// display event to offshoot when result count is zero.
|
|
794
794
|
this.host.emitEmptyResults();
|
|
795
795
|
}
|
|
796
|
+
this.sessionContext = success.sessionContext;
|
|
796
797
|
if (this.host.withinCollection) {
|
|
797
798
|
this.collectionExtraInfo = success.response.collectionExtraInfo;
|
|
798
799
|
// For collections, we want the UI to respect the default sort option
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-browser-data-source.js","sourceRoot":"","sources":["../../../src/data-source/collection-browser-data-source.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IAAI,CAAC,oBAAoB,GAAG,EAAE,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,wCAAwC;QACtG,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,MAAM,CACpD,CAAC,GAA2B,EAAE,MAAc,EAAE,EAAE;YAC9C,GAAG,CAAE,MAAM,CAAC,GAAc,CAAC,WAAW,EAAE,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC;YAC7D,OAAO,GAAG,CAAC;QACb,CAAC,EACD,EAAE,CACH,CAAC;QAEF,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iCAAiC;QACrC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,YAAyB,CAAC,EAAE;YACtE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,YAAgC,CAAC;YAC9D,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE;gBAC1C,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC;aAC3C;SACF;IACH,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YACrD,IAAI,CAAC,oBAAoB,GAAG,EAAE,CAAC;SAChC;QACD,IAAI,CAAC,iCAAiC,EAAE,CAAC;QACzC,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import type { ReactiveControllerHost } from 'lit';\nimport {\n AccountExtraInfo,\n Aggregation,\n Bucket,\n CollectionExtraInfo,\n FilterConstraint,\n FilterMap,\n FilterMapBuilder,\n PageElementMap,\n SearchParams,\n SearchResult,\n SearchType,\n} from '@internetarchive/search-service';\nimport {\n prefixFilterAggregationKeys,\n type FacetBucket,\n type PrefixFilterType,\n TileModel,\n PrefixFilterCounts,\n RequestKind,\n SortField,\n SORT_OPTIONS,\n} from '../models';\nimport { FACETLESS_PAGE_ELEMENTS, type PageSpecifierParams } from './models';\nimport type { CollectionBrowserDataSourceInterface } from './collection-browser-data-source-interface';\nimport type { CollectionBrowserSearchInterface } from './collection-browser-query-state';\nimport { sha1 } from '../utils/sha1';\nimport { log } from '../utils/log';\n\nexport class CollectionBrowserDataSource\n implements CollectionBrowserDataSourceInterface\n{\n /**\n * All pages of tile models that have been fetched so far, indexed by their page\n * number (with the first being page 1).\n */\n private pages: Record<string, TileModel[]> = {};\n\n /**\n * Tile offset to apply when looking up tiles in the pages, in order to maintain\n * page alignment after tiles are removed.\n */\n private offset = 0;\n\n /**\n * Total number of tile models stored in this data source's pages\n */\n private numTileModels = 0;\n\n /**\n * A set of fetch IDs that are valid for the current query state\n */\n private fetchesInProgress = new Set<string>();\n\n /**\n * A record of the query key used for the last search.\n * If this changes, we need to load new results.\n */\n private previousQueryKey: string = '';\n\n /**\n * Whether the initial page of search results for the current query state\n * is presently being fetched.\n */\n private searchResultsLoading = false;\n\n /**\n * Whether the facets (aggregations) for the current query state are\n * presently being fetched.\n */\n private facetsLoading = false;\n\n /**\n * Whether further query changes should be ignored and not trigger fetches\n */\n private suppressFetches = false;\n\n /**\n * @inheritdoc\n */\n totalResults = 0;\n\n /**\n * @inheritdoc\n */\n endOfDataReached = false;\n\n /**\n * @inheritdoc\n */\n queryInitialized = false;\n\n /**\n * @inheritdoc\n */\n aggregations?: Record<string, Aggregation>;\n\n /**\n * @inheritdoc\n */\n yearHistogramAggregation?: Aggregation;\n\n /**\n * @inheritdoc\n */\n collectionTitles = new Map<string, string>();\n\n /**\n * @inheritdoc\n */\n collectionExtraInfo?: CollectionExtraInfo;\n\n /**\n * @inheritdoc\n */\n accountExtraInfo?: AccountExtraInfo;\n\n /**\n * @inheritdoc\n */\n pageElements?: PageElementMap;\n\n /**\n * @inheritdoc\n */\n parentCollections?: string[] = [];\n\n /**\n * @inheritdoc\n */\n prefixFilterCountMap: Partial<Record<PrefixFilterType, PrefixFilterCounts>> =\n {};\n\n /**\n * @inheritdoc\n */\n queryErrorMessage?: string;\n\n /**\n * Internal property to store the `resolve` function for the most recent\n * `initialSearchComplete` promise, allowing us to resolve it at the appropriate time.\n */\n private _initialSearchCompleteResolver!: (val: boolean) => void;\n\n /**\n * Internal property to store the private value backing the `initialSearchComplete` getter.\n */\n private _initialSearchCompletePromise: Promise<boolean> = new Promise(res => {\n this._initialSearchCompleteResolver = res;\n });\n\n /**\n * @inheritdoc\n */\n get initialSearchComplete(): Promise<boolean> {\n return this._initialSearchCompletePromise;\n }\n\n // eslint-disable-next-line no-useless-constructor\n constructor(\n /** The host element to which this controller should attach listeners */\n private readonly host: ReactiveControllerHost &\n CollectionBrowserSearchInterface,\n /** Default size of result pages */\n private pageSize: number = 50\n ) {\n // Just setting some property values\n }\n\n hostConnected(): void {\n this.setSearchResultsLoading(this.searchResultsLoading);\n this.setFacetsLoading(this.facetsLoading);\n }\n\n hostUpdate(): void {\n // This reactive controller hook is run whenever the host component (collection-browser) performs an update.\n // We check whether the host's state has changed in a way which should trigger a reset & new results fetch.\n\n // Only the currently-installed data source should react to the update\n if (!this.activeOnHost) return;\n\n // Copy loading states onto the host\n this.setSearchResultsLoading(this.searchResultsLoading);\n this.setFacetsLoading(this.facetsLoading);\n\n // Can't perform searches without a search service\n if (!this.host.searchService) return;\n\n // We should only reset if part of the full query state has changed\n const queryKeyChanged = this.pageFetchQueryKey !== this.previousQueryKey;\n if (!queryKeyChanged) return;\n\n // We should only reset if either:\n // (a) our state permits a valid search, or\n // (b) we have a blank query that we want to show empty results for\n const shouldShowEmptyQueryResults =\n this.host.clearResultsOnEmptyQuery && this.host.baseQuery === '';\n if (!(this.canPerformSearch || shouldShowEmptyQueryResults)) return;\n\n if (this.activeOnHost) this.host.emitQueryStateChanged();\n this.handleQueryChange();\n }\n\n /**\n * Returns whether this data source is the one currently installed on the host component.\n */\n private get activeOnHost(): boolean {\n return this.host.dataSource === this;\n }\n\n /**\n * @inheritdoc\n */\n get size(): number {\n return this.numTileModels;\n }\n\n /**\n * @inheritdoc\n */\n reset(): void {\n log('Resetting CB data source');\n this.pages = {};\n this.aggregations = {};\n this.yearHistogramAggregation = undefined;\n this.pageElements = undefined;\n this.parentCollections = [];\n this.queryErrorMessage = undefined;\n\n this.offset = 0;\n this.numTileModels = 0;\n this.endOfDataReached = false;\n this.queryInitialized = false;\n\n // Invalidate any fetches in progress\n this.fetchesInProgress.clear();\n\n this.setTotalResultCount(0);\n this.requestHostUpdate();\n }\n\n /**\n * @inheritdoc\n */\n addPage(pageNum: number, pageTiles: TileModel[]): void {\n this.pages[pageNum] = pageTiles;\n this.numTileModels += pageTiles.length;\n this.requestHostUpdate();\n }\n\n /**\n * @inheritdoc\n */\n addMultiplePages(firstPageNum: number, tiles: TileModel[]): void {\n const numPages = Math.ceil(tiles.length / this.pageSize);\n for (let i = 0; i < numPages; i += 1) {\n const pageStartIndex = this.pageSize * i;\n this.addPage(\n firstPageNum + i,\n tiles.slice(pageStartIndex, pageStartIndex + this.pageSize)\n );\n }\n\n const visiblePages = this.host.currentVisiblePageNumbers;\n const needsReload = visiblePages.some(\n page => page >= firstPageNum && page <= firstPageNum + numPages\n );\n if (needsReload) {\n this.refreshVisibleResults();\n }\n }\n\n /**\n * @inheritdoc\n */\n getPage(pageNum: number): TileModel[] {\n return this.pages[pageNum];\n }\n\n /**\n * @inheritdoc\n */\n getAllPages(): Record<string, TileModel[]> {\n return this.pages;\n }\n\n /**\n * @inheritdoc\n */\n hasPage(pageNum: number): boolean {\n return !!this.pages[pageNum];\n }\n\n /**\n * @inheritdoc\n */\n getTileModelAt(index: number): TileModel | undefined {\n const pageNum = Math.floor(index / this.pageSize) + 1;\n const indexOnPage = index % this.pageSize;\n return this.pages[pageNum]?.[indexOnPage];\n }\n\n /**\n * @inheritdoc\n */\n indexOf(tile: TileModel): number {\n return Object.values(this.pages).flat().indexOf(tile);\n }\n\n /**\n * @inheritdoc\n */\n getPageSize(): number {\n return this.pageSize;\n }\n\n /**\n * @inheritdoc\n */\n setPageSize(pageSize: number): void {\n this.reset();\n this.pageSize = pageSize;\n }\n\n /**\n * @inheritdoc\n */\n setTotalResultCount(count: number): void {\n this.totalResults = count;\n if (this.activeOnHost) {\n this.host.setTotalResultCount(count);\n }\n }\n\n /**\n * @inheritdoc\n */\n setFetchesSuppressed(suppressed: boolean): void {\n this.suppressFetches = suppressed;\n }\n\n /**\n * @inheritdoc\n */\n async handleQueryChange(): Promise<void> {\n // Don't react to the change if fetches are suppressed for this data source\n if (this.suppressFetches) return;\n\n this.reset();\n\n // Reset the `initialSearchComplete` promise with a new value for the imminent search\n this._initialSearchCompletePromise = new Promise(res => {\n this._initialSearchCompleteResolver = res;\n });\n\n const shouldFetchFacets =\n !this.host.suppressFacets &&\n !FACETLESS_PAGE_ELEMENTS.includes(this.host.profileElement!);\n\n // Fire the initial page & facet requests\n this.queryInitialized = true;\n await Promise.all([\n this.doInitialPageFetch(),\n shouldFetchFacets ? this.fetchFacets() : null,\n ]);\n\n // Resolve the `initialSearchComplete` promise for this search\n this._initialSearchCompleteResolver(true);\n }\n\n /**\n * @inheritdoc\n */\n map(\n callback: (model: TileModel, index: number, array: TileModel[]) => TileModel\n ): void {\n this.pages = Object.fromEntries(\n Object.entries(this.pages).map(([page, tileModels]) => [\n page,\n tileModels.map((model, index, array) =>\n model ? callback(model, index, array) : model\n ),\n ])\n );\n this.requestHostUpdate();\n this.refreshVisibleResults();\n }\n\n /**\n * @inheritdoc\n */\n checkAllTiles = (): void => {\n this.map(model => {\n const cloned = model.clone();\n cloned.checked = true;\n return cloned;\n });\n };\n\n /**\n * @inheritdoc\n */\n uncheckAllTiles = (): void => {\n this.map(model => {\n const cloned = model.clone();\n cloned.checked = false;\n return cloned;\n });\n };\n\n /**\n * @inheritdoc\n */\n removeCheckedTiles = (): void => {\n // To make sure our data source remains page-aligned, we will offset our data source by\n // the number of removed tiles, so that we can just add the offset when the infinite\n // scroller queries for cell contents.\n // This only matters while we're still viewing the same set of results. If the user changes\n // their query/filters/sort, then the data source is overwritten and the offset cleared.\n const { checkedTileModels, uncheckedTileModels } = this;\n const numChecked = checkedTileModels.length;\n if (numChecked === 0) return;\n this.offset += numChecked;\n const newPages: typeof this.pages = {};\n\n // Which page the remaining tile models start on, post-offset\n let offsetPageNumber = Math.floor(this.offset / this.pageSize) + 1;\n let indexOnPage = this.offset % this.pageSize;\n\n // Fill the pages up to that point with empty models\n for (let page = 1; page <= offsetPageNumber; page += 1) {\n const remainingHidden = this.offset - this.pageSize * (page - 1);\n const offsetCellsOnPage = Math.min(this.pageSize, remainingHidden);\n newPages[page] = Array(offsetCellsOnPage).fill(undefined);\n }\n\n // Shift all the remaining tiles into their new positions in the data source\n for (const model of uncheckedTileModels) {\n if (!newPages[offsetPageNumber]) newPages[offsetPageNumber] = [];\n newPages[offsetPageNumber].push(model);\n indexOnPage += 1;\n if (indexOnPage >= this.pageSize) {\n offsetPageNumber += 1;\n indexOnPage = 0;\n }\n }\n\n // Swap in the new pages\n this.pages = newPages;\n this.numTileModels -= numChecked;\n this.requestHostUpdate();\n this.refreshVisibleResults();\n };\n\n /**\n * @inheritdoc\n */\n get checkedTileModels(): TileModel[] {\n return this.getFilteredTileModels(model => model.checked);\n }\n\n /**\n * @inheritdoc\n */\n get uncheckedTileModels(): TileModel[] {\n return this.getFilteredTileModels(model => !model.checked);\n }\n\n /**\n * Returns a flattened, filtered array of all the tile models in the data source\n * for which the given predicate returns a truthy value.\n *\n * @param predicate A callback function to apply on each tile model, as with Array.filter\n * @returns A filtered array of tile models satisfying the predicate\n */\n private getFilteredTileModels(\n predicate: (model: TileModel, index: number, array: TileModel[]) => unknown\n ): TileModel[] {\n return Object.values(this.pages)\n .flat()\n .filter((model, index, array) =>\n model ? predicate(model, index, array) : false\n );\n }\n\n /**\n * @inheritdoc\n */\n get canPerformSearch(): boolean {\n if (!this.host.searchService) return false;\n\n const trimmedQuery = this.host.baseQuery?.trim();\n const hasNonEmptyQuery = !!trimmedQuery;\n const isCollectionSearch = !!this.host.withinCollection;\n const isProfileSearch = !!this.host.withinProfile;\n const hasProfileElement = !!this.host.profileElement;\n const isMetadataSearch = this.host.searchType === SearchType.METADATA;\n\n // Metadata searches within a collection/profile are allowed to have no query.\n // Otherwise, a non-empty query must be set.\n return (\n hasNonEmptyQuery ||\n (isCollectionSearch && isMetadataSearch) ||\n (isProfileSearch && hasProfileElement && isMetadataSearch)\n );\n }\n\n /**\n * Sets the state for whether the initial set of search results for the\n * current query is loading\n */\n private setSearchResultsLoading(loading: boolean): void {\n this.searchResultsLoading = loading;\n if (this.activeOnHost) {\n this.host.setSearchResultsLoading(loading);\n }\n }\n\n /**\n * Sets the state for whether the facets for a query is loading\n */\n private setFacetsLoading(loading: boolean): void {\n this.facetsLoading = loading;\n if (this.activeOnHost) {\n this.host.setFacetsLoading(loading);\n }\n }\n\n /**\n * Requests that the host perform an update, provided this data\n * source is actively installed on it.\n */\n private requestHostUpdate(): void {\n if (this.activeOnHost) {\n this.host.requestUpdate();\n }\n }\n\n /**\n * Requests that the host refresh its visible tiles, provided this\n * data source is actively installed on it.\n */\n private refreshVisibleResults(): void {\n if (this.activeOnHost) {\n this.host.refreshVisibleResults();\n }\n }\n\n /**\n * The query key is a string that uniquely identifies the current search.\n * It consists of:\n * - The current base query\n * - The current collection/profile target & page element\n * - The current search type\n * - Any currently-applied facets\n * - Any currently-applied date range\n * - Any currently-applied prefix filters\n * - The current sort options\n *\n * This lets us internally keep track of queries so we don't persist data that's\n * no longer relevant. Not meant to be human-readable.\n */\n get pageFetchQueryKey(): string {\n const profileKey = `pf;${this.host.withinProfile}--pe;${this.host.profileElement}`;\n const pageTarget = this.host.withinCollection ?? profileKey;\n const sortField = this.host.selectedSort ?? 'none';\n const sortDirection = this.host.sortDirection ?? 'none';\n return `fq:${this.fullQuery}-pt:${pageTarget}-st:${this.host.searchType}-sf:${sortField}-sd:${sortDirection}`;\n }\n\n /**\n * Similar to `pageFetchQueryKey` above, but excludes sort fields since they\n * are not relevant in determining aggregation queries.\n */\n get facetFetchQueryKey(): string {\n const profileKey = `pf;${this.host.withinProfile}--pe;${this.host.profileElement}`;\n const pageTarget = this.host.withinCollection ?? profileKey;\n return `fq:${this.fullQuery}-pt:${pageTarget}-st:${this.host.searchType}`;\n }\n\n /**\n * Constructs a search service FilterMap object from the combination of\n * all the currently-applied filters. This includes any facets, letter\n * filters, and date range.\n */\n get filterMap(): FilterMap {\n const builder = new FilterMapBuilder();\n\n // Add the date range, if applicable\n if (this.host.minSelectedDate) {\n builder.addFilter(\n 'year',\n this.host.minSelectedDate,\n FilterConstraint.GREATER_OR_EQUAL\n );\n }\n if (this.host.maxSelectedDate) {\n builder.addFilter(\n 'year',\n this.host.maxSelectedDate,\n FilterConstraint.LESS_OR_EQUAL\n );\n }\n\n // Add any selected facets\n if (this.host.selectedFacets) {\n for (const [facetName, facetValues] of Object.entries(\n this.host.selectedFacets\n )) {\n const { name, values } = this.prepareFacetForFetch(\n facetName,\n facetValues\n );\n for (const [value, bucket] of Object.entries(values)) {\n let constraint;\n if (bucket.state === 'selected') {\n constraint = FilterConstraint.INCLUDE;\n } else if (bucket.state === 'hidden') {\n constraint = FilterConstraint.EXCLUDE;\n }\n\n if (constraint) {\n builder.addFilter(name, value, constraint);\n }\n }\n }\n }\n\n // Add any letter filters\n if (this.host.selectedTitleFilter) {\n builder.addFilter(\n 'firstTitle',\n this.host.selectedTitleFilter,\n FilterConstraint.INCLUDE\n );\n }\n if (this.host.selectedCreatorFilter) {\n builder.addFilter(\n 'firstCreator',\n this.host.selectedCreatorFilter,\n FilterConstraint.INCLUDE\n );\n }\n\n const filterMap = builder.build();\n return filterMap;\n }\n\n /**\n * Produces a compact unique ID for a search request that can help with debugging\n * on the backend by making related requests easier to trace through different services.\n * (e.g., tying the hits/aggregations requests for the same page back to a single hash).\n *\n * @param params The search service parameters for the request\n * @param kind The kind of request (hits-only, aggregations-only, or both)\n * @returns A Promise resolving to the uid to apply to the request\n */\n async requestUID(params: SearchParams, kind: RequestKind): Promise<string> {\n const paramsToHash = JSON.stringify({\n pageType: params.pageType,\n pageTarget: params.pageTarget,\n query: params.query,\n fields: params.fields,\n filters: params.filters,\n sort: params.sort,\n searchType: this.host.searchType,\n });\n\n const fullQueryHash = (await sha1(paramsToHash)).slice(0, 20); // First 80 bits of SHA-1 are plenty for this\n const sessionId = (await this.host.getSessionId()).slice(0, 20); // Likewise\n const page = params.page ?? 0;\n const kindPrefix = kind.charAt(0); // f = full, h = hits, a = aggregations\n const currentTime = Date.now();\n\n return `R:${fullQueryHash}-S:${sessionId}-P:${page}-K:${kindPrefix}-T:${currentTime}`;\n }\n\n /**\n * @inheritdoc\n */\n get pageSpecifierParams(): PageSpecifierParams | null {\n if (this.host.withinCollection) {\n return {\n pageType: 'collection_details',\n pageTarget: this.host.withinCollection,\n };\n }\n if (this.host.withinProfile) {\n return {\n pageType: 'account_details',\n pageTarget: this.host.withinProfile,\n pageElements: this.host.profileElement\n ? [this.host.profileElement]\n : [],\n };\n }\n return null;\n }\n\n /**\n * The full query, including year facets and date range clauses\n */\n private get fullQuery(): string | undefined {\n let fullQuery = this.host.baseQuery?.trim() ?? '';\n\n const { facetQuery, dateRangeQueryClause, sortFilterQueries } = this;\n\n if (facetQuery) {\n fullQuery += ` AND ${facetQuery}`;\n }\n if (dateRangeQueryClause) {\n fullQuery += ` AND ${dateRangeQueryClause}`;\n }\n if (sortFilterQueries) {\n fullQuery += ` AND ${sortFilterQueries}`;\n }\n return fullQuery.trim();\n }\n\n /**\n * Generates a query string representing the current set of applied facets\n *\n * Example: `mediatype:(\"collection\" OR \"audio\" OR -\"etree\") AND year:(\"2000\" OR \"2001\")`\n */\n private get facetQuery(): string | undefined {\n if (!this.host.selectedFacets) return undefined;\n const facetClauses = [];\n for (const [facetName, facetValues] of Object.entries(\n this.host.selectedFacets\n )) {\n facetClauses.push(this.buildFacetClause(facetName, facetValues));\n }\n return this.joinFacetClauses(facetClauses)?.trim();\n }\n\n private get dateRangeQueryClause(): string | undefined {\n if (!this.host.minSelectedDate || !this.host.maxSelectedDate) {\n return undefined;\n }\n\n return `year:[${this.host.minSelectedDate} TO ${this.host.maxSelectedDate}]`;\n }\n\n private get sortFilterQueries(): string {\n const queries = [this.titleQuery, this.creatorQuery];\n return queries.filter(q => q).join(' AND ');\n }\n\n /**\n * Returns a query clause identifying the currently selected title filter,\n * e.g., `firstTitle:X`.\n */\n private get titleQuery(): string | undefined {\n return this.host.selectedTitleFilter\n ? `firstTitle:${this.host.selectedTitleFilter}`\n : undefined;\n }\n\n /**\n * Returns a query clause identifying the currently selected creator filter,\n * e.g., `firstCreator:X`.\n */\n private get creatorQuery(): string | undefined {\n return this.host.selectedCreatorFilter\n ? `firstCreator:${this.host.selectedCreatorFilter}`\n : undefined;\n }\n\n /**\n * Builds an OR-joined facet clause for the given facet name and values.\n *\n * E.g., for name `subject` and values\n * `{ foo: { state: 'selected' }, bar: { state: 'hidden' } }`\n * this will produce the clause\n * `subject:(\"foo\" OR -\"bar\")`.\n *\n * @param facetName The facet type (e.g., 'collection')\n * @param facetValues The facet buckets, mapped by their keys\n */\n private buildFacetClause(\n facetName: string,\n facetValues: Record<string, FacetBucket>\n ): string {\n const { name: facetQueryName, values } = this.prepareFacetForFetch(\n facetName,\n facetValues\n );\n const facetEntries = Object.entries(values);\n if (facetEntries.length === 0) return '';\n\n const facetValuesArray: string[] = [];\n for (const [key, facetData] of facetEntries) {\n const plusMinusPrefix = facetData.state === 'hidden' ? '-' : '';\n facetValuesArray.push(`${plusMinusPrefix}\"${key}\"`);\n }\n\n const valueQuery = facetValuesArray.join(` OR `);\n return `${facetQueryName}:(${valueQuery})`;\n }\n\n /**\n * Handles some special pre-request normalization steps for certain facet types\n * that require them.\n *\n * @param facetName The name of the facet type (e.g., 'language')\n * @param facetValues An array of values for that facet type\n */\n private prepareFacetForFetch(\n facetName: string,\n facetValues: Record<string, FacetBucket>\n ): { name: string; values: Record<string, FacetBucket> } {\n // eslint-disable-next-line prefer-const\n let [normalizedName, normalizedValues] = [facetName, facetValues];\n\n // The full \"search engine\" name of the lending field is \"lending___status\"\n if (facetName === 'lending') {\n normalizedName = 'lending___status';\n }\n\n return {\n name: normalizedName,\n values: normalizedValues,\n };\n }\n\n /**\n * Takes an array of facet clauses, and combines them into a\n * full AND-joined facet query string. Empty clauses are ignored.\n */\n private joinFacetClauses(facetClauses: string[]): string | undefined {\n const nonEmptyFacetClauses = facetClauses.filter(\n clause => clause.length > 0\n );\n return nonEmptyFacetClauses.length > 0\n ? `(${nonEmptyFacetClauses.join(' AND ')})`\n : undefined;\n }\n\n /**\n * Fires a backend request to fetch a set of aggregations (representing UI facets) for\n * the current search state.\n */\n private async fetchFacets(): Promise<void> {\n const trimmedQuery = this.host.baseQuery?.trim();\n if (!this.canPerformSearch) return;\n\n const { facetFetchQueryKey } = this;\n if (this.fetchesInProgress.has(facetFetchQueryKey)) return;\n this.fetchesInProgress.add(facetFetchQueryKey);\n\n const sortParams = this.host.sortParam ? [this.host.sortParam] : [];\n const params: SearchParams = {\n ...this.pageSpecifierParams,\n query: trimmedQuery || '',\n rows: 0,\n filters: this.filterMap,\n // Fetch a few extra buckets beyond the 6 we show, in case some get suppressed\n aggregationsSize: 10,\n // Note: we don't need an aggregations param to fetch the default aggregations from the PPS.\n // The default aggregations for the search_results page type should be what we need here.\n };\n params.uid = await this.requestUID(\n { ...params, sort: sortParams },\n 'aggregations'\n );\n\n this.setFacetsLoading(true);\n const searchResponse = await this.host.searchService?.search(\n params,\n this.host.searchType\n );\n const success = searchResponse?.success;\n\n // This is checking to see if the query has changed since the data was fetched.\n // If so, we just want to discard this set of aggregations because they are\n // likely no longer valid for the newer query.\n const queryChangedSinceFetch =\n !this.fetchesInProgress.has(facetFetchQueryKey);\n this.fetchesInProgress.delete(facetFetchQueryKey);\n if (queryChangedSinceFetch) return;\n\n if (!success) {\n const errorMsg = searchResponse?.error?.message;\n const detailMsg = searchResponse?.error?.details?.message;\n\n if (!errorMsg && !detailMsg) {\n // @ts-ignore: Property 'Sentry' does not exist on type 'Window & typeof globalThis'\n window?.Sentry?.captureMessage?.(\n 'Missing or malformed facet response from backend',\n 'error'\n );\n }\n\n this.setFacetsLoading(false);\n return;\n }\n\n const { aggregations, collectionTitles } = success.response;\n this.aggregations = aggregations;\n\n if (collectionTitles) {\n for (const [id, title] of Object.entries(collectionTitles)) {\n this.collectionTitles.set(id, title);\n }\n }\n\n this.yearHistogramAggregation =\n success?.response?.aggregations?.year_histogram;\n\n this.setFacetsLoading(false);\n this.requestHostUpdate();\n }\n\n /**\n * Performs the initial page fetch(es) for the current search state.\n */\n private async doInitialPageFetch(): Promise<void> {\n this.setSearchResultsLoading(true);\n // Try to batch 2 initial page requests when possible\n await this.fetchPage(this.host.initialPageNumber, 2);\n }\n\n /**\n * Fetches one or more pages of results and updates the data source.\n *\n * @param pageNumber The page number to fetch\n * @param numInitialPages If this is an initial page fetch (`pageNumber = 1`),\n * specifies how many pages to batch together in one request. Ignored\n * if `pageNumber != 1`, defaulting to a single page.\n */\n async fetchPage(pageNumber: number, numInitialPages = 1): Promise<void> {\n const trimmedQuery = this.host.baseQuery?.trim();\n if (!this.canPerformSearch) return;\n\n // if we already have data, don't fetch again\n if (this.hasPage(pageNumber)) return;\n\n if (this.endOfDataReached) return;\n\n // Batch multiple initial page requests together if needed (e.g., can request\n // pages 1 and 2 together in a single request).\n let numPages = pageNumber === 1 ? numInitialPages : 1;\n const numRows = this.pageSize * numPages;\n\n // if a fetch is already in progress for this query and page, don't fetch again\n const { pageFetchQueryKey } = this;\n const currentPageKey = `${pageFetchQueryKey}-p:${pageNumber}`;\n if (this.fetchesInProgress.has(currentPageKey)) return;\n\n for (let i = 0; i < numPages; i += 1) {\n this.fetchesInProgress.add(`${pageFetchQueryKey}-p:${pageNumber + i}`);\n }\n this.previousQueryKey = pageFetchQueryKey;\n\n let sortParams = this.host.sortParam ? [this.host.sortParam] : [];\n // TODO eventually the PPS should handle these defaults natively\n const isDefaultProfileSort =\n this.host.withinProfile && this.host.selectedSort === SortField.default;\n if (isDefaultProfileSort && this.host.defaultSortParam) {\n const sortOption =\n SORT_OPTIONS[this.host.defaultSortParam.field as SortField];\n if (sortOption.searchServiceKey) {\n sortParams = [\n {\n field: sortOption.searchServiceKey,\n direction: 'desc',\n },\n ];\n }\n }\n\n const params: SearchParams = {\n ...this.pageSpecifierParams,\n query: trimmedQuery || '',\n page: pageNumber,\n rows: numRows,\n sort: sortParams,\n filters: this.filterMap,\n aggregations: { omit: true },\n };\n params.uid = await this.requestUID(params, 'hits');\n\n log('=== FIRING PAGE REQUEST ===', params);\n const searchResponse = await this.host.searchService?.search(\n params,\n this.host.searchType\n );\n log('=== RECEIVED PAGE RESPONSE IN CB ===', searchResponse);\n const success = searchResponse?.success;\n\n // This is checking to see if the fetch has been invalidated since it was fired off.\n // If so, we just want to discard the response since it is for an obsolete query state.\n if (!this.fetchesInProgress.has(currentPageKey)) return;\n for (let i = 0; i < numPages; i += 1) {\n this.fetchesInProgress.delete(`${pageFetchQueryKey}-p:${pageNumber + i}`);\n }\n\n if (!success) {\n const errorMsg = searchResponse?.error?.message;\n const detailMsg = searchResponse?.error?.details?.message;\n\n this.queryErrorMessage = `${errorMsg ?? ''}${\n detailMsg ? `; ${detailMsg}` : ''\n }`;\n\n if (!this.queryErrorMessage) {\n this.queryErrorMessage = 'Missing or malformed response from backend';\n // @ts-ignore: Property 'Sentry' does not exist on type 'Window & typeof globalThis'\n window?.Sentry?.captureMessage?.(this.queryErrorMessage, 'error');\n }\n\n this.setSearchResultsLoading(false);\n this.requestHostUpdate();\n return;\n }\n\n this.setTotalResultCount(success.response.totalResults - this.offset);\n if (this.activeOnHost && this.totalResults === 0) {\n // display event to offshoot when result count is zero.\n this.host.emitEmptyResults();\n }\n\n if (this.host.withinCollection) {\n this.collectionExtraInfo = success.response.collectionExtraInfo;\n\n // For collections, we want the UI to respect the default sort option\n // which can be specified in metadata, or otherwise assumed to be week:desc\n if (this.activeOnHost) {\n this.host.applyDefaultCollectionSort(this.collectionExtraInfo);\n }\n\n if (this.collectionExtraInfo) {\n this.parentCollections = [].concat(\n this.collectionExtraInfo.public_metadata?.collection ?? []\n );\n }\n } else if (this.host.withinProfile) {\n this.accountExtraInfo = success.response.accountExtraInfo;\n this.pageElements = success.response.pageElements;\n }\n\n const { results, collectionTitles } = success.response;\n if (results && results.length > 0) {\n // Load any collection titles present on the response into the cache,\n // or queue up preload fetches for them if none were present.\n if (collectionTitles) {\n for (const [id, title] of Object.entries(collectionTitles)) {\n this.collectionTitles.set(id, title);\n }\n }\n\n // Update the data source for each returned page.\n // For loans and web archives, we must account for receiving more pages than we asked for.\n if (\n this.host.profileElement === 'lending' ||\n this.host.profileElement === 'web_archives'\n ) {\n numPages = Math.ceil(results.length / this.pageSize);\n this.endOfDataReached = true;\n if (this.activeOnHost) this.host.setTileCount(this.totalResults);\n }\n for (let i = 0; i < numPages; i += 1) {\n const pageStartIndex = this.pageSize * i;\n this.addFetchedResultsToDataSource(\n pageNumber + i,\n results.slice(pageStartIndex, pageStartIndex + this.pageSize)\n );\n }\n }\n\n // When we reach the end of the data, we can set the infinite scroller's\n // item count to the real total number of results (rather than the\n // temporary estimates based on pages rendered so far).\n const resultCountDiscrepancy = numRows - results.length;\n if (resultCountDiscrepancy > 0) {\n this.endOfDataReached = true;\n if (this.activeOnHost) this.host.setTileCount(this.totalResults);\n }\n\n this.setSearchResultsLoading(false);\n this.requestHostUpdate();\n }\n\n /**\n * Update the datasource from the fetch response\n *\n * @param pageNumber\n * @param results\n */\n private addFetchedResultsToDataSource(\n pageNumber: number,\n results: SearchResult[]\n ): void {\n const tiles: TileModel[] = [];\n results?.forEach(result => {\n if (!result.identifier) return;\n tiles.push(new TileModel(result));\n });\n this.addPage(pageNumber, tiles);\n const visiblePages = this.host.currentVisiblePageNumbers;\n const needsReload = visiblePages.includes(pageNumber);\n if (needsReload) {\n this.refreshVisibleResults();\n }\n }\n\n /**\n * Fetches the aggregation buckets for the given prefix filter type.\n */\n private async fetchPrefixFilterBuckets(\n filterType: PrefixFilterType\n ): Promise<Bucket[]> {\n const trimmedQuery = this.host.baseQuery?.trim();\n if (!this.canPerformSearch) return [];\n\n const filterAggregationKey = prefixFilterAggregationKeys[filterType];\n const sortParams = this.host.sortParam ? [this.host.sortParam] : [];\n\n const params: SearchParams = {\n ...this.pageSpecifierParams,\n query: trimmedQuery || '',\n rows: 0,\n filters: this.filterMap,\n // Only fetch the firstTitle or firstCreator aggregation\n aggregations: { simpleParams: [filterAggregationKey] },\n // Fetch all 26 letter buckets\n aggregationsSize: 26,\n };\n params.uid = await this.requestUID(\n { ...params, sort: sortParams },\n 'aggregations'\n );\n\n const searchResponse = await this.host.searchService?.search(\n params,\n this.host.searchType\n );\n\n return (searchResponse?.success?.response?.aggregations?.[\n filterAggregationKey\n ]?.buckets ?? []) as Bucket[];\n }\n\n /**\n * Fetches and caches the prefix filter counts for the given filter type.\n */\n async updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void> {\n const { facetFetchQueryKey } = this;\n const buckets = await this.fetchPrefixFilterBuckets(filterType);\n\n // Don't update the filter counts for an outdated query (if it has been changed\n // since we sent the request)\n const queryChangedSinceFetch =\n facetFetchQueryKey !== this.facetFetchQueryKey;\n if (queryChangedSinceFetch) return;\n\n // Unpack the aggregation buckets into a simple map like { 'A': 50, 'B': 25, ... }\n this.prefixFilterCountMap = { ...this.prefixFilterCountMap }; // Clone the object to trigger an update\n this.prefixFilterCountMap[filterType] = buckets.reduce(\n (acc: Record<string, number>, bucket: Bucket) => {\n acc[(bucket.key as string).toUpperCase()] = bucket.doc_count;\n return acc;\n },\n {}\n );\n\n this.requestHostUpdate();\n }\n\n /**\n * @inheritdoc\n */\n async updatePrefixFiltersForCurrentSort(): Promise<void> {\n if (['title', 'creator'].includes(this.host.selectedSort as SortField)) {\n const filterType = this.host.selectedSort as PrefixFilterType;\n if (!this.prefixFilterCountMap[filterType]) {\n this.updatePrefixFilterCounts(filterType);\n }\n }\n }\n\n /**\n * @inheritdoc\n */\n refreshLetterCounts(): void {\n if (Object.keys(this.prefixFilterCountMap).length > 0) {\n this.prefixFilterCountMap = {};\n }\n this.updatePrefixFiltersForCurrentSort();\n this.requestHostUpdate();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"collection-browser-data-source.js","sourceRoot":"","sources":["../../../src/data-source/collection-browser-data-source.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,gBAAgB,EAEhB,gBAAgB,EAKhB,UAAU,GACX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,2BAA2B,EAG3B,SAAS,EAGT,SAAS,EACT,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,uBAAuB,EAA4B,MAAM,UAAU,CAAC;AAG7E,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,MAAM,OAAO,2BAA2B;IAsItC,kDAAkD;IAClD;IACE,wEAAwE;IACvD,IACiB;IAClC,mCAAmC;IAC3B,WAAmB,EAAE;QAHZ,SAAI,GAAJ,IAAI,CACa;QAE1B,aAAQ,GAAR,QAAQ,CAAa;QAzI/B;;;WAGG;QACK,UAAK,GAAgC,EAAE,CAAC;QAEhD;;;WAGG;QACK,WAAM,GAAG,CAAC,CAAC;QAEnB;;WAEG;QACK,kBAAa,GAAG,CAAC,CAAC;QAE1B;;WAEG;QACK,sBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;QAE9C;;;WAGG;QACK,qBAAgB,GAAW,EAAE,CAAC;QAEtC;;;WAGG;QACK,yBAAoB,GAAG,KAAK,CAAC;QAErC;;;WAGG;QACK,kBAAa,GAAG,KAAK,CAAC;QAE9B;;WAEG;QACK,oBAAe,GAAG,KAAK,CAAC;QAEhC;;WAEG;QACH,iBAAY,GAAG,CAAC,CAAC;QAEjB;;WAEG;QACH,qBAAgB,GAA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C;SAChC;QACD,IAAI,CAAC,iCAAiC,EAAE,CAAC;QACzC,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import type { ReactiveControllerHost } from 'lit';\nimport {\n AccountExtraInfo,\n Aggregation,\n Bucket,\n CollectionExtraInfo,\n FilterConstraint,\n FilterMap,\n FilterMapBuilder,\n PageElementMap,\n SearchParams,\n SearchResponseSessionContext,\n SearchResult,\n SearchType,\n} from '@internetarchive/search-service';\nimport {\n prefixFilterAggregationKeys,\n type FacetBucket,\n type PrefixFilterType,\n TileModel,\n PrefixFilterCounts,\n RequestKind,\n SortField,\n SORT_OPTIONS,\n} from '../models';\nimport { FACETLESS_PAGE_ELEMENTS, type PageSpecifierParams } from './models';\nimport type { CollectionBrowserDataSourceInterface } from './collection-browser-data-source-interface';\nimport type { CollectionBrowserSearchInterface } from './collection-browser-query-state';\nimport { sha1 } from '../utils/sha1';\nimport { log } from '../utils/log';\n\nexport class CollectionBrowserDataSource\n implements CollectionBrowserDataSourceInterface\n{\n /**\n * All pages of tile models that have been fetched so far, indexed by their page\n * number (with the first being page 1).\n */\n private pages: Record<string, TileModel[]> = {};\n\n /**\n * Tile offset to apply when looking up tiles in the pages, in order to maintain\n * page alignment after tiles are removed.\n */\n private offset = 0;\n\n /**\n * Total number of tile models stored in this data source's pages\n */\n private numTileModels = 0;\n\n /**\n * A set of fetch IDs that are valid for the current query state\n */\n private fetchesInProgress = new Set<string>();\n\n /**\n * A record of the query key used for the last search.\n * If this changes, we need to load new results.\n */\n private previousQueryKey: string = '';\n\n /**\n * Whether the initial page of search results for the current query state\n * is presently being fetched.\n */\n private searchResultsLoading = false;\n\n /**\n * Whether the facets (aggregations) for the current query state are\n * presently being fetched.\n */\n private facetsLoading = false;\n\n /**\n * Whether further query changes should be ignored and not trigger fetches\n */\n private suppressFetches = false;\n\n /**\n * @inheritdoc\n */\n totalResults = 0;\n\n /**\n * @inheritdoc\n */\n endOfDataReached = false;\n\n /**\n * @inheritdoc\n */\n queryInitialized = false;\n\n /**\n * @inheritdoc\n */\n aggregations?: Record<string, Aggregation>;\n\n /**\n * @inheritdoc\n */\n yearHistogramAggregation?: Aggregation;\n\n /**\n * @inheritdoc\n */\n collectionTitles = new Map<string, string>();\n\n /**\n * @inheritdoc\n */\n collectionExtraInfo?: CollectionExtraInfo;\n\n /**\n * @inheritdoc\n */\n accountExtraInfo?: AccountExtraInfo;\n\n /**\n * @inheritdoc\n */\n sessionContext?: SearchResponseSessionContext;\n\n /**\n * @inheritdoc\n */\n pageElements?: PageElementMap;\n\n /**\n * @inheritdoc\n */\n parentCollections?: string[] = [];\n\n /**\n * @inheritdoc\n */\n prefixFilterCountMap: Partial<Record<PrefixFilterType, PrefixFilterCounts>> =\n {};\n\n /**\n * @inheritdoc\n */\n queryErrorMessage?: string;\n\n /**\n * Internal property to store the `resolve` function for the most recent\n * `initialSearchComplete` promise, allowing us to resolve it at the appropriate time.\n */\n private _initialSearchCompleteResolver!: (val: boolean) => void;\n\n /**\n * Internal property to store the private value backing the `initialSearchComplete` getter.\n */\n private _initialSearchCompletePromise: Promise<boolean> = new Promise(res => {\n this._initialSearchCompleteResolver = res;\n });\n\n /**\n * @inheritdoc\n */\n get initialSearchComplete(): Promise<boolean> {\n return this._initialSearchCompletePromise;\n }\n\n // eslint-disable-next-line no-useless-constructor\n constructor(\n /** The host element to which this controller should attach listeners */\n private readonly host: ReactiveControllerHost &\n CollectionBrowserSearchInterface,\n /** Default size of result pages */\n private pageSize: number = 50\n ) {\n // Just setting some property values\n }\n\n hostConnected(): void {\n this.setSearchResultsLoading(this.searchResultsLoading);\n this.setFacetsLoading(this.facetsLoading);\n }\n\n hostUpdate(): void {\n // This reactive controller hook is run whenever the host component (collection-browser) performs an update.\n // We check whether the host's state has changed in a way which should trigger a reset & new results fetch.\n\n // Only the currently-installed data source should react to the update\n if (!this.activeOnHost) return;\n\n // Copy loading states onto the host\n this.setSearchResultsLoading(this.searchResultsLoading);\n this.setFacetsLoading(this.facetsLoading);\n\n // Can't perform searches without a search service\n if (!this.host.searchService) return;\n\n // We should only reset if part of the full query state has changed\n const queryKeyChanged = this.pageFetchQueryKey !== this.previousQueryKey;\n if (!queryKeyChanged) return;\n\n // We should only reset if either:\n // (a) our state permits a valid search, or\n // (b) we have a blank query that we want to show empty results for\n const shouldShowEmptyQueryResults =\n this.host.clearResultsOnEmptyQuery && this.host.baseQuery === '';\n if (!(this.canPerformSearch || shouldShowEmptyQueryResults)) return;\n\n if (this.activeOnHost) this.host.emitQueryStateChanged();\n this.handleQueryChange();\n }\n\n /**\n * Returns whether this data source is the one currently installed on the host component.\n */\n private get activeOnHost(): boolean {\n return this.host.dataSource === this;\n }\n\n /**\n * @inheritdoc\n */\n get size(): number {\n return this.numTileModels;\n }\n\n /**\n * @inheritdoc\n */\n reset(): void {\n log('Resetting CB data source');\n this.pages = {};\n this.aggregations = {};\n this.yearHistogramAggregation = undefined;\n this.pageElements = undefined;\n this.parentCollections = [];\n this.queryErrorMessage = undefined;\n\n this.offset = 0;\n this.numTileModels = 0;\n this.endOfDataReached = false;\n this.queryInitialized = false;\n\n // Invalidate any fetches in progress\n this.fetchesInProgress.clear();\n\n this.setTotalResultCount(0);\n this.requestHostUpdate();\n }\n\n /**\n * @inheritdoc\n */\n addPage(pageNum: number, pageTiles: TileModel[]): void {\n this.pages[pageNum] = pageTiles;\n this.numTileModels += pageTiles.length;\n this.requestHostUpdate();\n }\n\n /**\n * @inheritdoc\n */\n addMultiplePages(firstPageNum: number, tiles: TileModel[]): void {\n const numPages = Math.ceil(tiles.length / this.pageSize);\n for (let i = 0; i < numPages; i += 1) {\n const pageStartIndex = this.pageSize * i;\n this.addPage(\n firstPageNum + i,\n tiles.slice(pageStartIndex, pageStartIndex + this.pageSize)\n );\n }\n\n const visiblePages = this.host.currentVisiblePageNumbers;\n const needsReload = visiblePages.some(\n page => page >= firstPageNum && page <= firstPageNum + numPages\n );\n if (needsReload) {\n this.refreshVisibleResults();\n }\n }\n\n /**\n * @inheritdoc\n */\n getPage(pageNum: number): TileModel[] {\n return this.pages[pageNum];\n }\n\n /**\n * @inheritdoc\n */\n getAllPages(): Record<string, TileModel[]> {\n return this.pages;\n }\n\n /**\n * @inheritdoc\n */\n hasPage(pageNum: number): boolean {\n return !!this.pages[pageNum];\n }\n\n /**\n * @inheritdoc\n */\n getTileModelAt(index: number): TileModel | undefined {\n const pageNum = Math.floor(index / this.pageSize) + 1;\n const indexOnPage = index % this.pageSize;\n return this.pages[pageNum]?.[indexOnPage];\n }\n\n /**\n * @inheritdoc\n */\n indexOf(tile: TileModel): number {\n return Object.values(this.pages).flat().indexOf(tile);\n }\n\n /**\n * @inheritdoc\n */\n getPageSize(): number {\n return this.pageSize;\n }\n\n /**\n * @inheritdoc\n */\n setPageSize(pageSize: number): void {\n this.reset();\n this.pageSize = pageSize;\n }\n\n /**\n * @inheritdoc\n */\n setTotalResultCount(count: number): void {\n this.totalResults = count;\n if (this.activeOnHost) {\n this.host.setTotalResultCount(count);\n }\n }\n\n /**\n * @inheritdoc\n */\n setFetchesSuppressed(suppressed: boolean): void {\n this.suppressFetches = suppressed;\n }\n\n /**\n * @inheritdoc\n */\n async handleQueryChange(): Promise<void> {\n // Don't react to the change if fetches are suppressed for this data source\n if (this.suppressFetches) return;\n\n this.reset();\n\n // Reset the `initialSearchComplete` promise with a new value for the imminent search\n this._initialSearchCompletePromise = new Promise(res => {\n this._initialSearchCompleteResolver = res;\n });\n\n const shouldFetchFacets =\n !this.host.suppressFacets &&\n !FACETLESS_PAGE_ELEMENTS.includes(this.host.profileElement!);\n\n // Fire the initial page & facet requests\n this.queryInitialized = true;\n await Promise.all([\n this.doInitialPageFetch(),\n shouldFetchFacets ? this.fetchFacets() : null,\n ]);\n\n // Resolve the `initialSearchComplete` promise for this search\n this._initialSearchCompleteResolver(true);\n }\n\n /**\n * @inheritdoc\n */\n map(\n callback: (model: TileModel, index: number, array: TileModel[]) => TileModel\n ): void {\n this.pages = Object.fromEntries(\n Object.entries(this.pages).map(([page, tileModels]) => [\n page,\n tileModels.map((model, index, array) =>\n model ? callback(model, index, array) : model\n ),\n ])\n );\n this.requestHostUpdate();\n this.refreshVisibleResults();\n }\n\n /**\n * @inheritdoc\n */\n checkAllTiles = (): void => {\n this.map(model => {\n const cloned = model.clone();\n cloned.checked = true;\n return cloned;\n });\n };\n\n /**\n * @inheritdoc\n */\n uncheckAllTiles = (): void => {\n this.map(model => {\n const cloned = model.clone();\n cloned.checked = false;\n return cloned;\n });\n };\n\n /**\n * @inheritdoc\n */\n removeCheckedTiles = (): void => {\n // To make sure our data source remains page-aligned, we will offset our data source by\n // the number of removed tiles, so that we can just add the offset when the infinite\n // scroller queries for cell contents.\n // This only matters while we're still viewing the same set of results. If the user changes\n // their query/filters/sort, then the data source is overwritten and the offset cleared.\n const { checkedTileModels, uncheckedTileModels } = this;\n const numChecked = checkedTileModels.length;\n if (numChecked === 0) return;\n this.offset += numChecked;\n const newPages: typeof this.pages = {};\n\n // Which page the remaining tile models start on, post-offset\n let offsetPageNumber = Math.floor(this.offset / this.pageSize) + 1;\n let indexOnPage = this.offset % this.pageSize;\n\n // Fill the pages up to that point with empty models\n for (let page = 1; page <= offsetPageNumber; page += 1) {\n const remainingHidden = this.offset - this.pageSize * (page - 1);\n const offsetCellsOnPage = Math.min(this.pageSize, remainingHidden);\n newPages[page] = Array(offsetCellsOnPage).fill(undefined);\n }\n\n // Shift all the remaining tiles into their new positions in the data source\n for (const model of uncheckedTileModels) {\n if (!newPages[offsetPageNumber]) newPages[offsetPageNumber] = [];\n newPages[offsetPageNumber].push(model);\n indexOnPage += 1;\n if (indexOnPage >= this.pageSize) {\n offsetPageNumber += 1;\n indexOnPage = 0;\n }\n }\n\n // Swap in the new pages\n this.pages = newPages;\n this.numTileModels -= numChecked;\n this.requestHostUpdate();\n this.refreshVisibleResults();\n };\n\n /**\n * @inheritdoc\n */\n get checkedTileModels(): TileModel[] {\n return this.getFilteredTileModels(model => model.checked);\n }\n\n /**\n * @inheritdoc\n */\n get uncheckedTileModels(): TileModel[] {\n return this.getFilteredTileModels(model => !model.checked);\n }\n\n /**\n * Returns a flattened, filtered array of all the tile models in the data source\n * for which the given predicate returns a truthy value.\n *\n * @param predicate A callback function to apply on each tile model, as with Array.filter\n * @returns A filtered array of tile models satisfying the predicate\n */\n private getFilteredTileModels(\n predicate: (model: TileModel, index: number, array: TileModel[]) => unknown\n ): TileModel[] {\n return Object.values(this.pages)\n .flat()\n .filter((model, index, array) =>\n model ? predicate(model, index, array) : false\n );\n }\n\n /**\n * @inheritdoc\n */\n get canPerformSearch(): boolean {\n if (!this.host.searchService) return false;\n\n const trimmedQuery = this.host.baseQuery?.trim();\n const hasNonEmptyQuery = !!trimmedQuery;\n const isCollectionSearch = !!this.host.withinCollection;\n const isProfileSearch = !!this.host.withinProfile;\n const hasProfileElement = !!this.host.profileElement;\n const isMetadataSearch = this.host.searchType === SearchType.METADATA;\n\n // Metadata searches within a collection/profile are allowed to have no query.\n // Otherwise, a non-empty query must be set.\n return (\n hasNonEmptyQuery ||\n (isCollectionSearch && isMetadataSearch) ||\n (isProfileSearch && hasProfileElement && isMetadataSearch)\n );\n }\n\n /**\n * Sets the state for whether the initial set of search results for the\n * current query is loading\n */\n private setSearchResultsLoading(loading: boolean): void {\n this.searchResultsLoading = loading;\n if (this.activeOnHost) {\n this.host.setSearchResultsLoading(loading);\n }\n }\n\n /**\n * Sets the state for whether the facets for a query is loading\n */\n private setFacetsLoading(loading: boolean): void {\n this.facetsLoading = loading;\n if (this.activeOnHost) {\n this.host.setFacetsLoading(loading);\n }\n }\n\n /**\n * Requests that the host perform an update, provided this data\n * source is actively installed on it.\n */\n private requestHostUpdate(): void {\n if (this.activeOnHost) {\n this.host.requestUpdate();\n }\n }\n\n /**\n * Requests that the host refresh its visible tiles, provided this\n * data source is actively installed on it.\n */\n private refreshVisibleResults(): void {\n if (this.activeOnHost) {\n this.host.refreshVisibleResults();\n }\n }\n\n /**\n * The query key is a string that uniquely identifies the current search.\n * It consists of:\n * - The current base query\n * - The current collection/profile target & page element\n * - The current search type\n * - Any currently-applied facets\n * - Any currently-applied date range\n * - Any currently-applied prefix filters\n * - The current sort options\n *\n * This lets us internally keep track of queries so we don't persist data that's\n * no longer relevant. Not meant to be human-readable.\n */\n get pageFetchQueryKey(): string {\n const profileKey = `pf;${this.host.withinProfile}--pe;${this.host.profileElement}`;\n const pageTarget = this.host.withinCollection ?? profileKey;\n const sortField = this.host.selectedSort ?? 'none';\n const sortDirection = this.host.sortDirection ?? 'none';\n return `fq:${this.fullQuery}-pt:${pageTarget}-st:${this.host.searchType}-sf:${sortField}-sd:${sortDirection}`;\n }\n\n /**\n * Similar to `pageFetchQueryKey` above, but excludes sort fields since they\n * are not relevant in determining aggregation queries.\n */\n get facetFetchQueryKey(): string {\n const profileKey = `pf;${this.host.withinProfile}--pe;${this.host.profileElement}`;\n const pageTarget = this.host.withinCollection ?? profileKey;\n return `fq:${this.fullQuery}-pt:${pageTarget}-st:${this.host.searchType}`;\n }\n\n /**\n * Constructs a search service FilterMap object from the combination of\n * all the currently-applied filters. This includes any facets, letter\n * filters, and date range.\n */\n get filterMap(): FilterMap {\n const builder = new FilterMapBuilder();\n\n // Add the date range, if applicable\n if (this.host.minSelectedDate) {\n builder.addFilter(\n 'year',\n this.host.minSelectedDate,\n FilterConstraint.GREATER_OR_EQUAL\n );\n }\n if (this.host.maxSelectedDate) {\n builder.addFilter(\n 'year',\n this.host.maxSelectedDate,\n FilterConstraint.LESS_OR_EQUAL\n );\n }\n\n // Add any selected facets\n if (this.host.selectedFacets) {\n for (const [facetName, facetValues] of Object.entries(\n this.host.selectedFacets\n )) {\n const { name, values } = this.prepareFacetForFetch(\n facetName,\n facetValues\n );\n for (const [value, bucket] of Object.entries(values)) {\n let constraint;\n if (bucket.state === 'selected') {\n constraint = FilterConstraint.INCLUDE;\n } else if (bucket.state === 'hidden') {\n constraint = FilterConstraint.EXCLUDE;\n }\n\n if (constraint) {\n builder.addFilter(name, value, constraint);\n }\n }\n }\n }\n\n // Add any letter filters\n if (this.host.selectedTitleFilter) {\n builder.addFilter(\n 'firstTitle',\n this.host.selectedTitleFilter,\n FilterConstraint.INCLUDE\n );\n }\n if (this.host.selectedCreatorFilter) {\n builder.addFilter(\n 'firstCreator',\n this.host.selectedCreatorFilter,\n FilterConstraint.INCLUDE\n );\n }\n\n const filterMap = builder.build();\n return filterMap;\n }\n\n /**\n * Produces a compact unique ID for a search request that can help with debugging\n * on the backend by making related requests easier to trace through different services.\n * (e.g., tying the hits/aggregations requests for the same page back to a single hash).\n *\n * @param params The search service parameters for the request\n * @param kind The kind of request (hits-only, aggregations-only, or both)\n * @returns A Promise resolving to the uid to apply to the request\n */\n async requestUID(params: SearchParams, kind: RequestKind): Promise<string> {\n const paramsToHash = JSON.stringify({\n pageType: params.pageType,\n pageTarget: params.pageTarget,\n query: params.query,\n fields: params.fields,\n filters: params.filters,\n sort: params.sort,\n searchType: this.host.searchType,\n });\n\n const fullQueryHash = (await sha1(paramsToHash)).slice(0, 20); // First 80 bits of SHA-1 are plenty for this\n const sessionId = (await this.host.getSessionId()).slice(0, 20); // Likewise\n const page = params.page ?? 0;\n const kindPrefix = kind.charAt(0); // f = full, h = hits, a = aggregations\n const currentTime = Date.now();\n\n return `R:${fullQueryHash}-S:${sessionId}-P:${page}-K:${kindPrefix}-T:${currentTime}`;\n }\n\n /**\n * @inheritdoc\n */\n get pageSpecifierParams(): PageSpecifierParams | null {\n if (this.host.withinCollection) {\n return {\n pageType: 'collection_details',\n pageTarget: this.host.withinCollection,\n };\n }\n if (this.host.withinProfile) {\n return {\n pageType: 'account_details',\n pageTarget: this.host.withinProfile,\n pageElements: this.host.profileElement\n ? [this.host.profileElement]\n : [],\n };\n }\n return null;\n }\n\n /**\n * The full query, including year facets and date range clauses\n */\n private get fullQuery(): string | undefined {\n let fullQuery = this.host.baseQuery?.trim() ?? '';\n\n const { facetQuery, dateRangeQueryClause, sortFilterQueries } = this;\n\n if (facetQuery) {\n fullQuery += ` AND ${facetQuery}`;\n }\n if (dateRangeQueryClause) {\n fullQuery += ` AND ${dateRangeQueryClause}`;\n }\n if (sortFilterQueries) {\n fullQuery += ` AND ${sortFilterQueries}`;\n }\n return fullQuery.trim();\n }\n\n /**\n * Generates a query string representing the current set of applied facets\n *\n * Example: `mediatype:(\"collection\" OR \"audio\" OR -\"etree\") AND year:(\"2000\" OR \"2001\")`\n */\n private get facetQuery(): string | undefined {\n if (!this.host.selectedFacets) return undefined;\n const facetClauses = [];\n for (const [facetName, facetValues] of Object.entries(\n this.host.selectedFacets\n )) {\n facetClauses.push(this.buildFacetClause(facetName, facetValues));\n }\n return this.joinFacetClauses(facetClauses)?.trim();\n }\n\n private get dateRangeQueryClause(): string | undefined {\n if (!this.host.minSelectedDate || !this.host.maxSelectedDate) {\n return undefined;\n }\n\n return `year:[${this.host.minSelectedDate} TO ${this.host.maxSelectedDate}]`;\n }\n\n private get sortFilterQueries(): string {\n const queries = [this.titleQuery, this.creatorQuery];\n return queries.filter(q => q).join(' AND ');\n }\n\n /**\n * Returns a query clause identifying the currently selected title filter,\n * e.g., `firstTitle:X`.\n */\n private get titleQuery(): string | undefined {\n return this.host.selectedTitleFilter\n ? `firstTitle:${this.host.selectedTitleFilter}`\n : undefined;\n }\n\n /**\n * Returns a query clause identifying the currently selected creator filter,\n * e.g., `firstCreator:X`.\n */\n private get creatorQuery(): string | undefined {\n return this.host.selectedCreatorFilter\n ? `firstCreator:${this.host.selectedCreatorFilter}`\n : undefined;\n }\n\n /**\n * Builds an OR-joined facet clause for the given facet name and values.\n *\n * E.g., for name `subject` and values\n * `{ foo: { state: 'selected' }, bar: { state: 'hidden' } }`\n * this will produce the clause\n * `subject:(\"foo\" OR -\"bar\")`.\n *\n * @param facetName The facet type (e.g., 'collection')\n * @param facetValues The facet buckets, mapped by their keys\n */\n private buildFacetClause(\n facetName: string,\n facetValues: Record<string, FacetBucket>\n ): string {\n const { name: facetQueryName, values } = this.prepareFacetForFetch(\n facetName,\n facetValues\n );\n const facetEntries = Object.entries(values);\n if (facetEntries.length === 0) return '';\n\n const facetValuesArray: string[] = [];\n for (const [key, facetData] of facetEntries) {\n const plusMinusPrefix = facetData.state === 'hidden' ? '-' : '';\n facetValuesArray.push(`${plusMinusPrefix}\"${key}\"`);\n }\n\n const valueQuery = facetValuesArray.join(` OR `);\n return `${facetQueryName}:(${valueQuery})`;\n }\n\n /**\n * Handles some special pre-request normalization steps for certain facet types\n * that require them.\n *\n * @param facetName The name of the facet type (e.g., 'language')\n * @param facetValues An array of values for that facet type\n */\n private prepareFacetForFetch(\n facetName: string,\n facetValues: Record<string, FacetBucket>\n ): { name: string; values: Record<string, FacetBucket> } {\n // eslint-disable-next-line prefer-const\n let [normalizedName, normalizedValues] = [facetName, facetValues];\n\n // The full \"search engine\" name of the lending field is \"lending___status\"\n if (facetName === 'lending') {\n normalizedName = 'lending___status';\n }\n\n return {\n name: normalizedName,\n values: normalizedValues,\n };\n }\n\n /**\n * Takes an array of facet clauses, and combines them into a\n * full AND-joined facet query string. Empty clauses are ignored.\n */\n private joinFacetClauses(facetClauses: string[]): string | undefined {\n const nonEmptyFacetClauses = facetClauses.filter(\n clause => clause.length > 0\n );\n return nonEmptyFacetClauses.length > 0\n ? `(${nonEmptyFacetClauses.join(' AND ')})`\n : undefined;\n }\n\n /**\n * Fires a backend request to fetch a set of aggregations (representing UI facets) for\n * the current search state.\n */\n private async fetchFacets(): Promise<void> {\n const trimmedQuery = this.host.baseQuery?.trim();\n if (!this.canPerformSearch) return;\n\n const { facetFetchQueryKey } = this;\n if (this.fetchesInProgress.has(facetFetchQueryKey)) return;\n this.fetchesInProgress.add(facetFetchQueryKey);\n\n const sortParams = this.host.sortParam ? [this.host.sortParam] : [];\n const params: SearchParams = {\n ...this.pageSpecifierParams,\n query: trimmedQuery || '',\n rows: 0,\n filters: this.filterMap,\n // Fetch a few extra buckets beyond the 6 we show, in case some get suppressed\n aggregationsSize: 10,\n // Note: we don't need an aggregations param to fetch the default aggregations from the PPS.\n // The default aggregations for the search_results page type should be what we need here.\n };\n params.uid = await this.requestUID(\n { ...params, sort: sortParams },\n 'aggregations'\n );\n\n this.setFacetsLoading(true);\n const searchResponse = await this.host.searchService?.search(\n params,\n this.host.searchType\n );\n const success = searchResponse?.success;\n\n // This is checking to see if the query has changed since the data was fetched.\n // If so, we just want to discard this set of aggregations because they are\n // likely no longer valid for the newer query.\n const queryChangedSinceFetch =\n !this.fetchesInProgress.has(facetFetchQueryKey);\n this.fetchesInProgress.delete(facetFetchQueryKey);\n if (queryChangedSinceFetch) return;\n\n if (!success) {\n const errorMsg = searchResponse?.error?.message;\n const detailMsg = searchResponse?.error?.details?.message;\n\n if (!errorMsg && !detailMsg) {\n // @ts-ignore: Property 'Sentry' does not exist on type 'Window & typeof globalThis'\n window?.Sentry?.captureMessage?.(\n 'Missing or malformed facet response from backend',\n 'error'\n );\n }\n\n this.setFacetsLoading(false);\n return;\n }\n\n const { aggregations, collectionTitles } = success.response;\n this.aggregations = aggregations;\n\n if (collectionTitles) {\n for (const [id, title] of Object.entries(collectionTitles)) {\n this.collectionTitles.set(id, title);\n }\n }\n\n this.yearHistogramAggregation =\n success?.response?.aggregations?.year_histogram;\n\n this.setFacetsLoading(false);\n this.requestHostUpdate();\n }\n\n /**\n * Performs the initial page fetch(es) for the current search state.\n */\n private async doInitialPageFetch(): Promise<void> {\n this.setSearchResultsLoading(true);\n // Try to batch 2 initial page requests when possible\n await this.fetchPage(this.host.initialPageNumber, 2);\n }\n\n /**\n * Fetches one or more pages of results and updates the data source.\n *\n * @param pageNumber The page number to fetch\n * @param numInitialPages If this is an initial page fetch (`pageNumber = 1`),\n * specifies how many pages to batch together in one request. Ignored\n * if `pageNumber != 1`, defaulting to a single page.\n */\n async fetchPage(pageNumber: number, numInitialPages = 1): Promise<void> {\n const trimmedQuery = this.host.baseQuery?.trim();\n if (!this.canPerformSearch) return;\n\n // if we already have data, don't fetch again\n if (this.hasPage(pageNumber)) return;\n\n if (this.endOfDataReached) return;\n\n // Batch multiple initial page requests together if needed (e.g., can request\n // pages 1 and 2 together in a single request).\n let numPages = pageNumber === 1 ? numInitialPages : 1;\n const numRows = this.pageSize * numPages;\n\n // if a fetch is already in progress for this query and page, don't fetch again\n const { pageFetchQueryKey } = this;\n const currentPageKey = `${pageFetchQueryKey}-p:${pageNumber}`;\n if (this.fetchesInProgress.has(currentPageKey)) return;\n\n for (let i = 0; i < numPages; i += 1) {\n this.fetchesInProgress.add(`${pageFetchQueryKey}-p:${pageNumber + i}`);\n }\n this.previousQueryKey = pageFetchQueryKey;\n\n let sortParams = this.host.sortParam ? [this.host.sortParam] : [];\n // TODO eventually the PPS should handle these defaults natively\n const isDefaultProfileSort =\n this.host.withinProfile && this.host.selectedSort === SortField.default;\n if (isDefaultProfileSort && this.host.defaultSortParam) {\n const sortOption =\n SORT_OPTIONS[this.host.defaultSortParam.field as SortField];\n if (sortOption.searchServiceKey) {\n sortParams = [\n {\n field: sortOption.searchServiceKey,\n direction: 'desc',\n },\n ];\n }\n }\n\n const params: SearchParams = {\n ...this.pageSpecifierParams,\n query: trimmedQuery || '',\n page: pageNumber,\n rows: numRows,\n sort: sortParams,\n filters: this.filterMap,\n aggregations: { omit: true },\n };\n params.uid = await this.requestUID(params, 'hits');\n\n log('=== FIRING PAGE REQUEST ===', params);\n const searchResponse = await this.host.searchService?.search(\n params,\n this.host.searchType\n );\n log('=== RECEIVED PAGE RESPONSE IN CB ===', searchResponse);\n const success = searchResponse?.success;\n\n // This is checking to see if the fetch has been invalidated since it was fired off.\n // If so, we just want to discard the response since it is for an obsolete query state.\n if (!this.fetchesInProgress.has(currentPageKey)) return;\n for (let i = 0; i < numPages; i += 1) {\n this.fetchesInProgress.delete(`${pageFetchQueryKey}-p:${pageNumber + i}`);\n }\n\n if (!success) {\n const errorMsg = searchResponse?.error?.message;\n const detailMsg = searchResponse?.error?.details?.message;\n\n this.queryErrorMessage = `${errorMsg ?? ''}${\n detailMsg ? `; ${detailMsg}` : ''\n }`;\n\n if (!this.queryErrorMessage) {\n this.queryErrorMessage = 'Missing or malformed response from backend';\n // @ts-ignore: Property 'Sentry' does not exist on type 'Window & typeof globalThis'\n window?.Sentry?.captureMessage?.(this.queryErrorMessage, 'error');\n }\n\n this.setSearchResultsLoading(false);\n this.requestHostUpdate();\n return;\n }\n\n this.setTotalResultCount(success.response.totalResults - this.offset);\n if (this.activeOnHost && this.totalResults === 0) {\n // display event to offshoot when result count is zero.\n this.host.emitEmptyResults();\n }\n\n this.sessionContext = success.sessionContext;\n if (this.host.withinCollection) {\n this.collectionExtraInfo = success.response.collectionExtraInfo;\n\n // For collections, we want the UI to respect the default sort option\n // which can be specified in metadata, or otherwise assumed to be week:desc\n if (this.activeOnHost) {\n this.host.applyDefaultCollectionSort(this.collectionExtraInfo);\n }\n\n if (this.collectionExtraInfo) {\n this.parentCollections = [].concat(\n this.collectionExtraInfo.public_metadata?.collection ?? []\n );\n }\n } else if (this.host.withinProfile) {\n this.accountExtraInfo = success.response.accountExtraInfo;\n this.pageElements = success.response.pageElements;\n }\n\n const { results, collectionTitles } = success.response;\n if (results && results.length > 0) {\n // Load any collection titles present on the response into the cache,\n // or queue up preload fetches for them if none were present.\n if (collectionTitles) {\n for (const [id, title] of Object.entries(collectionTitles)) {\n this.collectionTitles.set(id, title);\n }\n }\n\n // Update the data source for each returned page.\n // For loans and web archives, we must account for receiving more pages than we asked for.\n if (\n this.host.profileElement === 'lending' ||\n this.host.profileElement === 'web_archives'\n ) {\n numPages = Math.ceil(results.length / this.pageSize);\n this.endOfDataReached = true;\n if (this.activeOnHost) this.host.setTileCount(this.totalResults);\n }\n for (let i = 0; i < numPages; i += 1) {\n const pageStartIndex = this.pageSize * i;\n this.addFetchedResultsToDataSource(\n pageNumber + i,\n results.slice(pageStartIndex, pageStartIndex + this.pageSize)\n );\n }\n }\n\n // When we reach the end of the data, we can set the infinite scroller's\n // item count to the real total number of results (rather than the\n // temporary estimates based on pages rendered so far).\n const resultCountDiscrepancy = numRows - results.length;\n if (resultCountDiscrepancy > 0) {\n this.endOfDataReached = true;\n if (this.activeOnHost) this.host.setTileCount(this.totalResults);\n }\n\n this.setSearchResultsLoading(false);\n this.requestHostUpdate();\n }\n\n /**\n * Update the datasource from the fetch response\n *\n * @param pageNumber\n * @param results\n */\n private addFetchedResultsToDataSource(\n pageNumber: number,\n results: SearchResult[]\n ): void {\n const tiles: TileModel[] = [];\n results?.forEach(result => {\n if (!result.identifier) return;\n tiles.push(new TileModel(result));\n });\n this.addPage(pageNumber, tiles);\n const visiblePages = this.host.currentVisiblePageNumbers;\n const needsReload = visiblePages.includes(pageNumber);\n if (needsReload) {\n this.refreshVisibleResults();\n }\n }\n\n /**\n * Fetches the aggregation buckets for the given prefix filter type.\n */\n private async fetchPrefixFilterBuckets(\n filterType: PrefixFilterType\n ): Promise<Bucket[]> {\n const trimmedQuery = this.host.baseQuery?.trim();\n if (!this.canPerformSearch) return [];\n\n const filterAggregationKey = prefixFilterAggregationKeys[filterType];\n const sortParams = this.host.sortParam ? [this.host.sortParam] : [];\n\n const params: SearchParams = {\n ...this.pageSpecifierParams,\n query: trimmedQuery || '',\n rows: 0,\n filters: this.filterMap,\n // Only fetch the firstTitle or firstCreator aggregation\n aggregations: { simpleParams: [filterAggregationKey] },\n // Fetch all 26 letter buckets\n aggregationsSize: 26,\n };\n params.uid = await this.requestUID(\n { ...params, sort: sortParams },\n 'aggregations'\n );\n\n const searchResponse = await this.host.searchService?.search(\n params,\n this.host.searchType\n );\n\n return (searchResponse?.success?.response?.aggregations?.[\n filterAggregationKey\n ]?.buckets ?? []) as Bucket[];\n }\n\n /**\n * Fetches and caches the prefix filter counts for the given filter type.\n */\n async updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void> {\n const { facetFetchQueryKey } = this;\n const buckets = await this.fetchPrefixFilterBuckets(filterType);\n\n // Don't update the filter counts for an outdated query (if it has been changed\n // since we sent the request)\n const queryChangedSinceFetch =\n facetFetchQueryKey !== this.facetFetchQueryKey;\n if (queryChangedSinceFetch) return;\n\n // Unpack the aggregation buckets into a simple map like { 'A': 50, 'B': 25, ... }\n this.prefixFilterCountMap = { ...this.prefixFilterCountMap }; // Clone the object to trigger an update\n this.prefixFilterCountMap[filterType] = buckets.reduce(\n (acc: Record<string, number>, bucket: Bucket) => {\n acc[(bucket.key as string).toUpperCase()] = bucket.doc_count;\n return acc;\n },\n {}\n );\n\n this.requestHostUpdate();\n }\n\n /**\n * @inheritdoc\n */\n async updatePrefixFiltersForCurrentSort(): Promise<void> {\n if (['title', 'creator'].includes(this.host.selectedSort as SortField)) {\n const filterType = this.host.selectedSort as PrefixFilterType;\n if (!this.prefixFilterCountMap[filterType]) {\n this.updatePrefixFilterCounts(filterType);\n }\n }\n }\n\n /**\n * @inheritdoc\n */\n refreshLetterCounts(): void {\n if (Object.keys(this.prefixFilterCountMap).length > 0) {\n this.prefixFilterCountMap = {};\n }\n this.updatePrefixFiltersForCurrentSort();\n this.requestHostUpdate();\n }\n}\n"]}
|
|
@@ -20,6 +20,7 @@ export const getMockSuccessSingleResult = () => ({
|
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
rawResponse: {},
|
|
23
|
+
sessionContext: {},
|
|
23
24
|
response: {
|
|
24
25
|
totalResults: 1,
|
|
25
26
|
returnedCount: 1,
|
|
@@ -57,6 +58,7 @@ export const getMockSuccessManyFields = () => ({
|
|
|
57
58
|
},
|
|
58
59
|
},
|
|
59
60
|
rawResponse: {},
|
|
61
|
+
sessionContext: {},
|
|
60
62
|
response: {
|
|
61
63
|
totalResults: 1,
|
|
62
64
|
returnedCount: 1,
|
|
@@ -115,6 +117,7 @@ export const getMockSuccessWithYearHistogramAggs = () => ({
|
|
|
115
117
|
},
|
|
116
118
|
},
|
|
117
119
|
rawResponse: {},
|
|
120
|
+
sessionContext: {},
|
|
118
121
|
response: {
|
|
119
122
|
totalResults: 1,
|
|
120
123
|
returnedCount: 1,
|
|
@@ -162,6 +165,7 @@ export const getMockSuccessLoggedInResult = () => ({
|
|
|
162
165
|
},
|
|
163
166
|
},
|
|
164
167
|
rawResponse: {},
|
|
168
|
+
sessionContext: {},
|
|
165
169
|
response: {
|
|
166
170
|
totalResults: 1,
|
|
167
171
|
returnedCount: 1,
|
|
@@ -201,6 +205,7 @@ export const getMockSuccessNoPreviewResult = () => ({
|
|
|
201
205
|
},
|
|
202
206
|
},
|
|
203
207
|
rawResponse: {},
|
|
208
|
+
sessionContext: {},
|
|
204
209
|
response: {
|
|
205
210
|
totalResults: 1,
|
|
206
211
|
returnedCount: 1,
|
|
@@ -238,6 +243,7 @@ export const getMockSuccessLoggedInAndNoPreviewResult = () => ({
|
|
|
238
243
|
},
|
|
239
244
|
},
|
|
240
245
|
rawResponse: {},
|
|
246
|
+
sessionContext: {},
|
|
241
247
|
response: {
|
|
242
248
|
totalResults: 1,
|
|
243
249
|
returnedCount: 1,
|
|
@@ -275,6 +281,7 @@ export const getMockSuccessFirstTitleResult = () => ({
|
|
|
275
281
|
},
|
|
276
282
|
},
|
|
277
283
|
rawResponse: {},
|
|
284
|
+
sessionContext: {},
|
|
278
285
|
response: {
|
|
279
286
|
totalResults: 1,
|
|
280
287
|
returnedCount: 1,
|
|
@@ -316,6 +323,7 @@ export const getMockSuccessFirstCreatorResult = () => ({
|
|
|
316
323
|
},
|
|
317
324
|
},
|
|
318
325
|
rawResponse: {},
|
|
326
|
+
sessionContext: {},
|
|
319
327
|
response: {
|
|
320
328
|
totalResults: 1,
|
|
321
329
|
returnedCount: 1,
|
|
@@ -357,6 +365,7 @@ export const getMockSuccessWithCollectionTitles = () => ({
|
|
|
357
365
|
},
|
|
358
366
|
},
|
|
359
367
|
rawResponse: {},
|
|
368
|
+
sessionContext: {},
|
|
360
369
|
response: {
|
|
361
370
|
totalResults: 2,
|
|
362
371
|
returnedCount: 2,
|
|
@@ -406,6 +415,7 @@ export const getMockSuccessWithCollectionAggregations = () => ({
|
|
|
406
415
|
},
|
|
407
416
|
},
|
|
408
417
|
rawResponse: {},
|
|
418
|
+
sessionContext: {},
|
|
409
419
|
response: {
|
|
410
420
|
totalResults: 0,
|
|
411
421
|
returnedCount: 0,
|
|
@@ -454,6 +464,7 @@ export const getMockSuccessSingleResultWithSort = (resultsSpy) => ({
|
|
|
454
464
|
},
|
|
455
465
|
},
|
|
456
466
|
rawResponse: {},
|
|
467
|
+
sessionContext: {},
|
|
457
468
|
response: {
|
|
458
469
|
totalResults: 1,
|
|
459
470
|
returnedCount: 1,
|
|
@@ -494,6 +505,7 @@ export const getMockSuccessMultipleResults = () => ({
|
|
|
494
505
|
},
|
|
495
506
|
},
|
|
496
507
|
rawResponse: {},
|
|
508
|
+
sessionContext: {},
|
|
497
509
|
response: {
|
|
498
510
|
totalResults: 2,
|
|
499
511
|
returnedCount: 2,
|
|
@@ -539,6 +551,7 @@ export const getMockSuccessNoResults = () => ({
|
|
|
539
551
|
},
|
|
540
552
|
},
|
|
541
553
|
rawResponse: {},
|
|
554
|
+
sessionContext: {},
|
|
542
555
|
response: {
|
|
543
556
|
totalResults: 0,
|
|
544
557
|
returnedCount: 0,
|
|
@@ -569,6 +582,7 @@ export const getMockSuccessMultiLineDescription = () => ({
|
|
|
569
582
|
},
|
|
570
583
|
},
|
|
571
584
|
rawResponse: {},
|
|
585
|
+
sessionContext: {},
|
|
572
586
|
response: {
|
|
573
587
|
totalResults: 1,
|
|
574
588
|
returnedCount: 1,
|
|
@@ -607,6 +621,7 @@ export const getMockSuccessExtraQuotedHref = () => ({
|
|
|
607
621
|
},
|
|
608
622
|
},
|
|
609
623
|
rawResponse: {},
|
|
624
|
+
sessionContext: {},
|
|
610
625
|
response: {
|
|
611
626
|
totalResults: 1,
|
|
612
627
|
returnedCount: 1,
|
|
@@ -645,6 +660,7 @@ export const getMockSuccessWithDefaultSort = () => ({
|
|
|
645
660
|
},
|
|
646
661
|
},
|
|
647
662
|
rawResponse: {},
|
|
663
|
+
sessionContext: {},
|
|
648
664
|
response: {
|
|
649
665
|
totalResults: 1,
|
|
650
666
|
returnedCount: 1,
|
|
@@ -687,6 +703,7 @@ export const getMockSuccessWithConciseDefaultSort = () => ({
|
|
|
687
703
|
},
|
|
688
704
|
},
|
|
689
705
|
rawResponse: {},
|
|
706
|
+
sessionContext: {},
|
|
690
707
|
response: {
|
|
691
708
|
totalResults: 1,
|
|
692
709
|
returnedCount: 1,
|
|
@@ -729,6 +746,7 @@ export const getMockSuccessWithDefaultFavSort = () => ({
|
|
|
729
746
|
},
|
|
730
747
|
},
|
|
731
748
|
rawResponse: {},
|
|
749
|
+
sessionContext: {},
|
|
732
750
|
response: {
|
|
733
751
|
totalResults: 1,
|
|
734
752
|
returnedCount: 1,
|
|
@@ -771,6 +789,7 @@ export const getMockSuccessWithParentCollections = () => ({
|
|
|
771
789
|
},
|
|
772
790
|
},
|
|
773
791
|
rawResponse: {},
|
|
792
|
+
sessionContext: {},
|
|
774
793
|
response: {
|
|
775
794
|
totalResults: 1,
|
|
776
795
|
returnedCount: 1,
|
|
@@ -813,6 +832,7 @@ export const getMockSuccessWithWebArchiveHits = () => ({
|
|
|
813
832
|
},
|
|
814
833
|
},
|
|
815
834
|
rawResponse: {},
|
|
835
|
+
sessionContext: {},
|
|
816
836
|
response: {
|
|
817
837
|
totalResults: 1,
|
|
818
838
|
returnedCount: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-search-responses.js","sourceRoot":"","sources":["../../../test/mocks/mock-search-responses.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,OAAO,EAEP,kBAAkB,EAClB,OAAO,GACR,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,2EAA2E,CAAC;AAC1G,OAAO,EAAE,sBAAsB,EAAE,MAAM,+DAA+D,CAAC;AAEvG,MAAM,CAAC,MAAM,0BAA0B,GAGnC,GAAG,EAAE,CAAC,CAAC;IACT,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,gBAAgB,EAAE;gB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B,CAAC,YAAY,EAAE,KAAK,EAAE;QACxE,OAAO,EAAE,KAAK;KACf,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAG/B,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import type { Result } from '@internetarchive/result-type';\nimport {\n Aggregation,\n ItemHit,\n SearchResponse,\n SearchServiceError,\n TextHit,\n} from '@internetarchive/search-service';\nimport { WebArchiveHit } from '@internetarchive/search-service/dist/src/models/hit-types/web-archive-hit';\nimport { SearchServiceErrorType } from '@internetarchive/search-service/dist/src/search-service-error';\n\nexport const getMockSuccessSingleResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessManyFields: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'many-fields',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'many-fields',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n avg_rating: 3.5,\n collection: ['foo', 'bar', 'no-preview', 'loggedin'],\n collection_files_count: 123,\n collection_size: 234,\n creator: ['baz', 'boop'],\n date: '2010-01-03T01:23:45Z',\n addeddate: '2010-01-01T01:23:45Z',\n publicdate: '2010-01-02T01:23:45Z',\n reviewdate: '2010-01-04T01:23:45Z',\n description: 'foo bar baz',\n downloads: 246,\n issue: 1,\n item_count: 20,\n mediatype: 'texts',\n num_favorites: 12,\n num_reviews: 23,\n source: 'foo bar',\n subject: ['baz', 'quux'],\n title: 'Foo Bar',\n volume: 2,\n week: 50,\n __href__: 'https://archive.org/details/foo',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithYearHistogramAggs: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'years',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'years',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n aggregations: {\n subject: new Aggregation({\n buckets: [\n {\n key: 'foo',\n doc_count: 3,\n },\n ],\n }),\n year_histogram: new Aggregation({\n buckets: [1, 2, 3, 3, 2, 1],\n first_bucket_key: 1950,\n last_bucket_key: 2000,\n interval: 10,\n number_buckets: 6,\n }),\n },\n results: [],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessLoggedInResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'loggedin',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'loggedin',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'loggedin', 'bar'],\n title: 'foo',\n mediatype: 'data',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessNoPreviewResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'no-preview',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'no-preview',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'no-preview', 'bar'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessLoggedInAndNoPreviewResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'loggedin-no-preview',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'loggedin-no-preview',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'loggedin', 'no-preview', 'bar'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessFirstTitleResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'first-title',\n sort: ['title', 'asc'],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'first-title',\n sort: ['title', 'asc'],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n aggregations: {\n firstTitle: new Aggregation({\n buckets: [{ key: 'X', doc_count: 1 }],\n }),\n },\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessFirstCreatorResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'first-creator',\n sort: ['creator', 'asc'],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'first-creator',\n sort: ['creator', 'asc'],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n aggregations: {\n firstCreator: new Aggregation({\n buckets: [{ key: 'X', doc_count: 1 }],\n }),\n },\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithCollectionTitles: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 2,\n returnedCount: 2,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n new ItemHit({\n fields: {\n identifier: 'bar',\n collection: ['baz', 'boop'],\n },\n }),\n ],\n collectionTitles: {\n foo: 'Foo Collection',\n bar: 'Bar Collection',\n baz: 'Baz Collection',\n boop: 'Boop Collection',\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithCollectionAggregations: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 0,\n returnedCount: 0,\n results: [],\n aggregations: {\n collection: new Aggregation({\n buckets: [\n {\n key: 'foo',\n doc_count: 10,\n },\n {\n key: 'bar',\n doc_count: 10,\n },\n ],\n }),\n },\n collectionTitles: {\n foo: 'Foo',\n bar: 'Bar',\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessSingleResultWithSort: (\n resultsSpy: Function\n) => Result<SearchResponse, SearchServiceError> = (resultsSpy: Function) => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'with-sort',\n sort: ['foo:asc'],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'with-sort',\n sort: ['foo:asc'],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n get results() {\n resultsSpy();\n return [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n ];\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessMultipleResults: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 2,\n returnedCount: 2,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n __href__: '/foo',\n },\n }),\n new ItemHit({\n fields: {\n identifier: 'bar',\n collection: ['baz', 'boop'],\n __href__: '/bar',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessNoResults: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'no-results',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'no-results',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 0,\n returnedCount: 0,\n results: [],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessMultiLineDescription: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'multi-line-description',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'multi-line-description',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n description: ['line1', 'line2'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessExtraQuotedHref: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'extra-quoted-href',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'extra-quoted-href',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new TextHit({\n fields: {\n identifier: 'foo',\n title: 'Foo',\n __href__: '/details/foo?q=%22%22quoted+query%22%22',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithDefaultSort: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'default-sort',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'default-sort',\n sort: ['titleSorter', 'identifier'],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n 'sort-by': 'titleSorter',\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithConciseDefaultSort: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'default-sort-concise',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'default-sort-concise',\n sort: ['addeddate:desc', 'identifier'],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n 'sort-by': '-addeddate',\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithDefaultFavSort: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'fav-sort',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'fav-sort',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n identifier: 'fav-foo',\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithParentCollections: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'parent-collections',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'parent-collections',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n collection: ['foo', 'bar'],\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithWebArchiveHits: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'web-archive',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'web-archive',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new WebArchiveHit({\n fields: {\n url: 'https://example.com',\n capture_dates: ['2010-01-02T03:04:05Z'],\n __href__:\n 'https://web.archive.org/web/20100102030405/https%3A%2F%2Fexample.com',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockErrorResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n error: new SearchServiceError(SearchServiceErrorType.networkError, 'foo', {\n message: 'bar',\n }),\n});\n\nexport const getMockMalformedResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({});\n"]}
|
|
1
|
+
{"version":3,"file":"mock-search-responses.js","sourceRoot":"","sources":["../../../test/mocks/mock-search-responses.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,OAAO,EAEP,kBAAkB,EAClB,OAAO,GACR,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,2EAA2E,CAAC;AAC1G,OAAO,EAAE,sBAAsB,EAAE,MAAM,+DAA+D,CAAC;AAEvG,MAAM,CAAC,MAAM,0BAA0B,GAGnC,GAAG,EAAE,CAAC,CAAC;IACT,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,gBAAgB,EAAE;gBAChB,UAAU,EAAE,gBAAgB;gBAC5B,IAAI,EAAE,EAAE;aACT;YACD,eAAe,EAAE;gBACf,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ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P,IAAI,aAAa,CAAC;oBAChB,MAAM,EAAE;wBACN,GAAG,EAAE,qBAAqB;wBAC1B,aAAa,EAAE,CAAC,sBAAsB,CAAC;wBACvC,QAAQ,EACN,sEAAsE;qBACzE;iBACF,CAAC;aACH;SACF;QACD,cAAc,EAAE;YACd,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,CAAC;SACd;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAG3B,GAAG,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,IAAI,kBAAkB,CAAC,sBAAsB,CAAC,YAAY,EAAE,KAAK,EAAE;QACxE,OAAO,EAAE,KAAK;KACf,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAG/B,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import type { Result } from '@internetarchive/result-type';\nimport {\n Aggregation,\n ItemHit,\n SearchResponse,\n SearchServiceError,\n TextHit,\n} from '@internetarchive/search-service';\nimport { WebArchiveHit } from '@internetarchive/search-service/dist/src/models/hit-types/web-archive-hit';\nimport { SearchServiceErrorType } from '@internetarchive/search-service/dist/src/search-service-error';\n\nexport const getMockSuccessSingleResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessManyFields: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'many-fields',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'many-fields',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n avg_rating: 3.5,\n collection: ['foo', 'bar', 'no-preview', 'loggedin'],\n collection_files_count: 123,\n collection_size: 234,\n creator: ['baz', 'boop'],\n date: '2010-01-03T01:23:45Z',\n addeddate: '2010-01-01T01:23:45Z',\n publicdate: '2010-01-02T01:23:45Z',\n reviewdate: '2010-01-04T01:23:45Z',\n description: 'foo bar baz',\n downloads: 246,\n issue: 1,\n item_count: 20,\n mediatype: 'texts',\n num_favorites: 12,\n num_reviews: 23,\n source: 'foo bar',\n subject: ['baz', 'quux'],\n title: 'Foo Bar',\n volume: 2,\n week: 50,\n __href__: 'https://archive.org/details/foo',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithYearHistogramAggs: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'years',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'years',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n aggregations: {\n subject: new Aggregation({\n buckets: [\n {\n key: 'foo',\n doc_count: 3,\n },\n ],\n }),\n year_histogram: new Aggregation({\n buckets: [1, 2, 3, 3, 2, 1],\n first_bucket_key: 1950,\n last_bucket_key: 2000,\n interval: 10,\n number_buckets: 6,\n }),\n },\n results: [],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessLoggedInResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'loggedin',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'loggedin',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'loggedin', 'bar'],\n title: 'foo',\n mediatype: 'data',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessNoPreviewResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'no-preview',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'no-preview',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'no-preview', 'bar'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessLoggedInAndNoPreviewResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'loggedin-no-preview',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'loggedin-no-preview',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'loggedin', 'no-preview', 'bar'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessFirstTitleResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'first-title',\n sort: ['title', 'asc'],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'first-title',\n sort: ['title', 'asc'],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n aggregations: {\n firstTitle: new Aggregation({\n buckets: [{ key: 'X', doc_count: 1 }],\n }),\n },\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessFirstCreatorResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'first-creator',\n sort: ['creator', 'asc'],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'first-creator',\n sort: ['creator', 'asc'],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n aggregations: {\n firstCreator: new Aggregation({\n buckets: [{ key: 'X', doc_count: 1 }],\n }),\n },\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithCollectionTitles: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 2,\n returnedCount: 2,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n new ItemHit({\n fields: {\n identifier: 'bar',\n collection: ['baz', 'boop'],\n },\n }),\n ],\n collectionTitles: {\n foo: 'Foo Collection',\n bar: 'Bar Collection',\n baz: 'Baz Collection',\n boop: 'Boop Collection',\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithCollectionAggregations: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 0,\n returnedCount: 0,\n results: [],\n aggregations: {\n collection: new Aggregation({\n buckets: [\n {\n key: 'foo',\n doc_count: 10,\n },\n {\n key: 'bar',\n doc_count: 10,\n },\n ],\n }),\n },\n collectionTitles: {\n foo: 'Foo',\n bar: 'Bar',\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessSingleResultWithSort: (\n resultsSpy: Function\n) => Result<SearchResponse, SearchServiceError> = (resultsSpy: Function) => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'with-sort',\n sort: ['foo:asc'],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'with-sort',\n sort: ['foo:asc'],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n get results() {\n resultsSpy();\n return [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n ];\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessMultipleResults: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 2,\n returnedCount: 2,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n __href__: '/foo',\n },\n }),\n new ItemHit({\n fields: {\n identifier: 'bar',\n collection: ['baz', 'boop'],\n __href__: '/bar',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessNoResults: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'no-results',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'no-results',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 0,\n returnedCount: 0,\n results: [],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessMultiLineDescription: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'multi-line-description',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'multi-line-description',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n description: ['line1', 'line2'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessExtraQuotedHref: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'extra-quoted-href',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'extra-quoted-href',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new TextHit({\n fields: {\n identifier: 'foo',\n title: 'Foo',\n __href__: '/details/foo?q=%22%22quoted+query%22%22',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithDefaultSort: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'default-sort',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'default-sort',\n sort: ['titleSorter', 'identifier'],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n 'sort-by': 'titleSorter',\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithConciseDefaultSort: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'default-sort-concise',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'default-sort-concise',\n sort: ['addeddate:desc', 'identifier'],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n 'sort-by': '-addeddate',\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithDefaultFavSort: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'fav-sort',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'fav-sort',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n identifier: 'fav-foo',\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithParentCollections: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'parent-collections',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'parent-collections',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n collection: ['foo', 'bar'],\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithWebArchiveHits: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'web-archive',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'web-archive',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n sessionContext: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new WebArchiveHit({\n fields: {\n url: 'https://example.com',\n capture_dates: ['2010-01-02T03:04:05Z'],\n __href__:\n 'https://web.archive.org/web/20100102030405/https%3A%2F%2Fexample.com',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockErrorResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n error: new SearchServiceError(SearchServiceErrorType.networkError, 'foo', {\n message: 'bar',\n }),\n});\n\nexport const getMockMalformedResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({});\n"]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "The Internet Archive Collection Browser.",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"author": "Internet Archive",
|
|
6
|
-
"version": "2.1.
|
|
6
|
+
"version": "2.1.6-alpha.0",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
9
9
|
"scripts": {
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"@internetarchive/field-parsers": "^0.1.4",
|
|
29
29
|
"@internetarchive/histogram-date-range": "^1.2.0",
|
|
30
30
|
"@internetarchive/ia-activity-indicator": "^0.0.4",
|
|
31
|
-
"@internetarchive/ia-dropdown": "^1.3.
|
|
31
|
+
"@internetarchive/ia-dropdown": "^1.3.8",
|
|
32
32
|
"@internetarchive/infinite-scroller": "1.0.1",
|
|
33
33
|
"@internetarchive/modal-manager": "^0.2.8",
|
|
34
|
-
"@internetarchive/search-service": "
|
|
34
|
+
"@internetarchive/search-service": "1.3.2-alpha.1",
|
|
35
35
|
"@internetarchive/shared-resize-observer": "^0.2.0",
|
|
36
36
|
"@lit/localize": "^0.11.2",
|
|
37
37
|
"dompurify": "^2.3.6",
|
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
CollectionExtraInfo,
|
|
5
5
|
AccountExtraInfo,
|
|
6
6
|
PageElementMap,
|
|
7
|
+
SearchResponseSessionContext,
|
|
7
8
|
} from '@internetarchive/search-service';
|
|
8
9
|
import type { ReactiveController } from 'lit';
|
|
9
10
|
import type {
|
|
@@ -99,6 +100,11 @@ export interface CollectionBrowserDataSourceInterface
|
|
|
99
100
|
*/
|
|
100
101
|
readonly accountExtraInfo?: AccountExtraInfo;
|
|
101
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Context about the user session that produced the search response, from the PPS.
|
|
105
|
+
*/
|
|
106
|
+
readonly sessionContext?: SearchResponseSessionContext;
|
|
107
|
+
|
|
102
108
|
/**
|
|
103
109
|
* The set of requested page elements for profile pages, if applicable. These represent
|
|
104
110
|
* any content specific to the current profile tab.
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
FilterMapBuilder,
|
|
10
10
|
PageElementMap,
|
|
11
11
|
SearchParams,
|
|
12
|
+
SearchResponseSessionContext,
|
|
12
13
|
SearchResult,
|
|
13
14
|
SearchType,
|
|
14
15
|
} from '@internetarchive/search-service';
|
|
@@ -116,6 +117,11 @@ export class CollectionBrowserDataSource
|
|
|
116
117
|
*/
|
|
117
118
|
accountExtraInfo?: AccountExtraInfo;
|
|
118
119
|
|
|
120
|
+
/**
|
|
121
|
+
* @inheritdoc
|
|
122
|
+
*/
|
|
123
|
+
sessionContext?: SearchResponseSessionContext;
|
|
124
|
+
|
|
119
125
|
/**
|
|
120
126
|
* @inheritdoc
|
|
121
127
|
*/
|
|
@@ -1021,6 +1027,7 @@ export class CollectionBrowserDataSource
|
|
|
1021
1027
|
this.host.emitEmptyResults();
|
|
1022
1028
|
}
|
|
1023
1029
|
|
|
1030
|
+
this.sessionContext = success.sessionContext;
|
|
1024
1031
|
if (this.host.withinCollection) {
|
|
1025
1032
|
this.collectionExtraInfo = success.response.collectionExtraInfo;
|
|
1026
1033
|
|
|
@@ -31,6 +31,7 @@ export const getMockSuccessSingleResult: () => Result<
|
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
rawResponse: {},
|
|
34
|
+
sessionContext: {},
|
|
34
35
|
response: {
|
|
35
36
|
totalResults: 1,
|
|
36
37
|
returnedCount: 1,
|
|
@@ -72,6 +73,7 @@ export const getMockSuccessManyFields: () => Result<
|
|
|
72
73
|
},
|
|
73
74
|
},
|
|
74
75
|
rawResponse: {},
|
|
76
|
+
sessionContext: {},
|
|
75
77
|
response: {
|
|
76
78
|
totalResults: 1,
|
|
77
79
|
returnedCount: 1,
|
|
@@ -134,6 +136,7 @@ export const getMockSuccessWithYearHistogramAggs: () => Result<
|
|
|
134
136
|
},
|
|
135
137
|
},
|
|
136
138
|
rawResponse: {},
|
|
139
|
+
sessionContext: {},
|
|
137
140
|
response: {
|
|
138
141
|
totalResults: 1,
|
|
139
142
|
returnedCount: 1,
|
|
@@ -185,6 +188,7 @@ export const getMockSuccessLoggedInResult: () => Result<
|
|
|
185
188
|
},
|
|
186
189
|
},
|
|
187
190
|
rawResponse: {},
|
|
191
|
+
sessionContext: {},
|
|
188
192
|
response: {
|
|
189
193
|
totalResults: 1,
|
|
190
194
|
returnedCount: 1,
|
|
@@ -228,6 +232,7 @@ export const getMockSuccessNoPreviewResult: () => Result<
|
|
|
228
232
|
},
|
|
229
233
|
},
|
|
230
234
|
rawResponse: {},
|
|
235
|
+
sessionContext: {},
|
|
231
236
|
response: {
|
|
232
237
|
totalResults: 1,
|
|
233
238
|
returnedCount: 1,
|
|
@@ -269,6 +274,7 @@ export const getMockSuccessLoggedInAndNoPreviewResult: () => Result<
|
|
|
269
274
|
},
|
|
270
275
|
},
|
|
271
276
|
rawResponse: {},
|
|
277
|
+
sessionContext: {},
|
|
272
278
|
response: {
|
|
273
279
|
totalResults: 1,
|
|
274
280
|
returnedCount: 1,
|
|
@@ -310,6 +316,7 @@ export const getMockSuccessFirstTitleResult: () => Result<
|
|
|
310
316
|
},
|
|
311
317
|
},
|
|
312
318
|
rawResponse: {},
|
|
319
|
+
sessionContext: {},
|
|
313
320
|
response: {
|
|
314
321
|
totalResults: 1,
|
|
315
322
|
returnedCount: 1,
|
|
@@ -355,6 +362,7 @@ export const getMockSuccessFirstCreatorResult: () => Result<
|
|
|
355
362
|
},
|
|
356
363
|
},
|
|
357
364
|
rawResponse: {},
|
|
365
|
+
sessionContext: {},
|
|
358
366
|
response: {
|
|
359
367
|
totalResults: 1,
|
|
360
368
|
returnedCount: 1,
|
|
@@ -400,6 +408,7 @@ export const getMockSuccessWithCollectionTitles: () => Result<
|
|
|
400
408
|
},
|
|
401
409
|
},
|
|
402
410
|
rawResponse: {},
|
|
411
|
+
sessionContext: {},
|
|
403
412
|
response: {
|
|
404
413
|
totalResults: 2,
|
|
405
414
|
returnedCount: 2,
|
|
@@ -453,6 +462,7 @@ export const getMockSuccessWithCollectionAggregations: () => Result<
|
|
|
453
462
|
},
|
|
454
463
|
},
|
|
455
464
|
rawResponse: {},
|
|
465
|
+
sessionContext: {},
|
|
456
466
|
response: {
|
|
457
467
|
totalResults: 0,
|
|
458
468
|
returnedCount: 0,
|
|
@@ -504,6 +514,7 @@ export const getMockSuccessSingleResultWithSort: (
|
|
|
504
514
|
},
|
|
505
515
|
},
|
|
506
516
|
rawResponse: {},
|
|
517
|
+
sessionContext: {},
|
|
507
518
|
response: {
|
|
508
519
|
totalResults: 1,
|
|
509
520
|
returnedCount: 1,
|
|
@@ -548,6 +559,7 @@ export const getMockSuccessMultipleResults: () => Result<
|
|
|
548
559
|
},
|
|
549
560
|
},
|
|
550
561
|
rawResponse: {},
|
|
562
|
+
sessionContext: {},
|
|
551
563
|
response: {
|
|
552
564
|
totalResults: 2,
|
|
553
565
|
returnedCount: 2,
|
|
@@ -597,6 +609,7 @@ export const getMockSuccessNoResults: () => Result<
|
|
|
597
609
|
},
|
|
598
610
|
},
|
|
599
611
|
rawResponse: {},
|
|
612
|
+
sessionContext: {},
|
|
600
613
|
response: {
|
|
601
614
|
totalResults: 0,
|
|
602
615
|
returnedCount: 0,
|
|
@@ -631,6 +644,7 @@ export const getMockSuccessMultiLineDescription: () => Result<
|
|
|
631
644
|
},
|
|
632
645
|
},
|
|
633
646
|
rawResponse: {},
|
|
647
|
+
sessionContext: {},
|
|
634
648
|
response: {
|
|
635
649
|
totalResults: 1,
|
|
636
650
|
returnedCount: 1,
|
|
@@ -673,6 +687,7 @@ export const getMockSuccessExtraQuotedHref: () => Result<
|
|
|
673
687
|
},
|
|
674
688
|
},
|
|
675
689
|
rawResponse: {},
|
|
690
|
+
sessionContext: {},
|
|
676
691
|
response: {
|
|
677
692
|
totalResults: 1,
|
|
678
693
|
returnedCount: 1,
|
|
@@ -715,6 +730,7 @@ export const getMockSuccessWithDefaultSort: () => Result<
|
|
|
715
730
|
},
|
|
716
731
|
},
|
|
717
732
|
rawResponse: {},
|
|
733
|
+
sessionContext: {},
|
|
718
734
|
response: {
|
|
719
735
|
totalResults: 1,
|
|
720
736
|
returnedCount: 1,
|
|
@@ -761,6 +777,7 @@ export const getMockSuccessWithConciseDefaultSort: () => Result<
|
|
|
761
777
|
},
|
|
762
778
|
},
|
|
763
779
|
rawResponse: {},
|
|
780
|
+
sessionContext: {},
|
|
764
781
|
response: {
|
|
765
782
|
totalResults: 1,
|
|
766
783
|
returnedCount: 1,
|
|
@@ -807,6 +824,7 @@ export const getMockSuccessWithDefaultFavSort: () => Result<
|
|
|
807
824
|
},
|
|
808
825
|
},
|
|
809
826
|
rawResponse: {},
|
|
827
|
+
sessionContext: {},
|
|
810
828
|
response: {
|
|
811
829
|
totalResults: 1,
|
|
812
830
|
returnedCount: 1,
|
|
@@ -853,6 +871,7 @@ export const getMockSuccessWithParentCollections: () => Result<
|
|
|
853
871
|
},
|
|
854
872
|
},
|
|
855
873
|
rawResponse: {},
|
|
874
|
+
sessionContext: {},
|
|
856
875
|
response: {
|
|
857
876
|
totalResults: 1,
|
|
858
877
|
returnedCount: 1,
|
|
@@ -899,6 +918,7 @@ export const getMockSuccessWithWebArchiveHits: () => Result<
|
|
|
899
918
|
},
|
|
900
919
|
},
|
|
901
920
|
rawResponse: {},
|
|
921
|
+
sessionContext: {},
|
|
902
922
|
response: {
|
|
903
923
|
totalResults: 1,
|
|
904
924
|
returnedCount: 1,
|