npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@formadapter/orpc

v0.0.1

Published

Type-safe oRPC submissions for FormAdapter forms.

Readme

@formadapter/orpc

Connect a FormAdapter form to an oRPC procedure without coupling the form to a router, transport, or UI adapter.

bun add @formadapter/orpc @orpc/client

Client procedures

createORPCSubmission returns a FormAdapter onSubmit handler. It sends the schema input from SubmitContext by default, not the transformed output passed as the first argument. That lets the server run the schema's transforms again at its trust boundary. The form's abort signal is forwarded through oRPC caller options.

import { createORPCSubmission } from "@formadapter/orpc";

<Account.Form onSubmit={createORPCSubmission(orpc.account.update)} />;

The procedure output is wrapped as { status: "success", data }. A procedure that already returns a well-formed FormAdapter SubmissionState passes through unchanged.

Use mapInput only when the form and procedure intentionally have different wire shapes. Caller options and oRPC context can be static values or per-submit factories:

const submit = createORPCSubmission(orpc.account.update, {
  mapInput: (values) => ({ account: values }),
  context: (_values, context) => ({ requestId: context.formData.get("requestId") }),
  options: () => ({ lastEventId: currentEventId }),
});

Unknown thrown values and server-side failures receive a safe generic message. Use mapError for application-specific errors; returning undefined falls through to the built-in mappings.

Typed form errors

The package has no @orpc/server dependency. It exports a structural Standard Schema error declaration that can be installed once on an oRPC base builder:

import { FORM_SUBMISSION_ERROR_MAP } from "@formadapter/orpc";
import { os } from "@orpc/server";

const formProcedure = os.errors(FORM_SUBMISSION_ERROR_MAP);

In a handler, return the error through oRPC's generated constructor:

throw errors.FORM_SUBMISSION_FAILED({
  data: submissionFailure({
    fieldErrors: { email: ["That address is already registered."] },
  }),
});

createORPCSubmission maps that data directly into form state. It also maps oRPC's built-in BAD_REQUEST { issues } payload, preserving nested and array Standard Schema paths.

That BAD_REQUEST mapping is runtime fallback behavior, not a declared custom error. It works with oRPC's default input-validation payload. If an interceptor replaces or removes data.issues, use a typed custom error or mapError instead.

Actionable procedures

Use createORPCActionSubmission for the tuple returned by .actionable(). This is separate because actionable procedures return JSON errors instead of throwing ordinary ORPCError instances and cannot accept an AbortSignal. Unexpected throws are deliberately re-thrown so framework redirects and not-found control flow continue to work.

@orpc/react's createFormAction is a different integration: it consumes bracket-notation FormData and returns no result state. FormAdapter uses its typed object submission path here so errors can be applied to the form.