@helloao/cli 0.0.5 → 0.0.6

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.
@@ -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.6",
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 = '/'
@@ -183,7 +183,7 @@ const config = {
183
183
  "value": "prisma-client-js"
184
184
  },
185
185
  "output": {
186
- "value": "/Users/kallyngowdy/YetiCode/bible-api/packages/helloao-cli/prisma-gen",
186
+ "value": "C:\\Projects\\bible-api\\packages\\helloao-cli\\prisma-gen",
187
187
  "fromEnvVar": null
188
188
  },
189
189
  "config": {
@@ -192,12 +192,12 @@ const config = {
192
192
  "binaryTargets": [
193
193
  {
194
194
  "fromEnvVar": null,
195
- "value": "darwin-arm64",
195
+ "value": "windows",
196
196
  "native": true
197
197
  }
198
198
  ],
199
199
  "previewFeatures": [],
200
- "sourceFilePath": "/Users/kallyngowdy/YetiCode/bible-api/packages/helloao-cli/schema.prisma",
200
+ "sourceFilePath": "C:\\Projects\\bible-api\\packages\\helloao-cli\\schema.prisma",
201
201
  "isCustomOutput": true
202
202
  },
203
203
  "relativeEnvPaths": {
@@ -219,8 +219,8 @@ const config = {
219
219
  }
220
220
  }
221
221
  },
222
- "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",
223
- "inlineSchemaHash": "ea2402692f047e9193d3a8f798f93adeef7fbcb5a1be2a437be6f623707da36a",
222
+ "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",
223
+ "inlineSchemaHash": "41764b814e923d5f889dfa978eb00e5b4ed97714ea6987e161972711cbecd4bb",
224
224
  "copyEngine": true
225
225
  }
226
226
 
@@ -258,8 +258,8 @@ exports.PrismaClient = PrismaClient
258
258
  Object.assign(exports, Prisma)
259
259
 
260
260
  // file annotations for bundling tools to include these files
261
- path.join(__dirname, "libquery_engine-darwin-arm64.dylib.node");
262
- path.join(process.cwd(), "packages/helloao-cli/prisma-gen/libquery_engine-darwin-arm64.dylib.node")
261
+ path.join(__dirname, "query_engine-windows.dll.node");
262
+ path.join(process.cwd(), "packages/helloao-cli/prisma-gen/query_engine-windows.dll.node")
263
263
  // file annotations for bundling tools to include these files
264
264
  path.join(__dirname, "schema.prisma");
265
265
  path.join(process.cwd(), "packages/helloao-cli/prisma-gen/schema.prisma")
package/s3.d.ts CHANGED
@@ -1,14 +1,44 @@
1
- import { SerializedFile, Uploader } from "./files";
1
+ import { SerializedFile, Uploader } from './files';
2
+ import { AwsCredentialIdentity, Provider } from '@smithy/types';
2
3
  export declare class S3Uploader implements Uploader {
3
4
  private _client;
4
5
  private _bucketName;
5
6
  private _keyPrefix;
6
7
  get idealBatchSize(): number;
7
- constructor(bucketName: string, keyPrefix: string, profile: string | null);
8
+ constructor(bucketName: string, keyPrefix: string, profile: string | null | AwsCredentialIdentity | Provider<AwsCredentialIdentity>);
8
9
  upload(file: SerializedFile, overwrite: boolean): Promise<boolean>;
9
10
  }
11
+ /**
12
+ * Parses the given S3 URL into its bucket name and object key.
13
+ * @param url The URL to parse.
14
+ */
10
15
  export declare function parseS3Url(url: string): {
11
16
  bucketName: string;
12
17
  objectKey: string;
13
18
  } | undefined;
