import { LitElement, ReactiveController, ReactiveControllerHost } from 'lit'; import { ContextConsumer } from '@lit/context'; import { WeavyType } from '../contexts/weavy-context'; import { AppType } from '../types/app.types'; import { ActionType } from '../types/action.types'; import { BlobType, CreateFileProps, ExternalBlobType, FileMutationContextType, FileType, MutateFileProps } from '../types/files.types'; import { MutateExternalBlobVariables } from '../data/blob-external'; import { MutationController } from './mutation-controller'; import { UserType } from '../contexts'; /** * Lit element controller for creating a conversation app. * * - Requires a weavy context. * - May use members and an agent. * * @fires {WyActionEventType} wy-action - Emitted when a file is created. */ export declare class CreateFilesController implements ReactiveController { host: LitElement & ReactiveControllerHost; protected weavyContext?: ContextConsumer<{ __context__: WeavyType; }, LitElement>; protected whenWeavyContext: Promise; protected resolveWeavyContext?: (value: WeavyType | PromiseLike) => void; protected get weavy(): WeavyType | undefined; protected appContext?: ContextConsumer<{ __context__: AppType; }, LitElement>; protected whenAppContext: Promise; protected resolveAppContext?: (value: AppType | PromiseLike) => void; protected get app(): AppType | undefined; protected userContext?: ContextConsumer<{ __context__: UserType; }, LitElement>; protected whenUserContext: Promise; protected resolveUserContext?: (value: UserType | PromiseLike) => void; protected get user(): UserType | undefined; /** @internal */ private uploadBlobMutation?; /** @internal */ private externalBlobMutation?; /** @internal */ private createFileMutation?; constructor(host: LitElement); /** * Initiates context consumers */ protected setContexts(): Promise; /** * Dispatch a `wy-action` event on the host. * * @fires {WyActionEventType} wy-action - Emitted when a conversation app is created and should be selected. */ dispatchActionEvent(file: FileType, action?: ActionType): Promise; /** * Create mutation controllers. */ protected initMutations(): Promise<{ uploadBlobMutation: MutationController; externalBlobMutation: MutationController; createFileMutation: MutationController; }>; /** * Upload a file and dispatch a `wy-action` event for the created file. * * @param file - The file to upload. * @param action - Action to dispatch, or a function choosing it from the created file. A function is needed when the action depends on properties only the server knows, such as the file `kind`. * @returns The created file. */ uploadFile(file: File | null | undefined, action?: ActionType | ((createdFile: FileType) => ActionType)): Promise; /** * Create an empty file with the given name, or report that the name is taken. * * Used by the filename prompt, which re-asks for a name on conflict. The server rejects a name that an existing * (non-trashed) file in the app already has with `409 Conflict`; that is returned as `undefined` instead of being * thrown, and the conflicting mutation is removed from the cache so the upload sheet does not also offer to replace * the existing file. Any other failure is thrown as usual. * * @param filename - The exact name of the file to create. * @param action - Action to dispatch, or a function choosing it from the created file. * @returns The created file, or `undefined` when a file with that name already exists. */ createEmptyFile(filename: string, action?: ActionType | ((createdFile: FileType) => ActionType)): Promise; uploadFiles(files: File[] | FileList | null | undefined): Promise<(FileType | undefined)[] | undefined>; addExternalBlobs(externalBlobs: ExternalBlobType[] | null | undefined): Promise<(FileType | undefined)[] | undefined>; createFileFromBlob(blob: BlobType, replace?: boolean): Promise; hostUpdate(): void; } //# sourceMappingURL=create-files-controller.d.ts.map