@archer-edu/dxp-directus-cli
Version:
39 lines (38 loc) • 1.45 kB
TypeScript
import { RemotePage, RemotePageKey } from "./types";
type RequestOptions = {
method?: string;
headers?: Record<string, string>;
body?: string;
debug?: boolean;
};
type RequestFunction = (path: string, options?: RequestOptions) => Promise<{
data: any;
}>;
type DirectusPageRepositoryOptions = {
token: string;
debug?: boolean;
request?: RequestFunction;
};
type SiteRecord = {
key: string;
name: string;
managed_pages?: boolean;
active?: boolean;
};
export declare class DirectusPageRepository {
private readonly token;
private readonly debug;
private readonly request;
constructor({ token, debug, request }: DirectusPageRepositoryOptions);
getSiteByKey(siteId: string): Promise<SiteRecord | undefined>;
findPageBySiteParentAndSlug(siteId: string, parentPageId: string | null, slug: string): Promise<RemotePageKey | undefined>;
resolveParentPageChain(siteId: string, parentPathSegments: string[]): Promise<string | null>;
getMaxSiblingSort(siteId: string, parentPageId: string | null): Promise<number>;
createPage(payload: Record<string, any>): Promise<any>;
getPageForReadBack(pageId: string): Promise<RemotePage>;
listPageKeys(siteId: string): Promise<RemotePageKey[]>;
private options;
}
export declare function authHeader(token: string): Record<string, string>;
export declare function resolveDirectusToken(optionToken?: string): string;
export {};