19
+ /**
20
+ * Gets the HTTP URL for the given S3 URL.
21
+ * @param s3Url The S3 URL to convert.
22
+ */
23
+ export declare function getHttpUrl(s3Url: string): string | undefined;
24
+ /**
25
+ * A provider that gets the credentials directly from the user input.
26
+ */
27
+ export declare const askForAccessKeyProvider: Provider<AwsCredentialIdentity>;
28
+ /**
29
+ * Defines a provider that tries to get the credentials from the given list of providers.
30
+ * @param providers The providers to try.
31
+ */
32
+ export declare function providerChain(...providers: Provider<AwsCredentialIdentity>[]): Provider<AwsCredentialIdentity>;
33
+ /**
34
+ * Gets the default provider for the given options.
35
+ *
36
+ * Defaults first to using the provided access key and secret access key, then to using the given profile, then finally to asking the user for the access key.
37
+ * @param options
38
+ */
39
+ export declare function defaultProviderForOptions(options: {
40
+ accessKeyId?: string;
41
+ secretAccessKey?: string;
42
+ profile?: string;
43
+ }): Provider<AwsCredentialIdentity> | AwsCredentialIdentity;
14
44
  //# sourceMappingURL=s3.d.ts.map
package/s3.js CHANGED
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.S3Uploader = void 0;
3
+ exports.askForAccessKeyProvider = exports.S3Uploader = void 0;
4
4
  exports.parseS3Url = parseS3Url;
5
+ exports.getHttpUrl = getHttpUrl;
6
+ exports.providerChain = providerChain;
7
+ exports.defaultProviderForOptions = defaultProviderForOptions;
5
8
  const client_s3_1 = require("@aws-sdk/client-s3");
6
9
  const credential_providers_1 = require("@aws-sdk/credential-providers"); // ES6 import
