@krak-stack/registry 0.1.53 → 0.1.55
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/CHANGELOG.md +31 -0
- package/dist/components/ui/error-component.js +9 -5
- package/dist/components/ui/form.d.ts +5 -5
- package/dist/services/events/browser.d.ts +5 -1
- package/dist/services/events/browser.js +295 -174
- package/dist/services/events/client/audit-log-table.d.ts +17 -12
- package/dist/services/events/client/audit-log-table.js +71 -17
- package/dist/services/events/client/tracking-notice.d.ts +24 -0
- package/dist/services/events/client/tracking-notice.js +480 -0
- package/dist/services/events/index.d.ts +15 -8
- package/dist/services/events/index.js +168 -107
- package/dist/services/events/schema.d.ts +51 -1
- package/dist/services/events/schema.js +22 -4
- package/dist/services/opentelemetry/api.js +13 -1
- package/dist/services/opentelemetry/browser.d.ts +8 -0
- package/dist/services/opentelemetry/browser.js +36 -11
- package/dist/services/opentelemetry/consent.d.ts +21 -0
- package/dist/services/opentelemetry/events.d.ts +2 -0
- package/dist/services/opentelemetry/index.js +13 -1
- package/dist/services/opentelemetry/schema.d.ts +11 -0
- package/dist/services/opentelemetry/web-vitals.d.ts +3 -2
- package/dist/services/opentelemetry/web-vitals.js +161 -58
- package/package.json +5 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { type
|
|
3
|
-
import type { EventLogRecord } from "../schema.js";
|
|
2
|
+
import { type DataTableStatus } from "../../../components/ui/data-table.js";
|
|
3
|
+
import type { EventLogRecord, EventQuery } from "../schema.js";
|
|
4
4
|
declare const translations: {
|
|
5
5
|
en: {
|
|
6
6
|
title: string;
|
|
7
|
+
event: string;
|
|
8
|
+
allEvents: string;
|
|
7
9
|
time: string;
|
|
8
10
|
action: string;
|
|
9
11
|
target: string;
|
|
@@ -18,6 +20,8 @@ declare const translations: {
|
|
|
18
20
|
};
|
|
19
21
|
fr: {
|
|
20
22
|
title: string;
|
|
23
|
+
event: string;
|
|
24
|
+
allEvents: string;
|
|
21
25
|
time: string;
|
|
22
26
|
action: string;
|
|
23
27
|
target: string;
|
|
@@ -32,22 +36,23 @@ declare const translations: {
|
|
|
32
36
|
};
|
|
33
37
|
};
|
|
34
38
|
export type AuditLogMessages = typeof translations.en;
|
|
35
|
-
export type
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
export type AuditLogTableProps = DataTableStatus & {
|
|
40
|
+
/** Full application-owned event catalog, with localized display labels. */
|
|
41
|
+
events?: readonly {
|
|
42
|
+
value: string;
|
|
43
|
+
label: string;
|
|
44
|
+
}[];
|
|
45
|
+
state?: EventQuery;
|
|
46
|
+
onStateChange?: (state: EventQuery) => void;
|
|
40
47
|
entries: readonly EventLogRecord[];
|
|
41
48
|
/** Total matching records from the query response; paging lives in state. */
|
|
42
49
|
rowCount: number;
|
|
50
|
+
/** Display time zone for the dateTime column. Defaults to America/New_York. */
|
|
51
|
+
timeZone?: string;
|
|
43
52
|
/** Overrides the shared KrakstackProvider locale when supplied. */
|
|
44
53
|
locale?: string;
|
|
45
54
|
messages?: Readonly<Record<string, Partial<AuditLogMessages>>>;
|
|
46
|
-
/** Current profiles the viewer may access. Matched by type and ID, including user impersonators.
|
|
47
|
-
* Missing profiles use neutral labels: the list may be loading, incomplete, or unavailable.
|
|
48
|
-
*/
|
|
49
|
-
actors?: readonly AuditActor[];
|
|
50
55
|
renderAction?: (entry: EventLogRecord) => ReactNode;
|
|
51
56
|
};
|
|
52
|
-
export declare const AuditLogTable: ({ entries, rowCount, locale: localeOverride, messages,
|
|
57
|
+
export declare const AuditLogTable: ({ entries, events, rowCount, timeZone, locale: localeOverride, messages, renderAction, state, onStateChange, ...status }: AuditLogTableProps) => import("react").JSX.Element;
|
|
53
58
|
export {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// ../../src/services/events/client/audit-log-table.tsx
|
|
2
|
+
import { ListFilterIcon } from "lucide-react";
|
|
3
|
+
|
|
1
4
|
// ../../src/components/ui/data-table.tsx
|
|
2
5
|
import { useAtom, useAtomSet } from "@effect/atom-react";
|
|
3
6
|
import { BrowserKeyValueStore } from "@effect/platform-browser";
|
|
@@ -3501,7 +3504,9 @@ var eventTextAttribute = (record, key) => Schema2.decodeUnknownOption(TextValue)
|
|
|
3501
3504
|
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3502
3505
|
var translations = {
|
|
3503
3506
|
en: {
|
|
3504
|
-
title: "
|
|
3507
|
+
title: "Activity history",
|
|
3508
|
+
event: "Action",
|
|
3509
|
+
allEvents: "All actions",
|
|
3505
3510
|
time: "Time",
|
|
3506
3511
|
action: "Action",
|
|
3507
3512
|
target: "Target",
|
|
@@ -3515,7 +3520,9 @@ var translations = {
|
|
|
3515
3520
|
methodUnknown: "Unknown"
|
|
3516
3521
|
},
|
|
3517
3522
|
fr: {
|
|
3518
|
-
title: "
|
|
3523
|
+
title: "Historique d’activité",
|
|
3524
|
+
event: "Action",
|
|
3525
|
+
allEvents: "Toutes les actions",
|
|
3519
3526
|
time: "Date",
|
|
3520
3527
|
action: "Action",
|
|
3521
3528
|
target: "Cible",
|
|
@@ -3531,10 +3538,11 @@ var translations = {
|
|
|
3531
3538
|
};
|
|
3532
3539
|
var AuditLogTable = ({
|
|
3533
3540
|
entries,
|
|
3541
|
+
events = [],
|
|
3534
3542
|
rowCount,
|
|
3543
|
+
timeZone = "America/New_York",
|
|
3535
3544
|
locale: localeOverride,
|
|
3536
3545
|
messages,
|
|
3537
|
-
actors = [],
|
|
3538
3546
|
renderAction,
|
|
3539
3547
|
state,
|
|
3540
3548
|
onStateChange,
|
|
@@ -3552,18 +3560,20 @@ var AuditLogTable = ({
|
|
|
3552
3560
|
["session", labels.methodSession],
|
|
3553
3561
|
["api_key", labels.methodApiKey]
|
|
3554
3562
|
]);
|
|
3555
|
-
const actorsByKey = new Map(actors.map((actor) => [`${actor.type}:${actor.id}`, actor]));
|
|
3556
3563
|
const getActor = (entry) => {
|
|
3557
3564
|
const type = eventTextAttribute(entry, "app.actor.type");
|
|
3558
|
-
const id = eventTextAttribute(entry, "app.actor.id");
|
|
3559
|
-
const actor = actorsByKey.get(`${type}:${id}`);
|
|
3560
|
-
if (actor)
|
|
3561
|
-
return actor;
|
|
3565
|
+
const id = eventTextAttribute(entry, "app.actor.id") ?? eventTextAttribute(entry, "user.id");
|
|
3562
3566
|
if (type === "organization") {
|
|
3563
3567
|
return { label: labels.actorOrganization, description: id };
|
|
3564
3568
|
}
|
|
3565
|
-
if (type === "user") {
|
|
3566
|
-
|
|
3569
|
+
if (type === "user" || eventTextAttribute(entry, "user.id") !== null) {
|
|
3570
|
+
const fullName = eventTextAttribute(entry, "user.full_name");
|
|
3571
|
+
const name = eventTextAttribute(entry, "user.name");
|
|
3572
|
+
const email = eventTextAttribute(entry, "user.email");
|
|
3573
|
+
return {
|
|
3574
|
+
label: fullName || name || email || labels.actorMember,
|
|
3575
|
+
description: fullName || name ? email || id : id
|
|
3576
|
+
};
|
|
3567
3577
|
}
|
|
3568
3578
|
return { label: type ?? labels.actor, description: id };
|
|
3569
3579
|
};
|
|
@@ -3572,12 +3582,13 @@ var AuditLogTable = ({
|
|
|
3572
3582
|
colId: "time",
|
|
3573
3583
|
headerName: labels.time,
|
|
3574
3584
|
type: "dateTime",
|
|
3585
|
+
typeOptions: { timeZone },
|
|
3575
3586
|
valueGetter: ({ data }) => new Date(Number(BigInt(data.timeUnixNano) / 1000000n))
|
|
3576
3587
|
},
|
|
3577
3588
|
{
|
|
3578
3589
|
field: "eventName",
|
|
3579
3590
|
headerName: labels.action,
|
|
3580
|
-
cellRenderer: ({ data }) => renderAction?.(data) ?? data.eventName
|
|
3591
|
+
cellRenderer: ({ data }) => renderAction?.(data) ?? events.find((event) => event.value === data.eventName)?.label ?? data.eventName
|
|
3581
3592
|
},
|
|
3582
3593
|
{
|
|
3583
3594
|
colId: "record",
|
|
@@ -3588,9 +3599,10 @@ var AuditLogTable = ({
|
|
|
3588
3599
|
getItem: (entry) => {
|
|
3589
3600
|
const id = eventTextAttribute(entry, "app.audit.target.id");
|
|
3590
3601
|
const name = eventTextAttribute(entry, "app.audit.target.name");
|
|
3602
|
+
const type = eventTextAttribute(entry, "app.audit.target.type");
|
|
3591
3603
|
return id === null ? null : {
|
|
3592
|
-
label: name ||
|
|
3593
|
-
description: name && name !== id ? id :
|
|
3604
|
+
label: name && name !== id ? name : type || labels.target,
|
|
3605
|
+
description: name && name !== id && type ? `${type} · ${id}` : id
|
|
3594
3606
|
};
|
|
3595
3607
|
}
|
|
3596
3608
|
}
|
|
@@ -3615,9 +3627,8 @@ var AuditLogTable = ({
|
|
|
3615
3627
|
className: "text-muted-foreground text-xs",
|
|
3616
3628
|
children: [
|
|
3617
3629
|
labels.impersonatedBy,
|
|
3618
|
-
":",
|
|
3619
|
-
|
|
3620
|
-
actorsByKey.get(`user:${impersonatorId}`)?.label ?? impersonatorId
|
|
3630
|
+
": ",
|
|
3631
|
+
impersonatorId
|
|
3621
3632
|
]
|
|
3622
3633
|
}) : null
|
|
3623
3634
|
]
|
|
@@ -3636,12 +3647,55 @@ var AuditLogTable = ({
|
|
|
3636
3647
|
];
|
|
3637
3648
|
return /* @__PURE__ */ jsx15("section", {
|
|
3638
3649
|
"aria-label": labels.title,
|
|
3650
|
+
className: "flex flex-col gap-4",
|
|
3639
3651
|
children: /* @__PURE__ */ jsx15(DataTable, {
|
|
3640
3652
|
locale,
|
|
3641
3653
|
status,
|
|
3642
3654
|
state,
|
|
3643
|
-
onStateChange
|
|
3655
|
+
onStateChange: onStateChange ? (next) => onStateChange({
|
|
3656
|
+
...next,
|
|
3657
|
+
eventName: state?.eventName
|
|
3658
|
+
}) : undefined,
|
|
3644
3659
|
features: {
|
|
3660
|
+
toolbar: state && onStateChange ? {
|
|
3661
|
+
items: /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
3662
|
+
children: [
|
|
3663
|
+
/* @__PURE__ */ jsxs9(MenubarTrigger, {
|
|
3664
|
+
children: [
|
|
3665
|
+
/* @__PURE__ */ jsx15(ListFilterIcon, {
|
|
3666
|
+
"aria-hidden": "true",
|
|
3667
|
+
"data-icon": "inline-start"
|
|
3668
|
+
}),
|
|
3669
|
+
labels.event,
|
|
3670
|
+
state.eventName ? `: ${events.find((event) => event.value === state.eventName)?.label ?? state.eventName}` : ""
|
|
3671
|
+
]
|
|
3672
|
+
}),
|
|
3673
|
+
/* @__PURE__ */ jsx15(MenubarContent, {
|
|
3674
|
+
className: "w-80",
|
|
3675
|
+
children: /* @__PURE__ */ jsxs9(MenubarGroup, {
|
|
3676
|
+
children: [
|
|
3677
|
+
/* @__PURE__ */ jsx15(MenubarItem, {
|
|
3678
|
+
onClick: () => onStateChange({
|
|
3679
|
+
...state,
|
|
3680
|
+
eventName: undefined,
|
|
3681
|
+
page: 0
|
|
3682
|
+
}),
|
|
3683
|
+
children: labels.allEvents
|
|
3684
|
+
}),
|
|
3685
|
+
events.map((event) => /* @__PURE__ */ jsx15(MenubarItem, {
|
|
3686
|
+
onClick: () => onStateChange({
|
|
3687
|
+
...state,
|
|
3688
|
+
eventName: event.value,
|
|
3689
|
+
page: 0
|
|
3690
|
+
}),
|
|
3691
|
+
children: event.label
|
|
3692
|
+
}, event.value))
|
|
3693
|
+
]
|
|
3694
|
+
})
|
|
3695
|
+
})
|
|
3696
|
+
]
|
|
3697
|
+
})
|
|
3698
|
+
} : false,
|
|
3645
3699
|
pagination: { mode: "server", rowCount }
|
|
3646
3700
|
},
|
|
3647
3701
|
columnDefs: columns,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface TrackingNoticeMessages {
|
|
2
|
+
readonly preferences: string;
|
|
3
|
+
readonly title: string;
|
|
4
|
+
readonly description: string;
|
|
5
|
+
readonly learnMore: string;
|
|
6
|
+
readonly details: string;
|
|
7
|
+
readonly essential: string;
|
|
8
|
+
readonly privacy: string;
|
|
9
|
+
readonly accept: string;
|
|
10
|
+
readonly decline: string;
|
|
11
|
+
readonly close: string;
|
|
12
|
+
readonly blocked: string;
|
|
13
|
+
readonly accepted: string;
|
|
14
|
+
readonly declined: string;
|
|
15
|
+
readonly pending: string;
|
|
16
|
+
readonly error: string;
|
|
17
|
+
}
|
|
18
|
+
/** Mount once in a persistent footer. English/French defaults follow KrakstackProvider. */
|
|
19
|
+
export declare const TrackingNotice: ({ messages, locale: localeOverride, privacyHref, }?: {
|
|
20
|
+
readonly messages?: Partial<TrackingNoticeMessages>;
|
|
21
|
+
readonly locale?: string;
|
|
22
|
+
/** Open an application-owned page instead of the details dialog. */
|
|
23
|
+
readonly privacyHref?: string;
|
|
24
|
+
}) => import("react").JSX.Element;
|