|
1
|
|
|
// Generated by dts-bundle-generator v7.1.0 |
|
2
|
|
|
|
|
3
|
|
|
import { SimpleGit } from 'simple-git'; |
|
4
|
|
|
import { Logger } from 'winston'; |
|
5
|
|
|
|
|
6
|
|
|
export type LogTarget = 'console' | 'file'; |
|
7
|
|
|
declare class HasLogger { |
|
8
|
|
|
logger: Logger; |
|
9
|
|
|
createLogger(targets: LogTarget[], defaultMeta: Record<string, any>): void; |
|
10
|
|
|
log(message: string, meta?: any[]): void; |
|
11
|
|
|
} |
|
12
|
|
|
export interface AppSettings { |
|
13
|
|
|
github_token: string; |
|
14
|
|
|
repository_storage_path: string; |
|
15
|
|
|
boosts_path: string; |
|
16
|
|
|
use_forks: boolean; |
|
17
|
|
|
use_pull_requests: boolean; |
|
18
|
|
|
log_target: LogTarget | LogTarget[]; |
|
19
|
|
|
dry_run?: boolean; |
|
20
|
|
|
auto_merge_pull_requests?: boolean; |
|
21
|
|
|
} |
|
22
|
|
|
export type BoostHistory = BoostHistoryItem[]; |
|
23
|
|
|
declare enum BoostHistoryItemState { |
|
24
|
|
|
SUCCEEDED = 'succeeded', |
|
25
|
|
|
FAILED = 'failed', |
|
26
|
|
|
RUNNING = 'running', |
|
27
|
|
|
SKIPPED = 'skipped', |
|
28
|
|
|
UNKNOWN = 'unknown', |
|
29
|
|
|
} |
|
30
|
|
|
export interface BoostHistoryItem { |
|
31
|
|
|
run_id: string; |
|
32
|
|
|
boost: string; |
|
33
|
|
|
version: string; |
|
34
|
|
|
repository: string; |
|
35
|
|
|
pull_request: number | null; |
|
36
|
|
|
state: BoostHistoryItemState; |
|
37
|
|
|
started_at: string; |
|
38
|
|
|
finished_at: string | null; |
|
39
|
|
|
[key: string]: any; |
|
40
|
|
|
} |
|
41
|
|
|
export interface RepositoryInfo { |
|
42
|
|
|
owner: string; |
|
43
|
|
|
name: string; |
|
44
|
|
|
} |
|
45
|
|
|
declare class Repository { |
|
46
|
|
|
name: string; |
|
47
|
|
|
owner: string; |
|
48
|
|
|
path: string; |
|
49
|
|
|
gitInstance: SimpleGit; |
|
50
|
|
|
get info(): RepositoryInfo; |
|
51
|
|
|
get git(): SimpleGit; |
|
52
|
|
|
initGitListeners(runId: string): void; |
|
53
|
|
|
constructor(fullRepositoryName: string, repositoryStoragePath: string); |
|
54
|
|
|
clone(): Promise<boolean>; |
|
55
|
|
|
prepare(): Promise<void>; |
|
56
|
|
|
localBranches(): Promise<import('simple-git').BranchSummary>; |
|
57
|
|
|
currentBranch(): Promise<string>; |
|
58
|
|
|
onBranch(branchName: string): Promise<boolean>; |
|
59
|
|
|
checkout(branchName: string): Promise<void>; |
|
60
|
|
|
defaultBranch(): Promise<string>; |
|
61
|
|
|
createFork(): Promise<void>; |
|
62
|
|
|
pushToFork(branchName: string): Promise<void>; |
|
63
|
|
|
fullRepositoryName(): string; |
|
64
|
|
|
} |
|
65
|
|
|
export type OnFileCopiedCallback = (src: string, dest: string) => void; |
|
66
|
|
|
declare class Tools { |
|
67
|
|
|
sleep(ms: number): Promise<unknown>; |
|
68
|
|
|
fileexists(path: string): boolean; |
|
69
|
|
|
readfile(path: string): string; |
|
70
|
|
|
writefile(path: string, content: string): void; |
|
71
|
|
|
copyfile(src: string, dest: string): string; |
|
72
|
|
|
hashfile(path: string): string; |
|
73
|
|
|
hashstring(str: string): string; |
|
74
|
|
|
filesAreEqual(file1: string, file2: string): boolean; |
|
75
|
|
|
readYaml(path: string): any; |
|
76
|
|
|
writeYaml(path: string, data: any): void; |
|
77
|
|
|
readJson(path: string): any; |
|
78
|
|
|
writeJson(path: string, data: any): void; |
|
79
|
|
|
exec(command: string, silent?: boolean): string; |
|
80
|
|
|
recursiveDirectoryCopy(src: string, dest: string, onCopiedCallback?: OnFileCopiedCallback | null): string[]; |
|
81
|
|
|
protected handleDirectoriesForDirectoryCopy({ stats, srcFn, destFn, handler }: { stats: any; srcFn: any; destFn: any; handler: any }): void; |
|
82
|
|
|
protected handleFilesForDirectoryCopy({ |
|
83
|
|
|
stats, |
|
84
|
|
|
srcFn, |
|
85
|
|
|
destFn, |
|
86
|
|
|
files, |
|
87
|
|
|
onCopiedCallback, |
|
88
|
|
|
}: { |
|
89
|
|
|
stats: any; |
|
90
|
|
|
srcFn: any; |
|
91
|
|
|
destFn: any; |
|
92
|
|
|
files: any; |
|
93
|
|
|
onCopiedCallback: any; |
|
94
|
|
|
}): void; |
|
95
|
|
|
} |
|
96
|
|
|
export interface BoostConfiguration { |
|
97
|
|
|
id: string; |
|
98
|
|
|
version: string; |
|
99
|
|
|
repository_limits: { |
|
100
|
|
|
max_runs_per_version: number; |
|
101
|
|
|
minutes_between_runs: number; |
|
102
|
|
|
}; |
|
103
|
|
|
pull_request: { |
|
104
|
|
|
title: string; |
|
105
|
|
|
body: string; |
|
106
|
|
|
branch: string; |
|
107
|
|
|
}; |
|
108
|
|
|
scripts: { |
|
109
|
|
|
parallel: boolean; |
|
110
|
|
|
files: string[]; |
|
111
|
|
|
}; |
|
112
|
|
|
} |
|
113
|
|
|
export interface BoostScriptHandlerParameters { |
|
114
|
|
|
args: any[]; |
|
115
|
|
|
boost: Boost; |
|
116
|
|
|
currentRun: BoostHistoryItem; |
|
117
|
|
|
git: SimpleGit; |
|
118
|
|
|
libs: { |
|
119
|
|
|
fs: typeof import('fs'); |
|
120
|
|
|
path: typeof import('path'); |
|
121
|
|
|
semver: typeof import('semver'); |
|
122
|
|
|
}; |
|
123
|
|
|
repository: Repository; |
|
124
|
|
|
tools: Tools; |
|
125
|
|
|
} |
|
126
|
|
|
declare class Boost { |
|
127
|
|
|
protected codeBoost: CodeBoost; |
|
128
|
|
|
protected repository: Repository | null; |
|
129
|
|
|
config: BoostConfiguration; |
|
130
|
|
|
path: string; |
|
131
|
|
|
id: string; |
|
132
|
|
|
version: string; |
|
133
|
|
|
repositoryLimits: { |
|
134
|
|
|
maxRunsPerVersion: number; |
|
135
|
|
|
minutesBetweenRuns: number; |
|
136
|
|
|
}; |
|
137
|
|
|
pullRequest: { |
|
138
|
|
|
title: string; |
|
139
|
|
|
body: string; |
|
140
|
|
|
branch: string; |
|
141
|
|
|
}; |
|
142
|
|
|
scripts: any[]; |
|
143
|
|
|
actions: any[]; |
|
144
|
|
|
state: Record<string, any>; |
|
145
|
|
|
changedFiles: string[]; |
|
146
|
|
|
runId: string; |
|
147
|
|
|
constructor(codeBoost: CodeBoost, boostPath: string); |
|
148
|
|
|
init(boostPath: string): void; |
|
149
|
|
|
get appSettings(): AppSettings; |
|
150
|
|
|
get history(): BoostHistory; |
|
151
|
|
|
log(message: any): void; |
|
152
|
|
|
loadConfiguration(boostPath: string): BoostConfiguration; |
|
153
|
|
|
loadPullRequest(pullRequest: Record<string, any>): { |
|
154
|
|
|
title: any; |
|
155
|
|
|
body: any; |
|
156
|
|
|
branch: string; |
|
157
|
|
|
}; |
|
158
|
|
|
loadScripts(scripts: string[]): any[]; |
|
159
|
|
|
run(repository: Repository, args?: any[]): Promise<false | undefined>; |
|
160
|
|
|
handlePullRequestCreation({ repository, historyItem }: { repository: any; historyItem: any }): Promise<void>; |
|
161
|
|
|
createScriptHandlerParameters(args: any[], historyItem: BoostHistoryItem): Promise<BoostScriptHandlerParameters>; |
|
162
|
|
|
runInitializationScript(params: BoostScriptHandlerParameters): Promise<void>; |
|
163
|
|
|
checkoutPullRequestBranch(): Promise<void>; |
|
164
|
|
|
updatePullRequestBranchName(): Promise<boolean>; |
|
165
|
|
|
runScripts(params: BoostScriptHandlerParameters): Promise<void>; |
|
166
|
|
|
canRunOnRepository(repo: Repository | string): boolean; |
|
167
|
|
|
protected isRunTimeRestricted(runs: BoostHistoryItem[]): boolean; |
|
168
|
|
|
} |
|
169
|
|
|
declare class HistoryManager { |
|
170
|
|
|
filename: string; |
|
171
|
|
|
data: BoostHistory; |
|
172
|
|
|
constructor(filename: string); |
|
173
|
|
|
for(boostName: string): BoostHistory; |
|
174
|
|
|
createEntry(item: BoostHistoryItem): BoostHistoryItem; |
|
175
|
|
|
save(): void; |
|
176
|
|
|
load(): void; |
|
177
|
|
|
} |
|
178
|
|
|
declare const CodeBoost_base: import('ts-mixer/dist/types/types').Class<any[], HasLogger, typeof HasLogger, false>; |
|
179
|
|
|
export declare class CodeBoost extends CodeBoost_base { |
|
180
|
|
|
protected repository: Repository; |
|
181
|
|
|
appSettings: AppSettings; |
|
182
|
|
|
historyManager: HistoryManager; |
|
183
|
|
|
repositoryPrepared: boolean; |
|
184
|
|
|
constructor(appSettings: AppSettings, historyManager: HistoryManager); |
|
185
|
|
|
init(repository: Repository, appSettings: AppSettings): Promise<void>; |
|
186
|
|
|
prepareRepository(): Promise<void>; |
|
187
|
|
|
runBoost(boost: string | Boost, args: string[]): Promise<Boost>; |
|
188
|
|
|
getBoost(boostName: string): Boost; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
export {}; |
|
192
|
|
|
|