@venturekit/integrations
Installation
Section titled “Installation”npm install @venturekit/integrations@devWhat It Provides
Section titled “What It Provides”HTTP Client
Section titled “HTTP Client”import { apiClient } from '@venturekit/integrations';
const stripe = apiClient({ baseUrl: 'https://api.stripe.com/v1', headers: { Authorization: `Bearer ${process.env.STRIPE_KEY}` }, retry: { maxRetries: 3 }, timeout: 5000,});
// The second argument is `ApiRequestOptions` (`{ body?, headers?, params?, ... }`).// Pass the JSON payload via `body` — it is auto-stringified.const res = await stripe.post('/charges', { body: { amount: 1000, currency: 'usd' },});- Automatic retries with exponential backoff
- Configurable timeouts
- Request/response/error interceptors
- Structured
ApiErrorclass
OAuth2
Section titled “OAuth2”import { oauth2 } from '@venturekit/integrations';
const auth = oauth2({ flow: 'client_credentials', tokenUrl: 'https://oauth.provider.com/token', clientId: process.env.CLIENT_ID!, clientSecret: process.env.CLIENT_SECRET!,});
const client = apiClient({ baseUrl: 'https://api.provider.com', onRequest: [auth.interceptor()],});- Client credentials and authorization code flows
- Automatic token refresh
- Token storage: in-memory (default) or DynamoDB
API Key Management
Section titled “API Key Management”import { apiKey, apiKeyHeader } from '@venturekit/integrations';
const key = apiKey({ ssm: '/myapp/prod/api-key' });
const client = apiClient({ baseUrl: 'https://api.example.com', onRequest: [apiKeyHeader(key, 'X-Api-Key', '')],});- Retrieve keys from environment variables, SSM Parameter Store, or Secrets Manager
- Built-in caching to avoid repeated AWS calls
ApiClient,ApiClientOptions,ApiRequestOptions,ApiResponse— HTTP client typesRetryOptions,RequestInterceptor,ResponseInterceptor,ErrorInterceptor— interceptor typesOAuth2Client,OAuth2Options,TokenSet,TokenStore— OAuth2 typesApiKeyHandle,ApiKeySource,ApiKeyFromEnv,ApiKeyFromSSM,ApiKeyFromSecret— API key types
Dependencies
Section titled “Dependencies”@venturekit/core— required@aws-sdk/client-dynamodb,@aws-sdk/lib-dynamodb— peer (for DynamoDB token store)@aws-sdk/client-ssm— peer (for SSM parameter store)@aws-sdk/client-secrets-manager— peer (for Secrets Manager)
Related
Section titled “Related”- API Reference — full type documentation