@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.
- package/{src/index.ts → index.d.ts} +1 -2
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/lib/auth.d.ts +59 -0
- package/lib/auth.js +135 -0
- package/lib/auth.js.map +1 -0
- package/lib/bibliography.d.ts +9 -0
- package/lib/bibliography.js +31 -0
- package/lib/bibliography.js.map +1 -0
- package/lib/client-browser.d.ts +1 -0
- package/lib/client-browser.js +10 -0
- package/lib/client-browser.js.map +1 -0
- package/lib/client-server.d.ts +4 -0
- package/lib/client-server.js +19 -0
- package/lib/client-server.js.map +1 -0
- package/lib/client-ssr.d.ts +1 -0
- package/lib/client-ssr.js +24 -0
- package/lib/client-ssr.js.map +1 -0
- package/lib/client-token.d.ts +7 -0
- package/lib/client-token.js +21 -0
- package/lib/client-token.js.map +1 -0
- package/lib/feedback.d.ts +6 -0
- package/lib/feedback.js +50 -0
- package/lib/feedback.js.map +1 -0
- package/lib/folio.d.ts +11 -0
- package/lib/folio.js +32 -0
- package/lib/folio.js.map +1 -0
- package/lib/glossary/batch.d.ts +5 -0
- package/lib/glossary/batch.js +24 -0
- package/lib/glossary/batch.js.map +1 -0
- package/lib/glossary/index.d.ts +4 -0
- package/lib/glossary/index.js +5 -0
- package/lib/glossary/index.js.map +1 -0
- package/lib/glossary/instance.d.ts +10 -0
- package/lib/glossary/instance.js +29 -0
- package/lib/glossary/instance.js.map +1 -0
- package/lib/glossary/landing.d.ts +5 -0
- package/lib/glossary/landing.js +33 -0
- package/lib/glossary/landing.js.map +1 -0
- package/lib/glossary/pagination.d.ts +55 -0
- package/lib/glossary/pagination.js +255 -0
- package/lib/glossary/pagination.js.map +1 -0
- package/lib/imprint.d.ts +10 -0
- package/lib/imprint.js +24 -0
- package/lib/imprint.js.map +1 -0
- package/lib/library.d.ts +58 -0
- package/lib/library.js +119 -0
- package/lib/library.js.map +1 -0
- package/lib/local-storage.d.ts +10 -0
- package/lib/local-storage.js +25 -0
- package/lib/local-storage.js.map +1 -0
- package/lib/lookup-entity.d.ts +7 -0
- package/lib/lookup-entity.js +94 -0
- package/lib/lookup-entity.js.map +1 -0
- package/lib/panel-url.d.ts +10 -0
- package/lib/panel-url.js +23 -0
- package/lib/panel-url.js.map +1 -0
- package/lib/passage/batch.d.ts +17 -0
- package/lib/passage/batch.js +159 -0
- package/lib/passage/batch.js.map +1 -0
- package/lib/passage/index.d.ts +5 -0
- package/lib/passage/index.js +6 -0
- package/lib/passage/index.js.map +1 -0
- package/lib/passage/pagination.d.ts +43 -0
- package/lib/passage/pagination.js +170 -0
- package/lib/passage/pagination.js.map +1 -0
- package/lib/passage/read.d.ts +15 -0
- package/lib/passage/read.js +61 -0
- package/lib/passage/read.js.map +1 -0
- package/lib/passage/replace-persistence.d.ts +46 -0
- package/lib/passage/replace-persistence.js +94 -0
- package/lib/passage/replace-persistence.js.map +1 -0
- package/lib/passage/save.d.ts +16 -0
- package/lib/passage/save.js +231 -0
- package/lib/passage/save.js.map +1 -0
- package/lib/proxy.d.ts +7 -0
- package/lib/proxy.js +48 -0
- package/lib/proxy.js.map +1 -0
- package/lib/publications.d.ts +86 -0
- package/lib/publications.js +226 -0
- package/lib/publications.js.map +1 -0
- package/lib/replace.d.ts +31 -0
- package/lib/replace.js +134 -0
- package/lib/replace.js.map +1 -0
- package/lib/storage.d.ts +7 -0
- package/lib/storage.js +11 -0
- package/lib/storage.js.map +1 -0
- package/lib/types/alignment.d.ts +18 -0
- package/lib/types/alignment.js +13 -0
- package/lib/types/alignment.js.map +1 -0
- package/lib/types/annotation/abbreviation.d.ts +3 -0
- package/lib/types/annotation/abbreviation.js +20 -0
- package/lib/types/annotation/abbreviation.js.map +1 -0
- package/lib/types/annotation/annotation-type.d.ts +31 -0
- package/lib/types/annotation/annotation-type.js +81 -0
- package/lib/types/annotation/annotation-type.js.map +1 -0
- package/lib/types/annotation/annotation.d.ts +142 -0
- package/lib/types/annotation/annotation.js +23 -0
- package/lib/types/annotation/annotation.js.map +1 -0
- package/lib/types/annotation/audio.d.ts +3 -0
- package/lib/types/annotation/audio.js +24 -0
- package/lib/types/annotation/audio.js.map +1 -0
- package/lib/types/annotation/blockquote.d.ts +3 -0
- package/lib/types/annotation/blockquote.js +8 -0
- package/lib/types/annotation/blockquote.js.map +1 -0
- package/lib/types/annotation/code.d.ts +3 -0
- package/lib/types/annotation/code.js +8 -0
- package/lib/types/annotation/code.js.map +1 -0
- package/lib/types/annotation/deprecated.d.ts +3 -0
- package/lib/types/annotation/deprecated.js +8 -0
- package/lib/types/annotation/deprecated.js.map +1 -0
- package/lib/types/annotation/end-note-link.d.ts +3 -0
- package/lib/types/annotation/end-note-link.js +23 -0
- package/lib/types/annotation/end-note-link.js.map +1 -0
- package/lib/types/annotation/export.d.ts +3 -0
- package/{src/lib/types/annotation/export.ts → lib/types/annotation/export.js} +34 -36
- package/lib/types/annotation/export.js.map +1 -0
- package/lib/types/annotation/glossary-instance.d.ts +3 -0
- package/lib/types/annotation/glossary-instance.js +23 -0
- package/lib/types/annotation/glossary-instance.js.map +1 -0
- package/lib/types/annotation/has-abbreviation.d.ts +3 -0
- package/lib/types/annotation/has-abbreviation.js +20 -0
- package/lib/types/annotation/has-abbreviation.js.map +1 -0
- package/lib/types/annotation/heading.d.ts +3 -0
- package/lib/types/annotation/heading.js +23 -0
- package/lib/types/annotation/heading.js.map +1 -0
- package/lib/types/annotation/image.d.ts +3 -0
- package/lib/types/annotation/image.js +20 -0
- package/lib/types/annotation/image.js.map +1 -0
- package/lib/types/annotation/indent.d.ts +3 -0
- package/lib/types/annotation/indent.js +8 -0
- package/lib/types/annotation/indent.js.map +1 -0
- package/lib/types/annotation/index.js +5 -0
- package/lib/types/annotation/index.js.map +1 -0
- package/lib/types/annotation/inline-title.d.ts +3 -0
- package/lib/types/annotation/inline-title.js +21 -0
- package/lib/types/annotation/inline-title.js.map +1 -0
- package/lib/types/annotation/internal-link.d.ts +3 -0
- package/lib/types/annotation/internal-link.js +62 -0
- package/lib/types/annotation/internal-link.js.map +1 -0
- package/lib/types/annotation/leading-space.d.ts +3 -0
- package/lib/types/annotation/leading-space.js +8 -0
- package/lib/types/annotation/leading-space.js.map +1 -0
- package/lib/types/annotation/line-group.d.ts +3 -0
- package/lib/types/annotation/line-group.js +8 -0
- package/lib/types/annotation/line-group.js.map +1 -0
- package/lib/types/annotation/line.d.ts +3 -0
- package/lib/types/annotation/line.js +8 -0
- package/lib/types/annotation/line.js.map +1 -0
- package/lib/types/annotation/link.d.ts +3 -0
- package/lib/types/annotation/link.js +27 -0
- package/lib/types/annotation/link.js.map +1 -0
- package/lib/types/annotation/list-item.d.ts +3 -0
- package/lib/types/annotation/list-item.js +8 -0
- package/lib/types/annotation/list-item.js.map +1 -0
- package/lib/types/annotation/list.d.ts +3 -0
- package/lib/types/annotation/list.js +31 -0
- package/lib/types/annotation/list.js.map +1 -0
- package/lib/types/annotation/mantra.d.ts +3 -0
- package/lib/types/annotation/mantra.js +21 -0
- package/lib/types/annotation/mantra.js.map +1 -0
- package/lib/types/annotation/mention.d.ts +3 -0
- package/lib/types/annotation/mention.js +50 -0
- package/lib/types/annotation/mention.js.map +1 -0
- package/lib/types/annotation/paragraph.d.ts +3 -0
- package/lib/types/annotation/paragraph.js +8 -0
- package/lib/types/annotation/paragraph.js.map +1 -0
- package/lib/types/annotation/quote.d.ts +3 -0
- package/lib/types/annotation/quote.js +21 -0
- package/lib/types/annotation/quote.js.map +1 -0
- package/lib/types/annotation/quoted.d.ts +3 -0
- package/lib/types/annotation/quoted.js +21 -0
- package/lib/types/annotation/quoted.js.map +1 -0
- package/lib/types/annotation/reference.d.ts +3 -0
- package/lib/types/annotation/reference.js +8 -0
- package/lib/types/annotation/reference.js.map +1 -0
- package/lib/types/annotation/span.d.ts +3 -0
- package/lib/types/annotation/span.js +29 -0
- package/lib/types/annotation/span.js.map +1 -0
- package/lib/types/annotation/table-body-data.d.ts +3 -0
- package/lib/types/annotation/table-body-data.js +8 -0
- package/lib/types/annotation/table-body-data.js.map +1 -0
- package/lib/types/annotation/table-body-header.d.ts +3 -0
- package/lib/types/annotation/table-body-header.js +8 -0
- package/lib/types/annotation/table-body-header.js.map +1 -0
- package/lib/types/annotation/table-body-row.d.ts +3 -0
- package/lib/types/annotation/table-body-row.js +8 -0
- package/lib/types/annotation/table-body-row.js.map +1 -0
- package/lib/types/annotation/table.d.ts +3 -0
- package/lib/types/annotation/table.js +8 -0
- package/lib/types/annotation/table.js.map +1 -0
- package/lib/types/annotation/trailer.d.ts +3 -0
- package/lib/types/annotation/trailer.js +8 -0
- package/lib/types/annotation/trailer.js.map +1 -0
- package/lib/types/annotation/transform.d.ts +6 -0
- package/lib/types/annotation/transform.js +108 -0
- package/lib/types/annotation/transform.js.map +1 -0
- package/lib/types/annotation/unknown.d.ts +3 -0
- package/lib/types/annotation/unknown.js +8 -0
- package/lib/types/annotation/unknown.js.map +1 -0
- package/lib/types/bibliography.d.ts +41 -0
- package/lib/types/bibliography.js +30 -0
- package/lib/types/bibliography.js.map +1 -0
- package/{src/lib/types/client.ts → lib/types/client.d.ts} +0 -1
- package/lib/types/client.js +2 -0
- package/lib/types/client.js.map +1 -0
- package/{src/lib/types/editor-content.ts → lib/types/editor-content.d.ts} +7 -11
- package/lib/types/editor-content.js +2 -0
- package/lib/types/editor-content.js.map +1 -0
- package/lib/types/folio.d.ts +17 -0
- package/lib/types/folio.js +11 -0
- package/lib/types/folio.js.map +1 -0
- package/lib/types/glossary-page.d.ts +48 -0
- package/lib/types/glossary-page.js +21 -0
- package/lib/types/glossary-page.js.map +1 -0
- package/lib/types/glossary.d.ts +76 -0
- package/lib/types/glossary.js +32 -0
- package/lib/types/glossary.js.map +1 -0
- package/lib/types/imprint.d.ts +78 -0
- package/lib/types/imprint.js +71 -0
- package/lib/types/imprint.js.map +1 -0
- package/{src/lib/types/index.ts → lib/types/index.d.ts} +0 -3
- package/lib/types/index.js +20 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/language.d.ts +9 -0
- package/lib/types/language.js +41 -0
- package/lib/types/language.js.map +1 -0
- package/lib/types/layout.d.ts +5 -0
- package/lib/types/layout.js +23 -0
- package/lib/types/layout.js.map +1 -0
- package/lib/types/library.d.ts +19 -0
- package/lib/types/library.js +8 -0
- package/lib/types/library.js.map +1 -0
- package/lib/types/passage.d.ts +73 -0
- package/lib/types/passage.js +120 -0
- package/lib/types/passage.js.map +1 -0
- package/lib/types/semver.js +2 -0
- package/lib/types/semver.js.map +1 -0
- package/lib/types/title.d.ts +21 -0
- package/lib/types/title.js +22 -0
- package/lib/types/title.js.map +1 -0
- package/lib/types/toh.js +2 -0
- package/lib/types/toh.js.map +1 -0
- package/{src/lib/types/translation.ts → lib/types/translation.d.ts} +5 -7
- package/lib/types/translation.js +2 -0
- package/lib/types/translation.js.map +1 -0
- package/{src/lib/types/user.ts → lib/types/user.d.ts} +2 -11
- package/lib/types/user.js +9 -0
- package/lib/types/user.js.map +1 -0
- package/lib/types/work.d.ts +37 -0
- package/lib/types/work.js +15 -0
- package/lib/types/work.js.map +1 -0
- package/lib/use-bookmark.d.ts +10 -0
- package/lib/use-bookmark.js +31 -0
- package/lib/use-bookmark.js.map +1 -0
- package/package.json +25 -3
- package/ssr.js +6 -0
- package/ssr.js.map +1 -0
- package/.babelrc +0 -12
- package/.eslintrc.json +0 -18
- package/README.md +0 -9
- package/jest.config.ts +0 -10
- package/project.json +0 -21
- package/src/lib/auth.ts +0 -203
- package/src/lib/bibliography.ts +0 -57
- package/src/lib/canon.ts +0 -111
- package/src/lib/client-browser.ts +0 -12
- package/src/lib/client-server.ts +0 -30
- package/src/lib/client-ssr.ts +0 -24
- package/src/lib/client-token.ts +0 -24
- package/src/lib/feedback.ts +0 -71
- package/src/lib/folio.ts +0 -43
- package/src/lib/glossary.ts +0 -147
- package/src/lib/imprint.ts +0 -42
- package/src/lib/library.ts +0 -209
- package/src/lib/local-storage.ts +0 -33
- package/src/lib/lookup-entity.ts +0 -122
- package/src/lib/panel-url.ts +0 -43
- package/src/lib/passage.ts +0 -122
- package/src/lib/projects.ts +0 -107
- package/src/lib/proxy.ts +0 -68
- package/src/lib/publications.ts +0 -213
- package/src/lib/storage.ts +0 -23
- package/src/lib/types/alignment.ts +0 -32
- package/src/lib/types/annotation/abbreviation.ts +0 -30
- package/src/lib/types/annotation/annotation-type.ts +0 -219
- package/src/lib/types/annotation/annotation.ts +0 -244
- package/src/lib/types/annotation/audio.ts +0 -33
- package/src/lib/types/annotation/blockquote.ts +0 -18
- package/src/lib/types/annotation/code.ts +0 -16
- package/src/lib/types/annotation/deprecated.ts +0 -18
- package/src/lib/types/annotation/end-note-link.ts +0 -35
- package/src/lib/types/annotation/glossary-instance.ts +0 -34
- package/src/lib/types/annotation/has-abbreviation.ts +0 -30
- package/src/lib/types/annotation/heading.ts +0 -37
- package/src/lib/types/annotation/image.ts +0 -29
- package/src/lib/types/annotation/indent.ts +0 -16
- package/src/lib/types/annotation/inline-title.ts +0 -34
- package/src/lib/types/annotation/internal-link.ts +0 -86
- package/src/lib/types/annotation/leading-space.ts +0 -18
- package/src/lib/types/annotation/line-group.ts +0 -18
- package/src/lib/types/annotation/line.ts +0 -16
- package/src/lib/types/annotation/link.ts +0 -38
- package/src/lib/types/annotation/list-item.ts +0 -16
- package/src/lib/types/annotation/list.ts +0 -43
- package/src/lib/types/annotation/mantra.ts +0 -31
- package/src/lib/types/annotation/mention.ts +0 -64
- package/src/lib/types/annotation/paragraph.ts +0 -18
- package/src/lib/types/annotation/quote.ts +0 -30
- package/src/lib/types/annotation/quoted.ts +0 -30
- package/src/lib/types/annotation/reference.ts +0 -18
- package/src/lib/types/annotation/span.ts +0 -39
- package/src/lib/types/annotation/table-body-data.ts +0 -18
- package/src/lib/types/annotation/table-body-header.ts +0 -18
- package/src/lib/types/annotation/table-body-row.ts +0 -18
- package/src/lib/types/annotation/table.ts +0 -16
- package/src/lib/types/annotation/trailer.ts +0 -16
- package/src/lib/types/annotation/transform.ts +0 -140
- package/src/lib/types/annotation/unknown.ts +0 -16
- package/src/lib/types/bibliography.ts +0 -86
- package/src/lib/types/canon.ts +0 -148
- package/src/lib/types/contributor.ts +0 -84
- package/src/lib/types/folio.ts +0 -28
- package/src/lib/types/glossary-page.ts +0 -204
- package/src/lib/types/glossary.ts +0 -114
- package/src/lib/types/imprint.ts +0 -159
- package/src/lib/types/language.ts +0 -64
- package/src/lib/types/layout.ts +0 -37
- package/src/lib/types/library.ts +0 -29
- package/src/lib/types/passage.ts +0 -220
- package/src/lib/types/project.ts +0 -200
- package/src/lib/types/title.ts +0 -47
- package/src/lib/types/work.ts +0 -38
- package/src/lib/use-bookmark.ts +0 -45
- package/tsconfig.json +0 -20
- package/tsconfig.lib.json +0 -26
- package/tsconfig.spec.json +0 -22
- /package/{src/lib/types/annotation/index.ts → lib/types/annotation/index.d.ts} +0 -0
- /package/{src/lib/types/semver.ts → lib/types/semver.d.ts} +0 -0
- /package/{src/lib/types/toh.ts → lib/types/toh.d.ts} +0 -0
- /package/{src/ssr.ts → ssr.d.ts} +0 -0
package/src/lib/types/canon.ts
DELETED
|
@@ -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
|
-
};
|
package/src/lib/types/folio.ts
DELETED
|
@@ -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
|
-
};
|