10
+ const prompts_1 = require("@inquirer/prompts");
7
11
  class S3Uploader {
8
12
  _client;
9
13
  _bucketName;
@@ -15,28 +19,43 @@ class S3Uploader {
15
19
  this._bucketName = bucketName;
16
20
  this._keyPrefix = keyPrefix;
17
21
  this._client = new client_s3_1.S3Client({
18
- credentials: (0, credential_providers_1.fromNodeProviderChain)({
19
- profile: profile ?? undefined,
20
- })
22
+ credentials: !profile || typeof profile === 'string'
23
+ ? (0, credential_providers_1.fromNodeProviderChain)({ profile: profile ?? undefined })
24
+ : profile,
21
25
  });
22
26
  }
23
27
  async upload(file, overwrite) {
24
- const path = file.path.startsWith('/') ? file.path.substring(1) : file.path;
28
+ const path = file.path.startsWith('/')
29
+ ? file.path.substring(1)
30
+ : file.path;
25
31
  const key = this._keyPrefix ? `${this._keyPrefix}/${path}` : path;
26
32
  const hash = file.sha256?.();
27
33
  const head = new client_s3_1.HeadObjectCommand({
28
34
  Bucket: this._bucketName,
29
35
  Key: key,
36
+ ChecksumMode: 'ENABLED',
30
37
  });
31
38
  if (hash || !overwrite) {
32
39
  try {
33
40
  const existingFile = await this._client.send(head);
34
- if (hash && hash.localeCompare(existingFile?.ChecksumSHA256 ?? "", undefined, { sensitivity: 'base' }) === 0) {
35
- // File is already uploaded and matches the checksum.
36
- console.log(`[s3] Matches checksum: ${key}`);
37
- return false;
41
+ let matches = true;
42
+ if (hash && existingFile.ChecksumSHA256) {
43
+ if (hash.localeCompare(existingFile?.ChecksumSHA256 ?? '', undefined, {
44
+ sensitivity: 'base',
45
+ }) === 0) {
46
+ // File is already uploaded and matches the checksum.
47
+ return false;
48
+ }
49
+ else {
50
+ // File is already uploaded but the checksums don't match.
51
+ matches = false;
52
+ }
53
+ }
54
+ else {
55
+ // File is already uploaded but the checksum is not available.
56
+ console.log(`[s3] Checksum not available: ${key}`);
38
57
  }
39
- if (!overwrite) {
58
+ if (matches && !overwrite) {
40
59
  return false;
41
60
  }
42
61
  }
@@ -55,22 +74,96 @@ class S3Uploader {
55
74
  Body: file.content,
56
75
  ContentType: 'application/json',
57
76
  ChecksumSHA256: hash,
77
+ ChecksumAlgorithm: 'SHA256',
58
78
  });
59
79
  await this._client.send(command);
60
80
  return true;
61
81
  }
62
82
  }
63
83
  exports.S3Uploader = S3Uploader;
84
+ /**
85
+ * Parses the given S3 URL into its bucket name and object key.
86
+ * @param url The URL to parse.
87
+ */
64
88
  function parseS3Url(url) {
65
89
  const regex = /^s3:\/\/([a-z0-9.\-]+)(\/[^${}]*)?$/;
66
90
  const matched = url.match(regex);
67
91
  if (matched) {
68
92
  const arr = [...matched];
93
+ let key = arr[2] ?? '';
94
+ if (key.startsWith('/')) {
95
+ key = key.substring(1);
96
+ }
69
97
  return {
70
98
  bucketName: arr[1],
71
- objectKey: arr[2] ?? "",
99
+ objectKey: key,
72
100
  };
73
101
  }
74
102
  return undefined;
75
103
  }
76
- ;
104
+ /**
105
+ * Gets the HTTP URL for the given S3 URL.
106
+ * @param s3Url The S3 URL to convert.
107
+ */
108
+ function getHttpUrl(s3Url) {
109
+ const parsed = parseS3Url(s3Url);
110
+ if (!parsed) {
111
+ return undefined;
112
+ }
113
+ const { bucketName, objectKey } = parsed;
114
+ if (objectKey) {
115
+ return `https://${bucketName}.s3.amazonaws.com/${objectKey}`;
116
+ }
117
+ else {
118
+ return `https://${bucketName}.s3.amazonaws.com`;
119
+ }
120
+ }
121
+ /**
122
+ * A provider that gets the credentials directly from the user input.
123
+ */
124
+ const askForAccessKeyProvider = async () => {
125
+ const accessKeyId = await (0, prompts_1.input)({
126
+ message: 'Enter your AWS Access Key ID',
127
+ });
128
+ const secretAccessKey = await (0, prompts_1.password)({
129
+ message: 'Enter your AWS Secret Access Key',
130
+ });
131
+ return {
132
+ accessKeyId,
133
+ secretAccessKey,
134
+ };
135
+ };
136
+ exports.askForAccessKeyProvider = askForAccessKeyProvider;
137
+ /**
138
+ * Defines a provider that tries to get the credentials from the given list of providers.
139
+ * @param providers The providers to try.
140
+ */
141
+ function providerChain(...providers) {
142
+ return async () => {
143
+ for (const provider of providers) {
144
+ const creds = await provider();
145
+ if (creds?.accessKeyId && creds?.secretAccessKey) {
146
+ return creds;
147
+ }
148
+ }
149
+ return {
150
+ accessKeyId: '',
151
+ secretAccessKey: '',
152
+ };
153
+ };
154
+ }
155
+ /**
156
+ * Gets the default provider for the given options.
157
+ *
158
+ * Defaults first to using the provided access key and secret access key, then to using the given profile, then finally to asking the user for the access key.
159
+ * @param options
160
+ */
161
+ function defaultProviderForOptions(options) {
162
+ if (options.accessKeyId && options.secretAccessKey) {
163
+ return {
164
+ accessKeyId: options.accessKeyId,
165
+ secretAccessKey: options.secretAccessKey,
166
+ };
167
+ }
168
+ return providerChain((0, credential_providers_1.fromNodeProviderChain)({ profile: options.profile }), exports.askForAccessKeyProvider);
169
+ }