@helloao/cli 0.0.12 → 0.0.14

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.
@@ -41,6 +41,41 @@ export interface InitDbOptions {
41
41
  */
42
42
  language?: string[];
43
43
  }
44
+ export interface ConvertToUsx3Options {
45
+ /**
46
+ * Whether to overwrite existing files in output directory.
47
+ */
48
+ overwrite?: boolean;
49
+ }
50
+ export interface SourceTranslationsOptions {
51
+ /**
52
+ * Whether to convert USFM files to USX3 format after download.
53
+ */
54
+ convertToUsx3?: boolean;
55
+ /**
56
+ * Options for USX3 conversion.
57
+ */
58
+ conversionOptions?: ConvertToUsx3Options;
59
+ /**
60
+ * Whether to track downloads in database.
61
+ */
62
+ useDatabase?: boolean;
63
+ /**
64
+ * Path to BibleMultiConverter.jar file. If not provided, will search common locations.
65
+ */
66
+ bibleMultiConverterPath?: string;
67
+ /**
68
+ * Whether to overwrite existing files in output directory.
69
+ *
70
+ * If database tracking is enabled, this will prevent overwriting files that were not tracked in the database.
71
+ */
72
+ overwrite?: boolean;
73
+ /**
74
+ * The database to use for tracking downloads.
75
+ */
76
+ db?: string | null;
77
+ }
78
+ export declare function getMetaPath(): Promise<string | null>;
44
79
  /**
45
80
  * Initializes a new Bible API DB.
46
81
  * @param dbPath The path to the database. If null or empty, then the "bible-api.db" will be used from the current working directory.
@@ -52,6 +87,10 @@ export interface ImportTranslationOptions {
52
87
  * Whether to forcibly import the translations, even if they have already been imported.
53
88
  */
54
89
  overwrite?: boolean;
90
+ /**
91
+ * The database to import the translations into.
92
+ */
93
+ db?: string | null;
55
94
  }
56
95
  /**
57
96
  * Imports a translation from the given directory into the database in the current working directory.
@@ -85,13 +124,6 @@ export interface FetchTranslationsOptions {
85
124
  */
86
125
  all?: boolean;
87
126
  }
88
- /**
89
- * Fetches the specified translations from fetch.bible and places them in the given directory.
90
- * @param dir The directory that the translations should be placed in.
91
- * @param translations The translations that should be downloaded. If not specified, then all translations will be downloaded.
92
- * @param options The options.
93
- */
94
- export declare function fetchTranslations(dir: string, translations?: string[], options?: FetchTranslationsOptions): Promise<void>;
95
127
  /**
96
128
  * Fetches the specified audio translations and places them in the given directory.
97
129
  * Translations should be in the format "translationId/audioId". e.g. "BSB/gilbert"
@@ -107,6 +139,28 @@ export declare function fetchAudio(dir: string, translations: string[], options?
107
139
  * @param options The options for the generation.
108
140
  */
109
141
  export declare function generateTranslationsFiles(input: string, dest: string, options: UploadApiFromDatabaseOptions): Promise<void>;
