@littlebearapps/australian-history-mcp 0.6.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 (467) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +502 -0
  3. package/dist/clients/datagovau_client.d.ts +61 -0
  4. package/dist/clients/datagovau_client.d.ts.map +1 -0
  5. package/dist/clients/datagovau_client.js +421 -0
  6. package/dist/clients/datagovau_client.js.map +1 -0
  7. package/dist/clients/prov_client.d.ts +64 -0
  8. package/dist/clients/prov_client.d.ts.map +1 -0
  9. package/dist/clients/prov_client.js +393 -0
  10. package/dist/clients/prov_client.js.map +1 -0
  11. package/dist/clients/trove_client.d.ts +77 -0
  12. package/dist/clients/trove_client.d.ts.map +1 -0
  13. package/dist/clients/trove_client.js +374 -0
  14. package/dist/clients/trove_client.js.map +1 -0
  15. package/dist/core/base-client.d.ts +49 -0
  16. package/dist/core/base-client.d.ts.map +1 -0
  17. package/dist/core/base-client.js +116 -0
  18. package/dist/core/base-client.js.map +1 -0
  19. package/dist/core/base-source.d.ts +45 -0
  20. package/dist/core/base-source.d.ts.map +1 -0
  21. package/dist/core/base-source.js +19 -0
  22. package/dist/core/base-source.js.map +1 -0
  23. package/dist/core/harvest-runner.d.ts +26 -0
  24. package/dist/core/harvest-runner.d.ts.map +1 -0
  25. package/dist/core/harvest-runner.js +82 -0
  26. package/dist/core/harvest-runner.js.map +1 -0
  27. package/dist/core/index.d.ts +10 -0
  28. package/dist/core/index.d.ts.map +1 -0
  29. package/dist/core/index.js +14 -0
  30. package/dist/core/index.js.map +1 -0
  31. package/dist/core/types.d.ts +80 -0
  32. package/dist/core/types.d.ts.map +1 -0
  33. package/dist/core/types.js +52 -0
  34. package/dist/core/types.js.map +1 -0
  35. package/dist/index.d.ts +21 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +103 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/registry.d.ts +65 -0
  40. package/dist/registry.d.ts.map +1 -0
  41. package/dist/registry.js +112 -0
  42. package/dist/registry.js.map +1 -0
  43. package/dist/sources/acmi/client.d.ts +47 -0
  44. package/dist/sources/acmi/client.d.ts.map +1 -0
  45. package/dist/sources/acmi/client.js +131 -0
  46. package/dist/sources/acmi/client.js.map +1 -0
  47. package/dist/sources/acmi/index.d.ts +12 -0
  48. package/dist/sources/acmi/index.d.ts.map +1 -0
  49. package/dist/sources/acmi/index.js +35 -0
  50. package/dist/sources/acmi/index.js.map +1 -0
  51. package/dist/sources/acmi/tools/get-constellation.d.ts +6 -0
  52. package/dist/sources/acmi/tools/get-constellation.d.ts.map +1 -0
  53. package/dist/sources/acmi/tools/get-constellation.js +53 -0
  54. package/dist/sources/acmi/tools/get-constellation.js.map +1 -0
  55. package/dist/sources/acmi/tools/get-creator.d.ts +6 -0
  56. package/dist/sources/acmi/tools/get-creator.d.ts.map +1 -0
  57. package/dist/sources/acmi/tools/get-creator.js +52 -0
  58. package/dist/sources/acmi/tools/get-creator.js.map +1 -0
  59. package/dist/sources/acmi/tools/get-work.d.ts +6 -0
  60. package/dist/sources/acmi/tools/get-work.d.ts.map +1 -0
  61. package/dist/sources/acmi/tools/get-work.js +103 -0
  62. package/dist/sources/acmi/tools/get-work.js.map +1 -0
  63. package/dist/sources/acmi/tools/harvest.d.ts +6 -0
  64. package/dist/sources/acmi/tools/harvest.d.ts.map +1 -0
  65. package/dist/sources/acmi/tools/harvest.js +95 -0
  66. package/dist/sources/acmi/tools/harvest.js.map +1 -0
  67. package/dist/sources/acmi/tools/list-constellations.d.ts +6 -0
  68. package/dist/sources/acmi/tools/list-constellations.d.ts.map +1 -0
  69. package/dist/sources/acmi/tools/list-constellations.js +44 -0
  70. package/dist/sources/acmi/tools/list-constellations.js.map +1 -0
  71. package/dist/sources/acmi/tools/list-creators.d.ts +6 -0
  72. package/dist/sources/acmi/tools/list-creators.d.ts.map +1 -0
  73. package/dist/sources/acmi/tools/list-creators.js +46 -0
  74. package/dist/sources/acmi/tools/list-creators.js.map +1 -0
  75. package/dist/sources/acmi/tools/search-works.d.ts +6 -0
  76. package/dist/sources/acmi/tools/search-works.d.ts.map +1 -0
  77. package/dist/sources/acmi/tools/search-works.js +73 -0
  78. package/dist/sources/acmi/tools/search-works.js.map +1 -0
  79. package/dist/sources/acmi/types.d.ts +135 -0
  80. package/dist/sources/acmi/types.d.ts.map +1 -0
  81. package/dist/sources/acmi/types.js +5 -0
  82. package/dist/sources/acmi/types.js.map +1 -0
  83. package/dist/sources/ala/client.d.ts +79 -0
  84. package/dist/sources/ala/client.d.ts.map +1 -0
  85. package/dist/sources/ala/client.js +556 -0
  86. package/dist/sources/ala/client.js.map +1 -0
  87. package/dist/sources/ala/index.d.ts +12 -0
  88. package/dist/sources/ala/index.d.ts.map +1 -0
  89. package/dist/sources/ala/index.js +37 -0
  90. package/dist/sources/ala/index.js.map +1 -0
  91. package/dist/sources/ala/tools/get-species-list.d.ts +6 -0
  92. package/dist/sources/ala/tools/get-species-list.d.ts.map +1 -0
  93. package/dist/sources/ala/tools/get-species-list.js +56 -0
  94. package/dist/sources/ala/tools/get-species-list.js.map +1 -0
  95. package/dist/sources/ala/tools/get-species.d.ts +6 -0
  96. package/dist/sources/ala/tools/get-species.d.ts.map +1 -0
  97. package/dist/sources/ala/tools/get-species.js +81 -0
  98. package/dist/sources/ala/tools/get-species.js.map +1 -0
  99. package/dist/sources/ala/tools/harvest.d.ts +6 -0
  100. package/dist/sources/ala/tools/harvest.d.ts.map +1 -0
  101. package/dist/sources/ala/tools/harvest.js +133 -0
  102. package/dist/sources/ala/tools/harvest.js.map +1 -0
  103. package/dist/sources/ala/tools/list-species-lists.d.ts +6 -0
  104. package/dist/sources/ala/tools/list-species-lists.d.ts.map +1 -0
  105. package/dist/sources/ala/tools/list-species-lists.js +60 -0
  106. package/dist/sources/ala/tools/list-species-lists.js.map +1 -0
  107. package/dist/sources/ala/tools/match-name.d.ts +6 -0
  108. package/dist/sources/ala/tools/match-name.d.ts.map +1 -0
  109. package/dist/sources/ala/tools/match-name.js +66 -0
  110. package/dist/sources/ala/tools/match-name.js.map +1 -0
  111. package/dist/sources/ala/tools/search-images.d.ts +6 -0
  112. package/dist/sources/ala/tools/search-images.d.ts.map +1 -0
  113. package/dist/sources/ala/tools/search-images.js +64 -0
  114. package/dist/sources/ala/tools/search-images.js.map +1 -0
  115. package/dist/sources/ala/tools/search-occurrences.d.ts +6 -0
  116. package/dist/sources/ala/tools/search-occurrences.d.ts.map +1 -0
  117. package/dist/sources/ala/tools/search-occurrences.js +134 -0
  118. package/dist/sources/ala/tools/search-occurrences.js.map +1 -0
  119. package/dist/sources/ala/tools/search-species.d.ts +6 -0
  120. package/dist/sources/ala/tools/search-species.d.ts.map +1 -0
  121. package/dist/sources/ala/tools/search-species.js +68 -0
  122. package/dist/sources/ala/tools/search-species.js.map +1 -0
  123. package/dist/sources/ala/types.d.ts +255 -0
  124. package/dist/sources/ala/types.d.ts.map +1 -0
  125. package/dist/sources/ala/types.js +7 -0
  126. package/dist/sources/ala/types.js.map +1 -0
  127. package/dist/sources/datagovau/client.d.ts +68 -0
  128. package/dist/sources/datagovau/client.d.ts.map +1 -0
  129. package/dist/sources/datagovau/client.js +344 -0
  130. package/dist/sources/datagovau/client.js.map +1 -0
  131. package/dist/sources/datagovau/index.d.ts +12 -0
  132. package/dist/sources/datagovau/index.d.ts.map +1 -0
  133. package/dist/sources/datagovau/index.js +37 -0
  134. package/dist/sources/datagovau/index.js.map +1 -0
  135. package/dist/sources/datagovau/tools/autocomplete.d.ts +6 -0
  136. package/dist/sources/datagovau/tools/autocomplete.d.ts.map +1 -0
  137. package/dist/sources/datagovau/tools/autocomplete.js +49 -0
  138. package/dist/sources/datagovau/tools/autocomplete.js.map +1 -0
  139. package/dist/sources/datagovau/tools/browse.d.ts +25 -0
  140. package/dist/sources/datagovau/tools/browse.d.ts.map +1 -0
  141. package/dist/sources/datagovau/tools/browse.js +205 -0
  142. package/dist/sources/datagovau/tools/browse.js.map +1 -0
  143. package/dist/sources/datagovau/tools/dataset.d.ts +17 -0
  144. package/dist/sources/datagovau/tools/dataset.d.ts.map +1 -0
  145. package/dist/sources/datagovau/tools/dataset.js +177 -0
  146. package/dist/sources/datagovau/tools/dataset.js.map +1 -0
  147. package/dist/sources/datagovau/tools/harvest.d.ts +6 -0
  148. package/dist/sources/datagovau/tools/harvest.d.ts.map +1 -0
  149. package/dist/sources/datagovau/tools/harvest.js +99 -0
  150. package/dist/sources/datagovau/tools/harvest.js.map +1 -0
  151. package/dist/sources/datagovau/tools/search.d.ts +6 -0
  152. package/dist/sources/datagovau/tools/search.d.ts.map +1 -0
  153. package/dist/sources/datagovau/tools/search.js +85 -0
  154. package/dist/sources/datagovau/tools/search.js.map +1 -0
  155. package/dist/sources/datagovau/types.d.ts +81 -0
  156. package/dist/sources/datagovau/types.d.ts.map +1 -0
  157. package/dist/sources/datagovau/types.js +5 -0
  158. package/dist/sources/datagovau/types.js.map +1 -0
  159. package/dist/sources/ga-hap/client.d.ts +65 -0
  160. package/dist/sources/ga-hap/client.d.ts.map +1 -0
  161. package/dist/sources/ga-hap/client.js +247 -0
  162. package/dist/sources/ga-hap/client.js.map +1 -0
  163. package/dist/sources/ga-hap/index.d.ts +12 -0
  164. package/dist/sources/ga-hap/index.d.ts.map +1 -0
  165. package/dist/sources/ga-hap/index.js +23 -0
  166. package/dist/sources/ga-hap/index.js.map +1 -0
  167. package/dist/sources/ga-hap/tools/get-photo.d.ts +6 -0
  168. package/dist/sources/ga-hap/tools/get-photo.d.ts.map +1 -0
  169. package/dist/sources/ga-hap/tools/get-photo.js +89 -0
  170. package/dist/sources/ga-hap/tools/get-photo.js.map +1 -0
  171. package/dist/sources/ga-hap/tools/harvest.d.ts +6 -0
  172. package/dist/sources/ga-hap/tools/harvest.d.ts.map +1 -0
  173. package/dist/sources/ga-hap/tools/harvest.js +87 -0
  174. package/dist/sources/ga-hap/tools/harvest.js.map +1 -0
  175. package/dist/sources/ga-hap/tools/search.d.ts +6 -0
  176. package/dist/sources/ga-hap/tools/search.d.ts.map +1 -0
  177. package/dist/sources/ga-hap/tools/search.js +97 -0
  178. package/dist/sources/ga-hap/tools/search.js.map +1 -0
  179. package/dist/sources/ga-hap/types.d.ts +178 -0
  180. package/dist/sources/ga-hap/types.d.ts.map +1 -0
  181. package/dist/sources/ga-hap/types.js +30 -0
  182. package/dist/sources/ga-hap/types.js.map +1 -0
  183. package/dist/sources/iiif/client.d.ts +37 -0
  184. package/dist/sources/iiif/client.d.ts.map +1 -0
  185. package/dist/sources/iiif/client.js +142 -0
  186. package/dist/sources/iiif/client.js.map +1 -0
  187. package/dist/sources/iiif/index.d.ts +18 -0
  188. package/dist/sources/iiif/index.d.ts.map +1 -0
  189. package/dist/sources/iiif/index.js +31 -0
  190. package/dist/sources/iiif/index.js.map +1 -0
  191. package/dist/sources/iiif/tools/get-image-url.d.ts +9 -0
  192. package/dist/sources/iiif/tools/get-image-url.d.ts.map +1 -0
  193. package/dist/sources/iiif/tools/get-image-url.js +101 -0
  194. package/dist/sources/iiif/tools/get-image-url.js.map +1 -0
  195. package/dist/sources/iiif/tools/get-manifest.d.ts +9 -0
  196. package/dist/sources/iiif/tools/get-manifest.d.ts.map +1 -0
  197. package/dist/sources/iiif/tools/get-manifest.js +87 -0
  198. package/dist/sources/iiif/tools/get-manifest.js.map +1 -0
  199. package/dist/sources/iiif/types.d.ts +123 -0
  200. package/dist/sources/iiif/types.d.ts.map +1 -0
  201. package/dist/sources/iiif/types.js +26 -0
  202. package/dist/sources/iiif/types.js.map +1 -0
  203. package/dist/sources/museums-victoria/client.d.ts +64 -0
  204. package/dist/sources/museums-victoria/client.d.ts.map +1 -0
  205. package/dist/sources/museums-victoria/client.js +358 -0
  206. package/dist/sources/museums-victoria/client.js.map +1 -0
  207. package/dist/sources/museums-victoria/index.d.ts +12 -0
  208. package/dist/sources/museums-victoria/index.d.ts.map +1 -0
  209. package/dist/sources/museums-victoria/index.js +30 -0
  210. package/dist/sources/museums-victoria/index.js.map +1 -0
  211. package/dist/sources/museums-victoria/tools/harvest.d.ts +6 -0
  212. package/dist/sources/museums-victoria/tools/harvest.d.ts.map +1 -0
  213. package/dist/sources/museums-victoria/tools/harvest.js +120 -0
  214. package/dist/sources/museums-victoria/tools/harvest.js.map +1 -0
  215. package/dist/sources/museums-victoria/tools/records.d.ts +21 -0
  216. package/dist/sources/museums-victoria/tools/records.d.ts.map +1 -0
  217. package/dist/sources/museums-victoria/tools/records.js +225 -0
  218. package/dist/sources/museums-victoria/tools/records.js.map +1 -0
  219. package/dist/sources/museums-victoria/tools/search.d.ts +6 -0
  220. package/dist/sources/museums-victoria/tools/search.d.ts.map +1 -0
  221. package/dist/sources/museums-victoria/tools/search.js +147 -0
  222. package/dist/sources/museums-victoria/tools/search.js.map +1 -0
  223. package/dist/sources/museums-victoria/types.d.ts +153 -0
  224. package/dist/sources/museums-victoria/types.d.ts.map +1 -0
  225. package/dist/sources/museums-victoria/types.js +5 -0
  226. package/dist/sources/museums-victoria/types.js.map +1 -0
  227. package/dist/sources/nma/client.d.ts +52 -0
  228. package/dist/sources/nma/client.d.ts.map +1 -0
  229. package/dist/sources/nma/client.js +175 -0
  230. package/dist/sources/nma/client.js.map +1 -0
  231. package/dist/sources/nma/index.d.ts +12 -0
  232. package/dist/sources/nma/index.d.ts.map +1 -0
  233. package/dist/sources/nma/index.js +39 -0
  234. package/dist/sources/nma/index.js.map +1 -0
  235. package/dist/sources/nma/tools/get-media.d.ts +6 -0
  236. package/dist/sources/nma/tools/get-media.d.ts.map +1 -0
  237. package/dist/sources/nma/tools/get-media.js +58 -0
  238. package/dist/sources/nma/tools/get-media.js.map +1 -0
  239. package/dist/sources/nma/tools/get-object.d.ts +6 -0
  240. package/dist/sources/nma/tools/get-object.d.ts.map +1 -0
  241. package/dist/sources/nma/tools/get-object.js +83 -0
  242. package/dist/sources/nma/tools/get-object.js.map +1 -0
  243. package/dist/sources/nma/tools/get-party.d.ts +6 -0
  244. package/dist/sources/nma/tools/get-party.d.ts.map +1 -0
  245. package/dist/sources/nma/tools/get-party.js +63 -0
  246. package/dist/sources/nma/tools/get-party.js.map +1 -0
  247. package/dist/sources/nma/tools/get-place.d.ts +6 -0
  248. package/dist/sources/nma/tools/get-place.d.ts.map +1 -0
  249. package/dist/sources/nma/tools/get-place.js +50 -0
  250. package/dist/sources/nma/tools/get-place.js.map +1 -0
  251. package/dist/sources/nma/tools/harvest.d.ts +6 -0
  252. package/dist/sources/nma/tools/harvest.d.ts.map +1 -0
  253. package/dist/sources/nma/tools/harvest.js +91 -0
  254. package/dist/sources/nma/tools/harvest.js.map +1 -0
  255. package/dist/sources/nma/tools/search-media.d.ts +6 -0
  256. package/dist/sources/nma/tools/search-media.d.ts.map +1 -0
  257. package/dist/sources/nma/tools/search-media.js +66 -0
  258. package/dist/sources/nma/tools/search-media.js.map +1 -0
  259. package/dist/sources/nma/tools/search-objects.d.ts +6 -0
  260. package/dist/sources/nma/tools/search-objects.d.ts.map +1 -0
  261. package/dist/sources/nma/tools/search-objects.js +70 -0
  262. package/dist/sources/nma/tools/search-objects.js.map +1 -0
  263. package/dist/sources/nma/tools/search-parties.d.ts +6 -0
  264. package/dist/sources/nma/tools/search-parties.d.ts.map +1 -0
  265. package/dist/sources/nma/tools/search-parties.js +64 -0
  266. package/dist/sources/nma/tools/search-parties.js.map +1 -0
  267. package/dist/sources/nma/tools/search-places.d.ts +6 -0
  268. package/dist/sources/nma/tools/search-places.d.ts.map +1 -0
  269. package/dist/sources/nma/tools/search-places.js +53 -0
  270. package/dist/sources/nma/tools/search-places.js.map +1 -0
  271. package/dist/sources/nma/types.d.ts +135 -0
  272. package/dist/sources/nma/types.d.ts.map +1 -0
  273. package/dist/sources/nma/types.js +5 -0
  274. package/dist/sources/nma/types.js.map +1 -0
  275. package/dist/sources/pm-transcripts/client.d.ts +39 -0
  276. package/dist/sources/pm-transcripts/client.d.ts.map +1 -0
  277. package/dist/sources/pm-transcripts/client.js +192 -0
  278. package/dist/sources/pm-transcripts/client.js.map +1 -0
  279. package/dist/sources/pm-transcripts/index.d.ts +13 -0
  280. package/dist/sources/pm-transcripts/index.d.ts.map +1 -0
  281. package/dist/sources/pm-transcripts/index.js +23 -0
  282. package/dist/sources/pm-transcripts/index.js.map +1 -0
  283. package/dist/sources/pm-transcripts/tools/get-transcript.d.ts +6 -0
  284. package/dist/sources/pm-transcripts/tools/get-transcript.d.ts.map +1 -0
  285. package/dist/sources/pm-transcripts/tools/get-transcript.js +52 -0
  286. package/dist/sources/pm-transcripts/tools/get-transcript.js.map +1 -0
  287. package/dist/sources/pm-transcripts/tools/harvest.d.ts +9 -0
  288. package/dist/sources/pm-transcripts/tools/harvest.d.ts.map +1 -0
  289. package/dist/sources/pm-transcripts/tools/harvest.js +213 -0
  290. package/dist/sources/pm-transcripts/tools/harvest.js.map +1 -0
  291. package/dist/sources/pm-transcripts/types.d.ts +54 -0
  292. package/dist/sources/pm-transcripts/types.d.ts.map +1 -0
  293. package/dist/sources/pm-transcripts/types.js +8 -0
  294. package/dist/sources/pm-transcripts/types.js.map +1 -0
  295. package/dist/sources/prov/client.d.ts +46 -0
  296. package/dist/sources/prov/client.d.ts.map +1 -0
  297. package/dist/sources/prov/client.js +297 -0
  298. package/dist/sources/prov/client.js.map +1 -0
  299. package/dist/sources/prov/index.d.ts +12 -0
  300. package/dist/sources/prov/index.d.ts.map +1 -0
  301. package/dist/sources/prov/index.js +31 -0
  302. package/dist/sources/prov/index.js.map +1 -0
  303. package/dist/sources/prov/tools/get-agency.d.ts +6 -0
  304. package/dist/sources/prov/tools/get-agency.d.ts.map +1 -0
  305. package/dist/sources/prov/tools/get-agency.js +49 -0
  306. package/dist/sources/prov/tools/get-agency.js.map +1 -0
  307. package/dist/sources/prov/tools/get-series.d.ts +6 -0
  308. package/dist/sources/prov/tools/get-series.d.ts.map +1 -0
  309. package/dist/sources/prov/tools/get-series.js +51 -0
  310. package/dist/sources/prov/tools/get-series.js.map +1 -0
  311. package/dist/sources/prov/tools/harvest.d.ts +6 -0
  312. package/dist/sources/prov/tools/harvest.d.ts.map +1 -0
  313. package/dist/sources/prov/tools/harvest.js +112 -0
  314. package/dist/sources/prov/tools/harvest.js.map +1 -0
  315. package/dist/sources/prov/tools/images.d.ts +9 -0
  316. package/dist/sources/prov/tools/images.d.ts.map +1 -0
  317. package/dist/sources/prov/tools/images.js +67 -0
  318. package/dist/sources/prov/tools/images.js.map +1 -0
  319. package/dist/sources/prov/tools/search.d.ts +6 -0
  320. package/dist/sources/prov/tools/search.d.ts.map +1 -0
  321. package/dist/sources/prov/tools/search.js +103 -0
  322. package/dist/sources/prov/tools/search.js.map +1 -0
  323. package/dist/sources/prov/types.d.ts +75 -0
  324. package/dist/sources/prov/types.d.ts.map +1 -0
  325. package/dist/sources/prov/types.js +31 -0
  326. package/dist/sources/prov/types.js.map +1 -0
  327. package/dist/sources/trove/client.d.ts +128 -0
  328. package/dist/sources/trove/client.d.ts.map +1 -0
  329. package/dist/sources/trove/client.js +1008 -0
  330. package/dist/sources/trove/client.js.map +1 -0
  331. package/dist/sources/trove/index.d.ts +12 -0
  332. package/dist/sources/trove/index.d.ts.map +1 -0
  333. package/dist/sources/trove/index.js +53 -0
  334. package/dist/sources/trove/index.js.map +1 -0
  335. package/dist/sources/trove/tools/get-contributor.d.ts +6 -0
  336. package/dist/sources/trove/tools/get-contributor.d.ts.map +1 -0
  337. package/dist/sources/trove/tools/get-contributor.js +54 -0
  338. package/dist/sources/trove/tools/get-contributor.js.map +1 -0
  339. package/dist/sources/trove/tools/get-list.d.ts +6 -0
  340. package/dist/sources/trove/tools/get-list.d.ts.map +1 -0
  341. package/dist/sources/trove/tools/get-list.js +95 -0
  342. package/dist/sources/trove/tools/get-list.js.map +1 -0
  343. package/dist/sources/trove/tools/get-magazine-title.d.ts +6 -0
  344. package/dist/sources/trove/tools/get-magazine-title.d.ts.map +1 -0
  345. package/dist/sources/trove/tools/get-magazine-title.js +96 -0
  346. package/dist/sources/trove/tools/get-magazine-title.js.map +1 -0
  347. package/dist/sources/trove/tools/get-person.d.ts +6 -0
  348. package/dist/sources/trove/tools/get-person.d.ts.map +1 -0
  349. package/dist/sources/trove/tools/get-person.js +64 -0
  350. package/dist/sources/trove/tools/get-person.js.map +1 -0
  351. package/dist/sources/trove/tools/get-work.d.ts +6 -0
  352. package/dist/sources/trove/tools/get-work.d.ts.map +1 -0
  353. package/dist/sources/trove/tools/get-work.js +104 -0
  354. package/dist/sources/trove/tools/get-work.js.map +1 -0
  355. package/dist/sources/trove/tools/harvest.d.ts +6 -0
  356. package/dist/sources/trove/tools/harvest.d.ts.map +1 -0
  357. package/dist/sources/trove/tools/harvest.js +127 -0
  358. package/dist/sources/trove/tools/harvest.js.map +1 -0
  359. package/dist/sources/trove/tools/list-contributors.d.ts +6 -0
  360. package/dist/sources/trove/tools/list-contributors.d.ts.map +1 -0
  361. package/dist/sources/trove/tools/list-contributors.js +59 -0
  362. package/dist/sources/trove/tools/list-contributors.js.map +1 -0
  363. package/dist/sources/trove/tools/list-magazine-titles.d.ts +6 -0
  364. package/dist/sources/trove/tools/list-magazine-titles.d.ts.map +1 -0
  365. package/dist/sources/trove/tools/list-magazine-titles.js +42 -0
  366. package/dist/sources/trove/tools/list-magazine-titles.js.map +1 -0
  367. package/dist/sources/trove/tools/newspaper.d.ts +17 -0
  368. package/dist/sources/trove/tools/newspaper.d.ts.map +1 -0
  369. package/dist/sources/trove/tools/newspaper.js +210 -0
  370. package/dist/sources/trove/tools/newspaper.js.map +1 -0
  371. package/dist/sources/trove/tools/search-people.d.ts +6 -0
  372. package/dist/sources/trove/tools/search-people.d.ts.map +1 -0
  373. package/dist/sources/trove/tools/search-people.js +72 -0
  374. package/dist/sources/trove/tools/search-people.js.map +1 -0
  375. package/dist/sources/trove/tools/search.d.ts +6 -0
  376. package/dist/sources/trove/tools/search.d.ts.map +1 -0
  377. package/dist/sources/trove/tools/search.js +219 -0
  378. package/dist/sources/trove/tools/search.js.map +1 -0
  379. package/dist/sources/trove/types.d.ts +257 -0
  380. package/dist/sources/trove/types.d.ts.map +1 -0
  381. package/dist/sources/trove/types.js +38 -0
  382. package/dist/sources/trove/types.js.map +1 -0
  383. package/dist/sources/vhd/client.d.ts +47 -0
  384. package/dist/sources/vhd/client.d.ts.map +1 -0
  385. package/dist/sources/vhd/client.js +158 -0
  386. package/dist/sources/vhd/client.js.map +1 -0
  387. package/dist/sources/vhd/index.d.ts +12 -0
  388. package/dist/sources/vhd/index.d.ts.map +1 -0
  389. package/dist/sources/vhd/index.js +39 -0
  390. package/dist/sources/vhd/index.js.map +1 -0
  391. package/dist/sources/vhd/tools/get-place.d.ts +6 -0
  392. package/dist/sources/vhd/tools/get-place.d.ts.map +1 -0
  393. package/dist/sources/vhd/tools/get-place.js +71 -0
  394. package/dist/sources/vhd/tools/get-place.js.map +1 -0
  395. package/dist/sources/vhd/tools/get-shipwreck.d.ts +6 -0
  396. package/dist/sources/vhd/tools/get-shipwreck.d.ts.map +1 -0
  397. package/dist/sources/vhd/tools/get-shipwreck.js +60 -0
  398. package/dist/sources/vhd/tools/get-shipwreck.js.map +1 -0
  399. package/dist/sources/vhd/tools/harvest.d.ts +6 -0
  400. package/dist/sources/vhd/tools/harvest.d.ts.map +1 -0
  401. package/dist/sources/vhd/tools/harvest.js +109 -0
  402. package/dist/sources/vhd/tools/harvest.js.map +1 -0
  403. package/dist/sources/vhd/tools/list-architectural-styles.d.ts +6 -0
  404. package/dist/sources/vhd/tools/list-architectural-styles.d.ts.map +1 -0
  405. package/dist/sources/vhd/tools/list-architectural-styles.js +33 -0
  406. package/dist/sources/vhd/tools/list-architectural-styles.js.map +1 -0
  407. package/dist/sources/vhd/tools/list-municipalities.d.ts +6 -0
  408. package/dist/sources/vhd/tools/list-municipalities.d.ts.map +1 -0
  409. package/dist/sources/vhd/tools/list-municipalities.js +33 -0
  410. package/dist/sources/vhd/tools/list-municipalities.js.map +1 -0
  411. package/dist/sources/vhd/tools/list-periods.d.ts +6 -0
  412. package/dist/sources/vhd/tools/list-periods.d.ts.map +1 -0
  413. package/dist/sources/vhd/tools/list-periods.js +33 -0
  414. package/dist/sources/vhd/tools/list-periods.js.map +1 -0
  415. package/dist/sources/vhd/tools/list-themes.d.ts +6 -0
  416. package/dist/sources/vhd/tools/list-themes.d.ts.map +1 -0
  417. package/dist/sources/vhd/tools/list-themes.js +34 -0
  418. package/dist/sources/vhd/tools/list-themes.js.map +1 -0
  419. package/dist/sources/vhd/tools/search-places.d.ts +6 -0
  420. package/dist/sources/vhd/tools/search-places.d.ts.map +1 -0
  421. package/dist/sources/vhd/tools/search-places.js +71 -0
  422. package/dist/sources/vhd/tools/search-places.js.map +1 -0
  423. package/dist/sources/vhd/tools/search-shipwrecks.d.ts +6 -0
  424. package/dist/sources/vhd/tools/search-shipwrecks.d.ts.map +1 -0
  425. package/dist/sources/vhd/tools/search-shipwrecks.js +52 -0
  426. package/dist/sources/vhd/tools/search-shipwrecks.js.map +1 -0
  427. package/dist/sources/vhd/types.d.ts +179 -0
  428. package/dist/sources/vhd/types.d.ts.map +1 -0
  429. package/dist/sources/vhd/types.js +5 -0
  430. package/dist/sources/vhd/types.js.map +1 -0
  431. package/dist/tools/datagovau_browse.d.ts +96 -0
  432. package/dist/tools/datagovau_browse.d.ts.map +1 -0
  433. package/dist/tools/datagovau_browse.js +297 -0
  434. package/dist/tools/datagovau_browse.js.map +1 -0
  435. package/dist/tools/datagovau_dataset.d.ts +79 -0
  436. package/dist/tools/datagovau_dataset.d.ts.map +1 -0
  437. package/dist/tools/datagovau_dataset.js +246 -0
  438. package/dist/tools/datagovau_dataset.js.map +1 -0
  439. package/dist/tools/datagovau_search.d.ts +58 -0
  440. package/dist/tools/datagovau_search.d.ts.map +1 -0
  441. package/dist/tools/datagovau_search.js +112 -0
  442. package/dist/tools/datagovau_search.js.map +1 -0
  443. package/dist/tools/harvest.d.ts +175 -0
  444. package/dist/tools/harvest.d.ts.map +1 -0
  445. package/dist/tools/harvest.js +426 -0
  446. package/dist/tools/harvest.js.map +1 -0
  447. package/dist/tools/prov_images.d.ts +38 -0
  448. package/dist/tools/prov_images.d.ts.map +1 -0
  449. package/dist/tools/prov_images.js +87 -0
  450. package/dist/tools/prov_images.js.map +1 -0
  451. package/dist/tools/prov_search.d.ts +60 -0
  452. package/dist/tools/prov_search.d.ts.map +1 -0
  453. package/dist/tools/prov_search.js +131 -0
  454. package/dist/tools/prov_search.js.map +1 -0
  455. package/dist/tools/trove_newspaper.d.ts +100 -0
  456. package/dist/tools/trove_newspaper.d.ts.map +1 -0
  457. package/dist/tools/trove_newspaper.js +282 -0
  458. package/dist/tools/trove_newspaper.js.map +1 -0
  459. package/dist/tools/trove_search.d.ts +62 -0
  460. package/dist/tools/trove_search.d.ts.map +1 -0
  461. package/dist/tools/trove_search.js +143 -0
  462. package/dist/tools/trove_search.js.map +1 -0
  463. package/dist/types.d.ts +231 -0
  464. package/dist/types.d.ts.map +1 -0
  465. package/dist/types.js +5 -0
  466. package/dist/types.js.map +1 -0
  467. package/package.json +73 -0
