- NodeSwordInterface
This is the main class of node-sword-interface and it provides a set of static functions that wrap SWORD library functionality.
- VerseObject :
Object
An object representation of a Bible verse.
- ModuleObject :
Object
An object representation of a SWORD module.
- StrongsReference :
Object
An object representation of a Strongs reference
- StrongsEntry :
Object
An object representation of a Strong's entry.
This is the main class of node-sword-interface and it provides a set of static functions that wrap SWORD library functionality.
Kind: global class
- NodeSwordInterface
- .repositoryConfigExisting() ⇒
Boolean
- .updateRepositoryConfig(progressCB) ⇒
Promise
- .getRepoNames() ⇒
Array.<String>
- .getRepoLanguages(repositoryName, moduleType) ⇒
Array.<String>
- .getAllRepoModules(repositoryName, moduleType) ⇒
Array.<ModuleObject>
- .getRepoModulesByLang(repositoryName, language, moduleType, headersFilter, strongsFilter, hebrewStrongsKeys, greekStrongsKeys) ⇒
Array.<ModuleObject>
- .getUpdatedRepoModules(repositoryName, includeBeta) ⇒
Array.<ModuleObject>
- .getRepoModule(moduleCode) ⇒
ModuleObject
- .getAllLocalModules(moduleType) ⇒
Array.<ModuleObject>
- .getRepoModuleCount(repositoryName, moduleType) ⇒
Number
- .getRepoLanguageModuleCount(repositoryName, language, moduleType) ⇒
Number
- .installModule(moduleCode, progressCB) ⇒
Promise
- .cancelInstallation()
- .uninstallModule(moduleCode) ⇒
Promise
- .refreshLocalModules()
- .saveModuleUnlockKey(moduleCode, key)
- .isModuleReadable(moduleCode) ⇒
Boolean
- .getModuleDescription(moduleCode) ⇒
String
- .enableMarkup()
- .getRawModuleEntry(moduleCode, key) ⇒
String
- .getReferenceText(moduleCode, key) ⇒
VerseObject
- .getChapterText(moduleCode, bookCode, chapter) ⇒
Array.<VerseObject>
- .getBookText(moduleCode, bookCode, startVerseNr, verseCount) ⇒
Array.<VerseObject>
- .getVersesFromReferences(moduleCode, references) ⇒
Array.<VerseObject>
- .getReferencesFromReferenceRange(referenceRange) ⇒
Array.<String>
- .getBookList(moduleCode) ⇒
Array.<String>
- .getBookHeaderList(moduleCode, bookCode, startVerseNumber, verseCount) ⇒
Array.<VerseObject>
- .getBookChapterCount(moduleCode, bookCode)
- .getChapterVerseCount(moduleCode, bookCode, chapter)
- .getAllChapterVerseCounts(moduleCode, bookCode) ⇒
Number
- .getBookVerseCount(moduleCode, bookCode) ⇒
Number
- .getBibleText(moduleCode) ⇒
Array.<VerseObject>
- .getBookIntroduction(moduleCode, bookCode) ⇒
String
- .moduleHasBook(moduleCode, bookCode) ⇒
Boolean
- .getDictModuleKeys(moduleCode) ⇒
Array.<String>
- .getModuleSearchResults(moduleCode, searchTerm, progressCB, searchType, searchScope, isCaseSensitive, useExtendedVerseBoundaries) ⇒
Promise
- .terminateModuleSearch()
- .hebrewStrongsAvailable() ⇒
Boolean
- .greekStrongsAvailable() ⇒
Boolean
- .strongsAvailable() ⇒
Boolean
- .getStrongsEntry(strongsKey) ⇒
StrongsEntry
- .getLocalModule(moduleCode) ⇒
ModuleObject
- .isModuleInUserDir(moduleCode) ⇒
Boolean
- .isModuleAvailableInRepo(moduleCode) ⇒
Boolean
- .getSwordTranslation(originalString, localeCode)
- .getBookAbbreviation(moduleName, bookCode, localeCode)
- .getSwordVersion() ⇒
String
- .getSwordPath() ⇒
String
- .repositoryConfigExisting() ⇒
Checks whether a repository configuration is already existing locally.
Kind: instance method of NodeSwordInterface
Creates or updates the repository configuration and stores the information persistently. The repository configuration contains information about all SWORD repositories and the available modules. After this operation the local cached repository configuration will contain the latest master repository list and updated lists of SWORD modules available from each repository.
This function must be called initially before using any other repository-related functions. Once the repository configuration has been initialized, the use of this function is optional. However, the cached repository configuration may not contain the latest information if this function is not called.
This function works asynchronously and returns a Promise object. The Promise delivers a detailed status object which contains one entry for each of the repositories of the master repo list as well as one result entry.
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
progressCB | function |
Optional callback function that is called on progress events. |
Returns the names of all available SWORD repositories.
Kind: instance method of NodeSwordInterface
Returns: Array.<String>
- An array of strings with the names of the available SWORD repositories.
Returns the available languages for the modules from a given repository (default: Bible modules). Note that the languages are returned as language codes.
Kind: instance method of NodeSwordInterface
Returns: Array.<String>
- An array of strings with the languages codes for the Bible modules from the given repository.
Param | Type | Default | Description |
---|---|---|---|
repositoryName | String |
The name of the given repository. | |
moduleType | String |
BIBLE |
A filter parameter that defines the moduleType (Options: BIBLE, DICT, COMMENTARY) |
nodeSwordInterface.getAllRepoModules(repositoryName, moduleType) ⇒ Array.<ModuleObject>
Returns all modules for the given repository (default: Bible modules).
Kind: instance method of NodeSwordInterface
Returns: Array.<ModuleObject>
- An array of strings with the module codes for the Bible modules of the given repository.
Param | Type | Default | Description |
---|---|---|---|
repositoryName | String |
The name of the given repository. | |
moduleType | String |
BIBLE |
A filter parameter that defines the moduleType (Options: BIBLE, DICT, COMMENTARY) |
nodeSwordInterface.getRepoModulesByLang(repositoryName, language, moduleType, headersFilter, strongsFilter, hebrewStrongsKeys, greekStrongsKeys) ⇒ Array.<ModuleObject>
Returns all Bible modules for the given repository and language
Kind: instance method of NodeSwordInterface
Returns: Array.<ModuleObject>
- An array of module objects.
Param | Type | Default | Description |
---|---|---|---|
repositoryName | String |
The name of the given repository. | |
language | String |
The language code that shall be used as a filter. | |
moduleType | String |
BIBLE |
A filter parameter that defines the moduleType (Options: BIBLE, DICT, COMMENTARY) |
headersFilter | Boolean |
false |
Whether only modules with Headers shall be returned. |
strongsFilter | Boolean |
false |
Whether only modules with Strong's shall be returned. |
hebrewStrongsKeys | Boolean |
false |
Whether only modules with Hebrew Strong's keys shall be returned (only applies to dictionaries). |
greekStrongsKeys | Boolean |
false |
Whether only modules with Greek Strong's keys shall be returned (only applies to dictionaries). |
nodeSwordInterface.getUpdatedRepoModules(repositoryName, includeBeta) ⇒ Array.<ModuleObject>
Returns all updated modules from all repositories or one specific repository.
Kind: instance method of NodeSwordInterface
Returns: Array.<ModuleObject>
- An array of module objects.
Param | Type | Default | Description |
---|---|---|---|
repositoryName | String |
all |
The name of the repository from which updates shall retrieved. Default: 'all' |
includeBeta | Boolean |
false |
Whether modules from the CrossWire Beta repository should also be included. |
nodeSwordInterface.getRepoModule(moduleCode) ⇒ ModuleObject
Returns an object representation of a SWORD module from a repository.
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
nodeSwordInterface.getAllLocalModules(moduleType) ⇒ Array.<ModuleObject>
Returns all modules installed locally (default: Bible modules).
Kind: instance method of NodeSwordInterface
Returns: Array.<ModuleObject>
- An array of ModuleObjects which represents the locally installed Bible modules.
Param | Type | Default | Description |
---|---|---|---|
moduleType | String |
BIBLE |
A filter parameter that defines the moduleType (Options: BIBLE, DICT, COMMENTARY) |
Returns the number of modules for a given repository (default: Bible modules).
Kind: instance method of NodeSwordInterface
Returns: Number
- The number of Bible modules for the given repository and module type.
Param | Type | Default | Description |
---|---|---|---|
repositoryName | String |
The name of the given repository. | |
moduleType | String |
BIBLE |
A filter parameter that defines the moduleType (Options: BIBLE, DICT, COMMENTARY) |
Returns the number of modules for a given repository and language (default: Bible modules).
Kind: instance method of NodeSwordInterface
Returns: Number
- The number of Bible modules for the given repository, language and module type.
Param | Type | Default | Description |
---|---|---|---|
repositoryName | String |
The name of the given repository. | |
language | String |
The language code that shall be used as a filter. | |
moduleType | String |
BIBLE |
A filter parameter that defines the moduleType (Options: BIBLE, DICT, COMMENTARY) |
Installs a module. The repository is automatically determined. The module is downloaded from the corresponding repository and then installed in the local SWORD directory. This operation may take some time depending on the available bandwidth and geographical distance to the SWORD repository server.
This function works asynchronously and returns a Promise object.
If the installation fails, the Promise will be rejected with the following status codes (based on SWORD): -1: General installation issue -9: Installation cancelled by user or internet connection suddenly interrupted
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module that shall be installed. |
progressCB | function |
Callback function that is called on progress events. |
Cancels an ongoing module installation.
Kind: instance method of NodeSwordInterface
Uninstalls a module.
This function works asynchronously and returns a Promise object.
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module that shall be uninstalled. |
Refresh the local module database. This function is purely for testing. It will usually be called after changing the SWORD module database outside of the actual application.
Kind: instance method of NodeSwordInterface
Persistently saves the unlock key of the corresponding module in the module's .conf file (in ~/.sword/mods.d/.conf)
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
key | String |
The unlock key. |
Checks whether the module is readable.
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
Returns the description of a module.
Kind: instance method of NodeSwordInterface
Returns: String
- The description of the respective module.
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
Enables available markup (like Strongs, foot notes, etc.) This influences the output for getChapterText, getBookText and getBibleText.
Kind: instance method of NodeSwordInterface
Returns the raw text of an entry for the given module and key. If no entry exists for the given key the return value is undefined.
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
key | String |
The key of the entry. |
nodeSwordInterface.getReferenceText(moduleCode, key) ⇒ VerseObject
Returns the text of an entry for the given module and key. If no entry exists for the given key the return value is a verse with empty content.
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
key | String |
The key of the entry. |
nodeSwordInterface.getChapterText(moduleCode, bookCode, chapter) ⇒ Array.<VerseObject>
Returns the text of a chapter for the given module.
Kind: instance method of NodeSwordInterface
Returns: Array.<VerseObject>
- An array of verse objects.
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
bookCode | String |
The book code of the SWORD module. |
chapter | Number |
The chapter that shall be returned. |
nodeSwordInterface.getBookText(moduleCode, bookCode, startVerseNr, verseCount) ⇒ Array.<VerseObject>
Returns the text of a book for the given module.
Kind: instance method of NodeSwordInterface
Returns: Array.<VerseObject>
- An array of verse objects.
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
bookCode | String |
The book code of the SWORD module. |
startVerseNr | Number |
The start verse number (absolute) where we start reading (Optional) |
verseCount | Number |
The number of verses that shall be returned (Optional) |
nodeSwordInterface.getVersesFromReferences(moduleCode, references) ⇒ Array.<VerseObject>
Returns an array of verses based on the given array of verse references
Kind: instance method of NodeSwordInterface
Returns: Array.<VerseObject>
- An array of verse objects.
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
references | Array |
A list of OSIS references. (like ['Gal.5.1', '1Cor.2.4']) |
Returns an array of individual verse references based on an OSIS reference range expression.
Kind: instance method of NodeSwordInterface
Returns: Array.<String>
- An array of OSIS references.
Param | Type | Description |
---|---|---|
referenceRange | String |
An OSIS reference range expression. (like 'Gal.1.15-Gal.1.16') |
Returns the list of books available in the given module. By default the book codes will be in OSIS format.
Kind: instance method of NodeSwordInterface
Returns: Array.<String>
- An array of book codes.
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
nodeSwordInterface.getBookHeaderList(moduleCode, bookCode, startVerseNumber, verseCount) ⇒ Array.<VerseObject>
Returns the list of headers available in the given book. The headers are returned as an array of VerseObjects.
Kind: instance method of NodeSwordInterface
Param | Type |
---|---|
moduleCode | String |
bookCode | String |
startVerseNumber | Number |
verseCount | Number |
Returns the chapter count of the given book.
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
bookCode | String |
The book code of the SWORD module. |
Returns the number of verses in the given chapter.
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
bookCode | String |
The book code of the SWORD module. |
chapter | Number |
The chapter of the book. |
Returns an array with the chapter verse counts of all chapters of a given book.
Kind: instance method of NodeSwordInterface
Returns: Number
- chapterVerseCounts
Param | Type |
---|---|
moduleCode | String |
bookCode | String |
Returns the number verses in the given book.
Kind: instance method of NodeSwordInterface
Returns: Number
- The verse count of the book.
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
bookCode | String |
The book code of the SWORD module. |
nodeSwordInterface.getBibleText(moduleCode) ⇒ Array.<VerseObject>
Returns the Bible text of a module.
Kind: instance method of NodeSwordInterface
Returns: Array.<VerseObject>
- An array of verse objects.
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
Returns the introduction of the given book.
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
bookCode | String |
The book code of the SWORD module. |
Checks whether a module has a certain book.
Kind: instance method of NodeSwordInterface
Param | Type |
---|---|
moduleCode | String |
bookCode | String |
Returns the keys of a dictionary module.
Kind: instance method of NodeSwordInterface
Param | Type |
---|---|
moduleCode | String |
nodeSwordInterface.getModuleSearchResults(moduleCode, searchTerm, progressCB, searchType, searchScope, isCaseSensitive, useExtendedVerseBoundaries) ⇒ Promise
Returns the results of a module search.
Kind: instance method of NodeSwordInterface
Param | Type | Default | Description |
---|---|---|---|
moduleCode | String |
The module code of the SWORD module. | |
searchTerm | String |
The term to search for. | |
progressCB | function |
Optional callback function that is called on progress events. | |
searchType | String |
phrase |
Options: phrase, multiWord, strongsNumber |
searchScope | String |
BIBLE |
Options: BIBLE, OT, NT |
isCaseSensitive | Boolean |
false |
Whether the search is case sensitive |
useExtendedVerseBoundaries | Boolean |
false |
Whether the search should use extended verse boundaries (Two verses instead of one) in case of a multi word search. |
Terminates the currently ongoing module search.
Kind: instance method of NodeSwordInterface
Checks whether Hebrew Strong's definitions are available.
Kind: instance method of NodeSwordInterface
Checks whether Greek Strong's definitions are available.
Kind: instance method of NodeSwordInterface
Checks whether Strongs definitions are available
Kind: instance method of NodeSwordInterface
nodeSwordInterface.getStrongsEntry(strongsKey) ⇒ StrongsEntry
Returns the Strong's entry for a given key.
Kind: instance method of NodeSwordInterface
Returns: StrongsEntry
- A StrongsEntry object.
Param | Type | Description |
---|---|---|
strongsKey | String |
The Strong's key for the requested entry. |
nodeSwordInterface.getLocalModule(moduleCode) ⇒ ModuleObject
Returns an object representation of a locally installed SWORD module. If the requested moduleCode
is not available
undefined
will be returned.
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
Checks whether the module resides in the user directory.
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
Checks whether the module is available in any repository.
Kind: instance method of NodeSwordInterface
Param | Type | Description |
---|---|---|
moduleCode | String |
The module code of the SWORD module. |
Uses the Sword LocaleMgr to translate a string. This can be used to translate book names for example.
Kind: instance method of NodeSwordInterface
Param | Type |
---|---|
originalString | String |
localeCode | String |
Uses the Sword LocaleMgr to translate a book abbreviation.
Kind: instance method of NodeSwordInterface
Param | Type |
---|---|
moduleName | String |
bookCode | String |
localeCode | String |
Returns the version of the SWORD library
Kind: instance method of NodeSwordInterface
Returns: String
- SWORD library version.
Returns the platform-specific path where SWORD accesses and stores its modules.
Kind: instance method of NodeSwordInterface
Returns: String
- Platform-specific SWORD path.
An object representation of a Bible verse.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
moduleCode | String |
The name/code of the SWORD module |
bibleBookShortTitle | String |
The short title of the verses's Bible book |
chapter | String |
The chapter number |
verseNr | String |
The verse number |
absoluteVerseNr | Number |
The absolute number of the verse within the book (independent of chapters, starting from 1) |
content | String |
The verse content |
An object representation of a SWORD module.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
name | String |
The name/code of the SWORD module |
type | String |
The type of the SWORD module (Currently the following types are supported: Biblical Texts, Lexicons / Dictionaries, Commentaries) |
description | String |
The description of the SWORD module |
language | String |
The language code of the SWORD module |
distributionLicense | String |
The distribution license of the SWORD module |
shortCopyright | String |
The short copyright information of the SWORD module |
version | String |
The version of the SWORD module |
lastUpdate | String |
The date of the last version update of the SWORD module |
category | String |
The category of the SWORD module |
repository | String |
The repository of the SWORD module |
about | String |
Extended description of the SWORD module |
abbreviation | String |
The abbreviation of the SWORD module |
size | Number |
The file size of the SWORD module (in KB) |
location | String |
The filesystem location where the module is stored |
unlockInfo | String |
Information about how to retrieve an unlock key (in case the module is locked) |
inUserDir | Boolean |
Information on whether the module is located in the user's directory |
locked | Boolean |
Information on whether the module is locked |
hasStrongs | Boolean |
Information on whether the module has Strong's numbers |
hasGreekStrongsKeys | Boolean |
Information on whether the module has Strong's based keys (Greek) |
hasHebrewStrongsKeys | Boolean |
Information on whether the module has Strong's based keys (Hebrew) |
hasFootnotes | Boolean |
Information on whether the module has footnotes |
hasHeadings | Boolean |
Information on whether the module has headings |
hasRedLetterWords | Boolean |
Information on whether the module has red letter words |
hasCrossReferences | Boolean |
Information on whether the module has cross references |
isRightToLeft | Boolean |
Information on whether the module has right to left text direction |
An object representation of a Strongs reference
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
text | String |
The full text of the reference |
key | String |
The reference key |
An object representation of a Strong's entry.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
rawEntry | String |
The full raw entry from the SWORD Strong's module |
key | String |
The key of the Strong's entry |
transcription | String |
The transcription of the Strong's entry |
phoneticTranscription | String |
The phonetic transcription of the Strong's entry |
definition | String |
The Strong's definition |
references | Array.<StrongsReference> |
The "see also" references of the Strong's entry |