@helloao/cli 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +138 -136
  2. package/dist/cjs/cli.cjs +8049 -12681
  3. package/dist/cjs/index.cjs +7628 -12571
  4. package/dist/esm/cli.js +5699 -0
  5. package/dist/esm/cli.js.map +7 -0
  6. package/dist/esm/index.js +1972 -6262
  7. package/dist/esm/index.js.map +4 -4
  8. package/dist/types/actions.d.ts +71 -0
  9. package/dist/types/db.d.ts +12 -8
  10. package/dist/types/ebible.d.ts +1 -1
  11. package/dist/types/files.d.ts +12 -1
  12. package/dist/types/openapi.d.ts +2 -0
  13. package/dist/types/prisma-gen/browser.d.ts +110 -0
  14. package/dist/types/prisma-gen/client.d.ts +129 -0
  15. package/dist/types/prisma-gen/commonInputTypes.d.ts +378 -0
  16. package/dist/types/prisma-gen/enums.d.ts +2 -0
  17. package/dist/types/prisma-gen/internal/class.d.ts +353 -0
  18. package/dist/types/prisma-gen/internal/prismaNamespace.d.ts +2273 -0
  19. package/dist/types/prisma-gen/internal/prismaNamespaceBrowser.d.ts +294 -0
  20. package/dist/types/prisma-gen/models/Book.d.ts +2197 -0
  21. package/dist/types/prisma-gen/models/Chapter.d.ts +1934 -0
  22. package/dist/types/prisma-gen/models/ChapterAudioTiming.d.ts +1414 -0
  23. package/dist/types/prisma-gen/models/ChapterAudioUrl.d.ts +1414 -0
  24. package/dist/types/prisma-gen/models/ChapterFootnote.d.ts +1642 -0
  25. package/dist/types/prisma-gen/models/ChapterVerse.d.ts +1653 -0
  26. package/dist/types/prisma-gen/models/ChapterWords.d.ts +1366 -0
  27. package/dist/types/prisma-gen/models/Commentary.d.ts +1711 -0
  28. package/dist/types/prisma-gen/models/CommentaryBook.d.ts +1622 -0
  29. package/dist/types/prisma-gen/models/CommentaryChapter.d.ts +1487 -0
  30. package/dist/types/prisma-gen/models/CommentaryChapterVerse.d.ts +1514 -0
  31. package/dist/types/prisma-gen/models/CommentaryProfile.d.ts +1451 -0
  32. package/dist/types/prisma-gen/models/Dataset.d.ts +1667 -0
  33. package/dist/types/prisma-gen/models/DatasetBook.d.ts +1565 -0
  34. package/dist/types/prisma-gen/models/DatasetChapter.d.ts +1553 -0
  35. package/dist/types/prisma-gen/models/DatasetChapterVerse.d.ts +1600 -0
  36. package/dist/types/prisma-gen/models/DatasetReference.d.ts +1789 -0
  37. package/dist/types/prisma-gen/models/EBibleSource.d.ts +1686 -0
  38. package/dist/types/prisma-gen/models/InputFile.d.ts +1039 -0
  39. package/dist/types/prisma-gen/models/InputFileWarning.d.ts +946 -0
  40. package/dist/types/prisma-gen/models/Translation.d.ts +2238 -0
  41. package/dist/types/prisma-gen/models.d.ts +23 -0
  42. package/dist/types/s3.d.ts +2 -0
  43. package/dist/types/uploads.d.ts +7 -1
  44. package/migrations/20260217200934_add_license_notice/migration.sql +5 -0
  45. package/migrations/20260703000000_add_chapter_audio_timing/migration.sql +13 -0
  46. package/migrations/20260809000000_add_chapter_words/migration.sql +12 -0
  47. package/package.json +23 -17
  48. package/schema.prisma +43 -2
  49. package/prisma-gen/client.d.ts +0 -1
  50. package/prisma-gen/client.js +0 -4
  51. package/prisma-gen/default.d.ts +0 -1
  52. package/prisma-gen/default.js +0 -1
  53. package/prisma-gen/edge.d.ts +0 -1
  54. package/prisma-gen/edge.js +0 -401
  55. package/prisma-gen/index-browser.js +0 -395
  56. package/prisma-gen/index.d.ts +0 -33919
  57. package/prisma-gen/index.js +0 -424
  58. package/prisma-gen/runtime/edge-esm.js +0 -31
  59. package/prisma-gen/runtime/edge.js +0 -31
  60. package/prisma-gen/runtime/index-browser.d.ts +0 -365
  61. package/prisma-gen/runtime/index-browser.js +0 -13
  62. package/prisma-gen/runtime/library.d.ts +0 -3403
  63. package/prisma-gen/runtime/library.js +0 -143
  64. package/prisma-gen/runtime/react-native.js +0 -80
  65. package/prisma-gen/runtime/wasm.js +0 -32
  66. package/prisma-gen/wasm.d.ts +0 -1
  67. package/prisma-gen/wasm.js +0 -395
@@ -0,0 +1,23 @@
1
+ export type * from './models/Translation';
2
+ export type * from './models/Commentary';
3
+ export type * from './models/EBibleSource';
4
+ export type * from './models/InputFile';
5
+ export type * from './models/InputFileWarning';
6
+ export type * from './models/Book';
7
+ export type * from './models/CommentaryBook';
8
+ export type * from './models/CommentaryProfile';
9
+ export type * from './models/Chapter';
10
+ export type * from './models/CommentaryChapter';
11
+ export type * from './models/ChapterAudioUrl';
12
+ export type * from './models/ChapterAudioTiming';
13
+ export type * from './models/ChapterWords';
14
+ export type * from './models/ChapterVerse';
15
+ export type * from './models/CommentaryChapterVerse';
16
+ export type * from './models/ChapterFootnote';
17
+ export type * from './models/Dataset';
18
+ export type * from './models/DatasetBook';
19
+ export type * from './models/DatasetChapter';
20
+ export type * from './models/DatasetChapterVerse';
21
+ export type * from './models/DatasetReference';
22
+ export type * from './commonInputTypes';
23
+ //# sourceMappingURL=models.d.ts.map
@@ -5,8 +5,10 @@ export declare class S3Uploader implements Uploader {
5
5
  private _bucketName;
6
6
  private _keyPrefix;
7
7
  get idealBatchSize(): number;
8
+ get retryCount(): number;
8
9
  constructor(bucketName: string, keyPrefix: string, profile: string | null | AwsCredentialIdentity | Provider<AwsCredentialIdentity>, region?: string);
9
10
  upload(file: SerializedFile, overwrite: boolean): Promise<boolean>;
11
+ private _upload;
10
12
  }
11
13
  /**
12
14
  * Parses the given S3 URL into its bucket name and object key.
@@ -1,7 +1,7 @@
1
1
  import { SerializedFile } from './db.js';
2
2
  import { Uploader } from './files.js';
3
3
  import { DatasetOutput } from '@helloao/tools/generation/dataset.js';
4
- import { PrismaClient } from './prisma-gen/index.js';
4
+ import { PrismaClient } from './prisma-gen/client.js';
5
5
  import { GenerateApiOptions } from '@helloao/tools/generation/api.js';
6
6
  export interface UploadApiFromDatabaseOptions extends UploadApiOptions, GenerateApiOptions {
7
7
  /**
@@ -56,6 +56,11 @@ export interface UploadApiOptions {
56
56
  * Whether to generate audio files for the API.
57
57
  */
58
58
  generateAudioFiles?: boolean;
59
+ /**
60
+ * Whether to generate the OpenAPI document for the API.
61
+ * Defaults to true.
62
+ */
63
+ generateOpenApiDocument?: boolean;
59
64
  /**
60
65
  * Whether to generate pretty-printed JSON files.
61
66
  */
