@internetarchive/collection-browser 1.14.17-beta.5 → 1.14.18-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.
Files changed (352) hide show
  1. package/.editorconfig +29 -29
  2. package/.husky/pre-commit +4 -4
  3. package/LICENSE +661 -661
  4. package/README.md +83 -83
  5. package/dist/index.d.ts +12 -11
  6. package/dist/index.js +12 -11
  7. package/dist/index.js.map +1 -1
  8. package/dist/src/app-root.d.ts +83 -83
  9. package/dist/src/app-root.js +438 -489
  10. package/dist/src/app-root.js.map +1 -1
  11. package/dist/src/assets/img/icons/arrow-left.d.ts +2 -2
  12. package/dist/src/assets/img/icons/arrow-left.js +2 -2
  13. package/dist/src/assets/img/icons/arrow-right.d.ts +2 -2
  14. package/dist/src/assets/img/icons/arrow-right.js +2 -2
  15. package/dist/src/assets/img/icons/chevron.d.ts +2 -2
  16. package/dist/src/assets/img/icons/chevron.js +2 -2
  17. package/dist/src/assets/img/icons/contract.d.ts +2 -2
  18. package/dist/src/assets/img/icons/contract.js +2 -2
  19. package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
  20. package/dist/src/assets/img/icons/empty-query.js +2 -2
  21. package/dist/src/assets/img/icons/expand.d.ts +2 -2
  22. package/dist/src/assets/img/icons/expand.js +2 -2
  23. package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
  24. package/dist/src/assets/img/icons/eye-closed.js +2 -2
  25. package/dist/src/assets/img/icons/eye.d.ts +2 -2
  26. package/dist/src/assets/img/icons/eye.js +2 -2
  27. package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
  28. package/dist/src/assets/img/icons/favorite-filled.js +2 -2
  29. package/dist/src/assets/img/icons/login-required.d.ts +1 -1
  30. package/dist/src/assets/img/icons/login-required.js +2 -2
  31. package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
  32. package/dist/src/assets/img/icons/mediatype/account.js +2 -2
  33. package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
  34. package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
  35. package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
  36. package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
  37. package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
  38. package/dist/src/assets/img/icons/mediatype/data.js +2 -2
  39. package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
  40. package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
  41. package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
  42. package/dist/src/assets/img/icons/mediatype/film.js +2 -2
  43. package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
  44. package/dist/src/assets/img/icons/mediatype/images.js +2 -2
  45. package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
  46. package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
  47. package/dist/src/assets/img/icons/mediatype/search.d.ts +1 -1
  48. package/dist/src/assets/img/icons/mediatype/search.js +2 -2
  49. package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
  50. package/dist/src/assets/img/icons/mediatype/software.js +2 -2
  51. package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
  52. package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
  53. package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
  54. package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
  55. package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
  56. package/dist/src/assets/img/icons/mediatype/video.js +2 -2
  57. package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
  58. package/dist/src/assets/img/icons/mediatype/web.js +2 -2
  59. package/dist/src/assets/img/icons/null-result.d.ts +2 -2
  60. package/dist/src/assets/img/icons/null-result.js +2 -2
  61. package/dist/src/assets/img/icons/restricted.d.ts +1 -1
  62. package/dist/src/assets/img/icons/restricted.js +2 -2
  63. package/dist/src/assets/img/icons/reviews.d.ts +1 -1
  64. package/dist/src/assets/img/icons/reviews.js +2 -2
  65. package/dist/src/assets/img/icons/upload.d.ts +1 -1
  66. package/dist/src/assets/img/icons/upload.js +2 -2
  67. package/dist/src/assets/img/icons/views.d.ts +1 -1
  68. package/dist/src/assets/img/icons/views.js +2 -2
  69. package/dist/src/circular-activity-indicator.d.ts +5 -5
  70. package/dist/src/circular-activity-indicator.js +17 -17
  71. package/dist/src/collection-browser.d.ts +384 -406
  72. package/dist/src/collection-browser.js +1342 -1363
  73. package/dist/src/collection-browser.js.map +1 -1
  74. package/dist/src/collection-facets/facet-row.d.ts +30 -30
  75. package/dist/src/collection-facets/facet-row.js +114 -114
  76. package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
  77. package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
  78. package/dist/src/collection-facets/facets-template.d.ts +17 -17
  79. package/dist/src/collection-facets/facets-template.js +114 -114
  80. package/dist/src/collection-facets/more-facets-content.d.ts +70 -70
  81. package/dist/src/collection-facets/more-facets-content.js +354 -369
  82. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  83. package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
  84. package/dist/src/collection-facets/more-facets-pagination.js +196 -196
  85. package/dist/src/collection-facets/toggle-switch.d.ts +41 -41
  86. package/dist/src/collection-facets/toggle-switch.js +94 -94
  87. package/dist/src/collection-facets.d.ts +103 -103
  88. package/dist/src/collection-facets.js +513 -510
  89. package/dist/src/collection-facets.js.map +1 -1
  90. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +217 -0
  91. package/dist/src/data-source/collection-browser-data-source-interface.js +2 -0
  92. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -0
  93. package/dist/src/data-source/collection-browser-data-source.d.ts +352 -434
  94. package/dist/src/data-source/collection-browser-data-source.js +911 -800
  95. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  96. package/dist/src/data-source/collection-browser-query-state.d.ts +43 -0
  97. package/dist/src/data-source/collection-browser-query-state.js +2 -0
  98. package/dist/src/data-source/collection-browser-query-state.js.map +1 -0
  99. package/dist/src/data-source/models.d.ts +28 -62
  100. package/dist/src/data-source/models.js +8 -1
  101. package/dist/src/data-source/models.js.map +1 -1
  102. package/dist/src/empty-placeholder.d.ts +23 -23
  103. package/dist/src/empty-placeholder.js +74 -74
  104. package/dist/src/expanded-date-picker.d.ts +43 -43
  105. package/dist/src/expanded-date-picker.js +109 -109
  106. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
  107. package/dist/src/language-code-handler/language-code-handler.js +26 -26
  108. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
  109. package/dist/src/language-code-handler/language-code-mapping.js +562 -562
  110. package/dist/src/manage/manage-bar.d.ts +26 -26
  111. package/dist/src/manage/manage-bar.js +53 -53
  112. package/dist/src/manage/manage-bar.js.map +1 -1
  113. package/dist/src/mediatype/mediatype-config.d.ts +3 -3
  114. package/dist/src/mediatype/mediatype-config.js +91 -91
  115. package/dist/src/models.d.ts +197 -180
  116. package/dist/src/models.js +380 -269
  117. package/dist/src/models.js.map +1 -1
  118. package/dist/src/restoration-state-handler.d.ts +70 -70
  119. package/dist/src/restoration-state-handler.js +355 -355
  120. package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -6
  121. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +24 -24
  122. package/dist/src/sort-filter-bar/alpha-bar.d.ts +21 -21
  123. package/dist/src/sort-filter-bar/alpha-bar.js +128 -128
  124. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
  125. package/dist/src/sort-filter-bar/img/compact.js +2 -2
  126. package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
  127. package/dist/src/sort-filter-bar/img/list.js +2 -2
  128. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -1
  129. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +2 -2
  130. package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -1
  131. package/dist/src/sort-filter-bar/img/sort-toggle-down.js +2 -2
  132. package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -1
  133. package/dist/src/sort-filter-bar/img/sort-toggle-up.js +2 -2
  134. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
  135. package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
  136. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
  137. package/dist/src/sort-filter-bar/img/tile.js +2 -2
  138. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +210 -210
  139. package/dist/src/sort-filter-bar/sort-filter-bar.js +653 -652
  140. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  141. package/dist/src/styles/item-image-styles.d.ts +8 -8
  142. package/dist/src/styles/item-image-styles.js +9 -9
  143. package/dist/src/styles/sr-only.d.ts +1 -1
  144. package/dist/src/styles/sr-only.js +2 -2
  145. package/dist/src/tiles/base-tile-component.d.ts +19 -19
  146. package/dist/src/tiles/base-tile-component.js +63 -63
  147. package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
  148. package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
  149. package/dist/src/tiles/grid/account-tile.d.ts +18 -18
  150. package/dist/src/tiles/grid/account-tile.js +72 -72
  151. package/dist/src/tiles/grid/collection-tile.d.ts +15 -15
  152. package/dist/src/tiles/grid/collection-tile.js +80 -80
  153. package/dist/src/tiles/grid/item-tile.d.ts +28 -27
  154. package/dist/src/tiles/grid/item-tile.js +162 -135
  155. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  156. package/dist/src/tiles/grid/search-tile.d.ts +10 -10
  157. package/dist/src/tiles/grid/search-tile.js +51 -51
  158. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
  159. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +8 -8
  160. package/dist/src/tiles/grid/tile-stats.d.ts +11 -11
  161. package/dist/src/tiles/grid/tile-stats.js +58 -53
  162. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  163. package/dist/src/tiles/hover/hover-pane-controller.d.ts +219 -219
  164. package/dist/src/tiles/hover/hover-pane-controller.js +352 -352
  165. package/dist/src/tiles/hover/tile-hover-pane.d.ts +15 -15
  166. package/dist/src/tiles/hover/tile-hover-pane.js +38 -38
  167. package/dist/src/tiles/image-block.d.ts +17 -17
  168. package/dist/src/tiles/image-block.js +73 -73
  169. package/dist/src/tiles/item-image.d.ts +39 -36
  170. package/dist/src/tiles/item-image.js +155 -127
  171. package/dist/src/tiles/item-image.js.map +1 -1
  172. package/dist/src/tiles/list/tile-list-compact-header.d.ts +6 -6
  173. package/dist/src/tiles/list/tile-list-compact-header.js +38 -38
  174. package/dist/src/tiles/list/tile-list-compact.d.ts +15 -15
  175. package/dist/src/tiles/list/tile-list-compact.js +115 -115
  176. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  177. package/dist/src/tiles/list/tile-list.d.ts +47 -46
  178. package/dist/src/tiles/list/tile-list.js +327 -296
  179. package/dist/src/tiles/list/tile-list.js.map +1 -1
  180. package/dist/src/tiles/mediatype-icon.d.ts +9 -9
  181. package/dist/src/tiles/mediatype-icon.js +47 -47
  182. package/dist/src/tiles/overlay/icon-overlay.d.ts +10 -10
  183. package/dist/src/tiles/overlay/icon-overlay.js +40 -40
  184. package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
  185. package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
  186. package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
  187. package/dist/src/tiles/overlay/text-overlay.js +42 -42
  188. package/dist/src/tiles/text-snippet-block.d.ts +27 -27
  189. package/dist/src/tiles/text-snippet-block.js +73 -73
  190. package/dist/src/tiles/tile-dispatcher.d.ts +64 -64
  191. package/dist/src/tiles/tile-dispatcher.js +232 -231
  192. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  193. package/dist/src/tiles/tile-display-value-provider.d.ts +47 -43
  194. package/dist/src/tiles/tile-display-value-provider.js +94 -80
  195. package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
  196. package/dist/src/utils/analytics-events.d.ts +25 -25
  197. package/dist/src/utils/analytics-events.js +27 -27
  198. package/dist/src/utils/array-equals.d.ts +4 -4
  199. package/dist/src/utils/array-equals.js +10 -10
  200. package/dist/src/utils/collapse-repeated-quotes.d.ts +11 -0
  201. package/dist/src/utils/collapse-repeated-quotes.js +14 -0
  202. package/dist/src/utils/collapse-repeated-quotes.js.map +1 -0
  203. package/dist/src/utils/format-count.d.ts +7 -7
  204. package/dist/src/utils/format-count.js +76 -76
  205. package/dist/src/utils/format-date.d.ts +2 -2
  206. package/dist/src/utils/format-date.js +25 -25
  207. package/dist/src/utils/format-unit-size.d.ts +2 -2
  208. package/dist/src/utils/format-unit-size.js +33 -33
  209. package/dist/src/utils/local-date-from-utc.d.ts +9 -9
  210. package/dist/src/utils/local-date-from-utc.js +15 -15
  211. package/dist/src/utils/log.d.ts +7 -0
  212. package/dist/src/utils/log.js +16 -0
  213. package/dist/src/utils/log.js.map +1 -0
  214. package/dist/src/utils/resolve-mediatype.d.ts +8 -0
  215. package/dist/src/utils/resolve-mediatype.js +24 -0
  216. package/dist/src/utils/resolve-mediatype.js.map +1 -0
  217. package/dist/src/utils/sha1.d.ts +2 -2
  218. package/dist/src/utils/sha1.js +8 -8
  219. package/dist/test/collection-browser.test.d.ts +1 -1
  220. package/dist/test/collection-browser.test.js +1211 -1149
  221. package/dist/test/collection-browser.test.js.map +1 -1
  222. package/dist/test/collection-facets/facet-row.test.d.ts +1 -1
  223. package/dist/test/collection-facets/facet-row.test.js +203 -203
  224. package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
  225. package/dist/test/collection-facets/facets-template.test.js +105 -105
  226. package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
  227. package/dist/test/collection-facets/more-facets-content.test.js +133 -133
  228. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
  229. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
  230. package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
  231. package/dist/test/collection-facets/toggle-switch.test.d.ts +1 -1
  232. package/dist/test/collection-facets/toggle-switch.test.js +73 -73
  233. package/dist/test/collection-facets.test.d.ts +2 -2
  234. package/dist/test/collection-facets.test.js +653 -648
  235. package/dist/test/collection-facets.test.js.map +1 -1
  236. package/dist/test/data-source/collection-browser-data-source.test.d.ts +1 -0
  237. package/dist/test/data-source/collection-browser-data-source.test.js +80 -0
  238. package/dist/test/data-source/collection-browser-data-source.test.js.map +1 -0
  239. package/dist/test/empty-placeholder.test.d.ts +1 -1
  240. package/dist/test/empty-placeholder.test.js +63 -63
  241. package/dist/test/expanded-date-picker.test.d.ts +1 -1
  242. package/dist/test/expanded-date-picker.test.js +95 -95
  243. package/dist/test/icon-overlay.test.d.ts +1 -1
  244. package/dist/test/icon-overlay.test.js +24 -24
  245. package/dist/test/image-block.test.d.ts +1 -1
  246. package/dist/test/image-block.test.js +48 -48
  247. package/dist/test/item-image.test.d.ts +1 -1
  248. package/dist/test/item-image.test.js +85 -86
  249. package/dist/test/item-image.test.js.map +1 -1
  250. package/dist/test/manage/manage-bar.test.d.ts +1 -1
  251. package/dist/test/manage/manage-bar.test.js +72 -72
  252. package/dist/test/mediatype-config.test.d.ts +1 -1
  253. package/dist/test/mediatype-config.test.js +16 -16
  254. package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
  255. package/dist/test/mocks/mock-analytics-handler.js +15 -15
  256. package/dist/test/mocks/mock-search-responses.d.ts +24 -21
  257. package/dist/test/mocks/mock-search-responses.js +840 -709
  258. package/dist/test/mocks/mock-search-responses.js.map +1 -1
  259. package/dist/test/mocks/mock-search-service.d.ts +15 -15
  260. package/dist/test/mocks/mock-search-service.js +53 -50
  261. package/dist/test/mocks/mock-search-service.js.map +1 -1
  262. package/dist/test/restoration-state-handler.test.d.ts +1 -1
  263. package/dist/test/restoration-state-handler.test.js +270 -270
  264. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -1
  265. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +12 -12
  266. package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
  267. package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -73
  268. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
  269. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +418 -418
  270. package/dist/test/text-overlay.test.d.ts +1 -1
  271. package/dist/test/text-overlay.test.js +48 -48
  272. package/dist/test/text-snippet-block.test.d.ts +1 -1
  273. package/dist/test/text-snippet-block.test.js +57 -57
  274. package/dist/test/tile-stats.test.d.ts +1 -1
  275. package/dist/test/tile-stats.test.js +95 -33
  276. package/dist/test/tile-stats.test.js.map +1 -1
  277. package/dist/test/tiles/grid/account-tile.test.d.ts +1 -1
  278. package/dist/test/tiles/grid/account-tile.test.js +76 -76
  279. package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
  280. package/dist/test/tiles/grid/collection-tile.test.js +73 -73
  281. package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
  282. package/dist/test/tiles/grid/item-tile.test.js +298 -254
  283. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  284. package/dist/test/tiles/grid/search-tile.test.d.ts +1 -1
  285. package/dist/test/tiles/grid/search-tile.test.js +51 -51
  286. package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
  287. package/dist/test/tiles/hover/hover-pane-controller.test.js +259 -258
  288. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
  289. package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -1
  290. package/dist/test/tiles/hover/tile-hover-pane.test.js +13 -13
  291. package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
  292. package/dist/test/tiles/list/tile-list-compact.test.js +143 -143
  293. package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
  294. package/dist/test/tiles/list/tile-list.test.js +283 -239
  295. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  296. package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -1
  297. package/dist/test/tiles/tile-dispatcher.test.js +106 -94
  298. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
  299. package/dist/test/tiles/tile-display-value-provider.test.d.ts +1 -1
  300. package/dist/test/tiles/tile-display-value-provider.test.js +141 -141
  301. package/dist/test/utils/array-equals.test.d.ts +1 -1
  302. package/dist/test/utils/array-equals.test.js +26 -26
  303. package/dist/test/utils/format-count.test.d.ts +1 -1
  304. package/dist/test/utils/format-count.test.js +23 -23
  305. package/dist/test/utils/format-date.test.d.ts +1 -1
  306. package/dist/test/utils/format-date.test.js +17 -17
  307. package/dist/test/utils/format-unit-size.test.d.ts +1 -1
  308. package/dist/test/utils/format-unit-size.test.js +17 -17
  309. package/dist/test/utils/local-date-from-utc.test.d.ts +1 -1
  310. package/dist/test/utils/local-date-from-utc.test.js +26 -26
  311. package/index.ts +3 -5
  312. package/local.archive.org.cert +86 -86
  313. package/local.archive.org.key +27 -27
  314. package/package.json +3 -4
  315. package/renovate.json +6 -6
  316. package/src/app-root.ts +30 -85
  317. package/src/collection-browser.ts +112 -139
  318. package/src/collection-facets/more-facets-content.ts +0 -19
  319. package/src/collection-facets.ts +6 -4
  320. package/src/data-source/collection-browser-data-source-interface.ts +272 -0
  321. package/src/data-source/collection-browser-data-source.ts +314 -379
  322. package/src/data-source/collection-browser-query-state.ts +54 -0
  323. package/src/data-source/models.ts +8 -45
  324. package/src/manage/manage-bar.ts +1 -1
  325. package/src/models.ts +164 -3
  326. package/src/sort-filter-bar/sort-filter-bar.ts +2 -1
  327. package/src/tiles/grid/item-tile.ts +36 -1
  328. package/src/tiles/grid/tile-stats.ts +12 -7
  329. package/src/tiles/item-image.ts +28 -0
  330. package/src/tiles/list/tile-list-compact.ts +1 -1
  331. package/src/tiles/list/tile-list.ts +43 -5
  332. package/src/tiles/tile-dispatcher.ts +2 -1
  333. package/src/tiles/tile-display-value-provider.ts +20 -2
  334. package/src/utils/collapse-repeated-quotes.ts +13 -0
  335. package/src/utils/log.ts +16 -0
  336. package/src/utils/resolve-mediatype.ts +26 -0
  337. package/test/collection-browser.test.ts +161 -50
  338. package/test/collection-facets/more-facets-content.test.ts +4 -2
  339. package/test/collection-facets.test.ts +5 -0
  340. package/test/data-source/collection-browser-data-source.test.ts +103 -0
  341. package/test/item-image.test.ts +34 -36
  342. package/test/mocks/mock-search-responses.ts +144 -0
  343. package/test/mocks/mock-search-service.ts +6 -0
  344. package/test/tile-stats.test.ts +104 -0
  345. package/test/tiles/grid/item-tile.test.ts +55 -0
  346. package/test/tiles/hover/hover-pane-controller.test.ts +19 -17
  347. package/test/tiles/list/tile-list.test.ts +55 -0
  348. package/test/tiles/tile-dispatcher.test.ts +13 -0
  349. package/tsconfig.json +21 -21
  350. package/web-dev-server.config.mjs +30 -30
  351. package/web-test-runner.config.mjs +41 -41
  352. package/types/sentry.d.ts +0 -1
