@eightyfourthousand/data-access 2026.3.1 → 2026.4.1

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 (341) hide show
  1. package/{src/index.ts → index.d.ts} +1 -2
  2. package/index.js +18 -0
  3. package/index.js.map +1 -0
  4. package/lib/auth.d.ts +59 -0
  5. package/lib/auth.js +135 -0
  6. package/lib/auth.js.map +1 -0
  7. package/lib/bibliography.d.ts +9 -0
  8. package/lib/bibliography.js +31 -0
  9. package/lib/bibliography.js.map +1 -0
  10. package/lib/client-browser.d.ts +1 -0
  11. package/lib/client-browser.js +10 -0
  12. package/lib/client-browser.js.map +1 -0
  13. package/lib/client-server.d.ts +4 -0
  14. package/lib/client-server.js +19 -0
  15. package/lib/client-server.js.map +1 -0
  16. package/lib/client-ssr.d.ts +1 -0
  17. package/lib/client-ssr.js +24 -0
  18. package/lib/client-ssr.js.map +1 -0
  19. package/lib/client-token.d.ts +7 -0
  20. package/lib/client-token.js +21 -0
  21. package/lib/client-token.js.map +1 -0
  22. package/lib/feedback.d.ts +6 -0
  23. package/lib/feedback.js +50 -0
  24. package/lib/feedback.js.map +1 -0
  25. package/lib/folio.d.ts +11 -0
  26. package/lib/folio.js +32 -0
  27. package/lib/folio.js.map +1 -0
  28. package/lib/glossary/batch.d.ts +5 -0
  29. package/lib/glossary/batch.js +24 -0
  30. package/lib/glossary/batch.js.map +1 -0
  31. package/lib/glossary/index.d.ts +4 -0
  32. package/lib/glossary/index.js +5 -0
  33. package/lib/glossary/index.js.map +1 -0
  34. package/lib/glossary/instance.d.ts +10 -0
  35. package/lib/glossary/instance.js +29 -0
  36. package/lib/glossary/instance.js.map +1 -0
  37. package/lib/glossary/landing.d.ts +5 -0
  38. package/lib/glossary/landing.js +33 -0
  39. package/lib/glossary/landing.js.map +1 -0
  40. package/lib/glossary/pagination.d.ts +55 -0
  41. package/lib/glossary/pagination.js +255 -0
  42. package/lib/glossary/pagination.js.map +1 -0
  43. package/lib/imprint.d.ts +10 -0
  44. package/lib/imprint.js +24 -0
  45. package/lib/imprint.js.map +1 -0
  46. package/lib/library.d.ts +58 -0
  47. package/lib/library.js +119 -0
  48. package/lib/library.js.map +1 -0
  49. package/lib/local-storage.d.ts +10 -0
  50. package/lib/local-storage.js +25 -0
  51. package/lib/local-storage.js.map +1 -0
  52. package/lib/lookup-entity.d.ts +7 -0
  53. package/lib/lookup-entity.js +94 -0
  54. package/lib/lookup-entity.js.map +1 -0
  55. package/lib/panel-url.d.ts +10 -0
  56. package/lib/panel-url.js +23 -0
  57. package/lib/panel-url.js.map +1 -0
  58. package/lib/passage/batch.d.ts +17 -0
  59. package/lib/passage/batch.js +159 -0
  60. package/lib/passage/batch.js.map +1 -0
  61. package/lib/passage/index.d.ts +5 -0
  62. package/lib/passage/index.js +6 -0
  63. package/lib/passage/index.js.map +1 -0
  64. package/lib/passage/pagination.d.ts +43 -0
  65. package/lib/passage/pagination.js +170 -0
  66. package/lib/passage/pagination.js.map +1 -0
  67. package/lib/passage/read.d.ts +15 -0
  68. package/lib/passage/read.js +61 -0
  69. package/lib/passage/read.js.map +1 -0
  70. package/lib/passage/replace-persistence.d.ts +46 -0
  71. package/lib/passage/replace-persistence.js +94 -0
  72. package/lib/passage/replace-persistence.js.map +1 -0
  73. package/lib/passage/save.d.ts +16 -0
  74. package/lib/passage/save.js +231 -0
  75. package/lib/passage/save.js.map +1 -0
  76. package/lib/proxy.d.ts +7 -0
  77. package/lib/proxy.js +48 -0
  78. package/lib/proxy.js.map +1 -0
  79. package/lib/publications.d.ts +86 -0
  80. package/lib/publications.js +226 -0
  81. package/lib/publications.js.map +1 -0
  82. package/lib/replace.d.ts +31 -0
  83. package/lib/replace.js +134 -0
  84. package/lib/replace.js.map +1 -0
  85. package/lib/storage.d.ts +7 -0
  86. package/lib/storage.js +11 -0
  87. package/lib/storage.js.map +1 -0
  88. package/lib/types/alignment.d.ts +18 -0
  89. package/lib/types/alignment.js +13 -0
  90. package/lib/types/alignment.js.map +1 -0
  91. package/lib/types/annotation/abbreviation.d.ts +3 -0
  92. package/lib/types/annotation/abbreviation.js +20 -0
  93. package/lib/types/annotation/abbreviation.js.map +1 -0
  94. package/lib/types/annotation/annotation-type.d.ts +31 -0
  95. package/lib/types/annotation/annotation-type.js +81 -0
  96. package/lib/types/annotation/annotation-type.js.map +1 -0
  97. package/lib/types/annotation/annotation.d.ts +142 -0
  98. package/lib/types/annotation/annotation.js +23 -0
  99. package/lib/types/annotation/annotation.js.map +1 -0
  100. package/lib/types/annotation/audio.d.ts +3 -0
  101. package/lib/types/annotation/audio.js +24 -0
  102. package/lib/types/annotation/audio.js.map +1 -0
  103. package/lib/types/annotation/blockquote.d.ts +3 -0
  104. package/lib/types/annotation/blockquote.js +8 -0
  105. package/lib/types/annotation/blockquote.js.map +1 -0
  106. package/lib/types/annotation/code.d.ts +3 -0
  107. package/lib/types/annotation/code.js +8 -0
  108. package/lib/types/annotation/code.js.map +1 -0
  109. package/lib/types/annotation/deprecated.d.ts +3 -0
  110. package/lib/types/annotation/deprecated.js +8 -0
  111. package/lib/types/annotation/deprecated.js.map +1 -0
  112. package/lib/types/annotation/end-note-link.d.ts +3 -0
  113. package/lib/types/annotation/end-note-link.js +23 -0
  114. package/lib/types/annotation/end-note-link.js.map +1 -0
  115. package/lib/types/annotation/export.d.ts +3 -0
  116. package/{src/lib/types/annotation/export.ts → lib/types/annotation/export.js} +34 -36
  117. package/lib/types/annotation/export.js.map +1 -0
  118. package/lib/types/annotation/glossary-instance.d.ts +3 -0
  119. package/lib/types/annotation/glossary-instance.js +23 -0
  120. package/lib/types/annotation/glossary-instance.js.map +1 -0
  121. package/lib/types/annotation/has-abbreviation.d.ts +3 -0
  122. package/lib/types/annotation/has-abbreviation.js +20 -0
  123. package/lib/types/annotation/has-abbreviation.js.map +1 -0
  124. package/lib/types/annotation/heading.d.ts +3 -0
  125. package/lib/types/annotation/heading.js +23 -0
  126. package/lib/types/annotation/heading.js.map +1 -0
  127. package/lib/types/annotation/image.d.ts +3 -0
  128. package/lib/types/annotation/image.js +20 -0
  129. package/lib/types/annotation/image.js.map +1 -0
  130. package/lib/types/annotation/indent.d.ts +3 -0
  131. package/lib/types/annotation/indent.js +8 -0
  132. package/lib/types/annotation/indent.js.map +1 -0
  133. package/lib/types/annotation/index.js +5 -0
  134. package/lib/types/annotation/index.js.map +1 -0
  135. package/lib/types/annotation/inline-title.d.ts +3 -0
  136. package/lib/types/annotation/inline-title.js +21 -0
  137. package/lib/types/annotation/inline-title.js.map +1 -0
  138. package/lib/types/annotation/internal-link.d.ts +3 -0
  139. package/lib/types/annotation/internal-link.js +62 -0
  140. package/lib/types/annotation/internal-link.js.map +1 -0
  141. package/lib/types/annotation/leading-space.d.ts +3 -0
  142. package/lib/types/annotation/leading-space.js +8 -0
  143. package/lib/types/annotation/leading-space.js.map +1 -0
  144. package/lib/types/annotation/line-group.d.ts +3 -0
  145. package/lib/types/annotation/line-group.js +8 -0
  146. package/lib/types/annotation/line-group.js.map +1 -0
  147. package/lib/types/annotation/line.d.ts +3 -0
  148. package/lib/types/annotation/line.js +8 -0
  149. package/lib/types/annotation/line.js.map +1 -0
  150. package/lib/types/annotation/link.d.ts +3 -0
  151. package/lib/types/annotation/link.js +27 -0
  152. package/lib/types/annotation/link.js.map +1 -0
  153. package/lib/types/annotation/list-item.d.ts +3 -0
  154. package/lib/types/annotation/list-item.js +8 -0
  155. package/lib/types/annotation/list-item.js.map +1 -0
  156. package/lib/types/annotation/list.d.ts +3 -0
  157. package/lib/types/annotation/list.js +31 -0
  158. package/lib/types/annotation/list.js.map +1 -0
  159. package/lib/types/annotation/mantra.d.ts +3 -0
  160. package/lib/types/annotation/mantra.js +21 -0
  161. package/lib/types/annotation/mantra.js.map +1 -0
  162. package/lib/types/annotation/mention.d.ts +3 -0
  163. package/lib/types/annotation/mention.js +50 -0
  164. package/lib/types/annotation/mention.js.map +1 -0
  165. package/lib/types/annotation/paragraph.d.ts +3 -0
  166. package/lib/types/annotation/paragraph.js +8 -0
  167. package/lib/types/annotation/paragraph.js.map +1 -0
  168. package/lib/types/annotation/quote.d.ts +3 -0
  169. package/lib/types/annotation/quote.js +21 -0
  170. package/lib/types/annotation/quote.js.map +1 -0
  171. package/lib/types/annotation/quoted.d.ts +3 -0
  172. package/lib/types/annotation/quoted.js +21 -0
  173. package/lib/types/annotation/quoted.js.map +1 -0
  174. package/lib/types/annotation/reference.d.ts +3 -0
  175. package/lib/types/annotation/reference.js +8 -0
  176. package/lib/types/annotation/reference.js.map +1 -0
  177. package/lib/types/annotation/span.d.ts +3 -0
  178. package/lib/types/annotation/span.js +29 -0
  179. package/lib/types/annotation/span.js.map +1 -0
  180. package/lib/types/annotation/table-body-data.d.ts +3 -0
  181. package/lib/types/annotation/table-body-data.js +8 -0
  182. package/lib/types/annotation/table-body-data.js.map +1 -0
  183. package/lib/types/annotation/table-body-header.d.ts +3 -0
  184. package/lib/types/annotation/table-body-header.js +8 -0
  185. package/lib/types/annotation/table-body-header.js.map +1 -0
  186. package/lib/types/annotation/table-body-row.d.ts +3 -0
  187. package/lib/types/annotation/table-body-row.js +8 -0
  188. package/lib/types/annotation/table-body-row.js.map +1 -0
  189. package/lib/types/annotation/table.d.ts +3 -0
  190. package/lib/types/annotation/table.js +8 -0
  191. package/lib/types/annotation/table.js.map +1 -0
  192. package/lib/types/annotation/trailer.d.ts +3 -0
  193. package/lib/types/annotation/trailer.js +8 -0
  194. package/lib/types/annotation/trailer.js.map +1 -0
  195. package/lib/types/annotation/transform.d.ts +6 -0
  196. package/lib/types/annotation/transform.js +108 -0
  197. package/lib/types/annotation/transform.js.map +1 -0
  198. package/lib/types/annotation/unknown.d.ts +3 -0
  199. package/lib/types/annotation/unknown.js +8 -0
  200. package/lib/types/annotation/unknown.js.map +1 -0
  201. package/lib/types/bibliography.d.ts +41 -0
  202. package/lib/types/bibliography.js +30 -0
  203. package/lib/types/bibliography.js.map +1 -0
  204. package/{src/lib/types/client.ts → lib/types/client.d.ts} +0 -1
  205. package/lib/types/client.js +2 -0
  206. package/lib/types/client.js.map +1 -0
  207. package/{src/lib/types/editor-content.ts → lib/types/editor-content.d.ts} +7 -11
  208. package/lib/types/editor-content.js +2 -0
  209. package/lib/types/editor-content.js.map +1 -0
  210. package/lib/types/folio.d.ts +17 -0
  211. package/lib/types/folio.js +11 -0
  212. package/lib/types/folio.js.map +1 -0
  213. package/lib/types/glossary-page.d.ts +48 -0
  214. package/lib/types/glossary-page.js +21 -0
  215. package/lib/types/glossary-page.js.map +1 -0
  216. package/lib/types/glossary.d.ts +76 -0
  217. package/lib/types/glossary.js +32 -0
  218. package/lib/types/glossary.js.map +1 -0
  219. package/lib/types/imprint.d.ts +78 -0
  220. package/lib/types/imprint.js +71 -0
  221. package/lib/types/imprint.js.map +1 -0
  222. package/{src/lib/types/index.ts → lib/types/index.d.ts} +0 -3
  223. package/lib/types/index.js +20 -0
  224. package/lib/types/index.js.map +1 -0
  225. package/lib/types/language.d.ts +9 -0
  226. package/lib/types/language.js +41 -0
  227. package/lib/types/language.js.map +1 -0
  228. package/lib/types/layout.d.ts +5 -0
  229. package/lib/types/layout.js +23 -0
  230. package/lib/types/layout.js.map +1 -0
  231. package/lib/types/library.d.ts +19 -0
  232. package/lib/types/library.js +8 -0
  233. package/lib/types/library.js.map +1 -0
  234. package/lib/types/passage.d.ts +73 -0
  235. package/lib/types/passage.js +120 -0
  236. package/lib/types/passage.js.map +1 -0
  237. package/lib/types/semver.js +2 -0
  238. package/lib/types/semver.js.map +1 -0
  239. package/lib/types/title.d.ts +21 -0
  240. package/lib/types/title.js +22 -0
  241. package/lib/types/title.js.map +1 -0
  242. package/lib/types/toh.js +2 -0
  243. package/lib/types/toh.js.map +1 -0
  244. package/{src/lib/types/translation.ts → lib/types/translation.d.ts} +5 -7
  245. package/lib/types/translation.js +2 -0
  246. package/lib/types/translation.js.map +1 -0
  247. package/{src/lib/types/user.ts → lib/types/user.d.ts} +2 -11
  248. package/lib/types/user.js +9 -0
  249. package/lib/types/user.js.map +1 -0
  250. package/lib/types/work.d.ts +37 -0
  251. package/lib/types/work.js +15 -0
  252. package/lib/types/work.js.map +1 -0
  253. package/lib/use-bookmark.d.ts +10 -0
  254. package/lib/use-bookmark.js +31 -0
  255. package/lib/use-bookmark.js.map +1 -0
  256. package/package.json +25 -3
  257. package/ssr.js +6 -0
  258. package/ssr.js.map +1 -0
  259. package/.babelrc +0 -12
  260. package/.eslintrc.json +0 -18
  261. package/README.md +0 -9
  262. package/jest.config.ts +0 -10
  263. package/project.json +0 -21
  264. package/src/lib/auth.ts +0 -203
  265. package/src/lib/bibliography.ts +0 -57
  266. package/src/lib/canon.ts +0 -111
  267. package/src/lib/client-browser.ts +0 -12
  268. package/src/lib/client-server.ts +0 -30
  269. package/src/lib/client-ssr.ts +0 -24
  270. package/src/lib/client-token.ts +0 -24
  271. package/src/lib/feedback.ts +0 -71
  272. package/src/lib/folio.ts +0 -43
  273. package/src/lib/glossary.ts +0 -147
  274. package/src/lib/imprint.ts +0 -42
  275. package/src/lib/library.ts +0 -209
  276. package/src/lib/local-storage.ts +0 -33
  277. package/src/lib/lookup-entity.ts +0 -122
  278. package/src/lib/panel-url.ts +0 -43
  279. package/src/lib/passage.ts +0 -122
  280. package/src/lib/projects.ts +0 -107
  281. package/src/lib/proxy.ts +0 -68
  282. package/src/lib/publications.ts +0 -213
  283. package/src/lib/storage.ts +0 -23
  284. package/src/lib/types/alignment.ts +0 -32
  285. package/src/lib/types/annotation/abbreviation.ts +0 -30
  286. package/src/lib/types/annotation/annotation-type.ts +0 -219
  287. package/src/lib/types/annotation/annotation.ts +0 -244
  288. package/src/lib/types/annotation/audio.ts +0 -33
  289. package/src/lib/types/annotation/blockquote.ts +0 -18
  290. package/src/lib/types/annotation/code.ts +0 -16
  291. package/src/lib/types/annotation/deprecated.ts +0 -18
  292. package/src/lib/types/annotation/end-note-link.ts +0 -35
  293. package/src/lib/types/annotation/glossary-instance.ts +0 -34
  294. package/src/lib/types/annotation/has-abbreviation.ts +0 -30
  295. package/src/lib/types/annotation/heading.ts +0 -37
  296. package/src/lib/types/annotation/image.ts +0 -29
  297. package/src/lib/types/annotation/indent.ts +0 -16
  298. package/src/lib/types/annotation/inline-title.ts +0 -34
  299. package/src/lib/types/annotation/internal-link.ts +0 -86
  300. package/src/lib/types/annotation/leading-space.ts +0 -18
  301. package/src/lib/types/annotation/line-group.ts +0 -18
  302. package/src/lib/types/annotation/line.ts +0 -16
  303. package/src/lib/types/annotation/link.ts +0 -38
  304. package/src/lib/types/annotation/list-item.ts +0 -16
  305. package/src/lib/types/annotation/list.ts +0 -43
  306. package/src/lib/types/annotation/mantra.ts +0 -31
  307. package/src/lib/types/annotation/mention.ts +0 -64
  308. package/src/lib/types/annotation/paragraph.ts +0 -18
  309. package/src/lib/types/annotation/quote.ts +0 -30
  310. package/src/lib/types/annotation/quoted.ts +0 -30
  311. package/src/lib/types/annotation/reference.ts +0 -18
  312. package/src/lib/types/annotation/span.ts +0 -39
  313. package/src/lib/types/annotation/table-body-data.ts +0 -18
  314. package/src/lib/types/annotation/table-body-header.ts +0 -18
  315. package/src/lib/types/annotation/table-body-row.ts +0 -18
  316. package/src/lib/types/annotation/table.ts +0 -16
  317. package/src/lib/types/annotation/trailer.ts +0 -16
  318. package/src/lib/types/annotation/transform.ts +0 -140
  319. package/src/lib/types/annotation/unknown.ts +0 -16
  320. package/src/lib/types/bibliography.ts +0 -86
  321. package/src/lib/types/canon.ts +0 -148
  322. package/src/lib/types/contributor.ts +0 -84
  323. package/src/lib/types/folio.ts +0 -28
  324. package/src/lib/types/glossary-page.ts +0 -204
  325. package/src/lib/types/glossary.ts +0 -114
  326. package/src/lib/types/imprint.ts +0 -159
  327. package/src/lib/types/language.ts +0 -64
  328. package/src/lib/types/layout.ts +0 -37
  329. package/src/lib/types/library.ts +0 -29
  330. package/src/lib/types/passage.ts +0 -220
  331. package/src/lib/types/project.ts +0 -200
  332. package/src/lib/types/title.ts +0 -47
  333. package/src/lib/types/work.ts +0 -38
  334. package/src/lib/use-bookmark.ts +0 -45
  335. package/tsconfig.json +0 -20
  336. package/tsconfig.lib.json +0 -26
  337. package/tsconfig.spec.json +0 -22
  338. /package/{src/lib/types/annotation/index.ts → lib/types/annotation/index.d.ts} +0 -0
  339. /package/{src/lib/types/semver.ts → lib/types/semver.d.ts} +0 -0
  340. /package/{src/lib/types/toh.ts → lib/types/toh.d.ts} +0 -0
  341. /package/{src/ssr.ts → ssr.d.ts} +0 -0
