@eightyfourthousand/data-access 2026.3.1 → 2026.4.0
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/package.json +1 -1
- package/src/index.ts +1 -2
- package/src/lib/folio.ts +23 -9
- package/src/lib/glossary/batch.ts +35 -0
- package/src/lib/glossary/index.ts +4 -0
- package/src/lib/glossary/instance.ts +54 -0
- package/src/lib/glossary/landing.ts +50 -0
- package/src/lib/glossary/pagination.ts +471 -0
- package/src/lib/passage/batch.ts +229 -0
- package/src/lib/passage/index.ts +5 -0
- package/src/lib/passage/pagination.ts +277 -0
- package/src/lib/passage/read.ts +100 -0
- package/src/lib/passage/replace-persistence.ts +153 -0
- package/src/lib/passage/save.ts +324 -0
- package/src/lib/publications.ts +168 -0
- package/src/lib/replace.spec.ts +154 -0
- package/src/lib/replace.ts +244 -0
- package/src/lib/types/folio.ts +2 -2
- package/src/lib/types/glossary-page.ts +0 -118
- package/src/lib/types/glossary.ts +3 -2
- package/src/lib/types/index.ts +0 -3
- package/src/lib/canon.ts +0 -111
- package/src/lib/glossary.ts +0 -147
- package/src/lib/passage.ts +0 -122
- package/src/lib/projects.ts +0 -107
- package/src/lib/types/canon.ts +0 -148
- package/src/lib/types/contributor.ts +0 -84
- package/src/lib/types/project.ts +0 -200
package/src/lib/types/project.ts
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { SemVer } from './semver';
|
|
2
|
-
|
|
3
|
-
export const PROJECT_STAGE_LABELS = [
|
|
4
|
-
'1',
|
|
5
|
-
'1.a',
|
|
6
|
-
'2',
|
|
7
|
-
'2.a',
|
|
8
|
-
'2.b',
|
|
9
|
-
'2.c',
|
|
10
|
-
'2.d',
|
|
11
|
-
'2.e',
|
|
12
|
-
'2.f',
|
|
13
|
-
'2.g',
|
|
14
|
-
'2.h',
|
|
15
|
-
'3',
|
|
16
|
-
'4',
|
|
17
|
-
'0',
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
export const STAGE_DESCRIPTIONS: Record<ProjectStageLabel, string> = {
|
|
21
|
-
'1': 'Published and in app',
|
|
22
|
-
'1.a': 'Published',
|
|
23
|
-
'2': 'Marked up and awaiting final proofing',
|
|
24
|
-
'2.a': 'Markup in progress',
|
|
25
|
-
'2.b': 'Awaiting markup',
|
|
26
|
-
'2.c': "Awaiting editor's OK form markup",
|
|
27
|
-
'2.d': 'Copy editing complete',
|
|
28
|
-
'2.e': 'Copy editing in progress',
|
|
29
|
-
'2.f': 'Review complete',
|
|
30
|
-
'2.g': 'In editorial review',
|
|
31
|
-
'2.h': 'Awaiting editorial review',
|
|
32
|
-
'3': 'In translation',
|
|
33
|
-
'4': 'Application pending',
|
|
34
|
-
'0': 'Not started',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const STAGE_COLORS: Record<ProjectStageLabel, string> = {
|
|
38
|
-
'1': 'emerald',
|
|
39
|
-
'1.a': 'emerald',
|
|
40
|
-
'2': 'ochre',
|
|
41
|
-
'2.a': 'ochre',
|
|
42
|
-
'2.b': 'ochre',
|
|
43
|
-
'2.c': 'ochre',
|
|
44
|
-
'2.d': 'ochre',
|
|
45
|
-
'2.e': 'ochre',
|
|
46
|
-
'2.f': 'ochre',
|
|
47
|
-
'2.g': 'ochre',
|
|
48
|
-
'2.h': 'ochre',
|
|
49
|
-
'3': 'navy',
|
|
50
|
-
'4': 'brick',
|
|
51
|
-
'0': 'muted text-muted-foreground',
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const CANON_TYPES = ['kangyur', 'tengyur'];
|
|
55
|
-
|
|
56
|
-
export type ProjectStageLabel = (typeof PROJECT_STAGE_LABELS)[number];
|
|
57
|
-
|
|
58
|
-
export type CanonType = (typeof CANON_TYPES)[number];
|
|
59
|
-
|
|
60
|
-
export type ProjectStage = {
|
|
61
|
-
label: ProjectStageLabel;
|
|
62
|
-
description: string;
|
|
63
|
-
date: Date;
|
|
64
|
-
targetDate?: Date;
|
|
65
|
-
color: string;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export type ProjectViewDTO = {
|
|
69
|
-
uuid: string;
|
|
70
|
-
toh: string;
|
|
71
|
-
title: string;
|
|
72
|
-
translator: string;
|
|
73
|
-
stage: ProjectStageLabel;
|
|
74
|
-
stage_date: string;
|
|
75
|
-
pages: number;
|
|
76
|
-
type?: string;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export type ProjectTableDTO = {
|
|
80
|
-
uuid: string;
|
|
81
|
-
notes: string;
|
|
82
|
-
contractDate: string;
|
|
83
|
-
contractId: string;
|
|
84
|
-
workUuid: string;
|
|
85
|
-
pages: number;
|
|
86
|
-
publicationDate: string;
|
|
87
|
-
version: string;
|
|
88
|
-
stage: ProjectStageLabel;
|
|
89
|
-
restriction: boolean;
|
|
90
|
-
title: string;
|
|
91
|
-
toh: string;
|
|
92
|
-
mainTranslator: string;
|
|
93
|
-
translationGroup: string;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export type Project = {
|
|
97
|
-
uuid: string;
|
|
98
|
-
toh: string;
|
|
99
|
-
title: string;
|
|
100
|
-
translator?: string;
|
|
101
|
-
translationGroup?: string;
|
|
102
|
-
stage: ProjectStage;
|
|
103
|
-
pages: number;
|
|
104
|
-
notes?: string;
|
|
105
|
-
contractDate?: Date;
|
|
106
|
-
contractId?: string;
|
|
107
|
-
workUuid?: string;
|
|
108
|
-
version?: SemVer;
|
|
109
|
-
canons?: string;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export type ProjectStageDetailsDTO = {
|
|
113
|
-
uuid: string;
|
|
114
|
-
stage: ProjectStageLabel;
|
|
115
|
-
stageDate: string;
|
|
116
|
-
targetDate?: string;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export type ProjectStageDetail = {
|
|
120
|
-
uuid: string;
|
|
121
|
-
stage: ProjectStage;
|
|
122
|
-
targetDate?: Date;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export type ProjectStageDetails = ProjectStageDetail[];
|
|
126
|
-
|
|
127
|
-
export type ProjectAssetDTO = {
|
|
128
|
-
uuid: string;
|
|
129
|
-
projectUuid: string;
|
|
130
|
-
stageUuid?: string;
|
|
131
|
-
filename: string;
|
|
132
|
-
url: string;
|
|
133
|
-
note?: string;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export type ProjectAsset = ProjectAssetDTO;
|
|
137
|
-
|
|
138
|
-
export function projectStageDetailFromDTO(
|
|
139
|
-
dto: ProjectStageDetailsDTO,
|
|
140
|
-
): ProjectStageDetail {
|
|
141
|
-
return {
|
|
142
|
-
uuid: dto.uuid,
|
|
143
|
-
stage: {
|
|
144
|
-
label: dto.stage,
|
|
145
|
-
description: STAGE_DESCRIPTIONS[dto.stage] || '',
|
|
146
|
-
date: new Date(dto.stageDate),
|
|
147
|
-
targetDate: dto.targetDate ? new Date(dto.targetDate) : undefined,
|
|
148
|
-
color: STAGE_COLORS[dto.stage] || 'grey',
|
|
149
|
-
},
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export function projectStageDetailsFromDTO(
|
|
154
|
-
dto?: ProjectStageDetailsDTO[],
|
|
155
|
-
): ProjectStageDetails {
|
|
156
|
-
return dto?.map(projectStageDetailFromDTO) || [];
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export function projectFromViewDTO(dto: ProjectViewDTO): Project {
|
|
160
|
-
return {
|
|
161
|
-
uuid: dto.uuid,
|
|
162
|
-
toh: dto.toh,
|
|
163
|
-
title: dto.title,
|
|
164
|
-
translator: dto.translator,
|
|
165
|
-
stage: {
|
|
166
|
-
label: dto.stage,
|
|
167
|
-
description: STAGE_DESCRIPTIONS[dto.stage] || '',
|
|
168
|
-
date: new Date(dto.stage_date),
|
|
169
|
-
color: STAGE_COLORS[dto.stage] || 'grey',
|
|
170
|
-
},
|
|
171
|
-
pages: dto.pages,
|
|
172
|
-
canons: dto.type,
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export function projectFromTableDTO(dto: ProjectTableDTO): Project {
|
|
177
|
-
const stage = dto.stage;
|
|
178
|
-
const contractDate = dto.contractDate
|
|
179
|
-
? new Date(dto.contractDate)
|
|
180
|
-
: undefined;
|
|
181
|
-
return {
|
|
182
|
-
uuid: dto.uuid,
|
|
183
|
-
toh: dto.toh,
|
|
184
|
-
title: dto.title,
|
|
185
|
-
stage: {
|
|
186
|
-
label: stage,
|
|
187
|
-
description: STAGE_DESCRIPTIONS[stage] || '',
|
|
188
|
-
date: new Date(dto.publicationDate),
|
|
189
|
-
color: STAGE_COLORS[stage] || 'grey',
|
|
190
|
-
},
|
|
191
|
-
pages: dto.pages,
|
|
192
|
-
notes: dto.notes,
|
|
193
|
-
contractId: dto.contractId,
|
|
194
|
-
contractDate,
|
|
195
|
-
workUuid: dto.workUuid,
|
|
196
|
-
version: dto.version as SemVer,
|
|
197
|
-
translator: dto.mainTranslator,
|
|
198
|
-
translationGroup: dto.translationGroup,
|
|
199
|
-
};
|
|
200
|
-
}
|