Skip to main content

Interface: IVerseLinkRepository

Defined in: Data/Repositories/IVerseLinkRepository.ts:26

Repository for the unified verse_link table (Module Format v2, WS-3).

The table is byte-identical in every module database and in the user database, so one repository serves them all — construct it against whichever connection you need.

verse_link does not exist in any shipped (v1) database. isSupported reports whether the connected database has it; every read returns an empty result when it does not, and every write throws rather than silently dropping data.

Methods

create()

create(link): VerseLinkRecord

Defined in: Data/Repositories/IVerseLinkRepository.ts:65

Insert one link. Validates source_type and link_type.

Parameters

VerseLinkRecord

Returns

VerseLinkRecord


createMany()

createMany(links): void

Defined in: Data/Repositories/IVerseLinkRepository.ts:68

Insert many links in a single transaction.

Parameters

VerseLinkRecord[]

Returns

void


delete()

delete(linkId): boolean

Defined in: Data/Repositories/IVerseLinkRepository.ts:74

Delete a single link by id.

Parameters

linkId

number

Returns

boolean


deleteForSource()

deleteForSource(sourceType, sourceId): number

Defined in: Data/Repositories/IVerseLinkRepository.ts:71

Delete every link belonging to a source row. Returns rows removed.

Parameters

sourceType

"journal" | "prayer" | "verse" | "note" | "dictionary_entry" | "book_section" | "commentary_entry" | "devotional_entry" | "topic" | "cross_reference_group" | "entity_facet"

sourceId

number

Returns

number


getForSource()

getForSource(sourceType, sourceId): VerseLinkRecord[]

Defined in: Data/Repositories/IVerseLinkRepository.ts:43

All links belonging to one source row, in sort_order.

Parameters

sourceType

"journal" | "prayer" | "verse" | "note" | "dictionary_entry" | "book_section" | "commentary_entry" | "devotional_entry" | "topic" | "cross_reference_group" | "entity_facet"

sourceId

number

Returns

VerseLinkRecord[]


getForSources()

getForSources(sourceType, sourceIds): Map<number, VerseLinkRecord[]>

Defined in: Data/Repositories/IVerseLinkRepository.ts:49

Batch variant of getForSource. Returns a map keyed by source_id; sources with no links are absent from the map.

Parameters

sourceType

"journal" | "prayer" | "verse" | "note" | "dictionary_entry" | "book_section" | "commentary_entry" | "devotional_entry" | "topic" | "cross_reference_group" | "entity_facet"

sourceIds

number[]

Returns

Map<number, VerseLinkRecord[]>


getForVerse()

getForVerse(verseId, filter?): VerseLinkRecord[]

Defined in: Data/Repositories/IVerseLinkRepository.ts:52

All links whose inclusive range covers verseId.

Parameters

verseId

number

filter?

VerseLinkFilter

Returns

VerseLinkRecord[]


getForVerseRange()

getForVerseRange(startVerseId, endVerseId, filter?): VerseLinkRecord[]

Defined in: Data/Repositories/IVerseLinkRepository.ts:55

All links whose inclusive range overlaps [startVerseId, endVerseId].

Parameters

startVerseId

number

endVerseId

number

filter?

VerseLinkFilter

Returns

VerseLinkRecord[]


getSourceIdsForVerse()

getSourceIdsForVerse(sourceType, verseId): number[]

Defined in: Data/Repositories/IVerseLinkRepository.ts:62

Distinct source_ids of a given kind that reference verseId.

Parameters

sourceType

"journal" | "prayer" | "verse" | "note" | "dictionary_entry" | "book_section" | "commentary_entry" | "devotional_entry" | "topic" | "cross_reference_group" | "entity_facet"

verseId

number

Returns

number[]


hasLinksFor()

hasLinksFor(sourceType): boolean

Defined in: Data/Repositories/IVerseLinkRepository.ts:40

True when verse_link actually carries rows for sourceType.

isSupported answers a question about shape — is the table there — which is not the same question as "are this module's links stored here". A half-upgraded module can have both: xref_tsk.db ships an empty verse_link alongside a fully populated v1 cross_reference_entry, so a caller that branches on isSupported() alone reads the empty table and reports no links at all. Branch on this instead when a v1 fallback exists.

Parameters

sourceType

"journal" | "prayer" | "verse" | "note" | "dictionary_entry" | "book_section" | "commentary_entry" | "devotional_entry" | "topic" | "cross_reference_group" | "entity_facet"

Returns

boolean


isSupported()

isSupported(): boolean

Defined in: Data/Repositories/IVerseLinkRepository.ts:28

True when the connected database actually has a unified verse_link table.

Returns

boolean