Skip to main content

Interface: ImportingPlugin

Defined in: src/types/interfaces/plugin.interface.ts:1426

Plugin that supports bulk import from external sources.

Remarks​

For sources without search APIs (LingBuzz, Semantics Archive), plugins must implement bulk fetching. The ImportScheduler periodically triggers imports for these plugins.

Since​

0.1.0

Extends​

Properties​

id​

readonly id: string

Defined in: src/types/interfaces/plugin.interface.ts:392

Unique plugin identifier.

Remarks​

Must match manifest.id.

Inherited from​

IChivePlugin.id


manifest​

readonly manifest: IPluginManifest

Defined in: src/types/interfaces/plugin.interface.ts:397

Plugin manifest.

Inherited from​

IChivePlugin.manifest


source​

readonly source: string

Defined in: src/types/interfaces/plugin.interface.ts:1435

Source identifier for this plugin.


supportsSearch​

readonly supportsSearch: false

Defined in: src/types/interfaces/plugin.interface.ts:1430

Discriminator to identify importing plugins.

Methods​

fetchEprints()​

fetchEprints(options?): AsyncIterable<ExternalEprint>

Defined in: src/types/interfaces/plugin.interface.ts:1447

Fetches eprints from the external source.

Parameters​

options?​

FetchOptions

Fetch options (pagination, filters)

Returns​

AsyncIterable<ExternalEprint>

Yields​

External eprints from the source

Remarks​

Use async generator for memory-efficient bulk fetching. Implementations must respect rate limits.


getState()​

getState(): PluginState

Defined in: src/types/interfaces/plugin.interface.ts:467

Gets current plugin state.

Returns​

PluginState

Current lifecycle state

Example​

getState(): PluginState {
return this.state;
}

Inherited from​

IChivePlugin.getState


initialize()​

initialize(context): Promise<void>

Defined in: src/types/interfaces/plugin.interface.ts:427

Initializes the plugin.

Parameters​

context​

IPluginContext

Plugin context with injected dependencies

Returns​

Promise<void>

Promise resolving when initialization complete

Remarks​

Called once when plugin is loaded. Use this to:

  • Subscribe to event hooks
  • Initialize plugin state
  • Validate configuration

If initialization fails, throw an error to prevent plugin from loading.

Example​

async initialize(context: IPluginContext): Promise<void> {
this.logger = context.logger;
this.cache = context.cache;

context.eventBus.on('eprint.indexed', this.handleIndexed.bind(this));

this.logger.info('Plugin initialized');
}

Inherited from​

IChivePlugin.initialize


shutdown()​

shutdown(): Promise<void>

Defined in: src/types/interfaces/plugin.interface.ts:451

Shuts down the plugin.

Returns​

Promise<void>

Promise resolving when shutdown complete

Remarks​

Called when Chive is shutting down or plugin is being unloaded. Use this to:

  • Unsubscribe from event hooks
  • Close connections
  • Save state

Example​

async shutdown(): Promise<void> {
this.logger.info('Plugin shutting down');
await this.saveState();
}

Inherited from​

IChivePlugin.shutdown