@paklo/core 0.10.0 → 0.11.1

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.
@@ -1,4 +1,4 @@
1
- import { Jt as DependabotPersistedPr, Un as VariableFinderFn, W as DependabotUpdatePullRequest, f as DependabotCreatePullRequest, vn as DependabotConfig } from "../index-CFWMNvXg.mjs";
1
+ import { Jt as DependabotPersistedPr, W as DependabotUpdatePullRequest, Wn as VariableFinderFn, f as DependabotCreatePullRequest, yn as DependabotConfig } from "../index-t1Aj_PJX.mjs";
2
2
  import "../index-BfwWezjJ.mjs";
3
3
  import { z } from "zod";
4
4
  import { KyInstance } from "ky";
@@ -22,11 +22,17 @@ type AzureDevOpsOrganizationUrl = {
22
22
  'identity-api-url': URL;
23
23
  };
24
24
  type AzureDevOpsProjectUrl = AzureDevOpsOrganizationUrl & {
25
- /** Project ID or Name */
25
+ /**
26
+ * Project ID or Name.
27
+ * This value is not URL-encoded, clients must encode it when constructing URLs.
28
+ */
26
29
  project: string;
27
30
  };
28
31
  type AzureDevOpsRepositoryUrl = AzureDevOpsProjectUrl & {
29
- /** Repository ID or Name */
32
+ /**
33
+ * Repository ID or Name.
34
+ * This value is not URL-encoded, clients must encode it when constructing URLs.
35
+ */
30
36
  repository: string;
31
37
  /** Slug of the repository e.g. `contoso/prj1/_git/repo1`, `tfs/contoso/prj1/_git/repo1` */
32
38
  'repository-slug': string;
@@ -65,21 +71,21 @@ declare class BaseAzureDevOpsClient {
65
71
  //#endregion
66
72
  //#region src/azure/client/types.d.ts
67
73
  declare const AzdoVersionControlChangeTypeSchema: z.ZodEnum<{
74
+ all: "all";
75
+ branch: "branch";
76
+ delete: "delete";
68
77
  none: "none";
69
78
  add: "add";
70
79
  edit: "edit";
71
80
  encoding: "encoding";
72
81
  rename: "rename";
73
- delete: "delete";
74
82
  undelete: "undelete";
75
- branch: "branch";
76
83
  merge: "merge";
77
84
  lock: "lock";
78
85
  rollback: "rollback";
79
86
  sourceRename: "sourceRename";
80
87
  targetRename: "targetRename";
81
88
  property: "property";
82
- all: "all";
83
89
  }>;
84
90
  type AzdoVersionControlChangeType = z.infer<typeof AzdoVersionControlChangeTypeSchema>;
85
91
  declare const AZDO_PULL_REQUEST_MERGE_STRATEGIES: readonly ["noFastForward", "squash", "rebase", "rebaseMerge"];
@@ -242,21 +248,21 @@ declare const AzdoGitRefUpdateResultSchema: z.ZodObject<{
242
248
  type AzdoGitRefUpdateResult = z.infer<typeof AzdoGitRefUpdateResultSchema>;
243
249
  declare const AzdoGitChangeSchema: z.ZodObject<{
244
250
  changeType: z.ZodEnum<{
251
+ all: "all";
252
+ branch: "branch";
253
+ delete: "delete";
245
254
  none: "none";
246
255
  add: "add";
247
256
  edit: "edit";
248
257
  encoding: "encoding";
249
258
  rename: "rename";
250
- delete: "delete";
251
259
  undelete: "undelete";
252
- branch: "branch";
253
260
  merge: "merge";
254
261
  lock: "lock";
255
262
  rollback: "rollback";
256
263
  sourceRename: "sourceRename";
257
264
  targetRename: "targetRename";
258
265
  property: "property";
259
- all: "all";
260
266
  }>;
261
267
  item: z.ZodOptional<z.ZodObject<{
262
268
  path: z.ZodString;
@@ -285,21 +291,21 @@ declare const AzdoGitCommitRefSchema: z.ZodObject<{
285
291
  }, z.core.$strip>>;
286
292
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
287
293
  changeType: z.ZodEnum<{
294
+ all: "all";
295
+ branch: "branch";
296
+ delete: "delete";
288
297
  none: "none";
289
298
  add: "add";
290
299
  edit: "edit";
291
300
  encoding: "encoding";
292
301
  rename: "rename";
293
- delete: "delete";
294
302
  undelete: "undelete";
295
- branch: "branch";
296
303
  merge: "merge";
297
304
  lock: "lock";
298
305
  rollback: "rollback";
299
306
  sourceRename: "sourceRename";
300
307
  targetRename: "targetRename";
301
308
  property: "property";
302
- all: "all";
303
309
  }>;
304
310
  item: z.ZodOptional<z.ZodObject<{
305
311
  path: z.ZodString;
@@ -330,21 +336,21 @@ declare const AzdoGitPushSchema: z.ZodObject<{
330
336
  }, z.core.$strip>>;
331
337
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
332
338
  changeType: z.ZodEnum<{
339
+ all: "all";
340
+ branch: "branch";
341
+ delete: "delete";
333
342
  none: "none";
334
343
  add: "add";
335
344
  edit: "edit";
336
345
  encoding: "encoding";
337
346
  rename: "rename";
338
- delete: "delete";
339
347
  undelete: "undelete";
340
- branch: "branch";
341
348
  merge: "merge";
342
349
  lock: "lock";
343
350
  rollback: "rollback";
344
351
  sourceRename: "sourceRename";
345
352
  targetRename: "targetRename";
346
353
  property: "property";
347
- all: "all";
348
354
  }>;
349
355
  item: z.ZodOptional<z.ZodObject<{
350
356
  path: z.ZodString;
@@ -389,21 +395,21 @@ declare const AzdoGitPushCreateSchema: z.ZodObject<{
389
395
  }, z.core.$strip>>;
390
396
  changes: z.ZodArray<z.ZodObject<{
391
397
  changeType: z.ZodEnum<{
398
+ all: "all";
399
+ branch: "branch";
400
+ delete: "delete";
392
401
  none: "none";
393
402
  add: "add";
394
403
  edit: "edit";
395
404
  encoding: "encoding";
396
405
  rename: "rename";
397
- delete: "delete";
398
406
  undelete: "undelete";
399
- branch: "branch";
400
407
  merge: "merge";
401
408
  lock: "lock";
402
409
  rollback: "rollback";
403
410
  sourceRename: "sourceRename";
404
411
  targetRename: "targetRename";
405
412
  property: "property";
406
- all: "all";
407
413
  }>;
408
414
  item: z.ZodOptional<z.ZodObject<{
409
415
  path: z.ZodString;
@@ -430,21 +436,21 @@ declare const AzdoGitCommitDiffsSchema: z.ZodObject<{
430
436
  baseCommit: z.ZodString;
431
437
  changes: z.ZodArray<z.ZodObject<{
432
438
  changeType: z.ZodEnum<{
439
+ all: "all";
440
+ branch: "branch";
441
+ delete: "delete";
433
442
  none: "none";
434
443
  add: "add";
435
444
  edit: "edit";
436
445
  encoding: "encoding";
437
446
  rename: "rename";
438
- delete: "delete";
439
447
  undelete: "undelete";
440
- branch: "branch";
441
448
  merge: "merge";
442
449
  lock: "lock";
443
450
  rollback: "rollback";
444
451
  sourceRename: "sourceRename";
445
452
  targetRename: "targetRename";
446
453
  property: "property";
447
- all: "all";
448
454
  }>;
449
455
  item: z.ZodOptional<z.ZodObject<{
450
456
  path: z.ZodString;
@@ -476,21 +482,21 @@ declare const AzdoRepositoryItemSchema: z.ZodObject<{
476
482
  }, z.core.$strip>>;
477
483
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
478
484
  changeType: z.ZodEnum<{
485
+ all: "all";
486
+ branch: "branch";
487
+ delete: "delete";
479
488
  none: "none";
480
489
  add: "add";
481
490
  edit: "edit";
482
491
  encoding: "encoding";
483
492
  rename: "rename";
484
- delete: "delete";
485
493
  undelete: "undelete";
486
- branch: "branch";
487
494
  merge: "merge";
488
495
  lock: "lock";
489
496
  rollback: "rollback";
490
497
  sourceRename: "sourceRename";
491
498
  targetRename: "targetRename";
492
499
  property: "property";
493
- all: "all";
494
500
  }>;
495
501
  item: z.ZodOptional<z.ZodObject<{
496
502
  path: z.ZodString;
@@ -545,21 +551,21 @@ declare const AzdoPullRequestSchema: z.ZodObject<{
545
551
  }, z.core.$strip>>;
546
552
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
547
553
  changeType: z.ZodEnum<{
554
+ all: "all";
555
+ branch: "branch";
556
+ delete: "delete";
548
557
  none: "none";
549
558
  add: "add";
550
559
  edit: "edit";
551
560
  encoding: "encoding";
552
561
  rename: "rename";
553
- delete: "delete";
554
562
  undelete: "undelete";
555
- branch: "branch";
556
563
  merge: "merge";
557
564
  lock: "lock";
558
565
  rollback: "rollback";
559
566
  sourceRename: "sourceRename";
560
567
  targetRename: "targetRename";
561
568
  property: "property";
562
- all: "all";
563
569
  }>;
564
570
  item: z.ZodOptional<z.ZodObject<{
565
571
  path: z.ZodString;
@@ -588,21 +594,21 @@ declare const AzdoPullRequestSchema: z.ZodObject<{
588
594
  }, z.core.$strip>>;
589
595
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
590
596
  changeType: z.ZodEnum<{
597
+ all: "all";
598
+ branch: "branch";
599
+ delete: "delete";
591
600
  none: "none";
592
601
  add: "add";
593
602
  edit: "edit";
594
603
  encoding: "encoding";
595
604
  rename: "rename";
596
- delete: "delete";
597
605
  undelete: "undelete";
598
- branch: "branch";
599
606
  merge: "merge";
600
607
  lock: "lock";
601
608
  rollback: "rollback";
602
609
  sourceRename: "sourceRename";
603
610
  targetRename: "targetRename";
604
611
  property: "property";
605
- all: "all";
606
612
  }>;
607
613
  item: z.ZodOptional<z.ZodObject<{
608
614
  path: z.ZodString;
@@ -956,7 +962,7 @@ declare function buildPullRequestProperties(packageManager: string, dependencies
956
962
  declare function parsePullRequestProperties(pullRequests: AzdoPrExtractedWithProperties[], packageManager: string | null): Record<string, DependabotPersistedPr>;
957
963
  declare function getPullRequestForDependencyNames(existingPullRequests: AzdoPrExtractedWithProperties[], packageManager: string, dependencyNames: string[]): AzdoPrExtractedWithProperties | undefined;
958
964
  declare function getPullRequestChangedFiles(data: DependabotCreatePullRequest | DependabotUpdatePullRequest): {
959
- changeType: "add" | "edit" | "delete";
965
+ changeType: "delete" | "add" | "edit";
960
966
  path: string;
961
967
  content: string | undefined;
962
968
  encoding: "utf-8" | "base64";
@@ -1236,21 +1242,21 @@ declare const AzdoEventCodePushResourceSchema: z.ZodObject<{
1236
1242
  }, z.core.$strip>>;
1237
1243
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1238
1244
  changeType: z.ZodEnum<{
1245
+ all: "all";
1246
+ branch: "branch";
1247
+ delete: "delete";
1239
1248
  none: "none";
1240
1249
  add: "add";
1241
1250
  edit: "edit";
1242
1251
  encoding: "encoding";
1243
1252
  rename: "rename";
1244
- delete: "delete";
1245
1253
  undelete: "undelete";
1246
- branch: "branch";
1247
1254
  merge: "merge";
1248
1255
  lock: "lock";
1249
1256
  rollback: "rollback";
1250
1257
  sourceRename: "sourceRename";
1251
1258
  targetRename: "targetRename";
1252
1259
  property: "property";
1253
- all: "all";
1254
1260
  }>;
1255
1261
  item: z.ZodOptional<z.ZodObject<{
1256
1262
  path: z.ZodString;
@@ -1471,21 +1477,21 @@ declare const AzdoEventSchema: z.ZodIntersection<z.ZodObject<{
1471
1477
  }, z.core.$strip>>;
1472
1478
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1473
1479
  changeType: z.ZodEnum<{
1480
+ all: "all";
1481
+ branch: "branch";
1482
+ delete: "delete";
1474
1483
  none: "none";
1475
1484
  add: "add";
1476
1485
  edit: "edit";
1477
1486
  encoding: "encoding";
1478
1487
  rename: "rename";
1479
- delete: "delete";
1480
1488
  undelete: "undelete";
1481
- branch: "branch";
1482
1489
  merge: "merge";
1483
1490
  lock: "lock";
1484
1491
  rollback: "rollback";
1485
1492
  sourceRename: "sourceRename";
1486
1493
  targetRename: "targetRename";
1487
1494
  property: "property";
1488
- all: "all";
1489
1495
  }>;
1490
1496
  item: z.ZodOptional<z.ZodObject<{
1491
1497
  path: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  import { n as logger } from "../logger-3Qfh9NUj.mjs";
2
- import { T as CONFIG_FILE_PATHS_AZURE, _ as DependabotPersistedPrSchema, z as parseDependabotConfig } from "../job-COuliaYg.mjs";
3
- import { n as getDependencyNames, o as normalizeBranchName, s as normalizeFilePath, t as areEqual } from "../dependabot-DVf7lAEG.mjs";
2
+ import { B as parseDependabotConfig, E as CONFIG_FILE_PATHS_AZURE, _ as DependabotPersistedPrSchema } from "../job-ClEevC5P.mjs";
3
+ import { n as getDependencyNames, o as normalizeBranchName, s as normalizeFilePath, t as areEqual } from "../dependabot-DbKUmEV3.mjs";
4
4
  import { z } from "zod";
5
5
  import ky, { isHTTPError } from "ky";
6
6
  import * as path from "node:path";
@@ -128,22 +128,22 @@ var PullRequestsClient = class extends BaseAzureDevOpsClient {
128
128
  * @param status The status of the pull requests to filter by
129
129
  */
130
130
  async list(projectIdOrName, repositoryIdOrName, creatorId, status) {
131
- return (await this.client.get(this.makeUrl(`${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/pullrequests`, {
131
+ return (await this.client.get(this.makeUrl(`${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests`, {
132
132
  "searchCriteria.creatorId": creatorId,
133
133
  "searchCriteria.status": status
134
134
  })).json())?.value;
135
135
  }
136
136
  async get(projectIdOrName, repositoryIdOrName, pullRequestId) {
137
- return await this.client.get(this.makeUrl(`${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/pullrequests/${pullRequestId}`)).json();
137
+ return await this.client.get(this.makeUrl(`${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}`)).json();
138
138
  }
139
139
  async create(projectIdOrName, repositoryIdOrName, pr) {
140
- return await this.client.post(this.makeUrl(`${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/pullrequests`), { json: pr }).json();
140
+ return await this.client.post(this.makeUrl(`${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests`), { json: pr }).json();
141
141
  }
142
142
  async update(projectIdOrName, repositoryIdOrName, pullRequestId, pr) {
143
- return await this.client.patch(this.makeUrl(`${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/pullrequests/${pullRequestId}`), { json: pr }).json();
143
+ return await this.client.patch(this.makeUrl(`${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}`), { json: pr }).json();
144
144
  }
145
145
  async getProperties(projectIdOrName, repositoryIdOrName, pullRequestId) {
146
- const response = await this.client.get(this.makeUrl(`${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/pullrequests/${pullRequestId}/properties`)).json();
146
+ const response = await this.client.get(this.makeUrl(`${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}/properties`)).json();
147
147
  return Object.entries(response?.value || {}).filter(([, val]) => val?.$value).map(([key, val]) => ({
148
148
  name: key,
149
149
  value: val.$value
@@ -166,7 +166,7 @@ var PullRequestsClient = class extends BaseAzureDevOpsClient {
166
166
  * Requires scope "Code (Write)" (vso.code_write).
167
167
  */
168
168
  async approve(projectIdOrName, repositoryIdOrName, pullRequestId, userId) {
169
- return await this.client.put(this.makeUrl(`${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/pullrequests/${pullRequestId}/reviewers/${userId}`, "7.1"), { json: {
169
+ return await this.client.put(this.makeUrl(`${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}/reviewers/${userId}`, "7.1"), { json: {
170
170
  vote: 10,
171
171
  isReapprove: true
172
172
  } }).json();
@@ -176,7 +176,7 @@ var PullRequestsClient = class extends BaseAzureDevOpsClient {
176
176
  * Requires scope "Code (Write)" (vso.code_write).
177
177
  */
178
178
  async abandon(projectIdOrName, repositoryIdOrName, pullRequestId, userId) {
179
- return await this.client.patch(this.makeUrl(`${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/pullrequests/${pullRequestId}`), { json: {
179
+ return await this.client.patch(this.makeUrl(`${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}`), { json: {
180
180
  status: "abandoned",
181
181
  closedBy: { id: userId }
182
182
  } }).json();
@@ -186,14 +186,14 @@ var PullRequestsClient = class extends BaseAzureDevOpsClient {
186
186
  * Requires scope "Code (Read)" (vso.code_read).
187
187
  */
188
188
  async getCommits(projectIdOrName, repositoryIdOrName, pullRequestId) {
189
- return (await this.client.get(this.makeUrl(`${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/pullrequests/${pullRequestId}/commits`)).json())?.value;
189
+ return (await this.client.get(this.makeUrl(`${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}/commits`)).json())?.value;
190
190
  }
191
191
  /**
192
192
  * Create a comment thread on a pull request.
193
193
  * Requires scope "Code (Write)" (vso.code_write).
194
194
  */
195
195
  async createCommentThread(projectIdOrName, repositoryIdOrName, pullRequestId, thread) {
196
- return await this.client.post(this.makeUrl(`${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/pullrequests/${pullRequestId}/threads`), { json: thread }).json();
196
+ return await this.client.post(this.makeUrl(`${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}/threads`), { json: thread }).json();
197
197
  }
198
198
  };
199
199
 
@@ -1240,10 +1240,10 @@ function extractOrganizationUrl({ organisationUrl }) {
1240
1240
  }
1241
1241
  function extractProjectUrl({ organisationUrl, project }) {
1242
1242
  const extracted = extractOrganizationUrl({ organisationUrl });
1243
- const escapedProject = encodeURI(project);
1243
+ const decodedProject = decodeURIComponent(project);
1244
1244
  return {
1245
1245
  ...extracted,
1246
- project: escapedProject
1246
+ project: decodedProject
1247
1247
  };
1248
1248
  }
1249
1249
  function extractRepositoryUrl({ organisationUrl, project, repository }) {
@@ -1251,12 +1251,12 @@ function extractRepositoryUrl({ organisationUrl, project, repository }) {
1251
1251
  organisationUrl,
1252
1252
  project
1253
1253
  });
1254
- const { organisation, "virtual-directory": virtualDirectory, project: escapedProject } = extracted;
1255
- const escapedRepository = encodeURI(repository);
1256
- const repoSlug = `${virtualDirectory ? `${virtualDirectory}/` : ""}${organisation}/${escapedProject}/_git/${escapedRepository}`;
1254
+ const { organisation, "virtual-directory": virtualDirectory, project: decodedProject } = extracted;
1255
+ const decodedRepository = decodeURIComponent(repository);
1256
+ const repoSlug = `${virtualDirectory ? `${virtualDirectory}/` : ""}${organisation}/${encodeURI(decodedProject)}/_git/${encodeURI(decodedRepository)}`;
1257
1257
  return {
1258
1258
  ...extracted,
1259
- repository: escapedRepository,
1259
+ repository: decodedRepository,
1260
1260
  "repository-slug": repoSlug
1261
1261
  };
1262
1262
  }