@@ -0,0 +1,1008 @@
1
+ /**
2
+ * Trove (National Library of Australia) API Client
3
+ *
4
+ * The Trove API v3 provides access to the National Library's digitised
5
+ * collections including newspapers, books, images, maps, and more.
6
+ *
7
+ * API Documentation: https://trove.nla.gov.au/about/create-something/using-api/v3/api-technical-guide
8
+ * API Console: https://troveconsole.herokuapp.com/
9
+ */
10
+ import { BaseClient } from '../../core/base-client.js';
11
+ import { STATE_TO_FULL_NAME, } from './types.js';
12
+ const TROVE_API_BASE = 'https://api.trove.nla.gov.au/v3';
13
+ export class TroveClient extends BaseClient {
14
+ apiKey;
15
+ constructor(apiKey) {
16
+ super(TROVE_API_BASE, { userAgent: 'australian-history-mcp/0.6.0' });
17
+ this.apiKey = apiKey ?? process.env.TROVE_API_KEY ?? '';
18
+ if (!this.apiKey) {
19
+ console.warn('TROVE_API_KEY not set - Trove API calls will fail');
20
+ }
21
+ }
22
+ /**
23
+ * Search across Trove categories
24
+ */
25
+ async search(params) {
26
+ const categories = Array.isArray(params.category)
27
+ ? params.category
28
+ : [params.category ?? 'all'];
29
+ const urlParams = {
30
+ q: params.query,
31
+ encoding: 'json',
32
+ n: (params.limit ?? 20).toString(),
33
+ };
34
+ // Add categories
35
+ urlParams.category = categories;
36
+ // Pagination
37
+ if (params.start) {
38
+ urlParams.s = params.start;
39
+ }
40
+ // Sorting (relevance, datedesc, dateasc)
41
+ if (params.sortby && params.sortby !== 'relevance') {
42
+ urlParams.sortby = params.sortby;
43
+ }
44
+ // Bulk harvest mode (stable sorting by ID)
45
+ if (params.bulkHarvest) {
46
+ urlParams.bulkHarvest = 'true';
47
+ }
48
+ // Build query with date range and search indexes
49
+ let query = params.query;
50
+ // Date range - modify query
51
+ if (params.dateFrom || params.dateTo) {
52
+ const from = params.dateFrom ?? '*';
53
+ const to = params.dateTo ?? '*';
54
+ query = `${query} date:[${from} TO ${to}]`;
55
+ }
56
+ // Search indexes - add to query string
57
+ if (params.creator) {
58
+ query = `${query} creator:(${params.creator})`;
59
+ }
60
+ if (params.subject) {
61
+ query = `${query} subject:(${params.subject})`;
62
+ }
63
+ if (params.isbn) {
64
+ query = `${query} isbn:${params.isbn}`;
65
+ }
66
+ if (params.issn) {
67
+ query = `${query} issn:${params.issn}`;
68
+ }
69
+ if (params.identifier) {
70
+ query = `${query} identifier:${params.identifier}`;
71
+ }
72
+ if (params.anbdid) {
73
+ query = `${query} anbdid:${params.anbdid}`;
74
+ }
75
+ if (params.lastupdated) {
76
+ query = `${query} lastupdated:${params.lastupdated}`;
77
+ }
78
+ if (params.rights) {
79
+ query = `${query} rights:"${params.rights}"`;
80
+ }
81
+ if (params.placeOfPublication) {
82
+ query = `${query} placeOfPublication:"${params.placeOfPublication}"`;
83
+ }
84
+ if (params.geographicCoverage) {
85
+ query = `${query} geographicCoverage:"${params.geographicCoverage}"`;
86
+ }
87
+ if (params.fullTextInd) {
88
+ query = `${query} fullTextInd:y`;
89
+ }
90
+ if (params.imageInd) {
91
+ query = `${query} imageInd:thumbnail`;
92
+ }
93
+ urlParams.q = query;
94
+ // State filter (for newspapers) - API requires full state names
95
+ if (params.state) {
96
+ urlParams['l-state'] = STATE_TO_FULL_NAME[params.state] || params.state;
97
+ }
98
+ // Format filter
99
+ if (params.format) {
100
+ urlParams['l-format'] = params.format;
101
+ }
102
+ // NUC code filter (contributor/partner)
103
+ if (params.nuc) {
104
+ urlParams['l-partnerNuc'] = params.nuc;
105
+ }
106
+ // Illustrated filter (for newspapers)
107
+ if (params.illustrated) {
108
+ urlParams['l-illustrated'] = params.illustrated;
109
+ }
110
+ // Advanced facet filters
111
+ if (params.decade) {
112
+ urlParams['l-decade'] = params.decade;
113
+ }
114
+ if (params.language) {
115
+ urlParams['l-language'] = params.language;
116
+ }
117
+ if (params.availability) {
118
+ urlParams['l-availability'] = params.availability;
119
+ }
120
+ if (params.australian) {
121
+ urlParams['l-australian'] = 'y';
122
+ }
123
+ if (params.wordCount) {
124
+ urlParams['l-wordCount'] = params.wordCount;
125
+ }
126
+ if (params.artType) {
127
+ urlParams['l-artType'] = params.artType;
128
+ }
129
+ if (params.geocoverage) {
130
+ urlParams['l-geocoverage'] = params.geocoverage;
131
+ }
132
+ if (params.contribcollection) {
133
+ urlParams['l-contribcollection'] = params.contribcollection;
134
+ }
135
+ if (params.firstAustralians) {
136
+ urlParams['l-firstAustralians'] = 'y';
137
+ }
138
+ if (params.austlanguage) {
139
+ urlParams['l-austlanguage'] = params.austlanguage;
140
+ }
141
+ // Build include options
142
+ const includes = [];
143
+ if (params.includeFullText) {
144
+ includes.push('articletext');
145
+ }
146
+ if (params.includeHoldings) {
147
+ includes.push('holdings');
148
+ }
149
+ if (params.includeLinks) {
150
+ includes.push('links');
151
+ }
152
+ if (includes.length > 0) {
153
+ urlParams.include = includes.join(',');
154
+ }
155
+ // Request facets
156
+ if (params.facets) {
157
+ urlParams.facet = params.facets;
158
+ }
159
+ const url = this.buildUrl('/result', urlParams);
160
+ const response = await this.fetchWithAuth(url);
161
+ return this.parseSearchResponse(response, params.query);
162
+ }
163
+ /**
164
+ * Get a newspaper article by ID
165
+ */
166
+ async getNewspaperArticle(articleId, includeText = true) {
167
+ const urlParams = {
168
+ encoding: 'json',
169
+ reclevel: 'full',
170
+ };
171
+ if (includeText) {
172
+ urlParams.include = 'articletext';
173
+ }
174
+ const url = this.buildUrl(`/newspaper/${articleId}`, urlParams);
175
+ try {
176
+ const data = await this.fetchWithAuth(url);
177
+ return this.parseArticleDetail(data);
178
+ }
179
+ catch (error) {
180
+ if (error instanceof Error && error.message.includes('404')) {
181
+ return null;
182
+ }
183
+ throw error;
184
+ }
185
+ }
186
+ /**
187
+ * Get a gazette article by ID
188
+ */
189
+ async getGazetteArticle(articleId, includeText = true) {
190
+ const urlParams = {
191
+ encoding: 'json',
192
+ reclevel: 'full',
193
+ };
194
+ if (includeText) {
195
+ urlParams.include = 'articletext';
196
+ }
197
+ const url = this.buildUrl(`/gazette/${articleId}`, urlParams);
198
+ try {
199
+ const data = await this.fetchWithAuth(url);
200
+ return this.parseArticleDetail(data);
201
+ }
202
+ catch (error) {
203
+ if (error instanceof Error && error.message.includes('404')) {
204
+ return null;
205
+ }
206
+ throw error;
207
+ }
208
+ }
209
+ /**
210
+ * List newspaper titles
211
+ */
212
+ async listNewspaperTitles(state) {
213
+ const urlParams = {
214
+ encoding: 'json',
215
+ };
216
+ if (state) {
217
+ urlParams.state = state;
218
+ }
219
+ const url = this.buildUrl('/newspaper/titles', urlParams);
220
+ const data = await this.fetchWithAuth(url);
221
+ return this.parseNewspaperTitles(data);
222
+ }
223
+ /**
224
+ * List gazette titles
225
+ */
226
+ async listGazetteTitles(state) {
227
+ const urlParams = {
228
+ encoding: 'json',
229
+ };
230
+ if (state) {
231
+ urlParams.state = state;
232
+ }
233
+ const url = this.buildUrl('/gazette/titles', urlParams);
234
+ const data = await this.fetchWithAuth(url);
235
+ return this.parseNewspaperTitles(data);
236
+ }
237
+ /**
238
+ * Get details of a specific newspaper/gazette title
239
+ */
240
+ async getTitleDetails(titleId, options) {
241
+ const type = options?.type ?? 'newspaper';
242
+ const urlParams = {
243
+ encoding: 'json',
244
+ };
245
+ if (options?.includeYears) {
246
+ urlParams.include = 'years';
247
+ }
248
+ if (options?.dateRange) {
249
+ const { from, to } = options.dateRange;
250
+ urlParams.range = `${from}-${to}`;
251
+ }
252
+ const url = this.buildUrl(`/${type}/title/${titleId}`, urlParams);
253
+ try {
254
+ const data = await this.fetchWithAuth(url);
255
+ return this.parseTitleDetail(data);
256
+ }
257
+ catch (error) {
258
+ if (error instanceof Error && error.message.includes('404')) {
259
+ return null;
260
+ }
261
+ throw error;
262
+ }
263
+ }
264
+ /**
265
+ * Check if API key is configured
266
+ */
267
+ hasApiKey() {
268
+ return !!this.apiKey;
269
+ }
270
+ /**
271
+ * Get contributor (library/archive) details by NUC code
272
+ */
273
+ async getContributor(nuc) {
274
+ const url = this.buildUrl(`/contributor/${nuc}`, {
275
+ encoding: 'json',
276
+ });
277
+ try {
278
+ const data = await this.fetchWithAuth(url);
279
+ return this.parseContributor(data);
280
+ }
281
+ catch (error) {
282
+ if (error instanceof Error && error.message.includes('404')) {
283
+ return null;
284
+ }
285
+ throw error;
286
+ }
287
+ }
288
+ /**
289
+ * List magazine titles
290
+ */
291
+ async listMagazineTitles() {
292
+ const url = this.buildUrl('/magazine/titles', {
293
+ encoding: 'json',
294
+ });
295
+ const data = await this.fetchWithAuth(url);
296
+ return this.parseMagazineTitles(data);
297
+ }
298
+ /**
299
+ * Get a work by ID (books, images, maps, music, archives)
300
+ */
301
+ async getWork(workId, options) {
302
+ const urlParams = {
303
+ encoding: 'json',
304
+ };
305
+ if (options?.reclevel) {
306
+ urlParams.reclevel = options.reclevel;
307
+ }
308
+ if (options?.include && options.include.length > 0) {
309
+ urlParams.include = options.include.join(',');
310
+ }
311
+ const url = this.buildUrl(`/work/${workId}`, urlParams);
312
+ try {
313
+ const data = await this.fetchWithAuth(url);
314
+ return this.parseWorkDetail(data);
315
+ }
316
+ catch (error) {
317
+ if (error instanceof Error && error.message.includes('404')) {
318
+ return null;
319
+ }
320
+ throw error;
321
+ }
322
+ }
323
+ /**
324
+ * Get a user-curated list by ID
325
+ */
326
+ async getList(listId, options) {
327
+ const urlParams = {
328
+ encoding: 'json',
329
+ };
330
+ if (options?.include && options.include.length > 0) {
331
+ urlParams.include = options.include.join(',');
332
+ }
333
+ const url = this.buildUrl(`/list/${listId}`, urlParams);
334
+ try {
335
+ const data = await this.fetchWithAuth(url);
336
+ return this.parseList(data);
337
+ }
338
+ catch (error) {
339
+ if (error instanceof Error && error.message.includes('404')) {
340
+ return null;
341
+ }
342
+ throw error;
343
+ }
344
+ }
345
+ /**
346
+ * Get a person or organisation by ID
347
+ */
348
+ async getPerson(personId, options) {
349
+ const urlParams = {
350
+ encoding: 'json',
351
+ };
352
+ if (options?.reclevel) {
353
+ urlParams.reclevel = options.reclevel;
354
+ }
355
+ const url = this.buildUrl(`/people/${personId}`, urlParams);
356
+ try {
357
+ const data = await this.fetchWithAuth(url);
358
+ return this.parsePerson(data);
359
+ }
360
+ catch (error) {
361
+ if (error instanceof Error && error.message.includes('404')) {
362
+ return null;
363
+ }
364
+ throw error;
365
+ }
366
+ }
367
+ /**
368
+ * List or search contributors (libraries, archives, institutions)
369
+ */
370
+ async listContributors(options) {
371
+ const urlParams = {
372
+ encoding: 'json',
373
+ };
374
+ if (options?.query) {
375
+ urlParams.q = options.query;
376
+ }
377
+ if (options?.reclevel) {
378
+ urlParams.reclevel = options.reclevel;
379
+ }
380
+ const url = this.buildUrl('/contributor', urlParams);
381
+ const data = await this.fetchWithAuth(url);
382
+ return this.parseContributorList(data);
383
+ }
384
+ /**
385
+ * Get magazine title details with years/issues
386
+ */
387
+ async getMagazineTitle(titleId, options) {
388
+ const urlParams = {
389
+ encoding: 'json',
390
+ };
391
+ if (options?.includeYears) {
392
+ urlParams.include = 'years';
393
+ }
394
+ if (options?.dateRange) {
395
+ urlParams.range = options.dateRange;
396
+ }
397
+ const url = this.buildUrl(`/magazine/title/${titleId}`, urlParams);
398
+ try {
399
+ const data = await this.fetchWithAuth(url);
400
+ return this.parseMagazineTitleDetail(data);
401
+ }
402
+ catch (error) {
403
+ if (error instanceof Error && error.message.includes('404')) {
404
+ return null;
405
+ }
406
+ throw error;
407
+ }
408
+ }
409
+ /**
410
+ * Search for people and organisations
411
+ */
412
+ async searchPeople(query, options) {
413
+ const urlParams = {
414
+ q: query,
415
+ encoding: 'json',
416
+ category: 'people',
417
+ n: (options?.limit ?? 20).toString(),
418
+ };
419
+ if (options?.start) {
420
+ urlParams.s = options.start;
421
+ }
422
+ // Filter by type using artType facet (maps to type in people category)
423
+ if (options?.type) {
424
+ urlParams['l-artType'] = options.type;
425
+ }
426
+ const url = this.buildUrl('/result', urlParams);
427
+ const data = await this.fetchWithAuth(url);
428
+ return this.parsePersonSearchResponse(data, query);
429
+ }
430
+ // =========================================================================
431
+ // Private helpers
432
+ // =========================================================================
433
+ async fetchWithAuth(url) {
434
+ if (!this.apiKey) {
435
+ throw new Error('TROVE_API_KEY not configured');
436
+ }
437
+ return this.fetchJSON(url, {
438
+ headers: {
439
+ 'X-API-KEY': this.apiKey,
440
+ 'Accept': 'application/json',
441
+ },
442
+ });
443
+ }
444
+ parseSearchResponse(data, query) {
445
+ const typedData = data;
446
+ const categories = typedData.category ?? [];
447
+ // Combine results from all categories
448
+ let totalResults = 0;
449
+ let nextStart;
450
+ const records = [];
451
+ for (const cat of categories) {
452
+ const catRecords = cat.records ?? {};
453
+ totalResults += catRecords.total ?? 0;
454
+ nextStart = catRecords.nextStart ?? nextStart;
455
+ const items = catRecords.article ?? catRecords.work ?? [];
456
+ for (const item of items) {
457
+ if (cat.code === 'newspaper' || cat.code === 'gazette') {
458
+ records.push(this.parseArticle(item));
459
+ }
460
+ else {
461
+ records.push(this.parseWork(item));
462
+ }
463
+ }
464
+ }
465
+ return {
466
+ query,
467
+ category: categories.map((c) => c.code).join(','),
468
+ totalResults,
469
+ nextStart,
470
+ records,
471
+ };
472
+ }
473
+ parseArticle(data) {
474
+ const d = data;
475
+ const id = String(d.id ?? '');
476
+ // title can be an object {id, title} or a string
477
+ const titleObj = d.title;
478
+ const titleStr = typeof titleObj === 'object' && titleObj !== null
479
+ ? String(titleObj.title ?? '')
480
+ : String(titleObj ?? '');
481
+ const titleId = typeof titleObj === 'object' && titleObj !== null
482
+ ? String(titleObj.id ?? '')
483
+ : '';
484
+ return {
485
+ id,
486
+ heading: String(d.heading ?? 'Untitled'),
487
+ title: titleStr,
488
+ titleId,
489
+ date: String(d.date ?? ''),
490
+ page: String(d.page ?? ''),
491
+ category: String(d.category ?? 'Article'),
492
+ snippet: d.snippet ? String(d.snippet) : undefined,
493
+ fullText: d.articleText ? String(d.articleText) : undefined,
494
+ troveUrl: d.troveUrl ? String(d.troveUrl) : `https://trove.nla.gov.au/newspaper/article/${id}`,
495
+ pdfUrl: d.pdf ? String(d.pdf) : undefined,
496
+ wordCount: typeof d.wordCount === 'number' ? d.wordCount : undefined,
497
+ correctionCount: typeof d.correctionCount === 'number' ? d.correctionCount : undefined,
498
+ illustrated: d.illustrated === 'Y',
499
+ };
500
+ }
501
+ parseArticleDetail(data) {
502
+ const d = data;
503
+ const article = (d.article ?? d);
504
+ const id = String(article.id ?? '');
505
+ // title can be an object {id, title} or a string
506
+ const titleObj = article.title;
507
+ const titleStr = typeof titleObj === 'object' && titleObj !== null
508
+ ? String(titleObj.title ?? '')
509
+ : String(titleObj ?? '');
510
+ const titleId = typeof titleObj === 'object' && titleObj !== null
511
+ ? String(titleObj.id ?? '')
512
+ : '';
513
+ return {
514
+ id,
515
+ heading: String(article.heading ?? 'Untitled'),
516
+ title: titleStr,
517
+ titleId,
518
+ date: String(article.date ?? ''),
519
+ page: String(article.page ?? ''),
520
+ pageSequence: typeof article.pageSequence === 'number' ? article.pageSequence : undefined,
521
+ category: String(article.category ?? 'Article'),
522
+ troveUrl: article.troveUrl ? String(article.troveUrl) : `https://trove.nla.gov.au/newspaper/article/${id}`,
523
+ pdfUrl: article.pdf ? String(article.pdf) : undefined,
524
+ fullText: article.articleText ? String(article.articleText) : undefined,
525
+ wordCount: typeof article.wordCount === 'number' ? article.wordCount : undefined,
526
+ correctionCount: typeof article.correctionCount === 'number' ? article.correctionCount : undefined,
527
+ tagCount: typeof article.tagCount === 'number' ? article.tagCount : undefined,
528
+ commentCount: typeof article.commentCount === 'number' ? article.commentCount : undefined,
529
+ illustrated: article.illustrated === 'Y',
530
+ lastCorrected: article.lastCorrected ? String(article.lastCorrected) : undefined,
531
+ };
532
+ }
533
+ parseWork(data) {
534
+ const d = data;
535
+ const types = Array.isArray(d.type) ? d.type.map(String) : [String(d.type)].filter(Boolean);
536
+ const id = String(d.id ?? '');
537
+ return {
538
+ id,
539
+ title: String(d.title ?? 'Untitled'),
540
+ contributor: d.contributor ? String(d.contributor) : undefined,
541
+ issued: d.issued ? String(d.issued) : undefined,
542
+ type: types,
543
+ holdingsCount: typeof d.holdingsCount === 'number' ? d.holdingsCount : undefined,
544
+ versionCount: typeof d.versionCount === 'number' ? d.versionCount : undefined,
545
+ troveUrl: d.troveUrl ? String(d.troveUrl) : `https://trove.nla.gov.au/work/${id}`,
546
+ thumbnailUrl: this.extractThumbnail(d),
547
+ abstract: d.abstract ? String(d.abstract) : undefined,
548
+ subjects: Array.isArray(d.subject) ? d.subject.map(String) : undefined,
549
+ };
550
+ }
551
+ parseNewspaperTitles(data) {
552
+ const d = data;
553
+ const titles = (d.newspaper ?? d.gazette ?? []);
554
+ return titles.map((t) => ({
555
+ id: String(t.id ?? ''),
556
+ title: String(t.title ?? 'Untitled'),
557
+ state: String(t.state ?? ''),
558
+ issn: t.issn ? String(t.issn) : undefined,
559
+ startDate: String(t.startDate ?? ''),
560
+ endDate: String(t.endDate ?? ''),
561
+ troveUrl: t.troveUrl ? String(t.troveUrl) : `https://trove.nla.gov.au/newspaper/title/${t.id}`,
562
+ }));
563
+ }
564
+ parseTitleDetail(data) {
565
+ const d = data;
566
+ const base = (d.newspaper ?? d.gazette ?? d);
567
+ const result = {
568
+ id: String(base.id ?? ''),
569
+ title: String(base.title ?? 'Untitled'),
570
+ state: String(base.state ?? ''),
571
+ issn: base.issn ? String(base.issn) : undefined,
572
+ startDate: String(base.startDate ?? ''),
573
+ endDate: String(base.endDate ?? ''),
574
+ troveUrl: String(base.troveUrl ?? ''),
575
+ };
576
+ // Parse years if included
577
+ if (Array.isArray(base.year)) {
578
+ result.years = base.year.map((y) => ({
579
+ year: String(y.date ?? y),
580
+ issueCount: typeof y.issuecount === 'number' ? y.issuecount : 0,
581
+ }));
582
+ // Parse issues within years
583
+ const issues = [];
584
+ for (const year of base.year) {
585
+ if (Array.isArray(year.issue)) {
586
+ for (const iss of year.issue) {
587
+ issues.push({
588
+ id: String(iss.id ?? ''),
589
+ date: String(iss.date ?? ''),
590
+ url: String(iss.url ?? ''),
591
+ });
592
+ }
593
+ }
594
+ }
595
+ if (issues.length > 0) {
596
+ result.issues = issues;
597
+ }
598
+ }
599
+ return result;
600
+ }
601
+ extractThumbnail(data) {
602
+ if (data.identifier) {
603
+ const identifiers = Array.isArray(data.identifier)
604
+ ? data.identifier
605
+ : [data.identifier];
606
+ for (const id of identifiers) {
607
+ if (id.linktype === 'thumbnail' && id.value) {
608
+ return String(id.value);
609
+ }
610
+ }
611
+ }
612
+ return undefined;
613
+ }
614
+ parseContributor(data) {
615
+ const d = data;
616
+ const contrib = (d.contributor ?? d);
617
+ return {
618
+ nuc: String(contrib.nuc ?? contrib.id ?? ''),
619
+ name: String(contrib.name ?? 'Unknown'),
620
+ shortname: contrib.shortname ? String(contrib.shortname) : undefined,
621
+ url: contrib.url ? String(contrib.url) : undefined,
622
+ address: contrib.address ? String(contrib.address) : undefined,
623
+ email: contrib.email ? String(contrib.email) : undefined,
624
+ phone: contrib.phone ? String(contrib.phone) : undefined,
625
+ fax: contrib.fax ? String(contrib.fax) : undefined,
626
+ catalogue: contrib.catalogue ? String(contrib.catalogue) : undefined,
627
+ totalHoldings: typeof contrib.totalHoldings === 'number' ? contrib.totalHoldings : undefined,
628
+ };
629
+ }
630
+ parseMagazineTitles(data) {
631
+ const d = data;
632
+ const titles = (d.magazine ?? []);
633
+ return titles.map((t) => ({
634
+ id: String(t.id ?? ''),
635
+ title: String(t.title ?? 'Untitled'),
636
+ publisher: t.publisher ? String(t.publisher) : undefined,
637
+ startDate: t.startDate ? String(t.startDate) : undefined,
638
+ endDate: t.endDate ? String(t.endDate) : undefined,
639
+ issn: t.issn ? String(t.issn) : undefined,
640
+ troveUrl: t.troveUrl ? String(t.troveUrl) : `https://trove.nla.gov.au/magazine/title/${t.id}`,
641
+ }));
642
+ }
643
+ parseWorkDetail(data) {
644
+ const d = data;
645
+ const work = (d.work ?? d);
646
+ const id = String(work.id ?? '');
647
+ const types = Array.isArray(work.type) ? work.type.map(String) : [String(work.type)].filter(Boolean);
648
+ const result = {
649
+ id,
650
+ title: String(work.title ?? 'Untitled'),
651
+ contributor: work.contributor ? String(work.contributor) : undefined,
652
+ issued: work.issued ? String(work.issued) : undefined,
653
+ type: types,
654
+ subjects: Array.isArray(work.subject) ? work.subject.map(String) : undefined,
655
+ abstract: work.abstract ? String(work.abstract) : undefined,
656
+ tableOfContents: work.tableOfContents ? String(work.tableOfContents) : undefined,
657
+ language: this.extractLanguage(work.language),
658
+ wikipedia: work.wikipedia ? String(work.wikipedia) : undefined,
659
+ holdingsCount: typeof work.holdingsCount === 'number' ? work.holdingsCount : 0,
660
+ versionCount: typeof work.versionCount === 'number' ? work.versionCount : 0,
661
+ troveUrl: work.troveUrl ? String(work.troveUrl) : `https://trove.nla.gov.au/work/${id}`,
662
+ thumbnailUrl: this.extractThumbnail(work),
663
+ identifier: this.extractIdentifier(work),
664
+ };
665
+ // Parse holdings if included
666
+ if (Array.isArray(work.holding)) {
667
+ result.holdings = this.parseHoldings(work.holding);
668
+ }
669
+ // Parse links if included (from identifier array with linktype)
670
+ if (work.identifier) {
671
+ result.links = this.parseLinks(work.identifier);
672
+ }
673
+ // Parse versions if included
674
+ if (Array.isArray(work.version)) {
675
+ result.versions = this.parseVersions(work.version);
676
+ }
677
+ return result;
678
+ }
679
+ parseHoldings(data) {
680
+ return data.map((h) => {
681
+ const holding = h;
682
+ return {
683
+ nuc: String(holding.nuc ?? holding.name ?? ''),
684
+ name: holding.name ? String(holding.name) : undefined,
685
+ url: this.extractHoldingUrl(holding),
686
+ callNumber: this.extractCallNumber(holding.callNumber),
687
+ localIdentifier: holding.localIdentifier ? String(holding.localIdentifier) : undefined,
688
+ };
689
+ });
690
+ }
691
+ extractHoldingUrl(holding) {
692
+ // URL can be in url field directly or nested in url array
693
+ if (typeof holding.url === 'string') {
694
+ return holding.url;
695
+ }
696
+ if (Array.isArray(holding.url) && holding.url.length > 0) {
697
+ const first = holding.url[0];
698
+ if (first.value) {
699
+ return String(first.value);
700
+ }
701
+ }
702
+ return undefined;
703
+ }
704
+ extractCallNumber(data) {
705
+ if (!data)
706
+ return undefined;
707
+ // callNumber can be a string, object {value}, or array of objects
708
+ if (typeof data === 'string') {
709
+ return data;
710
+ }
711
+ if (Array.isArray(data)) {
712
+ // Extract value from each object and join
713
+ const values = data
714
+ .map((item) => {
715
+ if (typeof item === 'string')
716
+ return item;
717
+ if (typeof item === 'object' && item !== null) {
718
+ const obj = item;
719
+ return obj.value ? String(obj.value) : undefined;
720
+ }
721
+ return undefined;
722
+ })
723
+ .filter(Boolean);
724
+ return values.length > 0 ? values.join(', ') : undefined;
725
+ }
726
+ if (typeof data === 'object' && data !== null) {
727
+ const obj = data;
728
+ return obj.value ? String(obj.value) : undefined;
729
+ }
730
+ return undefined;
731
+ }
732
+ extractLanguage(data) {
733
+ if (!data)
734
+ return undefined;
735
+ // language can be a string, object {value}, or array
736
+ if (typeof data === 'string') {
737
+ return data;
738
+ }
739
+ if (Array.isArray(data)) {
740
+ // Extract value from each item and join
741
+ const values = data
742
+ .map((item) => {
743
+ if (typeof item === 'string')
744
+ return item;
745
+ if (typeof item === 'object' && item !== null) {
746
+ const obj = item;
747
+ return obj.value ? String(obj.value) : undefined;
748
+ }
749
+ return undefined;
750
+ })
751
+ .filter(Boolean);
752
+ return values.length > 0 ? values.join(', ') : undefined;
753
+ }
754
+ if (typeof data === 'object' && data !== null) {
755
+ const obj = data;
756
+ return obj.value ? String(obj.value) : undefined;
757
+ }
758
+ return undefined;
759
+ }
760
+ extractBiography(data) {
761
+ if (!data)
762
+ return undefined;
763
+ // biography can be a string, object {value}, or array of objects
764
+ if (typeof data === 'string') {
765
+ return data;
766
+ }
767
+ if (Array.isArray(data)) {
768
+ // Extract value from each object and join with newlines
769
+ const values = data
770
+ .map((item) => {
771
+ if (typeof item === 'string')
772
+ return item;
773
+ if (typeof item === 'object' && item !== null) {
774
+ const obj = item;
775
+ return obj.value ? String(obj.value) : undefined;
776
+ }
777
+ return undefined;
778
+ })
779
+ .filter(Boolean);
780
+ return values.length > 0 ? values.join('\n\n') : undefined;
781
+ }
782
+ if (typeof data === 'object' && data !== null) {
783
+ const obj = data;
784
+ return obj.value ? String(obj.value) : undefined;
785
+ }
786
+ return undefined;
787
+ }
788
+ extractContributorList(data) {
789
+ if (!data)
790
+ return undefined;
791
+ // contributor can be a string, object {name/nuc}, or array of objects
792
+ if (typeof data === 'string') {
793
+ return data;
794
+ }
795
+ if (Array.isArray(data)) {
796
+ // Extract name or nuc from each object and join
797
+ const values = data
798
+ .map((item) => {
799
+ if (typeof item === 'string')
800
+ return item;
801
+ if (typeof item === 'object' && item !== null) {
802
+ const obj = item;
803
+ return obj.name ? String(obj.name) : (obj.nuc ? String(obj.nuc) : undefined);
804
+ }
805
+ return undefined;
806
+ })
807
+ .filter(Boolean);
808
+ return values.length > 0 ? values.join('; ') : undefined;
809
+ }
810
+ if (typeof data === 'object' && data !== null) {
811
+ const obj = data;
812
+ return obj.name ? String(obj.name) : (obj.nuc ? String(obj.nuc) : undefined);
813
+ }
814
+ return undefined;
815
+ }
816
+ parseLinks(identifiers) {
817
+ const ids = Array.isArray(identifiers) ? identifiers : [identifiers];
818
+ const links = [];
819
+ for (const id of ids) {
820
+ if (id.linktype && id.value) {
821
+ links.push({
822
+ url: String(id.value),
823
+ linktype: String(id.linktype),
824
+ linktext: id.linktext ? String(id.linktext) : undefined,
825
+ });
826
+ }
827
+ }
828
+ return links;
829
+ }
830
+ parseVersions(data) {
831
+ return data.map((v) => {
832
+ const version = v;
833
+ const types = Array.isArray(version.type)
834
+ ? version.type.map(String)
835
+ : [String(version.type)].filter(Boolean);
836
+ const result = {
837
+ id: String(version.id ?? ''),
838
+ type: types,
839
+ issued: version.issued ? String(version.issued) : undefined,
840
+ holdingsCount: typeof version.holdingsCount === 'number' ? version.holdingsCount : 0,
841
+ };
842
+ if (Array.isArray(version.holding)) {
843
+ result.holdings = this.parseHoldings(version.holding);
844
+ }
845
+ if (version.identifier) {
846
+ result.links = this.parseLinks(version.identifier);
847
+ }
848
+ return result;
849
+ });
850
+ }
851
+ extractIdentifier(data) {
852
+ if (data.identifier) {
853
+ const identifiers = Array.isArray(data.identifier)
854
+ ? data.identifier
855
+ : [data.identifier];
856
+ for (const id of identifiers) {
857
+ // Return first non-thumbnail URL as main identifier
858
+ if (id.value && id.linktype !== 'thumbnail') {
859
+ return String(id.value);
860
+ }
861
+ }
862
+ }
863
+ return undefined;
864
+ }
865
+ parseList(data) {
866
+ const d = data;
867
+ const list = (d.list ?? d);
868
+ const id = String(list.id ?? '');
869
+ const result = {
870
+ id,
871
+ title: String(list.title ?? 'Untitled'),
872
+ creator: String(list.creator ?? 'Unknown'),
873
+ description: list.description ? String(list.description) : undefined,
874
+ listItemCount: typeof list.listItemCount === 'number' ? list.listItemCount : 0,
875
+ thumbnailUrl: this.extractThumbnail(list),
876
+ dateCreated: list.date ? this.extractListDate(list.date, 'created') : undefined,
877
+ dateLastUpdated: list.date ? this.extractListDate(list.date, 'lastupdated') : undefined,
878
+ troveUrl: list.troveUrl ? String(list.troveUrl) : `https://trove.nla.gov.au/list?id=${id}`,
879
+ };
880
+ // Parse list items if included
881
+ if (Array.isArray(list.listItem)) {
882
+ result.items = this.parseListItems(list.listItem);
883
+ }
884
+ return result;
885
+ }
886
+ extractListDate(dateData, type) {
887
+ if (typeof dateData === 'object' && dateData !== null) {
888
+ const d = dateData;
889
+ return d[type] ? String(d[type]) : undefined;
890
+ }
891
+ return undefined;
892
+ }
893
+ parseListItems(items) {
894
+ return items.map((item) => {
895
+ const i = item;
896
+ const result = {};
897
+ if (i.note) {
898
+ result.note = String(i.note);
899
+ }
900
+ if (i.work) {
901
+ result.work = this.parseWork(i.work);
902
+ }
903
+ if (i.article) {
904
+ result.article = this.parseArticle(i.article);
905
+ }
906
+ if (i.people) {
907
+ const p = i.people;
908
+ result.people = {
909
+ id: String(p.id ?? ''),
910
+ troveUrl: p.troveUrl ? String(p.troveUrl) : `https://trove.nla.gov.au/people/${p.id}`,
911
+ };
912
+ }
913
+ if (i.externalWebsite) {
914
+ const e = i.externalWebsite;
915
+ result.externalWebsite = {
916
+ title: String(e.title ?? 'External Link'),
917
+ url: String(e.identifier?.value ?? e.url ?? ''),
918
+ };
919
+ }
920
+ return result;
921
+ });
922
+ }
923
+ parsePerson(data) {
924
+ const d = data;
925
+ const person = (d.people ?? d);
926
+ const id = String(person.id ?? '');
927
+ return {
928
+ id,
929
+ type: String(person.type ?? 'Person'),
930
+ primaryName: String(person.primaryName ?? 'Unknown'),
931
+ primaryDisplayName: person.primaryDisplayName ? String(person.primaryDisplayName) : undefined,
932
+ alternateName: Array.isArray(person.alternateName) ? person.alternateName.map(String) : undefined,
933
+ alternateDisplayName: Array.isArray(person.alternateDisplayName) ? person.alternateDisplayName.map(String) : undefined,
934
+ title: person.title ? String(person.title) : undefined,
935
+ occupation: Array.isArray(person.occupation) ? person.occupation.map(String) : undefined,
936
+ biography: this.extractBiography(person.biography),
937
+ contributor: this.extractContributorList(person.contributor),
938
+ thumbnailUrl: this.extractThumbnail(person),
939
+ troveUrl: person.troveUrl ? String(person.troveUrl) : `https://trove.nla.gov.au/people/${id}`,
940
+ };
941
+ }
942
+ parseContributorList(data) {
943
+ const d = data;
944
+ const contributors = (d.contributor ?? []);
945
+ return contributors.map((c) => this.parseContributor(c));
946
+ }
947
+ parseMagazineTitleDetail(data) {
948
+ const d = data;
949
+ const mag = (d.magazine ?? d);
950
+ const id = String(mag.id ?? '');
951
+ const result = {
952
+ id,
953
+ title: String(mag.title ?? 'Untitled'),
954
+ publisher: mag.publisher ? String(mag.publisher) : undefined,
955
+ place: mag.place ? String(mag.place) : undefined,
956
+ issn: mag.issn ? String(mag.issn) : undefined,
957
+ startDate: mag.startDate ? String(mag.startDate) : undefined,
958
+ endDate: mag.endDate ? String(mag.endDate) : undefined,
959
+ troveUrl: mag.troveUrl ? String(mag.troveUrl) : `https://trove.nla.gov.au/magazine/title/${id}`,
960
+ };
961
+ // Parse years if included
962
+ if (Array.isArray(mag.year)) {
963
+ result.years = mag.year.map((y) => {
964
+ const year = {
965
+ year: String(y.date ?? ''),
966
+ issueCount: typeof y.issuecount === 'number' ? y.issuecount : 0,
967
+ };
968
+ // Parse issues within year if present
969
+ if (Array.isArray(y.issue)) {
970
+ year.issues = y.issue.map((iss) => ({
971
+ id: String(iss.id ?? ''),
972
+ date: String(iss.date ?? ''),
973
+ url: String(iss.url ?? ''),
974
+ }));
975
+ }
976
+ return year;
977
+ });
978
+ }
979
+ return result;
980
+ }
981
+ parsePersonSearchResponse(data, query) {
982
+ const typedData = data;
983
+ const categories = typedData.category ?? [];
984
+ let totalResults = 0;
985
+ let nextStart;
986
+ const records = [];
987
+ for (const cat of categories) {
988
+ if (cat.code === 'people') {
989
+ const catRecords = cat.records ?? {};
990
+ totalResults = catRecords.total ?? 0;
991
+ nextStart = catRecords.nextStart;
992
+ const people = catRecords.people ?? [];
993
+ for (const person of people) {
994
+ records.push(this.parsePerson(person));
995
+ }
996
+ }
997
+ }
998
+ return {
999
+ query,
1000
+ totalResults,
1001
+ nextStart,
1002
+ records,
1003
+ };
1004
+ }
1005
+ }
1006
+ // Export singleton instance
1007
+ export const troveClient = new TroveClient();
1008
+ //# sourceMappingURL=client.js.map