Skip to main content

Overview

The PluginDefinition type defines the core configuration for an Atomemo plugin. It contains metadata, localization settings, and optional transporter configuration.

Importing Types

Types are re-exported from the SDK and can be imported from the types entry point:
import type { PluginDefinition } from "@choiceopen/atomemo-plugin-sdk-js/types"

Type Definition

type PluginDefinition<Locales extends string[], Options = TransporterOptions> = {
  name: string
  display_name: Record<Locales[number], string>
  description: Record<Locales[number], string>
  icon: string
  author?: string
  email?: string
  version?: string
  locales: Locales
  transporterOptions?: Options
}

Properties

name
string
required
The unique identifier for the plugin. Must be a valid plugin name.Example: "my-plugin"
display_name
Record<Locale, string>
required
Localized display names for the plugin. Keys should match the locales defined in the locales property.Example:
{
  en_US: "My Plugin",
  es_ES: "Mi Plugin"
}
description
Record<Locale, string>
required
Localized descriptions of what the plugin does. Keys should match the locales defined in the locales property.Example:
{
  en_US: "A plugin for managing tasks",
  es_ES: "Un plugin para gestionar tareas"
}
icon
string
required
An emoji or icon representation of the plugin.Example: "πŸ”Œ" or "⚑"
author
string
The name of the plugin author. This is automatically populated from the user session in debug mode or from definition.json in release mode.Note: You typically don’t need to provide this manually.
email
string
The email address of the plugin author. This is automatically populated from the user session in debug mode or from definition.json in release mode.Note: You typically don’t need to provide this manually.
version
string
The semantic version of the plugin. Defaults to process.env.npm_package_version if not provided.Example: "1.0.0"
locales
string[]
required
An array of supported locale codes. These locales determine which keys are valid in display_name and description.Example: ["en_US", "es_ES", "fr_FR"]
transporterOptions
TransporterOptions
Optional configuration for the network transporter that connects to the Hub Server. See TransporterOptions for details.

Example

import { createPlugin } from "@choiceopen/atomemo-plugin-sdk-js"

const plugin = await createPlugin({
  name: "task-manager",
  display_name: {
    en_US: "Task Manager",
    es_ES: "Gestor de Tareas"
  },
  description: {
    en_US: "Manage and organize your tasks efficiently",
    es_ES: "Gestiona y organiza tus tareas eficientemente"
  },
  icon: "πŸ“‹",
  locales: ["en_US", "es_ES"],
  version: "1.0.0",
  transporterOptions: {
    heartbeatIntervalMs: 30000,
    onOpen: () => console.log("Connected to Hub"),
  }
})

See Also

Build docs developers (and LLMs) love