diff --git a/index.d.ts b/index.d.ts index bd05766be..c3979e3a8 100644 --- a/index.d.ts +++ b/index.d.ts @@ -7,149 +7,149 @@ declare module '@shabados/database' { export const knex: ReturnType - type CommonBuilder = QueryBuilder & { - withTranslations: ( fn?: ( query: CommonBuilder ) => CommonBuilder ) => CommonBuilder, - withTransliterations: ( - fn?: ( query: CommonBuilder ) => CommonBuilder - ) => CommonBuilder, - } - - type LinesBuilder = QueryBuilder & { - withTranslations: ( fn?: ( query: LinesBuilder ) => LinesBuilder ) => LinesBuilder, - withTransliterations: ( fn?: ( query: LinesBuilder ) => LinesBuilder ) => LinesBuilder, - firstLetters: ( query: string ) => LinesBuilder, - fullWord: ( query: string ) => LinesBuilder, - } - - export class Translations extends Model { - lineId: string - translationSourceId: number - translation: string - additionalInformation: string - - translationSource?: UnwrapModel - line?: UnwrapModel - } - - export class Transliterations extends Model { - lineId: string - languageId: number - transliteration: string - - language?: UnwrapModel - line?: UnwrapModel - } - - export class Lines extends Model { - QueryBuilderType: LinesBuilder - - id: string - shabadId: string - sourcePage: number - sourceLine: number - firstLetters: string - vishraamFirstLetters: string - gurmukhi: string - pronunciation: string - pronunctiationInformation: string - typeId: number - orderId: number - - shabad?: Shabads - translations?: Translations[] - transliterations?: Transliterations[] - } - - export class Shabads extends Model { - QueryBuilderType: CommonBuilder - - id: string - sourceId: number - writerId: number - sectionId: number - subsectionId: number - sttmId: number - orderId: number - - writer?: Writers - section?: Sections - subsection?: Subsections - source?: Sources - lines?: Lines[] - } - - export class Languages extends Model { - QueryBuilderType: CommonBuilder - - id: number - nameGurmukhi: string - nameEnglish: string - nameInternational: string - - translationSources?: TranslationSources[] - } - - export class TranslationSources extends Model { - id: number - nameGurmukhi: string - nameEnglish: string - sourceId: number - languageId: number - - source?: Sources - language?: Languages - translations?: Translations[] - } - - export class Writers extends Model { - nameGurmukhi: string - nameEnglish: string - - shabads?: Shabads[] - } - - export class Subsections extends Model { - id: number - sectionId: number - nameGurmukhi: string - nameEnglish: string - startPage: number - endPage: number - - shabads?: Shabads[] - section?: Sections - } - - export class Sections extends Model { - id: number - sourceId: number - nameGurmukhi: string - nameEnglish: string - description: string - startPage: number - endPage: number - - shabads?: Shabads[] - source?: Sources - subsections?: Subsections[] - } - - export class Sources extends Model { - id: number - nameGurmukhi: string - nameEnglish: string - - shabads?: Shabads[] - translationSources?: TranslationSources[] - sections?: Sections[] - } - - export class Banis extends Model { - QueryBuilderType: CommonBuilder - - nameGurmukhi: string - nameEnglish: string - - lines?: (Lines & { lineGroup: number })[] - } + export type CommonBuilder = QueryBuilder & { + withTranslations: ( fn?: ( query: CommonBuilder ) => CommonBuilder ) => CommonBuilder, + withTransliterations: ( + fn?: ( query: CommonBuilder ) => CommonBuilder + ) => CommonBuilder, + } + + export type LinesBuilder = QueryBuilder & { + withTranslations: ( fn?: ( query: LinesBuilder ) => LinesBuilder ) => LinesBuilder, + withTransliterations: ( fn?: ( query: LinesBuilder ) => LinesBuilder ) => LinesBuilder, + firstLetters: ( query: string ) => LinesBuilder, + fullWord: ( query: string ) => LinesBuilder, + } + + export class Translations extends Model { + lineId: string + translationSourceId: number + translation: string + additionalInformation: string + + translationSource?: UnwrapModel + line?: UnwrapModel + } + + export class Transliterations extends Model { + lineId: string + languageId: number + transliteration: string + + language?: UnwrapModel + line?: UnwrapModel + } + + export class Lines extends Model { + QueryBuilderType: LinesBuilder + + id: string + shabadId: string + sourcePage: number + sourceLine: number + firstLetters: string + vishraamFirstLetters: string + gurmukhi: string + pronunciation: string + pronunctiationInformation: string + typeId: number + orderId: number + + shabad?: Shabads + translations?: Translations[] + transliterations?: Transliterations[] + } + + export class Shabads extends Model { + QueryBuilderType: CommonBuilder + + id: string + sourceId: number + writerId: number + sectionId: number + subsectionId: number + sttmId: number + orderId: number + + writer?: Writers + section?: Sections + subsection?: Subsections + source?: Sources + lines?: Lines[] + } + + export class Languages extends Model { + QueryBuilderType: CommonBuilder + + id: number + nameGurmukhi: string + nameEnglish: string + nameInternational: string + + translationSources?: TranslationSources[] + } + + export class TranslationSources extends Model { + id: number + nameGurmukhi: string + nameEnglish: string + sourceId: number + languageId: number + + source?: Sources + language?: Languages + translations?: Translations[] + } + + export class Writers extends Model { + nameGurmukhi: string + nameEnglish: string + + shabads?: Shabads[] + } + + export class Subsections extends Model { + id: number + sectionId: number + nameGurmukhi: string + nameEnglish: string + startPage: number + endPage: number + + shabads?: Shabads[] + section?: Sections + } + + export class Sections extends Model { + id: number + sourceId: number + nameGurmukhi: string + nameEnglish: string + description: string + startPage: number + endPage: number + + shabads?: Shabads[] + source?: Sources + subsections?: Subsections[] + } + + export class Sources extends Model { + id: number + nameGurmukhi: string + nameEnglish: string + + shabads?: Shabads[] + translationSources?: TranslationSources[] + sections?: Sections[] + } + + export class Banis extends Model { + QueryBuilderType: CommonBuilder + + nameGurmukhi: string + nameEnglish: string + + lines?: (Lines & { lineGroup: number })[] + } }