@nivaro/react 0.3.52 → 0.3.54
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 +47 -3
- package/dist/shared/components/ItemEditForm.js +4196 -4163
- package/dist/shared/components/NotificationBell.js +163 -150
- package/dist/shared/components/PageRenderer.js +645 -593
- package/dist/shared/components/ProfileView.js +36 -34
- package/dist/shared/components/QueryStatStrip.js +96 -89
- package/dist/shared/components/QueryTable.js +214 -215
- package/dist/shared/components/ReportView.js +548 -529
- package/dist/shared/components/alerts/AlertManagerView.js +346 -320
- package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
- package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
- package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
- package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
- package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
- package/dist/shared/components/item-edit/PlanGrid.js +718 -705
- package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
- package/dist/shared/components/item-edit/SummaryPanel.js +415 -361
- package/dist/shared/components/item-edit/line-qty.js +115 -53
- package/dist/shared/components/item-edit/save-outcome.js +48 -0
- package/dist/shared/components/item-edit/save-refusal.js +18 -18
- package/dist/shared/components/item-edit/stale-banner.js +13 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +225 -220
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/ItemLockBanner.js +318 -291
- package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
- package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
- package/dist/shared/components/panels/RevisionsPanel.js +101 -106
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
- package/dist/shared/components/panels/requirement-side-effects.js +46 -29
- package/dist/shared/components/queue/QueueItemSheet.js +219 -146
- package/dist/shared/components/queue/QueueWorklist.js +738 -730
- package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
- package/dist/shared/lib/activity-sentence.js +236 -227
- package/dist/shared/lib/draft-store.js +35 -29
- package/dist/shared/lib/page-widget-access.js +11 -0
- package/dist/shared/lib/record-ref.js +43 -34
- package/package.json +1 -1
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
function L(e) {
|
|
2
|
+
const n = i(e.collection_label) || "related rows", t = i(e.row_label), r = t ? `${n} · ${t}` : n;
|
|
3
|
+
if (e.verb === "added") return `added ${r}`;
|
|
4
|
+
if (e.verb === "removed") return `removed ${r}`;
|
|
5
|
+
const o = (e.changes ?? []).filter((s) => s && i(s.label)).map((s) => `${i(s.label)} ${i(s.from) || "—"} → ${i(s.to) || "—"}`);
|
|
6
|
+
return o.length ? `changed ${r}: ${o.join(", ")}` : `changed ${r}`;
|
|
7
|
+
}
|
|
8
|
+
const S = "a record you can't see", Z = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, P = {
|
|
2
9
|
ai: "AI",
|
|
3
10
|
api: "API",
|
|
4
11
|
csv: "CSV",
|
|
@@ -22,33 +29,33 @@ const S = "a record you can't see", F = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0
|
|
|
22
29
|
function i(e) {
|
|
23
30
|
return e == null ? "" : String(e).trim();
|
|
24
31
|
}
|
|
25
|
-
function
|
|
32
|
+
function G(e) {
|
|
26
33
|
return i(e).toUpperCase();
|
|
27
34
|
}
|
|
28
|
-
function
|
|
35
|
+
function O(e) {
|
|
29
36
|
return e.split(/[\s_.:-]+/).map((n) => n.trim()).filter(Boolean);
|
|
30
37
|
}
|
|
31
|
-
function
|
|
38
|
+
function q(e) {
|
|
32
39
|
const n = e.toLowerCase();
|
|
33
|
-
return
|
|
40
|
+
return P[n] ?? n;
|
|
34
41
|
}
|
|
35
|
-
function
|
|
36
|
-
const n =
|
|
42
|
+
function Y(e) {
|
|
43
|
+
const n = O(e).map(q).join(" ");
|
|
37
44
|
return n ? n.charAt(0).toUpperCase() + n.slice(1) : "";
|
|
38
45
|
}
|
|
39
46
|
function j(e) {
|
|
40
|
-
return
|
|
47
|
+
return O(e).map((n) => P[n.toLowerCase()] ?? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
|
|
41
48
|
}
|
|
42
|
-
function
|
|
49
|
+
function E(e) {
|
|
43
50
|
return /ies$/i.test(e) ? e.replace(/ies$/i, (n) => n === "IES" ? "Y" : "y") : /(ss|us|is)$/i.test(e) ? e : /(x|ch|sh|ss|us)es$/i.test(e) ? e.replace(/es$/i, "") : /s$/i.test(e) && e.length > 1 ? e.slice(0, -1) : e;
|
|
44
51
|
}
|
|
45
|
-
function
|
|
52
|
+
function R(e) {
|
|
46
53
|
return /[^aeiou]y$/i.test(e) ? e.replace(/y$/i, (n) => n === "Y" ? "IES" : "ies") : /(s|x|z|ch|sh)$/i.test(e) && !/^[A-Z0-9]+$/.test(e) ? `${e}es` : `${e}s`;
|
|
47
54
|
}
|
|
48
55
|
function g(e) {
|
|
49
56
|
return e.split(" ").map((n) => /[A-Z][^ ]*[A-Z]/.test(n) ? n : n.toLowerCase()).join(" ");
|
|
50
57
|
}
|
|
51
|
-
const
|
|
58
|
+
const H = {
|
|
52
59
|
nivaro_activity: "Activity entry",
|
|
53
60
|
nivaro_api_keys: "API key",
|
|
54
61
|
nivaro_approval_chains: "Approval chain",
|
|
@@ -73,40 +80,40 @@ const G = {
|
|
|
73
80
|
nivaro_webhooks: "Webhook",
|
|
74
81
|
nivaro_workflow_templates: "Pipeline"
|
|
75
82
|
};
|
|
76
|
-
function
|
|
83
|
+
function N(e, n) {
|
|
77
84
|
var f;
|
|
78
85
|
const t = i(e);
|
|
79
86
|
if (!t) return { singular: "Record", plural: "Records" };
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
const $ =
|
|
87
|
+
const r = (f = n == null ? void 0 : n.collections) == null ? void 0 : f[t], o = typeof r == "string" ? { plural: r } : r ?? {}, s = i(o.plural), u = i(o.singular);
|
|
88
|
+
if (u || s) {
|
|
89
|
+
const $ = u || k(s, E), h = s && s !== $ ? s : k($, R);
|
|
83
90
|
return { singular: $, plural: h };
|
|
84
91
|
}
|
|
85
|
-
const a =
|
|
86
|
-
if (a) return { singular: a, plural: a === "Settings" ? a : k(a,
|
|
87
|
-
const
|
|
88
|
-
return { singular: d, plural: k(d,
|
|
92
|
+
const a = H[t];
|
|
93
|
+
if (a) return { singular: a, plural: a === "Settings" ? a : k(a, R) };
|
|
94
|
+
const c = j(t.replace(/^(nivaro|directus)_/, "")) || "Record", d = k(c, E);
|
|
95
|
+
return { singular: d, plural: k(d, R) };
|
|
89
96
|
}
|
|
90
97
|
function k(e, n) {
|
|
91
98
|
const t = e.split(" ");
|
|
92
99
|
return t[t.length - 1] = n(t[t.length - 1] ?? ""), t.join(" ");
|
|
93
100
|
}
|
|
94
|
-
function
|
|
95
|
-
const { singular:
|
|
96
|
-
return `${e} ${g(e === 1 ?
|
|
101
|
+
function b(e, n, t) {
|
|
102
|
+
const { singular: r, plural: o } = N(n, t);
|
|
103
|
+
return `${e} ${g(e === 1 ? r : o)}`;
|
|
97
104
|
}
|
|
98
|
-
function
|
|
99
|
-
const t = e.user ?? e.user_id ?? null,
|
|
100
|
-
if (
|
|
101
|
-
const
|
|
102
|
-
return
|
|
105
|
+
function Q(e, n) {
|
|
106
|
+
const t = e.user ?? e.user_id ?? null, r = t ? C(t, n) : null;
|
|
107
|
+
if (r) return r;
|
|
108
|
+
const o = [i(e.first_name), i(e.last_name)].filter(Boolean).join(" ");
|
|
109
|
+
return o || (i(e.user_email) ? i(e.user_email) : null);
|
|
103
110
|
}
|
|
104
111
|
function C(e, n) {
|
|
105
112
|
if (!e || !(n != null && n.users)) return null;
|
|
106
113
|
const t = n.users;
|
|
107
|
-
return i(t[e] ?? t[
|
|
114
|
+
return i(t[e] ?? t[G(e)] ?? t[i(e).toLowerCase()]) || null;
|
|
108
115
|
}
|
|
109
|
-
const
|
|
116
|
+
const X = /* @__PURE__ */ new Set([
|
|
110
117
|
"person",
|
|
111
118
|
"view_as",
|
|
112
119
|
"api_key",
|
|
@@ -116,7 +123,7 @@ const Q = /* @__PURE__ */ new Set([
|
|
|
116
123
|
"cron",
|
|
117
124
|
"system"
|
|
118
125
|
]);
|
|
119
|
-
function
|
|
126
|
+
function ee(e) {
|
|
120
127
|
if (e == null || e === "") return null;
|
|
121
128
|
let n = e;
|
|
122
129
|
if (typeof e == "string")
|
|
@@ -126,16 +133,16 @@ function X(e) {
|
|
|
126
133
|
return null;
|
|
127
134
|
}
|
|
128
135
|
if (!n || typeof n != "object") return null;
|
|
129
|
-
const t = n,
|
|
130
|
-
return
|
|
131
|
-
kind:
|
|
136
|
+
const t = n, r = i(t.kind);
|
|
137
|
+
return X.has(r) ? {
|
|
138
|
+
kind: r,
|
|
132
139
|
id: t.id == null ? null : String(t.id),
|
|
133
140
|
name: t.name == null ? null : String(t.name),
|
|
134
141
|
on_behalf_of: t.on_behalf_of == null ? null : String(t.on_behalf_of)
|
|
135
142
|
} : null;
|
|
136
143
|
}
|
|
137
|
-
function
|
|
138
|
-
const n =
|
|
144
|
+
function T(e) {
|
|
145
|
+
const n = ee(e.actor);
|
|
139
146
|
if (n) return n;
|
|
140
147
|
const t = e.user ?? e.user_id ?? null;
|
|
141
148
|
if (i(e.mcp_conn) || i(e.via_app) || i(e.via_agent))
|
|
@@ -145,39 +152,39 @@ function O(e) {
|
|
|
145
152
|
name: i(e.via_app) || i(e.via_agent) || null,
|
|
146
153
|
on_behalf_of: t
|
|
147
154
|
};
|
|
148
|
-
const
|
|
149
|
-
if (
|
|
150
|
-
if ((
|
|
155
|
+
const r = i(e.auth_method);
|
|
156
|
+
if (r === "masquerade") return { kind: "view_as", id: null, name: null, on_behalf_of: t };
|
|
157
|
+
if ((r === "api_key" || r === "key_sim") && e.api_key_id != null)
|
|
151
158
|
return {
|
|
152
159
|
kind: "api_key",
|
|
153
160
|
id: String(e.api_key_id),
|
|
154
161
|
name: i(e.api_key_name) || null,
|
|
155
162
|
on_behalf_of: t
|
|
156
163
|
};
|
|
157
|
-
const
|
|
164
|
+
const o = i(e.chain_parent), s = /^(cron|import_run|flow_run):(.+)$/.exec(o);
|
|
158
165
|
if (s) {
|
|
159
166
|
const a = s[1] === "cron" ? "cron" : s[1] === "import_run" ? "import" : "flow";
|
|
160
167
|
return { kind: a, id: s[2], name: a === "cron" ? s[2] : null, on_behalf_of: t };
|
|
161
168
|
}
|
|
162
|
-
const
|
|
163
|
-
return
|
|
169
|
+
const u = /^import:([^:]+)/i.exec(i(e.comment));
|
|
170
|
+
return u ? { kind: "import", id: u[1], name: u[1], on_behalf_of: t } : i(e.origin) === "import" ? { kind: "import", id: null, name: null, on_behalf_of: t } : t ? { kind: "person", id: t, name: null, on_behalf_of: null } : {
|
|
164
171
|
kind: "system",
|
|
165
172
|
id: null,
|
|
166
173
|
name: i(e.origin) === "integration" ? "An integration" : null
|
|
167
174
|
};
|
|
168
175
|
}
|
|
169
|
-
function
|
|
170
|
-
const t =
|
|
176
|
+
function B(e, n) {
|
|
177
|
+
const t = T(e), r = Q(e, n), o = C(t.on_behalf_of, n) ?? r;
|
|
171
178
|
switch (t.kind) {
|
|
172
179
|
case "person":
|
|
173
|
-
return
|
|
180
|
+
return r ?? "Someone";
|
|
174
181
|
case "view_as":
|
|
175
|
-
return `${(C(t.id, n) ?? i(t.name) ?? "") || "An administrator"} as ${
|
|
182
|
+
return `${(C(t.id, n) ?? i(t.name) ?? "") || "An administrator"} as ${o ?? "someone"}`;
|
|
176
183
|
case "api_key":
|
|
177
184
|
return `API key “${i(t.name) || (t.id ? `#${t.id}` : "unnamed")}”`;
|
|
178
185
|
case "mcp": {
|
|
179
186
|
const s = i(t.name).replace(/^via\s+/i, "") || "An assistant";
|
|
180
|
-
return
|
|
187
|
+
return o ? `${s} for ${o}` : s;
|
|
181
188
|
}
|
|
182
189
|
case "import":
|
|
183
190
|
return i(t.name) ? `Import “${i(t.name)}”` : "An import";
|
|
@@ -190,80 +197,80 @@ function Y(e, n) {
|
|
|
190
197
|
}
|
|
191
198
|
}
|
|
192
199
|
function I(e, n, t) {
|
|
193
|
-
const
|
|
194
|
-
if (!
|
|
195
|
-
const
|
|
196
|
-
if (s &&
|
|
197
|
-
const a = s[
|
|
200
|
+
const r = i(n);
|
|
201
|
+
if (!r || !i(e)) return null;
|
|
202
|
+
const o = `${e}:${r}`, s = t == null ? void 0 : t.records, { singular: u } = N(e, t);
|
|
203
|
+
if (s && o in s) {
|
|
204
|
+
const a = s[o];
|
|
198
205
|
if (a == null) return S;
|
|
199
|
-
const
|
|
200
|
-
return
|
|
206
|
+
const c = i(a);
|
|
207
|
+
return c ? c.toLowerCase().startsWith(u.toLowerCase()) ? c : `${u} ${c}` : u;
|
|
201
208
|
}
|
|
202
|
-
return
|
|
209
|
+
return Z.test(r) ? `a ${g(u)}` : `${u} ${r}`;
|
|
203
210
|
}
|
|
204
|
-
function
|
|
205
|
-
var
|
|
206
|
-
const
|
|
207
|
-
return i(
|
|
211
|
+
function D(e, n, t) {
|
|
212
|
+
var o;
|
|
213
|
+
const r = (o = t == null ? void 0 : t.fields) == null ? void 0 : o[`${e ?? ""}.${n}`];
|
|
214
|
+
return i(r) || j(n);
|
|
208
215
|
}
|
|
209
|
-
function
|
|
210
|
-
const
|
|
211
|
-
return
|
|
216
|
+
function y(e, n, t) {
|
|
217
|
+
const r = [...new Set(n)].map((o) => D(e, o, t));
|
|
218
|
+
return r.length === 0 ? "" : r.length === 1 ? r[0] : r.length <= 3 ? `${r.slice(0, -1).join(", ")} and ${r[r.length - 1]}` : `${r.slice(0, 2).join(", ")} and ${r.length - 2} other fields`;
|
|
212
219
|
}
|
|
213
|
-
function
|
|
220
|
+
function ne(e) {
|
|
214
221
|
const n = String(e ?? "");
|
|
215
222
|
return n.startsWith("$t:") ? j(n.slice(3).replace(/-/g, "_")) : n;
|
|
216
223
|
}
|
|
217
|
-
const
|
|
218
|
-
function
|
|
219
|
-
var
|
|
224
|
+
const te = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, re = /^\d{4}-\d{2}-\d{2}$/;
|
|
225
|
+
function K(e, n, t, r) {
|
|
226
|
+
var u, a;
|
|
220
227
|
if (t == null || t === "") return "empty";
|
|
221
228
|
if (typeof t == "boolean") return t ? "Yes" : "No";
|
|
222
229
|
if (typeof t == "object")
|
|
223
230
|
return Array.isArray(t) ? `${t.length} items` : "a new value";
|
|
224
|
-
const
|
|
225
|
-
if (s) return
|
|
226
|
-
if (
|
|
227
|
-
if (
|
|
228
|
-
const
|
|
229
|
-
if (!Number.isNaN(
|
|
231
|
+
const o = String(t), s = (a = (u = r == null ? void 0 : r.choices) == null ? void 0 : u[`${e ?? ""}.${n}`]) == null ? void 0 : a[o];
|
|
232
|
+
if (s) return ne(s);
|
|
233
|
+
if (re.test(o)) return o;
|
|
234
|
+
if (te.test(o)) {
|
|
235
|
+
const c = new Date(o);
|
|
236
|
+
if (!Number.isNaN(c.getTime()))
|
|
230
237
|
try {
|
|
231
|
-
return
|
|
238
|
+
return c.toLocaleString(void 0, {
|
|
232
239
|
dateStyle: "medium",
|
|
233
240
|
timeStyle: "short",
|
|
234
|
-
...
|
|
241
|
+
...r != null && r.timeZone ? { timeZone: r.timeZone } : {}
|
|
235
242
|
});
|
|
236
243
|
} catch {
|
|
237
|
-
return
|
|
244
|
+
return c.toLocaleString();
|
|
238
245
|
}
|
|
239
246
|
}
|
|
240
|
-
return
|
|
247
|
+
return o.length > 60 ? `${o.slice(0, 57)}…` : o;
|
|
241
248
|
}
|
|
242
|
-
function
|
|
249
|
+
function J(e, n, t, r) {
|
|
243
250
|
var s;
|
|
244
|
-
const
|
|
245
|
-
return !(!(
|
|
251
|
+
const o = `${e ?? ""}.${n}`;
|
|
252
|
+
return !(!(r != null && r.fields) || !(o in r.fields) || (s = r.links) != null && s[o] || t != null && typeof t == "object");
|
|
246
253
|
}
|
|
247
|
-
function
|
|
254
|
+
function M(e) {
|
|
248
255
|
var n, t;
|
|
249
|
-
return (n = e.changes) != null && n.length ? e.changes.map((
|
|
256
|
+
return (n = e.changes) != null && n.length ? e.changes.map((r) => r.field) : (t = e.changed_fields) != null && t.length ? e.changed_fields : e.delta && typeof e.delta == "object" ? Object.keys(e.delta) : [];
|
|
250
257
|
}
|
|
251
|
-
function
|
|
258
|
+
function U(e) {
|
|
252
259
|
const n = { from: null, to: null, via: null, note: null, auto: !1 };
|
|
253
260
|
let t = i(e);
|
|
254
261
|
if (!t) return n;
|
|
255
|
-
const
|
|
256
|
-
if (
|
|
257
|
-
return n.auto = !0, n.via = i(
|
|
258
|
-
const
|
|
259
|
-
|
|
262
|
+
const r = /^auto(?:-transition)?:?\s*"?([^"]*)"?$/i.exec(t);
|
|
263
|
+
if (r)
|
|
264
|
+
return n.auto = !0, n.via = i(r[1]) || null, n;
|
|
265
|
+
const o = /\s+—\s+"([\s\S]*)"\s*$/.exec(t);
|
|
266
|
+
o && (n.note = o[1], t = t.slice(0, o.index)), t = t.replace(/\s*\(bulk:[^)]*\)\s*$/i, "");
|
|
260
267
|
const s = /^bulk:\s*(.+?)\s*→\s*(.+)$/i.exec(t);
|
|
261
268
|
if (s)
|
|
262
269
|
return n.via = s[1], n.to = s[2], n;
|
|
263
|
-
const
|
|
264
|
-
if (
|
|
265
|
-
const a = i(
|
|
266
|
-
n.from = a && a !== "Start" ? a : null, n.to = i(
|
|
270
|
+
const u = /^(.*?)\s*→\s*(.+?)(?:\s+via\s+(.+))?$/.exec(t);
|
|
271
|
+
if (u) {
|
|
272
|
+
const a = i(u[1]);
|
|
273
|
+
n.from = a && a !== "Start" ? a : null, n.to = i(u[2]) || null, n.via = i(u[3]) || null;
|
|
267
274
|
}
|
|
268
275
|
return n;
|
|
269
276
|
}
|
|
@@ -388,7 +395,7 @@ const x = {
|
|
|
388
395
|
updated: "updated",
|
|
389
396
|
upload: "uploaded",
|
|
390
397
|
view: "viewed"
|
|
391
|
-
},
|
|
398
|
+
}, oe = /* @__PURE__ */ new Set([
|
|
392
399
|
"add",
|
|
393
400
|
"build",
|
|
394
401
|
"create",
|
|
@@ -403,72 +410,73 @@ const x = {
|
|
|
403
410
|
"schedule",
|
|
404
411
|
"upload"
|
|
405
412
|
]);
|
|
406
|
-
function
|
|
407
|
-
const n =
|
|
413
|
+
function V(e) {
|
|
414
|
+
const n = O(e).map((u) => u.toLowerCase());
|
|
408
415
|
if (n.length === 0) return { verb: null, past: null, noun: "" };
|
|
409
416
|
const t = n[n.length - 1];
|
|
410
|
-
let
|
|
411
|
-
if (x[t])
|
|
412
|
-
else if (x[n[0]])
|
|
413
|
-
else for (let
|
|
414
|
-
if (
|
|
415
|
-
const
|
|
416
|
-
return { verb:
|
|
417
|
-
}
|
|
418
|
-
function
|
|
419
|
-
return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e &&
|
|
420
|
-
}
|
|
421
|
-
function
|
|
417
|
+
let r = -1;
|
|
418
|
+
if (x[t]) r = n.length - 1;
|
|
419
|
+
else if (x[n[0]]) r = 0;
|
|
420
|
+
else for (let u = n.length - 1; u >= 0; u--) x[n[u]] && (r = u);
|
|
421
|
+
if (r < 0) return { verb: null, past: null, noun: n.map(q).join(" ") };
|
|
422
|
+
const o = n[r], s = [...n.slice(0, r), ...n.slice(r + 1)];
|
|
423
|
+
return { verb: o, past: x[o], noun: s.map(q).join(" ") };
|
|
424
|
+
}
|
|
425
|
+
function ie(e, n) {
|
|
426
|
+
return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e && oe.has(e) ? `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}` : `the ${n}` : "";
|
|
427
|
+
}
|
|
428
|
+
function se(e) {
|
|
422
429
|
const n = /(\d[\d,]*)\s+rows?/i.exec(e), t = /^\s*(csv|xlsx|json|pdf|xml)\b/i.exec(e);
|
|
423
430
|
return {
|
|
424
431
|
rows: n ? Number(n[1].replace(/,/g, "")) : null,
|
|
425
|
-
format: t ?
|
|
432
|
+
format: t ? P[t[1].toLowerCase()] ?? t[1].toUpperCase() : null
|
|
426
433
|
};
|
|
427
434
|
}
|
|
428
|
-
const
|
|
429
|
-
function
|
|
435
|
+
const z = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
|
|
436
|
+
function ae(e, n) {
|
|
430
437
|
var $, h, v, m, _;
|
|
431
|
-
const t = i(e.action),
|
|
438
|
+
const t = i(e.action), r = e.collection ?? null, o = I(r, e.item, n), s = N(r, n), u = `${/^[aeiou]/i.test(s.singular) ? "an" : "a"} ${g(s.singular)}`, a = i(e.comment), c = o ? ` on ${o}` : "";
|
|
432
439
|
if ((($ = e.event) == null ? void 0 : $.kind) === "start") {
|
|
433
440
|
const l = i(e.event.to_label);
|
|
434
|
-
return `started ${
|
|
441
|
+
return `started ${o ?? "the pipeline"}${l ? ` in ${l}` : ""}`;
|
|
435
442
|
}
|
|
436
|
-
if (((h = e.event) == null ? void 0 : h.kind) === "transition" ||
|
|
443
|
+
if (((h = e.event) == null ? void 0 : h.kind) === "transition" || z.has(t)) {
|
|
437
444
|
const l = e.event ? {
|
|
438
445
|
from: i(e.event.from_label) || null,
|
|
439
446
|
to: i(e.event.to_label) || null,
|
|
440
447
|
via: i(e.event.transition_label) || null
|
|
441
|
-
} :
|
|
448
|
+
} : U(a), p = (v = e.event) != null && v.addendum ? `Addendum “${i(e.event.addendum.title) || "Untitled"}”` : o ?? "a record";
|
|
442
449
|
return l.from && l.to ? `moved ${p} from ${l.from} to ${l.to}` : l.to ? `moved ${p} to ${l.to}` : l.via ? `ran “${l.via}” on ${p}` : `moved ${p}`;
|
|
443
450
|
}
|
|
444
451
|
switch (t) {
|
|
445
452
|
case "create":
|
|
446
453
|
case "o2m-create":
|
|
447
|
-
return t === "o2m-create" ? `added related rows${
|
|
454
|
+
return t === "o2m-create" ? e.o2m ? `${L(e.o2m)}${c}` : `added related rows${c}` : r === "nivaro_settings" ? "saved the settings" : `created ${o ?? u}`;
|
|
448
455
|
case "update":
|
|
449
456
|
case "o2m-update": {
|
|
450
|
-
if (t === "o2m-update")
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
457
|
+
if (t === "o2m-update")
|
|
458
|
+
return e.o2m ? `${L(e.o2m)}${c}` : `changed related rows${c}`;
|
|
459
|
+
const l = M(e);
|
|
460
|
+
if (r === "nivaro_settings")
|
|
461
|
+
return l.length ? `changed the ${y(r, l, n)} setting${l.length === 1 ? "" : "s"}` : "changed the settings";
|
|
462
|
+
if (r === "nivaro_approval_instances" && ((m = e.why) != null && m.approval)) {
|
|
455
463
|
const p = e.why.approval, A = I(p.collection, p.item, n);
|
|
456
|
-
return `${(x[i(p.decision).toLowerCase()] ?? i(p.decision).toLowerCase()) || "decided on"} ${A ??
|
|
464
|
+
return `${(x[i(p.decision).toLowerCase()] ?? i(p.decision).toLowerCase()) || "decided on"} ${A ?? o ?? "an approval"}${p.chain ? ` (${p.chain})` : ""}`;
|
|
457
465
|
}
|
|
458
466
|
if (l.length) {
|
|
459
467
|
const p = ((_ = e.changes) == null ? void 0 : _.length) === 1 ? e.changes[0] : null;
|
|
460
|
-
return p && "value" in p &&
|
|
468
|
+
return p && "value" in p && J(r, p.field, p.value, n) ? `set ${D(r, p.field, n)} to ${K(r, p.field, p.value, n)}${c}` : `changed ${y(r, l, n)}${c}`;
|
|
461
469
|
}
|
|
462
|
-
return `updated ${
|
|
470
|
+
return `updated ${o ?? u}`;
|
|
463
471
|
}
|
|
464
472
|
case "delete":
|
|
465
473
|
case "o2m-delete":
|
|
466
|
-
return t === "o2m-delete" ? `removed related rows${
|
|
474
|
+
return t === "o2m-delete" ? e.o2m ? `${L(e.o2m)}${c}` : `removed related rows${c}` : `deleted ${o ?? u}`;
|
|
467
475
|
case "restore":
|
|
468
|
-
return `restored ${
|
|
476
|
+
return `restored ${o ?? u}`;
|
|
469
477
|
case "pipeline-start": {
|
|
470
478
|
const l = /initial state:\s*(.+)$/i.exec(a);
|
|
471
|
-
return `started ${
|
|
479
|
+
return `started ${o ?? "the pipeline"}${l ? ` in ${l[1]}` : ""}`;
|
|
472
480
|
}
|
|
473
481
|
case "login":
|
|
474
482
|
return "signed in";
|
|
@@ -477,8 +485,8 @@ function se(e, n) {
|
|
|
477
485
|
case "login-refused":
|
|
478
486
|
return "was refused sign-in";
|
|
479
487
|
case "export": {
|
|
480
|
-
const l =
|
|
481
|
-
return `exported ${l.rows != null ?
|
|
488
|
+
const l = se(a);
|
|
489
|
+
return `exported ${l.rows != null ? b(l.rows, r, n) : g(s.plural)}${l.format ? ` to ${l.format}` : ""}`;
|
|
482
490
|
}
|
|
483
491
|
case "masquerade-start":
|
|
484
492
|
return `started viewing as ${w(e, n, a)}`;
|
|
@@ -489,18 +497,18 @@ function se(e, n) {
|
|
|
489
497
|
case "token.revoke":
|
|
490
498
|
return `revoked the static token of ${w(e, n, "")}`;
|
|
491
499
|
case "api_key_created":
|
|
492
|
-
return `created ${
|
|
500
|
+
return `created ${o && o !== S ? o : "an API key"}`;
|
|
493
501
|
case "api_key_revoked":
|
|
494
|
-
return `revoked ${
|
|
502
|
+
return `revoked ${o && o !== S ? o : "an API key"}`;
|
|
495
503
|
case "api_key_deleted":
|
|
496
|
-
return `deleted ${
|
|
504
|
+
return `deleted ${o && o !== S ? o : "an API key"}`;
|
|
497
505
|
case "api_key_simulate":
|
|
498
|
-
return `tested requests as ${
|
|
506
|
+
return `tested requests as ${o && o !== S ? o : "an API key"}`;
|
|
499
507
|
case "set_role":
|
|
500
508
|
return `changed the role of ${w(e, n, "")}`;
|
|
501
509
|
case "bulk-write":
|
|
502
510
|
case "bulk-action-execute": {
|
|
503
|
-
const l = /(\d+)\s+(?:item|row)/i.exec(a), p = l ?
|
|
511
|
+
const l = /(\d+)\s+(?:item|row)/i.exec(a), p = l ? b(Number(l[1]), r, n) : g(s.plural), A = t === "bulk-action-execute" ? /^(.+?)\s*\([^)]*\)\s+on\s/.exec(a) : null;
|
|
504
512
|
return A ? `ran “${A[1]}” on ${p}` : `changed ${p} in bulk`;
|
|
505
513
|
}
|
|
506
514
|
case "import-create":
|
|
@@ -511,11 +519,11 @@ function se(e, n) {
|
|
|
511
519
|
case "import-failed":
|
|
512
520
|
return `had an import into ${g(s.plural)} fail`;
|
|
513
521
|
case "comment":
|
|
514
|
-
return `commented${
|
|
522
|
+
return `commented${c}`;
|
|
515
523
|
case "picker-exclude":
|
|
516
|
-
return `hid ${
|
|
524
|
+
return `hid ${o ?? u} from pickers`;
|
|
517
525
|
case "picker-include":
|
|
518
|
-
return `showed ${
|
|
526
|
+
return `showed ${o ?? u} in pickers again`;
|
|
519
527
|
case "ai-brief":
|
|
520
528
|
return "asked the assistant for a brief";
|
|
521
529
|
case "config-epoch":
|
|
@@ -525,146 +533,147 @@ function se(e, n) {
|
|
|
525
533
|
case "config-snapshot-export":
|
|
526
534
|
return "downloaded a configuration snapshot";
|
|
527
535
|
}
|
|
528
|
-
if (!t) return `did something${
|
|
529
|
-
const d =
|
|
530
|
-
return /settings$/.test(d.noun) && !d.verb ? `changed the ${d.noun}` : d.past ?
|
|
536
|
+
if (!t) return `did something${c}`;
|
|
537
|
+
const d = V(t);
|
|
538
|
+
return /settings$/.test(d.noun) && !d.verb ? `changed the ${d.noun}` : d.past ? o && d.noun && g(s.singular).toLowerCase().includes(d.noun.toLowerCase()) ? `${d.past} ${o}` : d.noun ? `${d.past} ${ie(d.verb, d.noun)}${c}` : `${d.past} ${o ?? "something"}` : `recorded “${Y(t)}”${c}`;
|
|
531
539
|
}
|
|
532
540
|
function w(e, n, t) {
|
|
533
|
-
const
|
|
534
|
-
if (
|
|
541
|
+
const r = i(e.item), o = C(r, n) ?? (t || null);
|
|
542
|
+
if (o) return o;
|
|
535
543
|
const s = e.collection === "nivaro_users" ? I(e.collection, e.item, n) : null;
|
|
536
|
-
return s && !
|
|
544
|
+
return s && !Z.test(r) ? s : "someone";
|
|
537
545
|
}
|
|
538
|
-
function
|
|
539
|
-
return `${
|
|
546
|
+
function ce(e, n) {
|
|
547
|
+
return `${B(e, n)} ${ae(e, n)}`;
|
|
540
548
|
}
|
|
541
|
-
function
|
|
542
|
-
var a,
|
|
549
|
+
function fe(e) {
|
|
550
|
+
var a, c, d, f;
|
|
543
551
|
const n = i(e.action), t = i(e.comment);
|
|
544
|
-
let
|
|
545
|
-
!
|
|
546
|
-
const s = (f = e.why) == null ? void 0 : f.approval,
|
|
547
|
-
return { reason:
|
|
552
|
+
let r = i((a = e.why) == null ? void 0 : a.reason) || null, o = i((c = e.why) == null ? void 0 : c.note) || null;
|
|
553
|
+
!o && z.has(n) && !e.event && (o = U(t).note), !o && ((d = e.event) == null ? void 0 : d.kind) === "transition" && t && (o = t), !r && (n === "create" || n === "update" || n === "delete") && t && !/^import:/i.test(t) && (r = t);
|
|
554
|
+
const s = (f = e.why) == null ? void 0 : f.approval, u = s ? `${j(i(s.decision)) || "Decided"}${s.chain ? ` · ${s.chain}` : ""}${s.step != null && s.step !== "" ? ` · step ${s.step}` : ""}${i(s.comment) ? ` — “${i(s.comment)}”` : ""}` : null;
|
|
555
|
+
return { reason: r, note: o, approval: u };
|
|
548
556
|
}
|
|
549
|
-
const
|
|
550
|
-
function
|
|
557
|
+
const ue = 6e4;
|
|
558
|
+
function W(e) {
|
|
551
559
|
return e.timestamp ? new Date(e.timestamp).getTime() : Number.NaN;
|
|
552
560
|
}
|
|
553
|
-
function
|
|
554
|
-
const n =
|
|
561
|
+
function F(e) {
|
|
562
|
+
const n = T(e);
|
|
555
563
|
return `${n.kind}|${i(n.id)}|${i(e.user ?? e.user_id).toUpperCase()}`;
|
|
556
564
|
}
|
|
557
|
-
function
|
|
565
|
+
function de(e) {
|
|
558
566
|
const n = i(e.action);
|
|
559
567
|
return !i(e.item) && (n.startsWith("bulk-") || n === "import-complete");
|
|
560
568
|
}
|
|
561
|
-
function
|
|
562
|
-
const t = n.windowMs ??
|
|
563
|
-
for (const
|
|
564
|
-
const s =
|
|
565
|
-
if (s &&
|
|
566
|
-
const
|
|
567
|
-
if (a && a ===
|
|
568
|
-
s.entries.push(
|
|
569
|
+
function me(e, n = {}) {
|
|
570
|
+
const t = n.windowMs ?? ue, r = [];
|
|
571
|
+
for (const o of e) {
|
|
572
|
+
const s = r[r.length - 1], u = s == null ? void 0 : s.entries[s.entries.length - 1], a = i(o.group_key);
|
|
573
|
+
if (s && u) {
|
|
574
|
+
const c = i(u.group_key);
|
|
575
|
+
if (a && a === c) {
|
|
576
|
+
s.entries.push(o), s.by = "group_key";
|
|
569
577
|
continue;
|
|
570
578
|
}
|
|
571
|
-
if (!a && !
|
|
572
|
-
s.entries.push(
|
|
579
|
+
if (!a && !c && s.by !== "group_key" && i(o.action) === i(u.action) && i(o.collection) === i(u.collection) && i(o.collection) !== "" && F(o) === F(u) && Math.abs(W(u) - W(o)) <= t) {
|
|
580
|
+
s.entries.push(o), s.by = "time";
|
|
573
581
|
continue;
|
|
574
582
|
}
|
|
575
583
|
}
|
|
576
|
-
|
|
584
|
+
r.push({ key: `${a || "e"}:${o.id ?? r.length}`, entries: [o], by: null });
|
|
577
585
|
}
|
|
578
|
-
return
|
|
586
|
+
return r;
|
|
579
587
|
}
|
|
580
|
-
function
|
|
588
|
+
function $e(e, n) {
|
|
581
589
|
if (e.length === 0) return "";
|
|
582
|
-
const t = e.filter((m) => !
|
|
583
|
-
if (t.length <= 1) return
|
|
584
|
-
const
|
|
585
|
-
t.map((m) =>
|
|
590
|
+
const t = e.filter((m) => !de(m)), r = t[0] ?? e[0];
|
|
591
|
+
if (t.length <= 1) return ce(r, n);
|
|
592
|
+
const o = B(r, n), u = new Set(t.map((m) => i(m.collection))).size === 1 ? r.collection ?? null : null, a = new Set(t.map((m) => i(m.item))), c = a.size > 1 ? a.size : t.length, d = u ? a.size === 1 && i(r.item) ? I(u, r.item, n) ?? b(c, u, n) : b(c, u, n) : `${c} records`, f = a.size === 1 && t.length > 1 ? ` ${t.length} times` : "", $ = new Set(
|
|
593
|
+
t.map((m) => z.has(i(m.action)) ? "transition" : i(m.action))
|
|
586
594
|
);
|
|
587
|
-
if ($.size !== 1) return `${
|
|
595
|
+
if ($.size !== 1) return `${o} made ${t.length} changes to ${d}`;
|
|
588
596
|
const h = [...$][0];
|
|
589
597
|
if (h === "transition") {
|
|
590
598
|
const m = new Set(
|
|
591
599
|
t.map((l) => {
|
|
592
600
|
var p;
|
|
593
|
-
return i(((p = l.event) == null ? void 0 : p.to_label) ??
|
|
601
|
+
return i(((p = l.event) == null ? void 0 : p.to_label) ?? U(l.comment).to);
|
|
594
602
|
})
|
|
595
603
|
), _ = m.size === 1 ? [...m][0] : "";
|
|
596
|
-
return `${
|
|
604
|
+
return `${o} moved ${d}${_ ? ` to ${_}` : ""}${f}`;
|
|
597
605
|
}
|
|
598
606
|
if (h === "update") {
|
|
599
|
-
const m =
|
|
600
|
-
return `${
|
|
607
|
+
const m = le(t, u, n);
|
|
608
|
+
return `${o} updated ${d}${f}${m ? `: ${m}` : ""}`;
|
|
601
609
|
}
|
|
602
|
-
if (h === "create") return `${
|
|
603
|
-
if (h === "delete") return `${
|
|
604
|
-
if (h === "picker-exclude") return `${
|
|
605
|
-
if (h === "picker-include") return `${
|
|
606
|
-
const v =
|
|
607
|
-
return v.past ? `${
|
|
608
|
-
}
|
|
609
|
-
function
|
|
610
|
+
if (h === "create") return `${o} created ${d}`;
|
|
611
|
+
if (h === "delete") return `${o} deleted ${d}`;
|
|
612
|
+
if (h === "picker-exclude") return `${o} hid ${d} from pickers${f}`;
|
|
613
|
+
if (h === "picker-include") return `${o} showed ${d} in pickers again${f}`;
|
|
614
|
+
const v = V(h);
|
|
615
|
+
return v.past ? `${o} ${v.past} ${d}${v.noun && !g(N(u, n).plural).toLowerCase().includes(v.noun) ? ` (${v.noun})` : ""}${f}` : `${o} recorded “${Y(h)}” on ${d}`;
|
|
616
|
+
}
|
|
617
|
+
function le(e, n, t) {
|
|
610
618
|
var a;
|
|
611
|
-
const
|
|
612
|
-
if (!(
|
|
613
|
-
const
|
|
614
|
-
return
|
|
619
|
+
const r = ((a = e[0]) == null ? void 0 : a.changes) ?? null;
|
|
620
|
+
if (!(r != null && r.length)) {
|
|
621
|
+
const c = e.map((d) => M(d).sort().join(","));
|
|
622
|
+
return c[0] && c.every((d) => d === c[0]) ? y(n, c[0].split(","), t) : "";
|
|
615
623
|
}
|
|
616
|
-
const
|
|
617
|
-
if (e.every((
|
|
618
|
-
return
|
|
619
|
-
(
|
|
624
|
+
const o = (c) => JSON.stringify((c.changes ?? []).map((d) => [d.field, d.value ?? null]).sort());
|
|
625
|
+
if (e.every((c) => o(c) === o(e[0])) && r.length <= 2 && r.every((c) => J(n, c.field, c.value, t)))
|
|
626
|
+
return r.map(
|
|
627
|
+
(c) => `${D(n, c.field, t)} → ${K(n, c.field, c.value, t)}`
|
|
620
628
|
).join(", ");
|
|
621
|
-
const
|
|
622
|
-
return
|
|
623
|
-
}
|
|
624
|
-
function
|
|
625
|
-
var
|
|
626
|
-
const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(),
|
|
627
|
-
const d = i(a), f = i(
|
|
628
|
-
!d || !f || (
|
|
629
|
+
const u = new Set(e.flatMap((c) => (c.changes ?? []).map((d) => d.field)));
|
|
630
|
+
return y(n, [...u], t);
|
|
631
|
+
}
|
|
632
|
+
function he(e) {
|
|
633
|
+
var u;
|
|
634
|
+
const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = (a, c) => {
|
|
635
|
+
const d = i(a), f = i(c);
|
|
636
|
+
!d || !f || (o.add(d), d === "nivaro_users" && t.add(f), n.set(`${d}:${f}`, { collection: d, id: f }));
|
|
629
637
|
};
|
|
630
638
|
for (const a of e) {
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
-
const d =
|
|
634
|
-
d.kind === "view_as" && d.id && t.add(d.id), d.on_behalf_of && t.add(d.on_behalf_of), i(a.collection) &&
|
|
635
|
-
for (const f of
|
|
639
|
+
const c = i(a.user ?? a.user_id);
|
|
640
|
+
c && t.add(c);
|
|
641
|
+
const d = T(a);
|
|
642
|
+
d.kind === "view_as" && d.id && t.add(d.id), d.on_behalf_of && t.add(d.on_behalf_of), i(a.collection) && o.add(i(a.collection)), s(a.collection, a.item), (u = a.why) != null && u.approval && s(a.why.approval.collection, a.why.approval.item);
|
|
643
|
+
for (const f of M(a)) {
|
|
636
644
|
const $ = i(a.collection);
|
|
637
|
-
$ &&
|
|
645
|
+
$ && r.set(`${$}.${f}`, { collection: $, field: f });
|
|
638
646
|
}
|
|
639
647
|
}
|
|
640
648
|
return {
|
|
641
649
|
refs: [...n.values()],
|
|
642
650
|
users: [...t],
|
|
643
|
-
fields: [...
|
|
644
|
-
collections: [...
|
|
651
|
+
fields: [...r.values()],
|
|
652
|
+
collections: [...o]
|
|
645
653
|
};
|
|
646
654
|
}
|
|
647
655
|
export {
|
|
648
|
-
|
|
656
|
+
ue as BURST_WINDOW_MS,
|
|
649
657
|
S as HIDDEN_RECORD,
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
658
|
+
V as actionParts,
|
|
659
|
+
he as activityLabelRefs,
|
|
660
|
+
ae as activityPredicate,
|
|
661
|
+
fe as activityWhy,
|
|
662
|
+
B as actorName,
|
|
663
|
+
T as actorOf,
|
|
664
|
+
ne as choiceText,
|
|
665
|
+
N as collectionNouns,
|
|
666
|
+
b as countNoun,
|
|
667
|
+
D as fieldLabel,
|
|
668
|
+
y as fieldList,
|
|
669
|
+
me as groupActivity,
|
|
670
|
+
L as o2mSentence,
|
|
671
|
+
ee as parseActor,
|
|
672
|
+
U as parseTransitionComment,
|
|
673
|
+
Y as readableTitle,
|
|
665
674
|
I as recordPhrase,
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
675
|
+
$e as renderActivityGroupSentence,
|
|
676
|
+
ce as renderActivitySentence,
|
|
677
|
+
J as valueShowable,
|
|
678
|
+
K as valueText
|
|
670
679
|
};
|