Update packages and refactor logging in diverse services

This commit updates diverse packages such as "@makerkit/data-loader-supabase-core" and "@makerkit/data-loader-supabase-nextjs" to the new versions in the package.json files. Also, several refactorings were done in logging within services and loaders by progressing 'server-only' imports and improving context handling. Additionally, type annotations have been added to several exported functions for better code readability and maintainability.
This commit is contained in:
giancarlo
2024-04-09 17:23:48 +08:00
parent 5adfb3edac
commit a9eaaafd3d
45 changed files with 159 additions and 128 deletions

View File

@@ -1,8 +1,9 @@
import 'server-only';
import { redirect } from 'next/navigation';
import type { User } from '@supabase/supabase-js';
import 'server-only';
import { z } from 'zod';
import { verifyCaptchaToken } from '@kit/auth/captcha/server';

View File

@@ -1,9 +1,10 @@
import 'server-only';
import { redirect } from 'next/navigation';
import { NextRequest, NextResponse } from 'next/server';
import { User } from '@supabase/supabase-js';
import 'server-only';
import { z } from 'zod';
import { verifyCaptchaToken } from '@kit/auth/captcha/server';

View File

@@ -4,11 +4,11 @@ export const zodParseFactory =
<T extends z.ZodTypeAny>(schema: T) =>
(data: unknown): z.infer<T> => {
try {
return schema.parse(data);
return schema.parse(data) as unknown;
} catch (err) {
console.error(err);
// handle error
throw new Error(`Invalid data: ${err}`);
throw new Error(`Invalid data: ${err as string}`);
}
};