ccdeck 3.50.0 → 3.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/THIRD_PARTY_NOTICES.md +28 -0
- package/dist/web/assets/BrowserWatchModal-CRqdEVdh.js +1 -0
- package/dist/web/assets/IntegrationModal-BDzEIGSM.js +7 -0
- package/dist/web/assets/RadioPanel-BJlsCpnN.js +1 -0
- package/dist/web/assets/TrafficRadar-BGxw-hlO.js +8 -0
- package/dist/web/assets/UsageHistoryModal-C_WBpNIp.js +1 -0
- package/dist/web/assets/app-B53fC4gE.js +358 -0
- package/dist/web/assets/app-Co1HNGP8.css +1 -0
- package/dist/web/assets/{index-DSIUCKoe.js → index-D9nJhUJR.js} +1 -1
- package/dist/web/index.html +3 -3
- package/node_modules/bare-addon-resolve/LICENSE +201 -0
- package/node_modules/bare-addon-resolve/README.md +226 -0
- package/node_modules/bare-addon-resolve/index.d.ts +100 -0
- package/node_modules/bare-addon-resolve/index.js +531 -0
- package/node_modules/bare-addon-resolve/lib/errors.d.ts +16 -0
- package/node_modules/bare-addon-resolve/lib/errors.js +21 -0
- package/node_modules/bare-addon-resolve/package.json +57 -0
- package/node_modules/bare-module-resolve/LICENSE +201 -0
- package/node_modules/bare-module-resolve/README.md +322 -0
- package/node_modules/bare-module-resolve/index.d.ts +171 -0
- package/node_modules/bare-module-resolve/index.js +899 -0
- package/node_modules/bare-module-resolve/lib/errors.d.ts +31 -0
- package/node_modules/bare-module-resolve/lib/errors.js +37 -0
- package/node_modules/bare-module-resolve/package.json +56 -0
- package/node_modules/bare-semver/LICENSE +201 -0
- package/node_modules/bare-semver/README.md +147 -0
- package/node_modules/bare-semver/index.d.ts +61 -0
- package/node_modules/bare-semver/index.js +13 -0
- package/node_modules/bare-semver/lib/comparator.js +37 -0
- package/node_modules/bare-semver/lib/constants.js +7 -0
- package/node_modules/bare-semver/lib/errors.js +22 -0
- package/node_modules/bare-semver/lib/range.js +256 -0
- package/node_modules/bare-semver/lib/version.js +240 -0
- package/node_modules/bare-semver/package.json +43 -0
- package/node_modules/fs-native-extensions/CMakeLists.txt +118 -0
- package/node_modules/fs-native-extensions/LICENSE +201 -0
- package/node_modules/fs-native-extensions/README.md +160 -0
- package/node_modules/fs-native-extensions/binding.c +1825 -0
- package/node_modules/fs-native-extensions/binding.js +3 -0
- package/node_modules/fs-native-extensions/include/fs-ext.h +193 -0
- package/node_modules/fs-native-extensions/index.js +356 -0
- package/node_modules/fs-native-extensions/package.json +72 -0
- package/node_modules/fs-native-extensions/prebuilds/android-arm/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-arm/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-arm64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-arm64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-ia32/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-ia32/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-x64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-x64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/darwin-arm64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/darwin-arm64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/darwin-x64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/darwin-x64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/ios-arm64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/ios-arm64-simulator/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/ios-x64-simulator/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/linux-arm64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/linux-arm64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/linux-x64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/linux-x64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/win32-arm64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/win32-arm64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/win32-x64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/win32-x64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/src/apple.c +197 -0
- package/node_modules/fs-native-extensions/src/linux.c +146 -0
- package/node_modules/fs-native-extensions/src/platform.h +51 -0
- package/node_modules/fs-native-extensions/src/posix.c +33 -0
- package/node_modules/fs-native-extensions/src/shared.c +397 -0
- package/node_modules/fs-native-extensions/src/win32/nt.h +226 -0
- package/node_modules/fs-native-extensions/src/win32.c +531 -0
- package/node_modules/require-addon/LICENSE +201 -0
- package/node_modules/require-addon/README.md +19 -0
- package/node_modules/require-addon/lib/bare.js +1 -0
- package/node_modules/require-addon/lib/default.js +7 -0
- package/node_modules/require-addon/lib/node.js +79 -0
- package/node_modules/require-addon/package.json +64 -0
- package/node_modules/which-runtime/LICENSE +201 -0
- package/node_modules/which-runtime/README.md +29 -0
- package/node_modules/which-runtime/index.js +36 -0
- package/node_modules/which-runtime/package.json +32 -0
- package/package.json +9 -2
- package/release-notes.json +33 -0
- package/src/server/integrations/jira-comment.mjs +37 -0
- package/src/server/integrations/jira-move.mjs +37 -11
- package/src/server/integrations/jira-transition.mjs +43 -0
- package/src/server/integrations/jira-write-guard.mjs +218 -0
- package/src/server/integrations/jira.mjs +16 -0
- package/src/server/integrations/routes.mjs +70 -7
- package/src/server/static-cache.mjs +34 -16
- package/src/server/traffic-radar-wire.mjs +6 -0
- package/dist/web/assets/BrowserWatchModal-CSckhvRP.js +0 -1
- package/dist/web/assets/IntegrationModal-CT8_QnAx.js +0 -7
- package/dist/web/assets/RadioPanel-D3JLkVYu.js +0 -1
- package/dist/web/assets/TrafficRadar-Cuk5tXfL.js +0 -8
- package/dist/web/assets/UsageHistoryModal-DiEH73iz.js +0 -1
- package/dist/web/assets/app-BRaZrImF.js +0 -321
- package/dist/web/assets/app-DfGYllmZ.css +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "which-runtime",
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "Detect if you are in Bare or Node and which os etc",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"index.js"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"format": "prettier --write .",
|
|
11
|
+
"lint": "prettier --check . && lunte .",
|
|
12
|
+
"test": "npm run test:node && npm run test:bare",
|
|
13
|
+
"test:node": "brittle-node test.js",
|
|
14
|
+
"test:bare": "brittle-bare test.js"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/holepunchto/which-runtime.git"
|
|
19
|
+
},
|
|
20
|
+
"author": "Holepunch Inc.",
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/holepunchto/which-runtime/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/holepunchto/which-runtime",
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"brittle": "^3.0.0",
|
|
28
|
+
"lunte": "^1.4.0",
|
|
29
|
+
"prettier": "^3.6.2",
|
|
30
|
+
"prettier-config-holepunch": "^2.0.0"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccdeck",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.52.0",
|
|
4
4
|
"description": "Local dashboard for Claude Code and Codex CLI sessions: which Claude Code session needs input, every tool call and Claude Code subagent live, token cost and quota, several Claude accounts. Run npx ccdeck.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"test": "vitest run",
|
|
28
28
|
"prepublishOnly": "npm run build",
|
|
29
29
|
"prepack": "npm run build",
|
|
30
|
+
"i18n:missing": "node scripts/i18n-missing.mjs",
|
|
30
31
|
"typecheck": "tsc --noEmit -p tsconfig.build.json"
|
|
31
32
|
},
|
|
32
33
|
"engines": {
|
|
@@ -95,5 +96,11 @@
|
|
|
95
96
|
"typescript": "^5.6.3",
|
|
96
97
|
"vite": "^6.0.0",
|
|
97
98
|
"vitest": "^2.1.9"
|
|
98
|
-
}
|
|
99
|
+
},
|
|
100
|
+
"dependencies": {
|
|
101
|
+
"fs-native-extensions": "1.5.2"
|
|
102
|
+
},
|
|
103
|
+
"bundledDependencies": [
|
|
104
|
+
"fs-native-extensions"
|
|
105
|
+
]
|
|
99
106
|
}
|
package/release-notes.json
CHANGED
|
@@ -84,6 +84,8 @@
|
|
|
84
84
|
"without one."
|
|
85
85
|
],
|
|
86
86
|
"//summaries": {
|
|
87
|
+
"3.52.0": "ccdeck in nine more languages",
|
|
88
|
+
"3.51.0": "Jira integration updates",
|
|
87
89
|
"3.46.0": "Plans, accounts and skills at a glance"
|
|
88
90
|
},
|
|
89
91
|
"//nothing-to-say": [
|
|
@@ -129,6 +131,37 @@
|
|
|
129
131
|
"3.48.1",
|
|
130
132
|
"3.49.1"
|
|
131
133
|
],
|
|
134
|
+
"3.52.0": [
|
|
135
|
+
{
|
|
136
|
+
"title": "🌍 ccdeck in your language",
|
|
137
|
+
"body": "Choose Traditional or Simplified Chinese, German, Japanese, Korean, French, Spanish, Brazilian Portuguese or Romanian in Settings › General › Language. Until you choose, ccdeck follows your browser's language.",
|
|
138
|
+
"priority": "highlight",
|
|
139
|
+
"noticeLabel": "Language",
|
|
140
|
+
"notice": "What's new and text written by Jira, GitHub or GitLab stay as they were written, and anything without a translation shows in English."
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"title": "📅 Codex 30-day windows say what a day may cost",
|
|
144
|
+
"body": "A Codex window reported as 30 days is paced over its real length, and its pace note says what a day may cost to last until the reset."
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"3.51.0": [
|
|
148
|
+
{
|
|
149
|
+
"title": "✏️ Comment and change status in Jira",
|
|
150
|
+
"body": "Add a comment or change an issue’s status from its details in ccdeck.",
|
|
151
|
+
"priority": "highlight",
|
|
152
|
+
"noticeLabel": "Jira edits",
|
|
153
|
+
"notice": "Changes are sent to your connected Jira account and follow its permissions. Jira edits require a supported native build and filesystem; if safe coordination is unavailable, ccdeck refuses the edit and you can still browse your board."
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"title": "📍 Jira moves follow your selection",
|
|
157
|
+
"body": "Drag the issue you select, move completed issues between sprints, and place issues at the end by default.",
|
|
158
|
+
"priority": "highlight"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"title": "🛠️ Reduced memory use during long sessions",
|
|
162
|
+
"body": "ccdeck releases more unused memory, and Jira edits recover more reliably when a connection is interrupted."
|
|
163
|
+
}
|
|
164
|
+
],
|
|
132
165
|
"3.50.0": [
|
|
133
166
|
{
|
|
134
167
|
"title": "🤝 Paired decks no longer each read a shared account's usage",
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// A single comment, with no caller-selected upstream URL, visibility or fields.
|
|
2
|
+
import { errorFromFetchFailure, errorFromStatus, integrationError } from "./errors.mjs";
|
|
3
|
+
import { isSafeTarget, originOf } from "./proxy.mjs";
|
|
4
|
+
const KEY = /^[A-Z][A-Z0-9_]{0,40}-[1-9]\d{0,11}$/;
|
|
5
|
+
export const MAX_COMMENT_LENGTH = 10000;
|
|
6
|
+
|
|
7
|
+
// Cloud API v3 uses ADF; Server/DC API v2 accepts its native text format.
|
|
8
|
+
export function commentBody(text, cloud) {
|
|
9
|
+
if (!cloud) return text;
|
|
10
|
+
return { type: "doc", version: 1, content: text.split("\n").map(line => ({ type: "paragraph", ...(line ? { content: [{ type: "text", text: line }] } : {}) })) };
|
|
11
|
+
}
|
|
12
|
+
export function createJiraComment({ secret, origins, sign, authCheck, fetchImpl = globalThis.fetch, rest, cloud, invalidate }) {
|
|
13
|
+
return async (key, body, signal) => {
|
|
14
|
+
if (!KEY.test(key) || !body || typeof body !== "object" || Array.isArray(body) || Object.keys(body).length !== 1 || typeof body.text !== "string" || !body.text.trim() || body.text.length > MAX_COMMENT_LENGTH) {
|
|
15
|
+
throw integrationError("invalid", "Enter a comment of up to 10,000 characters.");
|
|
16
|
+
}
|
|
17
|
+
const url = `${rest}/issue/${encodeURIComponent(key)}/comment`;
|
|
18
|
+
if (!isSafeTarget(url) || !origins().includes(originOf(url))) throw integrationError("permission", "This Jira write is outside the connection's token origins.");
|
|
19
|
+
const controller = new AbortController();
|
|
20
|
+
const stop = () => controller.abort();
|
|
21
|
+
if (signal?.aborted) stop(); else signal?.addEventListener("abort", stop, { once: true });
|
|
22
|
+
const timer = setTimeout(stop, 15000); timer.unref?.();
|
|
23
|
+
let res;
|
|
24
|
+
try {
|
|
25
|
+
try { res = await fetchImpl(url, { method: "POST", redirect: "manual", headers: { Accept: "application/json", "Content-Type": "application/json", "User-Agent": "ccdeck", ...sign(secret) }, body: JSON.stringify({ body: commentBody(body.text, cloud) }), signal: controller.signal }); }
|
|
26
|
+
catch (err) { const failure = errorFromFetchFailure(err, "Jira"); failure.message = "The comment could not be confirmed. Refresh the issue before sending again."; throw failure; }
|
|
27
|
+
if (res.status >= 300 && res.status < 400) throw integrationError("upstream", "Jira redirected the comment. Refresh the issue before sending again.");
|
|
28
|
+
const refused = authCheck(res.headers, secret);
|
|
29
|
+
if (refused) throw integrationError("expired", refused, { status: 401 });
|
|
30
|
+
if (res.status !== 201) {
|
|
31
|
+
if (!res.ok && res.status < 500) throw errorFromStatus(res.status, res.headers, { label: "Jira" });
|
|
32
|
+
throw integrationError("upstream", "The comment could not be confirmed. Refresh the issue before sending again.");
|
|
33
|
+
}
|
|
34
|
+
return { status: 200, body: { ok: true, issueKey: key } };
|
|
35
|
+
} finally { invalidate(); clearTimeout(timer); signal?.removeEventListener("abort", stop); await res?.body?.cancel().catch(() => {}); }
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -14,7 +14,7 @@ const only = (v, keys) => object(v) && Object.keys(v).every(k => keys.includes(k
|
|
|
14
14
|
const invalid = message => integrationError("invalid", message);
|
|
15
15
|
|
|
16
16
|
export function parseJiraMove(body) {
|
|
17
|
-
if (!only(body, ["issueKey", "issueKeys", "target", "beforeIssue", "afterIssue"]) || Object.hasOwn(body, "issueKey") === Object.hasOwn(body, "issueKeys")) {
|
|
17
|
+
if (!only(body, ["issueKey", "issueKeys", "target", "beforeIssue", "afterIssue", "atEnd"]) || Object.hasOwn(body, "issueKey") === Object.hasOwn(body, "issueKeys")) {
|
|
18
18
|
throw invalid("Supply either one issueKey or 2–50 ordered issueKeys and a sprint or backlog target.");
|
|
19
19
|
}
|
|
20
20
|
const key = value => typeof value === "string" && value === value.trim() && KEY.test(value) ? value : null;
|
|
@@ -27,10 +27,10 @@ export function parseJiraMove(body) {
|
|
|
27
27
|
!(t.kind === "backlog" || (t.kind === "sprint" && positiveId(t.sprintId)))) throw invalid("Not a valid issue key or move target.");
|
|
28
28
|
const beforeIssue = Object.hasOwn(body, "beforeIssue") ? key(body.beforeIssue) : undefined;
|
|
29
29
|
const afterIssue = Object.hasOwn(body, "afterIssue") ? key(body.afterIssue) : undefined;
|
|
30
|
-
if (beforeIssue === null || afterIssue === null || (beforeIssue && afterIssue) || issueKeys.includes(beforeIssue) || issueKeys.includes(afterIssue)) {
|
|
30
|
+
if ((Object.hasOwn(body, "atEnd") && body.atEnd !== true) || (body.atEnd && (beforeIssue || afterIssue)) || beforeIssue === null || afterIssue === null || (beforeIssue && afterIssue) || issueKeys.includes(beforeIssue) || issueKeys.includes(afterIssue)) {
|
|
31
31
|
throw invalid("Use at most one other issue as the rank anchor.");
|
|
32
32
|
}
|
|
33
|
-
return { issueKeys: issueKeys.slice(), batch, target: t.kind === "sprint" ? { kind: "sprint", sprintId: t.sprintId } : { kind: "backlog" }, beforeIssue, afterIssue };
|
|
33
|
+
return { issueKeys: issueKeys.slice(), batch, target: t.kind === "sprint" ? { kind: "sprint", sprintId: t.sprintId } : { kind: "backlog" }, beforeIssue, afterIssue, atEnd: body.atEnd === true };
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/** Conservative support, not a claim about the token's write permissions. */
|
|
@@ -115,8 +115,8 @@ export function createJiraMover({ secret, origins, sign, authCheck, fetchImpl =
|
|
|
115
115
|
|
|
116
116
|
return async (boardId, input, signal) => {
|
|
117
117
|
const move = parseJiraMove(input);
|
|
118
|
-
const { issueKeys, batch, target, beforeIssue, afterIssue } = move;
|
|
119
|
-
|
|
118
|
+
const { issueKeys, batch, target, beforeIssue, afterIssue, atEnd } = move;
|
|
119
|
+
let anchor = beforeIssue ?? afterIssue;
|
|
120
120
|
const read = reader(signal);
|
|
121
121
|
const outcomes = new Map(issueKeys.map(key => [key, { membership: "unchanged", rank: "unchanged" }]));
|
|
122
122
|
let attempted = false;
|
|
@@ -153,8 +153,11 @@ export function createJiraMover({ secret, origins, sign, authCheck, fetchImpl =
|
|
|
153
153
|
// Match Jira's issue normalizer, including renamed epic-level types.
|
|
154
154
|
const type = issue.fields?.issuetype;
|
|
155
155
|
const epic = type?.hierarchyLevel === 1 || /^epic$/i.test(String(type?.name ?? ""));
|
|
156
|
-
if (issueKeys.includes(key) && (epic || !["new", "indeterminate"].includes(issue.fields?.status?.statusCategory?.key))) {
|
|
157
|
-
throw invalid("Only
|
|
156
|
+
if (issueKeys.includes(key) && (epic || !["new", "indeterminate", "done"].includes(issue.fields?.status?.statusCategory?.key))) {
|
|
157
|
+
throw invalid("Only top-level non-epic issues with a known status can be moved.");
|
|
158
|
+
}
|
|
159
|
+
if (issueKeys.includes(key) && target.kind === "backlog" && issue.fields?.status?.statusCategory?.key === "done") {
|
|
160
|
+
throw invalid("Done issues cannot be moved to the backlog because Jira hides them there. Change the status first.");
|
|
158
161
|
}
|
|
159
162
|
}
|
|
160
163
|
const sources = new Map();
|
|
@@ -188,6 +191,25 @@ export function createJiraMover({ secret, origins, sign, authCheck, fetchImpl =
|
|
|
188
191
|
const found = await readIssues(groupSuffix(group), keys, "issuetype");
|
|
189
192
|
if (keys.some(key => !found.has(key))) throw invalid("An issue's source changed or is a closed sprint. Refresh the board.");
|
|
190
193
|
}
|
|
194
|
+
if (atEnd) {
|
|
195
|
+
// Read Jira's full destination order, never a filtered or partial UI list.
|
|
196
|
+
// Jira's board endpoints are rank-ordered by default. Ask for the
|
|
197
|
+
// reverse order and find the first top-level issue outside this batch.
|
|
198
|
+
let complete = false;
|
|
199
|
+
for (let startAt = 0, page = 0; page < 200; page++) {
|
|
200
|
+
const q = new URLSearchParams({ jql: "ORDER BY Rank DESC", fields: "issuetype", startAt: String(startAt), maxResults: "50" });
|
|
201
|
+
const result = await read.json(`${agile}/board/${boardId}/${groupSuffix(target)}?${q}`);
|
|
202
|
+
if (!Array.isArray(result?.issues)) throw invalid("Could not determine the destination's last issue. Refresh and try again.");
|
|
203
|
+
const values = result.issues;
|
|
204
|
+
if (values.some(i => !KEY.test(i?.key ?? "") || typeof i.fields?.issuetype?.subtask !== "boolean")) throw invalid("Could not verify the destination order. Refresh and try again.");
|
|
205
|
+
if (!values.length && Number.isInteger(result.total) && startAt < result.total) throw invalid("Could not verify the destination order. Refresh and try again.");
|
|
206
|
+
const last = values.find(i => KEY.test(i?.key ?? "") && i.fields?.issuetype?.subtask === false && !issueKeys.includes(i.key));
|
|
207
|
+
if (last) { anchor = last.key; complete = true; break; }
|
|
208
|
+
if (result.isLast === true || values.length === 0 || (Number.isInteger(result.total) && startAt + values.length >= result.total)) { complete = true; break; }
|
|
209
|
+
startAt += values.length;
|
|
210
|
+
}
|
|
211
|
+
if (!complete) throw invalid("The destination is too large to determine the last issue. Refresh and try again.");
|
|
212
|
+
}
|
|
191
213
|
if (anchor && !(await readIssues(groupSuffix(target), [anchor], "issuetype")).has(anchor)) throw invalid("The rank anchor must be in the target group. Refresh the board.");
|
|
192
214
|
const needed = issueKeys.filter(key => !sameGroup(sources.get(key)));
|
|
193
215
|
if (needed.length) {
|
|
@@ -197,13 +219,17 @@ export function createJiraMover({ secret, origins, sign, authCheck, fetchImpl =
|
|
|
197
219
|
await write(suffix, "POST", { issues: needed }, needed, signal);
|
|
198
220
|
for (const key of needed) outcomes.get(key).membership = "moved";
|
|
199
221
|
}
|
|
222
|
+
// With no outside anchor, the destination contains only this batch (or
|
|
223
|
+
// is empty). Once membership is set, order the rest after its first item.
|
|
224
|
+
const rankKeys = !anchor && atEnd && issueKeys.length > 1 ? issueKeys.slice(1) : issueKeys;
|
|
225
|
+
if (!anchor && atEnd && rankKeys !== issueKeys) anchor = issueKeys[0];
|
|
200
226
|
if (anchor) {
|
|
201
227
|
stage = "rank";
|
|
202
228
|
attempted = true;
|
|
203
|
-
pendingKeys =
|
|
204
|
-
await write("issue/rank", "PUT", { issues:
|
|
205
|
-
...(beforeIssue ? { rankBeforeIssue: beforeIssue } : { rankAfterIssue:
|
|
206
|
-
for (const key of
|
|
229
|
+
pendingKeys = rankKeys;
|
|
230
|
+
await write("issue/rank", "PUT", { issues: rankKeys, rankCustomFieldId: capability.rankCustomFieldId,
|
|
231
|
+
...(beforeIssue ? { rankBeforeIssue: beforeIssue } : { rankAfterIssue: anchor }) }, rankKeys, signal);
|
|
232
|
+
for (const key of rankKeys) outcomes.get(key).rank = "ranked";
|
|
207
233
|
}
|
|
208
234
|
return { status: 200, body: { ok: true, ...(batch ? { issueKeys } : { issueKey: issueKeys[0] }), target, refresh: true } };
|
|
209
235
|
} catch (err) {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// A bounded Jira workflow transition. Never accept a URL or arbitrary fields.
|
|
2
|
+
import { errorFromFetchFailure, errorFromStatus, integrationError } from './errors.mjs';
|
|
3
|
+
import { isSafeTarget, originOf } from './proxy.mjs';
|
|
4
|
+
|
|
5
|
+
const keyPattern = /^[A-Z][A-Z0-9_]{0,40}-[1-9]\d{0,11}$/;
|
|
6
|
+
const idPattern = /^[0-9]{1,12}$/;
|
|
7
|
+
export async function jiraTransitions(read, rest, key) {
|
|
8
|
+
if (!keyPattern.test(key)) throw integrationError('invalid', 'Not an issue key.');
|
|
9
|
+
const result = await read.json(`${rest}/issue/${encodeURIComponent(key)}/transitions?expand=transitions.fields`);
|
|
10
|
+
if (!Array.isArray(result?.transitions)) throw integrationError('upstream', 'Jira did not return its available transitions.');
|
|
11
|
+
return result.transitions.slice(0, 100).filter(t => typeof t.id === 'string' && idPattern.test(t.id) && typeof t.name === 'string' && t.name.trim())
|
|
12
|
+
.map(t => ({ id: t.id, name: t.name.slice(0, 120), to: typeof t.to?.name === 'string' ? t.to.name.slice(0, 120) : '',
|
|
13
|
+
requiresScreen: t.hasScreen === true || Object.values(t.fields ?? {}).some(f => f?.required === true) }));
|
|
14
|
+
}
|
|
15
|
+
export function createJiraTransition({ secret, origins, sign, authCheck, fetchImpl = globalThis.fetch, reader, rest, invalidate }) {
|
|
16
|
+
return async (key, body, signal) => {
|
|
17
|
+
if (!keyPattern.test(key) || !body || typeof body !== 'object' || Array.isArray(body) || Object.keys(body).length !== 1 || typeof body.transitionId !== 'string' || !idPattern.test(body.transitionId)) throw integrationError('invalid', 'Choose a valid transition.');
|
|
18
|
+
const choices = await jiraTransitions(reader(signal), rest, key);
|
|
19
|
+
const choice = choices.find(t => t.id === body.transitionId);
|
|
20
|
+
if (!choice || choice.requiresScreen) throw integrationError('invalid', 'This transition is unavailable or requires additional fields in Jira.');
|
|
21
|
+
const url = `${rest}/issue/${encodeURIComponent(key)}/transitions`;
|
|
22
|
+
if (!isSafeTarget(url) || !origins().includes(originOf(url))) throw integrationError('permission', 'This Jira write is outside the connection’s token origins.');
|
|
23
|
+
const controller = new AbortController();
|
|
24
|
+
const stop = () => controller.abort();
|
|
25
|
+
if (signal?.aborted) stop(); else signal?.addEventListener('abort', stop, { once: true });
|
|
26
|
+
const timer = setTimeout(stop, 15000); timer.unref?.();
|
|
27
|
+
let res;
|
|
28
|
+
try {
|
|
29
|
+
try { res = await fetchImpl(url, { method: 'POST', redirect: 'manual', headers: { Accept: 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'ccdeck', ...sign(secret) }, body: JSON.stringify({ transition: { id: choice.id } }), signal: controller.signal }); }
|
|
30
|
+
catch (err) { throw errorFromFetchFailure(err, 'Jira'); }
|
|
31
|
+
if (res.status >= 300 && res.status < 400) throw integrationError('upstream', 'Jira redirected the transition. Refresh the issue before trying again.');
|
|
32
|
+
const refused = authCheck(res.headers, secret);
|
|
33
|
+
if (refused) throw integrationError('expired', refused, { status: 401 });
|
|
34
|
+
if (res.status !== 204) {
|
|
35
|
+
if (!res.ok) throw errorFromStatus(res.status, res.headers, { label: 'Jira' });
|
|
36
|
+
throw integrationError('upstream', 'Jira did not confirm the transition. Refresh the issue.');
|
|
37
|
+
}
|
|
38
|
+
return { status: 200, body: { ok: true, issueKey: key } };
|
|
39
|
+
} finally {
|
|
40
|
+
invalidate(); clearTimeout(timer); signal?.removeEventListener('abort', stop); await res?.body?.cancel().catch(() => {});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// Durable per-scope reservations. Only the small allowlisted record is stored.
|
|
2
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
3
|
+
import { chmod, link, mkdir, open, readFile, readdir, unlink } from 'node:fs/promises';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { createConnection, createServer } from 'node:net';
|
|
6
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
7
|
+
import { createRequire } from 'node:module';
|
|
8
|
+
import { dirname } from 'node:path';
|
|
9
|
+
import { integrationError } from './errors.mjs';
|
|
10
|
+
import { deckDataDir } from '../deck-home.mjs';
|
|
11
|
+
import { createTemp, renameWithRetry } from '../atomic-write.mjs';
|
|
12
|
+
import { STORE_DIR } from './store.mjs';
|
|
13
|
+
|
|
14
|
+
const require = createRequire(import.meta.url);
|
|
15
|
+
let binding;
|
|
16
|
+
function nativeLock() {
|
|
17
|
+
if (!binding) {
|
|
18
|
+
// The exact dependency version pins this N-API layout and ABI. Loading the
|
|
19
|
+
// shipped binding directly avoids its resolver's Node 20-only Array.with.
|
|
20
|
+
// Keep this lazy so unsupported targets can still run the read-only deck.
|
|
21
|
+
const root = dirname(require.resolve('fs-native-extensions/package.json'));
|
|
22
|
+
binding = require(join(root, 'prebuilds', `${process.platform}-${process.arch}`, 'fs-native-extensions.node'));
|
|
23
|
+
}
|
|
24
|
+
return binding;
|
|
25
|
+
}
|
|
26
|
+
const nativeLocks = {
|
|
27
|
+
tryLock(fd) {
|
|
28
|
+
try { nativeLock().tryLock(fd, 0, 0, true); return true; }
|
|
29
|
+
catch (err) { if (err.code === 'EAGAIN') return false; throw err; }
|
|
30
|
+
},
|
|
31
|
+
unlock(fd) { nativeLock().unlock(fd, 0, 0); },
|
|
32
|
+
};
|
|
33
|
+
const active = new Set();
|
|
34
|
+
const listeners = new Map();
|
|
35
|
+
const keyPattern = /^[A-Z][A-Z0-9_]{0,40}-[1-9]\d{0,11}$/;
|
|
36
|
+
const uuidPattern = /^[0-9a-f-]{36}$/;
|
|
37
|
+
const scope = record => createHash('sha256').update(JSON.stringify([record.connectionId, record.kind, record.kind === 'move' ? '' : record.issueKey])).digest('hex');
|
|
38
|
+
const alive = pid => { try { process.kill(pid, 0); return true; } catch (e) { return e.code !== 'ESRCH'; } };
|
|
39
|
+
|
|
40
|
+
// Ephemeral sockets identify live writers without trusting reusable PIDs.
|
|
41
|
+
// Scope synchronization uses OS file locks below, never a fixed TCP port.
|
|
42
|
+
function listen(port, handler = socket => socket.destroy()) {
|
|
43
|
+
return new Promise((resolve, reject) => {
|
|
44
|
+
const server = createServer(handler);
|
|
45
|
+
server.once('error', reject);
|
|
46
|
+
server.listen({ port, host: '127.0.0.1', exclusive: true }, () => {
|
|
47
|
+
server.removeListener('error', reject);
|
|
48
|
+
resolve(server);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const close = server => new Promise((resolve, reject) => server.close(err => err ? reject(err) : resolve()));
|
|
53
|
+
async function startMarker(op) {
|
|
54
|
+
const token = randomUUID();
|
|
55
|
+
let server;
|
|
56
|
+
do {
|
|
57
|
+
server = await listen(0, socket => {
|
|
58
|
+
socket.setTimeout(1000, () => socket.destroy());
|
|
59
|
+
socket.end(token);
|
|
60
|
+
});
|
|
61
|
+
} while (!server);
|
|
62
|
+
server.unref();
|
|
63
|
+
listeners.set(op.operationId, server);
|
|
64
|
+
return { port: server.address().port, token };
|
|
65
|
+
}
|
|
66
|
+
async function stopMarker(op) {
|
|
67
|
+
const server = listeners.get(op.operationId);
|
|
68
|
+
if (server) { listeners.delete(op.operationId); await close(server); }
|
|
69
|
+
}
|
|
70
|
+
function markerAlive(marker) {
|
|
71
|
+
return new Promise(resolve => {
|
|
72
|
+
let data = '';
|
|
73
|
+
let settled = false;
|
|
74
|
+
const socket = createConnection({ host: '127.0.0.1', port: marker.port });
|
|
75
|
+
const done = value => { if (!settled) { settled = true; socket.destroy(); resolve(value); } };
|
|
76
|
+
// Ambiguous failures are treated as live; never acknowledge on a timeout.
|
|
77
|
+
socket.setTimeout(1000, () => done(true));
|
|
78
|
+
socket.on('data', chunk => { data += chunk.toString(); if (data.length >= marker.token.length) done(data === marker.token); });
|
|
79
|
+
socket.on('end', () => done(data === marker.token));
|
|
80
|
+
socket.on('error', err => done(err.code !== 'ECONNREFUSED'));
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function createJiraWriteGuard({ dir = () => join(deckDataDir(), STORE_DIR, 'jira-write-guard'), locks = nativeLocks } = {}) {
|
|
85
|
+
async function prepare() {
|
|
86
|
+
const root = dir();
|
|
87
|
+
await mkdir(root, { recursive: true, mode: 0o700 });
|
|
88
|
+
if (process.platform !== 'win32') await chmod(root, 0o700);
|
|
89
|
+
return root;
|
|
90
|
+
}
|
|
91
|
+
async function syncDir(root) {
|
|
92
|
+
// Windows does not support opening directories for fsync.
|
|
93
|
+
if (process.platform === 'win32') return;
|
|
94
|
+
const h = await open(root, 'r'); try { await h.sync(); } finally { await h.close(); }
|
|
95
|
+
}
|
|
96
|
+
async function read(path) {
|
|
97
|
+
try { return JSON.parse(await readFile(path, 'utf8')); }
|
|
98
|
+
catch (e) { if (e.code === 'ENOENT') return null; throw e; }
|
|
99
|
+
}
|
|
100
|
+
async function running(root, op) {
|
|
101
|
+
if (active.has(op.operationId)) return true;
|
|
102
|
+
const names = await readdir(root);
|
|
103
|
+
const prefix = `running-${op.operationId}-`;
|
|
104
|
+
for (const name of names.filter(name => name.startsWith(prefix))) {
|
|
105
|
+
const marker = await read(join(root, name)).catch(err => {
|
|
106
|
+
// Older releases used empty PID-only marker files. Preserve their
|
|
107
|
+
// conservative behaviour while those processes may still be running.
|
|
108
|
+
if (err instanceof SyntaxError) return null;
|
|
109
|
+
throw err;
|
|
110
|
+
});
|
|
111
|
+
if (marker && Number.isInteger(marker.port) && marker.port > 0 && marker.port <= 65535 && typeof marker.token === 'string' && uuidPattern.test(marker.token)) {
|
|
112
|
+
if (await markerAlive(marker)) return true;
|
|
113
|
+
} else if (alive(Number(name.slice(prefix.length)))) return true;
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
async function state(root, op) { return { ...op, state: await running(root, op) ? 'pending' : op.state === 'confirmed' ? 'confirmed' : 'uncertain' }; }
|
|
118
|
+
async function lock(root, op, fn) {
|
|
119
|
+
// Keep the inode forever: unlinking/replacing a locked file would allow
|
|
120
|
+
// two processes to lock different inodes for the same scope. The kernel
|
|
121
|
+
// releases ownership on descriptor close or process death, not file age.
|
|
122
|
+
const handle = await open(join(root, `lock-${scope(op)}`), 'a+', 0o600);
|
|
123
|
+
let acquired = false;
|
|
124
|
+
try {
|
|
125
|
+
while (!(acquired = locks.tryLock(handle.fd))) await delay(10);
|
|
126
|
+
return await fn();
|
|
127
|
+
} finally {
|
|
128
|
+
try { if (acquired) locks.unlock(handle.fd); }
|
|
129
|
+
finally { await handle.close(); }
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
async begin(input) {
|
|
134
|
+
const { connectionId, kind } = input;
|
|
135
|
+
if (typeof connectionId !== 'string' || !connectionId || connectionId.length > 64 || !['comment', 'status', 'move'].includes(kind)) throw new Error('Invalid guard scope');
|
|
136
|
+
const op = { connectionId, kind, ...(kind === 'move' ? { boardId: input.boardId, issueKeys: input.issueKeys } : { issueKey: input.issueKey }), operationId: randomUUID(), state: 'pending' };
|
|
137
|
+
if (kind === 'move' ? typeof op.boardId !== 'string' || !/^[1-9]\d{0,11}$/.test(op.boardId) || !Array.isArray(op.issueKeys) || op.issueKeys.length < 1 || op.issueKeys.length > 50 || op.issueKeys.some(k => !keyPattern.test(k)) : !keyPattern.test(op.issueKey)) throw new Error('Invalid guard issue keys');
|
|
138
|
+
const root = await prepare();
|
|
139
|
+
// Check the actual filesystem and native support before any Jira write.
|
|
140
|
+
try { await lock(root, op, async () => {}); }
|
|
141
|
+
catch { throw integrationError('unavailable', 'Jira writes are unavailable because this system cannot safely coordinate them.'); }
|
|
142
|
+
const path = join(root, `${scope(op)}.json`);
|
|
143
|
+
const marker = join(root, `running-${op.operationId}-${process.pid}`);
|
|
144
|
+
const temp = join(root, `tmp-${op.operationId}`);
|
|
145
|
+
let returned = false;
|
|
146
|
+
active.add(op.operationId);
|
|
147
|
+
try {
|
|
148
|
+
const identity = await startMarker(op);
|
|
149
|
+
const markerHandle = await open(marker, 'wx', 0o600);
|
|
150
|
+
try { await markerHandle.writeFile(JSON.stringify(identity)); } finally { await markerHandle.close(); }
|
|
151
|
+
const h = await open(temp, 'wx', 0o600);
|
|
152
|
+
try { await h.writeFile(JSON.stringify(op)); await h.sync(); } finally { await h.close(); }
|
|
153
|
+
try { await link(temp, path); }
|
|
154
|
+
catch (e) {
|
|
155
|
+
if (e.code !== 'EEXIST') throw e;
|
|
156
|
+
const existing = await read(path);
|
|
157
|
+
if (!existing) return await this.begin(input);
|
|
158
|
+
return { conflict: await state(root, existing) };
|
|
159
|
+
}
|
|
160
|
+
await syncDir(root);
|
|
161
|
+
returned = true;
|
|
162
|
+
return { operation: { ...op, state: 'pending' } };
|
|
163
|
+
} finally {
|
|
164
|
+
await unlink(temp).catch(() => {});
|
|
165
|
+
if (!returned) { active.delete(op.operationId); await stopMarker(op); await unlink(marker).catch(() => {}); }
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
async finish(op, outcome) {
|
|
169
|
+
const root = await prepare();
|
|
170
|
+
try {
|
|
171
|
+
if (outcome === true || outcome === 'confirmed') {
|
|
172
|
+
const result = await lock(root, op, async () => {
|
|
173
|
+
const path = join(root, `${scope(op)}.json`);
|
|
174
|
+
const current = await read(path);
|
|
175
|
+
if (current?.operationId !== op.operationId) return { ok: false };
|
|
176
|
+
if (outcome === true) await unlink(path);
|
|
177
|
+
else {
|
|
178
|
+
const { tmp, handle } = await createTemp(path, { mode: 0o600 });
|
|
179
|
+
try {
|
|
180
|
+
try { await handle.writeFile(JSON.stringify({ ...current, state: 'confirmed' })); await handle.sync(); }
|
|
181
|
+
finally { await handle.close(); }
|
|
182
|
+
await renameWithRetry(tmp, path);
|
|
183
|
+
} finally { await unlink(tmp).catch(() => {}); }
|
|
184
|
+
}
|
|
185
|
+
await syncDir(root);
|
|
186
|
+
return { ok: true };
|
|
187
|
+
});
|
|
188
|
+
if (!result.ok) throw new Error('Jira write guard could not finalize the operation');
|
|
189
|
+
}
|
|
190
|
+
} finally {
|
|
191
|
+
active.delete(op.operationId);
|
|
192
|
+
await stopMarker(op);
|
|
193
|
+
await unlink(join(root, `running-${op.operationId}-${process.pid}`)).catch(() => {});
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
async list(connectionId) {
|
|
197
|
+
const root = await prepare();
|
|
198
|
+
const names = (await readdir(root)).filter(n => /^[a-f0-9]{64}\.json$/.test(n));
|
|
199
|
+
const records = await Promise.all(names.map(n => read(join(root, n))));
|
|
200
|
+
return Promise.all(records.filter(x => x?.connectionId === connectionId).map(x => state(root, x)));
|
|
201
|
+
},
|
|
202
|
+
async acknowledge(connectionId, operationId) {
|
|
203
|
+
if (typeof operationId !== 'string' || !uuidPattern.test(operationId)) return { ok: false };
|
|
204
|
+
const root = await prepare();
|
|
205
|
+
const op = (await this.list(connectionId)).find(x => x.operationId === operationId);
|
|
206
|
+
if (!op) return { ok: false };
|
|
207
|
+
return lock(root, op, async () => {
|
|
208
|
+
const path = join(root, `${scope(op)}.json`);
|
|
209
|
+
const current = await read(path);
|
|
210
|
+
if (!current || current.operationId !== operationId) return { ok: false };
|
|
211
|
+
if (await running(root, current)) return { conflict: await state(root, current) };
|
|
212
|
+
await unlink(path); await syncDir(root);
|
|
213
|
+
return { ok: true };
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
export const jiraWriteGuard = createJiraWriteGuard();
|
|
@@ -29,6 +29,8 @@ import { errorResponse, integrationError, IntegrationError } from "./errors.mjs"
|
|
|
29
29
|
import { createProxy, fetchImage, isLocalHost, isSafeTarget, normaliseBaseUrl, originOf } from "./proxy.mjs";
|
|
30
30
|
import { createRouter } from "./registry.mjs";
|
|
31
31
|
import { createJiraMover, readJiraMoveCapability } from "./jira-move.mjs";
|
|
32
|
+
import { createJiraTransition, jiraTransitions } from "./jira-transition.mjs";
|
|
33
|
+
import { createJiraComment } from "./jira-comment.mjs";
|
|
32
34
|
|
|
33
35
|
export const MIN_SERVER_VERSION = [8, 14, 0];
|
|
34
36
|
const ATLASSIAN_API = "https://api.atlassian.com";
|
|
@@ -875,6 +877,8 @@ export function registerJiraRoutes(router) {
|
|
|
875
877
|
};
|
|
876
878
|
});
|
|
877
879
|
|
|
880
|
+
router.get("issue/:key/transitions", async ctx => ({ transitions: await jiraTransitions(ctx.client, restBase(ctx.conn), issueKey(ctx.params)) }));
|
|
881
|
+
|
|
878
882
|
/** Every subtask of one issue, whoever has it. */
|
|
879
883
|
router.get("issue/:key/subtasks", async ctx => {
|
|
880
884
|
const key = issueKey(ctx.params);
|
|
@@ -982,6 +986,8 @@ export function createJiraClient(conn, secret, { fetchImpl, apiOrigin } = {}) {
|
|
|
982
986
|
conn,
|
|
983
987
|
get cache() { return cache; },
|
|
984
988
|
moveIssue,
|
|
989
|
+
addComment: createJiraComment({ secret, origins: () => origins.slice(), sign: signJira, authCheck: jiraAuthCheck, fetchImpl, rest: restBase(conn), cloud: isCloud(conn), invalidate: () => { cache = createCache(); } }),
|
|
990
|
+
transitionIssue: createJiraTransition({ secret, origins: () => origins.slice(), sign: signJira, authCheck: jiraAuthCheck, fetchImpl, reader: signal => ({ json: (url, opts = {}) => reader().json(url, { ...opts, signal }) }), rest: restBase(conn), invalidate: () => { cache = createCache(); } }),
|
|
985
991
|
get allowedOrigins() { return origins.slice(); },
|
|
986
992
|
async validate({ phase = "validate", signal } = {}) {
|
|
987
993
|
const result = await validateJira(conn, secret, { phase, signal, client: list => proxy(list, phase, signal) }, { apiOrigin });
|
|
@@ -1018,6 +1024,16 @@ export async function jiraRoutes(client, method, subpath, searchParams, _req, {
|
|
|
1018
1024
|
try { return await client.moveIssue(move[1], moveBody, signal); }
|
|
1019
1025
|
catch (err) { return errorResponse(err); }
|
|
1020
1026
|
}
|
|
1027
|
+
const transition = /^issue\/([A-Z][A-Z0-9_]{0,40}-[1-9]\d{0,11})\/transitions$/.exec(subpath);
|
|
1028
|
+
if (method === "POST" && transition) {
|
|
1029
|
+
if ([...searchParams].length) return errorResponse(integrationError("invalid", "Transition parameters belong in the JSON body."));
|
|
1030
|
+
try { return await client.transitionIssue(transition[1], moveBody, signal); } catch (err) { return errorResponse(err); }
|
|
1031
|
+
}
|
|
1032
|
+
const comment = /^issue\/([A-Z][A-Z0-9_]{0,40}-[1-9]\d{0,11})\/comment$/.exec(subpath);
|
|
1033
|
+
if (method === "POST" && comment) {
|
|
1034
|
+
if ([...searchParams].length) return errorResponse(integrationError("invalid", "Comment parameters belong in the JSON body."));
|
|
1035
|
+
try { return await client.addComment(comment[1], moveBody, signal); } catch (err) { return errorResponse(err); }
|
|
1036
|
+
}
|
|
1021
1037
|
if (method !== "GET" && method !== "HEAD") return errorResponse(integrationError("invalid", "That Jira operation is not supported."));
|
|
1022
1038
|
const route = jiraRouter.find(subpath);
|
|
1023
1039
|
if (!route) return errorResponse(integrationError("not-found", "No such Jira read."));
|