Skip to content
RelKit
Esc
↑↓navigate↵open⌘Jpreview
On this page

Functions API

Generated public TypeScript reference for relkit/functions.

Common APIs

For configuration and examples, read Functions, Declared errors, effect.

For a complete workflow, follow from express or hono, relkit 0 9, upload product images, connect react, cache product prices, react to order events, register users in a transaction.

Frontend usage

Call a public service operation shows the client side of this capability.

Most-used APIs

These entries carry each API’s contract and example. The complete reference follows.

defineFunction

Defines the graph-visible executable unit shared by HTTP, background, tool, and agent calls.

The id is optional for source-scoped functions; the compiler derives it from the source/export hierarchy. Durable resources keep explicit IDs. The handler receives validated reusable input and an invocation-scoped context. Declare every function it calls under dependencies.functions and call it through context.functions, so the common engine preserves validation, service policy, limits, and telemetry.

Throws

TypeError for invalid definition inputs.

Example

import { defineFunction } from "relkit/functions";
import { z } from "relkit/schema";

const greet = defineFunction({
  input: z.object({ name: z.string() }),
  output: z.object({ message: z.string() }),
  handler: async ({ name }, context) => {
    context.log.info("greeting requested");
    return { message: `Hello, ${name}!` };
  },
});
const welcome = defineFunction({
  input: z.object({ name: z.string() }),
  output: z.object({ message: z.string() }),
  dependencies: { functions: { greet } },
  handler: ({ name }, context) => context.functions.greet({ name }),
});
void welcome;

Signature

declare const defineFunction: DefineFunction;

Source

Since v0.1.0

Backend and frontend example

Backend — these maintained files define the operation used by the frontend below.

/** Validates order input, calls the declared pricing function, and returns the calculated order. */
import { defineFunction } from "relkit/functions";
import { z } from "zod";
import priceOrder from "@app/services/orders/functions/price-order.function.js";

const orderInput = z.object({
  orderId: z.string().min(1),
  sku: z.string().min(1),
  quantity: z.number().int().positive(),
});

const orderOutput = z.object({
  orderId: z.string(),
  sku: z.string(),
  totalCents: z.number().int().nonnegative(),
});

const createOrder = defineFunction({
  input: orderInput,
  output: orderOutput,
  dependencies: { functions: { priceOrder } },
  handler: async (input, context) => {
    const { totalCents } = await context.functions.priceOrder({ quantity: input.quantity });
    const order = {
      orderId: input.orderId,
      sku: input.sku,
      totalCents,
    };

    return order;
  },
});

export default createOrder;
/** Maps the HTTP endpoint to its owning service's public member. */
import { defineServiceRoutes } from "relkit/routes";
import orders from "@app/services/orders/service.js";

export default defineServiceRoutes(orders, {
  POST: { member: "createOrder", successStatus: 201 },
});

Frontend

After frontend setup and pulling this API example’s contract, render this component under RelkitClientProvider:

"use client";

/** Calls the API example's Orders function through its public route, retaining the generated input and price result. */
import { api } from "@relkit/client";
import { useRelkitClient, useRouteMutation } from "@relkit/client/react";

/** Creates one order in the API example without importing the backend service.
 * @returns A guarded submission action and its typed price or failure. */
export function CreateOrder() {
  const { status } = useRelkitClient();
  const create = useRouteMutation(api.orders.createOrder);

  return (
    <section>
      <button
        disabled={status !== "ready" || !create.isIdle}
        onClick={() => create.mutate({ orderId: crypto.randomUUID(), sku: "book", quantity: 2 })}
      >
        Create an order
      </button>
      {create.isPending && <p role="status">Creating…</p>}
      {create.isSuccess && <p>Total: {create.data.totalCents} cents</p>}
      {create.isError && (
        <p role="alert">{create.error.message}. Check the outcome before retrying.</p>
      )}
    </section>
  );
}

This calls the same createOrder function through POST /orders, reached as api.orders.createOrder: orderId, sku, and quantity come from its input schema, and totalCents comes from its output schema. The browser calls RPC; it never imports the descriptor or calls the function directly. Service membership needs a client-exposed route to become a browser operation.

Reference: useRouteMutation. Continue with mutation state and recovery.

defineError

Defines a typed application error.

Throws

TypeError for invalid schema, retry, HTTP status, or message.

