av6-core 1.7.5 → 1.7.7
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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +48 -5
- package/dist/index.mjs +47 -5
- package/package.json +38 -39
- package/prisma-client.d.ts +12 -0
- package/.cursor/debug-check-prisma.ts +0 -100
package/dist/index.d.mts
CHANGED
|
@@ -526,6 +526,7 @@ declare function customOmit<T extends object, K extends keyof T>(obj: T, keys: K
|
|
|
526
526
|
};
|
|
527
527
|
declare function getDynamicValue(obj: Record<string, any> | null | undefined, accessorKey: string): any | null;
|
|
528
528
|
declare function getNestedValue<T = unknown>(obj: unknown, path?: string | null, defaultValue?: T): T | undefined;
|
|
529
|
+
declare function getNestedValueV2<T = unknown>(obj: unknown, path?: string | null, defaultValue?: T): T | undefined;
|
|
529
530
|
declare function objectTo2DArray<T>(obj: Record<string, T>, maxCols: number): (string | T)[][];
|
|
530
531
|
declare function toNumberOrNull(value: unknown): number | null;
|
|
531
532
|
declare const getPattern: {
|
|
@@ -701,4 +702,4 @@ declare class AuditProxy<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_
|
|
|
701
702
|
createAuditedService<T extends object>(serviceName: string, service: T): T;
|
|
702
703
|
}
|
|
703
704
|
|
|
704
|
-
export { type AuditContext, type AuditContextProvider, AuditCore, type AuditLogPayload, AuditLogger, AuditProxy, type BulkAtomicResult, type BulkConfig, type BulkConflictConfig, type BulkOnConflict, type CacheAdapter, type CalculationRes, type ColValue, type CommonCreateRequestRepository, type CommonExcelRequest, type CommonFilterRequest, type CommonFilterWithDate, type CommonServiceResponse, type CommonUpdateRequestRepository, type Config, type Context, 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 ExcelConfig, type ExportExcel, type ExportExcelRequestService, type FetchRequest, type FetchRequestRepository, type FieldConfig, type FieldRules, type FieldType, type FixedMap, type FixedSearchRequest, type FixedSearchRequestService, type Helpers, type ImportExcel, type ImportExcelRequestService, type LockUnlockParams, type LockUnlockRequestRepository, type LogicNode, type Mapper, type MergeAll, type NewFixedSearchRequest, type NewFixedSearchRequestService, type NewSearchRequest, NotificationEmitter, type Op, type PaginatedResponse, type PathToSelectWithSelect, type PathValue, type PathsToSelectWithSelect, type Presence, type Recipient, type RelationConfig, type RelationStrategy, type RelationWriteConfig, type SearchRequest, type SearchRequestService, type ServiceCacheAdapter, type SingleValidationMapping, type SourcePath, 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 UpdateConfigByCodeInput, type UpdateStatusRequestRepository, type UpdateUINConfigRequest, type ValidationErrorItem, commonService, customOmit, findDifferences, formatDatesDeep, fromTimestampToSqlDatetime, getDynamicValue, getNestedValue, getPattern, interpolate, objectTo2DArray, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
|
|
705
|
+
export { type AuditContext, type AuditContextProvider, AuditCore, type AuditLogPayload, AuditLogger, AuditProxy, type BulkAtomicResult, type BulkConfig, type BulkConflictConfig, type BulkOnConflict, type CacheAdapter, type CalculationRes, type ColValue, type CommonCreateRequestRepository, type CommonExcelRequest, type CommonFilterRequest, type CommonFilterWithDate, type CommonServiceResponse, type CommonUpdateRequestRepository, type Config, type Context, 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 ExcelConfig, type ExportExcel, type ExportExcelRequestService, type FetchRequest, type FetchRequestRepository, type FieldConfig, type FieldRules, type FieldType, type FixedMap, type FixedSearchRequest, type FixedSearchRequestService, type Helpers, type ImportExcel, type ImportExcelRequestService, type LockUnlockParams, type LockUnlockRequestRepository, type LogicNode, type Mapper, type MergeAll, type NewFixedSearchRequest, type NewFixedSearchRequestService, type NewSearchRequest, NotificationEmitter, type Op, type PaginatedResponse, type PathToSelectWithSelect, type PathValue, type PathsToSelectWithSelect, type Presence, type Recipient, type RelationConfig, type RelationStrategy, type RelationWriteConfig, type SearchRequest, type SearchRequestService, type ServiceCacheAdapter, type SingleValidationMapping, type SourcePath, 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 UpdateConfigByCodeInput, type UpdateStatusRequestRepository, type UpdateUINConfigRequest, type ValidationErrorItem, commonService, customOmit, findDifferences, formatDatesDeep, fromTimestampToSqlDatetime, getDynamicValue, getNestedValue, getNestedValueV2, getPattern, interpolate, objectTo2DArray, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -526,6 +526,7 @@ declare function customOmit<T extends object, K extends keyof T>(obj: T, keys: K
|
|
|
526
526
|
};
|
|
527
527
|
declare function getDynamicValue(obj: Record<string, any> | null | undefined, accessorKey: string): any | null;
|
|
528
528
|
declare function getNestedValue<T = unknown>(obj: unknown, path?: string | null, defaultValue?: T): T | undefined;
|
|
529
|
+
declare function getNestedValueV2<T = unknown>(obj: unknown, path?: string | null, defaultValue?: T): T | undefined;
|
|
529
530
|
declare function objectTo2DArray<T>(obj: Record<string, T>, maxCols: number): (string | T)[][];
|
|
530
531
|
declare function toNumberOrNull(value: unknown): number | null;
|
|
531
532
|
declare const getPattern: {
|
|
@@ -701,4 +702,4 @@ declare class AuditProxy<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_
|
|
|
701
702
|
createAuditedService<T extends object>(serviceName: string, service: T): T;
|
|
702
703
|
}
|
|
703
704
|
|
|
704
|
-
export { type AuditContext, type AuditContextProvider, AuditCore, type AuditLogPayload, AuditLogger, AuditProxy, type BulkAtomicResult, type BulkConfig, type BulkConflictConfig, type BulkOnConflict, type CacheAdapter, type CalculationRes, type ColValue, type CommonCreateRequestRepository, type CommonExcelRequest, type CommonFilterRequest, type CommonFilterWithDate, type CommonServiceResponse, type CommonUpdateRequestRepository, type Config, type Context, 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 ExcelConfig, type ExportExcel, type ExportExcelRequestService, type FetchRequest, type FetchRequestRepository, type FieldConfig, type FieldRules, type FieldType, type FixedMap, type FixedSearchRequest, type FixedSearchRequestService, type Helpers, type ImportExcel, type ImportExcelRequestService, type LockUnlockParams, type LockUnlockRequestRepository, type LogicNode, type Mapper, type MergeAll, type NewFixedSearchRequest, type NewFixedSearchRequestService, type NewSearchRequest, NotificationEmitter, type Op, type PaginatedResponse, type PathToSelectWithSelect, type PathValue, type PathsToSelectWithSelect, type Presence, type Recipient, type RelationConfig, type RelationStrategy, type RelationWriteConfig, type SearchRequest, type SearchRequestService, type ServiceCacheAdapter, type SingleValidationMapping, type SourcePath, 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 UpdateConfigByCodeInput, type UpdateStatusRequestRepository, type UpdateUINConfigRequest, type ValidationErrorItem, commonService, customOmit, findDifferences, formatDatesDeep, fromTimestampToSqlDatetime, getDynamicValue, getNestedValue, getPattern, interpolate, objectTo2DArray, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
|
|
705
|
+
export { type AuditContext, type AuditContextProvider, AuditCore, type AuditLogPayload, AuditLogger, AuditProxy, type BulkAtomicResult, type BulkConfig, type BulkConflictConfig, type BulkOnConflict, type CacheAdapter, type CalculationRes, type ColValue, type CommonCreateRequestRepository, type CommonExcelRequest, type CommonFilterRequest, type CommonFilterWithDate, type CommonServiceResponse, type CommonUpdateRequestRepository, type Config, type Context, 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 ExcelConfig, type ExportExcel, type ExportExcelRequestService, type FetchRequest, type FetchRequestRepository, type FieldConfig, type FieldRules, type FieldType, type FixedMap, type FixedSearchRequest, type FixedSearchRequestService, type Helpers, type ImportExcel, type ImportExcelRequestService, type LockUnlockParams, type LockUnlockRequestRepository, type LogicNode, type Mapper, type MergeAll, type NewFixedSearchRequest, type NewFixedSearchRequestService, type NewSearchRequest, NotificationEmitter, type Op, type PaginatedResponse, type PathToSelectWithSelect, type PathValue, type PathsToSelectWithSelect, type Presence, type Recipient, type RelationConfig, type RelationStrategy, type RelationWriteConfig, type SearchRequest, type SearchRequestService, type ServiceCacheAdapter, type SingleValidationMapping, type SourcePath, 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 UpdateConfigByCodeInput, type UpdateStatusRequestRepository, type UpdateUINConfigRequest, type ValidationErrorItem, commonService, customOmit, findDifferences, formatDatesDeep, fromTimestampToSqlDatetime, getDynamicValue, getNestedValue, getNestedValueV2, getPattern, interpolate, objectTo2DArray, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
fromTimestampToSqlDatetime: () => fromTimestampToSqlDatetime,
|
|
42
42
|
getDynamicValue: () => getDynamicValue,
|
|
43
43
|
getNestedValue: () => getNestedValue,
|
|
44
|
+
getNestedValueV2: () => getNestedValueV2,
|
|
44
45
|
getPattern: () => getPattern,
|
|
45
46
|
interpolate: () => interpolate,
|
|
46
47
|
objectTo2DArray: () => objectTo2DArray,
|
|
@@ -1343,6 +1344,25 @@ function getNestedValue(obj, path, defaultValue) {
|
|
|
1343
1344
|
}, obj);
|
|
1344
1345
|
return result === void 0 ? defaultValue : result;
|
|
1345
1346
|
}
|
|
1347
|
+
function getNestedValueV2(obj, path, defaultValue) {
|
|
1348
|
+
if (!obj || !path) return defaultValue;
|
|
1349
|
+
const normalizedPath = path.replace(/\[(\d+)\]/g, ".$1");
|
|
1350
|
+
const keys = normalizedPath.split(".");
|
|
1351
|
+
const resolve = (current, index) => {
|
|
1352
|
+
if (current == null) return void 0;
|
|
1353
|
+
if (index >= keys.length) return current;
|
|
1354
|
+
const key = keys[index];
|
|
1355
|
+
if (key.endsWith("[]")) {
|
|
1356
|
+
const arrayKey = key.replace("[]", "");
|
|
1357
|
+
const arr = current[arrayKey];
|
|
1358
|
+
if (!Array.isArray(arr)) return void 0;
|
|
1359
|
+
return arr.map((item) => resolve(item, index + 1));
|
|
1360
|
+
}
|
|
1361
|
+
return resolve(current[key], index + 1);
|
|
1362
|
+
};
|
|
1363
|
+
const result = resolve(obj, 0);
|
|
1364
|
+
return result === void 0 ? defaultValue : result;
|
|
1365
|
+
}
|
|
1346
1366
|
function objectTo2DArray(obj, maxCols) {
|
|
1347
1367
|
if (maxCols < 2) {
|
|
1348
1368
|
throw new Error("maxCols must be at least 2");
|
|
@@ -3204,9 +3224,9 @@ async function resolveAllRecipients(args) {
|
|
|
3204
3224
|
}
|
|
3205
3225
|
if (r.sourceType === "KEY_VALUE") {
|
|
3206
3226
|
const recs = toArray(cfg.recipients).map((x) => {
|
|
3207
|
-
const userIdVal =
|
|
3208
|
-
const level1Val =
|
|
3209
|
-
const level2Val = x.level2Id ?
|
|
3227
|
+
const userIdVal = getNestedValueV2(args.evtData, x.userId);
|
|
3228
|
+
const level1Val = getNestedValueV2(args.evtData, x.level1Id);
|
|
3229
|
+
const level2Val = x.level2Id ? getNestedValueV2(args.evtData, x.level2Id) : void 0;
|
|
3210
3230
|
return {
|
|
3211
3231
|
userId: userIdVal != null ? Number(userIdVal) : null,
|
|
3212
3232
|
level1Id: level1Val != null ? Number(level1Val) : null,
|
|
@@ -3241,7 +3261,7 @@ async function resolveAllRecipients(args) {
|
|
|
3241
3261
|
}
|
|
3242
3262
|
if (r.sourceType === "KEY_VALUE") {
|
|
3243
3263
|
for (const k of toArray(cfg.recipients)) {
|
|
3244
|
-
const v =
|
|
3264
|
+
const v = getNestedValueV2(args.evtData, k);
|
|
3245
3265
|
if (typeof v === "string") res[type].push(v);
|
|
3246
3266
|
if (Array.isArray(v)) res[type].push(...v.filter((x) => typeof x === "string"));
|
|
3247
3267
|
}
|
|
@@ -3452,9 +3472,31 @@ function renderTemplate(tpl, data) {
|
|
|
3452
3472
|
function renderEmailTemplate(tpl, data) {
|
|
3453
3473
|
return {
|
|
3454
3474
|
subject: tpl.subject ? import_handlebars.default.compile(tpl.subject)(data) : void 0,
|
|
3455
|
-
body: import_handlebars.default.compile(tpl.body)(data)
|
|
3475
|
+
body: import_handlebars.default.compile(convertArrayPatternToEachBlocksGeneric(tpl.body))(data)
|
|
3456
3476
|
};
|
|
3457
3477
|
}
|
|
3478
|
+
var convertArrayPatternToEachBlocksGeneric = (html) => {
|
|
3479
|
+
if (!html) return "";
|
|
3480
|
+
const blockTags = ["tr", "div", "li", "section", "tbody"];
|
|
3481
|
+
let output = html;
|
|
3482
|
+
blockTags.forEach((tag) => {
|
|
3483
|
+
const regex = new RegExp(`<${tag}\\b[^>]*>[\\s\\S]*?<\\/${tag}>`, "g");
|
|
3484
|
+
output = output.replace(regex, (blockHtml) => {
|
|
3485
|
+
const matches = [...blockHtml.matchAll(/{{\s*([a-zA-Z0-9_.-]+)\[\]\.([a-zA-Z0-9_.-]+)\s*}}/g)];
|
|
3486
|
+
if (!matches.length) return blockHtml;
|
|
3487
|
+
const uniqueArrays = Array.from(new Set(matches.map((m) => m[1])));
|
|
3488
|
+
if (uniqueArrays.length !== 1) return blockHtml;
|
|
3489
|
+
const arrayName = uniqueArrays[0];
|
|
3490
|
+
const escapedArray = arrayName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3491
|
+
const cleanedBlock = blockHtml.replace(
|
|
3492
|
+
new RegExp(`{{\\s*${escapedArray}\\[\\]\\.([a-zA-Z0-9_.-]+)\\s*}}`, "g"),
|
|
3493
|
+
"{{$1}}"
|
|
3494
|
+
);
|
|
3495
|
+
return `{{#each ${arrayName}}}${cleanedBlock}{{/each}}`;
|
|
3496
|
+
});
|
|
3497
|
+
});
|
|
3498
|
+
return output;
|
|
3499
|
+
};
|
|
3458
3500
|
|
|
3459
3501
|
// src/services/notification.service.ts
|
|
3460
3502
|
var import_lodash = __toESM(require("lodash.merge"));
|
|
@@ -4221,6 +4263,7 @@ var AuditProxy = class {
|
|
|
4221
4263
|
fromTimestampToSqlDatetime,
|
|
4222
4264
|
getDynamicValue,
|
|
4223
4265
|
getNestedValue,
|
|
4266
|
+
getNestedValueV2,
|
|
4224
4267
|
getPattern,
|
|
4225
4268
|
interpolate,
|
|
4226
4269
|
objectTo2DArray,
|
package/dist/index.mjs
CHANGED
|
@@ -1291,6 +1291,25 @@ function getNestedValue(obj, path, defaultValue) {
|
|
|
1291
1291
|
}, obj);
|
|
1292
1292
|
return result === void 0 ? defaultValue : result;
|
|
1293
1293
|
}
|
|
1294
|
+
function getNestedValueV2(obj, path, defaultValue) {
|
|
1295
|
+
if (!obj || !path) return defaultValue;
|
|
1296
|
+
const normalizedPath = path.replace(/\[(\d+)\]/g, ".$1");
|
|
1297
|
+
const keys = normalizedPath.split(".");
|
|
1298
|
+
const resolve = (current, index) => {
|
|
1299
|
+
if (current == null) return void 0;
|
|
1300
|
+
if (index >= keys.length) return current;
|
|
1301
|
+
const key = keys[index];
|
|
1302
|
+
if (key.endsWith("[]")) {
|
|
1303
|
+
const arrayKey = key.replace("[]", "");
|
|
1304
|
+
const arr = current[arrayKey];
|
|
1305
|
+
if (!Array.isArray(arr)) return void 0;
|
|
1306
|
+
return arr.map((item) => resolve(item, index + 1));
|
|
1307
|
+
}
|
|
1308
|
+
return resolve(current[key], index + 1);
|
|
1309
|
+
};
|
|
1310
|
+
const result = resolve(obj, 0);
|
|
1311
|
+
return result === void 0 ? defaultValue : result;
|
|
1312
|
+
}
|
|
1294
1313
|
function objectTo2DArray(obj, maxCols) {
|
|
1295
1314
|
if (maxCols < 2) {
|
|
1296
1315
|
throw new Error("maxCols must be at least 2");
|
|
@@ -3152,9 +3171,9 @@ async function resolveAllRecipients(args) {
|
|
|
3152
3171
|
}
|
|
3153
3172
|
if (r.sourceType === "KEY_VALUE") {
|
|
3154
3173
|
const recs = toArray(cfg.recipients).map((x) => {
|
|
3155
|
-
const userIdVal =
|
|
3156
|
-
const level1Val =
|
|
3157
|
-
const level2Val = x.level2Id ?
|
|
3174
|
+
const userIdVal = getNestedValueV2(args.evtData, x.userId);
|
|
3175
|
+
const level1Val = getNestedValueV2(args.evtData, x.level1Id);
|
|
3176
|
+
const level2Val = x.level2Id ? getNestedValueV2(args.evtData, x.level2Id) : void 0;
|
|
3158
3177
|
return {
|
|
3159
3178
|
userId: userIdVal != null ? Number(userIdVal) : null,
|
|
3160
3179
|
level1Id: level1Val != null ? Number(level1Val) : null,
|
|
@@ -3189,7 +3208,7 @@ async function resolveAllRecipients(args) {
|
|
|
3189
3208
|
}
|
|
3190
3209
|
if (r.sourceType === "KEY_VALUE") {
|
|
3191
3210
|
for (const k of toArray(cfg.recipients)) {
|
|
3192
|
-
const v =
|
|
3211
|
+
const v = getNestedValueV2(args.evtData, k);
|
|
3193
3212
|
if (typeof v === "string") res[type].push(v);
|
|
3194
3213
|
if (Array.isArray(v)) res[type].push(...v.filter((x) => typeof x === "string"));
|
|
3195
3214
|
}
|
|
@@ -3400,9 +3419,31 @@ function renderTemplate(tpl, data) {
|
|
|
3400
3419
|
function renderEmailTemplate(tpl, data) {
|
|
3401
3420
|
return {
|
|
3402
3421
|
subject: tpl.subject ? Handlebars.compile(tpl.subject)(data) : void 0,
|
|
3403
|
-
body: Handlebars.compile(tpl.body)(data)
|
|
3422
|
+
body: Handlebars.compile(convertArrayPatternToEachBlocksGeneric(tpl.body))(data)
|
|
3404
3423
|
};
|
|
3405
3424
|
}
|
|
3425
|
+
var convertArrayPatternToEachBlocksGeneric = (html) => {
|
|
3426
|
+
if (!html) return "";
|
|
3427
|
+
const blockTags = ["tr", "div", "li", "section", "tbody"];
|
|
3428
|
+
let output = html;
|
|
3429
|
+
blockTags.forEach((tag) => {
|
|
3430
|
+
const regex = new RegExp(`<${tag}\\b[^>]*>[\\s\\S]*?<\\/${tag}>`, "g");
|
|
3431
|
+
output = output.replace(regex, (blockHtml) => {
|
|
3432
|
+
const matches = [...blockHtml.matchAll(/{{\s*([a-zA-Z0-9_.-]+)\[\]\.([a-zA-Z0-9_.-]+)\s*}}/g)];
|
|
3433
|
+
if (!matches.length) return blockHtml;
|
|
3434
|
+
const uniqueArrays = Array.from(new Set(matches.map((m) => m[1])));
|
|
3435
|
+
if (uniqueArrays.length !== 1) return blockHtml;
|
|
3436
|
+
const arrayName = uniqueArrays[0];
|
|
3437
|
+
const escapedArray = arrayName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3438
|
+
const cleanedBlock = blockHtml.replace(
|
|
3439
|
+
new RegExp(`{{\\s*${escapedArray}\\[\\]\\.([a-zA-Z0-9_.-]+)\\s*}}`, "g"),
|
|
3440
|
+
"{{$1}}"
|
|
3441
|
+
);
|
|
3442
|
+
return `{{#each ${arrayName}}}${cleanedBlock}{{/each}}`;
|
|
3443
|
+
});
|
|
3444
|
+
});
|
|
3445
|
+
return output;
|
|
3446
|
+
};
|
|
3406
3447
|
|
|
3407
3448
|
// src/services/notification.service.ts
|
|
3408
3449
|
import merge from "lodash.merge";
|
|
@@ -4168,6 +4209,7 @@ export {
|
|
|
4168
4209
|
fromTimestampToSqlDatetime,
|
|
4169
4210
|
getDynamicValue,
|
|
4170
4211
|
getNestedValue,
|
|
4212
|
+
getNestedValueV2,
|
|
4171
4213
|
getPattern,
|
|
4172
4214
|
interpolate,
|
|
4173
4215
|
objectTo2DArray,
|
package/package.json
CHANGED
|
@@ -1,39 +1,38 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "av6-core",
|
|
3
|
-
"version": "1.7.
|
|
4
|
-
"main": "dist/index.js",
|
|
5
|
-
"module": "dist/index.mjs",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"description": "All utility function for av6 node js projects.",
|
|
8
|
-
"author": "Aniket Sarkar",
|
|
9
|
-
"license": "ISC",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "npm run format && tsup",
|
|
12
|
-
"p:gen": "prisma generate",
|
|
13
|
-
"format": "prettier --write **/*.ts"
|
|
14
|
-
},
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"@
|
|
17
|
-
"@types/
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "av6-core",
|
|
3
|
+
"version": "1.7.7",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"module": "dist/index.mjs",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"description": "All utility function for av6 node js projects.",
|
|
8
|
+
"author": "Aniket Sarkar",
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "npm run format && tsup",
|
|
12
|
+
"p:gen": "prisma generate",
|
|
13
|
+
"format": "prettier --write **/*.ts"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/lodash.merge": "^4.6.9",
|
|
17
|
+
"@types/nodemailer": "^7.0.3",
|
|
18
|
+
"tsup": "^8.5.0",
|
|
19
|
+
"typescript": "^5.9.2"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@prisma/client": "^6.19.0",
|
|
23
|
+
"winston": "^3.17.0"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"av6-utils": "^1.0.4",
|
|
27
|
+
"axios": "^1.11.0",
|
|
28
|
+
"dayjs": "^1.11.19",
|
|
29
|
+
"exceljs": "^4.4.0",
|
|
30
|
+
"handlebars": "^4.7.8",
|
|
31
|
+
"joi": "^17.13.3",
|
|
32
|
+
"lodash.merge": "^4.6.2",
|
|
33
|
+
"node-cron": "^4.2.1",
|
|
34
|
+
"nodemailer": "^7.0.10",
|
|
35
|
+
"prettier": "^3.6.2",
|
|
36
|
+
"prisma": "^6.19.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
// #region agent log
|
|
2
|
-
fetch('http://127.0.0.1:7244/ingest/0a9f7972-5d03-4255-b5c9-6164f846fb46',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'debug-check-prisma.ts:1',message:'Starting Prisma client check',data:{timestamp:Date.now()},sessionId:'debug-session',runId:'run1',hypothesisId:'A'})}).catch(()=>{});
|
|
3
|
-
// #endregion
|
|
4
|
-
|
|
5
|
-
import * as fs from 'fs';
|
|
6
|
-
import * as path from 'path';
|
|
7
|
-
|
|
8
|
-
const workspaceRoot = path.resolve(__dirname, '..');
|
|
9
|
-
const nodeModulesPath = path.join(workspaceRoot, 'node_modules');
|
|
10
|
-
const prismaClientPath = path.join(nodeModulesPath, '@prisma', 'client');
|
|
11
|
-
const prismaGeneratedPath = path.join(nodeModulesPath, '.prisma', 'client');
|
|
12
|
-
|
|
13
|
-
// #region agent log
|
|
14
|
-
fetch('http://127.0.0.1:7244/ingest/0a9f7972-5d03-4255-b5c9-6164f846fb46',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'debug-check-prisma.ts:10',message:'Checking paths',data:{workspaceRoot,prismaClientPath,prismaGeneratedPath,prismaClientExists:fs.existsSync(prismaClientPath),prismaGeneratedExists:fs.existsSync(prismaGeneratedPath)},sessionId:'debug-session',runId:'run1',hypothesisId:'A'})}).catch(()=>{});
|
|
15
|
-
// #endregion
|
|
16
|
-
|
|
17
|
-
// Check if @prisma/client package exists
|
|
18
|
-
const prismaClientExists = fs.existsSync(prismaClientPath);
|
|
19
|
-
const prismaGeneratedExists = fs.existsSync(prismaGeneratedPath);
|
|
20
|
-
|
|
21
|
-
// #region agent log
|
|
22
|
-
fetch('http://127.0.0.1:7244/ingest/0a9f7972-5d03-4255-b5c9-6164f846fb46',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'debug-check-prisma.ts:18',message:'Path check results',data:{prismaClientExists,prismaGeneratedExists},sessionId:'debug-session',runId:'run1',hypothesisId:'A'})}).catch(()=>{});
|
|
23
|
-
// #endregion
|
|
24
|
-
|
|
25
|
-
// Try to read package.json from @prisma/client
|
|
26
|
-
let prismaClientPackageJson: any = null;
|
|
27
|
-
if (prismaClientExists) {
|
|
28
|
-
try {
|
|
29
|
-
const packageJsonPath = path.join(prismaClientPath, 'package.json');
|
|
30
|
-
// #region agent log
|
|
31
|
-
fetch('http://127.0.0.1:7244/ingest/0a9f7972-5d03-4255-b5c9-6164f846fb46',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'debug-check-prisma.ts:26',message:'Reading @prisma/client package.json',data:{packageJsonPath,exists:fs.existsSync(packageJsonPath)},sessionId:'debug-session',runId:'run1',hypothesisId:'B'})}).catch(()=>{});
|
|
32
|
-
// #endregion
|
|
33
|
-
if (fs.existsSync(packageJsonPath)) {
|
|
34
|
-
prismaClientPackageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
35
|
-
// #region agent log
|
|
36
|
-
fetch('http://127.0.0.1:7244/ingest/0a9f7972-5d03-4255-b5c9-6164f846fb46',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'debug-check-prisma.ts:30',message:'@prisma/client package.json content',data:{name:prismaClientPackageJson?.name,version:prismaClientPackageJson?.version,exports:prismaClientPackageJson?.exports},sessionId:'debug-session',runId:'run1',hypothesisId:'B'})}).catch(()=>{});
|
|
37
|
-
// #endregion
|
|
38
|
-
}
|
|
39
|
-
} catch (e) {
|
|
40
|
-
// #region agent log
|
|
41
|
-
fetch('http://127.0.0.1:7244/ingest/0a9f7972-5d03-4255-b5c9-6164f846fb46',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'debug-check-prisma.ts:34',message:'Error reading package.json',data:{error:String(e)},sessionId:'debug-session',runId:'run1',hypothesisId:'B'})}).catch(()=>{});
|
|
42
|
-
// #endregion
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Check index.d.ts in @prisma/client
|
|
47
|
-
let indexDtsContent: string | null = null;
|
|
48
|
-
if (prismaClientExists) {
|
|
49
|
-
try {
|
|
50
|
-
const indexDtsPath = path.join(prismaClientPath, 'index.d.ts');
|
|
51
|
-
// #region agent log
|
|
52
|
-
fetch('http://127.0.0.1:7244/ingest/0a9f7972-5d03-4255-b5c9-6164f846fb46',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'debug-check-prisma.ts:43',message:'Reading index.d.ts',data:{indexDtsPath,exists:fs.existsSync(indexDtsPath)},sessionId:'debug-session',runId:'run1',hypothesisId:'C'})}).catch(()=>{});
|
|
53
|
-
// #endregion
|
|
54
|
-
if (fs.existsSync(indexDtsPath)) {
|
|
55
|
-
indexDtsContent = fs.readFileSync(indexDtsPath, 'utf-8');
|
|
56
|
-
// #region agent log
|
|
57
|
-
fetch('http://127.0.0.1:7244/ingest/0a9f7972-5d03-4255-b5c9-6164f846fb46',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'debug-check-prisma.ts:47',message:'index.d.ts content',data:{content:indexDtsContent.substring(0,200)},sessionId:'debug-session',runId:'run1',hypothesisId:'C'})}).catch(()=>{});
|
|
58
|
-
// #endregion
|
|
59
|
-
}
|
|
60
|
-
} catch (e) {
|
|
61
|
-
// #region agent log
|
|
62
|
-
fetch('http://127.0.0.1:7244/ingest/0a9f7972-5d03-4255-b5c9-6164f846fb46',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'debug-check-prisma.ts:51',message:'Error reading index.d.ts',data:{error:String(e)},sessionId:'debug-session',runId:'run1',hypothesisId:'C'})}).catch(()=>{});
|
|
63
|
-
// #endregion
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Try to dynamically import PrismaClient
|
|
68
|
-
let prismaClientImportSuccess = false;
|
|
69
|
-
let prismaClientImportError: string | null = null;
|
|
70
|
-
try {
|
|
71
|
-
// #region agent log
|
|
72
|
-
fetch('http://127.0.0.1:7244/ingest/0a9f7972-5d03-4255-b5c9-6164f846fb46',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'debug-check-prisma.ts:60',message:'Attempting dynamic import of PrismaClient',data:{},sessionId:'debug-session',runId:'run1',hypothesisId:'D'})}).catch(()=>{});
|
|
73
|
-
// #endregion
|
|
74
|
-
const prismaModule = require('@prisma/client');
|
|
75
|
-
// #region agent log
|
|
76
|
-
fetch('http://127.0.0.1:7244/ingest/0a9f7972-5d03-4255-b5c9-6164f846fb46',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'debug-check-prisma.ts:63',message:'Module loaded',data:{hasPrismaClient:!!prismaModule.PrismaClient,exports:Object.keys(prismaModule)},sessionId:'debug-session',runId:'run1',hypothesisId:'D'})}).catch(()=>{});
|
|
77
|
-
// #endregion
|
|
78
|
-
if (prismaModule.PrismaClient) {
|
|
79
|
-
prismaClientImportSuccess = true;
|
|
80
|
-
} else {
|
|
81
|
-
prismaClientImportError = 'PrismaClient not found in exports: ' + Object.keys(prismaModule).join(', ');
|
|
82
|
-
}
|
|
83
|
-
} catch (e) {
|
|
84
|
-
prismaClientImportError = String(e);
|
|
85
|
-
// #region agent log
|
|
86
|
-
fetch('http://127.0.0.1:7244/ingest/0a9f7972-5d03-4255-b5c9-6164f846fb46',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'debug-check-prisma.ts:72',message:'Dynamic import failed',data:{error:prismaClientImportError},sessionId:'debug-session',runId:'run1',hypothesisId:'D'})}).catch(()=>{});
|
|
87
|
-
// #endregion
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// #region agent log
|
|
91
|
-
fetch('http://127.0.0.1:7244/ingest/0a9f7972-5d03-4255-b5c9-6164f846fb46',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'debug-check-prisma.ts:76',message:'Final summary',data:{prismaClientExists,prismaGeneratedExists,prismaClientImportSuccess,prismaClientImportError,hasPackageJson:!!prismaClientPackageJson,hasIndexDts:!!indexDtsContent},sessionId:'debug-session',runId:'run1',hypothesisId:'ALL'})}).catch(()=>{});
|
|
92
|
-
// #endregion
|
|
93
|
-
|
|
94
|
-
console.log('Prisma Client Check Complete');
|
|
95
|
-
console.log('Prisma Client Package Exists:', prismaClientExists);
|
|
96
|
-
console.log('Prisma Generated Client Exists:', prismaGeneratedExists);
|
|
97
|
-
console.log('PrismaClient Import Success:', prismaClientImportSuccess);
|
|
98
|
-
if (prismaClientImportError) {
|
|
99
|
-
console.log('PrismaClient Import Error:', prismaClientImportError);
|
|
100
|
-
}
|