import { type WorkloadToken } from "./lib/workload-credentials.js"; import type { RequestInit, RequestInfo } from "./internal/builtin-types.js"; import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from "./internal/types.js"; export type { Logger, LogLevel } from "./internal/utils/log.js"; import * as Opts from "./internal/request-options.js"; import * as Errors from "./core/error.js"; import * as Pagination from "./core/pagination.js"; import { type ItemsParams, ItemsResponse } from "./core/pagination.js"; import * as Uploads from "./core/uploads.js"; import * as API from "./resources/index.js"; import { APIPromise } from "./core/api-promise.js"; import { Analytics, AnalyticsGetInstancesParams, AnalyticsGetParams, AnalyticsTimeFilter, AnalyticsInstancesResponse, AnalyticsResponse } from "./resources/analytics.js"; import { AndroidInstance, AndroidInstanceUpdateParams, AndroidInstanceCreateParams, AndroidInstanceListParams, AndroidInstancesItems } from "./resources/android-instances.js"; import { AndroidInstances } from "./resources/android-instances-helpers.js"; import { Asset, AssetGetOrCreateParams, AssetGetOrCreateResponse, AssetListParams, AssetListResponse } from "./resources/assets.js"; import { Assets, AssetGetOrUploadParams, AssetGetOrUploadResponse } from "./resources/assets-helpers.js"; import { GradleInstance, GradleInstanceUpdateParams, GradleInstanceCreateParams, GradleInstanceListParams, GradleInstances, GradleInstancesItems } from "./resources/gradle-instances.js"; import { MacosInstance, MacosInstanceUpdateParams, MacosInstanceCreateParams, MacosInstanceListParams, MacosInstances, MacosInstancesItems } from "./resources/macos-instances.js"; import { IosInstance, IosInstanceUpdateParams, IosInstanceCreateParams, IosInstanceListParams, IosInstancesItems } from "./resources/ios-instances.js"; import { IosInstances } from "./resources/ios-instances-helpers.js"; import { SessionArtifact } from "./resources/session-artifacts.js"; import { AccessToken, AccessTokenCreateParams, AccessTokenRevokeResponse, AccessTokens } from "./resources/access-tokens.js"; import { ScopedToken, ScopedTokenCreateParams, ScopedTokens } from "./resources/scoped-tokens.js"; import { XcodeInstance, XcodeInstanceUpdateParams, XcodeInstanceCreateParams, XcodeInstanceListParams, XcodeInstancesItems } from "./resources/xcode-instances.js"; import { XcodeInstances, XcodeCreateClientParams, XcodeClient, XcodeProjectConfig, XcodeBuildOptions, XcodeRunOptions, ReactNativeBuildConfig, SimulatorAttachResult, SimulatorStatus, SimulatorBuildStatus, SimulatorAttachment, SimulatorDeviceInfo, SimulatorInstallState, XcodeInfo, XcodeStatus, XcodeSelectResult, SandboxInfo, XcodeBuildLog, BazelBuildLog } from "./resources/xcode-instances-helpers.js"; import { type Fetch } from "./internal/builtin-types.js"; import { HeadersLike, NullableHeaders } from "./internal/headers.js"; import { FinalRequestOptions, RequestOptions } from "./internal/request-options.js"; import { type LogLevel, type Logger } from "./internal/utils/log.js"; export interface ClientOptions { /** * Workload JWT from your identity provider, or a function that returns the current one. A string is * exchanged as is on every renewal, so pass a function when the JWT expires before the client is done. * Takes precedence over workloadTokenFile. Defaults to LIMRUN_WORKLOAD_IDENTITY_TOKEN. Null disables discovery. */ workloadToken?: WorkloadToken | null; /** Projected workload JWT file. Defaults to LIMRUN_WORKLOAD_IDENTITY_TOKEN_FILE. Null disables discovery. */ workloadTokenFile?: string | null; /** * Exchange without sending a JWT, for platforms whose egress proxy adds it to requests for the token * service in the X-Limrun-Subject-Token header, so the workload never handles it. Requires bindingId * and cannot be combined with workloadToken or workloadTokenFile. * Defaults to LIMRUN_WORKLOAD_IDENTITY_TOKEN_INJECTED=true. Null disables discovery. */ workloadTokenInjected?: boolean | null; /** Customer federation binding ID. Defaults to LIMRUN_WORKLOAD_IDENTITY_BINDING_ID. */ bindingId?: string | null; /** Token service base URL. Federation defaults to https://sts.limrun.com. */ stsBaseURL?: string; /** * Defaults to process.env['LIM_API_KEY']. */ apiKey?: string | null | undefined; /** * Identify your application before the SDK's default User-Agent, for example "my-app/1.0". * Explicit User-Agent headers in defaultHeaders or request options override this value. */ userAgent?: string | undefined; /** * Override the default base URL for the API, e.g., "https://api.example.com/v2/" * * Defaults to process.env['LIMRUN_BASE_URL']. */ baseURL?: string | null | undefined; /** * The maximum amount of time (in milliseconds) that the client should wait for a response * from the server before timing out a single request. * * Note that request timeouts are retried by default, so in a worst-case scenario you may wait * much longer than this timeout before the promise succeeds or fails. * * @unit milliseconds */ timeout?: number | undefined; /** * Additional `RequestInit` options to be passed to `fetch` calls. * Properties will be overridden by per-request `fetchOptions`. */ fetchOptions?: MergedRequestInit | undefined; /** * Specify a custom `fetch` function implementation. * * If not provided, we expect that `fetch` is defined globally. */ fetch?: Fetch | undefined; /** * The maximum number of times that the client will retry a request in case of a * temporary failure, like a network error or a 5XX error from the server. * * @default 2 */ maxRetries?: number | undefined; /** * Default headers to include with every request to the API. * * These can be removed in individual requests by explicitly setting the * header to `null` in request options. */ defaultHeaders?: HeadersLike | undefined; /** * Default query parameters to include with every request to the API. * * These can be removed in individual requests by explicitly setting the * param to `undefined` in request options. */ defaultQuery?: Record | undefined; /** * Set the log level. * * Defaults to process.env['LIMRUN_LOG'] or 'warn' if it isn't set. */ logLevel?: LogLevel | undefined; /** * Set the logger. * * Defaults to globalThis.console. */ logger?: Logger | undefined; } /** * API Client for interfacing with the Limrun API. */ export declare class Limrun { #private; apiKey: string | null; baseURL: string; maxRetries: number; timeout: number; logger: Logger; logLevel: LogLevel | undefined; fetchOptions: MergedRequestInit | undefined; private fetch; private workloadCredentials?; protected idempotencyHeader?: string; private _options; /** * API Client for interfacing with the Limrun API. * * @param {string | null | undefined} [opts.apiKey=process.env['LIM_API_KEY'] ?? null] * @param {string} [opts.userAgent] - Application identifier prepended to the SDK's default User-Agent. * @param {string} [opts.baseURL=process.env['LIMRUN_BASE_URL'] ?? https://api.limrun.com] - Override the default base URL for the API. * @param {number} [opts.timeout=5 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls. * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API. * @param {Record} opts.defaultQuery - Default query parameters to include with every request to the API. */ constructor({ baseURL, apiKey, ...opts }?: ClientOptions); /** * Create a new client instance re-using the same options given to the current client with optional overriding. */ withOptions(options: Partial): this; protected defaultQuery(): Record | undefined; protected validateHeaders({ values, nulls }: NullableHeaders): void; protected authHeaders(opts: FinalRequestOptions): Promise; /** * Basic re-implementation of `qs.stringify` for primitive types. */ protected stringifyQuery(query: object | Record): string; private getUserAgent; protected defaultIdempotencyKey(): string; protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError; buildURL(path: string, query: Record | null | undefined, defaultBaseURL?: string | undefined): string; /** * Used as a callback for mutating the given `FinalRequestOptions` object. */ protected prepareOptions(options: FinalRequestOptions): Promise; /** * Used as a callback for mutating the given `RequestInit` object. * * This is useful for cases where you want to add certain headers based off of * the request properties, e.g. `method` or `url`. */ protected prepareRequest(request: RequestInit, { url, options }: { url: string; options: FinalRequestOptions; }): Promise; get(path: string, opts?: PromiseOrValue): APIPromise; post(path: string, opts?: PromiseOrValue): APIPromise; patch(path: string, opts?: PromiseOrValue): APIPromise; put(path: string, opts?: PromiseOrValue): APIPromise; delete(path: string, opts?: PromiseOrValue): APIPromise; private methodRequest; request(options: PromiseOrValue, remainingRetries?: number | null): APIPromise; private makeRequest; getAPIList = Pagination.AbstractPage>(path: string, Page: new (...args: any[]) => PageClass, opts?: PromiseOrValue): Pagination.PagePromise; requestAPIList = Pagination.AbstractPage>(Page: new (...args: ConstructorParameters) => PageClass, options: PromiseOrValue): Pagination.PagePromise; fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise; private shouldRetry; private retryRequest; private calculateDefaultRetryTimeoutMillis; buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: { retryCount?: number; }): Promise<{ req: FinalizedRequestInit; url: string; timeout: number; }>; private buildHeaders; private _makeAbort; private buildBody; static Limrun: typeof Limrun; static DEFAULT_TIMEOUT: number; static LimrunError: typeof Errors.LimrunError; static APIError: typeof Errors.APIError; static APIConnectionError: typeof Errors.APIConnectionError; static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError; static APIUserAbortError: typeof Errors.APIUserAbortError; static NotFoundError: typeof Errors.NotFoundError; static ConflictError: typeof Errors.ConflictError; static RateLimitError: typeof Errors.RateLimitError; static BadRequestError: typeof Errors.BadRequestError; static AuthenticationError: typeof Errors.AuthenticationError; static InternalServerError: typeof Errors.InternalServerError; static PermissionDeniedError: typeof Errors.PermissionDeniedError; static UnprocessableEntityError: typeof Errors.UnprocessableEntityError; static toFile: typeof Uploads.toFile; androidInstances: API.AndroidInstances; assets: API.Assets; secrets: API.Secrets; iosInstances: API.IosInstances; xcodeInstances: API.XcodeInstances; xcodeSnapshots: API.XcodeSnapshots; iosSnapshots: API.IOSSnapshots; gradleSnapshots: API.GradleSnapshots; gradleInstances: API.GradleInstances; supportTickets: API.SupportTickets; macosInstances: API.MacosInstances; analytics: API.Analytics; accessTokens: API.AccessTokens; /** @deprecated Use accessTokens. */ scopedTokens: API.ScopedTokens; } export declare namespace Limrun { export type RequestOptions = Opts.RequestOptions; export import Items = Pagination.Items; export { type ItemsParams as ItemsParams, type ItemsResponse as ItemsResponse }; export { AndroidInstances as AndroidInstances, type AndroidInstance as AndroidInstance, type AndroidInstancesItems as AndroidInstancesItems, type AndroidInstanceUpdateParams as AndroidInstanceUpdateParams, type AndroidInstanceCreateParams as AndroidInstanceCreateParams, type AndroidInstanceListParams as AndroidInstanceListParams, }; export { Assets as Assets, type Asset as Asset, type AssetListResponse as AssetListResponse, type AssetGetOrCreateResponse as AssetGetOrCreateResponse, type AssetListParams as AssetListParams, type AssetGetOrCreateParams as AssetGetOrCreateParams, type AssetGetOrUploadParams as AssetGetOrUploadParams, type AssetGetOrUploadResponse as AssetGetOrUploadResponse, }; export { IosInstances as IosInstances, type IosInstance as IosInstance, type IosInstancesItems as IosInstancesItems, type IosInstanceUpdateParams as IosInstanceUpdateParams, type IosInstanceCreateParams as IosInstanceCreateParams, type IosInstanceListParams as IosInstanceListParams, type SessionArtifact as SessionArtifact, }; export { XcodeInstances as XcodeInstances, type XcodeInstance as XcodeInstance, type XcodeInstancesItems as XcodeInstancesItems, type XcodeInstanceUpdateParams as XcodeInstanceUpdateParams, type XcodeInstanceCreateParams as XcodeInstanceCreateParams, type XcodeInstanceListParams as XcodeInstanceListParams, type XcodeCreateClientParams as XcodeCreateClientParams, type XcodeClient as XcodeClient, type XcodeProjectConfig as XcodeProjectConfig, type XcodeBuildOptions as XcodeBuildOptions, type XcodeRunOptions as XcodeRunOptions, type ReactNativeBuildConfig as ReactNativeBuildConfig, type SimulatorAttachResult as SimulatorAttachResult, type SimulatorStatus as SimulatorStatus, type SimulatorBuildStatus as SimulatorBuildStatus, type SimulatorAttachment as SimulatorAttachment, type SimulatorDeviceInfo as SimulatorDeviceInfo, type XcodeInfo as XcodeInfo, type XcodeStatus as XcodeStatus, type XcodeSelectResult as XcodeSelectResult, type SandboxInfo as SandboxInfo, type SimulatorInstallState as SimulatorInstallState, type XcodeBuildLog as XcodeBuildLog, type BazelBuildLog as BazelBuildLog, }; export { GradleInstances as GradleInstances, type GradleInstance as GradleInstance, type GradleInstancesItems as GradleInstancesItems, type GradleInstanceUpdateParams as GradleInstanceUpdateParams, type GradleInstanceCreateParams as GradleInstanceCreateParams, type GradleInstanceListParams as GradleInstanceListParams, }; export { MacosInstances as MacosInstances, type MacosInstance as MacosInstance, type MacosInstancesItems as MacosInstancesItems, type MacosInstanceUpdateParams as MacosInstanceUpdateParams, type MacosInstanceCreateParams as MacosInstanceCreateParams, type MacosInstanceListParams as MacosInstanceListParams, }; export { Analytics as Analytics, type AnalyticsInstancesResponse as AnalyticsInstancesResponse, type AnalyticsResponse as AnalyticsResponse, type AnalyticsTimeFilter as AnalyticsTimeFilter, type AnalyticsGetParams as AnalyticsGetParams, type AnalyticsGetInstancesParams as AnalyticsGetInstancesParams, }; export { AccessTokens as AccessTokens, type AccessToken as AccessToken, type AccessTokenCreateParams as AccessTokenCreateParams, type AccessTokenRevokeResponse, ScopedTokens as ScopedTokens, type ScopedToken as ScopedToken, type ScopedTokenCreateParams as ScopedTokenCreateParams, }; } //# sourceMappingURL=client.d.ts.map