@@ -1,9 +0,0 @@
|
||||
import { z } from 'zod';
|
||||
import { advancedCameraCardCustomActionsBaseSchema } from './base';
|
||||
|
||||
export const foldersViewActionConfigSchema =
|
||||
advancedCameraCardCustomActionsBaseSchema.extend({
|
||||
advanced_camera_card_action: z.literal('folders').or(z.literal('folder')),
|
||||
folder: z.string().optional(),
|
||||
});
|
||||
export type FoldersViewActionConfig = z.infer<typeof foldersViewActionConfigSchema>;
|
||||
@@ -1,23 +1,9 @@
|
||||
import { z } from 'zod';
|
||||
import {
|
||||
AdvancedCameraCardUserSpecifiedView,
|
||||
VIEWS_USER_SPECIFIED,
|
||||
} from '../../common/const';
|
||||
import { VIEWS_USER_SPECIFIED } from '../../common/const';
|
||||
import { advancedCameraCardCustomActionsBaseSchema } from './base';
|
||||
|
||||
type AdvancedCameraCardUserSpecifiedViewWithoutFolder = Exclude<
|
||||
AdvancedCameraCardUserSpecifiedView,
|
||||
'folder' | 'folders'
|
||||
>;
|
||||
|
||||
export const viewActionConfigSchema = advancedCameraCardCustomActionsBaseSchema.extend({
|
||||
advanced_camera_card_action: z.enum(
|
||||
// The folder/folders views are handled separately as they accept an
|
||||
// optional folder ID.
|
||||
VIEWS_USER_SPECIFIED.filter((view) => view !== 'folder' && view !== 'folders') as [
|
||||
AdvancedCameraCardUserSpecifiedViewWithoutFolder,
|
||||
...AdvancedCameraCardUserSpecifiedViewWithoutFolder[],
|
||||
],
|
||||
),
|
||||
advanced_camera_card_action: z.enum(VIEWS_USER_SPECIFIED),
|
||||
folder: z.string().optional(),
|
||||
});
|
||||
export type ViewActionConfig = z.infer<typeof viewActionConfigSchema>;
|
||||
|
||||
Reference in New Issue
Block a user