@tthr/vue 0.0.24 → 0.0.25
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.
|
@@ -217,7 +217,7 @@ useTetherSubscription('comments.list', undefined, (data) => {
|
|
|
217
217
|
if (!grouped[comment.postId]) {
|
|
218
218
|
grouped[comment.postId] = [];
|
|
219
219
|
}
|
|
220
|
-
grouped[comment.postId]
|
|
220
|
+
grouped[comment.postId]!.push(comment);
|
|
221
221
|
}
|
|
222
222
|
postComments.value = grouped;
|
|
223
223
|
}
|
|
@@ -251,11 +251,8 @@ async function handleCreateComment(postId: string) {
|
|
|
251
251
|
|
|
252
252
|
try {
|
|
253
253
|
await createComment.mutate({
|
|
254
|
-
id: crypto.randomUUID(),
|
|
255
254
|
postId,
|
|
256
255
|
content: newCommentText.value.trim(),
|
|
257
|
-
authorId: 'demo-user',
|
|
258
|
-
createdAt: new Date().toISOString(),
|
|
259
256
|
});
|
|
260
257
|
newCommentText.value = '';
|
|
261
258
|
// Refresh comments for this post
|
|
@@ -298,12 +295,8 @@ async function handleCreatePost() {
|
|
|
298
295
|
|
|
299
296
|
try {
|
|
300
297
|
await createPost.mutate({
|
|
301
|
-
id: crypto.randomUUID(),
|
|
302
298
|
title: newPostTitle.value.trim(),
|
|
303
299
|
content: '',
|
|
304
|
-
authorId: 'demo-user',
|
|
305
|
-
createdAt: new Date().toISOString(),
|
|
306
|
-
updatedAt: new Date().toISOString(),
|
|
307
300
|
});
|
|
308
301
|
newPostTitle.value = '';
|
|
309
302
|
await posts.refetch();
|
|
@@ -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,10 +240,12 @@ 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] Mutation: ${body.function}, custom function found: ${!!customFn}`);
|
|
237
244
|
|
|
238
245
|
if (customFn) {
|
|
239
246
|
// Execute locally with database proxy
|
|
240
247
|
try {
|
|
248
|
+
console.log(`[Tether] Executing custom mutation: ${body.function}`);
|
|
241
249
|
const db = createDatabaseProxy(apiKey, url, projectId);
|
|
242
250
|
|
|
243
251
|
// Create auth context - try to get user identity from request
|
|
@@ -296,9 +304,11 @@ export default defineEventHandler(async (event) => {
|
|
|
296
304
|
|
|
297
305
|
return { data: result };
|
|
298
306
|
} catch (error) {
|
|
307
|
+
console.error(`[Tether] Mutation ${body.function} failed:`, error);
|
|
299
308
|
throw createError({
|
|
300
309
|
statusCode: 500,
|
|
301
310
|
message: error.message || 'Mutation execution failed',
|
|
311
|
+
data: { function: body.function, error: String(error) },
|
|
302
312
|
});
|
|
303
313
|
}
|
|
304
314
|
}
|