import type { Instrumentation } from "./instrument/types.js"; import type { Sampler } from "./sampler.js"; export type SpanwiseConfig = { apiKey?: string; baseUrl?: string; timeout?: number; retries?: number; serviceName?: string; instrumentations?: Instrumentation[]; /** * Sampler for tracing. Default: parentBasedSampler with 100% root sampling. * @example * // 10% sampling for new traces, respect parent decisions * sampler: parentBasedSampler({ root: traceIdRatioSampler(0.1) }) */ sampler?: Sampler; /** * Explicitly enable/disable the SDK. When false, all methods are no-ops. * Useful for test environments: `enabled: process.env.NODE_ENV !== 'test'` * Default: true if apiKey is provided, false otherwise. */ enabled?: boolean; }; export type { Instrumentation }; export type Project = { id: string; name: string; slug: string; orgId: string; timezone: string; createdAt: string; updatedAt: string; }; export type CreateProjectInput = { name: string; slug: string; orgId: string; timezone?: string; }; export type UpdateProjectInput = { name?: string; timezone?: string; }; export type CheckStatus = "NEW" | "UP" | "LATE" | "DOWN" | "PAUSED"; export type ScheduleType = "PERIOD" | "CRON"; export type Check = { id: string; projectId: string; name: string; slug: string | null; scheduleType: ScheduleType; scheduleValue: string; graceSeconds: number; timezone: string | null; status: CheckStatus; lastPingAt: string | null; nextExpectedAt: string | null; alertOnRecovery: boolean; reminderIntervalHours: number | null; channelIds: string[]; createdAt: string; updatedAt: string; }; export type CreateCheckInput = { name: string; slug?: string; scheduleType: ScheduleType; scheduleValue: string; graceSeconds?: number; timezone?: string; alertOnRecovery?: boolean; reminderIntervalHours?: number; }; export type UpdateCheckInput = Partial & { channelIds?: string[]; }; export type ChannelType = "EMAIL" | "SLACK_WEBHOOK" | "SLACK_APP" | "DISCORD" | "PAGERDUTY" | "OPSGENIE" | "WEBHOOK"; export type EmailChannelConfig = { email: string; }; export type SlackWebhookChannelConfig = { webhookUrl: string; }; export type SlackAppChannelConfig = { accessToken: string; channelId: string; webhookUrl?: string; }; export type DiscordChannelConfig = { webhookUrl: string; }; export type PagerDutyChannelConfig = { routingKey: string; }; export type OpsgenieChannelConfig = { apiKey: string; region?: "us" | "eu"; }; export type WebhookChannelConfig = { url: string; secret?: string; }; export type ChannelConfig = EmailChannelConfig | SlackWebhookChannelConfig | SlackAppChannelConfig | DiscordChannelConfig | PagerDutyChannelConfig | OpsgenieChannelConfig | WebhookChannelConfig; export type Channel = { id: string; projectId: string; type: ChannelType; name: string; config: ChannelConfig; createdAt: string; updatedAt: string; }; export type CreateChannelInput = { type: "EMAIL"; name: string; config: EmailChannelConfig; } | { type: "SLACK_WEBHOOK"; name: string; config: SlackWebhookChannelConfig; } | { type: "SLACK_APP"; name: string; config: SlackAppChannelConfig; } | { type: "DISCORD"; name: string; config: DiscordChannelConfig; } | { type: "PAGERDUTY"; name: string; config: PagerDutyChannelConfig; } | { type: "OPSGENIE"; name: string; config: OpsgenieChannelConfig; } | { type: "WEBHOOK"; name: string; config: WebhookChannelConfig; }; export type UpdateChannelInput = { name?: string; config?: ChannelConfig; }; export type Organization = { id: string; name: string; slug: string; plan: string; trialEndsAt: string | null; createdAt: string; updatedAt: string; }; export type CreateOrganizationInput = { name: string; slug: string; }; export type UpdateOrganizationInput = { name?: string; }; export type ApiKey = { id: string; projectId: string; name: string; prefix: string; createdAt: string; lastUsedAt: string | null; }; export type ApiKeyCreated = ApiKey & { key: string; }; export type CreateApiKeyInput = { name: string; }; export type UptimeDay = { date: string; upPercent: number; upMinutes: number; downMinutes: number; totalPings: number; }; export type CheckStats = { checkId: string; days: UptimeDay[]; }; export type PingOptions = { type?: "success" | "start" | "fail"; body?: string; }; export type WrapOptions = { /** Send START ping before execution to track duration. Default: false */ trackDuration?: boolean; }; export type SpanKind = "server" | "client" | "internal" | "producer" | "consumer"; export type SpanOptions = { kind?: SpanKind; attributes?: Record; /** Parent span context for distributed tracing */ parent?: SpanContext; /** Mark this span as an intentional root span (no parent expected) */ root?: boolean; }; export type TraceOptions = { kind?: SpanKind; attributes?: Record; /** Parent span context for distributed tracing */ parent?: SpanContext; /** Mark this trace as an intentional root (no parent expected) */ root?: boolean; }; export type SpanContext = { traceId: string; spanId: string; /** Whether this context came from a remote service */ isRemote?: boolean; /** Whether this span was sampled */ sampled?: boolean; }; export type SpanInterface = { spanId: string; traceId: string; name: string; end: (options?: { error?: Error; }) => void; setAttributes: (attrs: Record) => void; updateName: (name: string) => void; context: () => SpanContext; }; export type PaginationParams = { page?: number; limit?: number; }; export type PaginatedResponse = { data: T[]; total: number; page: number; limit: number; totalPages: number; }; /** * Creates an async generator that iterates through all pages of a paginated endpoint. * @example * for await (const project of paginate(params => client.projects.list(params))) { * console.log(project.name) * } */ export declare function paginate(fetcher: (params: PaginationParams) => Promise>, params?: Omit): AsyncGenerator; /** * Fetches all items from a paginated endpoint into an array. * @example * const allProjects = await fetchAll(params => client.projects.list(params)) */ export declare function fetchAll(fetcher: (params: PaginationParams) => Promise>, params?: Omit): Promise; //# sourceMappingURL=types.d.ts.map