import Core from './core.js'; import { ExecutionConfig, WorkerOperationLifeCycle, SlicerOperationLifeCycle, Context, APIConfig, DeadLetterAction } from '../../interfaces/index.js'; /** * A base class for supporting APIs that run within an Execution Context. */ export default abstract class APICore extends Core implements WorkerOperationLifeCycle, SlicerOperationLifeCycle { readonly apiConfig: Readonly; deadLetterAction: DeadLetterAction; constructor(context: Context, apiConfig: APIConfig & T, executionConfig: ExecutionConfig); initialize(): Promise; shutdown(): Promise; /** * Try catch a transformation on a record and place any failed records in a dead letter queue * * See {@link #rejectRecord} for handling * * @param fn a function to transform the data with * @returns a curried a function that will be called * with the data and handle the dead letter action */ tryRecord(fn: (input: I) => R): (input: I) => R | null; /** * Reject a record using the dead letter action * * Based on {@link OpConfig._dead_letter_action} the transformation can * be handled any of the following ways: * - "throw": throw the original error * - "log": log the error and the data * - "none": skip the error entirely * OR a string to specify the api to use as the dead letter queue * * @param data the data to transform * @param fn a function to transform the data with * @returns null */ rejectRecord(input: unknown, err: Error): never | null; } //# sourceMappingURL=api-core.d.ts.map