@yimingliao/cms 0.0.119 → 0.0.121
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React15 from 'react';
|
|
2
|
-
import { useState, useEffect,
|
|
2
|
+
import { useState, useEffect, useCallback, useRef } from 'react';
|
|
3
3
|
import { UAParser } from 'ua-parser-js';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -58,6 +58,76 @@ var useIsMobile = () => {
|
|
|
58
58
|
}, []);
|
|
59
59
|
return !!isMobile;
|
|
60
60
|
};
|
|
61
|
+
var usePickItems = ({ items, setPickedItems }) => {
|
|
62
|
+
const pick = useCallback(
|
|
63
|
+
(item) => {
|
|
64
|
+
if (!setPickedItems) return;
|
|
65
|
+
setPickedItems((prev) => {
|
|
66
|
+
const isSame = prev[0]?.id === item?.id;
|
|
67
|
+
if (isSame) {
|
|
68
|
+
return [];
|
|
69
|
+
} else {
|
|
70
|
+
return item ? [item] : [];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
[setPickedItems]
|
|
75
|
+
);
|
|
76
|
+
const multiPick = useCallback(
|
|
77
|
+
(item) => {
|
|
78
|
+
if (!setPickedItems) return;
|
|
79
|
+
const id = item?.id;
|
|
80
|
+
setPickedItems((prev) => {
|
|
81
|
+
const alreadyPicked = prev.some((i) => i.id === id);
|
|
82
|
+
if (alreadyPicked) {
|
|
83
|
+
return prev.filter((i) => i.id !== id);
|
|
84
|
+
} else {
|
|
85
|
+
return item ? [...prev, item] : prev;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
[setPickedItems]
|
|
90
|
+
);
|
|
91
|
+
const pickAll = useCallback(() => {
|
|
92
|
+
if (!setPickedItems || !items?.length) return;
|
|
93
|
+
setPickedItems([...items]);
|
|
94
|
+
}, [setPickedItems, items]);
|
|
95
|
+
const cancelAll = useCallback(() => {
|
|
96
|
+
if (!setPickedItems) return;
|
|
97
|
+
setPickedItems([]);
|
|
98
|
+
}, [setPickedItems]);
|
|
99
|
+
return { pick, multiPick, pickAll, cancelAll };
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// src/client/applications/form/get-control-meta.ts
|
|
103
|
+
var getControlMeta = ({
|
|
104
|
+
records,
|
|
105
|
+
excludeIndex,
|
|
106
|
+
excludeSlug
|
|
107
|
+
}) => {
|
|
108
|
+
const indexes = records.map((r) => r.index).filter(
|
|
109
|
+
(index) => typeof index === "number" && !Number.isNaN(index)
|
|
110
|
+
);
|
|
111
|
+
if (typeof excludeIndex === "number") {
|
|
112
|
+
const i = indexes.indexOf(excludeIndex);
|
|
113
|
+
if (i !== -1) indexes.splice(i, 1);
|
|
114
|
+
}
|
|
115
|
+
const existingIndexes = [...indexes].sort((a, b) => a - b);
|
|
116
|
+
const indexSet = new Set(existingIndexes);
|
|
117
|
+
let availableIndex = 1;
|
|
118
|
+
while (indexSet.has(availableIndex)) {
|
|
119
|
+
availableIndex++;
|
|
120
|
+
}
|
|
121
|
+
const existingSlugs = records.map((r) => r.slug?.trim()).filter(
|
|
122
|
+
(slug) => typeof slug === "string" && slug !== "" && slug !== excludeSlug && !records.some((r) => r.id === slug)
|
|
123
|
+
// exclude default slug = id
|
|
124
|
+
);
|
|
125
|
+
return {
|
|
126
|
+
existingIndexes,
|
|
127
|
+
availableIndex,
|
|
128
|
+
existingSlugs
|
|
129
|
+
};
|
|
130
|
+
};
|
|
61
131
|
var useCountdown = (initialTime) => {
|
|
62
132
|
const [timeLeft, setTimeLeft] = useState(initialTime);
|
|
63
133
|
const [isCounting, setIsCounting] = useState(false);
|
|
@@ -1764,4 +1834,4 @@ function Spinner({ className, ...props }) {
|
|
|
1764
1834
|
);
|
|
1765
1835
|
}
|
|
1766
1836
|
|
|
1767
|
-
export { Avatar, AvatarFallback, AvatarImage, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FORM_MIDDLE_GAP_WIDTH, FORM_SIDE_FIELDS_WIDTH, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label2 as Label, NAVBAR_HEIGHT, PAGE_HEADER_HEIGHT, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, SIDEBAR_COOKIE_NAME, SIDEBAR_WIDTH, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, cn, isConfirm, useCountdown, useDeviceInfo, useParentPathname, useSidebar };
|
|
1837
|
+
export { Avatar, AvatarFallback, AvatarImage, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FORM_MIDDLE_GAP_WIDTH, FORM_SIDE_FIELDS_WIDTH, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label2 as Label, NAVBAR_HEIGHT, PAGE_HEADER_HEIGHT, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, SIDEBAR_COOKIE_NAME, SIDEBAR_WIDTH, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, cn, getControlMeta, isConfirm, useCountdown, useDeviceInfo, useParentPathname, usePickItems, useSidebar };
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as Result, S as SuccessResult, d as ErrorResult, g as AdminFull, D as DeviceInfo } from '../types-BGsFazJr.js';
|
|
1
|
+
import { R as Result, S as SuccessResult, d as ErrorResult, g as AdminFull, D as DeviceInfo, M as MultiItems, y as SingleItem } from '../types-BGsFazJr.js';
|
|
2
2
|
import { Logger } from 'logry';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { QueryClient, UseMutationOptions, UseQueryOptions } from '@tanstack/react-query';
|
|
@@ -619,4 +619,30 @@ declare function useDeviceInfo(): DeviceInfo | null;
|
|
|
619
619
|
|
|
620
620
|
declare const cn: (...inputs: ClassValue[]) => string;
|
|
621
621
|
|
|
622
|
-
|
|
622
|
+
interface Params {
|
|
623
|
+
items?: MultiItems;
|
|
624
|
+
setPickedItems?: Dispatch<SetStateAction<MultiItems>>;
|
|
625
|
+
}
|
|
626
|
+
declare const usePickItems: ({ items, setPickedItems }: Params) => {
|
|
627
|
+
pick: (item: SingleItem) => void;
|
|
628
|
+
multiPick: (item: SingleItem) => void;
|
|
629
|
+
pickAll: () => void;
|
|
630
|
+
cancelAll: () => void;
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
type ControlRecord = {
|
|
634
|
+
id: string;
|
|
635
|
+
index: number | null;
|
|
636
|
+
slug: string | null;
|
|
637
|
+
};
|
|
638
|
+
declare const getControlMeta: ({ records, excludeIndex, excludeSlug, }: {
|
|
639
|
+
records: ControlRecord[];
|
|
640
|
+
excludeIndex?: number | null;
|
|
641
|
+
excludeSlug?: string | null;
|
|
642
|
+
}) => {
|
|
643
|
+
existingIndexes: number[];
|
|
644
|
+
availableIndex: number;
|
|
645
|
+
existingSlugs: string[];
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
export { AdminProvider, ArrayInput, Button, type ButtonProps, Checkbox, ContentContainer, ControlFields, type ControlMeta, Field, FieldBody, FieldsContainer, Form, IndexField, Input, type InputProps, LayoutSkeleton, ListCardsContainer, MainFields, NAVBAR_HEIGHT, type NavItem, NavMain, Option, PAGE_HEADER_HEIGHT, PageHeader, PasswordInput, ReturnButton, SIDEBAR_WIDTH, SearchInput, Select, type ShowToastOption, SideFields, SlugField, Textarea, ThemeProvider, cn, createAdminInitializer, createChangePasswordPage, createEmailUnverifiedPage, createForgotPasswordPage, createI18nSelector, createNavbar, createRequestInterceptor, createResetPasswordPage, createResponseInterceptor, createSignInPage, createSignOutButton, createSmartFetch, createUseCommand, createUseQuery, createVerifyEmailPage, getControlMeta, handleToast, useAdmin, useDeviceInfo, usePickItems };
|
package/dist/client/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cn, useSidebar, Sidebar, Skeleton, SidebarInset, SIDEBAR_WIDTH, SidebarGroup, SidebarMenu, Collapsible, SidebarMenuItem, SidebarMenuButton, Separator, CollapsibleTrigger, SidebarMenuAction, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, Button, Spinner, useParentPathname, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, PAGE_HEADER_HEIGHT, InputGroup, InputGroupAddon, Textarea, InputGroupInput, InputGroupButton, Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectLabel, SelectItem, Label, FORM_MIDDLE_GAP_WIDTH, FORM_SIDE_FIELDS_WIDTH, Card, useDeviceInfo, CardHeader, CardTitle, CardContent, useCountdown, CardDescription, NAVBAR_HEIGHT, isConfirm, Avatar, AvatarImage, AvatarFallback, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup, Pagination, PaginationContent, PaginationItem, PaginationPrevious, PaginationLink, PaginationEllipsis, PaginationNext } from '../chunk-
|
|
2
|
-
export { NAVBAR_HEIGHT, PAGE_HEADER_HEIGHT, SIDEBAR_WIDTH, Sidebar, SidebarContent, SidebarInset, SidebarProvider, cn, useDeviceInfo, useSidebar } from '../chunk-
|
|
1
|
+
import { cn, useSidebar, Sidebar, Skeleton, SidebarInset, SIDEBAR_WIDTH, SidebarGroup, SidebarMenu, Collapsible, SidebarMenuItem, SidebarMenuButton, Separator, CollapsibleTrigger, SidebarMenuAction, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, Button, Spinner, useParentPathname, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, PAGE_HEADER_HEIGHT, InputGroup, InputGroupAddon, Textarea, InputGroupInput, InputGroupButton, Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectLabel, SelectItem, Label, FORM_MIDDLE_GAP_WIDTH, FORM_SIDE_FIELDS_WIDTH, Card, useDeviceInfo, CardHeader, CardTitle, CardContent, useCountdown, CardDescription, NAVBAR_HEIGHT, isConfirm, Avatar, AvatarImage, AvatarFallback, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup, Pagination, PaginationContent, PaginationItem, PaginationPrevious, PaginationLink, PaginationEllipsis, PaginationNext } from '../chunk-TUHPRDMA.js';
|
|
2
|
+
export { NAVBAR_HEIGHT, PAGE_HEADER_HEIGHT, SIDEBAR_WIDTH, Sidebar, SidebarContent, SidebarInset, SidebarProvider, cn, getControlMeta, useDeviceInfo, usePickItems, useSidebar } from '../chunk-TUHPRDMA.js';
|
|
3
3
|
import { ensureArray, findTranslation, joinUrl } from '../chunk-VSV6SQWC.js';
|
|
4
4
|
import { toast } from 'sonner';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Avatar, AvatarFallback, AvatarImage, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, SIDEBAR_COOKIE_NAME, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, useSidebar } from '../../chunk-
|
|
1
|
+
export { Avatar, AvatarFallback, AvatarImage, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, SIDEBAR_COOKIE_NAME, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, useSidebar } from '../../chunk-TUHPRDMA.js';
|
package/dist/server/index.d.ts
CHANGED
|
@@ -80,6 +80,15 @@ interface CreateExecuteApiParams {
|
|
|
80
80
|
}
|
|
81
81
|
declare function createExecuteApi({ initI18n, logger }: CreateExecuteApiParams): (fn: Api) => Promise<NextResponse<unknown>>;
|
|
82
82
|
|
|
83
|
+
interface RunActionOptions<T> {
|
|
84
|
+
shouldRun?: () => boolean | Promise<boolean>;
|
|
85
|
+
onSuccess?: (data?: T) => void;
|
|
86
|
+
onError?: (e?: unknown) => void;
|
|
87
|
+
}
|
|
88
|
+
declare function createRunAction({ logger }: {
|
|
89
|
+
logger: Logger;
|
|
90
|
+
}): <D>(action: () => Promise<Result<D>>, options?: RunActionOptions<D>) => Promise<Partial<D>>;
|
|
91
|
+
|
|
83
92
|
declare const adminCreateValidator: (schemas: ReturnType<typeof createSchemas>) => zod.ZodObject<{
|
|
84
93
|
role: zod.ZodEnum<{
|
|
85
94
|
SUPER_ADMIN: "SUPER_ADMIN";
|
|
@@ -1541,4 +1550,4 @@ declare class ServerError extends Error {
|
|
|
1541
1550
|
static internalServerError(): ServerError;
|
|
1542
1551
|
}
|
|
1543
1552
|
|
|
1544
|
-
export { ADMIN_ORDER_BY, ActionContext, type AdminCreateFormData, type AdminUpdateFormData, type FileCreateFormData, type FileCreateManyFormData, type FileUpdateFormData, type FolderCreateFormData, type FolderUpdateFormData, ORDER_BY, POST_ORDER_BY, type PostCreateFormData, type PostUpdateFormData, type SeoMetadataUpsertFormData, ServerError, createAdminCreateAction, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createAdminUpdateAction, createCache, createExecuteApi, createFileCreateAction, createFileCreateManyAction, createFileFindFullAction, createFileFindListCardsAction, createFilePurgeManyAction, createFileRestoreManyAction, createFileSchema, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileUpdateAction, createFolderCreateAction, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createFolderUpdateAction, createMultiFileSchema, createPostCreateAction, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createPostUpdateAction, createSchemas, createSeoMetadataUpsertAction, createTocItemSchema, createTransporter, createZod };
|
|
1553
|
+
export { ADMIN_ORDER_BY, ActionContext, type AdminCreateFormData, type AdminUpdateFormData, type FileCreateFormData, type FileCreateManyFormData, type FileUpdateFormData, type FolderCreateFormData, type FolderUpdateFormData, ORDER_BY, POST_ORDER_BY, type PostCreateFormData, type PostUpdateFormData, type SeoMetadataUpsertFormData, ServerError, createAdminCreateAction, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createAdminUpdateAction, createCache, createExecuteApi, createFileCreateAction, createFileCreateManyAction, createFileFindFullAction, createFileFindListCardsAction, createFilePurgeManyAction, createFileRestoreManyAction, createFileSchema, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileUpdateAction, createFolderCreateAction, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createFolderUpdateAction, createMultiFileSchema, createPostCreateAction, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createPostUpdateAction, createRunAction, createSchemas, createSeoMetadataUpsertAction, createTocItemSchema, createTransporter, createZod };
|
package/dist/server/index.js
CHANGED
|
@@ -1957,7 +1957,7 @@ var normalizeError = (error, translator) => {
|
|
|
1957
1957
|
};
|
|
1958
1958
|
};
|
|
1959
1959
|
|
|
1960
|
-
// src/server/interfaces/execution/
|
|
1960
|
+
// src/server/interfaces/execution/create-execute-action.ts
|
|
1961
1961
|
function createExecuteAction({
|
|
1962
1962
|
initI18n,
|
|
1963
1963
|
cacheResult,
|
|
@@ -2012,6 +2012,32 @@ function createExecuteApi({ initI18n, logger }) {
|
|
|
2012
2012
|
};
|
|
2013
2013
|
}
|
|
2014
2014
|
|
|
2015
|
+
// src/server/interfaces/execution/create-run-action.ts
|
|
2016
|
+
function createRunAction({ logger }) {
|
|
2017
|
+
return async function runAction(action, options) {
|
|
2018
|
+
const { shouldRun, onSuccess, onError } = options || {};
|
|
2019
|
+
if (shouldRun) {
|
|
2020
|
+
const shouldProceed = await shouldRun();
|
|
2021
|
+
if (shouldProceed === false) {
|
|
2022
|
+
return {};
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
try {
|
|
2026
|
+
const response = await action();
|
|
2027
|
+
if (response.success) {
|
|
2028
|
+
const data = response.data ?? {};
|
|
2029
|
+
onSuccess?.(data);
|
|
2030
|
+
return data;
|
|
2031
|
+
}
|
|
2032
|
+
throw new Error(response.message);
|
|
2033
|
+
} catch (error) {
|
|
2034
|
+
logger.error({ error });
|
|
2035
|
+
onError?.(error);
|
|
2036
|
+
return {};
|
|
2037
|
+
}
|
|
2038
|
+
};
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2015
2041
|
// src/server/interfaces/middlewares/auth/create-auth-middleware.ts
|
|
2016
2042
|
function createAuthMiddleware({
|
|
2017
2043
|
adminRefreshTokenCommandRepository,
|
|
@@ -4356,4 +4382,4 @@ function createForgotPasswordEmail({
|
|
|
4356
4382
|
};
|
|
4357
4383
|
}
|
|
4358
4384
|
|
|
4359
|
-
export { ADMIN_ORDER_BY, ORDER_BY, POST_ORDER_BY, ServerError, createAdminCommandRepository, createAdminCreateAction, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createAdminRefreshTokenQueryRepository, createAdminUpdateAction, createArgon2Service, createAuthMiddleware, createAuthUseCases, createCache, createCacheResult, createChangePasswordAction, createCookieService, createCryptoService, createEmailUnverifiedAction, createEmailVerificationEmail, createExecuteAction, createExecuteApi, createExist, createFileCommandRepository, createFileCreateAction, createFileCreateManyAction, createFileFindFullAction, createFileFindListCardsAction, createFilePurgeManyAction, createFileQueryRepository, createFileRestoreManyAction, createFileSchema, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileUpdateAction, createFolderCommandRepository, createFolderCreateAction, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createFolderQueryRepository, createFolderUpdateAction, createForgotPasswordAction, createForgotPasswordEmail, createIpRateLimiter, createJwtService, createMultiFileSchema, createPostCommandRepository, createPostCreateAction, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createPostQueryRepository, createPostUpdateAction, createRenderEmailTemplate, createResetPasswordAction, createSchemas, createSendEmail, createSeoMetadataCommandRepository, createSeoMetadataUpsertAction, createSignInAction, createSignOutAction, createTocItemSchema, createTransporter, createUnique, createVerifyAccessToken, createVerifyAction, createVerifyEmailAction, createVerifyRefreshToken, createZod, normalizeCacheKey };
|
|
4385
|
+
export { ADMIN_ORDER_BY, ORDER_BY, POST_ORDER_BY, ServerError, createAdminCommandRepository, createAdminCreateAction, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createAdminRefreshTokenQueryRepository, createAdminUpdateAction, createArgon2Service, createAuthMiddleware, createAuthUseCases, createCache, createCacheResult, createChangePasswordAction, createCookieService, createCryptoService, createEmailUnverifiedAction, createEmailVerificationEmail, createExecuteAction, createExecuteApi, createExist, createFileCommandRepository, createFileCreateAction, createFileCreateManyAction, createFileFindFullAction, createFileFindListCardsAction, createFilePurgeManyAction, createFileQueryRepository, createFileRestoreManyAction, createFileSchema, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileUpdateAction, createFolderCommandRepository, createFolderCreateAction, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createFolderQueryRepository, createFolderUpdateAction, createForgotPasswordAction, createForgotPasswordEmail, createIpRateLimiter, createJwtService, createMultiFileSchema, createPostCommandRepository, createPostCreateAction, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createPostQueryRepository, createPostUpdateAction, createRenderEmailTemplate, createResetPasswordAction, createRunAction, createSchemas, createSendEmail, createSeoMetadataCommandRepository, createSeoMetadataUpsertAction, createSignInAction, createSignOutAction, createTocItemSchema, createTransporter, createUnique, createVerifyAccessToken, createVerifyAction, createVerifyEmailAction, createVerifyRefreshToken, createZod, normalizeCacheKey };
|