Skip to content

Plugin contract

A plugin is the object definePlugin from @manablox/core returns. Its type, ManabloxPlugin<S>, is exported by @manablox/core; S is what its services build. A few fields and the types they take come from other packages, which add them to the core interfaces when they are imported (declare module '@manablox/core'). A plugin depending on those packages sees the fields; the core alone does not know them.

Identity and the plugin graph

FieldMeaningPackage
nameUnique; its id (lowercased, @ dropped, / as .) names the flag plugins.<id>, keys, procedures and routescore
version, descriptionListed in instance.plugins; description also explains the permission groupcore
requires, enhancesPlugins it cannot run without, and plugins it adds to when they are there. See Dependenciescore
extensionPoints, contributionsPoints others fill, and entries for others’ points. See Extension pointscore; each point’s entry type by its plugin (PluginContributions)

Model

FieldMeaningPackage
fieldTypesField types to register. See Custom field typescore
contentTypesContent types, the same inputs as the config’s; a name the config declares too is refusedcore
extendFields for content types declared in the config or by another plugin; a field that exists is merged. See Adding fields to other content typescore
blocks, contentTypeDataThe plugin’s data on block instances (ext.<id>) and on code content types. See Block extensionscore; the GraphQL type of block data by @manablox/api-graphql
db{ migrations, tables }: migration folders per dialect (pluginPackage(import.meta.url).migrations) and table definitions. See Tables and migrationscore (migrations), @manablox/db (tables)

Declarations

FieldMeaningPackage
permissions<id>:<action> keys. See Plugin permissionscore
controlsFlags, limits, usage, rate rules, retention and settings under the plugin’s namespace. See Plugin controlscore
ceilings(plugin)Read-only feature values above every scope, never stored, and admin banners; called once per process after the services are built. See Feature ceilingscore; wired by @manablox/server
audit, errorsActivity log kinds <id>.<entity> and error keys plugins.<id>.*. See Plugin servicescore
credentials, templatesCode resources for the targeted spaces. See Resources in codecore
resourceKinds, resourcesCode resource kinds the plugin owns, and entries of any plugin’s kinds. See Plugin resource kindscore; load, plan, reconcile, prune and configExport of a kind by @manablox/services

Runtime

FieldMeaningPackage
servicesBuilds the plugin’s services once per process. See Plugin servicescore; repos, db, cache and the core services on its context by @manablox/server
hooks(plugin)Returns the hook handlers, each made with onHook, once at boot with the plugin’s context; gated by the plugin’s flag in each space. See Pluginscore
jobs, maintenanceQueued jobs by name and scheduled payload-less jobs. See Plugin jobscore
start, stopLong-running work on management instances. See Lifecycle and channelscore; repos, db, cache, jobs and channel on the context by @manablox/server
spaceCreateThe plugin’s part of a new space. See New spacescore; the transaction’s repos by @manablox/services

Surfaces

FieldMeaningPackage
rpcProcedures of the management API under plugins.<id>. See Plugin procedures@manablox/api-rpc
serverHTTP routes under /plugins/<id>/ and middleware per scope. See Server routescore (the field), @manablox/server (routes, middleware)
modesServer modes. See Server modescore (name, scopes), @manablox/server (surface)
admin{ dir?, frameOrigins? }: the prebuilt admin bundle (pluginPackage(import.meta.url).adminDir). See Admin pluginscore
llmsMarkdown for the management API’s /llms.txt, with the plugin’s contextcore
cliThe CLI module of a plugin without a package of its own; wins over the package’s declaration when the config is loaded. See CLI contributionscore (the field), @manablox/cli (reads it)

Data

FieldMeaningPackage
dataData providers: environments, transfers, snapshots, retention, counters, hosts, cache tags. See Data providerscore (the list), @manablox/services (every part of a provider)

Outside the object

  • The CLI part of a packaged plugin: "manablox": { "plugin", "cli" } in its package.json, read without the config (the help, plugin install). See CLI contributions.
  • Other plugins’ services: PluginServicesMap, augmented by each plugin package, gives plugins.get(id) and plugins.require(id) their types. See Dependencies.
  • Hooks a plugin adds: ManabloxHooks, augmented by the plugin package. See Hooks.
  • The admin bundle: defineAdminPlugin of @manablox/admin-plugin, its own contract. See Admin plugins.