Add ifStuck/stop to frames and captured date to sequences (Refs #23)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,10 @@ import { isImageDataUrl, MAX_IMAGE_DATA_CHARS } from './images.js';
|
||||
// Item: { id, text, status: 'open'|'done'|'tbd', detail?: string }
|
||||
// Sequence (visual sequence): { id, kind: 'sequence', title, updated: 'YYYY-MM-DD',
|
||||
// frames: [Frame] } -- a numbered series of pictures with optional text.
|
||||
// Frame: { image: PNG/JPEG data URL or '', text, layout: 'right'|'under'|'none', secret?: boolean }
|
||||
// Frame: { image: PNG/JPEG data URL or '', text, layout: 'right'|'under'|'none', secret?: boolean,
|
||||
// ifStuck?: string, what to do if the screen looks different or the step fails
|
||||
// stop?: boolean } "stop here and call someone" marker; ifStuck says who/why
|
||||
// A sequence may also carry `captured: 'YYYY-MM-DD'`, set when a step is captured from the screen.
|
||||
// A sequence lives in the same ordered list as the records (records sections) or
|
||||
// items (steps / checklist sections), so it sits wherever the user puts it, but it
|
||||
// is not a record or an item (no number, no tick box). A 'text' section keeps its
|
||||
@@ -184,6 +187,7 @@ export function validate(doc) {
|
||||
if (q.kind !== 'sequence') errs.push(`${where}: kind must be "sequence"`);
|
||||
if (!isStr(q.title) || !q.title) errs.push(`${where}: missing title`);
|
||||
if (!DATE_RE.test(q.updated ?? '')) errs.push(`${where}: updated must be YYYY-MM-DD`);
|
||||
if (q.captured !== undefined && !DATE_RE.test(q.captured)) errs.push(`${where}: captured must be YYYY-MM-DD`);
|
||||
if (!Array.isArray(q.frames)) return errs.push(`${where}: frames must be an array`);
|
||||
q.frames.forEach((f, k) => {
|
||||
const fw = `${where}.frames[${k}]`;
|
||||
@@ -193,6 +197,8 @@ export function validate(doc) {
|
||||
if (!isStr(f.text)) errs.push(`${fw}: text must be a string`);
|
||||
if (!FRAME_LAYOUTS.includes(f.layout)) errs.push(`${fw}: bad layout "${f.layout}"`);
|
||||
if (f.secret !== undefined && typeof f.secret !== 'boolean') errs.push(`${fw}: secret must be a boolean`);
|
||||
if (f.ifStuck !== undefined && !isStr(f.ifStuck)) errs.push(`${fw}: ifStuck must be a string`);
|
||||
if (f.stop !== undefined && typeof f.stop !== 'boolean') errs.push(`${fw}: stop must be a boolean`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user