mirror of
https://github.com/gorules/zen.git
synced 2026-10-04 00:02:18 +00:00
fix: function data pass; (#80)
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
use anyhow::{anyhow, Context};
|
||||
use std::fmt::Debug;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::handler::function::vm::BASE_VM;
|
||||
use anyhow::{anyhow, Context};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::handler::function::vm::BASE_VM;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct EvaluateResponse {
|
||||
@@ -90,6 +91,9 @@ impl Script {
|
||||
return Err(anyhow!(exception.to_rust_string_lossy(tc_scope)));
|
||||
};
|
||||
|
||||
serde_v8::from_v8(tc_scope, result).context("Failed to parse function result")
|
||||
let result_string: String =
|
||||
serde_v8::from_v8(tc_scope, result).context("Failed to parse function result")?;
|
||||
|
||||
serde_json::from_str(result_string.as_str()).context("Failed to parse function result")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ const console = {
|
||||
}
|
||||
};
|
||||
|
||||
const main = (input) => ({
|
||||
const main = (input) => JSON.stringify({
|
||||
output: handler(input, {moment: __GLOBAL__DAYJS, dayjs: __GLOBAL__DAYJS, Big: Big, env: __GLOBAL__ENV}),
|
||||
log,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user