spur-board 0.171.0 → 0.171.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 +26 -10
- package/package.json +1 -1
package/dist/daemon.mjs
CHANGED
|
@@ -31710,6 +31710,11 @@ var SpurRequestError = class extends AdapterError {
|
|
|
31710
31710
|
function describePlace(place) {
|
|
31711
31711
|
return place.page === void 0 ? place.path : `${place.path} page ${String(place.page)}`;
|
|
31712
31712
|
}
|
|
31713
|
+
const linksWire = z.array(z.object({
|
|
31714
|
+
label: z.string().min(1),
|
|
31715
|
+
url: z.string()
|
|
31716
|
+
}));
|
|
31717
|
+
const sessionLinkUrl = sessionFactsSchema.shape.links.valueType;
|
|
31713
31718
|
const sessionWire = z.object({
|
|
31714
31719
|
id: z.string().min(1),
|
|
31715
31720
|
project: z.string().min(1),
|
|
@@ -31718,10 +31723,7 @@ const sessionWire = z.object({
|
|
|
31718
31723
|
state: z.string().min(1),
|
|
31719
31724
|
rateLimitResetAt: z.iso.datetime().optional(),
|
|
31720
31725
|
lastActivityAt: z.iso.datetime().nullable().optional(),
|
|
31721
|
-
slots: z.object({ links:
|
|
31722
|
-
label: z.string().min(1),
|
|
31723
|
-
url: z.url()
|
|
31724
|
-
})).optional() }).optional(),
|
|
31726
|
+
slots: z.object({ links: linksWire.optional() }).optional(),
|
|
31725
31727
|
queuedMessages: z.object({ messages: z.array(z.string()) }).optional()
|
|
31726
31728
|
});
|
|
31727
31729
|
const transitionWire = z.object({
|
|
@@ -31729,10 +31731,7 @@ const transitionWire = z.object({
|
|
|
31729
31731
|
sessionId: z.string().min(1),
|
|
31730
31732
|
project: z.string().min(1),
|
|
31731
31733
|
at: z.iso.datetime(),
|
|
31732
|
-
links:
|
|
31733
|
-
label: z.string().min(1),
|
|
31734
|
-
url: z.url()
|
|
31735
|
-
})),
|
|
31734
|
+
links: linksWire,
|
|
31736
31735
|
kind: z.enum(["status", "state"]),
|
|
31737
31736
|
from: z.string().min(1).nullable(),
|
|
31738
31737
|
to: z.string().min(1),
|
|
@@ -31761,6 +31760,7 @@ function createSpurAdapter(options) {
|
|
|
31761
31760
|
let instanceId;
|
|
31762
31761
|
const unknownHealthValues = /* @__PURE__ */ new Set();
|
|
31763
31762
|
const unknownStatusValues = /* @__PURE__ */ new Set();
|
|
31763
|
+
const warnedLinks = /* @__PURE__ */ new Set();
|
|
31764
31764
|
const isKnownHealth = (value) => SESSION_HEALTH_STATES.some((state) => state === value);
|
|
31765
31765
|
const isKnownStatus = (value) => SESSION_STATUSES.some((status) => status === value);
|
|
31766
31766
|
/** The HTTP-status failure of a finished request, with its place. */
|
|
@@ -31851,8 +31851,24 @@ function createSpurAdapter(options) {
|
|
|
31851
31851
|
candidate
|
|
31852
31852
|
};
|
|
31853
31853
|
}
|
|
31854
|
+
function webLinks(sessionId, links) {
|
|
31855
|
+
const kept = [];
|
|
31856
|
+
for (const { label, url } of links) {
|
|
31857
|
+
const parsed = sessionLinkUrl.safeParse(url);
|
|
31858
|
+
if (parsed.success) {
|
|
31859
|
+
kept.push([label, parsed.data]);
|
|
31860
|
+
continue;
|
|
31861
|
+
}
|
|
31862
|
+
if (options.warn === void 0) continue;
|
|
31863
|
+
const key = JSON.stringify([sessionId, label]);
|
|
31864
|
+
if (warnedLinks.has(key)) continue;
|
|
31865
|
+
warnedLinks.add(key);
|
|
31866
|
+
options.warn(`Discarded invalid Spur web link ${JSON.stringify(label)} for session ${JSON.stringify(sessionId)}`);
|
|
31867
|
+
}
|
|
31868
|
+
return Object.fromEntries(kept);
|
|
31869
|
+
}
|
|
31854
31870
|
function facts(wire, observedAt, state, endReason) {
|
|
31855
|
-
const links =
|
|
31871
|
+
const links = webLinks(wire.id, wire.slots?.links ?? []);
|
|
31856
31872
|
const prUrl = links["pr"];
|
|
31857
31873
|
let pr = null;
|
|
31858
31874
|
if (prUrl !== void 0) {
|
|
@@ -31918,7 +31934,7 @@ function createSpurAdapter(options) {
|
|
|
31918
31934
|
session: entry.sessionId,
|
|
31919
31935
|
spurProject: entry.project,
|
|
31920
31936
|
at: entry.at,
|
|
31921
|
-
links:
|
|
31937
|
+
links: webLinks(entry.sessionId, entry.links),
|
|
31922
31938
|
dimension: entry.kind === "status" ? "lifecycle" : "health",
|
|
31923
31939
|
from: entry.from,
|
|
31924
31940
|
to: entry.to,
|