Skip to main content

First-party features and command guards

Install first-party packages and block commands with command guards.

First-party features are package infrastructure for this workspace. They are how @lupinum/board-history and @lupinum/board-connections attach state, events, and persistence to the core engine.

ts
import { createBoardEngine } from '@lupinum/board-core'
import { connectionsPlugin } from '@lupinum/board-connections'
import { historyPlugin } from '@lupinum/board-history'

const engine = createBoardEngine({
  plugins: [historyPlugin(), connectionsPlugin({ routing: 'step' })],
})

This is not a third-party plugin surface. The supported consumer API is the package API exposed by each first-party package, such as engine.plugins.history and engine.plugins.connections.

Mutations blocked — try dragging or deleting.
Read-only

Blocked attempts

0

Command guards

addCommandGuard registers a command guard. Use it when an app needs read-only mode, audit logging, or one concrete product policy.

ts
engine.addCommandGuard(({ name }) =>
  name === 'deleteSelected' ? 'Deleting nodes is disabled.' : true,
)
If a guard returns a reason, the board state does not change and the command throws CommandBlockedError with that reason. Listen to command:blocked when the UI also needs a general blocked-command signal.