Example

import { defineError } from "relkit/functions";
import { z } from "relkit/schema";
const NotFound = defineError({
  id: "orders.not-found",
  data: z.object({ id: z.string() }),
  message: "Missing",
});
const error = new NotFound({ id: "order-1" });

Signature

declare const defineError: <const Id extends string, const DataSchema extends StandardSchemaV1>(
  options: DefineErrorOptions<Id, DataSchema>,
) => ErrorDescriptor<Id, InferOutput<DataSchema>, DataSchema>;

Source

Since v0.1.0

Complete reference

Public imports

  • relkit/functions — 137 exports

All exported APIs

Names link to their complete contracts. Re-exports share their original contract; legacy exports keep their separate identity. Examples link to the API’s inline sample, a maintained repository usage, or the shared module walkthrough.

API Kind Import from Example
AgentClientFor Type relkit/functions API example
AgentClients Type relkit/functions API example
AgentRef Type relkit/functions API example
AgentRefAny Type relkit/functions API example
ApplicationBuildUnavailableError Value relkit/functions Module example
ApplicationNotRunningError Value relkit/functions API example
AuthContext Type relkit/functions API example
BucketClient Type relkit/functions API example
BucketClientFor Type relkit/functions API example
BucketClients Type relkit/functions API example
BucketObjectMetadata Type relkit/functions API example
BucketRef Type relkit/functions API example
BucketRefAny Type relkit/functions API example
CacheClient Type relkit/functions API example
CacheClientFor Type relkit/functions API example
CacheClients Type relkit/functions API example
CacheOperationOptions Type relkit/functions API example
CacheRef Type relkit/functions API example
CacheRefAny Type relkit/functions API example
callGraphNodeEffect Value relkit/functions API example
callToolEffect Value relkit/functions API example
ChannelRef Type relkit/functions API example
ChannelRefAny Type relkit/functions API example
copyFunctionToolHooks Value relkit/functions API example
copyFunctionToolHooksEffect Value relkit/functions API example
createFunctionGraphNode Value relkit/functions API example
createFunctionGraphNodeEffect Value relkit/functions API example
createFunctionToolInvoker Value relkit/functions API example
createFunctionToolInvokerEffect Value relkit/functions API example
createRelkit Value relkit/functions API example
CreateRelkitOptions Type relkit/functions Module example
DatabaseClientFor Type relkit/functions API example
DatabaseClients Type relkit/functions API example
DatabaseRef Type relkit/functions API example
DatabaseRefAny Type relkit/functions API example
DeclaredError Value relkit/functions API example
DeclaredErrorOf Type relkit/functions API example
DeclaredErrorsOf Type relkit/functions API example
defineError Value relkit/functions API example
defineErrorEffect Value relkit/functions API example
DefineErrorOptions Type relkit/functions API example
defineFunction Value relkit/functions API example
defineFunctionEffect Value relkit/functions API example
DefineFunctionOptions Type relkit/functions API example
DescriptorRef Type relkit/functions API example
ErrorDescriptor Type relkit/functions API example
ErrorDescriptorAny Type relkit/functions Module example
ErrorHttpMapping Type relkit/functions API example
ErrorRef Type relkit/functions API example
ErrorRetry Type relkit/functions API example
ErrorRetryInput Type relkit/functions API example
EventAttributeValue Type relkit/functions API example
EventClientFor Type relkit/functions API example
EventClients Type relkit/functions API example
EventPublishOptions Type relkit/functions API example
EventPublishResult Type relkit/functions API example
EventRef Type relkit/functions API example
EventRefAny Type relkit/functions API example
fail Value relkit/functions API example
failEffect Value relkit/functions API example
FunctionAsGraphNode Type relkit/functions API example
functionAttempt Value relkit/functions API example
FunctionClientFor Type relkit/functions API example
FunctionClients Type relkit/functions API example
FunctionContext Type relkit/functions API example
FunctionDependencies Type relkit/functions API example
FunctionDescriptor Type relkit/functions API example
FunctionEffectValue Type relkit/functions API example
FunctionFailure Type relkit/functions API example
FunctionGraphNodeDescriptor Type relkit/functions API example
FunctionGraphNodeInvokeEffect Type relkit/functions API example
FunctionGraphNodeOptions Type relkit/functions API example
FunctionHandlerResult Type relkit/functions API example
FunctionHandlerValidation Type relkit/functions API example
FunctionOperation Type relkit/functions API example
FunctionOperationError Value relkit/functions API example
FunctionRef Type relkit/functions API example
FunctionRefAny Type relkit/functions API example
FunctionTelemetry Value relkit/functions API example
FunctionTelemetryLive Value relkit/functions API example
FunctionTelemetryService Type relkit/functions API example
FunctionToolApproval Type relkit/functions API example
FunctionToolApprovalDecision Type relkit/functions API example
FunctionToolApprovalDeniedError Value relkit/functions API example
FunctionToolApprovalDeniedFailure Value relkit/functions API example
FunctionToolApprovalRequest Type relkit/functions API example
FunctionToolApprovalRequiredError Value relkit/functions API example
FunctionToolApprovalRequiredFailure Value relkit/functions API example
FunctionToolApprovalResolver Type relkit/functions API example
FunctionToolArgumentFailure Value relkit/functions API example
FunctionToolArgumentValidationError Value relkit/functions API example
FunctionToolCancelledFailure Value relkit/functions API example
FunctionToolContext Type relkit/functions API example
FunctionToolDescriptor Type relkit/functions API example
FunctionToolHook Type relkit/functions API example
FunctionToolInvokeEffect Type relkit/functions API example
FunctionToolInvokeOptions Type relkit/functions API example
FunctionToolMetadata Type relkit/functions API example
FunctionToolOperationCancelledError Value relkit/functions API example
FunctionToolOptions Type relkit/functions API example
FunctionToolSideEffect Type relkit/functions API example
FunctionToolTarget Type relkit/functions API example
functionTry Value relkit/functions API example
getRelkit Value relkit/functions API example
InvocationMetadata Type relkit/functions API example
InvocationSource Type relkit/functions API example
invokeFunctionGraphNodeEffect Value relkit/functions API example
invokeFunctionToolEffect Value relkit/functions API example
isErrorDescriptor Value relkit/functions API example
isErrorDescriptorEffect Value relkit/functions API example
isFunctionGraphNode Value relkit/functions API example
isFunctionGraphNodeEffect Value relkit/functions API example
isStreamOutputSchema Value relkit/functions API example
isStreamOutputSchemaEffect Value relkit/functions API example
JobClientFor Type relkit/functions API example
JobClients Type relkit/functions API example
JobRef Type relkit/functions Module example
JobRefAny Type relkit/functions Module example
NormalizedErrorRetry Type relkit/functions API example
observeFunction Value relkit/functions API example
PublicClock Type relkit/functions API example
PublicLogger Type relkit/functions API example
RELKIT_FUNCTION_GRAPH_NODE Value relkit/functions API example
RelkitHandle Type relkit/functions API example
ResolvedApplicationEnv Type relkit/functions API example
runFunctionPromise Value relkit/functions API example
runFunctionSync Value relkit/functions API example
RuntimeHandleCallOptions Type relkit/functions Module example
RuntimeHandleInvoke Type relkit/functions Module example
RuntimeHandleOptions Type relkit/functions Module example
StandaloneRelkitHandle Type relkit/functions API example
streamOf Value relkit/functions API example
streamOfEffect Value relkit/functions API example
StreamOutputSchema Type relkit/functions API example
TaskClientFor Type relkit/functions API example
TaskClients Type relkit/functions API example
TaskTriggerOptions Type relkit/functions API example

