@leitwerk-dev/gitlab 0.0.0-bootstrap.0 → 0.2.1
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 +57 -1
- package/dist/LICENSE +13 -0
- package/dist/capability.d.ts +14 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/chunk-64FNBSKH.js +605 -0
- package/dist/chunk-64FNBSKH.js.map +1 -0
- package/dist/client.d.ts +336 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/external.d.ts +53 -0
- package/dist/external.d.ts.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +107 -0
- package/dist/index.js.map +1 -0
- package/dist/merge-request.test-fixture.d.ts +3 -0
- package/dist/merge-request.test-fixture.d.ts.map +1 -0
- package/dist/selection.d.ts +27 -0
- package/dist/selection.d.ts.map +1 -0
- package/dist/setup.d.ts +11 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/testing.d.ts +56 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +219 -0
- package/dist/testing.js.map +1 -0
- package/dist/tools.d.ts +57 -0
- package/dist/tools.d.ts.map +1 -0
- package/package.json +54 -14
- package/src/capability.ts +28 -0
- package/src/client.ts +702 -0
- package/src/external.ts +180 -0
- package/src/index.ts +67 -0
- package/src/merge-request.test-fixture.ts +16 -0
- package/src/selection.ts +77 -0
- package/src/setup.ts +20 -0
- package/src/testing.ts +254 -0
- package/src/tools.ts +208 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GitLabClient,
|
|
3
|
+
ensureGitLabSeenReaction,
|
|
4
|
+
gitLabFeedbackReadyAt,
|
|
5
|
+
gitlabExternal,
|
|
6
|
+
gitlabIntegration,
|
|
7
|
+
gitlabRepositoryCredentials,
|
|
8
|
+
observationKey,
|
|
9
|
+
observeMergeRequest,
|
|
10
|
+
parseGitLabProfiles,
|
|
11
|
+
pendingGitLabFeedback,
|
|
12
|
+
resolveGitLabBinding,
|
|
13
|
+
setupGitLabIntegration
|
|
14
|
+
} from "./chunk-64FNBSKH.js";
|
|
15
|
+
|
|
16
|
+
// src/index.ts
|
|
17
|
+
import { coreHostCapabilities } from "@leitwerk-dev/process-sdk";
|
|
18
|
+
|
|
19
|
+
// src/selection.ts
|
|
20
|
+
function parseGitLabSelection(raw) {
|
|
21
|
+
const list = (value) => {
|
|
22
|
+
if (value === void 0) return [];
|
|
23
|
+
if (!Array.isArray(value) || value.some(
|
|
24
|
+
(v) => typeof v !== "string" || !/^[a-zA-Z0-9_.-]+(?:\/[a-zA-Z0-9_.-]+)*$/.test(v) || v.split("/").some((p) => p === "." || p === "..")
|
|
25
|
+
))
|
|
26
|
+
throw new Error("GitLab selectors require exact namespace paths");
|
|
27
|
+
return [...new Set(value)];
|
|
28
|
+
};
|
|
29
|
+
const pair = (value) => {
|
|
30
|
+
if (value !== void 0 && (!value || typeof value !== "object" || Array.isArray(value)))
|
|
31
|
+
throw new Error("GitLab selectors must be objects");
|
|
32
|
+
const item = value;
|
|
33
|
+
return { include: list(item?.include), exclude: list(item?.exclude) };
|
|
34
|
+
};
|
|
35
|
+
if (raw.all_accessible !== void 0 && typeof raw.all_accessible !== "boolean")
|
|
36
|
+
throw new Error("all_accessible must be a boolean");
|
|
37
|
+
const parsed = {
|
|
38
|
+
projects: pair(raw.projects),
|
|
39
|
+
groups: pair(raw.groups),
|
|
40
|
+
allAccessible: raw.all_accessible === true
|
|
41
|
+
};
|
|
42
|
+
if (!parsed.allAccessible && !parsed.projects.include.length && !parsed.groups.include.length)
|
|
43
|
+
throw new Error("GitLab requires explicit project/group includes or all_accessible: true");
|
|
44
|
+
return parsed;
|
|
45
|
+
}
|
|
46
|
+
function projectExcluded(selection, name) {
|
|
47
|
+
return selection.projects.exclude.includes(name) || selection.groups.exclude.some((group) => name.startsWith(`${group}/`));
|
|
48
|
+
}
|
|
49
|
+
async function selectGitLabProjects(client, selection) {
|
|
50
|
+
const candidates = selection.allAccessible ? await client.listProjects() : [];
|
|
51
|
+
for (const name of selection.projects.include) candidates.push(await client.getProject(name));
|
|
52
|
+
for (const group of selection.groups.include)
|
|
53
|
+
candidates.push(...await client.listGroupProjects(group));
|
|
54
|
+
return [
|
|
55
|
+
...new Map(
|
|
56
|
+
candidates.filter((p) => !p.archived && !projectExcluded(selection, p.path_with_namespace)).map((p) => [p.id, p])
|
|
57
|
+
).values()
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/index.ts
|
|
62
|
+
var manifest = {
|
|
63
|
+
/** @internal */
|
|
64
|
+
id: "gitlab",
|
|
65
|
+
/** @internal */
|
|
66
|
+
version: "0.1.9"
|
|
67
|
+
};
|
|
68
|
+
var extension = {
|
|
69
|
+
manifest,
|
|
70
|
+
setupServer(api, config) {
|
|
71
|
+
const profiles = parseGitLabProfiles(config);
|
|
72
|
+
const clients = new Map([...profiles].map(([id, profile]) => [id, new GitLabClient(profile)]));
|
|
73
|
+
setupGitLabIntegration(api, {
|
|
74
|
+
profiles: () => [...profiles.keys()],
|
|
75
|
+
client: (profile) => {
|
|
76
|
+
const client = clients.get(profile);
|
|
77
|
+
if (!client) throw new Error(`Unknown GitLab profile '${profile}'`);
|
|
78
|
+
return client;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const deps = api.get(coreHostCapabilities.serverSetup);
|
|
82
|
+
if (!deps || Array.isArray(deps)) return;
|
|
83
|
+
deps.repositoryCredentials.register({
|
|
84
|
+
kind: "git_https",
|
|
85
|
+
resolve(ref) {
|
|
86
|
+
const profile = ref.startsWith("gitlab:") ? profiles.get(ref.slice(7)) : void 0;
|
|
87
|
+
return profile ? { origin: profile.baseUrl, username: "oauth2", password: profile.token } : null;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
var index_default = extension;
|
|
93
|
+
export {
|
|
94
|
+
index_default as default,
|
|
95
|
+
ensureGitLabSeenReaction,
|
|
96
|
+
gitLabFeedbackReadyAt,
|
|
97
|
+
gitlabExternal,
|
|
98
|
+
gitlabIntegration,
|
|
99
|
+
gitlabRepositoryCredentials,
|
|
100
|
+
observationKey,
|
|
101
|
+
observeMergeRequest,
|
|
102
|
+
parseGitLabSelection,
|
|
103
|
+
pendingGitLabFeedback,
|
|
104
|
+
resolveGitLabBinding,
|
|
105
|
+
selectGitLabProjects
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/selection.ts"],"sourcesContent":["import type { LeitwerkExtensionModule } from \"@leitwerk-dev/process-sdk\";\nimport { coreHostCapabilities } from \"@leitwerk-dev/process-sdk\";\nimport { GitLabClient, parseGitLabProfiles } from \"./client.js\";\nimport { setupGitLabIntegration } from \"./setup.js\";\n\n/** @internal */\nconst manifest = {\n\t/** @internal */\n\tid: \"gitlab\",\n\t/** @internal */\n\tversion: \"0.1.9\",\n} as const;\n/** @public */\nconst extension: LeitwerkExtensionModule = {\n\tmanifest,\n\tsetupServer(api, config) {\n\t\tconst profiles = parseGitLabProfiles(config);\n\t\tconst clients = new Map([...profiles].map(([id, profile]) => [id, new GitLabClient(profile)]));\n\t\tsetupGitLabIntegration(api, {\n\t\t\tprofiles: () => [...profiles.keys()],\n\t\t\tclient: (profile) => {\n\t\t\t\tconst client = clients.get(profile);\n\t\t\t\tif (!client) throw new Error(`Unknown GitLab profile '${profile}'`);\n\t\t\t\treturn client;\n\t\t\t},\n\t\t});\n\t\tconst deps = api.get(coreHostCapabilities.serverSetup);\n\t\tif (!deps || Array.isArray(deps)) return;\n\t\tdeps.repositoryCredentials.register({\n\t\t\tkind: \"git_https\",\n\t\t\tresolve(ref) {\n\t\t\t\tconst profile = ref.startsWith(\"gitlab:\") ? profiles.get(ref.slice(7)) : undefined;\n\t\t\t\treturn profile\n\t\t\t\t\t? { origin: profile.baseUrl, username: \"oauth2\", password: profile.token }\n\t\t\t\t\t: null;\n\t\t\t},\n\t\t});\n\t},\n};\nexport default extension;\nexport type { GitLabIntegration } from \"./capability.js\";\nexport {\n\tgitlabIntegration,\n\tgitlabRepositoryCredentials,\n} from \"./capability.js\";\nexport type {\n\tGitLabDiff,\n\tGitLabFeedback,\n\tGitLabIdentity,\n\tGitLabJob,\n\tGitLabMergeRequest,\n\tGitLabObservation,\n\tGitLabProject,\n} from \"./client.js\";\nexport { observeMergeRequest } from \"./client.js\";\nexport {\n\tgitLabFeedbackReadyAt,\n\tgitlabExternal,\n\tobservationKey,\n\tpendingGitLabFeedback,\n} from \"./external.js\";\nexport type { GitLabSelection } from \"./selection.js\";\nexport {\n\tparseGitLabSelection,\n\tselectGitLabProjects,\n} from \"./selection.js\";\nexport { ensureGitLabSeenReaction, resolveGitLabBinding } from \"./tools.js\";\n","import type { GitLabClientLike, GitLabProject } from \"./client.js\";\n/** @public */\nexport interface GitLabSelection {\n\t/** @public */\n\tprojects: {\n\t\t/** @public */\n\t\tinclude: readonly string[];\n\t\t/** @internal */\n\t\texclude: readonly string[];\n\t};\n\t/** @public */\n\tgroups: {\n\t\t/** @public */\n\t\tinclude: readonly string[];\n\t\t/** @internal */\n\t\texclude: readonly string[];\n\t};\n\t/** @internal */\n\tallAccessible: boolean;\n}\n/** @public */\nexport function parseGitLabSelection(raw: Record<string, unknown>): GitLabSelection {\n\tconst list = (value: unknown): string[] => {\n\t\tif (value === undefined) return [];\n\t\tif (\n\t\t\t!Array.isArray(value) ||\n\t\t\tvalue.some(\n\t\t\t\t(v) =>\n\t\t\t\t\ttypeof v !== \"string\" ||\n\t\t\t\t\t!/^[a-zA-Z0-9_.-]+(?:\\/[a-zA-Z0-9_.-]+)*$/.test(v) ||\n\t\t\t\t\tv.split(\"/\").some((p: string) => p === \".\" || p === \"..\"),\n\t\t\t)\n\t\t)\n\t\t\tthrow new Error(\"GitLab selectors require exact namespace paths\");\n\t\treturn [...new Set(value as string[])];\n\t};\n\tconst pair = (value: unknown) => {\n\t\tif (value !== undefined && (!value || typeof value !== \"object\" || Array.isArray(value)))\n\t\t\tthrow new Error(\"GitLab selectors must be objects\");\n\t\tconst item = value as Record<string, unknown> | undefined;\n\t\treturn { include: list(item?.include), exclude: list(item?.exclude) };\n\t};\n\tif (raw.all_accessible !== undefined && typeof raw.all_accessible !== \"boolean\")\n\t\tthrow new Error(\"all_accessible must be a boolean\");\n\tconst parsed = {\n\t\tprojects: pair(raw.projects),\n\t\tgroups: pair(raw.groups),\n\t\tallAccessible: raw.all_accessible === true,\n\t};\n\tif (!parsed.allAccessible && !parsed.projects.include.length && !parsed.groups.include.length)\n\t\tthrow new Error(\"GitLab requires explicit project/group includes or all_accessible: true\");\n\treturn parsed;\n}\n/** @internal */\nexport function projectExcluded(selection: GitLabSelection, name: string): boolean {\n\treturn (\n\t\tselection.projects.exclude.includes(name) ||\n\t\tselection.groups.exclude.some((group) => name.startsWith(`${group}/`))\n\t);\n}\n/** Include union, subgroup expansion, exclusion precedence, stable-ID deduplication. @public */\nexport async function selectGitLabProjects(\n\tclient: GitLabClientLike,\n\tselection: GitLabSelection,\n): Promise<GitLabProject[]> {\n\tconst candidates: GitLabProject[] = selection.allAccessible ? await client.listProjects() : [];\n\tfor (const name of selection.projects.include) candidates.push(await client.getProject(name));\n\tfor (const group of selection.groups.include)\n\t\tcandidates.push(...(await client.listGroupProjects(group)));\n\treturn [\n\t\t...new Map(\n\t\t\tcandidates\n\t\t\t\t.filter((p) => !p.archived && !projectExcluded(selection, p.path_with_namespace))\n\t\t\t\t.map((p) => [p.id, p]),\n\t\t).values(),\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA,SAAS,4BAA4B;;;ACoB9B,SAAS,qBAAqB,KAA+C;AACnF,QAAM,OAAO,CAAC,UAA6B;AAC1C,QAAI,UAAU,OAAW,QAAO,CAAC;AACjC,QACC,CAAC,MAAM,QAAQ,KAAK,KACpB,MAAM;AAAA,MACL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,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-request.test-fixture.d.ts","sourceRoot":"","sources":["../src/merge-request.test-fixture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,eAAO,MAAM,EAAE,EAAE,kBAahB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { GitLabClientLike, GitLabProject } from "./client.js";
|
|
2
|
+
/** @public */
|
|
3
|
+
export interface GitLabSelection {
|
|
4
|
+
/** @public */
|
|
5
|
+
projects: {
|
|
6
|
+
/** @public */
|
|
7
|
+
include: readonly string[];
|
|
8
|
+
/** @internal */
|
|
9
|
+
exclude: readonly string[];
|
|
10
|
+
};
|
|
11
|
+
/** @public */
|
|
12
|
+
groups: {
|
|
13
|
+
/** @public */
|
|
14
|
+
include: readonly string[];
|
|
15
|
+
/** @internal */
|
|
16
|
+
exclude: readonly string[];
|
|
17
|
+
};
|
|
18
|
+
/** @internal */
|
|
19
|
+
allAccessible: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** @public */
|
|
22
|
+
export declare function parseGitLabSelection(raw: Record<string, unknown>): GitLabSelection;
|
|
23
|
+
/** @internal */
|
|
24
|
+
export declare function projectExcluded(selection: GitLabSelection, name: string): boolean;
|
|
25
|
+
/** Include union, subgroup expansion, exclusion precedence, stable-ID deduplication. @public */
|
|
26
|
+
export declare function selectGitLabProjects(client: GitLabClientLike, selection: GitLabSelection): Promise<GitLabProject[]>;
|
|
27
|
+
//# sourceMappingURL=selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../src/selection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACnE,cAAc;AACd,MAAM,WAAW,eAAe;IAC/B,cAAc;IACd,QAAQ,EAAE;QACT,cAAc;QACd,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;QAC3B,gBAAgB;QAChB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;KAC3B,CAAC;IACF,cAAc;IACd,MAAM,EAAE;QACP,cAAc;QACd,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;QAC3B,gBAAgB;QAChB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;KAC3B,CAAC;IACF,gBAAgB;IAChB,aAAa,EAAE,OAAO,CAAC;CACvB;AACD,cAAc;AACd,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe,CA+BlF;AACD,gBAAgB;AAChB,wBAAgB,eAAe,CAAC,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAKjF;AACD,gGAAgG;AAChG,wBAAsB,oBAAoB,CACzC,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,eAAe,GACxB,OAAO,CAAC,aAAa,EAAE,CAAC,CAY1B"}
|
package/dist/setup.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ServerExtensionAPI } from "@leitwerk-dev/process-sdk";
|
|
2
|
+
import { type GitLabIntegration } from "./capability.js";
|
|
3
|
+
/** Register shared tools and polling with an explicit integration. @public */
|
|
4
|
+
export declare function setupGitLabIntegration(api: ServerExtensionAPI, integration: GitLabIntegration, options?: {
|
|
5
|
+
/** @public */
|
|
6
|
+
now?: () => number;
|
|
7
|
+
}): {
|
|
8
|
+
/** @public */
|
|
9
|
+
poll(): Promise<import("@leitwerk-dev/watcher-utils").PollResult>;
|
|
10
|
+
} | undefined;
|
|
11
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,KAAK,iBAAiB,EAAqB,MAAM,iBAAiB,CAAC;AAI5E,8EAA8E;AAC9E,wBAAgB,sBAAsB,CACrC,GAAG,EAAE,kBAAkB,EACvB,WAAW,EAAE,iBAAiB,EAC9B,OAAO,GAAE;IACR,cAAc;IACd,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACd;;;cAON"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { GitLabClientLike, GitLabDiff, GitLabFeedback, GitLabMergeRequest, GitLabNote, GitLabNoteReaction, GitLabPipeline, GitLabProject } from "./client.js";
|
|
2
|
+
export { setupGitLabIntegration } from "./setup.js";
|
|
3
|
+
/** @public */
|
|
4
|
+
interface LocalState {
|
|
5
|
+
/** @internal */
|
|
6
|
+
projects: GitLabProject[];
|
|
7
|
+
/** @internal */
|
|
8
|
+
mrs: GitLabMergeRequest[];
|
|
9
|
+
/** @internal */
|
|
10
|
+
pipelines: GitLabPipeline[];
|
|
11
|
+
/** @public */
|
|
12
|
+
notes: Record<string, GitLabNote[]>;
|
|
13
|
+
/** @internal */
|
|
14
|
+
diffs: Record<string, GitLabDiff[]>;
|
|
15
|
+
/** @public */
|
|
16
|
+
feedback?: Record<string, GitLabFeedback[]>;
|
|
17
|
+
/** @public */
|
|
18
|
+
discussionNotes?: Record<string, GitLabNote[]>;
|
|
19
|
+
/** @public */
|
|
20
|
+
reactions?: Record<string, GitLabNoteReaction[]>;
|
|
21
|
+
}
|
|
22
|
+
/** Persistent GitLab test boundary. Repository URLs use local Git's file transport. @public */
|
|
23
|
+
export declare class LocalGitLabAdapter {
|
|
24
|
+
/** @internal */
|
|
25
|
+
readonly root: string;
|
|
26
|
+
/** @internal */
|
|
27
|
+
readonly baseUrl: string;
|
|
28
|
+
/** @public */
|
|
29
|
+
state: LocalState;
|
|
30
|
+
/** @public */
|
|
31
|
+
loseNextCommentResponse: boolean;
|
|
32
|
+
/** @public */
|
|
33
|
+
loseNextReplyResponse: boolean;
|
|
34
|
+
/** @public */
|
|
35
|
+
loseNextReactionResponse: boolean;
|
|
36
|
+
/** @public */
|
|
37
|
+
constructor(
|
|
38
|
+
/** @internal */
|
|
39
|
+
root: string,
|
|
40
|
+
/** @internal */
|
|
41
|
+
baseUrl?: string);
|
|
42
|
+
/** @public */
|
|
43
|
+
save(): void;
|
|
44
|
+
private append;
|
|
45
|
+
private project;
|
|
46
|
+
private git;
|
|
47
|
+
/** @public */
|
|
48
|
+
addProject(name: string, bare: string): GitLabProject;
|
|
49
|
+
/** @public */
|
|
50
|
+
openMr(project: GitLabProject, branch: string): GitLabMergeRequest;
|
|
51
|
+
/** @public */
|
|
52
|
+
pipeline(mr: GitLabMergeRequest, status: string): GitLabPipeline;
|
|
53
|
+
/** @public */
|
|
54
|
+
client(): GitLabClientLike;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,cAAc;AACd,UAAU,UAAU;IACnB,gBAAgB;IAChB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,gBAAgB;IAChB,GAAG,EAAE,kBAAkB,EAAE,CAAC;IAC1B,gBAAgB;IAChB,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,cAAc;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IACpC,gBAAgB;IAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IACpC,cAAc;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;IAC5C,cAAc;IACd,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAC/C,cAAc;IACd,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;CACjD;AACD,+FAA+F;AAC/F,qBAAa,kBAAkB;IAW7B,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,gBAAgB;IAChB,QAAQ,CAAC,OAAO;IAbjB,cAAc;IACd,KAAK,EAAE,UAAU,CAAC;IAClB,cAAc;IACd,uBAAuB,UAAS;IAChC,cAAc;IACd,qBAAqB,UAAS;IAC9B,cAAc;IACd,wBAAwB,UAAS;IACjC,cAAc;;IAEb,gBAAgB;IACP,IAAI,EAAE,MAAM;IACrB,gBAAgB;IACP,OAAO,SAAwB;IAQzC,cAAc;IACd,IAAI;IAGJ,OAAO,CAAC,MAAM;IAed,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,GAAG;IAOX,cAAc;IACd,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa;IAYrD,cAAc;IACd,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,kBAAkB;IAmBlE,cAAc;IACd,QAAQ,CAAC,EAAE,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc;IAchE,cAAc;IACd,MAAM,IAAI,gBAAgB;CAmH1B"}
|
package/dist/testing.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setupGitLabIntegration
|
|
3
|
+
} from "./chunk-64FNBSKH.js";
|
|
4
|
+
|
|
5
|
+
// src/testing.ts
|
|
6
|
+
import { execFileSync } from "child_process";
|
|
7
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
8
|
+
import path from "path";
|
|
9
|
+
var LocalGitLabAdapter = class {
|
|
10
|
+
/** @public */
|
|
11
|
+
constructor(root, baseUrl = "https://gitlab.test") {
|
|
12
|
+
this.root = root;
|
|
13
|
+
this.baseUrl = baseUrl;
|
|
14
|
+
mkdirSync(root, { recursive: true });
|
|
15
|
+
const file = path.join(root, "gitlab.json");
|
|
16
|
+
this.state = existsSync(file) ? JSON.parse(readFileSync(file, "utf8")) : { projects: [], mrs: [], pipelines: [], notes: {}, diffs: {} };
|
|
17
|
+
}
|
|
18
|
+
root;
|
|
19
|
+
baseUrl;
|
|
20
|
+
/** @public */
|
|
21
|
+
state;
|
|
22
|
+
/** @public */
|
|
23
|
+
loseNextCommentResponse = false;
|
|
24
|
+
/** @public */
|
|
25
|
+
loseNextReplyResponse = false;
|
|
26
|
+
/** @public */
|
|
27
|
+
loseNextReactionResponse = false;
|
|
28
|
+
/** @public */
|
|
29
|
+
save() {
|
|
30
|
+
writeFileSync(path.join(this.root, "gitlab.json"), JSON.stringify(this.state), { mode: 384 });
|
|
31
|
+
}
|
|
32
|
+
append(items, item, kind) {
|
|
33
|
+
items.push(item);
|
|
34
|
+
this.save();
|
|
35
|
+
const flag = `loseNext${kind}Response`;
|
|
36
|
+
if (this[flag]) {
|
|
37
|
+
this[flag] = false;
|
|
38
|
+
const action = {
|
|
39
|
+
Comment: "comment write",
|
|
40
|
+
Reply: "discussion reply",
|
|
41
|
+
Reaction: "reaction write"
|
|
42
|
+
};
|
|
43
|
+
throw new Error(`Response lost after ${action[kind]}`);
|
|
44
|
+
}
|
|
45
|
+
return item;
|
|
46
|
+
}
|
|
47
|
+
project(id) {
|
|
48
|
+
const p = this.state.projects.find((p2) => p2.id === id || p2.path_with_namespace === id);
|
|
49
|
+
if (!p) throw new Error("Unknown test project");
|
|
50
|
+
return p;
|
|
51
|
+
}
|
|
52
|
+
git(id, args) {
|
|
53
|
+
return execFileSync(
|
|
54
|
+
"git",
|
|
55
|
+
["-c", "core.hooksPath=/dev/null", "--git-dir", this.project(id).http_url_to_repo, ...args],
|
|
56
|
+
{ encoding: "utf8" }
|
|
57
|
+
).trim();
|
|
58
|
+
}
|
|
59
|
+
/** @public */
|
|
60
|
+
addProject(name, bare) {
|
|
61
|
+
const project = {
|
|
62
|
+
id: this.state.projects.length + 1,
|
|
63
|
+
path_with_namespace: name,
|
|
64
|
+
http_url_to_repo: bare,
|
|
65
|
+
web_url: `${this.baseUrl}/${name}`,
|
|
66
|
+
default_branch: "main"
|
|
67
|
+
};
|
|
68
|
+
this.state.projects.push(project);
|
|
69
|
+
this.save();
|
|
70
|
+
return project;
|
|
71
|
+
}
|
|
72
|
+
/** @public */
|
|
73
|
+
openMr(project, branch) {
|
|
74
|
+
const mr = {
|
|
75
|
+
iid: this.state.mrs.length + 1,
|
|
76
|
+
project_id: project.id,
|
|
77
|
+
target_project_id: project.id,
|
|
78
|
+
source_project_id: project.id,
|
|
79
|
+
title: "Update dependency",
|
|
80
|
+
description: "Renovate upgrade",
|
|
81
|
+
state: "opened",
|
|
82
|
+
labels: ["renovate"],
|
|
83
|
+
sha: this.git(project.id, ["rev-parse", branch]),
|
|
84
|
+
source_branch: branch,
|
|
85
|
+
target_branch: "main",
|
|
86
|
+
web_url: `${project.web_url}/-/merge_requests/${this.state.mrs.length + 1}`
|
|
87
|
+
};
|
|
88
|
+
this.state.mrs.push(mr);
|
|
89
|
+
this.save();
|
|
90
|
+
return mr;
|
|
91
|
+
}
|
|
92
|
+
/** @public */
|
|
93
|
+
pipeline(mr, status) {
|
|
94
|
+
const value = {
|
|
95
|
+
id: this.state.pipelines.length + 1,
|
|
96
|
+
project_id: mr.source_project_id,
|
|
97
|
+
sha: this.git(mr.source_project_id, ["rev-parse", mr.source_branch]),
|
|
98
|
+
ref: mr.source_branch,
|
|
99
|
+
status,
|
|
100
|
+
source: "merge_request_event",
|
|
101
|
+
web_url: `${this.project(mr.source_project_id).web_url}/-/pipelines/${this.state.pipelines.length + 1}`
|
|
102
|
+
};
|
|
103
|
+
this.state.pipelines.push(value);
|
|
104
|
+
this.save();
|
|
105
|
+
return value;
|
|
106
|
+
}
|
|
107
|
+
/** @public */
|
|
108
|
+
client() {
|
|
109
|
+
const mr = (id, iid) => {
|
|
110
|
+
const m = this.state.mrs.find((m2) => m2.project_id === id && m2.iid === iid);
|
|
111
|
+
if (!m) throw new Error("Unknown test MR");
|
|
112
|
+
return m;
|
|
113
|
+
};
|
|
114
|
+
const commit = (id, ref) => ({
|
|
115
|
+
id: this.git(id, ["rev-parse", ref]),
|
|
116
|
+
parent_ids: this.git(id, ["show", "-s", "--format=%P", ref]).split(" ").filter(Boolean),
|
|
117
|
+
message: this.git(id, ["show", "-s", "--format=%B", ref])
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
baseUrl: this.baseUrl,
|
|
121
|
+
getProject: async (id) => structuredClone(this.project(id)),
|
|
122
|
+
listProjects: async () => structuredClone(this.state.projects),
|
|
123
|
+
getGroup: async (id) => ({ id: 1, full_path: String(id) }),
|
|
124
|
+
listGroupProjects: async (group) => structuredClone(
|
|
125
|
+
this.state.projects.filter((p) => p.path_with_namespace.startsWith(`${group}/`))
|
|
126
|
+
),
|
|
127
|
+
getMergeRequest: async (id, iid) => ({
|
|
128
|
+
...structuredClone(mr(id, iid)),
|
|
129
|
+
sha: commit(mr(id, iid).source_project_id, mr(id, iid).source_branch).id
|
|
130
|
+
}),
|
|
131
|
+
listMergeRequests: async (id, label) => structuredClone(
|
|
132
|
+
this.state.mrs.filter(
|
|
133
|
+
(m) => m.project_id === id && m.state === "opened" && m.labels.includes(label)
|
|
134
|
+
)
|
|
135
|
+
),
|
|
136
|
+
getBranch: async (id, branch) => ({
|
|
137
|
+
name: branch,
|
|
138
|
+
can_push: true,
|
|
139
|
+
protected: false,
|
|
140
|
+
commit: commit(id, branch)
|
|
141
|
+
}),
|
|
142
|
+
getCommit: async (id, ref) => commit(id, ref),
|
|
143
|
+
getChanges: async (id, iid) => structuredClone(this.state.diffs[`${id}:${iid}`] ?? []),
|
|
144
|
+
listMergeRequestPipelines: async (id, iid) => structuredClone(
|
|
145
|
+
this.state.pipelines.filter(
|
|
146
|
+
(p) => p.project_id === mr(id, iid).source_project_id && p.ref === mr(id, iid).source_branch
|
|
147
|
+
)
|
|
148
|
+
),
|
|
149
|
+
listBranchPipelines: async (id, branch, sha) => structuredClone(
|
|
150
|
+
this.state.pipelines.filter(
|
|
151
|
+
(p) => p.project_id === id && p.ref === branch && p.sha === sha && p.source === "push"
|
|
152
|
+
)
|
|
153
|
+
),
|
|
154
|
+
getPipeline: async (id, pipeline) => {
|
|
155
|
+
const p = this.state.pipelines.find((p2) => p2.project_id === id && p2.id === pipeline);
|
|
156
|
+
if (!p) throw new Error("Unknown test pipeline");
|
|
157
|
+
return structuredClone(p);
|
|
158
|
+
},
|
|
159
|
+
listFailedJobs: async (id, pipeline) => [
|
|
160
|
+
{
|
|
161
|
+
id: pipeline * 100,
|
|
162
|
+
name: "test",
|
|
163
|
+
status: "failed",
|
|
164
|
+
web_url: `${this.project(id).web_url}/-/jobs/${pipeline * 100}`,
|
|
165
|
+
failure_reason: "script_failure"
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
getJobTrace: async () => ({
|
|
169
|
+
text: "Expected new dependency API; test failed",
|
|
170
|
+
truncated: false
|
|
171
|
+
}),
|
|
172
|
+
resolveGitIdentity: async () => ({
|
|
173
|
+
name: "Leitwerk Bot",
|
|
174
|
+
email: "bot@gitlab.test",
|
|
175
|
+
username: "bot"
|
|
176
|
+
}),
|
|
177
|
+
listNotes: async (id, iid) => structuredClone(this.state.notes[`${id}:${iid}`] ?? []),
|
|
178
|
+
listMergeRequestFeedback: async (id, iid) => structuredClone(this.state.feedback?.[`${id}:${iid}`] ?? []),
|
|
179
|
+
getDiscussion: async (id, iid, discussionId) => ({
|
|
180
|
+
id: discussionId,
|
|
181
|
+
notes: (this.state.discussionNotes?.[`${id}:${iid}:${discussionId}`] ?? []).map((note) => ({
|
|
182
|
+
...structuredClone(note),
|
|
183
|
+
system: false,
|
|
184
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
185
|
+
author: { username: "bot" }
|
|
186
|
+
}))
|
|
187
|
+
}),
|
|
188
|
+
replyToDiscussion: async (id, iid, discussionId, body) => {
|
|
189
|
+
const key = `${id}:${iid}:${discussionId}`;
|
|
190
|
+
this.state.discussionNotes ??= {};
|
|
191
|
+
this.state.discussionNotes[key] ??= [];
|
|
192
|
+
const notes = this.state.discussionNotes[key];
|
|
193
|
+
return this.append(notes, { id: notes.length + 1, body }, "Reply");
|
|
194
|
+
},
|
|
195
|
+
listNoteReactions: async (id, iid, noteId) => structuredClone(this.state.reactions?.[`${id}:${iid}:${noteId}`] ?? []),
|
|
196
|
+
addNoteReaction: async (id, iid, noteId, name) => {
|
|
197
|
+
const key = `${id}:${iid}:${noteId}`;
|
|
198
|
+
this.state.reactions ??= {};
|
|
199
|
+
this.state.reactions[key] ??= [];
|
|
200
|
+
const reactions = this.state.reactions[key];
|
|
201
|
+
if (reactions.some((reaction2) => reaction2.name === name && reaction2.user.username === "bot"))
|
|
202
|
+
throw new Error("Reaction already exists");
|
|
203
|
+
const reaction = { id: reactions.length + 1, name, user: { username: "bot" } };
|
|
204
|
+
return this.append(reactions, reaction, "Reaction");
|
|
205
|
+
},
|
|
206
|
+
addNote: async (id, iid, body) => {
|
|
207
|
+
const key = `${id}:${iid}`;
|
|
208
|
+
this.state.notes[key] ??= [];
|
|
209
|
+
const notes = this.state.notes[key];
|
|
210
|
+
return this.append(notes, { id: notes.length + 1, body }, "Comment");
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
export {
|
|
216
|
+
LocalGitLabAdapter,
|
|
217
|
+
setupGitLabIntegration
|
|
218
|
+
};
|
|
219
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/testing.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type {\n\tGitLabClientLike,\n\tGitLabDiff,\n\tGitLabFeedback,\n\tGitLabMergeRequest,\n\tGitLabNote,\n\tGitLabNoteReaction,\n\tGitLabPipeline,\n\tGitLabProject,\n} from \"./client.js\";\n\nexport { setupGitLabIntegration } from \"./setup.js\";\n\n/** @public */\ninterface LocalState {\n\t/** @internal */\n\tprojects: GitLabProject[];\n\t/** @internal */\n\tmrs: GitLabMergeRequest[];\n\t/** @internal */\n\tpipelines: GitLabPipeline[];\n\t/** @public */\n\tnotes: Record<string, GitLabNote[]>;\n\t/** @internal */\n\tdiffs: Record<string, GitLabDiff[]>;\n\t/** @public */\n\tfeedback?: Record<string, GitLabFeedback[]>;\n\t/** @public */\n\tdiscussionNotes?: Record<string, GitLabNote[]>;\n\t/** @public */\n\treactions?: Record<string, GitLabNoteReaction[]>;\n}\n/** Persistent GitLab test boundary. Repository URLs use local Git's file transport. @public */\nexport class LocalGitLabAdapter {\n\t/** @public */\n\tstate: LocalState;\n\t/** @public */\n\tloseNextCommentResponse = false;\n\t/** @public */\n\tloseNextReplyResponse = false;\n\t/** @public */\n\tloseNextReactionResponse = false;\n\t/** @public */\n\tconstructor(\n\t\t/** @internal */\n\t\treadonly root: string,\n\t\t/** @internal */\n\t\treadonly baseUrl = \"https://gitlab.test\",\n\t) {\n\t\tmkdirSync(root, { recursive: true });\n\t\tconst file = path.join(root, \"gitlab.json\");\n\t\tthis.state = existsSync(file)\n\t\t\t? JSON.parse(readFileSync(file, \"utf8\"))\n\t\t\t: { projects: [], mrs: [], pipelines: [], notes: {}, diffs: {} };\n\t}\n\t/** @public */\n\tsave() {\n\t\twriteFileSync(path.join(this.root, \"gitlab.json\"), JSON.stringify(this.state), { mode: 0o600 });\n\t}\n\tprivate append<T>(items: T[], item: T, kind: \"Comment\" | \"Reply\" | \"Reaction\"): T {\n\t\titems.push(item);\n\t\tthis.save();\n\t\tconst flag = `loseNext${kind}Response` as const;\n\t\tif (this[flag]) {\n\t\t\tthis[flag] = false;\n\t\t\tconst action = {\n\t\t\t\tComment: \"comment write\",\n\t\t\t\tReply: \"discussion reply\",\n\t\t\t\tReaction: \"reaction write\",\n\t\t\t};\n\t\t\tthrow new Error(`Response lost after ${action[kind]}`);\n\t\t}\n\t\treturn item;\n\t}\n\tprivate project(id: number | string) {\n\t\tconst p = this.state.projects.find((p) => p.id === id || p.path_with_namespace === id);\n\t\tif (!p) throw new Error(\"Unknown test project\");\n\t\treturn p;\n\t}\n\tprivate git(id: number, args: string[]) {\n\t\treturn execFileSync(\n\t\t\t\"git\",\n\t\t\t[\"-c\", \"core.hooksPath=/dev/null\", \"--git-dir\", this.project(id).http_url_to_repo, ...args],\n\t\t\t{ encoding: \"utf8\" },\n\t\t).trim();\n\t}\n\t/** @public */\n\taddProject(name: string, bare: string): GitLabProject {\n\t\tconst project: GitLabProject = {\n\t\t\tid: this.state.projects.length + 1,\n\t\t\tpath_with_namespace: name,\n\t\t\thttp_url_to_repo: bare,\n\t\t\tweb_url: `${this.baseUrl}/${name}`,\n\t\t\tdefault_branch: \"main\",\n\t\t};\n\t\tthis.state.projects.push(project);\n\t\tthis.save();\n\t\treturn project;\n\t}\n\t/** @public */\n\topenMr(project: GitLabProject, branch: string): GitLabMergeRequest {\n\t\tconst mr: GitLabMergeRequest = {\n\t\t\tiid: this.state.mrs.length + 1,\n\t\t\tproject_id: project.id,\n\t\t\ttarget_project_id: project.id,\n\t\t\tsource_project_id: project.id,\n\t\t\ttitle: \"Update dependency\",\n\t\t\tdescription: \"Renovate upgrade\",\n\t\t\tstate: \"opened\",\n\t\t\tlabels: [\"renovate\"],\n\t\t\tsha: this.git(project.id, [\"rev-parse\", branch]),\n\t\t\tsource_branch: branch,\n\t\t\ttarget_branch: \"main\",\n\t\t\tweb_url: `${project.web_url}/-/merge_requests/${this.state.mrs.length + 1}`,\n\t\t};\n\t\tthis.state.mrs.push(mr);\n\t\tthis.save();\n\t\treturn mr;\n\t}\n\t/** @public */\n\tpipeline(mr: GitLabMergeRequest, status: string): GitLabPipeline {\n\t\tconst value: GitLabPipeline = {\n\t\t\tid: this.state.pipelines.length + 1,\n\t\t\tproject_id: mr.source_project_id,\n\t\t\tsha: this.git(mr.source_project_id, [\"rev-parse\", mr.source_branch]),\n\t\t\tref: mr.source_branch,\n\t\t\tstatus,\n\t\t\tsource: \"merge_request_event\",\n\t\t\tweb_url: `${this.project(mr.source_project_id).web_url}/-/pipelines/${this.state.pipelines.length + 1}`,\n\t\t};\n\t\tthis.state.pipelines.push(value);\n\t\tthis.save();\n\t\treturn value;\n\t}\n\t/** @public */\n\tclient(): GitLabClientLike {\n\t\tconst mr = (id: number, iid: number) => {\n\t\t\tconst m = this.state.mrs.find((m) => m.project_id === id && m.iid === iid);\n\t\t\tif (!m) throw new Error(\"Unknown test MR\");\n\t\t\treturn m;\n\t\t};\n\t\tconst commit = (id: number, ref: string) => ({\n\t\t\tid: this.git(id, [\"rev-parse\", ref]),\n\t\t\tparent_ids: this.git(id, [\"show\", \"-s\", \"--format=%P\", ref]).split(\" \").filter(Boolean),\n\t\t\tmessage: this.git(id, [\"show\", \"-s\", \"--format=%B\", ref]),\n\t\t});\n\t\treturn {\n\t\t\tbaseUrl: this.baseUrl,\n\t\t\tgetProject: async (id) => structuredClone(this.project(id)),\n\t\t\tlistProjects: async () => structuredClone(this.state.projects),\n\t\t\tgetGroup: async (id) => ({ id: 1, full_path: String(id) }),\n\t\t\tlistGroupProjects: async (group) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.projects.filter((p) => p.path_with_namespace.startsWith(`${group}/`)),\n\t\t\t\t),\n\t\t\tgetMergeRequest: async (id, iid) => ({\n\t\t\t\t...structuredClone(mr(id, iid)),\n\t\t\t\tsha: commit(mr(id, iid).source_project_id, mr(id, iid).source_branch).id,\n\t\t\t}),\n\t\t\tlistMergeRequests: async (id, label) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.mrs.filter(\n\t\t\t\t\t\t(m) => m.project_id === id && m.state === \"opened\" && m.labels.includes(label),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tgetBranch: async (id, branch) => ({\n\t\t\t\tname: branch,\n\t\t\t\tcan_push: true,\n\t\t\t\tprotected: false,\n\t\t\t\tcommit: commit(id, branch),\n\t\t\t}),\n\t\t\tgetCommit: async (id, ref) => commit(id, ref),\n\t\t\tgetChanges: async (id, iid) => structuredClone(this.state.diffs[`${id}:${iid}`] ?? []),\n\t\t\tlistMergeRequestPipelines: async (id, iid) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.pipelines.filter(\n\t\t\t\t\t\t(p) =>\n\t\t\t\t\t\t\tp.project_id === mr(id, iid).source_project_id && p.ref === mr(id, iid).source_branch,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tlistBranchPipelines: async (id, branch, sha) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.pipelines.filter(\n\t\t\t\t\t\t(p) => p.project_id === id && p.ref === branch && p.sha === sha && p.source === \"push\",\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tgetPipeline: async (id, pipeline) => {\n\t\t\t\tconst p = this.state.pipelines.find((p) => p.project_id === id && p.id === pipeline);\n\t\t\t\tif (!p) throw new Error(\"Unknown test pipeline\");\n\t\t\t\treturn structuredClone(p);\n\t\t\t},\n\t\t\tlistFailedJobs: async (id, pipeline) => [\n\t\t\t\t{\n\t\t\t\t\tid: pipeline * 100,\n\t\t\t\t\tname: \"test\",\n\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\tweb_url: `${this.project(id).web_url}/-/jobs/${pipeline * 100}`,\n\t\t\t\t\tfailure_reason: \"script_failure\",\n\t\t\t\t},\n\t\t\t],\n\t\t\tgetJobTrace: async () => ({\n\t\t\t\ttext: \"Expected new dependency API; test failed\",\n\t\t\t\ttruncated: false,\n\t\t\t}),\n\t\t\tresolveGitIdentity: async () => ({\n\t\t\t\tname: \"Leitwerk Bot\",\n\t\t\t\temail: \"bot@gitlab.test\",\n\t\t\t\tusername: \"bot\",\n\t\t\t}),\n\t\t\tlistNotes: async (id, iid) => structuredClone(this.state.notes[`${id}:${iid}`] ?? []),\n\t\t\tlistMergeRequestFeedback: async (id, iid) =>\n\t\t\t\tstructuredClone(this.state.feedback?.[`${id}:${iid}`] ?? []),\n\t\t\tgetDiscussion: async (id, iid, discussionId) => ({\n\t\t\t\tid: discussionId,\n\t\t\t\tnotes: (this.state.discussionNotes?.[`${id}:${iid}:${discussionId}`] ?? []).map((note) => ({\n\t\t\t\t\t...structuredClone(note),\n\t\t\t\t\tsystem: false,\n\t\t\t\t\tcreated_at: new Date().toISOString(),\n\t\t\t\t\tauthor: { username: \"bot\" },\n\t\t\t\t})),\n\t\t\t}),\n\t\t\treplyToDiscussion: async (id, iid, discussionId, body) => {\n\t\t\t\tconst key = `${id}:${iid}:${discussionId}`;\n\t\t\t\tthis.state.discussionNotes ??= {};\n\t\t\t\tthis.state.discussionNotes[key] ??= [];\n\t\t\t\tconst notes = this.state.discussionNotes[key];\n\t\t\t\treturn this.append(notes, { id: notes.length + 1, body }, \"Reply\");\n\t\t\t},\n\t\t\tlistNoteReactions: async (id, iid, noteId) =>\n\t\t\t\tstructuredClone(this.state.reactions?.[`${id}:${iid}:${noteId}`] ?? []),\n\t\t\taddNoteReaction: async (id, iid, noteId, name) => {\n\t\t\t\tconst key = `${id}:${iid}:${noteId}`;\n\t\t\t\tthis.state.reactions ??= {};\n\t\t\t\tthis.state.reactions[key] ??= [];\n\t\t\t\tconst reactions = this.state.reactions[key];\n\t\t\t\tif (\n\t\t\t\t\treactions.some((reaction) => reaction.name === name && reaction.user.username === \"bot\")\n\t\t\t\t)\n\t\t\t\t\tthrow new Error(\"Reaction already exists\");\n\t\t\t\tconst reaction = { id: reactions.length + 1, name, user: { username: \"bot\" } };\n\t\t\t\treturn this.append(reactions, reaction, \"Reaction\");\n\t\t\t},\n\t\t\taddNote: async (id, iid, body) => {\n\t\t\t\tconst key = `${id}:${iid}`;\n\t\t\t\tthis.state.notes[key] ??= [];\n\t\t\t\tconst notes = this.state.notes[key];\n\t\t\t\treturn this.append(notes, { id: notes.length + 1, body }, \"Comment\");\n\t\t\t},\n\t\t};\n\t}\n}\n"],"mappings":";;;;;AAAA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,OAAO,UAAU;AAkCV,IAAM,qBAAN,MAAyB;AAAA;AAAA,EAU/B,YAEU,MAEA,UAAU,uBAClB;AAHQ;AAEA;AAET,cAAU,MAAM,EAAE,WAAW,KAAK,CAAC;AACnC,UAAM,OAAO,KAAK,KAAK,MAAM,aAAa;AAC1C,SAAK,QAAQ,WAAW,IAAI,IACzB,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC,IACrC,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,EAAE;AAAA,EACjE;AAAA,EATU;AAAA,EAEA;AAAA;AAAA,EAZV;AAAA;AAAA,EAEA,0BAA0B;AAAA;AAAA,EAE1B,wBAAwB;AAAA;AAAA,EAExB,2BAA2B;AAAA;AAAA,EAe3B,OAAO;AACN,kBAAc,KAAK,KAAK,KAAK,MAAM,aAAa,GAAG,KAAK,UAAU,KAAK,KAAK,GAAG,EAAE,MAAM,IAAM,CAAC;AAAA,EAC/F;AAAA,EACQ,OAAU,OAAY,MAAS,MAA2C;AACjF,UAAM,KAAK,IAAI;AACf,SAAK,KAAK;AACV,UAAM,OAAO,WAAW,IAAI;AAC5B,QAAI,KAAK,IAAI,GAAG;AACf,WAAK,IAAI,IAAI;AACb,YAAM,SAAS;AAAA,QACd,SAAS;AAAA,QACT,OAAO;AAAA,QACP,UAAU;AAAA,MACX;AACA,YAAM,IAAI,MAAM,uBAAuB,OAAO,IAAI,CAAC,EAAE;AAAA,IACtD;AACA,WAAO;AAAA,EACR;AAAA,EACQ,Q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AG,MAAM,CAAC;AACrC,cAAM,QAAQ,KAAK,MAAM,gBAAgB,GAAG;AAC5C,eAAO,KAAK,OAAO,OAAO,EAAE,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO;AAAA,MAClE;AAAA,MACA,mBAAmB,OAAO,IAAI,KAAK,WAClC,gBAAgB,KAAK,MAAM,YAAY,GAAG,EAAE,IAAI,GAAG,IAAI,MAAM,EAAE,KAAK,CAAC,CAAC;AAAA,MACvE,iBAAiB,OAAO,IAAI,KAAK,QAAQ,SAAS;AACjD,cAAM,MAAM,GAAG,EAAE,IAAI,GAAG,IAAI,MAAM;AAClC,aAAK,MAAM,cAAc,CAAC;AAC1B,aAAK,MAAM,UAAU,GAAG,MAAM,CAAC;AAC/B,cAAM,YAAY,KAAK,MAAM,UAAU,GAAG;AAC1C,YACC,UAAU,KAAK,CAACE,cAAaA,UAAS,SAAS,QAAQA,UAAS,KAAK,aAAa,KAAK;AAEvF,gBAAM,IAAI,MAAM,yBAAyB;AAC1C,cAAM,WAAW,EAAE,IAAI,UAAU,SAAS,GAAG,MAAM,MAAM,EAAE,UAAU,MAAM,EAAE;AAC7E,eAAO,KAAK,OAAO,WAAW,UAAU,UAAU;AAAA,MACnD;AAAA,MACA,SAAS,OAAO,IAAI,KAAK,SAAS;AACjC,cAAM,MAAM,GAAG,EAAE,IAAI,GAAG;AACxB,aAAK,MAAM,MAAM,GAAG,MAAM,CAAC;AAC3B,cAAM,QAAQ,KAAK,MAAM,MAAM,GAAG;AAClC,eAAO,KAAK,OAAO,OAAO,EAAE,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,SAAS;AAAA,MACpE;AAAA,IACD;AAAA,EACD;AACD;","names":["p","m","reaction"]}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ExternalWrites } from "@leitwerk-dev/external-writes";
|
|
2
|
+
import { type IntegrationToolExecutionContext, type ServerExtensionAPI } from "@leitwerk-dev/process-sdk";
|
|
3
|
+
import type { GitLabIntegration } from "./capability.js";
|
|
4
|
+
import { type GitLabClientLike } from "./client.js";
|
|
5
|
+
/** @public */
|
|
6
|
+
export declare function resolveGitLabBinding(ctx: Pick<IntegrationToolExecutionContext, "project" | "process">): {
|
|
7
|
+
/** @public */
|
|
8
|
+
profile: string;
|
|
9
|
+
/** @public */
|
|
10
|
+
projectId: number;
|
|
11
|
+
/** @public */
|
|
12
|
+
iid: number;
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare function ensureGitLabComment(input: {
|
|
16
|
+
/** @internal */
|
|
17
|
+
client: GitLabClientLike;
|
|
18
|
+
/** @internal */
|
|
19
|
+
writes: ExternalWrites;
|
|
20
|
+
/** @internal */
|
|
21
|
+
instanceId: string;
|
|
22
|
+
/** @internal */
|
|
23
|
+
projectId: number;
|
|
24
|
+
/** @internal */
|
|
25
|
+
iid: number;
|
|
26
|
+
/** @internal */
|
|
27
|
+
writeKey: string;
|
|
28
|
+
/** @internal */
|
|
29
|
+
body: string;
|
|
30
|
+
/** @internal */
|
|
31
|
+
discussionId?: string;
|
|
32
|
+
/** @internal */
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
/** @internal */
|
|
36
|
+
marker: string;
|
|
37
|
+
}>;
|
|
38
|
+
/** @public */
|
|
39
|
+
export declare function ensureGitLabSeenReaction(input: {
|
|
40
|
+
/** @public */
|
|
41
|
+
client: GitLabClientLike;
|
|
42
|
+
/** @public */
|
|
43
|
+
writes: ExternalWrites;
|
|
44
|
+
/** @public */
|
|
45
|
+
instanceId: string;
|
|
46
|
+
/** @public */
|
|
47
|
+
projectId: number;
|
|
48
|
+
/** @public */
|
|
49
|
+
iid: number;
|
|
50
|
+
/** @public */
|
|
51
|
+
noteId: number;
|
|
52
|
+
/** @public */
|
|
53
|
+
signal?: AbortSignal;
|
|
54
|
+
}): Promise<void>;
|
|
55
|
+
/** @internal */
|
|
56
|
+
export declare function registerGitLabTools(api: ServerExtensionAPI, integration: GitLabIntegration): void;
|
|
57
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EACN,KAAK,+BAA+B,EAGpC,KAAK,kBAAkB,EAEvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,KAAK,gBAAgB,EAAoC,MAAM,aAAa,CAAC;AAUtF,cAAc;AACd,wBAAgB,oBAAoB,CACnC,GAAG,EAAE,IAAI,CAAC,+BAA+B,EAAE,SAAS,GAAG,SAAS,CAAC,GAC/D;IACF,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc;IACd,GAAG,EAAE,MAAM,CAAC;CACZ,CAcA;AACD,gBAAgB;AAChB,wBAAsB,mBAAmB,CAAC,KAAK,EAAE;IAChD,gBAAgB;IAChB,MAAM,EAAE,gBAAgB,CAAC;IACzB,gBAAgB;IAChB,MAAM,EAAE,cAAc,CAAC;IACvB,gBAAgB;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB;IAChB,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC;IACX,gBAAgB;IAChB,MAAM,EAAE,MAAM,CAAC;CACf,CAAC,CA0BD;AACD,cAAc;AACd,wBAAsB,wBAAwB,CAAC,KAAK,EAAE;IACrD,cAAc;IACd,MAAM,EAAE,gBAAgB,CAAC;IACzB,cAAc;IACd,MAAM,EAAE,cAAc,CAAC;IACvB,cAAc;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc;IACd,MAAM,EAAE,MAAM,CAAC;IACf,cAAc;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBhB;AACD,gBAAgB;AAChB,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,kBAAkB,EAAE,WAAW,EAAE,iBAAiB,QAuE1F"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
"name": "@leitwerk-dev/gitlab",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"leitwerk": {
|
|
6
|
+
"extension": {
|
|
7
|
+
"source": "./src/index.ts",
|
|
8
|
+
"import": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"discover": false
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"source": "./src/index.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./testing": {
|
|
19
|
+
"source": "./src/testing.ts",
|
|
20
|
+
"import": "./dist/testing.js",
|
|
21
|
+
"types": "./dist/testing.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup && tsc -p tsconfig.tsup.json --emitDeclarationOnly"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@leitwerk-dev/domain": "0.2.1",
|
|
29
|
+
"@leitwerk-dev/external-writes": "0.2.1",
|
|
30
|
+
"@leitwerk-dev/process-sdk": "0.2.1",
|
|
31
|
+
"@leitwerk-dev/watcher-utils": "0.2.1",
|
|
32
|
+
"@leitwerk-dev/test-support": "0.2.1"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"tsup": "^8.5.1",
|
|
36
|
+
"@types/node": "^26.2.0"
|
|
37
|
+
},
|
|
38
|
+
"license": "Apache-2.0",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=26 <27"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"dist/**",
|
|
47
|
+
"src/**",
|
|
48
|
+
"!dist/**/*.test.*",
|
|
49
|
+
"!src/**/*.test.ts"
|
|
50
|
+
],
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://github.com/leitwerk-dev/leitwerk.git",
|
|
54
|
+
"directory": "extensions/gitlab"
|
|
55
|
+
}
|
|
16
56
|
}
|