Update 3rd party dependencies

Closes #1593
This commit is contained in:
Tobie Morgan Hitchcock 2023-01-14 19:28:33 +00:00
parent 5e5342ebc7
commit 8f89f8729c
10 changed files with 556 additions and 541 deletions

932
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -26,27 +26,27 @@ codegen-units = 1
[dependencies]
argon2 = "0.4.1"
base64 = "0.13.0"
bytes = "1.2.1"
chrono = { version = "0.4.22", features = ["serde"] }
clap = { version = "3.2.22", features = ["env"] }
clap = { version = "3.2.23", features = ["env"] }
base64 = "0.21.0"
bytes = "1.3.0"
chrono = { version = "0.4.23", features = ["serde"] }
fern = { version = "0.6.1", features = ["colored"] }
futures = "0.3.24"
futures = "0.3.25"
http = "0.2.8"
hyper = "0.14.20"
jsonwebtoken = "8.1.1"
hyper = "0.14.23"
jsonwebtoken = "8.2.0"
log = "0.4.17"
once_cell = "1.15.0"
once_cell = "1.17.0"
rand = "0.8.5"
reqwest = { version = "0.11.13", features = ["blocking"] }
rustyline = "10.0.0"
serde = { version = "1.0.145", features = ["derive"] }
serde = { version = "1.0.152", features = ["derive"] }
serde_cbor = "0.11.2"
serde_json = "1.0.85"
serde_json = "1.0.91"
serde_pack = { version = "1.1.1", package = "rmp-serde" }
surrealdb = { path = "lib", features = ["protocol-http", "protocol-ws", "rustls"] }
thiserror = "1.0.37"
tokio = { version = "1.21.2", features = ["macros", "signal"] }
thiserror = "1.0.38"
tokio = { version = "1.24.1", features = ["macros", "signal"] }
warp = { version = "0.3.3", features = ["compression", "tls", "websocket"] }
[package.metadata.deb]

View file