client-maps.types.ts

AgentClientFor (type alias)

Typed callable client for an agent descriptor.

Example

const invoke: AgentClientFor<typeof agent> = async (input) => output;

Signature

type AgentClientFor<T> = (input: InputOf<T>) => Promise<OutputOf<T>>;

Source

AgentClients (type alias)

Named agent clients projected from dependencies.

Example

const agents: AgentClients<typeof dependencies.agents> = context.agents;

Signature

type AgentClients<M> = {
  readonly [Name in keyof NonNullable<M> & string]: AgentClientFor<NonNullable<M>[Name]>;
};

Source

BucketClientFor (type alias)

Bucket client exposed for a declared bucket.

Example

const client: BucketClientFor<typeof bucket> = buckets.uploads;

Signature

type BucketClientFor<T> = BucketClient;

Source

BucketClients (type alias)

Named bucket clients projected from dependencies.

Example

const buckets: BucketClients<typeof dependencies.buckets> = context.buckets;

Signature

type BucketClients<M> = {
  readonly [Name in keyof NonNullable<M> & string]: BucketClientFor<NonNullable<M>[Name]>;
};

Source

CacheClientFor (type alias)

Key and value typed cache client.

Example

const client: CacheClientFor<typeof cache> = caches.sessions;

Signature

type CacheClientFor<T> = CacheClient<KeyOf<T>, ValueOf<T>>;

Source

CacheClients (type alias)

Named cache clients projected from dependencies.

Example

const cache: CacheClients<typeof dependencies.cache> = context.cache;

Signature

type CacheClients<M> = {
  readonly [Name in keyof NonNullable<M> & string]: CacheClientFor<NonNullable<M>[Name]>;
};

Source

DatabaseClientFor (type alias)

Handler context of a database service declared under dependencies.databases. Database integrations map their service descriptors through Relkit.DatabaseContexts.

Example

const db: DatabaseClientFor<typeof database> = context.databases.main;

Signature

type DatabaseClientFor<T> = [Relkit.DatabaseContexts<T>[keyof Relkit.DatabaseContexts<T>]] extends [
  never,
]
  ? Readonly<Record<string, unknown>>
  : Relkit.DatabaseContexts<T>[keyof Relkit.DatabaseContexts<T>];

Source

DatabaseClients (type alias)

Named database contexts projected from dependencies.

Example

const databases: DatabaseClients<typeof dependencies.databases> = context.databases;

Signature

type DatabaseClients<M> = {
  readonly [Name in keyof NonNullable<M> & string]: DatabaseClientFor<NonNullable<M>[Name]>;
};

Source

EventClientFor (type alias)

Typed publish client for an event descriptor.

Example

const client: EventClientFor<typeof event> = events.created;

Signature

type EventClientFor<T> = {
  /** Publishes an event.
   * @param payload - Event payload.
   * @param options - Optional key and attributes.
   * @returns Accepted event envelope.
   * @example await events.created.publish(payload);
   */
  publish(
    payload: EventInputOf<T>,
    options?: EventPublishOptions,
  ): Promise<EventPublishResult<EventIdOf<T>, EventVersionOf<T>, EventOutputOf<T>>>;
};

Source

EventClients (type alias)

Named event clients projected from published events.

Example

const events: EventClients<typeof published> = context.events;

Signature

type EventClients<M> = {
  readonly [Name in keyof NonNullable<M> & string]: EventClientFor<NonNullable<M>[Name]>;
};

Source

FunctionClientFor (type alias)

Typed callable client for a function declared under dependencies.functions.

Example

const price: FunctionClientFor<typeof priceOrder> = context.functions.priceOrder;

Signature

type FunctionClientFor<T> = (input: InputOf<T>) => Promise<OutputOf<T>>;

Source

FunctionClients (type alias)

Named function clients projected from dependencies.

Example

const functions: FunctionClients<typeof dependencies.functions> = context.functions;

Signature

type FunctionClients<M> = {
  readonly [Name in keyof NonNullable<M> & string]: FunctionClientFor<NonNullable<M>[Name]>;
};

Source

JobClientFor (type alias)

Typed trigger client for a job descriptor.

Example

const client: JobClientFor<typeof job> = jobs.sendReceipt;

Signature

type JobClientFor<T> = {
  /** Triggers a run of the job's task.
   * @param input - Task input.
   * @param options - Optional scheduling and idempotency controls.
   * @returns Handle for the new run.
   * @example await jobs.sendReceipt.trigger(input);
   */
  trigger(input: InputOf<T>, options?: TaskTriggerOptions): Promise<RunHandle>;
};

Source

JobClients (type alias)

Named job clients projected from dependencies.

Example

const jobs: JobClients<typeof dependencies.jobs> = context.jobs;

Signature

type JobClients<M> = {
  readonly [Name in keyof NonNullable<M> & string]: JobClientFor<NonNullable<M>[Name]>;
};

Source

TaskClientFor (type alias)

Typed trigger client for a task descriptor.

Example

const client: TaskClientFor<typeof task> = tasks.send;

Signature