@@ -1,148 +0,0 @@
1
- import { TohokuCatalogEntry } from './toh';
2
- import { ExtendedTranslationLanguage } from './language';
3
-
4
- export type CanonNodeType =
5
- | 'root'
6
- | 'canonicalSection'
7
- | 'nonCanonicalSection'
8
- | 'textGrouping';
9
-
10
- export type CanonDTO = {
11
- uuid: string;
12
- created_at: string;
13
- label: string;
14
- parent_uuid?: string;
15
- xmlId: string;
16
- parent_xmlId?: string;
17
- sort: number;
18
- description: string;
19
- type: CanonNodeType;
20
- public_description?: string;
21
- article_uuid?: string;
22
- };
23
-
24
- export type CanonHead = {
25
- children: CanonNode[];
26
- };
27
-
28
- export type CanonNode = {
29
- uuid: string;
30
- label?: string;
31
- xmlId?: string;
32
- parentXmlId?: string;
33
- parentUuid?: string;
34
- sort: number;
35
- description?: string;
36
- type: CanonNodeType;
37
- publicDescription?: string;
38
- articleUuid?: string;
39
- children?: CanonNode[];
40
- createdAt?: string;
41
- };
42
-
43
- export type CanonArticleDTO = {
44
- uuid: string;
45
- title: string;
46
- body: string;
47
- image?: string;
48
- caption?: string;
49
- };
50
-
51
- export type CanonArticle = CanonArticleDTO;
52
-
53
- export type CanonArticleTitleDTO = {
54
- title: string;
55
- language: ExtendedTranslationLanguage;
56
- };
57
-
58
- export type CanonArticleTitle = CanonArticleTitleDTO;
59
-
60
- export type CanonDetailDTO = {
61
- uuid: string;
62
- label: string;
63
- description: string;
64
- type: CanonNodeType;
65
- article?: CanonArticleDTO;
66
- titles: CanonArticleTitleDTO[];
67
- };
68
- export type CanonDetail = CanonDetailDTO & {
69
- article?: CanonArticle;
70
- titles: CanonArticleTitle[];
71
- };
72
-
73
- export type CanonWorkStatus = 'published' | 'in-progress' | 'not-started';
74
-
75
- export type CanonWorkDTO = {
76
- uuid: string;
77
- toh: TohokuCatalogEntry;
78
- title: string;
79
- published: boolean;
80
- status: CanonWorkStatus;
81
- pages: number;
82
- };
83
-
84
- export type CanonWork = CanonWorkDTO;
85
-
86
- export type CanonWorksDTO = {
87
- works: CanonWorkDTO[];
88
- };
89
-
90
- export const canonNodeFromDTO = (dto: CanonDTO): CanonNode => {
91
- return {
92
- uuid: dto.uuid,
93
- label: dto.label,
94
- xmlId: dto.xmlId,
95
- parentXmlId: dto.parent_xmlId,
96
- parentUuid: dto.parent_uuid,
97
- sort: dto.sort,
98
- description: dto.description,
99
- type: dto.type,
100
- publicDescription: dto.public_description,
101
- articleUuid: dto.article_uuid,
102
- createdAt: dto.created_at,
103
- };
104
- };
105
-
106
- export const canonTreeFromDTOs = (dtos: CanonDTO[]): CanonHead => {
107
- const nodes: Record<string, CanonNode> = {};
108
- dtos.forEach((dto) => {
109
- nodes[dto.uuid] = canonNodeFromDTO(dto);
110
- });
111
-
112
- const tree: CanonNode[] = [];
113
-
114
- Object.values(nodes).forEach((node) => {
115
- if (node.parentUuid) {
116
- const parent = nodes[node.parentUuid];
117
- if (parent) {
118
- parent.children = parent.children || [];
119
- parent.children.push(node);
120
- }
121
- } else {
122
- tree.push(node);
123
- }
124
- });
125
-
126
- // Sort children by their sort order
127
- const sortChildren = (children: CanonNode[]) => {
128
- children.sort((a, b) => a.sort - b.sort);
129
- children.forEach((child) => {
130
- if (child.children) {
131
- sortChildren(child.children);
132
- }
133
- });
134
- };
135
- sortChildren(tree);
136
-
137
- return {
138
- children: tree,
139
- };
140
- };
141
-
142
- export const canonDetailFromDTO = (dto: CanonDetailDTO): CanonDetail => {
143
- return dto as CanonDetail;
144
- };
145
-
146
- export const caononWorksFromDTO = (dto: CanonWorksDTO): CanonWork[] => {
147
- return dto.works as CanonWork[];
148
- };
@@ -1,84 +0,0 @@
1
- export type ContributorRole =
2
- | 'englishAdvisor'
3
- | 'englishAssociateEditor'
4
- | 'englishCopyEditor'
5
- | 'englishDharmaMaster'
6
- | 'englishFinalReviewer'
7
- | 'englishMarkup'
8
- | 'englishProjectEditor'
9
- | 'englishProjectManager'
10
- | 'englishProofReader'
11
- | 'englishReviser'
12
- | 'englishTranslator'
13
- | 'englishTranslationSponsor'
14
- | 'englishTranslationTeam'
15
- | 'tibetanTranslator';
16
-
17
- export type Contributor = {
18
- name: string;
19
- role: ContributorRole;
20
- };
21
-
22
- export type ProjectContributor = Contributor & {
23
- uuid: string;
24
- contributorUuid: string;
25
- startDate?: Date;
26
- endDate?: Date;
27
- projectUuid: string;
28
- stageUuid?: string;
29
- };
30
-
31
- export type Contributors = Contributor[];
32
- export type ProjectContributors = ProjectContributor[];
33
-
34
- export type ContributorDTO = {
35
- name: string;
36
- role: ContributorRole;
37
- };
38
-
39
- export type ContributorsDTO = ContributorDTO[];
40
-
41
- export type ProjectContributorDTO = {
42
- uuid: string;
43
- projectUuid: string;
44
- stageUuid?: string;
45
- contributorUuid: string;
46
- name: string;
47
- role: ContributorRole;
48
- startDate: string;
49
- endDate: string;
50
- };
51
-
52
- export type ProjectContributorsDTO = ProjectContributorDTO[];
53
-
54
- export const contributorFromDTO = (dto: ContributorDTO): Contributor => {
55
- return {
56
- name: dto.name,
57
- role: dto.role,
58
- };
59
- };
60
-
61
- export const contributorsFromDTO = (dto?: ContributorsDTO): Contributors => {
62
- return dto?.map(contributorFromDTO) || [];
63
- };
64
-
65
- export const projectContributorFromDTO = (
66
- dto: ProjectContributorDTO,
67
- ): ProjectContributor => {
68
- return {
69
- uuid: dto.uuid,
70
- name: dto.name,
71
- contributorUuid: dto.contributorUuid,
72
- role: dto.role,
73
- startDate: new Date(dto.startDate),
74
- endDate: new Date(dto.endDate),
75
- projectUuid: dto.projectUuid,
76
- stageUuid: dto.stageUuid,
77
- };
78
- };
79
-
80
- export const projectContributorsFromDTO = (
81
- dto?: ProjectContributorsDTO,
82
- ): ProjectContributors => {
83
- return dto?.map(projectContributorFromDTO) || [];
84
- };
@@ -1,28 +0,0 @@
1
- export const FOLIO_SIDES = ['a', 'b'] as const;
2
- export type FolioSide = (typeof FOLIO_SIDES)[number];
3
-
4
- export type FolioDTO = {
5
- folio_uuid: string;
6
- content: string;
7
- volume_number: number;
8
- folio_number: number;
9
- side: FolioSide;
10
- };
11
-
12
- export type Folio = {
13
- uuid: string;
14
- content: string;
15
- volume: number;
16
- folio: number;
17
- side: FolioSide;
18
- };
19
-
20
- export const folioFromDTO = (dto: FolioDTO): Folio => {
21
- return {
22
- uuid: dto.folio_uuid,
23
- content: dto.content,
24
- volume: dto.volume_number,
25
- folio: dto.folio_number,
26
- side: dto.side,
27
- };
28
- };
@@ -1,204 +0,0 @@
1
- import { removeHtmlTags } from '@eightyfourthousand/lib-utils';
2
- import { TohokuCatalogEntry } from './toh';
3
- import {
4
- ExtendedTranslationLanguage,
5
- displayLanguageForTranslationLanguage,
6
- } from './language';
7
-
8
- export type GlossaryPageLanguage =
9
- | 'english'
10
- | 'tibetan'
11
- | 'sanskrit'
12
- | 'pali'
13
- | 'chinese';
14
-
15
- export type GlossaryLandingItem = {
16
- uuid: string;
17
- headword: string;
18
- type: string;
19
- language: string;
20
- nameVariants: string;
21
- definition: string;
22
- numGlossaryEntries: number;
23
- };
24
-
25
- export type LanguageRecord = Record<GlossaryPageLanguage, string[]>;
26
-
27
- export type GlossaryDetailItem = LanguageRecord & {
28
- authorityUuid: string;
29
- headword: string;
30
- language: GlossaryPageLanguage;
31
- classifications: string[];
32
- definition?: string;
33
- xmlId?: string;
34
- };
35
-
36
- export type GlossaryPageItem = GlossaryDetailItem & {
37
- relatedInstances: GlossaryInstance[];
38
- relatedEntities: GlossaryEntity[];
39
- };
40
-
41
- export type GlossaryInstance = LanguageRecord & {
42
- workUuid: string;
43
- toh: TohokuCatalogEntry;
44
- definition?: string;
45
- canon?: string;
46
- creators: string[];
47
- };
48
-
49
- export type GlossaryEntity = {
50
- sourceHeadword: string;
51
- sourceUuid: string;
52
- targetHeadword: string;
53
- targetUuid: string;
54
- };
55
- export type GlossaryLandingItemDTO = {
56
- authority_uuid: string;
57
- headword: string;
58
- type: string;
59
- headword_language?: ExtendedTranslationLanguage;
60
- name_variants?: string;
61
- definition?: string;
62
- num_glossary_entries?: number;
63
- };
64
-
65
- export type GlossaryDetailDTO = {
66
- authority_uuid: string;
67
- xmlId?: string;
68
- headword: string;
69
- headword_language?: GlossaryPageLanguage | null;
70
- classifications?: string[] | null;
71
- definition?: string | null;
72
- tibetan_names?: string[] | null;
73
- sanskrit_names?: string[] | null;
74
- pali_names?: string[] | null;
75
- chinese_names?: string[] | null;
76
- english_names?: string[] | null;
77
- };
78
-
79
- export type GlossaryEntityDTO = {
80
- related_entity_object_headword: string;
81
- related_entity_object_uuid: string;
82
- related_entity_subject_headword: string;
83
- related_entity_subject_uuid: string;
84
- };
85
-
86
- export type GlossaryInstanceDTO = {
87
- glossary_entry_work_uuid: string;
88
- glossary_entry_toh: TohokuCatalogEntry;
89
- glossary_entry_english?: string | null;
90
- glossary_entry_tibetan?: string | null;
91
- glossary_entry_sanskrit?: string | null;
92
- glossary_entry_chinese?: string | null;
93
- glossary_entry_pali?: string | null;
94
- glossary_entry_definition?: string | null;
95
- glossary_entry_canon?: string | null;
96
- glossary_entry_creators?: string[] | null;
97
- };
98
-
99
- export const glossaryLandingItemFromDTO = (
100
- dto?: GlossaryLandingItemDTO,
101
- ): GlossaryLandingItem | null => {
102
- if (!dto) {
103
- return null;
104
- }
105
-
106
- const definition = removeHtmlTags(dto.definition || '');
107
- const language = dto.headword_language
108
- ? displayLanguageForTranslationLanguage(dto.headword_language)
109
- : '';
110
-
111
- return {
112
- uuid: dto.authority_uuid,
113
- headword: dto.headword,
114
- type: dto.type.replace('Authority > ', ''),
115
- language,
116
- nameVariants: dto.name_variants || '',
117
- definition,
118
- numGlossaryEntries: dto.num_glossary_entries || 0,
119
- };
120
- };
121
-
122
- export const glossaryDetailFromDTO = (
123
- dto?: GlossaryDetailDTO,
124
- ): GlossaryDetailItem | null => {
125
- if (!dto) {
126
- return null;
127
- }
128
-
129
- return {
130
- authorityUuid: dto.authority_uuid,
131
- headword: dto.headword,
132
- language: dto.headword_language as GlossaryPageLanguage,
133
- classifications: dto.classifications || [],
134
- definition: dto.definition || undefined,
135
- xmlId: dto.xmlId,
136
- english: dto.english_names || [],
137
- tibetan: dto.tibetan_names || [],
138
- sanskrit: dto.sanskrit_names || [],
139
- pali: dto.pali_names || [],
140
- chinese: dto.chinese_names || [],
141
- };
142
- };
143
-
144
- export const glossaryInstanceFromDTO = (
145
- dto?: GlossaryInstanceDTO,
146
- ): GlossaryInstance | null => {
147
- if (!dto) {
148
- return null;
149
- }
150
-
151
- return {
152
- workUuid: dto.glossary_entry_work_uuid,
153
- toh: dto.glossary_entry_toh,
154
- definition: dto.glossary_entry_definition || undefined,
155
- canon: dto.glossary_entry_canon || undefined,
156
- english: dto.glossary_entry_english ? [dto.glossary_entry_english] : [],
157
- tibetan: dto.glossary_entry_tibetan ? [dto.glossary_entry_tibetan] : [],
158
- sanskrit: dto.glossary_entry_sanskrit ? [dto.glossary_entry_sanskrit] : [],
159
- pali: dto.glossary_entry_pali ? [dto.glossary_entry_pali] : [],
160
- chinese: dto.glossary_entry_chinese ? [dto.glossary_entry_chinese] : [],
161
- creators: dto.glossary_entry_creators || [],
162
- };
163
- };
164
-
165
- export const glossaryEntityFromDTO = (
166
- dto?: GlossaryEntityDTO,
167
- ): GlossaryEntity | null => {
168
- if (!dto) {
169
- return null;
170
- }
171
-
172
- return {
173
- sourceHeadword: dto.related_entity_subject_headword,
174
- sourceUuid: dto.related_entity_subject_uuid,
175
- targetHeadword: dto.related_entity_object_headword,
176
- targetUuid: dto.related_entity_object_uuid,
177
- };
178
- };
179
-
180
- export const glossaryPageItemFromDTO = (
181
- detail: GlossaryDetailDTO,
182
- instances: GlossaryInstanceDTO[],
183
- entities: GlossaryEntityDTO[],
184
- ): GlossaryPageItem => {
185
- const detailItem = glossaryDetailFromDTO(detail);
186
- if (!detailItem) {
187
- throw new Error('Invalid glossary detail item');
188
- }
189
-
190
- const relatedInstances =
191
- instances
192
- .map(glossaryInstanceFromDTO)
193
- .filter((i): i is GlossaryInstance => i !== null) || [];
194
- const relatedEntities =
195
- entities
196
- .map(glossaryEntityFromDTO)
197
- .filter((e): e is GlossaryEntity => e !== null) || [];
198
-
199
- return {
200
- ...detailItem,
201
- relatedInstances,
202
- relatedEntities,
203
- };
204
- };
@@ -1,114 +0,0 @@
1
-
2
- export type GlossaryItem = {
3
- authorityUuid: string;
4
- definition?: string | null;
5
- names: GlossaryNames;
6
- nameUuid?: string;
7
- };
8
-
9
- export type Glossary = GlossaryItem[];
10
-
11
- export type GlossaryName = {
12
- content: string;
13
- definition?: string | null;
14
- nameUuid: string;
15
- };
16
-
17
- export type GlossaryNames = GlossaryName[];
18
-
19
- export type GlossaryItemDTO = {
20
- authority_uuid: string;
21
- definition?: string | null;
22
- names: GlossaryNamesDTO;
23
- name_uuid: string;
24
- };
25
-
26
- export type GlossaryDTO = GlossaryItemDTO[];
27
-
28
- export type GlossaryNameDTO = {
29
- content: string;
30
- definition?: string | null;
31
- name_uuid: string;
32
- };
33
-
34
- export type GlossaryNamesDTO = GlossaryNameDTO[];
35
-
36
- export type GlossaryTermInstance = {
37
- uuid: string;
38
- authority: string;
39
- workUuid: string;
40
- definition?: string | null;
41
- termNumber: number;
42
- names: {
43
- chinese?: string;
44
- english?: string;
45
- pali?: string;
46
- sanskrit?: string;
47
- tibetan?: string;
48
- wylie?: string;
49
- };
50
- passages?: {
51
- items: Array<{ uuid: string; type: string; label: string }>;
52
- nextCursor: string | null;
53
- hasMore: boolean;
54
- }
55
- };
56
-
57
- export type GlossaryTermInstances = GlossaryTermInstance[];
58
-
59
- export type GlossaryTermInstanceDTO = {
60
- uuid: string;
61
- authority_uuid: string;
62
- work_uuid: string;
63
- definition?: string;
64
- names: {
65
- chinese?: string;
66
- english?: string;
67
- pali?: string;
68
- sanskrit?: string;
69
- tibetan?: string;
70
- wylie?: string;
71
- };
72
- };
73
-
74
- export type GlossaryTermInstancesDTO = {
75
- work_uuid: string;
76
- glossary_entries: GlossaryTermInstanceDTO[];
77
- };
78
-
79
- export const glossaryNameFromDTO = (dto: GlossaryNameDTO): GlossaryName => {
80
- return {
81
- content: dto.content,
82
- definition: dto.definition,
83
- nameUuid: dto.name_uuid,
84
- };
85
- };
86
-
87
- export const glossaryNamesFromDTO = (dto?: GlossaryNamesDTO): GlossaryNames => {
88
- return dto?.map(glossaryNameFromDTO) || [];
89
- };
90
-
91
- export const glossaryItemFromDTO = (dto: GlossaryItemDTO): GlossaryItem => {
92
- return {
93
- authorityUuid: dto.authority_uuid,
94
- definition: dto.definition,
95
- names: glossaryNamesFromDTO(dto.names),
96
- nameUuid: dto.name_uuid,
97
- };
98
- };
99
- export const glossaryFromDTO = (dto?: GlossaryDTO): Glossary => {
100
- return dto?.map(glossaryItemFromDTO) || [];
101
- };
102
-
103
- export const glossaryTermInstanceFromDTO = (
104
- dto: GlossaryTermInstanceDTO,
105
- ): GlossaryTermInstance => {
106
- return {
107
- uuid: dto.uuid,
108
- authority: dto.authority_uuid,
109
- workUuid: dto.work_uuid,
110
- definition: dto.definition,
111
- termNumber: 0,
112
- names: dto.names,
113
- };
114
- };