UNPKG

simple-task-master

Version:
43 lines 1.51 kB
"use strict"; /** * Core types and interfaces for Simple Task Master */ Object.defineProperty(exports, "__esModule", { value: true }); exports.isTask = isTask; exports.isConfig = isConfig; exports.isLockFile = isLockFile; // Type guards function isTask(obj) { const task = obj; return (typeof task === 'object' && task !== null && typeof task.schema === 'number' && typeof task.id === 'number' && typeof task.title === 'string' && typeof task.status === 'string' && ['pending', 'in-progress', 'done'].includes(task.status) && typeof task.created === 'string' && typeof task.updated === 'string' && Array.isArray(task.tags) && task.tags.every((tag) => typeof tag === 'string') && Array.isArray(task.dependencies) && task.dependencies.every((dep) => typeof dep === 'number')); } function isConfig(obj) { const config = obj; return (typeof config === 'object' && config !== null && typeof config.schema === 'number' && typeof config.lockTimeoutMs === 'number' && typeof config.maxTaskSizeBytes === 'number' && (config.tasksDir === undefined || typeof config.tasksDir === 'string')); } function isLockFile(obj) { const lock = obj; return (typeof lock === 'object' && lock !== null && typeof lock.pid === 'number' && typeof lock.command === 'string' && typeof lock.timestamp === 'number'); } //# sourceMappingURL=types.js.map