MCPcopy Create free account
hub / github.com/InsForge/InsForge / getFunctionCode

Function getFunctionCode

functions/server.ts:81–103  ·  view source on GitHub ↗
(slug: string)

Source from the content-addressed store, hash-verified

79
80// Get function code from database
81async function getFunctionCode(slug: string): Promise<string | null> {
82 const client = new Client(dbConfig);
83
84 try {
85 await client.connect();
86
87 const result = await client.queryObject<{ code: string }>`
88 SELECT code FROM functions.definitions
89 WHERE slug = ${slug} AND status = 'active'
90 `;
91
92 if (!result.rows.length) {
93 return null;
94 }
95
96 return result.rows[0].code;
97 } catch (error) {
98 console.error(`Error fetching function ${slug}:`, error);
99 return null;
100 } finally {
101 await client.end();
102 }
103}
104
105// Get all secrets from main secrets table and decrypt them
106async function getFunctionSecrets(): Promise<Record<string, string>> {

Callers 1

server.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected