Skip to content
This repository has been archived by the owner on Sep 15, 2020. It is now read-only.

Typos in hcdev init #775

Open
mitra42 opened this issue Sep 24, 2018 · 3 comments
Open

Typos in hcdev init #775

mitra42 opened this issue Sep 24, 2018 · 3 comments

Comments

@mitra42
Copy link

mitra42 commented Sep 24, 2018

sampleZome.js as created by "hsdev init” (I’m not sure where the source for this is), has at least one typo “additonal” => “additional”.

There may be others, I didn’t proof read (not sure if you care about things like this :-) it just jumped out because my spellchecker caught it.

@maackle
Copy link
Member

maackle commented Sep 25, 2018

Thanks for pointing this out, and feel free to make a PR if you want to help clean up typos!

@mitra42
Copy link
Author

mitra42 commented Sep 26, 2018

I'd be happy to, except I couldnt find the source code.

@maackle
Copy link
Member

maackle commented Sep 26, 2018

I just searched for "additonal" in this repository to find it:

"Code": "/*******************************************************************************\n * Utility functions\n ******************************************************************************/\n\n/**\n * Is this a valid entry type?\n *\n * @param {any} entryType The data to validate as an expected entryType.\n * @return {boolean} true if the passed argument is a valid entryType.\n */\nfunction isValidEntryType (entryType) {\n // Add additonal entry types here as they are added to dna.json.\n return [\"sampleEntry\"].includes(entryType);\n}\n\n/**\n * Returns the creator of an entity, given an entity hash.\n *\n * @param {string} hash The entity hash.\n * @return {string} The agent hash of the entity creator.\n */\nfunction getCreator (hash) {\n return get(hash, { GetMask: HC.GetMask.Sources })[0];\n}\n\n/*******************************************************************************\n * Required callbacks\n ******************************************************************************/\n\n/**\n * System genesis callback: Can the app start?\n *\n * Executes just after the initial genesis entries are committed to your chain\n * (1st - DNA entry, 2nd Identity entry). Enables you specify any additional\n * operations you want performed when a node joins your holochain.\n *\n * @return {boolean} true if genesis is successful and so the app may start.\n *\n * @see https://developer.holochain.org/API#genesis\n */\nfunction genesis () {\n return true;\n}\n\n/**\n * Validation callback: Can this entry be committed to a source chain?\n *\n * @param {string} entryType Type of the entry as per DNA config for this zome.\n * @param {string|object} entry Data with type as per DNA config for this zome.\n * @param {Header-object} header Header object for this entry.\n * @param {Package-object|null} pkg Package object for this entry, if exists.\n * @param {string[]} sources Array of agent hashes involved in this commit.\n * @return {boolean} true if this entry may be committed to a source chain.\n *\n * @see https://developer.holochain.org/API#validateCommit_entryType_entry_header_package_sources\n * @see https://developer.holochain.org/Validation_Functions\n */\nfunction validateCommit (entryType, entry, header, pkg, sources) {\n return isValidEntryType(entryType);\n}\n\n/**\n * Validation callback: Can this entry be committed to the DHT on any node?\n *\n * It is very likely that this validation routine should check the same data\n * integrity as validateCommit, but, as it happens during a different part of\n * the data life-cycle, it may require additional validation steps.\n *\n * This function will only get called on entry types with \"public\" sharing, as\n * they are the only types that get put to the DHT by the system.\n *\n * @param {string} entryType Type of the entry as per DNA config for this zome.\n * @param {string|object} entry Data with type as per DNA config for this zome.\n * @param {Header-object} header Header object for this entry.\n * @param {Package-object|null} pkg Package object for this entry, if exists.\n * @param {string[]} sources Array of agent hashes involved in this commit.\n * @return {boolean} true if this entry may be committed to the DHT.\n *\n * @see https://developer.holochain.org/API#validatePut_entryType_entry_header_package_sources\n * @see https://developer.holochain.org/Validation_Functions\n */\nfunction validatePut (entryType, entry, header, pkg, sources) {\n return validateCommit(entryType, entry, header, pkg, sources);\n}\n\n/**\n * Validation callback: Can this entry be modified?\n *\n * Validate that this entry can replace 'replaces' due to 'mod'.\n *\n * @param {string} entryType Type of the entry as per DNA config for this zome.\n * @param {string|object} entry Data with type as per DNA config for this zome.\n * @param {Header-object} header Header object for this entry.\n * @param {string} replaces The hash string of the entry being replaced.\n * @param {Package-object|null} pkg Package object for this entry, if exists.\n * @param {string[]} sources Array of agent hashes involved in this mod.\n * @return {boolean} true if this entry may replace 'replaces'.\n *\n * @see https://developer.holochain.org/API#validateMod_entryType_entry_header_replaces_package_sources\n * @see https://developer.holochain.org/Validation_Functions\n */\nfunction validateMod (entryType, entry, header, replaces, pkg, sources) {\n return validateCommit(entryType, entry, header, pkg, sources)\n // Only allow the creator of the entity to modify it.\n && getCreator(header.EntryLink) === getCreator(replaces);\n}\n\n/**\n * Validation callback: Can this entry be deleted?\n *\n * @param {string} entryType Name of the entry as per DNA config for this zome.\n * @param {string} hash The hash of the entry to be deleted.\n * @param {Package-object|null} pkg Package object for this entry, if exists.\n * @param {string[]} sources Array of agent hashes involved in this delete.\n * @return {boolean} true if this entry can be deleted.\n *\n * @see https://developer.holochain.org/API#validateDel_entryType_hash_package_sources\n * @see https://developer.holochain.org/Validation_Functions\n */\nfunction validateDel (entryType, hash, pkg, sources) {\n return isValidEntryType(entryType)\n // Only allow the creator of the entity to delete it.\n && getCreator(hash) === sources[0];\n}\n\n/**\n * Package callback: The package request for validateCommit() and valdiatePut().\n *\n * Both 'commit' and 'put' trigger 'validatePutPkg' as 'validateCommit' and\n * 'validatePut' must both have the same data.\n *\n * @param {string} entryType Name of the entry as per DNA config for this zome.\n * @return {PkgReq-object|null}\n * null if the data required is the Entry and Header.\n * Otherwise a \"Package Request\" object, which specifies what data to be sent\n * to the validating node.\n *\n * @see https://developer.holochain.org/API#validatePutPkg_entryType\n * @see https://developer.holochain.org/Validation_Packaging\n */\nfunction validatePutPkg (entryType) {\n return null;\n}\n\n/**\n * Package callback: The package request for validateMod().\n *\n * @param {string} entryType Name of the entry as per DNA config for this zome.\n * @return {PkgReq-object|null}\n * null if the data required is the Entry and Header.\n * Otherwise a \"Package Request\" object, which specifies what data to be sent\n * to the validating node.\n *\n * @see https://developer.holochain.org/API#validateModPkg_entryType\n * @see https://developer.holochain.org/Validation_Packaging\n */\nfunction validateModPkg (entryType) {\n return null;\n}\n\n/**\n * Package callback: The package request for validateDel().\n *\n * @param {string} entryType Name of the entry as per DNA config for this zome.\n * @return {PkgReq-object|null}\n * null if the data required is the Entry and Header.\n * Otherwise a \"Package Request\" object, which specifies what data to be sent\n * to the validating node.\n *\n * @see https://developer.holochain.org/API#validateDelPkg_entryType\n * @see https://developer.holochain.org/Validation_Packaging\n */\nfunction validateDelPkg (entryType) {\n return null;\n}"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants