@cat-indev/catops-cli 0.0.1-alpha.10
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/README.md +1254 -0
- package/dist/bin/devops-cli.d.ts +2 -0
- package/dist/bin/devops-cli.js +132 -0
- package/dist/bin/devops-cli.js.map +1 -0
- package/dist/core/Context.d.ts +56 -0
- package/dist/core/Context.js +197 -0
- package/dist/core/Context.js.map +1 -0
- package/dist/core/Menu.d.ts +23 -0
- package/dist/core/Menu.js +160 -0
- package/dist/core/Menu.js.map +1 -0
- package/dist/core/Notifier.d.ts +42 -0
- package/dist/core/Notifier.js +128 -0
- package/dist/core/Notifier.js.map +1 -0
- package/dist/core/classifiers.d.ts +45 -0
- package/dist/core/classifiers.js +90 -0
- package/dist/core/classifiers.js.map +1 -0
- package/dist/core/logger.d.ts +8 -0
- package/dist/core/logger.js +37 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/messages.d.ts +102 -0
- package/dist/core/messages.js +163 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/prompt.d.ts +10 -0
- package/dist/core/prompt.js +87 -0
- package/dist/core/prompt.js.map +1 -0
- package/dist/core/senders.d.ts +27 -0
- package/dist/core/senders.js +109 -0
- package/dist/core/senders.js.map +1 -0
- package/dist/core/types.d.ts +135 -0
- package/dist/core/types.js +33 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -0
- package/dist/services/ansible.d.ts +12 -0
- package/dist/services/ansible.js +35 -0
- package/dist/services/ansible.js.map +1 -0
- package/dist/services/archive.d.ts +4 -0
- package/dist/services/archive.js +16 -0
- package/dist/services/archive.js.map +1 -0
- package/dist/services/argocd.d.ts +23 -0
- package/dist/services/argocd.js +48 -0
- package/dist/services/argocd.js.map +1 -0
- package/dist/services/az.d.ts +38 -0
- package/dist/services/az.js +51 -0
- package/dist/services/az.js.map +1 -0
- package/dist/services/azdo-api.d.ts +213 -0
- package/dist/services/azdo-api.js +247 -0
- package/dist/services/azdo-api.js.map +1 -0
- package/dist/services/azdo.d.ts +13 -0
- package/dist/services/azdo.js +57 -0
- package/dist/services/azdo.js.map +1 -0
- package/dist/services/docker.d.ts +21 -0
- package/dist/services/docker.js +36 -0
- package/dist/services/docker.js.map +1 -0
- package/dist/services/git.d.ts +9 -0
- package/dist/services/git.js +36 -0
- package/dist/services/git.js.map +1 -0
- package/dist/services/helm.d.ts +4 -0
- package/dist/services/helm.js +24 -0
- package/dist/services/helm.js.map +1 -0
- package/dist/services/http-types.d.ts +57 -0
- package/dist/services/http-types.js +3 -0
- package/dist/services/http-types.js.map +1 -0
- package/dist/services/http.d.ts +64 -0
- package/dist/services/http.js +288 -0
- package/dist/services/http.js.map +1 -0
- package/dist/services/index.d.ts +37 -0
- package/dist/services/index.js +88 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/kubectl.d.ts +137 -0
- package/dist/services/kubectl.js +271 -0
- package/dist/services/kubectl.js.map +1 -0
- package/dist/services/npm.d.ts +5 -0
- package/dist/services/npm.js +20 -0
- package/dist/services/npm.js.map +1 -0
- package/dist/services/oc.d.ts +156 -0
- package/dist/services/oc.js +309 -0
- package/dist/services/oc.js.map +1 -0
- package/dist/services/pipeline.d.ts +116 -0
- package/dist/services/pipeline.js +474 -0
- package/dist/services/pipeline.js.map +1 -0
- package/dist/services/shell.d.ts +28 -0
- package/dist/services/shell.js +206 -0
- package/dist/services/shell.js.map +1 -0
- package/dist/services/tekton.d.ts +16 -0
- package/dist/services/tekton.js +46 -0
- package/dist/services/tekton.js.map +1 -0
- package/dist/services/terraform.d.ts +31 -0
- package/dist/services/terraform.js +63 -0
- package/dist/services/terraform.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.login = login;
|
|
4
|
+
exports.appSync = appSync;
|
|
5
|
+
exports.appGet = appGet;
|
|
6
|
+
exports.appWait = appWait;
|
|
7
|
+
exports.appSet = appSet;
|
|
8
|
+
exports.appList = appList;
|
|
9
|
+
exports.appRollback = appRollback;
|
|
10
|
+
const shell_1 = require("./shell");
|
|
11
|
+
function login({ server, username, password, insecure = false, exec }) {
|
|
12
|
+
const args = ["login", server, "--username", username, "--password", password];
|
|
13
|
+
if (insecure) {
|
|
14
|
+
args.push("--insecure");
|
|
15
|
+
}
|
|
16
|
+
return shell_1.shell.exec("argocd", ...(0, shell_1.withExecOptions)(args, exec));
|
|
17
|
+
}
|
|
18
|
+
function appSync(name, { prune = false, exec } = {}) {
|
|
19
|
+
const args = ["app", "sync", name];
|
|
20
|
+
if (prune) {
|
|
21
|
+
args.push("--prune");
|
|
22
|
+
}
|
|
23
|
+
return shell_1.shell.exec("argocd", ...(0, shell_1.withExecOptions)(args, exec));
|
|
24
|
+
}
|
|
25
|
+
function appGet(name, exec) {
|
|
26
|
+
return shell_1.shell.exec("argocd", ...(0, shell_1.withExecOptions)(["app", "get", name], exec));
|
|
27
|
+
}
|
|
28
|
+
function appWait(name, { timeout, exec } = {}) {
|
|
29
|
+
const args = ["app", "wait", name];
|
|
30
|
+
if (timeout) {
|
|
31
|
+
args.push("--timeout", String(timeout));
|
|
32
|
+
}
|
|
33
|
+
return shell_1.shell.exec("argocd", ...(0, shell_1.withExecOptions)(args, exec));
|
|
34
|
+
}
|
|
35
|
+
function appSet(name, params = {}, exec) {
|
|
36
|
+
const args = ["app", "set", name];
|
|
37
|
+
Object.entries(params).forEach(([k, v]) => {
|
|
38
|
+
args.push("-p", `${k}=${v}`);
|
|
39
|
+
});
|
|
40
|
+
return shell_1.shell.exec("argocd", ...(0, shell_1.withExecOptions)(args, exec));
|
|
41
|
+
}
|
|
42
|
+
function appList(exec) {
|
|
43
|
+
return shell_1.shell.exec("argocd", ...(0, shell_1.withExecOptions)(["app", "list"], exec));
|
|
44
|
+
}
|
|
45
|
+
function appRollback(name, revisionId, exec) {
|
|
46
|
+
return shell_1.shell.exec("argocd", ...(0, shell_1.withExecOptions)(["app", "rollback", name, revisionId], exec));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=argocd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argocd.js","sourceRoot":"","sources":["../../src/services/argocd.ts"],"names":[],"mappings":";;AAqBA,sBAUC;AAED,0BAUC;AAED,wBAEC;AAED,0BAUC;AAED,wBAUC;AAED,0BAEC;AAED,kCAEC;AA/ED,mCAAiD;AAqBjD,SAAgB,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,IAAI,EAAoB;IAE1F,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IAE/E,IAAI,QAAQ,EAAE,CAAC;QACX,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,aAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAA,uBAAe,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAEhE,CAAC;AAED,SAAgB,OAAO,CAAC,IAAY,EAAE,EAAE,KAAK,GAAG,KAAK,EAAE,IAAI,KAAsB,EAAE;IAE/E,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAEnC,IAAI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,aAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAA,uBAAe,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAEhE,CAAC;AAED,SAAgB,MAAM,CAAC,IAAY,EAAE,IAAkB;IACnD,OAAO,aAAK,CAAC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AAkB;IAC5E,OAAO,aAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAA,uBAAe,EAAC,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AACjG,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ExecOptions, ExecResult } from "../core/types";
|
|
2
|
+
export interface AzLoginOptions {
|
|
3
|
+
username: string;
|
|
4
|
+
password: string;
|
|
5
|
+
tenant: string;
|
|
6
|
+
exec?: ExecOptions;
|
|
7
|
+
}
|
|
8
|
+
export interface AzAcrBuildOptions {
|
|
9
|
+
registry: string;
|
|
10
|
+
image: string;
|
|
11
|
+
file?: string;
|
|
12
|
+
exec?: ExecOptions;
|
|
13
|
+
}
|
|
14
|
+
export interface AzWebappDeployOptions {
|
|
15
|
+
name: string;
|
|
16
|
+
resourceGroup: string;
|
|
17
|
+
srcPath: string;
|
|
18
|
+
exec?: ExecOptions;
|
|
19
|
+
}
|
|
20
|
+
export interface AzAksCredentialsOptions {
|
|
21
|
+
name: string;
|
|
22
|
+
resourceGroup: string;
|
|
23
|
+
overwriteExisting?: boolean;
|
|
24
|
+
exec?: ExecOptions;
|
|
25
|
+
}
|
|
26
|
+
export interface AzDeploymentGroupOptions {
|
|
27
|
+
resourceGroup: string;
|
|
28
|
+
templateFile: string;
|
|
29
|
+
parameters?: Record<string, string>;
|
|
30
|
+
exec?: ExecOptions;
|
|
31
|
+
}
|
|
32
|
+
export declare function loginServicePrincipal({ username, password, tenant, exec }: AzLoginOptions): Promise<ExecResult>;
|
|
33
|
+
export declare function setAccount(subscription: string, exec?: ExecOptions): Promise<ExecResult>;
|
|
34
|
+
export declare function acrBuild({ registry, image, file, exec }: AzAcrBuildOptions): Promise<ExecResult>;
|
|
35
|
+
export declare function acrLogin(registry: string, exec?: ExecOptions): Promise<ExecResult>;
|
|
36
|
+
export declare function webappDeploy({ name, resourceGroup, srcPath, exec }: AzWebappDeployOptions): Promise<ExecResult>;
|
|
37
|
+
export declare function aksGetCredentials({ name, resourceGroup, overwriteExisting, exec }: AzAksCredentialsOptions): Promise<ExecResult>;
|
|
38
|
+
export declare function deploymentGroupCreate({ resourceGroup, templateFile, parameters, exec }: AzDeploymentGroupOptions): Promise<ExecResult>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loginServicePrincipal = loginServicePrincipal;
|
|
4
|
+
exports.setAccount = setAccount;
|
|
5
|
+
exports.acrBuild = acrBuild;
|
|
6
|
+
exports.acrLogin = acrLogin;
|
|
7
|
+
exports.webappDeploy = webappDeploy;
|
|
8
|
+
exports.aksGetCredentials = aksGetCredentials;
|
|
9
|
+
exports.deploymentGroupCreate = deploymentGroupCreate;
|
|
10
|
+
const shell_1 = require("./shell");
|
|
11
|
+
function loginServicePrincipal({ username, password, tenant, exec }) {
|
|
12
|
+
const args = ["login", "--service-principal", "-u", username, "-p", password, "--tenant", tenant];
|
|
13
|
+
return shell_1.shell.exec("az", ...(0, shell_1.withExecOptions)(args, exec));
|
|
14
|
+
}
|
|
15
|
+
function setAccount(subscription, exec) {
|
|
16
|
+
return shell_1.shell.exec("az", ...(0, shell_1.withExecOptions)(["account", "set", "--subscription", subscription], exec));
|
|
17
|
+
}
|
|
18
|
+
function acrBuild({ registry, image, file = ".", exec }) {
|
|
19
|
+
const args = ["acr", "build", "--registry", registry, "--image", image, file];
|
|
20
|
+
return shell_1.shell.exec("az", ...(0, shell_1.withExecOptions)(args, exec));
|
|
21
|
+
}
|
|
22
|
+
function acrLogin(registry, exec) {
|
|
23
|
+
return shell_1.shell.exec("az", ...(0, shell_1.withExecOptions)(["acr", "login", "--name", registry], exec));
|
|
24
|
+
}
|
|
25
|
+
function webappDeploy({ name, resourceGroup, srcPath, exec }) {
|
|
26
|
+
const args = ["webapp", "deploy", "--name", name, "--resource-group", resourceGroup, "--src-path", srcPath];
|
|
27
|
+
return shell_1.shell.exec("az", ...(0, shell_1.withExecOptions)(args, exec));
|
|
28
|
+
}
|
|
29
|
+
function aksGetCredentials({ name, resourceGroup, overwriteExisting = true, exec }) {
|
|
30
|
+
const args = [
|
|
31
|
+
"aks", "get-credentials",
|
|
32
|
+
"--name", name,
|
|
33
|
+
"--resource-group", resourceGroup
|
|
34
|
+
];
|
|
35
|
+
if (overwriteExisting) {
|
|
36
|
+
args.push("--overwrite-existing");
|
|
37
|
+
}
|
|
38
|
+
return shell_1.shell.exec("az", ...(0, shell_1.withExecOptions)(args, exec));
|
|
39
|
+
}
|
|
40
|
+
function deploymentGroupCreate({ resourceGroup, templateFile, parameters = {}, exec }) {
|
|
41
|
+
const args = [
|
|
42
|
+
"deployment", "group", "create",
|
|
43
|
+
"--resource-group", resourceGroup,
|
|
44
|
+
"--template-file", templateFile
|
|
45
|
+
];
|
|
46
|
+
Object.entries(parameters).forEach(([k, v]) => {
|
|
47
|
+
args.push("--parameters", `${k}=${v}`);
|
|
48
|
+
});
|
|
49
|
+
return shell_1.shell.exec("az", ...(0, shell_1.withExecOptions)(args, exec));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=az.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"az.js","sourceRoot":"","sources":["../../src/services/az.ts"],"names":[],"mappings":";;AAsCA,sDAMC;AAED,gCAEC;AAED,4BAMC;AAED,4BAEC;AAED,oCAMC;AAED,8CAcC;AAED,sDAcC;AApGD,mCAAiD;AAsCjD,SAAgB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAkB;IAEtF,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAElG,OAAO,aAAK,CAAC,IAAI,CAAC,IAAI,EAAE,GA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EAAE,aAAa,EAAE,iBAAiB,GAAG,IAAI,EAAE,IAAI,EAA2B;IAE9G,MAAM,IAAI,GAAG;QACT,KAAK,EAAE,iBAAiB;QACxB,QAAQ,EAAE,IAAI;QACd,kBAAkB,EAAE,aAAa;KACpC,CAAC;IAEF,IAAI,iBAAiB,EAAE,CAAC;QACpB,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,aAAK,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAA,uBAAe,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAE5D,CAAC;AAED,SAAgB,qBAAqB,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,GAAG,EAAE,EAAE,IAAI,EAA4B;IAElH,MAAM,IAAI,GAAG;QACT,YAAY,EAAE,OAAO,EAAE,QAAQ;QAC/B,kBAAkB,EAAE,aAAa;QACjC,iBAAiB,EAAE,YAAY;KAClC,CAAC;IAEF,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;QAC1C,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,OAAO,aAAK,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAA,uBAAe,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAE5D,CAAC"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import type { HttpRequest, HttpResponse } from "./http-types";
|
|
2
|
+
import type { ExecOptions } from "../core/types";
|
|
3
|
+
interface HttpAgent {
|
|
4
|
+
request<T = unknown>(req: HttpRequest): Promise<HttpResponse<T>>;
|
|
5
|
+
}
|
|
6
|
+
export interface AzureDevOpsApiConfig {
|
|
7
|
+
/** URL base de la instancia (e.g. https://dev.azure.com/myorg o https://myorg.visualstudio.com). */
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
/** Personal Access Token para autenticación. */
|
|
10
|
+
pat: string;
|
|
11
|
+
/** Nombre del proyecto (opcional — se puede pasar por llamada). */
|
|
12
|
+
project?: string;
|
|
13
|
+
/** Versión de la API (default: "7.1"). */
|
|
14
|
+
apiVersion?: string;
|
|
15
|
+
/** Agent HTTP a usar para las peticiones. Si no se pasa, se crea uno interno. */
|
|
16
|
+
agent?: HttpAgent;
|
|
17
|
+
}
|
|
18
|
+
export interface AzdoRequestOptions {
|
|
19
|
+
/** Project override para esta llamada. */
|
|
20
|
+
project?: string;
|
|
21
|
+
/** API version override para esta llamada. */
|
|
22
|
+
apiVersion?: string;
|
|
23
|
+
/** Parámetros query extra. */
|
|
24
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
25
|
+
/** Opciones de exec (dryRun, retry, timeout). */
|
|
26
|
+
exec?: ExecOptions;
|
|
27
|
+
/** Si es true, omite el project de la URL (para endpoints de organización). */
|
|
28
|
+
organizationLevel?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface AzdoProject {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
url: string;
|
|
34
|
+
state: string;
|
|
35
|
+
revision: string;
|
|
36
|
+
visibility: string;
|
|
37
|
+
lastUpdateTime: string;
|
|
38
|
+
}
|
|
39
|
+
export interface AzdoGitRepository {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
url: string;
|
|
43
|
+
defaultBranch: string | null;
|
|
44
|
+
project: AzdoProject;
|
|
45
|
+
size: number;
|
|
46
|
+
remoteUrl: string;
|
|
47
|
+
sshUrl: string;
|
|
48
|
+
webUrl: string;
|
|
49
|
+
isDisabled: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface AzdoGitBranch {
|
|
52
|
+
name: string;
|
|
53
|
+
aheadCount: number;
|
|
54
|
+
behindCount: number;
|
|
55
|
+
isBaseVersion: boolean;
|
|
56
|
+
commit: AzdoGitCommitRef;
|
|
57
|
+
}
|
|
58
|
+
export interface AzdoGitCommitRef {
|
|
59
|
+
commitId: string;
|
|
60
|
+
author: AzdoGitAuthor;
|
|
61
|
+
committer: AzdoGitAuthor;
|
|
62
|
+
comment: string;
|
|
63
|
+
url: string;
|
|
64
|
+
}
|
|
65
|
+
export interface AzdoGitAuthor {
|
|
66
|
+
name: string;
|
|
67
|
+
email: string;
|
|
68
|
+
date: string;
|
|
69
|
+
}
|
|
70
|
+
export interface AzdoGitPullRequest {
|
|
71
|
+
pullRequestId: number;
|
|
72
|
+
title: string;
|
|
73
|
+
description: string;
|
|
74
|
+
status: string;
|
|
75
|
+
createdBy: AzdoGitAuthor;
|
|
76
|
+
creationDate: string;
|
|
77
|
+
sourceRefName: string;
|
|
78
|
+
targetRefName: string;
|
|
79
|
+
mergeStatus: string;
|
|
80
|
+
mergeId: string;
|
|
81
|
+
url: string;
|
|
82
|
+
}
|
|
83
|
+
export interface AzdoBuildDefinition {
|
|
84
|
+
id: number;
|
|
85
|
+
name: string;
|
|
86
|
+
path: string;
|
|
87
|
+
queueStatus: string;
|
|
88
|
+
revision: number;
|
|
89
|
+
type: string;
|
|
90
|
+
url: string;
|
|
91
|
+
}
|
|
92
|
+
export interface AzdoBuild {
|
|
93
|
+
id: number;
|
|
94
|
+
buildNumber: string;
|
|
95
|
+
status: string;
|
|
96
|
+
result: string | null;
|
|
97
|
+
definition: {
|
|
98
|
+
id: number;
|
|
99
|
+
name: string;
|
|
100
|
+
};
|
|
101
|
+
requestedBy: AzdoGitAuthor;
|
|
102
|
+
startTime: string;
|
|
103
|
+
finishTime: string | null;
|
|
104
|
+
url: string;
|
|
105
|
+
}
|
|
106
|
+
export interface AzdoPipeline {
|
|
107
|
+
id: number;
|
|
108
|
+
name: string;
|
|
109
|
+
folder: string;
|
|
110
|
+
revision: number;
|
|
111
|
+
url: string;
|
|
112
|
+
}
|
|
113
|
+
export interface AzdoWorkItem {
|
|
114
|
+
id: number;
|
|
115
|
+
rev: number;
|
|
116
|
+
fields: Record<string, unknown>;
|
|
117
|
+
url: string;
|
|
118
|
+
}
|
|
119
|
+
export interface AzdoListResponse<T> {
|
|
120
|
+
count: number;
|
|
121
|
+
value: T[];
|
|
122
|
+
}
|
|
123
|
+
export declare class AzureDevOpsApi {
|
|
124
|
+
private baseUrl;
|
|
125
|
+
private pat;
|
|
126
|
+
private project;
|
|
127
|
+
private apiVersion;
|
|
128
|
+
private agent;
|
|
129
|
+
private ownAgent;
|
|
130
|
+
configure(config: AzureDevOpsApiConfig): this;
|
|
131
|
+
private getAgent;
|
|
132
|
+
private authHeaders;
|
|
133
|
+
private projectPath;
|
|
134
|
+
private version;
|
|
135
|
+
request<T = unknown>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", apiPath: string, opts?: AzdoRequestOptions & {
|
|
136
|
+
body?: unknown;
|
|
137
|
+
}): Promise<HttpResponse<T>>;
|
|
138
|
+
/** Lista todos los proyectos de la organización. */
|
|
139
|
+
listProjects(opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoListResponse<AzdoProject>>>;
|
|
140
|
+
/** Obtiene un proyecto por nombre o GUID. */
|
|
141
|
+
getProject(projectNameOrId: string, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoProject>>;
|
|
142
|
+
/** Lista todos los repos del proyecto. */
|
|
143
|
+
listRepos(opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoListResponse<AzdoGitRepository>>>;
|
|
144
|
+
/** Obtiene un repo por nombre o GUID. */
|
|
145
|
+
getRepo(repoNameOrId: string, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoGitRepository>>;
|
|
146
|
+
/** Lista todas las branches de un repo. */
|
|
147
|
+
listBranches(repoNameOrId: string, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoListResponse<AzdoGitBranch>>>;
|
|
148
|
+
/** Verifica si una branch existe. Devuelve `true`/`false`. */
|
|
149
|
+
branchExists(repoNameOrId: string, branchName: string, opts?: AzdoRequestOptions): Promise<boolean>;
|
|
150
|
+
/** Obtiene una branch específica con su último commit. */
|
|
151
|
+
getBranch(repoNameOrId: string, branchName: string, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoGitBranch>>;
|
|
152
|
+
/** Lista commits de una branch. */
|
|
153
|
+
listCommits(repoNameOrId: string, opts?: AzdoRequestOptions & {
|
|
154
|
+
branch?: string;
|
|
155
|
+
top?: number;
|
|
156
|
+
skip?: number;
|
|
157
|
+
}): Promise<HttpResponse<AzdoListResponse<AzdoGitCommitRef>>>;
|
|
158
|
+
/** Obtiene un commit específico. */
|
|
159
|
+
getCommit(repoNameOrId: string, commitId: string, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoGitCommitRef>>;
|
|
160
|
+
/** Lista pull requests de un repo. */
|
|
161
|
+
listPullRequests(repoNameOrId: string, opts?: AzdoRequestOptions & {
|
|
162
|
+
status?: "active" | "abandoned" | "completed" | "all";
|
|
163
|
+
}): Promise<HttpResponse<AzdoListResponse<AzdoGitPullRequest>>>;
|
|
164
|
+
/** Obtiene un pull request por ID. */
|
|
165
|
+
getPullRequest(repoNameOrId: string, pullRequestId: number, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoGitPullRequest>>;
|
|
166
|
+
/** Crea un pull request. */
|
|
167
|
+
createPullRequest(repoNameOrId: string, pr: {
|
|
168
|
+
sourceRefName: string;
|
|
169
|
+
targetRefName: string;
|
|
170
|
+
title: string;
|
|
171
|
+
description?: string;
|
|
172
|
+
}, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoGitPullRequest>>;
|
|
173
|
+
/** Lista definiciones de build. */
|
|
174
|
+
listBuildDefinitions(opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoListResponse<AzdoBuildDefinition>>>;
|
|
175
|
+
/** Obtiene una definición de build por ID. */
|
|
176
|
+
getBuildDefinition(definitionId: number, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoBuildDefinition>>;
|
|
177
|
+
/** Lista builds recientes. */
|
|
178
|
+
listBuilds(opts?: AzdoRequestOptions & {
|
|
179
|
+
definitionId?: number;
|
|
180
|
+
top?: number;
|
|
181
|
+
status?: string;
|
|
182
|
+
}): Promise<HttpResponse<AzdoListResponse<AzdoBuild>>>;
|
|
183
|
+
/** Obtiene un build por ID. */
|
|
184
|
+
getBuild(buildId: number, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoBuild>>;
|
|
185
|
+
/** Ejecuta (queue) un build. */
|
|
186
|
+
queueBuild(definitionId: number, opts?: AzdoRequestOptions & {
|
|
187
|
+
branch?: string;
|
|
188
|
+
parameters?: Record<string, unknown>;
|
|
189
|
+
}): Promise<HttpResponse<AzdoBuild>>;
|
|
190
|
+
/** Lista pipelines del proyecto. */
|
|
191
|
+
listPipelines(opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoListResponse<AzdoPipeline>>>;
|
|
192
|
+
/** Obtiene un pipeline por ID. */
|
|
193
|
+
getPipeline(pipelineId: number, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoPipeline>>;
|
|
194
|
+
/** Ejecuta (run) un pipeline. */
|
|
195
|
+
runPipeline(pipelineId: number, opts?: AzdoRequestOptions & {
|
|
196
|
+
branch?: string;
|
|
197
|
+
variables?: Record<string, {
|
|
198
|
+
value: unknown;
|
|
199
|
+
}>;
|
|
200
|
+
}): Promise<HttpResponse<Record<string, unknown>>>;
|
|
201
|
+
/** Obtiene un work item por ID. */
|
|
202
|
+
getWorkItem(workItemId: number, opts?: AzdoRequestOptions & {
|
|
203
|
+
fields?: string[];
|
|
204
|
+
}): Promise<HttpResponse<AzdoWorkItem>>;
|
|
205
|
+
/** Consulta work items por WiQL. */
|
|
206
|
+
queryWorkItems(wiql: string, opts?: AzdoRequestOptions): Promise<HttpResponse<{
|
|
207
|
+
workItems: Array<{
|
|
208
|
+
id: number;
|
|
209
|
+
url: string;
|
|
210
|
+
}>;
|
|
211
|
+
}>>;
|
|
212
|
+
}
|
|
213
|
+
export {};
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AzureDevOpsApi = void 0;
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// AzureDevOpsApi
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
class AzureDevOpsApi {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.baseUrl = "";
|
|
10
|
+
this.pat = "";
|
|
11
|
+
this.project = "";
|
|
12
|
+
this.apiVersion = "7.1";
|
|
13
|
+
this.agent = null;
|
|
14
|
+
this.ownAgent = false;
|
|
15
|
+
}
|
|
16
|
+
configure(config) {
|
|
17
|
+
this.baseUrl = config.baseUrl.replace(/\/+$/, "");
|
|
18
|
+
this.pat = config.pat;
|
|
19
|
+
if (config.project !== undefined)
|
|
20
|
+
this.project = config.project;
|
|
21
|
+
if (config.apiVersion !== undefined)
|
|
22
|
+
this.apiVersion = config.apiVersion;
|
|
23
|
+
if (config.agent) {
|
|
24
|
+
this.agent = config.agent;
|
|
25
|
+
this.ownAgent = false;
|
|
26
|
+
}
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
getAgent() {
|
|
30
|
+
if (!this.agent) {
|
|
31
|
+
throw new Error("AzureDevOpsApi not configured. Call .configure({ baseUrl, pat }) first.");
|
|
32
|
+
}
|
|
33
|
+
return this.agent;
|
|
34
|
+
}
|
|
35
|
+
authHeaders() {
|
|
36
|
+
const encoded = Buffer.from(`:${this.pat}`).toString("base64");
|
|
37
|
+
return {
|
|
38
|
+
"Authorization": `Basic ${encoded}`,
|
|
39
|
+
"Accept": "application/json"
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
projectPath(opts) {
|
|
43
|
+
const p = opts?.project ?? this.project;
|
|
44
|
+
return p ? `/${p}` : "";
|
|
45
|
+
}
|
|
46
|
+
version(opts) {
|
|
47
|
+
return opts?.apiVersion ?? this.apiVersion;
|
|
48
|
+
}
|
|
49
|
+
// ---- internal request helper ----
|
|
50
|
+
async request(method, apiPath, opts) {
|
|
51
|
+
const prefix = opts?.organizationLevel ? "" : this.projectPath(opts);
|
|
52
|
+
const url = `${this.baseUrl}${prefix}/_apis${apiPath}`;
|
|
53
|
+
const agent = this.getAgent();
|
|
54
|
+
return agent.request({
|
|
55
|
+
url,
|
|
56
|
+
method,
|
|
57
|
+
headers: this.authHeaders(),
|
|
58
|
+
body: opts?.body,
|
|
59
|
+
query: {
|
|
60
|
+
"api-version": this.version(opts),
|
|
61
|
+
...opts?.query
|
|
62
|
+
},
|
|
63
|
+
exec: opts?.exec
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// =========================================================================
|
|
67
|
+
// Projects
|
|
68
|
+
// =========================================================================
|
|
69
|
+
/** Lista todos los proyectos de la organización. */
|
|
70
|
+
listProjects(opts) {
|
|
71
|
+
return this.request("GET", "/projects", { ...opts, organizationLevel: true });
|
|
72
|
+
}
|
|
73
|
+
/** Obtiene un proyecto por nombre o GUID. */
|
|
74
|
+
getProject(projectNameOrId, opts) {
|
|
75
|
+
return this.request("GET", `/projects/${encodeURIComponent(projectNameOrId)}`, { ...opts, organizationLevel: true });
|
|
76
|
+
}
|
|
77
|
+
// =========================================================================
|
|
78
|
+
// Git Repositories
|
|
79
|
+
// =========================================================================
|
|
80
|
+
/** Lista todos los repos del proyecto. */
|
|
81
|
+
listRepos(opts) {
|
|
82
|
+
return this.request("GET", "/git/repositories", opts);
|
|
83
|
+
}
|
|
84
|
+
/** Obtiene un repo por nombre o GUID. */
|
|
85
|
+
getRepo(repoNameOrId, opts) {
|
|
86
|
+
return this.request("GET", `/git/repositories/${encodeURIComponent(repoNameOrId)}`, opts);
|
|
87
|
+
}
|
|
88
|
+
// =========================================================================
|
|
89
|
+
// Branches
|
|
90
|
+
// =========================================================================
|
|
91
|
+
/** Lista todas las branches de un repo. */
|
|
92
|
+
listBranches(repoNameOrId, opts) {
|
|
93
|
+
return this.request("GET", `/git/repositories/${encodeURIComponent(repoNameOrId)}/refs`, {
|
|
94
|
+
...opts,
|
|
95
|
+
query: { filter: "heads/", ...opts?.query }
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/** Verifica si una branch existe. Devuelve `true`/`false`. */
|
|
99
|
+
async branchExists(repoNameOrId, branchName, opts) {
|
|
100
|
+
try {
|
|
101
|
+
const refName = branchName.startsWith("refs/heads/") ? branchName : `refs/heads/${branchName}`;
|
|
102
|
+
await this.request("GET", `/git/repositories/${encodeURIComponent(repoNameOrId)}/refs/${refName}`, opts);
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
if (err && typeof err === "object" && "status" in err && err.status === 404) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/** Obtiene una branch específica con su último commit. */
|
|
113
|
+
getBranch(repoNameOrId, branchName, opts) {
|
|
114
|
+
const refName = branchName.startsWith("refs/heads/") ? branchName : `refs/heads/${branchName}`;
|
|
115
|
+
return this.request("GET", `/git/repositories/${encodeURIComponent(repoNameOrId)}/refs/${refName}`, opts);
|
|
116
|
+
}
|
|
117
|
+
// =========================================================================
|
|
118
|
+
// Commits
|
|
119
|
+
// =========================================================================
|
|
120
|
+
/** Lista commits de una branch. */
|
|
121
|
+
listCommits(repoNameOrId, opts) {
|
|
122
|
+
const branch = opts?.branch ?? "main";
|
|
123
|
+
const body = {
|
|
124
|
+
searchCriteria: {
|
|
125
|
+
itemVersion: { version: branch, versionType: "branch" },
|
|
126
|
+
...(opts?.top !== undefined ? { $top: opts.top } : {}),
|
|
127
|
+
...(opts?.skip !== undefined ? { $skip: opts.skip } : {})
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
return this.request("POST", `/git/repositories/${encodeURIComponent(repoNameOrId)}/commits`, {
|
|
131
|
+
...opts,
|
|
132
|
+
body
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/** Obtiene un commit específico. */
|
|
136
|
+
getCommit(repoNameOrId, commitId, opts) {
|
|
137
|
+
return this.request("GET", `/git/repositories/${encodeURIComponent(repoNameOrId)}/commits/${commitId}`, opts);
|
|
138
|
+
}
|
|
139
|
+
// =========================================================================
|
|
140
|
+
// Pull Requests
|
|
141
|
+
// =========================================================================
|
|
142
|
+
/** Lista pull requests de un repo. */
|
|
143
|
+
listPullRequests(repoNameOrId, opts) {
|
|
144
|
+
return this.request("GET", `/git/repositories/${encodeURIComponent(repoNameOrId)}/pullrequests`, {
|
|
145
|
+
...opts,
|
|
146
|
+
query: { status: opts?.status ?? "active", ...opts?.query }
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/** Obtiene un pull request por ID. */
|
|
150
|
+
getPullRequest(repoNameOrId, pullRequestId, opts) {
|
|
151
|
+
return this.request("GET", `/git/repositories/${encodeURIComponent(repoNameOrId)}/pullrequests/${pullRequestId}`, opts);
|
|
152
|
+
}
|
|
153
|
+
/** Crea un pull request. */
|
|
154
|
+
createPullRequest(repoNameOrId, pr, opts) {
|
|
155
|
+
return this.request("POST", `/git/repositories/${encodeURIComponent(repoNameOrId)}/pullrequests`, {
|
|
156
|
+
...opts,
|
|
157
|
+
body: pr
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
// =========================================================================
|
|
161
|
+
// Build Definitions
|
|
162
|
+
// =========================================================================
|
|
163
|
+
/** Lista definiciones de build. */
|
|
164
|
+
listBuildDefinitions(opts) {
|
|
165
|
+
return this.request("GET", "/build/definitions", opts);
|
|
166
|
+
}
|
|
167
|
+
/** Obtiene una definición de build por ID. */
|
|
168
|
+
getBuildDefinition(definitionId, opts) {
|
|
169
|
+
return this.request("GET", `/build/definitions/${definitionId}`, opts);
|
|
170
|
+
}
|
|
171
|
+
// =========================================================================
|
|
172
|
+
// Builds
|
|
173
|
+
// =========================================================================
|
|
174
|
+
/** Lista builds recientes. */
|
|
175
|
+
listBuilds(opts) {
|
|
176
|
+
return this.request("GET", "/build/builds", {
|
|
177
|
+
...opts,
|
|
178
|
+
query: {
|
|
179
|
+
...(opts?.definitionId !== undefined ? { definitionId: opts.definitionId } : {}),
|
|
180
|
+
...(opts?.top !== undefined ? { $top: opts.top } : {}),
|
|
181
|
+
...(opts?.status !== undefined ? { statusFilter: opts.status } : {}),
|
|
182
|
+
...opts?.query
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/** Obtiene un build por ID. */
|
|
187
|
+
getBuild(buildId, opts) {
|
|
188
|
+
return this.request("GET", `/build/builds/${buildId}`, opts);
|
|
189
|
+
}
|
|
190
|
+
/** Ejecuta (queue) un build. */
|
|
191
|
+
queueBuild(definitionId, opts) {
|
|
192
|
+
const body = { definition: { id: definitionId } };
|
|
193
|
+
if (opts?.branch) {
|
|
194
|
+
body.sourceBranch = opts.branch.startsWith("refs/") ? opts.branch : `refs/heads/${opts.branch}`;
|
|
195
|
+
}
|
|
196
|
+
if (opts?.parameters) {
|
|
197
|
+
body.parameters = opts.parameters;
|
|
198
|
+
}
|
|
199
|
+
return this.request("POST", "/build/builds", { ...opts, body });
|
|
200
|
+
}
|
|
201
|
+
// =========================================================================
|
|
202
|
+
// Pipelines
|
|
203
|
+
// =========================================================================
|
|
204
|
+
/** Lista pipelines del proyecto. */
|
|
205
|
+
listPipelines(opts) {
|
|
206
|
+
return this.request("GET", "/pipelines", opts);
|
|
207
|
+
}
|
|
208
|
+
/** Obtiene un pipeline por ID. */
|
|
209
|
+
getPipeline(pipelineId, opts) {
|
|
210
|
+
return this.request("GET", `/pipelines/${pipelineId}`, opts);
|
|
211
|
+
}
|
|
212
|
+
/** Ejecuta (run) un pipeline. */
|
|
213
|
+
runPipeline(pipelineId, opts) {
|
|
214
|
+
const body = {};
|
|
215
|
+
if (opts?.branch) {
|
|
216
|
+
body.resources = {
|
|
217
|
+
repositories: {
|
|
218
|
+
self: { refName: opts.branch.startsWith("refs/") ? opts.branch : `refs/heads/${opts.branch}` }
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
if (opts?.variables) {
|
|
223
|
+
body.variables = opts.variables;
|
|
224
|
+
}
|
|
225
|
+
return this.request("POST", `/pipelines/${pipelineId}/runs`, { ...opts, body });
|
|
226
|
+
}
|
|
227
|
+
// =========================================================================
|
|
228
|
+
// Work Items
|
|
229
|
+
// =========================================================================
|
|
230
|
+
/** Obtiene un work item por ID. */
|
|
231
|
+
getWorkItem(workItemId, opts) {
|
|
232
|
+
const query = {};
|
|
233
|
+
if (opts?.fields?.length) {
|
|
234
|
+
query.fields = opts.fields.join(",");
|
|
235
|
+
}
|
|
236
|
+
return this.request("GET", `/wit/workitems/${workItemId}`, { ...opts, query });
|
|
237
|
+
}
|
|
238
|
+
/** Consulta work items por WiQL. */
|
|
239
|
+
queryWorkItems(wiql, opts) {
|
|
240
|
+
return this.request("POST", "/wit/wiql", {
|
|
241
|
+
...opts,
|
|
242
|
+
body: { query: wiql }
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
exports.AzureDevOpsApi = AzureDevOpsApi;
|
|
247
|
+
//# sourceMappingURL=azdo-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azdo-api.js","sourceRoot":"","sources":["../../src/services/azdo-api.ts"],"names":[],"mappings":";;;AAoJA,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,MAAa,cAAc;IAA3B;QAEY,YAAO,GAAG,EAAE,CAAC;QACb,QAAG,GAAG,EAAE,CAAC;QACT,YAAO,GAAG,EAAE,CAAC;QACb,eAAU,GAAG,KAAK,CAAC;QACnB,UAAK,GAAqB,IAAI,CAAC;QAC/B,aAAQ,GAAG,KAAK,CAAC;IA4S7B,CAAC;IA1SG,SAAS,CAAC,MAA4B;QAClC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;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EAAE,KAAK,EAAE,CAAC,CAAC;IACnF,CAAC;IAED,oCAAoC;IACpC,cAAc,CACV,IAAY,EACZ,IAAyB;QAEzB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE;YACrC,GAAG,IAAI;YACP,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;SACxB,CAAC,CAAC;IACP,CAAC;CAEJ;AAnTD,wCAmTC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface SetVariableOptions {
|
|
2
|
+
isSecret?: boolean;
|
|
3
|
+
isOutput?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function setVariable(name: string, value: unknown, { isSecret, isOutput }?: SetVariableOptions): void;
|
|
6
|
+
export declare function logError(message: string): void;
|
|
7
|
+
export declare function logWarning(message: string): void;
|
|
8
|
+
export declare function setProgress(percent: number, currentOperation?: string): void;
|
|
9
|
+
export declare function complete(result?: "Succeeded" | "SucceededWithIssues" | "Failed", message?: string): void;
|
|
10
|
+
export declare function addBuildTag(tag: string): void;
|
|
11
|
+
export declare function uploadArtifact(name: string, path: string, containerFolder?: string): void;
|
|
12
|
+
export declare function group(name: string): void;
|
|
13
|
+
export declare function endGroup(): void;
|