mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-18 10:46:22 +00:00
Refactor api-binder as a directory
The role of the api-binder module is to be the intermediary between the cloud API and the device-state. For this reason it makes sense to isolate target state retrieval and current state reporting into this module. This change just moves current state reporting to the directory.
This commit is contained in:
parent
97f3b2a51e
commit
25e9ab4786
@ -6,34 +6,31 @@ import * as t from 'io-ts';
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { PinejsClientRequest } from 'pinejs-client-request';
|
import { PinejsClientRequest } from 'pinejs-client-request';
|
||||||
import * as url from 'url';
|
import * as url from 'url';
|
||||||
import * as deviceRegister from './lib/register-device';
|
import * as deviceRegister from '../lib/register-device';
|
||||||
|
|
||||||
import * as config from './config';
|
import * as config from '../config';
|
||||||
import * as deviceConfig from './device-config';
|
import * as deviceConfig from '../device-config';
|
||||||
import * as eventTracker from './event-tracker';
|
import * as eventTracker from '../event-tracker';
|
||||||
import { loadBackupFromMigration } from './lib/migration';
|
import { loadBackupFromMigration } from '../lib/migration';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ContractValidationError,
|
ContractValidationError,
|
||||||
ContractViolationError,
|
ContractViolationError,
|
||||||
InternalInconsistencyError,
|
InternalInconsistencyError,
|
||||||
TargetStateError,
|
TargetStateError,
|
||||||
} from './lib/errors';
|
} from '../lib/errors';
|
||||||
import * as request from './lib/request';
|
import * as request from '../lib/request';
|
||||||
|
|
||||||
import log from './lib/supervisor-console';
|
import log from '../lib/supervisor-console';
|
||||||
|
|
||||||
import * as deviceState from './device-state';
|
import * as deviceState from '../device-state';
|
||||||
import * as globalEventBus from './event-bus';
|
import * as globalEventBus from '../event-bus';
|
||||||
import * as TargetState from './device-state/target-state';
|
import * as TargetState from '../device-state/target-state';
|
||||||
import * as logger from './logger';
|
import * as logger from '../logger';
|
||||||
|
|
||||||
import * as apiHelper from './lib/api-helper';
|
import * as apiHelper from '../lib/api-helper';
|
||||||
import { Device } from './lib/api-helper';
|
import { Device } from '../lib/api-helper';
|
||||||
import {
|
import { startReporting, stateReportErrors } from './report';
|
||||||
startReporting,
|
|
||||||
stateReportErrors,
|
|
||||||
} from './device-state/current-state';
|
|
||||||
|
|
||||||
interface DevicePinInfo {
|
interface DevicePinInfo {
|
||||||
app: number;
|
app: number;
|
@ -405,7 +405,7 @@ describe('ApiBinder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('fails when stateReportHealthy is false', async () => {
|
it('fails when stateReportHealthy is false', async () => {
|
||||||
const currentState = await import('../src/device-state/current-state');
|
const currentState = await import('../src/api-binder/report');
|
||||||
|
|
||||||
configStub.resolves({
|
configStub.resolves({
|
||||||
unmanaged: false,
|
unmanaged: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user