@paklo/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/browser/defineProperty-ie4tC-F5.js +43 -0
- package/dist/browser/environment-DinhzwQn.js +139 -0
- package/dist/browser/environment-DinhzwQn.js.map +1 -0
- package/dist/browser/environment.d.ts +33 -0
- package/dist/browser/environment.js +3 -0
- package/dist/browser/github.d.ts +151 -0
- package/dist/browser/github.js +199 -0
- package/dist/browser/github.js.map +1 -0
- package/dist/browser/http.d.ts +121 -0
- package/dist/browser/http.js +248 -0
- package/dist/browser/http.js.map +1 -0
- package/dist/browser/logger-B7HLv660.js +31 -0
- package/dist/browser/logger-B7HLv660.js.map +1 -0
- package/dist/browser/logger.d.ts +23 -0
- package/dist/browser/logger.js +4 -0
- package/dist/browser/shared-data.d.ts +22 -0
- package/dist/browser/shared-data.js +23 -0
- package/dist/browser/shared-data.js.map +1 -0
- package/dist/browser/usage.d.ts +99 -0
- package/dist/browser/usage.js +383 -0
- package/dist/browser/usage.js.map +1 -0
- package/dist/node/azure.d.ts +338 -0
- package/dist/node/azure.js +735 -0
- package/dist/node/azure.js.map +1 -0
- package/dist/node/dependabot-BteoKZVy.js +547 -0
- package/dist/node/dependabot-BteoKZVy.js.map +1 -0
- package/dist/node/dependabot.d.ts +3 -0
- package/dist/node/dependabot.js +6 -0
- package/dist/node/environment-DX5CD-dD.js +138 -0
- package/dist/node/environment-DX5CD-dD.js.map +1 -0
- package/dist/node/environment.d.ts +33 -0
- package/dist/node/environment.js +3 -0
- package/dist/node/github.d.ts +2 -0
- package/dist/node/github.js +198 -0
- package/dist/node/github.js.map +1 -0
- package/dist/node/http-BG_-s47I.js +245 -0
- package/dist/node/http-BG_-s47I.js.map +1 -0
- package/dist/node/http.d.ts +121 -0
- package/dist/node/http.js +4 -0
- package/dist/node/index-3wZw74Ah.d.ts +151 -0
- package/dist/node/index-DP9JfUPG.d.ts +1761 -0
- package/dist/node/job-Crr4kh3e.js +451 -0
- package/dist/node/job-Crr4kh3e.js.map +1 -0
- package/dist/node/logger-bWnHxtAf.js +31 -0
- package/dist/node/logger-bWnHxtAf.js.map +1 -0
- package/dist/node/logger.d.ts +23 -0
- package/dist/node/logger.js +4 -0
- package/dist/node/shared-data.d.ts +22 -0
- package/dist/node/shared-data.js +23 -0
- package/dist/node/shared-data.js.map +1 -0
- package/dist/node/usage.d.ts +99 -0
- package/dist/node/usage.js +48 -0
- package/dist/node/usage.js.map +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { D as DependabotUpdatePullRequest, Yt as DependabotConfig, ft as DependabotDependency, gt as DependabotExistingPR, mt as DependabotExistingGroupPR, r as DependabotCreatePullRequest, t as DependabotClosePullRequest, yn as VariableFinderFn } from "./index-DP9JfUPG.js";
|
|
2
|
+
import "./index-3wZw74Ah.js";
|
|
3
|
+
import * as zod_v40 from "zod/v4";
|
|
4
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
5
|
+
|
|
6
|
+
//#region src/azure/types.d.ts
|
|
7
|
+
declare enum VersionControlChangeType {
|
|
8
|
+
None = 0,
|
|
9
|
+
Add = 1,
|
|
10
|
+
Edit = 2,
|
|
11
|
+
Encoding = 4,
|
|
12
|
+
Rename = 8,
|
|
13
|
+
Delete = 16,
|
|
14
|
+
Undelete = 32,
|
|
15
|
+
Branch = 64,
|
|
16
|
+
Merge = 128,
|
|
17
|
+
Lock = 256,
|
|
18
|
+
Rollback = 512,
|
|
19
|
+
SourceRename = 1024,
|
|
20
|
+
TargetRename = 2048,
|
|
21
|
+
Property = 4096,
|
|
22
|
+
All = 8191,
|
|
23
|
+
}
|
|
24
|
+
declare enum GitPullRequestMergeStrategy {
|
|
25
|
+
NoFastForward = 1,
|
|
26
|
+
Squash = 2,
|
|
27
|
+
Rebase = 3,
|
|
28
|
+
RebaseMerge = 4,
|
|
29
|
+
}
|
|
30
|
+
declare enum CommentThreadStatus {
|
|
31
|
+
Unknown = 0,
|
|
32
|
+
Active = 1,
|
|
33
|
+
Fixed = 2,
|
|
34
|
+
WontFix = 3,
|
|
35
|
+
Closed = 4,
|
|
36
|
+
ByDesign = 5,
|
|
37
|
+
Pending = 6,
|
|
38
|
+
}
|
|
39
|
+
declare enum CommentType {
|
|
40
|
+
Unknown = 0,
|
|
41
|
+
Text = 1,
|
|
42
|
+
CodeChange = 2,
|
|
43
|
+
System = 3,
|
|
44
|
+
}
|
|
45
|
+
declare enum ItemContentType {
|
|
46
|
+
RawText = 0,
|
|
47
|
+
Base64Encoded = 1,
|
|
48
|
+
}
|
|
49
|
+
declare enum PullRequestAsyncStatus {
|
|
50
|
+
NotSet = 0,
|
|
51
|
+
Queued = 1,
|
|
52
|
+
Conflicts = 2,
|
|
53
|
+
Succeeded = 3,
|
|
54
|
+
RejectedByPolicy = 4,
|
|
55
|
+
Failure = 5,
|
|
56
|
+
}
|
|
57
|
+
declare enum PullRequestStatus {
|
|
58
|
+
NotSet = 0,
|
|
59
|
+
Active = 1,
|
|
60
|
+
Abandoned = 2,
|
|
61
|
+
Completed = 3,
|
|
62
|
+
All = 4,
|
|
63
|
+
}
|
|
64
|
+
interface IdentityRefWithVote {
|
|
65
|
+
id?: string;
|
|
66
|
+
displayName?: string;
|
|
67
|
+
uniqueName?: string;
|
|
68
|
+
url?: string;
|
|
69
|
+
imageUrl?: string;
|
|
70
|
+
vote?: number;
|
|
71
|
+
hasDeclined?: boolean;
|
|
72
|
+
isFlagged?: boolean;
|
|
73
|
+
isRequired?: boolean;
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/azure/models.d.ts
|
|
77
|
+
/**
|
|
78
|
+
* Pull request property names used to store metadata about the pull request.
|
|
79
|
+
* https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-request-properties
|
|
80
|
+
*/
|
|
81
|
+
declare const DEVOPS_PR_PROPERTY_MICROSOFT_GIT_SOURCE_REF_NAME = "Microsoft.Git.PullRequest.SourceRefName";
|
|
82
|
+
declare const DEVOPS_PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER = "Dependabot.PackageManager";
|
|
83
|
+
declare const DEVOPS_PR_PROPERTY_DEPENDABOT_DEPENDENCIES = "Dependabot.Dependencies";
|
|
84
|
+
/**
|
|
85
|
+
* File change
|
|
86
|
+
*/
|
|
87
|
+
interface IFileChange {
|
|
88
|
+
changeType: VersionControlChangeType;
|
|
89
|
+
path: string;
|
|
90
|
+
content: string;
|
|
91
|
+
encoding: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Pull request properties
|
|
95
|
+
*/
|
|
96
|
+
interface IPullRequestProperties {
|
|
97
|
+
id: number;
|
|
98
|
+
properties?: {
|
|
99
|
+
name: string;
|
|
100
|
+
value: string;
|
|
101
|
+
}[];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Pull request creation request
|
|
105
|
+
*/
|
|
106
|
+
interface ICreatePullRequest {
|
|
107
|
+
project: string;
|
|
108
|
+
repository: string;
|
|
109
|
+
source: {
|
|
110
|
+
commit: string;
|
|
111
|
+
branch: string;
|
|
112
|
+
};
|
|
113
|
+
target: {
|
|
114
|
+
branch: string;
|
|
115
|
+
};
|
|
116
|
+
author?: {
|
|
117
|
+
email: string;
|
|
118
|
+
name: string;
|
|
119
|
+
};
|
|
120
|
+
title: string;
|
|
121
|
+
description: string;
|
|
122
|
+
commitMessage: string;
|
|
123
|
+
autoComplete?: {
|
|
124
|
+
ignorePolicyConfigIds?: number[];
|
|
125
|
+
mergeStrategy?: GitPullRequestMergeStrategy;
|
|
126
|
+
};
|
|
127
|
+
assignees?: string[];
|
|
128
|
+
labels?: string[];
|
|
129
|
+
workItems?: string[];
|
|
130
|
+
changes: IFileChange[];
|
|
131
|
+
properties?: {
|
|
132
|
+
name: string;
|
|
133
|
+
value: string;
|
|
134
|
+
}[];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Pull request update request
|
|
138
|
+
*/
|
|
139
|
+
interface IUpdatePullRequest {
|
|
140
|
+
project: string;
|
|
141
|
+
repository: string;
|
|
142
|
+
pullRequestId: number;
|
|
143
|
+
commit: string;
|
|
144
|
+
author?: {
|
|
145
|
+
email: string;
|
|
146
|
+
name: string;
|
|
147
|
+
};
|
|
148
|
+
changes: IFileChange[];
|
|
149
|
+
skipIfDraft?: boolean;
|
|
150
|
+
skipIfCommitsFromAuthorsOtherThan?: string;
|
|
151
|
+
skipIfNotBehindTargetBranch?: boolean;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Pull request approval request
|
|
155
|
+
*/
|
|
156
|
+
interface IApprovePullRequest {
|
|
157
|
+
project: string;
|
|
158
|
+
repository: string;
|
|
159
|
+
pullRequestId: number;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Pull request abandon request
|
|
163
|
+
*/
|
|
164
|
+
interface IAbandonPullRequest {
|
|
165
|
+
project: string;
|
|
166
|
+
repository: string;
|
|
167
|
+
pullRequestId: number;
|
|
168
|
+
comment?: string;
|
|
169
|
+
deleteSourceBranch?: boolean;
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/azure/url-parts.d.ts
|
|
173
|
+
type AzureDevOpsUrl = {
|
|
174
|
+
/** URL of the organisation. This may lack the project name */
|
|
175
|
+
url: URL;
|
|
176
|
+
/** Organisation URL hostname */
|
|
177
|
+
hostname: string;
|
|
178
|
+
/** Organisation API endpoint URL */
|
|
179
|
+
'api-endpoint': string;
|
|
180
|
+
/** Project ID or Name */
|
|
181
|
+
project: string;
|
|
182
|
+
/** Repository ID or Name */
|
|
183
|
+
repository: string;
|
|
184
|
+
/** Slug of the repository e.g. `contoso/prj1/_git/repo1`, `tfs/contoso/prj1/_git/repo1` */
|
|
185
|
+
'repository-slug': string;
|
|
186
|
+
};
|
|
187
|
+
declare function extractUrlParts({
|
|
188
|
+
organisationUrl,
|
|
189
|
+
project,
|
|
190
|
+
repository
|
|
191
|
+
}: {
|
|
192
|
+
organisationUrl: string;
|
|
193
|
+
project: string;
|
|
194
|
+
repository: string;
|
|
195
|
+
}): AzureDevOpsUrl;
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/azure/client.d.ts
|
|
198
|
+
/** Azure DevOps REST API client. */
|
|
199
|
+
declare class AzureDevOpsWebApiClient {
|
|
200
|
+
private readonly organisationApiUrl;
|
|
201
|
+
private readonly identityApiUrl;
|
|
202
|
+
private readonly accessToken;
|
|
203
|
+
private readonly debug;
|
|
204
|
+
private authenticatedUserId?;
|
|
205
|
+
private resolvedUserIds;
|
|
206
|
+
static API_VERSION: string;
|
|
207
|
+
static API_VERSION_PREVIEW: string;
|
|
208
|
+
constructor(url: AzureDevOpsUrl, accessToken: string, debug?: boolean);
|
|
209
|
+
/**
|
|
210
|
+
* Get the identity of the authenticated user.
|
|
211
|
+
* @returns
|
|
212
|
+
*/
|
|
213
|
+
getUserId(): Promise<string>;
|
|
214
|
+
/**
|
|
215
|
+
* Get the identity id from a user name, email, or group name.
|
|
216
|
+
* Requires scope "Identity (Read)" (vso.identity).
|
|
217
|
+
* @param userNameEmailOrGroupName
|
|
218
|
+
* @returns
|
|
219
|
+
*/
|
|
220
|
+
resolveIdentityId(userNameEmailOrGroupName: string): Promise<string | undefined>;
|
|
221
|
+
/**
|
|
222
|
+
* Get the default branch for a repository.
|
|
223
|
+
* Requires scope "Code (Read)" (vso.code).
|
|
224
|
+
* @param project
|
|
225
|
+
* @param repository
|
|
226
|
+
* @returns
|
|
227
|
+
*/
|
|
228
|
+
getDefaultBranch(project: string, repository: string): Promise<string | undefined>;
|
|
229
|
+
/**
|
|
230
|
+
* Get the list of branch names for a repository.
|
|
231
|
+
* Requires scope "Code (Read)" (vso.code).
|
|
232
|
+
* @param project
|
|
233
|
+
* @param repository
|
|
234
|
+
* @returns
|
|
235
|
+
*/
|
|
236
|
+
getBranchNames(project: string, repository: string): Promise<string[] | undefined>;
|
|
237
|
+
/**
|
|
238
|
+
* Get the properties for all active pull request created by the supplied user.
|
|
239
|
+
* Requires scope "Code (Read)" (vso.code).
|
|
240
|
+
* @param project
|
|
241
|
+
* @param repository
|
|
242
|
+
* @param creator
|
|
243
|
+
* @returns
|
|
244
|
+
*/
|
|
245
|
+
getActivePullRequestProperties(project: string, repository: string, creator: string): Promise<IPullRequestProperties[]>;
|
|
246
|
+
/**
|
|
247
|
+
* Create a new pull request.
|
|
248
|
+
* Requires scope "Code (Write)" (vso.code_write).
|
|
249
|
+
* Requires scope "Identity (Read)" (vso.identity), if assignees are specified.
|
|
250
|
+
* @param pr
|
|
251
|
+
* @returns
|
|
252
|
+
*/
|
|
253
|
+
createPullRequest(pr: ICreatePullRequest): Promise<number | null>;
|
|
254
|
+
/**
|
|
255
|
+
* Update a pull request.
|
|
256
|
+
* Requires scope "Code (Read & Write)" (vso.code, vso.code_write).
|
|
257
|
+
* @param pr
|
|
258
|
+
* @returns
|
|
259
|
+
*/
|
|
260
|
+
updatePullRequest(pr: IUpdatePullRequest): Promise<boolean>;
|
|
261
|
+
/**
|
|
262
|
+
* Approve a pull request.
|
|
263
|
+
* Requires scope "Code (Write)" (vso.code_write).
|
|
264
|
+
* @param pr
|
|
265
|
+
* @returns
|
|
266
|
+
*/
|
|
267
|
+
approvePullRequest(pr: IApprovePullRequest): Promise<boolean>;
|
|
268
|
+
/**
|
|
269
|
+
* Abandon a pull request.
|
|
270
|
+
* Requires scope "Code (Write)" (vso.code_write).
|
|
271
|
+
* @param pr
|
|
272
|
+
* @returns
|
|
273
|
+
*/
|
|
274
|
+
abandonPullRequest(pr: IAbandonPullRequest): Promise<boolean>;
|
|
275
|
+
private restApiGet;
|
|
276
|
+
private restApiPost;
|
|
277
|
+
private restApiPut;
|
|
278
|
+
private restApiPatch;
|
|
279
|
+
}
|
|
280
|
+
declare function sendRestApiRequestWithRetry(method: string, url: string, payload: unknown, requestAsync: () => Promise<Response>, isDebug?: boolean, retryCount?: number, retryDelay?: number): Promise<any>;
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/azure/config.d.ts
|
|
283
|
+
/**
|
|
284
|
+
* Parse the dependabot config YAML file to specify update configuration.
|
|
285
|
+
* The file should be located at any of `POSSIBLE_CONFIG_FILE_PATHS`.
|
|
286
|
+
*
|
|
287
|
+
* To view YAML file format, visit
|
|
288
|
+
* https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#allow
|
|
289
|
+
*
|
|
290
|
+
* @returns {DependabotConfig} config - the dependabot configuration
|
|
291
|
+
*/
|
|
292
|
+
declare function getDependabotConfig({
|
|
293
|
+
url,
|
|
294
|
+
token,
|
|
295
|
+
remote,
|
|
296
|
+
rootDir,
|
|
297
|
+
variableFinder
|
|
298
|
+
}: {
|
|
299
|
+
url: AzureDevOpsUrl;
|
|
300
|
+
token: string;
|
|
301
|
+
/**
|
|
302
|
+
* Whether to fetch the configuration file via the REST API (true) or look for it locally (false).
|
|
303
|
+
*/
|
|
304
|
+
remote: boolean;
|
|
305
|
+
rootDir?: string;
|
|
306
|
+
variableFinder: VariableFinderFn;
|
|
307
|
+
}): Promise<DependabotConfig>;
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region src/azure/utils.d.ts
|
|
310
|
+
declare function normalizeFilePath(path: string): string;
|
|
311
|
+
declare function normalizeBranchName(branch?: string): string | undefined;
|
|
312
|
+
declare const DependenciesPrPropertySchema: zod_v40.ZodUnion<[zod_v40.ZodArray<zod_v40.ZodObject<{
|
|
313
|
+
'dependency-name': zod_v40.ZodString;
|
|
314
|
+
'dependency-version': zod_v40.ZodOptional<zod_v40.ZodNullable<zod_v40.ZodString>>;
|
|
315
|
+
directory: zod_v40.ZodOptional<zod_v40.ZodNullable<zod_v40.ZodString>>;
|
|
316
|
+
removed: zod_v40.ZodOptional<zod_v40.ZodNullable<zod_v40.ZodBoolean>>;
|
|
317
|
+
}, zod_v4_core0.$strip>>, zod_v40.ZodObject<{
|
|
318
|
+
'dependency-group-name': zod_v40.ZodString;
|
|
319
|
+
dependencies: zod_v40.ZodArray<zod_v40.ZodObject<{
|
|
320
|
+
'dependency-name': zod_v40.ZodString;
|
|
321
|
+
'dependency-version': zod_v40.ZodOptional<zod_v40.ZodNullable<zod_v40.ZodString>>;
|
|
322
|
+
directory: zod_v40.ZodOptional<zod_v40.ZodNullable<zod_v40.ZodString>>;
|
|
323
|
+
removed: zod_v40.ZodOptional<zod_v40.ZodNullable<zod_v40.ZodBoolean>>;
|
|
324
|
+
}, zod_v4_core0.$strip>>;
|
|
325
|
+
}, zod_v4_core0.$strip>]>;
|
|
326
|
+
declare function buildPullRequestProperties(packageManager: string, dependencies: DependabotExistingPR[] | DependabotExistingGroupPR): {
|
|
327
|
+
name: string;
|
|
328
|
+
value: string;
|
|
329
|
+
}[];
|
|
330
|
+
declare function parsePullRequestProperties(pullRequests: IPullRequestProperties[], packageManager: string | null): Record<string, DependabotExistingPR[] | DependabotExistingGroupPR>;
|
|
331
|
+
declare function getPullRequestForDependencyNames(existingPullRequests: IPullRequestProperties[], packageManager: string, dependencyNames: string[]): IPullRequestProperties | undefined;
|
|
332
|
+
declare function getPullRequestChangedFilesForOutputData(data: DependabotCreatePullRequest | DependabotUpdatePullRequest): IFileChange[];
|
|
333
|
+
declare function getPullRequestCloseReasonForOutputData(data: DependabotClosePullRequest): string | undefined;
|
|
334
|
+
declare function getPullRequestDependenciesPropertyValueForOutputData(data: DependabotCreatePullRequest): DependabotExistingPR[] | DependabotExistingGroupPR;
|
|
335
|
+
declare function getPullRequestDescription(packageManager: string, body: string | null | undefined, dependencies: DependabotDependency[]): string;
|
|
336
|
+
//#endregion
|
|
337
|
+
export { type AzureDevOpsUrl, AzureDevOpsWebApiClient, CommentThreadStatus, CommentType, DEVOPS_PR_PROPERTY_DEPENDABOT_DEPENDENCIES, DEVOPS_PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER, DEVOPS_PR_PROPERTY_MICROSOFT_GIT_SOURCE_REF_NAME, DependenciesPrPropertySchema, GitPullRequestMergeStrategy, IAbandonPullRequest, IApprovePullRequest, ICreatePullRequest, IFileChange, IPullRequestProperties, IUpdatePullRequest, IdentityRefWithVote, ItemContentType, PullRequestAsyncStatus, PullRequestStatus, VersionControlChangeType, buildPullRequestProperties, extractUrlParts, getDependabotConfig, getPullRequestChangedFilesForOutputData, getPullRequestCloseReasonForOutputData, getPullRequestDependenciesPropertyValueForOutputData, getPullRequestDescription, getPullRequestForDependencyNames, normalizeBranchName, normalizeFilePath, parsePullRequestProperties, sendRestApiRequestWithRetry };
|
|
338
|
+
//# sourceMappingURL=azure.d.ts.map
|