1 | import express from "express";
|
2 | import type { EmitterWebhookEvent as WebhookEvent, Webhooks } from "@octokit/webhooks";
|
3 | import type { LRUCache } from "lru-cache";
|
4 | import type { RedisOptions } from "ioredis";
|
5 | import type { Options as LoggingOptions } from "pino-http";
|
6 | import { Probot } from "./index.js";
|
7 | import { Context } from "./context.js";
|
8 | import { ProbotOctokit } from "./octokit/probot-octokit.js";
|
9 | import type { Logger } from "pino";
|
10 | import type { RequestRequestOptions } from "@octokit/types";
|
11 | export interface Options {
|
12 | privateKey?: string;
|
13 | githubToken?: string;
|
14 | appId?: number | string;
|
15 | Octokit?: typeof ProbotOctokit;
|
16 | log?: Logger;
|
17 | redisConfig?: RedisOptions | string;
|
18 | secret?: string;
|
19 | logLevel?: "trace" | "debug" | "info" | "warn" | "error" | "fatal";
|
20 | logMessageKey?: string;
|
21 | port?: number;
|
22 | host?: string;
|
23 | baseUrl?: string;
|
24 | request?: RequestRequestOptions;
|
25 | webhookPath?: string;
|
26 | }
|
27 | export type State = {
|
28 | appId?: number;
|
29 | privateKey?: string;
|
30 | githubToken?: string;
|
31 | log: Logger;
|
32 | Octokit: typeof ProbotOctokit;
|
33 | octokit: ProbotOctokit;
|
34 | cache?: LRUCache<number, string>;
|
35 | webhooks: {
|
36 | secret?: string;
|
37 | };
|
38 | port?: number;
|
39 | host?: string;
|
40 | baseUrl?: string;
|
41 | webhookPath: string;
|
42 | request?: RequestRequestOptions;
|
43 | };
|
44 | type SimplifiedObject = Omit<Context, keyof WebhookEvent>;
|
45 | export type ProbotWebhooks = Webhooks<SimplifiedObject>;
|
46 | export type ApplicationFunctionOptions = {
|
47 | getRouter?: (path?: string) => express.Router;
|
48 | cwd?: string;
|
49 | [key: string]: unknown;
|
50 | };
|
51 | export type ApplicationFunction = (app: Probot, options: ApplicationFunctionOptions) => void | Promise<void>;
|
52 | export type ServerOptions = {
|
53 | cwd?: string;
|
54 | log?: Logger;
|
55 | port?: number;
|
56 | host?: string;
|
57 | webhookPath?: string;
|
58 | webhookProxy?: string;
|
59 | Probot: typeof Probot;
|
60 | loggingOptions?: LoggingOptions;
|
61 | request?: RequestRequestOptions;
|
62 | };
|
63 | export type MiddlewareOptions = {
|
64 | probot: Probot;
|
65 | webhooksPath?: string;
|
66 | [key: string]: unknown;
|
67 | };
|
68 | export type OctokitOptions = NonNullable<ConstructorParameters<typeof ProbotOctokit>[0]>;
|
69 | export type PackageJson = {
|
70 | name?: string;
|
71 | version?: string;
|
72 | description?: string;
|
73 | homepage?: string;
|
74 | repository?: string;
|
75 | engines?: {
|
76 | [key: string]: string;
|
77 | };
|
78 | };
|
79 | export type Env = Record<Uppercase<string>, string>;
|
80 | type ManifestPermissionValue = "read" | "write" | "none";
|
81 | type ManifestPermissionScope = "actions" | "checks" | "contents" | "deployments" | "id-token" | "issues" | "discussions" | "packages" | "pages" | "pull-requests" | "repository-projects" | "security-events" | "statuses";
|
82 | export type Manifest = {
|
83 | |
84 |
|
85 |
|
86 | name?: string;
|
87 | |
88 |
|
89 |
|
90 | url: string;
|
91 | |
92 |
|
93 |
|
94 | hook_attributes?: {
|
95 | url: string;
|
96 | active?: boolean;
|
97 | };
|
98 | |
99 |
|
100 |
|
101 | redirect_url?: string;
|
102 | |
103 |
|
104 |
|
105 | callback_urls?: string[];
|
106 | |
107 |
|
108 |
|
109 | setup_url?: string;
|
110 | |
111 |
|
112 |
|
113 | description?: string;
|
114 | |
115 |
|
116 |
|
117 | public?: boolean;
|
118 | |
119 |
|
120 |
|
121 | default_events?: WebhookEvent[];
|
122 | |
123 |
|
124 |
|
125 | default_permissions?: "read-all" | "write-all" | Record<ManifestPermissionScope, ManifestPermissionValue>;
|
126 | |
127 |
|
128 |
|
129 | request_oauth_on_install?: boolean;
|
130 | |
131 |
|
132 |
|
133 | setup_on_update?: boolean;
|
134 | };
|
135 | export {};
|