MCPcopy
hub / github.com/simstudioai/sim / makeTx

Function makeTx

apps/sim/lib/workspaces/fork/copy/copy-resources.test.ts:370–386  ·  view source on GitHub ↗
(docs: ReturnType<typeof sourceRow>[])

Source from the content-addressed store, hash-verified

368 })
369
370 function makeTx(docs: ReturnType<typeof sourceRow>[]) {
371 const inserted: Array<Record<string, unknown>> = []
372 let selectCalled = false
373 const tx = {
374 select: () => {
375 selectCalled = true
376 return { from: () => ({ where: () => Promise.resolve(docs) }) }
377 },
378 insert: () => ({
379 values: (rows: Array<Record<string, unknown>>) => {
380 inserted.push(...rows)
381 return Promise.resolve()
382 },
383 }),
384 }
385 return { tx: tx as unknown as DbOrTx, inserted, wasSelectCalled: () => selectCalled }
386 }
387
388 const mappedKbResolver: ForkReferenceResolver = (kind, id) =>
389 kind === 'knowledge-base' && id === 'src-kb' ? 'target-kb' : null

Callers 1

Calls 2

resolveMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected