Skip to content

PluginApiUnavailabilityReason

The reason a plugin API could not be handed over.

The whole point of the enum is that these are told apart. @vanakat/plugin-api cannot tell any of them apart, and not uniformly: NotInstalled / NotEnabled / NotPublished all reduce to one Notice plus undefined, while VersionMismatch / ShapeMismatch produce NO signal at all — it never examines what it found, so it hands the object over and the mismatch surfaces later, somewhere else, as somebody else’s TypeError.

PluginApiRef.whenAvailable can report the first five; PluginApiUnavailabilityReason.Revoked is not one of them, because it describes a handle that WAS valid and is carried by PluginApiRevokedError instead.

Import:

import type { PluginApiUnavailabilityReason } from 'obsidian-dev-utils/obsidian/plugin/plugin-api';

Signature:

export enum PluginApiUnavailabilityReason

Members:

MemberValueDescription
NotEnabled'notEnabled'The plugin is installed but not enabled.
NotInstalled'notInstalled'The plugin is not installed in this vault.
NotPublished'notPublished'The plugin is installed and enabled but has not published any API.
Revoked'revoked'The handle was valid but the provider has since unloaded, so it has been revoked.
ShapeMismatch'shapeMismatch'A record satisfies the requested version range, but the API object is missing a method the contract declares — the provider’s shipped shape and its declared shape disagree.
VersionMismatch'versionMismatch'The plugin published an API, but no published contract version satisfies the requested range.

Links to this page: