@catladder/cli 0.0.0-refactor-untangle-gitlab-api-requests-from-vorpal-57cf3cf2 → 0.0.0-reference-database-url-1befbbee
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/dist/bundles/catenv/index.js +2146 -23675
- package/dist/bundles/cli/index.js +575 -1032
- package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.d.ts +2 -5
- package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.js +9 -26
- package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/commandSetup.js +5 -3
- package/dist/cli/src/apps/cli/commands/project/commandSetup.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/index.d.ts +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/index.js +6 -17
- package/dist/cli/src/apps/cli/commands/project/setup/index.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.d.ts +1 -4
- package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.js +23 -35
- package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.d.ts +2 -5
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js +23 -38
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupTopic.d.ts +1 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupTopic.js +4 -5
- package/dist/cli/src/apps/cli/commands/project/setup/setupTopic.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/utils/autocompletions.d.ts +1 -0
- package/dist/cli/src/apps/cli/commands/project/utils/autocompletions.js +9 -1
- package/dist/cli/src/apps/cli/commands/project/utils/autocompletions.js.map +1 -1
- package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -1
- package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.js +11 -20
- package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -1
- package/dist/cli/src/apps/cli/verify/index.js +5 -22
- package/dist/cli/src/apps/cli/verify/index.js.map +1 -1
- package/dist/cli/src/config/getProjectConfig.d.ts +1 -1
- package/dist/cli/src/config/getProjectConfig.js +10 -12
- package/dist/cli/src/config/getProjectConfig.js.map +1 -1
- package/dist/cli/src/git/gitProjectInformation.d.ts +1 -14
- package/dist/cli/src/git/gitProjectInformation.js +2 -29
- package/dist/cli/src/git/gitProjectInformation.js.map +1 -1
- package/dist/cli/src/utils/gitlab.d.ts +23 -17
- package/dist/cli/src/utils/gitlab.js +161 -120
- package/dist/cli/src/utils/gitlab.js.map +1 -1
- package/dist/cli/src/utils/log.d.ts +0 -15
- package/dist/cli/src/utils/log.js +1 -23
- package/dist/cli/src/utils/log.js.map +1 -1
- package/dist/cli/src/utils/preferences.d.ts +4 -0
- package/dist/cli/src/utils/preferences.js +58 -0
- package/dist/cli/src/utils/preferences.js.map +1 -0
- package/dist/pipeline/src/build/artifacts/createBuildJobArtifact.js +3 -1
- package/dist/pipeline/src/build/artifacts/createBuildJobArtifact.js.map +1 -1
- package/dist/pipeline/src/build/base/index.d.ts +2 -3
- package/dist/pipeline/src/build/base/index.js.map +1 -1
- package/dist/pipeline/src/build/cache/getAllCacheConfigsFromConfig.js +6 -4
- package/dist/pipeline/src/build/cache/getAllCacheConfigsFromConfig.js.map +1 -1
- package/dist/pipeline/src/build/custom/buildJob.d.ts +2 -2
- package/dist/pipeline/src/build/custom/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/custom/index.d.ts +2 -2
- package/dist/pipeline/src/build/custom/index.js.map +1 -1
- package/dist/pipeline/src/build/custom/testJob.d.ts +2 -2
- package/dist/pipeline/src/build/custom/testJob.js.map +1 -1
- package/dist/pipeline/src/build/docker.d.ts +4 -4
- package/dist/pipeline/src/build/docker.js +1 -1
- package/dist/pipeline/src/build/docker.js.map +1 -1
- package/dist/pipeline/src/build/index.d.ts +2 -2
- package/dist/pipeline/src/build/index.js +2 -3
- package/dist/pipeline/src/build/index.js.map +1 -1
- package/dist/pipeline/src/build/node/buildJob.d.ts +5 -3
- package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/node/index.d.ts +4 -4
- package/dist/pipeline/src/build/node/index.js.map +1 -1
- package/dist/pipeline/src/build/node/meteor.d.ts +2 -2
- package/dist/pipeline/src/build/node/meteor.js.map +1 -1
- package/dist/pipeline/src/build/node/yarn.d.ts +1 -1
- package/dist/pipeline/src/build/node/yarn.js +3 -1
- package/dist/pipeline/src/build/node/yarn.js.map +1 -1
- package/dist/pipeline/src/build/rails/build.d.ts +2 -2
- package/dist/pipeline/src/build/rails/build.js +0 -1
- package/dist/pipeline/src/build/rails/build.js.map +1 -1
- package/dist/pipeline/src/build/rails/index.d.ts +2 -2
- package/dist/pipeline/src/build/rails/index.js.map +1 -1
- package/dist/pipeline/src/build/rails/test.js +18 -1
- package/dist/pipeline/src/build/rails/test.js.map +1 -1
- package/dist/pipeline/src/build/sbom.d.ts +2 -2
- package/dist/pipeline/src/build/sbom.js +4 -1
- package/dist/pipeline/src/build/sbom.js.map +1 -1
- package/dist/pipeline/src/build/types.d.ts +8 -0
- package/dist/pipeline/src/build/types.js.map +1 -1
- package/dist/pipeline/src/context/createComponentContext.js +17 -6
- package/dist/pipeline/src/context/createComponentContext.js.map +1 -1
- package/dist/pipeline/src/context/getLabels.js +3 -1
- package/dist/pipeline/src/context/getLabels.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunJobs.js +2 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunJobs.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js +32 -7
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/execute/onDeploy.d.ts +1 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/execute/onDeploy.js +3 -10
- package/dist/pipeline/src/deploy/cloudRun/createJobs/execute/onDeploy.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/healthCheck.d.ts +5 -0
- package/dist/pipeline/src/deploy/cloudRun/createJobs/healthCheck.js +51 -0
- package/dist/pipeline/src/deploy/cloudRun/createJobs/healthCheck.js.map +1 -0
- package/dist/pipeline/src/deploy/cloudRun/index.js +7 -4
- package/dist/pipeline/src/deploy/cloudRun/index.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/database.d.ts +21 -2
- package/dist/pipeline/src/deploy/cloudRun/utils/database.js +55 -6
- package/dist/pipeline/src/deploy/cloudRun/utils/database.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/getJobOrServiceArgs.d.ts +2 -0
- package/dist/pipeline/src/deploy/cloudRun/utils/getJobOrServiceArgs.js +12 -0
- package/dist/pipeline/src/deploy/cloudRun/utils/getJobOrServiceArgs.js.map +1 -0
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.js +3 -1
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.js.map +1 -1
- package/dist/pipeline/src/deploy/sbom.js +4 -3
- package/dist/pipeline/src/deploy/sbom.js.map +1 -1
- package/dist/pipeline/src/deploy/types/googleCloudRun.d.ts +100 -0
- package/dist/pipeline/src/deploy/types/googleCloudRun.js +16 -0
- package/dist/pipeline/src/deploy/types/googleCloudRun.js.map +1 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.js +3 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
- package/dist/pipeline/src/types/config.d.ts +1 -1
- package/dist/pipeline/src/types/context.d.ts +6 -1
- package/dist/pipeline/src/types/context.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/cli/commands/project/commandGitlabCi.ts +20 -58
- package/src/apps/cli/commands/project/commandSetup.ts +5 -3
- package/src/apps/cli/commands/project/setup/index.ts +9 -19
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +45 -62
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +32 -53
- package/src/apps/cli/commands/project/setup/setupTopic.ts +12 -17
- package/src/apps/cli/commands/project/utils/autocompletions.ts +9 -0
- package/src/apps/cli/utils/getGoogleAuthUserNumber.ts +18 -28
- package/src/apps/cli/verify/index.ts +7 -25
- package/src/config/getProjectConfig.ts +21 -22
- package/src/git/gitProjectInformation.ts +1 -31
- package/src/utils/gitlab.ts +247 -200
- package/src/utils/log.ts +0 -26
- package/src/utils/preferences.ts +60 -0
- package/dist/cli/src/utils/gitlab-without-vorpal/FetchGitLabError.d.ts +0 -18
- package/dist/cli/src/utils/gitlab-without-vorpal/FetchGitLabError.js +0 -32
- package/dist/cli/src/utils/gitlab-without-vorpal/FetchGitLabError.js.map +0 -1
- package/dist/cli/src/utils/gitlab-without-vorpal/FetchMethod.d.ts +0 -1
- package/dist/cli/src/utils/gitlab-without-vorpal/FetchMethod.js +0 -3
- package/dist/cli/src/utils/gitlab-without-vorpal/FetchMethod.js.map +0 -1
- package/dist/cli/src/utils/gitlab-without-vorpal/GitLabApiDataOptional.d.ts +0 -14
- package/dist/cli/src/utils/gitlab-without-vorpal/GitLabApiDataOptional.js +0 -3
- package/dist/cli/src/utils/gitlab-without-vorpal/GitLabApiDataOptional.js.map +0 -1
- package/dist/cli/src/utils/gitlab-without-vorpal/GitLabTokenMissingError.d.ts +0 -4
- package/dist/cli/src/utils/gitlab-without-vorpal/GitLabTokenMissingError.js +0 -12
- package/dist/cli/src/utils/gitlab-without-vorpal/GitLabTokenMissingError.js.map +0 -1
- package/dist/cli/src/utils/gitlab-without-vorpal/fetchGitLabApi.d.ts +0 -8
- package/dist/cli/src/utils/gitlab-without-vorpal/fetchGitLabApi.js +0 -47
- package/dist/cli/src/utils/gitlab-without-vorpal/fetchGitLabApi.js.map +0 -1
- package/dist/cli/src/utils/gitlab-without-vorpal/getGitlabHostPathToken.d.ts +0 -20
- package/dist/cli/src/utils/gitlab-without-vorpal/getGitlabHostPathToken.js +0 -15
- package/dist/cli/src/utils/gitlab-without-vorpal/getGitlabHostPathToken.js.map +0 -1
- package/dist/cli/src/utils/gitlab-without-vorpal/gitLabProjectByGitPath.d.ts +0 -23
- package/dist/cli/src/utils/gitlab-without-vorpal/gitLabProjectByGitPath.js +0 -30
- package/dist/cli/src/utils/gitlab-without-vorpal/gitLabProjectByGitPath.js.map +0 -1
- package/dist/cli/src/utils/gitlab-without-vorpal/gitLabVariables.d.ts +0 -66
- package/dist/cli/src/utils/gitlab-without-vorpal/gitLabVariables.js +0 -129
- package/dist/cli/src/utils/gitlab-without-vorpal/gitLabVariables.js.map +0 -1
- package/dist/cli/src/utils/gitlab-without-vorpal/index.d.ts +0 -12
- package/dist/cli/src/utils/gitlab-without-vorpal/index.js +0 -29
- package/dist/cli/src/utils/gitlab-without-vorpal/index.js.map +0 -1
- package/dist/cli/src/utils/gitlab-without-vorpal/insertProjectTopics.d.ts +0 -5
- package/dist/cli/src/utils/gitlab-without-vorpal/insertProjectTopics.js +0 -23
- package/dist/cli/src/utils/gitlab-without-vorpal/insertProjectTopics.js.map +0 -1
- package/dist/cli/src/utils/gitlab-without-vorpal/loadGitLabToken.d.ts +0 -2
- package/dist/cli/src/utils/gitlab-without-vorpal/loadGitLabToken.js +0 -27
- package/dist/cli/src/utils/gitlab-without-vorpal/loadGitLabToken.js.map +0 -1
- package/dist/cli/src/utils/gitlab-without-vorpal/projectAccessToken.d.ts +0 -29
- package/dist/cli/src/utils/gitlab-without-vorpal/projectAccessToken.js +0 -24
- package/dist/cli/src/utils/gitlab-without-vorpal/projectAccessToken.js.map +0 -1
- package/dist/cli/src/utils/gitlab-without-vorpal/storeGitLabToken.d.ts +0 -3
- package/dist/cli/src/utils/gitlab-without-vorpal/storeGitLabToken.js +0 -19
- package/dist/cli/src/utils/gitlab-without-vorpal/storeGitLabToken.js.map +0 -1
- package/dist/cli/src/utils/preferences/CatladderPreferences.d.ts +0 -27
- package/dist/cli/src/utils/preferences/CatladderPreferences.js +0 -34
- package/dist/cli/src/utils/preferences/CatladderPreferences.js.map +0 -1
- package/dist/cli/src/utils/preferences/index.d.ts +0 -11
- package/dist/cli/src/utils/preferences/index.js +0 -79
- package/dist/cli/src/utils/preferences/index.js.map +0 -1
- package/src/utils/gitlab-without-vorpal/FetchGitLabError.ts +0 -57
- package/src/utils/gitlab-without-vorpal/FetchMethod.ts +0 -1
- package/src/utils/gitlab-without-vorpal/GitLabApiDataOptional.ts +0 -14
- package/src/utils/gitlab-without-vorpal/GitLabTokenMissingError.ts +0 -7
- package/src/utils/gitlab-without-vorpal/fetchGitLabApi.ts +0 -74
- package/src/utils/gitlab-without-vorpal/getGitlabHostPathToken.ts +0 -31
- package/src/utils/gitlab-without-vorpal/gitLabProjectByGitPath.ts +0 -57
- package/src/utils/gitlab-without-vorpal/gitLabVariables.ts +0 -290
- package/src/utils/gitlab-without-vorpal/index.ts +0 -12
- package/src/utils/gitlab-without-vorpal/insertProjectTopics.ts +0 -35
- package/src/utils/gitlab-without-vorpal/loadGitLabToken.ts +0 -29
- package/src/utils/gitlab-without-vorpal/projectAccessToken.ts +0 -86
- package/src/utils/gitlab-without-vorpal/storeGitLabToken.ts +0 -23
- package/src/utils/preferences/CatladderPreferences.ts +0 -51
- package/src/utils/preferences/index.ts +0 -103
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { readFile, writeFile, mkdir, cp, chmod } from "fs/promises";
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import { join, dirname } from "path";
|
|
4
|
+
import { homedir } from "os";
|
|
5
|
+
import { parse, stringify } from "yaml";
|
|
6
|
+
|
|
7
|
+
const legacyPreferencesPath = join(homedir(), ".catladder/preferences.yml");
|
|
8
|
+
const preferencesPath = join(homedir(), ".config/catladder/preferences.yml");
|
|
9
|
+
|
|
10
|
+
const ensurePreferencesFile = async () => {
|
|
11
|
+
if (existsSync(preferencesPath)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
await mkdir(dirname(preferencesPath), { recursive: true, mode: 0o700 });
|
|
15
|
+
if (!existsSync(legacyPreferencesPath)) {
|
|
16
|
+
return writeFile(preferencesPath, "---\n{}", {
|
|
17
|
+
encoding: "utf-8",
|
|
18
|
+
mode: 0o600,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
await cp(legacyPreferencesPath, preferencesPath);
|
|
22
|
+
await chmod(preferencesPath, 0o600);
|
|
23
|
+
await cp(
|
|
24
|
+
preferencesPath,
|
|
25
|
+
join(dirname(preferencesPath), "old_preferences_backup.yml"),
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const loadPreferences = async () => {
|
|
30
|
+
await ensurePreferencesFile();
|
|
31
|
+
return readFile(preferencesPath, { encoding: "utf-8" });
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const getPreferences = async () => {
|
|
35
|
+
const yamlContent = await loadPreferences();
|
|
36
|
+
return (parse(yamlContent) ?? {}) as Record<string, string>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const hasPreference = async (key: string) => {
|
|
40
|
+
const preferences = await getPreferences();
|
|
41
|
+
return key in preferences;
|
|
42
|
+
};
|
|
43
|
+
export const getPreference = async (key: string) => {
|
|
44
|
+
const preferences = await getPreferences();
|
|
45
|
+
return preferences[key];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const setPreference = async (key: string, value: string | number) => {
|
|
49
|
+
const preferences = await getPreferences();
|
|
50
|
+
|
|
51
|
+
const newPreferences = {
|
|
52
|
+
...preferences,
|
|
53
|
+
[key]: value,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
await writeFile(preferencesPath, stringify(newPreferences), {
|
|
57
|
+
encoding: "utf-8",
|
|
58
|
+
mode: 0o600,
|
|
59
|
+
});
|
|
60
|
+
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Response } from "node-fetch";
|
|
2
|
-
import type { FetchMethod } from "./FetchMethod";
|
|
3
|
-
export declare class FetchGitLabError extends Error {
|
|
4
|
-
response?: Response;
|
|
5
|
-
name: string;
|
|
6
|
-
status?: number;
|
|
7
|
-
statusText?: string;
|
|
8
|
-
contentType?: string;
|
|
9
|
-
cause?: unknown;
|
|
10
|
-
resourcePath?: string;
|
|
11
|
-
data?: any;
|
|
12
|
-
method?: FetchMethod;
|
|
13
|
-
constructor(response?: Response, { resourcePath, data, method, cause, }?: {
|
|
14
|
-
resourcePath?: string;
|
|
15
|
-
data?: any;
|
|
16
|
-
method?: FetchMethod;
|
|
17
|
-
} & ErrorOptions, extraMessage?: string);
|
|
18
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FetchGitLabError = void 0;
|
|
4
|
-
class FetchGitLabError extends Error {
|
|
5
|
-
constructor(response, { resourcePath, data, method, cause, } = {}, extraMessage = "") {
|
|
6
|
-
const status = response === null || response === void 0 ? void 0 : response.status;
|
|
7
|
-
const statusMsg = status ? ` ${status}` : "";
|
|
8
|
-
const methodPath = [method, resourcePath].filter(Boolean).join(" ");
|
|
9
|
-
const customMsg = (extraMessage === null || extraMessage === void 0 ? void 0 : extraMessage.length) ? `: ${extraMessage}` : "";
|
|
10
|
-
super(`GitLab API Error${statusMsg}${(methodPath === null || methodPath === void 0 ? void 0 : methodPath.length) ? ` ${methodPath}` : ""}${customMsg}`, {
|
|
11
|
-
cause: Object.entries({ resourcePath, data, method, cause }).reduce((acc, [k, v]) => {
|
|
12
|
-
if (v) {
|
|
13
|
-
acc[k] = v;
|
|
14
|
-
}
|
|
15
|
-
return acc;
|
|
16
|
-
}, {}),
|
|
17
|
-
});
|
|
18
|
-
this.response = response;
|
|
19
|
-
this.name = "FetchGitLabError";
|
|
20
|
-
this.cause = cause;
|
|
21
|
-
this.resourcePath = resourcePath;
|
|
22
|
-
this.data = data;
|
|
23
|
-
this.method = method;
|
|
24
|
-
if (response) {
|
|
25
|
-
this.status = status;
|
|
26
|
-
this.contentType = response.headers.get("content-type");
|
|
27
|
-
this.statusText = response.statusText;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.FetchGitLabError = FetchGitLabError;
|
|
32
|
-
//# sourceMappingURL=FetchGitLabError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FetchGitLabError.js","sourceRoot":"","sources":["../../../../../src/utils/gitlab-without-vorpal/FetchGitLabError.ts"],"names":[],"mappings":";;;AAIA,MAAa,gBAAiB,SAAQ,KAAK;IAUzC,YACS,QAAmB,EAC1B,EACE,YAAY,EACZ,IAAI,EACJ,MAAM,EACN,KAAK,MAKY,EAAE,EACrB,YAAY,GAAG,EAAE;QAEjB,MAAM,MAAM,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC;QAChC,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpE,MAAM,SAAS,GAAG,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,EAAC,CAAC,CAAC,KAAK,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,KAAK,CACH,mBAAmB,SAAS,GAAG,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,EAAC,CAAC,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,EACvF;YACE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CACjE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;gBACd,IAAI,CAAC,EAAE,CAAC;oBACN,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBACb,CAAC;gBACD,OAAO,GAAG,CAAC;YACb,CAAC,EACD,EAAE,CACH;SACF,CACF,CAAC;QA9BK,aAAQ,GAAR,QAAQ,CAAW;QAV5B,SAAI,GAAG,kBAAkB,CAAC;QAyCxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YACxD,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;QACxC,CAAC;IACH,CAAC;CACF;AApDD,4CAoDC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type FetchMethod = "GET" | "PUT" | "POST" | "DELETE";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FetchMethod.js","sourceRoot":"","sources":["../../../../../src/utils/gitlab-without-vorpal/FetchMethod.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type GitLabApiDataOptional = {
|
|
2
|
-
/**
|
|
3
|
-
* Already present GitLab instance hostname
|
|
4
|
-
*/
|
|
5
|
-
host?: string;
|
|
6
|
-
/**
|
|
7
|
-
* Already present GitLab project path
|
|
8
|
-
*/
|
|
9
|
-
path?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Already present GitLab Personal access token
|
|
12
|
-
*/
|
|
13
|
-
token?: string;
|
|
14
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GitLabApiDataOptional.js","sourceRoot":"","sources":["../../../../../src/utils/gitlab-without-vorpal/GitLabApiDataOptional.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GitLabTokenMissingError = void 0;
|
|
4
|
-
class GitLabTokenMissingError extends Error {
|
|
5
|
-
constructor(message = "", additional = {}) {
|
|
6
|
-
const notice = `GitLab token is missing${(message === null || message === void 0 ? void 0 : message.length) ? `: ${message}` : ""}`;
|
|
7
|
-
super(notice, additional);
|
|
8
|
-
this.name = "GitLabTokenMissingError";
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.GitLabTokenMissingError = GitLabTokenMissingError;
|
|
12
|
-
//# sourceMappingURL=GitLabTokenMissingError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GitLabTokenMissingError.js","sourceRoot":"","sources":["../../../../../src/utils/gitlab-without-vorpal/GitLabTokenMissingError.ts"],"names":[],"mappings":";;;AAAA,MAAa,uBAAwB,SAAQ,KAAK;IAEhD,YAAY,OAAO,GAAG,EAAE,EAAE,aAA2B,EAAE;QACrD,MAAM,MAAM,GAAG,0BAA0B,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,EAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACjF,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAH5B,SAAI,GAAG,yBAAyB,CAAC;IAIjC,CAAC;CACF;AAND,0DAMC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { LoggerCmdInstance } from "../log";
|
|
2
|
-
import type { FetchMethod } from "./FetchMethod";
|
|
3
|
-
import type { GitLabApiDataOptional } from "./GitLabApiDataOptional";
|
|
4
|
-
export declare const fetchGitLabApi: <T>({ resourcePath, data, method, host, token, }: {
|
|
5
|
-
resourcePath: string;
|
|
6
|
-
data?: any;
|
|
7
|
-
method?: FetchMethod;
|
|
8
|
-
} & Omit<GitLabApiDataOptional, "path">, logger?: LoggerCmdInstance) => Promise<T>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchGitLabApi = void 0;
|
|
7
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
8
|
-
const FetchGitLabError_1 = require("./FetchGitLabError");
|
|
9
|
-
const GitLabTokenMissingError_1 = require("./GitLabTokenMissingError");
|
|
10
|
-
const loadGitLabToken_1 = require("./loadGitLabToken");
|
|
11
|
-
const git_1 = require("../../git");
|
|
12
|
-
const fetchGitLabApi = async ({ resourcePath, data, method = "GET", host, token, }, logger = console) => {
|
|
13
|
-
const gitRemoteHost = await (0, git_1.getGitRemoteHost)(host);
|
|
14
|
-
const gitlabToken = token || (await (0, loadGitLabToken_1.loadGitLabToken)(gitRemoteHost, logger));
|
|
15
|
-
if (!(gitlabToken === null || gitlabToken === void 0 ? void 0 : gitlabToken.length)) {
|
|
16
|
-
throw new GitLabTokenMissingError_1.GitLabTokenMissingError();
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
const result = await (0, node_fetch_1.default)(`https://${gitRemoteHost}/api/v4/${resourcePath}`, {
|
|
20
|
-
method,
|
|
21
|
-
headers: {
|
|
22
|
-
"Content-Type": "application/json",
|
|
23
|
-
"Private-Token": gitlabToken,
|
|
24
|
-
},
|
|
25
|
-
body: data ? JSON.stringify(data) : undefined,
|
|
26
|
-
});
|
|
27
|
-
const status = result.status;
|
|
28
|
-
if (status >= 200 && status < 400) {
|
|
29
|
-
if (result.headers.get("content-type") === "application/json") {
|
|
30
|
-
return result.json();
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
if (status === 404) {
|
|
35
|
-
throw new FetchGitLabError_1.FetchGitLabError(result, { resourcePath, data, method }, "not found");
|
|
36
|
-
}
|
|
37
|
-
throw new FetchGitLabError_1.FetchGitLabError(result, { resourcePath, data, method }, `Could not send request to gitlab api ${resourcePath}: ${status} "${result.statusText}".\nResponse: ${JSON.stringify(await result.json(), null, 2)}`);
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
if (error instanceof FetchGitLabError_1.FetchGitLabError) {
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
throw new FetchGitLabError_1.FetchGitLabError(undefined, { resourcePath, data, method, cause: error }, `Unknown error ${error}`);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
exports.fetchGitLabApi = fetchGitLabApi;
|
|
47
|
-
//# sourceMappingURL=fetchGitLabApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchGitLabApi.js","sourceRoot":"","sources":["../../../../../src/utils/gitlab-without-vorpal/fetchGitLabApi.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAG/B,yDAAsD;AAEtD,uEAAoE;AACpE,uDAAoD;AAEpD,mCAA6C;AAEtC,MAAM,cAAc,GAAG,KAAK,EACjC,EACE,YAAY,EACZ,IAAI,EACJ,MAAM,GAAG,KAAK,EACd,IAAI,EACJ,KAAK,GAKgC,EACvC,SAA4B,OAAO,EACnC,EAAE;IACF,MAAM,aAAa,GAAG,MAAM,IAAA,sBAAgB,EAAC,IAAI,CAAC,CAAC;IACnD,MAAM,WAAW,GAAG,KAAK,IAAI,CAAC,MAAM,IAAA,iCAAe,EAAC,aA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f,IAAI,KAAK,YAAY,mCAAgB,EAAE,CAAC;YACtC,MAAM,KAAK,CAAC;QACd,CAAC;QACD,MAAM,IAAI,mCAAgB,CACxB,SAAS,EACT,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAC5C,iBAAiB,KAAK,EAAE,CACzB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AA/DW,QAAA,cAAc,kBA+DzB"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { LoggerCmdInstance } from "../log";
|
|
2
|
-
import type { GitLabApiDataOptional } from "./GitLabApiDataOptional";
|
|
3
|
-
/**
|
|
4
|
-
* Lazy gather the GitLab api request data
|
|
5
|
-
*/
|
|
6
|
-
export declare const getGitLabHostPathToken: ({ token: inputToken, ...existing }?: GitLabApiDataOptional, logger?: LoggerCmdInstance) => Promise<{
|
|
7
|
-
/**
|
|
8
|
-
* The GitLab instance hostname
|
|
9
|
-
*/
|
|
10
|
-
host: string;
|
|
11
|
-
/**
|
|
12
|
-
* The GitLab project path
|
|
13
|
-
*/
|
|
14
|
-
path: string;
|
|
15
|
-
/**
|
|
16
|
-
* The GitLab personal access token (PAT)
|
|
17
|
-
* Note: The token may not be present in the stored preferences.
|
|
18
|
-
*/
|
|
19
|
-
token: string | undefined;
|
|
20
|
-
}>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getGitLabHostPathToken = void 0;
|
|
4
|
-
const loadGitLabToken_1 = require("./loadGitLabToken");
|
|
5
|
-
const git_1 = require("../../git");
|
|
6
|
-
/**
|
|
7
|
-
* Lazy gather the GitLab api request data
|
|
8
|
-
*/
|
|
9
|
-
const getGitLabHostPathToken = async ({ token: inputToken, ...existing } = {}, logger = console) => {
|
|
10
|
-
const { gitRemotePath: path, gitRemoteHost: host } = await (0, git_1.getGitRemoteHostAndPath)(existing);
|
|
11
|
-
const token = inputToken || (await (0, loadGitLabToken_1.loadGitLabToken)(host, logger));
|
|
12
|
-
return { host, path, token: token || undefined };
|
|
13
|
-
};
|
|
14
|
-
exports.getGitLabHostPathToken = getGitLabHostPathToken;
|
|
15
|
-
//# sourceMappingURL=getGitlabHostPathToken.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getGitlabHostPathToken.js","sourceRoot":"","sources":["../../../../../src/utils/gitlab-without-vorpal/getGitlabHostPathToken.ts"],"names":[],"mappings":";;;AACA,uDAAoD;AAEpD,mCAAoD;AAEpD;;GAEG;AACI,MAAM,sBAAsB,GAAG,KAAK,EACzC,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,QAAQ,KAA4B,EAAE,EAC9D,SAA4B,OAAO,EAelC,EAAE;IACH,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,GAChD,MAAM,IAAA,6BAAuB,EAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,UAAU,IAAI,CAAC,MAAM,IAAA,iCAAe,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAClE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,CAAC;AACnD,CAAC,CAAC;AAtBW,QAAA,sBAAsB,0BAsBjC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { LoggerCmdInstance } from "../log";
|
|
2
|
-
import type { GitLabApiDataOptional } from "./GitLabApiDataOptional";
|
|
3
|
-
export type GitLabProject = {
|
|
4
|
-
id: number;
|
|
5
|
-
web_url: string;
|
|
6
|
-
name: string;
|
|
7
|
-
name_with_namespace: string;
|
|
8
|
-
default_branch: string;
|
|
9
|
-
path: string;
|
|
10
|
-
path_with_namespace: string;
|
|
11
|
-
ssh_url_to_repo: string;
|
|
12
|
-
http_url_to_repo: string;
|
|
13
|
-
readme_url?: string;
|
|
14
|
-
build_timeout?: number;
|
|
15
|
-
container_registry_image_prefix?: string;
|
|
16
|
-
container_registry_enabled?: boolean;
|
|
17
|
-
last_activity_at?: Date;
|
|
18
|
-
created_at?: Date;
|
|
19
|
-
updated_at?: Date;
|
|
20
|
-
topics: string[];
|
|
21
|
-
};
|
|
22
|
-
export declare const gitLabProjectByGitPath: (existing?: GitLabApiDataOptional, logger?: LoggerCmdInstance) => Promise<GitLabProject>;
|
|
23
|
-
export declare const getGitLabProjectId: (existing?: GitLabApiDataOptional, logger?: LoggerCmdInstance) => Promise<number>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getGitLabProjectId = exports.gitLabProjectByGitPath = void 0;
|
|
4
|
-
const preferences_1 = require("../preferences");
|
|
5
|
-
const fetchGitLabApi_1 = require("./fetchGitLabApi");
|
|
6
|
-
const getGitlabHostPathToken_1 = require("./getGitlabHostPathToken");
|
|
7
|
-
const gitLabProjectByGitPath = async (existing = {}, logger = console) => {
|
|
8
|
-
const { host, path, token } = await (0, getGitlabHostPathToken_1.getGitLabHostPathToken)(existing, logger);
|
|
9
|
-
return (0, fetchGitLabApi_1.fetchGitLabApi)({
|
|
10
|
-
resourcePath: `projects/${encodeURIComponent(path)}`,
|
|
11
|
-
host,
|
|
12
|
-
token,
|
|
13
|
-
}, logger);
|
|
14
|
-
};
|
|
15
|
-
exports.gitLabProjectByGitPath = gitLabProjectByGitPath;
|
|
16
|
-
const getGitLabProjectId = async (existing = {}, logger = console) => {
|
|
17
|
-
const [preferences, { host, path, token }] = await Promise.all([
|
|
18
|
-
(0, preferences_1.getPreferences)(logger),
|
|
19
|
-
(0, getGitlabHostPathToken_1.getGitLabHostPathToken)(existing, logger),
|
|
20
|
-
]);
|
|
21
|
-
const hostPathKey = `${host}/${path}`;
|
|
22
|
-
if (preferences.gitLabProjectIds[hostPathKey]) {
|
|
23
|
-
return preferences.gitLabProjectIds[hostPathKey];
|
|
24
|
-
}
|
|
25
|
-
const project = await (0, exports.gitLabProjectByGitPath)({ token, host, path }, logger);
|
|
26
|
-
await (0, preferences_1.upsertPreferences)({ gitLabProjectIds: { [hostPathKey]: project.id } });
|
|
27
|
-
return project.id;
|
|
28
|
-
};
|
|
29
|
-
exports.getGitLabProjectId = getGitLabProjectId;
|
|
30
|
-
//# sourceMappingURL=gitLabProjectByGitPath.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gitLabProjectByGitPath.js","sourceRoot":"","sources":["../../../../../src/utils/gitlab-without-vorpal/gitLabProjectByGitPath.ts"],"names":[],"mappings":";;;AACA,gDAAmE;AACnE,qDAAkD;AAClD,qEAAkE;AAuB3D,MAAM,sBAAsB,GAAG,KAAK,EACzC,WAAkC,EAAE,EACpC,SAA4B,OAAO,EACnC,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAA,+CAAsB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7E,OAAO,IAAA,+BAAc,EACnB;QACE,YAAY,EAAE,YAAY,kBAAkB,CAAC,IAAI,CAAC,EAAE;QACpD,IAAI;QACJ,KAAK;KACN,EACD,MAAM,CACP,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,sBAAsB,0BAajC;AAEK,MAAM,kBAAkB,GAAG,KAAK,EACrC,WAAkC,EAAE,EACpC,SAA4B,OAAO,EACnC,EAAE;IACF,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC7D,IAAA,4BAAc,EAAC,MAAM,CAAC;QACtB,IAAA,+CAAsB,EAAC,QAAQ,EAAE,MAAM,CAAC;KACzC,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;IACtC,IAAI,WAAW,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAAC;QAC9C,OAAO,WAAW,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,IAAA,8BAAsB,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAC5E,MAAM,IAAA,+BAAiB,EAAC,EAAE,gBAAgB,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7E,OAAO,OAAO,CAAC,EAAE,CAAC;AACpB,CAAC,CAAC;AAfW,QAAA,kBAAkB,sBAe7B"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import memoizee from "memoizee";
|
|
2
|
-
import type { LoggerCmdInstance } from "../log";
|
|
3
|
-
import type { GitLabApiDataOptional } from "./GitLabApiDataOptional";
|
|
4
|
-
export type GitlabVariable = {
|
|
5
|
-
variable_type: string;
|
|
6
|
-
key: string;
|
|
7
|
-
value: string;
|
|
8
|
-
hidden: boolean;
|
|
9
|
-
protected: boolean;
|
|
10
|
-
masked: boolean;
|
|
11
|
-
raw: boolean;
|
|
12
|
-
environment_scope: string;
|
|
13
|
-
description: string | null;
|
|
14
|
-
};
|
|
15
|
-
export type GetAllVariablesArgs = {
|
|
16
|
-
/**
|
|
17
|
-
* Amount of requests in parallel to GitLab
|
|
18
|
-
*
|
|
19
|
-
* 5 seems a good value for many projects.
|
|
20
|
-
* Ideally we would do one request in parallel per component.
|
|
21
|
-
* @defaultValue 5
|
|
22
|
-
*/
|
|
23
|
-
parallelRequests?: number;
|
|
24
|
-
projectId?: string | number;
|
|
25
|
-
logger?: LoggerCmdInstance;
|
|
26
|
-
} & GitLabApiDataOptional;
|
|
27
|
-
export declare const gitLabVariable: {
|
|
28
|
-
get: ({ projectId, key, host, token, }: {
|
|
29
|
-
projectId: string | number;
|
|
30
|
-
key: string;
|
|
31
|
-
} & Omit<GitLabApiDataOptional, "path">, logger?: LoggerCmdInstance) => Promise<GitlabVariable>;
|
|
32
|
-
create: ({ projectId, key, value, masked, scope, host, token, }: {
|
|
33
|
-
projectId: string | number;
|
|
34
|
-
key: string;
|
|
35
|
-
value: string;
|
|
36
|
-
masked?: boolean;
|
|
37
|
-
scope?: string;
|
|
38
|
-
} & Omit<GitLabApiDataOptional, "path">, logger?: LoggerCmdInstance) => Promise<GitlabVariable>;
|
|
39
|
-
update: ({ projectId, key, value, masked, host, token, }: {
|
|
40
|
-
projectId: string | number;
|
|
41
|
-
key: string;
|
|
42
|
-
value: string;
|
|
43
|
-
masked?: boolean;
|
|
44
|
-
} & Omit<GitLabApiDataOptional, "path">, logger?: LoggerCmdInstance) => Promise<GitlabVariable>;
|
|
45
|
-
delete: ({ projectId, key, host, token, }: {
|
|
46
|
-
projectId: string | number;
|
|
47
|
-
key: string;
|
|
48
|
-
} & Omit<GitLabApiDataOptional, "path">, logger?: LoggerCmdInstance) => Promise<unknown>;
|
|
49
|
-
getPage: ({ projectId, page, perPage, host, token, }: {
|
|
50
|
-
projectId: string | number;
|
|
51
|
-
/**
|
|
52
|
-
* @defaultValue 1
|
|
53
|
-
*/
|
|
54
|
-
page?: number;
|
|
55
|
-
/**
|
|
56
|
-
* @defaultValue 100
|
|
57
|
-
*/
|
|
58
|
-
perPage?: number;
|
|
59
|
-
} & Omit<GitLabApiDataOptional, "path">, logger?: LoggerCmdInstance) => Promise<GitlabVariable[]>;
|
|
60
|
-
getAll: (({ logger, parallelRequests, projectId, ...existing }?: GetAllVariablesArgs) => Promise<Array<GitlabVariable>>) & memoizee.Memoized<({ logger, parallelRequests, projectId, ...existing }?: GetAllVariablesArgs) => Promise<Array<GitlabVariable>>>;
|
|
61
|
-
getAllCatladder: ({ logger, projectId, ...existing }?: Omit<GetAllVariablesArgs, "parallelRequests">) => Promise<{
|
|
62
|
-
[x: `CL_${string}`]: {
|
|
63
|
-
backups: number[];
|
|
64
|
-
} & Omit<Partial<GitlabVariable>, "key">;
|
|
65
|
-
}>;
|
|
66
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.gitLabVariable = void 0;
|
|
7
|
-
const memoizee_1 = __importDefault(require("memoizee"));
|
|
8
|
-
const lodash_1 = require("lodash");
|
|
9
|
-
const fetchGitLabApi_1 = require("./fetchGitLabApi");
|
|
10
|
-
const getGitlabHostPathToken_1 = require("./getGitlabHostPathToken");
|
|
11
|
-
const gitLabProjectByGitPath_1 = require("./gitLabProjectByGitPath");
|
|
12
|
-
const GitLabTokenMissingError_1 = require("./GitLabTokenMissingError");
|
|
13
|
-
/**
|
|
14
|
-
* @see {@link https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js#L20}
|
|
15
|
-
*/
|
|
16
|
-
const maskableRegex = new RegExp("^[a-zA-Z0-9_+=/@:.~-]{8,}$");
|
|
17
|
-
/**
|
|
18
|
-
* @see {@link https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js#L20}
|
|
19
|
-
*/
|
|
20
|
-
const isMaskable = (value) => maskableRegex.test(value);
|
|
21
|
-
const getGitLabVariable = async ({ projectId, key, host, token, }, logger = console) => (0, fetchGitLabApi_1.fetchGitLabApi)({
|
|
22
|
-
resourcePath: `projects/${projectId}/variables/${key}`,
|
|
23
|
-
host,
|
|
24
|
-
token,
|
|
25
|
-
}, logger);
|
|
26
|
-
const createGitLabVariable = async ({ projectId, key, value, masked = true, scope = "*", host, token, }, logger = console) => (0, fetchGitLabApi_1.fetchGitLabApi)({
|
|
27
|
-
resourcePath: `projects/${projectId}/variables`,
|
|
28
|
-
method: "POST",
|
|
29
|
-
data: {
|
|
30
|
-
key,
|
|
31
|
-
value,
|
|
32
|
-
masked: masked && isMaskable(value),
|
|
33
|
-
environment_scope: scope,
|
|
34
|
-
},
|
|
35
|
-
host,
|
|
36
|
-
token,
|
|
37
|
-
}, logger);
|
|
38
|
-
const updateGitLabVariable = async ({ projectId, key, value, masked = true, host, token, }, logger = console) => (0, fetchGitLabApi_1.fetchGitLabApi)({
|
|
39
|
-
resourcePath: `projects/${projectId}/variables/${key}`,
|
|
40
|
-
method: "PUT",
|
|
41
|
-
data: {
|
|
42
|
-
value,
|
|
43
|
-
masked: masked && isMaskable(value),
|
|
44
|
-
},
|
|
45
|
-
host,
|
|
46
|
-
token,
|
|
47
|
-
}, logger);
|
|
48
|
-
const deleteGitLabVariable = async ({ projectId, key, host, token, }, logger = console) => (0, fetchGitLabApi_1.fetchGitLabApi)({
|
|
49
|
-
resourcePath: `projects/${projectId}/variables/${key}`,
|
|
50
|
-
method: "DELETE",
|
|
51
|
-
host,
|
|
52
|
-
token,
|
|
53
|
-
}, logger);
|
|
54
|
-
const getGitlabVariablesPage = async ({ projectId, page = 1, perPage = 100, host, token, }, logger = console) => (0, fetchGitLabApi_1.fetchGitLabApi)({
|
|
55
|
-
resourcePath: `projects/${projectId}/variables?per_page=${perPage}&page=${page}`,
|
|
56
|
-
host,
|
|
57
|
-
token,
|
|
58
|
-
}, logger);
|
|
59
|
-
const getAllVariables = (0, memoizee_1.default)(async ({ logger = console, parallelRequests = 5, projectId, ...existing } = {}) => {
|
|
60
|
-
const { host, path, token } = await (0, getGitlabHostPathToken_1.getGitLabHostPathToken)(existing, logger);
|
|
61
|
-
if (!(token === null || token === void 0 ? void 0 : token.length)) {
|
|
62
|
-
throw new GitLabTokenMissingError_1.GitLabTokenMissingError();
|
|
63
|
-
}
|
|
64
|
-
const id = projectId || (await (0, gitLabProjectByGitPath_1.getGitLabProjectId)({ host, path, token }, logger));
|
|
65
|
-
let all = [];
|
|
66
|
-
let result = [];
|
|
67
|
-
let page = 1;
|
|
68
|
-
do {
|
|
69
|
-
// Create an array of promises for parallelRequests pages - Wait for all promises to resolve
|
|
70
|
-
result = await Promise.all((0, lodash_1.times)(parallelRequests, (i) => i + 1).map((parallelPage) => getGitlabVariablesPage({ projectId: id, page: parallelPage, host, token }, logger)));
|
|
71
|
-
// Increment the page by parallelRequests
|
|
72
|
-
page += parallelRequests;
|
|
73
|
-
// Flatten the result array and add it to 'all'
|
|
74
|
-
all = all.concat(result.flat());
|
|
75
|
-
// Continue only if the last page had results
|
|
76
|
-
} while (result.length > 0 && result.slice(-1)[0].length > 0);
|
|
77
|
-
return all;
|
|
78
|
-
}, { promise: true });
|
|
79
|
-
const getAllCatladderEnvVars = async ({ logger = console, projectId, ...existing } = {}) => {
|
|
80
|
-
const { host, path, token } = await (0, getGitlabHostPathToken_1.getGitLabHostPathToken)(existing, logger);
|
|
81
|
-
if (!(token === null || token === void 0 ? void 0 : token.length)) {
|
|
82
|
-
throw new GitLabTokenMissingError_1.GitLabTokenMissingError();
|
|
83
|
-
}
|
|
84
|
-
const id = projectId || (await (0, gitLabProjectByGitPath_1.getGitLabProjectId)({ host, path, token }, logger));
|
|
85
|
-
const fetchResults = await exports.gitLabVariable.getAll({
|
|
86
|
-
projectId: id,
|
|
87
|
-
host,
|
|
88
|
-
path,
|
|
89
|
-
token,
|
|
90
|
-
logger,
|
|
91
|
-
});
|
|
92
|
-
const catladderPrefixed = fetchResults.filter(({ key }) => key.startsWith("CL_"));
|
|
93
|
-
const allVariables = catladderPrefixed.reduce((acc, { key, value, ...rest }) => {
|
|
94
|
-
var _a, _b, _c, _d;
|
|
95
|
-
const matchBackup = key.match(/(CL_.*)_backup_([0-9]+)/);
|
|
96
|
-
if (matchBackup) {
|
|
97
|
-
const key = matchBackup[1];
|
|
98
|
-
const timestamp = Number(matchBackup[2]);
|
|
99
|
-
const backups = [...((_b = (_a = acc[key]) === null || _a === void 0 ? void 0 : _a.backups) !== null && _b !== void 0 ? _b : []), timestamp];
|
|
100
|
-
return {
|
|
101
|
-
...acc,
|
|
102
|
-
[key]: {
|
|
103
|
-
...((_c = acc[key]) !== null && _c !== void 0 ? _c : {}), // add value
|
|
104
|
-
backups,
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
...acc,
|
|
110
|
-
[key]: {
|
|
111
|
-
backups: [],
|
|
112
|
-
...((_d = acc[key]) !== null && _d !== void 0 ? _d : {}), // may add backups
|
|
113
|
-
value,
|
|
114
|
-
...rest,
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
}, {});
|
|
118
|
-
return allVariables;
|
|
119
|
-
};
|
|
120
|
-
exports.gitLabVariable = {
|
|
121
|
-
get: getGitLabVariable,
|
|
122
|
-
create: createGitLabVariable,
|
|
123
|
-
update: updateGitLabVariable,
|
|
124
|
-
delete: deleteGitLabVariable,
|
|
125
|
-
getPage: getGitlabVariablesPage,
|
|
126
|
-
getAll: getAllVariables,
|
|
127
|
-
getAllCatladder: getAllCatladderEnvVars,
|
|
128
|
-
};
|
|
129
|
-
//# sourceMappingURL=gitLabVariables.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gitLabVariables.js","sourceRoot":"","sources":["../../../../../src/utils/gitlab-without-vorpal/gitLabVariables.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAChC,mCAA+B;AAG/B,qDAAkD;AAElD,qEAAkE;AAClE,qEAA8D;AAC9D,uEAAoE;AAEpE;;GAEG;AACH,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,4BAA4B,CAAC,CAAC;AAC/D;;GAEG;AACH,MAAM,UAAU,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAazE,MAAM,iBAAiB,GAAG,KAAK,EAC7B,EACE,SAAS,EACT,GAAG,EACH,IAAI,EACJ,KAAK,GAIgC,EACvC,SAA4B,OAAO,EACnC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-
export * from "./FetchGitLabError";
|
|
2
|
-
export * from "./FetchMethod";
|
|
3
|
-
export * from "./GitLabApiDataOptional";
|
|
4
|
-
export * from "./GitLabTokenMissingError";
|
|
5
|
-
export * from "./fetchGitLabApi";
|
|
6
|
-
export * from "./getGitlabHostPathToken";
|
|
7
|
-
export * from "./gitLabProjectByGitPath";
|
|
8
|
-
export * from "./gitLabVariables";
|
|
9
|
-
export * from "./insertProjectTopics";
|
|
10
|
-
export * from "./loadGitLabToken";
|
|
11
|
-
export * from "./projectAccessToken";
|
|
12
|
-
export * from "./storeGitLabToken";
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./FetchGitLabError"), exports);
|
|
18
|
-
__exportStar(require("./FetchMethod"), exports);
|
|
19
|
-
__exportStar(require("./GitLabApiDataOptional"), exports);
|
|
20
|
-
__exportStar(require("./GitLabTokenMissingError"), exports);
|
|
21
|
-
__exportStar(require("./fetchGitLabApi"), exports);
|
|
22
|
-
__exportStar(require("./getGitlabHostPathToken"), exports);
|
|
23
|
-
__exportStar(require("./gitLabProjectByGitPath"), exports);
|
|
24
|
-
__exportStar(require("./gitLabVariables"), exports);
|
|
25
|
-
__exportStar(require("./insertProjectTopics"), exports);
|
|
26
|
-
__exportStar(require("./loadGitLabToken"), exports);
|
|
27
|
-
__exportStar(require("./projectAccessToken"), exports);
|
|
28
|
-
__exportStar(require("./storeGitLabToken"), exports);
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/utils/gitlab-without-vorpal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,gDAA8B;AAC9B,0DAAwC;AACxC,4DAA0C;AAC1C,mDAAiC;AACjC,2DAAyC;AACzC,2DAAyC;AACzC,oDAAkC;AAClC,wDAAsC;AACtC,oDAAkC;AAClC,uDAAqC;AACrC,qDAAmC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { LoggerCmdInstance } from "../log";
|
|
2
|
-
import type { GitLabApiDataOptional } from "./GitLabApiDataOptional";
|
|
3
|
-
export declare const insertProjectTopics: ({ topics: insertTopics, ...existing }: GitLabApiDataOptional & {
|
|
4
|
-
topics: string[];
|
|
5
|
-
}, logger?: LoggerCmdInstance) => Promise<void>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.insertProjectTopics = void 0;
|
|
4
|
-
const fetchGitLabApi_1 = require("./fetchGitLabApi");
|
|
5
|
-
const getGitlabHostPathToken_1 = require("./getGitlabHostPathToken");
|
|
6
|
-
const gitLabProjectByGitPath_1 = require("./gitLabProjectByGitPath");
|
|
7
|
-
const GitLabTokenMissingError_1 = require("./GitLabTokenMissingError");
|
|
8
|
-
const insertProjectTopics = async ({ topics: insertTopics, ...existing }, logger = console) => {
|
|
9
|
-
const { host, path, token } = await (0, getGitlabHostPathToken_1.getGitLabHostPathToken)(existing, logger);
|
|
10
|
-
if (!(token === null || token === void 0 ? void 0 : token.length)) {
|
|
11
|
-
throw new GitLabTokenMissingError_1.GitLabTokenMissingError();
|
|
12
|
-
}
|
|
13
|
-
const { id, topics } = await (0, gitLabProjectByGitPath_1.gitLabProjectByGitPath)({ path, host, token }, logger);
|
|
14
|
-
await (0, fetchGitLabApi_1.fetchGitLabApi)({
|
|
15
|
-
resourcePath: `projects/${id}`,
|
|
16
|
-
data: { topics: [...insertTopics, ...topics] },
|
|
17
|
-
method: "PUT",
|
|
18
|
-
host,
|
|
19
|
-
token,
|
|
20
|
-
}, logger);
|
|
21
|
-
};
|
|
22
|
-
exports.insertProjectTopics = insertProjectTopics;
|
|
23
|
-
//# sourceMappingURL=insertProjectTopics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"insertProjectTopics.js","sourceRoot":"","sources":["../../../../../src/utils/gitlab-without-vorpal/insertProjectTopics.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAClD,qEAAkE;AAElE,qEAAkE;AAClE,uEAAoE;AAE7D,MAAM,mBAAmB,GAAG,KAAK,EACtC,EACE,MAAM,EAAE,YAAY,EACpB,GAAG,QAAQ,EACkC,EAC/C,SAA4B,OAAO,EACnC,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAA,+CAAsB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7E,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,CAAA,EAAE,CAAC;QACnB,MAAM,IAAI,iDAAuB,EAAE,CAAC;IACtC,CAAC;IAED,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,+CAAsB,EACjD,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EACrB,MAAM,CACP,CAAC;IAEF,MAAM,IAAA,+BAAc,EAClB;QACE,YAAY,EAAE,YAAY,EAAE,EAAE;QAC9B,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,YAAY,EAAE,GAAG,MAAM,CAAC,EAAE;QAC9C,MAAM,EAAE,KAAK;QACb,IAAI;QACJ,KAAK;KACN,EACD,MAAM,CACP,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,mBAAmB,uBA2B9B"}
|