"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Config = void 0;
const grpc_web_1 = require("@improbable-eng/grpc-web");
/**
 * Config controls the remote API settings.
 */
class Config {
    /**
     * Create a new Config object.
     * @param host The local/remote host url. Defaults to 'https:127.0.0.1:6007'.
     * @param transport The default transport to use when making web-gRPC calls. Defaults to WebSockets.
     */
    constructor(host, transport) {
        this.host = host || 'http://127.0.0.1:6007';
        this.transport = transport || grpc_web_1.grpc.WebsocketTransport();
    }
    _wrapMetadata(values) {
        if (!this.session) {
            return values;
        }
        const response = values !== null && values !== void 0 ? values : {};
        if ('Authorization' in response || 'authorization' in response) {
            return response;
        }
        response['Authorization'] = `Bearer ${this.session}`;
        return response;
    }
    _wrapBrowserHeaders(values) {
        if (!this.session) {
            return values;
        }
        values.set('Authorization', `Bearer ${this.session}`);
        return values;
    }
}
exports.Config = Config;
//# sourceMappingURL=config.js.map