UNPKG

probot

Version:

A framework for building GitHub Apps to automate and improve your workflow

69 lines (68 loc) • 2.85 kB
import type { RequestRequestOptions } from "@octokit/types"; import { createNodeMiddleware, type EmitterWebhookEvent as WebhookEvent } from "@octokit/webhooks"; import type { Logger } from "pino"; import { Lru } from "toad-cache"; import { type DeferredPromise } from "./helpers/create-deferred-promise.js"; import { ProbotOctokit } from "./octokit/probot-octokit.js"; import type { ApplicationFunction, ApplicationFunctionOptions, Options, ProbotWebhooks, RedisOptions } from "./types.js"; import { type Server } from "./server/server.js"; declare const UNINITIALIZED = 0; declare const INITIALIZING = 1; declare const INITIALIZED = 2; type InitializationState = typeof UNINITIALIZED | typeof INITIALIZING | typeof INITIALIZED; type OnHandler = [ "on", Parameters<ProbotWebhooks["on"]>[1], Parameters<ProbotWebhooks["on"]>[0] ]; type OnAnyHandler = ["onAny", Parameters<ProbotWebhooks["onAny"]>[0]]; type OnErrorHandler = ["onError", Parameters<ProbotWebhooks["onError"]>[0]]; export type State = { initializationState: InitializationState; initializedPromise: DeferredPromise<void>; initEventListeners: (OnHandler | OnAnyHandler | OnErrorHandler)[]; cache: Lru<string> | null; octokit: ProbotOctokit | null; webhooks: ProbotWebhooks | null; log: Logger | null; getLog: NonNullable<Options["getLog"]>; logFormat?: NonNullable<Options["logFormat"]>; logLevelInString?: boolean; sentryDsn?: string | undefined; logLevel?: NonNullable<Options["logLevel"]>; logMessageKey?: string | undefined; appId?: number | undefined; privateKey?: string | undefined; githubToken?: string | undefined; OctokitBase: typeof ProbotOctokit; port?: number | undefined; host?: string | undefined; baseUrl?: string | undefined; redisConfig?: RedisOptions | string | undefined; webhookPath: string; webhookSecret: string; request?: RequestRequestOptions | undefined; server?: Server | void; }; export declare class Probot { #private; static defaults<S extends typeof Probot>(this: S, defaults: Options): S; constructor(options?: Options); getNodeMiddleware({ log, path, }?: { log?: Logger | undefined; path?: string | undefined; }): Promise<ReturnType<typeof createNodeMiddleware>>; auth(installationId?: number | undefined): Promise<ProbotOctokit>; load(appFn: ApplicationFunction | ApplicationFunction[], options?: Partial<ApplicationFunctionOptions>): Promise<void>; get log(): Logger; on: ProbotWebhooks["on"]; onAny: ProbotWebhooks["onAny"]; onError: ProbotWebhooks["onError"]; ready(): Promise<this>; receive(event: WebhookEvent): Promise<void>; static get version(): string; get version(): string; get webhooks(): ProbotWebhooks; get webhookPath(): string; } export {};