av6-core 1.6.6 → 1.6.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 CHANGED
@@ -525,6 +525,7 @@ declare function customOmit<T extends object, K extends keyof T>(obj: T, keys: K
525
525
  omitted: Pick<T, K>;
526
526
  };
527
527
  declare function getDynamicValue(obj: Record<string, any> | null | undefined, accessorKey: string): any | null;
528
+ declare function getNestedValue<T = unknown>(obj: unknown, path?: string | null, defaultValue?: T): T | undefined;
528
529
  declare function objectTo2DArray<T>(obj: Record<string, T>, maxCols: number): (string | T)[][];
529
530
  declare function toNumberOrNull(value: unknown): number | null;
530
531
  declare const getPattern: {
@@ -694,4 +695,4 @@ declare class AuditProxy<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_
694
695
  createAuditedService<T extends object>(serviceName: string, service: T): T;
695
696
  }
696
697
 
697
- 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, fromTimestampToSqlDatetime, getDynamicValue, getPattern, interpolate, objectTo2DArray, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
698
+ 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, fromTimestampToSqlDatetime, getDynamicValue, getNestedValue, getPattern, interpolate, objectTo2DArray, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
package/dist/index.d.ts CHANGED
@@ -525,6 +525,7 @@ declare function customOmit<T extends object, K extends keyof T>(obj: T, keys: K
525
525
  omitted: Pick<T, K>;
526
526
  };
527
527
  declare function getDynamicValue(obj: Record<string, any> | null | undefined, accessorKey: string): any | null;
528
+ declare function getNestedValue<T = unknown>(obj: unknown, path?: string | null, defaultValue?: T): T | undefined;
528
529
  declare function objectTo2DArray<T>(obj: Record<string, T>, maxCols: number): (string | T)[][];
529
530
  declare function toNumberOrNull(value: unknown): number | null;
530
531
  declare const getPattern: {
@@ -694,4 +695,4 @@ declare class AuditProxy<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_
694
695
  createAuditedService<T extends object>(serviceName: string, service: T): T;
695
696
  }
696
697
 
