From 0d5a180d5628f8d4ddae4a567190f11910583682 Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Thu, 2 Jun 2022 09:38:56 -0400 Subject: [PATCH 1/2] fix: decodehex issue with null string --- src/utils/datalayer-utils.js | 66 ++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/utils/datalayer-utils.js b/src/utils/datalayer-utils.js index 6ff77ad7..62665dac 100644 --- a/src/utils/datalayer-utils.js +++ b/src/utils/datalayer-utils.js @@ -1,33 +1,33 @@ -export const encodeHex = (str) => { - return Buffer.from(str).toString('hex'); -}; - -export const decodeHex = (str) => { - return Buffer.from(str.replace('0x', ''), 'hex').toString(); -}; - -export const decodeDataLayerResponse = (data) => { - return data.keys_values.map((item) => ({ - key: decodeHex(item.key), - value: decodeHex(item.value), - })); -}; - -export const keyValueToChangeList = (key, value, includeDelete) => { - const changeList = []; - - if (includeDelete) { - changeList.push({ - action: 'delete', - key: encodeHex(key), - }); - } - - changeList.push({ - action: 'insert', - key: encodeHex(key), - value: encodeHex(value), - }); - - return changeList; -}; +export const encodeHex = (str) => { + return Buffer.from(str).toString('hex'); +}; + +export const decodeHex = (str = '') => { + return Buffer.from(str.replace('0x', ''), 'hex').toString(); +}; + +export const decodeDataLayerResponse = (data) => { + return data.keys_values.map((item) => ({ + key: decodeHex(item.key), + value: decodeHex(item.value), + })); +}; + +export const keyValueToChangeList = (key, value, includeDelete) => { + const changeList = []; + + if (includeDelete) { + changeList.push({ + action: 'delete', + key: encodeHex(key), + }); + } + + changeList.push({ + action: 'insert', + key: encodeHex(key), + value: encodeHex(value), + }); + + return changeList; +}; From ce0824c7d35a91c8d68d8201e7e834916ebf025c Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Thu, 2 Jun 2022 10:57:26 -0400 Subject: [PATCH 2/2] chore(release): 1.0.8 --- package.json | 204 +++++++++++++++++++++++++-------------------------- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/package.json b/package.json index a94f2f83..ab118063 100644 --- a/package.json +++ b/package.json @@ -1,102 +1,102 @@ -{ - "name": "climate-warehouse", - "version": "1.0.7", - "private": true, - "bin": "build/server.js", - "type": "module", - "engines": { - "node": ">=16.0.0" - }, - "scripts": { - "requirements-check": "node --experimental-json-modules check_node_version.js", - "start": "npx cross-env NODE_ENV=local node --experimental-specifier-resolution=node --no-warnings ./src/server.js", - "test": "npm run resetTestDb && npx cross-env NODE_ENV=test USE_SIMULATOR=true mocha tests/**/*.spec.js --reporter spec --exit --timeout 300000", - "release": "npx standard-version", - "postinstall": "npm run requirements-check", - "cleandb": "rm -f ~/.chia/climate-warehouse/data.sqlite3", - "resetTestDb": "rm -f ./test.sqlite3 && rm -f ./testMirror.sqlite3", - "resetMirrorDb": "npx sequelize-cli db:drop --env mirror", - "prepare": "husky install", - "build": "babel src --keep-file-extension --out-dir build --copy-files && cp package.json ./build", - "build-migrations": "babel migrations --keep-file-extension --out-dir dist/migrations --copy-files", - "prepare-binary": "rm -rf dist && mkdir dist", - "create-win-x64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node16-win-x64 --out-path dist", - "create-mac-x64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node16-macos-x64 --out-path dist", - "create-linux-x64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node16-linux-x64 --out-path dist" - }, - "pkg": { - "scripts": "package.json", - "assets": "package.json" - }, - "dependencies": { - "body-parser": "^1.19.0", - "char-spinner": "^1.0.1", - "cli-spinner": "^0.2.10", - "cli-spinners": "^2.6.1", - "cors": "^2.8.5", - "csvtojson": "^2.0.10", - "dotenv": "^10.0.0", - "express": "~4.16.1", - "express-fileupload": "^1.2.1", - "express-joi-validation": "^5.0.0", - "joi": "^17.5.0", - "js-yaml": "^4.1.0", - "lodash": "^4.17.21", - "log-update": "^4.0.0", - "mysql2": "^2.3.3", - "mysql2-promise": "^0.1.4", - "node-xlsx": "^0.21.0", - "random-hash": "^4.0.1", - "regenerator-runtime": "^0.13.9", - "request-promise": "^4.2.6", - "rxjs": "^7.5.1", - "sequelize": "^6.17.0", - "sequelize-mock": "^0.10.2", - "socket.io": "^4.4.0", - "socket.io-client": "^4.4.0", - "sqlite3": "4.1.1", - "toad-scheduler": "^1.6.0", - "updeep": "^1.2.1", - "uuidv4": "^6.2.12", - "winston": "^3.7.2", - "winston-daily-rotate-file": "^4.6.1" - }, - "devDependencies": { - "@babel/cli": "^7.16.0", - "@babel/core": "^7.16.0", - "@babel/preset-env": "^7.16.4", - "@commitlint/cli": "^14.1.0", - "@commitlint/config-conventional": "^14.1.0", - "babel-eslint": "^10.1.0", - "babel-plugin-module-resolver": "^4.1.0", - "chai": "^4.3.4", - "chai-http": "^4.3.0", - "eslint-plugin-mocha": "^9.0.0", - "eslint-plugin-react": "^7.26.1", - "git-authors-cli": "^1.0.36", - "husky": "^7.0.4", - "jest": "^27.3.1", - "lint-staged": "^11.2.6", - "mocha": "^9.2.0", - "prettier": "^2.4.1", - "semver": "^7.3.5", - "sinon": "^12.0.1", - "standard-version": "^9.3.2", - "supertest": "^6.1.6" - }, - "standard-version": { - "skip": { - "bump": true, - "commit": true, - "tag": true - } - }, - "contributors": [ - "Michael Taylor <5665004+MichaelTaylor3D@users.noreply.github.com>", - "Mike Keen ", - "Michael.Taylor ", - "Frantz Arty ", - "Chris Marslender ", - "Justin England " - ] -} +{ + "name": "climate-warehouse", + "version": "1.0.8", + "private": true, + "bin": "build/server.js", + "type": "module", + "engines": { + "node": ">=16.0.0" + }, + "scripts": { + "requirements-check": "node --experimental-json-modules check_node_version.js", + "start": "npx cross-env NODE_ENV=local node --experimental-specifier-resolution=node --no-warnings ./src/server.js", + "test": "npm run resetTestDb && npx cross-env NODE_ENV=test USE_SIMULATOR=true mocha tests/**/*.spec.js --reporter spec --exit --timeout 300000", + "release": "npx standard-version", + "postinstall": "npm run requirements-check", + "cleandb": "rm -f ~/.chia/climate-warehouse/data.sqlite3", + "resetTestDb": "rm -f ./test.sqlite3 && rm -f ./testMirror.sqlite3", + "resetMirrorDb": "npx sequelize-cli db:drop --env mirror", + "prepare": "husky install", + "build": "babel src --keep-file-extension --out-dir build --copy-files && cp package.json ./build", + "build-migrations": "babel migrations --keep-file-extension --out-dir dist/migrations --copy-files", + "prepare-binary": "rm -rf dist && mkdir dist", + "create-win-x64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node16-win-x64 --out-path dist", + "create-mac-x64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node16-macos-x64 --out-path dist", + "create-linux-x64-dist": "npm run build && npm run prepare-binary && pkg package.json -t node16-linux-x64 --out-path dist" + }, + "pkg": { + "scripts": "package.json", + "assets": "package.json" + }, + "dependencies": { + "body-parser": "^1.19.0", + "char-spinner": "^1.0.1", + "cli-spinner": "^0.2.10", + "cli-spinners": "^2.6.1", + "cors": "^2.8.5", + "csvtojson": "^2.0.10", + "dotenv": "^10.0.0", + "express": "~4.16.1", + "express-fileupload": "^1.2.1", + "express-joi-validation": "^5.0.0", + "joi": "^17.5.0", + "js-yaml": "^4.1.0", + "lodash": "^4.17.21", + "log-update": "^4.0.0", + "mysql2": "^2.3.3", + "mysql2-promise": "^0.1.4", + "node-xlsx": "^0.21.0", + "random-hash": "^4.0.1", + "regenerator-runtime": "^0.13.9", + "request-promise": "^4.2.6", + "rxjs": "^7.5.1", + "sequelize": "^6.17.0", + "sequelize-mock": "^0.10.2", + "socket.io": "^4.4.0", + "socket.io-client": "^4.4.0", + "sqlite3": "4.1.1", + "toad-scheduler": "^1.6.0", + "updeep": "^1.2.1", + "uuidv4": "^6.2.12", + "winston": "^3.7.2", + "winston-daily-rotate-file": "^4.6.1" + }, + "devDependencies": { + "@babel/cli": "^7.16.0", + "@babel/core": "^7.16.0", + "@babel/preset-env": "^7.16.4", + "@commitlint/cli": "^14.1.0", + "@commitlint/config-conventional": "^14.1.0", + "babel-eslint": "^10.1.0", + "babel-plugin-module-resolver": "^4.1.0", + "chai": "^4.3.4", + "chai-http": "^4.3.0", + "eslint-plugin-mocha": "^9.0.0", + "eslint-plugin-react": "^7.26.1", + "git-authors-cli": "^1.0.36", + "husky": "^7.0.4", + "jest": "^27.3.1", + "lint-staged": "^11.2.6", + "mocha": "^9.2.0", + "prettier": "^2.4.1", + "semver": "^7.3.5", + "sinon": "^12.0.1", + "standard-version": "^9.3.2", + "supertest": "^6.1.6" + }, + "standard-version": { + "skip": { + "bump": true, + "commit": true, + "tag": true + } + }, + "contributors": [ + "Michael Taylor <5665004+MichaelTaylor3D@users.noreply.github.com>", + "Mike Keen ", + "Michael.Taylor ", + "Frantz Arty ", + "Chris Marslender ", + "Justin England " + ] +}