@@ -1,710 +1,841 @@
1
- import { Aggregation, ItemHit, SearchServiceError, TextHit, } from '@internetarchive/search-service';
2
- import { SearchServiceErrorType } from '@internetarchive/search-service/dist/src/search-service-error';
3
- export const getMockSuccessSingleResult = () => ({
4
- success: {
5
- request: {
6
- kind: 'hits',
7
- clientParameters: {
8
- user_query: 'collection:foo',
9
- sort: [],
10
- },
11
- backendRequests: {
12
- primary: {
13
- kind: 'hits',
14
- finalized_parameters: {
15
- user_query: 'collection:foo',
16
- sort: [],
17
- },
18
- },
19
- },
20
- },
21
- rawResponse: {},
22
- response: {
23
- totalResults: 1,
24
- returnedCount: 1,
25
- results: [
26
- new ItemHit({
27
- fields: {
28
- identifier: 'foo',
29
- collection: ['foo', 'bar'],
30
- },
31
- }),
32
- ],
33
- },
34
- responseHeader: {
35
- succeeded: true,
36
- query_time: 0,
37
- },
38
- },
39
- });
40
- export const getMockSuccessWithYearHistogramAggs = () => ({
41
- success: {
42
- request: {
43
- kind: 'hits',
44
- clientParameters: {
45
- user_query: 'years',
46
- sort: [],
47
- },
48
- backendRequests: {
49
- primary: {
50
- kind: 'hits',
51
- finalized_parameters: {
52
- user_query: 'years',
53
- sort: [],
54
- },
55
- },
56
- },
57
- },
58
- rawResponse: {},
59
- response: {
60
- totalResults: 1,
61
- returnedCount: 1,
62
- aggregations: {
63
- subject: new Aggregation({
64
- buckets: [
65
- {
66
- key: 'foo',
67
- doc_count: 3,
68
- },
69
- ],
70
- }),
71
- year_histogram: new Aggregation({
72
- buckets: [1, 2, 3, 3, 2, 1],
73
- first_bucket_key: 1950,
74
- last_bucket_key: 2000,
75
- interval: 10,
76
- number_buckets: 6,
77
- }),
78
- },
79
- results: [],
80
- },
81
- responseHeader: {
82
- succeeded: true,
83
- query_time: 0,
84
- },
85
- },
86
- });
87
- export const getMockSuccessLoggedInResult = () => ({
88
- success: {
89
- request: {
90
- kind: 'hits',
91
- clientParameters: {
92
- user_query: 'loggedin',
93
- sort: [],
94
- },
95
- backendRequests: {
96
- primary: {
97
- kind: 'hits',
98
- finalized_parameters: {
99
- user_query: 'loggedin',
100
- sort: [],
101
- },
102
- },
103
- },
104
- },
105
- rawResponse: {},
106
- response: {
107
- totalResults: 1,
108
- returnedCount: 1,
109
- results: [
110
- new ItemHit({
111
- fields: {
112
- identifier: 'foo',
113
- collection: ['foo', 'loggedin', 'bar'],
114
- title: 'foo',
115
- mediatype: 'data',
116
- },
117
- }),
118
- ],
119
- },
120
- responseHeader: {
121
- succeeded: true,
122
- query_time: 0,
123
- },
124
- },
125
- });
126
- export const getMockSuccessNoPreviewResult = () => ({
127
- success: {
128
- request: {
129
- kind: 'hits',
130
- clientParameters: {
131
- user_query: 'no-preview',
132
- sort: [],
133
- },
134
- backendRequests: {
135
- primary: {
136
- kind: 'hits',
137
- finalized_parameters: {
138
- user_query: 'no-preview',
139
- sort: [],
140
- },
141
- },
142
- },
143
- },
144
- rawResponse: {},
145
- response: {
146
- totalResults: 1,
147
- returnedCount: 1,
148
- results: [
149
- new ItemHit({
150
- fields: {
151
- identifier: 'foo',
152
- collection: ['foo', 'no-preview', 'bar'],
153
- },
154
- }),
155
- ],
156
- },
157
- responseHeader: {
158
- succeeded: true,
159
- query_time: 0,
160
- },
161
- },
162
- });
163
- export const getMockSuccessLoggedInAndNoPreviewResult = () => ({
164
- success: {
165
- request: {
166
- kind: 'hits',
167
- clientParameters: {
168
- user_query: 'loggedin-no-preview',
169
- sort: [],
170
- },
171
- backendRequests: {
172
- primary: {
173
- kind: 'hits',
174
- finalized_parameters: {
175
- user_query: 'loggedin-no-preview',
176
- sort: [],
177
- },
178
- },
179
- },
180
- },
181
- rawResponse: {},
182
- response: {
183
- totalResults: 1,
184
- returnedCount: 1,
185
- results: [
186
- new ItemHit({
187
- fields: {
188
- identifier: 'foo',
189
- collection: ['foo', 'loggedin', 'no-preview', 'bar'],
190
- },
191
- }),
192
- ],
193
- },
194
- responseHeader: {
195
- succeeded: true,
196
- query_time: 0,
197
- },
198
- },
199
- });
200
- export const getMockSuccessFirstTitleResult = () => ({
201
- success: {
202
- request: {
203
- kind: 'hits',
204
- clientParameters: {
205
- user_query: 'first-title',
206
- sort: ['title', 'asc'],
207
- },
208
- backendRequests: {
209
- primary: {
210
- kind: 'hits',
211
- finalized_parameters: {
212
- user_query: 'first-title',
213
- sort: ['title', 'asc'],
214
- },
215
- },
216
- },
217
- },
218
- rawResponse: {},
219
- response: {
220
- totalResults: 1,
221
- returnedCount: 1,
222
- aggregations: {
223
- firstTitle: new Aggregation({
224
- buckets: [{ key: 'X', doc_count: 1 }],
225
- }),
226
- },
227
- results: [
228
- new ItemHit({
229
- fields: {
230
- identifier: 'foo',
231
- },
232
- }),
233
- ],
234
- },
235
- responseHeader: {
236
- succeeded: true,
237
- query_time: 0,
238
- },
239
- },
240
- });
241
- export const getMockSuccessFirstCreatorResult = () => ({
242
- success: {
243
- request: {
244
- kind: 'hits',
245
- clientParameters: {
246
- user_query: 'first-creator',
247
- sort: ['creator', 'asc'],
248
- },
249
- backendRequests: {
250
- primary: {
251
- kind: 'hits',
252
- finalized_parameters: {
253
- user_query: 'first-creator',
254
- sort: ['creator', 'asc'],
255
- },
256
- },
257
- },
258
- },
259
- rawResponse: {},
260
- response: {
261
- totalResults: 1,
262
- returnedCount: 1,
263
- aggregations: {
264
- firstCreator: new Aggregation({
265
- buckets: [{ key: 'X', doc_count: 1 }],
266
- }),
267
- },
268
- results: [
269
- new ItemHit({
270
- fields: {
271
- identifier: 'foo',
272
- },
273
- }),
274
- ],
275
- },
276
- responseHeader: {
277
- succeeded: true,
278
- query_time: 0,
279
- },
280
- },
281
- });
282
- export const getMockSuccessWithCollectionTitles = () => ({
283
- success: {
284
- request: {
285
- kind: 'hits',
286
- clientParameters: {
287
- user_query: 'collection:foo',
288
- sort: [],
289
- },
290
- backendRequests: {
291
- primary: {
292
- kind: 'hits',
293
- finalized_parameters: {
294
- user_query: 'collection:foo',
295
- sort: [],
296
- },
297
- },
298
- },
299
- },
300
- rawResponse: {},
301
- response: {
302
- totalResults: 2,
303
- returnedCount: 2,
304
- results: [
305
- new ItemHit({
306
- fields: {
307
- identifier: 'foo',
308
- collection: ['foo', 'bar'],
309
- },
310
- }),
311
- new ItemHit({
312
- fields: {
313
- identifier: 'bar',
314
- collection: ['baz', 'boop'],
315
- },
316
- }),
317
- ],
318
- collectionTitles: {
319
- foo: 'Foo Collection',
320
- bar: 'Bar Collection',
321
- baz: 'Baz Collection',
322
- boop: 'Boop Collection',
323
- },
324
- },
325
- responseHeader: {
326
- succeeded: true,
327
- query_time: 0,
328
- },
329
- },
330
- });
331
- export const getMockSuccessWithCollectionAggregations = () => ({
332
- success: {
333
- request: {
334
- kind: 'hits',
335
- clientParameters: {
336
- user_query: 'collection:foo',
337
- sort: [],
338
- },
339
- backendRequests: {
340
- primary: {
341
- kind: 'hits',
342
- finalized_parameters: {
343
- user_query: 'collection:foo',
344
- sort: [],
345
- },
346
- },
347
- },
348
- },
349
- rawResponse: {},
350
- response: {
351
- totalResults: 0,
352
- returnedCount: 0,
353
- results: [],
354
- aggregations: {
355
- collection: new Aggregation({
356
- buckets: [
357
- {
358
- key: 'foo',
359
- doc_count: 10,
360
- },
361
- {
362
- key: 'bar',
363
- doc_count: 10,
364
- },
365
- ],
366
- }),
367
- },
368
- },
369
- responseHeader: {
370
- succeeded: true,
371
- query_time: 0,
372
- },
373
- },
374
- });
375
- export const getMockSuccessSingleResultWithSort = (resultsSpy) => ({
376
- success: {
377
- request: {
378
- kind: 'hits',
379
- clientParameters: {
380
- user_query: 'with-sort',
381
- sort: ['foo:asc'],
382
- },
383
- backendRequests: {
384
- primary: {
385
- kind: 'hits',
386
- finalized_parameters: {
387
- user_query: 'with-sort',
388
- sort: ['foo:asc'],
389
- },
390
- },
391
- },
392
- },
393
- rawResponse: {},
394
- response: {
395
- totalResults: 1,
396
- returnedCount: 1,
397
- get results() {
398
- resultsSpy();
399
- return [
400
- new ItemHit({
401
- fields: {
402
- identifier: 'foo',
403
- collection: ['foo', 'bar'],
404
- },
405
- }),
406
- ];
407
- },
408
- },
409
- responseHeader: {
410
- succeeded: true,
411
- query_time: 0,
412
- },
413
- },
414
- });
415
- export const getMockSuccessMultipleResults = () => ({
416
- success: {
417
- request: {
418
- kind: 'hits',
419
- clientParameters: {
420
- user_query: 'collection:foo',
421
- sort: [],
422
- },
423
- backendRequests: {
424
- primary: {
425
- kind: 'hits',
426
- finalized_parameters: {
427
- user_query: 'collection:foo',
428
- sort: [],
429
- },
430
- },
431
- },
432
- },
433
- rawResponse: {},
434
- response: {
435
- totalResults: 2,
436
- returnedCount: 2,
437
- results: [
438
- new ItemHit({
439
- fields: {
440
- identifier: 'foo',
441
- collection: ['foo', 'bar'],
442
- __href__: '/foo',
443
- },
444
- }),
445
- new ItemHit({
446
- fields: {
447
- identifier: 'bar',
448
- collection: ['baz', 'boop'],
449
- __href__: '/bar',
450
- },
451
- }),
452
- ],
453
- },
454
- responseHeader: {
455
- succeeded: true,
456
- query_time: 0,
457
- },
458
- },
459
- });
460
- export const getMockSuccessMultiLineDescription = () => ({
461
- success: {
462
- request: {
463
- kind: 'hits',
464
- clientParameters: {
465
- user_query: 'multi-line-description',
466
- sort: [],
467
- },
468
- backendRequests: {
469
- primary: {
470
- kind: 'hits',
471
- finalized_parameters: {
472
- user_query: 'multi-line-description',
473
- sort: [],
474
- },
475
- },
476
- },
477
- },
478
- rawResponse: {},
479
- response: {
480
- totalResults: 1,
481
- returnedCount: 1,
482
- results: [
483
- new ItemHit({
484
- fields: {
485
- identifier: 'foo',
486
- collection: ['foo', 'bar'],
487
- description: ['line1', 'line2'],
488
- },
489
- }),
490
- ],
491
- },
492
- responseHeader: {
493
- succeeded: true,
494
- query_time: 0,
495
- },
496
- },
497
- });
498
- export const getMockSuccessExtraQuotedHref = () => ({
499
- success: {
500
- request: {
501
- kind: 'hits',
502
- clientParameters: {
503
- user_query: 'extra-quoted-href',
504
- sort: [],
505
- },
506
- backendRequests: {
507
- primary: {
508
- kind: 'hits',
509
- finalized_parameters: {
510
- user_query: 'extra-quoted-href',
511
- sort: [],
512
- },
513
- },
514
- },
515
- },
516
- rawResponse: {},
517
- response: {
518
- totalResults: 1,
519
- returnedCount: 1,
520
- results: [
521
- new TextHit({
522
- fields: {
523
- identifier: 'foo',
524
- title: 'Foo',
525
- __href__: '/details/foo?q=%22%22quoted+query%22%22',
526
- },
527
- }),
528
- ],
529
- },
530
- responseHeader: {
531
- succeeded: true,
532
- query_time: 0,
533
- },
534
- },
535
- });
536
- export const getMockSuccessWithDefaultSort = () => ({
537
- success: {
538
- request: {
539
- kind: 'hits',
540
- clientParameters: {
541
- user_query: 'default-sort',
542
- sort: [],
543
- },
544
- backendRequests: {
545
- primary: {
546
- kind: 'hits',
547
- finalized_parameters: {
548
- user_query: 'default-sort',
549
- sort: ['titleSorter', 'identifier'],
550
- },
551
- },
552
- },
553
- },
554
- rawResponse: {},
555
- response: {
556
- totalResults: 1,
557
- returnedCount: 1,
558
- results: [
559
- new ItemHit({
560
- fields: {
561
- identifier: 'foo',
562
- title: 'Foo',
563
- },
564
- }),
565
- ],
566
- collectionExtraInfo: {
567
- public_metadata: {
568
- 'sort-by': 'titleSorter',
569
- },
570
- },
571
- },
572
- responseHeader: {
573
- succeeded: true,
574
- query_time: 0,
575
- },
576
- },
577
- });
578
- export const getMockSuccessWithConciseDefaultSort = () => ({
579
- success: {
580
- request: {
581
- kind: 'hits',
582
- clientParameters: {
583
- user_query: 'default-sort-concise',
584
- sort: [],
585
- },
586
- backendRequests: {
587
- primary: {
588
- kind: 'hits',
589
- finalized_parameters: {
590
- user_query: 'default-sort-concise',
591
- sort: ['addeddate:desc', 'identifier'],
592
- },
593
- },
594
- },
595
- },
596
- rawResponse: {},
597
- response: {
598
- totalResults: 1,
599
- returnedCount: 1,
600
- results: [
601
- new ItemHit({
602
- fields: {
603
- identifier: 'foo',
604
- title: 'Foo',
605
- },
606
- }),
607
- ],
608
- collectionExtraInfo: {
609
- public_metadata: {
610
- 'sort-by': '-addeddate',
611
- },
612
- },
613
- },
614
- responseHeader: {
615
- succeeded: true,
616
- query_time: 0,
617
- },
618
- },
619
- });
620
- export const getMockSuccessWithDefaultFavSort = () => ({
621
- success: {
622
- request: {
623
- kind: 'hits',
624
- clientParameters: {
625
- user_query: 'fav-sort',
626
- sort: [],
627
- },
628
- backendRequests: {
629
- primary: {
630
- kind: 'hits',
631
- finalized_parameters: {
632
- user_query: 'fav-sort',
633
- sort: [],
634
- },
635
- },
636
- },
637
- },
638
- rawResponse: {},
639
- response: {
640
- totalResults: 1,
641
- returnedCount: 1,
642
- results: [
643
- new ItemHit({
644
- fields: {
645
- identifier: 'foo',
646
- title: 'Foo',
647
- },
648
- }),
649
- ],
650
- collectionExtraInfo: {
651
- public_metadata: {
652
- identifier: 'fav-foo',
653
- },
654
- },
655
- },
656
- responseHeader: {
657
- succeeded: true,
658
- query_time: 0,
659
- },
660
- },
661
- });
662
- export const getMockSuccessWithParentCollections = () => ({
663
- success: {
664
- request: {
665
- kind: 'hits',
666
- clientParameters: {
667
- user_query: 'parent-collections',
668
- sort: [],
669
- },
670
- backendRequests: {
671
- primary: {
672
- kind: 'hits',
673
- finalized_parameters: {
674
- user_query: 'parent-collections',
675
- sort: [],
676
- },
677
- },
678
- },
679
- },
680
- rawResponse: {},
681
- response: {
682
- totalResults: 1,
683
- returnedCount: 1,
684
- results: [
685
- new ItemHit({
686
- fields: {
687
- identifier: 'foo',
688
- title: 'Foo',
689
- },
690
- }),
691
- ],
692
- collectionExtraInfo: {
693
- public_metadata: {
694
- collection: ['foo', 'bar'],
695
- },
696
- },
697
- },
698
- responseHeader: {
699
- succeeded: true,
700
- query_time: 0,
701
- },
702
- },
703
- });
704
- export const getMockErrorResult = () => ({
705
- error: new SearchServiceError(SearchServiceErrorType.networkError, 'foo', {
706
- message: 'bar',
707
- }),
708
- });
709
- export const getMockMalformedResult = () => ({});
1
+ import { Aggregation, ItemHit, SearchServiceError, TextHit, } from '@internetarchive/search-service';
2
+ import { WebArchiveHit } from '@internetarchive/search-service/dist/src/models/hit-types/web-archive-hit';
3
+ import { SearchServiceErrorType } from '@internetarchive/search-service/dist/src/search-service-error';
4
+ export const getMockSuccessSingleResult = () => ({
5
+ success: {
6
+ request: {
7
+ kind: 'hits',
8
+ clientParameters: {
9
+ user_query: 'collection:foo',
10
+ sort: [],
11
+ },
12
+ backendRequests: {
13
+ primary: {
14
+ kind: 'hits',
15
+ finalized_parameters: {
16
+ user_query: 'collection:foo',
17
+ sort: [],
18
+ },
19
+ },
20
+ },
21
+ },
22
+ rawResponse: {},
23
+ response: {
24
+ totalResults: 1,
25
+ returnedCount: 1,
26
+ results: [
27
+ new ItemHit({
28
+ fields: {
29
+ identifier: 'foo',
30
+ collection: ['foo', 'bar'],
31
+ },
32
+ }),
33
+ ],
34
+ },
35
+ responseHeader: {
36
+ succeeded: true,
37
+ query_time: 0,
38
+ },
39
+ },
40
+ });
41
+ export const getMockSuccessManyFields = () => ({
42
+ success: {
43
+ request: {
44
+ kind: 'hits',
45
+ clientParameters: {
46
+ user_query: 'many-fields',
47
+ sort: [],
48
+ },
49
+ backendRequests: {
50
+ primary: {
51
+ kind: 'hits',
52
+ finalized_parameters: {
53
+ user_query: 'many-fields',
54
+ sort: [],
55
+ },
56
+ },
57
+ },
58
+ },
59
+ rawResponse: {},
60
+ response: {
61
+ totalResults: 1,
62
+ returnedCount: 1,
63
+ results: [
64
+ new ItemHit({
65
+ fields: {
66
+ identifier: 'foo',
67
+ avg_rating: 3.5,
68
+ collection: ['foo', 'bar', 'no-preview', 'loggedin'],
69
+ collection_files_count: 123,
70
+ collection_size: 234,
71
+ creator: ['baz', 'boop'],
72
+ date: '2010-01-03T01:23:45Z',
73
+ addeddate: '2010-01-01T01:23:45Z',
74
+ publicdate: '2010-01-02T01:23:45Z',
75
+ reviewdate: '2010-01-04T01:23:45Z',
76
+ description: 'foo bar baz',
77
+ downloads: 246,
78
+ issue: 1,
79
+ item_count: 20,
80
+ mediatype: 'texts',
81
+ num_favorites: 12,
82
+ num_reviews: 23,
83
+ source: 'foo bar',
84
+ subject: ['baz', 'quux'],
85
+ title: 'Foo Bar',
86
+ volume: 2,
87
+ week: 50,
88
+ __href__: 'https://archive.org/details/foo',
89
+ },
90
+ }),
91
+ ],
92
+ },
93
+ responseHeader: {
94
+ succeeded: true,
95
+ query_time: 0,
96
+ },
97
+ },
98
+ });
99
+ export const getMockSuccessWithYearHistogramAggs = () => ({
100
+ success: {
101
+ request: {
102
+ kind: 'hits',
103
+ clientParameters: {
104
+ user_query: 'years',
105
+ sort: [],
106
+ },
107
+ backendRequests: {
108
+ primary: {
109
+ kind: 'hits',
110
+ finalized_parameters: {
111
+ user_query: 'years',
112
+ sort: [],
113
+ },
114
+ },
115
+ },
116
+ },
117
+ rawResponse: {},
118
+ response: {
119
+ totalResults: 1,
120
+ returnedCount: 1,
121
+ aggregations: {
122
+ subject: new Aggregation({
123
+ buckets: [
124
+ {
125
+ key: 'foo',
126
+ doc_count: 3,
127
+ },
128
+ ],
129
+ }),
130
+ year_histogram: new Aggregation({
131
+ buckets: [1, 2, 3, 3, 2, 1],
132
+ first_bucket_key: 1950,
133
+ last_bucket_key: 2000,
134
+ interval: 10,
135
+ number_buckets: 6,
136
+ }),
137
+ },
138
+ results: [],
139
+ },
140
+ responseHeader: {
141
+ succeeded: true,
142
+ query_time: 0,
143
+ },
144
+ },
145
+ });
146
+ export const getMockSuccessLoggedInResult = () => ({
147
+ success: {
148
+ request: {
149
+ kind: 'hits',
150
+ clientParameters: {
151
+ user_query: 'loggedin',
152
+ sort: [],
153
+ },
154
+ backendRequests: {
155
+ primary: {
156
+ kind: 'hits',
157
+ finalized_parameters: {
158
+ user_query: 'loggedin',
159
+ sort: [],
160
+ },
161
+ },
162
+ },
163
+ },
164
+ rawResponse: {},
165
+ response: {
166
+ totalResults: 1,
167
+ returnedCount: 1,
168
+ results: [
169
+ new ItemHit({
170
+ fields: {
171
+ identifier: 'foo',
172
+ collection: ['foo', 'loggedin', 'bar'],
173
+ title: 'foo',
174
+ mediatype: 'data',
175
+ },
176
+ }),
177
+ ],
178
+ },
179
+ responseHeader: {
180
+ succeeded: true,
181
+ query_time: 0,
182
+ },
183
+ },
184
+ });
185
+ export const getMockSuccessNoPreviewResult = () => ({
186
+ success: {
187
+ request: {
188
+ kind: 'hits',
189
+ clientParameters: {
190
+ user_query: 'no-preview',
191
+ sort: [],
192
+ },
193
+ backendRequests: {
194
+ primary: {
195
+ kind: 'hits',
196
+ finalized_parameters: {
197
+ user_query: 'no-preview',
198
+ sort: [],
199
+ },
200
+ },
201
+ },
202
+ },
203
+ rawResponse: {},
204
+ response: {
205
+ totalResults: 1,
206
+ returnedCount: 1,
207
+ results: [
208
+ new ItemHit({
209
+ fields: {
210
+ identifier: 'foo',
211
+ collection: ['foo', 'no-preview', 'bar'],
212
+ },
213
+ }),
214
+ ],
215
+ },
216
+ responseHeader: {
217
+ succeeded: true,
218
+ query_time: 0,
219
+ },
220
+ },
221
+ });
222
+ export const getMockSuccessLoggedInAndNoPreviewResult = () => ({
223
+ success: {
224
+ request: {
225
+ kind: 'hits',
226
+ clientParameters: {
227
+ user_query: 'loggedin-no-preview',
228
+ sort: [],
229
+ },
230
+ backendRequests: {
231
+ primary: {
232
+ kind: 'hits',
233
+ finalized_parameters: {
234
+ user_query: 'loggedin-no-preview',
235
+ sort: [],
236
+ },
237
+ },
238
+ },
239
+ },
240
+ rawResponse: {},
241
+ response: {
242
+ totalResults: 1,
243
+ returnedCount: 1,
244
+ results: [
245
+ new ItemHit({
246
+ fields: {
247
+ identifier: 'foo',
248
+ collection: ['foo', 'loggedin', 'no-preview', 'bar'],
249
+ },
250
+ }),
251
+ ],
252
+ },
253
+ responseHeader: {
254
+ succeeded: true,
255
+ query_time: 0,
256
+ },
257
+ },
258
+ });
259
+ export const getMockSuccessFirstTitleResult = () => ({
260
+ success: {
261
+ request: {
262
+ kind: 'hits',
263
+ clientParameters: {
264
+ user_query: 'first-title',
265
+ sort: ['title', 'asc'],
266
+ },
267
+ backendRequests: {
268
+ primary: {
269
+ kind: 'hits',
270
+ finalized_parameters: {
271
+ user_query: 'first-title',
272
+ sort: ['title', 'asc'],
273
+ },
274
+ },
275
+ },
276
+ },
277
+ rawResponse: {},
278
+ response: {
279
+ totalResults: 1,
280
+ returnedCount: 1,
281
+ aggregations: {
282
+ firstTitle: new Aggregation({
283
+ buckets: [{ key: 'X', doc_count: 1 }],
284
+ }),
285
+ },
286
+ results: [
287
+ new ItemHit({
288
+ fields: {
289
+ identifier: 'foo',
290
+ },
291
+ }),
292
+ ],
293
+ },
294
+ responseHeader: {
295
+ succeeded: true,
296
+ query_time: 0,
297
+ },
298
+ },
299
+ });
300
+ export const getMockSuccessFirstCreatorResult = () => ({
301
+ success: {
302
+ request: {
303
+ kind: 'hits',
304
+ clientParameters: {
305
+ user_query: 'first-creator',
306
+ sort: ['creator', 'asc'],
307
+ },
308
+ backendRequests: {
309
+ primary: {
310
+ kind: 'hits',
311
+ finalized_parameters: {
312
+ user_query: 'first-creator',
313
+ sort: ['creator', 'asc'],
314
+ },
315
+ },
316
+ },
317
+ },
318
+ rawResponse: {},
319
+ response: {
320
+ totalResults: 1,
321
+ returnedCount: 1,
322
+ aggregations: {
323
+ firstCreator: new Aggregation({
324
+ buckets: [{ key: 'X', doc_count: 1 }],
325
+ }),
326
+ },
327
+ results: [
328
+ new ItemHit({
329
+ fields: {
330
+ identifier: 'foo',
331
+ },
332
+ }),
333
+ ],
334
+ },
335
+ responseHeader: {
336
+ succeeded: true,
337
+ query_time: 0,
338
+ },
339
+ },
340
+ });
341
+ export const getMockSuccessWithCollectionTitles = () => ({
342
+ success: {
343
+ request: {
344
+ kind: 'hits',
345
+ clientParameters: {
346
+ user_query: 'collection:foo',
347
+ sort: [],
348
+ },
349
+ backendRequests: {
350
+ primary: {
351
+ kind: 'hits',
352
+ finalized_parameters: {
353
+ user_query: 'collection:foo',
354
+ sort: [],
355
+ },
356
+ },
357
+ },
358
+ },
359
+ rawResponse: {},
360
+ response: {
361
+ totalResults: 2,
362
+ returnedCount: 2,
363
+ results: [
364
+ new ItemHit({
365
+ fields: {
366
+ identifier: 'foo',
367
+ collection: ['foo', 'bar'],
368
+ },
369
+ }),
370
+ new ItemHit({
371
+ fields: {
372
+ identifier: 'bar',
373
+ collection: ['baz', 'boop'],
374
+ },
375
+ }),
376
+ ],
377
+ collectionTitles: {
378
+ foo: 'Foo Collection',
379
+ bar: 'Bar Collection',
380
+ baz: 'Baz Collection',
381
+ boop: 'Boop Collection',
382
+ },
383
+ },
384
+ responseHeader: {
385
+ succeeded: true,
386
+ query_time: 0,
387
+ },
388
+ },
389
+ });
390
+ export const getMockSuccessWithCollectionAggregations = () => ({
391
+ success: {
392
+ request: {
393
+ kind: 'hits',
394
+ clientParameters: {
395
+ user_query: 'collection:foo',
396
+ sort: [],
397
+ },
398
+ backendRequests: {
399
+ primary: {
400
+ kind: 'hits',
401
+ finalized_parameters: {
402
+ user_query: 'collection:foo',
403
+ sort: [],
404
+ },
405
+ },
406
+ },
407
+ },
408
+ rawResponse: {},
409
+ response: {
410
+ totalResults: 0,
411
+ returnedCount: 0,
412
+ results: [],
413
+ aggregations: {
414
+ collection: new Aggregation({
415
+ buckets: [
416
+ {
417
+ key: 'foo',
418
+ doc_count: 10,
419
+ },
420
+ {
421
+ key: 'bar',
422
+ doc_count: 10,
423
+ },
424
+ ],
425
+ }),
426
+ },
427
+ collectionTitles: {
428
+ foo: 'Foo',
429
+ bar: 'Bar',
430
+ },
431
+ },
432
+ responseHeader: {
433
+ succeeded: true,
434
+ query_time: 0,
435
+ },
436
+ },
437
+ });
438
+ export const getMockSuccessSingleResultWithSort = (resultsSpy) => ({
439
+ success: {
440
+ request: {
441
+ kind: 'hits',
442
+ clientParameters: {
443
+ user_query: 'with-sort',
444
+ sort: ['foo:asc'],
445
+ },
446
+ backendRequests: {
447
+ primary: {
448
+ kind: 'hits',
449
+ finalized_parameters: {
450
+ user_query: 'with-sort',
451
+ sort: ['foo:asc'],
452
+ },
453
+ },
454
+ },
455
+ },
456
+ rawResponse: {},
457
+ response: {
458
+ totalResults: 1,
459
+ returnedCount: 1,
460
+ get results() {
461
+ resultsSpy();
462
+ return [
463
+ new ItemHit({
464
+ fields: {
465
+ identifier: 'foo',
466
+ collection: ['foo', 'bar'],
467
+ },
468
+ }),
469
+ ];
470
+ },
471
+ },
472
+ responseHeader: {
473
+ succeeded: true,
474
+ query_time: 0,
475
+ },
476
+ },
477
+ });
478
+ export const getMockSuccessMultipleResults = () => ({
479
+ success: {
480
+ request: {
481
+ kind: 'hits',
482
+ clientParameters: {
483
+ user_query: 'collection:foo',
484
+ sort: [],
485
+ },
486
+ backendRequests: {
487
+ primary: {
488
+ kind: 'hits',
489
+ finalized_parameters: {
490
+ user_query: 'collection:foo',
491
+ sort: [],
492
+ },
493
+ },
494
+ },
495
+ },
496
+ rawResponse: {},
497
+ response: {
498
+ totalResults: 2,
499
+ returnedCount: 2,
500
+ results: [
501
+ new ItemHit({
502
+ fields: {
503
+ identifier: 'foo',
504
+ collection: ['foo', 'bar'],
505
+ __href__: '/foo',
506
+ },
507
+ }),
508
+ new ItemHit({
509
+ fields: {
510
+ identifier: 'bar',
511
+ collection: ['baz', 'boop'],
512
+ __href__: '/bar',
513
+ },
514
+ }),
515
+ ],
516
+ },
517
+ responseHeader: {
518
+ succeeded: true,
519
+ query_time: 0,
520
+ },
521
+ },
522
+ });
523
+ export const getMockSuccessNoResults = () => ({
524
+ success: {
525
+ request: {
526
+ kind: 'hits',
527
+ clientParameters: {
528
+ user_query: 'no-results',
529
+ sort: [],
530
+ },
531
+ backendRequests: {
532
+ primary: {
533
+ kind: 'hits',
534
+ finalized_parameters: {
535
+ user_query: 'no-results',
536
+ sort: [],
537
+ },
538
+ },
539
+ },
540
+ },
541
+ rawResponse: {},
542
+ response: {
543
+ totalResults: 0,
544
+ returnedCount: 0,
545
+ results: [],
546
+ },
547
+ responseHeader: {
548
+ succeeded: true,
549
+ query_time: 0,
550
+ },
551
+ },
552
+ });
553
+ export const getMockSuccessMultiLineDescription = () => ({
554
+ success: {
555
+ request: {
556
+ kind: 'hits',
557
+ clientParameters: {
558
+ user_query: 'multi-line-description',
559
+ sort: [],
560
+ },
561
+ backendRequests: {
562
+ primary: {
563
+ kind: 'hits',
564
+ finalized_parameters: {
565
+ user_query: 'multi-line-description',
566
+ sort: [],
567
+ },
568
+ },
569
+ },
570
+ },
571
+ rawResponse: {},
572
+ response: {
573
+ totalResults: 1,
574
+ returnedCount: 1,
575
+ results: [
576
+ new ItemHit({
577
+ fields: {
578
+ identifier: 'foo',
579
+ collection: ['foo', 'bar'],
580
+ description: ['line1', 'line2'],
581
+ },
582
+ }),
583
+ ],
584
+ },
585
+ responseHeader: {
586
+ succeeded: true,
587
+ query_time: 0,
588
+ },
589
+ },
590
+ });
591
+ export const getMockSuccessExtraQuotedHref = () => ({
592
+ success: {
593
+ request: {
594
+ kind: 'hits',
595
+ clientParameters: {
596
+ user_query: 'extra-quoted-href',
597
+ sort: [],
598
+ },
599
+ backendRequests: {
600
+ primary: {
601
+ kind: 'hits',
602
+ finalized_parameters: {
603
+ user_query: 'extra-quoted-href',
604
+ sort: [],
605
+ },
606
+ },
607
+ },
608
+ },
609
+ rawResponse: {},
610
+ response: {
611
+ totalResults: 1,
612
+ returnedCount: 1,
613
+ results: [
614
+ new TextHit({
615
+ fields: {
616
+ identifier: 'foo',
617
+ title: 'Foo',
618
+ __href__: '/details/foo?q=%22%22quoted+query%22%22',
619
+ },
620
+ }),
621
+ ],
622
+ },
623
+ responseHeader: {
624
+ succeeded: true,
625
+ query_time: 0,
626
+ },
627
+ },
628
+ });
629
+ export const getMockSuccessWithDefaultSort = () => ({
630
+ success: {
631
+ request: {
632
+ kind: 'hits',
633
+ clientParameters: {
634
+ user_query: 'default-sort',
635
+ sort: [],
636
+ },
637
+ backendRequests: {
638
+ primary: {
639
+ kind: 'hits',
640
+ finalized_parameters: {
641
+ user_query: 'default-sort',
642
+ sort: ['titleSorter', 'identifier'],
643
+ },
644
+ },
645
+ },
646
+ },
647
+ rawResponse: {},
648
+ response: {
649
+ totalResults: 1,
650
+ returnedCount: 1,
651
+ results: [
652
+ new ItemHit({
653
+ fields: {
654
+ identifier: 'foo',
655
+ title: 'Foo',
656
+ },
657
+ }),
658
+ ],
659
+ collectionExtraInfo: {
660
+ public_metadata: {
661
+ 'sort-by': 'titleSorter',
662
+ },
663
+ },
664
+ },
665
+ responseHeader: {
666
+ succeeded: true,
667
+ query_time: 0,
668
+ },
669
+ },
670
+ });
671
+ export const getMockSuccessWithConciseDefaultSort = () => ({
672
+ success: {
673
+ request: {
674
+ kind: 'hits',
675
+ clientParameters: {
676
+ user_query: 'default-sort-concise',
677
+ sort: [],
678
+ },
679
+ backendRequests: {
680
+ primary: {
681
+ kind: 'hits',
682
+ finalized_parameters: {
683
+ user_query: 'default-sort-concise',
684
+ sort: ['addeddate:desc', 'identifier'],
685
+ },
686
+ },
687
+ },
688
+ },
689
+ rawResponse: {},
690
+ response: {
691
+ totalResults: 1,
692
+ returnedCount: 1,
693
+ results: [
694
+ new ItemHit({
695
+ fields: {
696
+ identifier: 'foo',
697
+ title: 'Foo',
698
+ },
699
+ }),
700
+ ],
701
+ collectionExtraInfo: {
702
+ public_metadata: {
703
+ 'sort-by': '-addeddate',
704
+ },
705
+ },
706
+ },
707
+ responseHeader: {
708
+ succeeded: true,
709
+ query_time: 0,
710
+ },
711
+ },
712
+ });
713
+ export const getMockSuccessWithDefaultFavSort = () => ({
714
+ success: {
715
+ request: {
716
+ kind: 'hits',
717
+ clientParameters: {
718
+ user_query: 'fav-sort',
719
+ sort: [],
720
+ },
721
+ backendRequests: {
722
+ primary: {
723
+ kind: 'hits',
724
+ finalized_parameters: {
725
+ user_query: 'fav-sort',
726
+ sort: [],
727
+ },
728
+ },
729
+ },
730
+ },
731
+ rawResponse: {},
732
+ response: {
733
+ totalResults: 1,
734
+ returnedCount: 1,
735
+ results: [
736
+ new ItemHit({
737
+ fields: {
738
+ identifier: 'foo',
739
+ title: 'Foo',
740
+ },
741
+ }),
742
+ ],
743
+ collectionExtraInfo: {
744
+ public_metadata: {
745
+ identifier: 'fav-foo',
746
+ },
747
+ },
748
+ },
749
+ responseHeader: {
750
+ succeeded: true,
751
+ query_time: 0,
752
+ },
753
+ },
754
+ });
755
+ export const getMockSuccessWithParentCollections = () => ({
756
+ success: {
757
+ request: {
758
+ kind: 'hits',
759
+ clientParameters: {
760
+ user_query: 'parent-collections',
761
+ sort: [],
762
+ },
763
+ backendRequests: {
764
+ primary: {
765
+ kind: 'hits',
766
+ finalized_parameters: {
767
+ user_query: 'parent-collections',
768
+ sort: [],
769
+ },
770
+ },
771
+ },
772
+ },
773
+ rawResponse: {},
774
+ response: {
775
+ totalResults: 1,
776
+ returnedCount: 1,
777
+ results: [
778
+ new ItemHit({
779
+ fields: {
780
+ identifier: 'foo',
781
+ title: 'Foo',
782
+ },
783
+ }),
784
+ ],
785
+ collectionExtraInfo: {
786
+ public_metadata: {
787
+ collection: ['foo', 'bar'],
788
+ },
789
+ },
790
+ },
791
+ responseHeader: {
792
+ succeeded: true,
793
+ query_time: 0,
794
+ },
795
+ },
796
+ });
797
+ export const getMockSuccessWithWebArchiveHits = () => ({
798
+ success: {
799
+ request: {
800
+ kind: 'hits',
801
+ clientParameters: {
802
+ user_query: 'web-archive',
803
+ sort: [],
804
+ },
805
+ backendRequests: {
806
+ primary: {
807
+ kind: 'hits',
808
+ finalized_parameters: {
809
+ user_query: 'web-archive',
810
+ sort: [],
811
+ },
812
+ },
813
+ },
814
+ },
815
+ rawResponse: {},
816
+ response: {
817
+ totalResults: 1,
818
+ returnedCount: 1,
819
+ results: [
820
+ new WebArchiveHit({
821
+ fields: {
822
+ url: 'https://example.com',
823
+ capture_dates: ['2010-01-02T03:04:05Z'],
824
+ __href__: 'https://web.archive.org/web/20100102030405/https%3A%2F%2Fexample.com',
825
+ },
826
+ }),
827
+ ],
828
+ },
829
+ responseHeader: {
830
+ succeeded: true,
831
+ query_time: 0,
832
+ },
833
+ },
834
+ });
835
+ export const getMockErrorResult = () => ({
836
+ error: new SearchServiceError(SearchServiceErrorType.networkError, 'foo', {
837
+ message: 'bar',
838
+ }),
839
+ });
840
+ export const getMockMalformedResult = () => ({});
710
841
  //# sourceMappingURL=mock-search-responses.js.map