Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Bump holochain version 0.3.0-beta-dev.48 #270

Merged
merged 49 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
a27b4ec
bump holochain dependencies
c12i Apr 24, 2024
671d0c9
update FlatOp::RegisterUpdate validation arm
c12i Apr 24, 2024
017b35a
update initial FlatOp::RegisterDelete
c12i Apr 24, 2024
f1a11ca
update FlatOp::RegisterDelete
c12i Apr 24, 2024
7d2c97f
update manifest and lock files
c12i Apr 24, 2024
478b254
fix unreachable code in update validation match arm
c12i Apr 24, 2024
a71ffb8
update FlatOp::RegisterDelete code
c12i Apr 24, 2024
c6d1725
bump holochain dependencies
c12i Apr 26, 2024
eafc1bd
nix flake update
c12i Apr 26, 2024
92a5136
bump hc spin
c12i Apr 26, 2024
7e74520
bump client-js version
c12i Apr 26, 2024
02323a7
Merge remote-tracking branch 'holochain/develop' into bump-holochain-…
c12i Apr 26, 2024
a70a89f
update flake lock
c12i Apr 26, 2024
8d9573e
remove unused imports
c12i Apr 26, 2024
ffaf5e4
bump client-js version
c12i Apr 26, 2024
849d302
bump version
c12i Apr 26, 2024
c64fd6d
update flake lock
c12i Apr 26, 2024
6a628af
bump client-js version
c12i Apr 28, 2024
a1aa94b
bump tryorama
c12i Apr 28, 2024
10b0048
add disable fast forward flag to test script
c12i Apr 28, 2024
bfb5ae8
update app websocket usage
c12i Apr 28, 2024
0c64331
bump hc spin
c12i Apr 29, 2024
6835ac6
replace version functions with constants
c12i Apr 29, 2024
4be32ee
parameterize holochain playground cli version
c12i Apr 29, 2024
9be85a1
update holochain playground cli version
c12i Apr 29, 2024
0363425
add doc comments to version consts
c12i Apr 29, 2024
601e938
add disable fast forward flag to holo-integration test script
c12i Apr 29, 2024
bd48799
improve register delete arm body check, prefer parse quote where ther…
c12i Apr 30, 2024
8ce1c1c
update register delete
c12i Apr 30, 2024
2a790a0
make conditional checks explicit/ declarative
c12i Apr 30, 2024
77a56d0
fix holo integration script runtime
c12i Apr 30, 2024
e4b8cb9
fix comparisons; revert validation
c12i Apr 30, 2024
1dfb27a
refactor add_entry_type_to_validation_arms function
c12i Apr 30, 2024
96bbefb
handle potential validation errors
c12i Apr 30, 2024
9afad70
improve validation error messages
c12i Apr 30, 2024
4f14c12
further improvements to code readability
c12i Apr 30, 2024
b37ee6f
fix clippy warnings
c12i Apr 30, 2024
4c9e659
reduce nested code
c12i Apr 30, 2024
7593aae
prefer parse_quote for non interpolated syn items
c12i Apr 30, 2024
8c0c546
refactor render_entry_definition_file
c12i Apr 30, 2024
3226233
refactor render_entry_definition_struct
c12i Apr 30, 2024
4864c25
fix indentation
c12i Apr 30, 2024
8b2bfa6
prefer parse_quote and avoid unwrapping in map closure
c12i May 2, 2024
2c454ac
bump tryorama
c12i May 6, 2024
51441a6
use consistent versioning
c12i May 6, 2024
2f5ba4f
prefer Display trait implmenentation to ToString
c12i May 7, 2024
4f41f5d
code refactoring n uis module
c12i May 7, 2024
31bad41
merge remote-tracking branch 'holochain/develop' into bump-holochain-…
c12i May 7, 2024
f25824b
fix formatting
c12i May 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1,609 changes: 726 additions & 883 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "holochain_scaffolding_cli"
version = "0.3000.0-dev.6"
version = "0.3000.0-dev.7"
description = "CLI to easily generate and modify holochain apps"
license = "CAL-1.0"
homepage = "https://developer.holochain.org"
Expand All @@ -18,10 +18,10 @@ name = "holochain_scaffolding_cli"
path = "src/lib.rs"

[dependencies]
holochain = { features = ["test_utils"], version = "0.3.0-beta-dev.45"}
holochain_types = "0.3.0-beta-dev.40"
holochain_util = { features = ["backtrace"], version = "0.3.0-beta-dev.6" }
mr_bundle = "0.3.0-beta-dev.8"
holochain = { features = ["test_utils"], version = "0.3.0-beta-dev.48"}
holochain_types = "0.3.0-beta-dev.43"
holochain_util = { features = ["backtrace"], version = "0.3.0-beta-dev.8" }
mr_bundle = "0.3.0-beta-dev.10"

dirs = "4.0.0"
ignore = "0.4"
Expand Down
20 changes: 10 additions & 10 deletions flake.lock

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

