@helloao/cli 0.0.15 → 0.0.17
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/dist/cjs/cli.cjs +70 -3
- package/dist/cjs/index.cjs +50 -1
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +2 -2
- package/package.json +2 -2
package/dist/cjs/cli.cjs
CHANGED
|
@@ -6039,6 +6039,7 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
6039
6039
|
translationBooks: [],
|
|
6040
6040
|
translationBookChapters: [],
|
|
6041
6041
|
translationBookChapterAudio: [],
|
|
6042
|
+
translationComplete: [],
|
|
6042
6043
|
availableCommentaries: {
|
|
6043
6044
|
commentaries: []
|
|
6044
6045
|
},
|
|
@@ -6067,6 +6068,7 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
6067
6068
|
translation.id,
|
|
6068
6069
|
apiPathPrefix
|
|
6069
6070
|
),
|
|
6071
|
+
completeTranslationApiLink: options.generateCompleteTranslationFiles ? completeTranslationApiLink(translation.id, apiPathPrefix) : void 0,
|
|
6070
6072
|
numberOfBooks,
|
|
6071
6073
|
totalNumberOfChapters: 0,
|
|
6072
6074
|
totalNumberOfVerses: 0,
|
|
@@ -6192,6 +6194,32 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
6192
6194
|
}
|
|
6193
6195
|
api.availableTranslations.translations.push(apiTranslation);
|
|
6194
6196
|
api.translationBooks.push(translationBooks);
|
|
6197
|
+
if (options.generateCompleteTranslationFiles) {
|
|
6198
|
+
const completeTranslation = {
|
|
6199
|
+
translation: apiTranslation,
|
|
6200
|
+
books: translationBooks.books.map((book) => {
|
|
6201
|
+
const bookChapters = translationChapters.filter(
|
|
6202
|
+
(ch) => ch.book.id === book.id
|
|
6203
|
+
);
|
|
6204
|
+
return {
|
|
6205
|
+
id: book.id,
|
|
6206
|
+
name: book.name,
|
|
6207
|
+
commonName: book.commonName,
|
|
6208
|
+
title: book.title,
|
|
6209
|
+
order: book.order,
|
|
6210
|
+
numberOfChapters: book.numberOfChapters,
|
|
6211
|
+
totalNumberOfVerses: book.totalNumberOfVerses,
|
|
6212
|
+
isApocryphal: book.isApocryphal,
|
|
6213
|
+
chapters: bookChapters.map((ch) => ({
|
|
6214
|
+
numberOfVerses: ch.numberOfVerses,
|
|
6215
|
+
thisChapterAudioLinks: ch.thisChapterAudioLinks,
|
|
6216
|
+
chapter: ch.chapter
|
|
6217
|
+
}))
|
|
6218
|
+
};
|
|
6219
|
+
})
|
|
6220
|
+
};
|
|
6221
|
+
api.translationComplete.push(completeTranslation);
|
|
6222
|
+
}
|
|
6195
6223
|
}
|
|
6196
6224
|
for (let { books, profiles, ...commentary } of dataset.commentaries) {
|
|
6197
6225
|
const apiCommentary = {
|
|
@@ -6466,6 +6494,16 @@ function generateFilesForApi(api) {
|
|
|
6466
6494
|
for (let audio of api.translationBookChapterAudio) {
|
|
6467
6495
|
files.push(downloadedFile(audio.link, audio.originalUrl));
|
|
6468
6496
|
}
|
|
6497
|
+
for (let complete of api.translationComplete) {
|
|
6498
|
+
if (complete.translation.completeTranslationApiLink) {
|
|
6499
|
+
files.push(
|
|
6500
|
+
jsonFile(
|
|
6501
|
+
complete.translation.completeTranslationApiLink,
|
|
6502
|
+
complete
|
|
6503
|
+
)
|
|
6504
|
+
);
|
|
6505
|
+
}
|
|
6506
|
+
}
|
|
6469
6507
|
files.push(
|
|
6470
6508
|
jsonFile(
|
|
6471
6509
|
`${api.pathPrefix}/api/available_commentaries.json`,
|
|
@@ -6532,6 +6570,9 @@ async function* generateOutputFilesFromDatasets(datasets, options) {
|
|
|
6532
6570
|
function listOfBooksApiLink(translationId, prefix = "") {
|
|
6533
6571
|
return `${prefix}/api/${translationId}/books.json`;
|
|
6534
6572
|
}
|
|
6573
|
+
function completeTranslationApiLink(translationId, prefix = "") {
|
|
6574
|
+
return `${prefix}/api/${translationId}/complete.json`;
|
|
6575
|
+
}
|
|
6535
6576
|
function listOfCommentaryBooksApiLink(commentaryId, prefix = "") {
|
|
6536
6577
|
return `${prefix}/api/c/${commentaryId}/books.json`;
|
|
6537
6578
|
}
|
|
@@ -12369,7 +12410,9 @@ var CodexParser = class {
|
|
|
12369
12410
|
for (let cell of data.cells) {
|
|
12370
12411
|
if (cell.languageId === "html" && cell.value) {
|
|
12371
12412
|
if (!cell.metadata) continue;
|
|
12372
|
-
const
|
|
12413
|
+
const metadataResult = metadataSchema.safeParse(cell.metadata);
|
|
12414
|
+
if (!metadataResult.success) continue;
|
|
12415
|
+
const metadata = metadataResult.data;
|
|
12373
12416
|
if (metadata.type === "text") {
|
|
12374
12417
|
const reference = parseVerseReference(metadata.id);
|
|
12375
12418
|
if (!reference)
|
|
@@ -15033,6 +15076,9 @@ async function uploadApiFilesFromDatabase(db, dest, options) {
|
|
|
15033
15076
|
if (options.pretty) {
|
|
15034
15077
|
logger2.log("Generating pretty-printed JSON files");
|
|
15035
15078
|
}
|
|
15079
|
+
if (options.generateCompleteTranslationFiles) {
|
|
15080
|
+
logger2.log("Generating complete translation files");
|
|
15081
|
+
}
|
|
15036
15082
|
const pageSize = typeof options.batchSize === "number" ? options.batchSize : parseInt(options.batchSize);
|
|
15037
15083
|
await serializeAndUploadDatasets(
|
|
15038
15084
|
dest,
|
|
@@ -15070,6 +15116,9 @@ async function serializeAndUploadDatasets(dest, datasets, options = {}) {
|
|
|
15070
15116
|
if (options.pretty) {
|
|
15071
15117
|
logger2.log("Generating pretty-printed JSON files");
|
|
15072
15118
|
}
|
|
15119
|
+
if (options.generateCompleteTranslationFiles) {
|
|
15120
|
+
logger2.log("Generating complete translation files");
|
|
15121
|
+
}
|
|
15073
15122
|
const files = serializeDatasets(datasets, {
|
|
15074
15123
|
...options
|
|
15075
15124
|
});
|
|
@@ -16459,6 +16508,9 @@ For inquiries, please contact hello@helloao.org.`
|
|
|
16459
16508
|
).option(
|
|
16460
16509
|
"--generate-audio-files",
|
|
16461
16510
|
"Whether to replace the audio URLs in the dataset with ones that are hosted locally."
|
|
16511
|
+
).option(
|
|
16512
|
+
"--no-generate-complete-translation-files",
|
|
16513
|
+
"Whether to skip generating complete translation files."
|
|
16462
16514
|
).option(
|
|
16463
16515
|
"--profile <profile>",
|
|
16464
16516
|
"The AWS profile to use for uploading to S3."
|
|
@@ -16522,6 +16574,9 @@ For inquiries, please contact hello@helloao.org.`
|
|
|
16522
16574
|
).option(
|
|
16523
16575
|
"--generate-audio-files",
|
|
16524
16576
|
"Whether to replace the audio URLs in the dataset with ones that are hosted locally."
|
|
16577
|
+
).option(
|
|
16578
|
+
"--no-generate-complete-translation-files",
|
|
16579
|
+
"Whether to skip generating complete translation files."
|
|
16525
16580
|
).option(
|
|
16526
16581
|
"--profile <profile>",
|
|
16527
16582
|
"The AWS profile to use for uploading to S3."
|
|
@@ -16592,7 +16647,10 @@ For inquiries, please contact hello@helloao.org.`
|
|
|
16592
16647
|
).option(
|
|
16593
16648
|
"--s3-region <region>",
|
|
16594
16649
|
"The AWS region to use for uploading to S3."
|
|
16595
|
-
).option("--pretty", "Whether to generate pretty-printed JSON files.").
|
|
16650
|
+
).option("--pretty", "Whether to generate pretty-printed JSON files.").option(
|
|
16651
|
+
"--no-generate-complete-translation-files",
|
|
16652
|
+
"Whether to skip generating complete translation files."
|
|
16653
|
+
).action(async (input5, dest, options) => {
|
|
16596
16654
|
await generateTranslationFiles(input5, dest, {
|
|
16597
16655
|
...program.opts(),
|
|
16598
16656
|
...options
|
|
@@ -16617,6 +16675,9 @@ For inquiries, please contact hello@helloao.org.`
|
|
|
16617
16675
|
).option(
|
|
16618
16676
|
"--generate-audio-files",
|
|
16619
16677
|
"Whether to replace the audio URLs in the dataset with ones that are hosted locally."
|
|
16678
|
+
).option(
|
|
16679
|
+
"--no-generate-complete-translation-files",
|
|
16680
|
+
"Whether to skip generating complete translation files."
|
|
16620
16681
|
).option(
|
|
16621
16682
|
"--profile <profile>",
|
|
16622
16683
|
"The AWS profile to use for uploading to S3."
|
|
@@ -16659,6 +16720,9 @@ For inquiries, please contact hello@helloao.org.`
|
|
|
16659
16720
|
).option(
|
|
16660
16721
|
"--generate-audio-files",
|
|
16661
16722
|
"Whether to replace the audio URLs in the dataset with ones that are hosted locally."
|
|
16723
|
+
).option(
|
|
16724
|
+
"--no-generate-complete-translation-files",
|
|
16725
|
+
"Whether to skip generating complete translation files."
|
|
16662
16726
|
).option(
|
|
16663
16727
|
"--profile <profile>",
|
|
16664
16728
|
"The AWS profile to use for uploading to S3."
|
|
@@ -16677,7 +16741,10 @@ For inquiries, please contact hello@helloao.org.`
|
|
|
16677
16741
|
).action(async (dest, options) => {
|
|
16678
16742
|
const db = getPrismaDb(program.opts().db);
|
|
16679
16743
|
try {
|
|
16680
|
-
await uploadApiFilesFromDatabase(db, dest,
|
|
16744
|
+
await uploadApiFilesFromDatabase(db, dest, {
|
|
16745
|
+
...program.opts(),
|
|
16746
|
+
...options
|
|
16747
|
+
});
|
|
16681
16748
|
} finally {
|
|
16682
16749
|
db.$disconnect();
|
|
16683
16750
|
}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -11858,7 +11858,9 @@ var CodexParser = class {
|
|
|
11858
11858
|
for (let cell of data.cells) {
|
|
11859
11859
|
if (cell.languageId === "html" && cell.value) {
|
|
11860
11860
|
if (!cell.metadata) continue;
|
|
11861
|
-
const
|
|
11861
|
+
const metadataResult = metadataSchema.safeParse(cell.metadata);
|
|
11862
|
+
if (!metadataResult.success) continue;
|
|
11863
|
+
const metadata = metadataResult.data;
|
|
11862
11864
|
if (metadata.type === "text") {
|
|
11863
11865
|
const reference = parseVerseReference(metadata.id);
|
|
11864
11866
|
if (!reference)
|
|
@@ -12446,6 +12448,7 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
12446
12448
|
translationBooks: [],
|
|
12447
12449
|
translationBookChapters: [],
|
|
12448
12450
|
translationBookChapterAudio: [],
|
|
12451
|
+
translationComplete: [],
|
|
12449
12452
|
availableCommentaries: {
|
|
12450
12453
|
commentaries: []
|
|
12451
12454
|
},
|
|
@@ -12474,6 +12477,7 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
12474
12477
|
translation.id,
|
|
12475
12478
|
apiPathPrefix
|
|
12476
12479
|
),
|
|
12480
|
+
completeTranslationApiLink: options.generateCompleteTranslationFiles ? completeTranslationApiLink(translation.id, apiPathPrefix) : void 0,
|
|
12477
12481
|
numberOfBooks,
|
|
12478
12482
|
totalNumberOfChapters: 0,
|
|
12479
12483
|
totalNumberOfVerses: 0,
|
|
@@ -12599,6 +12603,32 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
12599
12603
|
}
|
|
12600
12604
|
api.availableTranslations.translations.push(apiTranslation);
|
|
12601
12605
|
api.translationBooks.push(translationBooks);
|
|
12606
|
+
if (options.generateCompleteTranslationFiles) {
|
|
12607
|
+
const completeTranslation = {
|
|
12608
|
+
translation: apiTranslation,
|
|
12609
|
+
books: translationBooks.books.map((book) => {
|
|
12610
|
+
const bookChapters = translationChapters.filter(
|
|
12611
|
+
(ch) => ch.book.id === book.id
|
|
12612
|
+
);
|
|
12613
|
+
return {
|
|
12614
|
+
id: book.id,
|
|
12615
|
+
name: book.name,
|
|
12616
|
+
commonName: book.commonName,
|
|
12617
|
+
title: book.title,
|
|
12618
|
+
order: book.order,
|
|
12619
|
+
numberOfChapters: book.numberOfChapters,
|
|
12620
|
+
totalNumberOfVerses: book.totalNumberOfVerses,
|
|
12621
|
+
isApocryphal: book.isApocryphal,
|
|
12622
|
+
chapters: bookChapters.map((ch) => ({
|
|
12623
|
+
numberOfVerses: ch.numberOfVerses,
|
|
12624
|
+
thisChapterAudioLinks: ch.thisChapterAudioLinks,
|
|
12625
|
+
chapter: ch.chapter
|
|
12626
|
+
}))
|
|
12627
|
+
};
|
|
12628
|
+
})
|
|
12629
|
+
};
|
|
12630
|
+
api.translationComplete.push(completeTranslation);
|
|
12631
|
+
}
|
|
12602
12632
|
}
|
|
12603
12633
|
for (let { books, profiles, ...commentary } of dataset.commentaries) {
|
|
12604
12634
|
const apiCommentary = {
|
|
@@ -12873,6 +12903,16 @@ function generateFilesForApi(api) {
|
|
|
12873
12903
|
for (let audio of api.translationBookChapterAudio) {
|
|
12874
12904
|
files.push(downloadedFile(audio.link, audio.originalUrl));
|
|
12875
12905
|
}
|
|
12906
|
+
for (let complete of api.translationComplete) {
|
|
12907
|
+
if (complete.translation.completeTranslationApiLink) {
|
|
12908
|
+
files.push(
|
|
12909
|
+
jsonFile(
|
|
12910
|
+
complete.translation.completeTranslationApiLink,
|
|
12911
|
+
complete
|
|
12912
|
+
)
|
|
12913
|
+
);
|
|
12914
|
+
}
|
|
12915
|
+
}
|
|
12876
12916
|
files.push(
|
|
12877
12917
|
jsonFile(
|
|
12878
12918
|
`${api.pathPrefix}/api/available_commentaries.json`,
|
|
@@ -12939,6 +12979,9 @@ async function* generateOutputFilesFromDatasets(datasets, options) {
|
|
|
12939
12979
|
function listOfBooksApiLink(translationId, prefix = "") {
|
|
12940
12980
|
return `${prefix}/api/${translationId}/books.json`;
|
|
12941
12981
|
}
|
|
12982
|
+
function completeTranslationApiLink(translationId, prefix = "") {
|
|
12983
|
+
return `${prefix}/api/${translationId}/complete.json`;
|
|
12984
|
+
}
|
|
12942
12985
|
function listOfCommentaryBooksApiLink(commentaryId, prefix = "") {
|
|
12943
12986
|
return `${prefix}/api/c/${commentaryId}/books.json`;
|
|
12944
12987
|
}
|
|
@@ -15126,6 +15169,9 @@ async function uploadApiFilesFromDatabase(db, dest, options) {
|
|
|
15126
15169
|
if (options.pretty) {
|
|
15127
15170
|
logger2.log("Generating pretty-printed JSON files");
|
|
15128
15171
|
}
|
|
15172
|
+
if (options.generateCompleteTranslationFiles) {
|
|
15173
|
+
logger2.log("Generating complete translation files");
|
|
15174
|
+
}
|
|
15129
15175
|
const pageSize = typeof options.batchSize === "number" ? options.batchSize : parseInt(options.batchSize);
|
|
15130
15176
|
await serializeAndUploadDatasets(
|
|
15131
15177
|
dest,
|
|
@@ -15163,6 +15209,9 @@ async function serializeAndUploadDatasets(dest, datasets, options = {}) {
|
|
|
15163
15209
|
if (options.pretty) {
|
|
15164
15210
|
logger2.log("Generating pretty-printed JSON files");
|
|
15165
15211
|
}
|
|
15212
|
+
if (options.generateCompleteTranslationFiles) {
|
|
15213
|
+
logger2.log("Generating complete translation files");
|
|
15214
|
+
}
|
|
15166
15215
|
const files = serializeDatasets(datasets, {
|
|
15167
15216
|
...options
|
|
15168
15217
|
});
|
package/dist/esm/index.js
CHANGED
|
@@ -7984,6 +7984,9 @@ async function uploadApiFilesFromDatabase(db, dest, options) {
|
|
|
7984
7984
|
if (options.pretty) {
|
|
7985
7985
|
logger.log("Generating pretty-printed JSON files");
|
|
7986
7986
|
}
|
|
7987
|
+
if (options.generateCompleteTranslationFiles) {
|
|
7988
|
+
logger.log("Generating complete translation files");
|
|
7989
|
+
}
|
|
7987
7990
|
const pageSize = typeof options.batchSize === "number" ? options.batchSize : parseInt(options.batchSize);
|
|
7988
7991
|
await serializeAndUploadDatasets(
|
|
7989
7992
|
dest,
|
|
@@ -8021,6 +8024,9 @@ async function serializeAndUploadDatasets(dest, datasets, options = {}) {
|
|
|
8021
8024
|
if (options.pretty) {
|
|
8022
8025
|
logger.log("Generating pretty-printed JSON files");
|
|
8023
8026
|
}
|
|
8027
|
+
if (options.generateCompleteTranslationFiles) {
|
|
8028
|
+
logger.log("Generating complete translation files");
|
|
8029
|
+
}
|
|
8024
8030
|
const files = serializeDatasets(datasets, {
|
|
8025
8031
|
...options
|
|
8026
8032
|
});
|