spur-board 0.38.0 → 0.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/daemon.mjs +121 -89
- package/package.json +1 -1
package/dist/daemon.mjs
CHANGED
|
@@ -14522,6 +14522,26 @@ function retryAt(headers, now) {
|
|
|
14522
14522
|
if (!Number.isNaN(at)) return new Date(at);
|
|
14523
14523
|
}
|
|
14524
14524
|
}
|
|
14525
|
+
/** Longest a GitHub or Jira request may take, body read included. */
|
|
14526
|
+
const REQUEST_TIMEOUT_MS$1 = 3e4;
|
|
14527
|
+
/**
|
|
14528
|
+
* Runs one request under `signal` and a {@link REQUEST_TIMEOUT_MS} timer. A timeout rejects as a
|
|
14529
|
+
* `transient` error with `message`; a caller abort passes through unchanged.
|
|
14530
|
+
*/
|
|
14531
|
+
async function withTimeout(signal, message, work) {
|
|
14532
|
+
const timer = new AbortController();
|
|
14533
|
+
const handle = setTimeout(() => {
|
|
14534
|
+
timer.abort(new DOMException(message, "TimeoutError"));
|
|
14535
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
14536
|
+
try {
|
|
14537
|
+
return await work(AbortSignal.any([signal, timer.signal]));
|
|
14538
|
+
} catch (cause) {
|
|
14539
|
+
if (timer.signal.aborted && !signal.aborted) throw new AdapterError("transient", message, { cause });
|
|
14540
|
+
throw cause;
|
|
14541
|
+
} finally {
|
|
14542
|
+
clearTimeout(handle);
|
|
14543
|
+
}
|
|
14544
|
+
}
|
|
14525
14545
|
//#endregion
|
|
14526
14546
|
//#region ../adapters/src/github/client.ts
|
|
14527
14547
|
const MALFORMED$3 = "Malformed GitHub response";
|
|
@@ -14595,36 +14615,42 @@ var GithubClient = class {
|
|
|
14595
14615
|
this.fetcher = fetcher;
|
|
14596
14616
|
}
|
|
14597
14617
|
async query(query, variables, signal) {
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14618
|
+
const { response, body } = await withTimeout(signal, "GitHub request timed out", async (timed) => {
|
|
14619
|
+
let response;
|
|
14620
|
+
try {
|
|
14621
|
+
response = await this.fetcher("https://api.github.com/graphql", {
|
|
14622
|
+
method: "POST",
|
|
14623
|
+
signal: timed,
|
|
14624
|
+
headers: {
|
|
14625
|
+
authorization: `Bearer ${this.token}`,
|
|
14626
|
+
"content-type": "application/json",
|
|
14627
|
+
accept: "application/vnd.github+json"
|
|
14628
|
+
},
|
|
14629
|
+
body: JSON.stringify({
|
|
14630
|
+
query,
|
|
14631
|
+
variables
|
|
14632
|
+
})
|
|
14633
|
+
});
|
|
14634
|
+
} catch (cause) {
|
|
14635
|
+
if (timed.aborted) throw cause;
|
|
14636
|
+
throw new AdapterError("transient", "GitHub request failed", { cause });
|
|
14637
|
+
}
|
|
14638
|
+
if (!response.ok) throw classifyHttpFailure({
|
|
14639
|
+
status: response.status,
|
|
14640
|
+
headers: response.headers,
|
|
14641
|
+
body: await response.text()
|
|
14642
|
+
}, this.now());
|
|
14643
|
+
let body;
|
|
14644
|
+
try {
|
|
14645
|
+
body = await response.json();
|
|
14646
|
+
} catch (cause) {
|
|
14647
|
+
throw new AdapterError("transient", MALFORMED$3, { cause });
|
|
14648
|
+
}
|
|
14649
|
+
return {
|
|
14650
|
+
response,
|
|
14651
|
+
body
|
|
14652
|
+
};
|
|
14653
|
+
});
|
|
14628
14654
|
const wire = parseWire(envelopeWire, body, MALFORMED$3);
|
|
14629
14655
|
const errors = wire.errors ?? [];
|
|
14630
14656
|
if (errors.some((error) => error.type === "RATE_LIMITED" || /rate limit/i.test(error.message))) throw classifyHttpFailure({
|
|
@@ -15517,38 +15543,40 @@ function createGithubIssuesAdapter(options) {
|
|
|
15517
15543
|
if (!owner || !name) throw new AdapterError("config", "Invalid GitHub Issues repository");
|
|
15518
15544
|
const root = `https://api.github.com/repos/${owner}/${name}`;
|
|
15519
15545
|
async function request(url, signal) {
|
|
15520
|
-
|
|
15521
|
-
|
|
15522
|
-
|
|
15523
|
-
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15546
|
+
return withTimeout(signal, "GitHub issue request timed out", async (timed) => {
|
|
15547
|
+
let response;
|
|
15548
|
+
try {
|
|
15549
|
+
response = await transport(url, {
|
|
15550
|
+
signal: timed,
|
|
15551
|
+
headers: {
|
|
15552
|
+
accept: "application/vnd.github+json",
|
|
15553
|
+
authorization: `Bearer ${options.token}`,
|
|
15554
|
+
"x-github-api-version": "2022-11-28"
|
|
15555
|
+
}
|
|
15556
|
+
});
|
|
15557
|
+
} catch {
|
|
15558
|
+
throw new AdapterError("transient", "GitHub issue request failed");
|
|
15559
|
+
}
|
|
15560
|
+
if (!response.ok) {
|
|
15561
|
+
const failure = classifyHttpFailure({
|
|
15562
|
+
status: response.status,
|
|
15563
|
+
headers: response.headers,
|
|
15564
|
+
body: await response.text()
|
|
15565
|
+
}, options.now());
|
|
15566
|
+
throw new GithubIssuesHttpError(response.status, failure);
|
|
15567
|
+
}
|
|
15568
|
+
let value;
|
|
15569
|
+
try {
|
|
15570
|
+
value = await response.json();
|
|
15571
|
+
} catch {
|
|
15572
|
+
throw new AdapterError("transient", "Malformed GitHub issue response");
|
|
15573
|
+
}
|
|
15574
|
+
const next = response.headers.get("link")?.match(/<([^>]+)>;\s*rel="next"/)?.[1];
|
|
15575
|
+
return {
|
|
15576
|
+
value,
|
|
15577
|
+
...next === void 0 ? {} : { next }
|
|
15578
|
+
};
|
|
15579
|
+
});
|
|
15552
15580
|
}
|
|
15553
15581
|
let repositoryId;
|
|
15554
15582
|
/** Rejects a next link outside this repository before any request goes to it. */
|
|
@@ -15803,32 +15831,34 @@ function createJiraAdapter(options) {
|
|
|
15803
15831
|
const transport = options.fetch ?? fetch;
|
|
15804
15832
|
const authorization = `Basic ${Buffer.from(`${options.credentials.email}:${options.credentials.token}`).toString("base64")}`;
|
|
15805
15833
|
async function request(baseUrl, path, signal, body) {
|
|
15806
|
-
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
|
|
15810
|
-
|
|
15811
|
-
|
|
15812
|
-
|
|
15813
|
-
|
|
15814
|
-
|
|
15815
|
-
|
|
15816
|
-
|
|
15817
|
-
|
|
15818
|
-
|
|
15819
|
-
|
|
15820
|
-
|
|
15821
|
-
|
|
15822
|
-
|
|
15823
|
-
|
|
15824
|
-
|
|
15825
|
-
|
|
15826
|
-
|
|
15827
|
-
|
|
15828
|
-
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15834
|
+
return withTimeout(signal, "Jira request timed out", async (timed) => {
|
|
15835
|
+
let response;
|
|
15836
|
+
try {
|
|
15837
|
+
response = await transport(new URL(path, baseUrl), {
|
|
15838
|
+
method: body === void 0 ? "GET" : "POST",
|
|
15839
|
+
headers: {
|
|
15840
|
+
Accept: "application/json",
|
|
15841
|
+
Authorization: authorization,
|
|
15842
|
+
...body === void 0 ? {} : { "Content-Type": "application/json" }
|
|
15843
|
+
},
|
|
15844
|
+
...body === void 0 ? {} : { body: JSON.stringify(body) },
|
|
15845
|
+
signal: timed
|
|
15846
|
+
});
|
|
15847
|
+
} catch {
|
|
15848
|
+
if (timed.aborted) throw new AdapterError("transient", "Jira poll aborted");
|
|
15849
|
+
throw new AdapterError("transient", "Jira request failed");
|
|
15850
|
+
}
|
|
15851
|
+
if (response.status === 414 && options.searchMethod === "GET") throw new AdapterError("config", "Jira GET search URL is too long");
|
|
15852
|
+
if (!response.ok) throw new JiraHttpError(response.status, classifyHttpFailure({
|
|
15853
|
+
status: response.status,
|
|
15854
|
+
headers: response.headers
|
|
15855
|
+
}, options.now()));
|
|
15856
|
+
try {
|
|
15857
|
+
return await response.json();
|
|
15858
|
+
} catch {
|
|
15859
|
+
throw new AdapterError("transient", INVALID);
|
|
15860
|
+
}
|
|
15861
|
+
});
|
|
15832
15862
|
}
|
|
15833
15863
|
async function validate(tracker, signal) {
|
|
15834
15864
|
if (tracker.projectKeys.length === 0) throw new AdapterError("config", "Jira project key is required");
|
|
@@ -16131,6 +16161,8 @@ function applyEntityOutcomes(input) {
|
|
|
16131
16161
|
}
|
|
16132
16162
|
//#endregion
|
|
16133
16163
|
//#region ../adapters/src/runner/runner.ts
|
|
16164
|
+
/** The setTimeout limit: a longer delay would otherwise fire after 1 ms. */
|
|
16165
|
+
const MAX_TIMER_MS = 2147483647;
|
|
16134
16166
|
function startRunner(options) {
|
|
16135
16167
|
const startedAt = options.now();
|
|
16136
16168
|
const sources = options.entries.map((entry) => runSource(entry, options, startedAt));
|
|
@@ -16256,7 +16288,7 @@ function runSource(entry, options, runnerStartMs) {
|
|
|
16256
16288
|
pollTimer = setTimeout(() => {
|
|
16257
16289
|
pollTimer = void 0;
|
|
16258
16290
|
run(poll);
|
|
16259
|
-
}, delayMs);
|
|
16291
|
+
}, Math.min(delayMs, MAX_TIMER_MS));
|
|
16260
16292
|
}
|
|
16261
16293
|
async function poll() {
|
|
16262
16294
|
if (stopping) return;
|