MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / convertCache

Function convertCache

app/src/server/utils/nodes/convertCache.ts:3–41  ·  view source on GitHub ↗
({ nodeHash, nodeId }: { nodeHash: string; nodeId: string })

Source from the content-addressed store, hash-verified

1import { kysely } from "~/server/db";
2
3export const convertCache = async ({ nodeHash, nodeId }: { nodeHash: string; nodeId: string }) => {
4 await kysely
5 .insertInto("CachedProcessedEntry")
6 .columns([
7 "incomingInputHash",
8 "incomingOutputHash",
9 "outgoingInputHash",
10 "outgoingOutputHash",
11 "filterOutcome",
12 "explanation",
13 "createdAt",
14 "updatedAt",
15 "nodeId",
16 ])
17 .expression((eb) =>
18 eb
19 .selectFrom("CachedProcessedEntry as new")
20 .select((eb) => [
21 "incomingInputHash",
22 "incomingOutputHash",
23 "outgoingInputHash",
24 "outgoingOutputHash",
25 "filterOutcome",
26 "explanation",
27 "createdAt",
28 "updatedAt",
29 eb.val(nodeId).as("nodeId"),
30 ])
31 .where("nodeHash", "=", nodeHash)
32 .leftJoin("CachedProcessedEntry as existing", (join) =>
33 join
34 .onRef("existing.incomingInputHash", "=", "new.incomingInputHash")
35 .onRef("existing.incomingOutputHash", "=", "new.incomingOutputHash")
36 .onRef("existing.nodeHash", "=", "new.nodeHash"),
37 )
38 .where("existing.nodeHash", "is", null),
39 )
40 .execute();
41};

Callers 1

monitors.router.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected