1.4.10 • Published 1 year ago

@bible-engine/core v1.4.10

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

@bible-engine/core

Writing data

If you want to create a BibleEngine database, your starting point should be the importers package which includes helper classes and importers for bible formats like OSIS and sword.

However you can also use core methods directly for writing if you prefer that:

import { BibleEngine } from '@bible-engine/core';

const bibleEngine = new BibleEngine({
    type: 'sqlite',
    database: `${dirProjectRoot}/output/bible.db`,
});

const version = await bibleEngine.addVersion(
    new BibleVersion({
        version: 'XSB',
        title: 'X Standard Bible',
        language: 'en-US',
        chapterVerseSeparator: ':',
    })
);

const books = [{ num: 1, file: 'gen.xml' }];

for (const book of books) {
    /*
     * Of course the real magic needs to happen in the following line.
     * Your method needs to return data as defined in `models/BibleInput.ts`
     */
    const contents = myParserMethod(book.file);

    await bibleEngine.addBookWithContent(version.id, {
        book: {
            number: book.num,
            osisId: getOsisIdFromBookGenericId(book.num),
            abbreviation: book.abbr,
            title: book.title,
            type: 'ot',
        },
        contents,
    });
}

bibleEngine.finalizeVersion(version.id);

Reading from BibleEngine

If you want to read from a BibleEngine database or server, your starting point should be the client package which takes care of using a local database with an automatic server-fallback (if data is missing or if you want to use the same code for web- and native app).

Example for reading data from a local BibleEngine database using core-methods (e.g. if server-access is not needed):

import { BibleEngine } from '@bible-engine/core';

const bibleEngine = new BibleEngine({
    type: 'sqlite',
    database: `${dirProjectRoot}/output/bible.db`,
});

const bibleData = await bibleEngine.getFullDataForReferenceRange({
    versionUid: 'ESV',
    bookOsisId: 'Gen',
    versionChapterNum: 1,
});
1.4.10

1 year ago

1.4.9

2 years ago

1.4.6

2 years ago

1.4.8

2 years ago

1.4.7

2 years ago

1.3.7

3 years ago

1.4.5

3 years ago

1.3.6

3 years ago

1.4.4

3 years ago

1.3.5

3 years ago

1.4.3

3 years ago

1.3.4

3 years ago

1.4.2

3 years ago

1.3.3

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.2

3 years ago

1.2.3

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.2.2

3 years ago

1.2.0-pre.1

3 years ago

1.2.1

3 years ago

1.0.2

3 years ago

1.1.0

3 years ago

1.1.0-pre.1

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.2.0

4 years ago