@eightyfourthousand/client-graphql 2026.3.1 → 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.
Files changed (154) hide show
  1. package/index.d.ts +4 -0
  2. package/index.js +7 -0
  3. package/index.js.map +1 -0
  4. package/lib/client-ssr.d.ts +16 -0
  5. package/lib/client-ssr.js +39 -0
  6. package/lib/client-ssr.js.map +1 -0
  7. package/lib/client.d.ts +15 -0
  8. package/lib/client.js +46 -0
  9. package/lib/client.js.map +1 -0
  10. package/lib/config.d.ts +8 -0
  11. package/lib/config.js +19 -0
  12. package/lib/config.js.map +1 -0
  13. package/lib/functions/get-bibliography-entry.d.ts +9 -0
  14. package/lib/functions/get-bibliography-entry.js +27 -0
  15. package/lib/functions/get-bibliography-entry.js.map +1 -0
  16. package/lib/functions/get-glossary-instance.d.ts +9 -0
  17. package/lib/functions/get-glossary-instance.js +36 -0
  18. package/lib/functions/get-glossary-instance.js.map +1 -0
  19. package/lib/functions/get-passage.d.ts +10 -0
  20. package/lib/functions/get-passage.js +68 -0
  21. package/lib/functions/get-passage.js.map +1 -0
  22. package/lib/functions/get-term-passages.d.ts +20 -0
  23. package/lib/functions/get-term-passages.js +32 -0
  24. package/lib/functions/get-term-passages.js.map +1 -0
  25. package/lib/functions/get-translation-blocks-around.d.ts +15 -0
  26. package/lib/functions/get-translation-blocks-around.js +86 -0
  27. package/lib/functions/get-translation-blocks-around.js.map +1 -0
  28. package/lib/functions/get-translation-blocks.d.ts +25 -0
  29. package/lib/functions/get-translation-blocks.js +96 -0
  30. package/lib/functions/get-translation-blocks.js.map +1 -0
  31. package/lib/functions/get-translation-imprint.d.ts +10 -0
  32. package/lib/functions/get-translation-imprint.js +68 -0
  33. package/lib/functions/get-translation-imprint.js.map +1 -0
  34. package/lib/functions/get-translation-metadata.d.ts +16 -0
  35. package/lib/functions/get-translation-metadata.js +72 -0
  36. package/lib/functions/get-translation-metadata.js.map +1 -0
  37. package/lib/functions/get-translation-titles.d.ts +9 -0
  38. package/lib/functions/get-translation-titles.js +34 -0
  39. package/lib/functions/get-translation-titles.js.map +1 -0
  40. package/lib/functions/get-translation-toc.d.ts +9 -0
  41. package/{src/lib/functions/get-translation-toc.ts → lib/functions/get-translation-toc.js} +18 -48
  42. package/lib/functions/get-translation-toc.js.map +1 -0
  43. package/lib/functions/get-translation-uuids.d.ts +16 -0
  44. package/lib/functions/get-translation-uuids.js +40 -0
  45. package/lib/functions/get-translation-uuids.js.map +1 -0
  46. package/lib/functions/get-translations-metadata.d.ts +9 -0
  47. package/lib/functions/get-translations-metadata.js +51 -0
  48. package/lib/functions/get-translations-metadata.js.map +1 -0
  49. package/lib/functions/get-work-bibliography.d.ts +9 -0
  50. package/lib/functions/get-work-bibliography.js +33 -0
  51. package/lib/functions/get-work-bibliography.js.map +1 -0
  52. package/lib/functions/get-work-folios.d.ts +12 -0
  53. package/lib/functions/get-work-folios.js +32 -0
  54. package/lib/functions/get-work-folios.js.map +1 -0
  55. package/lib/functions/get-work-glossary-terms-around.d.ts +13 -0
  56. package/lib/functions/get-work-glossary-terms-around.js +95 -0
  57. package/lib/functions/get-work-glossary-terms-around.js.map +1 -0
  58. package/lib/functions/get-work-glossary-terms.d.ts +24 -0
  59. package/lib/functions/get-work-glossary-terms.js +104 -0
  60. package/lib/functions/get-work-glossary-terms.js.map +1 -0
  61. package/lib/functions/has-permission.d.ts +9 -0
  62. package/lib/functions/has-permission.js +15 -0
  63. package/lib/functions/has-permission.js.map +1 -0
  64. package/{src/lib/functions/index.ts → lib/functions/index.d.ts} +4 -18
  65. package/lib/functions/index.js +20 -0
  66. package/lib/functions/index.js.map +1 -0
  67. package/lib/functions/replace.d.ts +27 -0
  68. package/lib/functions/replace.js +49 -0
  69. package/lib/functions/replace.js.map +1 -0
  70. package/lib/functions/save-passages.d.ts +16 -0
  71. package/lib/functions/save-passages.js +35 -0
  72. package/lib/functions/save-passages.js.map +1 -0
  73. package/lib/generated/graphql.d.ts +1062 -0
  74. package/lib/generated/graphql.js +357 -0
  75. package/lib/generated/graphql.js.map +1 -0
  76. package/lib/mappers/alignment.d.ts +19 -0
  77. package/lib/mappers/alignment.js +19 -0
  78. package/lib/mappers/alignment.js.map +1 -0
  79. package/lib/mappers/annotation.d.ts +19 -0
  80. package/lib/mappers/annotation.js +74 -0
  81. package/lib/mappers/annotation.js.map +1 -0
  82. package/lib/mappers/imprint.d.ts +37 -0
  83. package/lib/mappers/imprint.js +44 -0
  84. package/lib/mappers/imprint.js.map +1 -0
  85. package/lib/mappers/index.js +8 -0
  86. package/lib/mappers/index.js.map +1 -0
  87. package/lib/mappers/passage.d.ts +41 -0
  88. package/lib/mappers/passage.js +39 -0
  89. package/lib/mappers/passage.js.map +1 -0
  90. package/lib/mappers/title.d.ts +18 -0
  91. package/lib/mappers/title.js +18 -0
  92. package/lib/mappers/title.js.map +1 -0
  93. package/lib/mappers/toc.d.ts +25 -0
  94. package/lib/mappers/toc.js +25 -0
  95. package/lib/mappers/toc.js.map +1 -0
  96. package/lib/mappers/work.d.ts +22 -0
  97. package/lib/mappers/work.js +22 -0
  98. package/lib/mappers/work.js.map +1 -0
  99. package/package.json +25 -3
  100. package/ssr.d.ts +4 -0
  101. package/ssr.js +7 -0
  102. package/ssr.js.map +1 -0
  103. package/README.md +0 -9
  104. package/codegen.ts +0 -34
  105. package/project.json +0 -21
  106. package/src/index.ts +0 -79
  107. package/src/lib/client-ssr.ts +0 -44
  108. package/src/lib/client.ts +0 -58
  109. package/src/lib/config.ts +0 -21
  110. package/src/lib/functions/get-bibliography-entry.ts +0 -40
  111. package/src/lib/functions/get-glossary-entry.ts +0 -136
  112. package/src/lib/functions/get-glossary-instance.ts +0 -48
  113. package/src/lib/functions/get-glossary-terms.ts +0 -44
  114. package/src/lib/functions/get-passage.ts +0 -78
  115. package/src/lib/functions/get-term-passages.ts +0 -53
  116. package/src/lib/functions/get-translation-blocks-around.ts +0 -131
  117. package/src/lib/functions/get-translation-blocks.ts +0 -160
  118. package/src/lib/functions/get-translation-imprint.ts +0 -114
  119. package/src/lib/functions/get-translation-metadata.ts +0 -99
  120. package/src/lib/functions/get-translation-passages-around.ts +0 -153
  121. package/src/lib/functions/get-translation-passages.ts +0 -168
  122. package/src/lib/functions/get-translation-titles.ts +0 -55
  123. package/src/lib/functions/get-translation-uuids.ts +0 -63
  124. package/src/lib/functions/get-translations-metadata.ts +0 -81
  125. package/src/lib/functions/get-work-bibliography.ts +0 -47
  126. package/src/lib/functions/get-work-folios.ts +0 -52
  127. package/src/lib/functions/get-work-glossary-terms-around.ts +0 -126
  128. package/src/lib/functions/get-work-glossary-terms.ts +0 -150
  129. package/src/lib/functions/get-work-glossary.ts +0 -54
  130. package/src/lib/functions/get-works.ts +0 -111
  131. package/src/lib/functions/has-permission.ts +0 -38
  132. package/src/lib/functions/save-passages.ts +0 -76
  133. package/src/lib/generated/graphql.ts +0 -1318
  134. package/src/lib/graphql/fragments/alignment.graphql +0 -7
  135. package/src/lib/graphql/fragments/annotation.graphql +0 -7
  136. package/src/lib/graphql/fragments/imprint.graphql +0 -34
  137. package/src/lib/graphql/fragments/passage.graphql +0 -29
  138. package/src/lib/graphql/fragments/title.graphql +0 -6
  139. package/src/lib/graphql/fragments/toc.graphql +0 -40
  140. package/src/lib/graphql/fragments/work.graphql +0 -10
  141. package/src/lib/graphql/queries/passages.graphql +0 -116
  142. package/src/lib/graphql/queries/work.graphql +0 -38
  143. package/src/lib/graphql/queries/works.graphql +0 -23
  144. package/src/lib/mappers/alignment.ts +0 -34
  145. package/src/lib/mappers/annotation.ts +0 -204
  146. package/src/lib/mappers/imprint.ts +0 -79
  147. package/src/lib/mappers/passage.ts +0 -80
  148. package/src/lib/mappers/title.ts +0 -35
  149. package/src/lib/mappers/toc.ts +0 -49
  150. package/src/lib/mappers/work.ts +0 -38
  151. package/src/ssr.ts +0 -73
  152. package/tsconfig.json +0 -17
  153. package/tsconfig.lib.json +0 -14
  154. /package/{src/lib/mappers/index.ts → lib/mappers/index.d.ts} +0 -0
@@ -1,80 +0,0 @@
1
- import type { Passage, PassagesPage, BodyItemType } from '@eightyfourthousand/data-access';
2
- import { annotationsFromGraphQL, type GraphQLAnnotation } from './annotation';
3
- import { alignmentsFromGraphQL, type GraphQLAlignment } from './alignment';
4
-
5
- /**
6
- * GraphQL Passage type
7
- */
8
- export type GraphQLPassage = {
9
- uuid: string;
10
- workUuid: string;
11
- content: string;
12
- label: string;
13
- sort: number;
14
- type: string;
15
- xmlId?: string | null;
16
- annotations?: GraphQLAnnotation[];
17
- alignments?: GraphQLAlignment[];
18
- };
19
-
20
- /**
21
- * GraphQL PageInfo type
22
- */
23
- export type GraphQLPageInfo = {
24
- nextCursor?: string | null;
25
- prevCursor?: string | null;
26
- hasMoreAfter: boolean;
27
- hasMoreBefore: boolean;
28
- };
29
-
30
- /**
31
- * GraphQL PassageConnection type
32
- */
33
- export type GraphQLPassageConnection = {
34
- nodes: GraphQLPassage[];
35
- pageInfo: GraphQLPageInfo;
36
- };
37
-
38
- /**
39
- * Convert a GraphQL passage to the internal Passage type
40
- */
41
- export function passageFromGraphQL(
42
- gqlPassage: GraphQLPassage,
43
- workUuid?: string,
44
- ): Passage {
45
- const annotations = gqlPassage.annotations
46
- ? annotationsFromGraphQL(gqlPassage.annotations, gqlPassage.uuid)
47
- : [];
48
-
49
- const alignments = gqlPassage.alignments
50
- ? alignmentsFromGraphQL(gqlPassage.alignments)
51
- : [];
52
-
53
- return {
54
- uuid: gqlPassage.uuid,
55
- content: gqlPassage.content,
56
- label: gqlPassage.label,
57
- sort: gqlPassage.sort,
58
- type: gqlPassage.type as BodyItemType,
59
- xmlId: gqlPassage.xmlId ?? undefined,
60
- workUuid: gqlPassage.workUuid ?? workUuid ?? '',
61
- annotations,
62
- alignments,
63
- };
64
- }
65
-
66
- /**
67
- * Convert a GraphQL PassageConnection to internal PassagesPage type
68
- */
69
- export function passagesPageFromGraphQL(
70
- connection: GraphQLPassageConnection,
71
- workUuid: string,
72
- ): PassagesPage {
73
- return {
74
- passages: connection.nodes.map((p) => passageFromGraphQL(p, workUuid)),
75
- nextCursor: connection.pageInfo.nextCursor ?? undefined,
76
- prevCursor: connection.pageInfo.prevCursor ?? undefined,
77
- hasMoreAfter: connection.pageInfo.hasMoreAfter,
78
- hasMoreBefore: connection.pageInfo.hasMoreBefore,
79
- };
80
- }
@@ -1,35 +0,0 @@
1
- import type {
2
- Title,
3
- Titles,
4
- TitleType,
5
- ExtendedTranslationLanguage,
6
- } from '@eightyfourthousand/data-access';
7
-
8
- /**
9
- * GraphQL Title type
10
- */
11
- export type GraphQLTitle = {
12
- uuid: string;
13
- content: string;
14
- language: string;
15
- type: string;
16
- };
17
-
18
- /**
19
- * Convert a GraphQL title to the internal Title type
20
- */
21
- export function titleFromGraphQL(gqlTitle: GraphQLTitle): Title {
22
- return {
23
- uuid: gqlTitle.uuid,
24
- title: gqlTitle.content,
25
- language: gqlTitle.language as ExtendedTranslationLanguage,
26
- type: gqlTitle.type as TitleType,
27
- };
28
- }
29
-
30
- /**
31
- * Convert an array of GraphQL titles to internal Title types
32
- */
33
- export function titlesFromGraphQL(gqlTitles: GraphQLTitle[]): Titles {
34
- return gqlTitles.map(titleFromGraphQL);
35
- }
@@ -1,49 +0,0 @@
1
- import type { Toc, TocEntry, TranslationSection } from '@eightyfourthousand/data-access';
2
-
3
- /**
4
- * GraphQL TocEntry type
5
- */
6
- export type GraphQLTocEntry = {
7
- uuid: string;
8
- content: string;
9
- label?: string | null;
10
- sort: number;
11
- level: number;
12
- section: string;
13
- children?: GraphQLTocEntry[] | null;
14
- };
15
-
16
- /**
17
- * GraphQL Toc type
18
- */
19
- export type GraphQLToc = {
20
- frontMatter: GraphQLTocEntry[];
21
- body: GraphQLTocEntry[];
22
- backMatter: GraphQLTocEntry[];
23
- };
24
-
25
- /**
26
- * Convert a GraphQL TocEntry to the internal TocEntry type
27
- */
28
- function tocEntryFromGraphQL(gqlEntry: GraphQLTocEntry): TocEntry {
29
- return {
30
- uuid: gqlEntry.uuid,
31
- content: gqlEntry.content,
32
- label: gqlEntry.label || undefined,
33
- sort: gqlEntry.sort,
34
- level: gqlEntry.level,
35
- section: gqlEntry.section as TranslationSection,
36
- children: (gqlEntry.children || []).map(tocEntryFromGraphQL),
37
- };
38
- }
39
-
40
- /**
41
- * Convert a GraphQL Toc to the internal Toc type
42
- */
43
- export function tocFromGraphQL(gqlToc: GraphQLToc): Toc {
44
- return {
45
- frontMatter: gqlToc.frontMatter.map(tocEntryFromGraphQL),
46
- body: gqlToc.body.map(tocEntryFromGraphQL),
47
- backMatter: gqlToc.backMatter.map(tocEntryFromGraphQL),
48
- };
49
- }
@@ -1,38 +0,0 @@
1
- import type { Work, TohokuCatalogEntry, SemVer } from '@eightyfourthousand/data-access';
2
-
3
- /**
4
- * GraphQL Work type
5
- */
6
- export type GraphQLWork = {
7
- uuid: string;
8
- title: string;
9
- toh: string[];
10
- publicationDate: string;
11
- publicationVersion: string;
12
- pages: number;
13
- restriction: boolean;
14
- section: string;
15
- };
16
-
17
- /**
18
- * Convert a GraphQL work to the internal Work type
19
- */
20
- export function workFromGraphQL(gqlWork: GraphQLWork): Work {
21
- return {
22
- uuid: gqlWork.uuid,
23
- title: gqlWork.title,
24
- toh: gqlWork.toh as TohokuCatalogEntry[],
25
- publicationDate: new Date(gqlWork.publicationDate),
26
- publicationVersion: gqlWork.publicationVersion as SemVer,
27
- pages: gqlWork.pages,
28
- restriction: gqlWork.restriction,
29
- section: gqlWork.section,
30
- };
31
- }
32
-
33
- /**
34
- * Convert an array of GraphQL works to internal Work types
35
- */
36
- export function worksFromGraphQL(gqlWorks: GraphQLWork[]): Work[] {
37
- return gqlWorks.map(workFromGraphQL);
38
- }
package/src/ssr.ts DELETED
@@ -1,73 +0,0 @@
1
- // SSR Client
2
- export {
3
- createServerGraphQLClient,
4
- createBuildGraphQLClient,
5
- } from './lib/client-ssr';
6
-
7
- // Functions (same as browser)
8
- export {
9
- getPassage,
10
- getTranslationPassages,
11
- getTranslationPassagesAround,
12
- getTranslationBlocks,
13
- getTranslationBlocksAround,
14
- getTranslationTitles,
15
- getTranslationMetadataByUuid,
16
- getTranslationMetadataByToh,
17
- getTranslationsMetadata,
18
- getTranslationUuids,
19
- getTranslationToc,
20
- getTranslationImprint,
21
- getGlossaryTerms,
22
- getGlossaryEntry,
23
- getGlossaryInstance,
24
- getWorkGlossary,
25
- getWorkGlossaryTerms,
26
- getWorkGlossaryTermsAround,
27
- type GlossaryTermsPage,
28
- getBibliographyEntry,
29
- getWorkBibliography,
30
- getWorkFolios,
31
- getWorks,
32
- type TranslationBlocksPage,
33
- type WorksPage,
34
- } from './lib/functions';
35
-
36
- // Re-export types from @eightyfourthousand/data-access for convenience
37
- export type {
38
- Passage,
39
- Passages,
40
- PassagesPage,
41
- PaginationDirection,
42
- BodyItemType,
43
- Annotation,
44
- Annotations,
45
- Alignment,
46
- Work,
47
- Title,
48
- Titles,
49
- TitleType,
50
- Toc,
51
- TocEntry,
52
- Imprint,
53
- GlossaryTermInstance,
54
- GlossaryLandingItem,
55
- GlossaryPageItem,
56
- BibliographyEntry,
57
- BibliographyEntryItem,
58
- BibliographyEntries,
59
- Folio,
60
- } from '@eightyfourthousand/data-access';
61
-
62
- // Re-export constants for passage filters
63
- export {
64
- BODY_ITEM_TYPES,
65
- FRONT_MATTER,
66
- FRONT_MATTER_FILTER,
67
- BODY_MATTER,
68
- BODY_MATTER_FILTER,
69
- BACK_MATTER,
70
- BACK_MATTER_FILTER,
71
- COMPARE_MODE,
72
- COMPARE_MODE_FILTER,
73
- } from '@eightyfourthousand/data-access';
package/tsconfig.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "jsx": "react-jsx",
4
- "allowJs": false,
5
- "esModuleInterop": false,
6
- "allowSyntheticDefaultImports": true,
7
- "strict": true
8
- },
9
- "files": [],
10
- "include": [],
11
- "references": [
12
- {
13
- "path": "./tsconfig.lib.json"
14
- }
15
- ],
16
- "extends": "../../tsconfig.base.json"
17
- }
package/tsconfig.lib.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../../dist/out-tsc",
5
- "declaration": true,
6
- "types": ["node"]
7
- },
8
- "exclude": [
9
- "jest.config.ts",
10
- "src/**/*.spec.ts",
11
- "src/**/*.test.ts"
12
- ],
13
- "include": ["src/**/*.ts"]
14
- }