"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.r = void 0;
exports.resolve = resolve;
exports.registerAppCleanup = registerAppCleanup;
exports.getAppConfig = getAppConfig;
const config_1 = require("./config");
const base_1 = require("./base");
function resolve(token) {
    return (0, base_1.getCurrentApp)().get(token);
}
exports.r = resolve;
/**
 * Registers cleanup for a resource owned by the current application instance.
 *
 * Registered callbacks run exactly once during `App.stop()`, in reverse registration order, after the normal
 * server shutdown lifecycle has completed. They also run when `stop()` follows a partial or failed startup,
 * allowing resources acquired before the app became fully started to be released safely. Shutdown attempts
 * every registered cleanup and reports any failures after all callbacks have been given a chance to run.
 *
 * The returned function unregisters the callback when the resource is released earlier. Callers should use
 * that function to prevent the app from retaining the callback and to avoid repeating an already-completed
 * cleanup during shutdown.
 */
function registerAppCleanup(cleanup) {
    return (0, base_1.getCurrentApp)().registerCleanup(cleanup);
}
function getAppConfig(token = config_1.BaseAppConfig) {
    return resolve(token);
}
//# sourceMappingURL=resolver.js.map