@eightyfourthousand/client-graphql 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.d.ts +4 -0
- package/index.js +7 -0
- package/index.js.map +1 -0
- package/lib/client-ssr.d.ts +16 -0
- package/lib/client-ssr.js +39 -0
- package/lib/client-ssr.js.map +1 -0
- package/lib/client.d.ts +15 -0
- package/lib/client.js +48 -0
- package/lib/client.js.map +1 -0
- package/lib/config.d.ts +8 -0
- package/lib/config.js +19 -0
- package/lib/config.js.map +1 -0
- package/lib/functions/get-bibliography-entry.d.ts +9 -0
- package/lib/functions/get-bibliography-entry.js +24 -0
- package/lib/functions/get-bibliography-entry.js.map +1 -0
- package/lib/functions/get-glossary-instance.d.ts +9 -0
- package/lib/functions/get-glossary-instance.js +33 -0
- package/lib/functions/get-glossary-instance.js.map +1 -0
- package/lib/functions/get-passage.d.ts +10 -0
- package/lib/functions/get-passage.js +65 -0
- package/lib/functions/get-passage.js.map +1 -0
- package/lib/functions/get-term-passages.d.ts +20 -0
- package/lib/functions/get-term-passages.js +29 -0
- package/lib/functions/get-term-passages.js.map +1 -0
- package/lib/functions/get-translation-blocks-around.d.ts +15 -0
- package/lib/functions/get-translation-blocks-around.js +82 -0
- package/lib/functions/get-translation-blocks-around.js.map +1 -0
- package/lib/functions/get-translation-blocks.d.ts +25 -0
- package/lib/functions/get-translation-blocks.js +92 -0
- package/lib/functions/get-translation-blocks.js.map +1 -0
- package/lib/functions/get-translation-imprint.d.ts +10 -0
- package/lib/functions/get-translation-imprint.js +64 -0
- package/lib/functions/get-translation-imprint.js.map +1 -0
- package/lib/functions/get-translation-metadata.d.ts +16 -0
- package/lib/functions/get-translation-metadata.js +67 -0
- package/lib/functions/get-translation-metadata.js.map +1 -0
- package/lib/functions/get-translation-titles.d.ts +9 -0
- package/lib/functions/get-translation-titles.js +31 -0
- package/lib/functions/get-translation-titles.js.map +1 -0
- package/lib/functions/get-translation-toc.d.ts +9 -0
- package/{src/lib/functions/get-translation-toc.ts → lib/functions/get-translation-toc.js} +13 -47
- package/lib/functions/get-translation-toc.js.map +1 -0
- package/lib/functions/get-translation-uuids.d.ts +16 -0
- package/lib/functions/get-translation-uuids.js +37 -0
- package/lib/functions/get-translation-uuids.js.map +1 -0
- package/lib/functions/get-translations-metadata.d.ts +9 -0
- package/lib/functions/get-translations-metadata.js +48 -0
- package/lib/functions/get-translations-metadata.js.map +1 -0
- package/lib/functions/get-work-bibliography.d.ts +9 -0
- package/lib/functions/get-work-bibliography.js +29 -0
- package/lib/functions/get-work-bibliography.js.map +1 -0
- package/lib/functions/get-work-folios.d.ts +12 -0
- package/lib/functions/get-work-folios.js +28 -0
- package/lib/functions/get-work-folios.js.map +1 -0
- package/lib/functions/get-work-glossary-terms-around.d.ts +13 -0
- package/lib/functions/get-work-glossary-terms-around.js +91 -0
- package/lib/functions/get-work-glossary-terms-around.js.map +1 -0
- package/lib/functions/get-work-glossary-terms.d.ts +24 -0
- package/lib/functions/get-work-glossary-terms.js +100 -0
- package/lib/functions/get-work-glossary-terms.js.map +1 -0
- package/lib/functions/has-permission.d.ts +9 -0
- package/lib/functions/has-permission.js +14 -0
- package/lib/functions/has-permission.js.map +1 -0
- package/{src/lib/functions/index.ts → lib/functions/index.d.ts} +3 -12
- package/lib/functions/index.js +20 -0
- package/lib/functions/index.js.map +1 -0
- package/lib/functions/replace.d.ts +27 -0
- package/lib/functions/replace.js +48 -0
- package/lib/functions/replace.js.map +1 -0
- package/lib/functions/save-passages.d.ts +16 -0
- package/lib/functions/save-passages.js +34 -0
- package/lib/functions/save-passages.js.map +1 -0
- package/lib/generated/graphql.d.ts +1062 -0
- package/lib/generated/graphql.js +357 -0
- package/lib/generated/graphql.js.map +1 -0
- package/lib/mappers/alignment.d.ts +19 -0
- package/lib/mappers/alignment.js +19 -0
- package/lib/mappers/alignment.js.map +1 -0
- package/lib/mappers/annotation.d.ts +19 -0
- package/lib/mappers/annotation.js +160 -0
- package/lib/mappers/annotation.js.map +1 -0
- package/lib/mappers/imprint.d.ts +37 -0
- package/lib/mappers/imprint.js +43 -0
- package/lib/mappers/imprint.js.map +1 -0
- package/lib/mappers/index.js +8 -0
- package/lib/mappers/index.js.map +1 -0
- package/lib/mappers/passage.d.ts +41 -0
- package/lib/mappers/passage.js +37 -0
- package/lib/mappers/passage.js.map +1 -0
- package/lib/mappers/title.d.ts +18 -0
- package/lib/mappers/title.js +18 -0
- package/lib/mappers/title.js.map +1 -0
- package/lib/mappers/toc.d.ts +25 -0
- package/lib/mappers/toc.js +25 -0
- package/lib/mappers/toc.js.map +1 -0
- package/lib/mappers/work.d.ts +22 -0
- package/lib/mappers/work.js +22 -0
- package/lib/mappers/work.js.map +1 -0
- package/package.json +25 -3
- package/ssr.d.ts +4 -0
- package/ssr.js +7 -0
- package/ssr.js.map +1 -0
- package/README.md +0 -9
- package/codegen.ts +0 -34
- package/project.json +0 -21
- package/src/index.ts +0 -75
- package/src/lib/client-ssr.ts +0 -44
- package/src/lib/client.ts +0 -58
- package/src/lib/config.ts +0 -21
- package/src/lib/functions/get-bibliography-entry.ts +0 -40
- package/src/lib/functions/get-glossary-instance.ts +0 -49
- package/src/lib/functions/get-passage.ts +0 -81
- package/src/lib/functions/get-term-passages.ts +0 -53
- package/src/lib/functions/get-translation-blocks-around.ts +0 -129
- package/src/lib/functions/get-translation-blocks.ts +0 -158
- package/src/lib/functions/get-translation-imprint.ts +0 -114
- package/src/lib/functions/get-translation-metadata.ts +0 -99
- package/src/lib/functions/get-translation-titles.ts +0 -55
- package/src/lib/functions/get-translation-uuids.ts +0 -63
- package/src/lib/functions/get-translations-metadata.ts +0 -81
- package/src/lib/functions/get-work-bibliography.ts +0 -47
- package/src/lib/functions/get-work-folios.ts +0 -52
- package/src/lib/functions/get-work-glossary-terms-around.ts +0 -127
- package/src/lib/functions/get-work-glossary-terms.ts +0 -154
- package/src/lib/functions/has-permission.ts +0 -38
- package/src/lib/functions/replace.ts +0 -91
- package/src/lib/functions/save-passages.ts +0 -76
- package/src/lib/generated/graphql.ts +0 -1297
- package/src/lib/graphql/fragments/alignment.graphql +0 -7
- package/src/lib/graphql/fragments/annotation.graphql +0 -7
- package/src/lib/graphql/fragments/imprint.graphql +0 -34
- package/src/lib/graphql/fragments/passage.graphql +0 -29
- package/src/lib/graphql/fragments/title.graphql +0 -6
- package/src/lib/graphql/fragments/toc.graphql +0 -40
- package/src/lib/graphql/fragments/work.graphql +0 -10
- package/src/lib/graphql/queries/passages.graphql +0 -116
- package/src/lib/graphql/queries/work.graphql +0 -38
- package/src/lib/graphql/queries/works.graphql +0 -23
- package/src/lib/mappers/alignment.ts +0 -34
- package/src/lib/mappers/annotation.ts +0 -204
- package/src/lib/mappers/imprint.ts +0 -79
- package/src/lib/mappers/passage.ts +0 -80
- package/src/lib/mappers/title.ts +0 -35
- package/src/lib/mappers/toc.ts +0 -49
- package/src/lib/mappers/work.ts +0 -38
- package/src/ssr.ts +0 -66
- package/tsconfig.json +0 -17
- package/tsconfig.lib.json +0 -14
- /package/{src/lib/mappers/index.ts → lib/mappers/index.d.ts} +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { gql } from 'graphql-request';
|
|
2
|
+
import { imprintFromGraphQL } from '../mappers';
|
|
3
|
+
const GET_WORK_WITH_IMPRINT = gql `
|
|
4
|
+
fragment LicenseFields on License {
|
|
5
|
+
name
|
|
6
|
+
link
|
|
7
|
+
description
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
fragment TitlesByLanguageFields on TitlesByLanguage {
|
|
11
|
+
tibetan
|
|
12
|
+
english
|
|
13
|
+
wylie
|
|
14
|
+
sanskrit
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
fragment ImprintFields on Imprint {
|
|
18
|
+
toh
|
|
19
|
+
section
|
|
20
|
+
version
|
|
21
|
+
restriction
|
|
22
|
+
publishYear
|
|
23
|
+
tibetanAuthors
|
|
24
|
+
isAuthorContested
|
|
25
|
+
sourceDescription
|
|
26
|
+
publisherStatement
|
|
27
|
+
tibetanTranslators
|
|
28
|
+
license {
|
|
29
|
+
...LicenseFields
|
|
30
|
+
}
|
|
31
|
+
mainTitles {
|
|
32
|
+
...TitlesByLanguageFields
|
|
33
|
+
}
|
|
34
|
+
longTitles {
|
|
35
|
+
...TitlesByLanguageFields
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
query GetWorkWithImprint($uuid: ID!, $toh: String) {
|
|
40
|
+
work(uuid: $uuid, toh: $toh) {
|
|
41
|
+
uuid
|
|
42
|
+
imprint {
|
|
43
|
+
...ImprintFields
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
/**
|
|
49
|
+
* Get the imprint for a translation work.
|
|
50
|
+
*/
|
|
51
|
+
export async function getTranslationImprint({ client, uuid, toh, }) {
|
|
52
|
+
try {
|
|
53
|
+
const response = await client.request(GET_WORK_WITH_IMPRINT, { uuid, toh });
|
|
54
|
+
if (!response.work?.imprint) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
return imprintFromGraphQL(response.work.imprint, response.work.uuid);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error('Error fetching translation imprint:', error);
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=get-translation-imprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-translation-imprint.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-translation-imprint.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,qBAAqB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4ChC,CAAC;AAqCF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,MAAM,EACN,IAAI,EACJ,GAAG,GAKJ;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,qBAAqB,EACrB,EAAE,IAAI,EAAE,GAAG,EAAE,CACd,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;YAC5B,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;QAC5D,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import type { Work } from '@eightyfourthousand/data-access';
|
|
3
|
+
/**
|
|
4
|
+
* Get work metadata by UUID.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getTranslationMetadataByUuid({ client, uuid, }: {
|
|
7
|
+
client: GraphQLClient;
|
|
8
|
+
uuid: string;
|
|
9
|
+
}): Promise<Work | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Get work metadata by Tohoku catalog number.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getTranslationMetadataByToh({ client, toh, }: {
|
|
14
|
+
client: GraphQLClient;
|
|
15
|
+
toh: string;
|
|
16
|
+
}): Promise<Work | null>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { gql } from 'graphql-request';
|
|
2
|
+
import { workFromGraphQL } from '../mappers';
|
|
3
|
+
const GET_WORK_BY_UUID = gql `
|
|
4
|
+
query GetWorkByUuid($uuid: ID!) {
|
|
5
|
+
work(uuid: $uuid) {
|
|
6
|
+
uuid
|
|
7
|
+
title
|
|
8
|
+
toh
|
|
9
|
+
publicationDate
|
|
10
|
+
publicationVersion
|
|
11
|
+
pages
|
|
12
|
+
restriction
|
|
13
|
+
section
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
const GET_WORK_BY_TOH = gql `
|
|
18
|
+
query GetWorkByToh($toh: String!) {
|
|
19
|
+
work(toh: $toh) {
|
|
20
|
+
uuid
|
|
21
|
+
title
|
|
22
|
+
toh
|
|
23
|
+
publicationDate
|
|
24
|
+
publicationVersion
|
|
25
|
+
pages
|
|
26
|
+
restriction
|
|
27
|
+
section
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
/**
|
|
32
|
+
* Get work metadata by UUID.
|
|
33
|
+
*/
|
|
34
|
+
export async function getTranslationMetadataByUuid({ client, uuid, }) {
|
|
35
|
+
try {
|
|
36
|
+
const response = await client.request(GET_WORK_BY_UUID, {
|
|
37
|
+
uuid,
|
|
38
|
+
});
|
|
39
|
+
if (!response.work) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return workFromGraphQL(response.work);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error('Error fetching translation metadata by UUID:', error);
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get work metadata by Tohoku catalog number.
|
|
51
|
+
*/
|
|
52
|
+
export async function getTranslationMetadataByToh({ client, toh, }) {
|
|
53
|
+
try {
|
|
54
|
+
const response = await client.request(GET_WORK_BY_TOH, {
|
|
55
|
+
toh,
|
|
56
|
+
});
|
|
57
|
+
if (!response.work) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return workFromGraphQL(response.work);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.error('Error fetching translation metadata by toh:', error);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=get-translation-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-translation-metadata.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-translation-metadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,gBAAgB,GAAG,GAAG,CAAA;;;;;;;;;;;;;CAa3B,CAAC;AAEF,MAAM,eAAe,GAAG,GAAG,CAAA;;;;;;;;;;;;;CAa1B,CAAC;AAeF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,EACjD,MAAM,EACN,IAAI,GAIL;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAkB,gBAAgB,EAAE;YACvE,IAAI;SACL,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,EAChD,MAAM,EACN,GAAG,GAIJ;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAkB,eAAe,EAAE;YACtE,GAAG;SACJ,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,KAAK,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import type { Titles } from '@eightyfourthousand/data-access';
|
|
3
|
+
/**
|
|
4
|
+
* Get all titles for a work.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getTranslationTitles({ client, uuid, }: {
|
|
7
|
+
client: GraphQLClient;
|
|
8
|
+
uuid: string;
|
|
9
|
+
}): Promise<Titles>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { gql } from 'graphql-request';
|
|
2
|
+
import { titlesFromGraphQL } from '../mappers';
|
|
3
|
+
const GET_WORK_TITLES = gql `
|
|
4
|
+
query GetWorkWithTitles($uuid: ID!) {
|
|
5
|
+
work(uuid: $uuid) {
|
|
6
|
+
titles {
|
|
7
|
+
uuid
|
|
8
|
+
content
|
|
9
|
+
language
|
|
10
|
+
type
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
/**
|
|
16
|
+
* Get all titles for a work.
|
|
17
|
+
*/
|
|
18
|
+
export async function getTranslationTitles({ client, uuid, }) {
|
|
19
|
+
try {
|
|
20
|
+
const response = await client.request(GET_WORK_TITLES, { uuid });
|
|
21
|
+
if (!response.work) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
return titlesFromGraphQL(response.work.titles);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error('Error fetching translation titles:', error);
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=get-translation-titles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-translation-titles.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-translation-titles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,eAAe,GAAG,GAAG,CAAA;;;;;;;;;;;CAW1B,CAAC;AAaF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,EACzC,MAAM,EACN,IAAI,GAIL;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,eAAe,EACf,EAAE,IAAI,EAAE,CACT,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;QAC3D,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import type { Toc } from '@eightyfourthousand/data-access';
|
|
3
|
+
/**
|
|
4
|
+
* Get the table of contents for a translation work.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getTranslationToc({ client, uuid, }: {
|
|
7
|
+
client: GraphQLClient;
|
|
8
|
+
uuid: string;
|
|
9
|
+
}): Promise<Toc | undefined>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type { GraphQLClient } from 'graphql-request';
|
|
2
1
|
import { gql } from 'graphql-request';
|
|
3
|
-
import type { Toc } from '@eightyfourthousand/data-access';
|
|
4
2
|
import { tocFromGraphQL } from '../mappers';
|
|
5
|
-
|
|
6
|
-
const GET_WORK_WITH_TOC = gql`
|
|
3
|
+
const GET_WORK_WITH_TOC = gql `
|
|
7
4
|
fragment TocEntryFields on TocEntry {
|
|
8
5
|
uuid
|
|
9
6
|
content
|
|
@@ -65,51 +62,20 @@ const GET_WORK_WITH_TOC = gql`
|
|
|
65
62
|
}
|
|
66
63
|
}
|
|
67
64
|
`;
|
|
68
|
-
|
|
69
|
-
type GetWorkWithTocResponse = {
|
|
70
|
-
work: {
|
|
71
|
-
uuid: string;
|
|
72
|
-
toc: {
|
|
73
|
-
frontMatter: TocEntryNode[];
|
|
74
|
-
body: TocEntryNode[];
|
|
75
|
-
backMatter: TocEntryNode[];
|
|
76
|
-
} | null;
|
|
77
|
-
} | null;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
type TocEntryNode = {
|
|
81
|
-
uuid: string;
|
|
82
|
-
content: string;
|
|
83
|
-
label?: string | null;
|
|
84
|
-
sort: number;
|
|
85
|
-
level: number;
|
|
86
|
-
section: string;
|
|
87
|
-
children?: TocEntryNode[] | null;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
65
|
/**
|
|
91
66
|
* Get the table of contents for a translation work.
|
|
92
67
|
*/
|
|
93
|
-
export async function getTranslationToc({
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
if (!response.work?.toc) {
|
|
107
|
-
return undefined;
|
|
68
|
+
export async function getTranslationToc({ client, uuid, }) {
|
|
69
|
+
try {
|
|
70
|
+
const response = await client.request(GET_WORK_WITH_TOC, { uuid });
|
|
71
|
+
if (!response.work?.toc) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
return tocFromGraphQL(response.work.toc);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
console.error('Error fetching translation TOC:', error);
|
|
78
|
+
return undefined;
|
|
108
79
|
}
|
|
109
|
-
|
|
110
|
-
return tocFromGraphQL(response.work.toc);
|
|
111
|
-
} catch (error) {
|
|
112
|
-
console.error('Error fetching translation TOC:', error);
|
|
113
|
-
return undefined;
|
|
114
|
-
}
|
|
115
80
|
}
|
|
81
|
+
//# sourceMappingURL=get-translation-toc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-translation-toc.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-translation-toc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,iBAAiB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6D5B,CAAC;AAuBF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EACtC,MAAM,EACN,IAAI,GAIL;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,iBAAiB,EACjB,EAAE,IAAI,EAAE,CACT,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;YACxB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;QACxD,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
type WorkFilter = {
|
|
3
|
+
maxPages?: number;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Get work UUIDs with optional filtering.
|
|
7
|
+
* @param client - GraphQL client
|
|
8
|
+
* @param filter - Optional filter criteria (e.g., maxPages)
|
|
9
|
+
* @param limit - Optional limit on total results (fetches all pages if not specified)
|
|
10
|
+
*/
|
|
11
|
+
export declare function getTranslationUuids({ client, filter, limit, }: {
|
|
12
|
+
client: GraphQLClient;
|
|
13
|
+
filter?: WorkFilter;
|
|
14
|
+
limit?: number;
|
|
15
|
+
}): Promise<string[]>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { gql } from 'graphql-request';
|
|
2
|
+
const DEFAULT_PAGE_SIZE = 200;
|
|
3
|
+
const GET_WORK_UUIDS = gql `
|
|
4
|
+
query GetWorkUuids($cursor: String, $limit: Int, $filter: WorkFilter) {
|
|
5
|
+
works(cursor: $cursor, limit: $limit, filter: $filter) {
|
|
6
|
+
items {
|
|
7
|
+
uuid
|
|
8
|
+
}
|
|
9
|
+
pageInfo {
|
|
10
|
+
nextCursor
|
|
11
|
+
hasMoreAfter
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
/**
|
|
17
|
+
* Get work UUIDs with optional filtering.
|
|
18
|
+
* @param client - GraphQL client
|
|
19
|
+
* @param filter - Optional filter criteria (e.g., maxPages)
|
|
20
|
+
* @param limit - Optional limit on total results (fetches all pages if not specified)
|
|
21
|
+
*/
|
|
22
|
+
export async function getTranslationUuids({ client, filter, limit, }) {
|
|
23
|
+
try {
|
|
24
|
+
// Single request - no pagination needed for static params
|
|
25
|
+
const response = await client.request(GET_WORK_UUIDS, {
|
|
26
|
+
cursor: null,
|
|
27
|
+
limit: limit ?? DEFAULT_PAGE_SIZE,
|
|
28
|
+
filter,
|
|
29
|
+
});
|
|
30
|
+
return response.works.items.map((w) => w.uuid);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.error('Error fetching translation UUIDs:', error);
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=get-translation-uuids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-translation-uuids.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-translation-uuids.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;CAYzB,CAAC;AAgBF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACxC,MAAM,EACN,MAAM,EACN,KAAK,GAKN;IACC,IAAI,CAAC;QACH,0DAA0D;QAC1D,MAAM,QAAQ,GACZ,MAAM,MAAM,CAAC,OAAO,CAAuB,cAAc,EAAE;YACzD,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,KAAK,IAAI,iBAAiB;YACjC,MAAM;SACP,CAAC,CAAC;QAEL,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QAC1D,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import type { Work } from '@eightyfourthousand/data-access';
|
|
3
|
+
/**
|
|
4
|
+
* Get metadata for all published translation works (fetches all pages).
|
|
5
|
+
*/
|
|
6
|
+
export declare function getTranslationsMetadata({ client, limit, }: {
|
|
7
|
+
client: GraphQLClient;
|
|
8
|
+
limit?: number;
|
|
9
|
+
}): Promise<Work[]>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { gql } from 'graphql-request';
|
|
2
|
+
import { worksFromGraphQL } from '../mappers';
|
|
3
|
+
const GET_ALL_WORKS = gql `
|
|
4
|
+
query GetAllWorks($cursor: String, $limit: Int) {
|
|
5
|
+
works(cursor: $cursor, limit: $limit) {
|
|
6
|
+
items {
|
|
7
|
+
uuid
|
|
8
|
+
title
|
|
9
|
+
toh
|
|
10
|
+
publicationDate
|
|
11
|
+
publicationVersion
|
|
12
|
+
pages
|
|
13
|
+
restriction
|
|
14
|
+
section
|
|
15
|
+
}
|
|
16
|
+
pageInfo {
|
|
17
|
+
nextCursor
|
|
18
|
+
hasMoreAfter
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
/**
|
|
24
|
+
* Get metadata for all published translation works (fetches all pages).
|
|
25
|
+
*/
|
|
26
|
+
export async function getTranslationsMetadata({ client, limit = 200, }) {
|
|
27
|
+
try {
|
|
28
|
+
const allWorks = [];
|
|
29
|
+
let cursor = null;
|
|
30
|
+
// Fetch all pages
|
|
31
|
+
do {
|
|
32
|
+
const response = await client.request(GET_ALL_WORKS, {
|
|
33
|
+
cursor,
|
|
34
|
+
limit,
|
|
35
|
+
});
|
|
36
|
+
allWorks.push(...response.works.items);
|
|
37
|
+
cursor = response.works.pageInfo.hasMoreAfter
|
|
38
|
+
? response.works.pageInfo.nextCursor
|
|
39
|
+
: null;
|
|
40
|
+
} while (cursor !== null);
|
|
41
|
+
return worksFromGraphQL(allWorks);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error('Error fetching translations metadata:', error);
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=get-translations-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-translations-metadata.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-translations-metadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,aAAa,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;CAmBxB,CAAC;AAuBF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,EAC5C,MAAM,EACN,KAAK,GAAG,GAAG,GAIZ;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAkB,EAAE,CAAC;QACnC,IAAI,MAAM,GAAkB,IAAI,CAAC;QAEjC,kBAAkB;QAClB,GAAG,CAAC;YACF,MAAM,QAAQ,GACZ,MAAM,MAAM,CAAC,OAAO,CAAsB,aAAa,EAAE;gBACvD,MAAM;gBACN,KAAK;aACN,CAAC,CAAC;YAEL,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACvC,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY;gBAC3C,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU;gBACpC,CAAC,CAAC,IAAI,CAAC;QACX,CAAC,QAAQ,MAAM,KAAK,IAAI,EAAE;QAE1B,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC9D,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import type { BibliographyEntries } from '@eightyfourthousand/data-access';
|
|
3
|
+
/**
|
|
4
|
+
* Get bibliography entries for a specific work.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getWorkBibliography({ client, uuid, }: {
|
|
7
|
+
client: GraphQLClient;
|
|
8
|
+
uuid: string;
|
|
9
|
+
}): Promise<BibliographyEntries>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { gql } from 'graphql-request';
|
|
2
|
+
const GET_WORK_BIBLIOGRAPHY = gql `
|
|
3
|
+
query GetWorkBibliography($uuid: ID!) {
|
|
4
|
+
work(uuid: $uuid) {
|
|
5
|
+
bibliography {
|
|
6
|
+
heading
|
|
7
|
+
entries {
|
|
8
|
+
uuid
|
|
9
|
+
html
|
|
10
|
+
workUuid
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
/**
|
|
17
|
+
* Get bibliography entries for a specific work.
|
|
18
|
+
*/
|
|
19
|
+
export async function getWorkBibliography({ client, uuid, }) {
|
|
20
|
+
try {
|
|
21
|
+
const response = await client.request(GET_WORK_BIBLIOGRAPHY, { uuid });
|
|
22
|
+
return response.work?.bibliography ?? [];
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
console.error('Error fetching work bibliography:', error);
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=get-work-bibliography.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-work-bibliography.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-work-bibliography.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAGtC,MAAM,qBAAqB,GAAG,GAAG,CAAA;;;;;;;;;;;;;CAahC,CAAC;AAQF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACxC,MAAM,EACN,IAAI,GAIL;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,qBAAqB,EACrB,EAAE,IAAI,EAAE,CACT,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,EAAE,YAAY,IAAI,EAAE,CAAC;IAC3C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QAC1D,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import type { Folio } from '@eightyfourthousand/data-access';
|
|
3
|
+
/**
|
|
4
|
+
* Get folios for a specific work, filtered by toh and paginated.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getWorkFolios({ client, uuid, toh, page, size, }: {
|
|
7
|
+
client: GraphQLClient;
|
|
8
|
+
uuid: string;
|
|
9
|
+
toh: string;
|
|
10
|
+
page?: number;
|
|
11
|
+
size?: number;
|
|
12
|
+
}): Promise<Folio[]>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { gql } from 'graphql-request';
|
|
2
|
+
const GET_WORK_FOLIOS = gql `
|
|
3
|
+
query GetWorkFolios($uuid: ID!, $toh: String!, $page: Int, $size: Int) {
|
|
4
|
+
work(uuid: $uuid) {
|
|
5
|
+
folios(toh: $toh, page: $page, size: $size) {
|
|
6
|
+
uuid
|
|
7
|
+
content
|
|
8
|
+
volume
|
|
9
|
+
folio
|
|
10
|
+
side
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
/**
|
|
16
|
+
* Get folios for a specific work, filtered by toh and paginated.
|
|
17
|
+
*/
|
|
18
|
+
export async function getWorkFolios({ client, uuid, toh, page = 0, size = 10, }) {
|
|
19
|
+
try {
|
|
20
|
+
const response = await client.request(GET_WORK_FOLIOS, { uuid, toh, page, size });
|
|
21
|
+
return response.work?.folios ?? [];
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.error('Error fetching work folios:', error);
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=get-work-folios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-work-folios.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-work-folios.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAGtC,MAAM,eAAe,GAAG,GAAG,CAAA;;;;;;;;;;;;CAY1B,CAAC;AAQF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,EAClC,MAAM,EACN,IAAI,EACJ,GAAG,EACH,IAAI,GAAG,CAAC,EACR,IAAI,GAAG,EAAE,GAOV;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,eAAe,EACf,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAC1B,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import type { GlossaryTermsPage } from './get-work-glossary-terms';
|
|
3
|
+
/**
|
|
4
|
+
* Get glossary terms around a specific term UUID.
|
|
5
|
+
* Used for navigating to a glossary entry that hasn't been loaded yet.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getWorkGlossaryTermsAround({ client, uuid, termUuid, limit, withAttestations, }: {
|
|
8
|
+
client: GraphQLClient;
|
|
9
|
+
uuid: string;
|
|
10
|
+
termUuid: string;
|
|
11
|
+
limit?: number;
|
|
12
|
+
withAttestations?: boolean;
|
|
13
|
+
}): Promise<GlossaryTermsPage>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { gql } from 'graphql-request';
|
|
2
|
+
const GET_WORK_GLOSSARY_TERMS_AROUND = gql `
|
|
3
|
+
query GetWorkGlossaryTermsAround(
|
|
4
|
+
$uuid: ID!
|
|
5
|
+
$cursor: String!
|
|
6
|
+
$limit: Int
|
|
7
|
+
$withAttestations: Boolean
|
|
8
|
+
) {
|
|
9
|
+
work(uuid: $uuid) {
|
|
10
|
+
glossaryTerms(
|
|
11
|
+
cursor: $cursor
|
|
12
|
+
limit: $limit
|
|
13
|
+
direction: AROUND
|
|
14
|
+
withAttestations: $withAttestations
|
|
15
|
+
) {
|
|
16
|
+
nodes {
|
|
17
|
+
uuid
|
|
18
|
+
authority
|
|
19
|
+
definition
|
|
20
|
+
termNumber
|
|
21
|
+
names {
|
|
22
|
+
english
|
|
23
|
+
tibetan
|
|
24
|
+
sanskrit
|
|
25
|
+
pali
|
|
26
|
+
chinese
|
|
27
|
+
wylie
|
|
28
|
+
alternatives
|
|
29
|
+
}
|
|
30
|
+
passages(first: 10) {
|
|
31
|
+
items {
|
|
32
|
+
uuid
|
|
33
|
+
type
|
|
34
|
+
label
|
|
35
|
+
}
|
|
36
|
+
nextCursor
|
|
37
|
+
hasMore
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
pageInfo {
|
|
41
|
+
nextCursor
|
|
42
|
+
prevCursor
|
|
43
|
+
hasMoreAfter
|
|
44
|
+
hasMoreBefore
|
|
45
|
+
}
|
|
46
|
+
totalCount
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
/**
|
|
52
|
+
* Get glossary terms around a specific term UUID.
|
|
53
|
+
* Used for navigating to a glossary entry that hasn't been loaded yet.
|
|
54
|
+
*/
|
|
55
|
+
export async function getWorkGlossaryTermsAround({ client, uuid, termUuid, limit, withAttestations = false, }) {
|
|
56
|
+
try {
|
|
57
|
+
const response = await client.request(GET_WORK_GLOSSARY_TERMS_AROUND, {
|
|
58
|
+
uuid,
|
|
59
|
+
cursor: termUuid,
|
|
60
|
+
limit,
|
|
61
|
+
withAttestations,
|
|
62
|
+
});
|
|
63
|
+
if (!response.work) {
|
|
64
|
+
return {
|
|
65
|
+
terms: [],
|
|
66
|
+
hasMoreAfter: false,
|
|
67
|
+
hasMoreBefore: false,
|
|
68
|
+
totalCount: 0,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const { glossaryTerms } = response.work;
|
|
72
|
+
return {
|
|
73
|
+
terms: glossaryTerms.nodes,
|
|
74
|
+
nextCursor: glossaryTerms.pageInfo.nextCursor ?? undefined,
|
|
75
|
+
prevCursor: glossaryTerms.pageInfo.prevCursor ?? undefined,
|
|
76
|
+
hasMoreAfter: glossaryTerms.pageInfo.hasMoreAfter,
|
|
77
|
+
hasMoreBefore: glossaryTerms.pageInfo.hasMoreBefore,
|
|
78
|
+
totalCount: glossaryTerms.totalCount,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error('Error fetching glossary terms around:', error);
|
|
83
|
+
return {
|
|
84
|
+
terms: [],
|
|
85
|
+
hasMoreAfter: false,
|
|
86
|
+
hasMoreBefore: false,
|
|
87
|
+
totalCount: 0,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=get-work-glossary-terms-around.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-work-glossary-terms-around.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-work-glossary-terms-around.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAItC,MAAM,8BAA8B,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDzC,CAAC;AAiBF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,EAC/C,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,gBAAgB,GAAG,KAAK,GAOzB;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,8BAA8B,EAC9B;YACE,IAAI;YACJ,MAAM,EAAE,QAAQ;YAChB,KAAK;YACL,gBAAgB;SACjB,CACF,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnB,OAAO;gBACL,KAAK,EAAE,EAAE;gBACT,YAAY,EAAE,KAAK;gBACnB,aAAa,EAAE,KAAK;gBACpB,UAAU,EAAE,CAAC;aACd,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,aAAa,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;QAExC,OAAO;YACL,KAAK,EAAE,aAAa,CAAC,KAAK;YAC1B,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,UAAU,IAAI,SAAS;YAC1D,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,UAAU,IAAI,SAAS;YAC1D,YAAY,EAAE,aAAa,CAAC,QAAQ,CAAC,YAAY;YACjD,aAAa,EAAE,aAAa,CAAC,QAAQ,CAAC,aAAa;YACnD,UAAU,EAAE,aAAa,CAAC,UAAU;SACrC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC9D,OAAO;YACL,KAAK,EAAE,EAAE;YACT,YAAY,EAAE,KAAK;YACnB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,CAAC;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import type { GlossaryTermInstance, PaginationDirection } from '@eightyfourthousand/data-access';
|
|
3
|
+
/**
|
|
4
|
+
* Result of fetching glossary terms with pagination info
|
|
5
|
+
*/
|
|
6
|
+
export type GlossaryTermsPage = {
|
|
7
|
+
terms: GlossaryTermInstance[];
|
|
8
|
+
nextCursor?: string;
|
|
9
|
+
prevCursor?: string;
|
|
10
|
+
hasMoreAfter: boolean;
|
|
11
|
+
hasMoreBefore: boolean;
|
|
12
|
+
totalCount: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Get paginated glossary terms for a work.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getWorkGlossaryTerms({ client, uuid, cursor, limit, direction, withAttestations, }: {
|
|
18
|
+
client: GraphQLClient;
|
|
19
|
+
uuid: string;
|
|
20
|
+
cursor?: string;
|
|
21
|
+
limit?: number;
|
|
22
|
+
direction?: PaginationDirection;
|
|
23
|
+
withAttestations?: boolean;
|
|
24
|
+
}): Promise<GlossaryTermsPage>;
|