@lumerahq/ui 0.11.3 → 0.12.0-dev.1
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/README.md +26 -0
- package/dist/{RecordSheet-SDw564xp.js → RecordSheet-gFscQDNL.js} +10408 -7405
- package/dist/{automations-DP-uLpqG.js → automations-EgDXJ43_.js} +2 -0
- package/dist/components/audit-log/AuditLog.d.ts +49 -0
- package/dist/components/audit-log/AuditLog.d.ts.map +1 -0
- package/dist/components/audit-log/AuditLogEntry.d.ts +17 -0
- package/dist/components/audit-log/AuditLogEntry.d.ts.map +1 -0
- package/dist/components/audit-log/index.d.ts +2 -0
- package/dist/components/audit-log/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +6 -5
- package/dist/{highlighted-body-OFNGDK62-7xB8r9be.js → highlighted-body-OFNGDK62-Dttr28i2.js} +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +5 -4
- package/dist/hooks/use-audit-log.d.ts +18 -0
- package/dist/hooks/use-audit-log.d.ts.map +1 -0
- package/dist/index.js +16 -14
- package/dist/lib/api.d.ts +7 -0
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/audit-log-core.d.ts +88 -0
- package/dist/lib/audit-log-core.d.ts.map +1 -0
- package/dist/lib/audit-log.d.ts +7 -0
- package/dist/lib/audit-log.d.ts.map +1 -0
- package/dist/lib/index.js +1 -1
- package/dist/mermaid-GHXKKRXX-BxahFUxz.js +4 -0
- package/dist/ui.css +136 -0
- package/dist/{use-automation-run-BLpS4iVw.js → use-automation-run-D2HediFL.js} +165 -3
- package/dist/{use-sql-table-E2BSyNpX.js → use-sql-table-DWHMqSIq.js} +1 -1
- package/package.json +1 -1
- package/dist/mermaid-GHXKKRXX-D3I6gc8h.js +0 -4
package/dist/ui.css
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
--tw-skew-x: initial;
|
|
12
12
|
--tw-skew-y: initial;
|
|
13
13
|
--tw-space-y-reverse: 0;
|
|
14
|
+
--tw-divide-y-reverse: 0;
|
|
14
15
|
--tw-border-style: solid;
|
|
15
16
|
--tw-gradient-position: initial;
|
|
16
17
|
--tw-gradient-from: #0000;
|
|
@@ -104,12 +105,14 @@
|
|
|
104
105
|
--color-amber-500: oklch(76.9% .188 70.08);
|
|
105
106
|
--color-amber-600: oklch(66.6% .179 58.318);
|
|
106
107
|
--color-amber-800: oklch(47.3% .137 46.201);
|
|
108
|
+
--color-amber-950: oklch(27.9% .077 45.635);
|
|
107
109
|
--color-green-600: oklch(62.7% .194 149.214);
|
|
108
110
|
--color-emerald-50: oklch(97.9% .021 166.113);
|
|
109
111
|
--color-emerald-200: oklch(90.5% .093 164.15);
|
|
110
112
|
--color-emerald-500: oklch(69.6% .17 162.48);
|
|
111
113
|
--color-emerald-600: oklch(59.6% .145 163.225);
|
|
112
114
|
--color-emerald-800: oklch(43.2% .095 166.913);
|
|
115
|
+
--color-sky-500: oklch(68.5% .169 237.323);
|
|
113
116
|
--color-blue-50: oklch(97% .014 254.604);
|
|
114
117
|
--color-blue-200: oklch(88.2% .059 254.128);
|
|
115
118
|
--color-blue-600: oklch(54.6% .245 262.881);
|
|
@@ -697,6 +700,10 @@
|
|
|
697
700
|
margin-bottom: calc(var(--spacing) * 4);
|
|
698
701
|
}
|
|
699
702
|
|
|
703
|
+
.mb-px {
|
|
704
|
+
margin-bottom: 1px;
|
|
705
|
+
}
|
|
706
|
+
|
|
700
707
|
.-ml-1 {
|
|
701
708
|
margin-left: calc(var(--spacing) * -1);
|
|
702
709
|
}
|
|
@@ -790,6 +797,11 @@
|
|
|
790
797
|
height: calc(var(--spacing) * 1.5);
|
|
791
798
|
}
|
|
792
799
|
|
|
800
|
+
.size-2 {
|
|
801
|
+
width: calc(var(--spacing) * 2);
|
|
802
|
+
height: calc(var(--spacing) * 2);
|
|
803
|
+
}
|
|
804
|
+
|
|
793
805
|
.size-2\.5 {
|
|
794
806
|
width: calc(var(--spacing) * 2.5);
|
|
795
807
|
height: calc(var(--spacing) * 2.5);
|
|
@@ -899,6 +911,10 @@
|
|
|
899
911
|
height: calc(var(--spacing) * 24);
|
|
900
912
|
}
|
|
901
913
|
|
|
914
|
+
.h-48 {
|
|
915
|
+
height: calc(var(--spacing) * 48);
|
|
916
|
+
}
|
|
917
|
+
|
|
902
918
|
.h-56 {
|
|
903
919
|
height: calc(var(--spacing) * 56);
|
|
904
920
|
}
|
|
@@ -975,6 +991,10 @@
|
|
|
975
991
|
min-height: calc(var(--spacing) * 0);
|
|
976
992
|
}
|
|
977
993
|
|
|
994
|
+
.min-h-7 {
|
|
995
|
+
min-height: calc(var(--spacing) * 7);
|
|
996
|
+
}
|
|
997
|
+
|
|
978
998
|
.min-h-9 {
|
|
979
999
|
min-height: calc(var(--spacing) * 9);
|
|
980
1000
|
}
|
|
@@ -1023,6 +1043,10 @@
|
|
|
1023
1043
|
width: calc(var(--spacing) * 2);
|
|
1024
1044
|
}
|
|
1025
1045
|
|
|
1046
|
+
.w-2\/3 {
|
|
1047
|
+
width: 66.6667%;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1026
1050
|
.w-3 {
|
|
1027
1051
|
width: calc(var(--spacing) * 3);
|
|
1028
1052
|
}
|
|
@@ -1043,6 +1067,30 @@
|
|
|
1043
1067
|
width: calc(var(--spacing) * 8);
|
|
1044
1068
|
}
|
|
1045
1069
|
|
|
1070
|
+
.w-12 {
|
|
1071
|
+
width: calc(var(--spacing) * 12);
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
.w-20 {
|
|
1075
|
+
width: calc(var(--spacing) * 20);
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
.w-24 {
|
|
1079
|
+
width: calc(var(--spacing) * 24);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
.w-28 {
|
|
1083
|
+
width: calc(var(--spacing) * 28);
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
.w-32 {
|
|
1087
|
+
width: calc(var(--spacing) * 32);
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
.w-48 {
|
|
1091
|
+
width: calc(var(--spacing) * 48);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1046
1094
|
.w-56 {
|
|
1047
1095
|
width: calc(var(--spacing) * 56);
|
|
1048
1096
|
}
|
|
@@ -1051,6 +1099,22 @@
|
|
|
1051
1099
|
width: calc(var(--spacing) * 60);
|
|
1052
1100
|
}
|
|
1053
1101
|
|
|
1102
|
+
.w-64 {
|
|
1103
|
+
width: calc(var(--spacing) * 64);
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
.w-\[8\.5rem\] {
|
|
1107
|
+
width: 8.5rem;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
.w-\[11rem\] {
|
|
1111
|
+
width: 11rem;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
.w-\[12rem\] {
|
|
1115
|
+
width: 12rem;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1054
1118
|
.w-\[70px\] {
|
|
1055
1119
|
width: 70px;
|
|
1056
1120
|
}
|
|
@@ -1095,6 +1159,10 @@
|
|
|
1095
1159
|
max-width: calc(var(--spacing) * 40);
|
|
1096
1160
|
}
|
|
1097
1161
|
|
|
1162
|
+
.max-w-48 {
|
|
1163
|
+
max-width: calc(var(--spacing) * 48);
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1098
1166
|
.max-w-\[82\%\] {
|
|
1099
1167
|
max-width: 82%;
|
|
1100
1168
|
}
|
|
@@ -1155,6 +1223,10 @@
|
|
|
1155
1223
|
min-width: calc(var(--spacing) * 48);
|
|
1156
1224
|
}
|
|
1157
1225
|
|
|
1226
|
+
.min-w-64 {
|
|
1227
|
+
min-width: calc(var(--spacing) * 64);
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1158
1230
|
.min-w-\[calc\(var\(--anchor-width\)\+--spacing\(7\)\)\] {
|
|
1159
1231
|
min-width: calc(var(--anchor-width) + calc(var(--spacing) * 7));
|
|
1160
1232
|
}
|
|
@@ -1208,6 +1280,10 @@
|
|
|
1208
1280
|
rotate: 45deg;
|
|
1209
1281
|
}
|
|
1210
1282
|
|
|
1283
|
+
.rotate-180 {
|
|
1284
|
+
rotate: 180deg;
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1211
1287
|
.transform {
|
|
1212
1288
|
transform: var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, );
|
|
1213
1289
|
}
|
|
@@ -1444,6 +1520,24 @@
|
|
|
1444
1520
|
margin-block-end: calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)));
|
|
1445
1521
|
}
|
|
1446
1522
|
|
|
1523
|
+
:where(.divide-y > :not(:last-child)) {
|
|
1524
|
+
--tw-divide-y-reverse: 0;
|
|
1525
|
+
border-bottom-style: var(--tw-border-style);
|
|
1526
|
+
border-top-style: var(--tw-border-style);
|
|
1527
|
+
border-top-width: calc(1px * var(--tw-divide-y-reverse));
|
|
1528
|
+
border-bottom-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
:where(.divide-border\/70 > :not(:last-child)) {
|
|
1532
|
+
border-color: var(--border);
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
1536
|
+
:where(.divide-border\/70 > :not(:last-child)) {
|
|
1537
|
+
border-color: color-mix(in oklab, var(--border) 70%, transparent);
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1447
1541
|
.self-start {
|
|
1448
1542
|
align-self: flex-start;
|
|
1449
1543
|
}
|
|
@@ -1726,6 +1820,10 @@
|
|
|
1726
1820
|
background-color: var(--color-emerald-50);
|
|
1727
1821
|
}
|
|
1728
1822
|
|
|
1823
|
+
.bg-emerald-500 {
|
|
1824
|
+
background-color: var(--color-emerald-500);
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1729
1827
|
.bg-emerald-500\/20 {
|
|
1730
1828
|
background-color: #00bb7f33;
|
|
1731
1829
|
}
|
|
@@ -1808,6 +1906,10 @@
|
|
|
1808
1906
|
background-color: var(--color-red-50);
|
|
1809
1907
|
}
|
|
1810
1908
|
|
|
1909
|
+
.bg-rose-500 {
|
|
1910
|
+
background-color: var(--color-rose-500);
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1811
1913
|
.bg-rose-500\/10 {
|
|
1812
1914
|
background-color: #ff23571a;
|
|
1813
1915
|
}
|
|
@@ -1830,6 +1932,10 @@
|
|
|
1830
1932
|
background-color: var(--sidebar-border);
|
|
1831
1933
|
}
|
|
1832
1934
|
|
|
1935
|
+
.bg-sky-500 {
|
|
1936
|
+
background-color: var(--color-sky-500);
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1833
1939
|
.bg-slate-500\/20 {
|
|
1834
1940
|
background-color: #62748e33;
|
|
1835
1941
|
}
|
|
@@ -1907,6 +2013,10 @@
|
|
|
1907
2013
|
padding: calc(var(--spacing) * 4);
|
|
1908
2014
|
}
|
|
1909
2015
|
|
|
2016
|
+
.p-5 {
|
|
2017
|
+
padding: calc(var(--spacing) * 5);
|
|
2018
|
+
}
|
|
2019
|
+
|
|
1910
2020
|
.p-6 {
|
|
1911
2021
|
padding: calc(var(--spacing) * 6);
|
|
1912
2022
|
}
|
|
@@ -1943,6 +2053,10 @@
|
|
|
1943
2053
|
padding-inline: calc(var(--spacing) * 4);
|
|
1944
2054
|
}
|
|
1945
2055
|
|
|
2056
|
+
.px-5 {
|
|
2057
|
+
padding-inline: calc(var(--spacing) * 5);
|
|
2058
|
+
}
|
|
2059
|
+
|
|
1946
2060
|
.px-6 {
|
|
1947
2061
|
padding-inline: calc(var(--spacing) * 6);
|
|
1948
2062
|
}
|
|
@@ -2159,6 +2273,10 @@
|
|
|
2159
2273
|
overflow-wrap: break-word;
|
|
2160
2274
|
}
|
|
2161
2275
|
|
|
2276
|
+
.whitespace-normal {
|
|
2277
|
+
white-space: normal;
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2162
2280
|
.whitespace-nowrap {
|
|
2163
2281
|
white-space: nowrap;
|
|
2164
2282
|
}
|
|
@@ -2175,6 +2293,10 @@
|
|
|
2175
2293
|
color: var(--color-amber-800);
|
|
2176
2294
|
}
|
|
2177
2295
|
|
|
2296
|
+
.text-amber-950 {
|
|
2297
|
+
color: var(--color-amber-950);
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2178
2300
|
.text-background {
|
|
2179
2301
|
color: var(--background);
|
|
2180
2302
|
}
|
|
@@ -3897,6 +4019,10 @@
|
|
|
3897
4019
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
3898
4020
|
}
|
|
3899
4021
|
|
|
4022
|
+
.sm\:grid-cols-\[9rem_1fr\] {
|
|
4023
|
+
grid-template-columns: 9rem 1fr;
|
|
4024
|
+
}
|
|
4025
|
+
|
|
3900
4026
|
.sm\:flex-row {
|
|
3901
4027
|
flex-direction: row;
|
|
3902
4028
|
}
|
|
@@ -3905,6 +4031,10 @@
|
|
|
3905
4031
|
justify-content: flex-end;
|
|
3906
4032
|
}
|
|
3907
4033
|
|
|
4034
|
+
.sm\:gap-4 {
|
|
4035
|
+
gap: calc(var(--spacing) * 4);
|
|
4036
|
+
}
|
|
4037
|
+
|
|
3908
4038
|
.sm\:gap-12 {
|
|
3909
4039
|
gap: calc(var(--spacing) * 12);
|
|
3910
4040
|
}
|
|
@@ -4986,6 +5116,12 @@
|
|
|
4986
5116
|
initial-value: 0;
|
|
4987
5117
|
}
|
|
4988
5118
|
|
|
5119
|
+
@property --tw-divide-y-reverse {
|
|
5120
|
+
syntax: "*";
|
|
5121
|
+
inherits: false;
|
|
5122
|
+
initial-value: 0;
|
|
5123
|
+
}
|
|
5124
|
+
|
|
4989
5125
|
@property --tw-border-style {
|
|
4990
5126
|
syntax: "*";
|
|
4991
5127
|
inherits: false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState, useRef, useCallback, useMemo } from "react";
|
|
2
|
-
import { useQueryClient, useMutation, useQuery } from "@tanstack/react-query";
|
|
3
|
-
import { H as ensureAutomationRun, F as createAutomationRun, A as cancelAutomationRun, z as automationStatuses, K as getAutomationRun } from "./automations-
|
|
2
|
+
import { useInfiniteQuery, useQueryClient, useMutation, useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { X as requestApi, H as ensureAutomationRun, F as createAutomationRun, A as cancelAutomationRun, z as automationStatuses, K as getAutomationRun } from "./automations-EgDXJ43_.js";
|
|
4
4
|
const QUEUED_DISCOVERY_POLL_MS = 2e3;
|
|
5
5
|
const IDLE_DISCOVERY_POLL_MS = 1e4;
|
|
6
6
|
const HIDDEN_DISCOVERY_POLL_MS = 3e4;
|
|
@@ -954,6 +954,159 @@ function replaceSession(sessions, next) {
|
|
|
954
954
|
});
|
|
955
955
|
return found ? updated : [next, ...updated];
|
|
956
956
|
}
|
|
957
|
+
const AUDIT_LOG_EXPORT_LIMIT = 1e4;
|
|
958
|
+
const AUDIT_LOG_MAX_COLLECTIONS = 20;
|
|
959
|
+
const normalizeAuditLogPageSize = (value = 50) => Math.min(200, Math.max(1, Math.trunc(value) || 50));
|
|
960
|
+
const normalizeAuditLogExportLimit = (value = AUDIT_LOG_EXPORT_LIMIT) => Math.min(AUDIT_LOG_EXPORT_LIMIT, Math.max(1, Math.trunc(value) || AUDIT_LOG_EXPORT_LIMIT));
|
|
961
|
+
const auditLogActorLabel = (actor) => actor.name?.trim() || actor.email?.trim() || actor.type_label;
|
|
962
|
+
function normalizeRecordAuditCollections(collections) {
|
|
963
|
+
const normalized = [];
|
|
964
|
+
const seen = /* @__PURE__ */ new Set();
|
|
965
|
+
for (const value of collections) {
|
|
966
|
+
const collection = value.trim();
|
|
967
|
+
if (!collection || seen.has(collection)) continue;
|
|
968
|
+
seen.add(collection);
|
|
969
|
+
normalized.push(collection);
|
|
970
|
+
}
|
|
971
|
+
return normalized;
|
|
972
|
+
}
|
|
973
|
+
function normalizeAuditLogFilterState(collections, filters = {}) {
|
|
974
|
+
const available = normalizeRecordAuditCollections(collections);
|
|
975
|
+
const allowed = new Set(available);
|
|
976
|
+
const selected = normalizeRecordAuditCollections(filters.collections ?? available).filter(
|
|
977
|
+
(name) => allowed.has(name)
|
|
978
|
+
);
|
|
979
|
+
return {
|
|
980
|
+
collections: selected.length > 0 ? selected : available,
|
|
981
|
+
event: filters.event,
|
|
982
|
+
actor: filters.actor?.trim() || void 0,
|
|
983
|
+
since: filters.since?.trim() || void 0,
|
|
984
|
+
until: filters.until?.trim() || void 0
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
function buildRecordAuditLogPath(params) {
|
|
988
|
+
const collections = normalizeRecordAuditCollections(params.collections);
|
|
989
|
+
if (collections.length === 0) {
|
|
990
|
+
throw new Error("At least one collection is required");
|
|
991
|
+
}
|
|
992
|
+
if (collections.length > AUDIT_LOG_MAX_COLLECTIONS) {
|
|
993
|
+
throw new Error(`At most ${AUDIT_LOG_MAX_COLLECTIONS} collections can be requested`);
|
|
994
|
+
}
|
|
995
|
+
const query = new URLSearchParams({
|
|
996
|
+
domain: "record",
|
|
997
|
+
limit: String(normalizeAuditLogPageSize(params.limit))
|
|
998
|
+
});
|
|
999
|
+
for (const collection of collections) query.append("collection", collection);
|
|
1000
|
+
if (params.cursor?.trim()) query.set("cursor", params.cursor.trim());
|
|
1001
|
+
if (params.event) query.set("event", params.event);
|
|
1002
|
+
if (params.actor?.trim()) query.set("actor", params.actor.trim());
|
|
1003
|
+
if (params.since?.trim()) query.set("since", params.since.trim());
|
|
1004
|
+
if (params.until?.trim()) query.set("until", params.until.trim());
|
|
1005
|
+
return `/audit-log?${query.toString()}`;
|
|
1006
|
+
}
|
|
1007
|
+
const summaryText = (entry) => entry.summary.map((segment) => segment.text).join(" ");
|
|
1008
|
+
const auditLogDetailValue = (entry, label) => entry.details.find((field) => field.label === label)?.value ?? "";
|
|
1009
|
+
const protectSpreadsheetCell = (value) => /^[\t\r ]*[=+\-@]/.test(value) ? `'${value}` : value;
|
|
1010
|
+
const csvCell = (value) => `"${protectSpreadsheetCell(value).replaceAll('"', '""')}"`;
|
|
1011
|
+
function buildAuditLogCsv(entries) {
|
|
1012
|
+
const rows = entries.map(
|
|
1013
|
+
(entry) => [
|
|
1014
|
+
entry.occurred_at,
|
|
1015
|
+
auditLogDetailValue(entry, "Collection"),
|
|
1016
|
+
auditLogActorLabel(entry.actor),
|
|
1017
|
+
entry.actor.type,
|
|
1018
|
+
entry.event,
|
|
1019
|
+
auditLogDetailValue(entry, "Record ID"),
|
|
1020
|
+
summaryText(entry)
|
|
1021
|
+
].map(csvCell).join(",")
|
|
1022
|
+
);
|
|
1023
|
+
return [
|
|
1024
|
+
["time", "collection", "actor", "actor_type", "event", "record_id", "summary"].map(csvCell).join(","),
|
|
1025
|
+
...rows
|
|
1026
|
+
].join("\n");
|
|
1027
|
+
}
|
|
1028
|
+
async function listRecordAuditLog(params) {
|
|
1029
|
+
return requestApi(buildRecordAuditLogPath(params), { method: "GET" });
|
|
1030
|
+
}
|
|
1031
|
+
async function getRecordAuditLogSnapshot(id, store) {
|
|
1032
|
+
const normalizedID = id.trim();
|
|
1033
|
+
if (!normalizedID) {
|
|
1034
|
+
throw new Error("Audit log ID is required");
|
|
1035
|
+
}
|
|
1036
|
+
return requestApi(
|
|
1037
|
+
`/audit-log/${encodeURIComponent(normalizedID)}/snapshot?store=${encodeURIComponent(store)}`,
|
|
1038
|
+
{ method: "GET" }
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
async function fetchRecordAuditLogCsv(params, maxRows = AUDIT_LOG_EXPORT_LIMIT) {
|
|
1042
|
+
const limit = normalizeAuditLogExportLimit(maxRows);
|
|
1043
|
+
const entries = [];
|
|
1044
|
+
let cursor = "";
|
|
1045
|
+
let truncated = false;
|
|
1046
|
+
while (entries.length < limit) {
|
|
1047
|
+
const page = await listRecordAuditLog({
|
|
1048
|
+
...params,
|
|
1049
|
+
cursor: cursor || void 0,
|
|
1050
|
+
limit: Math.min(200, limit - entries.length)
|
|
1051
|
+
});
|
|
1052
|
+
entries.push(...page.audit_logs.slice(0, limit - entries.length));
|
|
1053
|
+
if (!page.pagination.has_more) break;
|
|
1054
|
+
const nextCursor = page.pagination.next_cursor?.trim();
|
|
1055
|
+
if (!nextCursor || nextCursor === cursor) {
|
|
1056
|
+
throw new Error("Audit log export could not continue");
|
|
1057
|
+
}
|
|
1058
|
+
if (entries.length >= limit) {
|
|
1059
|
+
truncated = true;
|
|
1060
|
+
break;
|
|
1061
|
+
}
|
|
1062
|
+
cursor = nextCursor;
|
|
1063
|
+
}
|
|
1064
|
+
return { csv: buildAuditLogCsv(entries), count: entries.length, truncated };
|
|
1065
|
+
}
|
|
1066
|
+
function useAuditLog(collections, filters = {}, options = {}) {
|
|
1067
|
+
const normalizedCollections = normalizeRecordAuditCollections(collections);
|
|
1068
|
+
const pageSize = normalizeAuditLogPageSize(options.pageSize);
|
|
1069
|
+
const normalizedFilters = useMemo(
|
|
1070
|
+
() => ({
|
|
1071
|
+
event: filters.event,
|
|
1072
|
+
actor: filters.actor?.trim() || void 0,
|
|
1073
|
+
since: filters.since?.trim() || void 0,
|
|
1074
|
+
until: filters.until?.trim() || void 0
|
|
1075
|
+
}),
|
|
1076
|
+
[filters.actor, filters.event, filters.since, filters.until]
|
|
1077
|
+
);
|
|
1078
|
+
const query = useInfiniteQuery({
|
|
1079
|
+
queryKey: ["audit-log", normalizedCollections, normalizedFilters, pageSize],
|
|
1080
|
+
queryFn: ({ pageParam }) => listRecordAuditLog({
|
|
1081
|
+
collections: normalizedCollections,
|
|
1082
|
+
...normalizedFilters,
|
|
1083
|
+
cursor: typeof pageParam === "string" && pageParam ? pageParam : void 0,
|
|
1084
|
+
limit: pageSize
|
|
1085
|
+
}),
|
|
1086
|
+
initialPageParam: "",
|
|
1087
|
+
getNextPageParam: (lastPage) => lastPage.pagination.has_more ? lastPage.pagination.next_cursor || void 0 : void 0,
|
|
1088
|
+
enabled: (options.enabled ?? true) && normalizedCollections.length > 0,
|
|
1089
|
+
retry: (failureCount, error) => {
|
|
1090
|
+
const status = error.status;
|
|
1091
|
+
return !status || status >= 500 ? failureCount < 2 : false;
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
return {
|
|
1095
|
+
entries: query.data?.pages.flatMap((page) => page.audit_logs) ?? [],
|
|
1096
|
+
collectionStatus: query.data?.pages[0]?.record_collections ?? [],
|
|
1097
|
+
error: query.error,
|
|
1098
|
+
isLoading: query.isLoading,
|
|
1099
|
+
isFetching: query.isFetching,
|
|
1100
|
+
isLoadingMore: query.isFetchingNextPage,
|
|
1101
|
+
hasMore: Boolean(query.hasNextPage),
|
|
1102
|
+
loadMore: async () => {
|
|
1103
|
+
await query.fetchNextPage();
|
|
1104
|
+
},
|
|
1105
|
+
refresh: async () => {
|
|
1106
|
+
await query.refetch();
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
957
1110
|
function useAutomationRun(options) {
|
|
958
1111
|
const {
|
|
959
1112
|
agentId,
|
|
@@ -1083,7 +1236,16 @@ function useAutomationRun(options) {
|
|
|
1083
1236
|
};
|
|
1084
1237
|
}
|
|
1085
1238
|
export {
|
|
1239
|
+
AUDIT_LOG_MAX_COLLECTIONS as A,
|
|
1086
1240
|
useAgentChatSessions as a,
|
|
1087
|
-
|
|
1241
|
+
useAuditLog as b,
|
|
1242
|
+
useAutomationRun as c,
|
|
1243
|
+
auditLogDetailValue as d,
|
|
1244
|
+
auditLogActorLabel as e,
|
|
1245
|
+
normalizeAuditLogFilterState as f,
|
|
1246
|
+
getRecordAuditLogSnapshot as g,
|
|
1247
|
+
fetchRecordAuditLogCsv as h,
|
|
1248
|
+
normalizeAuditLogExportLimit as i,
|
|
1249
|
+
normalizeRecordAuditCollections as n,
|
|
1088
1250
|
useAgentChat as u
|
|
1089
1251
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query";
|
|
2
2
|
import { useState, useCallback, useEffect, useMemo } from "react";
|
|
3
|
-
import { T as listRunsByAgent, z as automationStatuses, F as createAutomationRun, y as uploadFile, o as onInitMessage, t as pbSql, v as pbUpdateRecord } from "./automations-
|
|
3
|
+
import { T as listRunsByAgent, z as automationStatuses, F as createAutomationRun, y as uploadFile, o as onInitMessage, t as pbSql, v as pbUpdateRecord } from "./automations-EgDXJ43_.js";
|
|
4
4
|
function useAutomationAgent({
|
|
5
5
|
agentId,
|
|
6
6
|
limit = 5,
|
package/package.json
CHANGED