@helloao/cli 0.2.0 → 0.4.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 (79) hide show
  1. package/README.md +4 -0
  2. package/dist/cjs/cli.cjs +7361 -8421
  3. package/dist/cjs/index.cjs +7663 -8857
  4. package/dist/esm/cli.js +6118 -0
  5. package/dist/esm/cli.js.map +7 -0
  6. package/dist/esm/index.js +1272 -6039
  7. package/dist/esm/index.js.map +4 -4
  8. package/dist/types/actions.d.ts +43 -1
  9. package/dist/types/db.d.ts +19 -8
  10. package/dist/types/ebible.d.ts +1 -1
  11. package/dist/types/files.d.ts +6 -1
  12. package/dist/types/prisma-gen/browser.d.ts +115 -0
  13. package/dist/types/prisma-gen/client.d.ts +134 -0
  14. package/dist/types/prisma-gen/commonInputTypes.d.ts +378 -0
  15. package/dist/types/prisma-gen/enums.d.ts +2 -0
  16. package/dist/types/prisma-gen/internal/class.d.ts +364 -0
  17. package/dist/types/prisma-gen/internal/prismaNamespace.d.ts +2358 -0
  18. package/dist/types/prisma-gen/internal/prismaNamespaceBrowser.d.ts +304 -0
  19. package/dist/types/prisma-gen/models/Book.d.ts +2197 -0
  20. package/dist/types/prisma-gen/models/Chapter.d.ts +1934 -0
  21. package/dist/types/prisma-gen/models/ChapterAudioTiming.d.ts +1414 -0
  22. package/dist/types/prisma-gen/models/ChapterAudioUrl.d.ts +1414 -0
  23. package/dist/types/prisma-gen/models/ChapterFootnote.d.ts +1642 -0
  24. package/dist/types/prisma-gen/models/ChapterVerse.d.ts +1653 -0
  25. package/dist/types/prisma-gen/models/ChapterWords.d.ts +1366 -0
  26. package/dist/types/prisma-gen/models/Commentary.d.ts +1711 -0
  27. package/dist/types/prisma-gen/models/CommentaryBook.d.ts +1622 -0
  28. package/dist/types/prisma-gen/models/CommentaryChapter.d.ts +1487 -0
  29. package/dist/types/prisma-gen/models/CommentaryChapterVerse.d.ts +1514 -0
  30. package/dist/types/prisma-gen/models/CommentaryProfile.d.ts +1451 -0
  31. package/dist/types/prisma-gen/models/Dataset.d.ts +1810 -0
  32. package/dist/types/prisma-gen/models/DatasetBook.d.ts +1565 -0
  33. package/dist/types/prisma-gen/models/DatasetChapter.d.ts +1553 -0
  34. package/dist/types/prisma-gen/models/DatasetChapterVerse.d.ts +1600 -0
  35. package/dist/types/prisma-gen/models/DatasetEntity.d.ts +1214 -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 +24 -0
  42. package/dist/types/s3.d.ts +2 -0
  43. package/dist/types/uploads.d.ts +1 -1
  44. package/meta/ARBNAV.json +10 -10
  45. package/meta/BSB.json +10 -10
  46. package/meta/HBOMAS.json +10 -10
  47. package/meta/HINIRV.json +10 -10
  48. package/meta/eng_dra.json +10 -10
  49. package/migrations/20240420231455_initial/migration.sql +66 -66
  50. package/migrations/20240711173108_add_chapter_audio/migration.sql +13 -13
  51. package/migrations/20240724212651_add_hashing/migration.sql +25 -25
  52. package/migrations/20250625201152_add_extra_ebible_metadata/migration.sql +3 -3
  53. package/migrations/20250630200532_add_apocryhpa_flag/migration.sql +2 -2
  54. package/migrations/20250701195337_add_file_warnings/migration.sql +8 -8
  55. package/migrations/20251028135135_add_datasets/migration.sql +72 -72
  56. package/migrations/20251028144932_fix_dataset_types/migration.sql +50 -50
  57. package/migrations/20260217200934_add_license_notice/migration.sql +5 -5
  58. package/migrations/20260703000000_add_chapter_audio_timing/migration.sql +13 -0
  59. package/migrations/20260809000000_add_chapter_words/migration.sql +12 -0
  60. package/migrations/20260829000000_add_dataset_entities/migration.sql +12 -0
  61. package/package.json +21 -18
  62. package/schema.prisma +65 -2
  63. package/prisma-gen/default.d.ts +0 -1
  64. package/prisma-gen/default.js +0 -1
  65. package/prisma-gen/edge.d.ts +0 -1
  66. package/prisma-gen/edge.js +0 -403
  67. package/prisma-gen/index-browser.js +0 -397
  68. package/prisma-gen/index.d.ts +0 -34011
  69. package/prisma-gen/index.js +0 -426
  70. package/prisma-gen/runtime/edge-esm.js +0 -31
  71. package/prisma-gen/runtime/edge.js +0 -31
  72. package/prisma-gen/runtime/index-browser.d.ts +0 -365
  73. package/prisma-gen/runtime/index-browser.js +0 -13
  74. package/prisma-gen/runtime/library.d.ts +0 -3403
  75. package/prisma-gen/runtime/library.js +0 -143
  76. package/prisma-gen/runtime/react-native.js +0 -80
  77. package/prisma-gen/runtime/wasm.js +0 -32
  78. package/prisma-gen/wasm.d.ts +0 -1
  79. package/prisma-gen/wasm.js +0 -397
@@ -1,4 +1,4 @@
1
- import { PrismaClient } from './prisma-gen/index.js';
1
+ import { PrismaClient } from './prisma-gen/client.js';
2
2
  import { InputTranslationMetadata } from '@helloao/tools/generation/index.js';
