import type { RipplingSDK } from "../../../client.js"; import { FunctionResponse, type FunctionContext } from "../../../functions.js"; import type { FunctionExecution, FunctionExecutionsPageCursorURL, ExecutionListLogsResponse } from "../../../resources/functions/executions.js"; import type { APIPromise } from "../../../core/api-promise.js"; import type { PagePromise } from "../../../core/pagination.js"; import { ManifestFunction, type ManifestFunctionProps } from "../manifest-function.js"; import type { RequestOptions } from "../../../internal/request-options.js"; import type { ExecutionListParams, ExecutionListLogsParams } from "../../../resources/functions/executions.js"; /** Parser shared by a function's caller and handler. */ export interface ValueParser { parse(value: unknown): TValue; } /** Authenticated execution resources supplied per call. */ export interface FunctionOperationsContext { readonly functions: { readonly executions: Pick; }; } export interface DefinedFunctionProps extends ManifestFunctionProps { /** Handler source file read unchanged by project export. Importing the definition performs no file I/O. */ source?: URL; input?: ValueParser; output?: ValueParser; } /** Execution returned by a function with its declared input/output contract. */ export type FunctionExecutionResult = Omit & { inputs: TInput; outputs?: TOutput; }; export interface FunctionExecutions { list(ctx: FunctionOperationsContext, params?: ExecutionListParams, options?: RequestOptions): PagePromise; retrieve(ctx: FunctionOperationsContext, executionID: string, options?: RequestOptions): APIPromise; listLogs(ctx: FunctionOperationsContext, executionID: string, params?: Omit, options?: RequestOptions): APIPromise; } export interface FunctionClient { execute(input: TInput, options?: RequestOptions): Promise>; executions: { list(params?: ExecutionListParams, options?: RequestOptions): PagePromise; retrieve(executionID: string, options?: RequestOptions): APIPromise; listLogs(executionID: string, params?: Omit, options?: RequestOptions): APIPromise; }; } export declare function defineFunction(props: DefinedFunctionProps): DefinedFunction; /** A deployable function reference with the same input/output contract at each call site. */ export declare class DefinedFunction extends ManifestFunction { private _source; readonly input: ValueParser | undefined; readonly output: ValueParser | undefined; readonly executions: FunctionExecutions; constructor(props: DefinedFunctionProps); get source(): URL | undefined; /** Replaces inline code or a file-backed source with the supplied code. */ setCode(code: string): this; /** Wraps a handler with the shared contract. Deployed source must be standalone or use declared npm dependencies. */ handler(handler: (input: TInput, context: FunctionContext) => TOutput | Promise): (event: TInput, context: FunctionContext) => Promise>; /** Starts an execution. Asynchronous executions may not have outputs yet. */ execute(ctx: FunctionOperationsContext, input: TInput, options?: RequestOptions): Promise>; } /** @internal Forward client helpers to the definition operations. */ export declare function createFunctionClient(ctx: FunctionOperationsContext, definition: DefinedFunction): FunctionClient; //# sourceMappingURL=function.d.ts.map