av6-core 1.7.6 → 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 +25 -4
- package/dist/index.mjs +24 -4
- package/package.json +1 -1
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
|
}
|
|
@@ -4243,6 +4263,7 @@ var AuditProxy = class {
|
|
|
4243
4263
|
fromTimestampToSqlDatetime,
|
|
4244
4264
|
getDynamicValue,
|
|
4245
4265
|
getNestedValue,
|
|
4266
|
+
getNestedValueV2,
|
|
4246
4267
|
getPattern,
|
|
4247
4268
|
interpolate,
|
|
4248
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
|
}
|
|
@@ -4190,6 +4209,7 @@ export {
|
|
|
4190
4209
|
fromTimestampToSqlDatetime,
|
|
4191
4210
|
getDynamicValue,
|
|
4192
4211
|
getNestedValue,
|
|
4212
|
+
getNestedValueV2,
|
|
4193
4213
|
getPattern,
|
|
4194
4214
|
interpolate,
|
|
4195
4215
|
objectTo2DArray,
|