@leitwerk-dev/forgejo-repo-change 0.2.0 → 0.3.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 +9 -1
- package/dist/index.d.ts +15 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +191 -447
- package/dist/index.js.map +1 -1
- package/dist/launcher.d.ts +19 -0
- package/dist/launcher.d.ts.map +1 -1
- package/dist/params.d.ts +21 -0
- package/dist/params.d.ts.map +1 -1
- package/dist/process.d.ts +2 -1
- package/dist/process.d.ts.map +1 -1
- package/dist/profile-bindings.d.ts +6 -1
- package/dist/profile-bindings.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +25 -19
- package/src/launcher.ts +23 -1
- package/src/params.ts +21 -1
- package/src/process.ts +215 -581
- package/src/profile-bindings.ts +6 -1
- package/src/routing.test-fixture.ts +14 -0
package/dist/launcher.d.ts
CHANGED
|
@@ -4,26 +4,45 @@ import { type LaunchPreparationCheck, type ProcessLaunchConfig, type ProcessLaun
|
|
|
4
4
|
import type { WoodpeckerIntegration } from "@leitwerk-dev/woodpecker";
|
|
5
5
|
import { type ForgejoRepoChangeParams } from "./params.js";
|
|
6
6
|
import { type ProfileBindings } from "./profile-bindings.js";
|
|
7
|
+
/** @internal */
|
|
7
8
|
export declare const forgejoRepoChangeUiLauncherId: "forgejo_repo_change_process.ui_launcher";
|
|
9
|
+
/** @internal */
|
|
8
10
|
export declare function forgejoRepoChangeParams(repository: ForgejoRepository, input: {
|
|
11
|
+
/** @internal */
|
|
9
12
|
profile: string;
|
|
13
|
+
/** @internal */
|
|
10
14
|
woodpeckerProfile: string;
|
|
15
|
+
/** @internal */
|
|
11
16
|
sshCredentialRef: string;
|
|
17
|
+
/** @internal */
|
|
12
18
|
prompt: string;
|
|
19
|
+
/** @internal */
|
|
13
20
|
workBranch: string;
|
|
14
21
|
}): ForgejoRepoChangeParams;
|
|
22
|
+
/** @internal */
|
|
15
23
|
export declare function forgejoRepoChangeLaunchConfig(params: ForgejoRepoChangeParams, title: string, gitIdentity: ForgejoGitIdentity): ProcessLaunchConfig<ForgejoRepoChangeParams>;
|
|
24
|
+
/** @internal */
|
|
16
25
|
export interface LauncherDependencies {
|
|
26
|
+
/** @internal */
|
|
17
27
|
forgejo: ForgejoIntegration;
|
|
28
|
+
/** @internal */
|
|
18
29
|
gitSsh: GitSshIntegration;
|
|
30
|
+
/** @internal */
|
|
19
31
|
woodpecker: WoodpeckerIntegration;
|
|
32
|
+
/** @internal */
|
|
20
33
|
profileBindings?: ProfileBindings;
|
|
21
34
|
}
|
|
35
|
+
/** @internal */
|
|
22
36
|
export declare function createForgejoRepoChangeLauncher(): {
|
|
37
|
+
/** @internal */
|
|
23
38
|
configure: (value: LauncherDependencies | null) => void;
|
|
39
|
+
/** @internal */
|
|
24
40
|
preparationChecks: (_input: unknown, { params }: ProcessLaunchConfig<ForgejoRepoChangeParams>) => readonly LaunchPreparationCheck<ForgejoRepoChangeParams>[];
|
|
41
|
+
/** @internal */
|
|
25
42
|
resolveProfiles: (profile: string) => import("./profile-bindings.js").ProfileBinding;
|
|
43
|
+
/** @internal */
|
|
26
44
|
resolveGitIdentity: (profile: string) => Promise<ForgejoGitIdentity>;
|
|
45
|
+
/** @internal */
|
|
27
46
|
launcher: ProcessLauncherDefinition<ForgejoRepoChangeParams>;
|
|
28
47
|
};
|
|
29
48
|
//# sourceMappingURL=launcher.d.ts.map
|
package/dist/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAEN,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,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EAAE,MAAM,CAAC;IAC1B,gBAAgB;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB;IAChB,UAAU,EAAE,MAAM,CAAC;CACnB,GACC,uBAAuB,CAiBzB;AAED,gBAAgB;AAChB,wBAAgB,6BAA6B,CAC5C,MAAM,EAAE,uBAAuB,EAC/B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,kBAAkB,GAC7B,mBAAmB,CAAC,uBAAuB,CAAC,CA6B9C;AAED,gBAAgB;AAChB,MAAM,WAAW,oBAAoB;IACpC,gBAAgB;IAChB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,gBAAgB;IAChB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,gBAAgB;IAChB,UAAU,EAAE,qBAAqB,CAAC;IAClC,gBAAgB;IAChB,eAAe,CAAC,EAAE,eAAe,CAAC;CAClC;AAED,gBAAgB;AAChB,wBAAgB,+BAA+B;IAgO7C,gBAAgB;uBA5NkC,oBAAoB,GAAG,IAAI,KAAG,IAAI;IA8NpF,gBAAgB;gCAxLR,OAAO,cACH,mBAAmB,CAAC,uBAAuB,CAAC,KACtD,SAAS,sBAAsB,CAAC,uBAAuB,CAAC,EAAE;IAwL5D,gBAAgB;+BAtJiB,MAAM;IAwJvC,gBAAgB;kCAzIiC,MAAM,KAAG,OAAO,CAAC,kBAAkB,CAAC;IA2IrF,gBAAgB;;EAGjB"}
|
package/dist/params.d.ts
CHANGED
|
@@ -1,27 +1,48 @@
|
|
|
1
1
|
import { type RepositoryChangeLaunchParams } from "@leitwerk-dev/coding/repository-change-launch";
|
|
2
|
+
/** @public */
|
|
2
3
|
interface ForgejoRepoChangeCommonParams {
|
|
4
|
+
/** @internal */
|
|
3
5
|
forgejoProfile: string;
|
|
6
|
+
/** @internal */
|
|
4
7
|
woodpeckerProfile: string;
|
|
8
|
+
/** @internal */
|
|
5
9
|
sshCredentialRef: string;
|
|
10
|
+
/** @internal */
|
|
6
11
|
owner: string;
|
|
12
|
+
/** @internal */
|
|
7
13
|
repo: string;
|
|
8
14
|
}
|
|
15
|
+
/** @public */
|
|
9
16
|
export interface ForgejoIssueOriginParams {
|
|
17
|
+
/** @internal */
|
|
10
18
|
origin: "issue";
|
|
19
|
+
/** @internal */
|
|
11
20
|
issueNumber: number;
|
|
21
|
+
/** @internal */
|
|
12
22
|
issueUrl: string;
|
|
23
|
+
/** @internal */
|
|
13
24
|
triggerLabel: string;
|
|
25
|
+
/** @internal */
|
|
14
26
|
doneLabel: string;
|
|
15
27
|
}
|
|
28
|
+
/** @public */
|
|
16
29
|
export interface ForgejoUiOriginParams {
|
|
30
|
+
/** @internal */
|
|
17
31
|
origin: "ui";
|
|
32
|
+
/** @internal */
|
|
18
33
|
issueNumber: null;
|
|
34
|
+
/** @internal */
|
|
19
35
|
issueUrl: null;
|
|
36
|
+
/** @internal */
|
|
20
37
|
triggerLabel: null;
|
|
38
|
+
/** @internal */
|
|
21
39
|
doneLabel: null;
|
|
22
40
|
}
|
|
41
|
+
/** @public */
|
|
23
42
|
export type ForgejoRepoChangeParams = RepositoryChangeLaunchParams<ForgejoRepoChangeCommonParams & (ForgejoIssueOriginParams | ForgejoUiOriginParams)>;
|
|
43
|
+
/** @internal */
|
|
24
44
|
export declare function isIssueOrigin(params: ForgejoRepoChangeParams): params is ForgejoRepoChangeParams & ForgejoIssueOriginParams;
|
|
45
|
+
/** @internal */
|
|
25
46
|
export declare const forgejoRepoChangeParamsCodec: import("@leitwerk-dev/process-sdk").Codec<ForgejoRepoChangeParams>;
|
|
26
47
|
export {};
|
|
27
48
|
//# sourceMappingURL=params.d.ts.map
|
package/dist/params.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../src/params.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,4BAA4B,EAEjC,MAAM,+CAA+C,CAAC;AAGvD,UAAU,6BAA6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C;IAChB,gBAAgB;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,cAAc;AACd,MAAM,WAAW,qBAAqB;IACrC,gBAAgB;IAChB,MAAM,EAAE,IAAI,CAAC;IACb,gBAAgB;IAChB,WAAW,EAAE,IAAI,CAAC;IAClB,gBAAgB;IAChB,QAAQ,EAAE,IAAI,CAAC;IACf,gBAAgB;IAChB,YAAY,EAAE,IAAI,CAAC;IACnB,gBAAgB;IAChB,SAAS,EAAE,IAAI,CAAC;CAChB;AAED,cAAc;AACd,MAAM,MAAM,uBAAuB,GAAG,4BAA4B,CACjE,6BAA6B,GAAG,CAAC,wBAAwB,GAAG,qBAAqB,CAAC,CAClF,CAAC;AAEF,gBAAgB;AAChB,wBAAgB,aAAa,CAC5B,MAAM,EAAE,uBAAuB,GAC7B,MAAM,IAAI,uBAAuB,GAAG,wBAAwB,CAE9D;AAED,gBAAgB;AAChB,eAAO,MAAM,4BAA4B,oEAiDtC,CAAC"}
|
package/dist/process.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RepositoryChangeState } from "@leitwerk-dev/coding/repository-change-state";
|
|
2
2
|
import { type createForgejoRepoChangeLauncher } from "./launcher.js";
|
|
3
3
|
import { type ForgejoRepoChangeParams } from "./params.js";
|
|
4
|
-
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare function createForgejoRepoChangeProcess(launcher: ReturnType<typeof createForgejoRepoChangeLauncher>, docker: boolean): import("@leitwerk-dev/process-sdk").ExtensionProcessDefinition<ForgejoRepoChangeParams, RepositoryChangeState>;
|
|
5
6
|
//# sourceMappingURL=process.d.ts.map
|
package/dist/process.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAS1F,OAAO,EACN,KAAK,+BAA+B,EAGpC,MAAM,eAAe,CAAC;AACvB,OAAO,EAEN,KAAK,uBAAuB,EAG5B,MAAM,aAAa,CAAC;AA8DrB,gBAAgB;AAChB,wBAAgB,8BAA8B,CAC7C,QAAQ,EAAE,UAAU,CAAC,OAAO,+BAA+B,CAAC,EAC5D,MAAM,EAAE,OAAO,kHA2Sf"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
/** Server-owned, non-secret wiring for future launches. */
|
|
1
|
+
/** Server-owned, non-secret wiring for future launches. @internal */
|
|
2
2
|
export interface ProfileBinding {
|
|
3
|
+
/** @internal */
|
|
3
4
|
woodpeckerProfile: string;
|
|
5
|
+
/** @internal */
|
|
4
6
|
sshCredentialRef: string;
|
|
5
7
|
}
|
|
8
|
+
/** @internal */
|
|
6
9
|
export type ProfileBindings = Readonly<Record<string, Readonly<ProfileBinding>>>;
|
|
10
|
+
/** @internal */
|
|
7
11
|
export declare function parseProfileBindings(raw: unknown): ProfileBindings;
|
|
12
|
+
/** @internal */
|
|
8
13
|
export declare function resolveProfileBinding(bindings: ProfileBindings, profile: string): ProfileBinding;
|
|
9
14
|
//# sourceMappingURL=profile-bindings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-bindings.d.ts","sourceRoot":"","sources":["../src/profile-bindings.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"profile-bindings.d.ts","sourceRoot":"","sources":["../src/profile-bindings.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,WAAW,cAAc;IAC9B,gBAAgB;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB;IAChB,gBAAgB,EAAE,MAAM,CAAC;CACzB;AACD,gBAAgB;AAChB,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAajF,gBAAgB;AAChB,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CA8BlE;AACD,gBAAgB;AAChB,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAIhG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leitwerk-dev/forgejo-repo-change",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"leitwerk": {
|
|
6
6
|
"extension": {
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"build": "tsup && tsc -p tsconfig.tsup.json --emitDeclarationOnly"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@leitwerk-dev/coding": "0.
|
|
24
|
-
"@leitwerk-dev/external-writes": "0.
|
|
25
|
-
"@leitwerk-dev/git-ssh": "0.
|
|
26
|
-
"@leitwerk-dev/process-sdk": "0.
|
|
27
|
-
"@leitwerk-dev/forgejo": "0.
|
|
28
|
-
"@leitwerk-dev/woodpecker": "0.
|
|
29
|
-
"@leitwerk-dev/repository-rebase": "0.
|
|
23
|
+
"@leitwerk-dev/coding": "0.3.0",
|
|
24
|
+
"@leitwerk-dev/external-writes": "0.3.0",
|
|
25
|
+
"@leitwerk-dev/git-ssh": "0.3.0",
|
|
26
|
+
"@leitwerk-dev/process-sdk": "0.3.0",
|
|
27
|
+
"@leitwerk-dev/forgejo": "0.3.0",
|
|
28
|
+
"@leitwerk-dev/woodpecker": "0.3.0",
|
|
29
|
+
"@leitwerk-dev/repository-rebase": "0.3.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"tsup": "^8.5.1"
|
package/src/index.ts
CHANGED
|
@@ -3,17 +3,27 @@ import { gitSshIntegration } from "@leitwerk-dev/git-ssh";
|
|
|
3
3
|
import type { LeitwerkExtensionModule } from "@leitwerk-dev/process-sdk";
|
|
4
4
|
import { woodpeckerIntegration } from "@leitwerk-dev/woodpecker";
|
|
5
5
|
import { createForgejoRepoChangeLauncher } from "./launcher.js";
|
|
6
|
+
|
|
7
|
+
export { forgejoRepoChangeLaunchConfig, forgejoRepoChangeParams } from "./launcher.js";
|
|
8
|
+
|
|
6
9
|
import { createForgejoRepoChangeProcess } from "./process.js";
|
|
7
10
|
import { parseProfileBindings } from "./profile-bindings.js";
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
/** @internal */
|
|
13
|
+
const manifest = {
|
|
14
|
+
/** @internal */
|
|
10
15
|
id: "forgejo-repo-change",
|
|
16
|
+
/** @internal */
|
|
11
17
|
version: "0.1.9",
|
|
18
|
+
/** @internal */
|
|
12
19
|
requires: ["forgejo", "woodpecker", "coding", "git-ssh"],
|
|
13
20
|
} as const;
|
|
14
21
|
|
|
15
|
-
/** Load exactly one variant per catalog. Only trusted composition code selects Docker. */
|
|
16
|
-
export function createForgejoRepoChange(options: {
|
|
22
|
+
/** Load exactly one variant per catalog. Only trusted composition code selects Docker. @public */
|
|
23
|
+
export function createForgejoRepoChange(options: {
|
|
24
|
+
/** @public */
|
|
25
|
+
docker: boolean;
|
|
26
|
+
}) {
|
|
17
27
|
if (typeof options.docker !== "boolean") throw new Error("docker must be a boolean");
|
|
18
28
|
const launcher = createForgejoRepoChangeLauncher();
|
|
19
29
|
const process = createForgejoRepoChangeProcess(launcher, options.docker);
|
|
@@ -37,22 +47,18 @@ export function createForgejoRepoChange(options: { docker: boolean }) {
|
|
|
37
47
|
api.onStop(() => launcher.configure(null));
|
|
38
48
|
},
|
|
39
49
|
};
|
|
40
|
-
return {
|
|
50
|
+
return {
|
|
51
|
+
/** @public */
|
|
52
|
+
extension,
|
|
53
|
+
/** @public */
|
|
54
|
+
process,
|
|
55
|
+
/** @internal */
|
|
56
|
+
launcher,
|
|
57
|
+
};
|
|
41
58
|
}
|
|
42
59
|
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export const {
|
|
48
|
-
extension: defaultExtension,
|
|
49
|
-
process: forgejoRepoChangeProcess,
|
|
50
|
-
launcher: defaultForgejoRepoChangeLauncher,
|
|
51
|
-
} = createForgejoRepoChange({ docker: true });
|
|
52
|
-
export const {
|
|
53
|
-
configure: configureForgejoRepoChangeLauncher,
|
|
54
|
-
preparationChecks: forgejoRepositoryPreparationChecks,
|
|
55
|
-
resolveGitIdentity: resolveForgejoGitIdentity,
|
|
56
|
-
launcher: forgejoRepoChangeUiLauncher,
|
|
57
|
-
} = defaultForgejoRepoChangeLauncher;
|
|
60
|
+
export type { ForgejoRepoChangeParams } from "./params.js";
|
|
61
|
+
|
|
62
|
+
/** @internal */
|
|
63
|
+
const { extension: defaultExtension } = createForgejoRepoChange({ docker: true });
|
|
58
64
|
export default defaultExtension;
|
package/src/launcher.ts
CHANGED
|
@@ -17,20 +17,26 @@ import type { WoodpeckerIntegration } from "@leitwerk-dev/woodpecker";
|
|
|
17
17
|
import { type ForgejoRepoChangeParams, isIssueOrigin } from "./params.js";
|
|
18
18
|
import { type ProfileBindings, resolveProfileBinding } from "./profile-bindings.js";
|
|
19
19
|
|
|
20
|
+
/** @internal */
|
|
20
21
|
export const forgejoRepoChangeUiLauncherId = "forgejo_repo_change_process.ui_launcher" as const;
|
|
21
22
|
|
|
23
|
+
/** @internal */
|
|
22
24
|
export function forgejoRepoChangeParams(
|
|
23
25
|
repository: ForgejoRepository,
|
|
24
26
|
input: {
|
|
27
|
+
/** @internal */
|
|
25
28
|
profile: string;
|
|
29
|
+
/** @internal */
|
|
26
30
|
woodpeckerProfile: string;
|
|
31
|
+
/** @internal */
|
|
27
32
|
sshCredentialRef: string;
|
|
33
|
+
/** @internal */
|
|
28
34
|
prompt: string;
|
|
35
|
+
/** @internal */
|
|
29
36
|
workBranch: string;
|
|
30
37
|
},
|
|
31
38
|
): ForgejoRepoChangeParams {
|
|
32
39
|
return {
|
|
33
|
-
launchKind: "requested_change",
|
|
34
40
|
repoLocator: repository.ssh_url,
|
|
35
41
|
baseBranch: repository.default_branch,
|
|
36
42
|
workBranch: input.workBranch,
|
|
@@ -48,6 +54,7 @@ export function forgejoRepoChangeParams(
|
|
|
48
54
|
};
|
|
49
55
|
}
|
|
50
56
|
|
|
57
|
+
/** @internal */
|
|
51
58
|
export function forgejoRepoChangeLaunchConfig(
|
|
52
59
|
params: ForgejoRepoChangeParams,
|
|
53
60
|
title: string,
|
|
@@ -83,16 +90,23 @@ export function forgejoRepoChangeLaunchConfig(
|
|
|
83
90
|
};
|
|
84
91
|
}
|
|
85
92
|
|
|
93
|
+
/** @internal */
|
|
86
94
|
export interface LauncherDependencies {
|
|
95
|
+
/** @internal */
|
|
87
96
|
forgejo: ForgejoIntegration;
|
|
97
|
+
/** @internal */
|
|
88
98
|
gitSsh: GitSshIntegration;
|
|
99
|
+
/** @internal */
|
|
89
100
|
woodpecker: WoodpeckerIntegration;
|
|
101
|
+
/** @internal */
|
|
90
102
|
profileBindings?: ProfileBindings;
|
|
91
103
|
}
|
|
92
104
|
|
|
105
|
+
/** @internal */
|
|
93
106
|
export function createForgejoRepoChangeLauncher() {
|
|
94
107
|
let dependencies: LauncherDependencies | null = null;
|
|
95
108
|
|
|
109
|
+
/** @internal */
|
|
96
110
|
function configureForgejoRepoChangeLauncher(value: LauncherDependencies | null): void {
|
|
97
111
|
dependencies = value;
|
|
98
112
|
}
|
|
@@ -129,6 +143,7 @@ export function createForgejoRepoChangeLauncher() {
|
|
|
129
143
|
};
|
|
130
144
|
}
|
|
131
145
|
|
|
146
|
+
/** @internal */
|
|
132
147
|
function forgejoRepositoryPreparationChecks(
|
|
133
148
|
_input: unknown,
|
|
134
149
|
{ params }: ProcessLaunchConfig<ForgejoRepoChangeParams>,
|
|
@@ -165,6 +180,7 @@ export function createForgejoRepoChangeLauncher() {
|
|
|
165
180
|
return { code, fieldId, message };
|
|
166
181
|
}
|
|
167
182
|
|
|
183
|
+
/** @internal */
|
|
168
184
|
function resolveProfiles(profile: string) {
|
|
169
185
|
const { forgejo, woodpecker, gitSsh, profileBindings = {} } = requireDependencies();
|
|
170
186
|
if (!forgejo.profiles().includes(profile)) throw new Error("Forgejo profile is not available");
|
|
@@ -179,6 +195,7 @@ export function createForgejoRepoChangeLauncher() {
|
|
|
179
195
|
return binding;
|
|
180
196
|
}
|
|
181
197
|
|
|
198
|
+
/** @internal */
|
|
182
199
|
async function resolveForgejoGitIdentity(profile: string): Promise<ForgejoGitIdentity> {
|
|
183
200
|
if (!profile) throw new Error("A Forgejo profile is required to resolve Git identity");
|
|
184
201
|
return requireDependencies().forgejo.client(profile).resolveGitIdentity(profile);
|
|
@@ -310,10 +327,15 @@ export function createForgejoRepoChangeLauncher() {
|
|
|
310
327
|
};
|
|
311
328
|
|
|
312
329
|
return {
|
|
330
|
+
/** @internal */
|
|
313
331
|
configure: configureForgejoRepoChangeLauncher,
|
|
332
|
+
/** @internal */
|
|
314
333
|
preparationChecks: forgejoRepositoryPreparationChecks,
|
|
334
|
+
/** @internal */
|
|
315
335
|
resolveProfiles,
|
|
336
|
+
/** @internal */
|
|
316
337
|
resolveGitIdentity: resolveForgejoGitIdentity,
|
|
338
|
+
/** @internal */
|
|
317
339
|
launcher: forgejoRepoChangeUiLauncher,
|
|
318
340
|
};
|
|
319
341
|
}
|
package/src/params.ts
CHANGED
|
@@ -6,43 +6,63 @@ import {
|
|
|
6
6
|
} from "@leitwerk-dev/coding/repository-change-launch";
|
|
7
7
|
import { trimString } from "@leitwerk-dev/domain";
|
|
8
8
|
|
|
9
|
+
/** @public */
|
|
9
10
|
interface ForgejoRepoChangeCommonParams {
|
|
11
|
+
/** @internal */
|
|
10
12
|
forgejoProfile: string;
|
|
13
|
+
/** @internal */
|
|
11
14
|
woodpeckerProfile: string;
|
|
15
|
+
/** @internal */
|
|
12
16
|
sshCredentialRef: string;
|
|
17
|
+
/** @internal */
|
|
13
18
|
owner: string;
|
|
19
|
+
/** @internal */
|
|
14
20
|
repo: string;
|
|
15
21
|
}
|
|
16
22
|
|
|
23
|
+
/** @public */
|
|
17
24
|
export interface ForgejoIssueOriginParams {
|
|
25
|
+
/** @internal */
|
|
18
26
|
origin: "issue";
|
|
27
|
+
/** @internal */
|
|
19
28
|
issueNumber: number;
|
|
29
|
+
/** @internal */
|
|
20
30
|
issueUrl: string;
|
|
31
|
+
/** @internal */
|
|
21
32
|
triggerLabel: string;
|
|
33
|
+
/** @internal */
|
|
22
34
|
doneLabel: string;
|
|
23
35
|
}
|
|
24
36
|
|
|
37
|
+
/** @public */
|
|
25
38
|
export interface ForgejoUiOriginParams {
|
|
39
|
+
/** @internal */
|
|
26
40
|
origin: "ui";
|
|
41
|
+
/** @internal */
|
|
27
42
|
issueNumber: null;
|
|
43
|
+
/** @internal */
|
|
28
44
|
issueUrl: null;
|
|
45
|
+
/** @internal */
|
|
29
46
|
triggerLabel: null;
|
|
47
|
+
/** @internal */
|
|
30
48
|
doneLabel: null;
|
|
31
49
|
}
|
|
32
50
|
|
|
51
|
+
/** @public */
|
|
33
52
|
export type ForgejoRepoChangeParams = RepositoryChangeLaunchParams<
|
|
34
53
|
ForgejoRepoChangeCommonParams & (ForgejoIssueOriginParams | ForgejoUiOriginParams)
|
|
35
54
|
>;
|
|
36
55
|
|
|
56
|
+
/** @internal */
|
|
37
57
|
export function isIssueOrigin(
|
|
38
58
|
params: ForgejoRepoChangeParams,
|
|
39
59
|
): params is ForgejoRepoChangeParams & ForgejoIssueOriginParams {
|
|
40
60
|
return params.origin === "issue";
|
|
41
61
|
}
|
|
42
62
|
|
|
63
|
+
/** @internal */
|
|
43
64
|
export const forgejoRepoChangeParamsCodec =
|
|
44
65
|
createRepositoryChangeParamsCodec<ForgejoRepoChangeParams>({
|
|
45
|
-
displayName: "Forgejo Repo Change",
|
|
46
66
|
normalize(value) {
|
|
47
67
|
const shared = normalizeRepositoryChangeParamsInput(value, "Forgejo Repo Change");
|
|
48
68
|
const record = repositoryChangeParamsRecord(value, "Forgejo Repo Change");
|