///
import { WorkflowStatus } from './constants/publishModes';
import { Cursor } from './lib/util';
import type { BackendClass, BackendInitializer, BaseField, CollectionWithDefaults, CollectionsWithDefaults, ConfigWithDefaults, Credentials, DisplayURL, Entry, EntryData, EventData, FilterRule, ImplementationEntry, MediaField, ObjectValue, PersistArgs, SearchQueryResponse, SearchResponse, UnknownField, UnpublishedEntry, User } from './interface';
import type { AsyncLock } from './lib/util';
import type { RootState } from './store';
import type AssetProxy from './valueObjects/AssetProxy';
export declare class LocalStorageAuthStore {
storageKey: string;
retrieve(): any;
store(userData: unknown): void;
logout(): void;
}
export declare function getEntryField(field: string, entry: Entry): string;
export declare function extractSearchFields(searchFields: string[]): (entry: Entry) => string;
export declare function expandSearchEntries(entries: Entry[], searchFields: string[]): (Entry & {
field: string;
})[];
export declare function mergeExpandedEntries(entries: (Entry & {
field: string;
})[]): Entry[];
interface AuthStore {
retrieve: () => User;
store: (user: User) => void;
logout: () => void;
}
interface BackendOptions {
backendName: string;
config: ConfigWithDefaults;
authStore?: AuthStore;
}
export interface MediaFile {
name: string;
id: string;
size?: number;
displayURL?: DisplayURL;
path: string;
draft?: boolean;
url?: string;
file?: File;
field?: MediaField;
queryOrder?: unknown;
isViewableImage?: boolean;
type?: string;
isDirectory?: boolean;
}
export declare class Backend {
implementation: BC;
backendName: string;
config: ConfigWithDefaults;
authStore?: AuthStore;
user?: User | null;
backupSync: AsyncLock;
constructor(implementation: BackendInitializer, { backendName, authStore, config }: BackendOptions);
status(): Promise<{
auth: {
status: boolean;
};
api: {
status: boolean;
statusPage: string;
};
}>;
currentUser(): User | Promise | Promise;
updateUserCredentials: (updatedCredentials: Credentials) => User | undefined;
authComponent(): import("react").FC;
authenticate(credentials: Credentials): Promise;
logout(): Promise;
getToken: () => Promise;
entryExist(collection: CollectionWithDefaults, path: string, slug: string, useWorkflow: boolean): Promise;
generateUniqueSlug(collection: CollectionWithDefaults, entry: Entry, config: ConfigWithDefaults, usedSlugs: string[], customPath: string | undefined): Promise;
processEntries(loadedEntries: ImplementationEntry[], collection: CollectionWithDefaults, config: ConfigWithDefaults): Entry[];
listEntries(collection: CollectionWithDefaults, config: ConfigWithDefaults): Promise<{
entries: Entry[];
pagination: unknown;
cursor: Cursor;
}>;
backendPromise: Record;
}>;
listAllEntriesExecutor(collection: CollectionWithDefaults, config: ConfigWithDefaults): Promise;
listAllEntries(collection: CollectionWithDefaults, config: ConfigWithDefaults): Promise;
printError(error: Error): string;
search(collections: CollectionWithDefaults[], searchTerm: string, config: ConfigWithDefaults): Promise;
query(collection: CollectionWithDefaults, config: ConfigWithDefaults, searchFields: string[], searchTerm: string, file?: string, limit?: number): Promise;
traverseCursor(cursor: Cursor, action: string, config: ConfigWithDefaults): Promise<{
entries: Entry[];
cursor: Cursor;
}>;
getLocalDraftBackup(collection: CollectionWithDefaults, config: ConfigWithDefaults, slug: string): Promise<{
entry: Entry | null;
}>;
persistLocalDraftBackup(entry: Entry, collection: CollectionWithDefaults, config: ConfigWithDefaults): Promise;
deleteLocalDraftBackup(collection: CollectionWithDefaults, slug: string): Promise;
deleteAnonymousBackup(): Promise;
getEntry(state: RootState, collection: CollectionWithDefaults, config: ConfigWithDefaults, slug: string): Promise>;
getMedia(folder?: string | undefined, folderSupport?: boolean, mediaPath?: string | undefined): Promise;
getMediaFile(path: string): Promise;
getMediaDisplayURL(displayURL: DisplayURL): Promise;
entryWithFormat(collection: CollectionWithDefaults, config: ConfigWithDefaults): (entry: Entry) => Entry;
processEntry(state: RootState, collection: CollectionWithDefaults, entry: Entry): Promise>;
persistEntry({ config, rootSlug, collection, entryDraft: draft, assetProxies, usedSlugs, unpublished, status, }: PersistArgs): Promise;
getEventData(entry: Entry): Promise;
invokePrePublishEvent(entry: Entry, collection: CollectionWithDefaults): Promise;
invokePostPublishEvent(entry: Entry, collection: CollectionWithDefaults): Promise;
invokePreSaveEvent(entry: Entry, collection: CollectionWithDefaults): Promise;
invokePostSaveEvent(entry: Entry, collection: CollectionWithDefaults): Promise;
persistMedia(config: ConfigWithDefaults, file: AssetProxy): Promise;
deleteEntry(state: RootState, collection: CollectionWithDefaults, slug: string): Promise;
deleteMedia(config: ConfigWithDefaults, path: string): Promise;
entryToRaw(collection: CollectionWithDefaults, entry: Entry, config: ConfigWithDefaults): string;
fieldsOrder(collection: CollectionWithDefaults, entry: Entry): string[];
filterEntries(collection: {
entries: Entry[];
}, filterRule: FilterRule | FilterRule[]): Entry[];
/**
* Editorial Workflows
*/
processUnpublishedEntry(collection: CollectionWithDefaults, config: ConfigWithDefaults, entryData: UnpublishedEntry, withMediaFiles: boolean): Promise>;
unpublishedEntries(collections: CollectionsWithDefaults, config: ConfigWithDefaults): Promise<{
pagination: number;
entries: Entry[];
}>;
unpublishedEntry(state: RootState, collection: CollectionWithDefaults, config: ConfigWithDefaults, slug: string): Promise>;
persistUnpublishedEntry(args: PersistArgs): Promise;
updateUnpublishedEntryStatus(collection: string, slug: string, newStatus: WorkflowStatus): Promise;
deleteUnpublishedEntry(collection: string, slug: string): Promise;
publishUnpublishedEntry(collection: CollectionWithDefaults, entry: Entry): Promise;
}
export declare function resolveBackend(config?: ConfigWithDefaults): Backend;
export declare const currentBackend: (config: ConfigWithDefaults) => Backend;
export {};