nestjs-log-decorator 1.2.0 → 1.3.0

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.
package/dist/index.cjs CHANGED
@@ -441,7 +441,11 @@ exports.Log = Log;
441
441
  exports.LogWrapper = LogWrapper;
442
442
  exports.NO_LOG_METADATA_KEY = NO_LOG_METADATA_KEY;
443
443
  exports.NoLog = NoLog;
444
+ exports.applyToClass = applyToClass;
445
+ exports.applyToMethod = applyToMethod;
444
446
  exports.buildArgsObject = buildArgsObject;
445
447
  exports.createLogWrapper = createLogWrapper;
448
+ exports.getParameterNames = getParameterNames;
449
+ exports.handleAsyncExecution = handleAsyncExecution;
446
450
  exports.isLoggable = isLoggable;
447
451
  exports.prettifyAxiosError = prettifyAxiosError;
package/dist/index.d.cts CHANGED
@@ -292,4 +292,46 @@ declare const NoLog: () => (_target: unknown, _propertyKey: string, descriptor:
292
292
  //#region src/axios/axios.logger.d.ts
293
293
  declare function prettifyAxiosError(error: unknown): unknown;
294
294
  //#endregion
295
- export { Log, LogArgsFormatter, LogOptions, LogWrapper, Loggable, NO_LOG_METADATA_KEY, NoLog, buildArgsObject, createLogWrapper, isLoggable, prettifyAxiosError };
295
+ //#region src/decorate/applyToMethod.d.ts
296
+ type MethodFunction = (...args: unknown[]) => unknown;
297
+ /**
298
+ * Applies logging to a single method.
299
+ * @internal
300
+ */
301
+ declare const applyToMethod: (target: object, propertyKey: string, descriptor: PropertyDescriptor, {
302
+ onInvoke: shouldLogInvoke,
303
+ args: formatArgs
304
+ }?: LogOptions) => PropertyDescriptor;
305
+ /**
306
+ * Extracts parameter names from a function signature.
307
+ *
308
+ * This function parses the function's string representation to extract
309
+ * parameter names, handling TypeScript type annotations and default values.
310
+ *
311
+ * @param func - The function to extract parameter names from
312
+ * @returns Array of parameter names
313
+ *
314
+ * @example
315
+ * function example(id: number, name: string = 'default') {}
316
+ * getParameterNames(example) // Returns: ['id', 'name']
317
+ *
318
+ * @internal
319
+ */
320
+ declare const getParameterNames: (func: MethodFunction) => string[];
321
+ /**
322
+ * Handles execution of async methods with proper logging.
323
+ * @internal
324
+ */
325
+ declare const handleAsyncExecution: (result: Promise<unknown>, logWrapper: LogWrapper) => Promise<unknown>;
326
+ //#endregion
327
+ //#region src/decorate/applyToClass.d.ts
328
+ interface Constructor {
329
+ prototype: Record<string, unknown>;
330
+ }
331
+ /**
332
+ * Applies logging to all methods in a class.
333
+ * @internal
334
+ */
335
+ declare const applyToClass: (target: Constructor, options: LogOptions) => void;
336
+ //#endregion
337
+ export { Log, LogArgsFormatter, LogOptions, LogWrapper, Loggable, NO_LOG_METADATA_KEY, NoLog, applyToClass, applyToMethod, buildArgsObject, createLogWrapper, getParameterNames, handleAsyncExecution, isLoggable, prettifyAxiosError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nestjs-log-decorator",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Decorator that removes try catch boilerplate logging from NestJS service methods",
5
5
  "author": "Vlad Goncharov <leovs010@gmail.com>",
6
6
  "license": "AGPL-3.0",