@nivaro/react 0.3.138 → 0.3.140
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 +36 -2
- package/dist/shared/components/AudienceConfirmPanel.js +19 -19
- package/dist/shared/components/BroadcastView.js +213 -211
- package/dist/shared/components/CollectionBrowserView.js +2677 -2658
- 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 +3038 -3027
- 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/SlaRulesView.js +73 -74
- 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/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 +1167 -1153
- package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
- package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
- 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 +671 -670
- package/dist/shared/components/queue/worklist-helpers.js +36 -21
- package/dist/shared/components/support/RequestList.js +121 -121
- package/dist/shared/components/support/SupportAnalytics.js +29 -29
- package/dist/shared/lib/activity-sentence.js +316 -278
- package/dist/shared/lib/format-value.js +5 -4
- 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,36 +31,36 @@ 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
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function se(e) {
|
|
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
|
-
function
|
|
48
|
-
const n =
|
|
47
|
+
function X(e) {
|
|
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
|
-
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
|
-
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) {
|
|
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
|
-
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
|
-
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 : 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
152
|
function L(e, n, t) {
|
|
153
|
-
const { singular: r, plural: o } =
|
|
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 ? 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
|
-
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")
|
|
@@ -184,95 +184,111 @@ function de(e) {
|
|
|
184
184
|
return null;
|
|
185
185
|
}
|
|
186
186
|
if (!n || typeof n != "object") return null;
|
|
187
|
-
const t = n, r =
|
|
188
|
-
return
|
|
187
|
+
const t = n, r = s(t.kind);
|
|
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),
|
|
192
192
|
on_behalf_of: t.on_behalf_of == null ? null : String(t.on_behalf_of)
|
|
193
193
|
} : null;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
const n =
|
|
195
|
+
function Z(e) {
|
|
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
|
-
function
|
|
228
|
-
const t =
|
|
227
|
+
function ee(e, n) {
|
|
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
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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
|
+
}
|
|
257
|
+
function pe(e, n) {
|
|
258
|
+
const t = s(e.parent_id);
|
|
259
|
+
if (!t) return !1;
|
|
260
|
+
const r = Y(e.parent_collection, t, n);
|
|
261
|
+
return !!r && r !== k;
|
|
262
|
+
}
|
|
263
|
+
function fe(e, n) {
|
|
264
|
+
const t = G(e, n), r = s(e.value);
|
|
265
|
+
return r ? `${e.noun} ${r} on ${t}` : pe(e, n) ? `${t} · ${e.noun}` : `${Q(e.noun)} on ${t}`;
|
|
266
|
+
}
|
|
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
|
+
if (o && r in o) {
|
|
271
|
+
const c = o[r];
|
|
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;
|
|
259
275
|
}
|
|
260
|
-
return
|
|
276
|
+
return a || U.test(n) ? N(i) : `${i} ${n}`;
|
|
261
277
|
}
|
|
262
|
-
function
|
|
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
|
-
return
|
|
281
|
+
return s(r) || q(n);
|
|
266
282
|
}
|
|
267
|
-
function
|
|
268
|
-
const r = [...new Set(n)].map((o) =>
|
|
283
|
+
function j(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,64 +296,86 @@ 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
|
|
287
|
-
var
|
|
302
|
+
function ne(e, n, t, r) {
|
|
303
|
+
var u, d, l;
|
|
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),
|
|
293
|
-
if (!
|
|
294
|
-
const a = (
|
|
295
|
-
if (a) return
|
|
296
|
-
|
|
297
|
-
if (
|
|
298
|
-
|
|
299
|
-
|
|
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
|
+
if (a) return me(a);
|
|
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()))
|
|
300
318
|
try {
|
|
301
|
-
return
|
|
319
|
+
return p.toLocaleString(void 0, {
|
|
302
320
|
dateStyle: "medium",
|
|
303
321
|
timeStyle: "short",
|
|
304
322
|
...r != null && r.timeZone ? { timeZone: r.timeZone } : {}
|
|
305
323
|
});
|
|
306
324
|
} catch {
|
|
307
|
-
return
|
|
325
|
+
return p.toLocaleString();
|
|
308
326
|
}
|
|
309
327
|
}
|
|
310
|
-
return
|
|
328
|
+
return i.length > 60 ? `${i.slice(0, 57)}…` : i;
|
|
311
329
|
}
|
|
312
|
-
function
|
|
313
|
-
|
|
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}`;
|
|
349
|
+
}
|
|
350
|
+
function te(e, n, t, r) {
|
|
351
|
+
var i;
|
|
314
352
|
const o = `${e ?? ""}.${n}`;
|
|
315
|
-
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");
|
|
316
354
|
}
|
|
317
|
-
function
|
|
355
|
+
function K(e) {
|
|
318
356
|
var n, t;
|
|
319
357
|
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
358
|
}
|
|
321
359
|
function J(e) {
|
|
322
360
|
const n = { from: null, to: null, via: null, note: null, auto: !1 };
|
|
323
|
-
let t =
|
|
361
|
+
let t = s(e);
|
|
324
362
|
if (!t) return n;
|
|
325
363
|
const r = /^auto(?:-transition)?:?\s*"?([^"]*)"?$/i.exec(t);
|
|
326
364
|
if (r)
|
|
327
|
-
return n.auto = !0, n.via =
|
|
365
|
+
return n.auto = !0, n.via = s(r[1]) || null, n;
|
|
328
366
|
const o = /\s+—\s+"([\s\S]*)"\s*$/.exec(t);
|
|
329
367
|
o && (n.note = o[1], t = t.slice(0, o.index)), t = t.replace(/\s*\(bulk:[^)]*\)\s*$/i, "");
|
|
330
|
-
const
|
|
331
|
-
if (
|
|
332
|
-
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;
|
|
333
371
|
const a = /^(.*?)\s*→\s*(.+?)(?:\s+via\s+(.+))?$/.exec(t);
|
|
334
372
|
if (a) {
|
|
335
|
-
const c =
|
|
336
|
-
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;
|
|
337
375
|
}
|
|
338
376
|
return n;
|
|
339
377
|
}
|
|
340
|
-
const
|
|
378
|
+
const b = {
|
|
341
379
|
ack: "acknowledged",
|
|
342
380
|
acknowledge: "acknowledged",
|
|
343
381
|
acquire: "took",
|
|
@@ -458,7 +496,7 @@ const x = {
|
|
|
458
496
|
updated: "updated",
|
|
459
497
|
upload: "uploaded",
|
|
460
498
|
view: "viewed"
|
|
461
|
-
},
|
|
499
|
+
}, we = /* @__PURE__ */ new Set([
|
|
462
500
|
"add",
|
|
463
501
|
"build",
|
|
464
502
|
"create",
|
|
@@ -473,111 +511,111 @@ const x = {
|
|
|
473
511
|
"schedule",
|
|
474
512
|
"upload"
|
|
475
513
|
]);
|
|
476
|
-
function
|
|
477
|
-
const n =
|
|
514
|
+
function re(e) {
|
|
515
|
+
const n = W(e).map((a) => a.toLowerCase());
|
|
478
516
|
if (n.length === 0) return { verb: null, past: null, noun: "" };
|
|
479
517
|
const t = n[n.length - 1];
|
|
480
518
|
let r = -1;
|
|
481
|
-
if (
|
|
482
|
-
else if (
|
|
483
|
-
else for (let a = n.length - 1; a >= 0; a--)
|
|
484
|
-
if (r < 0) return { verb: null, past: null, noun: n.map(
|
|
485
|
-
const o = n[r],
|
|
486
|
-
return { verb: o, past:
|
|
519
|
+
if (b[t]) r = n.length - 1;
|
|
520
|
+
else if (b[n[0]]) r = 0;
|
|
521
|
+
else for (let a = n.length - 1; a >= 0; a--) b[n[a]] && (r = a);
|
|
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(" ") };
|
|
487
525
|
}
|
|
488
|
-
function
|
|
489
|
-
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}` : "";
|
|
490
528
|
}
|
|
491
|
-
function
|
|
529
|
+
function ye(e) {
|
|
492
530
|
const n = /(\d[\d,]*)\s+rows?/i.exec(e), t = /^\s*(csv|xlsx|json|pdf|xml)\b/i.exec(e);
|
|
493
531
|
return {
|
|
494
532
|
rows: n ? Number(n[1].replace(/,/g, "")) : null,
|
|
495
|
-
format: t ?
|
|
533
|
+
format: t ? F[t[1].toLowerCase()] ?? t[1].toUpperCase() : null
|
|
496
534
|
};
|
|
497
535
|
}
|
|
498
536
|
function S(e, n) {
|
|
499
537
|
var r;
|
|
500
|
-
const t = `${
|
|
538
|
+
const t = `${s(e.collection)}:${s(e.item)}`;
|
|
501
539
|
return ((r = n == null ? void 0 : n.junctions) == null ? void 0 : r[t]) ?? null;
|
|
502
540
|
}
|
|
503
|
-
function
|
|
541
|
+
function Q(e) {
|
|
504
542
|
return `${/^[aeiou]/i.test(e) ? "an" : "a"} ${e}`;
|
|
505
543
|
}
|
|
506
|
-
function
|
|
507
|
-
const t = g(
|
|
508
|
-
if (!
|
|
509
|
-
const o =
|
|
544
|
+
function G(e, n) {
|
|
545
|
+
const t = g(I(e.parent_collection, n).singular), r = `${/^[aeiou]/i.test(t) ? "an" : "a"} ${t} record`;
|
|
546
|
+
if (!s(e.parent_id)) return r;
|
|
547
|
+
const o = Y(e.parent_collection, s(e.parent_id), n);
|
|
510
548
|
return !o || o === k ? r : o;
|
|
511
549
|
}
|
|
512
550
|
function E(e) {
|
|
513
|
-
const n =
|
|
514
|
-
return n ? `${e.noun} ${n}` :
|
|
551
|
+
const n = s(e.value);
|
|
552
|
+
return n ? `${e.noun} ${n}` : Q(e.noun);
|
|
515
553
|
}
|
|
516
|
-
function
|
|
517
|
-
const r =
|
|
554
|
+
function oe(e, n, t) {
|
|
555
|
+
const r = G(n, t);
|
|
518
556
|
return e === "create" ? `added ${E(n)} to ${r}` : e === "delete" ? `removed ${E(n)} from ${r}` : `updated ${E(n)} on ${r}`;
|
|
519
557
|
}
|
|
520
|
-
function
|
|
558
|
+
function xe(e, n) {
|
|
521
559
|
var l;
|
|
522
|
-
const t = e.map((
|
|
523
|
-
if (t.length === 0 || t.some((
|
|
524
|
-
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));
|
|
525
563
|
if (r.size > 1 || o.size > 1) return null;
|
|
526
|
-
const
|
|
527
|
-
for (const { e:
|
|
528
|
-
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);
|
|
529
567
|
v === "delete" ? _.removed.push(h) : v === "create" ? _.added.push(h) : _.updated.push(h), a.set($.noun, _);
|
|
530
568
|
}
|
|
531
|
-
const c = (
|
|
532
|
-
for (const [
|
|
569
|
+
const c = (p, $) => $ ? `${p} ${$}` : Q(p), u = [], d = [];
|
|
570
|
+
for (const [p, $] of a) {
|
|
533
571
|
if ($.removed.length === 1 && $.added.length === 1 && $.updated.length === 0) {
|
|
534
|
-
u.push({ noun:
|
|
572
|
+
u.push({ noun: p, from: $.removed[0], to: $.added[0] });
|
|
535
573
|
continue;
|
|
536
574
|
}
|
|
537
|
-
for (const _ of $.removed) d.push(`removed ${c(
|
|
538
|
-
for (const _ of $.added) d.push(`added ${c(
|
|
539
|
-
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, _)}`);
|
|
540
578
|
}
|
|
541
|
-
return { parent:
|
|
579
|
+
return { parent: G(i, n), pairs: u, rest: d };
|
|
542
580
|
}
|
|
543
|
-
function
|
|
581
|
+
function Ae(e) {
|
|
544
582
|
return e.from && e.to ? `${e.noun} ${e.from} → ${e.to}` : e.to ? `${e.noun} set to ${e.to}` : `changed ${e.noun}`;
|
|
545
583
|
}
|
|
546
|
-
function
|
|
547
|
-
const t =
|
|
584
|
+
function be(e, n) {
|
|
585
|
+
const t = xe(e, n);
|
|
548
586
|
if (!t) return null;
|
|
549
|
-
const { parent: r, pairs: o, rest:
|
|
550
|
-
if (
|
|
587
|
+
const { parent: r, pairs: o, rest: i } = t;
|
|
588
|
+
if (i.length === 0 && o.length === 1) {
|
|
551
589
|
const a = o[0];
|
|
552
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}`;
|
|
553
591
|
}
|
|
554
|
-
if (o.length === 0 &&
|
|
592
|
+
if (o.length === 0 && i.length === 1) {
|
|
555
593
|
const a = e[0];
|
|
556
|
-
return
|
|
594
|
+
return oe(s(a.action), S(a, n), n);
|
|
557
595
|
}
|
|
558
|
-
return `changed ${r}: ${[...o.map(
|
|
596
|
+
return `changed ${r}: ${[...o.map(Ae), ...i].join("; ")}`;
|
|
559
597
|
}
|
|
560
|
-
const
|
|
598
|
+
const H = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
|
|
561
599
|
function je(e) {
|
|
562
|
-
const n =
|
|
600
|
+
const n = s(e).toLowerCase();
|
|
563
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";
|
|
564
602
|
}
|
|
565
|
-
function
|
|
566
|
-
var $, _, h, v,
|
|
567
|
-
const t =
|
|
603
|
+
function Ie(e, n) {
|
|
604
|
+
var $, _, h, v, y;
|
|
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);
|
|
568
606
|
if (d && (t === "create" || t === "delete" || t === "update"))
|
|
569
|
-
return
|
|
607
|
+
return oe(t, d, n);
|
|
570
608
|
if ((($ = e.event) == null ? void 0 : $.kind) === "start") {
|
|
571
|
-
const
|
|
572
|
-
return `started ${o ?? "the pipeline"}${
|
|
609
|
+
const f = s(e.event.to_label);
|
|
610
|
+
return `started ${o ?? "the pipeline"}${f ? ` in ${f}` : ""}`;
|
|
573
611
|
}
|
|
574
|
-
if (((_ = e.event) == null ? void 0 : _.kind) === "transition" ||
|
|
575
|
-
const
|
|
576
|
-
from:
|
|
577
|
-
to:
|
|
578
|
-
via:
|
|
579
|
-
} : J(c), m = (h = e.event) != null && h.addendum ? `Addendum “${
|
|
580
|
-
return
|
|
612
|
+
if (((_ = e.event) == null ? void 0 : _.kind) === "transition" || H.has(t)) {
|
|
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}`;
|
|
581
619
|
}
|
|
582
620
|
switch (t) {
|
|
583
621
|
case "create":
|
|
@@ -587,16 +625,16 @@ function be(e, n) {
|
|
|
587
625
|
case "o2m-update": {
|
|
588
626
|
if (t === "o2m-update")
|
|
589
627
|
return e.o2m ? `${M(e.o2m)}${u}` : `changed related rows${u}`;
|
|
590
|
-
const
|
|
628
|
+
const f = K(e);
|
|
591
629
|
if (r === "nivaro_settings")
|
|
592
|
-
return
|
|
630
|
+
return f.length ? `changed the ${j(r, f, n)} setting${f.length === 1 ? "" : "s"}` : "changed the settings";
|
|
593
631
|
if (r === "nivaro_approval_instances" && ((v = e.why) != null && v.approval)) {
|
|
594
|
-
const m = e.why.approval, w =
|
|
595
|
-
return `${(
|
|
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})` : ""}`;
|
|
596
634
|
}
|
|
597
|
-
if (
|
|
598
|
-
const m = ((
|
|
599
|
-
return m && "value" in m &&
|
|
635
|
+
if (f.length) {
|
|
636
|
+
const m = ((y = e.changes) == null ? void 0 : y.length) === 1 ? e.changes[0] : null;
|
|
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}`;
|
|
600
638
|
}
|
|
601
639
|
return `updated ${o ?? a}`;
|
|
602
640
|
}
|
|
@@ -606,8 +644,8 @@ function be(e, n) {
|
|
|
606
644
|
case "restore":
|
|
607
645
|
return `restored ${o ?? a}`;
|
|
608
646
|
case "pipeline-start": {
|
|
609
|
-
const
|
|
610
|
-
return `started ${o ?? "the pipeline"}${
|
|
647
|
+
const f = /initial state:\s*(.+)$/i.exec(c);
|
|
648
|
+
return `started ${o ?? "the pipeline"}${f ? ` in ${f[1]}` : ""}`;
|
|
611
649
|
}
|
|
612
650
|
case "login":
|
|
613
651
|
return "signed in";
|
|
@@ -618,8 +656,8 @@ function be(e, n) {
|
|
|
618
656
|
case "sign-in-failed":
|
|
619
657
|
return o && o !== k ? `had a sign-in as ${o} fail` : "had a sign-in fail";
|
|
620
658
|
case "export": {
|
|
621
|
-
const
|
|
622
|
-
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}` : ""}`;
|
|
623
661
|
}
|
|
624
662
|
case "masquerade-start":
|
|
625
663
|
return `started viewing as ${A(e, n, c)}`;
|
|
@@ -641,36 +679,36 @@ function be(e, n) {
|
|
|
641
679
|
return `changed the role of ${A(e, n, "")}`;
|
|
642
680
|
case "bulk-write":
|
|
643
681
|
case "bulk-action-execute": {
|
|
644
|
-
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;
|
|
645
683
|
return w ? `ran “${w[1]}” on ${m}` : `changed ${m} in bulk`;
|
|
646
684
|
}
|
|
647
685
|
case "import-create":
|
|
648
686
|
case "import-queue":
|
|
649
|
-
return `started an import into ${g(
|
|
687
|
+
return `started an import into ${g(i.plural)}`;
|
|
650
688
|
case "import-complete":
|
|
651
|
-
return `finished an import into ${g(
|
|
689
|
+
return `finished an import into ${g(i.plural)}${c ? ` (${c})` : ""}`;
|
|
652
690
|
case "import-failed":
|
|
653
|
-
return `had an import into ${g(
|
|
691
|
+
return `had an import into ${g(i.plural)} fail`;
|
|
654
692
|
case "comment":
|
|
655
693
|
return `commented${u}`;
|
|
656
694
|
case "file-download": {
|
|
657
|
-
let
|
|
695
|
+
let f = "", m = !1;
|
|
658
696
|
try {
|
|
659
|
-
const
|
|
660
|
-
|
|
697
|
+
const D = JSON.parse(c);
|
|
698
|
+
f = typeof D.name == "string" ? D.name : "", m = D.kind === "open";
|
|
661
699
|
} catch {
|
|
662
700
|
}
|
|
663
|
-
const w =
|
|
701
|
+
const w = f ? `“${f}”` : "a file";
|
|
664
702
|
return `${m ? "opened" : "downloaded"} ${w}${r === "nivaro_files" ? "" : u}`;
|
|
665
703
|
}
|
|
666
704
|
case "split-out":
|
|
667
705
|
case "split-in": {
|
|
668
|
-
let
|
|
706
|
+
let f = 0;
|
|
669
707
|
try {
|
|
670
|
-
|
|
708
|
+
f = Number(JSON.parse(c).lines) || 0;
|
|
671
709
|
} catch {
|
|
672
710
|
}
|
|
673
|
-
const m =
|
|
711
|
+
const m = f > 0 ? `${f} ${f === 1 ? "line" : "lines"}` : "lines";
|
|
674
712
|
return t === "split-out" ? `moved ${m}${o ? ` of ${o}` : ""} to a new record` : `created ${o ?? a} from ${m} of another record`;
|
|
675
713
|
}
|
|
676
714
|
case "picker-exclude":
|
|
@@ -687,124 +725,124 @@ function be(e, n) {
|
|
|
687
725
|
return "downloaded a configuration snapshot";
|
|
688
726
|
}
|
|
689
727
|
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(
|
|
728
|
+
const l = re(t);
|
|
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}`;
|
|
692
730
|
}
|
|
693
731
|
function A(e, n, t) {
|
|
694
|
-
const r =
|
|
732
|
+
const r = s(e.item), o = P(r, n) ?? (t || null);
|
|
695
733
|
if (o) return o;
|
|
696
|
-
const
|
|
697
|
-
return
|
|
734
|
+
const i = e.collection === "nivaro_users" ? T(e.collection, e.item, n) : null;
|
|
735
|
+
return i && !U.test(r) ? i : "someone";
|
|
698
736
|
}
|
|
699
|
-
function
|
|
700
|
-
return `${
|
|
737
|
+
function Ne(e, n) {
|
|
738
|
+
return `${ee(e, n)} ${Ie(e, n)}`;
|
|
701
739
|
}
|
|
702
|
-
function
|
|
740
|
+
function qe(e) {
|
|
703
741
|
var c, u, d, l;
|
|
704
|
-
const n =
|
|
705
|
-
let r =
|
|
706
|
-
!o &&
|
|
707
|
-
const
|
|
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;
|
|
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);
|
|
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;
|
|
708
746
|
return { reason: r, note: o, approval: a };
|
|
709
747
|
}
|
|
710
|
-
const
|
|
711
|
-
function
|
|
748
|
+
const Ce = 6e4, Re = 5e3;
|
|
749
|
+
function C(e) {
|
|
712
750
|
return e.timestamp ? new Date(e.timestamp).getTime() : Number.NaN;
|
|
713
751
|
}
|
|
714
752
|
function R(e) {
|
|
715
|
-
const n =
|
|
716
|
-
return `${n.kind}|${
|
|
753
|
+
const n = Z(e);
|
|
754
|
+
return `${n.kind}|${s(n.id)}|${s(e.user ?? e.user_id).toUpperCase()}`;
|
|
717
755
|
}
|
|
718
|
-
function
|
|
719
|
-
const n =
|
|
720
|
-
return !
|
|
756
|
+
function Le(e) {
|
|
757
|
+
const n = s(e.action);
|
|
758
|
+
return !s(e.item) && (n.startsWith("bulk-") || n === "import-complete");
|
|
721
759
|
}
|
|
722
|
-
function
|
|
723
|
-
const t = n.windowMs ??
|
|
724
|
-
for (const
|
|
725
|
-
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);
|
|
726
764
|
if (a && c && n.labels) {
|
|
727
|
-
const d = S(
|
|
728
|
-
if (d && l && a.entries.every((
|
|
729
|
-
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");
|
|
730
768
|
continue;
|
|
731
769
|
}
|
|
732
770
|
}
|
|
733
771
|
if (a && c) {
|
|
734
|
-
const d =
|
|
772
|
+
const d = s(c.group_key);
|
|
735
773
|
if (u && u === d) {
|
|
736
|
-
a.entries.push(
|
|
774
|
+
a.entries.push(i), a.by = "group_key";
|
|
737
775
|
continue;
|
|
738
776
|
}
|
|
739
|
-
if (!u && !d && a.by !== "group_key" && i
|
|
740
|
-
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";
|
|
741
779
|
continue;
|
|
742
780
|
}
|
|
743
781
|
}
|
|
744
|
-
r.push({ key: `${u || "e"}:${
|
|
782
|
+
r.push({ key: `${u || "e"}:${i.id ?? r.length}`, entries: [i], by: null });
|
|
745
783
|
}
|
|
746
784
|
return r;
|
|
747
785
|
}
|
|
748
|
-
function
|
|
786
|
+
function Me(e, n) {
|
|
749
787
|
if (e.length === 0) return "";
|
|
750
|
-
const t = e.filter((v) => !
|
|
751
|
-
if (t.length <= 1) return
|
|
752
|
-
const o =
|
|
753
|
-
if (
|
|
754
|
-
const c = new Set(t.map((v) =>
|
|
755
|
-
t.map((v) =>
|
|
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))
|
|
756
794
|
);
|
|
757
795
|
if ($.size !== 1) return `${o} made ${t.length} changes to ${l}`;
|
|
758
796
|
const _ = [...$][0];
|
|
759
797
|
if (_ === "transition") {
|
|
760
798
|
const v = new Set(
|
|
761
|
-
t.map((
|
|
799
|
+
t.map((f) => {
|
|
762
800
|
var m;
|
|
763
|
-
return
|
|
801
|
+
return s(((m = f.event) == null ? void 0 : m.to_label) ?? J(f.comment).to);
|
|
764
802
|
})
|
|
765
|
-
),
|
|
766
|
-
return `${o} moved ${l}${
|
|
803
|
+
), y = v.size === 1 ? [...v][0] : "";
|
|
804
|
+
return `${o} moved ${l}${y ? ` to ${y}` : ""}${p}`;
|
|
767
805
|
}
|
|
768
806
|
if (_ === "update") {
|
|
769
|
-
const v =
|
|
770
|
-
return `${o} updated ${l}${
|
|
807
|
+
const v = Pe(t, c, n);
|
|
808
|
+
return `${o} updated ${l}${p}${v ? `: ${v}` : ""}`;
|
|
771
809
|
}
|
|
772
810
|
if (_ === "create") return `${o} created ${l}`;
|
|
773
811
|
if (_ === "delete") return `${o} deleted ${l}`;
|
|
774
|
-
if (_ === "picker-exclude") return `${o} hid ${l} from pickers${
|
|
775
|
-
if (_ === "picker-include") return `${o} showed ${l} in pickers again${
|
|
776
|
-
const h =
|
|
777
|
-
return h.past ? `${o} ${h.past} ${l}${h.noun && !g(
|
|
812
|
+
if (_ === "picker-exclude") return `${o} hid ${l} from pickers${p}`;
|
|
813
|
+
if (_ === "picker-include") return `${o} showed ${l} in pickers again${p}`;
|
|
814
|
+
const h = re(_);
|
|
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}`;
|
|
778
816
|
}
|
|
779
|
-
function
|
|
817
|
+
function Pe(e, n, t) {
|
|
780
818
|
var c;
|
|
781
819
|
const r = ((c = e[0]) == null ? void 0 : c.changes) ?? null;
|
|
782
820
|
if (!(r != null && r.length)) {
|
|
783
|
-
const u = e.map((d) =>
|
|
784
|
-
return u[0] && u.every((d) => d === u[0]) ?
|
|
821
|
+
const u = e.map((d) => K(d).sort().join(","));
|
|
822
|
+
return u[0] && u.every((d) => d === u[0]) ? j(n, u[0].split(","), t) : "";
|
|
785
823
|
}
|
|
786
824
|
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) =>
|
|
825
|
+
if (e.every((u) => o(u) === o(e[0])) && r.length <= 2 && r.every((u) => te(n, u.field, u.value, t)))
|
|
788
826
|
return r.map(
|
|
789
|
-
(u) => `${
|
|
827
|
+
(u) => `${B(n, u.field, t)} → ${ne(n, u.field, u.value, t)}`
|
|
790
828
|
).join(", ");
|
|
791
829
|
const a = new Set(e.flatMap((u) => (u.changes ?? []).map((d) => d.field)));
|
|
792
|
-
return
|
|
830
|
+
return j(n, [...a], t);
|
|
793
831
|
}
|
|
794
|
-
function
|
|
832
|
+
function Oe(e) {
|
|
795
833
|
var a;
|
|
796
|
-
const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(),
|
|
797
|
-
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);
|
|
798
836
|
!d || !l || (o.add(d), d === "nivaro_users" && t.add(l), n.set(`${d}:${l}`, { collection: d, id: l }));
|
|
799
837
|
};
|
|
800
838
|
for (const c of e) {
|
|
801
|
-
const u =
|
|
839
|
+
const u = s(c.user ?? c.user_id);
|
|
802
840
|
u && t.add(u);
|
|
803
|
-
const d =
|
|
804
|
-
d.kind === "view_as" && d.id && t.add(d.id), d.on_behalf_of && t.add(d.on_behalf_of),
|
|
805
|
-
for (const l of
|
|
806
|
-
const
|
|
807
|
-
|
|
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);
|
|
843
|
+
for (const l of K(c)) {
|
|
844
|
+
const p = s(c.collection);
|
|
845
|
+
p && r.set(`${p}.${l}`, { collection: p, field: l });
|
|
808
846
|
}
|
|
809
847
|
}
|
|
810
848
|
return {
|
|
@@ -815,34 +853,34 @@ function Pe(e) {
|
|
|
815
853
|
};
|
|
816
854
|
}
|
|
817
855
|
export {
|
|
818
|
-
|
|
856
|
+
Ce as BURST_WINDOW_MS,
|
|
819
857
|
k as HIDDEN_RECORD,
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
858
|
+
Re as LINK_WRITE_WINDOW_MS,
|
|
859
|
+
re as actionParts,
|
|
860
|
+
Oe as activityLabelRefs,
|
|
861
|
+
Ie as activityPredicate,
|
|
862
|
+
qe as activityWhy,
|
|
863
|
+
ee as actorName,
|
|
864
|
+
Z as actorOf,
|
|
865
|
+
me as choiceText,
|
|
866
|
+
I as collectionNouns,
|
|
829
867
|
L as countNoun,
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
868
|
+
B as fieldLabel,
|
|
869
|
+
j as fieldList,
|
|
870
|
+
De as groupActivity,
|
|
833
871
|
S as junctionOf,
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
872
|
+
xe as linkChanges,
|
|
873
|
+
be as linkGroupPredicate,
|
|
874
|
+
Ae as linkPairText,
|
|
837
875
|
M as o2mSentence,
|
|
838
|
-
|
|
839
|
-
|
|
876
|
+
Te as o2mTotalsText,
|
|
877
|
+
le as parseActor,
|
|
840
878
|
J as parseTransitionComment,
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
879
|
+
X as readableTitle,
|
|
880
|
+
T as recordPhrase,
|
|
881
|
+
Me as renderActivityGroupSentence,
|
|
882
|
+
Ne as renderActivitySentence,
|
|
845
883
|
je as transitionVerb,
|
|
846
|
-
|
|
847
|
-
|
|
884
|
+
te as valueShowable,
|
|
885
|
+
ne as valueText
|
|
848
886
|
};
|