@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
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type LinkAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (dto): LinkAnnotation => {
|
|
11
|
-
const linkAnnotation = baseAnnotationFromDTO(dto) as LinkAnnotation;
|
|
12
|
-
dto.content.forEach((content) => {
|
|
13
|
-
if (content.title) {
|
|
14
|
-
linkAnnotation.text = content.title as string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (content.href) {
|
|
18
|
-
linkAnnotation.href = content.href as string;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return linkAnnotation;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
26
|
-
const { href, text } = annotation as LinkAnnotation;
|
|
27
|
-
const dto = baseAnnotationToDto(annotation);
|
|
28
|
-
dto.content.push({
|
|
29
|
-
href,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
if (text) {
|
|
33
|
-
dto.content.push({
|
|
34
|
-
title: text,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return dto;
|
|
38
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type ListItemAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (dto): ListItemAnnotation => {
|
|
11
|
-
return baseAnnotationFromDTO(dto) as ListItemAnnotation;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
15
|
-
return baseAnnotationToDto(annotation);
|
|
16
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type ListAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (dto): ListAnnotation => {
|
|
11
|
-
const listAnnotation = baseAnnotationFromDTO(dto) as ListAnnotation;
|
|
12
|
-
dto.content.forEach((content) => {
|
|
13
|
-
if (content['list-spacing']) {
|
|
14
|
-
listAnnotation.spacing = content['list-spacing'] as string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (content['list-item-style']) {
|
|
18
|
-
listAnnotation.itemStyle = content['list-item-style'] as string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (content.nesting) {
|
|
22
|
-
listAnnotation.nesting = Number.parseInt(content.nesting as string);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return listAnnotation;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
30
|
-
const { spacing, nesting, itemStyle } = annotation as ListAnnotation;
|
|
31
|
-
const dto = baseAnnotationToDto(annotation);
|
|
32
|
-
if (spacing) {
|
|
33
|
-
dto.content.push({ 'list-spacing': spacing });
|
|
34
|
-
}
|
|
35
|
-
if (nesting) {
|
|
36
|
-
dto.content.push({ nesting });
|
|
37
|
-
}
|
|
38
|
-
if (itemStyle) {
|
|
39
|
-
dto.content.push({ 'list-item-style': itemStyle });
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return dto;
|
|
43
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type MantraAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
import type { ExtendedTranslationLanguage } from '../language';
|
|
10
|
-
|
|
11
|
-
export const transformer: AnnotationTransformer = (dto): MantraAnnotation => {
|
|
12
|
-
const mantraAnnotation = baseAnnotationFromDTO(dto) as MantraAnnotation;
|
|
13
|
-
dto.content.forEach((content) => {
|
|
14
|
-
if (content.lang) {
|
|
15
|
-
mantraAnnotation.lang = content.lang as ExtendedTranslationLanguage;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
return mantraAnnotation;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
22
|
-
const { lang } = annotation as MantraAnnotation;
|
|
23
|
-
const dto = baseAnnotationToDto(annotation);
|
|
24
|
-
|
|
25
|
-
if (lang) {
|
|
26
|
-
dto.content.push({
|
|
27
|
-
lang,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return dto;
|
|
31
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type MentionAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (
|
|
11
|
-
dto,
|
|
12
|
-
): MentionAnnotation => {
|
|
13
|
-
const mention = baseAnnotationFromDTO(dto) as MentionAnnotation;
|
|
14
|
-
dto.content.forEach((content) => {
|
|
15
|
-
if (content.uuid) {
|
|
16
|
-
mention.entity = content.uuid as string;
|
|
17
|
-
}
|
|
18
|
-
if (content.type) {
|
|
19
|
-
mention.linkType = content.type as string;
|
|
20
|
-
}
|
|
21
|
-
if (content.text) {
|
|
22
|
-
mention.text = content.text as string;
|
|
23
|
-
}
|
|
24
|
-
if (content.same_work !== undefined) {
|
|
25
|
-
mention.isSameWork = !!content.same_work;
|
|
26
|
-
}
|
|
27
|
-
if (content.subtype) {
|
|
28
|
-
mention.subtype = content.subtype as string;
|
|
29
|
-
}
|
|
30
|
-
if (content.toh) {
|
|
31
|
-
mention.linkToh = content.toh as string;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
return mention;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
39
|
-
const { entity, linkType, text, isSameWork, subtype, linkToh } =
|
|
40
|
-
annotation as MentionAnnotation;
|
|
41
|
-
const dto = baseAnnotationToDto(annotation);
|
|
42
|
-
|
|
43
|
-
if (entity) {
|
|
44
|
-
dto.content.push({ uuid: entity });
|
|
45
|
-
}
|
|
46
|
-
if (linkType) {
|
|
47
|
-
dto.content.push({ type: linkType });
|
|
48
|
-
}
|
|
49
|
-
// Persist custom override text, but NEVER persist displayText
|
|
50
|
-
if (text) {
|
|
51
|
-
dto.content.push({ text });
|
|
52
|
-
}
|
|
53
|
-
if (isSameWork !== undefined) {
|
|
54
|
-
dto.content.push({ same_work: isSameWork });
|
|
55
|
-
}
|
|
56
|
-
if (subtype) {
|
|
57
|
-
dto.content.push({ subtype });
|
|
58
|
-
}
|
|
59
|
-
if (linkToh) {
|
|
60
|
-
dto.content.push({ toh: linkToh });
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return dto;
|
|
64
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type ParagraphAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (
|
|
11
|
-
dto,
|
|
12
|
-
): ParagraphAnnotation => {
|
|
13
|
-
return baseAnnotationFromDTO(dto) as ParagraphAnnotation;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
17
|
-
return baseAnnotationToDto(annotation);
|
|
18
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type QuoteAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (dto): QuoteAnnotation => {
|
|
11
|
-
const quoteAnnotation = baseAnnotationFromDTO(dto) as QuoteAnnotation;
|
|
12
|
-
dto.content.forEach((content) => {
|
|
13
|
-
if (content.uuid) {
|
|
14
|
-
quoteAnnotation.quote = content.uuid as string;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
return quoteAnnotation;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
22
|
-
const { quote } = annotation as QuoteAnnotation;
|
|
23
|
-
const dto = baseAnnotationToDto(annotation);
|
|
24
|
-
if (quote) {
|
|
25
|
-
dto.content.push({
|
|
26
|
-
uuid: quote,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return dto;
|
|
30
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type QuotedAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (dto): QuotedAnnotation => {
|
|
11
|
-
const quotedAnnotation = baseAnnotationFromDTO(dto) as QuotedAnnotation;
|
|
12
|
-
dto.content.forEach((content) => {
|
|
13
|
-
if (content.uuid) {
|
|
14
|
-
quotedAnnotation.quote = content.uuid as string;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
return quotedAnnotation;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
22
|
-
const { quote } = annotation as QuotedAnnotation;
|
|
23
|
-
const dto = baseAnnotationToDto(annotation);
|
|
24
|
-
if (quote) {
|
|
25
|
-
dto.content.push({
|
|
26
|
-
uuid: quote,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return dto;
|
|
30
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type ReferenceAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (
|
|
11
|
-
dto,
|
|
12
|
-
): ReferenceAnnotation => {
|
|
13
|
-
return baseAnnotationFromDTO(dto) as ReferenceAnnotation;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
17
|
-
return baseAnnotationToDto(annotation);
|
|
18
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type SpanAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
import type { ExtendedTranslationLanguage } from '../language';
|
|
10
|
-
|
|
11
|
-
export const transformer: AnnotationTransformer = (dto): SpanAnnotation => {
|
|
12
|
-
const spanAnnotation = baseAnnotationFromDTO(dto) as SpanAnnotation;
|
|
13
|
-
dto.content.forEach((content) => {
|
|
14
|
-
if (content['text-style']) {
|
|
15
|
-
spanAnnotation.textStyle = content['text-style'] as string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (content.lang) {
|
|
19
|
-
spanAnnotation.lang = content.lang as ExtendedTranslationLanguage;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return spanAnnotation;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
26
|
-
const { textStyle, lang } = annotation as SpanAnnotation;
|
|
27
|
-
const dto = baseAnnotationToDto(annotation);
|
|
28
|
-
if (textStyle) {
|
|
29
|
-
dto.content.push({
|
|
30
|
-
'text-style': textStyle,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
if (lang) {
|
|
34
|
-
dto.content.push({
|
|
35
|
-
lang,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return dto;
|
|
39
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type TableBodyDataAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (
|
|
11
|
-
dto,
|
|
12
|
-
): TableBodyDataAnnotation => {
|
|
13
|
-
return baseAnnotationFromDTO(dto) as TableBodyDataAnnotation;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
17
|
-
return baseAnnotationToDto(annotation);
|
|
18
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type TableBodyHeaderAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (
|
|
11
|
-
dto,
|
|
12
|
-
): TableBodyHeaderAnnotation => {
|
|
13
|
-
return baseAnnotationFromDTO(dto) as TableBodyHeaderAnnotation;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
17
|
-
return baseAnnotationToDto(annotation);
|
|
18
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type TableBodyRowAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (
|
|
11
|
-
dto,
|
|
12
|
-
): TableBodyRowAnnotation => {
|
|
13
|
-
return baseAnnotationFromDTO(dto) as TableBodyRowAnnotation;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
17
|
-
return baseAnnotationToDto(annotation);
|
|
18
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type TableAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (dto): TableAnnotation => {
|
|
11
|
-
return baseAnnotationFromDTO(dto) as TableAnnotation;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
15
|
-
return baseAnnotationToDto(annotation);
|
|
16
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type TrailerAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (dto): TrailerAnnotation => {
|
|
11
|
-
return baseAnnotationFromDTO(dto) as TrailerAnnotation;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
15
|
-
return baseAnnotationToDto(annotation);
|
|
16
|
-
};
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
baseAnnotationFromDTO,
|
|
3
|
-
type UnknownAnnotation,
|
|
4
|
-
type Annotation,
|
|
5
|
-
type Annotations,
|
|
6
|
-
type AnnotationTransformer,
|
|
7
|
-
} from './annotation';
|
|
8
|
-
import type {
|
|
9
|
-
AnnotationDTO,
|
|
10
|
-
AnnotationsDTO,
|
|
11
|
-
AnnotationDTOType,
|
|
12
|
-
} from './annotation-type';
|
|
13
|
-
import { ANNOTATIONS_TO_IGNORE } from './annotation-type';
|
|
14
|
-
import { transformer as abbreviation } from './abbreviation';
|
|
15
|
-
import { transformer as audio } from './audio';
|
|
16
|
-
import { transformer as blockquote } from './blockquote';
|
|
17
|
-
import { transformer as code } from './code';
|
|
18
|
-
import { transformer as deprecated } from './deprecated';
|
|
19
|
-
import { transformer as endNoteLink } from './end-note-link';
|
|
20
|
-
import { transformer as glossaryInstance } from './glossary-instance';
|
|
21
|
-
import { transformer as hasAbbreviation } from './has-abbreviation';
|
|
22
|
-
import { transformer as heading } from './heading';
|
|
23
|
-
import { transformer as image } from './image';
|
|
24
|
-
import { transformer as indent } from './indent';
|
|
25
|
-
import { transformer as inlineTitle } from './inline-title';
|
|
26
|
-
import { transformer as internalLink } from './internal-link';
|
|
27
|
-
import { transformer as leadingSpace } from './leading-space';
|
|
28
|
-
import { transformer as line } from './line';
|
|
29
|
-
import { transformer as lineGroup } from './line-group';
|
|
30
|
-
import { transformer as link } from './link';
|
|
31
|
-
import { transformer as list } from './list';
|
|
32
|
-
import { transformer as listItem } from './list-item';
|
|
33
|
-
import { transformer as mantra } from './mantra';
|
|
34
|
-
import { transformer as mention } from './mention';
|
|
35
|
-
import { transformer as paragraph } from './paragraph';
|
|
36
|
-
import { transformer as quote } from './quote';
|
|
37
|
-
import { transformer as quoted } from './quoted';
|
|
38
|
-
import { transformer as reference } from './reference';
|
|
39
|
-
import { transformer as span } from './span';
|
|
40
|
-
import { transformer as trailer } from './trailer';
|
|
41
|
-
import { transformer as table } from './table';
|
|
42
|
-
import { transformer as tableBodyData } from './table-body-data';
|
|
43
|
-
import { transformer as tableBodyHeader } from './table-body-header';
|
|
44
|
-
import { transformer as tableBodyRow } from './table-body-row';
|
|
45
|
-
import { transformer as unknown } from './unknown';
|
|
46
|
-
import { annotationToDtoMap } from './export';
|
|
47
|
-
|
|
48
|
-
const dtoToAnnotationMap: Record<AnnotationDTOType, AnnotationTransformer> = {
|
|
49
|
-
abbreviation,
|
|
50
|
-
audio,
|
|
51
|
-
blockquote,
|
|
52
|
-
code,
|
|
53
|
-
'deprecated-internal-link': deprecated,
|
|
54
|
-
'end-note-link': endNoteLink,
|
|
55
|
-
'glossary-instance': glossaryInstance,
|
|
56
|
-
'has-abbreviation': hasAbbreviation,
|
|
57
|
-
heading,
|
|
58
|
-
image,
|
|
59
|
-
indent,
|
|
60
|
-
'inline-title': inlineTitle,
|
|
61
|
-
'internal-link': internalLink,
|
|
62
|
-
'leading-space': leadingSpace,
|
|
63
|
-
line,
|
|
64
|
-
'line-group': lineGroup,
|
|
65
|
-
link,
|
|
66
|
-
list,
|
|
67
|
-
'list-item': listItem,
|
|
68
|
-
mantra,
|
|
69
|
-
mention,
|
|
70
|
-
paragraph,
|
|
71
|
-
quote,
|
|
72
|
-
quoted,
|
|
73
|
-
reference,
|
|
74
|
-
span,
|
|
75
|
-
table,
|
|
76
|
-
'table-body-data': tableBodyData,
|
|
77
|
-
'table-body-header': tableBodyHeader,
|
|
78
|
-
'table-body-row': tableBodyRow,
|
|
79
|
-
trailer,
|
|
80
|
-
unknown,
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const annotationFromDTO = (
|
|
84
|
-
dto: AnnotationDTO,
|
|
85
|
-
passageLength: number,
|
|
86
|
-
): Annotation => {
|
|
87
|
-
const annotation = dtoToAnnotationMap[dto.type]?.(dto);
|
|
88
|
-
if (!annotation) {
|
|
89
|
-
console.warn(`Unknown annotation type: ${dto.type}`);
|
|
90
|
-
console.warn(dto);
|
|
91
|
-
return {
|
|
92
|
-
...baseAnnotationFromDTO(dto),
|
|
93
|
-
type: 'unknown',
|
|
94
|
-
} as UnknownAnnotation;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
annotation.start < 0 ||
|
|
99
|
-
annotation.start > passageLength ||
|
|
100
|
-
annotation.end < 0 ||
|
|
101
|
-
annotation.end > passageLength
|
|
102
|
-
) {
|
|
103
|
-
annotation.validated = false;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (!annotation.validated) {
|
|
107
|
-
console.warn(
|
|
108
|
-
`Invalid annotation range for annotation ${annotation.uuid} (${annotation.start}, ${annotation.end}) in passage of length ${passageLength}`,
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return annotation;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export const annotationsFromDTO = (
|
|
116
|
-
dto?: AnnotationsDTO,
|
|
117
|
-
passageLength?: number,
|
|
118
|
-
): Annotations => {
|
|
119
|
-
const filtered =
|
|
120
|
-
dto?.filter((a) => !ANNOTATIONS_TO_IGNORE.includes(a.type)) || [];
|
|
121
|
-
return filtered.map((a) => annotationFromDTO(a, passageLength || 0));
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export const annotationToDTO = (
|
|
125
|
-
annotation: Annotation,
|
|
126
|
-
): AnnotationDTO | undefined => {
|
|
127
|
-
const dto = annotationToDtoMap[annotation.type]?.(annotation);
|
|
128
|
-
if (!dto) {
|
|
129
|
-
console.warn(`Unknown annotation type: ${annotation.type}`);
|
|
130
|
-
console.warn(annotation);
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
return dto;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export const annotationsToDTO = (annotations: Annotations): AnnotationsDTO => {
|
|
137
|
-
return annotations
|
|
138
|
-
.map(annotationToDTO)
|
|
139
|
-
.filter((a): a is AnnotationDTO => a !== undefined);
|
|
140
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AnnotationDTO } from './annotation-type';
|
|
2
|
-
import {
|
|
3
|
-
type AnnotationExporter,
|
|
4
|
-
type AnnotationTransformer,
|
|
5
|
-
type UnknownAnnotation,
|
|
6
|
-
baseAnnotationFromDTO,
|
|
7
|
-
baseAnnotationToDto,
|
|
8
|
-
} from './annotation';
|
|
9
|
-
|
|
10
|
-
export const transformer: AnnotationTransformer = (dto): UnknownAnnotation => {
|
|
11
|
-
return baseAnnotationFromDTO(dto) as UnknownAnnotation;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const exporter: AnnotationExporter = (annotation): AnnotationDTO => {
|
|
15
|
-
return baseAnnotationToDto(annotation);
|
|
16
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
export type BibliographyItem = {
|
|
2
|
-
content?: string | null;
|
|
3
|
-
title: string;
|
|
4
|
-
uuid: string;
|
|
5
|
-
year: string;
|
|
6
|
-
publisher: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export type Bibliography = BibliographyItem[];
|
|
10
|
-
|
|
11
|
-
export type BibliographyItemDTO = {
|
|
12
|
-
content?: string | null;
|
|
13
|
-
title: string;
|
|
14
|
-
uuid: string;
|
|
15
|
-
year: string;
|
|
16
|
-
publisher: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type BibliographyDTO = BibliographyItemDTO[];
|
|
20
|
-
|
|
21
|
-
export const bibliographyItemFromDTO = (
|
|
22
|
-
dto: BibliographyItemDTO,
|
|
23
|
-
): BibliographyItem => {
|
|
24
|
-
return {
|
|
25
|
-
content: dto.content,
|
|
26
|
-
title: dto.title,
|
|
27
|
-
uuid: dto.uuid,
|
|
28
|
-
year: dto.year,
|
|
29
|
-
publisher: dto.publisher,
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type BibliographyEntryItemDTO = {
|
|
34
|
-
uuid: string;
|
|
35
|
-
bibl_html: string;
|
|
36
|
-
work_uuid?: string;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export type BibliographyEntryItem = {
|
|
40
|
-
uuid: string;
|
|
41
|
-
html: string;
|
|
42
|
-
workUuid?: string;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type BlibliographyEntryDTO = {
|
|
46
|
-
heading?: string;
|
|
47
|
-
entries: BibliographyEntryItemDTO[];
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export type BibliographyEntry = {
|
|
51
|
-
heading?: string;
|
|
52
|
-
entries: BibliographyEntryItem[];
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export type BibliographyEntriesDTO = BlibliographyEntryDTO[];
|
|
56
|
-
|
|
57
|
-
export type BibliographyEntries = BibliographyEntry[];
|
|
58
|
-
|
|
59
|
-
export const bibliographyEntryItemFromDTO = (
|
|
60
|
-
dto: BibliographyEntryItemDTO,
|
|
61
|
-
): BibliographyEntryItem => {
|
|
62
|
-
return {
|
|
63
|
-
uuid: dto.uuid,
|
|
64
|
-
html: dto.bibl_html,
|
|
65
|
-
workUuid: dto.work_uuid,
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const bibliographyEntryFromDTO = (
|
|
70
|
-
dto: BlibliographyEntryDTO,
|
|
71
|
-
): BibliographyEntry => {
|
|
72
|
-
return {
|
|
73
|
-
heading: dto.heading,
|
|
74
|
-
entries: dto.entries?.map(bibliographyEntryItemFromDTO) || [],
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export const bibliographyEntriesFromDTO = (
|
|
79
|
-
dtos: BibliographyEntriesDTO,
|
|
80
|
-
): BibliographyEntries => {
|
|
81
|
-
return dtos?.map(bibliographyEntryFromDTO) || [];
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const bibliographyFromDTO = (dto?: BibliographyDTO): Bibliography => {
|
|
85
|
-
return dto?.map(bibliographyItemFromDTO) || [];
|
|
86
|
-
};
|