MCPcopy
hub / github.com/OpenCoworkAI/open-codesign / createDesign

Function createDesign

apps/desktop/src/main/snapshots-db.ts:161–177  ·  view source on GitHub ↗
(db: Database, name = 'Untitled design')

Source from the content-addressed store, hash-verified

159}
160
161export function createDesign(db: Database, name = 'Untitled design'): Design {
162 return mutateStore(db, (data) => {
163 const now = nowIso();
164 const design: Design = {
165 schemaVersion: 1,
166 id: crypto.randomUUID(),
167 name,
168 createdAt: now,
169 updatedAt: now,
170 thumbnailText: null,
171 deletedAt: null,
172 workspacePath: null,
173 };
174 data.designs.push(design);
175 return design;
176 });
177}
178
179export function getDesign(db: Database, id: string): Design | null {
180 return readStore(db).designs.find((design) => design.id === id) ?? null;

Calls 2

mutateStoreFunction · 0.85
nowIsoFunction · 0.85

Tested by

no test coverage detected