@@ -72,6 +77,7 @@ export interface UploadApiOptions {
72
77
  * @param options The options to use for the upload.
73
78
  */
74
79
  export declare function uploadApiFilesFromDatabase(db: PrismaClient, dest: string, options: UploadApiFromDatabaseOptions): Promise<void>;
80
+ export declare function uploadOpenApiDocument(dest: string, options: UploadApiFromDatabaseOptions): Promise<void>;
75
81
  /**
76
82
  * Generates the API files from the given datasets and uploads them to the specified destination.
77
83
  * @param dest The destination to upload the API files to. Supported destinations are S3, zip files, and local directories.
@@ -0,0 +1,5 @@
1
+ -- AlterTable
2
+ ALTER TABLE "Commentary" ADD COLUMN "licenseNotice" TEXT;
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "Translation" ADD COLUMN "licenseNotice" TEXT;
@@ -0,0 +1,13 @@
1
+ -- CreateTable
2
+ CREATE TABLE "ChapterAudioTiming" (
3
+ "number" INTEGER NOT NULL,
4
+ "bookId" TEXT NOT NULL,
5
+ "translationId" TEXT NOT NULL,
6
+ "reader" TEXT NOT NULL,
7
+ "timingsJson" TEXT NOT NULL,
8
+
9
+ PRIMARY KEY ("translationId", "bookId", "number", "reader"),
10
+ CONSTRAINT "ChapterAudioTiming_translationId_bookId_fkey" FOREIGN KEY ("translationId", "bookId") REFERENCES "Book" ("translationId", "id") ON DELETE RESTRICT ON UPDATE CASCADE,
11
+ CONSTRAINT "ChapterAudioTiming_translationId_fkey" FOREIGN KEY ("translationId") REFERENCES "Translation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
12
+ CONSTRAINT "ChapterAudioTiming_translationId_bookId_number_fkey" FOREIGN KEY ("translationId", "bookId", "number") REFERENCES "Chapter" ("translationId", "bookId", "number") ON DELETE RESTRICT ON UPDATE CASCADE
13
+ );
@@ -0,0 +1,12 @@
1
+ -- CreateTable
2
+ CREATE TABLE "ChapterWords" (
3
+ "number" INTEGER NOT NULL,
4
+ "bookId" TEXT NOT NULL,
5
+ "translationId" TEXT NOT NULL,
6
+ "wordsJson" TEXT NOT NULL,
7
+
8
+ PRIMARY KEY ("translationId", "bookId", "number"),
9
+ CONSTRAINT "ChapterWords_translationId_bookId_fkey" FOREIGN KEY ("translationId", "bookId") REFERENCES "Book" ("translationId", "id") ON DELETE RESTRICT ON UPDATE CASCADE,
10
+ CONSTRAINT "ChapterWords_translationId_fkey" FOREIGN KEY ("translationId") REFERENCES "Translation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
11
+ CONSTRAINT "ChapterWords_translationId_bookId_number_fkey" FOREIGN KEY ("translationId", "bookId", "number") REFERENCES "Chapter" ("translationId", "bookId", "number") ON DELETE RESTRICT ON UPDATE CASCADE
12
+ );
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@helloao/cli",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "A CLI and related tools for managing HelloAO's Free Bible API",
5
+ "type": "module",
5
6
  "main": "./dist/cjs/index.cjs",
6
7
  "module": "./dist/esm/index.js",
7
8
  "types": "./dist/types/index.d.ts",
@@ -23,27 +24,32 @@
23
24
  "author": "Kallyn Gowdy <kal@helloao.org>",
24
25
  "license": "MIT",
25
26
  "dependencies": {
26
- "commander": "12.1.0",
27
- "@gracious.tech/fetch-client": "^0.7.0",
28
- "prisma": "^5.12.1",
29
- "@prisma/client": "^5.12.1",
30
- "better-sqlite3": "^9.5.0",
31
- "fs-extra": "^11.2.0",
32
- "lodash": "4.17.21",
33
- "linkedom": "0.18.4",
34
- "base64-js": "1.5.1",
35
- "hash.js": "1.1.7",
36
- "@zip.js/zip.js": "^2.6.40",
37
27
  "@aws-sdk/client-s3": "^3.609.0",
38
28
  "@aws-sdk/credential-providers": "^3.609.0",
39
- "@smithy/types": "^3.3.0",
40
- "@smithy/node-config-provider": "^3.1.9",
41
- "@smithy/config-resolver": "^3.0.10",
29
+ "@gracious.tech/fetch-client": "^0.7.0",
30
+ "@hey-api/openapi-ts": "^0.97.1",
42
31
  "@inquirer/prompts": "5.3.8",
32
+ "@prisma/client": "^7.8.0",
33
+ "@prisma/adapter-better-sqlite3": "^7.8.0",
34
+ "@smithy/config-resolver": "^3.0.10",
35
+ "@smithy/node-config-provider": "^3.1.9",
36
+ "@smithy/types": "^3.3.0",
37
+ "@zip.js/zip.js": "^2.6.40",
43
38
  "all-iso-language-codes": "1.0.17",
44
- "papaparse": "5.4.1",
39
+ "base64-js": "1.5.1",
40
+ "better-sqlite3": "^13.0.3",
41
+ "commander": "12.1.0",
42
+ "fs-extra": "^11.2.0",
43
+ "hash.js": "1.1.7",
44
+ "linkedom": "0.18.4",
45
+ "es-toolkit": "1.46.1",
45
46
  "luxon": "3.5.0",
46
- "@helloao/tools": "0.1.0"
47
+ "papaparse": "5.4.1",
48
+ "prisma": "^7.8.0",
49
+ "typesense": "3.0.5",
50
+ "zod": "^4.4.3",
51
+ "zod-openapi": "5.4.6",
52
+ "@helloao/tools": "0.3.0"
47
53
  },
48
54
  "files": [
49
55
  "/README.md",
package/schema.prisma CHANGED
@@ -1,10 +1,9 @@
1
1
  datasource db {
2
2
  provider = "sqlite"
3
- url = "file:../../bible-api.dev.db"
4
3
  }
5
4
 
6
5
  generator client {
7
- provider = "prisma-client-js"
6
+ provider = "prisma-client"
8
7
  output = "./prisma-gen"
9
8
  }
10
9
 
@@ -14,6 +13,7 @@ model Translation {
14
13
  website String
15
14
  licenseUrl String
16
15
  licenseNotes String?
16
+ licenseNotice String?
17
17
  shortName String?
18
18
  englishName String
19
19
  language String
@@ -28,6 +28,8 @@ model Translation {
28
28
  verses ChapterVerse[]
29
29
  footnotes ChapterFootnote[]
30
30
  audioUrls ChapterAudioUrl[]
31
+ audioTimings ChapterAudioTiming[]
32
+ words ChapterWords[]
31
33
  }
32
34
 
33
35
  model Commentary {
@@ -36,6 +38,7 @@ model Commentary {
36
38
  website String
37
39
  licenseUrl String
38
40
  licenseNotes String?
41
+ licenseNotice String?
39
42
  englishName String
40
43
  language String
41
44
  textDirection String
@@ -148,6 +151,8 @@ model Book {
148
151
  verses ChapterVerse[]
149
152
  footnotes ChapterFootnote[]
150
153
  audioUrls ChapterAudioUrl[]
154
+ audioTimings ChapterAudioTiming[]
155
+ words ChapterWords[]
151
156
 
152
157
  @@id([translationId, id])
153
158
  }
@@ -215,6 +220,8 @@ model Chapter {
215
220
  verses ChapterVerse[]
216
221
  footnotes ChapterFootnote[]
217
222
  audioUrls ChapterAudioUrl[]
223
+ audioTimings ChapterAudioTiming[]
224
+ words ChapterWords[]
218
225
 
219
226
  @@id([translationId, bookId, number])
220
227
  }
@@ -255,6 +262,40 @@ model ChapterAudioUrl {
255
262
  @@id([translationId, bookId, number, reader])
256
263
  }
257
264
 
265
+ model ChapterAudioTiming {
266
+ number Int
267
+ bookId String
268
+ book Book @relation(fields: [translationId, bookId], references: [translationId, id])
269
+
270
+ translationId String
271
+ translation Translation @relation(fields: [translationId], references: [id])
272
+
273
+ chapter Chapter @relation(fields: [translationId, bookId, number], references: [translationId, bookId, number])
274
+
275
+ reader String
276
+
277
+ // JSON array of numbers: the time (in seconds) that each verse starts, in verse order.
278
+ timingsJson String
279
+
280
+ @@id([translationId, bookId, number, reader])
281
+ }
282
+
283
+ model ChapterWords {
284
+ number Int
285
+ bookId String
286
+ book Book @relation(fields: [translationId, bookId], references: [translationId, id])
287
+
288
+ translationId String
289
+ translation Translation @relation(fields: [translationId], references: [id])
290
+
291
+ chapter Chapter @relation(fields: [translationId, bookId, number], references: [translationId, bookId, number])
292
+
293
+ // JSON object that maps a verse number to the list of annotated words in the verse.
294
+ wordsJson String
295
+
296
+ @@id([translationId, bookId, number])
297
+ }
298
+
258
299
  model ChapterVerse {
259
300
  number Int
260
301
 
@@ -1 +0,0 @@
1
- export * from "./index"
@@ -1,4 +0,0 @@
1
-
2
- /* !!! This is code generated by Prisma. Do not edit directly. !!!
3
- /* eslint-disable */
4
- module.exports = { ...require('.') }
@@ -1 +0,0 @@
1
- export * from "./index"
@@ -1 +0,0 @@
1
- module.exports = { ...require('.') }
@@ -1 +0,0 @@
1
- export * from "./default"