av6-core 1.2.2 → 1.2.4

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.d.mts CHANGED
@@ -428,14 +428,14 @@ declare class NotificationEmitter {
428
428
  notifyNow(shortCode: string, body: Omit<EmitPayload, "shortCode">): Promise<void>;
429
429
  }
430
430
 
431
- interface AuditContext {
431
+ interface AuditContext<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_BILL" | "PHARMACY" | "LAB" | "IPD"> {
432
432
  userId: number | null;
433
433
  traceId: string | null;
434
434
  level1Id: number | null;
435
435
  level2Id: number | null;
436
- module: "OPD" | "PROCEDURE" | "GENERAL_BILL" | "PHARMACY" | "LAB" | "IPD";
436
+ module: Module;
437
437
  }
438
- type AuditContextProvider = () => AuditContext;
438
+ type AuditContextProvider<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_BILL" | "PHARMACY" | "LAB" | "IPD"> = () => AuditContext<Module>;
439
439
  interface AuditLogPayload {
440
440
  message: string;
441
441
  type?: "INFO" | "CREATE" | "UPDATE" | "DELETE" | "ERROR";
@@ -444,17 +444,17 @@ interface AuditLogPayload {
444
444
  extra?: Record<string, any>;
445
445
  }
446
446
 
447
- declare class AuditCore {
447
+ declare class AuditCore<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_BILL" | "PHARMACY" | "LAB" | "IPD"> {
448
448
  private prisma;
449
449
  private contextProvider;
450
- constructor(prisma: PrismaClient, contextProvider: AuditContextProvider);
450
+ constructor(prisma: PrismaClient, contextProvider: AuditContextProvider<Module>);
451
451
  getPrisma(): PrismaClient;
452
- getContext(): AuditContext;
452
+ getContext(): AuditContext<Module>;
453
453
  }
454
454
 
455
- declare class AuditLogger {
455
+ declare class AuditLogger<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_BILL" | "PHARMACY" | "LAB" | "IPD"> {
456
456
  private core;
457
- constructor(core: AuditCore);
457
+ constructor(core: AuditCore<Module>);
458
458
  /**
459
459
  * Check core_audit_config and, if auditable, insert into core_common_audit
460
460
  */
@@ -465,9 +465,9 @@ declare class AuditLogger {
465
465
  }): Promise<void>;
466
466
  }
467
467
 
468
- declare class AuditProxy {
468
+ declare class AuditProxy<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_BILL" | "PHARMACY" | "LAB" | "IPD"> {
469
469
  private logger;
470
- constructor(logger: AuditLogger);
470
+ constructor(logger: AuditLogger<Module>);
471
471
  createAuditedService<T extends object>(serviceName: string, service: T): T;
472
472
  }
473
473
 
package/dist/index.d.ts CHANGED
@@ -428,14 +428,14 @@ declare class NotificationEmitter {
428
428
  notifyNow(shortCode: string, body: Omit<EmitPayload, "shortCode">): Promise<void>;
429
429
  }
430
430
 
431
- interface AuditContext {
431
+ interface AuditContext<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_BILL" | "PHARMACY" | "LAB" | "IPD"> {
432
432
  userId: number | null;
433
433
  traceId: string | null;
434
434
  level1Id: number | null;
435
435
  level2Id: number | null;
436
- module: "OPD" | "PROCEDURE" | "GENERAL_BILL" | "PHARMACY" | "LAB" | "IPD";
436
+ module: Module;
437
437
  }
438
- type AuditContextProvider = () => AuditContext;
438
+ type AuditContextProvider<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_BILL" | "PHARMACY" | "LAB" | "IPD"> = () => AuditContext<Module>;
439
439
  interface AuditLogPayload {
440
440
  message: string;
441
441
  type?: "INFO" | "CREATE" | "UPDATE" | "DELETE" | "ERROR";
@@ -444,17 +444,17 @@ interface AuditLogPayload {
444
444
  extra?: Record<string, any>;
445
445
  }
446
446
 
447
- declare class AuditCore {
447
+ declare class AuditCore<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_BILL" | "PHARMACY" | "LAB" | "IPD"> {
448
448
  private prisma;
449
449
  private contextProvider;
450
- constructor(prisma: PrismaClient, contextProvider: AuditContextProvider);
450
+ constructor(prisma: PrismaClient, contextProvider: AuditContextProvider<Module>);
451
451
  getPrisma(): PrismaClient;
452
- getContext(): AuditContext;
452
+ getContext(): AuditContext<Module>;
453
453
  }
454
454
 
455
- declare class AuditLogger {
455
+ declare class AuditLogger<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_BILL" | "PHARMACY" | "LAB" | "IPD"> {
456
456
  private core;
457
- constructor(core: AuditCore);
457
+ constructor(core: AuditCore<Module>);
458
458
  /**
459
459
  * Check core_audit_config and, if auditable, insert into core_common_audit
460
460
  */
@@ -465,9 +465,9 @@ declare class AuditLogger {
465
465
  }): Promise<void>;
466
466
  }
467
467
 
468
- declare class AuditProxy {
468
+ declare class AuditProxy<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_BILL" | "PHARMACY" | "LAB" | "IPD"> {
469
469
  private logger;
470
- constructor(logger: AuditLogger);
470
+ constructor(logger: AuditLogger<Module>);
471
471
  createAuditedService<T extends object>(serviceName: string, service: T): T;
472
472
  }
473
473
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "av6-core",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",