Import upstream v0.16.22, stripped
Upstream commit: 474dd0229cb20cf513036619781ed97bd8073c3f Enterprise-only files removed or emptied: 63 Enterprise-only snippets removed: 117 in 50 files Dangling module declarations removed: 5 Cargo edits turning enterprise off: 14 Verification: clean Enterprise feature gates left for rebuilt features: 19 in 18 files Produced by tools/fork/strip.py. The full report is in docs/fork/strip-reports/ on main.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <[email protected]>
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use crate::{
|
||||
schema::{
|
||||
enums::{TracingLevel, TracingLevelOpt},
|
||||
prelude::{Object, ObjectInner, Property},
|
||||
},
|
||||
types::EnumImpl,
|
||||
};
|
||||
use std::{cmp::Ordering, fmt::Display};
|
||||
use trc::TOTAL_EVENT_COUNT;
|
||||
|
||||
#[allow(clippy::derivable_impls)]
|
||||
pub mod enums;
|
||||
pub mod enums_impl;
|
||||
pub mod prelude;
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub mod properties;
|
||||
pub mod properties_impl;
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub mod structs;
|
||||
#[allow(clippy::needless_borrows_for_generic_args)]
|
||||
#[allow(clippy::len_zero)]
|
||||
#[allow(clippy::collapsible_if)]
|
||||
#[allow(clippy::derivable_impls)]
|
||||
#[allow(clippy::field_reassign_with_default)]
|
||||
pub mod structs_impl;
|
||||
|
||||
impl Display for Property {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.as_str())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<TracingLevelOpt> for trc::Level {
|
||||
fn from(level: TracingLevelOpt) -> Self {
|
||||
match level {
|
||||
TracingLevelOpt::Error => trc::Level::Error,
|
||||
TracingLevelOpt::Warn => trc::Level::Warn,
|
||||
TracingLevelOpt::Info => trc::Level::Info,
|
||||
TracingLevelOpt::Debug => trc::Level::Debug,
|
||||
TracingLevelOpt::Trace => trc::Level::Trace,
|
||||
TracingLevelOpt::Disable => trc::Level::Disable,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<TracingLevel> for trc::Level {
|
||||
fn from(level: TracingLevel) -> Self {
|
||||
match level {
|
||||
TracingLevel::Error => trc::Level::Error,
|
||||
TracingLevel::Warn => trc::Level::Warn,
|
||||
TracingLevel::Info => trc::Level::Info,
|
||||
TracingLevel::Debug => trc::Level::Debug,
|
||||
TracingLevel::Trace => trc::Level::Trace,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl EnumImpl for trc::EventType {
|
||||
const COUNT: usize = TOTAL_EVENT_COUNT;
|
||||
|
||||
fn parse(s: &str) -> Option<Self> {
|
||||
trc::EventType::parse(s)
|
||||
}
|
||||
|
||||
fn as_str(&self) -> &'static str {
|
||||
trc::EventType::as_str(self)
|
||||
}
|
||||
|
||||
fn from_id(id: u16) -> Option<Self> {
|
||||
trc::EventType::from_id(id)
|
||||
}
|
||||
|
||||
fn to_id(&self) -> u16 {
|
||||
trc::EventType::to_id(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl EnumImpl for trc::MetricType {
|
||||
const COUNT: usize = TOTAL_EVENT_COUNT;
|
||||
|
||||
fn parse(s: &str) -> Option<Self> {
|
||||
trc::MetricType::parse(s)
|
||||
}
|
||||
|
||||
fn as_str(&self) -> &'static str {
|
||||
trc::MetricType::as_str(self)
|
||||
}
|
||||
|
||||
fn from_id(id: u16) -> Option<Self> {
|
||||
trc::MetricType::from_id(id)
|
||||
}
|
||||
|
||||
fn to_id(&self) -> u16 {
|
||||
trc::MetricType::to_id(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialOrd for Property {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for Property {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
self.to_id().cmp(&other.to_id())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Into<ObjectInner>> From<T> for Object {
|
||||
fn from(value: T) -> Self {
|
||||
Object {
|
||||
inner: value.into(),
|
||||
revision: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Object {
|
||||
pub fn new(inner: ObjectInner) -> Self {
|
||||
Object { inner, revision: 0 }
|
||||
}
|
||||
|
||||
pub fn with_revision(inner: ObjectInner, revision: u64) -> Self {
|
||||
Object { inner, revision }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Property> for String {
|
||||
fn from(value: Property) -> Self {
|
||||
value.as_str().to_string()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <[email protected]>
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
pub use crate::jmap::IntoValue;
|
||||
pub use crate::jmap::JmapValue;
|
||||
pub use crate::jmap::MaybeUnpatched;
|
||||
pub use crate::jmap::PatchResult;
|
||||
pub use crate::jmap::RegistryJsonEnumPatch;
|
||||
pub use crate::jmap::{
|
||||
JsonPointerPatch, RegistryJsonPatch, RegistryJsonPropertyPatch, patch::object_type,
|
||||
};
|
||||
pub use crate::pickle::Pickle;
|
||||
pub use crate::schema::enums::*;
|
||||
pub use crate::schema::properties::*;
|
||||
pub use crate::schema::structs::*;
|
||||
pub use crate::types::EnumImpl;
|
||||
pub use crate::types::ObjectImpl;
|
||||
pub use crate::types::datetime::UTCDateTime;
|
||||
pub use crate::types::duration::Duration;
|
||||
pub use crate::types::error::*;
|
||||
pub use crate::types::float::Float;
|
||||
pub use crate::types::index::{IndexBuilder, IndexSchema, IndexSchemaType, IndexSchemaValueType};
|
||||
pub use crate::types::ipaddr::IpAddr;
|
||||
pub use crate::types::ipmask::IpAddrOrMask;
|
||||
pub use crate::types::list::List;
|
||||
pub use crate::types::map::Map;
|
||||
pub use crate::types::socketaddr::SocketAddr;
|
||||
pub use crate::types::string::StringValidator;
|
||||
pub use serde::{Deserialize, Serialize};
|
||||
pub use std::borrow::Cow;
|
||||
pub use std::str::FromStr;
|
||||
pub use types::blob::BlobId;
|
||||
pub use types::id::Id;
|
||||
pub use utils::map::vec_map::VecMap;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Object {
|
||||
pub inner: ObjectInner,
|
||||
pub revision: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ExpressionContext<'x> {
|
||||
pub expr: &'x Expression,
|
||||
pub default: Option<Expression>,
|
||||
pub property: Property,
|
||||
pub allowed_variables: &'static [ExpressionVariable],
|
||||
pub allowed_constants: &'static [ExpressionConstant],
|
||||
}
|
||||
|
||||
pub const OBJ_SINGLETON: u64 = 1;
|
||||
pub const OBJ_SEQ_ID: u64 = 1 << 1;
|
||||
pub const OBJ_FILTER_ACCOUNT: u64 = 1 << 2;
|
||||
pub const OBJ_FILTER_TENANT: u64 = 1 << 3;
|
||||
|
||||
pub const MASKED_PASSWORD: &str = "****";
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user