"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../../Class/Holder");
const method_1 = require("../../../../../client/method");
const Async_1 = require("../../../../../types/interface/async/Async");
const _ids_1 = require("../../../../_ids");
class Get1 extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['obj', 'name'],
            fo: ['value'],
            i: [],
            o: ['done'],
        }, {
            input: {
                obj: {
                    ref: true,
                },
            },
            output: {
                value: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_GET_1, 'done');
    }
    async f({ obj, name }, done, fail) {
        obj = (0, Async_1.Async)(obj, obj.__, this.__system.async);
        try {
            const value = await obj.$ref({ name, __: method_1.ALL_INTERFACES });
            if (value === null) {
                fail('key not found');
                return;
            }
            done({ value });
        }
        catch (err) {
            fail(err.message);
            return;
        }
    }
    b() {
        this._output.done.push(true);
    }
}
exports.default = Get1;
//# sourceMappingURL=index.js.map