@ -55,19 +55,19 @@ argon2 = "0.4.1"
async-recursion = "1.0.0"
bcrypt = "0.13.0"
bigdecimal = { version = "0.3.0", features = ["serde", "string-only"] }
channel = { version = "1.7.1", package = "async-channel" }
chrono = { version = "0.4.22", features = ["serde"] }
channel = { version = "1.8.0", package = "async-channel" }
chrono = { version = "0.4.23", features = ["serde"] }
derive = { version = "0.5.0", package = "surrealdb-derive" }
deunicode = "1.3.2"
deunicode = "1.3.3"
dmp = "0.1.1"
echodb = { version = "0.3.0", optional = true }
executor = { version = "1.4.1", package = "async-executor" }
executor = { version = "1.5.0", package = "async-executor" }
flume = "0.10.14"
futures = "0.3.24"
futures = "0.3.25"
futures-concurrency = "7.0.0"
foundationdb = { version = "0.7.0", default-features = false, features = ["embedded-fdb-include"], optional = true }
fuzzy-matcher = "0.3.7"
geo = { version = "0.23.0", features = ["use-serde"] }
geo = { version = "0.23.1", features = ["use-serde"] }
indexmap = { version = "1.9.2", features = ["serde"] }
indxdb = { version = "0.2.0", optional = true }
lexical-sort = "0.3.1"
@ -76,22 +76,22 @@ md-5 = "0.10.5"
msgpack = { version = "1.1.1", package = "rmp-serde" }
nanoid = "0.4.0"
native-tls = { version = "0.2.11", optional = true }
nom = { version = "7.1.1", features = ["alloc"] }
once_cell = "1.16.0"
nom = { version = "7.1.2", features = ["alloc"] }
once_cell = "1.17.0"
pbkdf2 = "0.11.0"
rand = "0.8.5"
regex = "1.6.0"
regex = "1.7.1"
reqwest = { version = "0.11.13", default-features = false, features = ["json", "stream"], optional = true }
rocksdb = { version = "0.19.0", optional = true }
rustls = { version = "0.20.7", optional = true }
rustls = { version = "0.20.8", optional = true }
scrypt = "0.10.0"
semver = { version = "1.0.14", features = ["serde"] }
serde = { version = "1.0.148", features = ["derive"] }
serde_json = "1.0.89"
sha-1 = "0.10.0"
semver = { version = "1.0.16", features = ["serde"] }
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.91"
sha-1 = "0.10.1"
sha2 = "0.10.6"
storekey = "0.3.0"
thiserror = "1.0.37"
storekey = "0.4.0"
thiserror = "1.0.38"
tikv = { version = "0.1.0", package = "tikv-client", optional = true }
tokio-stream = { version = "0.1.11", optional = true }
tokio-util = { version = "0.7.4", optional = true, features = ["compat"] }
@ -115,17 +115,17 @@ features = [
[dev-dependencies]
time = { version = "0.3.17", features = ["serde"] }
tokio = { version = "1.22.0", features = ["macros", "rt", "rt-multi-thread"] }
tokio = { version = "1.24.1", features = ["macros", "rt", "rt-multi-thread"] }
ulid = { version = "1.0.0", features = ["serde"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
pharos = "0.5.3"
tokio = { version = "1.22.0", default-features = false, features = ["rt"] }
uuid = { version = "1.2.1", features = ["serde", "js", "v4", "v7"] }
tokio = { version = "1.24.1", default-features = false, features = ["rt"] }
uuid = { version = "1.2.2", features = ["serde", "js", "v4", "v7"] }
wasm-bindgen-futures = "0.4.33"
ws_stream_wasm = "0.7.3"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1.22.0", default-features = false, features = ["io-util", "fs", "rt-multi-thread"] }
tokio-tungstenite = { version = "0.17.2", optional = true }
uuid = { version = "1.2.1", features = ["serde", "v4", "v7"] }
tokio = { version = "1.24.1", default-features = false, features = ["io-util", "fs", "rt-multi-thread"] }
tokio-tungstenite = { version = "0.18.0", optional = true }
uuid = { version = "1.2.2", features = ["serde", "v4", "v7"] }

View file

@ -6,6 +6,6 @@ publish = false
[dependencies]
actix-web = { version = "4.2.1", features = ["macros"] }
serde = { version = "1.0.147", features = ["derive"] }
serde = { version = "1.0.152", features = ["derive"] }
surrealdb = { path = "../.." }
thiserror = "1.0.37"
thiserror = "1.0.38"

View file

@ -73,7 +73,7 @@ impl<'js> FromJs<'js> for Value {
if (v).is_instance_of(&date) {
let f: js::Function = v.get("getTime")?;
let m: i64 = f.call((js::This(v),))?;
let d = Utc.timestamp_millis(m);
let d = Utc.timestamp_millis_opt(m).unwrap();
return Ok(Datetime::from(d).into());
}
// Check to see if this object is an array

View file

@ -41,23 +41,35 @@ pub fn group((datetime, strand): (Value, Value)) -> Result<Value, Error> {
match datetime {
Value::Datetime(v) => match strand {
Value::Strand(g) => match g.as_str() {
"year" => Ok(Utc.ymd(v.year(), 1, 1).and_hms(0, 0, 0).into()),
"month" => Ok(Utc.ymd(v.year(), v.month(), 1).and_hms(0, 0, 0).into()),
"year" => Ok(Utc
.with_ymd_and_hms(v.year(), 1, 1, 0,0,0)
.earliest()
.unwrap()
.into()),
"month" => Ok(Utc
.with_ymd_and_hms(v.year(), v.month(), 1, 0,0,0)
.earliest()
.unwrap()
.into()),
"day" => Ok(Utc
.ymd(v.year(), v.month(), v.day())
.and_hms(0, 0, 0)
.with_ymd_and_hms(v.year(), v.month(), v.day(), 0,0,0)
.earliest()
.unwrap()
.into()),
"hour" => Ok(Utc
.ymd(v.year(), v.month(), v.day())
.and_hms(v.hour(), 0, 0)
.with_ymd_and_hms(v.year(), v.month(), v.day(), v.hour(),0,0)
.earliest()
.unwrap()
.into()),
"minute" => Ok(Utc
.ymd(v.year(), v.month(), v.day())
.and_hms(v.hour(), v.minute(), 0)
.with_ymd_and_hms(v.year(), v.month(), v.day(), v.hour(),v.minute(),0)
.earliest()
.unwrap()
.into()),
"second" => Ok(Utc
.ymd(v.year(), v.month(), v.day())
.and_hms(v.hour(), v.minute(), v.second())
.with_ymd_and_hms(v.year(), v.month(), v.day(), v.hour(), v.minute(), v.second())
.earliest()
.unwrap()
.into()),
_ => Err(Error::InvalidArguments {
name: String::from("time::group"),

View file

@ -63,4 +63,24 @@ mod tests {
let dec = Thing::decode(&enc).unwrap();
assert_eq!(val, dec);
}
#[test]
fn key_complex() {
use super::*;
//
let id1 = "['test']";
let (_, id1) = crate::sql::id::id(id1).expect("Failed to parse the ID");
let val = Thing::new("test".to_string(), "test".to_string(), "test".to_string(), id1);
let enc = Thing::encode(&val).unwrap();
let dec = Thing::decode(&enc).unwrap();
assert_eq!(val, dec);
println!("---");
//
let id2 = "['f8e238f2-e734-47b8-9a16-476b291bd78a']";
let (_, id2) = crate::sql::id::id(id2).expect("Failed to parse the ID");
let val = Thing::new("test".to_string(), "test".to_string(), "test".to_string(), id2);
let enc = Thing::encode(&val).unwrap();
let dec = Thing::decode(&enc).unwrap();
assert_eq!(val, dec);
println!("---");
}
}

View file

@ -3,7 +3,8 @@ use crate::sql::duration::Duration;
use crate::sql::error::IResult;
use crate::sql::escape::escape_str;
use crate::sql::serde::is_internal_serialization;
use chrono::{DateTime, FixedOffset, NaiveDate, Offset, SecondsFormat, TimeZone, Utc};
use chrono::{DateTime, FixedOffset, Offset, SecondsFormat, TimeZone, Utc};
use chrono::{NaiveDate, NaiveDateTime, NaiveTime};
use nom::branch::alt;
use nom::character::complete::char;
use nom::combinator::map;
@ -25,12 +26,6 @@ impl Default for Datetime {
}
}
impl From<i64> for Datetime {
fn from(v: i64) -> Self {
Self(Utc.timestamp(v, 0))
}
}
impl From<DateTime<Utc>> for Datetime {
fn from(v: DateTime<Utc>) -> Self {
Self(v)
@ -164,13 +159,17 @@ fn convert(
zone: FixedOffset,
) -> IResult<&str, Datetime> {
// Attempt to create date
let n = NaiveDate::from_ymd_opt(year, mon, day)
let d = NaiveDate::from_ymd_opt(year, mon, day)
.ok_or_else(|| Err::Error(error_position!(i, ErrorKind::Verify)))?;
// Attempt to create time
let t = NaiveTime::from_hms_nano_opt(hour, min, sec, nano)
.ok_or_else(|| Err::Error(error_position!(i, ErrorKind::Verify)))?;
//
let v = NaiveDateTime::new(d, t);
// Attempt to create time
let d = zone
.from_local_date(&n)
.unwrap()
.and_hms_nano_opt(hour, min, sec, nano)
.from_local_datetime(&v)
.earliest()
.ok_or_else(|| Err::Error(error_position!(i, ErrorKind::Verify)))?
.with_timezone(&Utc);
// This is a valid datetime
@ -237,9 +236,15 @@ fn zone_all(i: &str) -> IResult<&str, FixedOffset> {
if h == 0 && m == 0 {
Ok((i, Utc.fix()))
} else if s < 0 {
Ok((i, FixedOffset::west((h * 3600 + m * 60) as i32)))
match FixedOffset::west_opt((h * 3600 + m * 60) as i32) {
Some(v) => Ok((i, v)),
None => Err(Err::Error(error_position!(i, ErrorKind::Verify))),
}
} else if s > 0 {
Ok((i, FixedOffset::east((h * 3600 + m * 60) as i32)))
match FixedOffset::east_opt((h * 3600 + m * 60) as i32) {
Some(v) => Ok((i, v)),
None => Err(Err::Error(error_position!(i, ErrorKind::Verify))),
}
} else {
Ok((i, Utc.fix()))
}

View file

@ -1,4 +1,6 @@
use crate::err::Error;
use base64::engine::general_purpose::STANDARD as BASE64;
use base64::Engine;
use std::str;
use surrealdb::sql::json;
use surrealdb::sql::Value;
@ -7,7 +9,7 @@ pub fn parse(value: &str) -> Result<Value, Error> {
// Extract the middle part of the token
let value = value.splitn(3, '.').skip(1).take(1).next().ok_or(Error::InvalidAuth)?;
// Decode the base64 token data content
let value = base64::decode(value).map_err(|_| Error::InvalidAuth)?;
let value = BASE64.decode(value).map_err(|_| Error::InvalidAuth)?;
// Convert the decoded data to a string
let value = str::from_utf8(&value).map_err(|_| Error::InvalidAuth)?;
// Parse the token data into SurrealQL

View file

@ -7,6 +7,8 @@ use crate::iam::LOG;
use crate::iam::TOKEN;
use argon2::password_hash::{PasswordHash, PasswordVerifier};
use argon2::Argon2;
use base64::engine::general_purpose::STANDARD as BASE64;
use base64::Engine;
use chrono::Utc;
use jsonwebtoken::{decode, DecodingKey, Validation};
use once_cell::sync::Lazy;
@ -93,7 +95,7 @@ pub async fn basic(session: &mut Session, auth: String) -> Result<(), Error> {
// Get the config options
let opts = CF.get().unwrap();
// Decode the encoded auth data
let auth = base64::decode(auth)?;
let auth = BASE64.decode(auth)?;
// Convert the auth data to String
let auth = String::from_utf8(auth)?;
// Split the auth data into user and pass