@eightyfourthousand/client-graphql 2026.4.1 → 2026.4.3
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/client-ssr.js +16 -16
- package/lib/client-ssr.js.map +1 -1
- package/lib/client.js +7 -5
- package/lib/client.js.map +1 -1
- package/lib/functions/get-bibliography-entry.js +9 -12
- package/lib/functions/get-bibliography-entry.js.map +1 -1
- package/lib/functions/get-glossary-instance.js +9 -12
- package/lib/functions/get-glossary-instance.js.map +1 -1
- package/lib/functions/get-passage.js +13 -16
- package/lib/functions/get-passage.js.map +1 -1
- package/lib/functions/get-term-passages.js +9 -12
- package/lib/functions/get-term-passages.js.map +1 -1
- package/lib/functions/get-translation-blocks-around.js +30 -34
- package/lib/functions/get-translation-blocks-around.js.map +1 -1
- package/lib/functions/get-translation-blocks.js +31 -35
- package/lib/functions/get-translation-blocks.js.map +1 -1
- package/lib/functions/get-translation-imprint.js +10 -14
- package/lib/functions/get-translation-imprint.js.map +1 -1
- package/lib/functions/get-translation-metadata.js +24 -29
- package/lib/functions/get-translation-metadata.js.map +1 -1
- package/lib/functions/get-translation-titles.js +10 -13
- package/lib/functions/get-translation-titles.js.map +1 -1
- package/lib/functions/get-translation-toc.js +10 -14
- package/lib/functions/get-translation-toc.js.map +1 -1
- package/lib/functions/get-translation-uuids.js +14 -17
- package/lib/functions/get-translation-uuids.js.map +1 -1
- package/lib/functions/get-translations-metadata.js +21 -24
- package/lib/functions/get-translations-metadata.js.map +1 -1
- package/lib/functions/get-work-bibliography.js +9 -13
- package/lib/functions/get-work-bibliography.js.map +1 -1
- package/lib/functions/get-work-folios.js +9 -13
- package/lib/functions/get-work-folios.js.map +1 -1
- package/lib/functions/get-work-glossary-terms-around.js +28 -32
- package/lib/functions/get-work-glossary-terms-around.js.map +1 -1
- package/lib/functions/get-work-glossary-terms.js +29 -33
- package/lib/functions/get-work-glossary-terms.js.map +1 -1
- package/lib/functions/has-permission.js +3 -4
- package/lib/functions/has-permission.js.map +1 -1
- package/lib/functions/replace.js +3 -4
- package/lib/functions/replace.js.map +1 -1
- package/lib/functions/save-passages.js +3 -4
- package/lib/functions/save-passages.js.map +1 -1
- package/lib/generated/graphql.js +12 -12
- package/lib/generated/graphql.js.map +1 -1
- package/lib/mappers/annotation.js +104 -18
- package/lib/mappers/annotation.js.map +1 -1
- package/lib/mappers/imprint.js +3 -4
- package/lib/mappers/imprint.js.map +1 -1
- package/lib/mappers/passage.js +4 -6
- package/lib/mappers/passage.js.map +1 -1
- package/package.json +2 -2
package/lib/client-ssr.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import 'server-only';
|
|
3
2
|
import { GraphQLClient } from 'graphql-request';
|
|
4
3
|
import { cookies } from 'next/headers';
|
|
@@ -9,22 +8,23 @@ import { getGraphQLUrl } from './config';
|
|
|
9
8
|
*
|
|
10
9
|
* Must be called within a Server Component or Server Action context.
|
|
11
10
|
*/
|
|
12
|
-
export function createServerGraphQLClient() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
export async function createServerGraphQLClient() {
|
|
12
|
+
const url = getGraphQLUrl();
|
|
13
|
+
// Get all cookies from the request
|
|
14
|
+
const cookieStore = await cookies();
|
|
15
|
+
const allCookies = cookieStore.getAll();
|
|
16
|
+
// Build cookie header string with encoded values to ensure HTTP header compatibility
|
|
17
|
+
// Cookie values may contain non-ASCII characters which are invalid in HTTP headers (ByteString)
|
|
18
|
+
const cookieHeader = allCookies
|
|
19
|
+
.map((cookie) => `${cookie.name}=${encodeURIComponent(cookie.value)}`)
|
|
20
|
+
.join('; ');
|
|
21
|
+
const client = new GraphQLClient(url, {
|
|
22
|
+
headers: {
|
|
23
|
+
// Forward cookies for authentication
|
|
24
|
+
...(cookieHeader ? { cookie: cookieHeader } : {}),
|
|
25
|
+
},
|
|
27
26
|
});
|
|
27
|
+
return client;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Create a GraphQL client for build-time requests (generateStaticParams).
|
package/lib/client-ssr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-ssr.js","sourceRoot":"","sources":["../../../../libs/client-graphql/src/lib/client-ssr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client-ssr.js","sourceRoot":"","sources":["../../../../libs/client-graphql/src/lib/client-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB;IAC7C,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAE5B,mCAAmC;IACnC,MAAM,WAAW,GAAG,MAAM,OAAO,EAAE,CAAC;IACpC,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC;IAExC,qFAAqF;IACrF,gGAAgG;IAChG,MAAM,YAAY,GAAG,UAAU;SAC5B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,IAAI,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;SACrE,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,GAAG,EAAE;QACpC,OAAO,EAAE;YACP,qCAAqC;YACrC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClD;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB;IACtC,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAC5B,OAAO,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;AAChC,CAAC"}
|
package/lib/client.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { GraphQLClient } from 'graphql-request';
|
|
3
2
|
import { getGraphQLUrl } from './config';
|
|
4
3
|
let clientInstance = null;
|
|
@@ -21,19 +20,22 @@ export function createGraphQLClient() {
|
|
|
21
20
|
const url = getGraphQLUrl();
|
|
22
21
|
clientInstance = new GraphQLClient(url, {
|
|
23
22
|
// Dynamic headers - called on each request
|
|
24
|
-
requestMiddleware: (request) =>
|
|
23
|
+
requestMiddleware: async (request) => {
|
|
25
24
|
const headers = {
|
|
26
25
|
'Content-Type': 'application/json',
|
|
27
26
|
'apollo-require-preflight': 'true',
|
|
28
27
|
};
|
|
29
28
|
if (getAccessToken) {
|
|
30
|
-
const token =
|
|
29
|
+
const token = await getAccessToken();
|
|
31
30
|
if (token) {
|
|
32
31
|
headers['Authorization'] = `Bearer ${token}`;
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
|
-
return
|
|
36
|
-
|
|
34
|
+
return {
|
|
35
|
+
...request,
|
|
36
|
+
headers,
|
|
37
|
+
};
|
|
38
|
+
},
|
|
37
39
|
});
|
|
38
40
|
return clientInstance;
|
|
39
41
|
}
|
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../libs/client-graphql/src/lib/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../libs/client-graphql/src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,IAAI,cAAc,GAAyB,IAAI,CAAC;AAChD,IAAI,cAAc,GAA0C,IAAI,CAAC;AAEjE;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,QAAsC;IAEtC,cAAc,GAAG,QAAQ,CAAC;AAC5B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAE5B,cAAc,GAAG,IAAI,aAAa,CAAC,GAAG,EAAE;QACtC,2CAA2C;QAC3C,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACnC,MAAM,OAAO,GAA2B;gBACtC,cAAc,EAAE,kBAAkB;gBAClC,0BAA0B,EAAE,MAAM;aACnC,CAAC;YAEF,IAAI,cAAc,EAAE,CAAC;gBACnB,MAAM,KAAK,GAAG,MAAM,cAAc,EAAE,CAAC;gBACrC,IAAI,KAAK,EAAE,CAAC;oBACV,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,KAAK,EAAE,CAAC;gBAC/C,CAAC;YACH,CAAC;YAED,OAAO;gBACL,GAAG,OAAO;gBACV,OAAO;aACR,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,cAAc,GAAG,IAAI,CAAC;AACxB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { gql } from 'graphql-request';
|
|
3
2
|
const GET_BIBLIOGRAPHY_ENTRY = gql `
|
|
4
3
|
query GetBibliographyEntry($uuid: ID!) {
|
|
@@ -12,16 +11,14 @@ const GET_BIBLIOGRAPHY_ENTRY = gql `
|
|
|
12
11
|
/**
|
|
13
12
|
* Get a single bibliography entry by UUID.
|
|
14
13
|
*/
|
|
15
|
-
export function getBibliographyEntry(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
});
|
|
14
|
+
export async function getBibliographyEntry({ client, uuid, }) {
|
|
15
|
+
try {
|
|
16
|
+
const response = await client.request(GET_BIBLIOGRAPHY_ENTRY, { uuid });
|
|
17
|
+
return response.bibliographyEntry;
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error('Error fetching bibliography entry:', error);
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
26
23
|
}
|
|
27
24
|
//# sourceMappingURL=get-bibliography-entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-bibliography-entry.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-bibliography-entry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-bibliography-entry.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-bibliography-entry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAGtC,MAAM,sBAAsB,GAAG,GAAG,CAAA;;;;;;;;CAQjC,CAAC;AAMF;;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,sBAAsB,EACtB,EAAE,IAAI,EAAE,CACT,CAAC;QAEF,OAAO,QAAQ,CAAC,iBAAiB,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { gql } from 'graphql-request';
|
|
3
2
|
const GET_GLOSSARY_INSTANCE = gql `
|
|
4
3
|
query GetGlossaryInstance($uuid: ID!) {
|
|
@@ -21,16 +20,14 @@ const GET_GLOSSARY_INSTANCE = gql `
|
|
|
21
20
|
/**
|
|
22
21
|
* Get a single glossary instance by UUID.
|
|
23
22
|
*/
|
|
24
|
-
export function getGlossaryInstance(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
});
|
|
23
|
+
export async function getGlossaryInstance({ client, uuid, }) {
|
|
24
|
+
try {
|
|
25
|
+
const response = await client.request(GET_GLOSSARY_INSTANCE, { uuid });
|
|
26
|
+
return response.glossaryInstance;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error('Error fetching glossary instance:', error);
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
35
32
|
}
|
|
36
33
|
//# sourceMappingURL=get-glossary-instance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-glossary-instance.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-glossary-instance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-glossary-instance.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-glossary-instance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAGtC,MAAM,qBAAqB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;CAiBhC,CAAC;AAMF;;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,gBAAgB,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { gql } from 'graphql-request';
|
|
3
2
|
import { passageFromGraphQL } from '../mappers';
|
|
4
3
|
const GET_PASSAGE = gql `
|
|
@@ -47,22 +46,20 @@ const GET_PASSAGE = gql `
|
|
|
47
46
|
/**
|
|
48
47
|
* Get a single passage by UUID or XML ID.
|
|
49
48
|
*/
|
|
50
|
-
export function getPassage(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!response.passage) {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
return passageFromGraphQL(response.passage);
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
console.error('Error fetching passage:', error);
|
|
49
|
+
export async function getPassage({ client, uuid, xmlId, }) {
|
|
50
|
+
try {
|
|
51
|
+
const response = await client.request(GET_PASSAGE, {
|
|
52
|
+
uuid,
|
|
53
|
+
xmlId,
|
|
54
|
+
});
|
|
55
|
+
if (!response.passage) {
|
|
64
56
|
return undefined;
|
|
65
57
|
}
|
|
66
|
-
|
|
58
|
+
return passageFromGraphQL(response.passage);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.error('Error fetching passage:', error);
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
67
64
|
}
|
|
68
65
|
//# sourceMappingURL=get-passage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-passage.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-passage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-passage.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-passage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAC;AAErE,MAAM,WAAW,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CtB,CAAC;AAMF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAC/B,MAAM,EACN,IAAI,EACJ,KAAK,GAKN;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAqB,WAAW,EAAE;YACrE,IAAI;YACJ,KAAK;SACN,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QAChD,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { gql } from 'graphql-request';
|
|
3
2
|
const GET_TERM_PASSAGES = gql `
|
|
4
3
|
query GetTermPassages($uuid: ID!, $first: Int, $after: String) {
|
|
@@ -17,16 +16,14 @@ const GET_TERM_PASSAGES = gql `
|
|
|
17
16
|
/**
|
|
18
17
|
* Fetch a page of passage references for a single glossary term instance.
|
|
19
18
|
*/
|
|
20
|
-
export function getTermPassages(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
});
|
|
19
|
+
export async function getTermPassages({ client, uuid, first = 10, after, }) {
|
|
20
|
+
try {
|
|
21
|
+
const response = await client.request(GET_TERM_PASSAGES, { uuid, first, after });
|
|
22
|
+
return response.glossaryTermPassages;
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
console.error('Error fetching term passages:', error);
|
|
26
|
+
return { items: [], nextCursor: null, hasMore: false };
|
|
27
|
+
}
|
|
31
28
|
}
|
|
32
29
|
//# sourceMappingURL=get-term-passages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-term-passages.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-term-passages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-term-passages.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-term-passages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,MAAM,iBAAiB,GAAG,GAAG,CAAA;;;;;;;;;;;;;CAa5B,CAAC;AAYF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EACpC,MAAM,EACN,IAAI,EACJ,KAAK,GAAG,EAAE,EACV,KAAK,GAMN;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,iBAAiB,EACjB,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CACvB,CAAC;QACF,OAAO,QAAQ,CAAC,oBAAoB,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACzD,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { gql } from 'graphql-request';
|
|
3
2
|
const GET_PASSAGES_AROUND_WITH_JSON = gql `
|
|
4
3
|
fragment PassageWithJson on Passage {
|
|
@@ -43,44 +42,41 @@ const GET_PASSAGES_AROUND_WITH_JSON = gql `
|
|
|
43
42
|
*
|
|
44
43
|
* Returns pre-transformed TipTap editor blocks ready for rendering.
|
|
45
44
|
*/
|
|
46
|
-
export function getTranslationBlocksAround(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
-
if (!response.work) {
|
|
57
|
-
return {
|
|
58
|
-
blocks: [],
|
|
59
|
-
hasMoreAfter: false,
|
|
60
|
-
hasMoreBefore: false,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
const { passages } = response.work;
|
|
64
|
-
// Extract the JSON blocks, filtering out any null values
|
|
65
|
-
const blocks = passages.nodes
|
|
66
|
-
.map((node) => node.json)
|
|
67
|
-
.filter((json) => json != null);
|
|
68
|
-
return {
|
|
69
|
-
blocks,
|
|
70
|
-
nextCursor: (_b = passages.pageInfo.nextCursor) !== null && _b !== void 0 ? _b : undefined,
|
|
71
|
-
prevCursor: (_c = passages.pageInfo.prevCursor) !== null && _c !== void 0 ? _c : undefined,
|
|
72
|
-
hasMoreAfter: passages.pageInfo.hasMoreAfter,
|
|
73
|
-
hasMoreBefore: passages.pageInfo.hasMoreBefore,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
console.error('Error fetching translation blocks around:', error);
|
|
45
|
+
export async function getTranslationBlocksAround({ client, uuid, passageUuid, type, maxPassages, }) {
|
|
46
|
+
try {
|
|
47
|
+
const response = await client.request(GET_PASSAGES_AROUND_WITH_JSON, {
|
|
48
|
+
uuid,
|
|
49
|
+
cursor: passageUuid,
|
|
50
|
+
limit: maxPassages,
|
|
51
|
+
filter: type ? { type } : undefined,
|
|
52
|
+
});
|
|
53
|
+
if (!response.work) {
|
|
78
54
|
return {
|
|
79
55
|
blocks: [],
|
|
80
56
|
hasMoreAfter: false,
|
|
81
57
|
hasMoreBefore: false,
|
|
82
58
|
};
|
|
83
59
|
}
|
|
84
|
-
|
|
60
|
+
const { passages } = response.work;
|
|
61
|
+
// Extract the JSON blocks, filtering out any null values
|
|
62
|
+
const blocks = passages.nodes
|
|
63
|
+
.map((node) => node.json)
|
|
64
|
+
.filter((json) => json != null);
|
|
65
|
+
return {
|
|
66
|
+
blocks,
|
|
67
|
+
nextCursor: passages.pageInfo.nextCursor ?? undefined,
|
|
68
|
+
prevCursor: passages.pageInfo.prevCursor ?? undefined,
|
|
69
|
+
hasMoreAfter: passages.pageInfo.hasMoreAfter,
|
|
70
|
+
hasMoreBefore: passages.pageInfo.hasMoreBefore,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.error('Error fetching translation blocks around:', error);
|
|
75
|
+
return {
|
|
76
|
+
blocks: [],
|
|
77
|
+
hasMoreAfter: false,
|
|
78
|
+
hasMoreBefore: false,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
85
81
|
}
|
|
86
82
|
//# sourceMappingURL=get-translation-blocks-around.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-translation-blocks-around.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-translation-blocks-around.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-translation-blocks-around.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-translation-blocks-around.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAItC,MAAM,6BAA6B,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCxC,CAAC;AA2BF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,EAC/C,MAAM,EACN,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,WAAW,GAOZ;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,6BAA6B,EAC7B;YACE,IAAI;YACJ,MAAM,EAAE,WAAW;YACnB,KAAK,EAAE,WAAW;YAClB,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;SACpC,CACF,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnB,OAAO;gBACL,MAAM,EAAE,EAAE;gBACV,YAAY,EAAE,KAAK;gBACnB,aAAa,EAAE,KAAK;aACrB,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;QAEnC,yDAAyD;QACzD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK;aAC1B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;aACxB,MAAM,CAAC,CAAC,IAAI,EAAwC,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;QAExE,OAAO;YACL,MAAM;YACN,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU,IAAI,SAAS;YACrD,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU,IAAI,SAAS;YACrD,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,YAAY;YAC5C,aAAa,EAAE,QAAQ,CAAC,QAAQ,CAAC,aAAa;SAC/C,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,KAAK,CAAC,CAAC;QAClE,OAAO;YACL,MAAM,EAAE,EAAE;YACV,YAAY,EAAE,KAAK;YACnB,aAAa,EAAE,KAAK;SACrB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { gql } from 'graphql-request';
|
|
3
2
|
const GET_PASSAGES_WITH_JSON = gql `
|
|
4
3
|
fragment PassageWithJson on Passage {
|
|
@@ -52,45 +51,42 @@ function mapDirection(direction) {
|
|
|
52
51
|
*
|
|
53
52
|
* Returns pre-transformed TipTap editor blocks ready for rendering.
|
|
54
53
|
*/
|
|
55
|
-
export function getTranslationBlocks(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
66
|
-
if (!response.work) {
|
|
67
|
-
return {
|
|
68
|
-
blocks: [],
|
|
69
|
-
hasMoreAfter: false,
|
|
70
|
-
hasMoreBefore: false,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
const { passages } = response.work;
|
|
74
|
-
// Extract the JSON blocks, filtering out any null values
|
|
75
|
-
const blocks = passages.nodes
|
|
76
|
-
.map((node) => node.json)
|
|
77
|
-
.filter((json) => json != null);
|
|
78
|
-
return {
|
|
79
|
-
blocks,
|
|
80
|
-
nextCursor: (_b = passages.pageInfo.nextCursor) !== null && _b !== void 0 ? _b : undefined,
|
|
81
|
-
prevCursor: (_c = passages.pageInfo.prevCursor) !== null && _c !== void 0 ? _c : undefined,
|
|
82
|
-
hasMoreAfter: passages.pageInfo.hasMoreAfter,
|
|
83
|
-
hasMoreBefore: passages.pageInfo.hasMoreBefore,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
console.error('Error fetching translation blocks:', error);
|
|
54
|
+
export async function getTranslationBlocks({ client, uuid, type, cursor, maxPassages = 100, direction, }) {
|
|
55
|
+
try {
|
|
56
|
+
const response = await client.request(GET_PASSAGES_WITH_JSON, {
|
|
57
|
+
uuid,
|
|
58
|
+
cursor,
|
|
59
|
+
limit: maxPassages,
|
|
60
|
+
direction: mapDirection(direction),
|
|
61
|
+
filter: type ? { type } : undefined,
|
|
62
|
+
});
|
|
63
|
+
if (!response.work) {
|
|
88
64
|
return {
|
|
89
65
|
blocks: [],
|
|
90
66
|
hasMoreAfter: false,
|
|
91
67
|
hasMoreBefore: false,
|
|
92
68
|
};
|
|
93
69
|
}
|
|
94
|
-
|
|
70
|
+
const { passages } = response.work;
|
|
71
|
+
// Extract the JSON blocks, filtering out any null values
|
|
72
|
+
const blocks = passages.nodes
|
|
73
|
+
.map((node) => node.json)
|
|
74
|
+
.filter((json) => json != null);
|
|
75
|
+
return {
|
|
76
|
+
blocks,
|
|
77
|
+
nextCursor: passages.pageInfo.nextCursor ?? undefined,
|
|
78
|
+
prevCursor: passages.pageInfo.prevCursor ?? undefined,
|
|
79
|
+
hasMoreAfter: passages.pageInfo.hasMoreAfter,
|
|
80
|
+
hasMoreBefore: passages.pageInfo.hasMoreBefore,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
console.error('Error fetching translation blocks:', error);
|
|
85
|
+
return {
|
|
86
|
+
blocks: [],
|
|
87
|
+
hasMoreAfter: false,
|
|
88
|
+
hasMoreBefore: false,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
95
91
|
}
|
|
96
92
|
//# sourceMappingURL=get-translation-blocks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-translation-blocks.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-translation-blocks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-translation-blocks.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-translation-blocks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAQtC,MAAM,sBAAsB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCjC,CAAC;AAsCF;;GAEG;AACH,SAAS,YAAY,CACnB,SAA+B;IAE/B,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACjC,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;AAC1D,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,EACzC,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,WAAW,GAAG,GAAG,EACjB,SAAS,GAQV;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,sBAAsB,EACtB;YACE,IAAI;YACJ,MAAM;YACN,KAAK,EAAE,WAAW;YAClB,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC;YAClC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;SACpC,CACF,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnB,OAAO;gBACL,MAAM,EAAE,EAAE;gBACV,YAAY,EAAE,KAAK;gBACnB,aAAa,EAAE,KAAK;aACrB,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;QAEnC,yDAAyD;QACzD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK;aAC1B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;aACxB,MAAM,CAAC,CAAC,IAAI,EAAwC,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;QAExE,OAAO;YACL,MAAM;YACN,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU,IAAI,SAAS;YACrD,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU,IAAI,SAAS;YACrD,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,YAAY;YAC5C,aAAa,EAAE,QAAQ,CAAC,QAAQ,CAAC,aAAa;SAC/C,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;QAC3D,OAAO;YACL,MAAM,EAAE,EAAE;YACV,YAAY,EAAE,KAAK;YACnB,aAAa,EAAE,KAAK;SACrB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { gql } from 'graphql-request';
|
|
3
2
|
import { imprintFromGraphQL } from '../mappers';
|
|
4
3
|
const GET_WORK_WITH_IMPRINT = gql `
|
|
@@ -49,20 +48,17 @@ const GET_WORK_WITH_IMPRINT = gql `
|
|
|
49
48
|
/**
|
|
50
49
|
* Get the imprint for a translation work.
|
|
51
50
|
*/
|
|
52
|
-
export function getTranslationImprint(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const response = yield client.request(GET_WORK_WITH_IMPRINT, { uuid, toh });
|
|
57
|
-
if (!((_b = response.work) === null || _b === void 0 ? void 0 : _b.imprint)) {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
return imprintFromGraphQL(response.work.imprint, response.work.uuid);
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
console.error('Error fetching translation imprint:', error);
|
|
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) {
|
|
64
55
|
return undefined;
|
|
65
56
|
}
|
|
66
|
-
|
|
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
|
+
}
|
|
67
63
|
}
|
|
68
64
|
//# sourceMappingURL=get-translation-imprint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-translation-imprint.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-translation-imprint.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { gql } from 'graphql-request';
|
|
3
2
|
import { workFromGraphQL } from '../mappers';
|
|
4
3
|
const GET_WORK_BY_UUID = gql `
|
|
@@ -32,41 +31,37 @@ const GET_WORK_BY_TOH = gql `
|
|
|
32
31
|
/**
|
|
33
32
|
* Get work metadata by UUID.
|
|
34
33
|
*/
|
|
35
|
-
export function getTranslationMetadataByUuid(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (!response.work) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
return workFromGraphQL(response.work);
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
console.error('Error fetching translation metadata by UUID:', error);
|
|
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) {
|
|
48
40
|
return null;
|
|
49
41
|
}
|
|
50
|
-
|
|
42
|
+
return workFromGraphQL(response.work);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error('Error fetching translation metadata by UUID:', error);
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
51
48
|
}
|
|
52
49
|
/**
|
|
53
50
|
* Get work metadata by Tohoku catalog number.
|
|
54
51
|
*/
|
|
55
|
-
export function getTranslationMetadataByToh(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (!response.work) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
return workFromGraphQL(response.work);
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
console.error('Error fetching translation metadata by toh:', error);
|
|
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) {
|
|
68
58
|
return null;
|
|
69
59
|
}
|
|
70
|
-
|
|
60
|
+
return workFromGraphQL(response.work);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.error('Error fetching translation metadata by toh:', error);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
71
66
|
}
|
|
72
67
|
//# sourceMappingURL=get-translation-metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-translation-metadata.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-translation-metadata.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { gql } from 'graphql-request';
|
|
3
2
|
import { titlesFromGraphQL } from '../mappers';
|
|
4
3
|
const GET_WORK_TITLES = gql `
|
|
@@ -16,19 +15,17 @@ const GET_WORK_TITLES = gql `
|
|
|
16
15
|
/**
|
|
17
16
|
* Get all titles for a work.
|
|
18
17
|
*/
|
|
19
|
-
export function getTranslationTitles(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (!response.work) {
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
return titlesFromGraphQL(response.work.titles);
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
console.error('Error fetching translation titles:', error);
|
|
18
|
+
export async function getTranslationTitles({ client, uuid, }) {
|
|
19
|
+
try {
|
|
20
|
+
const response = await client.request(GET_WORK_TITLES, { uuid });
|
|
21
|
+
if (!response.work) {
|
|
30
22
|
return [];
|
|
31
23
|
}
|
|
32
|
-
|
|
24
|
+
return titlesFromGraphQL(response.work.titles);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error('Error fetching translation titles:', error);
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
33
30
|
}
|
|
34
31
|
//# sourceMappingURL=get-translation-titles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-translation-titles.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-translation-titles.ts"],"names":[],"mappings":"
|
|
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"}
|