av6-core 1.7.17 → 1.8.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.d.mts CHANGED
@@ -537,6 +537,10 @@ declare enum FlowType {
537
537
  REFUND = 5
538
538
  }
539
539
  type StepType = "MIN_MAX" | "NORMAL";
540
+ declare enum ActionMode {
541
+ CONFIG_EVENT = "CONFIG_EVENT",
542
+ WEBHOOK = "WEBHOOK"
543
+ }
540
544
  type ApprovalStep = {
541
545
  id?: number;
542
546
  flowId: number;
@@ -592,6 +596,10 @@ type ApprovalFlow = {
592
596
  createdAt: Date;
593
597
  updatedAt: Date;
594
598
  flowType: FlowType;
599
+ actionType: ActionMode;
600
+ approveActionUrl: string | null;
601
+ rejectActionUrl: string | null;
602
+ partiallyApproveActionUrl: string | null;
595
603
  };
596
604
  type ApprovalAction = {
597
605
  id: number;
@@ -809,10 +817,18 @@ declare class ApprovalService {
809
817
  act({ instanceId, approverId, action, ccId, comment }: ActInput): Promise<any>;
810
818
  private emitEvents;
811
819
  private assertPermission;
820
+ getAllApprovalFlow(input: GetMyApprovalFlow): Promise<PaginatedResponse<ApprovalInstanceByUser>>;
821
+ getApprovalActDetailsBySubjectId(subjectId: number, subjectType: string, service: string): Promise<ApprovalAction[]>;
812
822
  }
813
823
 
814
824
  declare const approvalRepository: (helpers: Helpers) => {
815
825
  findMatchingFlow(tx: PrismaClient | Prisma.TransactionClient, type: string, service: string, ccId: number, netTotal: number, level?: number): Promise<RawFlowWithSelectedStepResponse | null>;
826
+ getAllApprovalFlow(tx: PrismaClient | Prisma.TransactionClient, { staffId, ccId, pageNo, pageSize, service, sortDir, startDate, endDate, searchText, status, flowType, }: GetMyApprovalFlow): Promise<PaginatedResponse<ApprovalInstanceByUser>>;
827
+ getApprovalActDetailsBySubjectId(tx: PrismaClient | Prisma.TransactionClient, { subjectId, subjectType, service }: {
828
+ subjectId: number;
829
+ subjectType: string;
830
+ service: string;
831
+ }): Promise<any>;
816
832
  };
817
833
 
818
834
  declare function customOmit<T extends object, K extends keyof T>(obj: T, keys: K[]): {
@@ -1008,4 +1024,4 @@ declare class AuditProxy<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_
1008
1024
  createAuditedService<T extends object>(serviceName: string, service: T): T;
1009
1025
  }
1010
1026
 
1011
- export { type ActInput, type ApprovalAction, type ApprovalActionDto, type ApprovalDeps, type ApprovalFlow, type ApprovalInstance, type ApprovalInstanceByUser, ApprovalService, ApprovalStatus, type ApprovalStep, type ApproverMapping, type AuditContext, type AuditContextProvider, AuditCore, type AuditLogPayload, AuditLogger, AuditProxy, type BulkAtomicResult, type BulkConfig, type BulkConflictConfig, type BulkOnConflict, type CacheAdapter, type CalculationRes, type ColValue, type CommonApproveReq, type CommonCreateRequestRepository, type CommonExcelRequest, type CommonFilterRequest, type CommonFilterWithDate, type CommonGetApprovalActionReq, type CommonServiceResponse, type CommonUpdateRequestRepository, type Config, type Context, type CreateApprovalFlow, type CreateUINConfigRequest, type CrudContext, type CrudDelegate, type DataType, type DeepMerge, type DeleteParams, type DeleteRequestRepository, type Deps, type DropdownRequest, type DropdownRequestService, type DtoFromMapping, type DtoNullOnMissing, type DynamicCreateInput, type DynamicCrudConfig, type DynamicShortCode, type DynamicUpdateInput, type EmitPayload, type EmployeeCache, type EventInstance, type ExcelConfig, type ExportExcel, type ExportExcelRequestService, type FetchRequest, type FetchRequestRepository, type FieldConfig, type FieldRules, type FieldType, type FixedMap, type FixedSearchRequest, type FixedSearchRequestService, FlowType, type FlowWithSelectedStepResponse, type FlowWithStepsResponse, type GetMyApprovalFlow, type GetPendingApprovalReq, type Helpers, type IApprovalStep, type IChildConfigData, type IChildConfigJSON, type ICommonApprovalUpdate, type IParentConfigData, type IParentConfigJSON, type ImportExcel, type ImportExcelRequestService, type LevelDoneEvt, type LevelReadyEvt, type LockUnlockParams, type LockUnlockRequestRepository, type LogicNode, type Mapper, type MergeAll, type NewFixedSearchRequest, type NewFixedSearchRequestService, type NewSearchRequest, NotificationEmitter, type NotificationEvent, type Op, type PaginatedResponse, type PathToSelectWithSelect, type PathValue, type PathsToSelectWithSelect, type Presence, type PrismaTransactionClient, type RawFlowWithSelectedStepResponse, type Recipient, type RelationConfig, type RelationStrategy, type RelationWriteConfig, type SearchRequest, type SearchRequestService, type ServiceCacheAdapter, type SingleValidationMapping, type SourcePath, type StartFlowReq, type StepType, type Store, type ToggleActive, type TxClient, type UINConfigDTO, type UINPreviewRequest, type UINSegment, type UINSegmentType, type UIN_RESET_POLICY, type UinDeps, type UnionToIntersection, type UniqueConfig, type UpdateApprovalFlow, type UpdateConfigByCodeInput, type UpdateStatusRequestRepository, type UpdateUINConfigRequest, type ValidationErrorItem, approvalRepository, commonService, convertArrayPatternToEachBlocksGeneric, customOmit, findDifferences, formatDatesDeep, fromTimestampToSqlDatetime, getDynamicValue, getNestedValue, getNestedValueV2, getPattern, interpolate, objectTo2DArray, renderEmailTemplate, renderTemplate, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
1027
+ export { type ActInput, ActionMode, type ApprovalAction, type ApprovalActionDto, type ApprovalDeps, type ApprovalFlow, type ApprovalInstance, type ApprovalInstanceByUser, ApprovalService, ApprovalStatus, type ApprovalStep, type ApproverMapping, type AuditContext, type AuditContextProvider, AuditCore, type AuditLogPayload, AuditLogger, AuditProxy, type BulkAtomicResult, type BulkConfig, type BulkConflictConfig, type BulkOnConflict, type CacheAdapter, type CalculationRes, type ColValue, type CommonApproveReq, type CommonCreateRequestRepository, type CommonExcelRequest, type CommonFilterRequest, type CommonFilterWithDate, type CommonGetApprovalActionReq, type CommonServiceResponse, type CommonUpdateRequestRepository, type Config, type Context, type CreateApprovalFlow, type CreateUINConfigRequest, type CrudContext, type CrudDelegate, type DataType, type DeepMerge, type DeleteParams, type DeleteRequestRepository, type Deps, type DropdownRequest, type DropdownRequestService, type DtoFromMapping, type DtoNullOnMissing, type DynamicCreateInput, type DynamicCrudConfig, type DynamicShortCode, type DynamicUpdateInput, type EmitPayload, type EmployeeCache, type EventInstance, type ExcelConfig, type ExportExcel, type ExportExcelRequestService, type FetchRequest, type FetchRequestRepository, type FieldConfig, type FieldRules, type FieldType, type FixedMap, type FixedSearchRequest, type FixedSearchRequestService, FlowType, type FlowWithSelectedStepResponse, type FlowWithStepsResponse, type GetMyApprovalFlow, type GetPendingApprovalReq, type Helpers, type IApprovalStep, type IChildConfigData, type IChildConfigJSON, type ICommonApprovalUpdate, type IParentConfigData, type IParentConfigJSON, type ImportExcel, type ImportExcelRequestService, type LevelDoneEvt, type LevelReadyEvt, type LockUnlockParams, type LockUnlockRequestRepository, type LogicNode, type Mapper, type MergeAll, type NewFixedSearchRequest, type NewFixedSearchRequestService, type NewSearchRequest, NotificationEmitter, type NotificationEvent, type Op, type PaginatedResponse, type PathToSelectWithSelect, type PathValue, type PathsToSelectWithSelect, type Presence, type PrismaTransactionClient, type RawFlowWithSelectedStepResponse, type Recipient, type RelationConfig, type RelationStrategy, type RelationWriteConfig, type SearchRequest, type SearchRequestService, type ServiceCacheAdapter, type SingleValidationMapping, type SourcePath, type StartFlowReq, type StepType, type Store, type ToggleActive, type TxClient, type UINConfigDTO, type UINPreviewRequest, type UINSegment, type UINSegmentType, type UIN_RESET_POLICY, type UinDeps, type UnionToIntersection, type UniqueConfig, type UpdateApprovalFlow, type UpdateConfigByCodeInput, type UpdateStatusRequestRepository, type UpdateUINConfigRequest, type ValidationErrorItem, approvalRepository, commonService, convertArrayPatternToEachBlocksGeneric, customOmit, findDifferences, formatDatesDeep, fromTimestampToSqlDatetime, getDynamicValue, getNestedValue, getNestedValueV2, getPattern, interpolate, objectTo2DArray, renderEmailTemplate, renderTemplate, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
package/dist/index.d.ts CHANGED
@@ -537,6 +537,10 @@ declare enum FlowType {
537
537
  REFUND = 5
538
538
  }
539
539
  type StepType = "MIN_MAX" | "NORMAL";
540
+ declare enum ActionMode {
541
+ CONFIG_EVENT = "CONFIG_EVENT",
542
+ WEBHOOK = "WEBHOOK"
543
+ }
540
544
  type ApprovalStep = {
541
545
  id?: number;
542
546
  flowId: number;
@@ -592,6 +596,10 @@ type ApprovalFlow = {
592
596
  createdAt: Date;
593
597
  updatedAt: Date;
594
598
  flowType: FlowType;
599
+ actionType: ActionMode;
600
+ approveActionUrl: string | null;
601
+ rejectActionUrl: string | null;
602
+ partiallyApproveActionUrl: string | null;
595
603
  };
596
604
  type ApprovalAction = {
597
605
  id: number;
@@ -809,10 +817,18 @@ declare class ApprovalService {
809
817
  act({ instanceId, approverId, action, ccId, comment }: ActInput): Promise<any>;
810
818
  private emitEvents;
811
819
  private assertPermission;
820
+ getAllApprovalFlow(input: GetMyApprovalFlow): Promise<PaginatedResponse<ApprovalInstanceByUser>>;
821
+ getApprovalActDetailsBySubjectId(subjectId: number, subjectType: string, service: string): Promise<ApprovalAction[]>;
812
822
  }
813
823
 
814
824
  declare const approvalRepository: (helpers: Helpers) => {
815
825
  findMatchingFlow(tx: PrismaClient | Prisma.TransactionClient, type: string, service: string, ccId: number, netTotal: number, level?: number): Promise<RawFlowWithSelectedStepResponse | null>;
826
+ getAllApprovalFlow(tx: PrismaClient | Prisma.TransactionClient, { staffId, ccId, pageNo, pageSize, service, sortDir, startDate, endDate, searchText, status, flowType, }: GetMyApprovalFlow): Promise<PaginatedResponse<ApprovalInstanceByUser>>;
827
+ getApprovalActDetailsBySubjectId(tx: PrismaClient | Prisma.TransactionClient, { subjectId, subjectType, service }: {
828
+ subjectId: number;
829
+ subjectType: string;
830
+ service: string;
831
+ }): Promise<any>;
816
832
  };
817
833
 
818
834
  declare function customOmit<T extends object, K extends keyof T>(obj: T, keys: K[]): {
@@ -1008,4 +1024,4 @@ declare class AuditProxy<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_
1008
1024
  createAuditedService<T extends object>(serviceName: string, service: T): T;
1009
1025
  }
1010
1026
 
1011
- export { type ActInput, type ApprovalAction, type ApprovalActionDto, type ApprovalDeps, type ApprovalFlow, type ApprovalInstance, type ApprovalInstanceByUser, ApprovalService, ApprovalStatus, type ApprovalStep, type ApproverMapping, type AuditContext, type AuditContextProvider, AuditCore, type AuditLogPayload, AuditLogger, AuditProxy, type BulkAtomicResult, type BulkConfig, type BulkConflictConfig, type BulkOnConflict, type CacheAdapter, type CalculationRes, type ColValue, type CommonApproveReq, type CommonCreateRequestRepository, type CommonExcelRequest, type CommonFilterRequest, type CommonFilterWithDate, type CommonGetApprovalActionReq, type CommonServiceResponse, type CommonUpdateRequestRepository, type Config, type Context, type CreateApprovalFlow, type CreateUINConfigRequest, type CrudContext, type CrudDelegate, type DataType, type DeepMerge, type DeleteParams, type DeleteRequestRepository, type Deps, type DropdownRequest, type DropdownRequestService, type DtoFromMapping, type DtoNullOnMissing, type DynamicCreateInput, type DynamicCrudConfig, type DynamicShortCode, type DynamicUpdateInput, type EmitPayload, type EmployeeCache, type EventInstance, type ExcelConfig, type ExportExcel, type ExportExcelRequestService, type FetchRequest, type FetchRequestRepository, type FieldConfig, type FieldRules, type FieldType, type FixedMap, type FixedSearchRequest, type FixedSearchRequestService, FlowType, type FlowWithSelectedStepResponse, type FlowWithStepsResponse, type GetMyApprovalFlow, type GetPendingApprovalReq, type Helpers, type IApprovalStep, type IChildConfigData, type IChildConfigJSON, type ICommonApprovalUpdate, type IParentConfigData, type IParentConfigJSON, type ImportExcel, type ImportExcelRequestService, type LevelDoneEvt, type LevelReadyEvt, type LockUnlockParams, type LockUnlockRequestRepository, type LogicNode, type Mapper, type MergeAll, type NewFixedSearchRequest, type NewFixedSearchRequestService, type NewSearchRequest, NotificationEmitter, type NotificationEvent, type Op, type PaginatedResponse, type PathToSelectWithSelect, type PathValue, type PathsToSelectWithSelect, type Presence, type PrismaTransactionClient, type RawFlowWithSelectedStepResponse, type Recipient, type RelationConfig, type RelationStrategy, type RelationWriteConfig, type SearchRequest, type SearchRequestService, type ServiceCacheAdapter, type SingleValidationMapping, type SourcePath, type StartFlowReq, type StepType, type Store, type ToggleActive, type TxClient, type UINConfigDTO, type UINPreviewRequest, type UINSegment, type UINSegmentType, type UIN_RESET_POLICY, type UinDeps, type UnionToIntersection, type UniqueConfig, type UpdateApprovalFlow, type UpdateConfigByCodeInput, type UpdateStatusRequestRepository, type UpdateUINConfigRequest, type ValidationErrorItem, approvalRepository, commonService, convertArrayPatternToEachBlocksGeneric, customOmit, findDifferences, formatDatesDeep, fromTimestampToSqlDatetime, getDynamicValue, getNestedValue, getNestedValueV2, getPattern, interpolate, objectTo2DArray, renderEmailTemplate, renderTemplate, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
1027
+ export { type ActInput, ActionMode, type ApprovalAction, type ApprovalActionDto, type ApprovalDeps, type ApprovalFlow, type ApprovalInstance, type ApprovalInstanceByUser, ApprovalService, ApprovalStatus, type ApprovalStep, type ApproverMapping, type AuditContext, type AuditContextProvider, AuditCore, type AuditLogPayload, AuditLogger, AuditProxy, type BulkAtomicResult, type BulkConfig, type BulkConflictConfig, type BulkOnConflict, type CacheAdapter, type CalculationRes, type ColValue, type CommonApproveReq, type CommonCreateRequestRepository, type CommonExcelRequest, type CommonFilterRequest, type CommonFilterWithDate, type CommonGetApprovalActionReq, type CommonServiceResponse, type CommonUpdateRequestRepository, type Config, type Context, type CreateApprovalFlow, type CreateUINConfigRequest, type CrudContext, type CrudDelegate, type DataType, type DeepMerge, type DeleteParams, type DeleteRequestRepository, type Deps, type DropdownRequest, type DropdownRequestService, type DtoFromMapping, type DtoNullOnMissing, type DynamicCreateInput, type DynamicCrudConfig, type DynamicShortCode, type DynamicUpdateInput, type EmitPayload, type EmployeeCache, type EventInstance, type ExcelConfig, type ExportExcel, type ExportExcelRequestService, type FetchRequest, type FetchRequestRepository, type FieldConfig, type FieldRules, type FieldType, type FixedMap, type FixedSearchRequest, type FixedSearchRequestService, FlowType, type FlowWithSelectedStepResponse, type FlowWithStepsResponse, type GetMyApprovalFlow, type GetPendingApprovalReq, type Helpers, type IApprovalStep, type IChildConfigData, type IChildConfigJSON, type ICommonApprovalUpdate, type IParentConfigData, type IParentConfigJSON, type ImportExcel, type ImportExcelRequestService, type LevelDoneEvt, type LevelReadyEvt, type LockUnlockParams, type LockUnlockRequestRepository, type LogicNode, type Mapper, type MergeAll, type NewFixedSearchRequest, type NewFixedSearchRequestService, type NewSearchRequest, NotificationEmitter, type NotificationEvent, type Op, type PaginatedResponse, type PathToSelectWithSelect, type PathValue, type PathsToSelectWithSelect, type Presence, type PrismaTransactionClient, type RawFlowWithSelectedStepResponse, type Recipient, type RelationConfig, type RelationStrategy, type RelationWriteConfig, type SearchRequest, type SearchRequestService, type ServiceCacheAdapter, type SingleValidationMapping, type SourcePath, type StartFlowReq, type StepType, type Store, type ToggleActive, type TxClient, type UINConfigDTO, type UINPreviewRequest, type UINSegment, type UINSegmentType, type UIN_RESET_POLICY, type UinDeps, type UnionToIntersection, type UniqueConfig, type UpdateApprovalFlow, type UpdateConfigByCodeInput, type UpdateStatusRequestRepository, type UpdateUINConfigRequest, type ValidationErrorItem, approvalRepository, commonService, convertArrayPatternToEachBlocksGeneric, customOmit, findDifferences, formatDatesDeep, fromTimestampToSqlDatetime, getDynamicValue, getNestedValue, getNestedValueV2, getPattern, interpolate, objectTo2DArray, renderEmailTemplate, renderTemplate, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
package/dist/index.js CHANGED
@@ -5,6 +5,12 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
11
+ var __commonJS = (cb, mod) => function __require() {
12
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
+ };
8
14
  var __export = (target, all) => {
9
15
  for (var name in all)
10
16
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -27,9 +33,28 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
33
  ));
28
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
35
 
36
+ // node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js
37
+ var init_cjs_shims = __esm({
38
+ "node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js"() {
39
+ "use strict";
40
+ }
41
+ });
42
+
43
+ // node_modules/.pnpm/@prisma+client@6.19.3_prisma@6.19.3_typescript@5.9.3__typescript@5.9.3/node_modules/@prisma/client/default.js
44
+ var require_default = __commonJS({
45
+ "node_modules/.pnpm/@prisma+client@6.19.3_prisma@6.19.3_typescript@5.9.3__typescript@5.9.3/node_modules/@prisma/client/default.js"(exports2, module2) {
46
+ "use strict";
47
+ init_cjs_shims();
48
+ module2.exports = {
49
+ ...require(".prisma/client/default")
50
+ };
51
+ }
52
+ });
53
+
30
54
  // src/index.ts
31
55
  var index_exports = {};
32
56
  __export(index_exports, {
57
+ ActionMode: () => ActionMode,
33
58
  ApprovalService: () => ApprovalService,
34
59
  ApprovalStatus: () => ApprovalStatus,
35
60
  AuditCore: () => AuditCore,
@@ -57,8 +82,16 @@ __export(index_exports, {
57
82
  uinConfigService: () => uinConfigService
58
83
  });
59
84
  module.exports = __toCommonJS(index_exports);
85
+ init_cjs_shims();
86
+
87
+ // src/services/common.service.ts
88
+ init_cjs_shims();
89
+
90
+ // src/repository/common.repository.ts
91
+ init_cjs_shims();
60
92
 
61
93
  // src/utils/dynamicSearchHelper.ts
94
+ init_cjs_shims();
62
95
  var import_assert = require("assert");
63
96
  var import_util = require("util");
64
97
  function buildNestedCondition(keys, searchText, isNot = false) {
@@ -1012,7 +1045,11 @@ var commonRepository = (serviceDeps) => {
1012
1045
  };
1013
1046
  };
1014
1047
 
1048
+ // src/repository/commonCreateUpdate.repository.ts
1049
+ init_cjs_shims();
1050
+
1015
1051
  // src/utils/dynamicCreateUpdate.utils.ts
1052
+ init_cjs_shims();
1016
1053
  var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
1017
1054
  var getByPath = (root, path) => {
1018
1055
  if (!path) return void 0;
@@ -1033,6 +1070,7 @@ var omitUndefined = (obj) => {
1033
1070
  };
1034
1071
 
1035
1072
  // src/utils/dynamicPrismaBuilder.utils.ts
1073
+ init_cjs_shims();
1036
1074
  var resolveSrc = (f, env) => {
1037
1075
  const src = f.src ?? `body.${f.db}`;
1038
1076
  if (src.startsWith("body.")) return getByPath(env.body, src.slice(5));
@@ -1316,10 +1354,12 @@ var commonCreateUpdateRepository = (serviceDeps) => {
1316
1354
  };
1317
1355
 
1318
1356
  // src/utils/dynamicJoiBuilder.utils.ts
1357
+ init_cjs_shims();
1319
1358
  var import_joi = __toESM(require("joi"));
1320
1359
  var import_dayjs2 = __toESM(require("dayjs"));
1321
1360
 
1322
1361
  // src/utils/helper.utils.ts
1362
+ init_cjs_shims();
1323
1363
  var import_dayjs = __toESM(require("dayjs"));
1324
1364
  function customOmit(obj, keys) {
1325
1365
  const rest = { ...obj };
@@ -1651,6 +1691,7 @@ var buildJoiSchemaForOp = (cfg, op, ctx) => {
1651
1691
  };
1652
1692
 
1653
1693
  // src/utils/dynamicOperation.utils.ts
1694
+ init_cjs_shims();
1654
1695
  var import_av6_utils = require("av6-utils");
1655
1696
  var OP_PRECEDENCE = {
1656
1697
  "u-": 3,
@@ -2304,7 +2345,39 @@ var commonService = (serviceDeps) => {
2304
2345
  };
2305
2346
  };
2306
2347
 
2348
+ // src/services/approval.service.ts
2349
+ init_cjs_shims();
2350
+
2307
2351
  // src/repository/approval.repository.ts
2352
+ init_cjs_shims();
2353
+
2354
+ // src/types/approval.type.ts
2355
+ init_cjs_shims();
2356
+ var ApprovalStatus = /* @__PURE__ */ ((ApprovalStatus2) => {
2357
+ ApprovalStatus2[ApprovalStatus2["PENDING"] = 0] = "PENDING";
2358
+ ApprovalStatus2[ApprovalStatus2["PARTIALLY_APPROVED"] = 1] = "PARTIALLY_APPROVED";
2359
+ ApprovalStatus2[ApprovalStatus2["APPROVED"] = 2] = "APPROVED";
2360
+ ApprovalStatus2[ApprovalStatus2["REJECTED"] = 3] = "REJECTED";
2361
+ ApprovalStatus2[ApprovalStatus2["CANCELLED"] = 4] = "CANCELLED";
2362
+ return ApprovalStatus2;
2363
+ })(ApprovalStatus || {});
2364
+ var FlowType = /* @__PURE__ */ ((FlowType3) => {
2365
+ FlowType3[FlowType3["STATUS"] = 0] = "STATUS";
2366
+ FlowType3[FlowType3["CO_PAY"] = 1] = "CO_PAY";
2367
+ FlowType3[FlowType3["INDIVIDUAL_DISCOUNT"] = 2] = "INDIVIDUAL_DISCOUNT";
2368
+ FlowType3[FlowType3["OVERALL_DISCOUNT"] = 3] = "OVERALL_DISCOUNT";
2369
+ FlowType3[FlowType3["SPECIAL_DISCOUNT"] = 4] = "SPECIAL_DISCOUNT";
2370
+ FlowType3[FlowType3["REFUND"] = 5] = "REFUND";
2371
+ return FlowType3;
2372
+ })(FlowType || {});
2373
+ var ActionMode = /* @__PURE__ */ ((ActionMode2) => {
2374
+ ActionMode2["CONFIG_EVENT"] = "CONFIG_EVENT";
2375
+ ActionMode2["WEBHOOK"] = "WEBHOOK";
2376
+ return ActionMode2;
2377
+ })(ActionMode || {});
2378
+
2379
+ // src/repository/approval.repository.ts
2380
+ var import_client = __toESM(require_default());
2308
2381
  var approvalRepository = (helpers) => {
2309
2382
  return {
2310
2383
  async findMatchingFlow(tx, type, service, ccId, netTotal, level = 1) {
@@ -2332,29 +2405,116 @@ var approvalRepository = (helpers) => {
2332
2405
  throw new helpers.ErrorHandler(400, "No matching flow found.");
2333
2406
  }
2334
2407
  return result[0];
2408
+ },
2409
+ async getAllApprovalFlow(tx, {
2410
+ staffId,
2411
+ ccId,
2412
+ pageNo = 1,
2413
+ pageSize = 1e4,
2414
+ service,
2415
+ sortDir = "ASC",
2416
+ startDate,
2417
+ endDate,
2418
+ searchText = "",
2419
+ status = [0 /* PENDING */, 1 /* PARTIALLY_APPROVED */],
2420
+ flowType
2421
+ }) {
2422
+ const offset = (pageNo - 1) * pageSize;
2423
+ const serviceLike = `%${service}%`;
2424
+ const pattern = searchText ? `%${searchText.replace(/[%_]/g, "\\$&")}%` : "%";
2425
+ const validSortDir = sortDir === "DESC" ? "DESC" : "ASC";
2426
+ const baseWhereConditions = import_client.Prisma.sql`
2427
+ ( cam.staff_id = ${staffId} or scc.staff_id = ${staffId} )
2428
+ and cai.status in (${import_client.Prisma.join(status)})
2429
+ and LOWER(cai.service) like LOWER(${serviceLike})
2430
+ and LOWER(cai.ref_no) like LOWER(${pattern})
2431
+ and cam.cc_id = ${ccId}
2432
+ and cai.is_active = 1
2433
+ and cas.is_active = 1
2434
+ and cam.is_active = 1`;
2435
+ let dateFilter = import_client.Prisma.empty;
2436
+ if (startDate && endDate) {
2437
+ const startDateTime = fromTimestampToSqlDatetime(startDate);
2438
+ const endDateTime = fromTimestampToSqlDatetime(endDate);
2439
+ dateFilter = import_client.Prisma.sql`and cai.created_at between ${startDateTime} and ${endDateTime}`;
2440
+ }
2441
+ let flowTypeFilter = import_client.Prisma.empty;
2442
+ if (flowType) {
2443
+ flowTypeFilter = import_client.Prisma.sql`and caf.flow_type = ${flowType}`;
2444
+ }
2445
+ const countQuery = import_client.Prisma.sql`
2446
+ SELECT COUNT(DISTINCT cai.id) as total
2447
+ FROM
2448
+ core_approval_instance cai
2449
+ JOIN core_approval_step cas on cai.current_step = cas.id
2450
+ JOIN core_approval_flow caf on cas.flow_id = caf.id
2451
+ JOIN core_approver_mapping cam on cas.id = cam.step_id and cam.is_active = 1
2452
+ LEFT JOIN staff_roles sr on sr.role_id = cam.role_id
2453
+ LEFT JOIN staff_collection_center scc on (scc.collection_center_id = cam.cc_id and scc.staff_id = sr.staff_id)
2454
+ LEFT JOIN staff s on s.id = cai.created_by
2455
+ WHERE
2456
+ ${baseWhereConditions}
2457
+ ${flowTypeFilter}
2458
+ ${dateFilter}`;
2459
+ const countResult = await tx.$queryRaw(countQuery);
2460
+ const total = countResult[0]?.total ?? 0n;
2461
+ const dataQuery = import_client.Prisma.sql`
2462
+ SELECT DISTINCT
2463
+ cai.id,
2464
+ cai.flow_id as flowId,
2465
+ cai.subject_type as subjectType,
2466
+ cai.service as service,
2467
+ cai.subject_id as subjectId,
2468
+ cai.ref_no as refNo,
2469
+ cai.current_step as currentStepId,
2470
+ cai.net_total as netTotal,
2471
+ cai.status,
2472
+ cai.extra,
2473
+ s.name as createdBy,
2474
+ caf.flow_type as flowType,
2475
+ caf.name as flowName,
2476
+ cai.created_at as createdAt,
2477
+ cas.level
2478
+ FROM
2479
+ core_approval_instance cai
2480
+ JOIN core_approval_step cas on cai.current_step = cas.id
2481
+ JOIN core_approval_flow caf on cas.flow_id = caf.id
2482
+ JOIN core_approver_mapping cam on cas.id = cam.step_id and cam.is_active = 1
2483
+ LEFT JOIN staff_roles sr on sr.role_id = cam.role_id
2484
+ LEFT JOIN staff_collection_center scc on (scc.collection_center_id = cam.cc_id and scc.staff_id = sr.staff_id)
2485
+ LEFT JOIN staff s on s.id = cai.created_by
2486
+ WHERE
2487
+ ${baseWhereConditions}
2488
+ ${flowTypeFilter}
2489
+ ${dateFilter}
2490
+ GROUP BY cai.id
2491
+ ORDER BY cai.id ${import_client.Prisma.raw(validSortDir)}
2492
+ LIMIT ${pageSize}
2493
+ OFFSET ${offset}`;
2494
+ const result = await tx.$queryRaw(dataQuery);
2495
+ return {
2496
+ data: result,
2497
+ totalRecords: Number(total),
2498
+ currentPageNumber: pageNo,
2499
+ lastPageNumber: Math.ceil(Number(total) / pageSize),
2500
+ pageSize
2501
+ };
2502
+ },
2503
+ async getApprovalActDetailsBySubjectId(tx, { subjectId, subjectType, service }) {
2504
+ return tx.approvalAction.findMany({
2505
+ where: {
2506
+ approvalInstance: {
2507
+ subjectType,
2508
+ subjectId,
2509
+ service
2510
+ },
2511
+ isActive: true
2512
+ }
2513
+ });
2335
2514
  }
2336
2515
  };
2337
2516
  };
2338
2517
 
2339
- // src/types/approval.type.ts
2340
- var ApprovalStatus = /* @__PURE__ */ ((ApprovalStatus2) => {
2341
- ApprovalStatus2[ApprovalStatus2["PENDING"] = 0] = "PENDING";
2342
- ApprovalStatus2[ApprovalStatus2["PARTIALLY_APPROVED"] = 1] = "PARTIALLY_APPROVED";
2343
- ApprovalStatus2[ApprovalStatus2["APPROVED"] = 2] = "APPROVED";
2344
- ApprovalStatus2[ApprovalStatus2["REJECTED"] = 3] = "REJECTED";
2345
- ApprovalStatus2[ApprovalStatus2["CANCELLED"] = 4] = "CANCELLED";
2346
- return ApprovalStatus2;
2347
- })(ApprovalStatus || {});
2348
- var FlowType = /* @__PURE__ */ ((FlowType3) => {
2349
- FlowType3[FlowType3["STATUS"] = 0] = "STATUS";
2350
- FlowType3[FlowType3["CO_PAY"] = 1] = "CO_PAY";
2351
- FlowType3[FlowType3["INDIVIDUAL_DISCOUNT"] = 2] = "INDIVIDUAL_DISCOUNT";
2352
- FlowType3[FlowType3["OVERALL_DISCOUNT"] = 3] = "OVERALL_DISCOUNT";
2353
- FlowType3[FlowType3["SPECIAL_DISCOUNT"] = 4] = "SPECIAL_DISCOUNT";
2354
- FlowType3[FlowType3["REFUND"] = 5] = "REFUND";
2355
- return FlowType3;
2356
- })(FlowType || {});
2357
-
2358
2518
  // src/services/approval.service.ts
2359
2519
  var ApprovalService = class {
2360
2520
  constructor(deps) {
@@ -2456,7 +2616,16 @@ var ApprovalService = class {
2456
2616
  status: newStatus
2457
2617
  }
2458
2618
  });
2459
- setImmediate(() => this.emitEvents(updated, inst.flow?.flowType, approverId, step, comment));
2619
+ setImmediate(
2620
+ () => this.emitEvents({
2621
+ instance: updated,
2622
+ flowType: inst.flow?.flowType,
2623
+ approverId,
2624
+ step,
2625
+ comment,
2626
+ approvalFlow: inst.flow
2627
+ })
2628
+ );
2460
2629
  this.deps.eventBus.emit("approval:LEVEL_DONE", {
2461
2630
  instanceId: inst.id,
2462
2631
  level: step.level,
@@ -2539,17 +2708,79 @@ var ApprovalService = class {
2539
2708
  // });
2540
2709
  // }
2541
2710
  // }
2542
- emitEvents(instance, flowType, approverId, step, comment) {
2543
- this.deps.eventBus.emit(`approval:${instance.status}`, {
2544
- instanceId: instance.id,
2545
- flowType,
2546
- subjectId: instance.subjectId,
2547
- approverId,
2548
- step,
2549
- comment,
2550
- subjectType: instance.subjectType,
2551
- service: instance.service
2552
- });
2711
+ async emitEvents({
2712
+ instance,
2713
+ flowType,
2714
+ approverId,
2715
+ step,
2716
+ comment,
2717
+ approvalFlow
2718
+ }) {
2719
+ if (approvalFlow.actionType === "CONFIG_EVENT" /* CONFIG_EVENT */) {
2720
+ this.deps.eventBus.emit(`approval:${instance.status}`, {
2721
+ instanceId: instance.id,
2722
+ flowType,
2723
+ subjectId: instance.subjectId,
2724
+ approverId,
2725
+ step,
2726
+ comment,
2727
+ subjectType: instance.subjectType,
2728
+ service: instance.service
2729
+ });
2730
+ } else {
2731
+ switch (instance.status) {
2732
+ case 2 /* APPROVED */:
2733
+ if (approvalFlow.approveActionUrl) {
2734
+ const res = await fetch(approvalFlow.approveActionUrl, {
2735
+ method: "POST",
2736
+ headers: {
2737
+ "Content-Type": "application/json"
2738
+ },
2739
+ body: JSON.stringify({ id: instance.id, subjectId: instance.subjectId })
2740
+ });
2741
+ if (!res.ok) {
2742
+ this.deps.logger.error(
2743
+ "[Approval Service] Approve action URL webhook failed",
2744
+ res.status,
2745
+ res.statusText
2746
+ );
2747
+ }
2748
+ }
2749
+ break;
2750
+ case 3 /* REJECTED */:
2751
+ if (approvalFlow.rejectActionUrl) {
2752
+ const res = await fetch(approvalFlow.rejectActionUrl, {
2753
+ method: "POST",
2754
+ headers: {
2755
+ "Content-Type": "application/json"
2756
+ }
2757
+ });
2758
+ if (!res.ok) {
2759
+ this.deps.logger.error("[Approval Service] Reject action URL webhook failed", res.status, res.statusText);
2760
+ }
2761
+ }
2762
+ break;
2763
+ case 1 /* PARTIALLY_APPROVED */:
2764
+ if (approvalFlow.partiallyApproveActionUrl) {
2765
+ const res = await fetch(approvalFlow.partiallyApproveActionUrl, {
2766
+ method: "POST",
2767
+ headers: {
2768
+ "Content-Type": "application/json"
2769
+ }
2770
+ });
2771
+ if (!res.ok) {
2772
+ this.deps.logger.error(
2773
+ "[Approval Service] Partially approve action URL webhook failed",
2774
+ res.status,
2775
+ res.statusText
2776
+ );
2777
+ }
2778
+ }
2779
+ break;
2780
+ default:
2781
+ break;
2782
+ }
2783
+ }
2553
2784
  }
2554
2785
  async assertPermission(step, approverId, instanceId, ccId, tx) {
2555
2786
  const result = await tx.$queryRaw(`
@@ -2610,9 +2841,22 @@ var ApprovalService = class {
2610
2841
  }
2611
2842
  return step;
2612
2843
  }
2844
+ async getAllApprovalFlow(input) {
2845
+ this.deps.logger.info("entering:getAllApprovalFlow --" + JSON.stringify({ input }));
2846
+ const instance = await this.approvalRepo.getAllApprovalFlow(this.deps.prisma, input);
2847
+ this.deps.logger.info("exiting:getAllApprovalFlow --" + JSON.stringify({ instance }));
2848
+ return instance;
2849
+ }
2850
+ async getApprovalActDetailsBySubjectId(subjectId, subjectType, service) {
2851
+ this.deps.logger.info(
2852
+ "entering:getApprovalActDetailsBySubjectId --" + JSON.stringify({ subjectId, subjectType, service })
2853
+ );
2854
+ return this.approvalRepo.getApprovalActDetailsBySubjectId(this.deps.prisma, { subjectId, subjectType, service });
2855
+ }
2613
2856
  };
2614
2857
 
2615
2858
  // src/utils/audit.utils.ts
2859
+ init_cjs_shims();
2616
2860
  function isValidDate(value) {
2617
2861
  if (value instanceof Date) {
2618
2862
  return !isNaN(value.getTime());
@@ -2660,6 +2904,7 @@ function findDifferences(obj1, obj2) {
2660
2904
  }
2661
2905
 
2662
2906
  // src/utils/renderer.ts
2907
+ init_cjs_shims();
2663
2908
  var import_handlebars = __toESM(require("handlebars"));
2664
2909
  function renderTemplate(tpl, data) {
2665
2910
  return import_handlebars.default.compile(tpl)(data);
@@ -2693,7 +2938,17 @@ var convertArrayPatternToEachBlocksGeneric = (html) => {
2693
2938
  return output;
2694
2939
  };
2695
2940
 
2941
+ // src/types/common.ts
2942
+ init_cjs_shims();
2943
+
2944
+ // src/types/dynamicCreateUpdate.type.ts
2945
+ init_cjs_shims();
2946
+
2947
+ // src/services/uinConfig.service.ts
2948
+ init_cjs_shims();
2949
+
2696
2950
  // src/mapper/uinConfig.mapper.ts
2951
+ init_cjs_shims();
2697
2952
  var toUINConfigDTO = (model) => {
2698
2953
  return {
2699
2954
  id: model.id,
@@ -2711,6 +2966,7 @@ var toUINConfigDTO = (model) => {
2711
2966
  };
2712
2967
 
2713
2968
  // src/repository/uinConfig.repository.ts
2969
+ init_cjs_shims();
2714
2970
  var uinConfigRepository = (uinDeps) => {
2715
2971
  const db = uinDeps.db;
2716
2972
  const logger = uinDeps.logger;
@@ -2796,6 +3052,7 @@ var uinConfigRepository = (uinDeps) => {
2796
3052
  };
2797
3053
 
2798
3054
  // src/validation/uinConfig.service.validation.ts
3055
+ init_cjs_shims();
2799
3056
  var uinConfigServiceValidation = (uinDeps) => {
2800
3057
  const { generateErrorMessage, ErrorHandler } = uinDeps.helpers;
2801
3058
  const logger = uinDeps.logger;
@@ -2997,7 +3254,20 @@ var uinConfigService = (uinDeps) => {
2997
3254
  };
2998
3255
  };
2999
3256
 
3257
+ // src/types/uinConfig.ts
3258
+ init_cjs_shims();
3259
+
3260
+ // src/events/eventEmitter.ts
3261
+ init_cjs_shims();
3262
+
3263
+ // src/services/audit.service.ts
3264
+ init_cjs_shims();
3265
+
3266
+ // src/services/notification.service.ts
3267
+ init_cjs_shims();
3268
+
3000
3269
  // src/providers/app.provider.ts
3270
+ init_cjs_shims();
3001
3271
  var ExpoAppNotificationProvider = class {
3002
3272
  constructor(logger = console, url = "https://api.expo.dev/v2/push/send") {
3003
3273
  this.logger = logger;
@@ -3035,7 +3305,11 @@ var ExpoAppNotificationProvider = class {
3035
3305
  }
3036
3306
  };
3037
3307
 
3308
+ // src/providers/email.providers.ts
3309
+ init_cjs_shims();
3310
+
3038
3311
  // src/types/notification.ts
3312
+ init_cjs_shims();
3039
3313
  var TemplateType = /* @__PURE__ */ ((TemplateType2) => {
3040
3314
  TemplateType2["EMAIL"] = "EMAIL";
3041
3315
  TemplateType2["SMS"] = "SMS";
@@ -3125,6 +3399,7 @@ var EmailProvider = class {
3125
3399
  };
3126
3400
 
3127
3401
  // src/providers/sms.provider.ts
3402
+ init_cjs_shims();
3128
3403
  var import_axios2 = __toESM(require("axios"));
3129
3404
  var import_node_https = __toESM(require("https"));
3130
3405
  var import_promises = __toESM(require("dns/promises"));
@@ -3275,6 +3550,7 @@ var SmsProvider = class {
3275
3550
  };
3276
3551
 
3277
3552
  // src/providers/web.provider.ts
3553
+ init_cjs_shims();
3278
3554
  var WebNotificationProvider = class {
3279
3555
  constructor(prisma, logger = console) {
3280
3556
  this.prisma = prisma;
@@ -3318,9 +3594,11 @@ var WebNotificationProvider = class {
3318
3594
  };
3319
3595
 
3320
3596
  // src/providers/whatsapp.provider.ts
3597
+ init_cjs_shims();
3321
3598
  var import_axios3 = __toESM(require("axios"));
3322
3599
 
3323
3600
  // src/utils/notification.utils.ts
3601
+ init_cjs_shims();
3324
3602
  function defaultValueField(t) {
3325
3603
  if (t === "EMAIL") return "EMAIL";
3326
3604
  if (t === "APP_NOTIFICATION") return "USER_ID";
@@ -4479,7 +4757,11 @@ var NotificationEmitter = class {
4479
4757
  }
4480
4758
  };
4481
4759
 
4760
+ // src/types/audit.ts
4761
+ init_cjs_shims();
4762
+
4482
4763
  // src/audit/audit.core.ts
4764
+ init_cjs_shims();
4483
4765
  var AuditCore = class {
4484
4766
  prisma;
4485
4767
  contextProvider;
@@ -4501,6 +4783,7 @@ var AuditCore = class {
4501
4783
  };
4502
4784
 
4503
4785
  // src/audit/audit.logger.ts
4786
+ init_cjs_shims();
4504
4787
  var AuditLogger = class {
4505
4788
  core;
4506
4789
  constructor(core) {
@@ -4552,6 +4835,7 @@ var AuditLogger = class {
4552
4835
  };
4553
4836
 
4554
4837
  // src/audit/audit.proxy.ts
4838
+ init_cjs_shims();
4555
4839
  var AuditProxy = class {
4556
4840
  logger;
4557
4841
  constructor(logger) {
@@ -4606,6 +4890,7 @@ var AuditProxy = class {
4606
4890
  };
4607
4891
  // Annotate the CommonJS export names for ESM import in node:
4608
4892
  0 && (module.exports = {
4893
+ ActionMode,
4609
4894
  ApprovalService,
4610
4895
  ApprovalStatus,
4611
4896
  AuditCore,
package/dist/index.mjs CHANGED
@@ -1,4 +1,69 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __esm = (fn, res) => function __init() {
14
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
15
+ };
16
+ var __commonJS = (cb, mod) => function __require2() {
17
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") {
21
+ for (let key of __getOwnPropNames(from))
22
+ if (!__hasOwnProp.call(to, key) && key !== except)
23
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
+ }
25
+ return to;
26
+ };
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
+ // If the importer is in node compatibility mode or this is not an ESM
29
+ // file that has been converted to a CommonJS file using a Babel-
30
+ // compatible transform (i.e. "__esModule" has not been set), then set
31
+ // "default" to the CommonJS "module.exports" for node compatibility.
32
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
33
+ mod
34
+ ));
35
+
36
+ // node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js
37
+ import path from "path";
38
+ import { fileURLToPath } from "url";
39
+ var init_esm_shims = __esm({
40
+ "node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js"() {
41
+ "use strict";
42
+ }
43
+ });
44
+
45
+ // node_modules/.pnpm/@prisma+client@6.19.3_prisma@6.19.3_typescript@5.9.3__typescript@5.9.3/node_modules/@prisma/client/default.js
46
+ var require_default = __commonJS({
47
+ "node_modules/.pnpm/@prisma+client@6.19.3_prisma@6.19.3_typescript@5.9.3__typescript@5.9.3/node_modules/@prisma/client/default.js"(exports, module) {
48
+ "use strict";
49
+ init_esm_shims();
50
+ module.exports = {
51
+ ...__require(".prisma/client/default")
52
+ };
53
+ }
54
+ });
55
+
56
+ // src/index.ts
57
+ init_esm_shims();
58
+
59
+ // src/services/common.service.ts
60
+ init_esm_shims();
61
+
62
+ // src/repository/common.repository.ts
63
+ init_esm_shims();
64
+
1
65
  // src/utils/dynamicSearchHelper.ts
66
+ init_esm_shims();
2
67
  import { deepStrictEqual as deepEqual } from "assert";
3
68
  import { isDeepStrictEqual } from "util";
4
69
  function buildNestedCondition(keys, searchText, isNot = false) {
@@ -203,9 +268,9 @@ function buildNestedConditionForSingleValue(keys, fieldType, val, isNot = false)
203
268
  }
204
269
  function buildPrismaSelect(mapping) {
205
270
  const select = {};
206
- for (const path of Object.values(mapping)) {
207
- if (typeof path !== "string") continue;
208
- const parts = path.split(".").map((s) => s.trim()).filter(Boolean);
271
+ for (const path2 of Object.values(mapping)) {
272
+ if (typeof path2 !== "string") continue;
273
+ const parts = path2.split(".").map((s) => s.trim()).filter(Boolean);
209
274
  if (!parts.length) continue;
210
275
  let cur = select;
211
276
  for (let i = 0; i < parts.length; i++) {
@@ -232,8 +297,8 @@ function buildPrismaSelect(mapping) {
232
297
  }
233
298
  return select;
234
299
  }
235
- function getByPathOrNull(row, path) {
236
- const parts = String(path || "").split(".").map((p) => p.trim()).filter(Boolean);
300
+ function getByPathOrNull(row, path2) {
301
+ const parts = String(path2 || "").split(".").map((p) => p.trim()).filter(Boolean);
237
302
  let cur = row;
238
303
  for (const key of parts) {
239
304
  if (cur == null) return null;
@@ -243,8 +308,8 @@ function getByPathOrNull(row, path) {
243
308
  }
244
309
  function toDynamicDropdownDto(mapping, row) {
245
310
  const out = {};
246
- for (const [dtoKey, path] of Object.entries(mapping)) {
247
- out[dtoKey] = getByPathOrNull(row, path);
311
+ for (const [dtoKey, path2] of Object.entries(mapping)) {
312
+ out[dtoKey] = getByPathOrNull(row, path2);
248
313
  }
249
314
  return out;
250
315
  }
@@ -952,11 +1017,15 @@ var commonRepository = (serviceDeps) => {
952
1017
  };
953
1018
  };
954
1019
 
1020
+ // src/repository/commonCreateUpdate.repository.ts
1021
+ init_esm_shims();
1022
+
955
1023
  // src/utils/dynamicCreateUpdate.utils.ts
1024
+ init_esm_shims();
956
1025
  var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
957
- var getByPath = (root, path) => {
958
- if (!path) return void 0;
959
- const parts = path.split(".");
1026
+ var getByPath = (root, path2) => {
1027
+ if (!path2) return void 0;
1028
+ const parts = path2.split(".");
960
1029
  let cur = root;
961
1030
  for (const p of parts) {
962
1031
  if (!isRecord(cur)) return void 0;
@@ -973,6 +1042,7 @@ var omitUndefined = (obj) => {
973
1042
  };
974
1043
 
975
1044
  // src/utils/dynamicPrismaBuilder.utils.ts
1045
+ init_esm_shims();
976
1046
  var resolveSrc = (f, env) => {
977
1047
  const src = f.src ?? `body.${f.db}`;
978
1048
  if (src.startsWith("body.")) return getByPath(env.body, src.slice(5));
@@ -1256,10 +1326,12 @@ var commonCreateUpdateRepository = (serviceDeps) => {
1256
1326
  };
1257
1327
 
1258
1328
  // src/utils/dynamicJoiBuilder.utils.ts
1329
+ init_esm_shims();
1259
1330
  import Joi from "joi";
1260
1331
  import dayjs2 from "dayjs";
1261
1332
 
1262
1333
  // src/utils/helper.utils.ts
1334
+ init_esm_shims();
1263
1335
  import dayjs from "dayjs";
1264
1336
  function customOmit(obj, keys) {
1265
1337
  const rest = { ...obj };
@@ -1282,18 +1354,18 @@ function getDynamicValue(obj, accessorKey) {
1282
1354
  }
1283
1355
  return result === void 0 ? null : result;
1284
1356
  }
1285
- function getNestedValue(obj, path, defaultValue) {
1286
- if (!obj || !path) return defaultValue;
1287
- const normalizedPath = path.replace(/\[(\d+)\]/g, ".$1");
1357
+ function getNestedValue(obj, path2, defaultValue) {
1358
+ if (!obj || !path2) return defaultValue;
1359
+ const normalizedPath = path2.replace(/\[(\d+)\]/g, ".$1");
1288
1360
  const result = normalizedPath.split(".").reduce((acc, key) => {
1289
1361
  if (acc == null) return void 0;
1290
1362
  return acc[key];
1291
1363
  }, obj);
1292
1364
  return result === void 0 ? defaultValue : result;
1293
1365
  }
1294
- function getNestedValueV2(obj, path, defaultValue) {
1295
- if (!obj || !path) return defaultValue;
1296
- const normalizedPath = path.replace(/\[(\d+)\]/g, ".$1");
1366
+ function getNestedValueV2(obj, path2, defaultValue) {
1367
+ if (!obj || !path2) return defaultValue;
1368
+ const normalizedPath = path2.replace(/\[(\d+)\]/g, ".$1");
1297
1369
  const keys = normalizedPath.split(".");
1298
1370
  const resolve = (current, index) => {
1299
1371
  if (current == null) return void 0;
@@ -1591,6 +1663,7 @@ var buildJoiSchemaForOp = (cfg, op, ctx) => {
1591
1663
  };
1592
1664
 
1593
1665
  // src/utils/dynamicOperation.utils.ts
1666
+ init_esm_shims();
1594
1667
  import { applyRound } from "av6-utils";
1595
1668
  var OP_PRECEDENCE = {
1596
1669
  "u-": 3,
@@ -2244,7 +2317,39 @@ var commonService = (serviceDeps) => {
2244
2317
  };
2245
2318
  };
2246
2319
 
2320
+ // src/services/approval.service.ts
2321
+ init_esm_shims();
2322
+
2323
+ // src/repository/approval.repository.ts
2324
+ init_esm_shims();
2325
+
2326
+ // src/types/approval.type.ts
2327
+ init_esm_shims();
2328
+ var ApprovalStatus = /* @__PURE__ */ ((ApprovalStatus2) => {
2329
+ ApprovalStatus2[ApprovalStatus2["PENDING"] = 0] = "PENDING";
2330
+ ApprovalStatus2[ApprovalStatus2["PARTIALLY_APPROVED"] = 1] = "PARTIALLY_APPROVED";
2331
+ ApprovalStatus2[ApprovalStatus2["APPROVED"] = 2] = "APPROVED";
2332
+ ApprovalStatus2[ApprovalStatus2["REJECTED"] = 3] = "REJECTED";
2333
+ ApprovalStatus2[ApprovalStatus2["CANCELLED"] = 4] = "CANCELLED";
2334
+ return ApprovalStatus2;
2335
+ })(ApprovalStatus || {});
2336
+ var FlowType = /* @__PURE__ */ ((FlowType3) => {
2337
+ FlowType3[FlowType3["STATUS"] = 0] = "STATUS";
2338
+ FlowType3[FlowType3["CO_PAY"] = 1] = "CO_PAY";
2339
+ FlowType3[FlowType3["INDIVIDUAL_DISCOUNT"] = 2] = "INDIVIDUAL_DISCOUNT";
2340
+ FlowType3[FlowType3["OVERALL_DISCOUNT"] = 3] = "OVERALL_DISCOUNT";
2341
+ FlowType3[FlowType3["SPECIAL_DISCOUNT"] = 4] = "SPECIAL_DISCOUNT";
2342
+ FlowType3[FlowType3["REFUND"] = 5] = "REFUND";
2343
+ return FlowType3;
2344
+ })(FlowType || {});
2345
+ var ActionMode = /* @__PURE__ */ ((ActionMode2) => {
2346
+ ActionMode2["CONFIG_EVENT"] = "CONFIG_EVENT";
2347
+ ActionMode2["WEBHOOK"] = "WEBHOOK";
2348
+ return ActionMode2;
2349
+ })(ActionMode || {});
2350
+
2247
2351
  // src/repository/approval.repository.ts
2352
+ var import_client = __toESM(require_default());
2248
2353
  var approvalRepository = (helpers) => {
2249
2354
  return {
2250
2355
  async findMatchingFlow(tx, type, service, ccId, netTotal, level = 1) {
@@ -2272,29 +2377,116 @@ var approvalRepository = (helpers) => {
2272
2377
  throw new helpers.ErrorHandler(400, "No matching flow found.");
2273
2378
  }
2274
2379
  return result[0];
2380
+ },
2381
+ async getAllApprovalFlow(tx, {
2382
+ staffId,
2383
+ ccId,
2384
+ pageNo = 1,
2385
+ pageSize = 1e4,
2386
+ service,
2387
+ sortDir = "ASC",
2388
+ startDate,
2389
+ endDate,
2390
+ searchText = "",
2391
+ status = [0 /* PENDING */, 1 /* PARTIALLY_APPROVED */],
2392
+ flowType
2393
+ }) {
2394
+ const offset = (pageNo - 1) * pageSize;
2395
+ const serviceLike = `%${service}%`;
2396
+ const pattern = searchText ? `%${searchText.replace(/[%_]/g, "\\$&")}%` : "%";
2397
+ const validSortDir = sortDir === "DESC" ? "DESC" : "ASC";
2398
+ const baseWhereConditions = import_client.Prisma.sql`
2399
+ ( cam.staff_id = ${staffId} or scc.staff_id = ${staffId} )
2400
+ and cai.status in (${import_client.Prisma.join(status)})
2401
+ and LOWER(cai.service) like LOWER(${serviceLike})
2402
+ and LOWER(cai.ref_no) like LOWER(${pattern})
2403
+ and cam.cc_id = ${ccId}
2404
+ and cai.is_active = 1
2405
+ and cas.is_active = 1
2406
+ and cam.is_active = 1`;
2407
+ let dateFilter = import_client.Prisma.empty;
2408
+ if (startDate && endDate) {
2409
+ const startDateTime = fromTimestampToSqlDatetime(startDate);
2410
+ const endDateTime = fromTimestampToSqlDatetime(endDate);
2411
+ dateFilter = import_client.Prisma.sql`and cai.created_at between ${startDateTime} and ${endDateTime}`;
2412
+ }
2413
+ let flowTypeFilter = import_client.Prisma.empty;
2414
+ if (flowType) {
2415
+ flowTypeFilter = import_client.Prisma.sql`and caf.flow_type = ${flowType}`;
2416
+ }
2417
+ const countQuery = import_client.Prisma.sql`
2418
+ SELECT COUNT(DISTINCT cai.id) as total
2419
+ FROM
2420
+ core_approval_instance cai
2421
+ JOIN core_approval_step cas on cai.current_step = cas.id
2422
+ JOIN core_approval_flow caf on cas.flow_id = caf.id
2423
+ JOIN core_approver_mapping cam on cas.id = cam.step_id and cam.is_active = 1
2424
+ LEFT JOIN staff_roles sr on sr.role_id = cam.role_id
2425
+ LEFT JOIN staff_collection_center scc on (scc.collection_center_id = cam.cc_id and scc.staff_id = sr.staff_id)
2426
+ LEFT JOIN staff s on s.id = cai.created_by
2427
+ WHERE
2428
+ ${baseWhereConditions}
2429
+ ${flowTypeFilter}
2430
+ ${dateFilter}`;
2431
+ const countResult = await tx.$queryRaw(countQuery);
2432
+ const total = countResult[0]?.total ?? 0n;
2433
+ const dataQuery = import_client.Prisma.sql`
2434
+ SELECT DISTINCT
2435
+ cai.id,
2436
+ cai.flow_id as flowId,
2437
+ cai.subject_type as subjectType,
2438
+ cai.service as service,
2439
+ cai.subject_id as subjectId,
2440
+ cai.ref_no as refNo,
2441
+ cai.current_step as currentStepId,
2442
+ cai.net_total as netTotal,
2443
+ cai.status,
2444
+ cai.extra,
2445
+ s.name as createdBy,
2446
+ caf.flow_type as flowType,
2447
+ caf.name as flowName,
2448
+ cai.created_at as createdAt,
2449
+ cas.level
2450
+ FROM
2451
+ core_approval_instance cai
2452
+ JOIN core_approval_step cas on cai.current_step = cas.id
2453
+ JOIN core_approval_flow caf on cas.flow_id = caf.id
2454
+ JOIN core_approver_mapping cam on cas.id = cam.step_id and cam.is_active = 1
2455
+ LEFT JOIN staff_roles sr on sr.role_id = cam.role_id
2456
+ LEFT JOIN staff_collection_center scc on (scc.collection_center_id = cam.cc_id and scc.staff_id = sr.staff_id)
2457
+ LEFT JOIN staff s on s.id = cai.created_by
2458
+ WHERE
2459
+ ${baseWhereConditions}
2460
+ ${flowTypeFilter}
2461
+ ${dateFilter}
2462
+ GROUP BY cai.id
2463
+ ORDER BY cai.id ${import_client.Prisma.raw(validSortDir)}
2464
+ LIMIT ${pageSize}
2465
+ OFFSET ${offset}`;
2466
+ const result = await tx.$queryRaw(dataQuery);
2467
+ return {
2468
+ data: result,
2469
+ totalRecords: Number(total),
2470
+ currentPageNumber: pageNo,
2471
+ lastPageNumber: Math.ceil(Number(total) / pageSize),
2472
+ pageSize
2473
+ };
2474
+ },
2475
+ async getApprovalActDetailsBySubjectId(tx, { subjectId, subjectType, service }) {
2476
+ return tx.approvalAction.findMany({
2477
+ where: {
2478
+ approvalInstance: {
2479
+ subjectType,
2480
+ subjectId,
2481
+ service
2482
+ },
2483
+ isActive: true
2484
+ }
2485
+ });
2275
2486
  }
2276
2487
  };
2277
2488
  };
2278
2489
 
2279
- // src/types/approval.type.ts
2280
- var ApprovalStatus = /* @__PURE__ */ ((ApprovalStatus2) => {
2281
- ApprovalStatus2[ApprovalStatus2["PENDING"] = 0] = "PENDING";
2282
- ApprovalStatus2[ApprovalStatus2["PARTIALLY_APPROVED"] = 1] = "PARTIALLY_APPROVED";
2283
- ApprovalStatus2[ApprovalStatus2["APPROVED"] = 2] = "APPROVED";
2284
- ApprovalStatus2[ApprovalStatus2["REJECTED"] = 3] = "REJECTED";
2285
- ApprovalStatus2[ApprovalStatus2["CANCELLED"] = 4] = "CANCELLED";
2286
- return ApprovalStatus2;
2287
- })(ApprovalStatus || {});
2288
- var FlowType = /* @__PURE__ */ ((FlowType3) => {
2289
- FlowType3[FlowType3["STATUS"] = 0] = "STATUS";
2290
- FlowType3[FlowType3["CO_PAY"] = 1] = "CO_PAY";
2291
- FlowType3[FlowType3["INDIVIDUAL_DISCOUNT"] = 2] = "INDIVIDUAL_DISCOUNT";
2292
- FlowType3[FlowType3["OVERALL_DISCOUNT"] = 3] = "OVERALL_DISCOUNT";
2293
- FlowType3[FlowType3["SPECIAL_DISCOUNT"] = 4] = "SPECIAL_DISCOUNT";
2294
- FlowType3[FlowType3["REFUND"] = 5] = "REFUND";
2295
- return FlowType3;
2296
- })(FlowType || {});
2297
-
2298
2490
  // src/services/approval.service.ts
2299
2491
  var ApprovalService = class {
2300
2492
  constructor(deps) {
@@ -2396,7 +2588,16 @@ var ApprovalService = class {
2396
2588
  status: newStatus
2397
2589
  }
2398
2590
  });
2399
- setImmediate(() => this.emitEvents(updated, inst.flow?.flowType, approverId, step, comment));
2591
+ setImmediate(
2592
+ () => this.emitEvents({
2593
+ instance: updated,
2594
+ flowType: inst.flow?.flowType,
2595
+ approverId,
2596
+ step,
2597
+ comment,
2598
+ approvalFlow: inst.flow
2599
+ })
2600
+ );
2400
2601
  this.deps.eventBus.emit("approval:LEVEL_DONE", {
2401
2602
  instanceId: inst.id,
2402
2603
  level: step.level,
@@ -2479,17 +2680,79 @@ var ApprovalService = class {
2479
2680
  // });
2480
2681
  // }
2481
2682
  // }
2482
- emitEvents(instance, flowType, approverId, step, comment) {
2483
- this.deps.eventBus.emit(`approval:${instance.status}`, {
2484
- instanceId: instance.id,
2485
- flowType,
2486
- subjectId: instance.subjectId,
2487
- approverId,
2488
- step,
2489
- comment,
2490
- subjectType: instance.subjectType,
2491
- service: instance.service
2492
- });
2683
+ async emitEvents({
2684
+ instance,
2685
+ flowType,
2686
+ approverId,
2687
+ step,
2688
+ comment,
2689
+ approvalFlow
2690
+ }) {
2691
+ if (approvalFlow.actionType === "CONFIG_EVENT" /* CONFIG_EVENT */) {
2692
+ this.deps.eventBus.emit(`approval:${instance.status}`, {
2693
+ instanceId: instance.id,
2694
+ flowType,
2695
+ subjectId: instance.subjectId,
2696
+ approverId,
2697
+ step,
2698
+ comment,
2699
+ subjectType: instance.subjectType,
2700
+ service: instance.service
2701
+ });
2702
+ } else {
2703
+ switch (instance.status) {
2704
+ case 2 /* APPROVED */:
2705
+ if (approvalFlow.approveActionUrl) {
2706
+ const res = await fetch(approvalFlow.approveActionUrl, {
2707
+ method: "POST",
2708
+ headers: {
2709
+ "Content-Type": "application/json"
2710
+ },
2711
+ body: JSON.stringify({ id: instance.id, subjectId: instance.subjectId })
2712
+ });
2713
+ if (!res.ok) {
2714
+ this.deps.logger.error(
2715
+ "[Approval Service] Approve action URL webhook failed",
2716
+ res.status,
2717
+ res.statusText
2718
+ );
2719
+ }
2720
+ }
2721
+ break;
2722
+ case 3 /* REJECTED */:
2723
+ if (approvalFlow.rejectActionUrl) {
2724
+ const res = await fetch(approvalFlow.rejectActionUrl, {
2725
+ method: "POST",
2726
+ headers: {
2727
+ "Content-Type": "application/json"
2728
+ }
2729
+ });
2730
+ if (!res.ok) {
2731
+ this.deps.logger.error("[Approval Service] Reject action URL webhook failed", res.status, res.statusText);
2732
+ }
2733
+ }
2734
+ break;
2735
+ case 1 /* PARTIALLY_APPROVED */:
2736
+ if (approvalFlow.partiallyApproveActionUrl) {
2737
+ const res = await fetch(approvalFlow.partiallyApproveActionUrl, {
2738
+ method: "POST",
2739
+ headers: {
2740
+ "Content-Type": "application/json"
2741
+ }
2742
+ });
2743
+ if (!res.ok) {
2744
+ this.deps.logger.error(
2745
+ "[Approval Service] Partially approve action URL webhook failed",
2746
+ res.status,
2747
+ res.statusText
2748
+ );
2749
+ }
2750
+ }
2751
+ break;
2752
+ default:
2753
+ break;
2754
+ }
2755
+ }
2493
2756
  }
2494
2757
  async assertPermission(step, approverId, instanceId, ccId, tx) {
2495
2758
  const result = await tx.$queryRaw(`
@@ -2550,9 +2813,22 @@ var ApprovalService = class {
2550
2813
  }
2551
2814
  return step;
2552
2815
  }
2816
+ async getAllApprovalFlow(input) {
2817
+ this.deps.logger.info("entering:getAllApprovalFlow --" + JSON.stringify({ input }));
2818
+ const instance = await this.approvalRepo.getAllApprovalFlow(this.deps.prisma, input);
2819
+ this.deps.logger.info("exiting:getAllApprovalFlow --" + JSON.stringify({ instance }));
2820
+ return instance;
2821
+ }
2822
+ async getApprovalActDetailsBySubjectId(subjectId, subjectType, service) {
2823
+ this.deps.logger.info(
2824
+ "entering:getApprovalActDetailsBySubjectId --" + JSON.stringify({ subjectId, subjectType, service })
2825
+ );
2826
+ return this.approvalRepo.getApprovalActDetailsBySubjectId(this.deps.prisma, { subjectId, subjectType, service });
2827
+ }
2553
2828
  };
2554
2829
 
2555
2830
  // src/utils/audit.utils.ts
2831
+ init_esm_shims();
2556
2832
  function isValidDate(value) {
2557
2833
  if (value instanceof Date) {
2558
2834
  return !isNaN(value.getTime());
@@ -2600,6 +2876,7 @@ function findDifferences(obj1, obj2) {
2600
2876
  }
2601
2877
 
2602
2878
  // src/utils/renderer.ts
2879
+ init_esm_shims();
2603
2880
  import Handlebars from "handlebars";
2604
2881
  function renderTemplate(tpl, data) {
2605
2882
  return Handlebars.compile(tpl)(data);
@@ -2633,7 +2910,17 @@ var convertArrayPatternToEachBlocksGeneric = (html) => {
2633
2910
  return output;
2634
2911
  };
2635
2912
 
2913
+ // src/types/common.ts
2914
+ init_esm_shims();
2915
+
2916
+ // src/types/dynamicCreateUpdate.type.ts
2917
+ init_esm_shims();
2918
+
2919
+ // src/services/uinConfig.service.ts
2920
+ init_esm_shims();
2921
+
2636
2922
  // src/mapper/uinConfig.mapper.ts
2923
+ init_esm_shims();
2637
2924
  var toUINConfigDTO = (model) => {
2638
2925
  return {
2639
2926
  id: model.id,
@@ -2651,6 +2938,7 @@ var toUINConfigDTO = (model) => {
2651
2938
  };
2652
2939
 
2653
2940
  // src/repository/uinConfig.repository.ts
2941
+ init_esm_shims();
2654
2942
  var uinConfigRepository = (uinDeps) => {
2655
2943
  const db = uinDeps.db;
2656
2944
  const logger = uinDeps.logger;
@@ -2736,6 +3024,7 @@ var uinConfigRepository = (uinDeps) => {
2736
3024
  };
2737
3025
 
2738
3026
  // src/validation/uinConfig.service.validation.ts
3027
+ init_esm_shims();
2739
3028
  var uinConfigServiceValidation = (uinDeps) => {
2740
3029
  const { generateErrorMessage, ErrorHandler } = uinDeps.helpers;
2741
3030
  const logger = uinDeps.logger;
@@ -2937,7 +3226,20 @@ var uinConfigService = (uinDeps) => {
2937
3226
  };
2938
3227
  };
2939
3228
 
3229
+ // src/types/uinConfig.ts
3230
+ init_esm_shims();
3231
+
3232
+ // src/events/eventEmitter.ts
3233
+ init_esm_shims();
3234
+
3235
+ // src/services/audit.service.ts
3236
+ init_esm_shims();
3237
+
3238
+ // src/services/notification.service.ts
3239
+ init_esm_shims();
3240
+
2940
3241
  // src/providers/app.provider.ts
3242
+ init_esm_shims();
2941
3243
  var ExpoAppNotificationProvider = class {
2942
3244
  constructor(logger = console, url = "https://api.expo.dev/v2/push/send") {
2943
3245
  this.logger = logger;
@@ -2975,7 +3277,11 @@ var ExpoAppNotificationProvider = class {
2975
3277
  }
2976
3278
  };
2977
3279
 
3280
+ // src/providers/email.providers.ts
3281
+ init_esm_shims();
3282
+
2978
3283
  // src/types/notification.ts
3284
+ init_esm_shims();
2979
3285
  var TemplateType = /* @__PURE__ */ ((TemplateType2) => {
2980
3286
  TemplateType2["EMAIL"] = "EMAIL";
2981
3287
  TemplateType2["SMS"] = "SMS";
@@ -3065,6 +3371,7 @@ var EmailProvider = class {
3065
3371
  };
3066
3372
 
3067
3373
  // src/providers/sms.provider.ts
3374
+ init_esm_shims();
3068
3375
  import axios2 from "axios";
3069
3376
  import https from "https";
3070
3377
  import dns from "dns/promises";
@@ -3215,6 +3522,7 @@ var SmsProvider = class {
3215
3522
  };
3216
3523
 
3217
3524
  // src/providers/web.provider.ts
3525
+ init_esm_shims();
3218
3526
  var WebNotificationProvider = class {
3219
3527
  constructor(prisma, logger = console) {
3220
3528
  this.prisma = prisma;
@@ -3258,9 +3566,11 @@ var WebNotificationProvider = class {
3258
3566
  };
3259
3567
 
3260
3568
  // src/providers/whatsapp.provider.ts
3569
+ init_esm_shims();
3261
3570
  import axios3 from "axios";
3262
3571
 
3263
3572
  // src/utils/notification.utils.ts
3573
+ init_esm_shims();
3264
3574
  function defaultValueField(t) {
3265
3575
  if (t === "EMAIL") return "EMAIL";
3266
3576
  if (t === "APP_NOTIFICATION") return "USER_ID";
@@ -4419,7 +4729,11 @@ var NotificationEmitter = class {
4419
4729
  }
4420
4730
  };
4421
4731
 
4732
+ // src/types/audit.ts
4733
+ init_esm_shims();
4734
+
4422
4735
  // src/audit/audit.core.ts
4736
+ init_esm_shims();
4423
4737
  var AuditCore = class {
4424
4738
  prisma;
4425
4739
  contextProvider;
@@ -4441,6 +4755,7 @@ var AuditCore = class {
4441
4755
  };
4442
4756
 
4443
4757
  // src/audit/audit.logger.ts
4758
+ init_esm_shims();
4444
4759
  var AuditLogger = class {
4445
4760
  core;
4446
4761
  constructor(core) {
@@ -4492,6 +4807,7 @@ var AuditLogger = class {
4492
4807
  };
4493
4808
 
4494
4809
  // src/audit/audit.proxy.ts
4810
+ init_esm_shims();
4495
4811
  var AuditProxy = class {
4496
4812
  logger;
4497
4813
  constructor(logger) {
@@ -4545,6 +4861,7 @@ var AuditProxy = class {
4545
4861
  }
4546
4862
  };
4547
4863
  export {
4864
+ ActionMode,
4548
4865
  ApprovalService,
4549
4866
  ApprovalStatus,
4550
4867
  AuditCore,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "av6-core",
3
- "version": "1.7.17",
3
+ "version": "1.8.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -8,5 +8,21 @@ declare module "@prisma/client" {
8
8
  export type JsonValue = any;
9
9
  export type JsonObject = any;
10
10
  export type JsonArray = any;
11
+
12
+ export interface Sql {
13
+ readonly values: unknown[];
14
+ readonly strings: string[];
15
+ readonly sql: string;
16
+ }
17
+
18
+ export const empty: Sql;
19
+ export function sql(strings: readonly string[], ...values: unknown[]): Sql;
20
+ export function join(
21
+ values: readonly unknown[],
22
+ separator?: string,
23
+ prefix?: string,
24
+ suffix?: string
25
+ ): Sql;
26
+ export function raw(value: string): Sql;
11
27
  }
12
28
  }