@paklo/core 0.11.0 → 0.12.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/README.md CHANGED
@@ -1,16 +1,9 @@
1
1
  # Paklo Core
2
2
 
3
- The shared toolkit for Paklo, ensuring consistent integrations with Azure DevOps, GitHub, Dependabot primitives, logging, HTTP helpers, and shared utilities.
3
+ > **⚠️ Internal Package - Not for Direct Use**
4
4
 
5
- ## Internal Surface Area
5
+ This package contains shared utilities used internally by Paklo components. It is not a public API and may change without notice.
6
6
 
7
- - This package is not a public API. Names, exports, and behaviors may change at any time as we evolve the architecture.
8
- - Use it only from within this monorepo. External consumers should rely on higher-level packages such as `@paklo/cli`.
9
- - When contributing, prefer adding well-tested, isolated helpers so they can be reused by downstream packages.
7
+ **Do not use this package directly.** Use `@paklo/cli` or the Azure DevOps extension instead.
10
8
 
11
- ## Development
12
-
13
- - `pnpm dev` — watch mode via `tsdown`
14
- - `pnpm test` — run the Vitest suite (fixtures live under `packages/core/fixtures`)
15
- - `pnpm lint` — run Biome checks
16
- - `pnpm build` — build distributable artifacts
9
+ For contribution guidelines, see [Contributing](https://www.paklo.app/docs/contributing).
@@ -1,18 +1,18 @@
1
- import { Jt as DependabotPersistedPr, Un as VariableFinderFn, W as DependabotUpdatePullRequest, f as DependabotCreatePullRequest, vn as DependabotConfig } from "../index-CjxvO_Pt.mjs";
1
+ import { Jt as DependabotPersistedPr, W as DependabotUpdatePullRequest, Wn as VariableFinderFn, f as DependabotCreatePullRequest, yn as DependabotConfig } from "../index-flzaUkHI.mjs";
2
2
  import "../index-BfwWezjJ.mjs";
3
3
  import { z } from "zod";
4
4
  import { KyInstance } from "ky";
5
5
 
6
6
  //#region src/azure/url-parts.d.ts
7
7
  type AzureDevOpsOrganizationUrl = {
8
- /** URL of the organisation. This may lack the project name */
8
+ /** URL of the organization. This may lack the project name */
9
9
  value: URL;
10
- /** Organisation URL hostname */
10
+ /** Organization URL hostname */
11
11
  hostname: string;
12
- /** Organisation API endpoint URL */
12
+ /** Organization API endpoint URL */
13
13
  'api-endpoint': string;
14
- /** Organisation name/slug */
15
- organisation: string;
14
+ /** Organization name/slug */
15
+ organization: string;
16
16
  /** Virtual directory if present (on-premises only) */
17
17
  'virtual-directory'?: string;
18
18
  /**
@@ -38,23 +38,23 @@ type AzureDevOpsRepositoryUrl = AzureDevOpsProjectUrl & {
38
38
  'repository-slug': string;
39
39
  };
40
40
  declare function extractOrganizationUrl({
41
- organisationUrl
41
+ organizationUrl
42
42
  }: {
43
- organisationUrl: string;
43
+ organizationUrl: string;
44
44
  }): AzureDevOpsOrganizationUrl;
45
45
  declare function extractProjectUrl({
46
- organisationUrl,
46
+ organizationUrl,
47
47
  project
48
48
  }: {
49
- organisationUrl: string;
49
+ organizationUrl: string;
50
50
  project: string;
51
51
  }): AzureDevOpsProjectUrl;
52
52
  declare function extractRepositoryUrl({
53
- organisationUrl,
53
+ organizationUrl,
54
54
  project,
55
55
  repository
56
56
  }: {
57
- organisationUrl: string;
57
+ organizationUrl: string;
58
58
  project: string;
59
59
  repository: string;
60
60
  }): AzureDevOpsRepositoryUrl;
@@ -71,21 +71,21 @@ declare class BaseAzureDevOpsClient {
71
71
  //#endregion
72
72
  //#region src/azure/client/types.d.ts
73
73
  declare const AzdoVersionControlChangeTypeSchema: z.ZodEnum<{
74
+ all: "all";
75
+ branch: "branch";
76
+ delete: "delete";
74
77
  none: "none";
75
78
  add: "add";
76
79
  edit: "edit";
77
80
  encoding: "encoding";
78
81
  rename: "rename";
79
- delete: "delete";
80
82
  undelete: "undelete";
81
- branch: "branch";
82
83
  merge: "merge";
83
84
  lock: "lock";
84
85
  rollback: "rollback";
85
86
  sourceRename: "sourceRename";
86
87
  targetRename: "targetRename";
87
88
  property: "property";
88
- all: "all";
89
89
  }>;
90
90
  type AzdoVersionControlChangeType = z.infer<typeof AzdoVersionControlChangeTypeSchema>;
91
91
  declare const AZDO_PULL_REQUEST_MERGE_STRATEGIES: readonly ["noFastForward", "squash", "rebase", "rebaseMerge"];
@@ -248,21 +248,21 @@ declare const AzdoGitRefUpdateResultSchema: z.ZodObject<{
248
248
  type AzdoGitRefUpdateResult = z.infer<typeof AzdoGitRefUpdateResultSchema>;
249
249
  declare const AzdoGitChangeSchema: z.ZodObject<{
250
250
  changeType: z.ZodEnum<{
251
+ all: "all";
252
+ branch: "branch";
253
+ delete: "delete";
251
254
  none: "none";
252
255
  add: "add";
253
256
  edit: "edit";
254
257
  encoding: "encoding";
255
258
  rename: "rename";
256
- delete: "delete";
257
259
  undelete: "undelete";
258
- branch: "branch";
259
260
  merge: "merge";
260
261
  lock: "lock";
261
262
  rollback: "rollback";
262
263
  sourceRename: "sourceRename";
263
264
  targetRename: "targetRename";
264
265
  property: "property";
265
- all: "all";
266
266
  }>;
267
267
  item: z.ZodOptional<z.ZodObject<{
268
268
  path: z.ZodString;
@@ -291,21 +291,21 @@ declare const AzdoGitCommitRefSchema: z.ZodObject<{
291
291
  }, z.core.$strip>>;
292
292
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
293
293
  changeType: z.ZodEnum<{
294
+ all: "all";
295
+ branch: "branch";
296
+ delete: "delete";
294
297
  none: "none";
295
298
  add: "add";
296
299
  edit: "edit";
297
300
  encoding: "encoding";
298
301
  rename: "rename";
299
- delete: "delete";
300
302
  undelete: "undelete";
301
- branch: "branch";
302
303
  merge: "merge";
303
304
  lock: "lock";
304
305
  rollback: "rollback";
305
306
  sourceRename: "sourceRename";
306
307
  targetRename: "targetRename";
307
308
  property: "property";
308
- all: "all";
309
309
  }>;
310
310
  item: z.ZodOptional<z.ZodObject<{
311
311
  path: z.ZodString;
@@ -336,21 +336,21 @@ declare const AzdoGitPushSchema: z.ZodObject<{
336
336
  }, z.core.$strip>>;
337
337
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
338
338
  changeType: z.ZodEnum<{
339
+ all: "all";
340
+ branch: "branch";
341
+ delete: "delete";
339
342
  none: "none";
340
343
  add: "add";
341
344
  edit: "edit";
342
345
  encoding: "encoding";
343
346
  rename: "rename";
344
- delete: "delete";
345
347
  undelete: "undelete";
346
- branch: "branch";
347
348
  merge: "merge";
348
349
  lock: "lock";
349
350
  rollback: "rollback";
350
351
  sourceRename: "sourceRename";
351
352
  targetRename: "targetRename";
352
353
  property: "property";
353
- all: "all";
354
354
  }>;
355
355
  item: z.ZodOptional<z.ZodObject<{
356
356
  path: z.ZodString;
@@ -395,21 +395,21 @@ declare const AzdoGitPushCreateSchema: z.ZodObject<{
395
395
  }, z.core.$strip>>;
396
396
  changes: z.ZodArray<z.ZodObject<{
397
397
  changeType: z.ZodEnum<{
398
+ all: "all";
399
+ branch: "branch";
400
+ delete: "delete";
398
401
  none: "none";
399
402
  add: "add";
400
403
  edit: "edit";
401
404
  encoding: "encoding";
402
405
  rename: "rename";
403
- delete: "delete";
404
406
  undelete: "undelete";
405
- branch: "branch";
406
407
  merge: "merge";
407
408
  lock: "lock";
408
409
  rollback: "rollback";
409
410
  sourceRename: "sourceRename";
410
411
  targetRename: "targetRename";
411
412
  property: "property";
412
- all: "all";
413
413
  }>;
414
414
  item: z.ZodOptional<z.ZodObject<{
415
415
  path: z.ZodString;
@@ -436,21 +436,21 @@ declare const AzdoGitCommitDiffsSchema: z.ZodObject<{
436
436
  baseCommit: z.ZodString;
437
437
  changes: z.ZodArray<z.ZodObject<{
438
438
  changeType: z.ZodEnum<{
439
+ all: "all";
440
+ branch: "branch";
441
+ delete: "delete";
439
442
  none: "none";
440
443
  add: "add";
441
444
  edit: "edit";
442
445
  encoding: "encoding";
443
446
  rename: "rename";
444
- delete: "delete";
445
447
  undelete: "undelete";
446
- branch: "branch";
447
448
  merge: "merge";
448
449
  lock: "lock";
449
450
  rollback: "rollback";
450
451
  sourceRename: "sourceRename";
451
452
  targetRename: "targetRename";
452
453
  property: "property";
453
- all: "all";
454
454
  }>;
455
455
  item: z.ZodOptional<z.ZodObject<{
456
456
  path: z.ZodString;
@@ -482,21 +482,21 @@ declare const AzdoRepositoryItemSchema: z.ZodObject<{
482
482
  }, z.core.$strip>>;
483
483
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
484
484
  changeType: z.ZodEnum<{
485
+ all: "all";
486
+ branch: "branch";
487
+ delete: "delete";
485
488
  none: "none";
486
489
  add: "add";
487
490
  edit: "edit";
488
491
  encoding: "encoding";
489
492
  rename: "rename";
490
- delete: "delete";
491
493
  undelete: "undelete";
492
- branch: "branch";
493
494
  merge: "merge";
494
495
  lock: "lock";
495
496
  rollback: "rollback";
496
497
  sourceRename: "sourceRename";
497
498
  targetRename: "targetRename";
498
499
  property: "property";
499
- all: "all";
500
500
  }>;
501
501
  item: z.ZodOptional<z.ZodObject<{
502
502
  path: z.ZodString;
@@ -551,21 +551,21 @@ declare const AzdoPullRequestSchema: z.ZodObject<{
551
551
  }, z.core.$strip>>;
552
552
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
553
553
  changeType: z.ZodEnum<{
554
+ all: "all";
555
+ branch: "branch";
556
+ delete: "delete";
554
557
  none: "none";
555
558
  add: "add";
556
559
  edit: "edit";
557
560
  encoding: "encoding";
558
561
  rename: "rename";
559
- delete: "delete";
560
562
  undelete: "undelete";
561
- branch: "branch";
562
563
  merge: "merge";
563
564
  lock: "lock";
564
565
  rollback: "rollback";
565
566
  sourceRename: "sourceRename";
566
567
  targetRename: "targetRename";
567
568
  property: "property";
568
- all: "all";
569
569
  }>;
570
570
  item: z.ZodOptional<z.ZodObject<{
571
571
  path: z.ZodString;
@@ -594,21 +594,21 @@ declare const AzdoPullRequestSchema: z.ZodObject<{
594
594
  }, z.core.$strip>>;
595
595
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
596
596
  changeType: z.ZodEnum<{
597
+ all: "all";
598
+ branch: "branch";
599
+ delete: "delete";
597
600
  none: "none";
598
601
  add: "add";
599
602
  edit: "edit";
600
603
  encoding: "encoding";
601
604
  rename: "rename";
602
- delete: "delete";
603
605
  undelete: "undelete";
604
- branch: "branch";
605
606
  merge: "merge";
606
607
  lock: "lock";
607
608
  rollback: "rollback";
608
609
  sourceRename: "sourceRename";
609
610
  targetRename: "targetRename";
610
611
  property: "property";
611
- all: "all";
612
612
  }>;
613
613
  item: z.ZodOptional<z.ZodObject<{
614
614
  path: z.ZodString;
@@ -962,7 +962,7 @@ declare function buildPullRequestProperties(packageManager: string, dependencies
962
962
  declare function parsePullRequestProperties(pullRequests: AzdoPrExtractedWithProperties[], packageManager: string | null): Record<string, DependabotPersistedPr>;
963
963
  declare function getPullRequestForDependencyNames(existingPullRequests: AzdoPrExtractedWithProperties[], packageManager: string, dependencyNames: string[]): AzdoPrExtractedWithProperties | undefined;
964
964
  declare function getPullRequestChangedFiles(data: DependabotCreatePullRequest | DependabotUpdatePullRequest): {
965
- changeType: "add" | "edit" | "delete";
965
+ changeType: "delete" | "add" | "edit";
966
966
  path: string;
967
967
  content: string | undefined;
968
968
  encoding: "utf-8" | "base64";
@@ -1242,21 +1242,21 @@ declare const AzdoEventCodePushResourceSchema: z.ZodObject<{
1242
1242
  }, z.core.$strip>>;
1243
1243
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1244
1244
  changeType: z.ZodEnum<{
1245
+ all: "all";
1246
+ branch: "branch";
1247
+ delete: "delete";
1245
1248
  none: "none";
1246
1249
  add: "add";
1247
1250
  edit: "edit";
1248
1251
  encoding: "encoding";
1249
1252
  rename: "rename";
1250
- delete: "delete";
1251
1253
  undelete: "undelete";
1252
- branch: "branch";
1253
1254
  merge: "merge";
1254
1255
  lock: "lock";
1255
1256
  rollback: "rollback";
1256
1257
  sourceRename: "sourceRename";
1257
1258
  targetRename: "targetRename";
1258
1259
  property: "property";
1259
- all: "all";
1260
1260
  }>;
1261
1261
  item: z.ZodOptional<z.ZodObject<{
1262
1262
  path: z.ZodString;
@@ -1477,21 +1477,21 @@ declare const AzdoEventSchema: z.ZodIntersection<z.ZodObject<{
1477
1477
  }, z.core.$strip>>;
1478
1478
  changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1479
1479
  changeType: z.ZodEnum<{
1480
+ all: "all";
1481
+ branch: "branch";
1482
+ delete: "delete";
1480
1483
  none: "none";
1481
1484
  add: "add";
1482
1485
  edit: "edit";
1483
1486
  encoding: "encoding";
1484
1487
  rename: "rename";
1485
- delete: "delete";
1486
1488
  undelete: "undelete";
1487
- branch: "branch";
1488
1489
  merge: "merge";
1489
1490
  lock: "lock";
1490
1491
  rollback: "rollback";
1491
1492
  sourceRename: "sourceRename";
1492
1493
  targetRename: "targetRename";
1493
1494
  property: "property";
1494
- all: "all";
1495
1495
  }>;
1496
1496
  item: z.ZodOptional<z.ZodObject<{
1497
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-KMy1H3XS.mjs";
4
4
  import { z } from "zod";
5
5
  import ky, { isHTTPError } from "ky";
6
6
  import * as path from "node:path";
@@ -256,7 +256,7 @@ var AzureDevOpsClient = class AzureDevOpsClient {
256
256
  pullRequests;
257
257
  subscriptions;
258
258
  constructor(url, accessToken, debug = false) {
259
- this.organizationSlug = url.organisation;
259
+ this.organizationSlug = url.organization;
260
260
  const organizationUrl = url.value.toString().replace(/\/$/, "");
261
261
  this.organizationUrl = organizationUrl;
262
262
  const mainClientOptions = AzureDevOpsClient.createClientOptions(accessToken, debug, { prefixUrl: organizationUrl });
@@ -1220,40 +1220,40 @@ const AzdoEventSchema = z.object({
1220
1220
 
1221
1221
  //#endregion
1222
1222
  //#region src/azure/url-parts.ts
1223
- function extractOrganizationUrl({ organisationUrl }) {
1224
- const value = new URL(organisationUrl);
1223
+ function extractOrganizationUrl({ organizationUrl }) {
1224
+ const value = new URL(organizationUrl);
1225
1225
  const protocol = value.protocol.slice(0, -1);
1226
1226
  let { hostname } = value;
1227
1227
  if (/^(?<prefix>\S+)\.visualstudio\.com$/iu.test(hostname)) hostname = "dev.azure.com";
1228
- const organisation = extractOrganisation(organisationUrl);
1228
+ const organization = extractOrganization(organizationUrl);
1229
1229
  const virtualDirectory = extractVirtualDirectory(value);
1230
1230
  const apiEndpoint = `${protocol}://${hostname}${value.port ? `:${value.port}` : ""}/${virtualDirectory ? `${virtualDirectory}/` : ""}`;
1231
- const identityApiUrl = hostname === "dev.azure.com" || hostname.endsWith(".visualstudio.com") ? new URL(`https://vssps.dev.azure.com/${organisation}/`) : value;
1231
+ const identityApiUrl = hostname === "dev.azure.com" || hostname.endsWith(".visualstudio.com") ? new URL(`https://vssps.dev.azure.com/${organization}/`) : value;
1232
1232
  return {
1233
1233
  value,
1234
1234
  hostname,
1235
1235
  "api-endpoint": apiEndpoint,
1236
- organisation,
1236
+ organization,
1237
1237
  "virtual-directory": virtualDirectory,
1238
1238
  "identity-api-url": identityApiUrl
1239
1239
  };
1240
1240
  }
1241
- function extractProjectUrl({ organisationUrl, project }) {
1242
- const extracted = extractOrganizationUrl({ organisationUrl });
1241
+ function extractProjectUrl({ organizationUrl, project }) {
1242
+ const extracted = extractOrganizationUrl({ organizationUrl });
1243
1243
  const decodedProject = decodeURIComponent(project);
1244
1244
  return {
1245
1245
  ...extracted,
1246
1246
  project: decodedProject
1247
1247
  };
1248
1248
  }
1249
- function extractRepositoryUrl({ organisationUrl, project, repository }) {
1249
+ function extractRepositoryUrl({ organizationUrl, project, repository }) {
1250
1250
  const extracted = extractProjectUrl({
1251
- organisationUrl,
1251
+ organizationUrl,
1252
1252
  project
1253
1253
  });
1254
- const { organisation, "virtual-directory": virtualDirectory, project: decodedProject } = extracted;
1254
+ const { organization, "virtual-directory": virtualDirectory, project: decodedProject } = extracted;
1255
1255
  const decodedRepository = decodeURIComponent(repository);
1256
- const repoSlug = `${virtualDirectory ? `${virtualDirectory}/` : ""}${organisation}/${encodeURI(decodedProject)}/_git/${encodeURI(decodedRepository)}`;
1256
+ const repoSlug = `${virtualDirectory ? `${virtualDirectory}/` : ""}${organization}/${encodeURI(decodedProject)}/_git/${encodeURI(decodedRepository)}`;
1257
1257
  return {
1258
1258
  ...extracted,
1259
1259
  repository: decodedRepository,
@@ -1261,32 +1261,32 @@ function extractRepositoryUrl({ organisationUrl, project, repository }) {
1261
1261
  };
1262
1262
  }
1263
1263
  /**
1264
- * Extract organisation name from organisation URL
1264
+ * Extract organization name from organization URL
1265
1265
  *
1266
- * @param organisationUrl
1266
+ * @param organizationUrl
1267
1267
  *
1268
- * @returns organisation name
1268
+ * @returns organization name
1269
1269
  */
1270
- function extractOrganisation(organisationUrl) {
1271
- const { hostname, pathname } = new URL(organisationUrl);
1270
+ function extractOrganization(organizationUrl) {
1271
+ const { hostname, pathname } = new URL(organizationUrl);
1272
1272
  if (hostname.endsWith(".visualstudio.com")) return hostname.split(".")[0];
1273
1273
  const pathSegments = pathname.split("/").filter((segment) => segment !== "");
1274
1274
  if (pathSegments.length >= 2 && hostname !== "dev.azure.com") return pathSegments[1];
1275
1275
  if (pathSegments.length >= 1) return pathSegments[0];
1276
- throw new Error(`Error parsing organisation from organisation url: '${organisationUrl}'.`);
1276
+ throw new Error(`Error parsing organization from organization url: '${organizationUrl}'.`);
1277
1277
  }
1278
1278
  /**
1279
- * Extract virtual directory from organisation URL
1279
+ * Extract virtual directory from organization URL
1280
1280
  *
1281
1281
  * Virtual Directories are sometimes used in on-premises
1282
- * @param organisationUrl
1282
+ * @param organizationUrl
1283
1283
  *
1284
1284
  * @returns virtual directory
1285
1285
  *
1286
1286
  * @example URLs typically are like this:`https://server.domain.com/tfs/x/` and `tfs` is the virtual directory
1287
1287
  */
1288
- function extractVirtualDirectory(organisationUrl) {
1289
- const path$1 = organisationUrl.pathname.split("/");
1288
+ function extractVirtualDirectory(organizationUrl) {
1289
+ const path$1 = organizationUrl.pathname.split("/");
1290
1290
  return path$1.length === 4 ? path$1[1] : void 0;
1291
1291
  }
1292
1292