Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
khulnasoft-bot committed Feb 4, 2025
1 parent 178dc5f commit dc75042
Show file tree
Hide file tree
Showing 142 changed files with 388 additions and 481 deletions.
2 changes: 1 addition & 1 deletion crates/nrz-trace/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ mod tracer;
use camino::Utf8PathBuf;
use clap::Parser;
use miette::Report;
use tracer::Tracer;
use nrzpath::{AbsoluteSystemPathBuf, PathError};
use tracer::Tracer;

#[derive(Parser, Debug)]
struct Args {
Expand Down
2 changes: 1 addition & 1 deletion crates/nrz-trace/src/tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::{collections::HashMap, fmt, sync::Arc};
use camino::{Utf8Path, Utf8PathBuf};
use globwalk::WalkType;
use miette::{Diagnostic, Report, SourceSpan};
use nrzpath::{AbsoluteSystemPath, AbsoluteSystemPathBuf, PathError};
use oxc_resolver::{
EnforceExtension, ResolveError, ResolveOptions, Resolver, TsconfigOptions, TsconfigReferences,
};
Expand All @@ -18,7 +19,6 @@ use swc_ecma_visit::VisitWith;
use thiserror::Error;
use tokio::task::JoinSet;
use tracing::{debug, error};
use nrzpath::{AbsoluteSystemPath, AbsoluteSystemPathBuf, PathError};

use crate::import_finder::ImportFinder;

Expand Down
8 changes: 4 additions & 4 deletions crates/nrzrepo-analytics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
use std::time::Duration;

use futures::{stream::FuturesUnordered, StreamExt};
use nrzrepo_api_client::{analytics::AnalyticsClient, APIAuth};
pub use nrzrepo_vercel_api::AnalyticsEvent;
use thiserror::Error;
use tokio::{
select,
sync::{mpsc, oneshot},
task::{JoinError, JoinHandle},
};
use tracing::debug;
use nrzrepo_api_client::{analytics::AnalyticsClient, APIAuth};
pub use nrzrepo_vercel_api::AnalyticsEvent;
use uuid::Uuid;

const BUFFER_THRESHOLD: usize = 10;
Expand Down Expand Up @@ -184,12 +184,12 @@ mod tests {
time::Duration,
};

use nrzrepo_api_client::{analytics::AnalyticsClient, APIAuth};
use nrzrepo_vercel_api::{AnalyticsEvent, CacheEvent, CacheSource};
use tokio::{
select,
sync::{mpsc, mpsc::UnboundedReceiver},
};
use nrzrepo_api_client::{analytics::AnalyticsClient, APIAuth};
use nrzrepo_vercel_api::{AnalyticsEvent, CacheEvent, CacheSource};

use crate::start_analytics;

Expand Down
2 changes: 1 addition & 1 deletion crates/nrzrepo-api-client/src/analytics.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::future::Future;

use reqwest::Method;
pub use nrzrepo_vercel_api::{AnalyticsEvent, CacheEvent, CacheSource};
use reqwest::Method;

use crate::{retry, APIAuth, APIClient, Error};

Expand Down
8 changes: 4 additions & 4 deletions crates/nrzrepo-api-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
use std::{backtrace::Backtrace, env, future::Future, time::Duration};

use lazy_static::lazy_static;
use regex::Regex;
pub use reqwest::Response;
use reqwest::{Body, Method, RequestBuilder, StatusCode};
use serde::Deserialize;
use nrzrepo_ci::{is_ci, Vendor};
use nrzrepo_vercel_api::{
token::ResponseTokenMetadata, APIError, CachingStatus, CachingStatusResponse,
PreflightResponse, SpacesResponse, Team, TeamsResponse, UserResponse, VerificationResponse,
VerifiedSsoUser,
};
use regex::Regex;
pub use reqwest::Response;
use reqwest::{Body, Method, RequestBuilder, StatusCode};
use serde::Deserialize;
use url::Url;

pub use crate::error::{Error, Result};
Expand Down
4 changes: 2 additions & 2 deletions crates/nrzrepo-api-client/src/spaces.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use chrono::{DateTime, Local};
use reqwest::Method;
use serde::Serialize;
use nrzpath::AnchoredSystemPath;
use nrzrepo_vercel_api::SpaceRun;
use reqwest::Method;
use serde::Serialize;

use crate::{retry, APIAuth, APIClient, Error};

Expand Down
2 changes: 1 addition & 1 deletion crates/nrzrepo-api-client/src/telemetry.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::future::Future;

use reqwest::Method;
use nrzrepo_vercel_api::telemetry::TelemetryEvent;
use reqwest::Method;

use crate::{retry, AnonAPIClient, Error};

Expand Down
9 changes: 4 additions & 5 deletions crates/nrzrepo-auth/src/auth/login.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::sync::Arc;

pub use error::Error;
use nrzrepo_api_client::{CacheClient, Client, TokenClient};
use nrzrepo_ui::{start_spinner, ColorConfig, BOLD};
use reqwest::Url;
use tokio::sync::OnceCell;
use tracing::{debug, warn};
use nrzrepo_api_client::{CacheClient, Client, TokenClient};
use nrzrepo_ui::{start_spinner, ColorConfig, BOLD};

use crate::{auth::extract_vercel_token, error, ui, LoginOptions, Token};

Expand Down Expand Up @@ -145,12 +145,12 @@ mod tests {
use std::{assert_matches::assert_matches, sync::atomic::AtomicUsize};

use async_trait::async_trait;
use reqwest::{Method, RequestBuilder, Response};
use nrzrepo_vercel_api::{
CachingStatus, CachingStatusResponse, Membership, Role, SpacesResponse, Team,
TeamsResponse, User, UserResponse, VerifiedSsoUser,
};
use nrzrepo_vercel_api_mock::start_test_server;
use reqwest::{Method, RequestBuilder, Response};

use super::*;
use crate::{login_server, LoginServer};
Expand Down Expand Up @@ -277,8 +277,7 @@ mod tests {
async fn get_metadata(
&self,
token: &str,
) -> nrzrepo_api_client::Result<nrzrepo_vercel_api::token::ResponseTokenMetadata>
{
) -> nrzrepo_api_client::Result<nrzrepo_vercel_api::token::ResponseTokenMetadata> {
if token.is_empty() {
return Err(MockApiError::EmptyToken.into());
}
Expand Down
9 changes: 4 additions & 5 deletions crates/nrzrepo-auth/src/auth/logout.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use tracing::error;
use nrzpath::AbsoluteSystemPath;
use nrzrepo_api_client::TokenClient;
use nrzrepo_dirs::{config_dir, vercel_config_dir};
use nrzrepo_ui::{cprintln, GREY};
use tracing::error;

use crate::{
Error, LogoutOptions, Token, NRZ_TOKEN_DIR, NRZ_TOKEN_FILE, VERCEL_TOKEN_DIR,
VERCEL_TOKEN_FILE,
Error, LogoutOptions, Token, NRZ_TOKEN_DIR, NRZ_TOKEN_FILE, VERCEL_TOKEN_DIR, VERCEL_TOKEN_FILE,
};

pub async fn logout<T: TokenClient>(options: &LogoutOptions<T>) -> Result<(), Error> {
Expand Down Expand Up @@ -82,15 +81,15 @@ impl<T: TokenClient> LogoutOptions<T> {
mod tests {
use std::backtrace::Backtrace;

use reqwest::{RequestBuilder, Response};
use tempfile::tempdir;
use nrzpath::AbsoluteSystemPathBuf;
use nrzrepo_api_client::Client;
use nrzrepo_ui::ColorConfig;
use nrzrepo_vercel_api::{
token::ResponseTokenMetadata, SpacesResponse, Team, TeamsResponse, UserResponse,
VerifiedSsoUser,
};
use reqwest::{RequestBuilder, Response};
use tempfile::tempdir;
use url::Url;

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/nrzrepo-auth/src/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ mod sso;

pub use login::*;
pub use logout::*;
pub use sso::*;
#[cfg(test)]
use nrzpath::AbsoluteSystemPathBuf;
use nrzrepo_api_client::{CacheClient, Client, TokenClient};
use nrzrepo_ui::ColorConfig;
pub use sso::*;

use crate::LoginServer;

Expand Down
9 changes: 4 additions & 5 deletions crates/nrzrepo-auth/src/auth/sso.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::sync::Arc;

use nrzrepo_api_client::{CacheClient, Client, TokenClient};
use nrzrepo_ui::{start_spinner, ColorConfig, BOLD};
use reqwest::Url;
use tokio::sync::OnceCell;
use tracing::warn;
use nrzrepo_api_client::{CacheClient, Client, TokenClient};
use nrzrepo_ui::{start_spinner, ColorConfig, BOLD};

use crate::{auth::extract_vercel_token, error, ui, Error, LoginOptions, Token};

Expand Down Expand Up @@ -145,12 +145,12 @@ mod tests {
use std::sync::atomic::AtomicUsize;

use async_trait::async_trait;
use reqwest::{Method, RequestBuilder, Response};
use nrzrepo_vercel_api::{
CachingStatus, CachingStatusResponse, Membership, Role, SpacesResponse, Team,
TeamsResponse, User, UserResponse, VerifiedSsoUser,
};
use nrzrepo_vercel_api_mock::start_test_server;
use reqwest::{Method, RequestBuilder, Response};

use super::*;
use crate::{LoginServer, LoginType};
Expand Down Expand Up @@ -273,8 +273,7 @@ mod tests {
async fn get_metadata(
&self,
token: &str,
) -> nrzrepo_api_client::Result<nrzrepo_vercel_api::token::ResponseTokenMetadata>
{
) -> nrzrepo_api_client::Result<nrzrepo_vercel_api::token::ResponseTokenMetadata> {
if token.is_empty() {
return Err(MockApiError::EmptyToken.into());
}
Expand Down
2 changes: 1 addition & 1 deletion crates/nrzrepo-auth/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::io;

use thiserror::Error;
use nrzpath::{AbsoluteSystemPathBuf, PathError};
use thiserror::Error;

#[derive(Debug, Error)]
pub enum Error {
Expand Down
6 changes: 3 additions & 3 deletions crates/nrzrepo-auth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ mod ui;
pub use auth::*;
pub use error::Error;
pub use login_server::*;
use serde::Deserialize;
use nrzpath::AbsoluteSystemPath;
use nrzrepo_api_client::{CacheClient, Client, TokenClient};
use nrzrepo_vercel_api::{token::ResponseTokenMetadata, User};
use serde::Deserialize;

pub struct TeamInfo<'a> {
pub id: &'a str,
Expand Down Expand Up @@ -274,10 +274,10 @@ fn is_token_active(metadata: &ResponseTokenMetadata, current_time: u128) -> bool
mod tests {
use std::backtrace::Backtrace;

use reqwest::{Method, Response};
use tempfile::tempdir;
use nrzpath::AbsoluteSystemPathBuf;
use nrzrepo_vercel_api::{token::Scope, CachingStatus, CachingStatusResponse};
use reqwest::{Method, Response};
use tempfile::tempdir;

use super::*;

Expand Down
6 changes: 3 additions & 3 deletions crates/nrzrepo-cache/src/async_cache.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::sync::{atomic::AtomicU8, Arc, Mutex};

use futures::{stream::FuturesUnordered, StreamExt};
use tokio::sync::{mpsc, oneshot, Semaphore};
use tracing::{warn, Instrument, Level};
use nrzpath::{AbsoluteSystemPath, AbsoluteSystemPathBuf, AnchoredSystemPathBuf};
use nrzrepo_analytics::AnalyticsSender;
use nrzrepo_api_client::{APIAuth, APIClient};
use tokio::sync::{mpsc, oneshot, Semaphore};
use tracing::{warn, Instrument, Level};

use crate::{
http::UploadMap, multiplexer::CacheMultiplexer, CacheError, CacheHitMetadata, CacheOpts,
Expand Down Expand Up @@ -220,10 +220,10 @@ mod tests {
use anyhow::Result;
use camino::Utf8PathBuf;
use futures::future::try_join_all;
use tempfile::tempdir;
use nrzpath::AbsoluteSystemPathBuf;
use nrzrepo_api_client::{APIAuth, APIClient};
use nrzrepo_vercel_api_mock::start_test_server;
use tempfile::tempdir;

use crate::{
test_cases::{get_test_cases, TestCase},
Expand Down
4 changes: 2 additions & 2 deletions crates/nrzrepo-cache/src/cache_archive/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use std::{
path::Path,
};

use tar::{EntryType, Header};
use nrzpath::{AbsoluteSystemPath, AnchoredSystemPath, IntoUnix};
use tar::{EntryType, Header};

use crate::CacheError;

Expand Down Expand Up @@ -162,9 +162,9 @@ mod tests {
use std::path::PathBuf;

use anyhow::Result;
use nrzpath::{AbsoluteSystemPathBuf, AnchoredSystemPathBuf};
use tempfile::tempdir;
use test_case::test_case;
use nrzpath::{AbsoluteSystemPathBuf, AnchoredSystemPathBuf};

use super::*;
use crate::cache_archive::restore::CacheReader;
Expand Down
4 changes: 2 additions & 2 deletions crates/nrzrepo-cache/src/cache_archive/restore.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::{backtrace::Backtrace, collections::HashMap, io::Read};

use nrzpath::{AbsoluteSystemPath, AbsoluteSystemPathBuf, AnchoredSystemPathBuf};
use petgraph::graph::DiGraph;
use sha2::{Digest, Sha512};
use tar::Entry;
use nrzpath::{AbsoluteSystemPath, AbsoluteSystemPathBuf, AnchoredSystemPathBuf};

use crate::{
cache_archive::{
Expand Down Expand Up @@ -184,11 +184,11 @@ mod tests {
use std::{fs, fs::File, io::empty, path::Path};

use anyhow::Result;
use nrzpath::{AbsoluteSystemPath, AbsoluteSystemPathBuf, AnchoredSystemPathBuf};
use tar::Header;
use tempfile::{tempdir, TempDir};
use test_case::test_case;
use tracing::debug;
use nrzpath::{AbsoluteSystemPath, AbsoluteSystemPathBuf, AnchoredSystemPathBuf};

use crate::cache_archive::{restore::CacheReader, restore_symlink::canonicalize_linkname};

Expand Down
4 changes: 2 additions & 2 deletions crates/nrzrepo-cache/src/cache_archive/restore_directory.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::{backtrace::Backtrace, ffi::OsString, io};

use camino::Utf8Component;
use tar::Entry;
use tracing::debug;
use nrzpath::{
AbsoluteSystemPath, AbsoluteSystemPathBuf, AnchoredSystemPath, AnchoredSystemPathBuf,
};
use tar::Entry;
use tracing::debug;

use crate::CacheError;

Expand Down
2 changes: 1 addition & 1 deletion crates/nrzrepo-cache/src/cache_archive/restore_regular.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{fs::OpenOptions, io, io::Read, path::Path};

use tar::Entry;
use nrzpath::{AbsoluteSystemPath, AnchoredSystemPath, AnchoredSystemPathBuf};
use tar::Entry;

use crate::{cache_archive::restore_directory::CachedDirTree, CacheError};

Expand Down
4 changes: 2 additions & 2 deletions crates/nrzrepo-cache/src/fs.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::{backtrace::Backtrace, fs::OpenOptions};

use camino::Utf8Path;
use serde::{Deserialize, Serialize};
use nrzpath::{AbsoluteSystemPath, AbsoluteSystemPathBuf, AnchoredSystemPathBuf};
use nrzrepo_analytics::AnalyticsSender;
use nrzrepo_api_client::{analytics, analytics::AnalyticsEvent};
use serde::{Deserialize, Serialize};

use crate::{
cache_archive::{CacheReader, CacheWriter},
Expand Down Expand Up @@ -182,11 +182,11 @@ mod test {

use anyhow::Result;
use futures::future::try_join_all;
use tempfile::tempdir;
use nrzpath::AnchoredSystemPath;
use nrzrepo_analytics::start_analytics;
use nrzrepo_api_client::{APIAuth, APIClient};
use nrzrepo_vercel_api_mock::start_test_server;
use tempfile::tempdir;

use super::*;
use crate::test_cases::{get_test_cases, validate_analytics, TestCase};
Expand Down
Loading

0 comments on commit dc75042

Please sign in to comment.