( value: unknown, path: string, issues: TaskNotesRuntimeQueryIssue[] )
| 3137 | } |
| 3138 | |
| 3139 | function normalizeFolderList( |
| 3140 | value: unknown, |
| 3141 | path: string, |
| 3142 | issues: TaskNotesRuntimeQueryIssue[] |
| 3143 | ): string[] | undefined { |
| 3144 | if (typeof value === "undefined") return undefined; |
| 3145 | if (!Array.isArray(value)) { |
| 3146 | issues.push({ |
| 3147 | path, |
| 3148 | code: "folder_list_invalid", |
| 3149 | message: "Runtime query folder scope must be an array of folder paths.", |
| 3150 | }); |
| 3151 | return undefined; |
| 3152 | } |
| 3153 | |
| 3154 | const folders = value |
| 3155 | .map((folder, index) => { |
| 3156 | if (typeof folder !== "string" || folder.trim().length === 0) { |
| 3157 | issues.push({ |
| 3158 | path: `${path}.${index}`, |
| 3159 | code: "folder_invalid", |
| 3160 | message: "Runtime query folder path must be a non-empty string.", |
| 3161 | }); |
| 3162 | return null; |
| 3163 | } |
| 3164 | return normalizePath(folder); |
| 3165 | }) |
| 3166 | .filter(isDefined); |
| 3167 | return folders.length > 0 ? folders : undefined; |
| 3168 | } |
| 3169 | |
| 3170 | function normalizeRuntimeValue(value: unknown): TaskNotesRuntimeValue { |
| 3171 | if (Array.isArray(value)) return value.map(normalizeRuntimeValue); |
no test coverage detected