@lumerahq/ui 0.13.0-dev.2 → 0.13.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.
- package/README.md +29 -21
- package/dist/{RecordSheet-CawHELpB.js → RecordSheet-BGs3rudM.js} +9146 -5815
- package/dist/{automations-EgDXJ43_.js → automations-DGUEnAYR.js} +199 -38
- package/dist/components/audit-log/AuditLog.d.ts +51 -0
- package/dist/components/audit-log/AuditLog.d.ts.map +1 -0
- package/dist/components/audit-log/AuditLogEntry.d.ts +19 -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-TFNZl-GI.js → highlighted-body-OFNGDK62-V6FEuBTg.js} +1 -1
- package/dist/hooks/index.d.ts +1 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +6 -7
- 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 +55 -65
- package/dist/lib/audit-log-core.d.ts +46 -40
- package/dist/lib/audit-log-core.d.ts.map +1 -1
- package/dist/lib/audit-log.d.ts +5 -5
- package/dist/lib/audit-log.d.ts.map +1 -1
- package/dist/lib/bridge.d.ts +28 -0
- package/dist/lib/bridge.d.ts.map +1 -1
- package/dist/lib/index.d.ts +1 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +36 -46
- package/dist/mermaid-GHXKKRXX-AvjGDhsO.js +4 -0
- package/dist/ui.css +185 -1
- package/dist/{use-automation-run-IypX1vtN.js → use-automation-run-D6DIaHy3.js} +189 -3
- package/dist/{use-sql-table-By700ZAo.js → use-sql-table-BfA0A-w3.js} +3 -72
- package/package.json +1 -1
- package/dist/audit-log-BPvip04_.js +0 -128
- package/dist/hooks/use-record-audit-log-snapshot.d.ts +0 -15
- package/dist/hooks/use-record-audit-log-snapshot.d.ts.map +0 -1
- package/dist/hooks/use-record-audit-log.d.ts +0 -23
- package/dist/hooks/use-record-audit-log.d.ts.map +0 -1
- package/dist/mermaid-GHXKKRXX-9ec0sPET.js +0 -4
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { X as requestApi } from "./automations-EgDXJ43_.js";
|
|
2
|
-
const RECORD_AUDIT_EXPORT_LIMIT = 1e4;
|
|
3
|
-
const RECORD_AUDIT_MAX_COLLECTIONS = 20;
|
|
4
|
-
const normalizeRecordAuditPageSize = (value = 50) => Math.min(200, Math.max(1, Math.trunc(value) || 50));
|
|
5
|
-
const normalizeRecordAuditExportLimit = (value = RECORD_AUDIT_EXPORT_LIMIT) => Math.min(RECORD_AUDIT_EXPORT_LIMIT, Math.max(1, Math.trunc(value) || RECORD_AUDIT_EXPORT_LIMIT));
|
|
6
|
-
const shortActorId = (id) => {
|
|
7
|
-
const normalized = id?.trim() || "";
|
|
8
|
-
return normalized.length > 4 ? `${normalized.slice(0, 4)}…` : normalized;
|
|
9
|
-
};
|
|
10
|
-
const recordAuditActorLabel = (actor) => actor.name?.trim() || actor.email?.trim() || [actor.type_label.trim(), shortActorId(actor.id)].filter(Boolean).join(" ") || "Unknown actor";
|
|
11
|
-
function normalizeRecordAuditCollections(collections) {
|
|
12
|
-
const normalized = [];
|
|
13
|
-
const seen = /* @__PURE__ */ new Set();
|
|
14
|
-
for (const value of collections) {
|
|
15
|
-
const collection = value.trim();
|
|
16
|
-
if (!collection || seen.has(collection)) continue;
|
|
17
|
-
seen.add(collection);
|
|
18
|
-
normalized.push(collection);
|
|
19
|
-
}
|
|
20
|
-
return normalized;
|
|
21
|
-
}
|
|
22
|
-
function buildRecordAuditLogPath(params) {
|
|
23
|
-
const collections = normalizeRecordAuditCollections(params.collections);
|
|
24
|
-
if (collections.length === 0) {
|
|
25
|
-
throw new Error("At least one collection is required");
|
|
26
|
-
}
|
|
27
|
-
if (collections.length > RECORD_AUDIT_MAX_COLLECTIONS) {
|
|
28
|
-
throw new Error(`At most ${RECORD_AUDIT_MAX_COLLECTIONS} collections can be requested`);
|
|
29
|
-
}
|
|
30
|
-
const query = new URLSearchParams({
|
|
31
|
-
domain: "record",
|
|
32
|
-
limit: String(normalizeRecordAuditPageSize(params.limit))
|
|
33
|
-
});
|
|
34
|
-
for (const collection of collections) query.append("collection", collection);
|
|
35
|
-
if (params.cursor?.trim()) query.set("cursor", params.cursor.trim());
|
|
36
|
-
if (params.event) query.set("event", params.event);
|
|
37
|
-
if (params.actor?.trim()) query.set("actor", params.actor.trim());
|
|
38
|
-
if (params.since?.trim()) query.set("since", params.since.trim());
|
|
39
|
-
if (params.until?.trim()) query.set("until", params.until.trim());
|
|
40
|
-
return `/audit-log?${query.toString()}`;
|
|
41
|
-
}
|
|
42
|
-
const protectSpreadsheetCell = (value) => /^[\t\r ]*[=+\-@]/.test(value) ? `'${value}` : value;
|
|
43
|
-
const csvCell = (value) => `"${protectSpreadsheetCell(value).replaceAll('"', '""')}"`;
|
|
44
|
-
const summaryText = (entry) => entry.summary.map((segment) => segment.text).join(" ");
|
|
45
|
-
function buildRecordAuditCsv(entries) {
|
|
46
|
-
const rows = entries.map(
|
|
47
|
-
(entry) => [
|
|
48
|
-
entry.occurred_at,
|
|
49
|
-
entry.collection,
|
|
50
|
-
entry.collection_id,
|
|
51
|
-
recordAuditActorLabel(entry.actor),
|
|
52
|
-
entry.actor.id || "",
|
|
53
|
-
entry.actor.type,
|
|
54
|
-
entry.event,
|
|
55
|
-
entry.record_id,
|
|
56
|
-
entry.record_label,
|
|
57
|
-
entry.changed_fields.join(", "),
|
|
58
|
-
summaryText(entry)
|
|
59
|
-
].map(csvCell).join(",")
|
|
60
|
-
);
|
|
61
|
-
return [
|
|
62
|
-
[
|
|
63
|
-
"time",
|
|
64
|
-
"collection",
|
|
65
|
-
"collection_id",
|
|
66
|
-
"actor",
|
|
67
|
-
"actor_id",
|
|
68
|
-
"actor_type",
|
|
69
|
-
"event",
|
|
70
|
-
"record_id",
|
|
71
|
-
"record_label",
|
|
72
|
-
"changed_fields",
|
|
73
|
-
"summary"
|
|
74
|
-
].map(csvCell).join(","),
|
|
75
|
-
...rows
|
|
76
|
-
].join("\n");
|
|
77
|
-
}
|
|
78
|
-
async function listRecordAuditLog(params) {
|
|
79
|
-
return requestApi(buildRecordAuditLogPath(params), { method: "GET" });
|
|
80
|
-
}
|
|
81
|
-
async function getRecordAuditLogSnapshot(id, store = "tenant") {
|
|
82
|
-
const normalizedID = id.trim();
|
|
83
|
-
if (!normalizedID) {
|
|
84
|
-
throw new Error("Audit log ID is required");
|
|
85
|
-
}
|
|
86
|
-
return requestApi(
|
|
87
|
-
`/audit-log/${encodeURIComponent(normalizedID)}/snapshot?store=${encodeURIComponent(store)}`,
|
|
88
|
-
{ method: "GET" }
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
async function fetchRecordAuditLogCsv(params, maxRows = RECORD_AUDIT_EXPORT_LIMIT) {
|
|
92
|
-
const limit = normalizeRecordAuditExportLimit(maxRows);
|
|
93
|
-
const entries = [];
|
|
94
|
-
let cursor = "";
|
|
95
|
-
let truncated = false;
|
|
96
|
-
while (entries.length < limit) {
|
|
97
|
-
const page = await listRecordAuditLog({
|
|
98
|
-
...params,
|
|
99
|
-
cursor: cursor || void 0,
|
|
100
|
-
limit: Math.min(200, limit - entries.length)
|
|
101
|
-
});
|
|
102
|
-
entries.push(...page.audit_logs.slice(0, limit - entries.length));
|
|
103
|
-
if (!page.pagination.has_more) break;
|
|
104
|
-
const nextCursor = page.pagination.next_cursor?.trim();
|
|
105
|
-
if (!nextCursor || nextCursor === cursor) {
|
|
106
|
-
throw new Error("Audit log export could not continue");
|
|
107
|
-
}
|
|
108
|
-
if (entries.length >= limit) {
|
|
109
|
-
truncated = true;
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
cursor = nextCursor;
|
|
113
|
-
}
|
|
114
|
-
return { csv: buildRecordAuditCsv(entries), count: entries.length, truncated };
|
|
115
|
-
}
|
|
116
|
-
export {
|
|
117
|
-
RECORD_AUDIT_EXPORT_LIMIT as R,
|
|
118
|
-
buildRecordAuditLogPath as a,
|
|
119
|
-
buildRecordAuditCsv as b,
|
|
120
|
-
normalizeRecordAuditExportLimit as c,
|
|
121
|
-
normalizeRecordAuditPageSize as d,
|
|
122
|
-
RECORD_AUDIT_MAX_COLLECTIONS as e,
|
|
123
|
-
fetchRecordAuditLogCsv as f,
|
|
124
|
-
getRecordAuditLogSnapshot as g,
|
|
125
|
-
listRecordAuditLog as l,
|
|
126
|
-
normalizeRecordAuditCollections as n,
|
|
127
|
-
recordAuditActorLabel as r
|
|
128
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { RecordAuditSnapshot, RecordAuditStore } from '../lib/audit-log';
|
|
2
|
-
export type UseRecordAuditLogSnapshotParams = {
|
|
3
|
-
id?: string;
|
|
4
|
-
store?: RecordAuditStore;
|
|
5
|
-
enabled?: boolean;
|
|
6
|
-
};
|
|
7
|
-
export type UseRecordAuditLogSnapshotResult = {
|
|
8
|
-
snapshot: RecordAuditSnapshot | null;
|
|
9
|
-
error: Error | null;
|
|
10
|
-
isLoading: boolean;
|
|
11
|
-
isFetching: boolean;
|
|
12
|
-
refresh: () => Promise<void>;
|
|
13
|
-
};
|
|
14
|
-
export declare function useRecordAuditLogSnapshot(params: UseRecordAuditLogSnapshotParams): UseRecordAuditLogSnapshotResult;
|
|
15
|
-
//# sourceMappingURL=use-record-audit-log-snapshot.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-record-audit-log-snapshot.d.ts","sourceRoot":"","sources":["../../src/hooks/use-record-audit-log-snapshot.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,KAAK,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE7G,MAAM,MAAM,+BAA+B,GAAG;IAC5C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACrC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,+BAA+B,GAAG,+BAA+B,CAsBlH"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { RecordAuditCollectionStatus, RecordAuditEntry, RecordAuditEvent } from '../lib/audit-log';
|
|
2
|
-
export type UseRecordAuditLogParams = {
|
|
3
|
-
collections: readonly string[];
|
|
4
|
-
event?: RecordAuditEvent;
|
|
5
|
-
actor?: string;
|
|
6
|
-
since?: string;
|
|
7
|
-
until?: string;
|
|
8
|
-
pageSize?: number;
|
|
9
|
-
enabled?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export type UseRecordAuditLogResult = {
|
|
12
|
-
entries: RecordAuditEntry[];
|
|
13
|
-
collectionStatus: RecordAuditCollectionStatus[];
|
|
14
|
-
error: Error | null;
|
|
15
|
-
isLoading: boolean;
|
|
16
|
-
isFetching: boolean;
|
|
17
|
-
isLoadingMore: boolean;
|
|
18
|
-
hasMore: boolean;
|
|
19
|
-
loadMore: () => Promise<void>;
|
|
20
|
-
refresh: () => Promise<void>;
|
|
21
|
-
};
|
|
22
|
-
export declare function useRecordAuditLog(params: UseRecordAuditLogParams): UseRecordAuditLogResult;
|
|
23
|
-
//# sourceMappingURL=use-record-audit-log.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-record-audit-log.d.ts","sourceRoot":"","sources":["../../src/hooks/use-record-audit-log.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,uBAAuB,GAAG;IACpC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,gBAAgB,EAAE,2BAA2B,EAAE,CAAC;IAChD,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,GAAG,uBAAuB,CA+C1F"}
|