From a2c2db12e1f687a2acf8a6e74d2f9a89d90aa57b Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Mon, 5 Jan 2026 11:37:49 -0700 Subject: [PATCH] pluralize --- core/src/install/mod.rs | 2 +- core/src/registry/asset.rs | 8 +++---- core/src/registry/os/asset/add.rs | 6 ++--- core/src/registry/package/add.rs | 2 +- core/src/registry/package/get.rs | 16 +++++++------ core/src/registry/package/index.rs | 24 +++++++++---------- sdk/base/lib/osBindings/PackageVersionInfo.ts | 2 +- sdk/base/lib/osBindings/RegistryAsset.ts | 2 +- 8 files changed, 32 insertions(+), 30 deletions(-) diff --git a/core/src/install/mod.rs b/core/src/install/mod.rs index 79e9fa797..261bafeb4 100644 --- a/core/src/install/mod.rs +++ b/core/src/install/mod.rs @@ -145,7 +145,7 @@ pub async fn install( let (_, asset) = package .best .get(&version) - .and_then(|i| i.s9pk.first()) + .and_then(|i| i.s9pks.first()) .ok_or_else(|| { Error::new( eyre!("{id}@{version} not found on {registry}"), diff --git a/core/src/registry/asset.rs b/core/src/registry/asset.rs index 868134a6a..03f320c41 100644 --- a/core/src/registry/asset.rs +++ b/core/src/registry/asset.rs @@ -28,7 +28,7 @@ pub struct RegistryAsset { #[ts(type = "string")] pub published_at: DateTime, #[ts(type = "string[]")] - pub url: Vec, + pub urls: Vec, pub commitment: Commitment, pub signatures: HashMap, } @@ -43,7 +43,7 @@ impl RegistryAsset { ) } pub async fn load_http_source(&self, client: Client) -> Result { - for url in &self.url { + for url in &self.urls { if let Ok(source) = HttpSource::new(client.clone(), url.clone()).await { return Ok(source); } @@ -58,7 +58,7 @@ impl RegistryAsset { client: Client, progress: PhaseProgressTrackerHandle, ) -> Result { - for url in &self.url { + for url in &self.urls { if let Ok(response) = client.get(url.clone()).send().await { return BufferedHttpSource::from_response(response, progress).await; } @@ -74,7 +74,7 @@ impl RegistryAsset { client: Client, progress: PhaseProgressTrackerHandle, ) -> Result { - for url in &self.url { + for url in &self.urls { if let Ok(response) = client.get(url.clone()).send().await { return BufferedHttpSource::from_response_with_path(path, response, progress).await; } diff --git a/core/src/registry/os/asset/add.rs b/core/src/registry/os/asset/add.rs index f57c4a3be..0f1d2f061 100644 --- a/core/src/registry/os/asset/add.rs +++ b/core/src/registry/os/asset/add.rs @@ -133,7 +133,7 @@ async fn add_asset( .upsert(&platform, || { Ok(RegistryAsset { published_at: Utc::now(), - url: vec![url.clone()], + urls: vec![url.clone()], commitment: commitment.clone(), signatures: HashMap::new(), }) @@ -146,8 +146,8 @@ async fn add_asset( )) } else { s.signatures.insert(signer, signature); - if !s.url.contains(&url) { - s.url.push(url); + if !s.urls.contains(&url) { + s.urls.push(url); } Ok(()) } diff --git a/core/src/registry/package/add.rs b/core/src/registry/package/add.rs index 790e64b06..44ba1b60b 100644 --- a/core/src/registry/package/add.rs +++ b/core/src/registry/package/add.rs @@ -61,7 +61,7 @@ pub async fn add_package( let manifest = s9pk.as_manifest(); let mut info = PackageVersionInfo::from_s9pk(&s9pk, url).await?; - for (_, s9pk) in &mut info.s9pk { + for (_, s9pk) in &mut info.s9pks { if !s9pk.signatures.contains_key(&uploader) && s9pk.commitment == commitment { s9pk.signatures.insert(uploader.clone(), signature.clone()); } diff --git a/core/src/registry/package/get.rs b/core/src/registry/package/get.rs index c4a272238..5c6db4a8e 100644 --- a/core/src/registry/package/get.rs +++ b/core/src/registry/package/get.rs @@ -183,7 +183,7 @@ fn get_matching_models<'a>( if let Some(device_info) = &device_info { info.for_device(device_info)? } else { - Some(info.as_s9pk().de()?) + Some(info.as_s9pks().de()?) } .map(|assets| (k.clone(), ExtendedVersion::from(v), info, assets)) } else { @@ -266,7 +266,7 @@ pub async fn get_package(ctx: RegistryContext, params: GetPackageParams) -> Resu PackageVersionInfo { metadata: i.as_metadata().de()?, source_version: i.as_source_version().de()?, - s9pk: a, + s9pks: a, }, )) }) @@ -299,7 +299,7 @@ pub async fn get_package(ctx: RegistryContext, params: GetPackageParams) -> Resu PackageVersionInfo { metadata: i.as_metadata().de()?, source_version: i.as_source_version().de()?, - s9pk: a, + s9pks: a, }, )) }) @@ -362,7 +362,7 @@ pub async fn get_package(ctx: RegistryContext, params: GetPackageParams) -> Resu PackageVersionInfo { metadata: i.as_metadata().de()?, source_version: i.as_source_version().de()?, - s9pk: a, + s9pks: a, }, )) }) @@ -406,7 +406,7 @@ pub async fn get_package(ctx: RegistryContext, params: GetPackageParams) -> Resu PackageVersionInfo { metadata: i.as_metadata().de()?, source_version: i.as_source_version().de()?, - s9pk: a, + s9pks: a, }, )) }) @@ -420,7 +420,7 @@ pub async fn get_package(ctx: RegistryContext, params: GetPackageParams) -> Resu PackageVersionInfo { metadata: i.as_metadata().de()?, source_version: i.as_source_version().de()?, - s9pk: a, + s9pks: a, }, )) }) @@ -511,7 +511,9 @@ pub async fn cli_download( ) .await?, )?; - let PackageVersionInfo { mut s9pk, .. } = match res.best.len() { + let PackageVersionInfo { + s9pks: mut s9pk, .. + } = match res.best.len() { 0 => { return Err(Error::new( eyre!( diff --git a/core/src/registry/package/index.rs b/core/src/registry/package/index.rs index 0ad236ebe..4549815fb 100644 --- a/core/src/registry/package/index.rs +++ b/core/src/registry/package/index.rs @@ -142,18 +142,18 @@ pub struct PackageVersionInfo { pub metadata: PackageMetadata, #[ts(type = "string | null")] pub source_version: Option, - pub s9pk: Vec<(HardwareRequirements, RegistryAsset)>, + pub s9pks: Vec<(HardwareRequirements, RegistryAsset)>, } impl PackageVersionInfo { pub async fn from_s9pk(s9pk: &S9pk, url: Url) -> Result { Ok(Self { metadata: PackageMetadata::load(s9pk).await?, source_version: None, // TODO - s9pk: vec![( + s9pks: vec![( s9pk.as_manifest().hardware_requirements.clone(), RegistryAsset { published_at: Utc::now(), - url: vec![url], + urls: vec![url], commitment: s9pk.as_archive().commitment().await?, signatures: [( AnyVerifyingKey::Ed25519(s9pk.as_archive().signer()), @@ -166,28 +166,28 @@ impl PackageVersionInfo { }) } pub fn merge_with(&mut self, other: Self) -> Result<(), Error> { - for (hw_req, asset) in other.s9pk { + for (hw_req, asset) in other.s9pks { if let Some((_, matching)) = self - .s9pk + .s9pks .iter_mut() .find(|(h, s)| s.commitment == asset.commitment && *h == hw_req) { - for url in asset.url { - if matching.url.contains(&url) { + for url in asset.urls { + if matching.urls.contains(&url) { continue; } - matching.url.push(url); + matching.urls.push(url); } } else { - if let Some((h, matching)) = self.s9pk.iter_mut().find(|(h, _)| *h == hw_req) { + if let Some((h, matching)) = self.s9pks.iter_mut().find(|(h, _)| *h == hw_req) { *matching = asset; *h = hw_req; } else { - self.s9pk.push((hw_req, asset)); + self.s9pks.push((hw_req, asset)); } } } - self.s9pk.sort_by_key(|(h, _)| h.specificity_desc()); + self.s9pks.sort_by_key(|(h, _)| h.specificity_desc()); Ok(()) } pub fn table(&self, version: &VersionString) -> prettytable::Table { @@ -229,7 +229,7 @@ impl Model { { return Ok(None); } - let mut s9pk = self.as_s9pk().de()?; + let mut s9pk = self.as_s9pks().de()?; s9pk.retain(|(hw, _)| { if let Some(arch) = &hw.arch { if !arch.contains(&device_info.hardware.arch) { diff --git a/sdk/base/lib/osBindings/PackageVersionInfo.ts b/sdk/base/lib/osBindings/PackageVersionInfo.ts index aafdf9df1..e19cf7d01 100644 --- a/sdk/base/lib/osBindings/PackageVersionInfo.ts +++ b/sdk/base/lib/osBindings/PackageVersionInfo.ts @@ -11,7 +11,7 @@ import type { RegistryAsset } from "./RegistryAsset" export type PackageVersionInfo = { sourceVersion: string | null - s9pk: Array<[HardwareRequirements, RegistryAsset]> + s9pks: Array<[HardwareRequirements, RegistryAsset]> title: string icon: DataUrl description: Description diff --git a/sdk/base/lib/osBindings/RegistryAsset.ts b/sdk/base/lib/osBindings/RegistryAsset.ts index 6edf5d39f..3b8c85bf2 100644 --- a/sdk/base/lib/osBindings/RegistryAsset.ts +++ b/sdk/base/lib/osBindings/RegistryAsset.ts @@ -4,7 +4,7 @@ import type { AnyVerifyingKey } from "./AnyVerifyingKey" export type RegistryAsset = { publishedAt: string - url: string[] + urls: string[] commitment: Commitment signatures: { [key: AnyVerifyingKey]: AnySignature } }