"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const integration_base_1 = require("@things-factory/integration-base");
const get_tracking_workspace_1 = require("./get-tracking-workspace");
async function TrackableObjectGetState(step, { logger, domain }) {
    var { connection } = step;
    var object = integration_base_1.ConnectionManager.getConnectionInstanceByName(domain, connection) || {};
    if (!object) {
        throw new Error(`no connection : ${connection}`);
    }
    var { name, endpoint } = object;
    var workspace = (0, get_tracking_workspace_1.getTrackingWorkspace)(domain);
    var { engine } = workspace;
    var { trackingStorage } = engine;
    return {
        data: trackingStorage.getObjectState(endpoint)
    };
}
TrackableObjectGetState.parameterSpec = [];
TrackableObjectGetState.help = 'robotics/task/trackable-object-get-state';
integration_base_1.TaskRegistry.registerTaskHandler('trackable-object-get-state', TrackableObjectGetState);
//# sourceMappingURL=trackable-object-get-state.js.map