Adds an explicit topic for operators (and the dashboardAPI v2 manual escape hatch from PRD F-12). On `regenerate-dashboard`, dashboardAPI iterates every child source cached by prior `child.register` messages and re-emits Grafana upsert messages — bypassing the diff-skip predicate from #36. - src/specificClass.js: light state cache (recordChild / cachedChildSources). - src/commands/handlers.js: refactor shared emit path; emitDashboardsFor() used by both child.register and regenerateDashboard; meta.trigger distinguishes the two for downstream filtering. - src/commands/index.js: register 'regenerate-dashboard' (alias 'regen'). - CONTRACT.md: document the new topic. - test/basic/slice41-manual-regen.basic.test.js: 5 cases covering cache semantics, no-op for empty cache, bypass-predicate, trigger stamp on both paths, registry exposure. Closes #41
23 lines
597 B
JavaScript
23 lines
597 B
JavaScript
'use strict';
|
|
|
|
// dashboardAPI command registry. Canonical names follow CONTRACTS.md §1.
|
|
// The legacy `registerChild` topic is kept as an alias of `child.register`
|
|
// (Phase 1 canonical) and logs a one-time deprecation warning on first use.
|
|
|
|
const handlers = require('./handlers');
|
|
|
|
module.exports = [
|
|
{
|
|
topic: 'child.register',
|
|
aliases: ['registerChild'],
|
|
payloadSchema: { type: 'any' },
|
|
handler: handlers.registerChild,
|
|
},
|
|
{
|
|
topic: 'regenerate-dashboard',
|
|
aliases: ['regen'],
|
|
payloadSchema: { type: 'any' },
|
|
handler: handlers.regenerateDashboard,
|
|
},
|
|
];
|