Update Supabase dependency, delete cookie handling, create logger

Updated Supabase dependency across multiple packages from "^2.41.1" to "^2.42.0". Removed files handling sidebar state and theme cookies. Created a new Logger interface for managing log messages in the shared package. Enhanced the middleware to track accounts membership webhook payload. Minor adjustments were also made in multiple package.json files.
This commit is contained in:
giancarlo
2024-04-03 23:59:41 +08:00
parent 406739d96d
commit 35ef90b4f8
23 changed files with 1019 additions and 1027 deletions

View File

@@ -1,7 +0,0 @@
import { cookies } from 'next/headers';
const SIDEBAR_STATE_COOKIE_NAME = 'sidebarState';
export function parseSidebarStateCookie() {
return cookies().get(SIDEBAR_STATE_COOKIE_NAME)?.value;
}

View File

@@ -1,7 +0,0 @@
import { cookies } from 'next/headers';
const THEME_COOKIE_NAME = 'theme';
export function parseThemeCookie() {
return cookies().get(THEME_COOKIE_NAME)?.value;
}

View File

@@ -1,6 +1,23 @@
import { Logger as LoggerInstance } from './logger';
/*
* Logger
* By default, the logger is set to use Pino. To change the logger, update the import statement below.
* to your desired logger implementation.
*/
export * from './impl/pino';
async function getLogger(): Promise<LoggerInstance> {
switch (process.env.LOGGER ?? 'pino') {
case 'pino': {
const { Logger: PinoLogger } = await import('./impl/pino');
return PinoLogger;
}
default:
throw new Error(`Unknown logger: ${process.env.LOGGER}`);
}
}
const Logger = await getLogger();
export { Logger };

View File

@@ -0,0 +1,17 @@
type LogFn = {
<T extends object>(obj: T, msg?: string, ...args: unknown[]): void;
(obj: unknown, msg?: string, ...args: unknown[]): void;
(msg: string, ...args: unknown[]): void;
};
/**
* @name Logger
* @description Logger interface for logging messages
*/
export interface Logger {
info: LogFn;
error: LogFn;
warn: LogFn;
debug: LogFn;
fatal: LogFn;
}