/* * The contents of this file were inserted manually and are not generated by Stainless. */ export interface FunctionResponseOptions { body?: Record; statusCode?: number; headers?: Record; message?: string; } export class FunctionResponse { body: Record; statusCode: number; headers: Record; message: string; constructor({ body = {}, statusCode = 200, headers = {}, message = '' }: FunctionResponseOptions = {}) { this.body = body; this.statusCode = statusCode; this.headers = headers; this.message = message; } } export type FunctionEvent = Record; export type DurableDuration = number | string; export type DurableTimestamp = number | Date | string; export interface DurableWaitForEventOptions { type: string; timeout?: DurableDuration; } export interface DurableFailureOptions { code?: string; details?: unknown; } export interface DurableWaitForEventEventResult { kind: 'event'; waitName: string; eventType: string; payload: T; } export interface DurableWaitForEventTimeoutResult { kind: 'timeout'; waitName: string; eventType: string; } export interface DurableWaitForEventResultHelpers { isEvent(): this is DurableWaitForEventEventResult & DurableWaitForEventResultHelpers; isTimeout(): this is DurableWaitForEventTimeoutResult & DurableWaitForEventResultHelpers; throwTimeout(this: DurableWaitForEventTimeoutResult & DurableWaitForEventResultHelpers): never; } export type DurableWaitForEventResult = | (DurableWaitForEventEventResult & DurableWaitForEventResultHelpers) | (DurableWaitForEventTimeoutResult & DurableWaitForEventResultHelpers); export interface FunctionContext { env: { // Set to the Rippling user's bearer token when the function is triggered by a user. // Prefer using this token when available; otherwise, fall back to the Settings Manager // or a hard-coded token if necessary. rippling_user_bearer_token: string | undefined; }; function: { company_id: string; function_id: string; function_version_id: string; run_id: string; role_id?: string; }; settings: Record; } export interface DurableFunctionContext extends FunctionContext { step(name: string, fn: () => Promise | T, opts?: unknown): Promise; sleep(name: string, duration: DurableDuration): Promise; sleepUntil(name: string, timestamp: DurableTimestamp): Promise; waitForEvent( name: string, opts: DurableWaitForEventOptions, ): Promise>; fail(message: string, opts?: DurableFailureOptions): never; } export class DataBridgeRecord { id: string; version: string; value: any; position: any; constructor(id: string, version: string, value: any, position: any) { this.id = id; this.version = version; this.value = value; this.position = position; } } export class DataBridgeTombstone { id: string; version: string; constructor(id: string, version: string) { this.id = id; this.version = version; } } export class DataBridgeFeed { streamName: string; extractAs: any; initialState: any; constructor(streamName: string, extractAs: any, initialState: any) { this.streamName = streamName; this.extractAs = extractAs; this.initialState = initialState; } } export interface DataBridgeResponseOptions { records?: any[]; tombstones?: any[]; checkpoint?: string; feeds?: any[]; last?: boolean; state?: Record; } export class DataBridgeResponse { records: any[]; tombstones: any[]; checkpoint: string; feeds: any[]; last: boolean; state: Record; constructor({ records = [], tombstones = [], checkpoint = '', feeds = [], last = false, state = {}, }: DataBridgeResponseOptions = {}) { this.records = records; this.tombstones = tombstones; this.checkpoint = checkpoint; this.feeds = feeds; this.last = last; this.state = state; } } export interface DataBridgeRequest { parameters: { streamName: string; state: any; checkpoint: string; backfill: boolean; connectionId: string; }; } export class DataBridgeRateLimitError extends Error { waitTimeInSeconds: number; constructor(message: string, waitTimeInSeconds: number) { const jsonMessage = JSON.stringify({ message, waitTimeInSeconds, }); super(jsonMessage); this.name = 'RateLimitError'; this.waitTimeInSeconds = waitTimeInSeconds; } }