feat: upgrade dependencies

This commit is contained in:
Stefan
2024-05-24 16:22:44 +02:00
parent 1f25e503a0
commit f347e1ebe5
6 changed files with 29 additions and 28 deletions
+13 -13
View File
@@ -6,31 +6,31 @@ members = [
]
[workspace.dependencies]
ahash = "0.8.6"
async-trait = "0.1.77"
ahash = "0.8.11"
async-trait = "0.1.80"
bincode = "2.0.0-rc.3"
bumpalo = "3.14.0"
chrono = "0.4.31"
bumpalo = "3.16.0"
chrono = "0.4.38"
criterion = "0.5.1"
fastrand = "2.0.1"
fastrand = "2.1.0"
futures = "0.3.30"
humantime = "2.1.0"
once_cell = "1.19.0"
petgraph = "0.6.4"
petgraph = "0.6.5"
phf = "0.11.2"
regex = "1.10.2"
regex = "1.10.4"
regex-lite = "0.1.5"
strum = "0.26.2"
strum_macros = "0.26.2"
serde = "1.0.195"
serde_json = "1.0.111"
serde = "1.0.202"
serde_json = "1.0.117"
itertools = "0.13.0"
rust_decimal = "1.33.1"
rust_decimal_macros = "1.33.1"
rust_decimal = "1.35.0"
rust_decimal_macros = "1.34.2"
json_dotpath = "1.1.0"
anyhow = "1.0.79"
thiserror = "1.0.50"
anyhow = "1.0.86"
thiserror = "1.0.61"
[profile.release]
lto = true
+1 -1
View File
@@ -23,7 +23,7 @@ once_cell = { workspace = true }
json_dotpath = { workspace = true }
fixedbitset = "0.4.2"
futures = { workspace = true }
rquickjs = { version = "0.4.3", features = ["macro", "loader", "rust-alloc"] }
rquickjs = { version = "0.6.2", features = ["macro", "loader", "rust-alloc"] }
itertools = { workspace = true }
zen-expression = { path = "../expression", version = "0.22.0" }
zen-tmpl = { path = "../template", version = "0.22.0" }
@@ -82,6 +82,7 @@ impl<'js> FromJs<'js> for JsValue {
Type::Constructor => json!("[Constructor]"),
Type::Symbol => json!("[Symbol]"),
Type::Unknown => json!("[Unknown]"),
Type::Promise => json!("[Promise]"),
};
Ok(JsValue(computed_value))
+9 -10
View File
@@ -1,7 +1,7 @@
use std::fmt::Debug;
use anyhow::Context as _;
use rquickjs::{Context, Ctx, Error as QError, FromJs, Runtime};
use rquickjs::{Context, Ctx, Error as QError, FromJs, Module, Runtime};
use serde::{Deserialize, Serialize};
use serde_json::Value;
@@ -34,15 +34,14 @@ impl Script {
serde_json::to_string(args).context("Failed to serialize function arguments")?;
let json_response = context.with(|ctx| -> anyhow::Result<String> {
let _ = ctx
.clone()
.compile("main", "import 'internals'; globalThis.now = Date.now();")
.map_err(|e| map_js_error(&ctx, e))?;
let _ = ctx
.globals()
.set("log", Vec::<isize>::new())
.map_err(|e| map_js_error(&ctx, e))?;
Module::evaluate(
ctx.clone(),
"main",
"import 'internals'; globalThis.now = Date.now(); globalThis.log = [];",
)
.map_err(|e| map_js_error(&ctx, e))?
.finish::<()>()
.map_err(|e| map_js_error(&ctx, e))?;
ctx.eval::<String, _>(format!("{source};main({args_str})"))
.map_err(|e| map_js_error(&ctx, e))
+3 -2
View File
@@ -1,7 +1,7 @@
pub use crate::variable::map::BumpMap;
pub use bumpalo::collections::Vec as BumpVec;
use bumpalo::Bump;
use chrono::NaiveDateTime;
use chrono::{DateTime, NaiveDateTime};
use rust_decimal::prelude::ToPrimitive;
use rust_decimal::Decimal;
use serde_json::{Number, Value};
@@ -163,13 +163,14 @@ impl TryFrom<&Variable<'_>> for NaiveDateTime {
fn try_from(value: &Variable<'_>) -> Result<Self, Self::Error> {
match value {
Variable::String(a) => date_time(a),
Variable::Number(a) => NaiveDateTime::from_timestamp_opt(
Variable::Number(a) => DateTime::from_timestamp(
a.to_i64().ok_or_else(|| VMError::OpcodeErr {
opcode: "DateManipulation".into(),
message: "Failed to extract date".into(),
})?,
0,
)
.map(|t| t.naive_utc())
.ok_or_else(|| VMError::ParseDateTimeErr {
timestamp: a.to_string(),
}),
+2 -2
View File
@@ -1113,7 +1113,7 @@ impl<'arena, 'parent_ref, 'bytecode_ref> VMInner<'arena, 'parent_ref, 'bytecode_
message: "Failed to run DateFunction".into(),
})?;
self.push(Number(s.timestamp().into()));
self.push(Number(s.and_utc().timestamp().into()));
}
Opcode::Slice => {
let from_var = self.pop()?;
@@ -1233,7 +1233,7 @@ impl<'arena, 'parent_ref, 'bytecode_ref> VMInner<'arena, 'parent_ref, 'bytecode_
Opcode::ParseDateTime => {
let a = self.pop()?;
let ts = match a {
String(a) => date_time(a)?.timestamp(),
String(a) => date_time(a)?.and_utc().timestamp(),
Number(a) => a.to_i64().ok_or_else(|| OpcodeErr {
opcode: "ParseDateTime".into(),
message: "Number overflow".into(),