@helloao/cli 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 (67) hide show
  1. package/README.md +138 -136
  2. package/dist/cjs/cli.cjs +8049 -12681
  3. package/dist/cjs/index.cjs +7628 -12571
  4. package/dist/esm/cli.js +5699 -0
  5. package/dist/esm/cli.js.map +7 -0
  6. package/dist/esm/index.js +1972 -6262
  7. package/dist/esm/index.js.map +4 -4
  8. package/dist/types/actions.d.ts +71 -0
  9. package/dist/types/db.d.ts +12 -8
  10. package/dist/types/ebible.d.ts +1 -1
  11. package/dist/types/files.d.ts +12 -1
  12. package/dist/types/openapi.d.ts +2 -0
  13. package/dist/types/prisma-gen/browser.d.ts +110 -0
  14. package/dist/types/prisma-gen/client.d.ts +129 -0
  15. package/dist/types/prisma-gen/commonInputTypes.d.ts +378 -0
  16. package/dist/types/prisma-gen/enums.d.ts +2 -0
  17. package/dist/types/prisma-gen/internal/class.d.ts +353 -0
  18. package/dist/types/prisma-gen/internal/prismaNamespace.d.ts +2273 -0
  19. package/dist/types/prisma-gen/internal/prismaNamespaceBrowser.d.ts +294 -0
  20. package/dist/types/prisma-gen/models/Book.d.ts +2197 -0
  21. package/dist/types/prisma-gen/models/Chapter.d.ts +1934 -0
  22. package/dist/types/prisma-gen/models/ChapterAudioTiming.d.ts +1414 -0
  23. package/dist/types/prisma-gen/models/ChapterAudioUrl.d.ts +1414 -0
  24. package/dist/types/prisma-gen/models/ChapterFootnote.d.ts +1642 -0
  25. package/dist/types/prisma-gen/models/ChapterVerse.d.ts +1653 -0
  26. package/dist/types/prisma-gen/models/ChapterWords.d.ts +1366 -0
  27. package/dist/types/prisma-gen/models/Commentary.d.ts +1711 -0
  28. package/dist/types/prisma-gen/models/CommentaryBook.d.ts +1622 -0
  29. package/dist/types/prisma-gen/models/CommentaryChapter.d.ts +1487 -0
  30. package/dist/types/prisma-gen/models/CommentaryChapterVerse.d.ts +1514 -0
  31. package/dist/types/prisma-gen/models/CommentaryProfile.d.ts +1451 -0
  32. package/dist/types/prisma-gen/models/Dataset.d.ts +1667 -0
  33. package/dist/types/prisma-gen/models/DatasetBook.d.ts +1565 -0
  34. package/dist/types/prisma-gen/models/DatasetChapter.d.ts +1553 -0
  35. package/dist/types/prisma-gen/models/DatasetChapterVerse.d.ts +1600 -0
  36. package/dist/types/prisma-gen/models/DatasetReference.d.ts +1789 -0
  37. package/dist/types/prisma-gen/models/EBibleSource.d.ts +1686 -0
  38. package/dist/types/prisma-gen/models/InputFile.d.ts +1039 -0
  39. package/dist/types/prisma-gen/models/InputFileWarning.d.ts +946 -0
  40. package/dist/types/prisma-gen/models/Translation.d.ts +2238 -0
  41. package/dist/types/prisma-gen/models.d.ts +23 -0
  42. package/dist/types/s3.d.ts +2 -0
  43. package/dist/types/uploads.d.ts +7 -1
  44. package/migrations/20260217200934_add_license_notice/migration.sql +5 -0
  45. package/migrations/20260703000000_add_chapter_audio_timing/migration.sql +13 -0
  46. package/migrations/20260809000000_add_chapter_words/migration.sql +12 -0
  47. package/package.json +23 -17
  48. package/schema.prisma +43 -2
  49. package/prisma-gen/client.d.ts +0 -1
  50. package/prisma-gen/client.js +0 -4
  51. package/prisma-gen/default.d.ts +0 -1
  52. package/prisma-gen/default.js +0 -1
  53. package/prisma-gen/edge.d.ts +0 -1
  54. package/prisma-gen/edge.js +0 -401
  55. package/prisma-gen/index-browser.js +0 -395
  56. package/prisma-gen/index.d.ts +0 -33919
  57. package/prisma-gen/index.js +0 -424
  58. package/prisma-gen/runtime/edge-esm.js +0 -31
  59. package/prisma-gen/runtime/edge.js +0 -31
  60. package/prisma-gen/runtime/index-browser.d.ts +0 -365
  61. package/prisma-gen/runtime/index-browser.js +0 -13
  62. package/prisma-gen/runtime/library.d.ts +0 -3403
  63. package/prisma-gen/runtime/library.js +0 -143
  64. package/prisma-gen/runtime/react-native.js +0 -80
  65. package/prisma-gen/runtime/wasm.js +0 -32
  66. package/prisma-gen/wasm.d.ts +0 -1
  67. package/prisma-gen/wasm.js +0 -395
