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

@tanstack-isomorphic-form/core

v1.2.0

Published

Core primitives for isomorphic form loading, form-data extraction, and actions in TanStack Start.

Downloads

588

Readme

@tanstack-isomorphic-form/core

Core primitives for @tanstack-isomorphic-form. Framework integrations can use these utilities to read submitted form data, validate it with a Standard Schema, run an action, and represent the resulting form state.

Installation

pnpm add @tanstack-isomorphic-form/core

Exports

JSON Schema

jsonSchemaFromStandardSchema(schema, options?)

Generates and validates the input JSON Schema for a StandardJSONSchemaV1 schema. By default it requests the draft-2020-12 target. Pass the result to createFormDataExtractor.

const jsonSchema = jsonSchemaFromStandardSchema(schema);
const extractFormData = createFormDataExtractor(jsonSchema);

jsonSchemaIncludesBinaryFile(jsonSchema)

Returns true when a JSON Schema contains a field with format: "binary", including fields nested in objects, arrays, and unions. Framework integrations can use this to select multipart/form-data for native submissions.

Form-data extraction

createFormDataExtractor(jsonSchema, options?)

Creates a function that converts FormData into the input shape represented by the JSON Schema. Object and array fields are reconstructed from field names; unsupported or absent fields are omitted.

The optional FormDataToObjectOptions customizes the separators used in field names. The default syntax is address.street for object properties and items[0] for array items.

FormDataExtractor<TSchema>

The function type returned by createFormDataExtractor. It accepts FormData and returns InferFormDataSchemaExtract<TSchema>.

FormDataToObjectOptions

Configuration for the field-name separators used while converting FormData into nested objects and arrays:

  • propertyStartDelimiter
  • propertyEndDelimiter
  • indexStartDelimiter
  • indexEndDelimiter

FormDataSchema<Input, Output>

The form schema constraint. A form schema implements both StandardSchemaV1 for validation and StandardJSONSchemaV1 for generating its input JSON Schema.

InferFormDataSchemaExtract<TSchema>

The extracted, pre-validation value shape for a form schema. Leaf values are represented as form values such as strings, File objects, or null-like values; nested objects and arrays retain their structure.

Actions

runFormAction(options)

Extracts and optionally sanitizes form values, validates them with the supplied schema, and runs actionFn when validation succeeds. It returns the resulting state and an optional redirect destination without performing navigation itself.

redirectAfterAction(options)

Builds a successful or failed action result that also redirects. It preserves an optional ok, result, or error value while moving the router options into redirect.

return redirectAfterAction({ to: "/todos" });

FormActionPanicError

An Error subclass used to represent an unexpected exception raised while running the form action or loader flow.

FormAction<TSchema, TResult, TError, TRedirect>

The action function type. It receives validated schema output as { data } and resolves to a success result, failure result, or either result with a redirect.

InferFormActionResult<TActionFn>

Infers the result type returned by a successful form action.

InferFormActionError<TActionFn>

Infers the error type returned by a failed form action.

RedirectAfterActionReturn<T>

The type returned by redirectAfterAction, including the redirect options and the inferred ok, result, and error fields.

ValueSanitizer<TSchema>

The type of a function that normalizes extracted values before they are stored in form state. The original form values are still what the schema validates.

Loaders

createFormLoader(options)

Creates a route loader. The loader reads submitted form data, runs the form action for POST requests, and otherwise returns idle state with optional defaults. Its options include the schema, action, extractor, optional defaults and sanitizer, and a submittedFormDataReader adapter.

createSubmittedFormDataReader(getRequest)

Creates the server/client submittedFormDataReader adapter required by createFormLoader. The server reader returns request.formData() for POST requests; the client reader returns undefined.

FormLoader<TSchema, TActionFn>

The loader function type created by createFormLoader. It accepts a route loader context containing location.publicHref and optional per-load default values.

FormLoaderReturn<TSchema, TActionFn, TActionUrl>

The promise returned by a form loader. It contains the action URL and the current FormState.

Form state

FormState<TSchema, TResult, TError>

The discriminated union used to represent a form lifecycle state: idle, pending, success, or error. All states include extracted values; success states include result, and error states contain either schema validation issues or a form-level error.

FormActionState<TSchema, TActionFn>

The FormState specialized for a particular form action. Its result and error types are inferred from TActionFn, and unexpected errors are represented by FormActionPanicError.

Repository

  • Source: https://github.com/cahnory/tanstack-isomorphic-form/tree/main/libs/core
  • Issues: https://github.com/cahnory/tanstack-isomorphic-form/issues

License

MIT