@helloao/tools 0.1.0 → 0.3.0

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 (78) hide show
  1. package/dist/cjs/generation/api.cjs +1580 -35
  2. package/dist/cjs/generation/api.cjs.map +3 -3
  3. package/dist/cjs/generation/audio.cjs +55 -8
  4. package/dist/cjs/generation/audio.cjs.map +2 -2
  5. package/dist/cjs/generation/book-order.cjs +1 -1
  6. package/dist/cjs/generation/book-order.cjs.map +2 -2
  7. package/dist/cjs/generation/common-types.cjs +996 -0
  8. package/dist/cjs/generation/common-types.cjs.map +2 -2
  9. package/dist/cjs/generation/dataset.cjs +44 -17
  10. package/dist/cjs/generation/dataset.cjs.map +2 -2
  11. package/dist/cjs/generation/index.cjs +8 -5
  12. package/dist/cjs/generation/index.cjs.map +2 -2
  13. package/dist/cjs/generation/simple.cjs +294 -0
  14. package/dist/cjs/generation/simple.cjs.map +7 -0
  15. package/dist/cjs/index.cjs +4 -4
  16. package/dist/cjs/parser/codex-parser.cjs +3 -3
  17. package/dist/cjs/parser/codex-parser.cjs.map +3 -3
  18. package/dist/cjs/parser/commentary-csv-parser.cjs +14 -3
  19. package/dist/cjs/parser/commentary-csv-parser.cjs.map +3 -3
  20. package/dist/cjs/parser/index.cjs +1 -1
  21. package/dist/cjs/parser/lockman-parser.cjs +334 -0
  22. package/dist/cjs/parser/lockman-parser.cjs.map +7 -0
  23. package/dist/cjs/parser/tyndale-xml-parser.cjs +1 -1
  24. package/dist/cjs/parser/tyndale-xml-parser.cjs.map +1 -1
  25. package/dist/cjs/parser/types.cjs.map +1 -1
  26. package/dist/cjs/parser/usfm-parser.cjs +2 -2
  27. package/dist/cjs/parser/usfm-parser.cjs.map +1 -1
  28. package/dist/cjs/parser/usx-parser.cjs +145 -32
  29. package/dist/cjs/parser/usx-parser.cjs.map +2 -2
  30. package/dist/cjs/parser/words.cjs +187 -0
  31. package/dist/cjs/parser/words.cjs.map +7 -0
  32. package/dist/cjs/utils.cjs +152 -0
  33. package/dist/cjs/utils.cjs.map +3 -3
  34. package/dist/esm/generation/api.js +1527 -35
  35. package/dist/esm/generation/api.js.map +3 -3
  36. package/dist/esm/generation/audio.js +47 -4
  37. package/dist/esm/generation/audio.js.map +2 -2
  38. package/dist/esm/generation/book-order.js +1 -1
  39. package/dist/esm/generation/book-order.js.map +2 -2
  40. package/dist/esm/generation/common-types.js +903 -0
  41. package/dist/esm/generation/common-types.js.map +3 -3
  42. package/dist/esm/generation/dataset.js +35 -10
  43. package/dist/esm/generation/dataset.js.map +2 -2
  44. package/dist/esm/generation/index.js +2 -1
  45. package/dist/esm/generation/index.js.map +2 -2
  46. package/dist/esm/generation/simple.js +260 -0
  47. package/dist/esm/generation/simple.js.map +7 -0
  48. package/dist/esm/parser/codex-parser.js +3 -3
  49. package/dist/esm/parser/codex-parser.js.map +3 -3
  50. package/dist/esm/parser/commentary-csv-parser.js +3 -2
  51. package/dist/esm/parser/commentary-csv-parser.js.map +2 -2
  52. package/dist/esm/parser/lockman-parser.js +306 -0
  53. package/dist/esm/parser/lockman-parser.js.map +7 -0
  54. package/dist/esm/parser/tyndale-xml-parser.js +1 -1
  55. package/dist/esm/parser/tyndale-xml-parser.js.map +1 -1
  56. package/dist/esm/parser/usfm-parser.js +1 -1
  57. package/dist/esm/parser/usfm-parser.js.map +1 -1
  58. package/dist/esm/parser/usx-parser.js +153 -32
  59. package/dist/esm/parser/usx-parser.js.map +2 -2
  60. package/dist/esm/parser/words.js +149 -0
  61. package/dist/esm/parser/words.js.map +7 -0
  62. package/dist/esm/utils.js +138 -0
  63. package/dist/esm/utils.js.map +2 -2
  64. package/dist/types/generation/api.d.ts +8478 -472
  65. package/dist/types/generation/audio.d.ts +5 -0
  66. package/dist/types/generation/common-types.d.ts +1646 -407
  67. package/dist/types/generation/dataset.d.ts +1 -0
  68. package/dist/types/generation/index.d.ts +2 -1
  69. package/dist/types/generation/simple.d.ts +110 -0
  70. package/dist/types/parser/codex-parser.d.ts +18 -138
  71. package/dist/types/parser/commentary-csv-parser.d.ts +1 -1
  72. package/dist/types/parser/lockman-parser.d.ts +14 -0
  73. package/dist/types/parser/tyndale-xml-parser.d.ts +1 -1
  74. package/dist/types/parser/types.d.ts +67 -0
  75. package/dist/types/parser/usx-parser.d.ts +6 -5
  76. package/dist/types/parser/words.d.ts +104 -0
  77. package/dist/types/utils.d.ts +223 -18
  78. package/package.json +7 -4
