@lumerahq/ui 0.11.2 → 0.12.0-dev.0

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.
Files changed (31) hide show
  1. package/dist/{RecordSheet-CTmyahrD.js → RecordSheet-DJoKhb3u.js} +9509 -6680
  2. package/dist/{automations-CmEr75-t.js → automations-EgDXJ43_.js} +4 -1
  3. package/dist/components/audit-log/AuditLog.d.ts +12 -0
  4. package/dist/components/audit-log/AuditLog.d.ts.map +1 -0
  5. package/dist/components/audit-log/AuditLogEntry.d.ts +5 -0
  6. package/dist/components/audit-log/AuditLogEntry.d.ts.map +1 -0
  7. package/dist/components/audit-log/index.d.ts +2 -0
  8. package/dist/components/audit-log/index.d.ts.map +1 -0
  9. package/dist/components/index.d.ts +1 -0
  10. package/dist/components/index.d.ts.map +1 -1
  11. package/dist/components/index.js +6 -5
  12. package/dist/{highlighted-body-OFNGDK62-CZTacEfs.js → highlighted-body-OFNGDK62-DD5EYZQR.js} +1 -1
  13. package/dist/hooks/index.d.ts +1 -0
  14. package/dist/hooks/index.d.ts.map +1 -1
  15. package/dist/hooks/index.js +5 -4
  16. package/dist/hooks/use-audit-log.d.ts +17 -0
  17. package/dist/hooks/use-audit-log.d.ts.map +1 -0
  18. package/dist/index.js +16 -14
  19. package/dist/lib/api.d.ts +10 -1
  20. package/dist/lib/api.d.ts.map +1 -1
  21. package/dist/lib/audit-log-core.d.ts +77 -0
  22. package/dist/lib/audit-log-core.d.ts.map +1 -0
  23. package/dist/lib/audit-log.d.ts +7 -0
  24. package/dist/lib/audit-log.d.ts.map +1 -0
  25. package/dist/lib/index.js +1 -1
  26. package/dist/mermaid-GHXKKRXX-BdrbO7XD.js +4 -0
  27. package/dist/ui.css +131 -0
  28. package/dist/{use-automation-run-Bxv8oQhP.js → use-automation-run-BrghacFY.js} +148 -3
  29. package/dist/{use-sql-table-D30SaDrm.js → use-sql-table-DWHMqSIq.js} +1 -1
  30. package/package.json +1 -1
  31. package/dist/mermaid-GHXKKRXX-C5AtWA-7.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;
@@ -110,6 +111,7 @@
110
111
  --color-emerald-500: oklch(69.6% .17 162.48);
111
112
  --color-emerald-600: oklch(59.6% .145 163.225);
112
113
  --color-emerald-800: oklch(43.2% .095 166.913);
114
+ --color-sky-500: oklch(68.5% .169 237.323);
113
115
  --color-blue-50: oklch(97% .014 254.604);
114
116
  --color-blue-200: oklch(88.2% .059 254.128);
115
117
  --color-blue-600: oklch(54.6% .245 262.881);
@@ -697,6 +699,10 @@
697
699
  margin-bottom: calc(var(--spacing) * 4);
698
700
  }
699
701
 
702
+ .mb-px {
703
+ margin-bottom: 1px;
704
+ }
705
+
700
706
  .-ml-1 {
701
707
  margin-left: calc(var(--spacing) * -1);
702
708
  }
@@ -790,6 +796,11 @@
790
796
  height: calc(var(--spacing) * 1.5);
791
797
  }
792
798
 
799
+ .size-2 {
800
+ width: calc(var(--spacing) * 2);
801
+ height: calc(var(--spacing) * 2);
802
+ }
803
+
793
804
  .size-2\.5 {
794
805
  width: calc(var(--spacing) * 2.5);
795
806
  height: calc(var(--spacing) * 2.5);
@@ -899,6 +910,10 @@
899
910
  height: calc(var(--spacing) * 24);
900
911
  }
901
912
 
