@helloao/cli 0.0.5 → 0.0.7

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/README.md CHANGED
@@ -1,126 +1,125 @@
1
- ## Hello AO CLI
2
-
3
- A Command Line Interface (CLI) that makes it easy to generate and manage your own [Free Use Bible API](https://bible.helloao.org/).
4
-
5
- Additionally, it includes many functions and utilities that can make working with commonly formatted Bible data much easier.
6
-
7
- ### Features
8
-
9
- - Supports [USFM](https://ubsicap.github.io/usfm/), [USX](https://ubsicap.github.io/usx/), and Codex (A JSON format).
10
- - Download over 1000 Bible translations from [fetch.bible](https://fetch.bible/).
11
- - Import Bible translations into a SQLite database.
12
- - Upload to S3, a zip file, or a local directory.
13
-
14
- ### Usage
15
-
16
- ```
17
- Usage: helloao [options] [command]
18
-
19
- A CLI for managing a Free Use Bible API.
20
-
21
- Options:
22
- -V, --version output the version number
23
- -h, --help display help for command
24
-
25
- Commands:
26
- init [options] [path] Initialize a new Bible API DB.
27
- import-translation [options] <dir> [dirs...] Imports a translation from the given directory into the database.
28
- import-translations [options] <dir> Imports all translations from the given directory into the database.
29
- generate-translation-files [options] <input> <dir> Generates API files from the given input translation.
30
- generate-translations-files [options] <input> <dir> Generates API files from the given input translations.
31
- upload-api-files [options] <dest> Uploads API files to the specified destination. For S3, use the format s3://bucket-name/path/to/folder.
32
- fetch-translations [options] <dir> [translations...] Fetches the specified translations from fetch.bible and places them in the given directory.
33
- fetch-audio [options] <dir> [translations...] Fetches the specified audio translations and places them in the given directory.
34
- Translations should be in the format "translationId/audioId". e.g. "BSB/gilbert"
35
- fetch-bible-metadata <dir> Fetches the Theographic bible metadata and places it in the given directory.
36
- help [command] display help for command
37
- ```
38
-
39
- The `@helloao/cli` package can also be used as a library.
40
-
41
- The library exports a variety of actions, utilities, and supporting classes designed to assist with generating and managing a Free Use Bible API.
42
-
43
- There are 6 main exports:
44
-
45
- - `actions` - This export contains function versions of the CLI commands. They make it easy to call a CLI command from a script.
46
- - `db` - This export contains functions that make working with a database easier. It supports operations like importing translations into a database, inserting chapters, verses, etc. and getting an updated database instance from a path.
47
- - `downloads` - This export contains functions that make downloading files easier.
48
- - `files` - This export contains functions that make working with files easier. It has functions to load files from a translation, discover translation metadata from the filesystem, and classes that support uploading API files to the local file system or to a zip archive.
49
- - `uploads` - This export contains functions that make it easy to upload an API to a destination like S3, the local filesystem, or a zip archive.
50
- - `s3` - This export contains a class that can upload files to S3.
51
-
52
-
53
- Here are some common operations that you might want to perform:
54
-
55
- #### Get a SQL Database
56
-
57
- ```typescript
58
- import { db } from '@helloao/cli';
59
-
60
- const pathToDb = './bible-database.db';
61
- const database = await db.getDb(pathToDb);
62
-
63
- // do work on the database
64
-
65
- // Close it when you are done.
66
- database.close();
67
- ```
68
-
69
- #### Import a translation into a database from a directory
70
-
71
- ```typescript
72
- import { db } from '@helloao/cli';
73
-
74
- const pathToDb = './bible-database.db';
75
- const database = await db.getDb(pathToDb);
76
-
77
- // Get a DOMParser for parsing USX.
78
- // On Node.js, you may have to import jsdom or linkedom.
79
- const parser = new DOMParser();
80
-
81
- const pathToTranslation = './path/to/translation';
82
-
83
- // Whether to overwrite files that already exist in the database.
84
- // The system will automatically determine the hashes of the input files and overwrite changed files if needed, so this is only needed
85
- // when you know that they need to be overwritten.
86
- const overwrite = false;
87
- await db.importTranslations(database, pathToTranslation, parser, overwrite);
88
- ```
89
-
90
- #### Generate an API from a translation
91
-
92
- ```typescript
93
- import { files, uploads } from '@helloao/cli';
94
- import { generation } from '@helloao/tools';
95
- import { toAsyncIterable } from '@helloao/tools/parser/iterators';
96
-
97
- const translationPath = './path/to/translation';
98
- const translationFiles = await files.loadTranslationFiles(translationPath);
99
-
100
- // Used to parse XML
101
- const domParser = new DOMParser();
102
-
103
- // Generate a dataset from the files
104
- // Datasets organize all the files and their content
105
- // by translation, book, chapter, and verse
106
- const dataset = generation.dataset.generateDataset(files, parser);
107
-
108
- // You can optionally specifiy a prefix that should be added to all API
109
- // links
110
- const pathPrefix = '';
111
-
112
- // Generate an API representation from the files
113
- // This adds links between chapters and additional metadata.
114
- const api = generation.api.generateApiForDataset(dataset, {
115
- pathPrefix
116
- });
117
-
118
- // Generate output files from the API representation.
119
- // This will give us a list of files and file paths that represent
120
- // the entire API.
121
- const outputFiles = generation.api.generateFilesForApi(api);
122
-
123
- // Optionally upload files by using:
124
- // const dest = 's3://my-bucket';
125
- // await uploads.serializeAndUploadDatasets(dest, toAsyncIterable(outputFiles));
126
- ```
1
+ ## Hello AO CLI
2
+
3
+ A Command Line Interface (CLI) that makes it easy to generate and manage your own [Free Use Bible API](https://bible.helloao.org/).
4
+
5
+ Additionally, it includes many functions and utilities that can make working with commonly formatted Bible data much easier.
6
+
7
+ ### Features
8
+
9
+ - Supports [USFM](https://ubsicap.github.io/usfm/), [USX](https://ubsicap.github.io/usx/), and Codex (A JSON format).
10
+ - Download over 1000 Bible translations from [fetch.bible](https://fetch.bible/).
11
+ - Import Bible translations into a SQLite database.
12
+ - Upload to S3, a zip file, or a local directory.
13
+
14
+ ### Usage
15
+
16
+ ```
17
+ Usage: helloao [options] [command]
18
+
19
+ A CLI for managing a Free Use Bible API.
20
+
21
+ Options:
22
+ -V, --version output the version number
23
+ -h, --help display help for command
24
+
25
+ Commands:
26
+ init [options] [path] Initialize a new Bible API DB.
27
+ import-translation [options] <dir> [dirs...] Imports a translation from the given directory into the database.
28
+ import-translations [options] <dir> Imports all translations from the given directory into the database.
29
+ generate-translation-files [options] <input> <dir> Generates API files from the given input translation.
30
+ generate-translations-files [options] <input> <dir> Generates API files from the given input translations.
31
+ upload-api-files [options] <dest> Uploads API files to the specified destination. For S3, use the format s3://bucket-name/path/to/folder.
32
+ fetch-translations [options] <dir> [translations...] Fetches the specified translations from fetch.bible and places them in the given directory.
33
+ fetch-audio [options] <dir> [translations...] Fetches the specified audio translations and places them in the given directory.
34
+ Translations should be in the format "translationId/audioId". e.g. "BSB/gilbert"
35
+ fetch-bible-metadata <dir> Fetches the Theographic bible metadata and places it in the given directory.
36
+ help [command] display help for command
37
+ ```
38
+
39
+ The `@helloao/cli` package can also be used as a library.
40
+
41
+ The library exports a variety of actions, utilities, and supporting classes designed to assist with generating and managing a Free Use Bible API.
42
+
43
+ There are 6 main exports:
44
+
45
+ - `actions` - This export contains function versions of the CLI commands. They make it easy to call a CLI command from a script.
46
+ - `db` - This export contains functions that make working with a database easier. It supports operations like importing translations into a database, inserting chapters, verses, etc. and getting an updated database instance from a path.
47
+ - `downloads` - This export contains functions that make downloading files easier.
48
+ - `files` - This export contains functions that make working with files easier. It has functions to load files from a translation, discover translation metadata from the filesystem, and classes that support uploading API files to the local file system or to a zip archive.
49
+ - `uploads` - This export contains functions that make it easy to upload an API to a destination like S3, the local filesystem, or a zip archive.
50
+ - `s3` - This export contains a class that can upload files to S3.
51
+
52
+ Here are some common operations that you might want to perform:
53
+
54
+ #### Get a SQL Database
55
+
56
+ ```typescript
57
+ import { db } from '@helloao/cli';
58
+
59
+ const pathToDb = './bible-database.db';
60
+ const database = await db.getDb(pathToDb);
61
+
62
+ // do work on the database
63
+
64
+ // Close it when you are done.
65
+ database.close();
66
+ ```
67
+
68
+ #### Import a translation into a database from a directory
69
+
70
+ ```typescript
71
+ import { db } from '@helloao/cli';
72
+
73
+ const pathToDb = './bible-database.db';
74
+ const database = await db.getDb(pathToDb);
75
+
76
+ // Get a DOMParser for parsing USX.
77
+ // On Node.js, you may have to import jsdom or linkedom.
78
+ const parser = new DOMParser();
79
+
80
+ const pathToTranslation = './path/to/translation';
81
+
82
+ // Whether to overwrite files that already exist in the database.
83
+ // The system will automatically determine the hashes of the input files and overwrite changed files if needed, so this is only needed
84
+ // when you know that they need to be overwritten.
85
+ const overwrite = false;
86
+ await db.importTranslations(database, pathToTranslation, parser, overwrite);
87
+ ```
88
+
89
+ #### Generate an API from a translation
90
+
91
+ ```typescript
92
+ import { files, uploads } from '@helloao/cli';
93
+ import { generation } from '@helloao/tools';
94
+ import { toAsyncIterable } from '@helloao/tools/parser/iterators';
95
+
96
+ const translationPath = './path/to/translation';
97
+ const translationFiles = await files.loadTranslationFiles(translationPath);
98
+
99
+ // Used to parse XML
100
+ const domParser = new DOMParser();
101
+
102
+ // Generate a dataset from the files
103
+ // Datasets organize all the files and their content
104
+ // by translation, book, chapter, and verse
105
+ const dataset = generation.dataset.generateDataset(files, parser);
106
+
107
+ // You can optionally specifiy a prefix that should be added to all API
108
+ // links
109
+ const pathPrefix = '';
110
+
111
+ // Generate an API representation from the files
112
+ // This adds links between chapters and additional metadata.
113
+ const api = generation.api.generateApiForDataset(dataset, {
114
+ pathPrefix,
115
+ });
116
+
117
+ // Generate output files from the API representation.
118
+ // This will give us a list of files and file paths that represent
119
+ // the entire API.
120
+ const outputFiles = generation.api.generateFilesForApi(api);
121
+
122
+ // Optionally upload files by using:
123
+ // const dest = 's3://my-bucket';
124
+ // await uploads.serializeAndUploadDatasets(dest, toAsyncIterable(outputFiles));
125
+ ```
@@ -1,26 +1,26 @@
1
- /*
2
- Warnings:
3
-
4
- - Added the required column `order` to the `Book` 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_Book" (
11
- "id" TEXT NOT NULL,
12
- "translationId" TEXT NOT NULL,
13
- "name" TEXT NOT NULL,
14
- "commonName" TEXT NOT NULL,
15
- "title" TEXT,
16
- "order" INTEGER NOT NULL,
17
- "numberOfChapters" INTEGER NOT NULL,
18
-
19
- PRIMARY KEY ("translationId", "id"),
20
- CONSTRAINT "Book_translationId_fkey" FOREIGN KEY ("translationId") REFERENCES "Translation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
21
- );
22
- INSERT INTO "new_Book" ("commonName", "id", "name", "numberOfChapters", "title", "translationId") SELECT "commonName", "id", "name", "numberOfChapters", "title", "translationId" FROM "Book";
23
- DROP TABLE "Book";
24
- ALTER TABLE "new_Book" RENAME TO "Book";
25
- PRAGMA foreign_keys=ON;
26
- PRAGMA defer_foreign_keys=OFF;
1
+ /*
2
+ Warnings:
3
+
4
+ - Added the required column `order` to the `Book` 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_Book" (
11
+ "id" TEXT NOT NULL,
12
+ "translationId" TEXT NOT NULL,
13
+ "name" TEXT NOT NULL,
14
+ "commonName" TEXT NOT NULL,
15
+ "title" TEXT,
16
+ "order" INTEGER NOT NULL,
17
+ "numberOfChapters" INTEGER NOT NULL,
18
+
19
+ PRIMARY KEY ("translationId", "id"),
20
+ CONSTRAINT "Book_translationId_fkey" FOREIGN KEY ("translationId") REFERENCES "Translation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
21
+ );
22
+ INSERT INTO "new_Book" ("commonName", "id", "name", "numberOfChapters", "title", "translationId") SELECT "commonName", "id", "name", "numberOfChapters", "title", "translationId" FROM "Book";
23
+ DROP TABLE "Book";
24
+ ALTER TABLE "new_Book" RENAME TO "Book";
25
+ PRAGMA foreign_keys=ON;
26
+ PRAGMA defer_foreign_keys=OFF;
@@ -1,45 +1,45 @@
1
- /*
2
- Warnings:
3
-
4
- - Added the required column `contentJson` to the `ChapterVerse` 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_Chapter" (
11
- "number" INTEGER NOT NULL,
12
- "bookId" TEXT NOT NULL,
13
- "translationId" TEXT NOT NULL,
14
- "apiLink" TEXT NOT NULL,
15
- "previousChapterTranslationId" TEXT,
16
- "previousChapterBookId" TEXT,
17
- "previousChapterNumber" INTEGER,
18
-
19
- PRIMARY KEY ("translationId", "bookId", "number"),
20
- CONSTRAINT "Chapter_translationId_bookId_fkey" FOREIGN KEY ("translationId", "bookId") REFERENCES "Book" ("translationId", "id") ON DELETE RESTRICT ON UPDATE CASCADE,
21
- CONSTRAINT "Chapter_translationId_fkey" FOREIGN KEY ("translationId") REFERENCES "Translation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
22
- CONSTRAINT "Chapter_previousChapterTranslationId_previousChapterBookId_previousChapterNumber_fkey" FOREIGN KEY ("previousChapterTranslationId", "previousChapterBookId", "previousChapterNumber") REFERENCES "Chapter" ("translationId", "bookId", "number") ON DELETE SET NULL ON UPDATE CASCADE
23
- );
24
- INSERT INTO "new_Chapter" ("apiLink", "bookId", "number", "translationId") SELECT "apiLink", "bookId", "number", "translationId" FROM "Chapter";
25
- DROP TABLE "Chapter";
26
- ALTER TABLE "new_Chapter" RENAME TO "Chapter";
27
- CREATE UNIQUE INDEX "Chapter_previousChapterTranslationId_previousChapterBookId_previousChapterNumber_key" ON "Chapter"("previousChapterTranslationId", "previousChapterBookId", "previousChapterNumber");
28
- CREATE TABLE "new_ChapterVerse" (
29
- "number" INTEGER NOT NULL,
30
- "chapterNumber" INTEGER NOT NULL,
31
- "bookId" TEXT NOT NULL,
32
- "translationId" TEXT NOT NULL,
33
- "text" TEXT NOT NULL,
34
- "contentJson" TEXT NOT NULL,
35
-
36
- PRIMARY KEY ("translationId", "bookId", "chapterNumber", "number"),
37
- CONSTRAINT "ChapterVerse_translationId_bookId_chapterNumber_fkey" FOREIGN KEY ("translationId", "bookId", "chapterNumber") REFERENCES "Chapter" ("translationId", "bookId", "number") ON DELETE RESTRICT ON UPDATE CASCADE,
38
- CONSTRAINT "ChapterVerse_translationId_bookId_fkey" FOREIGN KEY ("translationId", "bookId") REFERENCES "Book" ("translationId", "id") ON DELETE RESTRICT ON UPDATE CASCADE,
39
- CONSTRAINT "ChapterVerse_translationId_fkey" FOREIGN KEY ("translationId") REFERENCES "Translation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
40
- );
41
- INSERT INTO "new_ChapterVerse" ("bookId", "chapterNumber", "number", "text", "translationId") SELECT "bookId", "chapterNumber", "number", "text", "translationId" FROM "ChapterVerse";
42
- DROP TABLE "ChapterVerse";
43
- ALTER TABLE "new_ChapterVerse" RENAME TO "ChapterVerse";
44
- PRAGMA foreign_keys=ON;
45
- PRAGMA defer_foreign_keys=OFF;
1
+ /*
2
+ Warnings:
3
+
4
+ - Added the required column `contentJson` to the `ChapterVerse` 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_Chapter" (
11
+ "number" INTEGER NOT NULL,
12
+ "bookId" TEXT NOT NULL,
13
+ "translationId" TEXT NOT NULL,
14
+ "apiLink" TEXT NOT NULL,
15
+ "previousChapterTranslationId" TEXT,
16
+ "previousChapterBookId" TEXT,
17
+ "previousChapterNumber" INTEGER,
18
+
19
+ PRIMARY KEY ("translationId", "bookId", "number"),
20
+ CONSTRAINT "Chapter_translationId_bookId_fkey" FOREIGN KEY ("translationId", "bookId") REFERENCES "Book" ("translationId", "id") ON DELETE RESTRICT ON UPDATE CASCADE,
21
+ CONSTRAINT "Chapter_translationId_fkey" FOREIGN KEY ("translationId") REFERENCES "Translation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
22
+ CONSTRAINT "Chapter_previousChapterTranslationId_previousChapterBookId_previousChapterNumber_fkey" FOREIGN KEY ("previousChapterTranslationId", "previousChapterBookId", "previousChapterNumber") REFERENCES "Chapter" ("translationId", "bookId", "number") ON DELETE SET NULL ON UPDATE CASCADE
23
+ );
24
+ INSERT INTO "new_Chapter" ("apiLink", "bookId", "number", "translationId") SELECT "apiLink", "bookId", "number", "translationId" FROM "Chapter";
25
+ DROP TABLE "Chapter";
26
+ ALTER TABLE "new_Chapter" RENAME TO "Chapter";
27
+ CREATE UNIQUE INDEX "Chapter_previousChapterTranslationId_previousChapterBookId_previousChapterNumber_key" ON "Chapter"("previousChapterTranslationId", "previousChapterBookId", "previousChapterNumber");
28
+ CREATE TABLE "new_ChapterVerse" (
29
+ "number" INTEGER NOT NULL,
30
+ "chapterNumber" INTEGER NOT NULL,
31
+ "bookId" TEXT NOT NULL,
32
+ "translationId" TEXT NOT NULL,
33
+ "text" TEXT NOT NULL,
34
+ "contentJson" TEXT NOT NULL,
35
+
36
+ PRIMARY KEY ("translationId", "bookId", "chapterNumber", "number"),
37
+ CONSTRAINT "ChapterVerse_translationId_bookId_chapterNumber_fkey" FOREIGN KEY ("translationId", "bookId", "chapterNumber") REFERENCES "Chapter" ("translationId", "bookId", "number") ON DELETE RESTRICT ON UPDATE CASCADE,
38
+ CONSTRAINT "ChapterVerse_translationId_bookId_fkey" FOREIGN KEY ("translationId", "bookId") REFERENCES "Book" ("translationId", "id") ON DELETE RESTRICT ON UPDATE CASCADE,
39
+ CONSTRAINT "ChapterVerse_translationId_fkey" FOREIGN KEY ("translationId") REFERENCES "Translation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
40
+ );
41
+ INSERT INTO "new_ChapterVerse" ("bookId", "chapterNumber", "number", "text", "translationId") SELECT "bookId", "chapterNumber", "number", "text", "translationId" FROM "ChapterVerse";
42
+ DROP TABLE "ChapterVerse";
43
+ ALTER TABLE "new_ChapterVerse" RENAME TO "ChapterVerse";
44
+ PRAGMA foreign_keys=ON;
45
+ PRAGMA defer_foreign_keys=OFF;
@@ -1,30 +1,30 @@
1
- /*
2
- Warnings:
3
-
4
- - Added the required column `json` to the `Chapter` 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_Chapter" (
11
- "number" INTEGER NOT NULL,
12
- "bookId" TEXT NOT NULL,
13
- "translationId" TEXT NOT NULL,
14
- "apiLink" TEXT NOT NULL,
15
- "json" TEXT NOT NULL,
16
- "previousChapterTranslationId" TEXT,
17
- "previousChapterBookId" TEXT,
18
- "previousChapterNumber" INTEGER,
19
-
20
- PRIMARY KEY ("translationId", "bookId", "number"),
21
- CONSTRAINT "Chapter_translationId_bookId_fkey" FOREIGN KEY ("translationId", "bookId") REFERENCES "Book" ("translationId", "id") ON DELETE RESTRICT ON UPDATE CASCADE,
22
- CONSTRAINT "Chapter_translationId_fkey" FOREIGN KEY ("translationId") REFERENCES "Translation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
23
- CONSTRAINT "Chapter_previousChapterTranslationId_previousChapterBookId_previousChapterNumber_fkey" FOREIGN KEY ("previousChapterTranslationId", "previousChapterBookId", "previousChapterNumber") REFERENCES "Chapter" ("translationId", "bookId", "number") ON DELETE SET NULL ON UPDATE CASCADE
24
- );
25
- INSERT INTO "new_Chapter" ("apiLink", "bookId", "number", "previousChapterBookId", "previousChapterNumber", "previousChapterTranslationId", "translationId") SELECT "apiLink", "bookId", "number", "previousChapterBookId", "previousChapterNumber", "previousChapterTranslationId", "translationId" FROM "Chapter";
26
- DROP TABLE "Chapter";
27
- ALTER TABLE "new_Chapter" RENAME TO "Chapter";
28
- CREATE UNIQUE INDEX "Chapter_previousChapterTranslationId_previousChapterBookId_previousChapterNumber_key" ON "Chapter"("previousChapterTranslationId", "previousChapterBookId", "previousChapterNumber");
29
- PRAGMA foreign_keys=ON;
30
- PRAGMA defer_foreign_keys=OFF;
1
+ /*
2
+ Warnings:
3
+
4
+ - Added the required column `json` to the `Chapter` 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_Chapter" (
11
+ "number" INTEGER NOT NULL,
12
+ "bookId" TEXT NOT NULL,
13
+ "translationId" TEXT NOT NULL,
14
+ "apiLink" TEXT NOT NULL,
15
+ "json" TEXT NOT NULL,
16
+ "previousChapterTranslationId" TEXT,
17
+ "previousChapterBookId" TEXT,
18
+ "previousChapterNumber" INTEGER,
19
+
20
+ PRIMARY KEY ("translationId", "bookId", "number"),
21
+ CONSTRAINT "Chapter_translationId_bookId_fkey" FOREIGN KEY ("translationId", "bookId") REFERENCES "Book" ("translationId", "id") ON DELETE RESTRICT ON UPDATE CASCADE,
22
+ CONSTRAINT "Chapter_translationId_fkey" FOREIGN KEY ("translationId") REFERENCES "Translation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
23
+ CONSTRAINT "Chapter_previousChapterTranslationId_previousChapterBookId_previousChapterNumber_fkey" FOREIGN KEY ("previousChapterTranslationId", "previousChapterBookId", "previousChapterNumber") REFERENCES "Chapter" ("translationId", "bookId", "number") ON DELETE SET NULL ON UPDATE CASCADE
24
+ );
25
+ INSERT INTO "new_Chapter" ("apiLink", "bookId", "number", "previousChapterBookId", "previousChapterNumber", "previousChapterTranslationId", "translationId") SELECT "apiLink", "bookId", "number", "previousChapterBookId", "previousChapterNumber", "previousChapterTranslationId", "translationId" FROM "Chapter";
26
+ DROP TABLE "Chapter";
27
+ ALTER TABLE "new_Chapter" RENAME TO "Chapter";
28
+ CREATE UNIQUE INDEX "Chapter_previousChapterTranslationId_previousChapterBookId_previousChapterNumber_key" ON "Chapter"("previousChapterTranslationId", "previousChapterBookId", "previousChapterNumber");
29
+ PRAGMA foreign_keys=ON;
30
+ PRAGMA defer_foreign_keys=OFF;
@@ -1,27 +1,27 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `apiLink` on the `Chapter` table. All the data in the column will be lost.
5
- - You are about to drop the column `previousChapterBookId` on the `Chapter` table. All the data in the column will be lost.
6
- - You are about to drop the column `previousChapterNumber` on the `Chapter` table. All the data in the column will be lost.
7
- - You are about to drop the column `previousChapterTranslationId` on the `Chapter` table. All the data in the column will be lost.
8
-
9
- */
10
- -- RedefineTables
11
- PRAGMA defer_foreign_keys=ON;
12
- PRAGMA foreign_keys=OFF;
13
- CREATE TABLE "new_Chapter" (
14
- "number" INTEGER NOT NULL,
15
- "bookId" TEXT NOT NULL,
16
- "translationId" TEXT NOT NULL,
17
- "json" TEXT NOT NULL,
18
-
19
- PRIMARY KEY ("translationId", "bookId", "number"),
20
- CONSTRAINT "Chapter_translationId_bookId_fkey" FOREIGN KEY ("translationId", "bookId") REFERENCES "Book" ("translationId", "id") ON DELETE RESTRICT ON UPDATE CASCADE,
21
- CONSTRAINT "Chapter_translationId_fkey" FOREIGN KEY ("translationId") REFERENCES "Translation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
22
- );
23
- INSERT INTO "new_Chapter" ("bookId", "json", "number", "translationId") SELECT "bookId", "json", "number", "translationId" FROM "Chapter";
24
- DROP TABLE "Chapter";
25
- ALTER TABLE "new_Chapter" RENAME TO "Chapter";
26
- PRAGMA foreign_keys=ON;
27
- PRAGMA defer_foreign_keys=OFF;
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `apiLink` on the `Chapter` table. All the data in the column will be lost.
5
+ - You are about to drop the column `previousChapterBookId` on the `Chapter` table. All the data in the column will be lost.
6
+ - You are about to drop the column `previousChapterNumber` on the `Chapter` table. All the data in the column will be lost.
7
+ - You are about to drop the column `previousChapterTranslationId` on the `Chapter` table. All the data in the column will be lost.
8
+
9
+ */
10
+ -- RedefineTables
11
+ PRAGMA defer_foreign_keys=ON;
12
+ PRAGMA foreign_keys=OFF;
13
+ CREATE TABLE "new_Chapter" (
14
+ "number" INTEGER NOT NULL,
15
+ "bookId" TEXT NOT NULL,
16
+ "translationId" TEXT NOT NULL,
17
+ "json" TEXT NOT NULL,
18
+
19
+ PRIMARY KEY ("translationId", "bookId", "number"),
20
+ CONSTRAINT "Chapter_translationId_bookId_fkey" FOREIGN KEY ("translationId", "bookId") REFERENCES "Book" ("translationId", "id") ON DELETE RESTRICT ON UPDATE CASCADE,
21
+ CONSTRAINT "Chapter_translationId_fkey" FOREIGN KEY ("translationId") REFERENCES "Translation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
22
+ );
23
+ INSERT INTO "new_Chapter" ("bookId", "json", "number", "translationId") SELECT "bookId", "json", "number", "translationId" FROM "Chapter";
24
+ DROP TABLE "Chapter";
25
+ ALTER TABLE "new_Chapter" RENAME TO "Chapter";
26
+ PRAGMA foreign_keys=ON;
27
+ PRAGMA defer_foreign_keys=OFF;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helloao/cli",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "A CLI and related tools for managing HelloAO's Free Bible API",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",
@@ -23,7 +23,10 @@
23
23
  "hash.js": "1.1.7",
24
24
  "@zip.js/zip.js": "^2.6.40",
25
25
  "@aws-sdk/client-s3": "^3.609.0",
26
- "@aws-sdk/credential-providers": "^3.609.0"
26
+ "@aws-sdk/credential-providers": "^3.609.0",
27
+ "@smithy/types": "^3.3.0",
28
+ "@inquirer/prompts": "5.3.8",
29
+ "all-iso-language-codes": "1.0.17"
27
30
  },
28
31
  "files": [
29
32
  "/README.md",
@@ -182,7 +182,7 @@ const config = {
182
182
  "value": "prisma-client-js"
183
183
  },
184
184
  "output": {
185
- "value": "/Users/kallyngowdy/YetiCode/bible-api/packages/helloao-cli/prisma-gen",
185
+ "value": "C:\\Projects\\bible-api\\packages\\helloao-cli\\prisma-gen",
186
186
  "fromEnvVar": null
187
187
  },
188
188
  "config": {
@@ -191,12 +191,12 @@ const config = {
191
191
  "binaryTargets": [
192
192
  {
193
193
  "fromEnvVar": null,
194
- "value": "darwin-arm64",
194
+ "value": "windows",
195
195
  "native": true
196
196
  }
197
197
  ],
198
198
  "previewFeatures": [],
199
- "sourceFilePath": "/Users/kallyngowdy/YetiCode/bible-api/packages/helloao-cli/schema.prisma",
199
+ "sourceFilePath": "C:\\Projects\\bible-api\\packages\\helloao-cli\\schema.prisma",
200
200
  "isCustomOutput": true
201
201
  },
202
202
  "relativeEnvPaths": {
@@ -218,8 +218,8 @@ const config = {
218
218
  }
219
219
  }
220
220
  },
221
- "inlineSchema": "datasource db {\n provider = \"sqlite\"\n url = \"file:../../bible-api.dev.db\"\n}\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"./prisma-gen\"\n}\n\nmodel Translation {\n id String @id\n name String\n website String\n licenseUrl String\n shortName String?\n englishName String\n language String\n textDirection String\n\n // The SHA-256 hash of the translation\n // includes everything about the translation, including the books, chapters, verses, footnotes, etc.\n sha256 String?\n \n books Book[]\n chapters Chapter[]\n verses ChapterVerse[]\n footnotes ChapterFootnote[]\n audioUrls ChapterAudioUrl[]\n}\n\nmodel InputFile {\n // The ID of the translation that the file is for\n translationId String\n\n // The name of the file\n name String\n\n format String\n\n // The SHA-256 hash of the file\n sha256 String\n \n sizeInBytes Int\n\n @@id([translationId, name])\n}\n\nmodel Book {\n id String\n\n translationId String\n translation Translation @relation(fields: [translationId], references: [id])\n\n name String\n commonName String\n title String?\n order Int\n\n numberOfChapters Int\n\n // The SHA-256 hash of the book\n sha256 String?\n\n chapters Chapter[]\n verses ChapterVerse[]\n footnotes ChapterFootnote[]\n audioUrls ChapterAudioUrl[]\n\n @@id([translationId, id])\n}\n\nmodel Chapter {\n number Int\n\n bookId String\n book Book @relation(fields: [translationId, bookId], references: [translationId, id])\n\n translationId String\n translation Translation @relation(fields: [translationId], references: [id])\n\n json String // The JSON of the chapter\n\n // The SHA-256 hash of the chapter\n sha256 String?\n\n verses ChapterVerse[]\n footnotes ChapterFootnote[]\n audioUrls ChapterAudioUrl[]\n\n @@id([translationId, bookId, number])\n}\n\nmodel ChapterAudioUrl {\n number Int\n bookId String\n book Book @relation(fields: [translationId, bookId], references: [translationId, id])\n\n translationId String\n translation Translation @relation(fields: [translationId], references: [id])\n\n chapter Chapter @relation(fields: [translationId, bookId, number], references: [translationId, bookId, number])\n\n reader String\n url String\n\n @@id([translationId, bookId, number, reader])\n}\n\nmodel ChapterVerse {\n number Int\n\n chapterNumber Int\n chapter Chapter @relation(fields: [translationId, bookId, chapterNumber], references: [translationId, bookId, number])\n\n bookId String\n book Book @relation(fields: [translationId, bookId], references: [translationId, id])\n\n translationId String\n translation Translation @relation(fields: [translationId], references: [id])\n\n text String // The text of the verse\n contentJson String // The JSON of the verse content\n\n // The SHA-256 hash of the verse\n sha256 String?\n\n footnotes ChapterFootnote[]\n\n @@id([translationId, bookId, chapterNumber, number])\n}\n\nmodel ChapterFootnote {\n id Int\n\n chapterNumber Int\n chapter Chapter @relation(fields: [translationId, bookId, chapterNumber], references: [translationId, bookId, number])\n\n bookId String\n book Book @relation(fields: [translationId, bookId], references: [translationId, id])\n\n translationId String\n translation Translation @relation(fields: [translationId], references: [id])\n\n text String\n\n // The SHA-256 hash of the footnote\n sha256 String?\n\n verseNumber Int?\n verse ChapterVerse? @relation(fields: [translationId, bookId, chapterNumber, verseNumber], references: [translationId, bookId, chapterNumber, number])\n\n @@id([translationId, bookId, chapterNumber, id])\n}\n",
222
- "inlineSchemaHash": "ea2402692f047e9193d3a8f798f93adeef7fbcb5a1be2a437be6f623707da36a",
221
+ "inlineSchema": "datasource db {\r\n provider = \"sqlite\"\r\n url = \"file:../../bible-api.dev.db\"\r\n}\r\n\r\ngenerator client {\r\n provider = \"prisma-client-js\"\r\n output = \"./prisma-gen\"\r\n}\r\n\r\nmodel Translation {\r\n id String @id\r\n name String\r\n website String\r\n licenseUrl String\r\n shortName String?\r\n englishName String\r\n language String\r\n textDirection String\r\n\r\n // The SHA-256 hash of the translation\r\n // includes everything about the translation, including the books, chapters, verses, footnotes, etc.\r\n sha256 String?\r\n \r\n books Book[]\r\n chapters Chapter[]\r\n verses ChapterVerse[]\r\n footnotes ChapterFootnote[]\r\n audioUrls ChapterAudioUrl[]\r\n}\r\n\r\nmodel InputFile {\r\n // The ID of the translation that the file is for\r\n translationId String\r\n\r\n // The name of the file\r\n name String\r\n\r\n format String\r\n\r\n // The SHA-256 hash of the file\r\n sha256 String\r\n \r\n sizeInBytes Int\r\n\r\n @@id([translationId, name])\r\n}\r\n\r\nmodel Book {\r\n id String\r\n\r\n translationId String\r\n translation Translation @relation(fields: [translationId], references: [id])\r\n\r\n name String\r\n commonName String\r\n title String?\r\n order Int\r\n\r\n numberOfChapters Int\r\n\r\n // The SHA-256 hash of the book\r\n sha256 String?\r\n\r\n chapters Chapter[]\r\n verses ChapterVerse[]\r\n footnotes ChapterFootnote[]\r\n audioUrls ChapterAudioUrl[]\r\n\r\n @@id([translationId, id])\r\n}\r\n\r\nmodel Chapter {\r\n number Int\r\n\r\n bookId String\r\n book Book @relation(fields: [translationId, bookId], references: [translationId, id])\r\n\r\n translationId String\r\n translation Translation @relation(fields: [translationId], references: [id])\r\n\r\n json String // The JSON of the chapter\r\n\r\n // The SHA-256 hash of the chapter\r\n sha256 String?\r\n\r\n verses ChapterVerse[]\r\n footnotes ChapterFootnote[]\r\n audioUrls ChapterAudioUrl[]\r\n\r\n @@id([translationId, bookId, number])\r\n}\r\n\r\nmodel ChapterAudioUrl {\r\n number Int\r\n bookId String\r\n book Book @relation(fields: [translationId, bookId], references: [translationId, id])\r\n\r\n translationId String\r\n translation Translation @relation(fields: [translationId], references: [id])\r\n\r\n chapter Chapter @relation(fields: [translationId, bookId, number], references: [translationId, bookId, number])\r\n\r\n reader String\r\n url String\r\n\r\n @@id([translationId, bookId, number, reader])\r\n}\r\n\r\nmodel ChapterVerse {\r\n number Int\r\n\r\n chapterNumber Int\r\n chapter Chapter @relation(fields: [translationId, bookId, chapterNumber], references: [translationId, bookId, number])\r\n\r\n bookId String\r\n book Book @relation(fields: [translationId, bookId], references: [translationId, id])\r\n\r\n translationId String\r\n translation Translation @relation(fields: [translationId], references: [id])\r\n\r\n text String // The text of the verse\r\n contentJson String // The JSON of the verse content\r\n\r\n // The SHA-256 hash of the verse\r\n sha256 String?\r\n\r\n footnotes ChapterFootnote[]\r\n\r\n @@id([translationId, bookId, chapterNumber, number])\r\n}\r\n\r\nmodel ChapterFootnote {\r\n id Int\r\n\r\n chapterNumber Int\r\n chapter Chapter @relation(fields: [translationId, bookId, chapterNumber], references: [translationId, bookId, number])\r\n\r\n bookId String\r\n book Book @relation(fields: [translationId, bookId], references: [translationId, id])\r\n\r\n translationId String\r\n translation Translation @relation(fields: [translationId], references: [id])\r\n\r\n text String\r\n\r\n // The SHA-256 hash of the footnote\r\n sha256 String?\r\n\r\n verseNumber Int?\r\n verse ChapterVerse? @relation(fields: [translationId, bookId, chapterNumber, verseNumber], references: [translationId, bookId, chapterNumber, number])\r\n\r\n @@id([translationId, bookId, chapterNumber, id])\r\n}\r\n",
222
+ "inlineSchemaHash": "41764b814e923d5f889dfa978eb00e5b4ed97714ea6987e161972711cbecd4bb",
223
223
  "copyEngine": true
224
224
  }
225
225
  config.dirname = '/'