@eightyfourthousand/data-access 2026.4.0 → 2026.4.2
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/index.js +18 -0
- package/index.js.map +1 -0
- package/lib/auth.d.ts +59 -0
- package/lib/auth.js +134 -0
- package/lib/auth.js.map +1 -0
- package/lib/bibliography.d.ts +9 -0
- package/lib/bibliography.js +30 -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 +23 -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 +45 -0
- package/lib/feedback.js.map +1 -0
- package/lib/folio.d.ts +11 -0
- package/lib/folio.js +31 -0
- package/lib/folio.js.map +1 -0
- package/lib/glossary/batch.d.ts +5 -0
- package/lib/glossary/batch.js +22 -0
- package/lib/glossary/batch.js.map +1 -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 +28 -0
- package/lib/glossary/instance.js.map +1 -0
- package/lib/glossary/landing.d.ts +5 -0
- package/lib/glossary/landing.js +32 -0
- package/lib/glossary/landing.js.map +1 -0
- package/lib/glossary/pagination.d.ts +55 -0
- package/lib/glossary/pagination.js +254 -0
- package/lib/glossary/pagination.js.map +1 -0
- package/lib/imprint.d.ts +10 -0
- package/lib/imprint.js +23 -0
- package/lib/imprint.js.map +1 -0
- package/lib/library.d.ts +58 -0
- package/lib/library.js +118 -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 +93 -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 +155 -0
- package/lib/passage/batch.js.map +1 -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 +167 -0
- package/lib/passage/pagination.js.map +1 -0
- package/lib/passage/read.d.ts +15 -0
- package/lib/passage/read.js +59 -0
- package/lib/passage/read.js.map +1 -0
- package/lib/passage/replace-persistence.d.ts +46 -0
- package/lib/passage/replace-persistence.js +93 -0
- package/lib/passage/replace-persistence.js.map +1 -0
- package/lib/passage/save.d.ts +16 -0
- package/lib/passage/save.js +227 -0
- package/lib/passage/save.js.map +1 -0
- package/lib/proxy.d.ts +7 -0
- package/lib/proxy.js +45 -0
- package/lib/proxy.js.map +1 -0
- package/lib/publications.d.ts +86 -0
- package/lib/publications.js +223 -0
- package/lib/publications.js.map +1 -0
- package/lib/replace.d.ts +31 -0
- package/lib/replace.js +151 -0
- package/lib/replace.js.map +1 -0
- package/lib/storage.d.ts +7 -0
- package/lib/storage.js +10 -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 +26 -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 +109 -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 +29 -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 +78 -0
- package/lib/types/imprint.js.map +1 -0
- 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 +123 -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 +21 -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 +12 -0
- package/lib/types/work.js.map +1 -0
- package/lib/use-bookmark.d.ts +10 -0
- package/lib/use-bookmark.js +30 -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/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 -57
- package/src/lib/glossary/batch.ts +0 -35
- package/src/lib/glossary/instance.ts +0 -54
- package/src/lib/glossary/landing.ts +0 -50
- package/src/lib/glossary/pagination.ts +0 -471
- 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/batch.ts +0 -229
- package/src/lib/passage/pagination.ts +0 -277
- package/src/lib/passage/read.ts +0 -100
- package/src/lib/passage/replace-persistence.ts +0 -153
- package/src/lib/passage/save.ts +0 -324
- package/src/lib/proxy.ts +0 -68
- package/src/lib/publications.ts +0 -381
- package/src/lib/replace.spec.ts +0 -154
- package/src/lib/replace.ts +0 -244
- 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/folio.ts +0 -28
- package/src/lib/types/glossary-page.ts +0 -86
- package/src/lib/types/glossary.ts +0 -115
- 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/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/index.ts → index.d.ts} +0 -0
- /package/{src/lib/glossary/index.ts → lib/glossary/index.d.ts} +0 -0
- /package/{src/lib/passage/index.ts → lib/passage/index.d.ts} +0 -0
- /package/{src/lib/types/annotation/index.ts → lib/types/annotation/index.d.ts} +0 -0
- /package/{src/lib/types/index.ts → lib/types/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/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,86 +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 const glossaryLandingItemFromDTO = (
|
|
66
|
-
dto?: GlossaryLandingItemDTO,
|
|
67
|
-
): GlossaryLandingItem | null => {
|
|
68
|
-
if (!dto) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const definition = removeHtmlTags(dto.definition || '');
|
|
73
|
-
const language = dto.headword_language
|
|
74
|
-
? displayLanguageForTranslationLanguage(dto.headword_language)
|
|
75
|
-
: '';
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
uuid: dto.authority_uuid,
|
|
79
|
-
headword: dto.headword,
|
|
80
|
-
type: dto.type.replace('Authority > ', ''),
|
|
81
|
-
language,
|
|
82
|
-
nameVariants: dto.name_variants || '',
|
|
83
|
-
definition,
|
|
84
|
-
numGlossaryEntries: dto.num_glossary_entries || 0,
|
|
85
|
-
};
|
|
86
|
-
};
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
export type GlossaryItem = {
|
|
2
|
-
authorityUuid: string;
|
|
3
|
-
definition?: string | null;
|
|
4
|
-
names: GlossaryNames;
|
|
5
|
-
nameUuid?: string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type Glossary = GlossaryItem[];
|
|
9
|
-
|
|
10
|
-
export type GlossaryName = {
|
|
11
|
-
content: string;
|
|
12
|
-
definition?: string | null;
|
|
13
|
-
nameUuid: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type GlossaryNames = GlossaryName[];
|
|
17
|
-
|
|
18
|
-
export type GlossaryItemDTO = {
|
|
19
|
-
authority_uuid: string;
|
|
20
|
-
definition?: string | null;
|
|
21
|
-
names: GlossaryNamesDTO;
|
|
22
|
-
name_uuid: string;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export type GlossaryDTO = GlossaryItemDTO[];
|
|
26
|
-
|
|
27
|
-
export type GlossaryNameDTO = {
|
|
28
|
-
content: string;
|
|
29
|
-
definition?: string | null;
|
|
30
|
-
name_uuid: string;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type GlossaryNamesDTO = GlossaryNameDTO[];
|
|
34
|
-
|
|
35
|
-
export type GlossaryTermInstance = {
|
|
36
|
-
uuid: string;
|
|
37
|
-
authority: string;
|
|
38
|
-
workUuid: string;
|
|
39
|
-
definition?: string | null;
|
|
40
|
-
termNumber: number;
|
|
41
|
-
names: {
|
|
42
|
-
chinese?: string;
|
|
43
|
-
english?: string;
|
|
44
|
-
pali?: string;
|
|
45
|
-
sanskrit?: string;
|
|
46
|
-
tibetan?: string;
|
|
47
|
-
wylie?: string;
|
|
48
|
-
alternatives?: 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
|
-
alternatives?: string;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export type GlossaryTermInstancesDTO = {
|
|
76
|
-
work_uuid: string;
|
|
77
|
-
glossary_entries: GlossaryTermInstanceDTO[];
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const glossaryNameFromDTO = (dto: GlossaryNameDTO): GlossaryName => {
|
|
81
|
-
return {
|
|
82
|
-
content: dto.content,
|
|
83
|
-
definition: dto.definition,
|
|
84
|
-
nameUuid: dto.name_uuid,
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export const glossaryNamesFromDTO = (dto?: GlossaryNamesDTO): GlossaryNames => {
|
|
89
|
-
return dto?.map(glossaryNameFromDTO) || [];
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const glossaryItemFromDTO = (dto: GlossaryItemDTO): GlossaryItem => {
|
|
93
|
-
return {
|
|
94
|
-
authorityUuid: dto.authority_uuid,
|
|
95
|
-
definition: dto.definition,
|
|
96
|
-
names: glossaryNamesFromDTO(dto.names),
|
|
97
|
-
nameUuid: dto.name_uuid,
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
export const glossaryFromDTO = (dto?: GlossaryDTO): Glossary => {
|
|
101
|
-
return dto?.map(glossaryItemFromDTO) || [];
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export const glossaryTermInstanceFromDTO = (
|
|
105
|
-
dto: GlossaryTermInstanceDTO,
|
|
106
|
-
): GlossaryTermInstance => {
|
|
107
|
-
return {
|
|
108
|
-
uuid: dto.uuid,
|
|
109
|
-
authority: dto.authority_uuid,
|
|
110
|
-
workUuid: dto.work_uuid,
|
|
111
|
-
definition: dto.definition,
|
|
112
|
-
termNumber: 0,
|
|
113
|
-
names: dto.names,
|
|
114
|
-
};
|
|
115
|
-
};
|
package/src/lib/types/imprint.ts
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { TranslationLanguage } from './language';
|
|
2
|
-
import { BACK_MATTER, BODY_MATTER, FRONT_MATTER } from './passage';
|
|
3
|
-
import { SemVer } from './semver';
|
|
4
|
-
|
|
5
|
-
export type Imprint = {
|
|
6
|
-
uuid: string;
|
|
7
|
-
toh: string;
|
|
8
|
-
section?: string;
|
|
9
|
-
version?: SemVer;
|
|
10
|
-
restriction?: boolean;
|
|
11
|
-
publishYear?: string;
|
|
12
|
-
tibetanAuthors?: string[];
|
|
13
|
-
isAuthorContested: boolean;
|
|
14
|
-
sourceDescription?: string;
|
|
15
|
-
publisherStatement?: string;
|
|
16
|
-
tibetanTranslators?: string;
|
|
17
|
-
license: {
|
|
18
|
-
link?: string;
|
|
19
|
-
name?: string;
|
|
20
|
-
description?: string;
|
|
21
|
-
};
|
|
22
|
-
mainTitles?: Partial<{ [key in TranslationLanguage]: string }>;
|
|
23
|
-
longTitles?: Partial<{ [key in TranslationLanguage]: string }>;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export type ImprintDTO = {
|
|
27
|
-
work_uuid: string;
|
|
28
|
-
toh: string;
|
|
29
|
-
section?: string;
|
|
30
|
-
version?: SemVer;
|
|
31
|
-
restriction?: boolean;
|
|
32
|
-
publishYear?: string;
|
|
33
|
-
tibetanAuthors?: string;
|
|
34
|
-
isAuthorContested?: boolean;
|
|
35
|
-
sourceDescription?: string;
|
|
36
|
-
publisherStatement?: string;
|
|
37
|
-
tibetanTranslators?: string;
|
|
38
|
-
license: {
|
|
39
|
-
link?: string;
|
|
40
|
-
name?: string;
|
|
41
|
-
description?: string;
|
|
42
|
-
};
|
|
43
|
-
mainTitles?: Partial<{ [key in TranslationLanguage]: string }>;
|
|
44
|
-
longTitles?: Partial<{ [key in TranslationLanguage]: string }>;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const imprintFromDTO = (dto: ImprintDTO): Imprint => {
|
|
48
|
-
return {
|
|
49
|
-
uuid: dto.work_uuid,
|
|
50
|
-
toh: dto.toh,
|
|
51
|
-
section: dto.section,
|
|
52
|
-
version: dto.version,
|
|
53
|
-
restriction: dto.restriction,
|
|
54
|
-
publishYear: dto.publishYear,
|
|
55
|
-
tibetanAuthors: dto.tibetanAuthors
|
|
56
|
-
?.split(',')
|
|
57
|
-
.map((author) => author.trim())
|
|
58
|
-
.filter((author) => author.length > 0),
|
|
59
|
-
isAuthorContested: dto.isAuthorContested || false,
|
|
60
|
-
sourceDescription: dto.sourceDescription,
|
|
61
|
-
publisherStatement: dto.publisherStatement,
|
|
62
|
-
tibetanTranslators: dto.tibetanTranslators,
|
|
63
|
-
license: {
|
|
64
|
-
...dto.license,
|
|
65
|
-
},
|
|
66
|
-
mainTitles: dto.mainTitles,
|
|
67
|
-
longTitles: dto.longTitles,
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const ALL_SECTIONS = [...FRONT_MATTER, ...BODY_MATTER, ...BACK_MATTER];
|
|
72
|
-
export type TranslationSection = (typeof ALL_SECTIONS)[number];
|
|
73
|
-
|
|
74
|
-
export type TocEntryDTO = {
|
|
75
|
-
uuid: string;
|
|
76
|
-
content: string;
|
|
77
|
-
label?: string;
|
|
78
|
-
sort: number;
|
|
79
|
-
section: TranslationSection;
|
|
80
|
-
level: number;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export type TocDTO = TocEntryDTO[];
|
|
84
|
-
|
|
85
|
-
export type TocEntry = {
|
|
86
|
-
uuid: string;
|
|
87
|
-
content: string;
|
|
88
|
-
label?: string;
|
|
89
|
-
sort: number;
|
|
90
|
-
level: number;
|
|
91
|
-
section: TranslationSection;
|
|
92
|
-
children: TocEntry[];
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
export type Toc = {
|
|
96
|
-
frontMatter: TocEntry[];
|
|
97
|
-
body: TocEntry[];
|
|
98
|
-
backMatter: TocEntry[];
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export const tocFromDTO = (dto: TocDTO): Toc => {
|
|
102
|
-
// map by front matter, body matter, back matter based on constants above
|
|
103
|
-
const frontMatter: TocEntry[] = [];
|
|
104
|
-
const bodyMatter: TocEntry[] = [];
|
|
105
|
-
const backMatter: TocEntry[] = [];
|
|
106
|
-
|
|
107
|
-
const sectionMap: { [key in TranslationSection]: TocEntry[] } = {
|
|
108
|
-
abbreviations: backMatter,
|
|
109
|
-
acknowledgment: frontMatter,
|
|
110
|
-
appendix: bodyMatter,
|
|
111
|
-
colophon: bodyMatter,
|
|
112
|
-
endnotes: backMatter,
|
|
113
|
-
homage: bodyMatter,
|
|
114
|
-
introduction: frontMatter,
|
|
115
|
-
prelude: bodyMatter,
|
|
116
|
-
prologue: bodyMatter,
|
|
117
|
-
summary: frontMatter,
|
|
118
|
-
translation: bodyMatter,
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
dto.forEach((entry) => {
|
|
122
|
-
const tocEntry: TocEntry = {
|
|
123
|
-
...entry,
|
|
124
|
-
children: [],
|
|
125
|
-
};
|
|
126
|
-
sectionMap[entry.section].push(tocEntry);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
// within each section, create a hierarchy based on level from low to high
|
|
130
|
-
const buildHierarchy = (entries: TocEntry[]): TocEntry[] => {
|
|
131
|
-
const root: TocEntry = {
|
|
132
|
-
uuid: 'root',
|
|
133
|
-
content: '',
|
|
134
|
-
sort: 0,
|
|
135
|
-
level: 0,
|
|
136
|
-
section: 'introduction',
|
|
137
|
-
children: [],
|
|
138
|
-
};
|
|
139
|
-
const stack: TocEntry[] = [root];
|
|
140
|
-
|
|
141
|
-
entries.sort((a, b) => a.sort - b.sort);
|
|
142
|
-
|
|
143
|
-
entries.forEach((entry) => {
|
|
144
|
-
while (stack.length > 1 && entry.level <= stack[stack.length - 1].level) {
|
|
145
|
-
stack.pop();
|
|
146
|
-
}
|
|
147
|
-
stack[stack.length - 1].children.push(entry);
|
|
148
|
-
stack.push(entry);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
return root.children;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
return {
|
|
155
|
-
frontMatter: buildHierarchy(frontMatter),
|
|
156
|
-
body: buildHierarchy(bodyMatter),
|
|
157
|
-
backMatter: buildHierarchy(backMatter),
|
|
158
|
-
};
|
|
159
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
export const LANGUAGES = ['bo', 'en', 'Bo-Ltn', 'Sa-Ltn'] as const;
|
|
2
|
-
export type TranslationLanguage = (typeof LANGUAGES)[number];
|
|
3
|
-
export type ExtendedTranslationLanguage =
|
|
4
|
-
| TranslationLanguage
|
|
5
|
-
| 'zh'
|
|
6
|
-
| 'ja'
|
|
7
|
-
| 'Mt-Ltn'
|
|
8
|
-
| 'Pi-Ltn'
|
|
9
|
-
| 'Zh-Ltn';
|
|
10
|
-
|
|
11
|
-
export const DISPLAY_LANGUAGES = [
|
|
12
|
-
'tibetan',
|
|
13
|
-
'english',
|
|
14
|
-
'wylie',
|
|
15
|
-
'sanskrit',
|
|
16
|
-
'chinese',
|
|
17
|
-
'japanese',
|
|
18
|
-
'mongolian',
|
|
19
|
-
'pali',
|
|
20
|
-
'pinyin',
|
|
21
|
-
] as const;
|
|
22
|
-
export type DisplayLanguage = (typeof DISPLAY_LANGUAGES)[number];
|
|
23
|
-
|
|
24
|
-
export const LANGUAGE_MAP: Record<
|
|
25
|
-
ExtendedTranslationLanguage,
|
|
26
|
-
DisplayLanguage
|
|
27
|
-
> = {
|
|
28
|
-
bo: 'tibetan',
|
|
29
|
-
en: 'english',
|
|
30
|
-
'Bo-Ltn': 'tibetan',
|
|
31
|
-
'Sa-Ltn': 'sanskrit',
|
|
32
|
-
zh: 'chinese',
|
|
33
|
-
ja: 'japanese',
|
|
34
|
-
'Mt-Ltn': 'mongolian',
|
|
35
|
-
'Pi-Ltn': 'pali',
|
|
36
|
-
'Zh-Ltn': 'pinyin',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const REVERSE_LANGUAGE_MAP: Record<
|
|
40
|
-
DisplayLanguage,
|
|
41
|
-
ExtendedTranslationLanguage
|
|
42
|
-
> = {
|
|
43
|
-
tibetan: 'bo',
|
|
44
|
-
english: 'en',
|
|
45
|
-
wylie: 'Bo-Ltn',
|
|
46
|
-
sanskrit: 'Sa-Ltn',
|
|
47
|
-
chinese: 'zh',
|
|
48
|
-
japanese: 'ja',
|
|
49
|
-
mongolian: 'Mt-Ltn',
|
|
50
|
-
pinyin: 'Zh-Ltn',
|
|
51
|
-
pali: 'Pi-Ltn',
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const displayLanguageForTranslationLanguage = (
|
|
55
|
-
language: ExtendedTranslationLanguage,
|
|
56
|
-
): DisplayLanguage => {
|
|
57
|
-
return LANGUAGE_MAP[language];
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const translationLanguageForDisplayLanguage = (
|
|
61
|
-
language: DisplayLanguage,
|
|
62
|
-
): ExtendedTranslationLanguage => {
|
|
63
|
-
return REVERSE_LANGUAGE_MAP[language];
|
|
64
|
-
};
|
package/src/lib/types/layout.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { BodyItemType } from './passage';
|
|
2
|
-
|
|
3
|
-
export type PanelContentType =
|
|
4
|
-
| BodyItemType
|
|
5
|
-
| 'glossary'
|
|
6
|
-
| 'bibliography'
|
|
7
|
-
| 'source';
|
|
8
|
-
|
|
9
|
-
// NOTE: default to 'translation' (or 'compare') for content types not listed here
|
|
10
|
-
export const TAB_FOR_CONTENT_SECTION: Partial<
|
|
11
|
-
Record<PanelContentType, string>
|
|
12
|
-
> = {
|
|
13
|
-
abbreviations: 'abbreviations',
|
|
14
|
-
acknowledgment: 'front',
|
|
15
|
-
bibliography: 'bibliography',
|
|
16
|
-
glossary: 'glossary',
|
|
17
|
-
endnotes: 'endnotes',
|
|
18
|
-
introduction: 'front',
|
|
19
|
-
summary: 'front',
|
|
20
|
-
} as const;
|
|
21
|
-
|
|
22
|
-
// NOTE: default to 'main' for content types not listed here
|
|
23
|
-
export const PANEL_FOR_CONTENT_SECTION: Partial<
|
|
24
|
-
Record<PanelContentType, string>
|
|
25
|
-
> = {
|
|
26
|
-
abbreviations: 'right',
|
|
27
|
-
bibliography: 'right',
|
|
28
|
-
endnotes: 'right',
|
|
29
|
-
glossary: 'right',
|
|
30
|
-
source: 'main',
|
|
31
|
-
} as const;
|
|
32
|
-
|
|
33
|
-
// Support different tabs for some content
|
|
34
|
-
export const VARIANT_TABS_FOR_TAB: Partial<Record<PanelContentType, string[]>> =
|
|
35
|
-
{
|
|
36
|
-
translation: ['compare'],
|
|
37
|
-
} as const;
|
package/src/lib/types/library.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export const LIBRARY_ITEMS = [
|
|
2
|
-
'publications',
|
|
3
|
-
'passages',
|
|
4
|
-
'glossaries',
|
|
5
|
-
'bibliographies',
|
|
6
|
-
'searches',
|
|
7
|
-
] as const;
|
|
8
|
-
|
|
9
|
-
export type LibraryItemType = (typeof LIBRARY_ITEMS)[number];
|
|
10
|
-
|
|
11
|
-
export type UserLibraryItem = {
|
|
12
|
-
uuid: string;
|
|
13
|
-
type: LibraryItemType;
|
|
14
|
-
createdAt: string;
|
|
15
|
-
featured: boolean;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type UserPassageWork = {
|
|
19
|
-
uuid: string;
|
|
20
|
-
toh: string;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type UserPassageItem = {
|
|
24
|
-
uuid: string;
|
|
25
|
-
toh: string;
|
|
26
|
-
label: string;
|
|
27
|
-
content: string;
|
|
28
|
-
work: UserPassageWork;
|
|
29
|
-
};
|