913
+ .h-48 {
914
+ height: calc(var(--spacing) * 48);
915
+ }
916
+
902
917
  .h-56 {
903
918
  height: calc(var(--spacing) * 56);
904
919
  }
@@ -975,6 +990,10 @@
975
990
  min-height: calc(var(--spacing) * 0);
976
991
  }
977
992
 
993
+ .min-h-7 {
994
+ min-height: calc(var(--spacing) * 7);
995
+ }
996
+
978
997
  .min-h-9 {
979
998
  min-height: calc(var(--spacing) * 9);
980
999
  }
@@ -1023,6 +1042,10 @@
1023
1042
  width: calc(var(--spacing) * 2);
1024
1043
  }
1025
1044
 
1045
+ .w-2\/3 {
1046
+ width: 66.6667%;
1047
+ }
1048
+
1026
1049
  .w-3 {
1027
1050
  width: calc(var(--spacing) * 3);
1028
1051
  }
@@ -1043,6 +1066,30 @@
1043
1066
  width: calc(var(--spacing) * 8);
1044
1067
  }
1045
1068
 
1069
+ .w-12 {
1070
+ width: calc(var(--spacing) * 12);
1071
+ }
1072
+
1073
+ .w-20 {
1074
+ width: calc(var(--spacing) * 20);
1075
+ }
1076
+
1077
+ .w-24 {
1078
+ width: calc(var(--spacing) * 24);
1079
+ }
1080
+
1081
+ .w-28 {
1082
+ width: calc(var(--spacing) * 28);
1083
+ }
1084
+
1085
+ .w-32 {
1086
+ width: calc(var(--spacing) * 32);
1087
+ }
1088
+
1089
+ .w-48 {
1090
+ width: calc(var(--spacing) * 48);
1091
+ }
1092
+
1046
1093
  .w-56 {
1047
1094
  width: calc(var(--spacing) * 56);
1048
1095
  }
@@ -1051,6 +1098,26 @@
1051
1098
  width: calc(var(--spacing) * 60);
1052
1099
  }
1053
1100
 
1101
+ .w-64 {
1102
+ width: calc(var(--spacing) * 64);
1103
+ }
1104
+
1105
+ .w-\[8\.5rem\] {
1106
+ width: 8.5rem;
1107
+ }
1108
+
1109
+ .w-\[10\.5rem\] {
1110
+ width: 10.5rem;
1111
+ }
1112
+
1113
+ .w-\[11rem\] {
1114
+ width: 11rem;
1115
+ }
1116
+
1117
+ .w-\[12rem\] {
1118
+ width: 12rem;
1119
+ }
1120
+
1054
1121
  .w-\[70px\] {
1055
1122
  width: 70px;
1056
1123
  }
@@ -1095,6 +1162,10 @@
1095
1162
  max-width: calc(var(--spacing) * 40);
1096
1163
  }
1097
1164
 
1165
+ .max-w-48 {
1166
+ max-width: calc(var(--spacing) * 48);
1167
+ }
1168
+
1098
1169
  .max-w-\[82\%\] {
1099
1170
  max-width: 82%;
1100
1171
  }
@@ -1155,6 +1226,10 @@
1155
1226
  min-width: calc(var(--spacing) * 48);
1156
1227
  }
1157
1228
 
1229
+ .min-w-64 {
1230
+ min-width: calc(var(--spacing) * 64);
1231
+ }
1232
+
1158
1233
  .min-w-\[calc\(var\(--anchor-width\)\+--spacing\(7\)\)\] {
1159
1234
  min-width: calc(var(--anchor-width) + calc(var(--spacing) * 7));
1160
1235
  }
@@ -1208,6 +1283,10 @@
1208
1283
  rotate: 45deg;
1209
1284
  }
1210
1285
 
1286
+ .rotate-180 {
1287
+ rotate: 180deg;
1288
+ }
1289
+
1211
1290
  .transform {
1212
1291
  transform: var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, );
1213
1292
  }
@@ -1444,6 +1523,24 @@
1444
1523
  margin-block-end: calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)));
1445
1524
  }
1446
1525
 
