alinea
Version:
[](https://npmjs.org/package/alinea) [](https://packagephobia.com/result?p=alinea)
69 lines (68 loc) • 2.19 kB
TypeScript
import { Request, Response } from '@alinea/iso';
import { Auth, Config, Connection, EntryPhase, PreviewUpdate, ResolveDefaults, Resolver } from 'alinea/core';
import { Database } from './Database.js';
import { Drafts } from './Drafts.js';
import { History } from './History.js';
import { Media } from './Media.js';
import { Pending } from './Pending.js';
import { Previews } from './Previews';
import { Target } from './Target.js';
import { ChangeSetCreator } from './data/ChangeSet.js';
import { EntryResolver } from './resolver/EntryResolver.js';
import { Route } from './router/Router.js';
export interface HandlerOptions {
config: Config;
db: Database;
previews: Previews;
previewAuthToken: string;
auth?: Auth.Server;
target?: Target;
media?: Media;
drafts?: Drafts;
history?: History;
pending?: Pending;
resolveDefaults?: ResolveDefaults;
}
export declare class Handler implements Resolver {
options: HandlerOptions;
connect: (ctx: Connection.Context) => Connection;
router: Route<Request, Response | undefined>;
changes: ChangeSetCreator;
protected lastSync: number;
protected resolver: EntryResolver;
constructor(options: HandlerOptions);
resolve: (params: Connection.ResolveParams) => Promise<unknown>;
protected previewAuth(): Connection.Context;
parsePreview(preview: PreviewUpdate): Promise<{
path: string;
title: any;
data: Record<string, any>;
entryId: string;
phase: EntryPhase;
type: string;
seeded: boolean;
workspace: string;
root: string;
level: number;
filePath: string;
parentDir: string;
childrenDir: string;
index: string;
parent: string | null;
i18nId: string;
locale: string | null;
modifiedAt: number;
rowHash: string;
fileHash: string;
active: boolean;
main: boolean;
url: string;
searchableText: string;
} | undefined>;
periodicSync(): Promise<void>;
syncPending(): Promise<{
commitHash: string;
contentHash: string;
modifiedAt: number;
}>;
}