UNPKG

@rr0/cms

Version:

RR0 Content Management System (CMS)

38 lines (37 loc) 1.41 kB
import { HtmlRR0Context } from "../RR0Context.js"; import { HttpSource } from "../time/datasource/HttpSource.js"; import { TimeService } from "../time/TimeService.js"; import { AllDataService, RR0SourceType, Source } from "@rr0/data"; /** * Create Source objects. */ export declare class SourceFactory { protected dataService: AllDataService; protected http: HttpSource; protected baseUrl: string; protected options: Intl.DateTimeFormatOptions; protected time: TimeService; constructor(dataService: AllDataService, http: HttpSource, baseUrl: string, options: Intl.DateTimeFormatOptions, time: TimeService); /** * Create a Source object from an anchor's URL. * * @param context * @param href The anchor's URL string. */ create(context: HtmlRR0Context, href: string): Promise<Source<RR0SourceType>>; /** * Create a Source object from a link referencing an internal page of the site. * * @param context * @param href */ createInternal(context: HtmlRR0Context, href: string): Promise<Source<RR0SourceType>>; /** * Create a Source object from a link referencing a page outside the site. * * @param context * @param href */ createExternal(context: HtmlRR0Context, href: string): Promise<Source<RR0SourceType>>; fromPage(href: string, hash?: string): Promise<Source<RR0SourceType>>; }