src/utils/config-import/import-options.ts
Properties |
|
| checkExists |
checkExists:
|
Type : function
|
|
Check if item already exists |
| deleteExisting |
deleteExisting:
|
Type : function
|
| Optional |
|
Delete existing item if force is enabled |
| fileExtension |
fileExtension:
|
Type : string
|
| Optional |
|
File extension filter (e.g., ".json", ".png"). If not provided, all files are processed. |
| formatValidationError |
formatValidationError:
|
Type : function
|
| Optional |
|
Custom validation error formatter |
| loadData |
loadData:
|
Type : function
|
| Optional |
|
Custom data loader (e.g., for JSON files vs binary files) |
| processItem |
processItem:
|
Type : function
|
|
Process and store the item |
| resourceType |
resourceType:
|
Type : string
|
|
Resource type name for logging (e.g., "credential config", "key", "image") |
| subfolder |
subfolder:
|
Type : string
|
|
Subfolder within each tenant directory (e.g., "issuance", "keys", "images") |
| validationClass |
validationClass:
|
Type : ClassConstructor<T>
|
| Optional |
|
Class constructor for validation (if applicable) |
import { ClassConstructor } from "class-transformer";
import { ValidationError } from "class-validator";
export interface ImportOptions<T extends object> {
/**
* Subfolder within each tenant directory (e.g., "issuance", "keys", "images")
*/
subfolder: string;
/**
* File extension filter (e.g., ".json", ".png"). If not provided, all files are processed.
*/
fileExtension?: string;
/**
* Class constructor for validation (if applicable)
*/
validationClass?: ClassConstructor<T>;
/**
* Check if item already exists
*/
checkExists: (tenantId: string, data: T, file: string) => Promise<boolean>;
/**
* Delete existing item if force is enabled
*/
deleteExisting?: (tenantId: string, data: T, file: string) => Promise<void>;
/**
* Process and store the item
*/
processItem: (tenantId: string, data: T, file: string) => Promise<void>;
/**
* Custom data loader (e.g., for JSON files vs binary files)
*/
loadData?: (filePath: string) => T | Promise<T>;
/**
* Custom validation error formatter
*/
formatValidationError?: (error: ValidationError) => any;
/**
* Resource type name for logging (e.g., "credential config", "key", "image")
*/
resourceType: string;
}