UNPKG

1.37 kBTypeScriptView Raw
1/// <reference types="node" />
2import { ExtendedRequest, ExtendedResponse, KeywordMapper, SiteMeta, LastModifiedByLocale } from "./common";
3export interface SeoOptions {
4 useCache?: boolean;
5 defaultCache?: string[];
6 cacheDir?: string;
7 test?: boolean;
8 altHost?: string;
9 cacheDays?: number;
10}
11export interface SeoSubDirOptions {
12 subDir: boolean;
13 subDirBase: string;
14 subDirOptional: boolean;
15}
16export declare class SeoMiddleware {
17 private siteId;
18 private options;
19 private subDirOptions;
20 constructor(siteId: string, options: SeoOptions, subDirOptions: SeoSubDirOptions);
21 writeToCache(url: string, locale: string, translated: string): Promise<void>;
22 getHtml(url: string, locale: string, html?: string): Promise<string>;
23 getFromCache(url: string, locale: string, skip: boolean, callback: (e?: Error, html?: Buffer | string, isValid?: boolean) => void): void;
24 isEncoded(buffer: any): boolean;
25 readHeaderAsString(res: ExtendedResponse, headerName: string): string;
26 purgeCache(): Promise<void>;
27 middleware(): (meta: SiteMeta, lastModified: LastModifiedByLocale, keywordsByLocale: KeywordMapper, reverseKeywordByLocale: KeywordMapper, req: ExtendedRequest, res: ExtendedResponse, next: () => void) => void;
28}
29export declare function setRenderServer(url: string): void;