Skip to main content

compmd_host/
bundled_pack.rs

1//! A pack a bundle holds, as its manifest lists it.
2
3use std::collections::BTreeMap;
4
5use compmd_pack::{FilePath, Integrity, ReleaseId};
6use serde::{Deserialize, Serialize};
7
8use crate::trust::Trust;
9
10/// A pack the bundle holds. In JSON its release is flat: `{"pack", "version", "integrity", "trust", "modules"}`.
11#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
12pub struct BundledPack {
13    /// The release.
14    #[serde(flatten)]
15    pub release: ReleaseId,
16    /// The integrity the registry publishes for it (`sha512-…`), from the app's lock file; none when the lock file
17    /// gave none.
18    #[serde(default, skip_serializing_if = "Option::is_none")]
19    pub integrity: Option<Integrity>,
20    /// The trust the configuration gives it.
21    #[serde(default)]
22    pub trust: Trust,
23    /// Its built modules, by their path in the pack, with their integrity (`sha384-…`), which a frame checks.
24    #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
25    pub modules: BTreeMap<FilePath, Integrity>,
26}