telefunc
Version:
Remote functions. Instead of API.
24 lines (23 loc) • 782 B
TypeScript
export { runTelefunc };
export type { HttpResponse };
import { Telefunc } from './getContext.js';
/** The HTTP Response of a telefunction remote call HTTP Request */
type HttpResponse = {
/** HTTP Response Status Code */
statusCode: 200 | 403 | 500 | 400;
/** HTTP Response Body */
body: string;
/** HTTP Response Header `Content-Type` */
contentType: 'text/plain';
/** HTTP Response Header `ETag` */
etag: string | null;
/** Error thrown by your telefunction */
err?: unknown;
};
declare function runTelefunc(runContext: Parameters<typeof runTelefunc_>[0]): Promise<HttpResponse>;
declare function runTelefunc_(httpRequest: {
url: string;
method: string;
body: unknown;
context?: Telefunc.Context;
}): Promise<HttpResponse>;