var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
import { defineTapPropertyExtension, Tap } from '@iotize/tap';
import { DEFAULT_KEEP_ALIVE_PERIOD_MS, KeepAliveEngine, } from '@iotize/tap/keep-alive';
const ɵ0 = (context) => {
    return new KeepAliveEngine(context.tap, {
        period: DEFAULT_KEEP_ALIVE_PERIOD_MS,
    });
};
export const _TAP_EXTENSION_KEEP_ALIVE_ = defineTapPropertyExtension('keepAlive', ɵ0);
/**
 * @deprecated use keepAlive property instead
 * @param this
 */
export function getKeepAliveEngine() {
    return this.keepAlive;
}
Tap.prototype.getKeepAliveEngine = getKeepAliveEngine;
export function setupKeepAliveFromConfig() {
    return __awaiter(this, void 0, void 0, function* () {
        const periodInSeconds = (yield this.service.interface.getHostInactivityPeriod()).body();
        this.keepAlive.period = periodInSeconds * 1000;
        this.keepAlive.start();
    });
}
Tap.prototype.setupKeepAliveFromConfig = setupKeepAliveFromConfig;
export { ɵ0 };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia2VlcC1hbGl2ZS1leHQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9leHQva2VlcC1hbGl2ZS9zcmMvbGliL2tlZXAtYWxpdmUtZXh0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQUFBLE9BQU8sRUFBRSwwQkFBMEIsRUFBRSxHQUFHLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDOUQsT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