@eightyfourthousand/client-graphql 2026.4.0 → 2026.4.1
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 +46 -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 +27 -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 +36 -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 +68 -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 +32 -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 +86 -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 +96 -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 +68 -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 +72 -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 +34 -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} +18 -48
- 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 +40 -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 +51 -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 +33 -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 +32 -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 +95 -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 +104 -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 +15 -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 +49 -0
- package/lib/functions/replace.js.map +1 -0
- package/lib/functions/save-passages.d.ts +16 -0
- package/lib/functions/save-passages.js +35 -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 +74 -0
- package/lib/mappers/annotation.js.map +1 -0
- package/lib/mappers/imprint.d.ts +37 -0
- package/lib/mappers/imprint.js +44 -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 +39 -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,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>;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { gql } from 'graphql-request';
|
|
3
|
+
const GET_WORK_GLOSSARY_TERMS = gql `
|
|
4
|
+
query GetWorkGlossaryTerms(
|
|
5
|
+
$uuid: ID!
|
|
6
|
+
$cursor: String
|
|
7
|
+
$limit: Int
|
|
8
|
+
$direction: PaginationDirection
|
|
9
|
+
$withAttestations: Boolean
|
|
10
|
+
) {
|
|
11
|
+
work(uuid: $uuid) {
|
|
12
|
+
glossaryTerms(
|
|
13
|
+
cursor: $cursor
|
|
14
|
+
limit: $limit
|
|
15
|
+
direction: $direction
|
|
16
|
+
withAttestations: $withAttestations
|
|
17
|
+
) {
|
|
18
|
+
nodes {
|
|
19
|
+
uuid
|
|
20
|
+
authority
|
|
21
|
+
definition
|
|
22
|
+
termNumber
|
|
23
|
+
names {
|
|
24
|
+
english
|
|
25
|
+
tibetan
|
|
26
|
+
sanskrit
|
|
27
|
+
pali
|
|
28
|
+
chinese
|
|
29
|
+
wylie
|
|
30
|
+
alternatives
|
|
31
|
+
}
|
|
32
|
+
passages(first: 10) {
|
|
33
|
+
items {
|
|
34
|
+
uuid
|
|
35
|
+
type
|
|
36
|
+
label
|
|
37
|
+
}
|
|
38
|
+
nextCursor
|
|
39
|
+
hasMore
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
pageInfo {
|
|
43
|
+
nextCursor
|
|
44
|
+
prevCursor
|
|
45
|
+
hasMoreAfter
|
|
46
|
+
hasMoreBefore
|
|
47
|
+
}
|
|
48
|
+
totalCount
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
/**
|
|
54
|
+
* Map internal pagination direction to GraphQL enum
|
|
55
|
+
*/
|
|
56
|
+
function mapDirection(direction) {
|
|
57
|
+
if (!direction)
|
|
58
|
+
return undefined;
|
|
59
|
+
return direction === 'forward' ? 'FORWARD' : 'BACKWARD';
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get paginated glossary terms for a work.
|
|
63
|
+
*/
|
|
64
|
+
export function getWorkGlossaryTerms(_a) {
|
|
65
|
+
return __awaiter(this, arguments, void 0, function* ({ client, uuid, cursor, limit = 50, direction, withAttestations = false, }) {
|
|
66
|
+
var _b, _c;
|
|
67
|
+
try {
|
|
68
|
+
const response = yield client.request(GET_WORK_GLOSSARY_TERMS, {
|
|
69
|
+
uuid,
|
|
70
|
+
cursor,
|
|
71
|
+
limit,
|
|
72
|
+
direction: mapDirection(direction),
|
|
73
|
+
withAttestations,
|
|
74
|
+
});
|
|
75
|
+
if (!response.work) {
|
|
76
|
+
return {
|
|
77
|
+
terms: [],
|
|
78
|
+
hasMoreAfter: false,
|
|
79
|
+
hasMoreBefore: false,
|
|
80
|
+
totalCount: 0,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const { glossaryTerms } = response.work;
|
|
84
|
+
return {
|
|
85
|
+
terms: glossaryTerms.nodes,
|
|
86
|
+
nextCursor: (_b = glossaryTerms.pageInfo.nextCursor) !== null && _b !== void 0 ? _b : undefined,
|
|
87
|
+
prevCursor: (_c = glossaryTerms.pageInfo.prevCursor) !== null && _c !== void 0 ? _c : undefined,
|
|
88
|
+
hasMoreAfter: glossaryTerms.pageInfo.hasMoreAfter,
|
|
89
|
+
hasMoreBefore: glossaryTerms.pageInfo.hasMoreBefore,
|
|
90
|
+
totalCount: glossaryTerms.totalCount,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.error('Error fetching work glossary terms:', error);
|
|
95
|
+
return {
|
|
96
|
+
terms: [],
|
|
97
|
+
hasMoreAfter: false,
|
|
98
|
+
hasMoreBefore: false,
|
|
99
|
+
totalCount: 0,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=get-work-glossary-terms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-work-glossary-terms.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/get-work-glossary-terms.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAMtC,MAAM,uBAAuB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDlC,CAAC;AA6BF;;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;;GAEG;AACH,MAAM,UAAgB,oBAAoB;yDAAC,EACzC,MAAM,EACN,IAAI,EACJ,MAAM,EACN,KAAK,GAAG,EAAE,EACV,SAAS,EACT,gBAAgB,GAAG,KAAK,GAQzB;;QACC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,uBAAuB,EACvB;gBACE,IAAI;gBACJ,MAAM;gBACN,KAAK;gBACL,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC;gBAClC,gBAAgB;aACjB,CACF,CAAC;YAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACnB,OAAO;oBACL,KAAK,EAAE,EAAE;oBACT,YAAY,EAAE,KAAK;oBACnB,aAAa,EAAE,KAAK;oBACpB,UAAU,EAAE,CAAC;iBACd,CAAC;YACJ,CAAC;YAED,MAAM,EAAE,aAAa,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;YAExC,OAAO;gBACL,KAAK,EAAE,aAAa,CAAC,KAAK;gBAC1B,UAAU,EAAE,MAAA,aAAa,CAAC,QAAQ,CAAC,UAAU,mCAAI,SAAS;gBAC1D,UAAU,EAAE,MAAA,aAAa,CAAC,QAAQ,CAAC,UAAU,mCAAI,SAAS;gBAC1D,YAAY,EAAE,aAAa,CAAC,QAAQ,CAAC,YAAY;gBACjD,aAAa,EAAE,aAAa,CAAC,QAAQ,CAAC,aAAa;gBACnD,UAAU,EAAE,aAAa,CAAC,UAAU;aACrC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;YAC5D,OAAO;gBACL,KAAK,EAAE,EAAE;gBACT,YAAY,EAAE,KAAK;gBACnB,aAAa,EAAE,KAAK;gBACpB,UAAU,EAAE,CAAC;aACd,CAAC;QACJ,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
export type Permission = 'PROJECTS_READ' | 'PROJECTS_EDIT' | 'PROJECTS_ADMIN' | 'EDITOR_READ' | 'EDITOR_EDIT' | 'EDITOR_ADMIN';
|
|
3
|
+
/**
|
|
4
|
+
* Check if the current user has a specific permission
|
|
5
|
+
*/
|
|
6
|
+
export declare const hasPermission: ({ client, permission, }: {
|
|
7
|
+
client: GraphQLClient;
|
|
8
|
+
permission: Permission;
|
|
9
|
+
}) => Promise<boolean>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { gql } from 'graphql-request';
|
|
3
|
+
const HAS_PERMISSION_QUERY = gql `
|
|
4
|
+
query HasPermission($permission: Permission!) {
|
|
5
|
+
hasPermission(permission: $permission)
|
|
6
|
+
}
|
|
7
|
+
`;
|
|
8
|
+
/**
|
|
9
|
+
* Check if the current user has a specific permission
|
|
10
|
+
*/
|
|
11
|
+
export const hasPermission = (_a) => __awaiter(void 0, [_a], void 0, function* ({ client, permission, }) {
|
|
12
|
+
const response = yield client.request(HAS_PERMISSION_QUERY, { permission });
|
|
13
|
+
return response.hasPermission;
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=has-permission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-permission.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/has-permission.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAWtC,MAAM,oBAAoB,GAAG,GAAG,CAAA;;;;CAI/B,CAAC;AAMF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAMR,EAAE,4CANa,EAClC,MAAM,EACN,UAAU,GAIX;IACC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,oBAAoB,EACpB,EAAE,UAAU,EAAE,CACf,CAAC;IACF,OAAO,QAAQ,CAAC,aAAa,CAAC;AAChC,CAAC,CAAA,CAAC"}
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
export { getPassage } from './get-passage';
|
|
2
|
-
export {
|
|
3
|
-
getTranslationBlocks,
|
|
4
|
-
type TranslationBlocksPage,
|
|
5
|
-
} from './get-translation-blocks';
|
|
2
|
+
export { getTranslationBlocks, type TranslationBlocksPage, } from './get-translation-blocks';
|
|
6
3
|
export { getTranslationBlocksAround } from './get-translation-blocks-around';
|
|
7
4
|
export { getTranslationTitles } from './get-translation-titles';
|
|
8
|
-
export {
|
|
9
|
-
getTranslationMetadataByUuid,
|
|
10
|
-
getTranslationMetadataByToh,
|
|
11
|
-
} from './get-translation-metadata';
|
|
5
|
+
export { getTranslationMetadataByUuid, getTranslationMetadataByToh, } from './get-translation-metadata';
|
|
12
6
|
export { getTranslationsMetadata } from './get-translations-metadata';
|
|
13
7
|
export { getTranslationUuids } from './get-translation-uuids';
|
|
14
8
|
export { getTranslationToc } from './get-translation-toc';
|
|
15
9
|
export { getTranslationImprint } from './get-translation-imprint';
|
|
16
10
|
export { getGlossaryInstance } from './get-glossary-instance';
|
|
17
|
-
export {
|
|
18
|
-
getWorkGlossaryTerms,
|
|
19
|
-
type GlossaryTermsPage,
|
|
20
|
-
} from './get-work-glossary-terms';
|
|
11
|
+
export { getWorkGlossaryTerms, type GlossaryTermsPage, } from './get-work-glossary-terms';
|
|
21
12
|
export { getWorkGlossaryTermsAround } from './get-work-glossary-terms-around';
|
|
22
13
|
export { getTermPassages, type GlossaryPassagesPage } from './get-term-passages';
|
|
23
14
|
export { getBibliographyEntry } from './get-bibliography-entry';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { getPassage } from './get-passage';
|
|
2
|
+
export { getTranslationBlocks, } from './get-translation-blocks';
|
|
3
|
+
export { getTranslationBlocksAround } from './get-translation-blocks-around';
|
|
4
|
+
export { getTranslationTitles } from './get-translation-titles';
|
|
5
|
+
export { getTranslationMetadataByUuid, getTranslationMetadataByToh, } from './get-translation-metadata';
|
|
6
|
+
export { getTranslationsMetadata } from './get-translations-metadata';
|
|
7
|
+
export { getTranslationUuids } from './get-translation-uuids';
|
|
8
|
+
export { getTranslationToc } from './get-translation-toc';
|
|
9
|
+
export { getTranslationImprint } from './get-translation-imprint';
|
|
10
|
+
export { getGlossaryInstance } from './get-glossary-instance';
|
|
11
|
+
export { getWorkGlossaryTerms, } from './get-work-glossary-terms';
|
|
12
|
+
export { getWorkGlossaryTermsAround } from './get-work-glossary-terms-around';
|
|
13
|
+
export { getTermPassages } from './get-term-passages';
|
|
14
|
+
export { getBibliographyEntry } from './get-bibliography-entry';
|
|
15
|
+
export { getWorkBibliography } from './get-work-bibliography';
|
|
16
|
+
export { getWorkFolios } from './get-work-folios';
|
|
17
|
+
export { hasPermission } from './has-permission';
|
|
18
|
+
export { replace } from './replace';
|
|
19
|
+
export { savePassages } from './save-passages';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,oBAAoB,GAErB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAA6B,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAmB,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,OAAO,EAA0C,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import type { TranslationEditorContentItem } from '@eightyfourthousand/data-access';
|
|
3
|
+
export type ReplaceType = 'PASSAGE';
|
|
4
|
+
export interface ReplacedPassage {
|
|
5
|
+
json?: TranslationEditorContentItem | null;
|
|
6
|
+
uuid: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const replace: ({ client, cursorPassageUuid, cursorStart, occurrenceIndex, replaceText, searchText, targetUuids, type, }: {
|
|
9
|
+
client: GraphQLClient;
|
|
10
|
+
occurrenceIndex?: number;
|
|
11
|
+
replaceText: string;
|
|
12
|
+
searchText: string;
|
|
13
|
+
cursorPassageUuid?: string;
|
|
14
|
+
cursorStart?: number;
|
|
15
|
+
targetUuids: string[];
|
|
16
|
+
type?: ReplaceType;
|
|
17
|
+
}) => Promise<{
|
|
18
|
+
deletedAnnotationCount: number;
|
|
19
|
+
error?: string;
|
|
20
|
+
nextOccurrenceStart?: number | null;
|
|
21
|
+
nextPassageUuid?: string | null;
|
|
22
|
+
passages: ReplacedPassage[];
|
|
23
|
+
replacedOccurrenceCount: number;
|
|
24
|
+
success: boolean;
|
|
25
|
+
updatedAnnotationCount: number;
|
|
26
|
+
updatedCount: number;
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { gql } from 'graphql-request';
|
|
3
|
+
const REPLACE_MUTATION = gql `
|
|
4
|
+
mutation Replace(
|
|
5
|
+
$searchText: String!
|
|
6
|
+
$replaceText: String!
|
|
7
|
+
$targetUuids: [ID!]!
|
|
8
|
+
$type: ReplaceType
|
|
9
|
+
$occurrenceIndex: Int
|
|
10
|
+
$cursorPassageUuid: ID
|
|
11
|
+
$cursorStart: Int
|
|
12
|
+
) {
|
|
13
|
+
replace(
|
|
14
|
+
searchText: $searchText
|
|
15
|
+
replaceText: $replaceText
|
|
16
|
+
targetUuids: $targetUuids
|
|
17
|
+
type: $type
|
|
18
|
+
occurrenceIndex: $occurrenceIndex
|
|
19
|
+
cursorPassageUuid: $cursorPassageUuid
|
|
20
|
+
cursorStart: $cursorStart
|
|
21
|
+
) {
|
|
22
|
+
success
|
|
23
|
+
updatedCount
|
|
24
|
+
replacedOccurrenceCount
|
|
25
|
+
updatedAnnotationCount
|
|
26
|
+
deletedAnnotationCount
|
|
27
|
+
nextPassageUuid
|
|
28
|
+
nextOccurrenceStart
|
|
29
|
+
error
|
|
30
|
+
passages {
|
|
31
|
+
uuid
|
|
32
|
+
json
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
export const replace = (_a) => __awaiter(void 0, [_a], void 0, function* ({ client, cursorPassageUuid, cursorStart, occurrenceIndex, replaceText, searchText, targetUuids, type = 'PASSAGE', }) {
|
|
38
|
+
const response = yield client.request(REPLACE_MUTATION, {
|
|
39
|
+
searchText,
|
|
40
|
+
replaceText,
|
|
41
|
+
targetUuids,
|
|
42
|
+
type,
|
|
43
|
+
occurrenceIndex,
|
|
44
|
+
cursorPassageUuid,
|
|
45
|
+
cursorStart,
|
|
46
|
+
});
|
|
47
|
+
return response.replace;
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=replace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/replace.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAwBtC,MAAM,gBAAgB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC3B,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,KAkBpB,EAAE,4CAlByB,EAC5B,MAAM,EACN,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,WAAW,EACX,UAAU,EACV,WAAW,EACX,IAAI,GAAG,SAAS,GAUjB;IACC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAkB,gBAAgB,EAAE;QACvE,UAAU;QACV,WAAW;QACX,WAAW;QACX,IAAI;QACJ,eAAe;QACf,iBAAiB;QACjB,WAAW;KACZ,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC,CAAA,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import type { Passage } from '@eightyfourthousand/data-access';
|
|
3
|
+
/**
|
|
4
|
+
* Save one or more passages via GraphQL mutation.
|
|
5
|
+
* Requires editor.edit permission.
|
|
6
|
+
*/
|
|
7
|
+
export declare const savePassages: ({ client, passages, deletedUuids, }: {
|
|
8
|
+
client: GraphQLClient;
|
|
9
|
+
passages: Passage[];
|
|
10
|
+
deletedUuids?: string[];
|
|
11
|
+
}) => Promise<{
|
|
12
|
+
success: boolean;
|
|
13
|
+
savedCount: number;
|
|
14
|
+
deletedCount?: number;
|
|
15
|
+
error?: string;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { gql } from 'graphql-request';
|
|
3
|
+
const SAVE_PASSAGES_MUTATION = gql `
|
|
4
|
+
mutation SavePassages($passages: [PassageInput!]!, $deletedUuids: [ID!]) {
|
|
5
|
+
savePassages(passages: $passages, deletedUuids: $deletedUuids) {
|
|
6
|
+
success
|
|
7
|
+
savedCount
|
|
8
|
+
deletedCount
|
|
9
|
+
error
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
/**
|
|
14
|
+
* Convert a Passage to the GraphQL input format
|
|
15
|
+
*/
|
|
16
|
+
const passageToInput = (passage) => ({
|
|
17
|
+
uuid: passage.uuid,
|
|
18
|
+
workUuid: passage.workUuid,
|
|
19
|
+
content: passage.content,
|
|
20
|
+
label: passage.label,
|
|
21
|
+
sort: passage.sort,
|
|
22
|
+
type: passage.type,
|
|
23
|
+
xmlId: passage.xmlId,
|
|
24
|
+
annotations: passage.annotations,
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Save one or more passages via GraphQL mutation.
|
|
28
|
+
* Requires editor.edit permission.
|
|
29
|
+
*/
|
|
30
|
+
export const savePassages = (_a) => __awaiter(void 0, [_a], void 0, function* ({ client, passages, deletedUuids, }) {
|
|
31
|
+
const passageInputs = passages.map(passageToInput);
|
|
32
|
+
const response = yield client.request(SAVE_PASSAGES_MUTATION, { passages: passageInputs, deletedUuids });
|
|
33
|
+
return response.savePassages;
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=save-passages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-passages.js","sourceRoot":"","sources":["../../../../../libs/client-graphql/src/lib/functions/save-passages.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAGtC,MAAM,sBAAsB,GAAG,GAAG,CAAA;;;;;;;;;CASjC,CAAC;AAsBF;;GAEG;AACH,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAgB,EAAE,CAAC,CAAC;IAC1D,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;IAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;IACxB,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,WAAW,EAAE,OAAO,CAAC,WAAW;CACjC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAazB,EAAE,4CAb8B,EACjC,MAAM,EACN,QAAQ,EACR,YAAY,GAKb;IAMC,MAAM,aAAa,GAAG,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEnD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,sBAAsB,EACtB,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,CAC1C,CAAC;IAEF,OAAO,QAAQ,CAAC,YAAY,CAAC;AAC/B,CAAC,CAAA,CAAC"}
|