/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { BaseException, JsonValue, logging } from '@angular-devkit/core';
import { Observable, Observer } from 'rxjs';
import { JobDescription, JobHandler, JobHandlerContext } from './api';
export declare class ChannelAlreadyExistException extends BaseException {
constructor(name: string);
}
/**
* Interface for the JobHandler context that is used when using `createJobHandler()`. It extends
* the basic `JobHandlerContext` with additional functionality.
*/
export interface SimpleJobHandlerContext extends JobHandlerContext {
createChannel: (name: string) => Observer;
input: Observable;
addTeardown(teardown: () => Promise | void): void;
}
/**
* A simple version of the JobHandler. This simplifies a lot of the interaction with the job
* scheduler and registry. For example, instead of returning a JobOutboundMessage observable, you
* can directly return an output.
*/
export type SimpleJobHandlerFn = (input: A, context: SimpleJobHandlerContext) => O | Promise | Observable;
/**
* Make a simple job handler that sets start and end from a function that's synchronous.
*
* @param fn The function to create a handler for.
* @param options An optional set of properties to set on the handler. Some fields might be
* required by registry or schedulers.
*/
export declare function createJobHandler(fn: SimpleJobHandlerFn, options?: Partial): JobHandler;
/**
* Lazily create a job using a function.
* @param loader A factory function that returns a promise/observable of a JobHandler.
* @param options Same options as createJob.
*/
export declare function createJobFactory(loader: () => Promise>, options?: Partial): JobHandler;
/**
* Creates a job that logs out input/output messages of another Job. The messages are still
* propagated to the other job.
*/
export declare function createLoggerJob(job: JobHandler, logger: logging.LoggerApi): JobHandler;