x
This commit is contained in:
1 parent
ce6fa69b09
commit
716bb98b50
4 files changed
+11
-8
No files matched your search
@@ -191,7 +191,7 @@ export const MENU_TOOL_DEFINITIONS = [
|
||||
}
|
||||
] as const;
|
||||
|
||||
export const MENU_TOOL_NAMES = new Set(MENU_TOOL_DEFINITIONS.map((tool) => tool.name));
|
||||
export const MENU_TOOL_NAMES = new Set<string>(MENU_TOOL_DEFINITIONS.map((tool) => tool.name));
|
||||
|
||||
export async function handleMenuTool(api: AxiosInstance, name: string, params: any) {
|
||||
if (!MENU_TOOL_NAMES.has(name)) return null;
|
||||
|
||||
@@ -142,16 +142,17 @@ function validateMenuNodeData(nodeData: any, parentId?: string | null) {
|
||||
|
||||
function validateMenuTranslations(translations: any) {
|
||||
const issues: string[] = [];
|
||||
const warnings: string[] = [];
|
||||
if (!isPlainObject(translations)) {
|
||||
issues.push("translations must be a plain object");
|
||||
return { issues };
|
||||
return { issues, warnings };
|
||||
}
|
||||
for (const [key, value] of Object.entries(translations)) {
|
||||
if (typeof value !== "string") {
|
||||
issues.push(`translation for "${key}" must be a string`);
|
||||
}
|
||||
}
|
||||
return { issues };
|
||||
return { issues, warnings };
|
||||
}
|
||||
|
||||
function validateMenuItems(items: any) {
|
||||
|
||||
@@ -253,7 +253,7 @@ export const SECTION_TOOL_DEFINITIONS = [
|
||||
}
|
||||
] as const;
|
||||
|
||||
export const SECTION_TOOL_NAMES = new Set(SECTION_TOOL_DEFINITIONS.map((tool) => tool.name));
|
||||
export const SECTION_TOOL_NAMES = new Set<string>(SECTION_TOOL_DEFINITIONS.map((tool) => tool.name));
|
||||
|
||||
export async function handleSectionTool(api: AxiosInstance, name: string, params: any) {
|
||||
if (!SECTION_TOOL_NAMES.has(name)) return null;
|
||||
|
||||
Reference in new issue
Block a user