@krak-stack/registry 0.10.14 → 0.10.16
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 +15 -0
- package/dist/components/support-dialog.d.ts +1 -49
- package/dist/components/support-dialog.js +443 -241
- package/dist/components/support.d.ts +65 -0
- package/dist/components/support.js +853 -0
- package/dist/components/ui/dialog.d.ts +8 -4
- package/dist/components/ui/effect-form.d.ts +4 -0
- package/dist/components/ui/effect-form.js +78 -35
- package/dist/components/ui/error-component.d.ts +3 -1
- package/dist/components/ui/error-component.js +4 -2
- package/dist/components/ui/map-menu.js +23 -11
- package/dist/components/ui/search-menu.d.ts +1 -1
- package/dist/components/ui/search-menu.js +86 -22
- package/dist/lib/docs.integrations.server.js +4 -3
- package/dist/lib/docs.js +88 -24
- package/dist/lib/docs.server.js +4 -3
- package/dist/lib/documentation-toolkit.js +4 -3
- package/dist/services/agent/client/index.js +21 -23
- package/dist/services/clamav/index.d.ts +31 -0
- package/dist/services/clamav/index.js +124 -0
- package/dist/services/events/client/tracking-notice.js +34 -18
- package/dist/services/speech/api.js +18 -0
- package/dist/services/speech/index.js +37 -11
- package/dist/services/speech/schema.d.ts +25 -0
- package/dist/services/speech/schema.js +20 -0
- package/dist/services/webhooks/client/delivery-table.js +15 -13
- package/package.json +9 -1
package/dist/lib/docs.js
CHANGED
|
@@ -448,8 +448,8 @@ function CollapsibleContent({ ...props }) {
|
|
|
448
448
|
}
|
|
449
449
|
|
|
450
450
|
// ../../src/components/ui/search-menu.tsx
|
|
451
|
-
import { SearchIcon as SearchIcon2 } from "lucide-react";
|
|
452
|
-
import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
|
|
451
|
+
import { SearchIcon as SearchIcon2, XIcon as XIcon2 } from "lucide-react";
|
|
452
|
+
import { useCallback, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
453
453
|
|
|
454
454
|
// ../../src/components/ui/command.tsx
|
|
455
455
|
import { Command as CommandPrimitive } from "cmdk";
|
|
@@ -457,6 +457,7 @@ import { SearchIcon } from "lucide-react";
|
|
|
457
457
|
|
|
458
458
|
// ../../src/components/ui/dialog.tsx
|
|
459
459
|
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
460
|
+
import { cn as cn2 } from "cn";
|
|
460
461
|
import { XIcon } from "lucide-react";
|
|
461
462
|
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
462
463
|
function Dialog({ ...props }) {
|
|
@@ -477,13 +478,14 @@ function DialogOverlay({
|
|
|
477
478
|
}) {
|
|
478
479
|
return /* @__PURE__ */ jsx7(DialogPrimitive.Backdrop, {
|
|
479
480
|
"data-slot": "dialog-overlay",
|
|
480
|
-
className:
|
|
481
|
+
className: cn2("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs", className),
|
|
481
482
|
...props
|
|
482
483
|
});
|
|
483
484
|
}
|
|
484
485
|
function DialogContent({
|
|
485
486
|
className,
|
|
486
487
|
children,
|
|
488
|
+
showCloseButton = true,
|
|
487
489
|
...props
|
|
488
490
|
}) {
|
|
489
491
|
return /* @__PURE__ */ jsxs4(DialogPortal, {
|
|
@@ -491,16 +493,19 @@ function DialogContent({
|
|
|
491
493
|
/* @__PURE__ */ jsx7(DialogOverlay, {}),
|
|
492
494
|
/* @__PURE__ */ jsxs4(DialogPrimitive.Popup, {
|
|
493
495
|
"data-slot": "dialog-content",
|
|
494
|
-
className:
|
|
496
|
+
className: cn2("bg-popover text-popover-foreground ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-sm ring-1 duration-100 outline-none sm:max-w-md", className),
|
|
495
497
|
...props,
|
|
496
498
|
children: [
|
|
497
499
|
children,
|
|
498
|
-
/* @__PURE__ */ jsxs4(DialogPrimitive.Close, {
|
|
499
|
-
|
|
500
|
+
showCloseButton && /* @__PURE__ */ jsxs4(DialogPrimitive.Close, {
|
|
501
|
+
"data-slot": "dialog-close",
|
|
502
|
+
render: /* @__PURE__ */ jsx7(Button, {
|
|
503
|
+
variant: "ghost",
|
|
504
|
+
className: "absolute top-4 right-4",
|
|
505
|
+
size: "icon-sm"
|
|
506
|
+
}),
|
|
500
507
|
children: [
|
|
501
|
-
/* @__PURE__ */ jsx7(XIcon, {
|
|
502
|
-
className: "size-4"
|
|
503
|
-
}),
|
|
508
|
+
/* @__PURE__ */ jsx7(XIcon, {}),
|
|
504
509
|
/* @__PURE__ */ jsx7("span", {
|
|
505
510
|
className: "sr-only",
|
|
506
511
|
children: "Close"
|
|
@@ -515,17 +520,14 @@ function DialogContent({
|
|
|
515
520
|
function DialogHeader({ className, ...props }) {
|
|
516
521
|
return /* @__PURE__ */ jsx7("div", {
|
|
517
522
|
"data-slot": "dialog-header",
|
|
518
|
-
className:
|
|
523
|
+
className: cn2("flex flex-col gap-2", className),
|
|
519
524
|
...props
|
|
520
525
|
});
|
|
521
526
|
}
|
|
522
|
-
function DialogTitle({
|
|
523
|
-
className,
|
|
524
|
-
...props
|
|
525
|
-
}) {
|
|
527
|
+
function DialogTitle({ className, ...props }) {
|
|
526
528
|
return /* @__PURE__ */ jsx7(DialogPrimitive.Title, {
|
|
527
529
|
"data-slot": "dialog-title",
|
|
528
|
-
className:
|
|
530
|
+
className: cn2("leading-none font-medium", className),
|
|
529
531
|
...props
|
|
530
532
|
});
|
|
531
533
|
}
|
|
@@ -535,7 +537,7 @@ function DialogDescription({
|
|
|
535
537
|
}) {
|
|
536
538
|
return /* @__PURE__ */ jsx7(DialogPrimitive.Description, {
|
|
537
539
|
"data-slot": "dialog-description",
|
|
538
|
-
className:
|
|
540
|
+
className: cn2("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3", className),
|
|
539
541
|
...props
|
|
540
542
|
});
|
|
541
543
|
}
|
|
@@ -662,14 +664,16 @@ var messages3 = {
|
|
|
662
664
|
description: "Search for an item to open.",
|
|
663
665
|
placeholder: "Search...",
|
|
664
666
|
inputPlaceholder: "Search...",
|
|
665
|
-
emptyMessage: "No results found."
|
|
667
|
+
emptyMessage: "No results found.",
|
|
668
|
+
clearSearch: "Clear search"
|
|
666
669
|
},
|
|
667
670
|
fr: {
|
|
668
671
|
title: "Recherche",
|
|
669
672
|
description: "Recherchez un élément à ouvrir.",
|
|
670
673
|
placeholder: "Rechercher...",
|
|
671
674
|
inputPlaceholder: "Rechercher...",
|
|
672
|
-
emptyMessage: "Aucun résultat trouvé."
|
|
675
|
+
emptyMessage: "Aucun résultat trouvé.",
|
|
676
|
+
clearSearch: "Effacer la recherche"
|
|
673
677
|
}
|
|
674
678
|
};
|
|
675
679
|
var searchMenuMessages = (locale, translations) => ({
|
|
@@ -703,8 +707,36 @@ function SearchMenu({
|
|
|
703
707
|
const resolvedInputPlaceholder = inputPlaceholder ?? labels.inputPlaceholder;
|
|
704
708
|
const resolvedEmptyMessage = emptyMessage ?? labels.emptyMessage;
|
|
705
709
|
const [uncontrolledOpen, setUncontrolledOpen] = useState2(false);
|
|
710
|
+
const [uncontrolledQuery, setUncontrolledQuery] = useState2("");
|
|
706
711
|
const isControlled = open !== undefined;
|
|
707
712
|
const isOpen = open ?? uncontrolledOpen;
|
|
713
|
+
const searchQuery = query ?? uncontrolledQuery;
|
|
714
|
+
const externalGroups = shouldFilter === false ? groups : undefined;
|
|
715
|
+
const [selection, setSelection] = useState2();
|
|
716
|
+
const externalItems = externalGroups?.flatMap(({ items }) => items.filter(({ disabled }) => !disabled));
|
|
717
|
+
const selectedValue = selection?.groups === externalGroups && selection?.query === searchQuery && externalItems?.some(({ label }) => label.trim() === selection?.value) ? selection.value : externalItems?.[0]?.label.trim() ?? "";
|
|
718
|
+
const inputRef = useRef2(null);
|
|
719
|
+
const listRef = useRef2(null);
|
|
720
|
+
const setQuery = (value) => {
|
|
721
|
+
if (query === undefined)
|
|
722
|
+
setUncontrolledQuery(value);
|
|
723
|
+
onQueryChange?.(value);
|
|
724
|
+
};
|
|
725
|
+
useEffect2(() => {
|
|
726
|
+
if (!isOpen) {
|
|
727
|
+
setUncontrolledQuery("");
|
|
728
|
+
setSelection(undefined);
|
|
729
|
+
}
|
|
730
|
+
}, [isOpen]);
|
|
731
|
+
useEffect2(() => {
|
|
732
|
+
const list = listRef.current;
|
|
733
|
+
if (!isOpen || !list)
|
|
734
|
+
return;
|
|
735
|
+
const frame = requestAnimationFrame(() => {
|
|
736
|
+
list.scrollTop = 0;
|
|
737
|
+
});
|
|
738
|
+
return () => cancelAnimationFrame(frame);
|
|
739
|
+
}, [isOpen, searchQuery, externalGroups]);
|
|
708
740
|
const setOpen = useCallback((value) => {
|
|
709
741
|
if (!isControlled)
|
|
710
742
|
setUncontrolledOpen(value);
|
|
@@ -750,15 +782,47 @@ function SearchMenu({
|
|
|
750
782
|
onOpenChange: setOpen,
|
|
751
783
|
title: resolvedTitle,
|
|
752
784
|
description: resolvedDescription,
|
|
785
|
+
className: "[&>[data-slot=dialog-close]]:hidden",
|
|
753
786
|
children: /* @__PURE__ */ jsxs6(Command, {
|
|
754
787
|
...shouldFilter === undefined ? {} : { shouldFilter },
|
|
788
|
+
...externalGroups && {
|
|
789
|
+
value: selectedValue,
|
|
790
|
+
onValueChange: (value) => setSelection({
|
|
791
|
+
groups: externalGroups,
|
|
792
|
+
query: searchQuery,
|
|
793
|
+
value
|
|
794
|
+
})
|
|
795
|
+
},
|
|
755
796
|
children: [
|
|
756
|
-
/* @__PURE__ */
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
797
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
798
|
+
className: cn("relative", searchQuery && "[&_[data-slot=command-input-wrapper]>div]:pr-10"),
|
|
799
|
+
children: [
|
|
800
|
+
/* @__PURE__ */ jsx9(CommandInput, {
|
|
801
|
+
ref: inputRef,
|
|
802
|
+
placeholder: resolvedInputPlaceholder,
|
|
803
|
+
value: searchQuery,
|
|
804
|
+
onValueChange: setQuery
|
|
805
|
+
}),
|
|
806
|
+
searchQuery && /* @__PURE__ */ jsx9(Button, {
|
|
807
|
+
type: "button",
|
|
808
|
+
variant: "ghost",
|
|
809
|
+
size: "icon-sm",
|
|
810
|
+
"aria-label": labels.clearSearch,
|
|
811
|
+
className: "absolute top-1.5 right-2",
|
|
812
|
+
onKeyDown: (event) => {
|
|
813
|
+
if (event.key === "Enter")
|
|
814
|
+
event.stopPropagation();
|
|
815
|
+
},
|
|
816
|
+
onClick: () => {
|
|
817
|
+
setQuery("");
|
|
818
|
+
inputRef.current?.focus();
|
|
819
|
+
},
|
|
820
|
+
children: /* @__PURE__ */ jsx9(XIcon2, {})
|
|
821
|
+
})
|
|
822
|
+
]
|
|
760
823
|
}),
|
|
761
824
|
/* @__PURE__ */ jsxs6(CommandList, {
|
|
825
|
+
ref: listRef,
|
|
762
826
|
children: [
|
|
763
827
|
/* @__PURE__ */ jsx9(CommandEmpty, {
|
|
764
828
|
children: resolvedEmptyMessage
|
|
@@ -842,7 +906,7 @@ import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
|
842
906
|
|
|
843
907
|
// ../../src/components/ui/sheet.tsx
|
|
844
908
|
import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
|
|
845
|
-
import { XIcon as
|
|
909
|
+
import { XIcon as XIcon3 } from "lucide-react";
|
|
846
910
|
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
847
911
|
"use client";
|
|
848
912
|
function Sheet({ ...props }) {
|
|
@@ -889,7 +953,7 @@ function SheetContent({
|
|
|
889
953
|
size: "icon-sm"
|
|
890
954
|
}),
|
|
891
955
|
children: [
|
|
892
|
-
/* @__PURE__ */ jsx10(
|
|
956
|
+
/* @__PURE__ */ jsx10(XIcon3, {}),
|
|
893
957
|
/* @__PURE__ */ jsx10("span", {
|
|
894
958
|
className: "sr-only",
|
|
895
959
|
children: "Close"
|
package/dist/lib/docs.server.js
CHANGED
|
@@ -102,8 +102,8 @@ var themeCss = `${createThemeCss({
|
|
|
102
102
|
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
|
|
103
103
|
|
|
104
104
|
// ../../src/components/ui/search-menu.tsx
|
|
105
|
-
import { SearchIcon as SearchIcon2 } from "lucide-react";
|
|
106
|
-
import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
|
|
105
|
+
import { SearchIcon as SearchIcon2, XIcon as XIcon2 } from "lucide-react";
|
|
106
|
+
import { useCallback, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
107
107
|
|
|
108
108
|
// ../../src/components/ui/command.tsx
|
|
109
109
|
import { Command as CommandPrimitive } from "cmdk";
|
|
@@ -111,6 +111,7 @@ import { SearchIcon } from "lucide-react";
|
|
|
111
111
|
|
|
112
112
|
// ../../src/components/ui/dialog.tsx
|
|
113
113
|
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
114
|
+
import { cn as cn2 } from "cn";
|
|
114
115
|
import { XIcon } from "lucide-react";
|
|
115
116
|
|
|
116
117
|
// ../../src/components/ui/search-menu.tsx
|
|
@@ -139,7 +140,7 @@ import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
|
139
140
|
|
|
140
141
|
// ../../src/components/ui/sheet.tsx
|
|
141
142
|
import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
|
|
142
|
-
import { XIcon as
|
|
143
|
+
import { XIcon as XIcon3 } from "lucide-react";
|
|
143
144
|
"use client";
|
|
144
145
|
|
|
145
146
|
// ../../src/components/ui/tooltip.tsx
|
|
@@ -102,8 +102,8 @@ var themeCss = `${createThemeCss({
|
|
|
102
102
|
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
|
|
103
103
|
|
|
104
104
|
// ../../src/components/ui/search-menu.tsx
|
|
105
|
-
import { SearchIcon as SearchIcon2 } from "lucide-react";
|
|
106
|
-
import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
|
|
105
|
+
import { SearchIcon as SearchIcon2, XIcon as XIcon2 } from "lucide-react";
|
|
106
|
+
import { useCallback, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
107
107
|
|
|
108
108
|
// ../../src/components/ui/command.tsx
|
|
109
109
|
import { Command as CommandPrimitive } from "cmdk";
|
|
@@ -111,6 +111,7 @@ import { SearchIcon } from "lucide-react";
|
|
|
111
111
|
|
|
112
112
|
// ../../src/components/ui/dialog.tsx
|
|
113
113
|
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
114
|
+
import { cn as cn2 } from "cn";
|
|
114
115
|
import { XIcon } from "lucide-react";
|
|
115
116
|
|
|
116
117
|
// ../../src/components/ui/search-menu.tsx
|
|
@@ -139,7 +140,7 @@ import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
|
139
140
|
|
|
140
141
|
// ../../src/components/ui/sheet.tsx
|
|
141
142
|
import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
|
|
142
|
-
import { XIcon as
|
|
143
|
+
import { XIcon as XIcon3 } from "lucide-react";
|
|
143
144
|
"use client";
|
|
144
145
|
|
|
145
146
|
// ../../src/components/ui/tooltip.tsx
|
|
@@ -678,6 +678,7 @@ import { SearchIcon } from "lucide-react";
|
|
|
678
678
|
|
|
679
679
|
// ../../src/components/ui/dialog.tsx
|
|
680
680
|
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
681
|
+
import { cn as cn2 } from "cn";
|
|
681
682
|
import { XIcon } from "lucide-react";
|
|
682
683
|
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
683
684
|
function Dialog({ ...props }) {
|
|
@@ -707,17 +708,14 @@ function DialogClose({ ...props }) {
|
|
|
707
708
|
function DialogHeader({ className, ...props }) {
|
|
708
709
|
return /* @__PURE__ */ jsx8("div", {
|
|
709
710
|
"data-slot": "dialog-header",
|
|
710
|
-
className:
|
|
711
|
+
className: cn2("flex flex-col gap-2", className),
|
|
711
712
|
...props
|
|
712
713
|
});
|
|
713
714
|
}
|
|
714
|
-
function DialogTitle({
|
|
715
|
-
className,
|
|
716
|
-
...props
|
|
717
|
-
}) {
|
|
715
|
+
function DialogTitle({ className, ...props }) {
|
|
718
716
|
return /* @__PURE__ */ jsx8(DialogPrimitive.Title, {
|
|
719
717
|
"data-slot": "dialog-title",
|
|
720
|
-
className:
|
|
718
|
+
className: cn2("leading-none font-medium", className),
|
|
721
719
|
...props
|
|
722
720
|
});
|
|
723
721
|
}
|
|
@@ -927,7 +925,7 @@ function InputGroupTextarea({
|
|
|
927
925
|
import { mergeProps as mergeProps4 } from "@base-ui/react/merge-props";
|
|
928
926
|
import { useRender as useRender4 } from "@base-ui/react/use-render";
|
|
929
927
|
import { cva as cva8 } from "class-variance-authority";
|
|
930
|
-
import { cn as
|
|
928
|
+
import { cn as cn3 } from "cn";
|
|
931
929
|
|
|
932
930
|
// ../../src/components/ui/separator.tsx
|
|
933
931
|
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
@@ -962,7 +960,7 @@ function Item({
|
|
|
962
960
|
return useRender4({
|
|
963
961
|
defaultTagName: "div",
|
|
964
962
|
props: mergeProps4({
|
|
965
|
-
className:
|
|
963
|
+
className: cn3(itemVariants({ variant, size, className }))
|
|
966
964
|
}, props),
|
|
967
965
|
render,
|
|
968
966
|
state: {
|
|
@@ -992,42 +990,42 @@ function ItemMedia({
|
|
|
992
990
|
return /* @__PURE__ */ jsx13("div", {
|
|
993
991
|
"data-slot": "item-media",
|
|
994
992
|
"data-variant": variant,
|
|
995
|
-
className:
|
|
993
|
+
className: cn3(itemMediaVariants({ variant, className })),
|
|
996
994
|
...props
|
|
997
995
|
});
|
|
998
996
|
}
|
|
999
997
|
function ItemContent({ className, ...props }) {
|
|
1000
998
|
return /* @__PURE__ */ jsx13("div", {
|
|
1001
999
|
"data-slot": "item-content",
|
|
1002
|
-
className:
|
|
1000
|
+
className: cn3("flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none", className),
|
|
1003
1001
|
...props
|
|
1004
1002
|
});
|
|
1005
1003
|
}
|
|
1006
1004
|
function ItemTitle({ className, ...props }) {
|
|
1007
1005
|
return /* @__PURE__ */ jsx13("div", {
|
|
1008
1006
|
"data-slot": "item-title",
|
|
1009
|
-
className:
|
|
1007
|
+
className: cn3("line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4", className),
|
|
1010
1008
|
...props
|
|
1011
1009
|
});
|
|
1012
1010
|
}
|
|
1013
1011
|
function ItemDescription({ className, ...props }) {
|
|
1014
1012
|
return /* @__PURE__ */ jsx13("p", {
|
|
1015
1013
|
"data-slot": "item-description",
|
|
1016
|
-
className:
|
|
1014
|
+
className: cn3("line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className),
|
|
1017
1015
|
...props
|
|
1018
1016
|
});
|
|
1019
1017
|
}
|
|
1020
1018
|
function ItemActions({ className, ...props }) {
|
|
1021
1019
|
return /* @__PURE__ */ jsx13("div", {
|
|
1022
1020
|
"data-slot": "item-actions",
|
|
1023
|
-
className:
|
|
1021
|
+
className: cn3("flex items-center gap-2", className),
|
|
1024
1022
|
...props
|
|
1025
1023
|
});
|
|
1026
1024
|
}
|
|
1027
1025
|
function ItemFooter({ className, ...props }) {
|
|
1028
1026
|
return /* @__PURE__ */ jsx13("div", {
|
|
1029
1027
|
"data-slot": "item-footer",
|
|
1030
|
-
className:
|
|
1028
|
+
className: cn3("flex basis-full items-center justify-between gap-2", className),
|
|
1031
1029
|
...props
|
|
1032
1030
|
});
|
|
1033
1031
|
}
|
|
@@ -1183,7 +1181,7 @@ function PopoverContent({
|
|
|
1183
1181
|
}
|
|
1184
1182
|
|
|
1185
1183
|
// ../../src/components/ui/trace.tsx
|
|
1186
|
-
import { cn as
|
|
1184
|
+
import { cn as cn4 } from "cn";
|
|
1187
1185
|
|
|
1188
1186
|
// ../../src/components/ui/collapsible.tsx
|
|
1189
1187
|
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
|
|
@@ -1213,7 +1211,7 @@ import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
|
1213
1211
|
function Trace({ className, ...props }) {
|
|
1214
1212
|
return /* @__PURE__ */ jsx18("div", {
|
|
1215
1213
|
"data-slot": "trace",
|
|
1216
|
-
className:
|
|
1214
|
+
className: cn4("flex w-full min-w-0 flex-col gap-2 *:has-[>[data-slot=trace-line]]:flex *:has-[>[data-slot=trace-line]]:w-fit *:has-[>[data-slot=trace-line]]:max-w-full *:has-[>[data-slot=trace-line]]:min-w-0 *:has-[>[data-slot=trace-line]]:rounded-md *:has-[>[data-slot=trace-line]]:text-left *:has-[>[data-slot=trace-line]]:outline-none *:has-[>[data-slot=trace-line]]:focus-visible:ring-3 *:has-[>[data-slot=trace-line]]:focus-visible:ring-ring/50", className),
|
|
1217
1215
|
...props
|
|
1218
1216
|
});
|
|
1219
1217
|
}
|
|
@@ -1225,7 +1223,7 @@ function TraceLine({
|
|
|
1225
1223
|
return /* @__PURE__ */ jsx18("span", {
|
|
1226
1224
|
"data-slot": "trace-line",
|
|
1227
1225
|
"data-status": status,
|
|
1228
|
-
className:
|
|
1226
|
+
className: cn4("flex w-fit max-w-full min-w-0 items-center gap-2 text-sm text-muted-foreground transition-colors in-[a,button]:cursor-pointer in-[a:hover,button:hover]:text-foreground data-[status=error]:text-destructive data-[status=error]:in-[a:hover,button:hover]:text-destructive data-[status=pending]:opacity-60 data-[status=running]:*:data-[slot=trace-title]:shimmer", className),
|
|
1229
1227
|
...props
|
|
1230
1228
|
});
|
|
1231
1229
|
}
|
|
@@ -1233,14 +1231,14 @@ function TraceIcon({ className, ...props }) {
|
|
|
1233
1231
|
return /* @__PURE__ */ jsx18("span", {
|
|
1234
1232
|
"data-slot": "trace-icon",
|
|
1235
1233
|
"aria-hidden": "true",
|
|
1236
|
-
className:
|
|
1234
|
+
className: cn4("flex size-4 shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [[data-slot=trace-title]~&]:-ml-1", className),
|
|
1237
1235
|
...props
|
|
1238
1236
|
});
|
|
1239
1237
|
}
|
|
1240
1238
|
function TraceTitle({ className, ...props }) {
|
|
1241
1239
|
return /* @__PURE__ */ jsx18("span", {
|
|
1242
1240
|
"data-slot": "trace-title",
|
|
1243
|
-
className:
|
|
1241
|
+
className: cn4("min-w-0 truncate motion-reduce:shimmer-none", className),
|
|
1244
1242
|
...props
|
|
1245
1243
|
});
|
|
1246
1244
|
}
|
|
@@ -1250,7 +1248,7 @@ function TraceDescription({
|
|
|
1250
1248
|
}) {
|
|
1251
1249
|
return /* @__PURE__ */ jsx18("span", {
|
|
1252
1250
|
"data-slot": "trace-description",
|
|
1253
|
-
className:
|
|
1251
|
+
className: cn4("shrink-0 text-muted-foreground/70 tabular-nums", className),
|
|
1254
1252
|
...props
|
|
1255
1253
|
});
|
|
1256
1254
|
}
|
|
@@ -1260,7 +1258,7 @@ function TraceCollapsible({
|
|
|
1260
1258
|
}) {
|
|
1261
1259
|
return /* @__PURE__ */ jsx18(Collapsible, {
|
|
1262
1260
|
"data-slot": "trace-collapsible",
|
|
1263
|
-
className:
|
|
1261
|
+
className: cn4("flex w-full min-w-0 flex-col", className),
|
|
1264
1262
|
...props
|
|
1265
1263
|
});
|
|
1266
1264
|
}
|
|
@@ -1271,7 +1269,7 @@ function TraceCollapsibleTrigger({
|
|
|
1271
1269
|
}) {
|
|
1272
1270
|
return /* @__PURE__ */ jsxs6(CollapsibleTrigger, {
|
|
1273
1271
|
"data-slot": "trace-collapsible-trigger",
|
|
1274
|
-
className:
|
|
1272
|
+
className: cn4("group/trace-collapsible-trigger flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-md text-left text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 has-[[data-status=error]]:text-destructive", className),
|
|
1275
1273
|
...props,
|
|
1276
1274
|
children: [
|
|
1277
1275
|
children,
|
|
@@ -1293,7 +1291,7 @@ function TraceCollapsibleContent({
|
|
|
1293
1291
|
...props,
|
|
1294
1292
|
children: /* @__PURE__ */ jsx18("div", {
|
|
1295
1293
|
"data-slot": "trace-collapsible-content-inner",
|
|
1296
|
-
className:
|
|
1294
|
+
className: cn4("mt-2 mb-1 ml-[calc(--spacing(2)-1px)] min-w-0 border-l pr-1 pl-4 leading-relaxed wrap-break-word text-muted-foreground", className),
|
|
1297
1295
|
children
|
|
1298
1296
|
})
|
|
1299
1297
|
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Config, Context, Effect, Layer, Schema } from "effect";
|
|
2
|
+
export type ClamAVVerdict = {
|
|
3
|
+
readonly _tag: "Clean";
|
|
4
|
+
} | {
|
|
5
|
+
readonly _tag: "Detected";
|
|
6
|
+
readonly signature: string;
|
|
7
|
+
} | {
|
|
8
|
+
readonly _tag: "Unscannable";
|
|
9
|
+
};
|
|
10
|
+
declare const ClamAVError_base: Schema.Class<ClamAVError, Schema.TaggedStruct<"ClamAVError", {
|
|
11
|
+
readonly reason: Schema.Literals<readonly ["Unavailable", "Timeout", "InvalidReply", "ScanFailed"]>;
|
|
12
|
+
}>, import("effect/Cause").YieldableError>;
|
|
13
|
+
export declare class ClamAVError extends ClamAVError_base {
|
|
14
|
+
}
|
|
15
|
+
type Endpoint = {
|
|
16
|
+
readonly host: string;
|
|
17
|
+
readonly port: number;
|
|
18
|
+
};
|
|
19
|
+
declare const ClamAV_base: Context.ServiceClass<ClamAV, "krak-stack/ClamAV", {
|
|
20
|
+
readonly scan: (input: {
|
|
21
|
+
readonly bytes: Uint8Array;
|
|
22
|
+
}) => Effect.Effect<ClamAVVerdict, ClamAVError>;
|
|
23
|
+
readonly ping: () => Effect.Effect<void, ClamAVError>;
|
|
24
|
+
}>;
|
|
25
|
+
export declare class ClamAV extends ClamAV_base {
|
|
26
|
+
static readonly layerWith: (endpoint: Endpoint) => Layer.Layer<ClamAV, never, never>;
|
|
27
|
+
static readonly layer: Layer.Layer<ClamAV, Config.ConfigError, never>;
|
|
28
|
+
static readonly layerTest: (service: ClamAV["Service"]) => Layer.Layer<ClamAV, never, never>;
|
|
29
|
+
private static readonly make;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// ../../src/services/clamav/index.ts
|
|
2
|
+
import { createConnection } from "node:net";
|
|
3
|
+
import { Config, Context, Effect, Layer, Schema, Semaphore } from "effect";
|
|
4
|
+
|
|
5
|
+
class ClamAVError extends Schema.TaggedError()("ClamAVError", {
|
|
6
|
+
reason: Schema.Literals([
|
|
7
|
+
"Unavailable",
|
|
8
|
+
"Timeout",
|
|
9
|
+
"InvalidReply",
|
|
10
|
+
"ScanFailed"
|
|
11
|
+
])
|
|
12
|
+
}) {
|
|
13
|
+
}
|
|
14
|
+
var maxBytes = 100 * 1024 * 1024;
|
|
15
|
+
var request = (endpoint, bytes) => Effect.tryPromise({
|
|
16
|
+
try: (signal) => new Promise((resolve, reject) => {
|
|
17
|
+
const socket = createConnection({ ...endpoint, signal });
|
|
18
|
+
let reply = Buffer.alloc(0);
|
|
19
|
+
let sent = bytes === undefined;
|
|
20
|
+
const fail = (reason) => {
|
|
21
|
+
reject(new ClamAVError({ reason }));
|
|
22
|
+
socket.destroy();
|
|
23
|
+
};
|
|
24
|
+
socket.on("error", () => fail("Unavailable"));
|
|
25
|
+
socket.on("close", () => {
|
|
26
|
+
const end = reply.indexOf(0);
|
|
27
|
+
if (end < 0)
|
|
28
|
+
return fail(reply.length ? "InvalidReply" : "Unavailable");
|
|
29
|
+
if (end !== reply.length - 1)
|
|
30
|
+
return fail("InvalidReply");
|
|
31
|
+
const line = reply.toString("utf8", 0, end);
|
|
32
|
+
if (!sent && line === "stream: OK")
|
|
33
|
+
return fail("InvalidReply");
|
|
34
|
+
resolve(line);
|
|
35
|
+
});
|
|
36
|
+
socket.on("data", (part) => {
|
|
37
|
+
if (reply.length + part.length > 4096)
|
|
38
|
+
return fail("InvalidReply");
|
|
39
|
+
reply = Buffer.concat([reply, part]);
|
|
40
|
+
});
|
|
41
|
+
socket.once("connect", () => {
|
|
42
|
+
if (!bytes) {
|
|
43
|
+
socket.write("zPING\x00");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
let offset = 0;
|
|
47
|
+
const send = () => {
|
|
48
|
+
if (socket.destroyed)
|
|
49
|
+
return;
|
|
50
|
+
if (offset === bytes.length) {
|
|
51
|
+
sent = true;
|
|
52
|
+
socket.write(Buffer.alloc(4));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const size = Math.min(64 * 1024, bytes.length - offset);
|
|
56
|
+
const frame = Buffer.allocUnsafe(4 + size);
|
|
57
|
+
frame.writeUInt32BE(size);
|
|
58
|
+
frame.set(bytes.subarray(offset, offset + size), 4);
|
|
59
|
+
offset += size;
|
|
60
|
+
socket.write(frame, (error) => {
|
|
61
|
+
if (error)
|
|
62
|
+
fail("Unavailable");
|
|
63
|
+
else
|
|
64
|
+
send();
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
socket.write("zINSTREAM\x00", (error) => {
|
|
68
|
+
if (error)
|
|
69
|
+
fail("Unavailable");
|
|
70
|
+
else
|
|
71
|
+
send();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}),
|
|
75
|
+
catch: (error) => error instanceof ClamAVError ? error : new ClamAVError({ reason: "Unavailable" })
|
|
76
|
+
}).pipe(Effect.timeoutOrElse({
|
|
77
|
+
duration: "60 seconds",
|
|
78
|
+
orElse: () => Effect.fail(new ClamAVError({ reason: "Timeout" }))
|
|
79
|
+
}));
|
|
80
|
+
|
|
81
|
+
class ClamAV extends Context.Service()("krak-stack/ClamAV") {
|
|
82
|
+
static layerWith = (endpoint) => Layer.effect(this, ClamAV.make(endpoint));
|
|
83
|
+
static layer = Layer.effect(this, Effect.gen(function* () {
|
|
84
|
+
const host = yield* Config.schema(Schema.NonEmptyString, "CLAMAV_HOST");
|
|
85
|
+
const port = yield* Config.Port("CLAMAV_PORT").pipe(Config.withDefault(3310));
|
|
86
|
+
return yield* ClamAV.make({ host, port });
|
|
87
|
+
}));
|
|
88
|
+
static layerTest = (service) => Layer.succeed(this, service);
|
|
89
|
+
static make = (endpoint) => Effect.gen(function* () {
|
|
90
|
+
const semaphore = yield* Semaphore.make(2);
|
|
91
|
+
const scan = Effect.fn("ClamAV.scan")(function* ({
|
|
92
|
+
bytes
|
|
93
|
+
}) {
|
|
94
|
+
if (bytes.length === 0 || bytes.length > maxBytes)
|
|
95
|
+
return { _tag: "Unscannable" };
|
|
96
|
+
const line = yield* semaphore.withPermit(request(endpoint, bytes));
|
|
97
|
+
if (line === "stream: OK")
|
|
98
|
+
return { _tag: "Clean" };
|
|
99
|
+
if (/^INSTREAM size limit exceeded\.? ERROR$/.test(line))
|
|
100
|
+
return { _tag: "Unscannable" };
|
|
101
|
+
const match = /^stream: ([^\r\n]+) FOUND$/.exec(line);
|
|
102
|
+
if (match) {
|
|
103
|
+
const signature = match[1];
|
|
104
|
+
if (/^Heuristics\.(Limits\.Exceeded|Encrypted)(?:\.|$)/.test(signature)) {
|
|
105
|
+
return { _tag: "Unscannable" };
|
|
106
|
+
}
|
|
107
|
+
return { _tag: "Detected", signature };
|
|
108
|
+
}
|
|
109
|
+
return yield* new ClamAVError({
|
|
110
|
+
reason: line.endsWith(" ERROR") ? "ScanFailed" : "InvalidReply"
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
const ping = Effect.fn("ClamAV.ping")(function* () {
|
|
114
|
+
if ((yield* request(endpoint)) !== "PONG") {
|
|
115
|
+
return yield* new ClamAVError({ reason: "InvalidReply" });
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
return { scan, ping };
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
ClamAV,
|
|
123
|
+
ClamAVError
|
|
124
|
+
};
|