@@ -1,3 +1,4 @@
1
+ import { PrismaClient } from './prisma-gen/client.js';
1
2
  import { InputTranslationMetadata } from '@helloao/tools/generation/index.js';
2
3
  import { UploadApiFromDatabaseOptions, UploadApiOptions } from './uploads.js';
3
4
  export interface GetTranslationsItem {
@@ -124,6 +125,41 @@ export declare function importCommentaries(dir: string, options: ImportTranslati
124
125
  * @param options The options.
125
126
  */
126
127
  export declare function importApi(dir: string, options: ImportTranslationOptions): Promise<void>;
128
+ /**
129
+ * A single chapter's worth of audio timing data to import.
130
+ */
131
+ export interface AudioTimingRecord {
132
+ /**
133
+ * The ID of the translation.
134
+ */
135
+ translationId: string;
136
+ /**
137
+ * The ID of the book.
138
+ */
139
+ bookId: string;
140
+ /**
141
+ * The number of the chapter.
142
+ */
143
+ chapterNumber: number;
144
+ /**
145
+ * The reader that the timings are for.
146
+ */
147
+ reader: string;
148
+ /**
149
+ * The times (in seconds) that each verse starts, in verse order.
150
+ */
151
+ verses: number[];
152
+ }
153
+ /**
154
+ * Imports chapter audio timing data from the given JSON file into the database in the
155
+ * current working directory.
156
+ *
157
+ * The file should contain an array of records: `{ translationId, bookId, chapterNumber, reader, verses }`
158
+ * where `verses` is an array of numbers (seconds) - one per verse in the chapter, in order.
159
+ * @param file The path to the JSON file to import.
160
+ * @param options The options.
161
+ */
162
+ export declare function importAudioTimings(file: string, options: ImportTranslationOptions): Promise<void>;
127
163
  export interface FetchTranslationsOptions {
128
164
  /**
129
165
  * Fetch all translations. If omitted, only undownloaded translations will be fetched.
@@ -236,5 +272,40 @@ export declare function uploadTestTranslation(input: string, options: UploadTest
236
272
  /**
237
273
  * Asks the user for the metadata for the translation.
238
274
  */
275
+ export interface UploadTypesenseVersesOptions {
276
+ translations?: string[];
277
+ language?: string;
278
+ }
279
+ export interface TypesenseSearchOptions {
280
+ translation?: string;
281
+ book?: string;
282
+ chapter?: string | number;
283
+ language?: string;
284
+ search?: string;
285
+ }
286
+ export declare function uploadTypesenseVerses(nodes: string[], apiKey: string, db: PrismaClient, options: UploadTypesenseVersesOptions): Promise<void>;
287
+ export declare function searchTypesenseVerses(nodes: string[], apiKey: string, options: TypesenseSearchOptions): Promise<import("typesense").SearchResponse<object>>;
239
288
  export declare function askForMetadata(defaultId?: string): Promise<InputTranslationMetadata>;
289
+ export interface CopyOpenBibleAudioOptions {
290
+ /**
291
+ * The translation ID to copy (e.g. "BSB"). If omitted, all known translations are copied.
292
+ */
293
+ translation?: string;
294
+ /**
295
+ * The readers to copy (e.g. ["hays", "souer"]). If omitted, all known readers for the translation are copied.
296
+ */
297
+ readers?: string[];
298
+ /**
299
+ * Whether to overwrite existing files.
300
+ */
301
+ overwrite?: boolean;
302
+ }
303
+ /**
304
+ * Copies .mp3 files from the OpenBible filename format to the Free Use Bible API format:
305
+ * /api/{translationId}/{bookId}/{chapterNumber}/audio/{reader}.mp3
306
+ * @param srcDir The source directory containing .mp3 files in OpenBible filename format.
307
+ * @param destDir The destination directory for files in API format.
308
+ * @param options The options.
309
+ */
310
+ export declare function copyOpenBibleAudio(srcDir: string, destDir: string, options?: CopyOpenBibleAudioOptions): Promise<void>;
240
311
  //# sourceMappingURL=actions.d.ts.map
@@ -1,4 +1,4 @@
1
- import { PrismaClient } from './prisma-gen/index.js';
1
+ import { PrismaClient, Prisma } from './prisma-gen/client.js';
2
2
  import { Database } from 'better-sqlite3';
3
3
  import { DatasetCommentary, DatasetCommentaryBook, DatasetCommentaryProfile, DatasetDataset, DatasetDatasetBook, DatasetOutput, DatasetTranslation, DatasetTranslationBook } from '@helloao/tools/generation/dataset.js';
4
4
  import { InputFile, TranslationBookChapter, CommentaryBookChapter, DatasetBookChapter } from '@helloao/tools/generation/index.js';
@@ -72,6 +72,16 @@ export declare function insertFileMetadata(db: Database, files: InputFile[]): vo
72
72
  export declare function insertTranslations(db: Database, translations: DatasetTranslation[]): void;
73
73
  export declare function insertTranslationBooks(db: Database, translation: DatasetTranslation, translationBooks: DatasetTranslationBook[]): void;
74
74
  export declare function insertTranslationContent(db: Database, translation: DatasetTranslation, book: DatasetTranslationBook, chapters: TranslationBookChapter[]): void;
75
+ /**
76
+ * Inserts or updates the audio timing (per-verse start times, in seconds) for a chapter and reader.
77
+ * @param db The database to insert the timing into.
78
+ * @param translationId The ID of the translation.
79
+ * @param bookId The ID of the book.
80
+ * @param chapterNumber The number of the chapter.
81
+ * @param reader The reader that the timing is for.
82
+ * @param verses The times (in seconds) that each verse starts, in verse order.
83
+ */
84
+ export declare function upsertChapterAudioTiming(db: Database, translationId: string, bookId: string, chapterNumber: number, reader: string, verses: number[]): void;
75
85
  export declare function insertCommentaries(db: Database, commentaries: DatasetCommentary[]): void;
76
86
  export declare function insertCommentaryBooks(db: Database, commentary: DatasetCommentary, commentaryBooks: DatasetCommentaryBook[]): void;
77
87
  export declare function insertCommentaryProfiles(db: Database, commentary: DatasetCommentary, commentaryProfiles: DatasetCommentaryProfile[]): void;
@@ -81,13 +91,7 @@ export declare function insertDatasetBooks(db: Database, dataset: DatasetDataset
81
91
  export declare function insertDatasetContent(db: Database, dataset: DatasetDataset, book: DatasetDatasetBook, chapters: DatasetBookChapter[]): void;
82
92
  export declare function getDbPathFromDir(dir: string): string;
83
93
  export declare function getDbPath(p?: string | null): string;
84
- export declare function getPrismaDb(path?: string | null): PrismaClient<{
85
- datasources: {
86
- db: {
87
- url: string;
88
- };
89
- };
90
- }, never, import("prisma-gen/runtime/library.js").DefaultArgs>;
94
+ export declare function getPrismaDb(path?: string | null): Promise<import("./prisma-gen/internal/class.js").PrismaClient<never, Prisma.GlobalOmitConfig | undefined, import("@prisma/client/runtime/client").DefaultArgs>>;
91
95
  /**
92
96
  * Gets the database from the given path. If no path is provided, the current working directory is used.
93
97
  * @param path The path to the database. If not provided, the current working directory is used.
@@ -1,4 +1,4 @@
1
- import { EBibleSource } from 'prisma-gen/index.js';
1
+ import { EBibleSource } from './prisma-gen/client.js';
2
2
  /**
3
3
  * Fetches eBible translation metadata and returns EBibleSource objects.
4
4
  */
@@ -1,6 +1,6 @@
1
1
  import { InputFile, InputTranslationMetadata, OutputFile } from '@helloao/tools/generation/common-types.js';
2
2
  import { Readable } from 'stream';
3
- import { DatasetDataset } from '@helloao/tools/generation/dataset.js';
3
+ import { DatasetCommentary, DatasetDataset, DatasetTranslation } from '@helloao/tools/generation/dataset.js';
4
4
  /**
5
5
  * Defines an interface that contains information about a serialized file.
6
6
  */
@@ -80,6 +80,17 @@ export declare function loadCommentariesFiles(dirs: string[]): Promise<InputFile
80
80
  * @returns The list of files that were loaded, or null if the commentary has no metadata.
81
81
  */
82
82
  export declare function loadCommentaryFiles(commentary: string): Promise<InputFile[] | null>;
83
+ /**
84
+ * Imports all the datasets from the given directory into the database in the current working directory.
85
+ * @param dir The directory that the datasets are located in.
86
+ * @param options The options.
87
+ */
88
+ export declare function loadTranslationsFromDirectory(dir: string): Promise<DatasetTranslation[]>;
89
+ /**
90
+ * Imports all the commentaries from the given directory into the database in the current working directory.
91
+ * @param dir The directory that the commentaries are located in.
92
+ */
93
+ export declare function loadCommentariesFromDirectory(dir: string): Promise<DatasetCommentary[]>;
83
94
  /**
84
95
  * Imports all the datasets from the given directory into the database in the current working directory.
85
96
  * @param dir The directory that the datasets are located in.
@@ -0,0 +1,2 @@
1
+ export declare function createFreeUseBibleApiOpenApiDocument(): any;
2
+ //# sourceMappingURL=openapi.d.ts.map
@@ -0,0 +1,110 @@
1
+ import * as Prisma from './internal/prismaNamespaceBrowser';
2
+ export { Prisma };
3
+ export * as $Enums from './enums';
4
+ export * from './enums';
5
+ /**
6
+ * Model Translation
7
+ *
8
+ */
9
+ export type Translation = Prisma.TranslationModel;
10
+ /**
11
+ * Model Commentary
12
+ *
13
+ */
14
+ export type Commentary = Prisma.CommentaryModel;
15
+ /**
16
+ * Model EBibleSource
17
+ *
18
+ */
19
+ export type EBibleSource = Prisma.EBibleSourceModel;
20
+ /**
21
+ * Model InputFile
22
+ *
23
+ */
24
+ export type InputFile = Prisma.InputFileModel;
25
+ /**
26
+ * Model InputFileWarning
27
+ *
28
+ */
29
+ export type InputFileWarning = Prisma.InputFileWarningModel;
30
+ /**
31
+ * Model Book
32
+ *
33
+ */
34
+ export type Book = Prisma.BookModel;
35
+ /**
36
+ * Model CommentaryBook
37
+ *
38
+ */
39
+ export type CommentaryBook = Prisma.CommentaryBookModel;
40
+ /**
41
+ * Model CommentaryProfile
42
+ *
43
+ */
44
+ export type CommentaryProfile = Prisma.CommentaryProfileModel;
45
+ /**
46
+ * Model Chapter
47
+ *
48
+ */
49
+ export type Chapter = Prisma.ChapterModel;
50
+ /**
51
+ * Model CommentaryChapter
52
+ *
53
+ */
54
+ export type CommentaryChapter = Prisma.CommentaryChapterModel;
55
+ /**
56
+ * Model ChapterAudioUrl
57
+ *
58
+ */
59
+ export type ChapterAudioUrl = Prisma.ChapterAudioUrlModel;
60
+ /**
61
+ * Model ChapterAudioTiming
62
+ *
63
+ */
64
+ export type ChapterAudioTiming = Prisma.ChapterAudioTimingModel;
65
+ /**
66
+ * Model ChapterWords
67
+ *
68
+ */
69
+ export type ChapterWords = Prisma.ChapterWordsModel;
70
+ /**
71
+ * Model ChapterVerse
72
+ *
73
+ */
74
+ export type ChapterVerse = Prisma.ChapterVerseModel;
75
+ /**
76
+ * Model CommentaryChapterVerse
77
+ *
78
+ */
79
+ export type CommentaryChapterVerse = Prisma.CommentaryChapterVerseModel;
80
+ /**
81
+ * Model ChapterFootnote
82
+ *
83
+ */
84
+ export type ChapterFootnote = Prisma.ChapterFootnoteModel;
85
+ /**
86
+ * Model Dataset
87
+ *
88
+ */
89
+ export type Dataset = Prisma.DatasetModel;
90
+ /**
91
+ * Model DatasetBook
92
+ *
93
+ */
94
+ export type DatasetBook = Prisma.DatasetBookModel;
95
+ /**
96
+ * Model DatasetChapter
97
+ *
98
+ */
99
+ export type DatasetChapter = Prisma.DatasetChapterModel;
100
+ /**
101
+ * Model DatasetChapterVerse
102
+ *
103
+ */
104
+ export type DatasetChapterVerse = Prisma.DatasetChapterVerseModel;
105
+ /**
106
+ * Model DatasetReference
107
+ *
108
+ */
109
+ export type DatasetReference = Prisma.DatasetReferenceModel;
110
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1,129 @@
1
+ import * as runtime from "@prisma/client/runtime/client";
2
+ import * as $Class from "./internal/class";
3
+ import * as Prisma from "./internal/prismaNamespace";
4
+ export * as $Enums from './enums';
5
+ export * from "./enums";
6
+ /**
7
+ * ## Prisma Client
8
+ *
9
+ * Type-safe database client for TypeScript
10
+ * @example
11
+ * ```
12
+ * const prisma = new PrismaClient({
13
+ * adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL })
14
+ * })
15
+ * // Fetch zero or more Translations
16
+ * const translations = await prisma.translation.findMany()
17
+ * ```
18
+ *
19
+ * Read more in our [docs](https://pris.ly/d/client).
20
+ */
21
+ export declare const PrismaClient: $Class.PrismaClientConstructor;
22
+ export type PrismaClient<LogOpts extends Prisma.LogLevel = never, OmitOpts extends Prisma.PrismaClientOptions["omit"] = Prisma.PrismaClientOptions["omit"], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>;
23
+ export { Prisma };
24
+ /**
25
+ * Model Translation
26
+ *
27
+ */
28
+ export type Translation = Prisma.TranslationModel;
29
+ /**
30
+ * Model Commentary
31
+ *
32
+ */
33
+ export type Commentary = Prisma.CommentaryModel;
34
+ /**
35
+ * Model EBibleSource
36
+ *
37
+ */
38
+ export type EBibleSource = Prisma.EBibleSourceModel;
39
+ /**
40
+ * Model InputFile
41
+ *
42
+ */
43
+ export type InputFile = Prisma.InputFileModel;
44
+ /**
45
+ * Model InputFileWarning
46
+ *
47
+ */
48
+ export type InputFileWarning = Prisma.InputFileWarningModel;
49
+ /**
50
+ * Model Book
51
+ *
52
+ */
53
+ export type Book = Prisma.BookModel;
54
+ /**
55
+ * Model CommentaryBook
56
+ *
57
+ */
58
+ export type CommentaryBook = Prisma.CommentaryBookModel;
59
+ /**
60
+ * Model CommentaryProfile
61
+ *
62
+ */
63
+ export type CommentaryProfile = Prisma.CommentaryProfileModel;
64
+ /**
65
+ * Model Chapter
66
+ *
67
+ */
68
+ export type Chapter = Prisma.ChapterModel;
69
+ /**
70
+ * Model CommentaryChapter
71
+ *
72
+ */
73
+ export type CommentaryChapter = Prisma.CommentaryChapterModel;
74
+ /**
75
+ * Model ChapterAudioUrl
76
+ *
77
+ */
78
+ export type ChapterAudioUrl = Prisma.ChapterAudioUrlModel;
79
+ /**
80
+ * Model ChapterAudioTiming
81
+ *
82
+ */
83
+ export type ChapterAudioTiming = Prisma.ChapterAudioTimingModel;
84
+ /**
85
+ * Model ChapterWords
86
+ *
87
+ */
88
+ export type ChapterWords = Prisma.ChapterWordsModel;
89
+ /**
90
+ * Model ChapterVerse
91
+ *
92
+ */
93
+ export type ChapterVerse = Prisma.ChapterVerseModel;
94
+ /**
95
+ * Model CommentaryChapterVerse
96
+ *
97
+ */
98
+ export type CommentaryChapterVerse = Prisma.CommentaryChapterVerseModel;
99
+ /**
100
+ * Model ChapterFootnote
101
+ *
102
+ */
103
+ export type ChapterFootnote = Prisma.ChapterFootnoteModel;
104
+ /**
105
+ * Model Dataset
106
+ *
107
+ */
108
+ export type Dataset = Prisma.DatasetModel;
109
+ /**
110
+ * Model DatasetBook
111
+ *
112
+ */
113
+ export type DatasetBook = Prisma.DatasetBookModel;
114
+ /**
115
+ * Model DatasetChapter
116
+ *
117
+ */
118
+ export type DatasetChapter = Prisma.DatasetChapterModel;
119
+ /**
120
+ * Model DatasetChapterVerse
121
+ *
122
+ */
123
+ export type DatasetChapterVerse = Prisma.DatasetChapterVerseModel;
124
+ /**
125
+ * Model DatasetReference
126
+ *
127
+ */
128
+ export type DatasetReference = Prisma.DatasetReferenceModel;
129
+ //# sourceMappingURL=client.d.ts.map