@alpacakit/integrations 0.1.0-beta.31 → 0.1.0-beta.36
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 +6 -2
- package/dist/auth.d.ts +2 -2
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +9 -1
- package/dist/catalog.d.ts +3 -3
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +10 -3
- package/dist/code-hosts/facets.d.ts +2 -2
- package/dist/code-hosts/facets.d.ts.map +1 -1
- package/dist/code-hosts/facets.js +4 -48
- package/dist/code-hosts/gitea-pull-request-snapshot.js +0 -1
- package/dist/code-hosts/gitea.d.ts.map +1 -1
- package/dist/code-hosts/gitea.js +100 -12
- package/dist/code-hosts/github.d.ts.map +1 -1
- package/dist/code-hosts/github.js +71 -21
- package/dist/code-hosts/gitlab.d.ts.map +1 -1
- package/dist/code-hosts/gitlab.js +70 -18
- package/dist/code-hosts/helpers.d.ts +12 -3
- package/dist/code-hosts/helpers.d.ts.map +1 -1
- package/dist/code-hosts/helpers.js +67 -7
- package/dist/code-hosts/repository-host.d.ts +4 -0
- package/dist/code-hosts/repository-host.d.ts.map +1 -0
- package/dist/code-hosts/repository-host.js +61 -0
- package/dist/code-hosts/repository-info.d.ts +4 -0
- package/dist/code-hosts/repository-info.d.ts.map +1 -0
- package/dist/code-hosts/repository-info.js +11 -0
- package/dist/code-hosts/strategy.d.ts +3 -2
- package/dist/code-hosts/strategy.d.ts.map +1 -1
- package/dist/definition.d.ts +18 -3
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +5 -0
- package/dist/error.d.ts +1 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/model.d.ts +10 -8
- package/dist/model.d.ts.map +1 -1
- package/dist/runtime.d.ts +12 -3
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +25 -4
- package/dist/testing/contracts.d.ts +13 -2
- package/dist/testing/contracts.d.ts.map +1 -1
- package/dist/testing/contracts.js +108 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/transport/http-transport.js +1 -1
- package/dist/values.d.ts +13 -2
- package/dist/values.d.ts.map +1 -1
- package/dist/values.js +13 -2
- package/package.json +2 -2
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import { createSchemaRuntimeCodec } from "@alpacakit/core";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { bearerMaterialHandlers } from "../auth.js";
|
|
5
|
-
import { defineIntegration } from "../definition.js";
|
|
5
|
+
import { defineIntegration, } from "../definition.js";
|
|
6
6
|
import { INTEGRATION_ERROR_CODE, IntegrationError, isIntegrationError, withIntegrationIdentity, } from "../error.js";
|
|
7
7
|
import { integrationId, workItemRef, } from "../ids.js";
|
|
8
8
|
import { collectPaginated } from "../transport/collect.js";
|
|
9
9
|
import { createOpaqueCursorCodec } from "../transport/cursor.js";
|
|
10
10
|
import { HttpTransport } from "../transport/http-transport.js";
|
|
11
11
|
import { PageParamPager } from "../transport/pager.js";
|
|
12
|
-
import { AUTHORIZATION_SCHEME, GIT_PROTOCOL, HTTP_METHOD, MERGE_METHOD, MERGE_STATE_STATUS, MERGEABILITY, OWNER_KIND, PULL_REQUEST_STATE, REPOSITORY_SETTINGS_UPDATE_KIND, REVIEW_DECISION, WORK_ITEM_KIND, WORK_ITEM_QUERY_STATE, WORK_ITEM_STATE, } from "../values.js";
|
|
12
|
+
import { AUTHORIZATION_SCHEME, GIT_PROTOCOL, HTTP_METHOD, MERGE_METHOD, MERGE_STATE_STATUS, MERGEABILITY, OWNER_KIND, PULL_REQUEST_STATE, REPOSITORY_REMOTE_RESOLUTION_KIND, REPOSITORY_SETTINGS_UPDATE_KIND, REVIEW_DECISION, WORK_ITEM_KIND, WORK_ITEM_QUERY_STATE, WORK_ITEM_STATE, } from "../values.js";
|
|
13
13
|
import { createCodeHostAccount, createCodeHostRepository, createCodeHostRepositoryHost, createCodeHostWorkItems, probeCodeHostDoctor, } from "./facets.js";
|
|
14
14
|
import { createGitLabIssueLabelChangeRequests, createGitLabLabelCreateRequest, } from "./gitlab-label-requests.js";
|
|
15
15
|
import { gitLabDeviceLogin } from "./gitlab-login.js";
|
|
16
|
-
import { ambientToken,
|
|
16
|
+
import { ambientToken, hasRepositoryNameConflictDetail, parseGitRemote, } from "./helpers.js";
|
|
17
17
|
import { rawGitLabApprovalsCodec, rawGitLabEventListCodec, rawGitLabIssueLinkListCodec, rawGitLabNamespaceCodec, rawGitLabUserListCodec, rawPullRequestCodec, rawReactionListCodec, rawRepositoryCodec, } from "./schemas.js";
|
|
18
18
|
import { CODE_HOST_CHANGE_FEED_KIND, refNumber, } from "./strategy.js";
|
|
19
19
|
import { CODE_HOST_LABEL_KIND, CODE_HOST_RESOURCE, GITLAB_REACTIONS, } from "./values.js";
|
|
@@ -62,7 +62,9 @@ const settingsSchema = z
|
|
|
62
62
|
.strict()
|
|
63
63
|
.transform((settings) => ({
|
|
64
64
|
project: settings.project,
|
|
65
|
-
baseUrl: (settings.baseUrl ?? GITLAB_DEFAULT_BASE_URL)
|
|
65
|
+
baseUrl: new URL(settings.baseUrl ?? GITLAB_DEFAULT_BASE_URL)
|
|
66
|
+
.toString()
|
|
67
|
+
.replace(/\/$/u, ""),
|
|
66
68
|
}));
|
|
67
69
|
const gitLabCursorCodec = createOpaqueCursorCodec({
|
|
68
70
|
integration: GITLAB_INTEGRATION_ID,
|
|
@@ -71,12 +73,51 @@ const gitLabCursorCodec = createOpaqueCursorCodec({
|
|
|
71
73
|
.object({ lastEventId: z.string(), observedAtMs: z.number().int() })
|
|
72
74
|
.strict(),
|
|
73
75
|
});
|
|
76
|
+
function splitGitLabProject(project) {
|
|
77
|
+
const parts = project.split("/");
|
|
78
|
+
return {
|
|
79
|
+
owner: parts.slice(0, -1).join("/"),
|
|
80
|
+
repository: parts.at(-1) ?? project,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function resolveGitLabRemote(remoteUrl) {
|
|
84
|
+
const parsed = parseGitRemote(remoteUrl);
|
|
85
|
+
if (parsed.kind === "rejected") {
|
|
86
|
+
return {
|
|
87
|
+
kind: REPOSITORY_REMOTE_RESOLUTION_KIND.rejected,
|
|
88
|
+
detail: `GitLab remote ${parsed.detail}.`,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (parsed.pathSegments.length < 2) {
|
|
92
|
+
return {
|
|
93
|
+
kind: REPOSITORY_REMOTE_RESOLUTION_KIND.rejected,
|
|
94
|
+
detail: "GitLab remote path must contain a namespace and project.",
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const projectSegment = parsed.pathSegments.at(-1);
|
|
98
|
+
const projectName = projectSegment.endsWith(".git")
|
|
99
|
+
? projectSegment.slice(0, -4)
|
|
100
|
+
: projectSegment;
|
|
101
|
+
if (projectName === "") {
|
|
102
|
+
return {
|
|
103
|
+
kind: REPOSITORY_REMOTE_RESOLUTION_KIND.rejected,
|
|
104
|
+
detail: "GitLab remote project must not be empty.",
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const project = [...parsed.pathSegments.slice(0, -1), projectName].join("/");
|
|
108
|
+
const repository = splitGitLabProject(project);
|
|
109
|
+
return {
|
|
110
|
+
kind: REPOSITORY_REMOTE_RESOLUTION_KIND.matched,
|
|
111
|
+
repository: { owner: repository.owner, name: repository.repository },
|
|
112
|
+
baseUrl: parsed.webOrigin,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
74
115
|
export function gitlab() {
|
|
75
116
|
return defineIntegration({
|
|
76
117
|
id: GITLAB_INTEGRATION_ID,
|
|
77
118
|
settingsCodec: createSchemaRuntimeCodec(settingsSchema),
|
|
78
|
-
remoteMatch: (remoteUrl, settings) => matchesRemote(remoteUrl, new URL(settings.baseUrl).hostname, settings.project),
|
|
79
119
|
repositoryScope: {
|
|
120
|
+
resolveRemote: resolveGitLabRemote,
|
|
80
121
|
applySettings: (input) => {
|
|
81
122
|
if (input.kind === REPOSITORY_SETTINGS_UPDATE_KIND.baseUrl) {
|
|
82
123
|
return {
|
|
@@ -85,17 +126,20 @@ export function gitlab() {
|
|
|
85
126
|
};
|
|
86
127
|
}
|
|
87
128
|
const project = `${input.repository.owner}/${input.repository.name}`;
|
|
88
|
-
const baseUrl = input.baseUrl ?? input.current?.baseUrl;
|
|
129
|
+
const baseUrl = input.baseUrl ?? input.current?.baseUrl ?? GITLAB_DEFAULT_BASE_URL;
|
|
89
130
|
return {
|
|
90
131
|
project,
|
|
91
|
-
|
|
132
|
+
baseUrl,
|
|
92
133
|
};
|
|
93
134
|
},
|
|
94
|
-
|
|
95
|
-
const
|
|
135
|
+
project: (settings) => {
|
|
136
|
+
const project = splitGitLabProject(settings.project);
|
|
96
137
|
return {
|
|
97
|
-
|
|
98
|
-
|
|
138
|
+
repository: {
|
|
139
|
+
owner: project.owner,
|
|
140
|
+
name: project.repository,
|
|
141
|
+
},
|
|
142
|
+
baseUrl: settings.baseUrl,
|
|
99
143
|
};
|
|
100
144
|
},
|
|
101
145
|
},
|
|
@@ -142,9 +186,7 @@ function createGitLabSession(settings, authorization, ports, connectionId) {
|
|
|
142
186
|
function gitLabStrategy(settings) {
|
|
143
187
|
const project = encodeURIComponent(settings.project);
|
|
144
188
|
const projectPath = `/projects/${project}`;
|
|
145
|
-
const
|
|
146
|
-
const repository = parts.at(-1) ?? settings.project;
|
|
147
|
-
const owner = parts.slice(0, -1).join("/") || settings.project;
|
|
189
|
+
const { owner, repository } = splitGitLabProject(settings.project);
|
|
148
190
|
const webBaseUrl = `${settings.baseUrl}/${settings.project}`;
|
|
149
191
|
const issueBody = (input, assigneeIds) => ({
|
|
150
192
|
...(input.title === undefined ? {} : { title: input.title }),
|
|
@@ -306,7 +348,7 @@ function gitLabStrategy(settings) {
|
|
|
306
348
|
resource: CODE_HOST_RESOURCE.reaction,
|
|
307
349
|
});
|
|
308
350
|
},
|
|
309
|
-
|
|
351
|
+
createNewRequest: async (transport, input) => {
|
|
310
352
|
const namespace = await transport.request({
|
|
311
353
|
method: HTTP_METHOD.get,
|
|
312
354
|
path: `/namespaces/${encodeURIComponent(input.ref.owner)}`,
|
|
@@ -318,14 +360,13 @@ function gitLabStrategy(settings) {
|
|
|
318
360
|
body: {
|
|
319
361
|
name: input.ref.name,
|
|
320
362
|
namespace_id: namespace.id,
|
|
321
|
-
visibility:
|
|
322
|
-
? GITLAB_VISIBILITY.public
|
|
323
|
-
: GITLAB_VISIBILITY.private,
|
|
363
|
+
visibility: GITLAB_VISIBILITY.private,
|
|
324
364
|
description: input.description ?? "",
|
|
325
365
|
},
|
|
326
366
|
resource: CODE_HOST_RESOURCE.repository,
|
|
327
367
|
};
|
|
328
368
|
},
|
|
369
|
+
isCreateNewConflict: isGitLabRepositoryCreateConflict,
|
|
329
370
|
workItemCreateRequest: async (transport, input) => ({
|
|
330
371
|
method: HTTP_METHOD.post,
|
|
331
372
|
path: `${projectPath}/issues`,
|
|
@@ -598,6 +639,17 @@ function normalizeGitLabMergeState(status) {
|
|
|
598
639
|
function includesGitLabStatus(statuses, status) {
|
|
599
640
|
return statuses.includes(status);
|
|
600
641
|
}
|
|
642
|
+
function isGitLabRepositoryCreateConflict(error) {
|
|
643
|
+
if (isIntegrationError(error, INTEGRATION_ERROR_CODE.conflict) &&
|
|
644
|
+
(error.data.status === 409 ||
|
|
645
|
+
(error.data.status === 422 &&
|
|
646
|
+
hasRepositoryNameConflictDetail(error.data.detail)))) {
|
|
647
|
+
return true;
|
|
648
|
+
}
|
|
649
|
+
return (isIntegrationError(error, INTEGRATION_ERROR_CODE.failed) &&
|
|
650
|
+
error.data.status === 400 &&
|
|
651
|
+
hasRepositoryNameConflictDetail(error.data.bodyTail));
|
|
652
|
+
}
|
|
601
653
|
function createGitLabRelations(transport, projectPath, project) {
|
|
602
654
|
const list = (ref) => collectPaginated(transport, {
|
|
603
655
|
method: HTTP_METHOD.get,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Authorization } from "../auth.js";
|
|
2
2
|
import type { CommentRef, WorkItemRef } from "../ids.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { CreateNewRepositoryInput } from "../model.js";
|
|
4
4
|
import type { Exec, SessionPorts } from "../ports.js";
|
|
5
5
|
import type { HttpTransport } from "../transport/http-transport.js";
|
|
6
6
|
import type { RequestSpec } from "../transport/types.js";
|
|
@@ -9,7 +9,15 @@ export declare function commentIdentity(ref: CommentRef): {
|
|
|
9
9
|
readonly targetNumber: string;
|
|
10
10
|
readonly comment: string;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type ParsedGitRemote = {
|
|
13
|
+
readonly kind: "parsed";
|
|
14
|
+
readonly webOrigin: string;
|
|
15
|
+
readonly pathSegments: readonly string[];
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: "rejected";
|
|
18
|
+
readonly detail: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function parseGitRemote(remoteUrl: string): ParsedGitRemote;
|
|
13
21
|
export declare function ambientToken(options: {
|
|
14
22
|
readonly env: Record<string, string>;
|
|
15
23
|
readonly envNames: readonly string[];
|
|
@@ -17,6 +25,7 @@ export declare function ambientToken(options: {
|
|
|
17
25
|
readonly args: string[];
|
|
18
26
|
readonly exec: Exec;
|
|
19
27
|
}): Promise<Authorization | null>;
|
|
20
|
-
export declare function orgOrUserRepositoryRequest(transport: HttpTransport, input:
|
|
28
|
+
export declare function orgOrUserRepositoryRequest(transport: HttpTransport, input: CreateNewRepositoryInput): Promise<RequestSpec>;
|
|
29
|
+
export declare function hasRepositoryNameConflictDetail(detail: string | null): boolean;
|
|
21
30
|
export declare function waitFor(ports: SessionPorts, seconds: number, signal: AbortSignal): Promise<void>;
|
|
22
31
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources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GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA4BhC;AAED,wBAAsB,0BAA0B,CAC9C,SAAS,EAAE,aAAa,EACxB,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,WAAW,CAAC,CAsBtB;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,OAAO,CAOT;AAED,wBAAsB,OAAO,CAC3B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CAef"}
|
|
@@ -11,18 +11,74 @@ export function commentIdentity(ref) {
|
|
|
11
11
|
comment: separator === -1 ? ref : ref.slice(separator + 2),
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
export function
|
|
15
|
-
|
|
14
|
+
export function parseGitRemote(remoteUrl) {
|
|
15
|
+
if (remoteUrl.trim() !== remoteUrl || /[\s?#]/u.test(remoteUrl)) {
|
|
16
|
+
return rejectedGitRemote("contains whitespace, a query, or a fragment");
|
|
17
|
+
}
|
|
16
18
|
try {
|
|
17
19
|
const url = new URL(remoteUrl);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
if (!["http:", "https:", "ssh:"].includes(url.protocol)) {
|
|
21
|
+
return rejectedGitRemote("must use HTTP(S) or SSH");
|
|
22
|
+
}
|
|
23
|
+
if (url.password !== "" ||
|
|
24
|
+
((url.protocol === "http:" || url.protocol === "https:") &&
|
|
25
|
+
url.username !== "")) {
|
|
26
|
+
return rejectedGitRemote("must not contain credentials");
|
|
27
|
+
}
|
|
28
|
+
const path = parseRemotePath(url.pathname.replace(/^\//u, ""));
|
|
29
|
+
return path.kind === "rejected"
|
|
30
|
+
? path
|
|
31
|
+
: {
|
|
32
|
+
kind: "parsed",
|
|
33
|
+
webOrigin: url.protocol === "ssh:" ? `https://${url.hostname}` : url.origin,
|
|
34
|
+
pathSegments: path.pathSegments,
|
|
35
|
+
};
|
|
20
36
|
}
|
|
21
37
|
catch {
|
|
22
|
-
const match = remoteUrl.match(/^(?:[
|
|
23
|
-
|
|
24
|
-
|
|
38
|
+
const match = remoteUrl.match(/^(?:[^@/:]+@)?([^@/:]+):(.+)$/u);
|
|
39
|
+
if (match?.[1] === undefined || match[2] === undefined) {
|
|
40
|
+
return rejectedGitRemote("is not a supported Git remote");
|
|
41
|
+
}
|
|
42
|
+
const path = parseRemotePath(match[2]);
|
|
43
|
+
if (path.kind === "rejected")
|
|
44
|
+
return path;
|
|
45
|
+
let webOrigin;
|
|
46
|
+
try {
|
|
47
|
+
webOrigin = new URL(`https://${match[1]}`).origin;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return rejectedGitRemote("contains an invalid host");
|
|
51
|
+
}
|
|
52
|
+
return { kind: "parsed", webOrigin, pathSegments: path.pathSegments };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function parseRemotePath(path) {
|
|
56
|
+
const encodedSegments = path.split("/");
|
|
57
|
+
if (encodedSegments.length === 0 ||
|
|
58
|
+
encodedSegments.some((segment) => segment.length === 0)) {
|
|
59
|
+
return rejectedGitRemote("contains an empty path segment");
|
|
25
60
|
}
|
|
61
|
+
const pathSegments = [];
|
|
62
|
+
for (const encoded of encodedSegments) {
|
|
63
|
+
let segment;
|
|
64
|
+
try {
|
|
65
|
+
segment = decodeURIComponent(encoded);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return rejectedGitRemote("contains invalid path encoding");
|
|
69
|
+
}
|
|
70
|
+
if (segment === "." ||
|
|
71
|
+
segment === ".." ||
|
|
72
|
+
segment.includes("/") ||
|
|
73
|
+
segment.includes("\\")) {
|
|
74
|
+
return rejectedGitRemote("contains an unsafe path segment");
|
|
75
|
+
}
|
|
76
|
+
pathSegments.push(segment);
|
|
77
|
+
}
|
|
78
|
+
return { kind: "parsed", pathSegments };
|
|
79
|
+
}
|
|
80
|
+
function rejectedGitRemote(detail) {
|
|
81
|
+
return { kind: "rejected", detail };
|
|
26
82
|
}
|
|
27
83
|
export async function ambientToken(options) {
|
|
28
84
|
for (const name of options.envNames) {
|
|
@@ -72,6 +128,10 @@ export async function orgOrUserRepositoryRequest(transport, input) {
|
|
|
72
128
|
resource: CODE_HOST_RESOURCE.repository,
|
|
73
129
|
};
|
|
74
130
|
}
|
|
131
|
+
export function hasRepositoryNameConflictDetail(detail) {
|
|
132
|
+
return (detail !== null &&
|
|
133
|
+
/(?:repository|name|path)[\s\S]*(?:already exists|already (?:been )?taken)|(?:already exists|already (?:been )?taken)[\s\S]*(?:repository|name|path)/iu.test(detail));
|
|
134
|
+
}
|
|
75
135
|
export async function waitFor(ports, seconds, signal) {
|
|
76
136
|
if (signal.aborted) {
|
|
77
137
|
throw signal.reason;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-host.d.ts","sourceRoot":"","sources":["../../src/code-hosts/repository-host.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,eAAe,GACvB,cAAc,CAoChB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { INTEGRATION_ERROR_CODE, IntegrationError, isIntegrationError, } from "../error.js";
|
|
2
|
+
import { CREATE_NEW_REPOSITORY_RESULT_KIND } from "../values.js";
|
|
3
|
+
import { normalizeRepositoryInfo } from "./repository-info.js";
|
|
4
|
+
import { rawRepositoryCodec } from "./schemas.js";
|
|
5
|
+
export function createCodeHostRepositoryHost(session) {
|
|
6
|
+
const { transport, strategy } = session;
|
|
7
|
+
const find = async (ref) => {
|
|
8
|
+
const raw = await transport.requestOptional(strategy.paths.repository(ref), rawRepositoryCodec);
|
|
9
|
+
return raw === null
|
|
10
|
+
? null
|
|
11
|
+
: normalizeRepositoryInfo(raw, ref, strategy.ownerKind);
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
find,
|
|
15
|
+
createNew: async (input) => {
|
|
16
|
+
const { ref } = input;
|
|
17
|
+
const request = await strategy.createNewRequest(transport, input);
|
|
18
|
+
try {
|
|
19
|
+
const raw = await transport.request(request, rawRepositoryCodec);
|
|
20
|
+
return {
|
|
21
|
+
kind: CREATE_NEW_REPOSITORY_RESULT_KIND.created,
|
|
22
|
+
repository: normalizeRepositoryInfo(raw, ref, strategy.ownerKind),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (strategy.isCreateNewConflict(error)) {
|
|
27
|
+
return { kind: CREATE_NEW_REPOSITORY_RESULT_KIND.conflict };
|
|
28
|
+
}
|
|
29
|
+
if (isIntegrationError(error, INTEGRATION_ERROR_CODE.conflict)) {
|
|
30
|
+
throw repositoryCreateInvalidInput(error);
|
|
31
|
+
}
|
|
32
|
+
if (isRepositoryCreateOutcomeUnknown(error)) {
|
|
33
|
+
return { kind: CREATE_NEW_REPOSITORY_RESULT_KIND.outcomeUnknown };
|
|
34
|
+
}
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function repositoryCreateInvalidInput(error) {
|
|
41
|
+
return new IntegrationError({
|
|
42
|
+
code: INTEGRATION_ERROR_CODE.invalidInput,
|
|
43
|
+
message: "Repository creation input was rejected by the provider",
|
|
44
|
+
data: {
|
|
45
|
+
reason: error.data.detail ?? `provider returned HTTP ${error.data.status}`,
|
|
46
|
+
},
|
|
47
|
+
integrationId: error.integrationId,
|
|
48
|
+
connectionId: error.connectionId,
|
|
49
|
+
cause: error,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function isRepositoryCreateOutcomeUnknown(error) {
|
|
53
|
+
if (isIntegrationError(error, INTEGRATION_ERROR_CODE.notAvailable)) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
if (!isIntegrationError(error, INTEGRATION_ERROR_CODE.failed)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const { status } = error.data;
|
|
60
|
+
return status === null || status >= 500 || (status >= 200 && status < 300);
|
|
61
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RepositoryInfo, RepositoryRef } from "../model.js";
|
|
2
|
+
import type { RawRepository } from "./schemas.js";
|
|
3
|
+
export declare function normalizeRepositoryInfo(raw: RawRepository, ref: RepositoryRef, fallbackOwnerKind: RepositoryInfo["ownerKind"]): RepositoryInfo;
|
|
4
|
+
//# sourceMappingURL=repository-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-info.d.ts","sourceRoot":"","sources":["../../src/code-hosts/repository-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,aAAa,EAClB,iBAAiB,EAAE,cAAc,CAAC,WAAW,CAAC,GAC7C,cAAc,CAShB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ownerKindOf } from "./account.js";
|
|
2
|
+
export function normalizeRepositoryInfo(raw, ref, fallbackOwnerKind) {
|
|
3
|
+
return {
|
|
4
|
+
repositoryId: String(raw.id),
|
|
5
|
+
ref,
|
|
6
|
+
defaultBranch: raw.defaultBranch,
|
|
7
|
+
url: raw.url,
|
|
8
|
+
isPrivate: raw.isPrivate,
|
|
9
|
+
ownerKind: ownerKindOf(raw, fallbackOwnerKind),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChangeFeedCursor, CommentReaction } from "../ids.js";
|
|
2
|
-
import type { ChangeFeedPage, CommentKind, CreateLabelInput, CreatePullRequestInput, CreateWorkItemInput,
|
|
2
|
+
import type { ChangeFeedPage, CommentKind, CreateLabelInput, CreateNewRepositoryInput, CreatePullRequestInput, CreateWorkItemInput, MergeMethod, OwnerKind, PatchWorkItemInput, PullRequestIdentity, PullRequestReviewContext, PullRequestStatus, RepositoryRef, WorkItemLabels, WorkItemListQuery, WorkItemRelations, WorkItemSearchQuery } from "../model.js";
|
|
3
3
|
import type { HttpTransport } from "../transport/http-transport.js";
|
|
4
4
|
import type { CursorCodec, Pager, RequestSpec } from "../transport/types.js";
|
|
5
5
|
import type { NormalizationVocabulary } from "./normalize.js";
|
|
@@ -100,7 +100,8 @@ export type CodeHostStrategy = {
|
|
|
100
100
|
readonly workItemRelations: (transport: HttpTransport) => WorkItemRelations;
|
|
101
101
|
readonly markReadyForReview?: (transport: HttpTransport, number: string) => Promise<void>;
|
|
102
102
|
readonly ensureLinkedBranch?: (transport: HttpTransport, workItem: string, branch: string) => Promise<void>;
|
|
103
|
-
readonly
|
|
103
|
+
readonly createNewRequest: (transport: HttpTransport, input: CreateNewRepositoryInput) => Promise<RequestSpec>;
|
|
104
|
+
readonly isCreateNewConflict: (error: unknown) => boolean;
|
|
104
105
|
readonly workItemCreateRequest: (transport: HttpTransport, input: CreateWorkItemInput) => Promise<RequestSpec>;
|
|
105
106
|
readonly workItemPatchRequest: (transport: HttpTransport, number: string, input: PatchWorkItemInput) => Promise<RequestSpec>;
|
|
106
107
|
readonly pullRequestAssigneesRequest: (transport: HttpTransport, number: string, logins: string[]) => Promise<RequestSpec>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../../src/code-hosts/strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../../src/code-hosts/strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1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ionId, IntegrationId }
|
|
|
4
4
|
import type { DoctorCapability, IntegrationLoginCapability } from "./login.js";
|
|
5
5
|
import type { Account, Repository, RepositoryHost, RepositoryRef, WorkItems } from "./model.js";
|
|
6
6
|
import type { SessionPorts } from "./ports.js";
|
|
7
|
-
import type { INTEGRATION_SETTINGS_INPUT_KIND, REPOSITORY_SETTINGS_UPDATE_KIND } from "./values.js";
|
|
7
|
+
import type { INTEGRATION_SETTINGS_INPUT_KIND, REPOSITORY_REMOTE_RESOLUTION_KIND, REPOSITORY_SETTINGS_UPDATE_KIND } from "./values.js";
|
|
8
8
|
export type IntegrationConnectionRecord = {
|
|
9
9
|
readonly id: IntegrationConnectionId;
|
|
10
10
|
readonly integrationId: IntegrationId;
|
|
@@ -43,14 +43,29 @@ export type IntegrationSettingsInput = {
|
|
|
43
43
|
readonly kind: typeof INTEGRATION_SETTINGS_INPUT_KIND.raw;
|
|
44
44
|
readonly settings: JsonObject;
|
|
45
45
|
};
|
|
46
|
+
export type RepositoryRemoteResolution = {
|
|
47
|
+
readonly kind: typeof REPOSITORY_REMOTE_RESOLUTION_KIND.matched;
|
|
48
|
+
readonly repository: RepositoryRef;
|
|
49
|
+
readonly baseUrl: string | null;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: typeof REPOSITORY_REMOTE_RESOLUTION_KIND.unmatched;
|
|
52
|
+
} | {
|
|
53
|
+
readonly kind: typeof REPOSITORY_REMOTE_RESOLUTION_KIND.rejected;
|
|
54
|
+
readonly detail: string;
|
|
55
|
+
};
|
|
56
|
+
export type RepositoryScope = {
|
|
57
|
+
readonly repository: RepositoryRef;
|
|
58
|
+
readonly baseUrl: string;
|
|
59
|
+
};
|
|
60
|
+
export declare function sameRepositoryScope(left: RepositoryScope, right: RepositoryScope): boolean;
|
|
46
61
|
export interface RepositoryScopeAdapter<TSettings> {
|
|
47
62
|
applySettings(input: RepositorySettingsApplication<TSettings>): JsonObject;
|
|
48
|
-
|
|
63
|
+
project(settings: TSettings): RepositoryScope;
|
|
64
|
+
resolveRemote(remoteUrl: string): RepositoryRemoteResolution;
|
|
49
65
|
}
|
|
50
66
|
export interface IntegrationDefinition<Id extends IntegrationId = IntegrationId, TSettings = JsonObject, TSession = unknown> {
|
|
51
67
|
readonly id: Id;
|
|
52
68
|
readonly settingsCodec: RuntimeCodec<TSettings>;
|
|
53
|
-
readonly remoteMatch?: (remoteUrl: string, settings: TSettings) => boolean;
|
|
54
69
|
readonly repositoryScope?: RepositoryScopeAdapter<TSettings>;
|
|
55
70
|
readonly auth?: IntegrationAuthCapability;
|
|
56
71
|
readonly login?: IntegrationLoginCapability;
|
package/dist/definition.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../src/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,KAAK,EACV,aAAa,EACb,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACV,cAAc,EACd,aAAa,EACb,SAAS,EACV,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EACV,+BAA+B,EAC/B,+BAA+B,EAChC,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,EAAE,EAAE,uBAAuB,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IACtC,QAAQ,CAAC,QAA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,cAAc,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3D,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,SAAS,CAAC;IACtD,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,UAAU,CAAC;IACxD,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,cAAc,CAAC;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC;CACnD;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,CAAC,EAAE,SAAS,aAAa,EAC9B,SAAS,EACT,QAAQ,EAER,UAAU,EAAE,qBAAqB,CAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,GACzD,qBAAqB,CAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAEhD;AAED,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,GACzB,CAAC"}
|
package/dist/definition.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export function sameRepositoryScope(left, right) {
|
|
2
|
+
return (left.baseUrl === right.baseUrl &&
|
|
3
|
+
left.repository.owner === right.repository.owner &&
|
|
4
|
+
left.repository.name === right.repository.name);
|
|
5
|
+
}
|
|
1
6
|
export function defineIntegration(definition) {
|
|
2
7
|
return definition;
|
|
3
8
|
}
|
package/dist/error.d.ts
CHANGED
package/dist/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvE,eAAO,MAAM,sBAAsB;;;;;;;;;CASzB,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAC9B,CAAC,OA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@@ -1,13 +1,13 @@
|
|
|
1
1
|
/** Provider-neutral development-management integration runtime. */
|
|
2
2
|
export { ABORTABLE_HTTP_CLIENT_CLOSED_MESSAGE, type AbortableHttpClient, type AbortableHttpClientOptions, createAbortableHttpClient, } from "./abortable-http-client.js";
|
|
3
|
-
export { type AmbientAuthResolver, type Authorization, authorizationHeader, bearerMaterialHandlers, envResolver, type IntegrationAuthBinding, type IntegrationAuthCapability, type IntegrationAuthMaterial, type IntegrationAuthMaterialKind, type IntegrationAuthProfile, type MaterialHandler, type MaterialHandlers, requireSecret, type SecretRef, } from "./auth.js";
|
|
3
|
+
export { type AmbientAuthResolver, type Authorization, authorizationHeader, bearerMaterialHandlers, envResolver, type IntegrationAuthBinding, type IntegrationAuthCapability, type IntegrationAuthMaterial, type IntegrationAuthMaterialKind, type IntegrationAuthProfile, type MaterialHandler, type MaterialHandlers, requireSecret, type SecretRef, sameIntegrationAuthBinding, } from "./auth.js";
|
|
4
4
|
export { createIntegrationDefinitionCatalog, type IntegrationDefinitionCatalog, } from "./catalog.js";
|
|
5
5
|
export { BUILTIN_INTEGRATION_ID, type BuiltinIntegrationId, findGitCredentialScheme, gitCredentialScheme, templatePaths, } from "./code-hosts/builtin.js";
|
|
6
6
|
export { GITEA_INTEGRATION_ID, type GiteaSettings, gitea, } from "./code-hosts/gitea.js";
|
|
7
7
|
export { GITHUB_INTEGRATION_ID, type GitHubSettings, github, } from "./code-hosts/github.js";
|
|
8
8
|
export { GITLAB_INTEGRATION_ID, type GitLabSettings, gitlab, } from "./code-hosts/gitlab.js";
|
|
9
|
-
export type { ConnectContext, IntegrationConnectionRecord, IntegrationDefinition, IntegrationSettingsInput, RepositoryScopeAdapter, RepositorySettingsApplication, RepositorySettingsUpdate, } from "./definition.js";
|
|
10
|
-
export { defineIntegration } from "./definition.js";
|
|
9
|
+
export type { ConnectContext, IntegrationConnectionRecord, IntegrationDefinition, IntegrationSettingsInput, RepositoryRemoteResolution, RepositoryScope, RepositoryScopeAdapter, RepositorySettingsApplication, RepositorySettingsUpdate, } from "./definition.js";
|
|
10
|
+
export { defineIntegration, sameRepositoryScope } from "./definition.js";
|
|
11
11
|
export { AUTH_FAILURE_REASON, type AuthFailureReason, INTEGRATION_ERROR_CODE, IntegrationError, type IntegrationErrorCode, type IntegrationErrorData, type IntegrationErrorOptions, isIntegrationError, NOT_AVAILABLE_CAUSE, type NotAvailableCause, } from "./error.js";
|
|
12
12
|
export type { ChangeFeedCursor, CommentReaction, CommentRef, IntegrationAuthProfileId, IntegrationConnectionId, IntegrationId, MilestoneRef, PullRequestRef, WorkItemRef, } from "./ids.js";
|
|
13
13
|
export { changeFeedCursor, commentReaction, commentRef, integrationAuthProfileId, integrationConnectionId, integrationId, milestoneRef, pullRequestRef, workItemRef, } from "./ids.js";
|
|
@@ -15,10 +15,10 @@ export type { DoctorCapability, DoctorCheck, DoctorCheckStatus, IntegrationLogin
|
|
|
15
15
|
export * from "./model.js";
|
|
16
16
|
export type { Clock, Exec, ExecChunk, ExecExit, ExecProcess, ExecSpawnOptions, HttpClient, HttpTelemetry, IntegrationPorts, Logger, SecretResolver, SecretResolvers, SessionPorts, TelemetrySink, } from "./ports.js";
|
|
17
17
|
export { parseRepositoryRef } from "./repository-ref.js";
|
|
18
|
-
export { type ConnectionCheck, createIntegrationRuntime, type Integration, type IntegrationRuntime, type IntegrationRuntimeOptions, } from "./runtime.js";
|
|
18
|
+
export { type ConnectionCheck, createIntegrationRuntime, type Integration, type IntegrationRemoteResolution, type IntegrationRuntime, type IntegrationRuntimeOptions, } from "./runtime.js";
|
|
19
19
|
export { createOpaqueCursorCodec } from "./transport/cursor.js";
|
|
20
20
|
export { HttpTransport, type HttpTransportOptions, } from "./transport/http-transport.js";
|
|
21
21
|
export { LinkHeaderPager, PageParamPager, type PageParamPagerOptions, } from "./transport/pager.js";
|
|
22
22
|
export type { CursorCodec, HttpMethod, Pager, RequestSpec, } from "./transport/types.js";
|
|
23
|
-
export { AUTHORIZATION_KIND, AUTHORIZATION_SCHEME, COMMENT_KIND, COMMENT_SIDE, CONNECTION_STATUS,
|
|
23
|
+
export { AUTHORIZATION_KIND, AUTHORIZATION_SCHEME, COMMENT_KIND, COMMENT_SIDE, CONNECTION_STATUS, CREATE_NEW_REPOSITORY_RESULT_KIND, DOCTOR_CHECK_STATUS, EXEC_CHANNEL, FILE_CHANGE_STATUS, GIT_PROTOCOL, HTTP_MEDIA_TYPE, HTTP_METHOD, INTEGRATION_AUTH_BINDING_KIND, INTEGRATION_AUTH_MATERIAL_KIND, INTEGRATION_LOGIN_METHOD, INTEGRATION_REMOTE_RESOLUTION_KIND, INTEGRATION_SETTINGS_INPUT_KIND, LOG_LEVEL, LOGIN_EVENT_TYPE, MEMBERSHIP, MERGE_METHOD, MERGE_STATE_STATUS, MERGEABILITY, OWNER_KIND, PULL_REQUEST_FEEDBACK_KIND, PULL_REQUEST_REVIEW_CONTEXT_AVAILABILITY, PULL_REQUEST_REVIEW_STATE, PULL_REQUEST_STATE, REPOSITORY_REMOTE_RESOLUTION_KIND, REPOSITORY_SETTINGS_UPDATE_KIND, REVIEW_DECISION, WORK_ITEM_KIND, WORK_ITEM_QUERY_STATE, WORK_ITEM_SEARCH_FIELD, WORK_ITEM_STATE, } from "./values.js";
|
|
24
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,OAAO,EACL,oCAAoC,EACpC,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,WAAW,EACX,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,aAAa,EACb,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,OAAO,EACL,oCAAoC,EACpC,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,WAAW,EACX,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,aAAa,EACb,KAAK,SAAS,EACd,0BAA0B,GAC3B,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,kCAAkC,EAClC,KAAK,4BAA4B,GAClC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oBAAoB,EACpB,KAAK,aAAa,EAClB,KAAK,GACN,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,qBAAqB,EACrB,KAAK,cAAc,EACnB,MAAM,GACP,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,qBAAqB,EACrB,KAAK,cAAc,EACnB,MAAM,GACP,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,cAAc,EACd,2BAA2B,EAC3B,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC1B,eAAe,EACf,sBAAsB,EACtB,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,iBA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BAA+B,CAAC;AACvC,OAAO,EACL,eAAe,EACf,cAAc,EACd,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,WAAW,EACX,UAAU,EACV,KAAK,EACL,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,iCAAiC,EACjC,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,WAAW,EACX,6BAA6B,EAC7B,8BAA8B,EAC9B,wBAAwB,EACxB,kCAAkC,EAClC,+BAA+B,EAC/B,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,0BAA0B,EAC1B,wCAAwC,EACxC,yBAAyB,EACzB,kBAAkB,EAClB,iCAAiC,EACjC,+BAA+B,EAC/B,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,GAChB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/** Provider-neutral development-management integration runtime. */
|
|
2
2
|
export { ABORTABLE_HTTP_CLIENT_CLOSED_MESSAGE, createAbortableHttpClient, } from "./abortable-http-client.js";
|
|
3
|
-
export { authorizationHeader, bearerMaterialHandlers, envResolver, requireSecret, } from "./auth.js";
|
|
3
|
+
export { authorizationHeader, bearerMaterialHandlers, envResolver, requireSecret, sameIntegrationAuthBinding, } from "./auth.js";
|
|
4
4
|
export { createIntegrationDefinitionCatalog, } from "./catalog.js";
|
|
5
5
|
export { BUILTIN_INTEGRATION_ID, findGitCredentialScheme, gitCredentialScheme, templatePaths, } from "./code-hosts/builtin.js";
|
|
6
6
|
export { GITEA_INTEGRATION_ID, gitea, } from "./code-hosts/gitea.js";
|
|
7
7
|
export { GITHUB_INTEGRATION_ID, github, } from "./code-hosts/github.js";
|
|
8
8
|
export { GITLAB_INTEGRATION_ID, gitlab, } from "./code-hosts/gitlab.js";
|
|
9
|
-
export { defineIntegration } from "./definition.js";
|
|
9
|
+
export { defineIntegration, sameRepositoryScope } from "./definition.js";
|
|
10
10
|
export { AUTH_FAILURE_REASON, INTEGRATION_ERROR_CODE, IntegrationError, isIntegrationError, NOT_AVAILABLE_CAUSE, } from "./error.js";
|
|
11
11
|
export { changeFeedCursor, commentReaction, commentRef, integrationAuthProfileId, integrationConnectionId, integrationId, milestoneRef, pullRequestRef, workItemRef, } from "./ids.js";
|
|
12
12
|
export * from "./model.js";
|
|
@@ -15,4 +15,4 @@ export { createIntegrationRuntime, } from "./runtime.js";
|
|
|
15
15
|
export { createOpaqueCursorCodec } from "./transport/cursor.js";
|
|
16
16
|
export { HttpTransport, } from "./transport/http-transport.js";
|
|
17
17
|
export { LinkHeaderPager, PageParamPager, } from "./transport/pager.js";
|
|
18
|
-
export { AUTHORIZATION_KIND, AUTHORIZATION_SCHEME, COMMENT_KIND, COMMENT_SIDE, CONNECTION_STATUS,
|
|
18
|
+
export { AUTHORIZATION_KIND, AUTHORIZATION_SCHEME, COMMENT_KIND, COMMENT_SIDE, CONNECTION_STATUS, CREATE_NEW_REPOSITORY_RESULT_KIND, DOCTOR_CHECK_STATUS, EXEC_CHANNEL, FILE_CHANGE_STATUS, GIT_PROTOCOL, HTTP_MEDIA_TYPE, HTTP_METHOD, INTEGRATION_AUTH_BINDING_KIND, INTEGRATION_AUTH_MATERIAL_KIND, INTEGRATION_LOGIN_METHOD, INTEGRATION_REMOTE_RESOLUTION_KIND, INTEGRATION_SETTINGS_INPUT_KIND, LOG_LEVEL, LOGIN_EVENT_TYPE, MEMBERSHIP, MERGE_METHOD, MERGE_STATE_STATUS, MERGEABILITY, OWNER_KIND, PULL_REQUEST_FEEDBACK_KIND, PULL_REQUEST_REVIEW_CONTEXT_AVAILABILITY, PULL_REQUEST_REVIEW_STATE, PULL_REQUEST_STATE, REPOSITORY_REMOTE_RESOLUTION_KIND, REPOSITORY_SETTINGS_UPDATE_KIND, REVIEW_DECISION, WORK_ITEM_KIND, WORK_ITEM_QUERY_STATE, WORK_ITEM_SEARCH_FIELD, WORK_ITEM_STATE, } from "./values.js";
|