MCPcopy Create free account
hub / github.com/CatMuse/HiNote / validateFileMappingData

Method validateFileMappingData

src/storage/DataValidator.ts:204–225  ·  view source on GitHub ↗

* 验证文件映射数据 * @param data 映射数据 * @returns 验证结果

(data: unknown)

Source from the content-addressed store, hash-verified

202 * @returns 验证结果
203 */
204 static validateFileMappingData(data: unknown): { valid: boolean; errors: string[] } {
205 const errors: string[] = [];
206
207 if (!this.isRecord(data)) {
208 errors.push('映射数据必须是对象');
209 return { valid: false, errors };
210 }
211
212 if (!data.version || typeof data.version !== 'string') {
213 errors.push('缺少有效的版本信息');
214 }
215
216 if (!data.mapping || typeof data.mapping !== 'object') {
217 errors.push('缺少mapping对象');
218 }
219
220 if (typeof data.lastUpdated !== 'number') {
221 errors.push('lastUpdated必须是数字');
222 }
223
224 return { valid: errors.length === 0, errors };
225 }
226
227 /**
228 * 清理和标准化高亮数据

Callers 1

loadMethod · 0.80

Calls 1

isRecordMethod · 0.95

Tested by

no test coverage detected