Options
All
  • Public
  • Public/Protected
  • All
Menu

Module migrations

A simple wrapper over the Vortex migration API to make writing migrations a little easier.

Import types from this module using

import {} from 'vortex-ext-common/migrations'

Index

Type aliases

ExtensionUpdateInfo

ExtensionUpdateInfo: { name: string; newVersion: string; oldVersion?: string; releaseNotes?: string; requiredVortexVersion?: string }

A simple data type to encapsulate information about an extension update.

Type declaration

  • name: string

    The extension name.

  • newVersion: string

    The new version of the extension (i.e. what we're upgrading to)

  • Optional oldVersion?: string

    The previous extension version that the migration is upgrading from.

    remarks

    Do not set this! The migrationHandler will set this for you.

  • Optional releaseNotes?: string

    Optional link to release notes for this update, shown in dialog.

  • Optional requiredVortexVersion?: string

    Optional minimum required/recommended Vortex version for this version.

Functions

migrationHandler

  • migrationHandler(api: IExtensionApi, gameId: string | undefined, extInfo: ExtensionUpdateInfo, callback?: (api: IExtensionApi, extInfo: ExtensionUpdateInfo) => Promise<any>): (oldVersion: string) => Promise<any>
  • A simple wrapper function to use when registering migrations that simplifies the basic version checking and only runs when the current game is available with mods installed.

    Parameters

    • api: IExtensionApi

      The extension API.

    • gameId: string | undefined

      The game ID for this migration.

    • extInfo: ExtensionUpdateInfo

      The extension update this migration is for.

    • Optional callback: (api: IExtensionApi, extInfo: ExtensionUpdateInfo) => Promise<any>

      The callback you want to run when this migration is required and run.

    Returns (oldVersion: string) => Promise<any>

      • (oldVersion: string): Promise<any>
      • Parameters

        • oldVersion: string

        Returns Promise<any>

requireVortexVersionNotification

  • requireVortexVersionNotification(api: IExtensionApi, extInfo: ExtensionUpdateInfo, message: string, callback?: () => void): string
  • Shows a notification warning users that an updated extension version requires a specific version of Vortex.

    Parameters

    • api: IExtensionApi

      The extension API.

    • extInfo: ExtensionUpdateInfo

      The extension update this notification is referencing.

    • message: string

      The message to show to users in the details dialog.

    • Optional callback: () => void

      A callback to run after the dialog is closed.

        • (): void
        • Returns void

    Returns string

    The notification ID.

showUpgradeDialog

  • showUpgradeDialog(api: IExtensionApi, extInfo: ExtensionUpdateInfo, message: string | IDialogContent, callback?: () => void): Promise<IDialogResult>
  • Shows a dialog informing a user that an extension has been updated and optionally providing a link to release notes.

    Parameters

    • api: IExtensionApi

      The extension API.

    • extInfo: ExtensionUpdateInfo

      The extension update this dialog is referencing.

    • message: string | IDialogContent

      A simple message (or dialog contents) to show to users.

    • Optional callback: () => void

      A callback to run after the dialog is closed.

        • (): void
        • Returns void

    Returns Promise<IDialogResult>

showUpgradeNotification

  • showUpgradeNotification(api: IExtensionApi, extInfo: ExtensionUpdateInfo, message: string | IDialogContent, callback?: () => void, notificationMsg?: string): Promise<void>
  • Shows a simple upgrade notification to users when the migration runs, with an optional (to the user) dialog to provide more details on the update.

    Parameters

    • api: IExtensionApi

      The extension API.

    • extInfo: ExtensionUpdateInfo

      The extension update this notification is referencing.

    • message: string | IDialogContent

      A simple message (or dialog contents) to show to users in the details dialog.

    • Optional callback: () => void

      A callback to run after the dialog is closed (will not run if notification is dismissed).

        • (): void
        • Returns void

    • Optional notificationMsg: string

    Returns Promise<void>

    A Promise that resolves when the notification or dialog is dismissed.

Generated using TypeDoc