Options
All
  • Public
  • Public/Protected
  • All
Menu

Profile IO methods for writing/reading profiles to disk. The profile managers never invoke "fs" directly. All "fs" calls are wrapped here and errors are transformed to ImperativeError for error handling/flow throughout Imperative.

export

Hierarchy

  • ProfileIO

Index

Properties

Static Private ERROR_ID

ERROR_ID: string = "Profile IO Error"

Error IO tag for Imperative Errors

static
memberof

ProfileIO

Static Readonly MAX_YAML_DEPTH

MAX_YAML_DEPTH: number = 9999

The yamljs package requires you to indicate the depth for conversion to yaml. Set to max of 9999.

static
memberof

ProfileIO

Methods

Static createProfileDirs

  • createProfileDirs(path: string): void
  • Creates the full set of directories indicated by the path. Used to create the profile root directory and type directories.

    static
    memberof

    ProfileIO

    Parameters

    • path: string

      The directory path to create - creates all necessary subdirectories.

    Returns void

Static deleteProfile

  • deleteProfile(name: string, fullFilePath: string): void

Static exists

  • exists(path: string): string

Static fileToProfileName

  • fileToProfileName(file: string, ext: string): string

Static getAllProfileDirectories

  • getAllProfileDirectories(profileRootDirectory: string): string[]
  • Accepts the profiles root directory and returns all directories within. The directories within the root directory are all assumed to be profile type directories (potentially containing a meta file and profiles of that type).

    static
    memberof

    ProfileIO

    Parameters

    • profileRootDirectory: string

      The profiles root directory to obtain all profiles from.

    Returns string[]

    • The list of profiles returned or a blank array

Static getAllProfileNames

  • getAllProfileNames(profileTypeDir: string, ext: string, metaNameForType: string): string[]
  • Accepts the profile directory location for a type, reads all filenames, and returns a list of profile names that are present within the directory (excluding the meta profile)

    static
    memberof

    ProfileIO

    Parameters

    • profileTypeDir: string

      The directory for the type

    • ext: string

      the extension for the profile files (normally YAML)

    • metaNameForType: string

      the meta name for this type

    Returns string[]

    • A list of all profile names (without path/ext)

Static readMetaFile

  • Read the profile meta file using Yaml "safeLoad" (ensures that no code executes, etc. during the load). The meta profile file for a type contains the default profile specification. The meta profile is ALWAYS in YAML format (controlled exclusively by the Imperative framework).

    static
    memberof

    ProfileIO

    Type parameters

    Parameters

    • path: string

      The path to the meta profile

    Returns IMetaProfile<T>

    • The meta profile

Static readProfileFile

  • readProfileFile(filePath: string, type: string): IProfile
  • Read a profile from disk. Profiles are always assumed to be YAML (YAML "safeLoad" is invoked to perform the load).

    static
    memberof

    ProfileIO

    Parameters

    • filePath: string

      Path to the profile.

    • type: string

      The profile type; used to populate the "type" in the profile object (type property not persisted on disk).

    Returns IProfile

    • The profile object.

Static writeMetaFile

Static writeProfile

  • writeProfile(fullFilePath: string, profile: IProfile): void
  • Accepts a profile object and writes the profile to the specified location (and optionally converts the profile to YAML format - the default for Imperative profiles).

    static
    memberof

    ProfileIO

    Parameters

    • fullFilePath: string

      the fully qualified profile path, file, & extension.

    • profile: IProfile

      the profile object to write to disk.

    Returns void

Generated using TypeDoc