chia-changelist-generator
Advanced tools
Comparing version 1.0.9 to 1.0.10
27
index.js
@@ -23,3 +23,3 @@ const Datalayer = require("chia-datalayer"); | ||
const isValidHexadecimal = (value) => { | ||
const isValidHexadecimal = (value) => { | ||
if (value?.startsWith("0x")) { | ||
@@ -37,8 +37,11 @@ value = value.slice(2); | ||
if (action == 'insert' && !isValidHexadecimal(value)) { | ||
throw new Error( | ||
`Value for ${key} is not a valid hexadecimal string` | ||
); | ||
if (action == "insert" && !isValidHexadecimal(value)) { | ||
throw new Error(`Value for ${key} is not a valid hexadecimal string`); | ||
} | ||
// Update doesnt require knowledge of existing keys | ||
if (action === "upsert") { | ||
return generateUpsertChange(key, value); | ||
} | ||
const existingKeys = await datalayer.getKeys({ id: storeId }); | ||
@@ -55,2 +58,16 @@ | ||
const generateUpsertChange = async (existingKeys, key) => { | ||
const change = []; | ||
console.log(`Upsert: Key ${decodeHex(key)}`); | ||
change.push({ | ||
action: "upsert", | ||
key: key, | ||
value: value, | ||
}); | ||
return change; | ||
}; | ||
const generateInsertChange = (existingKeys, key, value) => { | ||
@@ -57,0 +74,0 @@ const change = []; |
{ | ||
"name": "chia-changelist-generator", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "Easily Generate a ChangeList for Chia DataLayer", | ||
@@ -23,5 +23,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"chia-changelist-chunks": "^1.0.16", | ||
"chia-datalayer": "^2.0.10" | ||
"chia-changelist-chunks": "^1.0.13", | ||
"chia-datalayer": "^2.0.9" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29806
13
859
1
Updatedchia-datalayer@^2.0.9