Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt

Use this file to discover all available pages before exploring further.

Types are generated from the plugin catalog — plugin IDs, auth types, and credential field names all autocomplete.
import {
  createClient,
  CorsairApiError,
  PluginIdSchema,
  type PluginId,
  type PluginAuthTypes,
  type PluginAccountFields,
  type PluginIntegrationFields,
} from "@corsair-dev/app";

Plugin types

await inst.plugins.upsert("slack", { mode: "cautious" });

// Validate external input
const pluginId = PluginIdSchema.parse(body.pluginId);
await inst.plugins.upsert("github", { authType: "oauth_2" }); // typed per plugin
await t.plugins.credentials.set("slack", "api_key", "xoxb-...");
await inst.plugins.credentials.setRoot("github", "client_id", "...");

Zod schemas

import { InstanceDetailSchema, TenantSummarySchema } from "@corsair-dev/app";

const instance = InstanceDetailSchema.parse(raw);

Catalog helpers

import { PLUGINS, PLUGINS_BY_ID } from "@corsair-dev/app";

const slack = PLUGINS_BY_ID.slack;

Errors

Non-2xx responses throw CorsairApiError:
try {
  await inst.plugins.upsert("slack", { mode: "cautious" });
} catch (err) {
  if (err instanceof CorsairApiError) {
    console.error(err.status, err.code, err.message, err.details);
  }
}
FieldMeaning
statusHTTP status
codeMachine-readable code
messageHuman-readable message
detailsOptional validation details

run() results

tenant.run() returns { success: true, data } or { success: false, signInLink } when auth is missing — it does not throw for missing credentials.