Replace null values when converting bytes to string in graph-node host API (#523)

* Replace null value in strings for postgres text data type

* Upgrade package versions to 0.2.99
This commit is contained in:
2024-06-14 13:47:54 +05:30
committed by GitHub
parent 9c4b06652e
commit 981f70ec9b
15 changed files with 41 additions and 37 deletions
+5 -5
View File
@@ -1,10 +1,10 @@
{
"name": "@cerc-io/graph-node",
"version": "0.2.98",
"version": "0.2.99",
"main": "dist/index.js",
"license": "AGPL-3.0",
"devDependencies": {
"@cerc-io/solidity-mapper": "^0.2.98",
"@cerc-io/solidity-mapper": "^0.2.99",
"@ethersproject/providers": "^5.4.4",
"@graphprotocol/graph-ts": "^0.22.0",
"@nomiclabs/hardhat-ethers": "^2.0.2",
@@ -51,9 +51,9 @@
"dependencies": {
"@apollo/client": "^3.3.19",
"@cerc-io/assemblyscript": "0.19.10-watcher-ts-0.1.2",
"@cerc-io/cache": "^0.2.98",
"@cerc-io/ipld-eth-client": "^0.2.98",
"@cerc-io/util": "^0.2.98",
"@cerc-io/cache": "^0.2.99",
"@cerc-io/ipld-eth-client": "^0.2.99",
"@cerc-io/util": "^0.2.99",
"@types/json-diff": "^0.5.2",
"@types/yargs": "^17.0.0",
"bn.js": "^4.11.9",
+5 -1
View File
@@ -340,7 +340,11 @@ export const instantiate = async (
},
'typeConversion.bytesToString': async (bytes: number) => {
const byteArray = __getArray(bytes);
const string = utils.toUtf8String(byteArray, utils.Utf8ErrorFuncs.replace);
let string = utils.toUtf8String(byteArray, utils.Utf8ErrorFuncs.replace);
// Replace \x00 with empty string as Postgres DB text data type does not support it
string = string.replaceAll('\x00', '');
const ptr = await __newString(string);
return ptr;
+1 -1
View File
@@ -12,7 +12,7 @@
/* Language and Environment */
"target": "ES2019", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
"lib": ["ES2021"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */