@eightyfourthousand/data-access 2026.4.1 → 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/lib/auth.js +34 -35
- package/lib/auth.js.map +1 -1
- package/lib/bibliography.js +6 -7
- package/lib/bibliography.js.map +1 -1
- package/lib/client-ssr.js +4 -5
- package/lib/client-ssr.js.map +1 -1
- package/lib/feedback.js +37 -42
- package/lib/feedback.js.map +1 -1
- package/lib/folio.js +6 -7
- package/lib/folio.js.map +1 -1
- package/lib/glossary/batch.js +5 -7
- package/lib/glossary/batch.js.map +1 -1
- package/lib/glossary/instance.js +6 -7
- package/lib/glossary/instance.js.map +1 -1
- package/lib/glossary/landing.js +4 -5
- package/lib/glossary/landing.js.map +1 -1
- package/lib/glossary/pagination.js +24 -25
- package/lib/glossary/pagination.js.map +1 -1
- package/lib/imprint.js +6 -7
- package/lib/imprint.js.map +1 -1
- package/lib/library.js +23 -24
- package/lib/library.js.map +1 -1
- package/lib/local-storage.js +1 -1
- package/lib/local-storage.js.map +1 -1
- package/lib/lookup-entity.js +15 -16
- package/lib/lookup-entity.js.map +1 -1
- package/lib/passage/batch.js +21 -25
- package/lib/passage/batch.js.map +1 -1
- package/lib/passage/pagination.js +19 -22
- package/lib/passage/pagination.js.map +1 -1
- package/lib/passage/read.js +13 -15
- package/lib/passage/read.js.map +1 -1
- package/lib/passage/replace-persistence.js +13 -14
- package/lib/passage/replace-persistence.js.map +1 -1
- package/lib/passage/save.js +78 -82
- package/lib/passage/save.js.map +1 -1
- package/lib/proxy.js +38 -41
- package/lib/proxy.js.map +1 -1
- package/lib/publications.js +45 -48
- package/lib/publications.js.map +1 -1
- package/lib/replace.js +23 -6
- package/lib/replace.js.map +1 -1
- package/lib/storage.js +3 -4
- package/lib/storage.js.map +1 -1
- package/lib/types/annotation/heading.js +4 -1
- package/lib/types/annotation/heading.js.map +1 -1
- package/lib/types/annotation/transform.js +7 -6
- package/lib/types/annotation/transform.js.map +1 -1
- package/lib/types/bibliography.js +3 -4
- package/lib/types/bibliography.js.map +1 -1
- package/lib/types/glossary.js +2 -2
- package/lib/types/glossary.js.map +1 -1
- package/lib/types/imprint.js +11 -4
- package/lib/types/imprint.js.map +1 -1
- package/lib/types/passage.js +4 -1
- package/lib/types/passage.js.map +1 -1
- package/lib/types/title.js +2 -3
- package/lib/types/title.js.map +1 -1
- package/lib/types/work.js +11 -14
- package/lib/types/work.js.map +1 -1
- package/lib/use-bookmark.js +4 -5
- package/lib/use-bookmark.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { passageFromDTO } from '../types';
|
|
3
2
|
const DEFAULT_GLOSSARY_LIMIT = 50;
|
|
4
3
|
const MAX_GLOSSARY_LIMIT = 200;
|
|
@@ -24,7 +23,7 @@ function parseOffsetCursor(after) {
|
|
|
24
23
|
function parseCount(value) {
|
|
25
24
|
if (typeof value === 'number')
|
|
26
25
|
return value;
|
|
27
|
-
const parsed = Number.parseInt(value
|
|
26
|
+
const parsed = Number.parseInt(value ?? '', 10);
|
|
28
27
|
return Number.isFinite(parsed) ? parsed : 0;
|
|
29
28
|
}
|
|
30
29
|
function rowToGlossaryTermNode(row) {
|
|
@@ -46,10 +45,10 @@ function rowToGlossaryTermNode(row) {
|
|
|
46
45
|
},
|
|
47
46
|
};
|
|
48
47
|
}
|
|
49
|
-
export const getGlossaryTermPassagesPage =
|
|
50
|
-
const limit = Math.max(first
|
|
48
|
+
export const getGlossaryTermPassagesPage = async ({ client, uuid, first, after, }) => {
|
|
49
|
+
const limit = Math.max(first ?? DEFAULT_GLOSSARY_PASSAGES_LIMIT, 1);
|
|
51
50
|
const offset = parseOffsetCursor(after);
|
|
52
|
-
const { data: annotations, error: annotationsError } =
|
|
51
|
+
const { data: annotations, error: annotationsError } = await client
|
|
53
52
|
.from('passage_annotations')
|
|
54
53
|
.select('passage_uuid')
|
|
55
54
|
.eq('type', 'glossary-instance')
|
|
@@ -58,11 +57,11 @@ export const getGlossaryTermPassagesPage = (_a) => __awaiter(void 0, [_a], void
|
|
|
58
57
|
console.error('Error fetching glossary passage annotations:', annotationsError);
|
|
59
58
|
return { items: [], nextCursor: null, hasMore: false };
|
|
60
59
|
}
|
|
61
|
-
const passageUuids = (annotations
|
|
60
|
+
const passageUuids = (annotations ?? []).map((annotation) => annotation.passage_uuid);
|
|
62
61
|
if (passageUuids.length === 0) {
|
|
63
62
|
return { items: [], nextCursor: null, hasMore: false };
|
|
64
63
|
}
|
|
65
|
-
const { data: passages, error: passagesError } =
|
|
64
|
+
const { data: passages, error: passagesError } = await client
|
|
66
65
|
.from('passages')
|
|
67
66
|
.select('uuid, content, label, sort, type, xmlId, work_uuid, toh')
|
|
68
67
|
.in('uuid', passageUuids)
|
|
@@ -72,7 +71,7 @@ export const getGlossaryTermPassagesPage = (_a) => __awaiter(void 0, [_a], void
|
|
|
72
71
|
console.error('Error fetching glossary passages:', passagesError);
|
|
73
72
|
return { items: [], nextCursor: null, hasMore: false };
|
|
74
73
|
}
|
|
75
|
-
const rows = passages
|
|
74
|
+
const rows = passages ?? [];
|
|
76
75
|
const hasMore = rows.length > limit;
|
|
77
76
|
const items = hasMore ? rows.slice(0, limit) : rows;
|
|
78
77
|
return {
|
|
@@ -80,8 +79,8 @@ export const getGlossaryTermPassagesPage = (_a) => __awaiter(void 0, [_a], void
|
|
|
80
79
|
nextCursor: hasMore ? String(offset + limit) : null,
|
|
81
80
|
hasMore,
|
|
82
81
|
};
|
|
83
|
-
}
|
|
84
|
-
export const getWorkGlossaryTermsPage =
|
|
82
|
+
};
|
|
83
|
+
export const getWorkGlossaryTermsPage = async ({ client, workUuid, limit = DEFAULT_GLOSSARY_LIMIT, cursor, direction = 'FORWARD', withAttestations = false, }) => {
|
|
85
84
|
const clampedLimit = Math.min(Math.max(limit, 1), MAX_GLOSSARY_LIMIT);
|
|
86
85
|
if (direction === 'AROUND') {
|
|
87
86
|
return getWorkGlossaryTermsAround({
|
|
@@ -92,7 +91,7 @@ export const getWorkGlossaryTermsPage = (_a) => __awaiter(void 0, [_a], void 0,
|
|
|
92
91
|
withAttestations,
|
|
93
92
|
});
|
|
94
93
|
}
|
|
95
|
-
const [{ count, error: countError }, { data: cursorRows, error: cursorError },] =
|
|
94
|
+
const [{ count, error: countError }, { data: cursorRows, error: cursorError },] = await Promise.all([
|
|
96
95
|
client
|
|
97
96
|
.from('glossary_term_index')
|
|
98
97
|
.select('authority_uuid', { count: 'exact', head: true })
|
|
@@ -114,12 +113,12 @@ export const getWorkGlossaryTermsPage = (_a) => __awaiter(void 0, [_a], void 0,
|
|
|
114
113
|
console.error('Error fetching glossary cursor term:', cursorError);
|
|
115
114
|
return buildGlossaryTermConnection([], null, null, false, false, 0);
|
|
116
115
|
}
|
|
117
|
-
const totalCount = count
|
|
116
|
+
const totalCount = count ?? 0;
|
|
118
117
|
if (totalCount === 0) {
|
|
119
118
|
return buildGlossaryTermConnection([], null, null, false, false, 0);
|
|
120
119
|
}
|
|
121
120
|
const cursorRow = cursor
|
|
122
|
-
? (cursorRows
|
|
121
|
+
? (cursorRows ?? [])[0]
|
|
123
122
|
: undefined;
|
|
124
123
|
if (cursor && !cursorRow) {
|
|
125
124
|
return buildGlossaryTermConnection([], null, null, false, false, totalCount);
|
|
@@ -147,26 +146,26 @@ export const getWorkGlossaryTermsPage = (_a) => __awaiter(void 0, [_a], void 0,
|
|
|
147
146
|
: query.lt('term_number', cursorTermNumber);
|
|
148
147
|
}
|
|
149
148
|
const ascending = direction === 'FORWARD';
|
|
150
|
-
const { data, error } =
|
|
149
|
+
const { data, error } = await query
|
|
151
150
|
.order('term_number', { ascending })
|
|
152
151
|
.limit(clampedLimit);
|
|
153
152
|
if (error) {
|
|
154
153
|
console.error('Error fetching paginated glossary terms:', error);
|
|
155
154
|
return buildGlossaryTermConnection([], null, null, false, false, totalCount);
|
|
156
155
|
}
|
|
157
|
-
const pageRows = (data
|
|
156
|
+
const pageRows = (data ?? []);
|
|
158
157
|
const rows = ascending ? pageRows : [...pageRows].reverse();
|
|
159
158
|
if (rows.length === 0) {
|
|
160
159
|
return buildGlossaryTermConnection([], null, null, false, false, totalCount);
|
|
161
160
|
}
|
|
162
|
-
const nodes = rows.map((row) => rowToGlossaryTermNode(
|
|
161
|
+
const nodes = rows.map((row) => rowToGlossaryTermNode({ ...row, withAttestations }));
|
|
163
162
|
const firstRow = rows[0];
|
|
164
163
|
const lastRow = rows[rows.length - 1];
|
|
165
164
|
const hasMoreBefore = parseCount(firstRow.term_number) > 1;
|
|
166
165
|
const hasMoreAfter = parseCount(lastRow.term_number) < totalCount;
|
|
167
166
|
return buildGlossaryTermConnection(nodes, hasMoreAfter ? lastRow.authority_uuid : null, hasMoreBefore ? firstRow.authority_uuid : null, hasMoreAfter, hasMoreBefore, totalCount);
|
|
168
|
-
}
|
|
169
|
-
export const getWorkGlossaryTermsAround =
|
|
167
|
+
};
|
|
168
|
+
export const getWorkGlossaryTermsAround = async ({ client, workUuid, limit, cursor, withAttestations, }) => {
|
|
170
169
|
if (!cursor) {
|
|
171
170
|
return getWorkGlossaryTermsPage({
|
|
172
171
|
client,
|
|
@@ -177,7 +176,7 @@ export const getWorkGlossaryTermsAround = (_a) => __awaiter(void 0, [_a], void 0
|
|
|
177
176
|
withAttestations,
|
|
178
177
|
});
|
|
179
178
|
}
|
|
180
|
-
const [{ count, error: countError }, { data: cursorRows, error: cursorError },] =
|
|
179
|
+
const [{ count, error: countError }, { data: cursorRows, error: cursorError },] = await Promise.all([
|
|
181
180
|
client
|
|
182
181
|
.from('glossary_term_index')
|
|
183
182
|
.select('authority_uuid', { count: 'exact', head: true })
|
|
@@ -204,8 +203,8 @@ export const getWorkGlossaryTermsAround = (_a) => __awaiter(void 0, [_a], void 0
|
|
|
204
203
|
withAttestations,
|
|
205
204
|
});
|
|
206
205
|
}
|
|
207
|
-
const totalCount = count
|
|
208
|
-
const cursorRow = (cursorRows
|
|
206
|
+
const totalCount = count ?? 0;
|
|
207
|
+
const cursorRow = (cursorRows ?? [])[0];
|
|
209
208
|
if (!cursorRow) {
|
|
210
209
|
return getWorkGlossaryTermsPage({
|
|
211
210
|
client,
|
|
@@ -223,7 +222,7 @@ export const getWorkGlossaryTermsAround = (_a) => __awaiter(void 0, [_a], void 0
|
|
|
223
222
|
endTerm = totalCount;
|
|
224
223
|
startTerm = Math.max(1, endTerm - limit + 1);
|
|
225
224
|
}
|
|
226
|
-
const { data, error } =
|
|
225
|
+
const { data, error } = await client
|
|
227
226
|
.from('glossary_term_index')
|
|
228
227
|
.select(`glossary_uuid,
|
|
229
228
|
authority_uuid,
|
|
@@ -244,12 +243,12 @@ export const getWorkGlossaryTermsAround = (_a) => __awaiter(void 0, [_a], void 0
|
|
|
244
243
|
console.error('Error fetching glossary terms around cursor:', error);
|
|
245
244
|
return buildGlossaryTermConnection([], null, null, false, false, totalCount);
|
|
246
245
|
}
|
|
247
|
-
const rows = (data
|
|
248
|
-
const nodes = rows.map((row) => rowToGlossaryTermNode(
|
|
246
|
+
const rows = (data ?? []);
|
|
247
|
+
const nodes = rows.map((row) => rowToGlossaryTermNode({ ...row, withAttestations }));
|
|
249
248
|
const hasMoreBefore = startTerm > 1;
|
|
250
249
|
const hasMoreAfter = endTerm < totalCount;
|
|
251
250
|
const firstRow = rows[0];
|
|
252
251
|
const lastRow = rows[rows.length - 1];
|
|
253
252
|
return buildGlossaryTermConnection(nodes, hasMoreAfter && lastRow ? lastRow.authority_uuid : null, hasMoreBefore && firstRow ? firstRow.authority_uuid : null, hasMoreAfter, hasMoreBefore, totalCount);
|
|
254
|
-
}
|
|
253
|
+
};
|
|
255
254
|
//# sourceMappingURL=pagination.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../../../libs/data-access/src/lib/glossary/pagination.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../../../libs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AC"}
|
package/lib/imprint.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { imprintFromDTO, tocFromDTO } from './types';
|
|
3
|
-
export const getTranslationToc =
|
|
4
|
-
const { data, error } =
|
|
2
|
+
export const getTranslationToc = async ({ client, uuid, }) => {
|
|
3
|
+
const { data, error } = await client.rpc('get_work_toc', {
|
|
5
4
|
work_uuid_input: uuid,
|
|
6
5
|
});
|
|
7
6
|
if (error) {
|
|
@@ -9,9 +8,9 @@ export const getTranslationToc = (_a) => __awaiter(void 0, [_a], void 0, functio
|
|
|
9
8
|
return undefined;
|
|
10
9
|
}
|
|
11
10
|
return tocFromDTO(data || []);
|
|
12
|
-
}
|
|
13
|
-
export const getTranslationImprint =
|
|
14
|
-
const { data, error } =
|
|
11
|
+
};
|
|
12
|
+
export const getTranslationImprint = async ({ client, uuid, toh, }) => {
|
|
13
|
+
const { data, error } = await client.rpc('get_imprint', {
|
|
15
14
|
work_uuid: uuid,
|
|
16
15
|
toh,
|
|
17
16
|
});
|
|
@@ -20,5 +19,5 @@ export const getTranslationImprint = (_a) => __awaiter(void 0, [_a], void 0, fun
|
|
|
20
19
|
return undefined;
|
|
21
20
|
}
|
|
22
21
|
return imprintFromDTO(data);
|
|
23
|
-
}
|
|
22
|
+
};
|
|
24
23
|
//# sourceMappingURL=imprint.js.map
|
package/lib/imprint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imprint.js","sourceRoot":"","sources":["../../../../libs/data-access/src/lib/imprint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"imprint.js","sourceRoot":"","sources":["../../../../libs/data-access/src/lib/imprint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,cAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEjE,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,EACtC,MAAM,EACN,IAAI,GAIL,EAAE,EAAE;IACH,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE;QACvD,eAAe,EAAE,IAAI;KACtB,CAAC,CAAC;IAEH,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;QAC5C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EAAE,EAC1C,MAAM,EACN,IAAI,EACJ,GAAG,GAKJ,EAAE,EAAE;IACH,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE;QACtD,SAAS,EAAE,IAAI;QACf,GAAG;KACJ,CAAC,CAAC;IAEH,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QAChD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC"}
|
package/lib/library.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { error } = yield client
|
|
1
|
+
export const updateUserProfile = async ({ client, userId, avatar, name, username, subscriptions, }) => {
|
|
2
|
+
const { error } = await client
|
|
4
3
|
.from('user_profiles')
|
|
5
4
|
.update({
|
|
6
5
|
avatar_url: avatar,
|
|
@@ -15,9 +14,9 @@ export const updateUserProfile = (_a) => __awaiter(void 0, [_a], void 0, functio
|
|
|
15
14
|
return false;
|
|
16
15
|
}
|
|
17
16
|
return true;
|
|
18
|
-
}
|
|
19
|
-
export const getUserLibrary =
|
|
20
|
-
const { data, error } =
|
|
17
|
+
};
|
|
18
|
+
export const getUserLibrary = async ({ client, userId, }) => {
|
|
19
|
+
const { data, error } = await client
|
|
21
20
|
.from('user_libraries')
|
|
22
21
|
.select(`
|
|
23
22
|
uuid:entity_id::uuid,
|
|
@@ -31,9 +30,9 @@ export const getUserLibrary = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
31
30
|
return [];
|
|
32
31
|
}
|
|
33
32
|
return (data || []);
|
|
34
|
-
}
|
|
35
|
-
export const addUserLibraryItem =
|
|
36
|
-
const { error } =
|
|
33
|
+
};
|
|
34
|
+
export const addUserLibraryItem = async ({ client, userId, type, entityId, }) => {
|
|
35
|
+
const { error } = await client.from('user_libraries').insert({
|
|
37
36
|
user_id: userId,
|
|
38
37
|
entity_id: entityId,
|
|
39
38
|
entity_type: type,
|
|
@@ -44,9 +43,9 @@ export const addUserLibraryItem = (_a) => __awaiter(void 0, [_a], void 0, functi
|
|
|
44
43
|
return false;
|
|
45
44
|
}
|
|
46
45
|
return true;
|
|
47
|
-
}
|
|
48
|
-
export const removeUserLibraryItem =
|
|
49
|
-
const { error } =
|
|
46
|
+
};
|
|
47
|
+
export const removeUserLibraryItem = async ({ client, entityId, }) => {
|
|
48
|
+
const { error } = await client
|
|
50
49
|
.from('user_libraries')
|
|
51
50
|
.delete()
|
|
52
51
|
.eq('entity_id', entityId);
|
|
@@ -55,9 +54,9 @@ export const removeUserLibraryItem = (_a) => __awaiter(void 0, [_a], void 0, fun
|
|
|
55
54
|
return false;
|
|
56
55
|
}
|
|
57
56
|
return true;
|
|
58
|
-
}
|
|
59
|
-
export const getUserBibliographies =
|
|
60
|
-
const { data, error } =
|
|
57
|
+
};
|
|
58
|
+
export const getUserBibliographies = async ({ client, uuids, }) => {
|
|
59
|
+
const { data, error } = await client
|
|
61
60
|
.from('bibliographies')
|
|
62
61
|
.select(`
|
|
63
62
|
uuid::text,
|
|
@@ -70,9 +69,9 @@ export const getUserBibliographies = (_a) => __awaiter(void 0, [_a], void 0, fun
|
|
|
70
69
|
return [];
|
|
71
70
|
}
|
|
72
71
|
return data || [];
|
|
73
|
-
}
|
|
74
|
-
export const getUserPassages =
|
|
75
|
-
const { data, error } =
|
|
72
|
+
};
|
|
73
|
+
export const getUserPassages = async ({ client, uuids, }) => {
|
|
74
|
+
const { data, error } = await client
|
|
76
75
|
.from('passages')
|
|
77
76
|
.select(`
|
|
78
77
|
uuid::text,
|
|
@@ -91,9 +90,9 @@ export const getUserPassages = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
91
90
|
// NOTE: Supabase incorrectly infers `work` as an array. We have to jump
|
|
92
91
|
// though the hoop of casting to inknown first.
|
|
93
92
|
return (data || []);
|
|
94
|
-
}
|
|
95
|
-
export const getUserPublications =
|
|
96
|
-
const { data, error } =
|
|
93
|
+
};
|
|
94
|
+
export const getUserPublications = async ({ client, uuids, }) => {
|
|
95
|
+
const { data, error } = await client
|
|
97
96
|
.from('works')
|
|
98
97
|
.select(`
|
|
99
98
|
uuid::text,
|
|
@@ -110,10 +109,10 @@ export const getUserPublications = (_a) => __awaiter(void 0, [_a], void 0, funct
|
|
|
110
109
|
return [];
|
|
111
110
|
}
|
|
112
111
|
return data || [];
|
|
113
|
-
}
|
|
114
|
-
export const getUserSearches = (_) =>
|
|
112
|
+
};
|
|
113
|
+
export const getUserSearches = async (_) => {
|
|
115
114
|
// TODO: Support saving and retrieving user searches
|
|
116
115
|
console.warn('getUserSearches not implemented yet');
|
|
117
116
|
return [];
|
|
118
|
-
}
|
|
117
|
+
};
|
|
119
118
|
//# sourceMappingURL=library.js.map
|
package/lib/library.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.js","sourceRoot":"","sources":["../../../../libs/data-access/src/lib/library.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"library.js","sourceRoot":"","sources":["../../../../libs/data-access/src/lib/library.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,EACtC,MAAM,EACN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AAK,EAAE,GAAG,MAAM,MAAM;SACjC,IAAI,CAAC,UAAU,CAAC;SAChB,MAAM,CACL;;;;;;;;KAQD,CACA;SACA,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACrB,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,wEAAwE;IACxE,+CAA+C;IAC/C,OAAO,CAAC,IAAI,IAAI,EAAE,CAAiC,CAAC;AACtD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAAE,EACxC,MAAM,EACN,KAAK,GAIN,EAAE,EAAE;IACH,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM;SACjC,IAAI,CAAC,OAAO,CAAC;SACb,MAAM,CACL;;;;;;KAMD,CACA;SACA,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC;SACjC,EAAE,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;SACnC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAErB,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QAC1D,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,IAAI,IAAI,EAAE,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,CAGrC,EAAE,EAAE;IACH,oDAAoD;IACpD,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;IACpD,OAAO,EAAqD,CAAC;AAC/D,CAAC,CAAC"}
|
package/lib/local-storage.js
CHANGED
package/lib/local-storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-storage.js","sourceRoot":"","sources":["../../../../libs/data-access/src/lib/local-storage.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,GAAG,SAAS,CAAC;AAE9B,MAAM,UAAU,YAAY;IAC1B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC9C,IAAI,CAAC,GAAG;YAAE,OAAO,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmB,CAAC;IAC3C,CAAC;IAAC,
|
|
1
|
+
{"version":3,"file":"local-storage.js","sourceRoot":"","sources":["../../../../libs/data-access/src/lib/local-storage.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,GAAG,SAAS,CAAC;AAE9B,MAAM,UAAU,YAAY;IAC1B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC9C,IAAI,CAAC,GAAG;YAAE,OAAO,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmB,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAkB;IAC5C,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC;IACrE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAChE,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACrD,CAAC"}
|
package/lib/lookup-entity.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { createServerClient } from './client-ssr';
|
|
3
2
|
import { getBibliographyEntry } from './bibliography';
|
|
4
3
|
import { getPassage, getPassageUuidByXmlId } from './passage';
|
|
@@ -6,18 +5,18 @@ import { getTranslationMetadataByToh, getTranslationMetadataByUuid, } from './pu
|
|
|
6
5
|
import { panelAndTabForContentType } from './panel-url';
|
|
7
6
|
import { getGlossaryInstance } from './glossary';
|
|
8
7
|
const ALLOWED_TYPES = ['bibliography', 'glossary', 'passage', 'translation', 'work'];
|
|
9
|
-
export const lookupEntity =
|
|
8
|
+
export const lookupEntity = async ({ type, entity, prefix = '', xmlId, searchParams, }) => {
|
|
10
9
|
if (!ALLOWED_TYPES.includes(type)) {
|
|
11
10
|
return;
|
|
12
11
|
}
|
|
13
|
-
const client =
|
|
12
|
+
const client = await createServerClient();
|
|
14
13
|
let path = '';
|
|
15
14
|
const query = searchParams || new URLSearchParams();
|
|
16
15
|
switch (type) {
|
|
17
16
|
case 'bibliography':
|
|
18
17
|
{
|
|
19
|
-
const item =
|
|
20
|
-
if (!
|
|
18
|
+
const item = await getBibliographyEntry({ client, uuid: entity });
|
|
19
|
+
if (!item?.workUuid || !item.uuid) {
|
|
21
20
|
return;
|
|
22
21
|
}
|
|
23
22
|
query.set('right', `open:bibliography:${item.uuid}`);
|
|
@@ -26,8 +25,8 @@ export const lookupEntity = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
26
25
|
break;
|
|
27
26
|
case 'glossary':
|
|
28
27
|
{
|
|
29
|
-
const item =
|
|
30
|
-
if (!
|
|
28
|
+
const item = await getGlossaryInstance({ client, uuid: entity });
|
|
29
|
+
if (!item?.workUuid || !item.authority) {
|
|
31
30
|
return;
|
|
32
31
|
}
|
|
33
32
|
query.set('right', `open:glossary:${item.authority}`);
|
|
@@ -36,8 +35,8 @@ export const lookupEntity = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
36
35
|
break;
|
|
37
36
|
case 'passage':
|
|
38
37
|
{
|
|
39
|
-
const item =
|
|
40
|
-
if (!
|
|
38
|
+
const item = await getPassage({ client, uuid: entity });
|
|
39
|
+
if (!item?.workUuid || !item.uuid) {
|
|
41
40
|
return;
|
|
42
41
|
}
|
|
43
42
|
const queryTab = query.get('tab') || undefined;
|
|
@@ -55,10 +54,10 @@ export const lookupEntity = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
55
54
|
const toh = entity.replace('.html', '');
|
|
56
55
|
query.set('toh', toh);
|
|
57
56
|
if (xmlId) {
|
|
58
|
-
const item =
|
|
57
|
+
const item = await getPassageUuidByXmlId({ client, xmlId });
|
|
59
58
|
const queryTab = query.get('tab') || undefined;
|
|
60
59
|
const { panel, tab } = panelAndTabForContentType(item.type, queryTab);
|
|
61
|
-
if (
|
|
60
|
+
if (item?.uuid && item?.workUuid) {
|
|
62
61
|
const { uuid, workUuid } = item;
|
|
63
62
|
query.delete('tab');
|
|
64
63
|
query.set(panel, `open:${tab}:${uuid}`);
|
|
@@ -66,8 +65,8 @@ export const lookupEntity = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
66
65
|
return path;
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
|
-
const item =
|
|
70
|
-
if (!
|
|
68
|
+
const item = await getTranslationMetadataByToh({ client, toh });
|
|
69
|
+
if (!item?.uuid) {
|
|
71
70
|
return;
|
|
72
71
|
}
|
|
73
72
|
path = `${prefix}/${item.uuid}?${query.toString()}`;
|
|
@@ -75,11 +74,11 @@ export const lookupEntity = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
75
74
|
break;
|
|
76
75
|
case 'work':
|
|
77
76
|
{
|
|
78
|
-
const item =
|
|
77
|
+
const item = await getTranslationMetadataByUuid({
|
|
79
78
|
client,
|
|
80
79
|
uuid: entity,
|
|
81
80
|
});
|
|
82
|
-
if (!
|
|
81
|
+
if (!item?.uuid) {
|
|
83
82
|
return;
|
|
84
83
|
}
|
|
85
84
|
path = `${prefix}/${item.uuid}?${query.toString()}`;
|
|
@@ -90,5 +89,5 @@ export const lookupEntity = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
91
|
return path;
|
|
93
|
-
}
|
|
92
|
+
};
|
|
94
93
|
//# sourceMappingURL=lookup-entity.js.map
|
package/lib/lookup-entity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup-entity.js","sourceRoot":"","sources":["../../../../libs/data-access/src/lib/lookup-entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lookup-entity.js","sourceRoot":"","sources":["../../../../libs/data-access/src/lib/lookup-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,aAAa,GAAG,CAAC,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;AAErF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,EAC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
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { passageFromDTO, } from '../types';
|
|
3
|
-
export const getAnnotationsByPassageUuids =
|
|
4
|
-
var _b;
|
|
2
|
+
export const getAnnotationsByPassageUuids = async ({ client, passageUuids, }) => {
|
|
5
3
|
const annotationsByPassage = new Map();
|
|
6
4
|
if (passageUuids.length === 0) {
|
|
7
5
|
return annotationsByPassage;
|
|
@@ -11,7 +9,7 @@ export const getAnnotationsByPassageUuids = (_a) => __awaiter(void 0, [_a], void
|
|
|
11
9
|
let offset = 0;
|
|
12
10
|
let hasMore = true;
|
|
13
11
|
while (hasMore) {
|
|
14
|
-
const { data, error } =
|
|
12
|
+
const { data, error } = await client
|
|
15
13
|
.from('passage_annotations')
|
|
16
14
|
.select('uuid, passage_uuid, type, start, end, content, toh')
|
|
17
15
|
.in('passage_uuid', passageUuids)
|
|
@@ -21,8 +19,8 @@ export const getAnnotationsByPassageUuids = (_a) => __awaiter(void 0, [_a], void
|
|
|
21
19
|
console.error('Error batch loading annotations:', error);
|
|
22
20
|
return new Map();
|
|
23
21
|
}
|
|
24
|
-
allData = allData.concat((data
|
|
25
|
-
hasMore = (
|
|
22
|
+
allData = allData.concat((data ?? []));
|
|
23
|
+
hasMore = (data?.length ?? 0) === pageSize;
|
|
26
24
|
offset += pageSize;
|
|
27
25
|
}
|
|
28
26
|
for (const annotation of allData) {
|
|
@@ -45,9 +43,8 @@ export const getAnnotationsByPassageUuids = (_a) => __awaiter(void 0, [_a], void
|
|
|
45
43
|
});
|
|
46
44
|
}
|
|
47
45
|
return annotationsByPassage;
|
|
48
|
-
}
|
|
49
|
-
export const getAlignmentsByPassageUuids =
|
|
50
|
-
var _b;
|
|
46
|
+
};
|
|
47
|
+
export const getAlignmentsByPassageUuids = async ({ client, passageUuids, }) => {
|
|
51
48
|
const alignmentsByPassage = new Map();
|
|
52
49
|
if (passageUuids.length === 0) {
|
|
53
50
|
return alignmentsByPassage;
|
|
@@ -57,7 +54,7 @@ export const getAlignmentsByPassageUuids = (_a) => __awaiter(void 0, [_a], void
|
|
|
57
54
|
let offset = 0;
|
|
58
55
|
let hasMore = true;
|
|
59
56
|
while (hasMore) {
|
|
60
|
-
const { data, error } =
|
|
57
|
+
const { data, error } = await client
|
|
61
58
|
.from('passage_alignments')
|
|
62
59
|
.select('passage_uuid, folio_uuid, toh, tibetan, folio_number, volume_number')
|
|
63
60
|
.in('passage_uuid', passageUuids)
|
|
@@ -66,8 +63,8 @@ export const getAlignmentsByPassageUuids = (_a) => __awaiter(void 0, [_a], void
|
|
|
66
63
|
console.error('Error batch loading alignments:', error);
|
|
67
64
|
return new Map();
|
|
68
65
|
}
|
|
69
|
-
allData = allData.concat((data
|
|
70
|
-
hasMore = (
|
|
66
|
+
allData = allData.concat((data ?? []));
|
|
67
|
+
hasMore = (data?.length ?? 0) === pageSize;
|
|
71
68
|
offset += pageSize;
|
|
72
69
|
}
|
|
73
70
|
for (const row of allData) {
|
|
@@ -80,13 +77,13 @@ export const getAlignmentsByPassageUuids = (_a) => __awaiter(void 0, [_a], void
|
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
79
|
return alignmentsByPassage;
|
|
83
|
-
}
|
|
84
|
-
export const getPassageLabelsByUuids =
|
|
80
|
+
};
|
|
81
|
+
export const getPassageLabelsByUuids = async ({ client, passageUuids, }) => {
|
|
85
82
|
const labelsByUuid = new Map();
|
|
86
83
|
if (passageUuids.length === 0) {
|
|
87
84
|
return labelsByUuid;
|
|
88
85
|
}
|
|
89
|
-
const { data, error } =
|
|
86
|
+
const { data, error } = await client
|
|
90
87
|
.from('passages')
|
|
91
88
|
.select('uuid, label')
|
|
92
89
|
.in('uuid', passageUuids);
|
|
@@ -94,20 +91,19 @@ export const getPassageLabelsByUuids = (_a) => __awaiter(void 0, [_a], void 0, f
|
|
|
94
91
|
console.error('Error batch loading passage labels:', error);
|
|
95
92
|
return labelsByUuid;
|
|
96
93
|
}
|
|
97
|
-
for (const passage of data
|
|
94
|
+
for (const passage of data ?? []) {
|
|
98
95
|
if (passage.label) {
|
|
99
96
|
labelsByUuid.set(passage.uuid, passage.label);
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
99
|
return labelsByUuid;
|
|
103
|
-
}
|
|
104
|
-
export const getPassageReferencesByTargetUuids =
|
|
105
|
-
var _b;
|
|
100
|
+
};
|
|
101
|
+
export const getPassageReferencesByTargetUuids = async ({ client, passageUuids, }) => {
|
|
106
102
|
const referencesByTargetUuid = new Map();
|
|
107
103
|
if (passageUuids.length === 0) {
|
|
108
104
|
return referencesByTargetUuid;
|
|
109
105
|
}
|
|
110
|
-
const { data: annotations, error: annotationsError } =
|
|
106
|
+
const { data: annotations, error: annotationsError } = await client.rpc('get_passage_annotations_by_content_uuids', {
|
|
111
107
|
annotation_type: 'end-note-link',
|
|
112
108
|
target_uuids: passageUuids,
|
|
113
109
|
});
|
|
@@ -117,11 +113,11 @@ export const getPassageReferencesByTargetUuids = (_a) => __awaiter(void 0, [_a],
|
|
|
117
113
|
}
|
|
118
114
|
const targetToSourceUuids = new Map();
|
|
119
115
|
const allSourceUuids = new Set();
|
|
120
|
-
for (const row of (annotations
|
|
116
|
+
for (const row of (annotations ?? [])) {
|
|
121
117
|
if (!row.target_uuid || !row.passage_uuid)
|
|
122
118
|
continue;
|
|
123
119
|
allSourceUuids.add(row.passage_uuid);
|
|
124
|
-
const sourceSet =
|
|
120
|
+
const sourceSet = targetToSourceUuids.get(row.target_uuid) ?? new Set();
|
|
125
121
|
sourceSet.add(row.passage_uuid);
|
|
126
122
|
targetToSourceUuids.set(row.target_uuid, sourceSet);
|
|
127
123
|
}
|
|
@@ -130,7 +126,7 @@ export const getPassageReferencesByTargetUuids = (_a) => __awaiter(void 0, [_a],
|
|
|
130
126
|
const inBatchSize = 300;
|
|
131
127
|
for (let i = 0; i < sourceUuidArray.length; i += inBatchSize) {
|
|
132
128
|
const batch = sourceUuidArray.slice(i, i + inBatchSize);
|
|
133
|
-
const { data, error } =
|
|
129
|
+
const { data, error } = await client
|
|
134
130
|
.from('passages')
|
|
135
131
|
.select('uuid, content, label, sort, type, toh, xmlId, work_uuid')
|
|
136
132
|
.in('uuid', batch);
|
|
@@ -138,7 +134,7 @@ export const getPassageReferencesByTargetUuids = (_a) => __awaiter(void 0, [_a],
|
|
|
138
134
|
console.error('Error batch loading passage reference data:', error);
|
|
139
135
|
return new Map();
|
|
140
136
|
}
|
|
141
|
-
for (const row of (data
|
|
137
|
+
for (const row of (data ?? [])) {
|
|
142
138
|
passageMap.set(row.uuid, passageFromDTO(row));
|
|
143
139
|
}
|
|
144
140
|
}
|
|
@@ -155,5 +151,5 @@ export const getPassageReferencesByTargetUuids = (_a) => __awaiter(void 0, [_a],
|
|
|
155
151
|
referencesByTargetUuid.set(targetUuid, references.sort((a, b) => a.sort - b.sort));
|
|
156
152
|
}
|
|
157
153
|
return referencesByTargetUuid;
|
|
158
|
-
}
|
|
154
|
+
};
|
|
159
155
|
//# sourceMappingURL=batch.js.map
|