av6-core 1.9.3 → 2.0.1

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
@@ -1,4 +1,3 @@
1
- import { JsonValue, Decimal, DecimalJsLike, InputJsonValue } from '@prisma/client/runtime/library';
2
1
  import { AsyncLocalStorage } from 'async_hooks';
3
2
  import { AxiosResponse } from 'axios';
4
3
  import ExcelJs from 'exceljs';
@@ -306,9 +305,9 @@ type DynamicShortCode = {
306
305
  isSingleDto?: boolean;
307
306
  isDropDown?: boolean;
308
307
  permission?: string | null;
309
- whereClause?: JsonValue | null;
310
- selectClause?: JsonValue | null;
311
- config?: JsonValue | null;
308
+ whereClause?: Prisma.JsonValue | null;
309
+ selectClause?: Prisma.JsonValue | null;
310
+ config?: Prisma.JsonValue | null;
312
311
  };
313
312
  interface UpdateConfigByCodeInput extends Pick<DynamicShortCode, "config"> {
314
313
  shortCode: string;
@@ -441,7 +440,7 @@ type DataType = {
441
440
  interface CacheAdapter {
442
441
  getCacheById(key: string, id: number | string): Promise<any | undefined>;
443
442
  updateCache(key: string, id: number | string, value: unknown): Promise<void>;
444
- createCache(table: string, data: DataType[]): Promise<void>;
443
+ createCache?(table: string, data: DataType[]): Promise<void>;
445
444
  deleteCache(key: string, id: number | string): Promise<void>;
446
445
  addToCache(key: string, id: number | string, data: unknown): Promise<void>;
447
446
  }
@@ -499,6 +498,7 @@ interface Deps {
499
498
  cacheAdapter: CacheAdapter;
500
499
  requestStorage: AsyncLocalStorage<Store>;
501
500
  db: TxClient;
501
+ getDb?: () => PrismaClient;
502
502
  }
503
503
  interface CommonServiceResponse {
504
504
  search: (searchParams: SearchRequestService<DynamicShortCode>) => Promise<unknown>;
@@ -545,11 +545,11 @@ type ApprovalStep = {
545
545
  id?: number;
546
546
  flowId: number;
547
547
  level: number;
548
- minAmount?: Decimal | DecimalJsLike | number | string | null;
549
- maxAmount?: Decimal | DecimalJsLike | number | string | null;
548
+ minAmount?: Prisma.Decimal | Prisma.DecimalJsLike | number | string | null;
549
+ maxAmount?: Prisma.Decimal | Prisma.DecimalJsLike | number | string | null;
550
550
  stepType?: StepType;
551
- config?: InputJsonValue;
552
- childConfig?: InputJsonValue;
551
+ config?: Prisma.JsonValue;
552
+ childConfig?: Prisma.JsonValue;
553
553
  isActive?: boolean;
554
554
  createdBy?: number | null;
555
555
  updatedBy?: number | null;
@@ -576,9 +576,9 @@ type ApprovalInstance = {
576
576
  subjectId: number;
577
577
  refNo?: string | null;
578
578
  currentStep: number;
579
- netTotal?: Decimal | DecimalJsLike | number | string | null;
579
+ netTotal?: Prisma.Decimal | Prisma.DecimalJsLike | number | string | null;
580
580
  status?: ApprovalStatus;
581
- extra?: JsonValue | InputJsonValue;
581
+ extra?: Prisma.JsonValue | null;
582
582
  isActive?: boolean;
583
583
  createdBy?: number | null;
584
584
  updatedBy?: number | null;
@@ -804,12 +804,14 @@ interface ApprovalDeps {
804
804
  requestStorage: AsyncLocalStorage<Store>;
805
805
  prisma: PrismaClient;
806
806
  eventBus: EventEmitter;
807
+ getDb?: () => PrismaClient;
807
808
  }
808
809
  type PrismaTransactionClient = Omit<PrismaClient, "$connect" | "$disconnect" | "$on" | "$transaction" | "$use" | "$extends">;
809
810
 
810
811
  declare class ApprovalService {
811
812
  private deps;
812
813
  private approvalRepo;
814
+ private prisma;
813
815
  constructor(deps: ApprovalDeps);
814
816
  startFlow(tx: PrismaClient | PrismaTransactionClient, { service, subjectType, subjectId, netTotal, ccId, refNo, level, extra }: StartFlowReq): Promise<void>;
815
817
  lastLevel(steps: ApprovalStep[]): Promise<number>;
@@ -897,6 +899,7 @@ interface UinDeps {
897
899
  db: PrismaClient;
898
900
  prisma: typeof PrismaNamespace;
899
901
  modelName?: string;
902
+ getDb?: () => PrismaClient;
900
903
  }
901
904
  type UINSegmentType = "text" | "separator" | "dateFormat" | "sequenceNo";
902
905
  type UIN_RESET_POLICY = "daily" | "weekly" | "monthly" | "yearly" | "no";
@@ -968,6 +971,7 @@ type NotificationEmitterDeps = {
968
971
  logger?: ILogger;
969
972
  envMode?: "Production" | "Development";
970
973
  helpers: Helpers;
974
+ getDb?: () => PrismaClient;
971
975
  };
972
976
 
973
977
  /**
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { JsonValue, Decimal, DecimalJsLike, InputJsonValue } from '@prisma/client/runtime/library';
2
1
  import { AsyncLocalStorage } from 'async_hooks';
3
2
  import { AxiosResponse } from 'axios';
4
3
  import ExcelJs from 'exceljs';
@@ -306,9 +305,9 @@ type DynamicShortCode = {
306
305
  isSingleDto?: boolean;
307
306
  isDropDown?: boolean;
308
307
  permission?: string | null;
309
- whereClause?: JsonValue | null;
310
- selectClause?: JsonValue | null;
311
- config?: JsonValue | null;
308
+ whereClause?: Prisma.JsonValue | null;
309
+ selectClause?: Prisma.JsonValue | null;
310
+ config?: Prisma.JsonValue | null;
312
311
  };
313
312
  interface UpdateConfigByCodeInput extends Pick<DynamicShortCode, "config"> {
314
313
  shortCode: string;
@@ -441,7 +440,7 @@ type DataType = {
441
440
  interface CacheAdapter {
442
441
  getCacheById(key: string, id: number | string): Promise<any | undefined>;
443
442
  updateCache(key: string, id: number | string, value: unknown): Promise<void>;
444
- createCache(table: string, data: DataType[]): Promise<void>;
443
+ createCache?(table: string, data: DataType[]): Promise<void>;
445
444
  deleteCache(key: string, id: number | string): Promise<void>;
446
445
  addToCache(key: string, id: number | string, data: unknown): Promise<void>;
447
446
  }
@@ -499,6 +498,7 @@ interface Deps {
499
498
  cacheAdapter: CacheAdapter;
500
499
  requestStorage: AsyncLocalStorage<Store>;
501
500
  db: TxClient;
501
+ getDb?: () => PrismaClient;
502
502
  }
503
503
  interface CommonServiceResponse {
504
504
  search: (searchParams: SearchRequestService<DynamicShortCode>) => Promise<unknown>;
@@ -545,11 +545,11 @@ type ApprovalStep = {
545
545
  id?: number;
546
546
  flowId: number;
547
547
  level: number;
548
- minAmount?: Decimal | DecimalJsLike | number | string | null;
549
- maxAmount?: Decimal | DecimalJsLike | number | string | null;
548
+ minAmount?: Prisma.Decimal | Prisma.DecimalJsLike | number | string | null;
549
+ maxAmount?: Prisma.Decimal | Prisma.DecimalJsLike | number | string | null;
550
550
  stepType?: StepType;
551
- config?: InputJsonValue;
552
- childConfig?: InputJsonValue;
551
+ config?: Prisma.JsonValue;
552
+ childConfig?: Prisma.JsonValue;
553
553
  isActive?: boolean;
554
554
  createdBy?: number | null;
555
555
  updatedBy?: number | null;
@@ -576,9 +576,9 @@ type ApprovalInstance = {
576
576
  subjectId: number;
577
577
  refNo?: string | null;
578
578
  currentStep: number;
579
- netTotal?: Decimal | DecimalJsLike | number | string | null;
579
+ netTotal?: Prisma.Decimal | Prisma.DecimalJsLike | number | string | null;
580
580
  status?: ApprovalStatus;
581
- extra?: JsonValue | InputJsonValue;
581
+ extra?: Prisma.JsonValue | null;
582
582
  isActive?: boolean;
583
583
  createdBy?: number | null;
584
584
  updatedBy?: number | null;
@@ -804,12 +804,14 @@ interface ApprovalDeps {
804
804
  requestStorage: AsyncLocalStorage<Store>;
805
805
  prisma: PrismaClient;
806
806
  eventBus: EventEmitter;
807
+ getDb?: () => PrismaClient;
807
808
  }
808
809
  type PrismaTransactionClient = Omit<PrismaClient, "$connect" | "$disconnect" | "$on" | "$transaction" | "$use" | "$extends">;
809
810
 
810
811
  declare class ApprovalService {
811
812
  private deps;
812
813
  private approvalRepo;
814
+ private prisma;
813
815
  constructor(deps: ApprovalDeps);
814
816
  startFlow(tx: PrismaClient | PrismaTransactionClient, { service, subjectType, subjectId, netTotal, ccId, refNo, level, extra }: StartFlowReq): Promise<void>;
815
817
  lastLevel(steps: ApprovalStep[]): Promise<number>;
@@ -897,6 +899,7 @@ interface UinDeps {
897
899
  db: PrismaClient;
898
900
  prisma: typeof PrismaNamespace;
899
901
  modelName?: string;
902
+ getDb?: () => PrismaClient;
900
903
  }
901
904
  type UINSegmentType = "text" | "separator" | "dateFormat" | "sequenceNo";
902
905
  type UIN_RESET_POLICY = "daily" | "weekly" | "monthly" | "yearly" | "no";
@@ -968,6 +971,7 @@ type NotificationEmitterDeps = {
968
971
  logger?: ILogger;
969
972
  envMode?: "Production" | "Development";
970
973
  helpers: Helpers;
974
+ getDb?: () => PrismaClient;
971
975
  };
972
976
 
973
977
  /**
package/dist/index.js CHANGED
@@ -462,10 +462,9 @@ function normalizeWhere(where) {
462
462
  var import_util2 = require("util");
463
463
  var commonRepository = (serviceDeps) => {
464
464
  const { mappingExport, mappingImport, dtoMapping } = serviceDeps.mapper;
465
- const db = serviceDeps.db;
465
+ const db = serviceDeps?.getDb?.() ?? serviceDeps.db;
466
466
  const { generateErrorMessage, ErrorHandler } = serviceDeps.helpers;
467
467
  const logger = serviceDeps.logger;
468
- const createCache = serviceDeps.cacheAdapter.createCache;
469
468
  const requestStorage = serviceDeps.requestStorage;
470
469
  return {
471
470
  async commonSearch({
@@ -1161,7 +1160,7 @@ var buildPrismaData = (cfg, op, validatedBody, ctx) => {
1161
1160
 
1162
1161
  // src/repository/commonCreateUpdate.repository.ts
1163
1162
  var commonCreateUpdateRepository = (serviceDeps) => {
1164
- const db = serviceDeps.db;
1163
+ const db = serviceDeps?.getDb?.() ?? serviceDeps.db;
1165
1164
  const { ErrorHandler } = serviceDeps.helpers;
1166
1165
  return {
1167
1166
  getDelegate(tableName) {
@@ -1896,7 +1895,7 @@ var import_joi2 = __toESM(require("joi"));
1896
1895
  var commonService = (serviceDeps) => {
1897
1896
  const generateErrorMessage = serviceDeps.helpers.generateErrorMessage;
1898
1897
  const ErrorHandler = serviceDeps.helpers.ErrorHandler;
1899
- const { deleteCache, getCacheById, updateCache, createCache, addToCache } = serviceDeps.cacheAdapter;
1898
+ const { deleteCache, getCacheById, updateCache, addToCache } = serviceDeps.cacheAdapter;
1900
1899
  const logger = serviceDeps.logger;
1901
1900
  const dtoMapping = serviceDeps.mapper.dtoMapping;
1902
1901
  const validationMapping = serviceDeps.mapper.validationMapping;
@@ -2345,6 +2344,7 @@ var ActionMode = /* @__PURE__ */ ((ActionMode2) => {
2345
2344
  // src/repository/approval.repository.ts
2346
2345
  var import_client = require("@prisma/client");
2347
2346
  var approvalRepository = (deps) => {
2347
+ const prisma = deps.getDb?.() ?? deps.prisma;
2348
2348
  return {
2349
2349
  async findMatchingFlow(tx, type, service, ccId, netTotal, level = 1) {
2350
2350
  const result = await tx.$queryRaw`
@@ -2478,6 +2478,9 @@ var approvalRepository = (deps) => {
2478
2478
  service
2479
2479
  },
2480
2480
  isActive: true
2481
+ },
2482
+ include: {
2483
+ approvalInstance: true
2481
2484
  }
2482
2485
  });
2483
2486
  },
@@ -2493,14 +2496,14 @@ var approvalRepository = (deps) => {
2493
2496
  SET ${import_client.Prisma.join(setFragments, ", ")}
2494
2497
  WHERE id = ${data.id};
2495
2498
  `;
2496
- await deps.prisma.$queryRaw(query);
2499
+ await prisma.$queryRaw(query);
2497
2500
  },
2498
2501
  async commonParentChildUpdate(config, childConfig, inst) {
2499
2502
  deps.logger.info("entering::commonRefundUpdate::repository");
2500
2503
  const { tableName: parentTableName, ...parentTableConfig } = config;
2501
2504
  const { tableName: childTableName, ...childTableConfig } = childConfig ?? {};
2502
2505
  const parentId = inst.subjectId;
2503
- await deps.prisma.$transaction(async (tx) => {
2506
+ await prisma.$transaction(async (tx) => {
2504
2507
  const commonDetails = await this.getChildCommonDetailsByParentId(tx, parentId, inst.subjectType, inst.service);
2505
2508
  const parentDetails = await this.getParentCommonDetailsByParentId(tx, parentId, inst.subjectType, inst.service);
2506
2509
  if (!parentDetails) {
@@ -2596,10 +2599,12 @@ var externalInterceptor = () => {
2596
2599
  var ApprovalService = class {
2597
2600
  constructor(deps) {
2598
2601
  this.deps = deps;
2602
+ this.prisma = deps.getDb?.() ?? deps.prisma;
2599
2603
  this.approvalRepo = approvalRepository(deps);
2600
2604
  }
2601
2605
  deps;
2602
2606
  approvalRepo;
2607
+ prisma;
2603
2608
  async startFlow(tx, { service, subjectType, subjectId, netTotal, ccId, refNo, level = 1, extra }) {
2604
2609
  const store = this.deps.requestStorage.getStore();
2605
2610
  const currentUser = store?.user?.id;
@@ -2648,7 +2653,7 @@ var ApprovalService = class {
2648
2653
  }
2649
2654
  /** Approver clicks “Approve” or “Reject”. */
2650
2655
  async act({ instanceId, approverId, action, ccId, comment }) {
2651
- return this.deps.prisma.$transaction(async (tx) => {
2656
+ return this.prisma.$transaction(async (tx) => {
2652
2657
  const inst = await tx.approvalInstance.findUnique({
2653
2658
  where: { id: instanceId },
2654
2659
  include: { flow: { where: { isActive: true }, include: { steps: { where: { isActive: true } } } } }
@@ -2929,7 +2934,7 @@ var ApprovalService = class {
2929
2934
  }
2930
2935
  async getAllApprovalFlow(input) {
2931
2936
  this.deps.logger.info("entering:getAllApprovalFlow --" + JSON.stringify({ input }));
2932
- const instance = await this.approvalRepo.getAllApprovalFlow(this.deps.prisma, input);
2937
+ const instance = await this.approvalRepo.getAllApprovalFlow(this.prisma, input);
2933
2938
  this.deps.logger.info("exiting:getAllApprovalFlow --" + JSON.stringify({ instance }));
2934
2939
  return instance;
2935
2940
  }
@@ -2937,7 +2942,7 @@ var ApprovalService = class {
2937
2942
  this.deps.logger.info(
2938
2943
  "entering:getApprovalActDetailsBySubjectId --" + JSON.stringify({ subjectId, subjectType, service })
2939
2944
  );
2940
- return this.approvalRepo.getApprovalActDetailsBySubjectId(this.deps.prisma, { subjectId, subjectType, service });
2945
+ return this.approvalRepo.getApprovalActDetailsBySubjectId(this.prisma, { subjectId, subjectType, service });
2941
2946
  }
2942
2947
  async commonStatusUpdate(config, data) {
2943
2948
  return this.approvalRepo.commonStatusUpdate(config, data);
@@ -3047,7 +3052,7 @@ var toUINConfigDTO = (model) => {
3047
3052
 
3048
3053
  // src/repository/uinConfig.repository.ts
3049
3054
  var uinConfigRepository = (uinDeps) => {
3050
- const db = uinDeps.db;
3055
+ const db = uinDeps?.getDb?.() ?? uinDeps.db;
3051
3056
  const logger = uinDeps.logger;
3052
3057
  const requestStorage = uinDeps.requestStorage;
3053
3058
  const modelName = uinDeps.modelName || "uINConfig";
@@ -4789,7 +4794,8 @@ var NotificationEmitter = class {
4789
4794
  service;
4790
4795
  constructor(deps) {
4791
4796
  this.emitter = new import_events.EventEmitter();
4792
- this.service = new NotificationService(deps.prisma, deps.logger ?? console, deps.helpers);
4797
+ const prisma = deps.getDb?.() ?? deps.prisma;
4798
+ this.service = new NotificationService(prisma, deps.logger ?? console, deps.helpers);
4793
4799
  this.emitter.on("notify", async (payload) => {
4794
4800
  try {
4795
4801
  await this.service.handleEvent(payload);
package/dist/index.mjs CHANGED
@@ -399,10 +399,9 @@ function normalizeWhere(where) {
399
399
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "util";
400
400
  var commonRepository = (serviceDeps) => {
401
401
  const { mappingExport, mappingImport, dtoMapping } = serviceDeps.mapper;
402
- const db = serviceDeps.db;
402
+ const db = serviceDeps?.getDb?.() ?? serviceDeps.db;
403
403
  const { generateErrorMessage, ErrorHandler } = serviceDeps.helpers;
404
404
  const logger = serviceDeps.logger;
405
- const createCache = serviceDeps.cacheAdapter.createCache;
406
405
  const requestStorage = serviceDeps.requestStorage;
407
406
  return {
408
407
  async commonSearch({
@@ -1098,7 +1097,7 @@ var buildPrismaData = (cfg, op, validatedBody, ctx) => {
1098
1097
 
1099
1098
  // src/repository/commonCreateUpdate.repository.ts
1100
1099
  var commonCreateUpdateRepository = (serviceDeps) => {
1101
- const db = serviceDeps.db;
1100
+ const db = serviceDeps?.getDb?.() ?? serviceDeps.db;
1102
1101
  const { ErrorHandler } = serviceDeps.helpers;
1103
1102
  return {
1104
1103
  getDelegate(tableName) {
@@ -1833,7 +1832,7 @@ import Joi2 from "joi";
1833
1832
  var commonService = (serviceDeps) => {
1834
1833
  const generateErrorMessage = serviceDeps.helpers.generateErrorMessage;
1835
1834
  const ErrorHandler = serviceDeps.helpers.ErrorHandler;
1836
- const { deleteCache, getCacheById, updateCache, createCache, addToCache } = serviceDeps.cacheAdapter;
1835
+ const { deleteCache, getCacheById, updateCache, addToCache } = serviceDeps.cacheAdapter;
1837
1836
  const logger = serviceDeps.logger;
1838
1837
  const dtoMapping = serviceDeps.mapper.dtoMapping;
1839
1838
  const validationMapping = serviceDeps.mapper.validationMapping;
@@ -2282,6 +2281,7 @@ var ActionMode = /* @__PURE__ */ ((ActionMode2) => {
2282
2281
  // src/repository/approval.repository.ts
2283
2282
  import { Prisma } from "@prisma/client";
2284
2283
  var approvalRepository = (deps) => {
2284
+ const prisma = deps.getDb?.() ?? deps.prisma;
2285
2285
  return {
2286
2286
  async findMatchingFlow(tx, type, service, ccId, netTotal, level = 1) {
2287
2287
  const result = await tx.$queryRaw`
@@ -2415,6 +2415,9 @@ var approvalRepository = (deps) => {
2415
2415
  service
2416
2416
  },
2417
2417
  isActive: true
2418
+ },
2419
+ include: {
2420
+ approvalInstance: true
2418
2421
  }
2419
2422
  });
2420
2423
  },
@@ -2430,14 +2433,14 @@ var approvalRepository = (deps) => {
2430
2433
  SET ${Prisma.join(setFragments, ", ")}
2431
2434
  WHERE id = ${data.id};
2432
2435
  `;
2433
- await deps.prisma.$queryRaw(query);
2436
+ await prisma.$queryRaw(query);
2434
2437
  },
2435
2438
  async commonParentChildUpdate(config, childConfig, inst) {
2436
2439
  deps.logger.info("entering::commonRefundUpdate::repository");
2437
2440
  const { tableName: parentTableName, ...parentTableConfig } = config;
2438
2441
  const { tableName: childTableName, ...childTableConfig } = childConfig ?? {};
2439
2442
  const parentId = inst.subjectId;
2440
- await deps.prisma.$transaction(async (tx) => {
2443
+ await prisma.$transaction(async (tx) => {
2441
2444
  const commonDetails = await this.getChildCommonDetailsByParentId(tx, parentId, inst.subjectType, inst.service);
2442
2445
  const parentDetails = await this.getParentCommonDetailsByParentId(tx, parentId, inst.subjectType, inst.service);
2443
2446
  if (!parentDetails) {
@@ -2533,10 +2536,12 @@ var externalInterceptor = () => {
2533
2536
  var ApprovalService = class {
2534
2537
  constructor(deps) {
2535
2538
  this.deps = deps;
2539
+ this.prisma = deps.getDb?.() ?? deps.prisma;
2536
2540
  this.approvalRepo = approvalRepository(deps);
2537
2541
  }
2538
2542
  deps;
2539
2543
  approvalRepo;
2544
+ prisma;
2540
2545
  async startFlow(tx, { service, subjectType, subjectId, netTotal, ccId, refNo, level = 1, extra }) {
2541
2546
  const store = this.deps.requestStorage.getStore();
2542
2547
  const currentUser = store?.user?.id;
@@ -2585,7 +2590,7 @@ var ApprovalService = class {
2585
2590
  }
2586
2591
  /** Approver clicks “Approve” or “Reject”. */
2587
2592
  async act({ instanceId, approverId, action, ccId, comment }) {
2588
- return this.deps.prisma.$transaction(async (tx) => {
2593
+ return this.prisma.$transaction(async (tx) => {
2589
2594
  const inst = await tx.approvalInstance.findUnique({
2590
2595
  where: { id: instanceId },
2591
2596
  include: { flow: { where: { isActive: true }, include: { steps: { where: { isActive: true } } } } }
@@ -2866,7 +2871,7 @@ var ApprovalService = class {
2866
2871
  }
2867
2872
  async getAllApprovalFlow(input) {
2868
2873
  this.deps.logger.info("entering:getAllApprovalFlow --" + JSON.stringify({ input }));
2869
- const instance = await this.approvalRepo.getAllApprovalFlow(this.deps.prisma, input);
2874
+ const instance = await this.approvalRepo.getAllApprovalFlow(this.prisma, input);
2870
2875
  this.deps.logger.info("exiting:getAllApprovalFlow --" + JSON.stringify({ instance }));
2871
2876
  return instance;
2872
2877
  }
@@ -2874,7 +2879,7 @@ var ApprovalService = class {
2874
2879
  this.deps.logger.info(
2875
2880
  "entering:getApprovalActDetailsBySubjectId --" + JSON.stringify({ subjectId, subjectType, service })
2876
2881
  );
2877
- return this.approvalRepo.getApprovalActDetailsBySubjectId(this.deps.prisma, { subjectId, subjectType, service });
2882
+ return this.approvalRepo.getApprovalActDetailsBySubjectId(this.prisma, { subjectId, subjectType, service });
2878
2883
  }
2879
2884
  async commonStatusUpdate(config, data) {
2880
2885
  return this.approvalRepo.commonStatusUpdate(config, data);
@@ -2984,7 +2989,7 @@ var toUINConfigDTO = (model) => {
2984
2989
 
2985
2990
  // src/repository/uinConfig.repository.ts
2986
2991
  var uinConfigRepository = (uinDeps) => {
2987
- const db = uinDeps.db;
2992
+ const db = uinDeps?.getDb?.() ?? uinDeps.db;
2988
2993
  const logger = uinDeps.logger;
2989
2994
  const requestStorage = uinDeps.requestStorage;
2990
2995
  const modelName = uinDeps.modelName || "uINConfig";
@@ -4726,7 +4731,8 @@ var NotificationEmitter = class {
4726
4731
  service;
4727
4732
  constructor(deps) {
4728
4733
  this.emitter = new EventEmitter();
4729
- this.service = new NotificationService(deps.prisma, deps.logger ?? console, deps.helpers);
4734
+ const prisma = deps.getDb?.() ?? deps.prisma;
4735
+ this.service = new NotificationService(prisma, deps.logger ?? console, deps.helpers);
4730
4736
  this.emitter.on("notify", async (payload) => {
4731
4737
  try {
4732
4738
  await this.service.handleEvent(payload);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "av6-core",
3
- "version": "1.9.3",
3
+ "version": "2.0.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",