1526
+ :where(.divide-y > :not(:last-child)) {
1527
+ --tw-divide-y-reverse: 0;
1528
+ border-bottom-style: var(--tw-border-style);
1529
+ border-top-style: var(--tw-border-style);
1530
+ border-top-width: calc(1px * var(--tw-divide-y-reverse));
1531
+ border-bottom-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
1532
+ }
1533
+
1534
+ :where(.divide-border\/70 > :not(:last-child)) {
1535
+ border-color: var(--border);
1536
+ }
1537
+
1538
+ @supports (color: color-mix(in lab, red, red)) {
1539
+ :where(.divide-border\/70 > :not(:last-child)) {
1540
+ border-color: color-mix(in oklab, var(--border) 70%, transparent);
1541
+ }
1542
+ }
1543
+
1447
1544
  .self-start {
1448
1545
  align-self: flex-start;
1449
1546
  }
@@ -1726,6 +1823,10 @@
1726
1823
  background-color: var(--color-emerald-50);
1727
1824
  }
1728
1825
 
1826
+ .bg-emerald-500 {
1827
+ background-color: var(--color-emerald-500);
1828
+ }
1829
+
1729
1830
  .bg-emerald-500\/20 {
1730
1831
  background-color: #00bb7f33;
1731
1832
  }
@@ -1808,6 +1909,10 @@
1808
1909
  background-color: var(--color-red-50);
1809
1910
  }
1810
1911
 
1912
+ .bg-rose-500 {
1913
+ background-color: var(--color-rose-500);
1914
+ }
1915
+
1811
1916
  .bg-rose-500\/10 {
1812
1917
  background-color: #ff23571a;
1813
1918
  }
@@ -1830,6 +1935,10 @@
1830
1935
  background-color: var(--sidebar-border);
1831
1936
  }
1832
1937
 
1938
+ .bg-sky-500 {
1939
+ background-color: var(--color-sky-500);
1940
+ }
1941
+
1833
1942
  .bg-slate-500\/20 {
1834
1943
  background-color: #62748e33;
1835
1944
  }
@@ -1943,6 +2052,10 @@
1943
2052
  padding-inline: calc(var(--spacing) * 4);
1944
2053
  }
1945
2054
 
2055
+ .px-5 {
2056
+ padding-inline: calc(var(--spacing) * 5);
2057
+ }
2058
+
1946
2059
  .px-6 {
1947
2060
  padding-inline: calc(var(--spacing) * 6);
1948
2061
  }
@@ -2159,6 +2272,10 @@
2159
2272
  overflow-wrap: break-word;
2160
2273
  }
2161
2274
 
2275
+ .whitespace-normal {
2276
+ white-space: normal;
2277
+ }
2278
+
2162
2279
  .whitespace-nowrap {
2163
2280
  white-space: nowrap;
2164
2281
  }
@@ -3897,6 +4014,10 @@
3897
4014
  grid-template-columns: repeat(2, minmax(0, 1fr));
3898
4015
  }
3899
4016
 
4017
+ .sm\:grid-cols-\[9rem_1fr\] {
4018
+ grid-template-columns: 9rem 1fr;
4019
+ }
4020
+
3900
4021
  .sm\:flex-row {
3901
4022
  flex-direction: row;
3902
4023
  }
@@ -3905,6 +4026,10 @@
3905
4026
  justify-content: flex-end;
3906
4027
  }
3907
4028
 
4029
+ .sm\:gap-4 {
4030
+ gap: calc(var(--spacing) * 4);
4031
+ }
4032
+
3908
4033
  .sm\:gap-12 {
3909
4034
  gap: calc(var(--spacing) * 12);
3910
4035
  }
@@ -4986,6 +5111,12 @@
4986
5111
  initial-value: 0;
4987
5112
  }
4988
5113
 
