@betterinternship/components 2.9.5 → 2.9.6
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/dist/components/ui/animated-count.js.map +1 -1
- package/dist/components/ui/fab.js +9 -9
- package/dist/components/ui/input.js +2 -2
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/status-notice.js.map +1 -1
- package/dist/config.d.ts +6 -6
- package/dist/config.js +9 -9
- package/dist/hooks/useClientProcess.d.ts +69 -69
- package/dist/hooks/useClientProcess.js +255 -255
- package/dist/hooks/useMQJob.js.map +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +249 -249
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animated-count.js","sources":["../../../src/components/ui/animated-count.tsx"],"sourcesContent":["import { useRef, useEffect } from 'react';\
|
|
1
|
+
{"version":3,"file":"animated-count.js","sources":["../../../src/components/ui/animated-count.tsx"],"sourcesContent":["import { useRef, useEffect } from 'react';\nimport { AnimatePresence, motion, useReducedMotion } from 'framer-motion';\n\n/**\n * A number that rolls up or down when its value changes.\n * @prop value The number displayed by the component.\n */\nexport const AnimatedCount = ({ value }: { value: number }) => {\n const reduceMotion = useReducedMotion();\n const prev = useRef(value);\n const direction = value >= prev.current ? 1 : -1;\n\n useEffect(() => {\n prev.current = value;\n }, [value]);\n\n return (\n <span className=\"relative inline-flex justify-center overflow-hidden tabular-nums\">\n {/* keeps the box the right width without clipping the rolling digit */}\n <span className=\"invisible\">{value}</span>\n <AnimatePresence initial={false}>\n <motion.span\n key={value}\n className=\"absolute inset-0 flex items-center justify-center\"\n initial={\n reduceMotion ? false : { y: `${direction * 100}%`, opacity: 0 }\n }\n animate={{ y: '0%', opacity: 1 }}\n exit={\n reduceMotion\n ? { opacity: 0 }\n : { y: `${direction * -100}%`, opacity: 0 }\n }\n transition={{ duration: 0.18, ease: 'easeOut' }}\n >\n {value}\n </motion.span>\n </AnimatePresence>\n </span>\n );\n};\n\nex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EX;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { Button } from './button.js';
|
|
3
|
-
|
|
4
|
-
const FloatingActionButton = ({ onClick, children }) => {
|
|
5
|
-
return (jsx(Button, { onClick: onClick, className: "fixed bottom-4 right-4 z-50 rounded-full p-4 shadow-lg bg-primary text-white hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary", children: children }));
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export { FloatingActionButton };
|
|
9
|
-
//# sourceMappingURL=fab.js.map
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Button } from './button.js';
|
|
3
|
+
|
|
4
|
+
const FloatingActionButton = ({ onClick, children }) => {
|
|
5
|
+
return (jsx(Button, { onClick: onClick, className: "fixed bottom-4 right-4 z-50 rounded-full p-4 shadow-lg bg-primary text-white hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary", children: children }));
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { FloatingActionButton };
|
|
9
|
+
//# sourceMappingURL=fab.js.map
|
|
@@ -7,9 +7,9 @@ const Input = React.forwardRef(({ className, type, disabled, ...props }, ref) =>
|
|
|
7
7
|
const [passwordVisible, setPasswordVisible] = React.useState(false);
|
|
8
8
|
if (type === 'password') {
|
|
9
9
|
const Icon = passwordVisible ? EyeOff : Eye;
|
|
10
|
-
return (jsxs("div", { className: "relative", children: [jsx("input", { type: passwordVisible ? 'text' : 'password', className: cn('bg-background pointer-events-auto relative z-10 box-border flex h-8 min-h-8 max-h-8 w-full rounded-[0.33em] border border-gray-
|
|
10
|
+
return (jsxs("div", { className: "relative", children: [jsx("input", { type: passwordVisible ? 'text' : 'password', className: cn('bg-background pointer-events-auto relative z-10 box-border flex h-8 min-h-8 max-h-8 w-full rounded-[0.33em] border border-gray-300 px-[0.75em] py-0 pr-10 text-base ring-0 focus:ring-transparent sm:text-sm', 'file:text-foreground placeholder:text-muted-foreground/40 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50', className), ref: ref, disabled: disabled, ...props }), jsx("button", { type: "button", className: "text-muted-foreground hover:text-foreground absolute inset-y-0 right-0 z-20 flex w-10 items-center justify-center disabled:cursor-not-allowed disabled:opacity-50", onClick: () => setPasswordVisible((current) => !current), disabled: disabled, "aria-label": passwordVisible ? 'Hide password' : 'Show password', "aria-pressed": passwordVisible, children: jsx(Icon, { className: "h-4 w-4", "aria-hidden": "true" }) })] }));
|
|
11
11
|
}
|
|
12
|
-
return (jsx("input", { type: type, className: cn('bg-background pointer-events-auto relative z-10 box-border flex h-8 min-h-8 max-h-8 w-full rounded-[0.33em] border border-gray-
|
|
12
|
+
return (jsx("input", { type: type, className: cn('bg-background pointer-events-auto relative z-10 box-border flex h-8 min-h-8 max-h-8 w-full rounded-[0.33em] border border-gray-300 px-[0.75em] py-0 text-base ring-0 focus:ring-transparent sm:text-sm', 'file:text-foreground placeholder:text-muted-foreground/40 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50', className), ref: ref, disabled: disabled, ...props }));
|
|
13
13
|
});
|
|
14
14
|
Input.displayName = 'Input';
|
|
15
15
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sources":["../../../src/components/ui/input.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Eye, EyeOff } from 'lucide-react';\n\nimport { cn } from '@/utils';\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<'input'>>(\n ({ className, type, disabled, ...props }, ref) => {\n const [passwordVisible, setPasswordVisible] = React.useState(false);\n\n if (type === 'password') {\n const Icon = passwordVisible ? EyeOff : Eye;\n\n return (\n <div className=\"relative\">\n <input\n type={passwordVisible ? 'text' : 'password'}\n className={cn(\n 'bg-background pointer-events-auto relative z-10 box-border flex h-8 min-h-8 max-h-8 w-full rounded-[0.33em] border border-gray-
|
|
1
|
+
{"version":3,"file":"input.js","sources":["../../../src/components/ui/input.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Eye, EyeOff } from 'lucide-react';\n\nimport { cn } from '@/utils';\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<'input'>>(\n ({ className, type, disabled, ...props }, ref) => {\n const [passwordVisible, setPasswordVisible] = React.useState(false);\n\n if (type === 'password') {\n const Icon = passwordVisible ? EyeOff : Eye;\n\n return (\n <div className=\"relative\">\n <input\n type={passwordVisible ? 'text' : 'password'}\n className={cn(\n 'bg-background pointer-events-auto relative z-10 box-border flex h-8 min-h-8 max-h-8 w-full rounded-[0.33em] border border-gray-300 px-[0.75em] py-0 pr-10 text-base ring-0 focus:ring-transparent sm:text-sm',\n 'file:text-foreground placeholder:text-muted-foreground/40 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n ref={ref}\n disabled={disabled}\n {...props}\n />\n <button\n type=\"button\"\n className=\"text-muted-foreground hover:text-foreground absolute inset-y-0 right-0 z-20 flex w-10 items-center justify-center disabled:cursor-not-allowed disabled:opacity-50\"\n onClick={() => setPasswordVisible((current) => !current)}\n disabled={disabled}\n aria-label={passwordVisible ? 'Hide password' : 'Show password'}\n aria-pressed={passwordVisible}\n >\n <Icon className=\"h-4 w-4\" aria-hidden=\"true\" />\n </button>\n </div>\n );\n }\n\n return (\n <input\n type={type}\n className={cn(\n 'bg-background pointer-events-auto relative z-10 box-border flex h-8 min-h-8 max-h-8 w-full rounded-[0.33em] border border-gray-300 px-[0.75em] py-0 text-base ring-0 focus:ring-transparent sm:text-sm',\n 'file:text-foreground placeholder:text-muted-foreground/40 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n ref={ref}\n disabled={disabled}\n {...props}\n />\n );\n },\n);\nInput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,EAAA,GACd,KAAK,EAAA,CACT;AAEN,CAAC;AAEH,KAAK,CAAC,WAAW,GAAG,OAAO;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-notice.js","sources":["../../../src/components/ui/status-notice.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from \"react\";\
|
|
1
|
+
{"version":3,"file":"status-notice.js","sources":["../../../src/components/ui/status-notice.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport { cn } from \"@/utils\";\n\ntype StatusNoticeVariant = \"primary\" | \"warning\" | \"destructive\";\n\nconst variantClasses: Record<\n StatusNoticeVariant,\n { container: string; icon: string }\n> = {\n primary: {\n container:\n \"border-primary/25 bg-primary/[0.035] transition-colors hover:bg-primary/[0.06]\",\n icon: \"bg-primary/5 text-primary\",\n },\n warning: {\n container:\n \"border-warning/30 bg-warning/10 transition-colors hover:bg-warning/15\",\n icon: \"bg-warning/10 text-warning\",\n },\n destructive: {\n container:\n \"border-destructive/30 bg-destructive/5 transition-colors hover:bg-destructive/10\",\n icon: \"bg-destructive/10 text-destructive\",\n },\n};\n\nfunction StatusNotice({\n icon: Icon,\n media,\n title,\n description,\n action,\n actionClassName,\n variant = \"primary\",\n compact = false,\n className,\n ...props\n}: ComponentProps<\"div\"> & {\n icon?: LucideIcon;\n media?: ReactNode;\n title: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n actionClassName?: string;\n variant?: StatusNoticeVariant;\n compact?: boolean;\n}) {\n const styles = variantClasses[variant];\n\n return (\n <div\n data-slot=\"status-notice\"\n className={cn(\n \"group/status-notice flex flex-col rounded-[0.33em] border\",\n compact\n ? \"items-start gap-3 p-3 sm:flex-row sm:items-start sm:gap-2\"\n : \"gap-4 px-4 py-4 sm:flex-row sm:items-stretch sm:gap-3 sm:px-5\",\n styles.container,\n className,\n )}\n {...props}\n >\n <div\n className={cn(\n \"flex min-w-0 flex-1 items-start gap-3 sm:items-stretch sm:gap-3\",\n compact && \"gap-2 sm:items-start sm:gap-2\",\n )}\n >\n <span\n className={cn(\n \"flex shrink-0 items-center justify-center rounded-[0.33em]\",\n compact ? \"size-8\" : \"size-10 sm:self-center\",\n styles.icon,\n )}\n >\n {media ??\n (Icon && (\n <Icon\n className={compact ? \"size-4\" : \"size-5\"}\n aria-hidden=\"true\"\n />\n ))}\n </span>\n <div className=\"min-w-0 flex-1 space-y-0.5\">\n <p className=\"text-sm font-medium text-gray-900\">{title}</p>\n {description && (\n <div className=\"text-muted-foreground text-sm\">{description}</div>\n )}\n </div>\n </div>\n {action && (\n <div\n className={cn(\n \"w-full shrink-0 sm:w-auto sm:self-center\",\n actionClassName,\n )}\n >\n {action}\n </div>\n )}\n </div>\n );\n}\n\nexport { StatusNotice, type StatusNoticeVariant };\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAMA,MAAM,cAAc,GAGhB;AACF,IAAA,OAAO,EAAE;AACP,QAAA,SAAS,EACP,gFAAgF;AAClF,QAAA,IAAI,EAAE,2BAA2B;AAClC,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,SAAS,EACP,uEAAuE;AACzE,QAAA,IAAI,EAAE,4BAA4B;AACnC,KAAA;AACD,IAAA,WAAW,EAAE;AACX,QAAA,SAAS,EACP,kFAAkF;AACpF,QAAA,IAAI,EAAE,oCAAoC;AAC3C,KAAA;CACF;AAED,SAAS,YAAY,CAAC,EACpB,IAAI,EAAE,IAAI,EACV,KAAK,EACL,KAAK,EACL,WAAW,EACX,MAAM,EACN,eAAe,EACf,OAAO,GAAG,SAAS,EACnB,OAAO,GAAG,KAAK,EACf,SAAS,EACT,GAAG,KAAK,EAUT,EAAA;AACC,IAAA,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC;IAEtC,QACEA,IAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EACY,eAAe,EACzB,SAAS,EAAE,EAAE,CACX,2DAA2D,EAC3D;AACE,cAAE;cACA,+DAA+D,EACnE,MAAM,CAAC,SAAS,EAChB,SAAS,CACV,EAAA,GACG,KAAK,EAAA,QAAA,EAAA,CAETA,IAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,iEAAiE,EACjE,OAAO,IAAI,+BAA+B,CAC3C,aAEDC,GAAA,CAAA,MAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,4DAA4D,EAC5D,OAAO,GAAG,QAAQ,GAAG,wBAAwB,EAC7C,MAAM,CAAC,IAAI,CACZ,EAAA,QAAA,EAEA,KAAK;AACJ,6BAAC,IAAI,KACHA,GAAA,CAAC,IAAI,EAAA,EACH,SAAS,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,EAAA,aAAA,EAC5B,MAAM,EAAA,CAClB,CACH,CAAC,GACC,EACPD,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,4BAA4B,EAAA,QAAA,EAAA,CACzCC,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,mCAAmC,EAAA,QAAA,EAAE,KAAK,EAAA,CAAK,EAC3D,WAAW,KACVA,aAAK,SAAS,EAAC,+BAA+B,EAAA,QAAA,EAAE,WAAW,EAAA,CAAO,CACnE,CAAA,EAAA,CACG,IACF,EACL,MAAM,KACLA,GAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,0CAA0C,EAC1C,eAAe,CAChB,YAEA,MAAM,EAAA,CACH,CACP,CAAA,EAAA,CACG;AAEV;;;;"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
interface PackageConfig {
|
|
2
|
-
orchestratorApi: string;
|
|
3
|
-
}
|
|
4
|
-
export declare let config: PackageConfig;
|
|
5
|
-
export declare const configure: (newConfig: PackageConfig) => void;
|
|
6
|
-
export {};
|
|
1
|
+
interface PackageConfig {
|
|
2
|
+
orchestratorApi: string;
|
|
3
|
+
}
|
|
4
|
+
export declare let config: PackageConfig;
|
|
5
|
+
export declare const configure: (newConfig: PackageConfig) => void;
|
|
6
|
+
export {};
|
package/dist/config.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
let config = {
|
|
2
|
-
orchestratorApi: 'https://orca.betterinternship.com/process',
|
|
3
|
-
};
|
|
4
|
-
const configure = (newConfig) => {
|
|
5
|
-
config = { ...config, ...newConfig };
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export { config, configure };
|
|
9
|
-
//# sourceMappingURL=config.js.map
|
|
1
|
+
let config = {
|
|
2
|
+
orchestratorApi: 'https://orca.betterinternship.com/process',
|
|
3
|
+
};
|
|
4
|
+
const configure = (newConfig) => {
|
|
5
|
+
config = { ...config, ...newConfig };
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { config, configure };
|
|
9
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
interface ClientProcess<T> {
|
|
2
|
-
dto?: ProcessCallbackDto;
|
|
3
|
-
metadata?: ClientProcessMetadata;
|
|
4
|
-
options?: ClientProcessOptions;
|
|
5
|
-
result?: T;
|
|
6
|
-
success?: boolean;
|
|
7
|
-
pending?: boolean;
|
|
8
|
-
error?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface ProcessCallbackDto {
|
|
11
|
-
processId: string;
|
|
12
|
-
processName: string;
|
|
13
|
-
processCallbackUrl: string;
|
|
14
|
-
}
|
|
15
|
-
export interface ClientProcessOptions {
|
|
16
|
-
onLoading?: (processId: string, processName: string) => void;
|
|
17
|
-
onSuccess?: <R>(processId: string, processName: string, result: R) => void;
|
|
18
|
-
onFailure?: (processId: string, processName: string, error?: string) => void;
|
|
19
|
-
}
|
|
20
|
-
export interface ClientProcessMetadata {
|
|
21
|
-
filterKey: string;
|
|
22
|
-
metadata?: Record<string, string>;
|
|
23
|
-
}
|
|
24
|
-
export interface ProcessResponse {
|
|
25
|
-
processId: string;
|
|
26
|
-
processName: string;
|
|
27
|
-
processCallbackUrl: string;
|
|
28
|
-
success: boolean;
|
|
29
|
-
message?: string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* This should be at the root layout.
|
|
33
|
-
*
|
|
34
|
-
* @context
|
|
35
|
-
*/
|
|
36
|
-
export declare const ClientProcessesProvider: ({ children, }: {
|
|
37
|
-
children: React.ReactNode;
|
|
38
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
-
/**
|
|
40
|
-
* A simpler version, where u just pass the async function that returns process data.
|
|
41
|
-
*
|
|
42
|
-
* @param caller
|
|
43
|
-
* @returns
|
|
44
|
-
*/
|
|
45
|
-
export declare function useClientProcess<T, R>({ caller, invalidator, filterKey, onLoading, onSuccess, onFailure, }: {
|
|
46
|
-
caller?: (inputs: T) => Promise<ProcessResponse>;
|
|
47
|
-
invalidator?: (result: R) => boolean;
|
|
48
|
-
filterKey: string;
|
|
49
|
-
onLoading?: (processId: string, processName: string) => void;
|
|
50
|
-
onSuccess?: <R>(processId: string, processName: string, result: R) => void;
|
|
51
|
-
onFailure?: (processId: string, processName: string, error?: string) => void;
|
|
52
|
-
}): {
|
|
53
|
-
run: (inputs: T, metadata?: Record<string, string>) => Promise<{
|
|
54
|
-
id: string;
|
|
55
|
-
success: boolean;
|
|
56
|
-
message: string | undefined;
|
|
57
|
-
} | {
|
|
58
|
-
id: null;
|
|
59
|
-
success: boolean;
|
|
60
|
-
message: string;
|
|
61
|
-
}>;
|
|
62
|
-
get: (id: string) => ClientProcess<unknown> | null;
|
|
63
|
-
getAll: () => ClientProcess<unknown>[];
|
|
64
|
-
getAllPending: () => ClientProcess<unknown>[];
|
|
65
|
-
getAllHandled: () => ClientProcess<unknown>[];
|
|
66
|
-
getAllFailed: () => ClientProcess<unknown>[];
|
|
67
|
-
refreshCache: () => Promise<void>;
|
|
68
|
-
};
|
|
69
|
-
export {};
|
|
1
|
+
interface ClientProcess<T> {
|
|
2
|
+
dto?: ProcessCallbackDto;
|
|
3
|
+
metadata?: ClientProcessMetadata;
|
|
4
|
+
options?: ClientProcessOptions;
|
|
5
|
+
result?: T;
|
|
6
|
+
success?: boolean;
|
|
7
|
+
pending?: boolean;
|
|
8
|
+
error?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ProcessCallbackDto {
|
|
11
|
+
processId: string;
|
|
12
|
+
processName: string;
|
|
13
|
+
processCallbackUrl: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ClientProcessOptions {
|
|
16
|
+
onLoading?: (processId: string, processName: string) => void;
|
|
17
|
+
onSuccess?: <R>(processId: string, processName: string, result: R) => void;
|
|
18
|
+
onFailure?: (processId: string, processName: string, error?: string) => void;
|
|
19
|
+
}
|
|
20
|
+
export interface ClientProcessMetadata {
|
|
21
|
+
filterKey: string;
|
|
22
|
+
metadata?: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
export interface ProcessResponse {
|
|
25
|
+
processId: string;
|
|
26
|
+
processName: string;
|
|
27
|
+
processCallbackUrl: string;
|
|
28
|
+
success: boolean;
|
|
29
|
+
message?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* This should be at the root layout.
|
|
33
|
+
*
|
|
34
|
+
* @context
|
|
35
|
+
*/
|
|
36
|
+
export declare const ClientProcessesProvider: ({ children, }: {
|
|
37
|
+
children: React.ReactNode;
|
|
38
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* A simpler version, where u just pass the async function that returns process data.
|
|
41
|
+
*
|
|
42
|
+
* @param caller
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
export declare function useClientProcess<T, R>({ caller, invalidator, filterKey, onLoading, onSuccess, onFailure, }: {
|
|
46
|
+
caller?: (inputs: T) => Promise<ProcessResponse>;
|
|
47
|
+
invalidator?: (result: R) => boolean;
|
|
48
|
+
filterKey: string;
|
|
49
|
+
onLoading?: (processId: string, processName: string) => void;
|
|
50
|
+
onSuccess?: <R>(processId: string, processName: string, result: R) => void;
|
|
51
|
+
onFailure?: (processId: string, processName: string, error?: string) => void;
|
|
52
|
+
}): {
|
|
53
|
+
run: (inputs: T, metadata?: Record<string, string>) => Promise<{
|
|
54
|
+
id: string;
|
|
55
|
+
success: boolean;
|
|
56
|
+
message: string | undefined;
|
|
57
|
+
} | {
|
|
58
|
+
id: null;
|
|
59
|
+
success: boolean;
|
|
60
|
+
message: string;
|
|
61
|
+
}>;
|
|
62
|
+
get: (id: string) => ClientProcess<unknown> | null;
|
|
63
|
+
getAll: () => ClientProcess<unknown>[];
|
|
64
|
+
getAllPending: () => ClientProcess<unknown>[];
|
|
65
|
+
getAllHandled: () => ClientProcess<unknown>[];
|
|
66
|
+
getAllFailed: () => ClientProcess<unknown>[];
|
|
67
|
+
refreshCache: () => Promise<void>;
|
|
68
|
+
};
|
|
69
|
+
export {};
|