Repo cleanup

This commit is contained in:
Darren Clarke 2026-02-10 08:36:04 +01:00
parent 59872f579a
commit e941353b64
444 changed files with 1485 additions and 21978 deletions

View file

@ -1,36 +0,0 @@
{
"name": "@link-stack/logger",
"version": "3.5.0-beta.1",
"description": "Shared logging utility for Link Stack monorepo",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
}
},
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
"lint": "eslint . --ext .ts",
"type-check": "tsc --noEmit"
},
"dependencies": {
"pino": "^10.0.0",
"pino-pretty": "^13.1.1"
},
"devDependencies": {
"@link-stack/eslint-config": "workspace:*",
"@link-stack/typescript-config": "workspace:*",
"@types/node": "^24.7.0",
"eslint": "^9.37.0",
"tsup": "^8.5.0",
"typescript": "^5.9.3"
},
"publishConfig": {
"access": "public"
}
}

View file

@ -1,81 +0,0 @@
import type { LoggerOptions } from 'pino';
export const getLogLevel = (): string => {
return process.env.LOG_LEVEL || (process.env.NODE_ENV === 'production' ? 'info' : 'debug');
};
export const getPinoConfig = (): LoggerOptions => {
const isDevelopment = process.env.NODE_ENV !== 'production';
const baseConfig: LoggerOptions = {
level: getLogLevel(),
formatters: {
level: (label) => {
return { level: label.toUpperCase() };
},
},
timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`,
redact: {
paths: [
// Top-level sensitive fields
'password',
'token',
'secret',
'api_key',
'apiKey',
'authorization',
'cookie',
'HandshakeKey',
'receivedSecret',
'access_token',
'refresh_token',
'zammadCsrfToken',
'clientSecret',
// Nested sensitive fields (one level)
'*.password',
'*.token',
'*.secret',
'*.api_key',
'*.apiKey',
'*.authorization',
'*.cookie',
'*.access_token',
'*.refresh_token',
'*.zammadCsrfToken',
'*.HandshakeKey',
'*.receivedSecret',
'*.clientSecret',
// Common nested patterns
'payload.HandshakeKey',
'headers.authorization',
'headers.cookie',
'headers.Authorization',
'headers.Cookie',
'credentials.password',
'credentials.secret',
'credentials.token',
],
censor: '[REDACTED]',
},
};
if (isDevelopment) {
// In development, use pretty printing for better readability
return {
...baseConfig,
transport: {
target: 'pino-pretty',
options: {
colorize: true,
translateTime: 'SYS:standard',
ignore: 'pid,hostname',
singleLine: false,
messageFormat: '{msg}',
},
},
};
}
// In production, use JSON for structured logging
return baseConfig;
};

View file

@ -1,35 +0,0 @@
import pino, { Logger as PinoLogger } from 'pino';
import { getPinoConfig } from './config';
export type Logger = PinoLogger;
// Create the default logger instance
export const logger: Logger = pino(getPinoConfig());
// Factory function to create child loggers with context
export const createLogger = (name: string, context?: Record<string, any>): Logger => {
return logger.child({ name, ...context });
};
// Export log levels for consistency
export const LogLevel = {
TRACE: 'trace',
DEBUG: 'debug',
INFO: 'info',
WARN: 'warn',
ERROR: 'error',
FATAL: 'fatal',
} as const;
export type LogLevelType = typeof LogLevel[keyof typeof LogLevel];
// Utility to check if a log level is enabled
export const isLogLevelEnabled = (level: LogLevelType): boolean => {
return logger.isLevelEnabled(level);
};
// Re-export pino types that might be useful
export type { LoggerOptions, DestinationStream } from 'pino';
// Default export for convenience
export default logger;

View file

@ -1,21 +0,0 @@
{
"compilerOptions": {
"target": "es2022",
"lib": ["es2022"],
"module": "esnext",
"moduleResolution": "node",
"outDir": "./dist",
"rootDir": "./src",
"declaration": true,
"declarationMap": true,
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"allowJs": false,
"types": ["node"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}