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

Function readOrderedArray

projects/openade-module/src/nodeYjsStorage.ts:236–251  ·  view source on GitHub ↗
(documentId: string, name: string)

Source from the content-addressed store, hash-verified

234 }
235 },
236 async readOrderedArray<T extends Record<string, unknown>>(documentId: string, name: string): Promise<T[] | null> {
237 const doc = await loadDoc(documentId)
238 if (!doc) return null
239 try {
240 const dataMap = doc.getMap(`${name}:data`)
241 const orderArray = doc.getArray<string>(`${name}:order`)
242 const rows: T[] = []
243 for (const id of orderArray.toArray()) {
244 const row = toPlain(dataMap.get(id))
245 if (isRecord(row)) rows.push(row as T)
246 }
247 return rows
248 } finally {
249 doc.destroy()
250 }
251 },
252 }
253}

Callers

nothing calls this directly

Calls 6

pushMethod · 0.80
destroyMethod · 0.80
loadDocFunction · 0.70
toPlainFunction · 0.70
isRecordFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected