@mastra/factory 0.1.0-alpha.3 → 0.1.0-alpha.5
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/CHANGELOG.md +42 -0
- package/dist/capabilities/intake.d.ts +2 -0
- package/dist/capabilities/intake.d.ts.map +1 -1
- package/dist/capabilities/version-control.d.ts +6 -0
- package/dist/capabilities/version-control.d.ts.map +1 -1
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +912 -242
- package/dist/factory.js.map +1 -1
- package/dist/index.js +912 -242
- package/dist/index.js.map +1 -1
- package/dist/integrations/github/integration.d.ts +2 -2
- package/dist/integrations/github/integration.js +45 -12
- package/dist/integrations/github/integration.js.map +1 -1
- package/dist/integrations/github/provenance.js.map +1 -1
- package/dist/integrations/github/routes.js +12 -10
- package/dist/integrations/github/routes.js.map +1 -1
- package/dist/integrations/github/sandbox.d.ts +1 -0
- package/dist/integrations/github/sandbox.d.ts.map +1 -1
- package/dist/integrations/github/sandbox.js +2 -2
- package/dist/integrations/github/sandbox.js.map +1 -1
- package/dist/integrations/github/session-subscriptions.d.ts +3 -0
- package/dist/integrations/github/session-subscriptions.d.ts.map +1 -1
- package/dist/integrations/github/session-subscriptions.js +30 -0
- package/dist/integrations/github/session-subscriptions.js.map +1 -1
- package/dist/integrations/github/token-refresh.d.ts +6 -0
- package/dist/integrations/github/token-refresh.d.ts.map +1 -0
- package/dist/integrations/github/token-refresh.js +17 -0
- package/dist/integrations/github/token-refresh.js.map +1 -0
- package/dist/integrations/platform/api-client.d.ts +2 -0
- package/dist/integrations/platform/api-client.d.ts.map +1 -1
- package/dist/integrations/platform/api-client.js +7 -0
- package/dist/integrations/platform/api-client.js.map +1 -1
- package/dist/integrations/platform/github/event-worker.js.map +1 -1
- package/dist/integrations/platform/github/integration.d.ts.map +1 -1
- package/dist/integrations/platform/github/integration.js +173 -45
- package/dist/integrations/platform/github/integration.js.map +1 -1
- package/dist/integrations/platform/linear/integration.js +3 -0
- package/dist/integrations/platform/linear/integration.js.map +1 -1
- package/dist/routes/config.d.ts +16 -11
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/config.js +222 -109
- package/dist/routes/config.js.map +1 -1
- package/dist/routes/custom-provider-source.d.ts +52 -0
- package/dist/routes/custom-provider-source.d.ts.map +1 -0
- package/dist/routes/custom-provider-source.js +107 -0
- package/dist/routes/custom-provider-source.js.map +1 -0
- package/dist/routes/oauth.js +33 -1
- package/dist/routes/oauth.js.map +1 -1
- package/dist/routes/surface.d.ts +4 -0
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +266 -110
- package/dist/routes/surface.js.map +1 -1
- package/dist/sandbox/fleet.d.ts +3 -0
- package/dist/sandbox/fleet.d.ts.map +1 -1
- package/dist/sandbox/fleet.js +10 -3
- package/dist/sandbox/fleet.js.map +1 -1
- package/dist/spa-static.d.ts +4 -5
- package/dist/spa-static.d.ts.map +1 -1
- package/dist/spa-static.js +5 -2
- package/dist/spa-static.js.map +1 -1
- package/dist/storage/domains/custom-providers/base.d.ts +57 -0
- package/dist/storage/domains/custom-providers/base.d.ts.map +1 -0
- package/dist/storage/domains/custom-providers/base.js +150 -0
- package/dist/storage/domains/custom-providers/base.js.map +1 -0
- package/dist/storage/domains/memory-settings/base.d.ts +62 -0
- package/dist/storage/domains/memory-settings/base.d.ts.map +1 -0
- package/dist/storage/domains/memory-settings/base.js +111 -0
- package/dist/storage/domains/memory-settings/base.js.map +1 -0
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +17 -0
- package/dist/workspace.js.map +1 -1
- package/package.json +8 -7
|
@@ -117,8 +117,8 @@ function bindingStore(row, storage) {
|
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
async function ensureProjectSandbox(options) {
|
|
120
|
-
const { fleet, row, storage, onProgress } = options;
|
|
121
|
-
return fleet.ensureSandbox(bindingStore(row, storage), onProgress);
|
|
120
|
+
const { fleet, row, storage, token, onProgress } = options;
|
|
121
|
+
return fleet.ensureSandbox(bindingStore(row, storage), { GH_TOKEN: token }, onProgress);
|
|
122
122
|
}
|
|
123
123
|
async function teardownProjectSandbox(options) {
|
|
124
124
|
const { fleet, row, storage, sandbox } = options;
|
|
@@ -1395,13 +1395,6 @@ async function loadOrCreateSandboxRow(github, project, userId) {
|
|
|
1395
1395
|
async function prepareProject(options) {
|
|
1396
1396
|
const { github, fleet, project, userId, onProgress } = options;
|
|
1397
1397
|
const sandboxRow = await loadOrCreateSandboxRow(github, project, userId);
|
|
1398
|
-
const sandbox = await ensureProjectSandbox({
|
|
1399
|
-
fleet,
|
|
1400
|
-
row: sandboxRow,
|
|
1401
|
-
storage: github.sourceControlStorage.sandboxes,
|
|
1402
|
-
onProgress
|
|
1403
|
-
});
|
|
1404
|
-
const fresh = await github.sourceControlStorage.sandboxes.getById({ id: sandboxRow.id });
|
|
1405
1398
|
const access = await github.versionControl.getRepositoryAccess({
|
|
1406
1399
|
orgId: project.installation.orgId,
|
|
1407
1400
|
repositoryId: project.repository.id
|
|
@@ -1409,6 +1402,14 @@ async function prepareProject(options) {
|
|
|
1409
1402
|
if (!access.authorization) {
|
|
1410
1403
|
throw new MaterializeError("Repository access did not include a bearer token.", "clone-failed");
|
|
1411
1404
|
}
|
|
1405
|
+
const sandbox = await ensureProjectSandbox({
|
|
1406
|
+
fleet,
|
|
1407
|
+
row: sandboxRow,
|
|
1408
|
+
storage: github.sourceControlStorage.sandboxes,
|
|
1409
|
+
token: access.authorization.token,
|
|
1410
|
+
onProgress
|
|
1411
|
+
});
|
|
1412
|
+
const fresh = await github.sourceControlStorage.sandboxes.getById({ id: sandboxRow.id });
|
|
1412
1413
|
const finalRow = fresh ?? sandboxRow;
|
|
1413
1414
|
await materializeRepo({
|
|
1414
1415
|
row: finalRow,
|
|
@@ -1728,7 +1729,8 @@ function buildProjectGitRoutes({
|
|
|
1728
1729
|
baseBranch: base,
|
|
1729
1730
|
headBranch: head,
|
|
1730
1731
|
title,
|
|
1731
|
-
body: prBody
|
|
1732
|
+
body: prBody,
|
|
1733
|
+
actingUserId: userId
|
|
1732
1734
|
});
|
|
1733
1735
|
await emitAudit?.({
|
|
1734
1736
|
context: loose(c),
|
|
@@ -1839,6 +1841,18 @@ async function resolveSessionWorkspace(github, projectId, userId, sessionId) {
|
|
|
1839
1841
|
// src/integrations/github/session-subscriptions.ts
|
|
1840
1842
|
import { createTool } from "@mastra/core/tools";
|
|
1841
1843
|
import { z } from "zod";
|
|
1844
|
+
|
|
1845
|
+
// src/integrations/github/token-refresh.ts
|
|
1846
|
+
var GITHUB_TOKEN_INJECTOR_CONTEXT_KEY = "factoryGithubTokenInjector";
|
|
1847
|
+
function injectGithubToken(requestContext, token) {
|
|
1848
|
+
const injector = requestContext.get(GITHUB_TOKEN_INJECTOR_CONTEXT_KEY);
|
|
1849
|
+
if (!injector) {
|
|
1850
|
+
throw new Error("GitHub token refresh requires an active Factory sandbox workspace.");
|
|
1851
|
+
}
|
|
1852
|
+
injector(token);
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
// src/integrations/github/session-subscriptions.ts
|
|
1842
1856
|
function sessionUserId(user) {
|
|
1843
1857
|
return user?.workosId ?? user?.id;
|
|
1844
1858
|
}
|
|
@@ -1925,11 +1939,30 @@ async function unsubscribeCurrentSessionFromPullRequest(requestContext, pullRequ
|
|
|
1925
1939
|
await unsubscribeFromPullRequest(await subscriptionInput(target, number), github.integrationStorage);
|
|
1926
1940
|
return number;
|
|
1927
1941
|
}
|
|
1942
|
+
async function refreshGithubToken(requestContext, github) {
|
|
1943
|
+
const target = await resolveSessionTarget(requestContext, github);
|
|
1944
|
+
const access = await github.versionControl.getRepositoryAccess({
|
|
1945
|
+
orgId: target.orgId,
|
|
1946
|
+
repositoryId: target.repository.id
|
|
1947
|
+
});
|
|
1948
|
+
const token = access.authorization?.token;
|
|
1949
|
+
if (!token) throw new Error("Repository access did not include a bearer token for the Factory session.");
|
|
1950
|
+
injectGithubToken(requestContext, token);
|
|
1951
|
+
}
|
|
1928
1952
|
function createGithubSubscriptionTools(requestContext, github) {
|
|
1929
1953
|
const context = requestContext.get("controller");
|
|
1930
1954
|
const user = requestContext.get("user");
|
|
1931
1955
|
if (!context?.getState().projectRepositoryId || !sessionOrgId(user) || !sessionUserId(user)) return {};
|
|
1932
1956
|
return {
|
|
1957
|
+
github_refresh_token: createTool({
|
|
1958
|
+
id: "github_refresh_token",
|
|
1959
|
+
description: "Refresh GitHub CLI authentication in the active Factory sandbox. Use this after a gh command fails because authentication is expired, invalid, or missing. It installs a fresh GH_TOKEN for subsequent sandbox commands. After this tool succeeds, retry the failed gh command. Takes no arguments and never returns the token.",
|
|
1960
|
+
inputSchema: z.object({}),
|
|
1961
|
+
execute: async () => {
|
|
1962
|
+
await refreshGithubToken(requestContext, github);
|
|
1963
|
+
return { refreshed: true };
|
|
1964
|
+
}
|
|
1965
|
+
}),
|
|
1933
1966
|
github_subscribe_pr: createTool({
|
|
1934
1967
|
id: "github_subscribe_pr",
|
|
1935
1968
|
description: "Subscribe this thread to GitHub pull request activity. You usually do not need this tool: successful gh pr create commands subscribe automatically. Use it for an existing PR or to recover when automatic subscription did not occur. Closed or merged PRs are unsubscribed automatically. Accepts a PR number or canonical URL for the active project.",
|
|
@@ -2056,6 +2089,9 @@ var PlatformApiClient = class {
|
|
|
2056
2089
|
accept: "application/json",
|
|
2057
2090
|
authorization: `Bearer ${this.#accessToken}`
|
|
2058
2091
|
};
|
|
2092
|
+
if (options?.actingUserId) {
|
|
2093
|
+
headers["x-acting-user-id"] = options.actingUserId;
|
|
2094
|
+
}
|
|
2059
2095
|
const timeoutSignal = AbortSignal.timeout(15e3);
|
|
2060
2096
|
const init = {
|
|
2061
2097
|
method,
|
|
@@ -2107,6 +2143,9 @@ function redact(message, accessToken) {
|
|
|
2107
2143
|
function logPlatformInfo(message, fields) {
|
|
2108
2144
|
writePlatformLog("info", message, fields);
|
|
2109
2145
|
}
|
|
2146
|
+
function logPlatformWarn(message, fields) {
|
|
2147
|
+
writePlatformLog("warn", message, fields);
|
|
2148
|
+
}
|
|
2110
2149
|
function logPlatformError(message, fields) {
|
|
2111
2150
|
writePlatformLog("error", message, fields);
|
|
2112
2151
|
}
|
|
@@ -2425,6 +2464,11 @@ function retryDelay(error, fallbackMs) {
|
|
|
2425
2464
|
// src/integrations/platform/github/integration.ts
|
|
2426
2465
|
var PAGE_SIZE = 30;
|
|
2427
2466
|
var API_PREFIX2 = "/v1/server";
|
|
2467
|
+
var REPOSITORY_TOKEN_PERMISSIONS = {
|
|
2468
|
+
contents: "write",
|
|
2469
|
+
issues: "write",
|
|
2470
|
+
pull_requests: "write"
|
|
2471
|
+
};
|
|
2428
2472
|
function loose2(c) {
|
|
2429
2473
|
return c;
|
|
2430
2474
|
}
|
|
@@ -2538,7 +2582,7 @@ var PlatformGithubIntegration = class {
|
|
|
2538
2582
|
return this.#listIssues(input.connection, sourceId, parsePositiveCursor(input.cursor), input.labels);
|
|
2539
2583
|
},
|
|
2540
2584
|
getIssue: (input) => this.#getIssue(input.connection, input.sourceId, input.issueId),
|
|
2541
|
-
createComment: (input) => this.#createIssueComment(input
|
|
2585
|
+
createComment: (input) => this.#createIssueComment(input)
|
|
2542
2586
|
};
|
|
2543
2587
|
versionControl = {
|
|
2544
2588
|
initialize: ({ storage }) => {
|
|
@@ -2577,7 +2621,7 @@ var PlatformGithubIntegration = class {
|
|
|
2577
2621
|
const token = await this.#client.request(
|
|
2578
2622
|
"POST",
|
|
2579
2623
|
`${API_PREFIX2}/github-app/installations/${installationId}/token`,
|
|
2580
|
-
{ repositories: [repositoryName], permissions:
|
|
2624
|
+
{ repositories: [repositoryName], permissions: REPOSITORY_TOKEN_PERMISSIONS }
|
|
2581
2625
|
);
|
|
2582
2626
|
return {
|
|
2583
2627
|
cloneUrl: `https://github.com/${repository.slug}.git`,
|
|
@@ -2641,6 +2685,7 @@ var PlatformGithubIntegration = class {
|
|
|
2641
2685
|
return [
|
|
2642
2686
|
this.#statusRoute(ctx),
|
|
2643
2687
|
this.#connectRoute(ctx),
|
|
2688
|
+
this.#connectUserRoute(ctx),
|
|
2644
2689
|
...buildGithubRoutes({
|
|
2645
2690
|
auth: ctx.auth,
|
|
2646
2691
|
fleet: ctx.fleet,
|
|
@@ -2672,11 +2717,16 @@ var PlatformGithubIntegration = class {
|
|
|
2672
2717
|
organizationRequired: true,
|
|
2673
2718
|
connected: false,
|
|
2674
2719
|
installations: [],
|
|
2720
|
+
userConnected: false,
|
|
2721
|
+
userGithubUsername: null,
|
|
2675
2722
|
reason: "organization_required",
|
|
2676
2723
|
diagnostics: this.diagnostics()
|
|
2677
2724
|
});
|
|
2678
2725
|
}
|
|
2679
|
-
const installations = await
|
|
2726
|
+
const [installations, userConnection] = await Promise.all([
|
|
2727
|
+
this.#syncInstallations(tenant.orgId, tenant.userId),
|
|
2728
|
+
this.#fetchUserConnection(tenant.userId)
|
|
2729
|
+
]);
|
|
2680
2730
|
return c.json({
|
|
2681
2731
|
enabled: true,
|
|
2682
2732
|
sandboxEnabled: ctx.fleet.enabled,
|
|
@@ -2686,6 +2736,8 @@ var PlatformGithubIntegration = class {
|
|
|
2686
2736
|
accountLogin: installation.accountName,
|
|
2687
2737
|
accountType: installation.accountType
|
|
2688
2738
|
})),
|
|
2739
|
+
userConnected: userConnection.connected,
|
|
2740
|
+
userGithubUsername: userConnection.githubUsername,
|
|
2689
2741
|
reason: installations.length > 0 ? "ready" : "not_connected",
|
|
2690
2742
|
diagnostics: this.diagnostics()
|
|
2691
2743
|
});
|
|
@@ -2720,6 +2772,55 @@ var PlatformGithubIntegration = class {
|
|
|
2720
2772
|
}
|
|
2721
2773
|
});
|
|
2722
2774
|
}
|
|
2775
|
+
#connectUserRoute(ctx) {
|
|
2776
|
+
return registerApiRoute2("/auth/github/connect-user", {
|
|
2777
|
+
method: "GET",
|
|
2778
|
+
requiresAuth: false,
|
|
2779
|
+
handler: async (c) => {
|
|
2780
|
+
await ctx.auth.ensureUser(loose2(c));
|
|
2781
|
+
const tenant = ctx.auth.tenant(loose2(c));
|
|
2782
|
+
if (!tenant?.orgId) return c.json({ error: "unauthorized" }, 401);
|
|
2783
|
+
const redirectTo = c.req.query("redirectTo") || c.req.query("return_to") || "/";
|
|
2784
|
+
const originator = routeBaseUrl(ctx, c.req.url);
|
|
2785
|
+
logPlatformInfo("Starting Platform GitHub user authorization flow", {
|
|
2786
|
+
orgId: tenant.orgId,
|
|
2787
|
+
redirectTo,
|
|
2788
|
+
originator
|
|
2789
|
+
});
|
|
2790
|
+
const query = new URLSearchParams({
|
|
2791
|
+
userId: tenant.userId,
|
|
2792
|
+
redirectTo,
|
|
2793
|
+
originator
|
|
2794
|
+
});
|
|
2795
|
+
const { url } = await this.#client.request(
|
|
2796
|
+
"GET",
|
|
2797
|
+
`${API_PREFIX2}/github-app/authenticate?${query}`
|
|
2798
|
+
);
|
|
2799
|
+
return c.redirect(url);
|
|
2800
|
+
}
|
|
2801
|
+
});
|
|
2802
|
+
}
|
|
2803
|
+
/**
|
|
2804
|
+
* Personal GitHub connection status for the acting user. Returns
|
|
2805
|
+
* not-connected when the platform predates the user-connection endpoint.
|
|
2806
|
+
*/
|
|
2807
|
+
async #fetchUserConnection(userId) {
|
|
2808
|
+
try {
|
|
2809
|
+
const connection = await this.#client.request(
|
|
2810
|
+
"GET",
|
|
2811
|
+
`${API_PREFIX2}/github-app/user-connection?${new URLSearchParams({ userId })}`
|
|
2812
|
+
);
|
|
2813
|
+
if (!connection.connected && connection.reason) {
|
|
2814
|
+
logPlatformWarn("Platform GitHub user connection verification failed", {
|
|
2815
|
+
userId,
|
|
2816
|
+
reason: connection.reason
|
|
2817
|
+
});
|
|
2818
|
+
}
|
|
2819
|
+
return connection;
|
|
2820
|
+
} catch {
|
|
2821
|
+
return { connected: false, githubUsername: null };
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2723
2824
|
async #syncInstallations(orgId, userId) {
|
|
2724
2825
|
const result = await this.#client.request(
|
|
2725
2826
|
"GET",
|
|
@@ -2815,7 +2916,7 @@ var PlatformGithubIntegration = class {
|
|
|
2815
2916
|
const result = await this.#client.request(
|
|
2816
2917
|
"POST",
|
|
2817
2918
|
`${API_PREFIX2}/github-app/installations/${installationId}/token`,
|
|
2818
|
-
{ repositories: repositories.map((repository) => repository.name), permissions:
|
|
2919
|
+
{ repositories: repositories.map((repository) => repository.name), permissions: REPOSITORY_TOKEN_PERMISSIONS }
|
|
2819
2920
|
);
|
|
2820
2921
|
return result.token;
|
|
2821
2922
|
}
|
|
@@ -2870,15 +2971,16 @@ var PlatformGithubIntegration = class {
|
|
|
2870
2971
|
throw error;
|
|
2871
2972
|
}
|
|
2872
2973
|
}
|
|
2873
|
-
async #createIssueComment(
|
|
2874
|
-
requireGithubConnection(connection);
|
|
2875
|
-
const repository = requireSource(sourceId, "GitHub Intake requires a repository source.");
|
|
2876
|
-
const issueNumber = requirePositiveId(issueId, "issue");
|
|
2974
|
+
async #createIssueComment(input) {
|
|
2975
|
+
requireGithubConnection(input.connection);
|
|
2976
|
+
const repository = requireSource(input.sourceId, "GitHub Intake requires a repository source.");
|
|
2977
|
+
const issueNumber = requirePositiveId(input.issueId, "issue");
|
|
2877
2978
|
try {
|
|
2878
2979
|
const comment = await this.#client.request(
|
|
2879
2980
|
"POST",
|
|
2880
2981
|
repositoryPath(repository, `issues/${issueNumber}/comments`),
|
|
2881
|
-
{ body }
|
|
2982
|
+
{ body: input.body },
|
|
2983
|
+
{ actingUserId: input.actingUserId }
|
|
2882
2984
|
);
|
|
2883
2985
|
return { id: String(comment.id), url: comment.htmlUrl };
|
|
2884
2986
|
} catch (error) {
|
|
@@ -2915,29 +3017,40 @@ var PlatformGithubIntegration = class {
|
|
|
2915
3017
|
}
|
|
2916
3018
|
async #createPullRequest(input) {
|
|
2917
3019
|
requireGithubConnection(input.connection);
|
|
2918
|
-
const result = await this.#client.request(
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
3020
|
+
const result = await this.#client.request(
|
|
3021
|
+
"POST",
|
|
3022
|
+
repositoryPath(input.sourceId, "pulls"),
|
|
3023
|
+
{
|
|
3024
|
+
head: input.headBranch,
|
|
3025
|
+
base: input.baseBranch,
|
|
3026
|
+
title: input.title,
|
|
3027
|
+
body: input.body,
|
|
3028
|
+
draft: input.draft
|
|
3029
|
+
},
|
|
3030
|
+
{ actingUserId: input.actingUserId }
|
|
3031
|
+
);
|
|
2925
3032
|
return parsePullRequest2(result);
|
|
2926
3033
|
}
|
|
2927
3034
|
async #updatePullRequest(input) {
|
|
2928
|
-
const result = await this.#client.request(
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
3035
|
+
const result = await this.#client.request(
|
|
3036
|
+
"PATCH",
|
|
3037
|
+
pullRequestPath(input, input.pullRequestId),
|
|
3038
|
+
{
|
|
3039
|
+
title: input.title,
|
|
3040
|
+
body: input.body === null ? "" : input.body,
|
|
3041
|
+
base: input.baseBranch,
|
|
3042
|
+
state: input.state
|
|
3043
|
+
},
|
|
3044
|
+
{ actingUserId: input.actingUserId }
|
|
3045
|
+
);
|
|
2934
3046
|
return parsePullRequest2(result);
|
|
2935
3047
|
}
|
|
2936
3048
|
#mergePullRequest(input) {
|
|
2937
3049
|
return this.#client.request(
|
|
2938
3050
|
"PUT",
|
|
2939
3051
|
`${pullRequestPath(input, input.pullRequestId)}/merge`,
|
|
2940
|
-
{ commitTitle: input.commitTitle, commitMessage: input.commitMessage, method: input.method }
|
|
3052
|
+
{ commitTitle: input.commitTitle, commitMessage: input.commitMessage, method: input.method },
|
|
3053
|
+
{ actingUserId: input.actingUserId }
|
|
2941
3054
|
);
|
|
2942
3055
|
}
|
|
2943
3056
|
async #listComments(input) {
|
|
@@ -2955,7 +3068,8 @@ var PlatformGithubIntegration = class {
|
|
|
2955
3068
|
const comment = await this.#client.request(
|
|
2956
3069
|
"POST",
|
|
2957
3070
|
repositoryPath(input.sourceId, `issues/${requirePositiveId(input.pullRequestId, "pull request")}/comments`),
|
|
2958
|
-
{ body: input.body }
|
|
3071
|
+
{ body: input.body },
|
|
3072
|
+
{ actingUserId: input.actingUserId }
|
|
2959
3073
|
);
|
|
2960
3074
|
return parseComment(comment);
|
|
2961
3075
|
}
|
|
@@ -2964,7 +3078,8 @@ var PlatformGithubIntegration = class {
|
|
|
2964
3078
|
const comment = await this.#client.request(
|
|
2965
3079
|
"PATCH",
|
|
2966
3080
|
repositoryPath(input.sourceId, `issues/comments/${requirePositiveId(input.commentId, "comment")}`),
|
|
2967
|
-
{ body: input.body }
|
|
3081
|
+
{ body: input.body },
|
|
3082
|
+
{ actingUserId: input.actingUserId }
|
|
2968
3083
|
);
|
|
2969
3084
|
return parseComment(comment);
|
|
2970
3085
|
}
|
|
@@ -2972,7 +3087,9 @@ var PlatformGithubIntegration = class {
|
|
|
2972
3087
|
requireGithubConnection(input.connection);
|
|
2973
3088
|
await this.#client.request(
|
|
2974
3089
|
"DELETE",
|
|
2975
|
-
repositoryPath(input.sourceId, `issues/comments/${requirePositiveId(input.commentId, "comment")}`)
|
|
3090
|
+
repositoryPath(input.sourceId, `issues/comments/${requirePositiveId(input.commentId, "comment")}`),
|
|
3091
|
+
void 0,
|
|
3092
|
+
{ actingUserId: input.actingUserId }
|
|
2976
3093
|
);
|
|
2977
3094
|
}
|
|
2978
3095
|
async #listReviews(input) {
|
|
@@ -3003,7 +3120,8 @@ var PlatformGithubIntegration = class {
|
|
|
3003
3120
|
const review = await this.#client.request(
|
|
3004
3121
|
"POST",
|
|
3005
3122
|
`${pullRequestPath(input, input.pullRequestId)}/reviews`,
|
|
3006
|
-
{ body: input.body, commitId: input.commitId, event: input.event ? reviewEvent(input.event) : void 0 }
|
|
3123
|
+
{ body: input.body, commitId: input.commitId, event: input.event ? reviewEvent(input.event) : void 0 },
|
|
3124
|
+
{ actingUserId: input.actingUserId }
|
|
3007
3125
|
);
|
|
3008
3126
|
return parseReview(review);
|
|
3009
3127
|
}
|
|
@@ -3011,7 +3129,8 @@ var PlatformGithubIntegration = class {
|
|
|
3011
3129
|
const review = await this.#client.request(
|
|
3012
3130
|
"PUT",
|
|
3013
3131
|
`${pullRequestPath(input, input.pullRequestId)}/reviews/${requirePositiveId(input.reviewId, "review")}`,
|
|
3014
|
-
{ body: input.body }
|
|
3132
|
+
{ body: input.body },
|
|
3133
|
+
{ actingUserId: input.actingUserId }
|
|
3015
3134
|
);
|
|
3016
3135
|
return parseReview(review);
|
|
3017
3136
|
}
|
|
@@ -3019,7 +3138,8 @@ var PlatformGithubIntegration = class {
|
|
|
3019
3138
|
const review = await this.#client.request(
|
|
3020
3139
|
"POST",
|
|
3021
3140
|
`${pullRequestPath(input, input.pullRequestId)}/reviews/${requirePositiveId(input.reviewId, "review")}/events`,
|
|
3022
|
-
{ body: input.body, event: reviewEvent(input.event) }
|
|
3141
|
+
{ body: input.body, event: reviewEvent(input.event) },
|
|
3142
|
+
{ actingUserId: input.actingUserId }
|
|
3023
3143
|
);
|
|
3024
3144
|
return parseReview(review);
|
|
3025
3145
|
}
|
|
@@ -3027,14 +3147,17 @@ var PlatformGithubIntegration = class {
|
|
|
3027
3147
|
const review = await this.#client.request(
|
|
3028
3148
|
"PUT",
|
|
3029
3149
|
`${pullRequestPath(input, input.pullRequestId)}/reviews/${requirePositiveId(input.reviewId, "review")}/dismissals`,
|
|
3030
|
-
{ message: input.message }
|
|
3150
|
+
{ message: input.message },
|
|
3151
|
+
{ actingUserId: input.actingUserId }
|
|
3031
3152
|
);
|
|
3032
3153
|
return parseReview(review);
|
|
3033
3154
|
}
|
|
3034
3155
|
async #deletePendingReview(input) {
|
|
3035
3156
|
await this.#client.request(
|
|
3036
3157
|
"DELETE",
|
|
3037
|
-
`${pullRequestPath(input, input.pullRequestId)}/reviews/${requirePositiveId(input.reviewId, "review")}
|
|
3158
|
+
`${pullRequestPath(input, input.pullRequestId)}/reviews/${requirePositiveId(input.reviewId, "review")}`,
|
|
3159
|
+
void 0,
|
|
3160
|
+
{ actingUserId: input.actingUserId }
|
|
3038
3161
|
);
|
|
3039
3162
|
}
|
|
3040
3163
|
async #listReviewComments(input) {
|
|
@@ -3070,7 +3193,8 @@ var PlatformGithubIntegration = class {
|
|
|
3070
3193
|
await this.#client.request(
|
|
3071
3194
|
"POST",
|
|
3072
3195
|
`${pullRequestPath(input, input.pullRequestId)}/comments`,
|
|
3073
|
-
body
|
|
3196
|
+
body,
|
|
3197
|
+
{ actingUserId: input.actingUserId }
|
|
3074
3198
|
)
|
|
3075
3199
|
);
|
|
3076
3200
|
}
|
|
@@ -3080,7 +3204,8 @@ var PlatformGithubIntegration = class {
|
|
|
3080
3204
|
await this.#client.request(
|
|
3081
3205
|
"PATCH",
|
|
3082
3206
|
repositoryPath(input.sourceId, `pulls/comments/${requirePositiveId(input.commentId, "review comment")}`),
|
|
3083
|
-
{ body: input.body }
|
|
3207
|
+
{ body: input.body },
|
|
3208
|
+
{ actingUserId: input.actingUserId }
|
|
3084
3209
|
)
|
|
3085
3210
|
);
|
|
3086
3211
|
}
|
|
@@ -3088,7 +3213,9 @@ var PlatformGithubIntegration = class {
|
|
|
3088
3213
|
requireGithubConnection(input.connection);
|
|
3089
3214
|
await this.#client.request(
|
|
3090
3215
|
"DELETE",
|
|
3091
|
-
repositoryPath(input.sourceId, `pulls/comments/${requirePositiveId(input.commentId, "review comment")}`)
|
|
3216
|
+
repositoryPath(input.sourceId, `pulls/comments/${requirePositiveId(input.commentId, "review comment")}`),
|
|
3217
|
+
void 0,
|
|
3218
|
+
{ actingUserId: input.actingUserId }
|
|
3092
3219
|
);
|
|
3093
3220
|
}
|
|
3094
3221
|
#requestedReviewers(method, input) {
|
|
@@ -3096,7 +3223,8 @@ var PlatformGithubIntegration = class {
|
|
|
3096
3223
|
return this.#client.request(
|
|
3097
3224
|
method,
|
|
3098
3225
|
`${pullRequestPath(input, input.pullRequestId)}/requested-reviewers`,
|
|
3099
|
-
method === "GET" ? void 0 : { users: input.users, teams: input.teams }
|
|
3226
|
+
method === "GET" ? void 0 : { users: input.users, teams: input.teams },
|
|
3227
|
+
method === "GET" ? void 0 : { actingUserId: input.actingUserId }
|
|
3100
3228
|
);
|
|
3101
3229
|
}
|
|
3102
3230
|
};
|