Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbrisebois committed Jul 26, 2023
2 parents 4533fd2 + 8ad6faa commit 4427146
Show file tree
Hide file tree
Showing 48 changed files with 307 additions and 507 deletions.
12 changes: 5 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@
- Mere Memory API

### Entity Relationship Pattern
This project implements the CEPS pattern *(pattern documentation is in process)*.
This project implements the CAPS pattern *(pattern documentation is in process)*.

- [github.com/mjbrisebois/rust-hc-crud-ceps/](https://github.com/mjbrisebois/rust-hc-crud-ceps/)
- [docs.rs/hc_crud_ceps/](https://docs.rs/hc_crud_ceps/) - Rust library that implements th CEPS pattern
- [github.com/mjbrisebois/rust-hc-crud-caps/](https://github.com/mjbrisebois/rust-hc-crud-caps/)
- [docs.rs/hc_crud_caps/](https://docs.rs/hc_crud_caps/) - Rust library that implements th CAPS pattern

#### CEPS Concept Example
![](https://drive.google.com/a/webheroes.ca/thumbnail?sz=w1000&id=1oJTioA_IlGrcZI4tn-AyM0orMCt5kP6r)


## Development
Expand Down Expand Up @@ -94,7 +92,7 @@ make test-all-debug
## Dependencies

- DevHub
- CRUD (`hc_crud_ceps`)
- CRUD (`hc_crud_caps`)
- Mere Memory
- dev / testing
- `@whi/holochain-client`
Expand All @@ -103,7 +101,7 @@ make test-all-debug
- Holochain Conductor API


#### [CRUD](https://crates.io/crates/hc_crud_ceps)
#### [CRUD](https://crates.io/crates/hc_crud_caps)

This library handles the underlying CRUD patter for all DevHub's entry types. If there is a new HDK
for Holochain, the CRUD library will need to be bumped and possibly updated to handle any API
Expand Down
23 changes: 14 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -183,27 +183,32 @@ clean-files-all: clean-remove-chaff
clean-files-all-force: clean-remove-chaff
git clean -fdx

PRE_HDK_VERSION = "0.3.0-beta-dev.7"
NEW_HDK_VERSION = "0.2.1-beta-rc.0"
PRE_HDK_VERSION = "=0.2.1-beta-rc.0"
NEW_HDK_VERSION = "=0.2.1"

PRE_HDI_VERSION = "0.4.0-beta-dev.5"
NEW_HDI_VERSION = "0.3.1-beta-rc.0"
PRE_HDI_VERSION = "0.3.1-beta-rc.0"
NEW_HDI_VERSION = "=0.3.1"

PRE_CRUD_VERSION = "0.79.0"
NEW_CRUD_VERSION = "0.80.0"
PRE_HDIEV = "0.2"
NEW_HDIEV = "0.2.1"

PRE_MM_VERSION = "0.86.0"
NEW_MM_VERSION = "0.87.0"
PRE_CRUD_VERSION = "0.8.0"
NEW_CRUD_VERSION = "0.9.0"

PRE_MM_VERSION = "0.87.0"
NEW_MM_VERSION = "0.88.0"

# PRE_PORTAL_VERSION = "0.3.0"
NEW_PORTAL_VERSION = "0.7.0"
NEW_PORTAL_VERSION = "0.8.0"

GG_REPLACE_LOCATIONS = ':(exclude)*.lock' devhub_types/ zomes/*/

update-hdk-version:
git grep -l '$(PRE_HDK_VERSION)' -- $(GG_REPLACE_LOCATIONS) | xargs sed -i 's|$(PRE_HDK_VERSION)|$(NEW_HDK_VERSION)|g'
update-hdi-version:
git grep -l '$(PRE_HDI_VERSION)' -- $(GG_REPLACE_LOCATIONS) | xargs sed -i 's|$(PRE_HDI_VERSION)|$(NEW_HDI_VERSION)|g'
update-extensions-version:
git grep -l '$(PRE_HDIEV)' -- $(GG_REPLACE_LOCATIONS) | xargs sed -i 's|$(PRE_HDIEV)|$(NEW_HDIEV)|g'
update-crud-version:
git grep -l '$(PRE_CRUD_VERSION)' -- $(GG_REPLACE_LOCATIONS) | xargs sed -i 's|$(PRE_CRUD_VERSION)|$(NEW_CRUD_VERSION)|g'
update-mere-memory-version:
Expand Down
8 changes: 4 additions & 4 deletions devhub_types/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions devhub_types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devhub_types"
version = "0.2.1-beta-rc.0"
version = "0.0.0"
authors = ["Matthew Brisebois <matthew.brisebois@holo.host>"]
edition = "2018"

Expand All @@ -11,8 +11,8 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
essence_payloads = "0.1"
flate2 = "1"
hc_crud_ceps = "0.80.0"
hdk = "0.2.1-beta-rc.0"
hc_crud_caps = "0.9.0"
hdk = "=0.2.1"
hex = "0"
rmp-serde = "0.15.5"
serde = "1"
Expand Down
6 changes: 3 additions & 3 deletions devhub_types/src/base_zome_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ use crate::{


#[hdk_extern]
fn get_record(hash: EntryHash) -> ExternResult<DevHubResponse<Record>> {
fn get_record(hash: ActionHash) -> ExternResult<DevHubResponse<Record>> {
let record = get( hash.to_owned(), GetOptions::latest() )?
.ok_or( wasm_error!(WasmErrorInner::Guest(format!("Entry not found: {}", hash ))) )?;
.ok_or( wasm_error!(WasmErrorInner::Guest(format!("Action not found: {}", hash ))) )?;

Ok(composition( record, VALUE_MD ))
}

#[hdk_extern]
fn get_record_latest(hash: EntryHash) -> ExternResult<DevHubResponse<Record>> {
fn get_record_latest(hash: ActionHash) -> ExternResult<DevHubResponse<Record>> {
let entity = hc_crud::fetch_record_latest( &hash )
.map_err( |err| wasm_error!(WasmErrorInner::Guest(format!("fetch_record_latest Error: {:?}", err ))) )?;

Expand Down
44 changes: 22 additions & 22 deletions devhub_types/src/dnarepo_entry_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct DeprecationNotice {
pub message: String,

// optional
pub recommended_alternatives: Option<Vec<EntryHash>>,
pub recommended_alternatives: Option<Vec<ActionHash>>,
}

impl DeprecationNotice {
Expand Down Expand Up @@ -68,17 +68,17 @@ pub struct DnaEntry {
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct IntegrityZomeReference {
pub name: String,
pub zome : EntryHash, // Zome ID
pub version : EntryHash, // Version ID
pub zome : ActionHash, // Zome ID
pub version : ActionHash, // Version ID
pub resource : EntryHash, // Mere Memory address for a short-circuit download
pub resource_hash : String, // Hash of resource contents
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct ZomeReference {
pub name: String,
pub zome : EntryHash, // Zome ID
pub version : EntryHash, // Version ID
pub zome : ActionHash, // Zome ID
pub version : ActionHash, // Version ID
pub resource : EntryHash, // Mere Memory address for a short-circuit download
pub resource_hash : String, // Hash of resource contents
pub dependencies: Vec<String>,
Expand All @@ -87,7 +87,7 @@ pub struct ZomeReference {
#[hdk_entry_helper]
#[derive(Clone)]
pub struct DnaVersionEntry {
pub for_dna: EntryHash,
pub for_dna: ActionHash,
pub version: String,
pub ordering: u64,
pub published_at: u64,
Expand All @@ -109,7 +109,7 @@ pub struct DnaVersionEntry {
// Package
#[derive(Debug, Serialize, Deserialize)]
pub struct DnaVersionPackage {
pub for_dna: EntryHash,
pub for_dna: ActionHash,
pub version: String,
pub published_at: u64,
pub last_updated: u64,
Expand Down Expand Up @@ -163,7 +163,7 @@ pub struct ZomeEntry {
#[hdk_entry_helper]
#[derive(Clone, PartialEq)]
pub struct ZomeVersionEntry {
pub for_zome: EntryHash,
pub for_zome: ActionHash,
pub version: String,
pub ordering: u64,
// pub properties: Option<serde_yaml::Value>,
Expand All @@ -176,7 +176,7 @@ pub struct ZomeVersionEntry {
pub metadata: BTreeMap<String, serde_yaml::Value>,

// optional
pub review_summary: Option<EntryHash>,
pub review_summary: Option<ActionHash>,
pub source_code_commit_url: Option<String>,
}

Expand All @@ -188,18 +188,18 @@ pub struct ZomeVersionEntry {
#[hdk_entry_helper]
#[derive(Clone, PartialEq)]
pub struct ReviewEntry {
pub subject_ids: Vec<(EntryHash, ActionHash)>,
pub subject_ids: Vec<(ActionHash, ActionHash)>,
pub author: AgentPubKey,
pub ratings: BTreeMap<String,u8>,
pub message: String,
pub published_at: u64,
pub last_updated: u64,
pub reaction_summary: Option<EntryHash>,
pub reaction_summary: Option<ActionHash>,
pub metadata: BTreeMap<String, serde_yaml::Value>,
pub deleted: bool,

// optional
pub related_entries: Option<BTreeMap<String, EntryHash>>,
pub related_entries: Option<BTreeMap<String, ActionHash>>,
}


Expand All @@ -210,7 +210,7 @@ pub struct ReviewEntry {
#[hdk_entry_helper]
#[derive(Clone)]
pub struct ReactionEntry {
pub subject_ids: Vec<(EntryHash, ActionHash)>,
pub subject_ids: Vec<(ActionHash, ActionHash)>,
pub author: AgentPubKey,
pub reaction_type: u64,

Expand All @@ -221,7 +221,7 @@ pub struct ReactionEntry {
pub deleted: bool,

// optional
pub related_entries: Option<BTreeMap<String, EntryHash>>,
pub related_entries: Option<BTreeMap<String, ActionHash>>,
}


Expand All @@ -232,16 +232,16 @@ pub struct ReactionEntry {
#[hdk_entry_helper]
#[derive(Clone)]
pub struct ReactionSummaryEntry {
pub subject_id: EntryHash,
pub subject_id: ActionHash,
pub subject_history: Vec<ActionHash>,

pub published_at: u64,
pub last_updated: u64,

pub factored_action_count: u64,

pub reaction_refs: BTreeMap<String,(EntryHash, ActionHash, AgentPubKey, u64, u64)>,
pub deleted_reactions: BTreeMap<String,(EntryHash, ActionHash)>,
pub reaction_refs: BTreeMap<String,(ActionHash, ActionHash, AgentPubKey, u64, u64)>,
pub deleted_reactions: BTreeMap<String,(ActionHash, ActionHash)>,
}


Expand All @@ -252,7 +252,7 @@ pub struct ReactionSummaryEntry {
#[hdk_entry_helper]
#[derive(Clone)]
pub struct ReviewSummaryEntry {
pub subject_id: EntryHash,
pub subject_id: ActionHash,
pub subject_history: Vec<ActionHash>,

pub published_at: u64,
Expand All @@ -274,8 +274,8 @@ pub struct ReviewSummaryEntry {
//
// review_total_activity - the activity count for all review revisions
//
pub review_refs: BTreeMap<String,(EntryHash, ActionHash, AgentPubKey, u64, BTreeMap<String,u8>, Option<(ActionHash, u64, BTreeMap<u64,u64>)>)>,
pub deleted_reviews: BTreeMap<String,(EntryHash, ActionHash, AgentPubKey, Option<(ActionHash, u64, BTreeMap<u64,u64>)>)>,
pub review_refs: BTreeMap<String,(ActionHash, ActionHash, AgentPubKey, u64, BTreeMap<String,u8>, Option<(ActionHash, u64, BTreeMap<u64,u64>)>)>,
pub deleted_reviews: BTreeMap<String,(ActionHash, ActionHash, AgentPubKey, Option<(ActionHash, u64, BTreeMap<u64,u64>)>)>,
}


Expand All @@ -287,7 +287,7 @@ pub mod tests {

fn create_dnaentry() -> DnaEntry {
let bytes = rand::thread_rng().gen::<[u8; 32]>();
let hash = EntryHash::from_raw_32( bytes.to_vec() );
let agent = AgentPubKey::from_raw_32( bytes.to_vec() );

DnaEntry {
name: String::from("game_turns"),
Expand All @@ -299,7 +299,7 @@ pub mod tests {
last_updated: 1618855430,

// optional
developer: hash.into(),
developer: agent.into(),
deprecation: None,
source_code_url: None,
metadata: BTreeMap::new(),
Expand Down
16 changes: 8 additions & 8 deletions devhub_types/src/happ_entry_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct DeprecationNotice {
pub message: String,

// optional
pub recommended_alternatives: Option<Vec<EntryHash>>,
pub recommended_alternatives: Option<Vec<ActionHash>>,
}

#[derive(Debug, Serialize, Deserialize, Clone)]
Expand Down Expand Up @@ -153,8 +153,8 @@ pub struct HappEntry {
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct DnaReference {
pub role_name: String,
pub dna : EntryHash, // Dna ID
pub version : EntryHash, // Version ID
pub dna : ActionHash, // Dna ID
pub version : ActionHash, // Version ID
pub wasm_hash : String,
}

Expand All @@ -163,7 +163,7 @@ pub struct DnaReference {
pub struct HappReleaseEntry {
pub version: String,
pub description: String,
pub for_happ: EntryHash,
pub for_happ: ActionHash,
pub ordering: u64,
pub published_at: u64,
pub last_updated: u64,
Expand All @@ -174,7 +174,7 @@ pub struct HappReleaseEntry {
pub metadata: BTreeMap<String, serde_yaml::Value>,

// Optional fields
pub official_gui: Option<EntryHash>,
pub official_gui: Option<ActionHash>,
}


Expand Down Expand Up @@ -209,9 +209,9 @@ pub struct GUIEntry {
pub struct GUIReleaseEntry {
pub version: String,
pub changelog: String,
pub for_gui: EntryHash,
pub for_happ_releases: Vec<EntryHash>,
pub web_asset_id: EntryHash,
pub for_gui: ActionHash,
pub for_happ_releases: Vec<ActionHash>,
pub web_asset_id: ActionHash,
pub published_at: u64,
pub last_updated: u64,
pub metadata: BTreeMap<String, serde_yaml::Value>,
Expand Down
Loading

0 comments on commit 4427146

Please sign in to comment.