3
3
  import { UploadApiFromDatabaseOptions, UploadApiOptions } from './uploads.js';
4
4
  export interface GetTranslationsItem {
@@ -125,6 +125,48 @@ export declare function importCommentaries(dir: string, options: ImportTranslati
125
125
  * @param options The options.
126
126
  */
127
127
  export declare function importApi(dir: string, options: ImportTranslationOptions): Promise<void>;
128
+ /**
129
+ * Imports the Theographic Bible Metadata from the given directory into the database.
130
+ * The directory should contain the JSON files that are downloaded by the fetch-bible-metadata command.
131
+ * @param dir The directory that the Theographic JSON files are located in.
132
+ * @param options The options.
133
+ */
134
+ export declare function importBibleMetadata(dir: string, options: ImportTranslationOptions): Promise<void>;
135
+ /**
136
+ * A single chapter's worth of audio timing data to import.
137
+ */
138
+ export interface AudioTimingRecord {
139
+ /**
140
+ * The ID of the translation.
141
+ */
142
+ translationId: string;
143
+ /**
144
+ * The ID of the book.
145
+ */
146
+ bookId: string;
147
+ /**
148
+ * The number of the chapter.
149
+ */
150
+ chapterNumber: number;
151
+ /**
152
+ * The reader that the timings are for.
153
+ */
154
+ reader: string;
155
+ /**
156
+ * The times (in seconds) that each verse starts, in verse order.
157
+ */
158
+ verses: number[];
159
+ }
160
+ /**
161
+ * Imports chapter audio timing data from the given JSON file into the database in the
162
+ * current working directory.
163
+ *
164
+ * The file should contain an array of records: `{ translationId, bookId, chapterNumber, reader, verses }`
165
+ * where `verses` is an array of numbers (seconds) - one per verse in the chapter, in order.
166
+ * @param file The path to the JSON file to import.
167
+ * @param options The options.
168
+ */
169
+ export declare function importAudioTimings(file: string, options: ImportTranslationOptions): Promise<void>;
128
170
  export interface FetchTranslationsOptions {
129
171
  /**
130
172
  * Fetch all translations. If omitted, only undownloaded translations will be fetched.
@@ -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,22 +72,33 @@ 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;
78
88
  export declare function insertCommentaryContent(db: Database, commentary: DatasetCommentary, book: DatasetCommentaryBook, chapters: CommentaryBookChapter[]): void;
79
89
  export declare function insertDatasets(db: Database, datasets: DatasetDataset[]): void;
90
+ /**
91
+ * Inserts the entities (people, places, events, and people groups) for the given dataset into the database.
92
+ * Any entities that are no longer present in the dataset are deleted.
93
+ * @param db The database to insert the entities into.
94
+ * @param dataset The dataset that the entities belong to.
95
+ */
96
+ export declare function insertDatasetEntities(db: Database, dataset: DatasetDataset): void;
80
97
  export declare function insertDatasetBooks(db: Database, dataset: DatasetDataset, datasetBooks: DatasetDatasetBook[]): void;
81
98
  export declare function insertDatasetContent(db: Database, dataset: DatasetDataset, book: DatasetDatasetBook, chapters: DatasetBookChapter[]): void;
82
99
  export declare function getDbPathFromDir(dir: string): string;
83
100
  export declare function getDbPath(p?: string | null): string;
84
- export declare function getPrismaDb(path?: string | null): Promise<PrismaClient<{
85
- datasources: {
86
- db: {
87
- url: string;
88
- };
89
- };
90
- }, never, import("./prisma-gen/runtime/library.js").DefaultArgs>>;
101
+ 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
102
  /**
92
103
  * Gets the database from the given path. If no path is provided, the current working directory is used.
93
104
  * @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, DatasetTranslation } 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
  */
@@ -86,6 +86,11 @@ export declare function loadCommentaryFiles(commentary: string): Promise<InputFi
86
86
  * @param options The options.
87
87
  */
88
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[]>;
89
94
  /**
90
95
  * Imports all the datasets from the given directory into the database in the current working directory.
91
96
  * @param dir The directory that the datasets are located in.
@@ -0,0 +1,115 @@
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 DatasetEntity
92
+ *
93
+ */
94
+ export type DatasetEntity = Prisma.DatasetEntityModel;
95
+ /**
96
+ * Model DatasetBook
97
+ *
98
+ */
99
+ export type DatasetBook = Prisma.DatasetBookModel;
100
+ /**
101
+ * Model DatasetChapter
102
+ *
103
+ */
104
+ export type DatasetChapter = Prisma.DatasetChapterModel;
105
+ /**
106
+ * Model DatasetChapterVerse
107
+ *
108
+ */
109
+ export type DatasetChapterVerse = Prisma.DatasetChapterVerseModel;
110
+ /**
111
+ * Model DatasetReference
112
+ *
113
+ */
114
+ export type DatasetReference = Prisma.DatasetReferenceModel;
115
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1,134 @@
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 DatasetEntity
111
+ *
112
+ */
113
+ export type DatasetEntity = Prisma.DatasetEntityModel;
114
+ /**
115
+ * Model DatasetBook
116
+ *
117
+ */
118
+ export type DatasetBook = Prisma.DatasetBookModel;
119
+ /**
120
+ * Model DatasetChapter
121
+ *
122
+ */
123
+ export type DatasetChapter = Prisma.DatasetChapterModel;
124
+ /**
125
+ * Model DatasetChapterVerse
126
+ *
127
+ */
128
+ export type DatasetChapterVerse = Prisma.DatasetChapterVerseModel;
129
+ /**
130
+ * Model DatasetReference
131
+ *
132
+ */
133
+ export type DatasetReference = Prisma.DatasetReferenceModel;
134
+ //# sourceMappingURL=client.d.ts.map