@tthr/vue 0.0.22 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -21,12 +21,18 @@ async function loadFunctionRegistry() {
|
|
|
21
21
|
try {
|
|
22
22
|
// Try to import the user's functions index
|
|
23
23
|
// This path is relative to the Nuxt app's server runtime
|
|
24
|
-
|
|
24
|
+
console.log('[Tether] Loading custom functions from ~~/tether/functions/index.ts');
|
|
25
|
+
const functions = await import('~~/tether/functions/index.ts').catch((err) => {
|
|
26
|
+
console.warn('[Tether] Failed to import functions:', err.message);
|
|
27
|
+
return null;
|
|
28
|
+
});
|
|
25
29
|
|
|
26
30
|
if (functions) {
|
|
31
|
+
console.log('[Tether] Loaded function modules:', Object.keys(functions));
|
|
27
32
|
functionRegistry = functions;
|
|
28
33
|
} else {
|
|
29
34
|
// No custom functions found - that's OK, we'll proxy everything
|
|
35
|
+
console.log('[Tether] No custom functions found, will proxy all requests');
|
|
30
36
|
functionRegistry = {};
|
|
31
37
|
}
|
|
32
38
|
} catch (error) {
|
|
@@ -234,6 +240,7 @@ export default defineEventHandler(async (event) => {
|
|
|
234
240
|
|
|
235
241
|
// Try to find a custom function
|
|
236
242
|
const customFn = lookupFunction(body.function);
|
|
243
|
+
console.log(`[Tether] Query: ${body.function}, custom function found: ${!!customFn}`);
|
|
237
244
|
|
|
238
245
|
if (customFn) {
|
|
239
246
|
// Execute locally with database proxy
|
|
@@ -283,12 +290,14 @@ export default defineEventHandler(async (event) => {
|
|
|
283
290
|
userId: userIdentity?.subject ?? null,
|
|
284
291
|
};
|
|
285
292
|
|
|
293
|
+
console.log(`[Tether] Executing custom function: ${body.function}`);
|
|
286
294
|
const result = await customFn.handler({
|
|
287
295
|
db,
|
|
288
296
|
ctx,
|
|
289
297
|
auth,
|
|
290
298
|
args: body.args ?? {},
|
|
291
299
|
});
|
|
300
|
+
console.log(`[Tether] Function ${body.function} completed`);
|
|
292
301
|
|
|
293
302
|
return { data: result };
|
|
294
303
|
} catch (error) {
|