av6-core 1.7.3 → 1.7.5
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 +30 -5
- package/dist/index.mjs +29 -5
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -533,6 +533,7 @@ declare const getPattern: {
|
|
|
533
533
|
};
|
|
534
534
|
declare const interpolate: (template: string, vars: Record<string, unknown>) => string;
|
|
535
535
|
declare const fromTimestampToSqlDatetime: (date: string) => string;
|
|
536
|
+
declare function formatDatesDeep<T>(data: T, format?: string): T;
|
|
536
537
|
|
|
537
538
|
interface CreateTransaction {
|
|
538
539
|
field: string;
|
|
@@ -700,4 +701,4 @@ declare class AuditProxy<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_
|
|
|
700
701
|
createAuditedService<T extends object>(serviceName: string, service: T): T;
|
|
701
702
|
}
|
|
702
703
|
|
|
703
|
-
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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -533,6 +533,7 @@ declare const getPattern: {
|
|
|
533
533
|
};
|
|
534
534
|
declare const interpolate: (template: string, vars: Record<string, unknown>) => string;
|
|
535
535
|
declare const fromTimestampToSqlDatetime: (date: string) => string;
|
|
536
|
+
declare function formatDatesDeep<T>(data: T, format?: string): T;
|
|
536
537
|
|
|
537
538
|
interface CreateTransaction {
|
|
538
539
|
field: string;
|
|
@@ -700,4 +701,4 @@ declare class AuditProxy<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_
|
|
|
700
701
|
createAuditedService<T extends object>(serviceName: string, service: T): T;
|
|
701
702
|
}
|
|
702
703
|
|
|
703
|
-
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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -37,6 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
commonService: () => commonService,
|
|
38
38
|
customOmit: () => customOmit,
|
|
39
39
|
findDifferences: () => findDifferences,
|
|
40
|
+
formatDatesDeep: () => formatDatesDeep,
|
|
40
41
|
fromTimestampToSqlDatetime: () => fromTimestampToSqlDatetime,
|
|
41
42
|
getDynamicValue: () => getDynamicValue,
|
|
42
43
|
getNestedValue: () => getNestedValue,
|
|
@@ -1308,9 +1309,10 @@ var commonCreateUpdateRepository = (serviceDeps) => {
|
|
|
1308
1309
|
|
|
1309
1310
|
// src/utils/dynamicJoiBuilder.utils.ts
|
|
1310
1311
|
var import_joi = __toESM(require("joi"));
|
|
1311
|
-
var
|
|
1312
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
1312
1313
|
|
|
1313
1314
|
// src/utils/helper.utils.ts
|
|
1315
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
1314
1316
|
function customOmit(obj, keys) {
|
|
1315
1317
|
const rest = { ...obj };
|
|
1316
1318
|
const omitted = {};
|
|
@@ -1435,6 +1437,27 @@ var interpolate = (template, vars) => {
|
|
|
1435
1437
|
});
|
|
1436
1438
|
};
|
|
1437
1439
|
var fromTimestampToSqlDatetime = (date) => date.replace("T", " ").replace("Z", "");
|
|
1440
|
+
function formatDatesDeep(data, format = "YYYY-MM-DD") {
|
|
1441
|
+
if (data === null || data === void 0) return data;
|
|
1442
|
+
if (Array.isArray(data)) {
|
|
1443
|
+
return data.map((item) => formatDatesDeep(item, format));
|
|
1444
|
+
}
|
|
1445
|
+
if (typeof data === "object") {
|
|
1446
|
+
const result = {};
|
|
1447
|
+
for (const key in data) {
|
|
1448
|
+
const value = data[key];
|
|
1449
|
+
if (value instanceof Date || typeof value === "string" && (0, import_dayjs.default)(value, "YYYY-MM-DD", true).isValid()) {
|
|
1450
|
+
result[key] = (0, import_dayjs.default)(value).format(format);
|
|
1451
|
+
} else if (Array.isArray(value) || typeof value === "object" && value !== null) {
|
|
1452
|
+
result[key] = formatDatesDeep(value, format);
|
|
1453
|
+
} else {
|
|
1454
|
+
result[key] = value;
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
return result;
|
|
1458
|
+
}
|
|
1459
|
+
return data;
|
|
1460
|
+
}
|
|
1438
1461
|
|
|
1439
1462
|
// src/utils/dynamicJoiBuilder.utils.ts
|
|
1440
1463
|
function applyNumberCompare(schema, op, ref) {
|
|
@@ -1467,13 +1490,13 @@ function resolvePrecision(rule, ctx) {
|
|
|
1467
1490
|
function resolveMinDate(rule) {
|
|
1468
1491
|
if (!rule.minDate) return void 0;
|
|
1469
1492
|
if (rule.minDate === "now") return /* @__PURE__ */ new Date();
|
|
1470
|
-
if (rule.minDate === "today") return (0,
|
|
1493
|
+
if (rule.minDate === "today") return (0, import_dayjs2.default)().startOf("day").toDate();
|
|
1471
1494
|
return void 0;
|
|
1472
1495
|
}
|
|
1473
1496
|
function resolveMaxDate(rule) {
|
|
1474
1497
|
if (!rule.maxDate) return void 0;
|
|
1475
1498
|
if (rule.maxDate === "now") return /* @__PURE__ */ new Date();
|
|
1476
|
-
if (rule.maxDate === "today") return (0,
|
|
1499
|
+
if (rule.maxDate === "today") return (0, import_dayjs2.default)().startOf("day").toDate();
|
|
1477
1500
|
return void 0;
|
|
1478
1501
|
}
|
|
1479
1502
|
var buildScalar = (f, ctx, op) => {
|
|
@@ -2450,7 +2473,7 @@ var uinConfigServiceValidation = (uinDeps) => {
|
|
|
2450
2473
|
};
|
|
2451
2474
|
|
|
2452
2475
|
// src/services/uinConfig.service.ts
|
|
2453
|
-
var
|
|
2476
|
+
var import_dayjs3 = __toESM(require("dayjs"));
|
|
2454
2477
|
var import_node_cron = __toESM(require("node-cron"));
|
|
2455
2478
|
var MS_IN_A_DAY = 24 * 36e5;
|
|
2456
2479
|
function buildFromSegments(segments, seqValue) {
|
|
@@ -2464,7 +2487,7 @@ function buildFromSegments(segments, seqValue) {
|
|
|
2464
2487
|
break;
|
|
2465
2488
|
case "dateFormat":
|
|
2466
2489
|
try {
|
|
2467
|
-
out += (0,
|
|
2490
|
+
out += (0, import_dayjs3.default)(/* @__PURE__ */ new Date()).format(seg.value);
|
|
2468
2491
|
} catch {
|
|
2469
2492
|
console.error("Invalid dateFormat:", seg.value);
|
|
2470
2493
|
}
|
|
@@ -3446,6 +3469,7 @@ var NotificationService = class {
|
|
|
3446
3469
|
* Creates parent EventDelivery and one child EventDeliveryItem per attempt.
|
|
3447
3470
|
*/
|
|
3448
3471
|
async handleEvent(evt) {
|
|
3472
|
+
evt.data = formatDatesDeep(evt.data);
|
|
3449
3473
|
const cfg = await this.loadEventConfigOrThrow(evt);
|
|
3450
3474
|
const delivery = await this.createDeliveryParent(cfg, evt);
|
|
3451
3475
|
const tasks = [];
|
|
@@ -4193,6 +4217,7 @@ var AuditProxy = class {
|
|
|
4193
4217
|
commonService,
|
|
4194
4218
|
customOmit,
|
|
4195
4219
|
findDifferences,
|
|
4220
|
+
formatDatesDeep,
|
|
4196
4221
|
fromTimestampToSqlDatetime,
|
|
4197
4222
|
getDynamicValue,
|
|
4198
4223
|
getNestedValue,
|
package/dist/index.mjs
CHANGED
|
@@ -1257,9 +1257,10 @@ var commonCreateUpdateRepository = (serviceDeps) => {
|
|
|
1257
1257
|
|
|
1258
1258
|
// src/utils/dynamicJoiBuilder.utils.ts
|
|
1259
1259
|
import Joi from "joi";
|
|
1260
|
-
import
|
|
1260
|
+
import dayjs2 from "dayjs";
|
|
1261
1261
|
|
|
1262
1262
|
// src/utils/helper.utils.ts
|
|
1263
|
+
import dayjs from "dayjs";
|
|
1263
1264
|
function customOmit(obj, keys) {
|
|
1264
1265
|
const rest = { ...obj };
|
|
1265
1266
|
const omitted = {};
|
|
@@ -1384,6 +1385,27 @@ var interpolate = (template, vars) => {
|
|
|
1384
1385
|
});
|
|
1385
1386
|
};
|
|
1386
1387
|
var fromTimestampToSqlDatetime = (date) => date.replace("T", " ").replace("Z", "");
|
|
1388
|
+
function formatDatesDeep(data, format = "YYYY-MM-DD") {
|
|
1389
|
+
if (data === null || data === void 0) return data;
|
|
1390
|
+
if (Array.isArray(data)) {
|
|
1391
|
+
return data.map((item) => formatDatesDeep(item, format));
|
|
1392
|
+
}
|
|
1393
|
+
if (typeof data === "object") {
|
|
1394
|
+
const result = {};
|
|
1395
|
+
for (const key in data) {
|
|
1396
|
+
const value = data[key];
|
|
1397
|
+
if (value instanceof Date || typeof value === "string" && dayjs(value, "YYYY-MM-DD", true).isValid()) {
|
|
1398
|
+
result[key] = dayjs(value).format(format);
|
|
1399
|
+
} else if (Array.isArray(value) || typeof value === "object" && value !== null) {
|
|
1400
|
+
result[key] = formatDatesDeep(value, format);
|
|
1401
|
+
} else {
|
|
1402
|
+
result[key] = value;
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
return result;
|
|
1406
|
+
}
|
|
1407
|
+
return data;
|
|
1408
|
+
}
|
|
1387
1409
|
|
|
1388
1410
|
// src/utils/dynamicJoiBuilder.utils.ts
|
|
1389
1411
|
function applyNumberCompare(schema, op, ref) {
|
|
@@ -1416,13 +1438,13 @@ function resolvePrecision(rule, ctx) {
|
|
|
1416
1438
|
function resolveMinDate(rule) {
|
|
1417
1439
|
if (!rule.minDate) return void 0;
|
|
1418
1440
|
if (rule.minDate === "now") return /* @__PURE__ */ new Date();
|
|
1419
|
-
if (rule.minDate === "today") return
|
|
1441
|
+
if (rule.minDate === "today") return dayjs2().startOf("day").toDate();
|
|
1420
1442
|
return void 0;
|
|
1421
1443
|
}
|
|
1422
1444
|
function resolveMaxDate(rule) {
|
|
1423
1445
|
if (!rule.maxDate) return void 0;
|
|
1424
1446
|
if (rule.maxDate === "now") return /* @__PURE__ */ new Date();
|
|
1425
|
-
if (rule.maxDate === "today") return
|
|
1447
|
+
if (rule.maxDate === "today") return dayjs2().startOf("day").toDate();
|
|
1426
1448
|
return void 0;
|
|
1427
1449
|
}
|
|
1428
1450
|
var buildScalar = (f, ctx, op) => {
|
|
@@ -2399,7 +2421,7 @@ var uinConfigServiceValidation = (uinDeps) => {
|
|
|
2399
2421
|
};
|
|
2400
2422
|
|
|
2401
2423
|
// src/services/uinConfig.service.ts
|
|
2402
|
-
import
|
|
2424
|
+
import dayjs3 from "dayjs";
|
|
2403
2425
|
import cron from "node-cron";
|
|
2404
2426
|
var MS_IN_A_DAY = 24 * 36e5;
|
|
2405
2427
|
function buildFromSegments(segments, seqValue) {
|
|
@@ -2413,7 +2435,7 @@ function buildFromSegments(segments, seqValue) {
|
|
|
2413
2435
|
break;
|
|
2414
2436
|
case "dateFormat":
|
|
2415
2437
|
try {
|
|
2416
|
-
out +=
|
|
2438
|
+
out += dayjs3(/* @__PURE__ */ new Date()).format(seg.value);
|
|
2417
2439
|
} catch {
|
|
2418
2440
|
console.error("Invalid dateFormat:", seg.value);
|
|
2419
2441
|
}
|
|
@@ -3395,6 +3417,7 @@ var NotificationService = class {
|
|
|
3395
3417
|
* Creates parent EventDelivery and one child EventDeliveryItem per attempt.
|
|
3396
3418
|
*/
|
|
3397
3419
|
async handleEvent(evt) {
|
|
3420
|
+
evt.data = formatDatesDeep(evt.data);
|
|
3398
3421
|
const cfg = await this.loadEventConfigOrThrow(evt);
|
|
3399
3422
|
const delivery = await this.createDeliveryParent(cfg, evt);
|
|
3400
3423
|
const tasks = [];
|
|
@@ -4141,6 +4164,7 @@ export {
|
|
|
4141
4164
|
commonService,
|
|
4142
4165
|
customOmit,
|
|
4143
4166
|
findDifferences,
|
|
4167
|
+
formatDatesDeep,
|
|
4144
4168
|
fromTimestampToSqlDatetime,
|
|
4145
4169
|
getDynamicValue,
|
|
4146
4170
|
getNestedValue,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "av6-core",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"av6-utils": "^1.0.4",
|
|
28
28
|
"axios": "^1.11.0",
|
|
29
|
+
"dayjs": "^1.11.19",
|
|
29
30
|
"exceljs": "^4.4.0",
|
|
30
31
|
"handlebars": "^4.7.8",
|
|
31
32
|
"joi": "^17.13.3",
|