/** * @superblocksteam/sdk-api - TypeScript SDK for Superblocks APIs. * * This SDK enables writing Superblocks APIs as simple TypeScript functions * with type-safe input/output validation using Zod schemas and upfront * integration declarations. * * @example * ```typescript * import { api, z, postgres, slack } from '@superblocksteam/sdk-api'; * * export default api({ * integrations: { * db: postgres('Production Postgres'), * notifier: slack('Ops Slack'), * }, * * input: z.object({ * userId: z.string().uuid(), * }), * * output: z.object({ * user: z.object({ * id: z.string(), * name: z.string(), * email: z.string().email(), * }), * }), * * async run(ctx, { userId }) { * const [user] = await ctx.integrations.db.query( * 'SELECT * FROM users WHERE id = $1', * z.object({ id: z.string(), name: z.string(), email: z.string() }), * [userId] * ); * * if (!user) { * throw new Error('User not found'); * } * * const notifyResult = await ctx.integrations.notifier.apiRequest( * { method: 'POST', path: '/chat.postMessage', body: { channel: '#user-lookups', text: `Fetched user ${user.name}` } }, * { response: z.object({ channel: z.string(), ts: z.string() }) } * ); * * if (!notifyResult.ok) { * throw new Error(`Slack API error: ${notifyResult.error}`); * } * * return { user }; * }, * }); * ``` * * @packageDocumentation */ // Re-export Zod for convenience export { z } from "zod"; // Canonical file contracts export { fileRefSchema, readableFileSchema } from "./files.js"; export type { FileRef, ReadableFile } from "./files.js"; // API definition and registry export { api, __setEntryPoint, type CompiledApi } from "./api/index.js"; // Type extraction utilities export type { ExtractApiInput, ExtractApiOutput } from "./api/definition.js"; // Core types export type { ApiConfig, ApiContext, ApiUser, Logger, BaseIntegrationClient, IntegrationRef, AnyIntegrationRef, IntegrationsMap, } from "./types.js"; // Integration declaration functions export { postgres, slack, openai, anthropic, stripe, github, notion, snowflake, snowflakeCortex, airtable, asana, bitbucket, box, circleci, cohere, confluence, datadog, dropbox, elasticsearch, fireworks, front, gemini, googleAnalytics, googleDrive, groq, hubspot, intercom, jira, launchDarkly, mistral, pagerDuty, perplexity, segment, sendGrid, stabilityAI, twilio, zendesk, zoom, graphql, mysql, mariadb, mssql, cockroachdb, oracledb, redshift, athena, databricks, bigquery, mongodb, dynamodb, cosmosdb, s3, gcs, googleSheets, salesforce, superblocksOcr, restApiIntegration, getIntegrationDeclarations, lakebase, snowflakePostgres, smtp, // Types for advanced use type IntegrationDeclaration, type PostgresRef, type SlackRef, type OpenAIRef, type AnthropicRef, type StripeRef, type GitHubRef, type NotionRef, type SnowflakeRef, type SnowflakeCortexRef, type AirtableRef, type AsanaRef, type BitbucketRef, type BoxRef, type CircleCIRef, type CohereRef, type ConfluenceRef, type DatadogRef, type DropboxRef, type ElasticSearchRef, type FireworksRef, type FrontRef, type GeminiRef, type GoogleAnalyticsRef, type GoogleDriveRef, type GroqRef, type HubSpotRef, type IntercomRef, type JiraRef, type LaunchDarklyRef, type MistralRef, type PagerDutyRef, type PerplexityRef, type SegmentRef, type SendGridRef, type StabilityAIRef, type TwilioRef, type ZendeskRef, type ZoomRef, type GraphQLRef, type MySQLRef, type MariaDBRef, type MSSQLRef, type CockroachDBRef, type OracleDBRef, type RedshiftRef, type AthenaRef, type DatabricksRef, type BigQueryRef, type MongoDBRef, type DynamoDBRef, type CosmosDBRef, type S3Ref, type GCSRef, type GoogleSheetsRef, type SalesforceRef, type SuperblocksOCRRef, type RestApiIntegrationRef, type LakebaseRef, type SnowflakePostgresRef, type SmtpRef, } from "./integrations/index.js"; // Integration client types (for advanced use cases) export type { PostgresClient } from "./integrations/postgres/index.js"; export type { SlackClient, SlackResponse, SlackErrorResponse, } from "./integrations/slack/index.js"; export type { SnowflakeClient } from "./integrations/snowflake/index.js"; export type { SnowflakeCortexClient } from "./integrations/snowflakecortex/index.js"; export type { AirtableClient } from "./integrations/airtable/index.js"; export type { AsanaClient } from "./integrations/asana/index.js"; export type { BitbucketClient } from "./integrations/bitbucket/index.js"; export type { BoxClient } from "./integrations/box/index.js"; export type { CircleCIClient } from "./integrations/circleci/index.js"; export type { CohereClient } from "./integrations/cohere/index.js"; export type { ConfluenceClient } from "./integrations/confluence/index.js"; export type { DatadogClient } from "./integrations/datadog/index.js"; export type { DropboxClient } from "./integrations/dropbox/index.js"; export type { ElasticSearchClient } from "./integrations/elasticsearch/index.js"; export type { FireworksClient } from "./integrations/fireworks/index.js"; export type { FrontClient } from "./integrations/front/index.js"; export type { GeminiClient } from "./integrations/gemini/index.js"; export type { GoogleAnalyticsClient } from "./integrations/googleanalytics/index.js"; export type { GoogleDriveClient } from "./integrations/googledrive/index.js"; export type { GroqClient } from "./integrations/groq/index.js"; export type { HubSpotClient } from "./integrations/hubspot/index.js"; export type { IntercomClient } from "./integrations/intercom/index.js"; export type { JiraClient } from "./integrations/jira/index.js"; export type { LaunchDarklyClient } from "./integrations/launchdarkly/index.js"; export type { MistralClient } from "./integrations/mistral/index.js"; export type { PagerDutyClient } from "./integrations/pagerduty/index.js"; export type { PerplexityClient } from "./integrations/perplexity/index.js"; export type { SegmentClient } from "./integrations/segment/index.js"; export type { SendGridClient } from "./integrations/sendgrid/index.js"; export type { StabilityAIClient } from "./integrations/stabilityai/index.js"; export type { TwilioClient } from "./integrations/twilio/index.js"; export type { ZendeskClient } from "./integrations/zendesk/index.js"; export type { ZoomClient } from "./integrations/zoom/index.js"; export type { GraphQLClient } from "./integrations/graphql/index.js"; // Dedicated plugin client types and parameter types export type { DynamoDBClient, DynamoDBAttributeValue, DynamoDBScanOptions, } from "./integrations/dynamodb/index.js"; export type { CosmosDBClient } from "./integrations/cosmosdb/index.js"; export type { SalesforceClient, SalesforceCrudAction, SalesforceBulkAction, } from "./integrations/salesforce/index.js"; export type { S3Client } from "./integrations/s3/index.js"; export type { GCSClient } from "./integrations/gcs/index.js"; export type { GoogleSheetsClient } from "./integrations/gsheets/index.js"; export type { SuperblocksOCRClient } from "./integrations/superblocks-ocr/index.js"; export type { RestApiIntegrationPluginClient } from "./integrations/restapiintegration/index.js"; export type { LakebaseClient } from "./integrations/lakebase/index.js"; export type { SnowflakePostgresClient } from "./integrations/snowflakepostgres/index.js"; export type { SmtpClient, SmtpSendOptions } from "./integrations/smtp/index.js"; // Runtime (for orchestrator use) export { // Executor executeApi, // Context factories createApiContext, // Error types SdkError, InputValidationError, OutputValidationError, IntegrationNotFoundError, IntegrationError, ExecutionError, ErrorCode, } from "./runtime/index.js"; export type { ExecuteApiRequest, ExecuteApiResponse, ExecuteApiSuccessResponse, ExecuteApiErrorResponse, // Context types CreateContextOptions, ErrorCodeType, } from "./runtime/index.js"; // Integration registry (for orchestrator use) export { createClient, isPluginSupported, SUPPORTED_PLUGINS, SUPPORTED_PLUGIN_IDS, } from "./integrations/index.js"; export type { IntegrationConfig, IntegrationClientImpl, SupportedPluginId, QueryExecutor, TraceMetadata, CreateClientOptions, } from "./integrations/index.js"; // resolveIntegrationDocumentation is intentionally NOT re-exported here. // It uses node:fs which is incompatible with browser bundles (Vite dev server). // Import directly from "@superblocksteam/sdk-api/dist/integrations/documentation.js" instead. // SDK-level error types export { RestApiValidationError, QueryValidationError, CodeExecutionError, } from "./errors.js";