Docs API Reference

API Reference

Complete method signatures and TypeScript types for the Devloom SDK.

dlx.client()

Creates an authenticated client instance for a connector.

ParameterTypeRequiredDescription
connectorstringYesConnector slug (e.g. 'fieldvault-crm')
authAuthConfigYesAuth strategy from dlx.auth.*
retryRetryConfigNoOverride default retry behavior
timeoutnumberNoRequest timeout in ms (default: 30000)

client.query()

Returns a chainable query builder for a resource type.

MethodReturnsDescription
.filter(predicates)QueryBuilderApply server-side filters
.select(fields[])QueryBuilderLimit returned fields
.autopage()QueryBuilderEnable automatic pagination
.limit(n)QueryBuilderMax records to return
.all()Promise<T[]>Execute and return all records
.first()Promise<T>Return first matching record
.count()Promise<number>Return count without fetching records

dlx.auth

Auth strategy constructors. Pass the result to dlx.client({ auth }).

// OAuth2 with auto token refresh
dlx.auth.oauth2({
  clientId: '...',
  clientSecret: '...',
  scopes: ['read', 'write'],
  autoRefresh: true
});

// API key header
dlx.auth.apiKey({ header: 'X-API-Key', value: process.env.API_KEY });

// Bearer token
dlx.auth.bearer({ token: process.env.BEARER_TOKEN });

client.stream()

Subscribe to real-time webhook events with a normalized event schema.

const sub = client
  .stream('opportunity.created')
  .on('event', (e: DlxEvent) => {
    // e.type, e.record, e.timestamp
  })
  .on('error', console.error);

// Close subscription
sub.close();

TypeScript Types

interface DlxClient {
  query<T>(resource: string): QueryBuilder<T>;
  stream(event: string): StreamSubscription;
  mutate<T>(resource: string, data: Partial<T>): Promise<T>;
}

interface DlxEvent<T = Record<string, unknown>> {
  type: string;
  record: T;
  timestamp: string;
  connector: string;
}