4 changes: 2 additions & 2 deletions run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ setup_and_build_happ() {
cleanup_tmp "$1"

cd $TEMPLATE_PATH
hc-scaffold --template "$2" web-app "$1" --setup-nix true
hc-scaffold --template "$2" web-app "$1" --setup-nix true -F
cd "$1"

hc-scaffold dna forum
Expand Down Expand Up @@ -93,7 +93,7 @@ if [[ -n "$SCOPE" ]]; then
rm -rf /tmp/holo-flake
cd /tmp

hc-scaffold --template vue web-app holo-flake --setup-nix true
hc-scaffold --template vue web-app holo-flake --setup-nix true -F
cd holo-flake

nix develop --command bash -c "
Expand Down
4 changes: 2 additions & 2 deletions src/scaffold/app/nix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use std::process::{Command, Stdio};

use crate::error::{ScaffoldError, ScaffoldResult};
use crate::file_tree::*;
use crate::versions::holochain_nix_version;
use crate::versions;

pub fn flake_nix(holo_enabled: bool) -> FileTree {
let holochain_nix_version = holochain_nix_version();
let holochain_nix_version = versions::HOLOCHAIN_NIX_VERSION;

let holo_inputs = holo_enabled
.then_some(
Expand Down
125 changes: 71 additions & 54 deletions src/scaffold/entry_type/integrity.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use convert_case::{Case, Casing};
use itertools::Itertools;
use proc_macro2::TokenStream;
use quote::{format_ident, quote};
use quote::{format_ident, quote, ToTokens};
use std::{ffi::OsString, path::PathBuf};

use crate::error::{ScaffoldError, ScaffoldResult};
Expand Down Expand Up @@ -690,7 +690,7 @@ fn add_entry_type_to_validation_arms(
));
}
};
match original_app_entry { }
match original_app_entry {}
}"#,
)?;
}
Expand Down Expand Up @@ -816,9 +816,15 @@ fn add_entry_type_to_validation_arms(
syn::parse_str::<
syn::Expr,
>(
r#"match (app_entry, original_app_entry) {
_ => Ok(ValidateCallbackResult::Invalid("Original and updated entry types must be the same".to_string()))
}"#,
r#"
{
let original_action = must_get_action(action.clone().original_action_address)?
.action()
.to_owned();
let original_action = EntryCreationAction::try_from(original_action)
c12i marked this conversation as resolved.
Show resolved Hide resolved
.map_err(|e| wasm_error!(e.to_string()))?;
match app_entry {}
}"#,
)?;
}

