MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / getFakeStatementRow

Function getFakeStatementRow

desktop/artifact-state-db.test.ts:53–68  ·  view source on GitHub ↗
(normalized: string, params: unknown[])

Source from the content-addressed store, hash-verified

51}
52
53function getFakeStatementRow(normalized: string, params: unknown[]) {
54 if (normalized.startsWith('PRAGMA table_info')) return undefined
55 if (normalized.includes('FROM sqlite_master')) return undefined
56 if (normalized === 'SELECT 1 FROM artifacts WHERE id = ?') {
57 return fakeState.artifacts.has(String(params[0])) ? { 1: 1 } : undefined
58 }
59 if (normalized.includes('FROM artifacts WHERE id = ? AND conversation_id = ?')) {
60 const row = fakeState.artifacts.get(String(params[0]))
61 return row && row.conversationId === params[1] ? mapArtifact(row) : undefined
62 }
63 if (normalized.includes('FROM artifacts WHERE id = ?')) {
64 const row = fakeState.artifacts.get(String(params[0]))
65 return row ? mapArtifact(row) : undefined
66 }
67 return undefined
68}
69
70function insertFakeArtifact(params: unknown[]) {
71 const [id, conversationId, kind, content] = params.map(String)

Callers 1

createStatementFunction · 0.85

Calls 2

mapArtifactFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected