Skip to main content

txtx_addon_kit/types/
package.rs

1use std::collections::{HashMap, HashSet};
2
3use super::{ConstructDid, PackageId};
4
5#[derive(Clone, Debug, Serialize, Deserialize)]
6pub struct Package {
7    /// Id of the Package
8    pub package_id: PackageId,
9    pub flow_inputs_dids: HashSet<ConstructDid>,
10    pub flow_inputs_did_lookup: HashMap<String, ConstructDid>,
11    pub variables_dids: HashSet<ConstructDid>,
12    pub variables_did_lookup: HashMap<String, ConstructDid>,
13    pub outputs_dids: HashSet<ConstructDid>,
14    pub outputs_did_lookup: HashMap<String, ConstructDid>,
15    pub modules_dids: HashSet<ConstructDid>,
16    pub modules_did_lookup: HashMap<String, ConstructDid>,
17    pub imports_dids: HashSet<ConstructDid>,
18    pub imports_did_lookup: HashMap<String, ConstructDid>,
19    pub commands_dids: HashSet<ConstructDid>,
20    pub commands_did_lookup: HashMap<String, ConstructDid>,
21    pub addons_dids: HashSet<ConstructDid>,
22    pub addons_did_lookup: HashMap<String, ConstructDid>,
23    pub signers_dids: HashSet<ConstructDid>,
24    pub signers_did_lookup: HashMap<String, ConstructDid>,
25    pub embedded_runbooks_dids: HashSet<ConstructDid>,
26    pub embedded_runbooks_did_lookup: HashMap<String, ConstructDid>,
27}
28
29impl Package {
30    pub fn new(package_id: &PackageId) -> Self {
31        Self {
32            package_id: package_id.clone(),
33            flow_inputs_dids: HashSet::new(),
34            flow_inputs_did_lookup: HashMap::new(),
35            variables_dids: HashSet::new(),
36            variables_did_lookup: HashMap::new(),
37            outputs_dids: HashSet::new(),
38            outputs_did_lookup: HashMap::new(),
39            modules_dids: HashSet::new(),
40            modules_did_lookup: HashMap::new(),
41            imports_dids: HashSet::new(),
42            imports_did_lookup: HashMap::new(),
43            commands_dids: HashSet::new(),
44            commands_did_lookup: HashMap::new(),
45            addons_dids: HashSet::new(),
46            addons_did_lookup: HashMap::new(),
47            signers_dids: HashSet::new(),
48            signers_did_lookup: HashMap::new(),
49            embedded_runbooks_dids: HashSet::new(),
50            embedded_runbooks_did_lookup: HashMap::new(),
51        }
52    }
53}