-
Notifications
You must be signed in to change notification settings - Fork 950
/
types.ts
81 lines (72 loc) · 1.95 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import express from "express";
import { WebhookEvent, Webhooks } from "@octokit/webhooks";
import LRUCache from "lru-cache";
import Redis from "ioredis";
import { Probot } from "./index";
import { Context } from "./context";
import { ProbotOctokit } from "./octokit/probot-octokit";
import { Application } from "./application";
import type { Logger, LogFn } from "pino";
export interface Options {
// same options as Application class
privateKey?: string;
githubToken?: string;
id?: number;
Octokit?: typeof ProbotOctokit;
log?: Logger;
redisConfig?: Redis.RedisOptions | string;
secret?: string;
webhookPath?: string;
logLevel?: "trace" | "debug" | "info" | "warn" | "error" | "fatal";
port?: number;
host?: string;
webhookProxy?: string;
baseUrl?: string;
// Probot class-specific options
/**
* @deprecated `cert` options is deprecated. Use `privateKey` instead
*/
cert?: string;
/**
* @deprecated set `Octokit` to `ProbotOctokit.defaults({ throttle })` instead
*/
throttleOptions?: any;
}
export type State = {
id?: number;
privateKey?: string;
githubToken?: string;
log: Logger;
Octokit: typeof ProbotOctokit;
octokit: InstanceType<typeof ProbotOctokit>;
cache?: LRUCache<number, string>;
webhooks: {
path?: string;
secret?: string;
};
port?: number;
host?: string;
webhookProxy?: string;
webhookPath?: string;
baseUrl?: string;
};
export type ProbotWebhooks = Webhooks<
WebhookEvent,
Omit<Context, keyof WebhookEvent>
>;
export type DeprecatedLogger = LogFn & Logger;
type deprecatedKeys =
| "router"
| "log"
| "on"
| "receive"
| "load"
| "route"
| "auth";
export type ApplicationFunctionOptions = {
/**
* @deprecated "(app) => {}" is deprecated. Use "({ app }) => {}" instead.
*/
[K in deprecatedKeys]: Application[K];
} & { app: Probot; getRouter: (path?: string) => express.Router };
export type ApplicationFunction = (options: ApplicationFunctionOptions) => void;