Lifecycle Hooks

Overview

Lifecycle hooks provide extension points for custom logic at critical stages of the export process. All hooks are optional and are invoked in a defined sequence during export operations.

Available Hooks

canExport(item)

Determines whether an item should be included in the export operation.

Function Signature:

canExport: (item: NormalizedItem) => boolean

Parameters:

  • item - Normalized item object

Returns:

  • boolean - true to include item, false to exclude

Example:

hooks: {
  canExport: (item) => {
    // Export only items with magic power attribute
    return (item.modules?.expansion_magic_power || 0) > 0;
  }
}

beforeExport(item, transformed)

Modifies or augments transformed data immediately before file write operations.

Function Signature:

Parameters:

  • item - Original normalized item object

  • transformed - Output from transform function

Returns:

  • object - Modified transformed data

Example:

afterExport(item, transformed, filePath)

Executes custom logic after successful item export.

Function Signature:

Parameters:

  • item - Original normalized item object

  • transformed - Final exported data

  • filePath - Absolute path to exported file

Returns:

  • void

Example:

Last updated