Plugin
Plugin protocol schemas
Upgrade Context Schema
Provides version migration context to the onUpgrade lifecycle hook.
Enables developers to write conditional migration logic based on
the previous and new versions.
Source: packages/spec/src/kernel/plugin.zod.ts
TypeScript Usage
import { ActivationEvent, UpgradeContext } from '@objectstack/spec/kernel';
import type { ActivationEvent, UpgradeContext } from '@objectstack/spec/kernel';
// Validate data
const result = ActivationEvent.parse(data);ActivationEvent
Lazy activation trigger for a dynamic plugin
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| type | Enum<'onCommand' | 'onRoute' | 'onObject' | 'onEvent' | 'onService' | 'onSchedule' | 'onStartup'> | ✅ | Trigger type for lazy activation |
| pattern | string | ✅ | Match pattern for the activation trigger |
UpgradeContext
Version migration context for onUpgrade hook
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| previousVersion | string | ✅ | Version before upgrade |
| newVersion | string | ✅ | Version after upgrade |
| isMajorUpgrade | boolean | ✅ | Whether this is a major version bump |
| previousMetadata | Record<string, any> | optional | Metadata snapshot before upgrade |