@helloao/tools 0.0.9 → 0.0.11
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/dist/cjs/generation/api.cjs +194 -0
- package/dist/cjs/generation/api.cjs.map +2 -2
- package/dist/cjs/generation/common-types.cjs.map +1 -1
- package/dist/cjs/generation/dataset.cjs +180 -83
- package/dist/cjs/generation/dataset.cjs.map +3 -3
- package/dist/cjs/index.cjs +3 -0
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/cjs/log.cjs +50 -0
- package/dist/cjs/log.cjs.map +7 -0
- package/dist/cjs/parser/codex-parser.cjs +81 -67
- package/dist/cjs/parser/codex-parser.cjs.map +2 -2
- package/dist/cjs/parser/commentary-csv-parser.cjs +133 -0
- package/dist/cjs/parser/commentary-csv-parser.cjs.map +7 -0
- package/dist/cjs/parser/index.cjs +3 -1
- package/dist/cjs/parser/index.cjs.map +2 -2
- package/dist/cjs/parser/iterators.cjs +17 -6
- package/dist/cjs/parser/iterators.cjs.map +2 -2
- package/dist/cjs/parser/tyndale-xml-parser.cjs +212 -0
- package/dist/cjs/parser/tyndale-xml-parser.cjs.map +7 -0
- package/dist/cjs/parser/types.cjs.map +1 -1
- package/dist/cjs/parser/usfm-parser.cjs +4 -2
- package/dist/cjs/parser/usfm-parser.cjs.map +2 -2
- package/dist/cjs/parser/usx-parser.cjs +13 -1
- package/dist/cjs/parser/usx-parser.cjs.map +2 -2
- package/dist/cjs/utils.cjs +180 -6
- package/dist/cjs/utils.cjs.map +3 -3
- package/dist/esm/generation/api.js +186 -0
- package/dist/esm/generation/api.js.map +2 -2
- package/dist/esm/generation/dataset.js +181 -84
- package/dist/esm/generation/dataset.js.map +2 -2
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/log.js +20 -0
- package/dist/esm/log.js.map +7 -0
- package/dist/esm/parser/codex-parser.js +75 -65
- package/dist/esm/parser/codex-parser.js.map +2 -2
- package/dist/esm/parser/commentary-csv-parser.js +107 -0
- package/dist/esm/parser/commentary-csv-parser.js.map +7 -0
- package/dist/esm/parser/index.js +1 -0
- package/dist/esm/parser/index.js.map +2 -2
- package/dist/esm/parser/iterators.js +17 -6
- package/dist/esm/parser/iterators.js.map +2 -2
- package/dist/esm/parser/tyndale-xml-parser.js +184 -0
- package/dist/esm/parser/tyndale-xml-parser.js.map +7 -0
- package/dist/esm/parser/usfm-parser.js +4 -2
- package/dist/esm/parser/usfm-parser.js.map +2 -2
- package/dist/esm/parser/usx-parser.js +13 -1
- package/dist/esm/parser/usx-parser.js.map +2 -2
- package/dist/esm/utils.js +178 -6
- package/dist/esm/utils.js.map +3 -3
- package/dist/types/generation/api.d.ts +222 -1
- package/dist/types/generation/common-types.d.ts +151 -24
- package/dist/types/generation/dataset.d.ts +38 -2
- package/dist/types/index.d.ts +2 -1
- package/dist/types/log.d.ts +23 -0
- package/dist/types/parser/codex-parser.d.ts +50 -7
- package/dist/types/parser/commentary-csv-parser.d.ts +12 -0
- package/dist/types/parser/index.d.ts +1 -0
- package/dist/types/parser/tyndale-xml-parser.d.ts +8 -0
- package/dist/types/parser/types.d.ts +53 -1
- package/dist/types/parser/usx-parser.d.ts +1 -1
- package/dist/types/utils.d.ts +14 -0
- package/package.json +37 -14
|
@@ -20,6 +20,26 @@ export declare const chapterHeadingSchema: z.ZodObject<{
|
|
|
20
20
|
chapter: number;
|
|
21
21
|
};
|
|
22
22
|
}>;
|
|
23
|
+
export declare const verseSchema: z.ZodObject<{
|
|
24
|
+
type: z.ZodLiteral<"text">;
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
id: string;
|
|
28
|
+
type: "text";
|
|
29
|
+
}, {
|
|
30
|
+
id: string;
|
|
31
|
+
type: "text";
|
|
32
|
+
}>;
|
|
33
|
+
export declare const paratextSchema: z.ZodObject<{
|
|
34
|
+
type: z.ZodLiteral<"paratext">;
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
id: string;
|
|
38
|
+
type: "paratext";
|
|
39
|
+
}, {
|
|
40
|
+
id: string;
|
|
41
|
+
type: "paratext";
|
|
42
|
+
}>;
|
|
23
43
|
export declare const metadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
24
44
|
type: z.ZodLiteral<"chapter-heading">;
|
|
25
45
|
data: z.ZodObject<{
|
|
@@ -39,10 +59,29 @@ export declare const metadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
|
|
|
39
59
|
data: {
|
|
40
60
|
chapter: number;
|
|
41
61
|
};
|
|
62
|
+
}>, z.ZodObject<{
|
|
63
|
+
type: z.ZodLiteral<"text">;
|
|
64
|
+
id: z.ZodString;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
id: string;
|
|
67
|
+
type: "text";
|
|
68
|
+
}, {
|
|
69
|
+
id: string;
|
|
70
|
+
type: "text";
|
|
71
|
+
}>, z.ZodObject<{
|
|
72
|
+
type: z.ZodLiteral<"paratext">;
|
|
73
|
+
id: z.ZodString;
|
|
74
|
+
}, "strip", z.ZodTypeAny, {
|
|
75
|
+
id: string;
|
|
76
|
+
type: "paratext";
|
|
77
|
+
}, {
|
|
78
|
+
id: string;
|
|
79
|
+
type: "paratext";
|
|
42
80
|
}>]>;
|
|
43
81
|
export declare const codexSchema: z.ZodObject<{
|
|
44
82
|
cells: z.ZodArray<z.ZodObject<{
|
|
45
|
-
|
|
83
|
+
kind: z.ZodNumber;
|
|
84
|
+
languageId: z.ZodString;
|
|
46
85
|
value: z.ZodString;
|
|
47
86
|
metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
48
87
|
type: z.ZodString;
|
|
@@ -52,30 +91,34 @@ export declare const codexSchema: z.ZodObject<{
|
|
|
52
91
|
type: z.ZodString;
|
|
53
92
|
}, z.ZodTypeAny, "passthrough">>>>;
|
|
54
93
|
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
kind: number;
|
|
55
95
|
value: string;
|
|
56
|
-
|
|
96
|
+
languageId: string;
|
|
57
97
|
metadata?: z.objectOutputType<{
|
|
58
98
|
type: z.ZodString;
|
|
59
99
|
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
60
100
|
}, {
|
|
101
|
+
kind: number;
|
|
61
102
|
value: string;
|
|
62
|
-
|
|
103
|
+
languageId: string;
|
|
63
104
|
metadata?: z.objectInputType<{
|
|
64
105
|
type: z.ZodString;
|
|
65
106
|
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
66
107
|
}>, "many">;
|
|
67
108
|
}, "strip", z.ZodTypeAny, {
|
|
68
109
|
cells: {
|
|
110
|
+
kind: number;
|
|
69
111
|
value: string;
|
|
70
|
-
|
|
112
|
+
languageId: string;
|
|
71
113
|
metadata?: z.objectOutputType<{
|
|
72
114
|
type: z.ZodString;
|
|
73
115
|
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
74
116
|
}[];
|
|
75
117
|
}, {
|
|
76
118
|
cells: {
|
|
119
|
+
kind: number;
|
|
77
120
|
value: string;
|
|
78
|
-
|
|
121
|
+
languageId: string;
|
|
79
122
|
metadata?: z.objectInputType<{
|
|
80
123
|
type: z.ZodString;
|
|
81
124
|
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
@@ -87,9 +130,9 @@ export declare const codexSchema: z.ZodObject<{
|
|
|
87
130
|
export declare class CodexParser {
|
|
88
131
|
private _noteCounter;
|
|
89
132
|
/**
|
|
90
|
-
* Parses the specified
|
|
133
|
+
* Parses the specified codex content.
|
|
91
134
|
*
|
|
92
|
-
* @param
|
|
135
|
+
* @param codex The codex content to parse.
|
|
93
136
|
* @returns The parse tree that was generated.
|
|
94
137
|
*/
|
|
95
138
|
parse(codex: string): ParseTree;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CommentaryParseTree } from './types';
|
|
2
|
+
export interface CsvLine {
|
|
3
|
+
book: string;
|
|
4
|
+
chapter: string;
|
|
5
|
+
verse: string;
|
|
6
|
+
commentaries: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class CommentaryCsvParser {
|
|
9
|
+
parse(data: string): CommentaryParseTree;
|
|
10
|
+
parseLines(data: CsvLine[]): CommentaryParseTree;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=commentary-csv-parser.d.ts.map
|
|
@@ -2,6 +2,7 @@ export * from './types.js';
|
|
|
2
2
|
export * from './usfm-parser.js';
|
|
3
3
|
export * from './usx-parser.js';
|
|
4
4
|
export * from './codex-parser.js';
|
|
5
|
+
export * from './commentary-csv-parser.js';
|
|
5
6
|
import * as iterators from './iterators.js';
|
|
6
7
|
export { iterators };
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CommentaryParseTree } from './types';
|
|
2
|
+
export declare class TyndaleXmlParser {
|
|
3
|
+
private _domParser;
|
|
4
|
+
constructor(domParser: DOMParser);
|
|
5
|
+
parse(xml: string): CommentaryParseTree;
|
|
6
|
+
}
|
|
7
|
+
export declare function toKebabCase(camelCase: string): string;
|
|
8
|
+
//# sourceMappingURL=tyndale-xml-parser.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VerseRef } from '../utils.js';
|
|
1
2
|
/**
|
|
2
3
|
* The parse tree that is gathered.
|
|
3
4
|
*/
|
|
@@ -24,7 +25,7 @@ export interface Heading {
|
|
|
24
25
|
type: 'heading';
|
|
25
26
|
content: string[];
|
|
26
27
|
}
|
|
27
|
-
export type ChapterContent =
|
|
28
|
+
export type ChapterContent = Heading | Verse | HebrewSubtitle | LineBreak;
|
|
28
29
|
export type VerseContent = string | FootnoteReference | Text;
|
|
29
30
|
/**
|
|
30
31
|
* Defines an interface that represents a chapter.
|
|
@@ -141,4 +142,55 @@ export interface Footnote {
|
|
|
141
142
|
export interface LineBreak {
|
|
142
143
|
type: 'line_break';
|
|
143
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* The parse tree that is gathered.
|
|
147
|
+
*/
|
|
148
|
+
export interface CommentaryParseTree {
|
|
149
|
+
type: 'commentary/root';
|
|
150
|
+
/**
|
|
151
|
+
* The books that are contained in the commentary.
|
|
152
|
+
*/
|
|
153
|
+
books: CommentaryBookNode[];
|
|
154
|
+
/**
|
|
155
|
+
* The profiles that are contained in the commentary.
|
|
156
|
+
*/
|
|
157
|
+
profiles?: CommentaryProfileNode[];
|
|
158
|
+
}
|
|
159
|
+
export interface CommentaryBookNode {
|
|
160
|
+
type: 'book';
|
|
161
|
+
book: string;
|
|
162
|
+
introduction: string | null;
|
|
163
|
+
introductionSummary?: string | null;
|
|
164
|
+
chapters: CommentaryChapterNode[];
|
|
165
|
+
}
|
|
166
|
+
export interface CommentaryProfileNode {
|
|
167
|
+
/**
|
|
168
|
+
* The ID of the profile.
|
|
169
|
+
* Used to identify the profile within a commentary.
|
|
170
|
+
*/
|
|
171
|
+
id: string;
|
|
172
|
+
/**
|
|
173
|
+
* The subject(s) of the profile.
|
|
174
|
+
*/
|
|
175
|
+
subject: string;
|
|
176
|
+
/**
|
|
177
|
+
* The Bible reference that the profile is associated with.
|
|
178
|
+
*/
|
|
179
|
+
reference: VerseRef | null;
|
|
180
|
+
/**
|
|
181
|
+
* The content of the profile.
|
|
182
|
+
*/
|
|
183
|
+
content: string[];
|
|
184
|
+
}
|
|
185
|
+
export interface CommentaryChapterNode {
|
|
186
|
+
type: 'chapter';
|
|
187
|
+
number: number;
|
|
188
|
+
introduction: string | null;
|
|
189
|
+
verses: CommentaryVerseNode[];
|
|
190
|
+
}
|
|
191
|
+
export interface CommentaryVerseNode {
|
|
192
|
+
type: 'verse';
|
|
193
|
+
number: number;
|
|
194
|
+
content: string[];
|
|
195
|
+
}
|
|
144
196
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -4,7 +4,7 @@ import { RewindableIterator } from './iterators.js';
|
|
|
4
4
|
* The version of the parser.
|
|
5
5
|
* Used to determine whether input files need to be re-parsed.
|
|
6
6
|
*/
|
|
7
|
-
export declare const PARSER_VERSION = "
|
|
7
|
+
export declare const PARSER_VERSION = "2";
|
|
8
8
|
/**
|
|
9
9
|
* Defines a class that is able to parse USX content.
|
|
10
10
|
*/
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -18,6 +18,14 @@ export interface VerseRef {
|
|
|
18
18
|
* The rest of the content of the verse.
|
|
19
19
|
*/
|
|
20
20
|
content?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The chapter that the verse reference ends at.
|
|
23
|
+
*/
|
|
24
|
+
endChapter?: number;
|
|
25
|
+
/**
|
|
26
|
+
* The verse that the verse reference ends at.
|
|
27
|
+
*/
|
|
28
|
+
endVerse?: number;
|
|
21
29
|
}
|
|
22
30
|
/**
|
|
23
31
|
* Parses the given verse reference.
|
|
@@ -26,4 +34,10 @@ export interface VerseRef {
|
|
|
26
34
|
* @param text The reference to parse.
|
|
27
35
|
*/
|
|
28
36
|
export declare function parseVerseReference(text: string): VerseRef | null;
|
|
37
|
+
/**
|
|
38
|
+
* Gets the ID of the given book.
|
|
39
|
+
* Returns null if the ID could not be found.
|
|
40
|
+
* @param book The name/ID of the book.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getBookId(book: string): string | null;
|
|
29
43
|
//# sourceMappingURL=utils.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,34 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helloao/tools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "A set of tools for managing HelloAO's Free Bible API",
|
|
5
|
+
"main": "./dist/cjs/index.cjs",
|
|
6
|
+
"module": "./dist/esm/index.js",
|
|
5
7
|
"exports": {
|
|
6
8
|
".": {
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
"import": {
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
11
|
+
"default": "./dist/esm/index.js"
|
|
12
|
+
},
|
|
13
|
+
"require": {
|
|
14
|
+
"types": "./dist/types/index.d.ts",
|
|
15
|
+
"default": "./dist/cjs/index.cjs"
|
|
16
|
+
}
|
|
10
17
|
},
|
|
11
18
|
"./*.js": {
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
"import": {
|
|
20
|
+
"types": "./dist/types/*.d.ts",
|
|
21
|
+
"default": "./dist/esm/*.js"
|
|
22
|
+
},
|
|
23
|
+
"require": {
|
|
24
|
+
"types": "./dist/types/*.d.ts",
|
|
25
|
+
"default": "./dist/cjs/*.cjs"
|
|
26
|
+
}
|
|
15
27
|
},
|
|
16
28
|
"./parser/*.js": {
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
"import": {
|
|
30
|
+
"types": "./dist/types/parser/*.d.ts",
|
|
31
|
+
"default": "./dist/esm/parser/*.js"
|
|
32
|
+
},
|
|
33
|
+
"require": {
|
|
34
|
+
"types": "./dist/types/parser/*.d.ts",
|
|
35
|
+
"default": "./dist/cjs/parser/*.cjs"
|
|
36
|
+
}
|
|
20
37
|
},
|
|
21
38
|
"./generation/*.js": {
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
39
|
+
"import": {
|
|
40
|
+
"types": "./dist/types/generation/*.d.ts",
|
|
41
|
+
"default": "./dist/esm/generation/*.js"
|
|
42
|
+
},
|
|
43
|
+
"require": {
|
|
44
|
+
"types": "./dist/types/generation/*.d.ts",
|
|
45
|
+
"default": "./dist/cjs/generation/*.cjs"
|
|
46
|
+
}
|
|
25
47
|
}
|
|
26
48
|
},
|
|
27
49
|
"author": "Kallyn Gowdy <kal@helloao.org>",
|
|
28
50
|
"license": "MIT",
|
|
29
51
|
"dependencies": {
|
|
30
52
|
"lodash": "4.17.21",
|
|
31
|
-
"zod": "^3.23.8"
|
|
53
|
+
"zod": "^3.23.8",
|
|
54
|
+
"papaparse": "5.4.1"
|
|
32
55
|
},
|
|
33
56
|
"devDependencies": {
|
|
34
57
|
"linkedom": "0.18.4",
|