@blockless/gateway-core
Advanced tools
Comparing version
@@ -146,5 +146,7 @@ "use strict"; | ||
let type = 'text/html'; | ||
if (data.result.startsWith('data:')) { | ||
const bufferData = data.result.split(',')[1]; | ||
const contentType = data.result.split(',')[0].split(':')[1].split(';')[0]; | ||
const payload = data.results && data.results.length > 0 ? data.results[0].result : data.result || ''; | ||
const payloadBody = typeof payload === 'string' ? payload : payload.stdout || payload.stderr; | ||
if (payloadBody.startsWith('data:')) { | ||
const bufferData = payloadBody.split(',')[1]; | ||
const contentType = payloadBody.split(',')[0].split(':')[1].split(';')[0]; | ||
const base64data = Buffer.from(bufferData, 'base64'); | ||
@@ -156,3 +158,3 @@ type = contentType; | ||
try { | ||
JSON.parse(data.result); | ||
JSON.parse(payloadBody); | ||
type = 'application/json'; | ||
@@ -163,3 +165,3 @@ } | ||
} | ||
body = data.result; | ||
body = payloadBody; | ||
} | ||
@@ -166,0 +168,0 @@ return { |
@@ -17,2 +17,11 @@ export interface IHeadNodePayload { | ||
result: string; | ||
results: { | ||
result: { | ||
stdout: string; | ||
stderr: string; | ||
exit_code: number; | ||
}; | ||
peerds: string[]; | ||
frequency: number; | ||
}[]; | ||
} |
@@ -38,2 +38,8 @@ import mongoose from 'mongoose'; | ||
permissions: string[]; | ||
modules: { | ||
file: string; | ||
name: string; | ||
type: string; | ||
md5: string; | ||
}[]; | ||
} | ||
@@ -40,0 +46,0 @@ export interface IFunctionEnvVarRecord { |
@@ -122,6 +122,6 @@ "use strict"; | ||
function_id: functionId, | ||
method: manifest.entry, | ||
method: manifest.modules && manifest.modules.length > 0 ? manifest.modules[0].file : manifest.entry, | ||
parameters: null, | ||
config: { | ||
permissions: [...manifest.permissions], | ||
permissions: manifest.permissions ? [...manifest.permissions] : [], | ||
env_vars: [...envVars], | ||
@@ -128,0 +128,0 @@ stdin: stdin ? stdin.value : '', |
{ | ||
"name": "@blockless/gateway-core", | ||
"version": "0.0.21", | ||
"version": "0.0.24", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
153450
0.68%2944
0.58%