av6-core 1.8.0 → 1.8.2

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,3 +1,4 @@
1
+ /// <reference path="./prisma-client.d.ts" />
1
2
  import { JsonValue, Decimal, DecimalJsLike, InputJsonValue } from '@prisma/client/runtime/library';
2
3
  import { AsyncLocalStorage } from 'async_hooks';
3
4
  import { AxiosResponse } from 'axios';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference path="./prisma-client.d.ts" />
1
2
  import { JsonValue, Decimal, DecimalJsLike, InputJsonValue } from '@prisma/client/runtime/library';
2
3
  import { AsyncLocalStorage } from 'async_hooks';
3
4
  import { AxiosResponse } from 'axios';
package/dist/index.js CHANGED
@@ -5,12 +5,6 @@ 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
- };
14
8
  var __export = (target, all) => {
15
9
  for (var name in all)
16
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -33,24 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
27
  ));
34
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
29
 
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
-
54
30
  // src/index.ts
55
31
  var index_exports = {};
56
32
  __export(index_exports, {
@@ -82,16 +58,8 @@ __export(index_exports, {
82
58
  uinConfigService: () => uinConfigService
83
59
  });
84
60
  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();
92
61
 
93
62
  // src/utils/dynamicSearchHelper.ts
94
- init_cjs_shims();
95
63
  var import_assert = require("assert");
96
64
  var import_util = require("util");
97
65
  function buildNestedCondition(keys, searchText, isNot = false) {
@@ -1045,11 +1013,7 @@ var commonRepository = (serviceDeps) => {
1045
1013
  };
1046
1014
  };
1047
1015
 
1048
- // src/repository/commonCreateUpdate.repository.ts
1049
- init_cjs_shims();
1050
-
1051
1016
  // src/utils/dynamicCreateUpdate.utils.ts
1052
- init_cjs_shims();
1053
1017
  var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
1054
1018
  var getByPath = (root, path) => {
1055
1019
  if (!path) return void 0;
@@ -1070,7 +1034,6 @@ var omitUndefined = (obj) => {
1070
1034
  };
1071
1035
 
1072
1036
  // src/utils/dynamicPrismaBuilder.utils.ts
1073
- init_cjs_shims();
1074
1037
  var resolveSrc = (f, env) => {
1075
1038
  const src = f.src ?? `body.${f.db}`;
1076
1039
  if (src.startsWith("body.")) return getByPath(env.body, src.slice(5));
@@ -1354,12 +1317,10 @@ var commonCreateUpdateRepository = (serviceDeps) => {
1354
1317
  };
1355
1318
 
1356
1319
  // src/utils/dynamicJoiBuilder.utils.ts
1357
- init_cjs_shims();
1358
1320
  var import_joi = __toESM(require("joi"));
1359
1321
  var import_dayjs2 = __toESM(require("dayjs"));
1360
1322
 
1361
1323
  // src/utils/helper.utils.ts
1362
- init_cjs_shims();
1363
1324
  var import_dayjs = __toESM(require("dayjs"));
1364
1325
  function customOmit(obj, keys) {
1365
1326
  const rest = { ...obj };
@@ -1691,7 +1652,6 @@ var buildJoiSchemaForOp = (cfg, op, ctx) => {
1691
1652
  };
1692
1653
 
1693
1654
  // src/utils/dynamicOperation.utils.ts
1694
- init_cjs_shims();
1695
1655
  var import_av6_utils = require("av6-utils");
1696
1656
  var OP_PRECEDENCE = {
1697
1657
  "u-": 3,
@@ -2345,14 +2305,7 @@ var commonService = (serviceDeps) => {
2345
2305
  };
2346
2306
  };
2347
2307
 
2348
- // src/services/approval.service.ts
2349
- init_cjs_shims();
2350
-
2351
- // src/repository/approval.repository.ts
2352
- init_cjs_shims();
2353
-
2354
2308
  // src/types/approval.type.ts
2355
- init_cjs_shims();
2356
2309
  var ApprovalStatus = /* @__PURE__ */ ((ApprovalStatus2) => {
2357
2310
  ApprovalStatus2[ApprovalStatus2["PENDING"] = 0] = "PENDING";
2358
2311
  ApprovalStatus2[ApprovalStatus2["PARTIALLY_APPROVED"] = 1] = "PARTIALLY_APPROVED";
@@ -2377,7 +2330,7 @@ var ActionMode = /* @__PURE__ */ ((ActionMode2) => {
2377
2330
  })(ActionMode || {});
2378
2331
 
2379
2332
  // src/repository/approval.repository.ts
2380
- var import_client = __toESM(require_default());
2333
+ var import_client = require("@prisma/client");
2381
2334
  var approvalRepository = (helpers) => {
2382
2335
  return {
2383
2336
  async findMatchingFlow(tx, type, service, ccId, netTotal, level = 1) {
@@ -2856,7 +2809,6 @@ var ApprovalService = class {
2856
2809
  };
2857
2810
 
2858
2811
  // src/utils/audit.utils.ts
2859
- init_cjs_shims();
2860
2812
  function isValidDate(value) {
2861
2813
  if (value instanceof Date) {
2862
2814
  return !isNaN(value.getTime());
@@ -2904,7 +2856,6 @@ function findDifferences(obj1, obj2) {
2904
2856
  }
2905
2857
 
2906
2858
  // src/utils/renderer.ts
2907
- init_cjs_shims();
2908
2859
  var import_handlebars = __toESM(require("handlebars"));
2909
2860
  function renderTemplate(tpl, data) {
2910
2861
  return import_handlebars.default.compile(tpl)(data);
@@ -2938,17 +2889,7 @@ var convertArrayPatternToEachBlocksGeneric = (html) => {
2938
2889
  return output;
2939
2890
  };
2940
2891
 
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
-
2950
2892
  // src/mapper/uinConfig.mapper.ts
2951
- init_cjs_shims();
2952
2893
  var toUINConfigDTO = (model) => {
2953
2894
  return {
2954
2895
  id: model.id,
@@ -2966,7 +2907,6 @@ var toUINConfigDTO = (model) => {
2966
2907
  };
2967
2908
 
2968
2909
  // src/repository/uinConfig.repository.ts
2969
- init_cjs_shims();
2970
2910
  var uinConfigRepository = (uinDeps) => {
2971
2911
  const db = uinDeps.db;
2972
2912
  const logger = uinDeps.logger;
@@ -3052,7 +2992,6 @@ var uinConfigRepository = (uinDeps) => {
3052
2992
  };
3053
2993
 
3054
2994
  // src/validation/uinConfig.service.validation.ts
3055
- init_cjs_shims();
3056
2995
  var uinConfigServiceValidation = (uinDeps) => {
3057
2996
  const { generateErrorMessage, ErrorHandler } = uinDeps.helpers;
3058
2997
  const logger = uinDeps.logger;
@@ -3254,20 +3193,7 @@ var uinConfigService = (uinDeps) => {
3254
3193
  };
3255
3194
  };
3256
3195
 
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
-
3269
3196
  // src/providers/app.provider.ts
3270
- init_cjs_shims();
3271
3197
  var ExpoAppNotificationProvider = class {
3272
3198
  constructor(logger = console, url = "https://api.expo.dev/v2/push/send") {
3273
3199
  this.logger = logger;
@@ -3305,11 +3231,7 @@ var ExpoAppNotificationProvider = class {
3305
3231
  }
3306
3232
  };
3307
3233
 
3308
- // src/providers/email.providers.ts
3309
- init_cjs_shims();
3310
-
3311
3234
  // src/types/notification.ts
3312
- init_cjs_shims();
3313
3235
  var TemplateType = /* @__PURE__ */ ((TemplateType2) => {
3314
3236
  TemplateType2["EMAIL"] = "EMAIL";
3315
3237
  TemplateType2["SMS"] = "SMS";
@@ -3399,7 +3321,6 @@ var EmailProvider = class {
3399
3321
  };
3400
3322
 
3401
3323
  // src/providers/sms.provider.ts
3402
- init_cjs_shims();
3403
3324
  var import_axios2 = __toESM(require("axios"));
3404
3325
  var import_node_https = __toESM(require("https"));
3405
3326
  var import_promises = __toESM(require("dns/promises"));
@@ -3550,7 +3471,6 @@ var SmsProvider = class {
3550
3471
  };
3551
3472
 
3552
3473
  // src/providers/web.provider.ts
3553
- init_cjs_shims();
3554
3474
  var WebNotificationProvider = class {
3555
3475
  constructor(prisma, logger = console) {
3556
3476
  this.prisma = prisma;
@@ -3594,11 +3514,9 @@ var WebNotificationProvider = class {
3594
3514
  };
3595
3515
 
3596
3516
  // src/providers/whatsapp.provider.ts
3597
- init_cjs_shims();
3598
3517
  var import_axios3 = __toESM(require("axios"));
3599
3518
 
3600
3519
  // src/utils/notification.utils.ts
3601
- init_cjs_shims();
3602
3520
  function defaultValueField(t) {
3603
3521
  if (t === "EMAIL") return "EMAIL";
3604
3522
  if (t === "APP_NOTIFICATION") return "USER_ID";
@@ -4757,11 +4675,7 @@ var NotificationEmitter = class {
4757
4675
  }
4758
4676
  };
4759
4677
 
4760
- // src/types/audit.ts
4761
- init_cjs_shims();
4762
-
4763
4678
  // src/audit/audit.core.ts
4764
- init_cjs_shims();
4765
4679
  var AuditCore = class {
4766
4680
  prisma;
4767
4681
  contextProvider;
@@ -4783,7 +4697,6 @@ var AuditCore = class {
4783
4697
  };
4784
4698
 
4785
4699
  // src/audit/audit.logger.ts
4786
- init_cjs_shims();
4787
4700
  var AuditLogger = class {
4788
4701
  core;
4789
4702
  constructor(core) {
@@ -4835,7 +4748,6 @@ var AuditLogger = class {
4835
4748
  };
4836
4749
 
4837
4750
  // src/audit/audit.proxy.ts
4838
- init_cjs_shims();
4839
4751
  var AuditProxy = class {
4840
4752
  logger;
4841
4753
  constructor(logger) {
package/dist/index.mjs CHANGED
@@ -1,69 +1,4 @@
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
-
65
1
  // src/utils/dynamicSearchHelper.ts
66
- init_esm_shims();
67
2
  import { deepStrictEqual as deepEqual } from "assert";
68
3
  import { isDeepStrictEqual } from "util";
69
4
  function buildNestedCondition(keys, searchText, isNot = false) {
@@ -268,9 +203,9 @@ function buildNestedConditionForSingleValue(keys, fieldType, val, isNot = false)
268
203
  }
269
204
  function buildPrismaSelect(mapping) {
270
205
  const select = {};
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);
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);
274
209
  if (!parts.length) continue;
275
210
  let cur = select;
276
211
  for (let i = 0; i < parts.length; i++) {
@@ -297,8 +232,8 @@ function buildPrismaSelect(mapping) {
297
232
  }
298
233
  return select;
299
234
  }
300
- function getByPathOrNull(row, path2) {
301
- const parts = String(path2 || "").split(".").map((p) => p.trim()).filter(Boolean);
235
+ function getByPathOrNull(row, path) {
236
+ const parts = String(path || "").split(".").map((p) => p.trim()).filter(Boolean);
302
237
  let cur = row;
303
238
  for (const key of parts) {
304
239
  if (cur == null) return null;
@@ -308,8 +243,8 @@ function getByPathOrNull(row, path2) {
308
243
  }
309
244
  function toDynamicDropdownDto(mapping, row) {
310
245
  const out = {};
311
- for (const [dtoKey, path2] of Object.entries(mapping)) {
312
- out[dtoKey] = getByPathOrNull(row, path2);
246
+ for (const [dtoKey, path] of Object.entries(mapping)) {
247
+ out[dtoKey] = getByPathOrNull(row, path);
313
248
  }
314
249
  return out;
315
250
  }
@@ -1017,15 +952,11 @@ var commonRepository = (serviceDeps) => {
1017
952
  };
1018
953
  };
1019
954
 
1020
- // src/repository/commonCreateUpdate.repository.ts
1021
- init_esm_shims();
1022
-
1023
955
  // src/utils/dynamicCreateUpdate.utils.ts
1024
- init_esm_shims();
1025
956
  var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
1026
- var getByPath = (root, path2) => {
1027
- if (!path2) return void 0;
1028
- const parts = path2.split(".");
957
+ var getByPath = (root, path) => {
958
+ if (!path) return void 0;
959
+ const parts = path.split(".");
1029
960
  let cur = root;
1030
961
  for (const p of parts) {
1031
962
  if (!isRecord(cur)) return void 0;
@@ -1042,7 +973,6 @@ var omitUndefined = (obj) => {
1042
973
  };
1043
974
 
1044
975
  // src/utils/dynamicPrismaBuilder.utils.ts
1045
- init_esm_shims();
1046
976
  var resolveSrc = (f, env) => {
1047
977
  const src = f.src ?? `body.${f.db}`;
1048
978
  if (src.startsWith("body.")) return getByPath(env.body, src.slice(5));
@@ -1326,12 +1256,10 @@ var commonCreateUpdateRepository = (serviceDeps) => {
1326
1256
  };
1327
1257
 
1328
1258
  // src/utils/dynamicJoiBuilder.utils.ts
1329
- init_esm_shims();
1330
1259
  import Joi from "joi";
1331
1260
  import dayjs2 from "dayjs";
1332
1261
 
1333
1262
  // src/utils/helper.utils.ts
1334
- init_esm_shims();
1335
1263
  import dayjs from "dayjs";
1336
1264
  function customOmit(obj, keys) {
1337
1265
  const rest = { ...obj };
@@ -1354,18 +1282,18 @@ function getDynamicValue(obj, accessorKey) {
1354
1282
  }
1355
1283
  return result === void 0 ? null : result;
1356
1284
  }
1357
- function getNestedValue(obj, path2, defaultValue) {
1358
- if (!obj || !path2) return defaultValue;
1359
- const normalizedPath = path2.replace(/\[(\d+)\]/g, ".$1");
1285
+ function getNestedValue(obj, path, defaultValue) {
1286
+ if (!obj || !path) return defaultValue;
1287
+ const normalizedPath = path.replace(/\[(\d+)\]/g, ".$1");
1360
1288
  const result = normalizedPath.split(".").reduce((acc, key) => {
1361
1289
  if (acc == null) return void 0;
1362
1290
  return acc[key];
1363
1291
  }, obj);
1364
1292
  return result === void 0 ? defaultValue : result;
1365
1293
  }
1366
- function getNestedValueV2(obj, path2, defaultValue) {
1367
- if (!obj || !path2) return defaultValue;
1368
- const normalizedPath = path2.replace(/\[(\d+)\]/g, ".$1");
1294
+ function getNestedValueV2(obj, path, defaultValue) {
1295
+ if (!obj || !path) return defaultValue;
1296
+ const normalizedPath = path.replace(/\[(\d+)\]/g, ".$1");
1369
1297
  const keys = normalizedPath.split(".");
1370
1298
  const resolve = (current, index) => {
1371
1299
  if (current == null) return void 0;
@@ -1663,7 +1591,6 @@ var buildJoiSchemaForOp = (cfg, op, ctx) => {
1663
1591
  };
1664
1592
 
1665
1593
  // src/utils/dynamicOperation.utils.ts
1666
- init_esm_shims();
1667
1594
  import { applyRound } from "av6-utils";
1668
1595
  var OP_PRECEDENCE = {
1669
1596
  "u-": 3,
@@ -2317,14 +2244,7 @@ var commonService = (serviceDeps) => {
2317
2244
  };
2318
2245
  };
2319
2246
 
2320
- // src/services/approval.service.ts
2321
- init_esm_shims();
2322
-
2323
- // src/repository/approval.repository.ts
2324
- init_esm_shims();
2325
-
2326
2247
  // src/types/approval.type.ts
2327
- init_esm_shims();
2328
2248
  var ApprovalStatus = /* @__PURE__ */ ((ApprovalStatus2) => {
2329
2249
  ApprovalStatus2[ApprovalStatus2["PENDING"] = 0] = "PENDING";
2330
2250
  ApprovalStatus2[ApprovalStatus2["PARTIALLY_APPROVED"] = 1] = "PARTIALLY_APPROVED";
@@ -2349,7 +2269,7 @@ var ActionMode = /* @__PURE__ */ ((ActionMode2) => {
2349
2269
  })(ActionMode || {});
2350
2270
 
2351
2271
  // src/repository/approval.repository.ts
2352
- var import_client = __toESM(require_default());
2272
+ import { Prisma } from "@prisma/client";
2353
2273
  var approvalRepository = (helpers) => {
2354
2274
  return {
2355
2275
  async findMatchingFlow(tx, type, service, ccId, netTotal, level = 1) {
@@ -2395,26 +2315,26 @@ var approvalRepository = (helpers) => {
2395
2315
  const serviceLike = `%${service}%`;
2396
2316
  const pattern = searchText ? `%${searchText.replace(/[%_]/g, "\\$&")}%` : "%";
2397
2317
  const validSortDir = sortDir === "DESC" ? "DESC" : "ASC";
2398
- const baseWhereConditions = import_client.Prisma.sql`
2318
+ const baseWhereConditions = Prisma.sql`
2399
2319
  ( cam.staff_id = ${staffId} or scc.staff_id = ${staffId} )
2400
- and cai.status in (${import_client.Prisma.join(status)})
2320
+ and cai.status in (${Prisma.join(status)})
2401
2321
  and LOWER(cai.service) like LOWER(${serviceLike})
2402
2322
  and LOWER(cai.ref_no) like LOWER(${pattern})
2403
2323
  and cam.cc_id = ${ccId}
2404
2324
  and cai.is_active = 1
2405
2325
  and cas.is_active = 1
2406
2326
  and cam.is_active = 1`;
2407
- let dateFilter = import_client.Prisma.empty;
2327
+ let dateFilter = Prisma.empty;
2408
2328
  if (startDate && endDate) {
2409
2329
  const startDateTime = fromTimestampToSqlDatetime(startDate);
2410
2330
  const endDateTime = fromTimestampToSqlDatetime(endDate);
2411
- dateFilter = import_client.Prisma.sql`and cai.created_at between ${startDateTime} and ${endDateTime}`;
2331
+ dateFilter = Prisma.sql`and cai.created_at between ${startDateTime} and ${endDateTime}`;
2412
2332
  }
2413
- let flowTypeFilter = import_client.Prisma.empty;
2333
+ let flowTypeFilter = Prisma.empty;
2414
2334
  if (flowType) {
2415
- flowTypeFilter = import_client.Prisma.sql`and caf.flow_type = ${flowType}`;
2335
+ flowTypeFilter = Prisma.sql`and caf.flow_type = ${flowType}`;
2416
2336
  }
2417
- const countQuery = import_client.Prisma.sql`
2337
+ const countQuery = Prisma.sql`
2418
2338
  SELECT COUNT(DISTINCT cai.id) as total
2419
2339
  FROM
2420
2340
  core_approval_instance cai
@@ -2430,7 +2350,7 @@ var approvalRepository = (helpers) => {
2430
2350
  ${dateFilter}`;
2431
2351
  const countResult = await tx.$queryRaw(countQuery);
2432
2352
  const total = countResult[0]?.total ?? 0n;
2433
- const dataQuery = import_client.Prisma.sql`
2353
+ const dataQuery = Prisma.sql`
2434
2354
  SELECT DISTINCT
2435
2355
  cai.id,
2436
2356
  cai.flow_id as flowId,
@@ -2460,7 +2380,7 @@ var approvalRepository = (helpers) => {
2460
2380
  ${flowTypeFilter}
2461
2381
  ${dateFilter}
2462
2382
  GROUP BY cai.id
2463
- ORDER BY cai.id ${import_client.Prisma.raw(validSortDir)}
2383
+ ORDER BY cai.id ${Prisma.raw(validSortDir)}
2464
2384
  LIMIT ${pageSize}
2465
2385
  OFFSET ${offset}`;
2466
2386
  const result = await tx.$queryRaw(dataQuery);
@@ -2828,7 +2748,6 @@ var ApprovalService = class {
2828
2748
  };
2829
2749
 
2830
2750
  // src/utils/audit.utils.ts
2831
- init_esm_shims();
2832
2751
  function isValidDate(value) {
2833
2752
  if (value instanceof Date) {
2834
2753
  return !isNaN(value.getTime());
@@ -2876,7 +2795,6 @@ function findDifferences(obj1, obj2) {
2876
2795
  }
2877
2796
 
2878
2797
  // src/utils/renderer.ts
2879
- init_esm_shims();
2880
2798
  import Handlebars from "handlebars";
2881
2799
  function renderTemplate(tpl, data) {
2882
2800
  return Handlebars.compile(tpl)(data);
@@ -2910,17 +2828,7 @@ var convertArrayPatternToEachBlocksGeneric = (html) => {
2910
2828
  return output;
2911
2829
  };
2912
2830
 
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
-
2922
2831
  // src/mapper/uinConfig.mapper.ts
2923
- init_esm_shims();
2924
2832
  var toUINConfigDTO = (model) => {
2925
2833
  return {
2926
2834
  id: model.id,
@@ -2938,7 +2846,6 @@ var toUINConfigDTO = (model) => {
2938
2846
  };
2939
2847
 
2940
2848
  // src/repository/uinConfig.repository.ts
2941
- init_esm_shims();
2942
2849
  var uinConfigRepository = (uinDeps) => {
2943
2850
  const db = uinDeps.db;
2944
2851
  const logger = uinDeps.logger;
@@ -3024,7 +2931,6 @@ var uinConfigRepository = (uinDeps) => {
3024
2931
  };
3025
2932
 
3026
2933
  // src/validation/uinConfig.service.validation.ts
3027
- init_esm_shims();
3028
2934
  var uinConfigServiceValidation = (uinDeps) => {
3029
2935
  const { generateErrorMessage, ErrorHandler } = uinDeps.helpers;
3030
2936
  const logger = uinDeps.logger;
@@ -3226,20 +3132,7 @@ var uinConfigService = (uinDeps) => {
3226
3132
  };
3227
3133
  };
3228
3134
 
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
-
3241
3135
  // src/providers/app.provider.ts
3242
- init_esm_shims();
3243
3136
  var ExpoAppNotificationProvider = class {
3244
3137
  constructor(logger = console, url = "https://api.expo.dev/v2/push/send") {
3245
3138
  this.logger = logger;
@@ -3277,11 +3170,7 @@ var ExpoAppNotificationProvider = class {
3277
3170
  }
3278
3171
  };
3279
3172
 
3280
- // src/providers/email.providers.ts
3281
- init_esm_shims();
3282
-
3283
3173
  // src/types/notification.ts
3284
- init_esm_shims();
3285
3174
  var TemplateType = /* @__PURE__ */ ((TemplateType2) => {
3286
3175
  TemplateType2["EMAIL"] = "EMAIL";
3287
3176
  TemplateType2["SMS"] = "SMS";
@@ -3371,7 +3260,6 @@ var EmailProvider = class {
3371
3260
  };
3372
3261
 
3373
3262
  // src/providers/sms.provider.ts
3374
- init_esm_shims();
3375
3263
  import axios2 from "axios";
3376
3264
  import https from "https";
3377
3265
  import dns from "dns/promises";
@@ -3522,7 +3410,6 @@ var SmsProvider = class {
3522
3410
  };
3523
3411
 
3524
3412
  // src/providers/web.provider.ts
3525
- init_esm_shims();
3526
3413
  var WebNotificationProvider = class {
3527
3414
  constructor(prisma, logger = console) {
3528
3415
  this.prisma = prisma;
@@ -3566,11 +3453,9 @@ var WebNotificationProvider = class {
3566
3453
  };
3567
3454
 
3568
3455
  // src/providers/whatsapp.provider.ts
3569
- init_esm_shims();
3570
3456
  import axios3 from "axios";
3571
3457
 
3572
3458
  // src/utils/notification.utils.ts
3573
- init_esm_shims();
3574
3459
  function defaultValueField(t) {
3575
3460
  if (t === "EMAIL") return "EMAIL";
3576
3461
  if (t === "APP_NOTIFICATION") return "USER_ID";
@@ -4729,11 +4614,7 @@ var NotificationEmitter = class {
4729
4614
  }
4730
4615
  };
4731
4616
 
4732
- // src/types/audit.ts
4733
- init_esm_shims();
4734
-
4735
4617
  // src/audit/audit.core.ts
4736
- init_esm_shims();
4737
4618
  var AuditCore = class {
4738
4619
  prisma;
4739
4620
  contextProvider;
@@ -4755,7 +4636,6 @@ var AuditCore = class {
4755
4636
  };
4756
4637
 
4757
4638
  // src/audit/audit.logger.ts
4758
- init_esm_shims();
4759
4639
  var AuditLogger = class {
4760
4640
  core;
4761
4641
  constructor(core) {
@@ -4807,7 +4687,6 @@ var AuditLogger = class {
4807
4687
  };
4808
4688
 
4809
4689
  // src/audit/audit.proxy.ts
4810
- init_esm_shims();
4811
4690
  var AuditProxy = class {
4812
4691
  logger;
4813
4692
  constructor(logger) {
@@ -0,0 +1,28 @@
1
+ declare module "@prisma/client" {
2
+ export class PrismaClient {
3
+ [key: string]: any;
4
+ }
5
+
6
+ export namespace Prisma {
7
+ export type TransactionClient = any;
8
+ export type JsonValue = any;
9
+ export type JsonObject = any;
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;
27
+ }
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "av6-core",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "author": "Aniket Sarkar",
9
9
  "license": "ISC",
10
10
  "scripts": {
11
- "build": "npm run format && tsup",
11
+ "build": "npm run format && tsup && node scripts/prepare-prisma-types.mjs",
12
12
  "p:gen": "prisma generate",
13
13
  "format": "prettier --write **/*.ts"
14
14
  },
@@ -0,0 +1,26 @@
1
+ import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ const rootDir = dirname(fileURLToPath(new URL("../package.json", import.meta.url)));
6
+ const distDir = join(rootDir, "dist");
7
+ const sourceShim = join(rootDir, "prisma-client.d.ts");
8
+ const distShim = join(distDir, "prisma-client.d.ts");
9
+ const reference = '/// <reference path="./prisma-client.d.ts" />\n';
10
+
11
+ mkdirSync(distDir, { recursive: true });
12
+ copyFileSync(sourceShim, distShim);
13
+
14
+ for (const fileName of ["index.d.ts", "index.d.mts"]) {
15
+ const declarationPath = join(distDir, fileName);
16
+
17
+ if (!existsSync(declarationPath)) {
18
+ continue;
19
+ }
20
+
21
+ const declaration = readFileSync(declarationPath, "utf8");
22
+
23
+ if (!declaration.startsWith(reference)) {
24
+ writeFileSync(declarationPath, `${reference}${declaration}`);
25
+ }
26
+ }