Compare commits

...

2 Commits

Author SHA1 Message Date
f4c5745bd8 Make the interfaces more generic 2023-11-29 13:26:10 +02:00
0d229d9da6 v1.7.4 2023-11-29 13:25:52 +02:00
6 changed files with 12 additions and 25 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@navy.gif/wrappers",
"version": "1.7.3",
"version": "1.7.4",
"description": "Various wrapper classes I use in my projects",
"repository": "https://git.corgi.wtf/Navy.gif/wrappers.git",
"author": "Navy.gif",

View File

@ -3,7 +3,6 @@ import dns from 'node:dns/promises';
import mysql, { PoolCluster, PoolClusterConfig, PoolConfig, PoolConnection, FieldInfo, OkPacket } from 'mysql';
import { ILogger, IServer } from './interfaces/index.js';
import { LoggerClientOptions } from './interfaces/Logger.js';
const SAFE_TO_RETRY = [ 'ER_LOCK_DEADLOCK', 'PROTOCOL_CONNECTION_LOST' ];
@ -24,7 +23,7 @@ export type MariaOptions = {
cluster?: PoolClusterConfig,
client?: PoolConfig,
credentials: Credentials,
loggerOptions?: LoggerClientOptions,
loggerOptions?: object,
donorQuery?: boolean,
recordMetrics?: boolean,
metricsBuckets?: number[],

View File

@ -1,6 +1,6 @@
import { inspect } from 'node:util';
import { MongoClient, MongoClientOptions, Db, Document, WithId, ObjectId, Filter, IndexSpecification, CreateIndexesOptions, FindOptions, ModifyResult } from 'mongodb';
import { IServer, ILogger, LoggerClientOptions } from './interfaces/index.js';
import { IServer, ILogger } from './interfaces/index.js';
type Credentials = {
URI?: string,
@ -19,7 +19,7 @@ type MongoQuery = {
export type MongoOptions = {
credentials: Credentials,
loggerOptions?: LoggerClientOptions,
loggerOptions?: object,
client?: MongoClientOptions,
load?: boolean,
recordMetrics?: boolean,

View File

@ -1,19 +1,7 @@
export type LoggerClientOptions = {
guard: string,
customStreams: string[],
logLevel: number,
logLevelMapping: {[key: string]: number}
}
type WriteOptions = {
subheader?: string,
broadcast?: boolean
}
export interface ILogger {
info(str: string | object, opts?: WriteOptions): void
status(str: string | object, opts?: WriteOptions): void
debug(str: string | object, opts?: WriteOptions): void
warn(str: string | object, opts?: WriteOptions): void
error(str: string | object, opts?: WriteOptions): void
info(...args: (string | object)[]): void
status(...args: (string | object)[]): void
debug(...args: (string | object)[]): void
warn(...args: (string | object)[]): void
error(...args: (string | object)[]): void
}

View File

@ -1,6 +1,6 @@
import { ILogger, LoggerClientOptions } from './Logger.js';
import { ILogger } from './Logger.js';
export interface IServer {
createLogger(obj: object, options?: Partial<LoggerClientOptions>): ILogger
createLogger(obj: object, options?: object): ILogger
registerMetric(metric: object): void
}

View File

@ -1,2 +1,2 @@
export { ILogger, LoggerClientOptions } from './Logger.js';
export { ILogger } from './Logger.js';
export { IServer } from './Server.js';