import { Listener, ListenerList, MaybePromise, MessageService, ILogger } from '@theia/core'; import { Deferred } from '@theia/core/lib/common/promise-util'; import { interfaces } from '@theia/core/shared/inversify'; import { PreferenceScope } from '@theia/core/lib/common/preferences/preference-scope'; import URI from '@theia/core/lib/common/uri'; import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model'; import { Mutex } from 'async-mutex'; import { MonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service'; import { MonacoJSONCEditor } from './monaco-jsonc-editor'; import { EditorManager } from '@theia/editor/lib/browser/editor-manager'; import { IReference } from '@theia/monaco-editor-core/esm/vs/base/common/lifecycle'; export declare abstract class Transaction { protected _open: boolean; /** * Whether the transaction is still accepting new interactions. * Enqueueing an action when the Transaction is no longer open will throw an error. */ get open(): boolean; protected _result: Deferred; /** * The status of the transaction when complete. */ get result(): Promise; /** * The transaction will self-dispose when the queue is empty, once at least one action has been processed. */ protected readonly queue: Mutex; protected readonly onWillConcludeListeners: ListenerList>; /** * An event fired when the transaction is wrapping up. * Consumers can call `waitUntil` on the event to delay the resolution of the `result` Promise. */ onWillConclude: Listener.Registration>; protected status: Deferred; /** * Whether any actions have been added to the transaction. * The Transaction will not self-dispose until at least one action has been performed. */ protected inUse: boolean; protected init(): void; protected doInit(): Promise; waitFor(delay?: Promise, disposeIfRejected?: boolean): Promise; /** * @returns a promise reflecting the result of performing an action. Typically the promise will not resolve until the whole transaction is complete. */ enqueueAction(...args: Arguments): Promise; protected disposeWhenDone(): void; protected conclude(): Promise; dispose(): void; /** * Runs any code necessary to initialize the batch of interactions. No interaction will be run until the setup is complete. * * @returns a representation of the success of setup specific to a given transaction implementation. */ protected abstract setUp(): MaybePromise; /** * Performs a single interaction * * @returns the result of that interaction, specific to a given transaction type. */ protected abstract act(...args: Arguments): MaybePromise; /** * Runs any code necessary to complete a transaction and release any resources it holds. * * @returns implementation-specific information about the success of the transaction. Will be used as the final status of the transaction. */ protected abstract tearDown(): MaybePromise; } export interface PreferenceContext { getConfigUri(): URI; getScope(): PreferenceScope; } export declare const PreferenceContext: unique symbol; export declare const PreferenceTransactionPreludeProvider: unique symbol; export type PreferenceTransactionPreludeProvider = () => Promise; export declare class PreferenceTransaction extends Transaction<[string, string[], unknown], boolean, boolean> { reference: IReference | undefined; protected readonly context: PreferenceContext; protected readonly prelude?: PreferenceTransactionPreludeProvider; protected readonly textModelService: MonacoTextModelService; protected readonly jsoncEditor: MonacoJSONCEditor; protected readonly messageService: MessageService; protected readonly editorManager: EditorManager; protected readonly logger: ILogger; protected doInit(): Promise; protected setUp(): Promise; /** * @returns whether the setting operation in progress, and any others started in the meantime, should continue. */ protected handleDirtyEditor(): Promise; protected act(key: string, path: string[], value: unknown): Promise; protected tearDown(): Promise; } export interface PreferenceTransactionFactory { (context: PreferenceContext, waitFor?: Promise): PreferenceTransaction; } export declare const PreferenceTransactionFactory: unique symbol; export declare const preferenceTransactionFactoryCreator: interfaces.FactoryCreator; //# sourceMappingURL=preference-transaction-manager.d.ts.map