av6-core 1.3.0 → 1.3.1
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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +7 -0
- package/dist/index.mjs +7 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -352,8 +352,13 @@ interface CacheAdapter {
|
|
|
352
352
|
deleteCache(key: string, id: number | string): Promise<void>;
|
|
353
353
|
addToCache(key: string, id: number | string, data: unknown): Promise<void>;
|
|
354
354
|
}
|
|
355
|
+
interface SingleValidationMapping {
|
|
356
|
+
create?: DtoMappingFunction;
|
|
357
|
+
update?: DtoMappingFunction;
|
|
358
|
+
}
|
|
355
359
|
interface Mapper {
|
|
356
360
|
dtoMapping: Record<string, DtoMappingFunction>;
|
|
361
|
+
validationMapping?: Record<string, SingleValidationMapping>;
|
|
357
362
|
mappingExport: {
|
|
358
363
|
[key: string]: (record: unknown) => unknown;
|
|
359
364
|
};
|
|
@@ -595,4 +600,4 @@ declare class AuditProxy<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_
|
|
|
595
600
|
createAuditedService<T extends object>(serviceName: string, service: T): T;
|
|
596
601
|
}
|
|
597
602
|
|
|
598
|
-
export { type AuditContext, type AuditContextProvider, AuditCore, type AuditLogPayload, AuditLogger, AuditProxy, 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 DeleteParams, type DeleteRequestRepository, type Deps, type DropdownRequest, type DropdownRequestService, 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 FixedSearchRequest, type FixedSearchRequestService, type Helpers, type ImportExcel, type ImportExcelRequestService, type LockUnlockParams, type LockUnlockRequestRepository, type Mapper, type NewFixedSearchRequest, type NewFixedSearchRequestService, type NewSearchRequest, NotificationEmitter, type Op, type PaginatedResponse, type Presence, type Recipient, type RelationConfig, type RelationStrategy, type RelationWriteConfig, type SearchRequest, type SearchRequestService, type ServiceCacheAdapter, type SourcePath, type Store, type ToggleActive, type TxClient, type UINConfigDTO, type UINPreviewRequest, type UINSegment, type UINSegmentType, type UIN_RESET_POLICY, type UinDeps, type UniqueConfig, type UpdateConfigByCodeInput, type UpdateStatusRequestRepository, type UpdateUINConfigRequest, type ValidationErrorItem, commonService, customOmit, findDifferences, fromTimestampToSqlDatetime, getDynamicValue, getPattern, interpolate, objectTo2DArray, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
|
|
603
|
+
export { type AuditContext, type AuditContextProvider, AuditCore, type AuditLogPayload, AuditLogger, AuditProxy, 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 DeleteParams, type DeleteRequestRepository, type Deps, type DropdownRequest, type DropdownRequestService, 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 FixedSearchRequest, type FixedSearchRequestService, type Helpers, type ImportExcel, type ImportExcelRequestService, type LockUnlockParams, type LockUnlockRequestRepository, type Mapper, type NewFixedSearchRequest, type NewFixedSearchRequestService, type NewSearchRequest, NotificationEmitter, type Op, type PaginatedResponse, 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 UniqueConfig, type UpdateConfigByCodeInput, type UpdateStatusRequestRepository, type UpdateUINConfigRequest, type ValidationErrorItem, commonService, customOmit, findDifferences, fromTimestampToSqlDatetime, getDynamicValue, getPattern, interpolate, objectTo2DArray, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -352,8 +352,13 @@ interface CacheAdapter {
|
|
|
352
352
|
deleteCache(key: string, id: number | string): Promise<void>;
|
|
353
353
|
addToCache(key: string, id: number | string, data: unknown): Promise<void>;
|
|
354
354
|
}
|
|
355
|
+
interface SingleValidationMapping {
|
|
356
|
+
create?: DtoMappingFunction;
|
|
357
|
+
update?: DtoMappingFunction;
|
|
358
|
+
}
|
|
355
359
|
interface Mapper {
|
|
356
360
|
dtoMapping: Record<string, DtoMappingFunction>;
|
|
361
|
+
validationMapping?: Record<string, SingleValidationMapping>;
|
|
357
362
|
mappingExport: {
|
|
358
363
|
[key: string]: (record: unknown) => unknown;
|
|
359
364
|
};
|
|
@@ -595,4 +600,4 @@ declare class AuditProxy<Module extends string = "OPD" | "PROCEDURE" | "GENERAL_
|
|
|
595
600
|
createAuditedService<T extends object>(serviceName: string, service: T): T;
|
|
596
601
|
}
|
|
597
602
|
|
|
598
|
-
export { type AuditContext, type AuditContextProvider, AuditCore, type AuditLogPayload, AuditLogger, AuditProxy, 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 DeleteParams, type DeleteRequestRepository, type Deps, type DropdownRequest, type DropdownRequestService, 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 FixedSearchRequest, type FixedSearchRequestService, type Helpers, type ImportExcel, type ImportExcelRequestService, type LockUnlockParams, type LockUnlockRequestRepository, type Mapper, type NewFixedSearchRequest, type NewFixedSearchRequestService, type NewSearchRequest, NotificationEmitter, type Op, type PaginatedResponse, type Presence, type Recipient, type RelationConfig, type RelationStrategy, type RelationWriteConfig, type SearchRequest, type SearchRequestService, type ServiceCacheAdapter, type SourcePath, type Store, type ToggleActive, type TxClient, type UINConfigDTO, type UINPreviewRequest, type UINSegment, type UINSegmentType, type UIN_RESET_POLICY, type UinDeps, type UniqueConfig, type UpdateConfigByCodeInput, type UpdateStatusRequestRepository, type UpdateUINConfigRequest, type ValidationErrorItem, commonService, customOmit, findDifferences, fromTimestampToSqlDatetime, getDynamicValue, getPattern, interpolate, objectTo2DArray, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
|
|
603
|
+
export { type AuditContext, type AuditContextProvider, AuditCore, type AuditLogPayload, AuditLogger, AuditProxy, 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 DeleteParams, type DeleteRequestRepository, type Deps, type DropdownRequest, type DropdownRequestService, 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 FixedSearchRequest, type FixedSearchRequestService, type Helpers, type ImportExcel, type ImportExcelRequestService, type LockUnlockParams, type LockUnlockRequestRepository, type Mapper, type NewFixedSearchRequest, type NewFixedSearchRequestService, type NewSearchRequest, NotificationEmitter, type Op, type PaginatedResponse, 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 UniqueConfig, type UpdateConfigByCodeInput, type UpdateStatusRequestRepository, type UpdateUINConfigRequest, type ValidationErrorItem, commonService, customOmit, findDifferences, fromTimestampToSqlDatetime, getDynamicValue, getPattern, interpolate, objectTo2DArray, toNumberOrNull, toUINConfigDTO, uinConfigService, type updateStatusParams };
|
package/dist/index.js
CHANGED
|
@@ -1223,6 +1223,7 @@ var commonService = (serviceDeps) => {
|
|
|
1223
1223
|
const { deleteCache, getCacheById, updateCache, createCache, addToCache } = serviceDeps.cacheAdapter;
|
|
1224
1224
|
const logger = serviceDeps.logger;
|
|
1225
1225
|
const dtoMapping = serviceDeps.mapper.dtoMapping;
|
|
1226
|
+
const validationMapping = serviceDeps.mapper.validationMapping;
|
|
1226
1227
|
const { REDIS_PREFIX, CACHE_KEY_NAME } = serviceDeps.config;
|
|
1227
1228
|
const commonRepositoryFactory = commonRepository(serviceDeps);
|
|
1228
1229
|
const commonCreateUpdateRepositoryFactory = commonCreateUpdateRepository(serviceDeps);
|
|
@@ -1476,6 +1477,9 @@ var commonService = (serviceDeps) => {
|
|
|
1476
1477
|
const ctx = { userId: currentUser ?? void 0, vars: {} };
|
|
1477
1478
|
const schema = buildJoiSchemaForOp(cfg, "create");
|
|
1478
1479
|
const validated = await schema.validateAsync(createParams.body);
|
|
1480
|
+
if (validationMapping && validationMapping[shortCodeData.shortCode] && validationMapping[shortCodeData.shortCode].create) {
|
|
1481
|
+
await validationMapping[shortCodeData.shortCode].create?.(validated);
|
|
1482
|
+
}
|
|
1479
1483
|
const createResult = await commonCreateUpdateRepositoryFactory.commonCreate({
|
|
1480
1484
|
body: validated,
|
|
1481
1485
|
ctx,
|
|
@@ -1515,6 +1519,9 @@ var commonService = (serviceDeps) => {
|
|
|
1515
1519
|
const ctx = { userId: currentUser ?? void 0, vars: {} };
|
|
1516
1520
|
const schema = buildJoiSchemaForOp(cfg, "update");
|
|
1517
1521
|
const validated = await schema.validateAsync(updateParams.body);
|
|
1522
|
+
if (validationMapping && validationMapping[shortCodeData.shortCode] && validationMapping[shortCodeData.shortCode].update) {
|
|
1523
|
+
await validationMapping[shortCodeData.shortCode].update?.(validated);
|
|
1524
|
+
}
|
|
1518
1525
|
const updateResult = await commonCreateUpdateRepositoryFactory.commonUpdate({
|
|
1519
1526
|
body: validated,
|
|
1520
1527
|
ctx,
|
package/dist/index.mjs
CHANGED
|
@@ -1173,6 +1173,7 @@ var commonService = (serviceDeps) => {
|
|
|
1173
1173
|
const { deleteCache, getCacheById, updateCache, createCache, addToCache } = serviceDeps.cacheAdapter;
|
|
1174
1174
|
const logger = serviceDeps.logger;
|
|
1175
1175
|
const dtoMapping = serviceDeps.mapper.dtoMapping;
|
|
1176
|
+
const validationMapping = serviceDeps.mapper.validationMapping;
|
|
1176
1177
|
const { REDIS_PREFIX, CACHE_KEY_NAME } = serviceDeps.config;
|
|
1177
1178
|
const commonRepositoryFactory = commonRepository(serviceDeps);
|
|
1178
1179
|
const commonCreateUpdateRepositoryFactory = commonCreateUpdateRepository(serviceDeps);
|
|
@@ -1426,6 +1427,9 @@ var commonService = (serviceDeps) => {
|
|
|
1426
1427
|
const ctx = { userId: currentUser ?? void 0, vars: {} };
|
|
1427
1428
|
const schema = buildJoiSchemaForOp(cfg, "create");
|
|
1428
1429
|
const validated = await schema.validateAsync(createParams.body);
|
|
1430
|
+
if (validationMapping && validationMapping[shortCodeData.shortCode] && validationMapping[shortCodeData.shortCode].create) {
|
|
1431
|
+
await validationMapping[shortCodeData.shortCode].create?.(validated);
|
|
1432
|
+
}
|
|
1429
1433
|
const createResult = await commonCreateUpdateRepositoryFactory.commonCreate({
|
|
1430
1434
|
body: validated,
|
|
1431
1435
|
ctx,
|
|
@@ -1465,6 +1469,9 @@ var commonService = (serviceDeps) => {
|
|
|
1465
1469
|
const ctx = { userId: currentUser ?? void 0, vars: {} };
|
|
1466
1470
|
const schema = buildJoiSchemaForOp(cfg, "update");
|
|
1467
1471
|
const validated = await schema.validateAsync(updateParams.body);
|
|
1472
|
+
if (validationMapping && validationMapping[shortCodeData.shortCode] && validationMapping[shortCodeData.shortCode].update) {
|
|
1473
|
+
await validationMapping[shortCodeData.shortCode].update?.(validated);
|
|
1474
|
+
}
|
|
1468
1475
|
const updateResult = await commonCreateUpdateRepositoryFactory.commonUpdate({
|
|
1469
1476
|
body: validated,
|
|
1470
1477
|
ctx,
|