docs: function logout(logoutOptions) {
      if (logoutOptions === void 0) { logoutOptions = {}; }
      var serverUrl = urls.resolveServer('/', logoutOptions);
      var serverObj = server.Server.getInstance(serverUrl);
      // process options
      var currentOptions = serverObj.applyOptions({
          serverUrl: serverUrl,
          agentOptions: logoutOptions.agentOptions || init.initOptions.agentOptions,
          agentClass: logoutOptions.agentClass || init.initOptions.agentClass,
      });
      return ajax(_.defaults({
          serverUrl: serverUrl,
          method: 'POST',
          url: '/gofer/security/rest/auth/logout',
          body: {}
      }, currentOptions)).catch(function (error) {
          if (error.statusCode === 422) {
              // REST-based logout URL currently is broken reporting a 422 in all cases
              return ajax(_.defaults({
                  serverUrl: serverUrl,
                  method: 'GET',
                  url: '/gofer/security-logout'
              }, currentOptions)).then(function (result) {
                  diag.debug.warn('BUG: resorted to classic PATH-based logout as REST-based logout failed:', error);
                  return result;
              }, function (error2) {
                  return Q.reject(error2.statusCode === 422 ? error : error2);
              });
          }
          return Q.reject(error);
      }).catch(function (error) {
          // ignore network failures on timeout, server forgets on session timeout anyways
          if (!error.statusCode) {
              return Q.resolve(undefined);
          }
          return Q.reject(error);
      }).finally(function () {
          // eventually erase offline login data
          if (logoutOptions.offlineCapable) {
              // requested to erase login data
              return offline.clearOfflineLogin(serverObj.credentials, currentOptions).catch(function (offlineError) {
                  diag.debug.warn('failed erasing offline login data', offlineError);
                  return Q.resolve(undefined);
              });
          }
      }).finally(function () {
          // forget everything about it
          serverObj.credentials = null;
          serverObj.authorization = auth.ANONYMOUS_AUTHORIZATION;
          serverObj.organization = null;
          serverObj.user = null;
          serverObj.sessionUserUuid = null;
      });
  }