@servicenow/sdk - v4.4.1
    Preparing search index...
    Index

    Methods

    • Adds an existing directory from the relative path or directory name, or throws if it doesn't exist.

      Will return the directory if it was already added.

      Parameters

      • relativeOrAbsoluteDirPath: string

        Directory name or path to the directory that should be added.

      • Optionaloptions: DirectoryAddOptions

      Returns Directory

      DirectoryNotFoundError if the directory does not exist.

    • Adds an existing directory from the relative path or directory name, or returns undefined if it doesn't exist.

      Will return the directory if it was already added.

      Parameters

      • relativeOrAbsoluteDirPath: string

        Directory name or path to the directory that should be added.

      • Optionaloptions: DirectoryAddOptions

        Options.

      Returns Directory | undefined

    • Adds an existing source file, relative to this directory, or throws if it doesn't exist.

      Will return the source file if it was already added.

      Parameters

      • relativeFilePath: string

        Relative file path to add.

      Returns SourceFile

      FileNotFoundError when the file doesn't exist.

    • Adds an existing source file, relative to this directory, or returns undefined.

      Will return the source file if it was already added.

      Parameters

      • relativeFilePath: string

        Relative file path to add.

      Returns SourceFile | undefined

    • Add source files based on file globs.

      Parameters

      • fileGlobs: string | readonly string[]

        File glob or globs to add files based on.

      Returns SourceFile[]

      The matched source files.

    • Recreates the directory.

      Returns void

      This will delete all the descendant source files and directories in memory and queue a delete & mkdir to the file system.

    • Asynchronously recreates the directory.

      Returns Promise<void>

      This will delete all the descendant source files and directories in memory and push a delete & mkdir to the file system.

    • Synchronously recreates the directory.

      Returns void

      This will delete all the descendant source files and directories in memory and push a delete & mkdir to the file system.

    • Copies the directory to a new directory.

      Parameters

      • relativeOrAbsolutePath: string

        The relative or absolute path to the new directory.

      • Optionaloptions: DirectoryCopyOptions

        Options.

      Returns Directory

      The directory the copy was made to.

    • Immediately copies the directory to the specified path asynchronously.

      Parameters

      • relativeOrAbsolutePath: string

        Directory path as an absolute or relative path.

      • Optionaloptions: DirectoryCopyOptions

        Options for moving the directory.

      Returns Promise<Directory>

      If includeTrackedFiles is true, then it will execute the pending operations in the current directory.

    • Immediately copies the directory to the specified path synchronously.

      Parameters

      • relativeOrAbsolutePath: string

        Directory path as an absolute or relative path.

      • Optionaloptions: DirectoryCopyOptions

        Options for moving the directory.

      Returns Directory

      If includeTrackedFiles is true, then it will execute the pending operations in the current directory.

    • Copies the directory to a subdirectory of the specified directory.

      Parameters

      • dirPathOrDirectory: string | Directory

        Directory path or directory object to copy the directory to.

      • Optionaloptions: DirectoryCopyOptions

        Options for copying.

      Returns Directory

      The new copied directory.

    • Creates a directory if it doesn't exist.

      Parameters

      • relativeOrAbsoluteDirPath: string

        Relative or absolute path to the directory that should be created.

      Returns Directory

    • Creates a source file, relative to this directory.

      Note: The file will not be created and saved to the file system until .save() is called on the source file.

      Parameters

      Returns SourceFile

      • InvalidOperationError if a source file already exists at the provided file name.
    • Queues a deletion of the directory to the file system.

      The directory will be deleted when calling ast.save(). If you wish to delete the file immediately, then use deleteImmediately().

      Returns void

    • Asyncronously deletes the directory and all its descendants from the file system.

      Returns Promise<void>

    • Synchronously deletes the directory and all its descendants from the file system.

      Returns void

    • Emits the files in the directory.

      Parameters

      • Optionaloptions: { declarationDir?: string; emitOnlyDtsFiles?: boolean; outDir?: string }

        Options for emitting.

      Returns Promise<DirectoryEmitResult>

    • Emits the files in the directory synchronously.

      Remarks: This might be very slow compared to the asynchronous version if there are a lot of files.

      Parameters

      • Optionaloptions: { declarationDir?: string; emitOnlyDtsFiles?: boolean; outDir?: string }

        Options for emitting.

      Returns DirectoryEmitResult

    • Forgets the directory and all its descendants from the Project.

      Note: Does not delete the directory from the file system.

      Returns void

    • Gets the directory path's base name.

      Returns string

    • Gets the descendant directories.

      Returns Directory[]

    • Gets the source files in the current directory and all the descendant directories.

      Returns SourceFile[]

    • Gets the child directories.

      Returns Directory[]

    • Gets a directory with the specified path or undefined if not found.

      Parameters

      • path: string

        Relative path from this directory or absolute path.

      Returns Directory | undefined

    • Gets a child directory by the specified condition or undefined if not found.

      Parameters

      • condition: (directory: Directory) => boolean

        Condition to check the directory with.

      Returns Directory | undefined

    • Gets a child directory with the specified path or throws if not found.

      Parameters

      • path: string

        Relative path from this directory or absolute path.

      Returns Directory

    • Gets a child directory by the specified condition or throws if not found.

      Parameters

      • condition: (directory: Directory) => boolean

        Condition to check the directory with.

      Returns Directory

    • Gets the parent directory if it exists and was added to the project.

      Returns Directory | undefined

    • Gets the parent directory or throws if it doesn't exist or was never added to the project.

      Parameters

      • Optionalmessage: string | (() => string)

      Returns Directory

    • Gets the path to the directory.

      Returns StandardizedFilePath

    • Gets the project.

      Returns Project

    • Gets the relative path to the specified file path as a module specifier.

      Parameters

      • filePath: string

        File path.

      Returns string

      To get to a directory, provide path/to/directory/index.ts.

    • Gets the relative path to the specified source file as a module specifier.

      Parameters

      Returns string

    • Gets the relative path to the specified directory as a module specifier.

      Parameters

      Returns string

    • Gets the relative path to the specified path.

      Parameters

      • fileOrDirPath: string

        The file or directory path.

      Returns string

    • Gets the relative path to another source file.

      Parameters

      Returns string

    • Gets the relative path to another directory.

      Parameters

      Returns string

    • Gets a child source file with the specified path or undefined if not found.

      Parameters

      • path: string

        Relative or absolute path to the file.

      Returns SourceFile | undefined

    • Gets a child source file by the specified condition or undefined if not found.

      Parameters

      • condition: (sourceFile: SourceFile) => boolean

        Condition to check the source file with.

      Returns SourceFile | undefined

    • Gets a child source file with the specified path or throws if not found.

      Parameters

      • path: string

        Relative or absolute path to the file.

      Returns SourceFile

    • Gets a child source file by the specified condition or throws if not found.

      Parameters

      • condition: (sourceFile: SourceFile) => boolean

        Condition to check the source file with.

      Returns SourceFile

    • Gets the source files within this directory.

      Returns SourceFile[]

    • Gets all the source files added to the project relative to the directory that match a pattern.

      Parameters

      • globPattern: string

        Glob pattern for filtering out the source files.

      Returns SourceFile[]

    • Gets all the source files added to the project relative to the directory that match the provided patterns.

      Parameters

      • globPatterns: readonly string[]

        Glob patterns for filtering out the source files.

      Returns SourceFile[]

    • Checks if this directory is an ancestor of the provided directory.

      Parameters

      • possibleDescendant: SourceFile | Directory

        Directory or source file that's a possible descendant.

      Returns boolean

    • Checks if this directory is a descendant of the provided directory.

      Parameters

      • possibleAncestor: Directory

        Directory or source file that's a possible ancestor.

      Returns boolean

    • Moves the directory to a new path.

      Parameters

      • relativeOrAbsolutePath: string

        Directory path as an absolute or relative path.

      • Optionaloptions: DirectoryMoveOptions

        Options for moving the directory.

      Returns this

    • Immediately moves the directory to a new path asynchronously.

      Parameters

      • relativeOrAbsolutePath: string

        Directory path as an absolute or relative path.

      • Optionaloptions: DirectoryMoveOptions

        Options for moving the directory.

      Returns Promise<Directory>

    • Immediately moves the directory to a new path synchronously.

      Parameters

      • relativeOrAbsolutePath: string

        Directory path as an absolute or relative path.

      • Optionaloptions: DirectoryMoveOptions

        Options for moving the directory.

      Returns this

    • Moves the directory to a subdirectory of the specified directory.

      Parameters

      • dirPathOrDirectory: string | Directory

        Directory path or directory object to move the directory to.

      • Optionaloptions: DirectoryMoveOptions

        Options for moving.

      Returns this

    • Asynchronously saves the directory and all the unsaved source files to the disk.

      Returns Promise<void>

    • Synchronously saves the directory and all the unsaved source files to the disk.

      Returns void

    • Gets if the directory was forgotten.

      Returns boolean