@nivaro/react 0.3.110 → 0.3.112
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +170 -2
- package/dist/index.js +745 -728
- package/dist/shared/components/CollectionBrowserView.js +3097 -2972
- package/dist/shared/components/CollectionImportBanner.js +135 -0
- package/dist/shared/components/ItemEditForm.js +2235 -2218
- package/dist/shared/components/JobsTray.js +54 -47
- package/dist/shared/components/TipLayer.js +61 -54
- package/dist/shared/components/ViewAsPersonButton.js +109 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +228 -150
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +35 -41
- package/dist/shared/components/bulk/BulkLinksValue.js +91 -0
- package/dist/shared/components/bulk/bulk-field-options.js +20 -19
- package/dist/shared/components/bulk/bulk-update-preview.js +39 -0
- package/dist/shared/components/cbv/ColumnHeaderMenu.js +113 -0
- package/dist/shared/components/cbv/column-totals.js +66 -0
- package/dist/shared/components/collections-directory/CollectionHoverCard.js +108 -81
- package/dist/shared/components/collections-directory/CollectionRow.js +164 -148
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +167 -166
- package/dist/shared/components/collections-directory/directory-data.js +70 -58
- package/dist/shared/components/imports/CollectionImportPanel.js +120 -118
- package/dist/shared/components/imports/DefinitionsPanel.js +24 -24
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +65 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +631 -639
- package/dist/shared/components/item-edit/DuplicateNotice.js +168 -0
- package/dist/shared/components/item-edit/FieldRow.js +248 -246
- package/dist/shared/components/item-edit/InlineGridField.js +34 -33
- package/dist/shared/components/item-edit/InlineTableField.js +3064 -2882
- package/dist/shared/components/item-edit/MembershipSetField.js +165 -169
- package/dist/shared/components/item-edit/NestedRelationEditor.js +184 -189
- package/dist/shared/components/item-edit/PlanGrid.js +2 -1
- package/dist/shared/components/item-edit/QuickPickerDialog.js +35 -34
- package/dist/shared/components/item-edit/RecordLiveSync.js +32 -30
- package/dist/shared/components/item-edit/RelationCombobox.js +101 -100
- package/dist/shared/components/item-edit/RowHistorySheet.js +28 -27
- package/dist/shared/components/item-edit/SummaryPanel.js +133 -135
- package/dist/shared/components/item-edit/ViewAsRole.js +129 -52
- package/dist/shared/components/item-edit/grid-search.js +345 -0
- package/dist/shared/components/item-edit/render-stability.js +61 -54
- package/dist/shared/components/notifications/NotificationRulesEditor.js +25 -20
- package/dist/shared/components/ops-report/DigestSections.js +163 -144
- package/dist/shared/components/ops-report/drill.js +97 -97
- package/dist/shared/components/panels/AddendumLinesDiff.js +52 -51
- package/dist/shared/components/panels/AddendumPanel.js +92 -91
- package/dist/shared/components/panels/AsyncUserPicker.js +108 -0
- package/dist/shared/components/panels/BlockedMove.js +73 -0
- package/dist/shared/components/panels/CommentPanel.js +265 -252
- package/dist/shared/components/panels/OwnersSlot.js +47 -35
- package/dist/shared/components/panels/PipelineInsight.js +186 -0
- package/dist/shared/components/panels/PipelinePanel.js +1573 -1475
- package/dist/shared/components/panels/RecordIntegrityBanner.js +39 -38
- package/dist/shared/components/panels/RevisionsPanel.js +261 -260
- package/dist/shared/components/pipeline/FieldPicker.js +41 -40
- package/dist/shared/components/pipeline/OwnerMatrix.js +829 -700
- package/dist/shared/components/pipeline/OwnerRecordTrial.js +362 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -467
- package/dist/shared/components/pipeline/PipelineStateOwners.js +65 -64
- package/dist/shared/components/pipeline/owner-matrix-draft.js +178 -0
- package/dist/shared/components/profile/MyDefaultsCard.js +36 -35
- package/dist/shared/components/profile/PersonHeader.js +29 -29
- package/dist/shared/components/profile/PersonProfile.js +30 -28
- package/dist/shared/components/profile/SlowScreensCard.js +286 -0
- package/dist/shared/components/queue/QueueWorklist.js +1090 -1071
- package/dist/shared/components/quick-filters/useQuickFilterEditing.js +45 -44
- package/dist/shared/components/support/TicketDetailSheet.js +25 -16
- package/dist/shared/components/support/TicketSlowScreens.js +32 -0
- package/dist/shared/lib/activity-sentence.js +224 -178
- package/dist/shared/lib/collection-import-banner.js +27 -0
- package/dist/shared/lib/crash-report.js +112 -0
- package/dist/shared/lib/export-runs.js +99 -0
- package/dist/shared/lib/jobs-tray.js +89 -67
- package/dist/shared/lib/list-link.js +76 -69
- package/dist/shared/lib/nav-trail.js +180 -76
- package/dist/shared/lib/query-keys.js +26 -0
- package/dist/shared/lib/view-as.js +16 -11
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function f(t) {
|
|
2
|
+
const e = Math.max(0, Math.floor(t));
|
|
3
|
+
if (e < 60) return `${e} s`;
|
|
4
|
+
const r = Math.floor(e / 60);
|
|
5
|
+
return r < 60 ? `${r} min ${String(e % 60).padStart(2, "0")} s` : `${Math.floor(r / 60)} h ${r % 60} min`;
|
|
6
|
+
}
|
|
7
|
+
function d(t, e, r = /* @__PURE__ */ new Set()) {
|
|
8
|
+
const u = t ?? [], a = u.filter((n) => n.status === "running");
|
|
9
|
+
if (a.length > 0) {
|
|
10
|
+
const n = a.map((i) => i.started_at ? new Date(i.started_at).getTime() : Number.NaN).filter((i) => Number.isFinite(i)), o = n.length ? Math.max(0, (e - Math.min(...n)) / 1e3) : null;
|
|
11
|
+
return { kind: "running", runs: a, elapsedSeconds: o };
|
|
12
|
+
}
|
|
13
|
+
const s = u.filter((n) => (n.status === "completed" || n.status === "error") && !r.has(n.run_id)).sort((n, o) => new Date(o.finished_at ?? 0).getTime() - new Date(n.finished_at ?? 0).getTime())[0];
|
|
14
|
+
return s ? { kind: s.status, run: s } : null;
|
|
15
|
+
}
|
|
16
|
+
function m(t) {
|
|
17
|
+
return t.length === 1 ? `${t[0].label} import is running` : `${t.length} imports are running`;
|
|
18
|
+
}
|
|
19
|
+
function c(t) {
|
|
20
|
+
return t == null ? null : `${t.toLocaleString("en-US")} ${t === 1 ? "row" : "rows"} reported by the run`;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
f as formatElapsed,
|
|
24
|
+
d as importBannerState,
|
|
25
|
+
c as rowsText,
|
|
26
|
+
m as runningTitle
|
|
27
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { pagePattern as _ } from "./page-context.js";
|
|
2
|
+
import { isCodeError as k } from "./safe-error.js";
|
|
3
|
+
const b = [
|
|
4
|
+
// First: a URL keeps its path (the bundle file a frame names) and loses its query and
|
|
5
|
+
// fragment, before any key=value rule reads a query parameter as a secret.
|
|
6
|
+
[/(\bhttps?:\/\/[^\s?#'"<>)]*)[?#][^\s:'"<>)]*/gi, "$1"],
|
|
7
|
+
[/\bBearer\s+[A-Za-z0-9._~+/=-]{6,}/gi, "Bearer <redacted>"],
|
|
8
|
+
[/\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{2,}/g, "<jwt>"],
|
|
9
|
+
[/\bnv[a-z]{1,3}_[A-Za-z0-9_-]{6,}/g, "<token>"],
|
|
10
|
+
[
|
|
11
|
+
/\b(password|passwd|pwd|secret|token|api[_-]?key|access[_-]?key|authorization|cookie|session(?:id)?)(["']?\s*[:=]\s*)(["']?)[^\s"'&,;)}\]]+/gi,
|
|
12
|
+
(e, n, r, i) => `${n}${r}${i}<redacted>`
|
|
13
|
+
],
|
|
14
|
+
[/\b[\w.+-]+@[\w-]+(?:\.[\w-]+)+\b/g, "<email>"],
|
|
15
|
+
[
|
|
16
|
+
/[A-Za-z0-9+/_-]{32,}={0,2}/g,
|
|
17
|
+
(e) => /\d/.test(e) && /[A-Za-z]/.test(e) ? "<redacted>" : e
|
|
18
|
+
],
|
|
19
|
+
[
|
|
20
|
+
/(["'`])((?:(?!\1)[^\\\n]|\\.){0,300})\1/g,
|
|
21
|
+
(e, n, r) => /^[A-Za-z_$][\w$.-]{0,59}$/.test(r) || r === "" ? e : `${n}…${n}`
|
|
22
|
+
]
|
|
23
|
+
];
|
|
24
|
+
function p(e, n = 6e3) {
|
|
25
|
+
let r = String(e ?? "");
|
|
26
|
+
for (const [i, c] of b) r = r.replace(i, c);
|
|
27
|
+
return r.slice(0, n);
|
|
28
|
+
}
|
|
29
|
+
const A = /failed to fetch|load failed|networkerror|network request failed|network error/i, z = /dynamically imported module|importing a module script failed|loading (?:css )?chunk \S+ failed|error loading dynamically/i, S = /* @__PURE__ */ new Set(["AbortError", "CanceledError", "ChunkLoadError", "TimeoutError"]), m = /(chrome|moz|safari(-web)?)-extension:\/\//;
|
|
30
|
+
function $(e) {
|
|
31
|
+
if (!(e instanceof Error)) return !1;
|
|
32
|
+
if (k(e)) return !m.test(e.stack ?? "");
|
|
33
|
+
const n = e;
|
|
34
|
+
return !(n.status != null || n.response != null || S.has(n.name) || n.code === "ERR_CANCELED" || A.test(n.message) || z.test(n.message) || m.test(n.stack ?? ""));
|
|
35
|
+
}
|
|
36
|
+
function C(e) {
|
|
37
|
+
const n = (e.stack ?? "").split(`
|
|
38
|
+
`).find((r) => /^\s*at\s|@/.test(r)) ?? "";
|
|
39
|
+
return `${e.name}|${e.message}|${n.trim()}`.slice(0, 500);
|
|
40
|
+
}
|
|
41
|
+
function R(e, n, r) {
|
|
42
|
+
const i = p(
|
|
43
|
+
[e.stack, r.componentStack].filter(Boolean).join(`
|
|
44
|
+
---
|
|
45
|
+
`),
|
|
46
|
+
6e3
|
|
47
|
+
), c = _(r.screen);
|
|
48
|
+
return {
|
|
49
|
+
message: p(e.message || e.name || "Unknown error", 400),
|
|
50
|
+
name: String(e.name || "Error").slice(0, 60),
|
|
51
|
+
...i ? { stack: i } : {},
|
|
52
|
+
kind: n,
|
|
53
|
+
app: r.app,
|
|
54
|
+
screen: c,
|
|
55
|
+
url: c,
|
|
56
|
+
...r.release ? { release: String(r.release).slice(0, 60) } : {},
|
|
57
|
+
...r.replay ? { recording_id: r.replay.recording_id, recording_offset_ms: r.replay.offset_ms } : {}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function L(e) {
|
|
61
|
+
const n = e.now ?? (() => Date.now()), r = e.maxPerMinute ?? 6, i = e.maxPerTab ?? 30, c = e.dedupeMs ?? 5 * 6e4, l = /* @__PURE__ */ new Map(), u = [];
|
|
62
|
+
let f = 0;
|
|
63
|
+
const E = () => {
|
|
64
|
+
try {
|
|
65
|
+
return e.screen ? e.screen() : typeof location < "u" ? location.pathname : "/";
|
|
66
|
+
} catch {
|
|
67
|
+
return "/";
|
|
68
|
+
}
|
|
69
|
+
}, g = (t) => {
|
|
70
|
+
if (f >= i) return !1;
|
|
71
|
+
const s = n();
|
|
72
|
+
for (; u.length && s - u[0] >= 6e4; ) u.shift();
|
|
73
|
+
if (u.length >= r) return !1;
|
|
74
|
+
const o = C(t), a = l.get(o);
|
|
75
|
+
return a != null && s - a < c ? !1 : (l.set(o, s), l.size > 200 && l.delete(l.keys().next().value), u.push(s), f++, !0);
|
|
76
|
+
}, h = async (t, s, o) => {
|
|
77
|
+
try {
|
|
78
|
+
const a = E(), w = e.captureReplay ? await e.captureReplay().catch(() => null) : null, y = typeof e.release == "function" ? e.release() : e.release;
|
|
79
|
+
await e.send(
|
|
80
|
+
R(t, s, { app: e.app, screen: a, release: y, componentStack: o, replay: w })
|
|
81
|
+
);
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
}, d = {
|
|
85
|
+
report(t, s, o) {
|
|
86
|
+
if (s !== "render" && !(t instanceof Error)) return !1;
|
|
87
|
+
const a = t instanceof Error ? t : new Error(typeof t == "string" ? t : "Non-error value thrown");
|
|
88
|
+
return s !== "render" && !$(a) || s === "render" && m.test(a.stack ?? "") || !g(a) ? !1 : (h(a, s, o), !0);
|
|
89
|
+
},
|
|
90
|
+
install(t = window) {
|
|
91
|
+
const s = (a) => {
|
|
92
|
+
a.error && d.report(a.error, "error");
|
|
93
|
+
}, o = (a) => {
|
|
94
|
+
d.report(a.reason, "rejection");
|
|
95
|
+
};
|
|
96
|
+
return t.addEventListener("error", s), t.addEventListener("unhandledrejection", o), () => {
|
|
97
|
+
t.removeEventListener("error", s), t.removeEventListener("unhandledrejection", o);
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
get sent() {
|
|
101
|
+
return f;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
return d;
|
|
105
|
+
}
|
|
106
|
+
export {
|
|
107
|
+
R as buildCrashBody,
|
|
108
|
+
C as crashKey,
|
|
109
|
+
L as createCrashReporter,
|
|
110
|
+
$ as isCrashWorthy,
|
|
111
|
+
p as scrubCrashText
|
|
112
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { toast as u } from "sonner";
|
|
2
|
+
import { toastError as m } from "./error-toast.js";
|
|
3
|
+
import { LOCAL_JOB_PREFIX as y, setLocalCancel as p, applyJobUpdate as l, subscribeJobs as g, trayJobs as k } from "./jobs-tray.js";
|
|
4
|
+
function L(e) {
|
|
5
|
+
const o = e;
|
|
6
|
+
return !!o && o.mode === "background" && typeof o.run_id == "number" && typeof o.key == "string";
|
|
7
|
+
}
|
|
8
|
+
function E(e) {
|
|
9
|
+
return (e ?? "").replace(/\s*→ file [0-9a-fA-F-]{8,}\s*$/, "");
|
|
10
|
+
}
|
|
11
|
+
const b = (e) => `/api/files/${encodeURIComponent(e)}?download=1`;
|
|
12
|
+
function h(e, o) {
|
|
13
|
+
if (typeof document > "u") return;
|
|
14
|
+
const t = document.createElement("a");
|
|
15
|
+
t.href = e, t.rel = "noopener", t.style.display = "none", document.body.appendChild(t), t.click(), t.remove();
|
|
16
|
+
}
|
|
17
|
+
const a = /* @__PURE__ */ new Map();
|
|
18
|
+
let c = null;
|
|
19
|
+
function C(e) {
|
|
20
|
+
const o = a.get(e.key);
|
|
21
|
+
if (o && !(e.status === "running" || e.status === "queued"))
|
|
22
|
+
if (a.delete(e.key), o.poll && clearInterval(o.poll), a.size === 0 && c && (c(), c = null), e.status === "completed" && e.file_id) {
|
|
23
|
+
const t = b(e.file_id);
|
|
24
|
+
h(t), u.success("Your export is ready", {
|
|
25
|
+
description: E(e.outcome) || o.label,
|
|
26
|
+
action: { label: "Download again", onClick: () => h(t) }
|
|
27
|
+
});
|
|
28
|
+
} else e.status === "error" ? m({ message: e.error ?? "" }, "The export did not finish") : e.status === "canceled" && u("Export cancelled", { description: o.label });
|
|
29
|
+
}
|
|
30
|
+
function _() {
|
|
31
|
+
for (const e of k()) a.has(e.key) && C(e);
|
|
32
|
+
}
|
|
33
|
+
function $(e, o, t) {
|
|
34
|
+
const r = { label: o };
|
|
35
|
+
a.set(e, r), c || (c = g(_)), t && (r.poll = setInterval(() => {
|
|
36
|
+
t().then((s) => {
|
|
37
|
+
s && l(s);
|
|
38
|
+
}).catch(() => {
|
|
39
|
+
});
|
|
40
|
+
}, 4e3));
|
|
41
|
+
}
|
|
42
|
+
function S(e, o = {}) {
|
|
43
|
+
l({
|
|
44
|
+
key: e.key,
|
|
45
|
+
kind: "export",
|
|
46
|
+
label: e.label,
|
|
47
|
+
status: "running",
|
|
48
|
+
progress: { phase: "Starting", done: 0, total: e.total, unit: "rows" },
|
|
49
|
+
cancel_path: e.cancel_path
|
|
50
|
+
}), $(e.key, e.label, o.read), u.info(`${e.label} in the background`, {
|
|
51
|
+
description: "Follow it in the Jobs tray — it downloads here when it is ready, and you get a notice with the link."
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
let R = 0;
|
|
55
|
+
function U(e, o) {
|
|
56
|
+
const t = `${y}export:${Date.now().toString(36)}:${++R}`, r = `Exporting ${e}`.slice(0, 200), s = new AbortController();
|
|
57
|
+
let i = { done: 0, total: o, phase: "Reading rows" };
|
|
58
|
+
const f = (n) => l({ key: t, kind: "export", label: r, status: "running", ...n });
|
|
59
|
+
p(t, () => s.abort()), f({ progress: { ...i, unit: "rows" }, cancel_path: t });
|
|
60
|
+
const w = (n) => {
|
|
61
|
+
p(t, null), l({ key: t, kind: "export", label: r, status: "completed", ...n });
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
key: t,
|
|
65
|
+
signal: s.signal,
|
|
66
|
+
progress(n, d, x) {
|
|
67
|
+
i = { done: n, total: d === void 0 ? i.total : d, phase: x ?? i.phase }, f({ progress: { ...i, unit: "rows" } });
|
|
68
|
+
},
|
|
69
|
+
finish(n) {
|
|
70
|
+
w({ outcome: n });
|
|
71
|
+
},
|
|
72
|
+
fail(n) {
|
|
73
|
+
p(t, null);
|
|
74
|
+
const d = m(n, "The export did not finish");
|
|
75
|
+
l({ key: t, kind: "export", label: r, status: "error", error: d.title });
|
|
76
|
+
},
|
|
77
|
+
cancelled() {
|
|
78
|
+
p(t, null), l({ key: t, kind: "export", label: r, status: "canceled", outcome: "Cancelled" }), u("Export cancelled", { description: e });
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
class F extends Error {
|
|
83
|
+
constructor() {
|
|
84
|
+
super("Export cancelled"), this.name = "ExportCancelledError";
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function A(e) {
|
|
88
|
+
if (e.aborted) throw new F();
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
F as ExportCancelledError,
|
|
92
|
+
h as downloadUrl,
|
|
93
|
+
b as exportFileUrl,
|
|
94
|
+
S as followExportRun,
|
|
95
|
+
L as isStartedExportRun,
|
|
96
|
+
U as startLocalExport,
|
|
97
|
+
A as throwIfCancelled,
|
|
98
|
+
E as withoutFileRef
|
|
99
|
+
};
|
|
@@ -1,101 +1,123 @@
|
|
|
1
|
-
import { useSyncExternalStore as
|
|
2
|
-
const
|
|
3
|
-
let s = [], r = /* @__PURE__ */ new Set(),
|
|
4
|
-
const
|
|
5
|
-
function
|
|
1
|
+
import { useSyncExternalStore as E } from "react";
|
|
2
|
+
const f = "nvr:jobs-tray:v1", d = "nvr:jobs-tray:dismissed:v1", I = 20, $ = 1440 * 60 * 1e3;
|
|
3
|
+
let s = [], r = /* @__PURE__ */ new Set(), b = !1, w = 0;
|
|
4
|
+
const a = /* @__PURE__ */ new Set();
|
|
5
|
+
function c(e, n) {
|
|
6
6
|
try {
|
|
7
|
-
const
|
|
8
|
-
return
|
|
7
|
+
const t = localStorage.getItem(e);
|
|
8
|
+
return t ? JSON.parse(t) : n;
|
|
9
9
|
} catch {
|
|
10
10
|
return n;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
const j = "local:", y = (e) => e.startsWith(j), S = /* @__PURE__ */ new Map();
|
|
14
|
+
function M(e, n) {
|
|
15
|
+
n ? S.set(e, n) : S.delete(e);
|
|
16
|
+
}
|
|
17
|
+
function N(e) {
|
|
18
|
+
const n = S.get(e);
|
|
19
|
+
return n ? (n(), !0) : !1;
|
|
20
|
+
}
|
|
21
|
+
function k() {
|
|
14
22
|
try {
|
|
15
|
-
localStorage.setItem(
|
|
23
|
+
localStorage.setItem(f, JSON.stringify(s.filter((e) => !y(e.key)))), localStorage.setItem(d, JSON.stringify([...r].slice(-200)));
|
|
16
24
|
} catch {
|
|
17
25
|
}
|
|
18
26
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
for (const
|
|
27
|
+
function g() {
|
|
28
|
+
w++;
|
|
29
|
+
for (const e of a) e();
|
|
22
30
|
}
|
|
23
|
-
function
|
|
24
|
-
const
|
|
25
|
-
s = s.filter((n) => n.status === "queued" || n.status === "running" || n.at >=
|
|
31
|
+
function J() {
|
|
32
|
+
const e = Date.now() - $;
|
|
33
|
+
s = s.filter((n) => n.status === "queued" || n.status === "running" || n.at >= e).sort((n, t) => t.at - n.at).slice(0, I);
|
|
26
34
|
}
|
|
27
35
|
function l() {
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
b || typeof window > "u" || (b = !0, s = c(f, []).filter((e) => !y(e.key)), r = new Set(c(d, [])), J(), window.addEventListener("storage", (e) => {
|
|
37
|
+
if (e.key !== f && e.key !== d) return;
|
|
38
|
+
s = [...s.filter((t) => y(t.key)), ...c(f, []).filter((t) => !y(t.key))], r = new Set(c(d, [])), g();
|
|
30
39
|
}));
|
|
31
40
|
}
|
|
32
|
-
function
|
|
33
|
-
return r.has(
|
|
41
|
+
function L(e, n) {
|
|
42
|
+
return r.has(e) && (n === "completed" || n === "error" || n === "canceled");
|
|
34
43
|
}
|
|
35
|
-
function
|
|
36
|
-
if (l(), !(
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
44
|
+
function O(e, n = Date.now()) {
|
|
45
|
+
if (l(), !(e != null && e.key) || !e.status) return;
|
|
46
|
+
const t = s.find((i) => i.key === e.key);
|
|
47
|
+
if (t && (t.status === "completed" || t.status === "error" || t.status === "canceled") && e.status === "running" || (e.status === "queued" && r.delete(e.key), L(e.key, e.status))) return;
|
|
39
48
|
s = [{
|
|
40
|
-
key:
|
|
41
|
-
kind:
|
|
42
|
-
label: (
|
|
43
|
-
status:
|
|
44
|
-
progress:
|
|
45
|
-
outcome:
|
|
46
|
-
error:
|
|
47
|
-
href:
|
|
48
|
-
file_id:
|
|
49
|
+
key: e.key,
|
|
50
|
+
kind: e.kind ?? (t == null ? void 0 : t.kind) ?? "job",
|
|
51
|
+
label: (e.label ?? (t == null ? void 0 : t.label) ?? "Background job").slice(0, 200),
|
|
52
|
+
status: e.status,
|
|
53
|
+
progress: e.progress ?? (e.status === "running" ? t == null ? void 0 : t.progress : null) ?? null,
|
|
54
|
+
outcome: e.outcome ?? null,
|
|
55
|
+
error: e.error ?? null,
|
|
56
|
+
href: e.href ?? (t == null ? void 0 : t.href) ?? null,
|
|
57
|
+
file_id: e.file_id ?? (t == null ? void 0 : t.file_id) ?? null,
|
|
49
58
|
// Only a running job can be cancelled; a progress tick without it keeps the earlier one.
|
|
50
|
-
cancel_path:
|
|
51
|
-
position:
|
|
52
|
-
eta_seconds:
|
|
59
|
+
cancel_path: e.status === "running" || e.status === "queued" ? e.cancel_path ?? (t == null ? void 0 : t.cancel_path) ?? null : null,
|
|
60
|
+
position: e.position ?? null,
|
|
61
|
+
eta_seconds: e.eta_seconds ?? null,
|
|
53
62
|
at: n
|
|
54
|
-
}, ...s.filter((i) => i.key !==
|
|
63
|
+
}, ...s.filter((i) => i.key !== e.key)], J(), k(), g();
|
|
55
64
|
}
|
|
56
|
-
const
|
|
57
|
-
function
|
|
58
|
-
let n = 0,
|
|
59
|
-
for (const o of
|
|
60
|
-
o.status === "running" || o.status === "queued" ? n++ : o.status === "error" ?
|
|
65
|
+
const _ = (e) => `${e} job${e === 1 ? "" : "s"}`;
|
|
66
|
+
function A(e) {
|
|
67
|
+
let n = 0, t = 0, u = 0, i = 0;
|
|
68
|
+
for (const o of e)
|
|
69
|
+
o.status === "running" || o.status === "queued" ? n++ : o.status === "error" ? t++ : o.status === "canceled" ? i++ : u++;
|
|
61
70
|
if (n > 0)
|
|
62
71
|
return {
|
|
63
72
|
tone: "running",
|
|
64
|
-
text: `${
|
|
65
|
-
note:
|
|
73
|
+
text: `${_(n)} running`,
|
|
74
|
+
note: t > 0 ? `${t} failed` : null
|
|
66
75
|
};
|
|
67
|
-
const
|
|
68
|
-
[
|
|
69
|
-
[u, u && (
|
|
76
|
+
const h = [
|
|
77
|
+
[t, "failed"],
|
|
78
|
+
[u, u && (t || i) ? "done" : "finished"],
|
|
70
79
|
[i, "cancelled"]
|
|
71
|
-
].filter(([o]) => o > 0).map(([o,
|
|
72
|
-
return { tone:
|
|
80
|
+
].filter(([o]) => o > 0).map(([o, m], D) => D === 0 ? `${_(o)} ${m}` : `${o} ${m}`).join(", ");
|
|
81
|
+
return { tone: t > 0 ? "failed" : u > 0 ? "done" : "cancelled", text: h, note: null };
|
|
73
82
|
}
|
|
74
|
-
function
|
|
83
|
+
function B(e) {
|
|
75
84
|
l();
|
|
76
|
-
for (const n of
|
|
85
|
+
for (const n of e) O(n, n.at ? new Date(n.at).getTime() : Date.now());
|
|
77
86
|
}
|
|
78
|
-
function
|
|
79
|
-
l(), r.add(
|
|
87
|
+
function C(e) {
|
|
88
|
+
l(), r.add(e), s = s.filter((n) => n.key !== e), k(), g();
|
|
80
89
|
}
|
|
81
|
-
function
|
|
90
|
+
function F() {
|
|
82
91
|
l();
|
|
83
|
-
for (const
|
|
84
|
-
|
|
85
|
-
s = s.filter((
|
|
86
|
-
}
|
|
87
|
-
function
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
for (const e of s)
|
|
93
|
+
e.status !== "queued" && e.status !== "running" && r.add(e.key);
|
|
94
|
+
s = s.filter((e) => e.status === "queued" || e.status === "running"), k(), g();
|
|
95
|
+
}
|
|
96
|
+
function H(e) {
|
|
97
|
+
return a.add(e), () => {
|
|
98
|
+
a.delete(e);
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function K() {
|
|
102
|
+
return l(), s;
|
|
103
|
+
}
|
|
104
|
+
function R() {
|
|
105
|
+
return l(), E(
|
|
106
|
+
(e) => (a.add(e), () => a.delete(e)),
|
|
107
|
+
() => w,
|
|
91
108
|
() => 0
|
|
92
109
|
), s;
|
|
93
110
|
}
|
|
94
111
|
export {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
N as
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
j as LOCAL_JOB_PREFIX,
|
|
113
|
+
O as applyJobUpdate,
|
|
114
|
+
N as cancelLocalJob,
|
|
115
|
+
F as dismissFinishedJobs,
|
|
116
|
+
C as dismissJob,
|
|
117
|
+
B as seedJobs,
|
|
118
|
+
M as setLocalCancel,
|
|
119
|
+
H as subscribeJobs,
|
|
120
|
+
A as trayHeadline,
|
|
121
|
+
K as trayJobs,
|
|
122
|
+
R as useTrayJobs
|
|
101
123
|
};
|