@nivaro/react 0.3.138 → 0.3.139
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.
|
@@ -5,7 +5,7 @@ function M(e) {
|
|
|
5
5
|
const o = (e.changes ?? []).filter((s) => s && i(s.label)).map((s) => `${i(s.label)} ${i(s.from) || "—"} → ${i(s.to) || "—"}`);
|
|
6
6
|
return o.length ? `changed ${r}: ${o.join(", ")}` : `changed ${r}`;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function Le(e) {
|
|
9
9
|
return (e.totals ?? []).filter((n) => n && i(n.label) && Number.isFinite(n.delta) && n.delta !== 0).map(
|
|
10
10
|
(n) => `${i(n.label)} ${n.delta > 0 ? "+" : "−"}${Math.abs(n.delta).toLocaleString("en-US", { maximumFractionDigits: 2 })}`
|
|
11
11
|
).join(", ");
|
|
@@ -34,7 +34,7 @@ const k = "a record you can't see", z = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0
|
|
|
34
34
|
function i(e) {
|
|
35
35
|
return e == null ? "" : String(e).trim();
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function se(e) {
|
|
38
38
|
return i(e).toUpperCase();
|
|
39
39
|
}
|
|
40
40
|
function F(e) {
|
|
@@ -44,14 +44,14 @@ function U(e) {
|
|
|
44
44
|
const n = e.toLowerCase();
|
|
45
45
|
return W[n] ?? n;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function X(e) {
|
|
48
48
|
const n = F(e).map(U).join(" ");
|
|
49
49
|
return n ? n.charAt(0).toUpperCase() + n.slice(1) : "";
|
|
50
50
|
}
|
|
51
51
|
function q(e) {
|
|
52
52
|
return F(e).map((n) => W[n.toLowerCase()] ?? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function V(e) {
|
|
55
55
|
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;
|
|
56
56
|
}
|
|
57
57
|
function D(e) {
|
|
@@ -60,7 +60,7 @@ function D(e) {
|
|
|
60
60
|
function g(e) {
|
|
61
61
|
return e.split(" ").map((n) => /[A-Z][^ ]*[A-Z]/.test(n) ? n : n.toLowerCase()).join(" ");
|
|
62
62
|
}
|
|
63
|
-
const
|
|
63
|
+
const ae = {
|
|
64
64
|
nivaro_activity: "Activity entry",
|
|
65
65
|
nivaro_activity_views: "Activity view",
|
|
66
66
|
nivaro_addendums: "Addendum",
|
|
@@ -126,45 +126,45 @@ const se = {
|
|
|
126
126
|
nivaro_workflow_states: "Pipeline state",
|
|
127
127
|
nivaro_workflow_templates: "Pipeline",
|
|
128
128
|
nivaro_workflow_transitions: "Pipeline move"
|
|
129
|
-
},
|
|
130
|
-
function
|
|
129
|
+
}, ce = /^(nivaro|directus)_/i;
|
|
130
|
+
function N(e) {
|
|
131
131
|
const n = g(e);
|
|
132
132
|
return `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}`;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function I(e, n) {
|
|
135
135
|
var l;
|
|
136
136
|
const t = i(e);
|
|
137
137
|
if (!t) return { singular: "Record", plural: "Records" };
|
|
138
138
|
const r = (l = n == null ? void 0 : n.collections) == null ? void 0 : l[t], o = typeof r == "string" ? { plural: r } : r ?? {}, s = i(o.plural), a = i(o.singular);
|
|
139
139
|
if (a || s) {
|
|
140
|
-
const f = a ||
|
|
140
|
+
const f = a || A(s, V), $ = s && s !== f ? s : A(f, D);
|
|
141
141
|
return { singular: f, plural: $ };
|
|
142
142
|
}
|
|
143
|
-
const c =
|
|
144
|
-
if (c) return { singular: c, plural: c === "Settings" ? c :
|
|
145
|
-
const u = q(t.replace(/^(nivaro|directus)_/, "")) || "Record", d =
|
|
146
|
-
return { singular: d, plural:
|
|
143
|
+
const c = ae[t];
|
|
144
|
+
if (c) return { singular: c, plural: c === "Settings" ? c : A(c, D) };
|
|
145
|
+
const u = q(t.replace(/^(nivaro|directus)_/, "")) || "Record", d = A(u, V);
|
|
146
|
+
return { singular: d, plural: A(d, D) };
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function A(e, n) {
|
|
149
149
|
const t = e.split(" ");
|
|
150
150
|
return t[t.length - 1] = n(t[t.length - 1] ?? ""), t.join(" ");
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
const { singular: r, plural: o } =
|
|
152
|
+
function P(e, n, t) {
|
|
153
|
+
const { singular: r, plural: o } = I(n, t);
|
|
154
154
|
return `${e} ${g(e === 1 ? r : o)}`;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
157
|
-
const t = e.user ?? e.user_id ?? null, r = t ?
|
|
156
|
+
function ue(e, n) {
|
|
157
|
+
const t = e.user ?? e.user_id ?? null, r = t ? L(t, n) : null;
|
|
158
158
|
if (r) return r;
|
|
159
159
|
const o = [i(e.first_name), i(e.last_name)].filter(Boolean).join(" ");
|
|
160
160
|
return o || (i(e.user_email) ? i(e.user_email) : null);
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function L(e, n) {
|
|
163
163
|
if (!e || !(n != null && n.users)) return null;
|
|
164
164
|
const t = n.users;
|
|
165
|
-
return i(t[e] ?? t[
|
|
165
|
+
return i(t[e] ?? t[se(e)] ?? t[i(e).toLowerCase()]) || null;
|
|
166
166
|
}
|
|
167
|
-
const
|
|
167
|
+
const de = /* @__PURE__ */ new Set([
|
|
168
168
|
"person",
|
|
169
169
|
"view_as",
|
|
170
170
|
"api_key",
|
|
@@ -174,7 +174,7 @@ const ue = /* @__PURE__ */ new Set([
|
|
|
174
174
|
"cron",
|
|
175
175
|
"system"
|
|
176
176
|
]);
|
|
177
|
-
function
|
|
177
|
+
function le(e) {
|
|
178
178
|
if (e == null || e === "") return null;
|
|
179
179
|
let n = e;
|
|
180
180
|
if (typeof e == "string")
|
|
@@ -185,7 +185,7 @@ function de(e) {
|
|
|
185
185
|
}
|
|
186
186
|
if (!n || typeof n != "object") return null;
|
|
187
187
|
const t = n, r = i(t.kind);
|
|
188
|
-
return
|
|
188
|
+
return de.has(r) ? {
|
|
189
189
|
kind: r,
|
|
190
190
|
id: t.id == null ? null : String(t.id),
|
|
191
191
|
name: t.name == null ? null : String(t.name),
|
|
@@ -193,7 +193,7 @@ function de(e) {
|
|
|
193
193
|
} : null;
|
|
194
194
|
}
|
|
195
195
|
function Y(e) {
|
|
196
|
-
const n =
|
|
196
|
+
const n = le(e.actor);
|
|
197
197
|
if (n) return n;
|
|
198
198
|
const t = e.user ?? e.user_id ?? null;
|
|
199
199
|
if (i(e.mcp_conn) || i(e.via_app) || i(e.via_agent))
|
|
@@ -224,13 +224,13 @@ function Y(e) {
|
|
|
224
224
|
name: i(e.origin) === "integration" ? "An integration" : null
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
const t = Y(e), r =
|
|
227
|
+
function ee(e, n) {
|
|
228
|
+
const t = Y(e), r = ue(e, n), o = L(t.on_behalf_of, n) ?? r;
|
|
229
229
|
switch (t.kind) {
|
|
230
230
|
case "person":
|
|
231
231
|
return r ?? "Someone";
|
|
232
232
|
case "view_as":
|
|
233
|
-
return `${(
|
|
233
|
+
return `${(L(t.id, n) ?? i(t.name) ?? "") || "An administrator"} as ${o ?? "someone"}`;
|
|
234
234
|
case "api_key":
|
|
235
235
|
return `API key “${i(t.name) || (t.id ? `#${t.id}` : "unnamed")}”`;
|
|
236
236
|
case "mcp": {
|
|
@@ -247,32 +247,48 @@ function H(e, n) {
|
|
|
247
247
|
return i(t.name) || "System";
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function j(e, n, t) {
|
|
251
|
+
var s;
|
|
251
252
|
const r = i(n);
|
|
252
253
|
if (!r || !i(e)) return null;
|
|
253
|
-
const o =
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
return
|
|
254
|
+
const o = (s = t == null ? void 0 : t.junctions) == null ? void 0 : s[`${e}:${r}`];
|
|
255
|
+
return o ? fe(o, t) : Z(e, r, t);
|
|
256
|
+
}
|
|
257
|
+
function pe(e, n) {
|
|
258
|
+
const t = i(e.parent_id);
|
|
259
|
+
if (!t) return !1;
|
|
260
|
+
const r = Z(e.parent_collection, t, n);
|
|
261
|
+
return !!r && r !== k;
|
|
262
|
+
}
|
|
263
|
+
function fe(e, n) {
|
|
264
|
+
const t = G(e, n), r = i(e.value);
|
|
265
|
+
return r ? `${e.noun} ${r} on ${t}` : pe(e, n) ? `${t} · ${e.noun}` : `${Q(e.noun)} on ${t}`;
|
|
261
266
|
}
|
|
262
267
|
function Z(e, n, t) {
|
|
268
|
+
if (!n || !i(e)) return null;
|
|
269
|
+
const r = `${e}:${n}`, o = t == null ? void 0 : t.records, { singular: s } = I(e, t), a = ce.test(i(e));
|
|
270
|
+
if (o && r in o) {
|
|
271
|
+
const c = o[r];
|
|
272
|
+
if (c == null) return a ? N(s) : k;
|
|
273
|
+
const u = i(c);
|
|
274
|
+
return u ? a && (u === n || z.test(u)) ? N(s) : u.toLowerCase().startsWith(s.toLowerCase()) ? u : `${s} ${u}` : a ? N(s) : s;
|
|
275
|
+
}
|
|
276
|
+
return a || z.test(n) ? N(s) : `${s} ${n}`;
|
|
277
|
+
}
|
|
278
|
+
function B(e, n, t) {
|
|
263
279
|
var o;
|
|
264
280
|
const r = (o = t == null ? void 0 : t.fields) == null ? void 0 : o[`${e ?? ""}.${n}`];
|
|
265
281
|
return i(r) || q(n);
|
|
266
282
|
}
|
|
267
|
-
function
|
|
268
|
-
const r = [...new Set(n)].map((o) =>
|
|
283
|
+
function T(e, n, t) {
|
|
284
|
+
const r = [...new Set(n)].map((o) => B(e, o, t));
|
|
269
285
|
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`;
|
|
270
286
|
}
|
|
271
|
-
function
|
|
287
|
+
function me(e) {
|
|
272
288
|
const n = String(e ?? "");
|
|
273
289
|
return n.startsWith("$t:") ? q(n.slice(3).replace(/-/g, "_")) : n;
|
|
274
290
|
}
|
|
275
|
-
const
|
|
291
|
+
const $e = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, _e = /^\d{4}-\d{2}-\d{2}$/, ve = /<\/?[a-z][a-z0-9]*(\s[^>]*)?\/?>/i, he = {
|
|
276
292
|
" ": " ",
|
|
277
293
|
"&": "&",
|
|
278
294
|
"<": "<",
|
|
@@ -280,21 +296,21 @@ const pe = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, fe = /^\d{4}-\d{2}-\d{2}$/, me = /<
|
|
|
280
296
|
""": '"',
|
|
281
297
|
"'": "'"
|
|
282
298
|
};
|
|
283
|
-
function
|
|
284
|
-
return e.replace(/<(script|style|template)\b[\s\S]*?<\/\1>/gi, " ").replace(/<[^>]+>/g, " ").replace(/&(nbsp|amp|lt|gt|quot|#39);/g, (n) =>
|
|
299
|
+
function ge(e) {
|
|
300
|
+
return e.replace(/<(script|style|template)\b[\s\S]*?<\/\1>/gi, " ").replace(/<[^>]+>/g, " ").replace(/&(nbsp|amp|lt|gt|quot|#39);/g, (n) => he[n] ?? n).replace(/\s+/g, " ").trim();
|
|
285
301
|
}
|
|
286
|
-
function
|
|
302
|
+
function ne(e, n, t, r) {
|
|
287
303
|
var c, u;
|
|
288
304
|
if (t == null || t === "") return "empty";
|
|
289
305
|
if (typeof t == "boolean") return t ? "Yes" : "No";
|
|
290
306
|
if (typeof t == "object")
|
|
291
307
|
return Array.isArray(t) ? `${t.length} items` : "a new value";
|
|
292
|
-
const o = String(t), s =
|
|
308
|
+
const o = String(t), s = ve.test(o) ? ge(o) : o;
|
|
293
309
|
if (!s) return "empty";
|
|
294
310
|
const a = (u = (c = r == null ? void 0 : r.choices) == null ? void 0 : c[`${e ?? ""}.${n}`]) == null ? void 0 : u[s];
|
|
295
|
-
if (a) return
|
|
296
|
-
if (
|
|
297
|
-
if (
|
|
311
|
+
if (a) return me(a);
|
|
312
|
+
if (_e.test(s)) return s;
|
|
313
|
+
if ($e.test(s)) {
|
|
298
314
|
const d = new Date(s);
|
|
299
315
|
if (!Number.isNaN(d.getTime()))
|
|
300
316
|
try {
|
|
@@ -309,12 +325,12 @@ function V(e, n, t, r) {
|
|
|
309
325
|
}
|
|
310
326
|
return s.length > 60 ? `${s.slice(0, 57)}…` : s;
|
|
311
327
|
}
|
|
312
|
-
function
|
|
328
|
+
function te(e, n, t, r) {
|
|
313
329
|
var s;
|
|
314
330
|
const o = `${e ?? ""}.${n}`;
|
|
315
331
|
return !(!(r != null && r.fields) || !(o in r.fields) || (s = r.links) != null && s[o] || t != null && typeof t == "object");
|
|
316
332
|
}
|
|
317
|
-
function
|
|
333
|
+
function K(e) {
|
|
318
334
|
var n, t;
|
|
319
335
|
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) : [];
|
|
320
336
|
}
|
|
@@ -337,7 +353,7 @@ function J(e) {
|
|
|
337
353
|
}
|
|
338
354
|
return n;
|
|
339
355
|
}
|
|
340
|
-
const
|
|
356
|
+
const b = {
|
|
341
357
|
ack: "acknowledged",
|
|
342
358
|
acknowledge: "acknowledged",
|
|
343
359
|
acquire: "took",
|
|
@@ -458,7 +474,7 @@ const x = {
|
|
|
458
474
|
updated: "updated",
|
|
459
475
|
upload: "uploaded",
|
|
460
476
|
view: "viewed"
|
|
461
|
-
},
|
|
477
|
+
}, ke = /* @__PURE__ */ new Set([
|
|
462
478
|
"add",
|
|
463
479
|
"build",
|
|
464
480
|
"create",
|
|
@@ -473,22 +489,22 @@ const x = {
|
|
|
473
489
|
"schedule",
|
|
474
490
|
"upload"
|
|
475
491
|
]);
|
|
476
|
-
function
|
|
492
|
+
function re(e) {
|
|
477
493
|
const n = F(e).map((a) => a.toLowerCase());
|
|
478
494
|
if (n.length === 0) return { verb: null, past: null, noun: "" };
|
|
479
495
|
const t = n[n.length - 1];
|
|
480
496
|
let r = -1;
|
|
481
|
-
if (
|
|
482
|
-
else if (
|
|
483
|
-
else for (let a = n.length - 1; a >= 0; a--)
|
|
497
|
+
if (b[t]) r = n.length - 1;
|
|
498
|
+
else if (b[n[0]]) r = 0;
|
|
499
|
+
else for (let a = n.length - 1; a >= 0; a--) b[n[a]] && (r = a);
|
|
484
500
|
if (r < 0) return { verb: null, past: null, noun: n.map(U).join(" ") };
|
|
485
501
|
const o = n[r], s = [...n.slice(0, r), ...n.slice(r + 1)];
|
|
486
|
-
return { verb: o, past:
|
|
502
|
+
return { verb: o, past: b[o], noun: s.map(U).join(" ") };
|
|
487
503
|
}
|
|
488
|
-
function
|
|
489
|
-
return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e &&
|
|
504
|
+
function we(e, n) {
|
|
505
|
+
return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e && ke.has(e) ? `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}` : `the ${n}` : "";
|
|
490
506
|
}
|
|
491
|
-
function
|
|
507
|
+
function Se(e) {
|
|
492
508
|
const n = /(\d[\d,]*)\s+rows?/i.exec(e), t = /^\s*(csv|xlsx|json|pdf|xml)\b/i.exec(e);
|
|
493
509
|
return {
|
|
494
510
|
rows: n ? Number(n[1].replace(/,/g, "")) : null,
|
|
@@ -500,24 +516,24 @@ function S(e, n) {
|
|
|
500
516
|
const t = `${i(e.collection)}:${i(e.item)}`;
|
|
501
517
|
return ((r = n == null ? void 0 : n.junctions) == null ? void 0 : r[t]) ?? null;
|
|
502
518
|
}
|
|
503
|
-
function
|
|
519
|
+
function Q(e) {
|
|
504
520
|
return `${/^[aeiou]/i.test(e) ? "an" : "a"} ${e}`;
|
|
505
521
|
}
|
|
506
|
-
function
|
|
507
|
-
const t = g(
|
|
522
|
+
function G(e, n) {
|
|
523
|
+
const t = g(I(e.parent_collection, n).singular), r = `${/^[aeiou]/i.test(t) ? "an" : "a"} ${t} record`;
|
|
508
524
|
if (!i(e.parent_id)) return r;
|
|
509
|
-
const o =
|
|
525
|
+
const o = Z(e.parent_collection, i(e.parent_id), n);
|
|
510
526
|
return !o || o === k ? r : o;
|
|
511
527
|
}
|
|
512
528
|
function E(e) {
|
|
513
529
|
const n = i(e.value);
|
|
514
|
-
return n ? `${e.noun} ${n}` :
|
|
530
|
+
return n ? `${e.noun} ${n}` : Q(e.noun);
|
|
515
531
|
}
|
|
516
|
-
function
|
|
517
|
-
const r =
|
|
532
|
+
function oe(e, n, t) {
|
|
533
|
+
const r = G(n, t);
|
|
518
534
|
return e === "create" ? `added ${E(n)} to ${r}` : e === "delete" ? `removed ${E(n)} from ${r}` : `updated ${E(n)} on ${r}`;
|
|
519
535
|
}
|
|
520
|
-
function
|
|
536
|
+
function ye(e, n) {
|
|
521
537
|
var l;
|
|
522
538
|
const t = e.map((f) => ({ e: f, j: S(f, n) }));
|
|
523
539
|
if (t.length === 0 || t.some((f) => !f.j)) return null;
|
|
@@ -528,7 +544,7 @@ function ke(e, n) {
|
|
|
528
544
|
const _ = a.get($.noun) ?? { removed: [], added: [], updated: [] }, h = i($.value), v = i(f.action);
|
|
529
545
|
v === "delete" ? _.removed.push(h) : v === "create" ? _.added.push(h) : _.updated.push(h), a.set($.noun, _);
|
|
530
546
|
}
|
|
531
|
-
const c = (f, $) => $ ? `${f} ${$}` :
|
|
547
|
+
const c = (f, $) => $ ? `${f} ${$}` : Q(f), u = [], d = [];
|
|
532
548
|
for (const [f, $] of a) {
|
|
533
549
|
if ($.removed.length === 1 && $.added.length === 1 && $.updated.length === 0) {
|
|
534
550
|
u.push({ noun: f, from: $.removed[0], to: $.added[0] });
|
|
@@ -538,13 +554,13 @@ function ke(e, n) {
|
|
|
538
554
|
for (const _ of $.added) d.push(`added ${c(f, _)}`);
|
|
539
555
|
for (const _ of $.updated) d.push(`updated ${c(f, _)}`);
|
|
540
556
|
}
|
|
541
|
-
return { parent:
|
|
557
|
+
return { parent: G(s, n), pairs: u, rest: d };
|
|
542
558
|
}
|
|
543
|
-
function
|
|
559
|
+
function Ae(e) {
|
|
544
560
|
return e.from && e.to ? `${e.noun} ${e.from} → ${e.to}` : e.to ? `${e.noun} set to ${e.to}` : `changed ${e.noun}`;
|
|
545
561
|
}
|
|
546
|
-
function
|
|
547
|
-
const t =
|
|
562
|
+
function xe(e, n) {
|
|
563
|
+
const t = ye(e, n);
|
|
548
564
|
if (!t) return null;
|
|
549
565
|
const { parent: r, pairs: o, rest: s } = t;
|
|
550
566
|
if (s.length === 0 && o.length === 1) {
|
|
@@ -553,25 +569,25 @@ function Se(e, n) {
|
|
|
553
569
|
}
|
|
554
570
|
if (o.length === 0 && s.length === 1) {
|
|
555
571
|
const a = e[0];
|
|
556
|
-
return
|
|
572
|
+
return oe(i(a.action), S(a, n), n);
|
|
557
573
|
}
|
|
558
|
-
return `changed ${r}: ${[...o.map(
|
|
574
|
+
return `changed ${r}: ${[...o.map(Ae), ...s].join("; ")}`;
|
|
559
575
|
}
|
|
560
|
-
const
|
|
576
|
+
const H = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
|
|
561
577
|
function je(e) {
|
|
562
578
|
const n = i(e).toLowerCase();
|
|
563
579
|
return /approv/.test(n) ? "Approved" : /reject/.test(n) ? "Rejected" : /declin/.test(n) ? "Declined" : /send.?back|return/.test(n) ? "Sent back" : /submit/.test(n) ? "Submitted" : /cancel/.test(n) ? "Cancelled" : "Moved";
|
|
564
580
|
}
|
|
565
581
|
function be(e, n) {
|
|
566
|
-
var $, _, h, v,
|
|
567
|
-
const t = i(e.action), r = e.collection ?? null, o =
|
|
582
|
+
var $, _, h, v, y;
|
|
583
|
+
const t = i(e.action), r = e.collection ?? null, o = j(r, e.item, n), s = I(r, n), a = `${/^[aeiou]/i.test(s.singular) ? "an" : "a"} ${g(s.singular)}`, c = i(e.comment), u = o ? ` on ${o}` : "", d = S(e, n);
|
|
568
584
|
if (d && (t === "create" || t === "delete" || t === "update"))
|
|
569
|
-
return
|
|
585
|
+
return oe(t, d, n);
|
|
570
586
|
if ((($ = e.event) == null ? void 0 : $.kind) === "start") {
|
|
571
587
|
const p = i(e.event.to_label);
|
|
572
588
|
return `started ${o ?? "the pipeline"}${p ? ` in ${p}` : ""}`;
|
|
573
589
|
}
|
|
574
|
-
if (((_ = e.event) == null ? void 0 : _.kind) === "transition" ||
|
|
590
|
+
if (((_ = e.event) == null ? void 0 : _.kind) === "transition" || H.has(t)) {
|
|
575
591
|
const p = e.event ? {
|
|
576
592
|
from: i(e.event.from_label) || null,
|
|
577
593
|
to: i(e.event.to_label) || null,
|
|
@@ -587,16 +603,16 @@ function be(e, n) {
|
|
|
587
603
|
case "o2m-update": {
|
|
588
604
|
if (t === "o2m-update")
|
|
589
605
|
return e.o2m ? `${M(e.o2m)}${u}` : `changed related rows${u}`;
|
|
590
|
-
const p =
|
|
606
|
+
const p = K(e);
|
|
591
607
|
if (r === "nivaro_settings")
|
|
592
|
-
return p.length ? `changed the ${
|
|
608
|
+
return p.length ? `changed the ${T(r, p, n)} setting${p.length === 1 ? "" : "s"}` : "changed the settings";
|
|
593
609
|
if (r === "nivaro_approval_instances" && ((v = e.why) != null && v.approval)) {
|
|
594
|
-
const m = e.why.approval, w =
|
|
595
|
-
return `${(
|
|
610
|
+
const m = e.why.approval, w = j(m.collection, m.item, n);
|
|
611
|
+
return `${(b[i(m.decision).toLowerCase()] ?? i(m.decision).toLowerCase()) || "decided on"} ${w ?? o ?? "an approval"}${m.chain ? ` (${m.chain})` : ""}`;
|
|
596
612
|
}
|
|
597
613
|
if (p.length) {
|
|
598
|
-
const m = ((
|
|
599
|
-
return m && "value" in m &&
|
|
614
|
+
const m = ((y = e.changes) == null ? void 0 : y.length) === 1 ? e.changes[0] : null;
|
|
615
|
+
return m && "value" in m && te(r, m.field, m.value, n) ? `set ${B(r, m.field, n)} to ${ne(r, m.field, m.value, n)}${u}` : `changed ${T(r, p, n)}${u}`;
|
|
600
616
|
}
|
|
601
617
|
return `updated ${o ?? a}`;
|
|
602
618
|
}
|
|
@@ -618,17 +634,17 @@ function be(e, n) {
|
|
|
618
634
|
case "sign-in-failed":
|
|
619
635
|
return o && o !== k ? `had a sign-in as ${o} fail` : "had a sign-in fail";
|
|
620
636
|
case "export": {
|
|
621
|
-
const p =
|
|
622
|
-
return `exported ${p.rows != null ?
|
|
637
|
+
const p = Se(c);
|
|
638
|
+
return `exported ${p.rows != null ? P(p.rows, r, n) : g(s.plural)}${p.format ? ` to ${p.format}` : ""}`;
|
|
623
639
|
}
|
|
624
640
|
case "masquerade-start":
|
|
625
|
-
return `started viewing as ${
|
|
641
|
+
return `started viewing as ${x(e, n, c)}`;
|
|
626
642
|
case "masquerade-stop":
|
|
627
|
-
return `stopped viewing as ${
|
|
643
|
+
return `stopped viewing as ${x(e, n, c)}`;
|
|
628
644
|
case "token.generate":
|
|
629
|
-
return `generated a static token for ${
|
|
645
|
+
return `generated a static token for ${x(e, n, "")}`;
|
|
630
646
|
case "token.revoke":
|
|
631
|
-
return `revoked the static token of ${
|
|
647
|
+
return `revoked the static token of ${x(e, n, "")}`;
|
|
632
648
|
case "api_key_created":
|
|
633
649
|
return `created ${o && o !== k ? o : "an API key"}`;
|
|
634
650
|
case "api_key_revoked":
|
|
@@ -638,10 +654,10 @@ function be(e, n) {
|
|
|
638
654
|
case "api_key_simulate":
|
|
639
655
|
return `tested requests as ${o && o !== k ? o : "an API key"}`;
|
|
640
656
|
case "set_role":
|
|
641
|
-
return `changed the role of ${
|
|
657
|
+
return `changed the role of ${x(e, n, "")}`;
|
|
642
658
|
case "bulk-write":
|
|
643
659
|
case "bulk-action-execute": {
|
|
644
|
-
const p = /(\d+)\s+(?:item|row)/i.exec(c), m = p ?
|
|
660
|
+
const p = /(\d+)\s+(?:item|row)/i.exec(c), m = p ? P(Number(p[1]), r, n) : g(s.plural), w = t === "bulk-action-execute" ? /^(.+?)\s*\([^)]*\)\s+on\s/.exec(c) : null;
|
|
645
661
|
return w ? `ran “${w[1]}” on ${m}` : `changed ${m} in bulk`;
|
|
646
662
|
}
|
|
647
663
|
case "import-create":
|
|
@@ -687,45 +703,45 @@ function be(e, n) {
|
|
|
687
703
|
return "downloaded a configuration snapshot";
|
|
688
704
|
}
|
|
689
705
|
if (!t) return `did something${u}`;
|
|
690
|
-
const l =
|
|
691
|
-
return /settings$/.test(l.noun) && !l.verb ? `changed the ${l.noun}` : l.past ? o && l.noun && g(s.singular).toLowerCase().includes(l.noun.toLowerCase()) ? `${l.past} ${o}` : l.noun ? `${l.past} ${
|
|
706
|
+
const l = re(t);
|
|
707
|
+
return /settings$/.test(l.noun) && !l.verb ? `changed the ${l.noun}` : l.past ? o && l.noun && g(s.singular).toLowerCase().includes(l.noun.toLowerCase()) ? `${l.past} ${o}` : l.noun ? `${l.past} ${we(l.verb, l.noun)}${u}` : `${l.past} ${o ?? "something"}` : `recorded “${X(t)}”${u}`;
|
|
692
708
|
}
|
|
693
|
-
function
|
|
694
|
-
const r = i(e.item), o =
|
|
709
|
+
function x(e, n, t) {
|
|
710
|
+
const r = i(e.item), o = L(r, n) ?? (t || null);
|
|
695
711
|
if (o) return o;
|
|
696
|
-
const s = e.collection === "nivaro_users" ?
|
|
712
|
+
const s = e.collection === "nivaro_users" ? j(e.collection, e.item, n) : null;
|
|
697
713
|
return s && !z.test(r) ? s : "someone";
|
|
698
714
|
}
|
|
699
|
-
function
|
|
700
|
-
return `${
|
|
715
|
+
function Ie(e, n) {
|
|
716
|
+
return `${ee(e, n)} ${be(e, n)}`;
|
|
701
717
|
}
|
|
702
|
-
function
|
|
718
|
+
function Te(e) {
|
|
703
719
|
var c, u, d, l;
|
|
704
720
|
const n = i(e.action), t = i(e.comment);
|
|
705
721
|
let r = i((c = e.why) == null ? void 0 : c.reason) || null, o = i((u = e.why) == null ? void 0 : u.note) || null;
|
|
706
|
-
!o &&
|
|
722
|
+
!o && H.has(n) && !e.event && (o = J(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);
|
|
707
723
|
const s = (l = e.why) == null ? void 0 : l.approval, a = s ? `${q(i(s.decision)) || "Decided"}${s.chain ? ` · ${s.chain}` : ""}${s.step != null && s.step !== "" ? ` · step ${s.step}` : ""}${i(s.comment) ? ` — “${i(s.comment)}”` : ""}` : null;
|
|
708
724
|
return { reason: r, note: o, approval: a };
|
|
709
725
|
}
|
|
710
|
-
const
|
|
711
|
-
function
|
|
726
|
+
const Ne = 6e4, Ce = 5e3;
|
|
727
|
+
function C(e) {
|
|
712
728
|
return e.timestamp ? new Date(e.timestamp).getTime() : Number.NaN;
|
|
713
729
|
}
|
|
714
730
|
function R(e) {
|
|
715
731
|
const n = Y(e);
|
|
716
732
|
return `${n.kind}|${i(n.id)}|${i(e.user ?? e.user_id).toUpperCase()}`;
|
|
717
733
|
}
|
|
718
|
-
function
|
|
734
|
+
function Re(e) {
|
|
719
735
|
const n = i(e.action);
|
|
720
736
|
return !i(e.item) && (n.startsWith("bulk-") || n === "import-complete");
|
|
721
737
|
}
|
|
722
|
-
function
|
|
723
|
-
const t = n.windowMs ??
|
|
738
|
+
function qe(e, n = {}) {
|
|
739
|
+
const t = n.windowMs ?? Ne, r = [], o = (s, a) => s.parent_collection === a.parent_collection && (!i(s.parent_id) || !i(a.parent_id) || i(s.parent_id) === i(a.parent_id));
|
|
724
740
|
for (const s of e) {
|
|
725
741
|
const a = r[r.length - 1], c = a == null ? void 0 : a.entries[a.entries.length - 1], u = i(s.group_key);
|
|
726
742
|
if (a && c && n.labels) {
|
|
727
743
|
const d = S(s, n.labels), l = S(c, n.labels);
|
|
728
|
-
if (d && l && a.entries.every((f) => S(f, n.labels)) && o(d, l) && R(s) === R(c) && Math.abs(
|
|
744
|
+
if (d && l && a.entries.every((f) => S(f, n.labels)) && o(d, l) && R(s) === R(c) && Math.abs(C(c) - C(s)) <= Ce) {
|
|
729
745
|
a.entries.push(s), a.by !== "group_key" && (a.by = "time");
|
|
730
746
|
continue;
|
|
731
747
|
}
|
|
@@ -736,7 +752,7 @@ function Le(e, n = {}) {
|
|
|
736
752
|
a.entries.push(s), a.by = "group_key";
|
|
737
753
|
continue;
|
|
738
754
|
}
|
|
739
|
-
if (!u && !d && a.by !== "group_key" && i(s.action) === i(c.action) && i(s.collection) === i(c.collection) && i(s.collection) !== "" && R(s) === R(c) && Math.abs(
|
|
755
|
+
if (!u && !d && a.by !== "group_key" && i(s.action) === i(c.action) && i(s.collection) === i(c.collection) && i(s.collection) !== "" && R(s) === R(c) && Math.abs(C(c) - C(s)) <= t) {
|
|
740
756
|
a.entries.push(s), a.by = "time";
|
|
741
757
|
continue;
|
|
742
758
|
}
|
|
@@ -745,14 +761,14 @@ function Le(e, n = {}) {
|
|
|
745
761
|
}
|
|
746
762
|
return r;
|
|
747
763
|
}
|
|
748
|
-
function
|
|
764
|
+
function Oe(e, n) {
|
|
749
765
|
if (e.length === 0) return "";
|
|
750
|
-
const t = e.filter((v) => !
|
|
751
|
-
if (t.length <= 1) return
|
|
752
|
-
const o =
|
|
766
|
+
const t = e.filter((v) => !Re(v)), r = t[0] ?? e[0];
|
|
767
|
+
if (t.length <= 1) return Ie(r, n);
|
|
768
|
+
const o = ee(r, n), s = xe(t, n);
|
|
753
769
|
if (s) return `${o} ${s}`;
|
|
754
|
-
const c = new Set(t.map((v) => i(v.collection))).size === 1 ? r.collection ?? null : null, u = new Set(t.map((v) => i(v.item))), d = u.size > 1 ? u.size : t.length, l = c ? u.size === 1 && i(r.item) ?
|
|
755
|
-
t.map((v) =>
|
|
770
|
+
const c = new Set(t.map((v) => i(v.collection))).size === 1 ? r.collection ?? null : null, u = new Set(t.map((v) => i(v.item))), d = u.size > 1 ? u.size : t.length, l = c ? u.size === 1 && i(r.item) ? j(c, r.item, n) ?? P(d, c, n) : P(d, c, n) : `${d} records`, f = u.size === 1 && t.length > 1 ? ` ${t.length} times` : "", $ = new Set(
|
|
771
|
+
t.map((v) => H.has(i(v.action)) ? "transition" : i(v.action))
|
|
756
772
|
);
|
|
757
773
|
if ($.size !== 1) return `${o} made ${t.length} changes to ${l}`;
|
|
758
774
|
const _ = [...$][0];
|
|
@@ -762,36 +778,36 @@ function Te(e, n) {
|
|
|
762
778
|
var m;
|
|
763
779
|
return i(((m = p.event) == null ? void 0 : m.to_label) ?? J(p.comment).to);
|
|
764
780
|
})
|
|
765
|
-
),
|
|
766
|
-
return `${o} moved ${l}${
|
|
781
|
+
), y = v.size === 1 ? [...v][0] : "";
|
|
782
|
+
return `${o} moved ${l}${y ? ` to ${y}` : ""}${f}`;
|
|
767
783
|
}
|
|
768
784
|
if (_ === "update") {
|
|
769
|
-
const v =
|
|
785
|
+
const v = Pe(t, c, n);
|
|
770
786
|
return `${o} updated ${l}${f}${v ? `: ${v}` : ""}`;
|
|
771
787
|
}
|
|
772
788
|
if (_ === "create") return `${o} created ${l}`;
|
|
773
789
|
if (_ === "delete") return `${o} deleted ${l}`;
|
|
774
790
|
if (_ === "picker-exclude") return `${o} hid ${l} from pickers${f}`;
|
|
775
791
|
if (_ === "picker-include") return `${o} showed ${l} in pickers again${f}`;
|
|
776
|
-
const h =
|
|
777
|
-
return h.past ? `${o} ${h.past} ${l}${h.noun && !g(
|
|
792
|
+
const h = re(_);
|
|
793
|
+
return h.past ? `${o} ${h.past} ${l}${h.noun && !g(I(c, n).plural).toLowerCase().includes(h.noun) ? ` (${h.noun})` : ""}${f}` : `${o} recorded “${X(_)}” on ${l}`;
|
|
778
794
|
}
|
|
779
|
-
function
|
|
795
|
+
function Pe(e, n, t) {
|
|
780
796
|
var c;
|
|
781
797
|
const r = ((c = e[0]) == null ? void 0 : c.changes) ?? null;
|
|
782
798
|
if (!(r != null && r.length)) {
|
|
783
|
-
const u = e.map((d) =>
|
|
784
|
-
return u[0] && u.every((d) => d === u[0]) ?
|
|
799
|
+
const u = e.map((d) => K(d).sort().join(","));
|
|
800
|
+
return u[0] && u.every((d) => d === u[0]) ? T(n, u[0].split(","), t) : "";
|
|
785
801
|
}
|
|
786
802
|
const o = (u) => JSON.stringify((u.changes ?? []).map((d) => [d.field, d.value ?? null]).sort());
|
|
787
|
-
if (e.every((u) => o(u) === o(e[0])) && r.length <= 2 && r.every((u) =>
|
|
803
|
+
if (e.every((u) => o(u) === o(e[0])) && r.length <= 2 && r.every((u) => te(n, u.field, u.value, t)))
|
|
788
804
|
return r.map(
|
|
789
|
-
(u) => `${
|
|
805
|
+
(u) => `${B(n, u.field, t)} → ${ne(n, u.field, u.value, t)}`
|
|
790
806
|
).join(", ");
|
|
791
807
|
const a = new Set(e.flatMap((u) => (u.changes ?? []).map((d) => d.field)));
|
|
792
|
-
return
|
|
808
|
+
return T(n, [...a], t);
|
|
793
809
|
}
|
|
794
|
-
function
|
|
810
|
+
function Me(e) {
|
|
795
811
|
var a;
|
|
796
812
|
const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = (c, u) => {
|
|
797
813
|
const d = i(c), l = i(u);
|
|
@@ -802,7 +818,7 @@ function Pe(e) {
|
|
|
802
818
|
u && t.add(u);
|
|
803
819
|
const d = Y(c);
|
|
804
820
|
d.kind === "view_as" && d.id && t.add(d.id), d.on_behalf_of && t.add(d.on_behalf_of), i(c.collection) && o.add(i(c.collection)), s(c.collection, c.item), (a = c.why) != null && a.approval && s(c.why.approval.collection, c.why.approval.item);
|
|
805
|
-
for (const l of
|
|
821
|
+
for (const l of K(c)) {
|
|
806
822
|
const f = i(c.collection);
|
|
807
823
|
f && r.set(`${f}.${l}`, { collection: f, field: l });
|
|
808
824
|
}
|
|
@@ -815,34 +831,34 @@ function Pe(e) {
|
|
|
815
831
|
};
|
|
816
832
|
}
|
|
817
833
|
export {
|
|
818
|
-
|
|
834
|
+
Ne as BURST_WINDOW_MS,
|
|
819
835
|
k as HIDDEN_RECORD,
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
836
|
+
Ce as LINK_WRITE_WINDOW_MS,
|
|
837
|
+
re as actionParts,
|
|
838
|
+
Me as activityLabelRefs,
|
|
823
839
|
be as activityPredicate,
|
|
824
|
-
|
|
825
|
-
|
|
840
|
+
Te as activityWhy,
|
|
841
|
+
ee as actorName,
|
|
826
842
|
Y as actorOf,
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
843
|
+
me as choiceText,
|
|
844
|
+
I as collectionNouns,
|
|
845
|
+
P as countNoun,
|
|
846
|
+
B as fieldLabel,
|
|
847
|
+
T as fieldList,
|
|
848
|
+
qe as groupActivity,
|
|
833
849
|
S as junctionOf,
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
850
|
+
ye as linkChanges,
|
|
851
|
+
xe as linkGroupPredicate,
|
|
852
|
+
Ae as linkPairText,
|
|
837
853
|
M as o2mSentence,
|
|
838
|
-
|
|
839
|
-
|
|
854
|
+
Le as o2mTotalsText,
|
|
855
|
+
le as parseActor,
|
|
840
856
|
J as parseTransitionComment,
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
857
|
+
X as readableTitle,
|
|
858
|
+
j as recordPhrase,
|
|
859
|
+
Oe as renderActivityGroupSentence,
|
|
860
|
+
Ie as renderActivitySentence,
|
|
845
861
|
je as transitionVerb,
|
|
846
|
-
|
|
847
|
-
|
|
862
|
+
te as valueShowable,
|
|
863
|
+
ne as valueText
|
|
848
864
|
};
|