@paklo/core 0.11.1 → 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 +4 -11
- package/dist/azure/index.d.mts +12 -12
- package/dist/azure/index.mjs +23 -23
- package/dist/azure/index.mjs.map +1 -1
- package/dist/dependabot/index.d.mts +1 -1
- package/dist/dependabot/index.mjs +1 -1
- package/dist/{dependabot-DbKUmEV3.mjs → dependabot-KMy1H3XS.mjs} +2 -1
- package/dist/dependabot-KMy1H3XS.mjs.map +1 -0
- package/dist/github/index.mjs.map +1 -1
- package/dist/{index-t1Aj_PJX.d.mts → index-flzaUkHI.d.mts} +11 -11
- package/dist/job-ClEevC5P.mjs.map +1 -1
- package/dist/usage.d.mts +3 -3
- package/dist/usage.mjs +1 -1
- package/dist/usage.mjs.map +1 -1
- package/package.json +8 -8
- package/dist/dependabot-DbKUmEV3.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
# Paklo Core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **⚠️ Internal Package - Not for Direct Use**
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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).
|
package/dist/azure/index.d.mts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Jt as DependabotPersistedPr, W as DependabotUpdatePullRequest, Wn as VariableFinderFn, f as DependabotCreatePullRequest, yn as DependabotConfig } from "../index-
|
|
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
|
|
8
|
+
/** URL of the organization. This may lack the project name */
|
|
9
9
|
value: URL;
|
|
10
|
-
/**
|
|
10
|
+
/** Organization URL hostname */
|
|
11
11
|
hostname: string;
|
|
12
|
-
/**
|
|
12
|
+
/** Organization API endpoint URL */
|
|
13
13
|
'api-endpoint': string;
|
|
14
|
-
/**
|
|
15
|
-
|
|
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
|
-
|
|
41
|
+
organizationUrl
|
|
42
42
|
}: {
|
|
43
|
-
|
|
43
|
+
organizationUrl: string;
|
|
44
44
|
}): AzureDevOpsOrganizationUrl;
|
|
45
45
|
declare function extractProjectUrl({
|
|
46
|
-
|
|
46
|
+
organizationUrl,
|
|
47
47
|
project
|
|
48
48
|
}: {
|
|
49
|
-
|
|
49
|
+
organizationUrl: string;
|
|
50
50
|
project: string;
|
|
51
51
|
}): AzureDevOpsProjectUrl;
|
|
52
52
|
declare function extractRepositoryUrl({
|
|
53
|
-
|
|
53
|
+
organizationUrl,
|
|
54
54
|
project,
|
|
55
55
|
repository
|
|
56
56
|
}: {
|
|
57
|
-
|
|
57
|
+
organizationUrl: string;
|
|
58
58
|
project: string;
|
|
59
59
|
repository: string;
|
|
60
60
|
}): AzureDevOpsRepositoryUrl;
|
package/dist/azure/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as logger } from "../logger-3Qfh9NUj.mjs";
|
|
2
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-
|
|
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.
|
|
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({
|
|
1224
|
-
const value = new URL(
|
|
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
|
|
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/${
|
|
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
|
-
|
|
1236
|
+
organization,
|
|
1237
1237
|
"virtual-directory": virtualDirectory,
|
|
1238
1238
|
"identity-api-url": identityApiUrl
|
|
1239
1239
|
};
|
|
1240
1240
|
}
|
|
1241
|
-
function extractProjectUrl({
|
|
1242
|
-
const extracted = extractOrganizationUrl({
|
|
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({
|
|
1249
|
+
function extractRepositoryUrl({ organizationUrl, project, repository }) {
|
|
1250
1250
|
const extracted = extractProjectUrl({
|
|
1251
|
-
|
|
1251
|
+
organizationUrl,
|
|
1252
1252
|
project
|
|
1253
1253
|
});
|
|
1254
|
-
const {
|
|
1254
|
+
const { organization, "virtual-directory": virtualDirectory, project: decodedProject } = extracted;
|
|
1255
1255
|
const decodedRepository = decodeURIComponent(repository);
|
|
1256
|
-
const repoSlug = `${virtualDirectory ? `${virtualDirectory}/` : ""}${
|
|
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
|
|
1264
|
+
* Extract organization name from organization URL
|
|
1265
1265
|
*
|
|
1266
|
-
* @param
|
|
1266
|
+
* @param organizationUrl
|
|
1267
1267
|
*
|
|
1268
|
-
* @returns
|
|
1268
|
+
* @returns organization name
|
|
1269
1269
|
*/
|
|
1270
|
-
function
|
|
1271
|
-
const { hostname, pathname } = new URL(
|
|
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
|
|
1276
|
+
throw new Error(`Error parsing organization from organization url: '${organizationUrl}'.`);
|
|
1277
1277
|
}
|
|
1278
1278
|
/**
|
|
1279
|
-
* Extract virtual directory from
|
|
1279
|
+
* Extract virtual directory from organization URL
|
|
1280
1280
|
*
|
|
1281
1281
|
* Virtual Directories are sometimes used in on-premises
|
|
1282
|
-
* @param
|
|
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(
|
|
1289
|
-
const path$1 =
|
|
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
|
|