feat(api): absorb the Hub control plane into the local instance model
Add central notification channels, rules, queue and delivery logs, fleet organization groups and tags, device discovery, the device action catalog, instance module reads, the log centre, connection settings and system maintenance as native /api/v1 routes backed by the existing secret store, audit trail and pinned upstream transport.
This commit is contained in:
@@ -64,6 +64,46 @@ describe('resolveTargets', () => {
|
||||
db.close();
|
||||
});
|
||||
|
||||
it('resolves the Hub all-devices and single-group selectors', () => {
|
||||
const db = fixture();
|
||||
const now = '2026-07-30T00:00:00.000Z';
|
||||
db.prepare(
|
||||
'INSERT INTO device_groups (id,name,description,created_at,updated_at) VALUES (?,?,?,?,?)',
|
||||
).run('g-lab', '实验室', '', now, now);
|
||||
db.prepare('UPDATE instances SET group_id = ? WHERE id IN (?,?)').run('g-lab', 'a', 'c');
|
||||
expect(resolveTargets(db, { mode: 'all' })).toEqual([
|
||||
{ id: 'a', revision: 3 },
|
||||
{ id: 'b', revision: 2 },
|
||||
]);
|
||||
expect(resolveTargets(db, { mode: 'group', groupId: 'g-lab' })).toEqual([
|
||||
{ id: 'a', revision: 3 },
|
||||
]);
|
||||
db.close();
|
||||
});
|
||||
|
||||
it('dispatches control-plane backups without resolving device targets', () => {
|
||||
const db = fixture();
|
||||
expect(resolveOperationTargets(db, { mode: 'all' }, 'backup-data')).toEqual({
|
||||
targets: [{ id: 'control-plane', revision: 1 }],
|
||||
targetSnapshot: [],
|
||||
unavailableInstanceIds: [],
|
||||
});
|
||||
db.close();
|
||||
});
|
||||
|
||||
it('dispatches devices whose capability was never probed', () => {
|
||||
const db = fixture();
|
||||
expect(resolveOperationTargets(db, { mode: 'all' }, 'restart-baseband')).toEqual({
|
||||
targets: [
|
||||
{ id: 'a', revision: 3 },
|
||||
{ id: 'b', revision: 2 },
|
||||
],
|
||||
targetSnapshot: ['a', 'b'],
|
||||
unavailableInstanceIds: [],
|
||||
});
|
||||
db.close();
|
||||
});
|
||||
|
||||
it('separates targets whose required operation capability is unavailable', () => {
|
||||
const db = fixture();
|
||||
const now = '2026-07-30T00:00:00.000Z';
|
||||
|
||||
Reference in New Issue
Block a user