Skip to content

Commit

Permalink
refactor(spaces): no more spaces (#9961)
Browse files Browse the repository at this point in the history
### Description

Deletes spaces code

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
  • Loading branch information
NicholasLYang authored Feb 24, 2025
1 parent 7c991a0 commit 67cf6ad
Show file tree
Hide file tree
Showing 30 changed files with 211 additions and 1,549 deletions.
32 changes: 1 addition & 31 deletions crates/turborepo-api-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use serde::Deserialize;
use turborepo_ci::{is_ci, Vendor};
use turborepo_vercel_api::{
token::ResponseTokenMetadata, APIError, CachingStatus, CachingStatusResponse,
PreflightResponse, SpacesResponse, Team, TeamsResponse, UserResponse, VerificationResponse,
VerifiedSsoUser,
PreflightResponse, Team, TeamsResponse, UserResponse, VerificationResponse, VerifiedSsoUser,
};
use url::Url;

Expand All @@ -23,7 +22,6 @@ pub use crate::error::{Error, Result};
pub mod analytics;
mod error;
mod retry;
pub mod spaces;
pub mod telemetry;

pub use bytes::Bytes;
Expand All @@ -43,11 +41,6 @@ pub trait Client {
team_id: &str,
) -> impl Future<Output = Result<Option<Team>>> + Send;
fn add_ci_header(request_builder: RequestBuilder) -> RequestBuilder;
fn get_spaces(
&self,
token: &str,
team_id: Option<&str>,
) -> impl Future<Output = Result<SpacesResponse>> + Send;
fn verify_sso_token(
&self,
token: &str,
Expand Down Expand Up @@ -199,29 +192,6 @@ impl Client for APIClient {
request_builder
}

async fn get_spaces(&self, token: &str, team_id: Option<&str>) -> Result<SpacesResponse> {
// create url with teamId if provided
let endpoint = match team_id {
Some(team_id) => format!("/v0/spaces?limit=100&teamId={}", team_id),
None => "/v0/spaces?limit=100".to_string(),
};

let request_builder = self
.client
.get(self.make_url(endpoint.as_str())?)
.header("User-Agent", self.user_agent.clone())
.header("Content-Type", "application/json")
.header("Authorization", format!("Bearer {}", token));

let response =
retry::make_retryable_request(request_builder, retry::RetryStrategy::Timeout)
.await?
.into_response()
.error_for_status()?;

Ok(response.json().await?)
}

async fn verify_sso_token(&self, token: &str, token_name: &str) -> Result<VerifiedSsoUser> {
let request_builder = self
.client
Expand Down
264 changes: 0 additions & 264 deletions crates/turborepo-api-client/src/spaces.rs

This file was deleted.

11 changes: 2 additions & 9 deletions crates/turborepo-auth/src/auth/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ mod tests {
use async_trait::async_trait;
use reqwest::{Method, RequestBuilder, Response};
use turborepo_vercel_api::{
CachingStatus, CachingStatusResponse, Membership, Role, SpacesResponse, Team,
TeamsResponse, User, UserResponse, VerifiedSsoUser,
CachingStatus, CachingStatusResponse, Membership, Role, Team, TeamsResponse, User,
UserResponse, VerifiedSsoUser,
};
use turborepo_vercel_api_mock::start_test_server;

Expand Down Expand Up @@ -247,13 +247,6 @@ mod tests {
fn add_ci_header(_request_builder: RequestBuilder) -> RequestBuilder {
unimplemented!("add_ci_header")
}
async fn get_spaces(
&self,
_token: &str,
_team_id: Option<&str>,
) -> turborepo_api_client::Result<SpacesResponse> {
unimplemented!("get_spaces")
}
async fn verify_sso_token(
&self,
token: &str,
Expand Down
10 changes: 1 addition & 9 deletions crates/turborepo-auth/src/auth/logout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ mod tests {
use turborepo_api_client::Client;
use turborepo_ui::ColorConfig;
use turborepo_vercel_api::{
token::ResponseTokenMetadata, SpacesResponse, Team, TeamsResponse, UserResponse,
VerifiedSsoUser,
token::ResponseTokenMetadata, Team, TeamsResponse, UserResponse, VerifiedSsoUser,
};
use url::Url;

Expand All @@ -116,13 +115,6 @@ mod tests {
fn add_ci_header(_request_builder: RequestBuilder) -> RequestBuilder {
unimplemented!("add_ci_header")
}
async fn get_spaces(
&self,
_token: &str,
_team_id: Option<&str>,
) -> turborepo_api_client::Result<SpacesResponse> {
unimplemented!("get_spaces")
}
async fn verify_sso_token(
&self,
token: &str,
Expand Down
11 changes: 2 additions & 9 deletions crates/turborepo-auth/src/auth/sso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ mod tests {
use reqwest::{Method, RequestBuilder, Response};
use turborepo_vercel_api::{
token::{ResponseTokenMetadata, Scope},
CachingStatus, CachingStatusResponse, Membership, Role, SpacesResponse, Team,
TeamsResponse, User, UserResponse, VerifiedSsoUser,
CachingStatus, CachingStatusResponse, Membership, Role, Team, TeamsResponse, User,
UserResponse, VerifiedSsoUser,
};
use turborepo_vercel_api_mock::start_test_server;

Expand Down Expand Up @@ -244,13 +244,6 @@ mod tests {
fn add_ci_header(_request_builder: RequestBuilder) -> RequestBuilder {
unimplemented!("add_ci_header")
}
async fn get_spaces(
&self,
_token: &str,
_team_id: Option<&str>,
) -> turborepo_api_client::Result<SpacesResponse> {
unimplemented!("get_spaces")
}
async fn verify_sso_token(
&self,
token: &str,
Expand Down
Loading

0 comments on commit 67cf6ad

Please sign in to comment.