@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/passage.ts
DELETED
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { Alignment, AlignmentDTO, alignmentsFromDTO } from './alignment';
|
|
2
|
-
import {
|
|
3
|
-
Annotations,
|
|
4
|
-
AnnotationsDTO,
|
|
5
|
-
annotationsFromDTO,
|
|
6
|
-
annotationsToDTO,
|
|
7
|
-
} from './annotation';
|
|
8
|
-
import { TohokuCatalogEntry } from './toh';
|
|
9
|
-
|
|
10
|
-
export const BODY_ITEM_TYPES = [
|
|
11
|
-
'abbreviations',
|
|
12
|
-
'abbreviationsHeader',
|
|
13
|
-
'acknowledgment',
|
|
14
|
-
'acknowledgmentHeader',
|
|
15
|
-
'appendix',
|
|
16
|
-
'appendixHeader',
|
|
17
|
-
'colophon',
|
|
18
|
-
'colophonHeader',
|
|
19
|
-
'endnotes',
|
|
20
|
-
'endnotesHeader',
|
|
21
|
-
'homage',
|
|
22
|
-
'homageHeader',
|
|
23
|
-
'introduction',
|
|
24
|
-
'introductionHeader',
|
|
25
|
-
'prelude',
|
|
26
|
-
'preludeHeader',
|
|
27
|
-
'prologue',
|
|
28
|
-
'prologueHeader',
|
|
29
|
-
'summary',
|
|
30
|
-
'summaryHeader',
|
|
31
|
-
'translation',
|
|
32
|
-
'translationHeader',
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
export type BodyItemType = (typeof BODY_ITEM_TYPES)[number] | 'unknown';
|
|
36
|
-
|
|
37
|
-
export const FRONT_MATTER: BodyItemType[] = [
|
|
38
|
-
'acknowledgment',
|
|
39
|
-
'summary',
|
|
40
|
-
'introduction',
|
|
41
|
-
];
|
|
42
|
-
export const FRONT_MATTER_FILTER = `(${FRONT_MATTER.join('|')})`;
|
|
43
|
-
export const BODY_MATTER: BodyItemType[] = [
|
|
44
|
-
'prelude',
|
|
45
|
-
'prologue',
|
|
46
|
-
'translation',
|
|
47
|
-
'appendix',
|
|
48
|
-
'colophon',
|
|
49
|
-
'homage',
|
|
50
|
-
];
|
|
51
|
-
export const BODY_MATTER_FILTER = `(${BODY_MATTER.join('|')})`;
|
|
52
|
-
export const BACK_MATTER: BodyItemType[] = ['abbreviations', 'endnotes'];
|
|
53
|
-
export const BACK_MATTER_FILTER = `(${BACK_MATTER.join('|')})`;
|
|
54
|
-
export const COMPARE_MODE = BODY_MATTER;
|
|
55
|
-
export const COMPARE_MODE_FILTER = `(${COMPARE_MODE.join('|')})`;
|
|
56
|
-
|
|
57
|
-
export const PANEL_FILTERS = [
|
|
58
|
-
FRONT_MATTER_FILTER,
|
|
59
|
-
BODY_MATTER_FILTER,
|
|
60
|
-
BACK_MATTER_FILTER,
|
|
61
|
-
COMPARE_MODE_FILTER,
|
|
62
|
-
] as const;
|
|
63
|
-
|
|
64
|
-
export type PanelFilter = (typeof PANEL_FILTERS)[number];
|
|
65
|
-
|
|
66
|
-
export type Passage = {
|
|
67
|
-
alignments?: Alignment[];
|
|
68
|
-
annotations: Annotations;
|
|
69
|
-
content: string;
|
|
70
|
-
label: string;
|
|
71
|
-
sort: number;
|
|
72
|
-
type: BodyItemType;
|
|
73
|
-
uuid: string;
|
|
74
|
-
workUuid: string;
|
|
75
|
-
xmlId?: string;
|
|
76
|
-
parent?: string;
|
|
77
|
-
toh?: TohokuCatalogEntry;
|
|
78
|
-
references?: Passages;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export type Passages = Passage[];
|
|
82
|
-
|
|
83
|
-
export type PassageRowDTO = {
|
|
84
|
-
content: string;
|
|
85
|
-
label: string;
|
|
86
|
-
sort: number;
|
|
87
|
-
type: BodyItemType;
|
|
88
|
-
uuid: string;
|
|
89
|
-
work_uuid: string;
|
|
90
|
-
xmlId?: string;
|
|
91
|
-
parent?: string;
|
|
92
|
-
toh?: TohokuCatalogEntry;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
export type PassageDTO = PassageRowDTO & {
|
|
96
|
-
alignments?: AlignmentDTO[];
|
|
97
|
-
annotations?: AnnotationsDTO | null;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export type PaginationDirection = 'forward' | 'backward';
|
|
101
|
-
|
|
102
|
-
export type PassagesPageDTO = {
|
|
103
|
-
passages: PassageDTO[];
|
|
104
|
-
nextCursor?: string;
|
|
105
|
-
hasMore: boolean;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export type PassagesPageAroundDTO = {
|
|
109
|
-
passages: PassageDTO[];
|
|
110
|
-
prevCursor?: string;
|
|
111
|
-
nextCursor?: string;
|
|
112
|
-
hasMoreBefore: boolean;
|
|
113
|
-
hasMoreAfter: boolean;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export type PassagesPage = {
|
|
117
|
-
passages: Passage[];
|
|
118
|
-
prevCursor?: string;
|
|
119
|
-
nextCursor?: string;
|
|
120
|
-
hasMoreAfter: boolean;
|
|
121
|
-
hasMoreBefore: boolean;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export const passageFromDTO = (
|
|
125
|
-
dto: PassageDTO,
|
|
126
|
-
annotations: Annotations = [],
|
|
127
|
-
alignments: Alignment[] = [],
|
|
128
|
-
): Passage => {
|
|
129
|
-
return {
|
|
130
|
-
content: dto.content,
|
|
131
|
-
label: dto.label,
|
|
132
|
-
sort: dto.sort,
|
|
133
|
-
type: dto.type,
|
|
134
|
-
uuid: dto.uuid,
|
|
135
|
-
workUuid: dto.work_uuid,
|
|
136
|
-
xmlId: dto.xmlId,
|
|
137
|
-
parent: dto.parent,
|
|
138
|
-
toh: dto.toh,
|
|
139
|
-
alignments,
|
|
140
|
-
annotations,
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
export const passagesFromDTO = (dto: PassageDTO[]): Passage[] => {
|
|
145
|
-
return dto.map((p) =>
|
|
146
|
-
passageFromDTO(
|
|
147
|
-
p,
|
|
148
|
-
annotationsFromDTO(p.annotations || [], p.content.length),
|
|
149
|
-
alignmentsFromDTO(p.alignments || []),
|
|
150
|
-
),
|
|
151
|
-
);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
export const passageToRowDTO = (passage: Passage): PassageRowDTO => {
|
|
155
|
-
const dto: PassageRowDTO = {
|
|
156
|
-
content: passage.content,
|
|
157
|
-
label: passage.label,
|
|
158
|
-
sort: passage.sort,
|
|
159
|
-
type: passage.type,
|
|
160
|
-
uuid: passage.uuid,
|
|
161
|
-
work_uuid: passage.workUuid,
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
// NOTE: only include xmlId and parent if they exist, otherwise an upsert
|
|
165
|
-
// will set them to null in the database.
|
|
166
|
-
if (passage.xmlId) {
|
|
167
|
-
dto.xmlId = passage.xmlId;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if (passage.parent) {
|
|
171
|
-
dto.parent = passage.parent;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (passage.toh) {
|
|
175
|
-
dto.toh = passage.toh;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return dto;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
export const passageToDTO = (passage: Passage): PassageDTO => {
|
|
182
|
-
// NOTE: ignore alignments
|
|
183
|
-
return {
|
|
184
|
-
...passageToRowDTO(passage),
|
|
185
|
-
annotations: annotationsToDTO(passage.annotations) || [],
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
export const passagesToDTO = (passages: Passage[]): PassageDTO[] => {
|
|
190
|
-
return passages.map(passageToDTO);
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
export const passagesToRowDTO = (passages: Passage[]): PassageRowDTO[] => {
|
|
194
|
-
return passages.map(passageToRowDTO);
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
export const passagesPageFromDTO = (
|
|
198
|
-
direction: PaginationDirection,
|
|
199
|
-
dto: PassagesPageDTO,
|
|
200
|
-
): PassagesPage => {
|
|
201
|
-
return {
|
|
202
|
-
passages: passagesFromDTO(dto.passages),
|
|
203
|
-
nextCursor: direction === 'forward' ? dto.nextCursor : undefined,
|
|
204
|
-
prevCursor: direction === 'backward' ? dto.nextCursor : undefined,
|
|
205
|
-
hasMoreAfter: direction === 'forward' && dto.hasMore,
|
|
206
|
-
hasMoreBefore: direction === 'backward' && dto.hasMore,
|
|
207
|
-
};
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export const passagesPageAroundFromDTO = (
|
|
211
|
-
dto: PassagesPageAroundDTO,
|
|
212
|
-
): PassagesPage => {
|
|
213
|
-
return {
|
|
214
|
-
passages: passagesFromDTO(dto.passages),
|
|
215
|
-
nextCursor: dto.nextCursor,
|
|
216
|
-
prevCursor: dto.prevCursor,
|
|
217
|
-
hasMoreAfter: dto.hasMoreAfter,
|
|
218
|
-
hasMoreBefore: dto.hasMoreBefore,
|
|
219
|
-
};
|
|
220
|
-
};
|
package/src/lib/types/title.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { ExtendedTranslationLanguage } from './language';
|
|
2
|
-
|
|
3
|
-
export const TITLE_TYPES = [
|
|
4
|
-
'toh',
|
|
5
|
-
'mainTitle',
|
|
6
|
-
'mainTitleOutsideCatalogueSection',
|
|
7
|
-
'longTitle',
|
|
8
|
-
'otherTitle',
|
|
9
|
-
'shortcode',
|
|
10
|
-
] as const;
|
|
11
|
-
|
|
12
|
-
export const BO_TITLE_PREFIX = '༄༅།\u00a0\u00a0།' as const;
|
|
13
|
-
|
|
14
|
-
export type TitleType = (typeof TITLE_TYPES)[number];
|
|
15
|
-
|
|
16
|
-
export type TitleTypeDTO = `eft:${TitleType}`;
|
|
17
|
-
|
|
18
|
-
export type Title = {
|
|
19
|
-
uuid: string;
|
|
20
|
-
title: string;
|
|
21
|
-
language: ExtendedTranslationLanguage;
|
|
22
|
-
type: TitleType;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export type Titles = Title[];
|
|
26
|
-
|
|
27
|
-
export type TitleDTO = {
|
|
28
|
-
uuid: string;
|
|
29
|
-
title: string;
|
|
30
|
-
language: ExtendedTranslationLanguage;
|
|
31
|
-
type: TitleTypeDTO;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type TitlesDTO = TitleDTO[];
|
|
35
|
-
|
|
36
|
-
export const titleFromDTO = (dto: TitleDTO): Title => {
|
|
37
|
-
return {
|
|
38
|
-
uuid: dto.uuid,
|
|
39
|
-
title: dto.title,
|
|
40
|
-
language: dto.language,
|
|
41
|
-
type: (dto.type?.replace('eft:', '') as TitleType) || 'mainTitle',
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const titlesFromDTO = (dto?: TitlesDTO): Titles => {
|
|
46
|
-
return dto?.map(titleFromDTO) || [];
|
|
47
|
-
};
|
package/src/lib/types/work.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { TohokuCatalogEntry } from './toh';
|
|
2
|
-
import { SemVer } from './semver';
|
|
3
|
-
|
|
4
|
-
export type Work = {
|
|
5
|
-
uuid: string;
|
|
6
|
-
title: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
toh: TohokuCatalogEntry[];
|
|
9
|
-
publicationDate?: Date;
|
|
10
|
-
publicationVersion: SemVer;
|
|
11
|
-
pages: number;
|
|
12
|
-
restriction: boolean;
|
|
13
|
-
section: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type WorkDTO = {
|
|
17
|
-
uuid: string;
|
|
18
|
-
title?: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
tohs: { toh: TohokuCatalogEntry }[];
|
|
21
|
-
publicationDate: string;
|
|
22
|
-
publicationVersion: string;
|
|
23
|
-
pages: number;
|
|
24
|
-
restriction: boolean;
|
|
25
|
-
breadcrumb?: string;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const workFromDTO = (dto: WorkDTO) => ({
|
|
29
|
-
uuid: dto.uuid,
|
|
30
|
-
title: dto.title || '<Untitled>',
|
|
31
|
-
description: dto.description || '',
|
|
32
|
-
toh: dto.tohs.map((t) => t.toh) as TohokuCatalogEntry[],
|
|
33
|
-
publicationDate: dto.publicationDate ? new Date(dto.publicationDate) : undefined,
|
|
34
|
-
publicationVersion: (dto.publicationVersion || '0.0.0') as SemVer,
|
|
35
|
-
pages: dto.pages || 0,
|
|
36
|
-
restriction: dto.restriction,
|
|
37
|
-
section: dto.breadcrumb?.split('>').at(-2)?.trim() || '',
|
|
38
|
-
});
|
package/src/lib/use-bookmark.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useCallback, useSyncExternalStore } from 'react';
|
|
4
|
-
import { addBookmark, isBookmarked, removeBookmark } from './local-storage';
|
|
5
|
-
|
|
6
|
-
type BookmarkOptions = {
|
|
7
|
-
type: string;
|
|
8
|
-
subType?: string;
|
|
9
|
-
tab: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const listeners = new Set<() => void>();
|
|
13
|
-
|
|
14
|
-
function subscribe(callback: () => void) {
|
|
15
|
-
listeners.add(callback);
|
|
16
|
-
return () => listeners.delete(callback);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function emitChange() {
|
|
20
|
-
listeners.forEach((l) => l());
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function useBookmark(uuid: string, options?: BookmarkOptions) {
|
|
24
|
-
const bookmarked = useSyncExternalStore(
|
|
25
|
-
subscribe,
|
|
26
|
-
() => isBookmarked(uuid),
|
|
27
|
-
() => false,
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
const toggle = useCallback(() => {
|
|
31
|
-
if (isBookmarked(uuid)) {
|
|
32
|
-
removeBookmark(uuid);
|
|
33
|
-
} else {
|
|
34
|
-
addBookmark({
|
|
35
|
-
uuid,
|
|
36
|
-
type: options?.type ?? '',
|
|
37
|
-
subType: options?.subType,
|
|
38
|
-
tab: options?.tab ?? '',
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
emitChange();
|
|
42
|
-
}, [uuid, options?.type, options?.subType, options?.tab]);
|
|
43
|
-
|
|
44
|
-
return { isBookmarked: bookmarked, toggle };
|
|
45
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"jsx": "react-jsx",
|
|
4
|
-
"allowJs": false,
|
|
5
|
-
"esModuleInterop": false,
|
|
6
|
-
"allowSyntheticDefaultImports": true,
|
|
7
|
-
"strict": true
|
|
8
|
-
},
|
|
9
|
-
"files": [],
|
|
10
|
-
"include": [],
|
|
11
|
-
"references": [
|
|
12
|
-
{
|
|
13
|
-
"path": "./tsconfig.lib.json"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"path": "./tsconfig.spec.json"
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
"extends": "../../tsconfig.base.json"
|
|
20
|
-
}
|
package/tsconfig.lib.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"types": [
|
|
7
|
-
"node",
|
|
8
|
-
"@nx/react/typings/cssmodule.d.ts",
|
|
9
|
-
"@nx/react/typings/image.d.ts",
|
|
10
|
-
"next",
|
|
11
|
-
"@nx/next/typings/image.d.ts"
|
|
12
|
-
]
|
|
13
|
-
},
|
|
14
|
-
"exclude": [
|
|
15
|
-
"jest.config.ts",
|
|
16
|
-
"src/**/*.spec.ts",
|
|
17
|
-
"src/**/*.test.ts",
|
|
18
|
-
"src/**/*.spec.tsx",
|
|
19
|
-
"src/**/*.test.tsx",
|
|
20
|
-
"src/**/*.spec.js",
|
|
21
|
-
"src/**/*.test.js",
|
|
22
|
-
"src/**/*.spec.jsx",
|
|
23
|
-
"src/**/*.test.jsx"
|
|
24
|
-
],
|
|
25
|
-
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
26
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"moduleResolution": "node10",
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"types": ["jest", "node"]
|
|
9
|
-
},
|
|
10
|
-
"include": [
|
|
11
|
-
"jest.config.ts",
|
|
12
|
-
"src/**/*.test.ts",
|
|
13
|
-
"src/**/*.spec.ts",
|
|
14
|
-
"src/**/*.test.tsx",
|
|
15
|
-
"src/**/*.spec.tsx",
|
|
16
|
-
"src/**/*.test.js",
|
|
17
|
-
"src/**/*.spec.js",
|
|
18
|
-
"src/**/*.test.jsx",
|
|
19
|
-
"src/**/*.spec.jsx",
|
|
20
|
-
"src/**/*.d.ts"
|
|
21
|
-
]
|
|
22
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{src/ssr.ts → ssr.d.ts}
RENAMED
|
File without changes
|