@@ -1,3 +1,4 @@
1
+ import z from "zod";
1
2
  /**
2
3
  * Normalizes the given language code into a ISO 639 code.
3
4
  * @param language The language code to normalize.
@@ -10,23 +11,227 @@ export declare function normalizeLanguage(language: string): string;
10
11
  export declare function getTranslationId(translationId: string): string;
11
12
  export declare function isEmptyOrWhitespace(str: string | null | undefined): boolean;
12
13
  export declare function getFirstNonEmpty<T extends string>(...values: T[]): T;
13
- export interface VerseRef {
14
- book: string;
15
- chapter: number;
16
- verse: number;
17
- /**
18
- * The rest of the content of the verse.
19
- */
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;
29
- }
14
+ /**
15
+ * Defines a Zod schema for all USFM book IDs.
16
+ */
17
+ export declare const BookIdSchema: z.ZodEnum<{
18
+ GEN: "GEN";
19
+ EXO: "EXO";
20
+ LEV: "LEV";
21
+ NUM: "NUM";
22
+ DEU: "DEU";
23
+ JOS: "JOS";
24
+ JDG: "JDG";
25
+ RUT: "RUT";
26
+ "1SA": "1SA";
27
+ "2SA": "2SA";
28
+ "1KI": "1KI";
29
+ "2KI": "2KI";
30
+ "1CH": "1CH";
31
+ "2CH": "2CH";
32
+ EZR: "EZR";
33
+ NEH: "NEH";
34
+ EST: "EST";
35
+ JOB: "JOB";
36
+ PSA: "PSA";
37
+ PRO: "PRO";
38
+ ECC: "ECC";
39
+ SNG: "SNG";
40
+ ISA: "ISA";
41
+ JER: "JER";
42
+ LAM: "LAM";
43
+ EZK: "EZK";
44
+ DAN: "DAN";
45
+ HOS: "HOS";
46
+ JOL: "JOL";
47
+ AMO: "AMO";
48
+ OBA: "OBA";
49
+ JON: "JON";
50
+ MIC: "MIC";
51
+ NAM: "NAM";
52
+ HAB: "HAB";
53
+ ZEP: "ZEP";
54
+ HAG: "HAG";
55
+ ZEC: "ZEC";
56
+ MAL: "MAL";
57
+ MAT: "MAT";
58
+ MRK: "MRK";
59
+ LUK: "LUK";
60
+ JHN: "JHN";
61
+ ACT: "ACT";
62
+ ROM: "ROM";
63
+ "1CO": "1CO";
64
+ "2CO": "2CO";
65
+ GAL: "GAL";
66
+ EPH: "EPH";
67
+ PHP: "PHP";
68
+ COL: "COL";
69
+ "1TH": "1TH";
70
+ "2TH": "2TH";
71
+ "1TI": "1TI";
72
+ "2TI": "2TI";
73
+ TIT: "TIT";
74
+ PHM: "PHM";
75
+ HEB: "HEB";
76
+ JAS: "JAS";
77
+ "1PE": "1PE";
78
+ "2PE": "2PE";
79
+ "1JN": "1JN";
80
+ "2JN": "2JN";
81
+ "3JN": "3JN";
82
+ JUD: "JUD";
83
+ REV: "REV";
84
+ TOB: "TOB";
85
+ JDT: "JDT";
86
+ ESG: "ESG";
87
+ WIS: "WIS";
88
+ SIR: "SIR";
89
+ BAR: "BAR";
90
+ LJE: "LJE";
91
+ S3Y: "S3Y";
92
+ SUS: "SUS";
93
+ BEL: "BEL";
94
+ "1MA": "1MA";
95
+ "2MA": "2MA";
96
+ "3MA": "3MA";
97
+ "4MA": "4MA";
98
+ "1ES": "1ES";
99
+ "2ES": "2ES";
100
+ MAN: "MAN";
101
+ PS2: "PS2";
102
+ ODA: "ODA";
103
+ PSS: "PSS";
104
+ EZA: "EZA";
105
+ "5EZ": "5EZ";
106
+ "6EZ": "6EZ";
107
+ DAG: "DAG";
108
+ PS3: "PS3";
109
+ "2BA": "2BA";
110
+ LBA: "LBA";
111
+ JUB: "JUB";
112
+ ENO: "ENO";
113
+ "1MQ": "1MQ";
114
+ "2MQ": "2MQ";
115
+ "3MQ": "3MQ";
116
+ REP: "REP";
117
+ "4BA": "4BA";
118
+ LAO: "LAO";
119
+ }>;
120
+ export type BookId = z.infer<typeof BookIdSchema>;
121
+ /**
122
+ * Defines a schema for validating verse references.
123
+ */
124
+ export declare const VerseRefSchema: z.ZodObject<{
125
+ book: z.ZodEnum<{
126
+ GEN: "GEN";
127
+ EXO: "EXO";
128
+ LEV: "LEV";
129
+ NUM: "NUM";
130
+ DEU: "DEU";
131
+ JOS: "JOS";
132
+ JDG: "JDG";
133
+ RUT: "RUT";
134
+ "1SA": "1SA";
135
+ "2SA": "2SA";
136
+ "1KI": "1KI";
137
+ "2KI": "2KI";
138
+ "1CH": "1CH";
139
+ "2CH": "2CH";
140
+ EZR: "EZR";
141
+ NEH: "NEH";
142
+ EST: "EST";
143
+ JOB: "JOB";
144
+ PSA: "PSA";
145
+ PRO: "PRO";
146
+ ECC: "ECC";
147
+ SNG: "SNG";
148
+ ISA: "ISA";
149
+ JER: "JER";
150
+ LAM: "LAM";
151
+ EZK: "EZK";
152
+ DAN: "DAN";
153
+ HOS: "HOS";
154
+ JOL: "JOL";
155
+ AMO: "AMO";
156
+ OBA: "OBA";
157
+ JON: "JON";
158
+ MIC: "MIC";
159
+ NAM: "NAM";
160
+ HAB: "HAB";
161
+ ZEP: "ZEP";
162
+ HAG: "HAG";
163
+ ZEC: "ZEC";
164
+ MAL: "MAL";
165
+ MAT: "MAT";
166
+ MRK: "MRK";
167
+ LUK: "LUK";
168
+ JHN: "JHN";
169
+ ACT: "ACT";
170
+ ROM: "ROM";
171
+ "1CO": "1CO";
172
+ "2CO": "2CO";
173
+ GAL: "GAL";
174
+ EPH: "EPH";
175
+ PHP: "PHP";
176
+ COL: "COL";
177
+ "1TH": "1TH";
178
+ "2TH": "2TH";
179
+ "1TI": "1TI";
180
+ "2TI": "2TI";
181
+ TIT: "TIT";
182
+ PHM: "PHM";
183
+ HEB: "HEB";
184
+ JAS: "JAS";
185
+ "1PE": "1PE";
186
+ "2PE": "2PE";
187
+ "1JN": "1JN";
188
+ "2JN": "2JN";
189
+ "3JN": "3JN";
190
+ JUD: "JUD";
191
+ REV: "REV";
192
+ TOB: "TOB";
193
+ JDT: "JDT";
194
+ ESG: "ESG";
195
+ WIS: "WIS";
196
+ SIR: "SIR";
197
+ BAR: "BAR";
198
+ LJE: "LJE";
199
+ S3Y: "S3Y";
200
+ SUS: "SUS";
201
+ BEL: "BEL";
202
+ "1MA": "1MA";
203
+ "2MA": "2MA";
204
+ "3MA": "3MA";
205
+ "4MA": "4MA";
206
+ "1ES": "1ES";
207
+ "2ES": "2ES";
208
+ MAN: "MAN";
209
+ PS2: "PS2";
210
+ ODA: "ODA";
211
+ PSS: "PSS";
212
+ EZA: "EZA";
213
+ "5EZ": "5EZ";
214
+ "6EZ": "6EZ";
215
+ DAG: "DAG";
216
+ PS3: "PS3";
217
+ "2BA": "2BA";
218
+ LBA: "LBA";
219
+ JUB: "JUB";
220
+ ENO: "ENO";
221
+ "1MQ": "1MQ";
222
+ "2MQ": "2MQ";
223
+ "3MQ": "3MQ";
224
+ REP: "REP";
225
+ "4BA": "4BA";
226
+ LAO: "LAO";
227
+ }>;
228
+ chapter: z.ZodNumber;
229
+ verse: z.ZodNumber;
230
+ content: z.ZodOptional<z.ZodString>;
231
+ endChapter: z.ZodOptional<z.ZodNumber>;
232
+ endVerse: z.ZodOptional<z.ZodNumber>;
233
+ }, z.core.$strip>;
234
+ export type VerseRef = z.infer<typeof VerseRefSchema>;
30
235
  /**
31
236
  * Parses the given verse reference.
32
237
  * Formatted like "GEN 1:1".
@@ -39,7 +244,7 @@ export declare function parseVerseReference(text: string): VerseRef | null;
39
244
  * Returns null if the ID could not be found.
40
245
  * @param book The name/ID of the book.
41
246
  */
42
- export declare function getBookId(book: string): string | null;
247
+ export declare function getBookId(book: string): BookId | null;
43
248
  /**
44
249
  * A brief list of verses which may appear in some older translations
45
250
  * but are not present in more modern translations.
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@helloao/tools",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "A set of tools for managing HelloAO's Free Bible API",
5
+ "type": "module",
5
6
  "main": "./dist/cjs/index.cjs",
6
7
  "module": "./dist/esm/index.js",
7
8
  "exports": {
@@ -49,13 +50,15 @@
49
50
  "author": "Kallyn Gowdy <kal@helloao.org>",
50
51
  "license": "MIT",
51
52
  "dependencies": {
52
- "lodash": "4.17.21",
53
- "zod": "^3.23.8",
53
+ "es-toolkit": "1.46.1",
54
+ "zod": "^4.4.3",
54
55
  "papaparse": "5.4.1"
55
56
  },
56
57
  "devDependencies": {
58
+ "@types/jest": "^29.4.0",
57
59
  "linkedom": "0.18.4",
58
- "hash.js": "1.1.7"
60
+ "hash.js": "1.1.7",
61
+ "zod-openapi": "5.4.6"
59
62
  },
60
63
  "files": [
61
64
  "/README.md",