MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / ensureTaskPreview

Function ensureTaskPreview

projects/openade-module/src/yjsMutation.ts:211–219  ·  view source on GitHub ↗
(repoMap: Y.Map<unknown>, preview: { id: string; slug: string; title: string; createdAt: string }, updatedAt: string)

Source from the content-addressed store, hash-verified

209}
210
211function ensureTaskPreview(repoMap: Y.Map<unknown>, preview: { id: string; slug: string; title: string; createdAt: string }, updatedAt: string): void {
212 const tasks = ensureYArray(repoMap, "tasks")
213 const existing = tasks.toArray().some((task) => {
214 const plain = toPlain(task)
215 return isRecord(plain) && plain.id === preview.id
216 })
217 if (!existing) tasks.push([toYValue(preview)])
218 repoMap.set("updatedAt", updatedAt)
219}
220
221function deleteTaskPreview(repoMap: Y.Map<unknown>, taskId: string, updatedAt: string): boolean {
222 const tasks = ensureYArray(repoMap, "tasks")

Callers 1

createTaskFunction · 0.85

Calls 6

ensureYArrayFunction · 0.85
toYValueFunction · 0.85
pushMethod · 0.80
toPlainFunction · 0.70
isRecordFunction · 0.70
setMethod · 0.65

Tested by

no test coverage detected