Skip to main content
Home

latest

Formata client-facing SDK, enabling users of Formata to easily call into their APIs.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
a year ago (0.3.1)

Formata Client SDK

Connect and orchestrate applications with Formata. This SDK is only one way of interacting with your endpoints and services on the Formata Lattice, but is a very efficient way to do so.

It is recommended to keep one FormataClient instance, housing your WebSocket connection to Formata. It is designed to be held for long periods of time, ensuring reconnects when needed, etc...

Example

import { FormataClient, TokenAuth } from "@formata/client-sdk";

// Creates a WebSocket connection to Formata.
const client = new FormataClient();

// Creates and calls an authenticated request to Formata. Multiple ways to authenticate exist if needed.
// The 'connect' tab in the Formata web application (https://app.formata.io) outlines the 'space', 'version', 'api', and 'endpoint' to use.
// The 'wait' method is shorthand for 'send', then 'wait' on the resulting session for a final response.
// If you don't expect or plan to use a response, call 'send' instead.
const auth = new TokenAuth('my_Formata_api_key');
const resp = await client.request('space', 'version', 'api', 'endpoint').auth(auth).json({ name: 'Bob' }).wait();

// Close the connection explicitly. If you send another message, the connection will be re-opened.
// Most likely will not need to use this in your use of the SDK.
client.close();

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@formata/client-sdk

Import symbol

import * as client_sdk from "@formata/client-sdk";
or

Import directly with a jsr specifier

import * as client_sdk from "jsr:@formata/client-sdk";

Add Package

pnpm i jsr:@formata/client-sdk
or (using pnpm 10.8 or older)
pnpm dlx jsr add @formata/client-sdk

Import symbol

import * as client_sdk from "@formata/client-sdk";

Add Package

yarn add jsr:@formata/client-sdk
or (using Yarn 4.8 or older)
yarn dlx jsr add @formata/client-sdk

Import symbol

import * as client_sdk from "@formata/client-sdk";

Add Package

vlt install jsr:@formata/client-sdk

Import symbol

import * as client_sdk from "@formata/client-sdk";

Add Package

npx jsr add @formata/client-sdk

Import symbol

import * as client_sdk from "@formata/client-sdk";

Add Package

bunx jsr add @formata/client-sdk

Import symbol

import * as client_sdk from "@formata/client-sdk";