@helloao/cli 0.0.16 → 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 +67 -2
- package/dist/cjs/index.cjs +47 -0
- 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
|
}
|
|
@@ -15035,6 +15076,9 @@ async function uploadApiFilesFromDatabase(db, dest, options) {
|
|
|
15035
15076
|
if (options.pretty) {
|
|
15036
15077
|
logger2.log("Generating pretty-printed JSON files");
|
|
15037
15078
|
}
|
|
15079
|
+
if (options.generateCompleteTranslationFiles) {
|
|
15080
|
+
logger2.log("Generating complete translation files");
|
|
15081
|
+
}
|
|
15038
15082
|
const pageSize = typeof options.batchSize === "number" ? options.batchSize : parseInt(options.batchSize);
|
|
15039
15083
|
await serializeAndUploadDatasets(
|
|
15040
15084
|
dest,
|
|
@@ -15072,6 +15116,9 @@ async function serializeAndUploadDatasets(dest, datasets, options = {}) {
|
|
|
15072
15116
|
if (options.pretty) {
|
|
15073
15117
|
logger2.log("Generating pretty-printed JSON files");
|
|
15074
15118
|
}
|
|
15119
|
+
if (options.generateCompleteTranslationFiles) {
|
|
15120
|
+
logger2.log("Generating complete translation files");
|
|
15121
|
+
}
|
|
15075
15122
|
const files = serializeDatasets(datasets, {
|
|
15076
15123
|
...options
|
|
15077
15124
|
});
|
|
@@ -16461,6 +16508,9 @@ For inquiries, please contact hello@helloao.org.`
|
|
|
16461
16508
|
).option(
|
|
16462
16509
|
"--generate-audio-files",
|
|
16463
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."
|
|
16464
16514
|
).option(
|
|
16465
16515
|
"--profile <profile>",
|
|
16466
16516
|
"The AWS profile to use for uploading to S3."
|
|
@@ -16524,6 +16574,9 @@ For inquiries, please contact hello@helloao.org.`
|
|
|
16524
16574
|
).option(
|
|
16525
16575
|
"--generate-audio-files",
|
|
16526
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."
|
|
16527
16580
|
).option(
|
|
16528
16581
|
"--profile <profile>",
|
|
16529
16582
|
"The AWS profile to use for uploading to S3."
|
|
@@ -16594,7 +16647,10 @@ For inquiries, please contact hello@helloao.org.`
|
|
|
16594
16647
|
).option(
|
|
16595
16648
|
"--s3-region <region>",
|
|
16596
16649
|
"The AWS region to use for uploading to S3."
|
|
16597
|
-
).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) => {
|
|
16598
16654
|
await generateTranslationFiles(input5, dest, {
|
|
16599
16655
|
...program.opts(),
|
|
16600
16656
|
...options
|
|
@@ -16619,6 +16675,9 @@ For inquiries, please contact hello@helloao.org.`
|
|
|
16619
16675
|
).option(
|
|
16620
16676
|
"--generate-audio-files",
|
|
16621
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."
|
|
16622
16681
|
).option(
|
|
16623
16682
|
"--profile <profile>",
|
|
16624
16683
|
"The AWS profile to use for uploading to S3."
|
|
@@ -16661,6 +16720,9 @@ For inquiries, please contact hello@helloao.org.`
|
|
|
16661
16720
|
).option(
|
|
16662
16721
|
"--generate-audio-files",
|
|
16663
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."
|
|
16664
16726
|
).option(
|
|
16665
16727
|
"--profile <profile>",
|
|
16666
16728
|
"The AWS profile to use for uploading to S3."
|
|
@@ -16679,7 +16741,10 @@ For inquiries, please contact hello@helloao.org.`
|
|
|
16679
16741
|
).action(async (dest, options) => {
|
|
16680
16742
|
const db = getPrismaDb(program.opts().db);
|
|
16681
16743
|
try {
|
|
16682
|
-
await uploadApiFilesFromDatabase(db, dest,
|
|
16744
|
+
await uploadApiFilesFromDatabase(db, dest, {
|
|
16745
|
+
...program.opts(),
|
|
16746
|
+
...options
|
|
16747
|
+
});
|
|
16683
16748
|
} finally {
|
|
16684
16749
|
db.$disconnect();
|
|
16685
16750
|
}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -12448,6 +12448,7 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
12448
12448
|
translationBooks: [],
|
|
12449
12449
|
translationBookChapters: [],
|
|
12450
12450
|
translationBookChapterAudio: [],
|
|
12451
|
+
translationComplete: [],
|
|
12451
12452
|
availableCommentaries: {
|
|
12452
12453
|
commentaries: []
|
|
12453
12454
|
},
|
|
@@ -12476,6 +12477,7 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
12476
12477
|
translation.id,
|
|
12477
12478
|
apiPathPrefix
|
|
12478
12479
|
),
|
|
12480
|
+
completeTranslationApiLink: options.generateCompleteTranslationFiles ? completeTranslationApiLink(translation.id, apiPathPrefix) : void 0,
|
|
12479
12481
|
numberOfBooks,
|
|
12480
12482
|
totalNumberOfChapters: 0,
|
|
12481
12483
|
totalNumberOfVerses: 0,
|
|
@@ -12601,6 +12603,32 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
12601
12603
|
}
|
|
12602
12604
|
api.availableTranslations.translations.push(apiTranslation);
|
|
12603
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
|
+
}
|
|
12604
12632
|
}
|
|
12605
12633
|
for (let { books, profiles, ...commentary } of dataset.commentaries) {
|
|
12606
12634
|
const apiCommentary = {
|
|
@@ -12875,6 +12903,16 @@ function generateFilesForApi(api) {
|
|
|
12875
12903
|
for (let audio of api.translationBookChapterAudio) {
|
|
12876
12904
|
files.push(downloadedFile(audio.link, audio.originalUrl));
|
|
12877
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
|
+
}
|
|
12878
12916
|
files.push(
|
|
12879
12917
|
jsonFile(
|
|
12880
12918
|
`${api.pathPrefix}/api/available_commentaries.json`,
|
|
@@ -12941,6 +12979,9 @@ async function* generateOutputFilesFromDatasets(datasets, options) {
|
|
|
12941
12979
|
function listOfBooksApiLink(translationId, prefix = "") {
|
|
12942
12980
|
return `${prefix}/api/${translationId}/books.json`;
|
|
12943
12981
|
}
|
|
12982
|
+
function completeTranslationApiLink(translationId, prefix = "") {
|
|
12983
|
+
return `${prefix}/api/${translationId}/complete.json`;
|
|
12984
|
+
}
|
|
12944
12985
|
function listOfCommentaryBooksApiLink(commentaryId, prefix = "") {
|
|
12945
12986
|
return `${prefix}/api/c/${commentaryId}/books.json`;
|
|
12946
12987
|
}
|
|
@@ -15128,6 +15169,9 @@ async function uploadApiFilesFromDatabase(db, dest, options) {
|
|
|
15128
15169
|
if (options.pretty) {
|
|
15129
15170
|
logger2.log("Generating pretty-printed JSON files");
|
|
15130
15171
|
}
|
|
15172
|
+
if (options.generateCompleteTranslationFiles) {
|
|
15173
|
+
logger2.log("Generating complete translation files");
|
|
15174
|
+
}
|
|
15131
15175
|
const pageSize = typeof options.batchSize === "number" ? options.batchSize : parseInt(options.batchSize);
|
|
15132
15176
|
await serializeAndUploadDatasets(
|
|
15133
15177
|
dest,
|
|
@@ -15165,6 +15209,9 @@ async function serializeAndUploadDatasets(dest, datasets, options = {}) {
|
|
|
15165
15209
|
if (options.pretty) {
|
|
15166
15210
|
logger2.log("Generating pretty-printed JSON files");
|
|
15167
15211
|
}
|
|
15212
|
+
if (options.generateCompleteTranslationFiles) {
|
|
15213
|
+
logger2.log("Generating complete translation files");
|
|
15214
|
+
}
|
|
15168
15215
|
const files = serializeDatasets(datasets, {
|
|
15169
15216
|
...options
|
|
15170
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
|
});
|