Files
wehub-resource-sync 2114b14ee0
Sync main into demo / sync (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:26 +08:00

29 lines
813 B
TypeScript

import defaults from './defaults.json';
import { NOTES_CONSTANTS } from '../constants';
import * as TimeService from '../../../os/TimeService';
import type { Note, NotesTodo } from '../types';
const parseTimestamp = (value: unknown): number => {
if (typeof value === 'number' && Number.isFinite(value)) return value;
if (typeof value === 'string') return TimeService.parseToTimestamp(value);
return 0;
};
const sampleNotes = (defaults.sampleNotes ?? []).map((note) => ({
...note,
updatedAt: parseTimestamp((note as any).updatedAt),
})) as Note[];
const sampleTodos = (defaults.sampleTodos ?? []).map((todo) => ({
...todo,
updatedAt: parseTimestamp((todo as any).updatedAt),
})) as NotesTodo[];
export const NOTES_CONFIG = {
...NOTES_CONSTANTS,
...defaults,
sampleNotes,
sampleTodos,
};