5114
+ @property --tw-divide-y-reverse {
5115
+ syntax: "*";
5116
+ inherits: false;
5117
+ initial-value: 0;
5118
+ }
5119
+
4989
5120
  @property --tw-border-style {
4990
5121
  syntax: "*";
4991
5122
  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-CmEr75-t.js";
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,143 @@ 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 auditLogActorLabel = (actor) => actor.name?.trim() || actor.email?.trim() || actor.type_label;
961
+ function normalizeRecordAuditCollections(collections) {
962
+ const normalized = [];
963
+ const seen = /* @__PURE__ */ new Set();
964
+ for (const value of collections) {
965
+ const collection = value.trim();
966
+ if (!collection || seen.has(collection)) continue;
967
+ seen.add(collection);
968
+ normalized.push(collection);
969
+ }
970
+ return normalized;
971
+ }
972
+ function buildRecordAuditLogPath(params) {
973
+ const collections = normalizeRecordAuditCollections(params.collections);
974
+ if (collections.length === 0) {
975
+ throw new Error("At least one collection is required");
976
+ }
977
+ if (collections.length > AUDIT_LOG_MAX_COLLECTIONS) {
978
+ throw new Error(`At most ${AUDIT_LOG_MAX_COLLECTIONS} collections can be requested`);
979
+ }
980
+ const query = new URLSearchParams({
981
+ domain: "record",
982
+ limit: String(normalizeAuditLogPageSize(params.limit))
983
+ });
984
+ for (const collection of collections) query.append("collection", collection);
985
+ if (params.cursor?.trim()) query.set("cursor", params.cursor.trim());
986
+ if (params.event) query.set("event", params.event);
987
+ if (params.actor?.trim()) query.set("actor", params.actor.trim());
988
+ if (params.since?.trim()) query.set("since", params.since.trim());
989
+ if (params.until?.trim()) query.set("until", params.until.trim());
990
+ return `/audit-log?${query.toString()}`;
991
+ }
992
+ const summaryText = (entry) => entry.summary.map((segment) => segment.text).join(" ");
993
+ const auditLogDetailValue = (entry, label) => entry.details.find((field) => field.label === label)?.value ?? "";
994
+ const protectSpreadsheetCell = (value) => /^[\t\r ]*[=+\-@]/.test(value) ? `'${value}` : value;
995
+ const csvCell = (value) => `"${protectSpreadsheetCell(value).replaceAll('"', '""')}"`;
996
+ function buildAuditLogCsv(entries) {
997
+ const rows = entries.map(
998
+ (entry) => [
999
+ entry.occurred_at,
1000
+ auditLogDetailValue(entry, "Collection"),
1001
+ auditLogActorLabel(entry.actor),
1002
+ entry.actor.type,
1003
+ entry.event,
1004
+ auditLogDetailValue(entry, "Record ID"),
1005
+ summaryText(entry)
1006
+ ].map(csvCell).join(",")
1007
+ );
1008
+ return [
1009
+ ["time", "collection", "actor", "actor_type", "event", "record_id", "summary"].map(csvCell).join(","),
1010
+ ...rows
1011
+ ].join("\n");
1012
+ }
1013
+ async function listRecordAuditLog(params) {
1014
+ return requestApi(buildRecordAuditLogPath(params), { method: "GET" });
1015
+ }
1016
+ async function getRecordAuditLogSnapshot(id, store) {
1017
+ const normalizedID = id.trim();
1018
+ if (!normalizedID) {
1019
+ throw new Error("Audit log ID is required");
1020
+ }
1021
+ return requestApi(
1022
+ `/audit-log/${encodeURIComponent(normalizedID)}/snapshot?store=${encodeURIComponent(store)}`,
1023
+ { method: "GET" }
1024
+ );
1025
+ }
1026
+ async function fetchRecordAuditLogCsv(params, maxRows = AUDIT_LOG_EXPORT_LIMIT) {
1027
+ const limit = Math.min(AUDIT_LOG_EXPORT_LIMIT, Math.max(1, Math.trunc(maxRows) || AUDIT_LOG_EXPORT_LIMIT));
1028
+ const entries = [];
1029
+ let cursor = "";
1030
+ let truncated = false;
1031
+ while (entries.length < limit) {
1032
+ const page = await listRecordAuditLog({
1033
+ ...params,
1034
+ cursor: cursor || void 0,
1035
+ limit: Math.min(200, limit - entries.length)
1036
+ });
1037
+ entries.push(...page.audit_logs.slice(0, limit - entries.length));
1038
+ if (!page.pagination.has_more) break;
1039
+ const nextCursor = page.pagination.next_cursor?.trim();
1040
+ if (!nextCursor || nextCursor === cursor) {
1041
+ throw new Error("Audit log export could not continue");
1042
+ }
1043
+ if (entries.length >= limit) {
1044
+ truncated = true;
1045
+ break;
1046
+ }
1047
+ cursor = nextCursor;
1048
+ }
1049
+ return { csv: buildAuditLogCsv(entries), count: entries.length, truncated };
1050
+ }
1051
+ function useAuditLog(collections, filters = {}, options = {}) {
1052
+ const normalizedCollections = normalizeRecordAuditCollections(collections);
1053
+ const pageSize = normalizeAuditLogPageSize(options.pageSize);
1054
+ const normalizedFilters = useMemo(
1055
+ () => ({
1056
+ event: filters.event,
1057
+ actor: filters.actor?.trim() || void 0,
1058
+ since: filters.since?.trim() || void 0,
1059
+ until: filters.until?.trim() || void 0
1060
+ }),
1061
+ [filters.actor, filters.event, filters.since, filters.until]
1062
+ );
1063
+ const query = useInfiniteQuery({
1064
+ queryKey: ["audit-log", normalizedCollections, normalizedFilters, pageSize],
1065
+ queryFn: ({ pageParam }) => listRecordAuditLog({
1066
+ collections: normalizedCollections,
1067
+ ...normalizedFilters,
1068
+ cursor: typeof pageParam === "string" && pageParam ? pageParam : void 0,
1069
+ limit: pageSize
1070
+ }),
1071
+ initialPageParam: "",
1072
+ getNextPageParam: (lastPage) => lastPage.pagination.has_more ? lastPage.pagination.next_cursor || void 0 : void 0,
1073
+ enabled: (options.enabled ?? true) && normalizedCollections.length > 0,
1074
+ retry: (failureCount, error) => {
1075
+ const status = error.status;
1076
+ return !status || status >= 500 ? failureCount < 2 : false;
1077
+ }
1078
+ });
1079
+ return {
1080
+ entries: query.data?.pages.flatMap((page) => page.audit_logs) ?? [],
1081
+ error: query.error,
1082
+ isLoading: query.isLoading,
1083
+ isFetching: query.isFetching,
1084
+ isLoadingMore: query.isFetchingNextPage,
1085
+ hasMore: Boolean(query.hasNextPage),
1086
+ loadMore: async () => {
1087
+ await query.fetchNextPage();
1088
+ },
1089
+ refresh: async () => {
1090
+ await query.refetch();
1091
+ }
1092
+ };
1093
+ }
957
1094
  function useAutomationRun(options) {
958
1095
  const {
959
1096
  agentId,
@@ -1083,7 +1220,15 @@ function useAutomationRun(options) {
1083
1220
  };
1084
1221
  }
1085
1222
  export {
1223
+ AUDIT_LOG_MAX_COLLECTIONS as A,
1086
1224
  useAgentChatSessions as a,
1087
- useAutomationRun as b,
1225
+ useAuditLog as b,
1226
+ useAutomationRun as c,
1227
+ auditLogDetailValue as d,
1228
+ auditLogActorLabel as e,
1229
+ fetchRecordAuditLogCsv as f,
1230
+ getRecordAuditLogSnapshot as g,
1231
+ AUDIT_LOG_EXPORT_LIMIT as h,
1232
+ normalizeRecordAuditCollections as n,
1088
1233
  useAgentChat as u
1089
1234
  };
@@ -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-CmEr75-t.js";
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumerahq/ui",
3
- "version": "0.11.2",
3
+ "version": "0.12.0-dev.0",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -1,4 +0,0 @@
1
- import { r } from "./RecordSheet-CTmyahrD.js";
2
- export {
3
- r as Mermaid
4
- };