Expand All @@ -829,9 +835,12 @@ fn add_entry_type_to_validation_arms(
)
{
let new_arm: syn::Arm = syn::parse_str(
format!(
"(EntryTypes::{pascal_entry_def_name}({snake_entry_def_name}), EntryTypes::{pascal_entry_def_name}(original_{snake_entry_def_name})) =>
validate_update_{snake_entry_def_name}(action, {snake_entry_def_name}, original_action, original_{snake_entry_def_name}),",
format!(r#"
EntryTypes::{pascal_entry_def_name}({snake_entry_def_name}) => {{
let original_app_entry = must_get_valid_record(action.clone().original_action_address)?;
let original_{snake_entry_def_name} = {pascal_entry_def_name}::try_from(original_app_entry)?;
c12i marked this conversation as resolved.
Show resolved Hide resolved
validate_update_{snake_entry_def_name}(action, {snake_entry_def_name}, original_action, original_{snake_entry_def_name})
}}"#,
).as_str()
)?;
entry_type_match
Expand All @@ -846,54 +855,62 @@ fn add_entry_type_to_validation_arms(
} else if path_segment_str
.eq(&String::from("RegisterDelete"))
{
if let Some(op_entry_match_expr) =
find_ending_match_expr(&mut arm.body)
{
for op_entry_arm in
&mut op_entry_match_expr.arms
{
if let syn::Pat::Struct(pat_struct) =
&mut op_entry_arm.pat
{
if let Some(ps) =
pat_struct.path.segments.last()
{
if ps
.ident
.to_string()
.eq(&String::from("Entry"))
{
// Add new entry type to match arm
if find_ending_match_expr(
&mut op_entry_arm.body,
)
.is_none()
{
// Change empty invalid to match on entry_type
*op_entry_arm.body = syn::parse_str::<syn::Expr>("match original_app_entry {}")?;
}
// Add new entry type to match arm
if let Some(entry_type_match) =
find_ending_match_expr(
&mut op_entry_arm.body,
)
{
let new_arm: syn::Arm = syn::parse_str(
format!("EntryTypes::{}({}) => validate_delete_{}(action, original_action, {}),",
entry_def.name.to_case(Case::Pascal),
entry_def.name.to_case(Case::Snake),
entry_def.name.to_case(Case::Snake),
entry_def.name.to_case(Case::Snake)
).as_str()
)?;
entry_type_match
.arms
.push(new_arm);
}
if arm.body.as_ref().to_token_stream().to_string().contains("There are no entry types in this integrity zome") {
c12i marked this conversation as resolved.
Show resolved Hide resolved
*arm.body = syn::parse_str::<syn::Expr>(r#"{
let original_action_hash = delete_entry.clone().action.deletes_address;
let original_record = must_get_valid_record(original_action_hash)?;
let original_action = original_record.action().clone();
let original_action = EntryCreationAction::try_from(original_action)
c12i marked this conversation as resolved.
Show resolved Hide resolved
.map_err(|e| wasm_error!(e.to_string()))?;
let app_entry_type = match original_action.entry_type() {
EntryType::App(app_entry_type) => app_entry_type,
_ => {
return Ok(ValidateCallbackResult::Valid);
}
};
let entry = match original_record.entry().as_option() {
Some(entry) => entry,
None => {
if original_action.entry_type().visibility().is_public() {
return Ok(ValidateCallbackResult::Invalid(
"Original record for a delete of a public entry must contain an entry"
.to_string(),
));
} else {
return Ok(ValidateCallbackResult::Valid);
c12i marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
}
};
let original_app_entry = match EntryTypes::deserialize_from_type(
app_entry_type.zome_index,
app_entry_type.entry_index,
entry,
)? {
Some(app_entry) => app_entry,
None => {
c12i marked this conversation as resolved.
Show resolved Hide resolved
return Ok(ValidateCallbackResult::Invalid(
"Original app entry must be one of the defined entry types for this zome"
.to_string(),
));
}
};
match original_app_entry {}
}"#,
)?;
}

// Add new entry type to match arm
if let Some(match_expr) =
find_ending_match_expr(&mut arm.body)
{
let new_arm: syn::Arm = syn::parse_str(
format!(r#"
EntryTypes::{pascal_entry_def_name}(original_{snake_entry_def_name}) => {{
validate_delete_{snake_entry_def_name}(delete_entry.clone().action, original_action, original_{snake_entry_def_name})
}}"#,
).as_str()
)?;
match_expr.arms.insert(0, new_arm);
}
}
}
Expand Down
16 changes: 11 additions & 5 deletions src/scaffold/zome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
integrity::scaffold_integrity_zome_templates, ScaffoldedTemplate,
},
utils::input_with_case,
versions::{hdi_version, hdk_version},
versions,
};
use build_fs_tree::{dir, file};
use holochain_types::prelude::{DnaManifest, ZomeManifest};
Expand Down Expand Up @@ -334,10 +334,16 @@ fn try_to_guess_coordinator_zomes_location(
pub fn add_common_zome_dependencies_to_workspace_cargo(
file_tree: FileTree,
) -> ScaffoldResult<FileTree> {
let file_tree =
add_workspace_external_dependency(file_tree, "hdi", &format!("={}", hdi_version()))?;
let file_tree =
add_workspace_external_dependency(file_tree, "hdk", &format!("={}", hdk_version()))?;
let file_tree = add_workspace_external_dependency(
file_tree,
"hdi",
&format!("={}", versions::HDI_VERSION),
)?;
let file_tree = add_workspace_external_dependency(
file_tree,
"hdk",
&format!("={}", versions::HDK_VERSION),
)?;
let file_tree = add_workspace_external_dependency(file_tree, "serde", "1.0")?;
Ok(file_tree)
}
Expand Down
36 changes: 12 additions & 24 deletions src/scaffold/zome/integrity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,45 +74,33 @@ pub fn validate(op: Op) -> ExternResult<ValidateCallbackResult> {
_ => Ok(ValidateCallbackResult::Valid)
},
FlatOp::RegisterUpdate(update_entry) => match update_entry {
OpUpdate::Entry {
original_action,
original_app_entry,
app_entry,
action
} => Ok(ValidateCallbackResult::Invalid(
"There are no entry types in this integrity zome".to_string(),
)),
OpUpdate::Entry { app_entry, action } => {
Ok(ValidateCallbackResult::Invalid(
"There are no entry types in this integrity zome".to_string(),
))
},
_ => Ok(ValidateCallbackResult::Valid)
},
FlatOp::RegisterDelete(delete_entry) => match delete_entry {
OpDelete::Entry {
original_action,
original_app_entry,
action
} => Ok(ValidateCallbackResult::Invalid(
"There are no entry types in this integrity zome".to_string(),
)),
_ => Ok(ValidateCallbackResult::Valid),
},
FlatOp::RegisterDelete(delete_entry) => Ok(ValidateCallbackResult::Invalid(
"There are no entry types in this integrity zome".to_string(),
)),
FlatOp::RegisterCreateLink {
link_type,
base_address,
target_address,
tag,
action
} => Ok(ValidateCallbackResult::Invalid(String::from(
"There are no link types in this integrity zome",
))),
} => Ok(ValidateCallbackResult::Invalid(
"There are no link types in this integrity zome".to_string()
)),
FlatOp::RegisterDeleteLink {
link_type,
base_address,
target_address,
tag,
original_action,
action
} => Ok(ValidateCallbackResult::Invalid(String::from(
"There are no link types in this integrity zome",
))),
} => Ok(ValidateCallbackResult::Invalid("There are no link types in this integrity zome".to_string())),
FlatOp::StoreRecord(store_record) => match store_record {
/// Complementary validation to the `StoreEntry` Op, in which the record itself is validated
/// If you want to optimize performance, you can remove the validation for an entry type here and keep it in `StoreEntry`
Expand Down