-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
becade2
commit 644fe75
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//! NPM Registry Implementation | ||
//! | ||
//! Documentation for NPM: https://github.com/npm/registry/blob/main/docs/REGISTRY-API.md | ||
use ahash::HashMap; | ||
use chrono::{DateTime, FixedOffset}; | ||
use serde::{Deserialize, Serialize}; | ||
use serde_json::Value; | ||
#[derive(Debug, Clone)] | ||
pub struct RegistryResponse { | ||
pub db_name: String, | ||
pub engine: String, | ||
pub doc_count: u64, | ||
pub doc_del_count: u64, | ||
pub update_seq: u64, | ||
pub purge_seq: u64, | ||
pub compact_running: bool, | ||
// TODO: Add more fields | ||
} | ||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct NpmRegistryPackage { | ||
#[serde(rename = "_id")] | ||
pub id: String, | ||
#[serde(rename = "_rev")] | ||
pub rev: String, | ||
pub name: String, | ||
pub description: Option<String>, | ||
#[serde(rename = "dist-tags")] | ||
pub dist_tags: HashMap<String, String>, | ||
pub versions: HashMap<String, Value>, | ||
pub time: HashMap<String, String>, | ||
} | ||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct NPMRegistryPackageTime { | ||
pub created: String, | ||
pub modified: DateTime<FixedOffset>, | ||
#[serde(flatten)] | ||
pub versions: HashMap<String, String>, | ||
} | ||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct Maintainers { | ||
pub name: String, | ||
pub email: String, | ||
} | ||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct Bugs { | ||
pub url: String, | ||
} |