@nivaro/react 0.3.139 → 0.3.141
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/components/InlineGridField.js +95 -92
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +39 -2
- package/dist/shared/components/AudienceConfirmPanel.js +19 -19
- package/dist/shared/components/BroadcastView.js +213 -211
- package/dist/shared/components/CollectionBrowserView.js +2702 -2671
- package/dist/shared/components/ConfigHistory.js +45 -45
- package/dist/shared/components/ConformanceView.js +110 -110
- package/dist/shared/components/DataTable.js +51 -51
- package/dist/shared/components/FilePreviewLightbox.js +26 -25
- package/dist/shared/components/ItemEditForm.js +3475 -3458
- package/dist/shared/components/LiveCount.js +27 -23
- package/dist/shared/components/LiveTraceView.js +62 -61
- package/dist/shared/components/PageRenderer.js +422 -410
- package/dist/shared/components/ProfileView.js +199 -199
- package/dist/shared/components/QualityRulesView.js +70 -70
- package/dist/shared/components/QueryTable.js +131 -130
- package/dist/shared/components/RecordGraph.js +98 -98
- package/dist/shared/components/RecordReadView.js +287 -288
- package/dist/shared/components/ReportView.js +1279 -1259
- package/dist/shared/components/RowPresence.js +83 -76
- package/dist/shared/components/SlaRulesView.js +73 -74
- package/dist/shared/components/UnseenDot.js +183 -22
- package/dist/shared/components/WidgetSlot.js +73 -73
- package/dist/shared/components/ai/AiChart.js +36 -32
- package/dist/shared/components/ai/AiMarkdown.js +136 -129
- package/dist/shared/components/ai/TaskDo.js +87 -87
- package/dist/shared/components/ai/answer-formats.js +37 -30
- package/dist/shared/components/ai/call-log/format.js +17 -16
- package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
- package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
- package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
- package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
- package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
- package/dist/shared/components/bulk/bulk-field-options.js +10 -10
- package/dist/shared/components/cbv/column-totals.js +53 -51
- package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
- package/dist/shared/components/command-center/announce.js +7 -6
- package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
- package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
- package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
- package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
- package/dist/shared/components/delivery-analytics/drill.js +32 -32
- package/dist/shared/components/imports/RunDetailSheet.js +1 -1
- package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
- package/dist/shared/components/integrations/console/EventsView.js +35 -35
- package/dist/shared/components/integrations/console/FirefightView.js +15 -14
- package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
- package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
- package/dist/shared/components/integrations/console/SignalCard.js +67 -67
- package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
- package/dist/shared/components/item-edit/ChangesTray.js +88 -74
- package/dist/shared/components/item-edit/FilePickerField.js +123 -123
- package/dist/shared/components/item-edit/GroupSection.js +301 -292
- package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
- package/dist/shared/components/item-edit/InlineGridField.js +45 -36
- package/dist/shared/components/item-edit/InlineTableField.js +1390 -1376
- package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
- package/dist/shared/components/item-edit/RecordRecapChanges.js +116 -74
- package/dist/shared/components/item-edit/RecordRecapStrip.js +148 -160
- package/dist/shared/components/item-edit/summary-layout-request.js +15 -0
- package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +226 -157
- package/dist/shared/components/layout-editor/settings/WhoSection.js +53 -52
- package/dist/shared/components/layout-editor/settings/controls.js +98 -90
- package/dist/shared/components/layout-editor/settings/settings-registry.js +8 -0
- package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
- package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
- package/dist/shared/components/ops-report/format.js +37 -36
- package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
- package/dist/shared/components/panels/RevisionsPanel.js +306 -305
- package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
- package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
- package/dist/shared/components/pipeline/TeamsView.js +189 -130
- package/dist/shared/components/profile/AgentsPanel.js +6 -6
- package/dist/shared/components/profile/DelegationCard.js +13 -12
- package/dist/shared/components/profile/PersonActivity.js +48 -48
- package/dist/shared/components/profile/PersonExtras.js +107 -107
- package/dist/shared/components/profile/PersonWeek.js +9 -9
- package/dist/shared/components/queue/QueueBulkBar.js +19 -18
- package/dist/shared/components/queue/QueueBulkMove.js +21 -20
- package/dist/shared/components/queue/QueueItemSheet.js +136 -131
- package/dist/shared/components/queue/QueueWorklist.js +884 -872
- package/dist/shared/components/queue/worklist-helpers.js +36 -21
- package/dist/shared/components/support/RequestList.js +123 -123
- package/dist/shared/components/support/SupportAnalytics.js +29 -29
- package/dist/shared/lib/activity-sentence.js +251 -229
- package/dist/shared/lib/format-value.js +5 -4
- package/dist/shared/lib/layout-resolve.js +64 -48
- package/dist/shared/lib/number-format.js +87 -0
- package/dist/shared/lib/number-kind.js +133 -0
- package/dist/shared/lib/utils.js +24 -20
- package/dist/shared/lib/watch-list.js +1 -1
- package/dist/shared/lib/widget-value-format.js +26 -12
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
function M(e) {
|
|
2
|
-
const n =
|
|
2
|
+
const n = s(e.collection_label) || "related rows", t = s(e.row_label), r = t ? `${n} · ${t}` : n;
|
|
3
3
|
if (e.verb === "added") return `added ${r}`;
|
|
4
4
|
if (e.verb === "removed") return `removed ${r}`;
|
|
5
|
-
const o = (e.changes ?? []).filter((
|
|
5
|
+
const o = (e.changes ?? []).filter((i) => i && s(i.label)).map((i) => `${s(i.label)} ${s(i.from) || "—"} → ${s(i.to) || "—"}`);
|
|
6
6
|
return o.length ? `changed ${r}: ${o.join(", ")}` : `changed ${r}`;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
return (e.totals ?? []).filter((n) => n &&
|
|
10
|
-
(n) => `${
|
|
8
|
+
function Te(e) {
|
|
9
|
+
return (e.totals ?? []).filter((n) => n && s(n.label) && Number.isFinite(n.delta) && n.delta !== 0).map(
|
|
10
|
+
(n) => `${s(n.label)} ${n.delta > 0 ? "+" : "−"}${Math.abs(n.delta).toLocaleString("en-US", { maximumFractionDigits: 2 })}`
|
|
11
11
|
).join(", ");
|
|
12
12
|
}
|
|
13
|
-
const k = "a record you can't see",
|
|
13
|
+
const k = "a record you can't see", U = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, F = {
|
|
14
14
|
ai: "AI",
|
|
15
15
|
api: "API",
|
|
16
16
|
csv: "CSV",
|
|
@@ -31,30 +31,30 @@ const k = "a record you can't see", z = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0
|
|
|
31
31
|
url: "URL",
|
|
32
32
|
xlsx: "Excel"
|
|
33
33
|
};
|
|
34
|
-
function
|
|
34
|
+
function s(e) {
|
|
35
35
|
return e == null ? "" : String(e).trim();
|
|
36
36
|
}
|
|
37
37
|
function se(e) {
|
|
38
|
-
return
|
|
38
|
+
return s(e).toUpperCase();
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function W(e) {
|
|
41
41
|
return e.split(/[\s_.:-]+/).map((n) => n.trim()).filter(Boolean);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function z(e) {
|
|
44
44
|
const n = e.toLowerCase();
|
|
45
|
-
return
|
|
45
|
+
return F[n] ?? n;
|
|
46
46
|
}
|
|
47
47
|
function X(e) {
|
|
48
|
-
const n =
|
|
48
|
+
const n = W(e).map(z).join(" ");
|
|
49
49
|
return n ? n.charAt(0).toUpperCase() + n.slice(1) : "";
|
|
50
50
|
}
|
|
51
51
|
function q(e) {
|
|
52
|
-
return
|
|
52
|
+
return W(e).map((n) => F[n.toLowerCase()] ?? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
|
|
53
53
|
}
|
|
54
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
|
-
function
|
|
57
|
+
function O(e) {
|
|
58
58
|
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`;
|
|
59
59
|
}
|
|
60
60
|
function g(e) {
|
|
@@ -133,36 +133,36 @@ function N(e) {
|
|
|
133
133
|
}
|
|
134
134
|
function I(e, n) {
|
|
135
135
|
var l;
|
|
136
|
-
const t =
|
|
136
|
+
const t = s(e);
|
|
137
137
|
if (!t) return { singular: "Record", plural: "Records" };
|
|
138
|
-
const r = (l = n == null ? void 0 : n.collections) == null ? void 0 : l[t], o = typeof r == "string" ? { plural: r } : r ?? {},
|
|
139
|
-
if (a ||
|
|
140
|
-
const
|
|
141
|
-
return { singular:
|
|
138
|
+
const r = (l = n == null ? void 0 : n.collections) == null ? void 0 : l[t], o = typeof r == "string" ? { plural: r } : r ?? {}, i = s(o.plural), a = s(o.singular);
|
|
139
|
+
if (a || i) {
|
|
140
|
+
const p = a || x(i, V), $ = i && i !== p ? i : x(p, O);
|
|
141
|
+
return { singular: p, plural: $ };
|
|
142
142
|
}
|
|
143
143
|
const c = ae[t];
|
|
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:
|
|
144
|
+
if (c) return { singular: c, plural: c === "Settings" ? c : x(c, O) };
|
|
145
|
+
const u = q(t.replace(/^(nivaro|directus)_/, "")) || "Record", d = x(u, V);
|
|
146
|
+
return { singular: d, plural: x(d, O) };
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function x(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
|
|
152
|
+
function L(e, n, t) {
|
|
153
153
|
const { singular: r, plural: o } = I(n, t);
|
|
154
154
|
return `${e} ${g(e === 1 ? r : o)}`;
|
|
155
155
|
}
|
|
156
156
|
function ue(e, n) {
|
|
157
|
-
const t = e.user ?? e.user_id ?? null, r = t ?
|
|
157
|
+
const t = e.user ?? e.user_id ?? null, r = t ? P(t, n) : null;
|
|
158
158
|
if (r) return r;
|
|
159
|
-
const o = [
|
|
160
|
-
return o || (
|
|
159
|
+
const o = [s(e.first_name), s(e.last_name)].filter(Boolean).join(" ");
|
|
160
|
+
return o || (s(e.user_email) ? s(e.user_email) : null);
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function P(e, n) {
|
|
163
163
|
if (!e || !(n != null && n.users)) return null;
|
|
164
164
|
const t = n.users;
|
|
165
|
-
return
|
|
165
|
+
return s(t[e] ?? t[se(e)] ?? t[s(e).toLowerCase()]) || null;
|
|
166
166
|
}
|
|
167
167
|
const de = /* @__PURE__ */ new Set([
|
|
168
168
|
"person",
|
|
@@ -184,7 +184,7 @@ function le(e) {
|
|
|
184
184
|
return null;
|
|
185
185
|
}
|
|
186
186
|
if (!n || typeof n != "object") return null;
|
|
187
|
-
const t = n, r =
|
|
187
|
+
const t = n, r = s(t.kind);
|
|
188
188
|
return de.has(r) ? {
|
|
189
189
|
kind: r,
|
|
190
190
|
id: t.id == null ? null : String(t.id),
|
|
@@ -192,95 +192,95 @@ function le(e) {
|
|
|
192
192
|
on_behalf_of: t.on_behalf_of == null ? null : String(t.on_behalf_of)
|
|
193
193
|
} : null;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function Z(e) {
|
|
196
196
|
const n = le(e.actor);
|
|
197
197
|
if (n) return n;
|
|
198
198
|
const t = e.user ?? e.user_id ?? null;
|
|
199
|
-
if (
|
|
199
|
+
if (s(e.mcp_conn) || s(e.via_app) || s(e.via_agent))
|
|
200
200
|
return {
|
|
201
201
|
kind: "mcp",
|
|
202
|
-
id:
|
|
203
|
-
name:
|
|
202
|
+
id: s(e.mcp_conn) || null,
|
|
203
|
+
name: s(e.via_app) || s(e.via_agent) || null,
|
|
204
204
|
on_behalf_of: t
|
|
205
205
|
};
|
|
206
|
-
const r =
|
|
206
|
+
const r = s(e.auth_method);
|
|
207
207
|
if (r === "masquerade") return { kind: "view_as", id: null, name: null, on_behalf_of: t };
|
|
208
208
|
if ((r === "api_key" || r === "key_sim") && e.api_key_id != null)
|
|
209
209
|
return {
|
|
210
210
|
kind: "api_key",
|
|
211
211
|
id: String(e.api_key_id),
|
|
212
|
-
name:
|
|
212
|
+
name: s(e.api_key_name) || null,
|
|
213
213
|
on_behalf_of: t
|
|
214
214
|
};
|
|
215
|
-
const o =
|
|
216
|
-
if (
|
|
217
|
-
const c =
|
|
218
|
-
return { kind: c, id:
|
|
215
|
+
const o = s(e.chain_parent), i = /^(cron|import_run|flow_run):(.+)$/.exec(o);
|
|
216
|
+
if (i) {
|
|
217
|
+
const c = i[1] === "cron" ? "cron" : i[1] === "import_run" ? "import" : "flow";
|
|
218
|
+
return { kind: c, id: i[2], name: c === "cron" ? i[2] : null, on_behalf_of: t };
|
|
219
219
|
}
|
|
220
|
-
const a = /^import:([^:]+)/i.exec(
|
|
221
|
-
return a ? { kind: "import", id: a[1], name: a[1], on_behalf_of: t } :
|
|
220
|
+
const a = /^import:([^:]+)/i.exec(s(e.comment));
|
|
221
|
+
return a ? { kind: "import", id: a[1], name: a[1], on_behalf_of: t } : s(e.origin) === "import" ? { kind: "import", id: null, name: null, on_behalf_of: t } : t ? { kind: "person", id: t, name: null, on_behalf_of: null } : {
|
|
222
222
|
kind: "system",
|
|
223
223
|
id: null,
|
|
224
|
-
name:
|
|
224
|
+
name: s(e.origin) === "integration" ? "An integration" : null
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
227
|
function ee(e, n) {
|
|
228
|
-
const t =
|
|
228
|
+
const t = Z(e), r = ue(e, n), o = P(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 `${(P(t.id, n) ?? s(t.name) ?? "") || "An administrator"} as ${o ?? "someone"}`;
|
|
234
234
|
case "api_key":
|
|
235
|
-
return `API key “${
|
|
235
|
+
return `API key “${s(t.name) || (t.id ? `#${t.id}` : "unnamed")}”`;
|
|
236
236
|
case "mcp": {
|
|
237
|
-
const
|
|
238
|
-
return o ? `${
|
|
237
|
+
const i = s(t.name).replace(/^via\s+/i, "") || "An assistant";
|
|
238
|
+
return o ? `${i} for ${o}` : i;
|
|
239
239
|
}
|
|
240
240
|
case "import":
|
|
241
|
-
return
|
|
241
|
+
return s(t.name) ? `Import “${s(t.name)}”` : "An import";
|
|
242
242
|
case "flow":
|
|
243
|
-
return
|
|
243
|
+
return s(t.name) ? `Flow “${s(t.name)}”` : "A flow";
|
|
244
244
|
case "cron":
|
|
245
|
-
return
|
|
245
|
+
return s(t.name || t.id) ? `Scheduled job “${s(t.name || t.id)}”` : "A scheduled job";
|
|
246
246
|
default:
|
|
247
|
-
return
|
|
247
|
+
return s(t.name) || "System";
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
|
-
function
|
|
251
|
-
var
|
|
252
|
-
const r =
|
|
253
|
-
if (!r || !
|
|
254
|
-
const o = (
|
|
255
|
-
return o ? fe(o, t) :
|
|
250
|
+
function T(e, n, t) {
|
|
251
|
+
var i;
|
|
252
|
+
const r = s(n);
|
|
253
|
+
if (!r || !s(e)) return null;
|
|
254
|
+
const o = (i = t == null ? void 0 : t.junctions) == null ? void 0 : i[`${e}:${r}`];
|
|
255
|
+
return o ? fe(o, t) : Y(e, r, t);
|
|
256
256
|
}
|
|
257
257
|
function pe(e, n) {
|
|
258
|
-
const t =
|
|
258
|
+
const t = s(e.parent_id);
|
|
259
259
|
if (!t) return !1;
|
|
260
|
-
const r =
|
|
260
|
+
const r = Y(e.parent_collection, t, n);
|
|
261
261
|
return !!r && r !== k;
|
|
262
262
|
}
|
|
263
263
|
function fe(e, n) {
|
|
264
|
-
const t = G(e, n), r =
|
|
264
|
+
const t = G(e, n), r = s(e.value);
|
|
265
265
|
return r ? `${e.noun} ${r} on ${t}` : pe(e, n) ? `${t} · ${e.noun}` : `${Q(e.noun)} on ${t}`;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
268
|
-
if (!n || !
|
|
269
|
-
const r = `${e}:${n}`, o = t == null ? void 0 : t.records, { singular:
|
|
267
|
+
function Y(e, n, t) {
|
|
268
|
+
if (!n || !s(e)) return null;
|
|
269
|
+
const r = `${e}:${n}`, o = t == null ? void 0 : t.records, { singular: i } = I(e, t), a = ce.test(s(e));
|
|
270
270
|
if (o && r in o) {
|
|
271
271
|
const c = o[r];
|
|
272
|
-
if (c == null) return a ? N(
|
|
273
|
-
const u =
|
|
274
|
-
return u ? a && (u === n ||
|
|
272
|
+
if (c == null) return a ? N(i) : k;
|
|
273
|
+
const u = s(c);
|
|
274
|
+
return u ? a && (u === n || U.test(u)) ? N(i) : u.toLowerCase().startsWith(i.toLowerCase()) ? u : `${i} ${u}` : a ? N(i) : i;
|
|
275
275
|
}
|
|
276
|
-
return a ||
|
|
276
|
+
return a || U.test(n) ? N(i) : `${i} ${n}`;
|
|
277
277
|
}
|
|
278
278
|
function B(e, n, t) {
|
|
279
279
|
var o;
|
|
280
280
|
const r = (o = t == null ? void 0 : t.fields) == null ? void 0 : o[`${e ?? ""}.${n}`];
|
|
281
|
-
return
|
|
281
|
+
return s(r) || q(n);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function j(e, n, t) {
|
|
284
284
|
const r = [...new Set(n)].map((o) => B(e, o, t));
|
|
285
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`;
|
|
286
286
|
}
|
|
@@ -300,35 +300,57 @@ function ge(e) {
|
|
|
300
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();
|
|
301
301
|
}
|
|
302
302
|
function ne(e, n, t, r) {
|
|
303
|
-
var
|
|
303
|
+
var u, d, l;
|
|
304
304
|
if (t == null || t === "") return "empty";
|
|
305
305
|
if (typeof t == "boolean") return t ? "Yes" : "No";
|
|
306
306
|
if (typeof t == "object")
|
|
307
307
|
return Array.isArray(t) ? `${t.length} items` : "a new value";
|
|
308
|
-
const o = String(t),
|
|
309
|
-
if (!
|
|
310
|
-
const a = (
|
|
308
|
+
const o = String(t), i = ve.test(o) ? ge(o) : o;
|
|
309
|
+
if (!i) return "empty";
|
|
310
|
+
const a = (d = (u = r == null ? void 0 : r.choices) == null ? void 0 : u[`${e ?? ""}.${n}`]) == null ? void 0 : d[i];
|
|
311
311
|
if (a) return me(a);
|
|
312
|
-
|
|
313
|
-
if (
|
|
314
|
-
|
|
315
|
-
|
|
312
|
+
const c = (l = r == null ? void 0 : r.numbers) == null ? void 0 : l[`${e ?? ""}.${n}`];
|
|
313
|
+
if (c && /^-?\d+(\.\d+)?$/.test(i.trim())) return ke(Number(i.trim()), c);
|
|
314
|
+
if (_e.test(i)) return i;
|
|
315
|
+
if ($e.test(i)) {
|
|
316
|
+
const p = new Date(i);
|
|
317
|
+
if (!Number.isNaN(p.getTime()))
|
|
316
318
|
try {
|
|
317
|
-
return
|
|
319
|
+
return p.toLocaleString(void 0, {
|
|
318
320
|
dateStyle: "medium",
|
|
319
321
|
timeStyle: "short",
|
|
320
322
|
...r != null && r.timeZone ? { timeZone: r.timeZone } : {}
|
|
321
323
|
});
|
|
322
324
|
} catch {
|
|
323
|
-
return
|
|
325
|
+
return p.toLocaleString();
|
|
324
326
|
}
|
|
325
327
|
}
|
|
326
|
-
return
|
|
328
|
+
return i.length > 60 ? `${i.slice(0, 57)}…` : i;
|
|
329
|
+
}
|
|
330
|
+
function ke(e, n) {
|
|
331
|
+
const t = Math.min(Math.max(Math.trunc(Number(n.decimals ?? 2)) || 0, 0), 10);
|
|
332
|
+
if (n.kind === "money") {
|
|
333
|
+
const o = /^[A-Z]{3}$/.test(String(n.currency ?? "")) ? String(n.currency) : "USD";
|
|
334
|
+
try {
|
|
335
|
+
return e.toLocaleString(void 0, {
|
|
336
|
+
style: "currency",
|
|
337
|
+
currency: o,
|
|
338
|
+
minimumFractionDigits: t,
|
|
339
|
+
maximumFractionDigits: t
|
|
340
|
+
});
|
|
341
|
+
} catch {
|
|
342
|
+
return e.toLocaleString(void 0, { style: "currency", currency: "USD" });
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
const r = e.toLocaleString(void 0, {
|
|
346
|
+
maximumFractionDigits: n.kind === "count" && Number.isInteger(e) ? 0 : t
|
|
347
|
+
});
|
|
348
|
+
return !n.unit || n.unit === "$" ? r : n.unit === "%" ? `${r}%` : `${r} ${n.unit}`;
|
|
327
349
|
}
|
|
328
350
|
function te(e, n, t, r) {
|
|
329
|
-
var
|
|
351
|
+
var i;
|
|
330
352
|
const o = `${e ?? ""}.${n}`;
|
|
331
|
-
return !(!(r != null && r.fields) || !(o in r.fields) || (
|
|
353
|
+
return !(!(r != null && r.fields) || !(o in r.fields) || (i = r.links) != null && i[o] || t != null && typeof t == "object");
|
|
332
354
|
}
|
|
333
355
|
function K(e) {
|
|
334
356
|
var n, t;
|
|
@@ -336,20 +358,20 @@ function K(e) {
|
|
|
336
358
|
}
|
|
337
359
|
function J(e) {
|
|
338
360
|
const n = { from: null, to: null, via: null, note: null, auto: !1 };
|
|
339
|
-
let t =
|
|
361
|
+
let t = s(e);
|
|
340
362
|
if (!t) return n;
|
|
341
363
|
const r = /^auto(?:-transition)?:?\s*"?([^"]*)"?$/i.exec(t);
|
|
342
364
|
if (r)
|
|
343
|
-
return n.auto = !0, n.via =
|
|
365
|
+
return n.auto = !0, n.via = s(r[1]) || null, n;
|
|
344
366
|
const o = /\s+—\s+"([\s\S]*)"\s*$/.exec(t);
|
|
345
367
|
o && (n.note = o[1], t = t.slice(0, o.index)), t = t.replace(/\s*\(bulk:[^)]*\)\s*$/i, "");
|
|
346
|
-
const
|
|
347
|
-
if (
|
|
348
|
-
return n.via =
|
|
368
|
+
const i = /^bulk:\s*(.+?)\s*→\s*(.+)$/i.exec(t);
|
|
369
|
+
if (i)
|
|
370
|
+
return n.via = i[1], n.to = i[2], n;
|
|
349
371
|
const a = /^(.*?)\s*→\s*(.+?)(?:\s+via\s+(.+))?$/.exec(t);
|
|
350
372
|
if (a) {
|
|
351
|
-
const c =
|
|
352
|
-
n.from = c && c !== "Start" ? c : null, n.to =
|
|
373
|
+
const c = s(a[1]);
|
|
374
|
+
n.from = c && c !== "Start" ? c : null, n.to = s(a[2]) || null, n.via = s(a[3]) || null;
|
|
353
375
|
}
|
|
354
376
|
return n;
|
|
355
377
|
}
|
|
@@ -474,7 +496,7 @@ const b = {
|
|
|
474
496
|
updated: "updated",
|
|
475
497
|
upload: "uploaded",
|
|
476
498
|
view: "viewed"
|
|
477
|
-
},
|
|
499
|
+
}, we = /* @__PURE__ */ new Set([
|
|
478
500
|
"add",
|
|
479
501
|
"build",
|
|
480
502
|
"create",
|
|
@@ -490,30 +512,30 @@ const b = {
|
|
|
490
512
|
"upload"
|
|
491
513
|
]);
|
|
492
514
|
function re(e) {
|
|
493
|
-
const n =
|
|
515
|
+
const n = W(e).map((a) => a.toLowerCase());
|
|
494
516
|
if (n.length === 0) return { verb: null, past: null, noun: "" };
|
|
495
517
|
const t = n[n.length - 1];
|
|
496
518
|
let r = -1;
|
|
497
519
|
if (b[t]) r = n.length - 1;
|
|
498
520
|
else if (b[n[0]]) r = 0;
|
|
499
521
|
else for (let a = n.length - 1; a >= 0; a--) b[n[a]] && (r = a);
|
|
500
|
-
if (r < 0) return { verb: null, past: null, noun: n.map(
|
|
501
|
-
const o = n[r],
|
|
502
|
-
return { verb: o, past: b[o], noun:
|
|
522
|
+
if (r < 0) return { verb: null, past: null, noun: n.map(z).join(" ") };
|
|
523
|
+
const o = n[r], i = [...n.slice(0, r), ...n.slice(r + 1)];
|
|
524
|
+
return { verb: o, past: b[o], noun: i.map(z).join(" ") };
|
|
503
525
|
}
|
|
504
|
-
function
|
|
505
|
-
return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e &&
|
|
526
|
+
function Se(e, n) {
|
|
527
|
+
return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e && we.has(e) ? `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}` : `the ${n}` : "";
|
|
506
528
|
}
|
|
507
|
-
function
|
|
529
|
+
function ye(e) {
|
|
508
530
|
const n = /(\d[\d,]*)\s+rows?/i.exec(e), t = /^\s*(csv|xlsx|json|pdf|xml)\b/i.exec(e);
|
|
509
531
|
return {
|
|
510
532
|
rows: n ? Number(n[1].replace(/,/g, "")) : null,
|
|
511
|
-
format: t ?
|
|
533
|
+
format: t ? F[t[1].toLowerCase()] ?? t[1].toUpperCase() : null
|
|
512
534
|
};
|
|
513
535
|
}
|
|
514
536
|
function S(e, n) {
|
|
515
537
|
var r;
|
|
516
|
-
const t = `${
|
|
538
|
+
const t = `${s(e.collection)}:${s(e.item)}`;
|
|
517
539
|
return ((r = n == null ? void 0 : n.junctions) == null ? void 0 : r[t]) ?? null;
|
|
518
540
|
}
|
|
519
541
|
function Q(e) {
|
|
@@ -521,79 +543,79 @@ function Q(e) {
|
|
|
521
543
|
}
|
|
522
544
|
function G(e, n) {
|
|
523
545
|
const t = g(I(e.parent_collection, n).singular), r = `${/^[aeiou]/i.test(t) ? "an" : "a"} ${t} record`;
|
|
524
|
-
if (!
|
|
525
|
-
const o =
|
|
546
|
+
if (!s(e.parent_id)) return r;
|
|
547
|
+
const o = Y(e.parent_collection, s(e.parent_id), n);
|
|
526
548
|
return !o || o === k ? r : o;
|
|
527
549
|
}
|
|
528
550
|
function E(e) {
|
|
529
|
-
const n =
|
|
551
|
+
const n = s(e.value);
|
|
530
552
|
return n ? `${e.noun} ${n}` : Q(e.noun);
|
|
531
553
|
}
|
|
532
554
|
function oe(e, n, t) {
|
|
533
555
|
const r = G(n, t);
|
|
534
556
|
return e === "create" ? `added ${E(n)} to ${r}` : e === "delete" ? `removed ${E(n)} from ${r}` : `updated ${E(n)} on ${r}`;
|
|
535
557
|
}
|
|
536
|
-
function
|
|
558
|
+
function xe(e, n) {
|
|
537
559
|
var l;
|
|
538
|
-
const t = e.map((
|
|
539
|
-
if (t.length === 0 || t.some((
|
|
540
|
-
const r = new Set(t.map((
|
|
560
|
+
const t = e.map((p) => ({ e: p, j: S(p, n) }));
|
|
561
|
+
if (t.length === 0 || t.some((p) => !p.j)) return null;
|
|
562
|
+
const r = new Set(t.map((p) => s(p.j.parent_id)).filter(Boolean)), o = new Set(t.map((p) => p.j.parent_collection));
|
|
541
563
|
if (r.size > 1 || o.size > 1) return null;
|
|
542
|
-
const
|
|
543
|
-
for (const { e:
|
|
544
|
-
const _ = a.get($.noun) ?? { removed: [], added: [], updated: [] }, h =
|
|
564
|
+
const i = ((l = t.find((p) => s(p.j.parent_id))) == null ? void 0 : l.j) ?? t[0].j, a = /* @__PURE__ */ new Map();
|
|
565
|
+
for (const { e: p, j: $ } of [...t].reverse()) {
|
|
566
|
+
const _ = a.get($.noun) ?? { removed: [], added: [], updated: [] }, h = s($.value), v = s(p.action);
|
|
545
567
|
v === "delete" ? _.removed.push(h) : v === "create" ? _.added.push(h) : _.updated.push(h), a.set($.noun, _);
|
|
546
568
|
}
|
|
547
|
-
const c = (
|
|
548
|
-
for (const [
|
|
569
|
+
const c = (p, $) => $ ? `${p} ${$}` : Q(p), u = [], d = [];
|
|
570
|
+
for (const [p, $] of a) {
|
|
549
571
|
if ($.removed.length === 1 && $.added.length === 1 && $.updated.length === 0) {
|
|
550
|
-
u.push({ noun:
|
|
572
|
+
u.push({ noun: p, from: $.removed[0], to: $.added[0] });
|
|
551
573
|
continue;
|
|
552
574
|
}
|
|
553
|
-
for (const _ of $.removed) d.push(`removed ${c(
|
|
554
|
-
for (const _ of $.added) d.push(`added ${c(
|
|
555
|
-
for (const _ of $.updated) d.push(`updated ${c(
|
|
575
|
+
for (const _ of $.removed) d.push(`removed ${c(p, _)}`);
|
|
576
|
+
for (const _ of $.added) d.push(`added ${c(p, _)}`);
|
|
577
|
+
for (const _ of $.updated) d.push(`updated ${c(p, _)}`);
|
|
556
578
|
}
|
|
557
|
-
return { parent: G(
|
|
579
|
+
return { parent: G(i, n), pairs: u, rest: d };
|
|
558
580
|
}
|
|
559
581
|
function Ae(e) {
|
|
560
582
|
return e.from && e.to ? `${e.noun} ${e.from} → ${e.to}` : e.to ? `${e.noun} set to ${e.to}` : `changed ${e.noun}`;
|
|
561
583
|
}
|
|
562
|
-
function
|
|
563
|
-
const t =
|
|
584
|
+
function be(e, n) {
|
|
585
|
+
const t = xe(e, n);
|
|
564
586
|
if (!t) return null;
|
|
565
|
-
const { parent: r, pairs: o, rest:
|
|
566
|
-
if (
|
|
587
|
+
const { parent: r, pairs: o, rest: i } = t;
|
|
588
|
+
if (i.length === 0 && o.length === 1) {
|
|
567
589
|
const a = o[0];
|
|
568
590
|
return a.from && a.to ? `changed ${a.noun} on ${r}: ${a.from} → ${a.to}` : a.to ? `changed ${a.noun} on ${r} to ${a.to}` : `changed ${a.noun} on ${r}`;
|
|
569
591
|
}
|
|
570
|
-
if (o.length === 0 &&
|
|
592
|
+
if (o.length === 0 && i.length === 1) {
|
|
571
593
|
const a = e[0];
|
|
572
|
-
return oe(
|
|
594
|
+
return oe(s(a.action), S(a, n), n);
|
|
573
595
|
}
|
|
574
|
-
return `changed ${r}: ${[...o.map(Ae), ...
|
|
596
|
+
return `changed ${r}: ${[...o.map(Ae), ...i].join("; ")}`;
|
|
575
597
|
}
|
|
576
598
|
const H = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
|
|
577
599
|
function je(e) {
|
|
578
|
-
const n =
|
|
600
|
+
const n = s(e).toLowerCase();
|
|
579
601
|
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";
|
|
580
602
|
}
|
|
581
|
-
function
|
|
603
|
+
function Ie(e, n) {
|
|
582
604
|
var $, _, h, v, y;
|
|
583
|
-
const t =
|
|
605
|
+
const t = s(e.action), r = e.collection ?? null, o = T(r, e.item, n), i = I(r, n), a = `${/^[aeiou]/i.test(i.singular) ? "an" : "a"} ${g(i.singular)}`, c = s(e.comment), u = o ? ` on ${o}` : "", d = S(e, n);
|
|
584
606
|
if (d && (t === "create" || t === "delete" || t === "update"))
|
|
585
607
|
return oe(t, d, n);
|
|
586
608
|
if ((($ = e.event) == null ? void 0 : $.kind) === "start") {
|
|
587
|
-
const
|
|
588
|
-
return `started ${o ?? "the pipeline"}${
|
|
609
|
+
const f = s(e.event.to_label);
|
|
610
|
+
return `started ${o ?? "the pipeline"}${f ? ` in ${f}` : ""}`;
|
|
589
611
|
}
|
|
590
612
|
if (((_ = e.event) == null ? void 0 : _.kind) === "transition" || H.has(t)) {
|
|
591
|
-
const
|
|
592
|
-
from:
|
|
593
|
-
to:
|
|
594
|
-
via:
|
|
595
|
-
} : J(c), m = (h = e.event) != null && h.addendum ? `Addendum “${
|
|
596
|
-
return
|
|
613
|
+
const f = e.event ? {
|
|
614
|
+
from: s(e.event.from_label) || null,
|
|
615
|
+
to: s(e.event.to_label) || null,
|
|
616
|
+
via: s(e.event.transition_label) || null
|
|
617
|
+
} : J(c), m = (h = e.event) != null && h.addendum ? `Addendum “${s(e.event.addendum.title) || "Untitled"}”` : o ?? "a record";
|
|
618
|
+
return f.from && f.to ? `moved ${m} from ${f.from} to ${f.to}` : f.to ? `moved ${m} to ${f.to}` : f.via ? `ran “${f.via}” on ${m}` : `moved ${m}`;
|
|
597
619
|
}
|
|
598
620
|
switch (t) {
|
|
599
621
|
case "create":
|
|
@@ -603,16 +625,16 @@ function be(e, n) {
|
|
|
603
625
|
case "o2m-update": {
|
|
604
626
|
if (t === "o2m-update")
|
|
605
627
|
return e.o2m ? `${M(e.o2m)}${u}` : `changed related rows${u}`;
|
|
606
|
-
const
|
|
628
|
+
const f = K(e);
|
|
607
629
|
if (r === "nivaro_settings")
|
|
608
|
-
return
|
|
630
|
+
return f.length ? `changed the ${j(r, f, n)} setting${f.length === 1 ? "" : "s"}` : "changed the settings";
|
|
609
631
|
if (r === "nivaro_approval_instances" && ((v = e.why) != null && v.approval)) {
|
|
610
|
-
const m = e.why.approval, w =
|
|
611
|
-
return `${(b[
|
|
632
|
+
const m = e.why.approval, w = T(m.collection, m.item, n);
|
|
633
|
+
return `${(b[s(m.decision).toLowerCase()] ?? s(m.decision).toLowerCase()) || "decided on"} ${w ?? o ?? "an approval"}${m.chain ? ` (${m.chain})` : ""}`;
|
|
612
634
|
}
|
|
613
|
-
if (
|
|
635
|
+
if (f.length) {
|
|
614
636
|
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 ${
|
|
637
|
+
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 ${j(r, f, n)}${u}`;
|
|
616
638
|
}
|
|
617
639
|
return `updated ${o ?? a}`;
|
|
618
640
|
}
|
|
@@ -622,8 +644,8 @@ function be(e, n) {
|
|
|
622
644
|
case "restore":
|
|
623
645
|
return `restored ${o ?? a}`;
|
|
624
646
|
case "pipeline-start": {
|
|
625
|
-
const
|
|
626
|
-
return `started ${o ?? "the pipeline"}${
|
|
647
|
+
const f = /initial state:\s*(.+)$/i.exec(c);
|
|
648
|
+
return `started ${o ?? "the pipeline"}${f ? ` in ${f[1]}` : ""}`;
|
|
627
649
|
}
|
|
628
650
|
case "login":
|
|
629
651
|
return "signed in";
|
|
@@ -634,17 +656,17 @@ function be(e, n) {
|
|
|
634
656
|
case "sign-in-failed":
|
|
635
657
|
return o && o !== k ? `had a sign-in as ${o} fail` : "had a sign-in fail";
|
|
636
658
|
case "export": {
|
|
637
|
-
const
|
|
638
|
-
return `exported ${
|
|
659
|
+
const f = ye(c);
|
|
660
|
+
return `exported ${f.rows != null ? L(f.rows, r, n) : g(i.plural)}${f.format ? ` to ${f.format}` : ""}`;
|
|
639
661
|
}
|
|
640
662
|
case "masquerade-start":
|
|
641
|
-
return `started viewing as ${
|
|
663
|
+
return `started viewing as ${A(e, n, c)}`;
|
|
642
664
|
case "masquerade-stop":
|
|
643
|
-
return `stopped viewing as ${
|
|
665
|
+
return `stopped viewing as ${A(e, n, c)}`;
|
|
644
666
|
case "token.generate":
|
|
645
|
-
return `generated a static token for ${
|
|
667
|
+
return `generated a static token for ${A(e, n, "")}`;
|
|
646
668
|
case "token.revoke":
|
|
647
|
-
return `revoked the static token of ${
|
|
669
|
+
return `revoked the static token of ${A(e, n, "")}`;
|
|
648
670
|
case "api_key_created":
|
|
649
671
|
return `created ${o && o !== k ? o : "an API key"}`;
|
|
650
672
|
case "api_key_revoked":
|
|
@@ -654,39 +676,39 @@ function be(e, n) {
|
|
|
654
676
|
case "api_key_simulate":
|
|
655
677
|
return `tested requests as ${o && o !== k ? o : "an API key"}`;
|
|
656
678
|
case "set_role":
|
|
657
|
-
return `changed the role of ${
|
|
679
|
+
return `changed the role of ${A(e, n, "")}`;
|
|
658
680
|
case "bulk-write":
|
|
659
681
|
case "bulk-action-execute": {
|
|
660
|
-
const
|
|
682
|
+
const f = /(\d+)\s+(?:item|row)/i.exec(c), m = f ? L(Number(f[1]), r, n) : g(i.plural), w = t === "bulk-action-execute" ? /^(.+?)\s*\([^)]*\)\s+on\s/.exec(c) : null;
|
|
661
683
|
return w ? `ran “${w[1]}” on ${m}` : `changed ${m} in bulk`;
|
|
662
684
|
}
|
|
663
685
|
case "import-create":
|
|
664
686
|
case "import-queue":
|
|
665
|
-
return `started an import into ${g(
|
|
687
|
+
return `started an import into ${g(i.plural)}`;
|
|
666
688
|
case "import-complete":
|
|
667
|
-
return `finished an import into ${g(
|
|
689
|
+
return `finished an import into ${g(i.plural)}${c ? ` (${c})` : ""}`;
|
|
668
690
|
case "import-failed":
|
|
669
|
-
return `had an import into ${g(
|
|
691
|
+
return `had an import into ${g(i.plural)} fail`;
|
|
670
692
|
case "comment":
|
|
671
693
|
return `commented${u}`;
|
|
672
694
|
case "file-download": {
|
|
673
|
-
let
|
|
695
|
+
let f = "", m = !1;
|
|
674
696
|
try {
|
|
675
|
-
const
|
|
676
|
-
|
|
697
|
+
const D = JSON.parse(c);
|
|
698
|
+
f = typeof D.name == "string" ? D.name : "", m = D.kind === "open";
|
|
677
699
|
} catch {
|
|
678
700
|
}
|
|
679
|
-
const w =
|
|
701
|
+
const w = f ? `“${f}”` : "a file";
|
|
680
702
|
return `${m ? "opened" : "downloaded"} ${w}${r === "nivaro_files" ? "" : u}`;
|
|
681
703
|
}
|
|
682
704
|
case "split-out":
|
|
683
705
|
case "split-in": {
|
|
684
|
-
let
|
|
706
|
+
let f = 0;
|
|
685
707
|
try {
|
|
686
|
-
|
|
708
|
+
f = Number(JSON.parse(c).lines) || 0;
|
|
687
709
|
} catch {
|
|
688
710
|
}
|
|
689
|
-
const m =
|
|
711
|
+
const m = f > 0 ? `${f} ${f === 1 ? "line" : "lines"}` : "lines";
|
|
690
712
|
return t === "split-out" ? `moved ${m}${o ? ` of ${o}` : ""} to a new record` : `created ${o ?? a} from ${m} of another record`;
|
|
691
713
|
}
|
|
692
714
|
case "picker-exclude":
|
|
@@ -704,100 +726,100 @@ function be(e, n) {
|
|
|
704
726
|
}
|
|
705
727
|
if (!t) return `did something${u}`;
|
|
706
728
|
const l = re(t);
|
|
707
|
-
return /settings$/.test(l.noun) && !l.verb ? `changed the ${l.noun}` : l.past ? o && l.noun && g(
|
|
729
|
+
return /settings$/.test(l.noun) && !l.verb ? `changed the ${l.noun}` : l.past ? o && l.noun && g(i.singular).toLowerCase().includes(l.noun.toLowerCase()) ? `${l.past} ${o}` : l.noun ? `${l.past} ${Se(l.verb, l.noun)}${u}` : `${l.past} ${o ?? "something"}` : `recorded “${X(t)}”${u}`;
|
|
708
730
|
}
|
|
709
|
-
function
|
|
710
|
-
const r =
|
|
731
|
+
function A(e, n, t) {
|
|
732
|
+
const r = s(e.item), o = P(r, n) ?? (t || null);
|
|
711
733
|
if (o) return o;
|
|
712
|
-
const
|
|
713
|
-
return
|
|
734
|
+
const i = e.collection === "nivaro_users" ? T(e.collection, e.item, n) : null;
|
|
735
|
+
return i && !U.test(r) ? i : "someone";
|
|
714
736
|
}
|
|
715
|
-
function
|
|
716
|
-
return `${ee(e, n)} ${
|
|
737
|
+
function Ne(e, n) {
|
|
738
|
+
return `${ee(e, n)} ${Ie(e, n)}`;
|
|
717
739
|
}
|
|
718
|
-
function
|
|
740
|
+
function qe(e) {
|
|
719
741
|
var c, u, d, l;
|
|
720
|
-
const n =
|
|
721
|
-
let r =
|
|
742
|
+
const n = s(e.action), t = s(e.comment);
|
|
743
|
+
let r = s((c = e.why) == null ? void 0 : c.reason) || null, o = s((u = e.why) == null ? void 0 : u.note) || null;
|
|
722
744
|
!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);
|
|
723
|
-
const
|
|
745
|
+
const i = (l = e.why) == null ? void 0 : l.approval, a = i ? `${q(s(i.decision)) || "Decided"}${i.chain ? ` · ${i.chain}` : ""}${i.step != null && i.step !== "" ? ` · step ${i.step}` : ""}${s(i.comment) ? ` — “${s(i.comment)}”` : ""}` : null;
|
|
724
746
|
return { reason: r, note: o, approval: a };
|
|
725
747
|
}
|
|
726
|
-
const
|
|
748
|
+
const Ce = 6e4, Re = 5e3;
|
|
727
749
|
function C(e) {
|
|
728
750
|
return e.timestamp ? new Date(e.timestamp).getTime() : Number.NaN;
|
|
729
751
|
}
|
|
730
752
|
function R(e) {
|
|
731
|
-
const n =
|
|
732
|
-
return `${n.kind}|${
|
|
753
|
+
const n = Z(e);
|
|
754
|
+
return `${n.kind}|${s(n.id)}|${s(e.user ?? e.user_id).toUpperCase()}`;
|
|
733
755
|
}
|
|
734
|
-
function
|
|
735
|
-
const n =
|
|
736
|
-
return !
|
|
756
|
+
function Le(e) {
|
|
757
|
+
const n = s(e.action);
|
|
758
|
+
return !s(e.item) && (n.startsWith("bulk-") || n === "import-complete");
|
|
737
759
|
}
|
|
738
|
-
function
|
|
739
|
-
const t = n.windowMs ??
|
|
740
|
-
for (const
|
|
741
|
-
const a = r[r.length - 1], c = a == null ? void 0 : a.entries[a.entries.length - 1], u = i
|
|
760
|
+
function De(e, n = {}) {
|
|
761
|
+
const t = n.windowMs ?? Ce, r = [], o = (i, a) => i.parent_collection === a.parent_collection && (!s(i.parent_id) || !s(a.parent_id) || s(i.parent_id) === s(a.parent_id));
|
|
762
|
+
for (const i of e) {
|
|
763
|
+
const a = r[r.length - 1], c = a == null ? void 0 : a.entries[a.entries.length - 1], u = s(i.group_key);
|
|
742
764
|
if (a && c && n.labels) {
|
|
743
|
-
const d = S(
|
|
744
|
-
if (d && l && a.entries.every((
|
|
745
|
-
a.entries.push(
|
|
765
|
+
const d = S(i, n.labels), l = S(c, n.labels);
|
|
766
|
+
if (d && l && a.entries.every((p) => S(p, n.labels)) && o(d, l) && R(i) === R(c) && Math.abs(C(c) - C(i)) <= Re) {
|
|
767
|
+
a.entries.push(i), a.by !== "group_key" && (a.by = "time");
|
|
746
768
|
continue;
|
|
747
769
|
}
|
|
748
770
|
}
|
|
749
771
|
if (a && c) {
|
|
750
|
-
const d =
|
|
772
|
+
const d = s(c.group_key);
|
|
751
773
|
if (u && u === d) {
|
|
752
|
-
a.entries.push(
|
|
774
|
+
a.entries.push(i), a.by = "group_key";
|
|
753
775
|
continue;
|
|
754
776
|
}
|
|
755
|
-
if (!u && !d && a.by !== "group_key" && i
|
|
756
|
-
a.entries.push(
|
|
777
|
+
if (!u && !d && a.by !== "group_key" && s(i.action) === s(c.action) && s(i.collection) === s(c.collection) && s(i.collection) !== "" && R(i) === R(c) && Math.abs(C(c) - C(i)) <= t) {
|
|
778
|
+
a.entries.push(i), a.by = "time";
|
|
757
779
|
continue;
|
|
758
780
|
}
|
|
759
781
|
}
|
|
760
|
-
r.push({ key: `${u || "e"}:${
|
|
782
|
+
r.push({ key: `${u || "e"}:${i.id ?? r.length}`, entries: [i], by: null });
|
|
761
783
|
}
|
|
762
784
|
return r;
|
|
763
785
|
}
|
|
764
|
-
function
|
|
786
|
+
function Me(e, n) {
|
|
765
787
|
if (e.length === 0) return "";
|
|
766
|
-
const t = e.filter((v) => !
|
|
767
|
-
if (t.length <= 1) return
|
|
768
|
-
const o = ee(r, n),
|
|
769
|
-
if (
|
|
770
|
-
const c = new Set(t.map((v) =>
|
|
771
|
-
t.map((v) => H.has(
|
|
788
|
+
const t = e.filter((v) => !Le(v)), r = t[0] ?? e[0];
|
|
789
|
+
if (t.length <= 1) return Ne(r, n);
|
|
790
|
+
const o = ee(r, n), i = be(t, n);
|
|
791
|
+
if (i) return `${o} ${i}`;
|
|
792
|
+
const c = new Set(t.map((v) => s(v.collection))).size === 1 ? r.collection ?? null : null, u = new Set(t.map((v) => s(v.item))), d = u.size > 1 ? u.size : t.length, l = c ? u.size === 1 && s(r.item) ? T(c, r.item, n) ?? L(d, c, n) : L(d, c, n) : `${d} records`, p = u.size === 1 && t.length > 1 ? ` ${t.length} times` : "", $ = new Set(
|
|
793
|
+
t.map((v) => H.has(s(v.action)) ? "transition" : s(v.action))
|
|
772
794
|
);
|
|
773
795
|
if ($.size !== 1) return `${o} made ${t.length} changes to ${l}`;
|
|
774
796
|
const _ = [...$][0];
|
|
775
797
|
if (_ === "transition") {
|
|
776
798
|
const v = new Set(
|
|
777
|
-
t.map((
|
|
799
|
+
t.map((f) => {
|
|
778
800
|
var m;
|
|
779
|
-
return
|
|
801
|
+
return s(((m = f.event) == null ? void 0 : m.to_label) ?? J(f.comment).to);
|
|
780
802
|
})
|
|
781
803
|
), y = v.size === 1 ? [...v][0] : "";
|
|
782
|
-
return `${o} moved ${l}${y ? ` to ${y}` : ""}${
|
|
804
|
+
return `${o} moved ${l}${y ? ` to ${y}` : ""}${p}`;
|
|
783
805
|
}
|
|
784
806
|
if (_ === "update") {
|
|
785
807
|
const v = Pe(t, c, n);
|
|
786
|
-
return `${o} updated ${l}${
|
|
808
|
+
return `${o} updated ${l}${p}${v ? `: ${v}` : ""}`;
|
|
787
809
|
}
|
|
788
810
|
if (_ === "create") return `${o} created ${l}`;
|
|
789
811
|
if (_ === "delete") return `${o} deleted ${l}`;
|
|
790
|
-
if (_ === "picker-exclude") return `${o} hid ${l} from pickers${
|
|
791
|
-
if (_ === "picker-include") return `${o} showed ${l} in pickers again${
|
|
812
|
+
if (_ === "picker-exclude") return `${o} hid ${l} from pickers${p}`;
|
|
813
|
+
if (_ === "picker-include") return `${o} showed ${l} in pickers again${p}`;
|
|
792
814
|
const h = re(_);
|
|
793
|
-
return h.past ? `${o} ${h.past} ${l}${h.noun && !g(I(c, n).plural).toLowerCase().includes(h.noun) ? ` (${h.noun})` : ""}${
|
|
815
|
+
return h.past ? `${o} ${h.past} ${l}${h.noun && !g(I(c, n).plural).toLowerCase().includes(h.noun) ? ` (${h.noun})` : ""}${p}` : `${o} recorded “${X(_)}” on ${l}`;
|
|
794
816
|
}
|
|
795
817
|
function Pe(e, n, t) {
|
|
796
818
|
var c;
|
|
797
819
|
const r = ((c = e[0]) == null ? void 0 : c.changes) ?? null;
|
|
798
820
|
if (!(r != null && r.length)) {
|
|
799
821
|
const u = e.map((d) => K(d).sort().join(","));
|
|
800
|
-
return u[0] && u.every((d) => d === u[0]) ?
|
|
822
|
+
return u[0] && u.every((d) => d === u[0]) ? j(n, u[0].split(","), t) : "";
|
|
801
823
|
}
|
|
802
824
|
const o = (u) => JSON.stringify((u.changes ?? []).map((d) => [d.field, d.value ?? null]).sort());
|
|
803
825
|
if (e.every((u) => o(u) === o(e[0])) && r.length <= 2 && r.every((u) => te(n, u.field, u.value, t)))
|
|
@@ -805,22 +827,22 @@ function Pe(e, n, t) {
|
|
|
805
827
|
(u) => `${B(n, u.field, t)} → ${ne(n, u.field, u.value, t)}`
|
|
806
828
|
).join(", ");
|
|
807
829
|
const a = new Set(e.flatMap((u) => (u.changes ?? []).map((d) => d.field)));
|
|
808
|
-
return
|
|
830
|
+
return j(n, [...a], t);
|
|
809
831
|
}
|
|
810
|
-
function
|
|
832
|
+
function Oe(e) {
|
|
811
833
|
var a;
|
|
812
|
-
const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(),
|
|
813
|
-
const d =
|
|
834
|
+
const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), i = (c, u) => {
|
|
835
|
+
const d = s(c), l = s(u);
|
|
814
836
|
!d || !l || (o.add(d), d === "nivaro_users" && t.add(l), n.set(`${d}:${l}`, { collection: d, id: l }));
|
|
815
837
|
};
|
|
816
838
|
for (const c of e) {
|
|
817
|
-
const u =
|
|
839
|
+
const u = s(c.user ?? c.user_id);
|
|
818
840
|
u && t.add(u);
|
|
819
|
-
const d =
|
|
820
|
-
d.kind === "view_as" && d.id && t.add(d.id), d.on_behalf_of && t.add(d.on_behalf_of),
|
|
841
|
+
const d = Z(c);
|
|
842
|
+
d.kind === "view_as" && d.id && t.add(d.id), d.on_behalf_of && t.add(d.on_behalf_of), s(c.collection) && o.add(s(c.collection)), i(c.collection, c.item), (a = c.why) != null && a.approval && i(c.why.approval.collection, c.why.approval.item);
|
|
821
843
|
for (const l of K(c)) {
|
|
822
|
-
const
|
|
823
|
-
|
|
844
|
+
const p = s(c.collection);
|
|
845
|
+
p && r.set(`${p}.${l}`, { collection: p, field: l });
|
|
824
846
|
}
|
|
825
847
|
}
|
|
826
848
|
return {
|
|
@@ -831,33 +853,33 @@ function Me(e) {
|
|
|
831
853
|
};
|
|
832
854
|
}
|
|
833
855
|
export {
|
|
834
|
-
|
|
856
|
+
Ce as BURST_WINDOW_MS,
|
|
835
857
|
k as HIDDEN_RECORD,
|
|
836
|
-
|
|
858
|
+
Re as LINK_WRITE_WINDOW_MS,
|
|
837
859
|
re as actionParts,
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
860
|
+
Oe as activityLabelRefs,
|
|
861
|
+
Ie as activityPredicate,
|
|
862
|
+
qe as activityWhy,
|
|
841
863
|
ee as actorName,
|
|
842
|
-
|
|
864
|
+
Z as actorOf,
|
|
843
865
|
me as choiceText,
|
|
844
866
|
I as collectionNouns,
|
|
845
|
-
|
|
867
|
+
L as countNoun,
|
|
846
868
|
B as fieldLabel,
|
|
847
|
-
|
|
848
|
-
|
|
869
|
+
j as fieldList,
|
|
870
|
+
De as groupActivity,
|
|
849
871
|
S as junctionOf,
|
|
850
|
-
|
|
851
|
-
|
|
872
|
+
xe as linkChanges,
|
|
873
|
+
be as linkGroupPredicate,
|
|
852
874
|
Ae as linkPairText,
|
|
853
875
|
M as o2mSentence,
|
|
854
|
-
|
|
876
|
+
Te as o2mTotalsText,
|
|
855
877
|
le as parseActor,
|
|
856
878
|
J as parseTransitionComment,
|
|
857
879
|
X as readableTitle,
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
880
|
+
T as recordPhrase,
|
|
881
|
+
Me as renderActivityGroupSentence,
|
|
882
|
+
Ne as renderActivitySentence,
|
|
861
883
|
je as transitionVerb,
|
|
862
884
|
te as valueShowable,
|
|
863
885
|
ne as valueText
|