697
- 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, fromTimestampToSqlDatetime, getDynamicValue, getPattern, interpolate, objectTo2DArray, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
698
+ 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, fromTimestampToSqlDatetime, getDynamicValue, getNestedValue, getPattern, interpolate, objectTo2DArray, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
package/dist/index.js CHANGED
@@ -39,6 +39,7 @@ __export(index_exports, {
39
39
  findDifferences: () => findDifferences,
40
40
  fromTimestampToSqlDatetime: () => fromTimestampToSqlDatetime,
41
41
  getDynamicValue: () => getDynamicValue,
42
+ getNestedValue: () => getNestedValue,
42
43
  getPattern: () => getPattern,
43
44
  interpolate: () => interpolate,
44
45
  objectTo2DArray: () => objectTo2DArray,
@@ -1329,6 +1330,15 @@ function getDynamicValue(obj, accessorKey) {
1329
1330
  }
1330
1331
  return result === void 0 ? null : result;
1331
1332
  }
1333
+ function getNestedValue(obj, path, defaultValue) {
1334
+ if (!obj || !path) return defaultValue;
1335
+ const normalizedPath = path.replace(/\[(\d+)\]/g, ".$1");
1336
+ const result = normalizedPath.split(".").reduce((acc, key) => {
1337
+ if (acc == null) return void 0;
1338
+ return acc[key];
1339
+ }, obj);
1340
+ return result === void 0 ? defaultValue : result;
1341
+ }
1332
1342
  function objectTo2DArray(obj, maxCols) {
1333
1343
  if (maxCols < 2) {
1334
1344
  throw new Error("maxCols must be at least 2");
@@ -3168,9 +3178,9 @@ async function resolveAllRecipients(args) {
3168
3178
  }
3169
3179
  if (r.sourceType === "KEY_VALUE") {
3170
3180
  const recs = toArray(cfg.recipients).map((x) => {
3171
- const userIdVal = args.evtData?.[x.userId];
3172
- const level1Val = args.evtData?.[x.level1Id];
3173
- const level2Val = x.level2Id ? args.evtData?.[x.level2Id] : void 0;
3181
+ const userIdVal = getNestedValue(args.evtData, x.userId);
3182
+ const level1Val = getNestedValue(args.evtData, x.level1Id);
3183
+ const level2Val = x.level2Id ? getNestedValue(args.evtData, x.level2Id) : void 0;
3174
3184
  return {
3175
3185
  userId: userIdVal != null ? Number(userIdVal) : null,
3176
3186
  level1Id: level1Val != null ? Number(level1Val) : null,
@@ -3205,7 +3215,7 @@ async function resolveAllRecipients(args) {
3205
3215
  }
3206
3216
  if (r.sourceType === "KEY_VALUE") {
3207
3217
  for (const k of toArray(cfg.recipients)) {
3208
- const v = args.evtData?.[k];
3218
+ const v = getNestedValue(args.evtData, k);
3209
3219
  if (typeof v === "string") res[type].push(v);
3210
3220
  if (Array.isArray(v)) res[type].push(...v.filter((x) => typeof x === "string"));
3211
3221
  }
@@ -4149,6 +4159,7 @@ var AuditProxy = class {
4149
4159
  findDifferences,
4150
4160
  fromTimestampToSqlDatetime,
4151
4161
  getDynamicValue,
4162
+ getNestedValue,
4152
4163
  getPattern,
4153
4164
  interpolate,
4154
4165
  objectTo2DArray,
package/dist/index.mjs CHANGED
@@ -1279,6 +1279,15 @@ function getDynamicValue(obj, accessorKey) {
1279
1279
  }
1280
1280
  return result === void 0 ? null : result;
1281
1281
  }
1282
+ function getNestedValue(obj, path, defaultValue) {
1283
+ if (!obj || !path) return defaultValue;
1284
+ const normalizedPath = path.replace(/\[(\d+)\]/g, ".$1");
1285
+ const result = normalizedPath.split(".").reduce((acc, key) => {
1286
+ if (acc == null) return void 0;
1287
+ return acc[key];
1288
+ }, obj);
1289
+ return result === void 0 ? defaultValue : result;
1290
+ }
1282
1291
  function objectTo2DArray(obj, maxCols) {
1283
1292
  if (maxCols < 2) {
1284
1293
  throw new Error("maxCols must be at least 2");
@@ -3118,9 +3127,9 @@ async function resolveAllRecipients(args) {
3118
3127
  }
3119
3128
  if (r.sourceType === "KEY_VALUE") {
3120
3129
  const recs = toArray(cfg.recipients).map((x) => {
3121
- const userIdVal = args.evtData?.[x.userId];
3122
- const level1Val = args.evtData?.[x.level1Id];
3123
- const level2Val = x.level2Id ? args.evtData?.[x.level2Id] : void 0;
3130
+ const userIdVal = getNestedValue(args.evtData, x.userId);
3131
+ const level1Val = getNestedValue(args.evtData, x.level1Id);
3132
+ const level2Val = x.level2Id ? getNestedValue(args.evtData, x.level2Id) : void 0;
3124
3133
  return {
3125
3134
  userId: userIdVal != null ? Number(userIdVal) : null,
3126
3135
  level1Id: level1Val != null ? Number(level1Val) : null,
@@ -3155,7 +3164,7 @@ async function resolveAllRecipients(args) {
3155
3164
  }
3156
3165
  if (r.sourceType === "KEY_VALUE") {
3157
3166
  for (const k of toArray(cfg.recipients)) {
3158
- const v = args.evtData?.[k];
3167
+ const v = getNestedValue(args.evtData, k);
3159
3168
  if (typeof v === "string") res[type].push(v);
3160
3169
  if (Array.isArray(v)) res[type].push(...v.filter((x) => typeof x === "string"));
3161
3170
  }
@@ -4098,6 +4107,7 @@ export {
4098
4107
  findDifferences,
4099
4108
  fromTimestampToSqlDatetime,
4100
4109
  getDynamicValue,
4110
+ getNestedValue,
4101
4111
  getPattern,
4102
4112
  interpolate,
4103
4113
  objectTo2DArray,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "av6-core",
3
- "version": "1.6.6",
3
+ "version": "1.6.7",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",