type TaskClientFor<T> = {
  /** Triggers a task run.
   * @param input - Task input.
   * @param options - Optional scheduling and idempotency controls.
   * @returns Handle for the new run.
   * @example await tasks.send.trigger(input);
   */
  trigger(input: InputOf<T>, options?: TaskTriggerOptions): Promise<RunHandle>;
};

Source

TaskClients (type alias)

Named task clients projected from dependencies.

Example

const tasks: TaskClients<typeof dependencies.tasks> = context.tasks;

Signature

type TaskClients<M> = {
  readonly [Name in keyof NonNullable<M> & string]: TaskClientFor<NonNullable<M>[Name]>;
};

Source

TaskTriggerOptions (interface)

Scheduling and idempotency options for a task.

Example

await tasks.send.trigger(input, { operationId: "send-1" });

Signature

export interface TaskTriggerOptions {
  readonly operationId?: string;
  readonly idempotencyKey?: string;
  readonly delay?: string;
  readonly at?: string;
  readonly tags?: readonly string[];
  readonly correlationId?: string;
}

Source

clients.types.ts

“./client-maps.types.js” (namespace export)

Re-exports all named exports from the “./client-maps.types.js” module.

Signature

export * from "./client-maps.types.js";

Source

BucketClient

Signature

declare const BucketClient: BucketClient;

Source

BucketObjectMetadata

Signature

declare const BucketObjectMetadata: BucketObjectMetadata;

Source

BucketPutOptions

Signature

declare const BucketPutOptions: BucketPutOptions;

Source

CacheClient

Signature

declare const CacheClient: CacheClient<Key, Value>;

Source

CacheOperationOptions

Signature

declare const CacheOperationOptions: CacheOperationOptions;

Source

EventAttributeValue (type alias)

Scalar value accepted in event attributes.

Example

const value: EventAttributeValue = true;

Signature

type EventAttributeValue = string | number | boolean;

Source

EventPublishOptions (interface)

Metadata supplied with an event publication.

Example

await events.publish(payload, { key: "order-1" });

Signature

export interface EventPublishOptions {
  readonly key?: string;
  readonly attributes?: Readonly<Record<string, EventAttributeValue>>;
}

Source

EventPublishResult (interface)

Accepted event envelope returned by publication.

Example

const published: EventPublishResult = await events.publish(payload);

Signature

export interface EventPublishResult<
  Id extends string = string,
  Version extends number = number,
  Payload = unknown,
> extends EventEnvelope<Id, Version, Payload> {
  readonly accepted: true;
}

Source

create-relkit.ts

createRelkit(config): a runtime handle for scripts, seeders and other frameworks. It runs the built application’s activation with no HTTP listener, event consumers or job workers.

ApplicationBuildUnavailableError (class)

Raised when createRelkit finds no usable build of the application.

Signature

declare class ApplicationBuildUnavailableError {
  constructor(entry: string, reason: string);
}

Source

code (property)

Signature

readonly code: "RELKIT_APPLICATION_BUILD_UNAVAILABLE"

Source

CreateRelkitOptions (interface)

Options for createRelkit.

Signature

export interface CreateRelkitOptions {
  /** Project root that holds `.relkit/build`; defaults to the current directory. */
  readonly root?: string;
}

Source

StandaloneRelkitHandle (type alias)

A runtime handle that owns its providers until close() releases them.

Example

const relkit = await createRelkit(config);
await relkit.close();

Signature

type StandaloneRelkitHandle = RelkitHandle & {
  /** Releases the providers the handle started; calling it again does nothing.
   * @returns Completion after every provider is released.
   * @example await relkit.close();
   */
  readonly close: () => Promise<void>;
};

Source

createRelkit

Starts a runtime handle for code that runs outside the application, such as a seed script. Only the providers the application’s graph needs are activated; nothing listens for requests.

Throws

ApplicationBuildUnavailableError when the build is missing or predates createRelkit.

Example

const relkit = await createRelkit(config);
await relkit.database.orders.insert({ data: { id: "o1", totalCents: 100 } });
await relkit.close();

Signature

declare const createRelkit: (
  config: { readonly ref: { readonly kind: "app" } },
  options?: CreateRelkitOptions,
) => Promise<StandaloneRelkitHandle>;

Source

define-error-validation.ts

assertErrorSchema

Asserts a declared error data schema.

Throws

TypeError for a nonstandard schema.

Example

assertErrorSchema(z.string());

Signature

declare const assertErrorSchema: (value: unknown) => asserts value is StandardSchemaV1;

Source

assertErrorSchemaEffect

Validates a Standard Schema through Effect.

Example

Effect.runSync(assertErrorSchemaEffect(z.string()));

Signature

declare const assertErrorSchemaEffect: (
  value: unknown,
) => Effect.Effect<StandardSchemaV1<unknown, unknown>, FunctionOperationError, never>;

Source

isErrorDescriptor

Recognizes a declared error descriptor.

Example

if (isErrorDescriptor(value)) console.log(value.id);

Signature

declare const isErrorDescriptor: (value: unknown) => value is ErrorDescriptorAny;

Source

isErrorDescriptorEffect

Checks a declared error descriptor through Effect.

Example

Effect.runSync(isErrorDescriptorEffect(value));

Signature

declare const isErrorDescriptorEffect: (
  value: unknown,
) => Effect.Effect<boolean, FunctionOperationError, never>;

Source

isRecord

Recognizes a nonarray record-like value.

Example

isRecord({ id: "one" });

Signature

declare const isRecord: (value: unknown) => value is Record<PropertyKey, unknown>;

Source

isRecordEffect

Checks a record-like value through Effect.

Example

Effect.runSync(isRecordEffect({}));

Signature

declare const isRecordEffect: (
  value: unknown,
) => Effect.Effect<boolean, FunctionOperationError, never>;

Source

validateErrorHttp

Validates a declared error HTTP mapping.

Throws

TypeError for an invalid status.

Example

validateErrorHttp({ status: 404 });

Signature

declare const validateErrorHttp: (http: ErrorHttpMapping | undefined) => void;

Source

validateErrorHttpEffect

Validates an HTTP status mapping through Effect.

Example

Effect.runSync(validateErrorHttpEffect({ status: 404 }));

Signature

declare const validateErrorHttpEffect: (
  http: ErrorHttpMapping | undefined,
) => Effect.Effect<void, FunctionOperationError, never>;

Source

define-error.ts

defineErrorEffect

Defines a typed application error with safe data, transport metadata, and an optional retry hint. The compiler derives omitted IDs. Omitted retry means never; later only hints to durable work.

Example

const NotFound = Effect.runSync(
  defineErrorEffect({
    id: "orders.not-found",
    data: z.object({ orderId: z.string() }),
    message: ({ orderId }) => `Order ${orderId} was not found`,
  }),
);
new NotFound({ orderId: "order-1" });

Signature

declare const defineErrorEffect: <
  const Id extends string,
  const DataSchema extends StandardSchemaV1,
>(
  options: DefineErrorOptions<Id, DataSchema>,
) => Effect.Effect<
  ErrorDescriptor<Id, InferOutput<DataSchema>, DataSchema>,
  FunctionOperationError,
  never
>;

Source

Since v0.1.0

DeclaredError (class)

Validated application error instance.

Example

const error = new NotFound({ id: "one" });

Signature

declare class DeclaredError<Id, Data> {
  constructor(
    id: Id,
    ref: ErrorRef<Id>,
    data: Data,
    message: string,
    retry: ErrorRetry,
    afterMs: number | undefined,
    http: ErrorHttpMapping | undefined,
  );
}

Source

id (property)

Signature

readonly id: Id

Source

ref (property)

Signature

readonly ref: ErrorRef<Id>

Source

data (property)

Signature

readonly data: Data

Source

retry (property)

Signature

readonly retry: ErrorRetry

Source

afterMs (property)

Signature

readonly afterMs: number | undefined

Source

http (property)

Signature

readonly http: ErrorHttpMapping | undefined

Source

DefineErrorOptions

Options for constructing a declared error descriptor.

Example

defineError({ id: "orders.not-found", data: z.object({ id: z.string() }), message: "Missing" });

Signature

export interface DefineErrorOptions<
  Id extends string,
  DataSchema extends StandardSchemaV1,
> extends DescriptorMetadata {
  /** The error's public code; required because it must not change when the file moves. */
  readonly id: Id;
  /** Schema of the details callers receive with the error. */
  readonly data: DataSchema;
  /** Text of the error: a string, or a function that builds it from `data`. */
  readonly message: string | ((data: InferOutput<DataSchema>) => string);