File

src/utils/config-import/import-options.ts

Index

Properties

Properties

checkExists
checkExists: function
Type : function

Check if item already exists

deleteExisting
deleteExisting: function
Type : function
Optional

Delete existing item if force is enabled

fileExtension
fileExtension: string
Type : string
Optional

File extension filter (e.g., ".json", ".png"). If not provided, all files are processed.

formatValidationError
formatValidationError: function
Type : function
Optional

Custom validation error formatter

loadData
loadData: function
Type : function
Optional

Custom data loader (e.g., for JSON files vs binary files)

processItem
processItem: function
Type : function

Process and store the item

resourceType
resourceType: string
Type : string

Resource type name for logging (e.g., "credential config", "key", "image")

subfolder
subfolder: string
Type : string

Subfolder within each tenant directory (e.g., "issuance", "keys", "images")

validationClass
validationClass: ClassConstructor<T>
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;
}

results matching ""

    No results matching ""