142
+ /**
143
+ * Instructions for manual USFM to USX3 conversion using BibleMultiConverter
144
+ */
145
+ export declare const CONVERSION_INSTRUCTIONS: {
146
+ downloadUrl: string;
147
+ javaRequirement: string;
148
+ getConversionCommand: (inputDir: string, outputDir: string, filenamePattern?: string) => string;
149
+ examples: {
150
+ windows: string;
151
+ unix: string;
152
+ };
153
+ };
154
+ /**
155
+ * Prints conversion instructions for the user
156
+ */
157
+ export declare function printConversionInstructions(): void;
158
+ /**
159
+ * Downloads and processes USFM files from eBible.org.
160
+ * Can optionally convert to USX3 format and/or track in database.
161
+ */
162
+ export declare function sourceTranslations(outputDir: string, translations?: string[], options?: SourceTranslationsOptions): Promise<void>;
163
+ export declare function listEBibleTranslations(searchTerm?: string): Promise<void>;
110
164
  /**
111
165
  * Generates the translation files directly from the translation stored in the given input directory.
112
166
  * @param input The input directory that the translation is stored in.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Finds BibleMultiConverter.jar automatically in common locations
3
+ */
4
+ export declare function findBibleMultiConverterJar(providedPath?: string): Promise<string | null>;
5
+ /**
6
+ * Prompts user for BibleMultiConverter.jar location
7
+ */
8
+ export declare function promptForBibleMultiConverter(): Promise<string | null>;
9
+ /**
10
+ * Converts USFM directory to USX3 using BibleMultiConverter
11
+ */
12
+ export declare function convertUsfmToUsx3(inputDir: string, outputDir: string, jarPath: string): Promise<boolean>;
13
+ //# sourceMappingURL=conversion.d.ts.map
@@ -71,16 +71,20 @@ export declare function insertCommentaryBooks(db: Database, commentary: DatasetC
71
71
  export declare function insertCommentaryProfiles(db: Database, commentary: DatasetCommentary, commentaryProfiles: DatasetCommentaryProfile[]): void;
72
72
  export declare function insertCommentaryContent(db: Database, commentary: DatasetCommentary, book: DatasetCommentaryBook, chapters: CommentaryBookChapter[]): void;
73
73
  export declare function getDbPathFromDir(dir: string): string;
74
- export declare function getDbPath(p: string | null): string;
75
- export declare function getPrismaDbFromDir(dir: string): PrismaClient<{
74
+ export declare function getDbPath(p?: string | null): string;
75
+ export declare function getPrismaDb(path?: string | null): PrismaClient<{
76
76
  datasources: {
77
77
  db: {
78
78
  url: string;
79
79
  };
80
80
  };
81
81
  }, never, import("prisma-gen/runtime/library.js").DefaultArgs>;
82
- export declare function getDbFromDir(dir: string): Promise<Database>;
83
- export declare function getDb(dbPath: string): Promise<Database>;
82
+ /**
83
+ * Gets the database from the given path. If no path is provided, the current working directory is used.
84
+ * @param path The path to the database. If not provided, the current working directory is used.
85
+ * @returns
86
+ */
87
+ export declare function getDb(path?: string | null): Promise<Database>;
84
88
  export interface SerializedFile {
85
89
  path: string;
86
90
  content: string | Readable;
@@ -1,2 +1,14 @@
1
+ import { Entry, ZipReader } from '@zip.js/zip.js';
1
2
  export declare function downloadFile(url: string, path: string, onProgress?: (progress: number) => void): Promise<void>;
3
+ export declare function downloadResponse(response: Response, path: string, onProgress?: (progress: number) => void): Promise<void>;
4
+ /**
5
+ * Unzips a ZipReader to a specified directory.
6
+ * @param zip The ZipReader instance to read from.
7
+ * @param directory The directory to unzip files into.
8
+ * @param overwrite Wether to overwrite existing files.
9
+ * @param entryFilter A filter function to determine which entries to unzip.
10
+ * @param closeWhenDone Whether to close the ZipReader when done.
11
+ * @returns The number of files that matched the entry filter.
12
+ */
13
+ export declare function unzipToDirectory(zip: ZipReader<unknown>, directory: string, overwrite: boolean, entryFilter?: (entry: Entry) => boolean, closeWhenDone?: boolean): Promise<number>;
2
14
  //# sourceMappingURL=downloads.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { EBibleSource } from 'prisma-gen/index.js';
2
+ /**
3
+ * Fetches eBible translation metadata and returns EBibleSource objects.
4
+ */
5
+ export declare function fetchEBibleMetadata(): Promise<EBibleSource[]>;
6
+ //# sourceMappingURL=ebible.d.ts.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "id": "ARBNAV",
3
+ "name": "كتاب الحياة",
4
+ "direction": "rtl",
5
+ "englishName": "New Arabic Version (Book of Life)",
6
+ "language": "arb",
7
+ "licenseUrl": "https://ebible.org/Scriptures/details.php?id=arbnav",
8
+ "shortName": "NAV",
9
+ "website": "https://ebible.org/Scriptures/details.php?id=arbnav"
10
+ }
package/meta/BSB.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "id": "BSB",
3
+ "name": "Berean Standard Bible",
4
+ "direction": "ltr",
5
+ "englishName": "Berean Standard Bible",
6
+ "language": "eng",
7
+ "licenseUrl": "https://berean.bible/",
8
+ "shortName": "BSB",
9
+ "website": "https://berean.bible/"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "id": "HBOMAS",
3
+ "name": "כתבי הקודש",
4
+ "direction": "rtl",
5
+ "englishName": "Hebrew Masoretic OT",
6
+ "language": "hbo",
7
+ "licenseUrl": "https://ebible.org/Scriptures/details.php?id=hbo",
8
+ "shortName": "MAS",
9
+ "website": "https://ebible.org/Scriptures/details.php?id=hbo"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "id": "HINIRV",
3
+ "name": "इंडियन रिवाइज्ड वर्जन",
4
+ "direction": "ltr",
5
+ "englishName": "Hindi Indian Revised Version Bible",
6
+ "language": "hin",
7
+ "licenseUrl": "https://ebible.org/Scriptures/details.php?id=hin2017",
8
+ "shortName": "IRV",
9
+ "website": "https://ebible.org/Scriptures/details.php?id=hin2017"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "id": "eng_dra",
3
+ "name": "Douay-Rheims 1899",
4
+ "direction": "ltr",
5
+ "englishName": "Douay-Rheims 1899",
6
+ "language": "eng",
7
+ "licenseUrl": "https://ebible.org/Scriptures/details.php?id=engDRA",
8
+ "shortName": "DRA",
9
+ "website": "https://ebible.org/Scriptures/details.php?id=engDRA"
10
+ }
@@ -0,0 +1,24 @@
1
+ -- CreateTable
2
+ CREATE TABLE "EBibleSource" (
3
+ "id" TEXT NOT NULL PRIMARY KEY,
4
+ "usfmZipUrl" TEXT,
5
+ "usfmZipEtag" TEXT,
6
+ "languageCode" TEXT NOT NULL,
7
+ "title" TEXT NOT NULL,
8
+ "redistributable" BOOLEAN NOT NULL,
9
+ "description" TEXT NOT NULL,
10
+ "copyright" TEXT NOT NULL,
11
+ "updateDate" DATETIME NOT NULL,
12
+ "sourceDate" DATETIME NOT NULL,
13
+ "oldTestamentBooks" INTEGER NOT NULL,
14
+ "oldTestamentChapters" INTEGER NOT NULL,
15
+ "oldTestamentVerses" INTEGER NOT NULL,
16
+ "newTestamentBooks" INTEGER NOT NULL,
17
+ "newTestamentChapters" INTEGER NOT NULL,
18
+ "newTestamentVerses" INTEGER NOT NULL,
19
+ "apocryphaBooks" INTEGER NOT NULL,
20
+ "apocryphaChapters" INTEGER NOT NULL,
21
+ "apocryphaVerses" INTEGER NOT NULL,
22
+ "translationId" TEXT NOT NULL,
23
+ "sha256" TEXT
24
+ );
@@ -0,0 +1,39 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - Added the required column `FCBHID` to the `EBibleSource` table without a default value. This is not possible if the table is not empty.
5
+
6
+ */
7
+ -- RedefineTables
8
+ PRAGMA defer_foreign_keys=ON;
9
+ PRAGMA foreign_keys=OFF;
10
+ CREATE TABLE "new_EBibleSource" (
11
+ "id" TEXT NOT NULL PRIMARY KEY,
12
+ "usfmZipUrl" TEXT,
13
+ "usfmZipEtag" TEXT,
14
+ "languageCode" TEXT NOT NULL,
15
+ "title" TEXT NOT NULL,
16
+ "redistributable" BOOLEAN NOT NULL,
17
+ "description" TEXT NOT NULL,
18
+ "copyright" TEXT NOT NULL,
19
+ "FCBHID" TEXT NOT NULL,
20
+ "updateDate" DATETIME NOT NULL,
21
+ "sourceDate" DATETIME NOT NULL,
22
+ "oldTestamentBooks" INTEGER NOT NULL,
23
+ "oldTestamentChapters" INTEGER NOT NULL,
24
+ "oldTestamentVerses" INTEGER NOT NULL,
25
+ "newTestamentBooks" INTEGER NOT NULL,
26
+ "newTestamentChapters" INTEGER NOT NULL,
27
+ "newTestamentVerses" INTEGER NOT NULL,
28
+ "apocryphaBooks" INTEGER NOT NULL,
29
+ "apocryphaChapters" INTEGER NOT NULL,
30
+ "apocryphaVerses" INTEGER NOT NULL,
31
+ "translationId" TEXT NOT NULL,
32
+ "usfmDownloadDate" DATETIME,
33
+ "sha256" TEXT
34
+ );
35
+ INSERT INTO "new_EBibleSource" ("apocryphaBooks", "apocryphaChapters", "apocryphaVerses", "copyright", "description", "id", "languageCode", "newTestamentBooks", "newTestamentChapters", "newTestamentVerses", "oldTestamentBooks", "oldTestamentChapters", "oldTestamentVerses", "redistributable", "sha256", "sourceDate", "title", "translationId", "updateDate", "usfmZipEtag", "usfmZipUrl") SELECT "apocryphaBooks", "apocryphaChapters", "apocryphaVerses", "copyright", "description", "id", "languageCode", "newTestamentBooks", "newTestamentChapters", "newTestamentVerses", "oldTestamentBooks", "oldTestamentChapters", "oldTestamentVerses", "redistributable", "sha256", "sourceDate", "title", "translationId", "updateDate", "usfmZipEtag", "usfmZipUrl" FROM "EBibleSource";
36
+ DROP TABLE "EBibleSource";
37
+ ALTER TABLE "new_EBibleSource" RENAME TO "EBibleSource";
38
+ PRAGMA foreign_keys=ON;
39
+ PRAGMA defer_foreign_keys=OFF;
@@ -0,0 +1,2 @@
1
+ -- AlterTable
2
+ ALTER TABLE "EBibleSource" ADD COLUMN "usfmDownloadPath" TEXT;
@@ -0,0 +1,3 @@
1
+ -- AlterTable
2
+ ALTER TABLE "EBibleSource" ADD COLUMN "shortTitle" TEXT;
3
+ ALTER TABLE "EBibleSource" ADD COLUMN "textDirection" TEXT;
@@ -0,0 +1,2 @@
1
+ -- AlterTable
2
+ ALTER TABLE "Book" ADD COLUMN "isApocryphal" BOOLEAN;
@@ -0,0 +1,8 @@
1
+ -- CreateTable
2
+ CREATE TABLE "InputFileWarning" (
3
+ "name" TEXT NOT NULL,
4
+ "type" TEXT NOT NULL,
5
+ "message" TEXT NOT NULL,
6
+
7
+ PRIMARY KEY ("name", "type", "message")
8
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helloao/cli",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "A CLI and related tools for managing HelloAO's Free Bible API",
5
5
  "main": "./dist/cjs/index.cjs",
6
6
  "module": "./dist/esm/index.js",
@@ -41,7 +41,9 @@
41
41
  "@smithy/config-resolver": "^3.0.10",
42
42
  "@inquirer/prompts": "5.3.8",
43
43
  "all-iso-language-codes": "1.0.17",
44
- "@helloao/tools": "0.0.12"
44
+ "papaparse": "5.4.1",
45
+ "luxon": "3.5.0",
46
+ "@helloao/tools": "0.0.14"
45
47
  },
46
48
  "files": [
47
49
  "/README.md",
@@ -50,7 +52,8 @@
50
52
  "**/*.js.map",
51
53
  "**/*.d.ts",
52
54
  "/migrations/**/*.sql",
53
- "./schema.prisma"
55
+ "./schema.prisma",
56
+ "/meta/*.json"
54
57
  ],
55
58
  "prisma": {
56
59
  "schema": "./schema.prisma"