chore (backend-rs): organize imports
This commit is contained in:
parent
642c4cb2c7
commit
97765209a2
21 changed files with 72 additions and 72 deletions
16
packages/backend-rs/index.d.ts
vendored
16
packages/backend-rs/index.d.ts
vendored
|
@ -1375,16 +1375,10 @@ export enum PushNotificationKind {
|
|||
}
|
||||
export function sendPushNotification(receiverUserId: string, kind: PushNotificationKind, content: any): Promise<void>
|
||||
export function publishToChannelStream(channelId: string, userId: string): Promise<void>
|
||||
export enum ChatEvent {
|
||||
Message = 'message',
|
||||
Read = 'read',
|
||||
Deleted = 'deleted',
|
||||
Typing = 'typing'
|
||||
}
|
||||
export function publishToChatStream(senderUserId: string, receiverUserId: string, kind: ChatEvent, object: any): Promise<void>
|
||||
export enum ChatIndexEvent {
|
||||
Message = 'message',
|
||||
Read = 'read'
|
||||
Message = 0,
|
||||
Read = 1
|
||||
}
|
||||
export function publishToChatIndexStream(userId: string, kind: ChatIndexEvent, object: any): Promise<void>
|
||||
export interface PackedEmoji {
|
||||
|
@ -1407,6 +1401,12 @@ export interface AbuseUserReportLike {
|
|||
comment: string
|
||||
}
|
||||
export function publishToModerationStream(moderatorId: string, report: AbuseUserReportLike): Promise<void>
|
||||
export enum ChatEvent {
|
||||
Message = 0,
|
||||
Read = 1,
|
||||
Deleted = 2,
|
||||
Typing = 3
|
||||
}
|
||||
export function getTimestamp(id: string): number
|
||||
/**
|
||||
* The generated ID results in the form of `[8 chars timestamp] + [cuid2]`.
|
||||
|
|
|
@ -310,7 +310,7 @@ if (!nativeBinding) {
|
|||
throw new Error(`Failed to load native binding`)
|
||||
}
|
||||
|
||||
const { SECOND, MINUTE, HOUR, DAY, USER_ONLINE_THRESHOLD, USER_ACTIVE_THRESHOLD, FILE_TYPE_BROWSERSAFE, loadEnv, fetchMeta, updateMetaCache, metaToPugArgs, loadConfig, stringToAcct, acctToString, fetchNodeinfo, nodeinfo_2_1, nodeinfo_2_0, Protocol, Inbound, Outbound, greet, initializeRustLogger, showServerInfo, isBlockedServer, isSilencedServer, isAllowedServer, checkWordMute, getFullApAccount, isSelfHost, isSameOrigin, extractHost, toPuny, isUnicodeEmoji, sqlLikeEscape, safeForSql, formatMilliseconds, getImageSizeFromUrl, getNoteSummary, isQuote, isSafeUrl, latestVersion, toMastodonId, fromMastodonId, nyaify, hashPassword, verifyPassword, isOldPasswordAlgorithm, decodeReaction, countReactions, toDbReaction, removeOldAttestationChallenges, cpuInfo, cpuUsage, memoryUsage, storageUsage, AntennaSrc, DriveFileUsageHint, MutedNoteReason, NoteVisibility, NotificationType, PageVisibility, PollNoteVisibility, RelayStatus, UserEmojiModPerm, UserProfileFfvisibility, UserProfileMutingNotificationTypes, updateAntennasOnNewNote, watchNote, unwatchNote, PushNotificationKind, sendPushNotification, publishToChannelStream, ChatEvent, publishToChatStream, ChatIndexEvent, publishToChatIndexStream, publishToBroadcastStream, publishToGroupChatStream, publishToModerationStream, getTimestamp, genId, genIdAt, generateSecureRandomString, generateUserToken } = nativeBinding
|
||||
const { SECOND, MINUTE, HOUR, DAY, USER_ONLINE_THRESHOLD, USER_ACTIVE_THRESHOLD, FILE_TYPE_BROWSERSAFE, loadEnv, fetchMeta, updateMetaCache, metaToPugArgs, loadConfig, stringToAcct, acctToString, fetchNodeinfo, nodeinfo_2_1, nodeinfo_2_0, Protocol, Inbound, Outbound, greet, initializeRustLogger, showServerInfo, isBlockedServer, isSilencedServer, isAllowedServer, checkWordMute, getFullApAccount, isSelfHost, isSameOrigin, extractHost, toPuny, isUnicodeEmoji, sqlLikeEscape, safeForSql, formatMilliseconds, getImageSizeFromUrl, getNoteSummary, isQuote, isSafeUrl, latestVersion, toMastodonId, fromMastodonId, nyaify, hashPassword, verifyPassword, isOldPasswordAlgorithm, decodeReaction, countReactions, toDbReaction, removeOldAttestationChallenges, cpuInfo, cpuUsage, memoryUsage, storageUsage, AntennaSrc, DriveFileUsageHint, MutedNoteReason, NoteVisibility, NotificationType, PageVisibility, PollNoteVisibility, RelayStatus, UserEmojiModPerm, UserProfileFfvisibility, UserProfileMutingNotificationTypes, updateAntennasOnNewNote, watchNote, unwatchNote, PushNotificationKind, sendPushNotification, publishToChannelStream, publishToChatStream, ChatIndexEvent, publishToChatIndexStream, publishToBroadcastStream, publishToGroupChatStream, publishToModerationStream, ChatEvent, getTimestamp, genId, genIdAt, generateSecureRandomString, generateUserToken } = nativeBinding
|
||||
|
||||
module.exports.SECOND = SECOND
|
||||
module.exports.MINUTE = MINUTE
|
||||
|
@ -384,13 +384,13 @@ module.exports.unwatchNote = unwatchNote
|
|||
module.exports.PushNotificationKind = PushNotificationKind
|
||||
module.exports.sendPushNotification = sendPushNotification
|
||||
module.exports.publishToChannelStream = publishToChannelStream
|
||||
module.exports.ChatEvent = ChatEvent
|
||||
module.exports.publishToChatStream = publishToChatStream
|
||||
module.exports.ChatIndexEvent = ChatIndexEvent
|
||||
module.exports.publishToChatIndexStream = publishToChatIndexStream
|
||||
module.exports.publishToBroadcastStream = publishToBroadcastStream
|
||||
module.exports.publishToGroupChatStream = publishToGroupChatStream
|
||||
module.exports.publishToModerationStream = publishToModerationStream
|
||||
module.exports.ChatEvent = ChatEvent
|
||||
module.exports.getTimestamp = getTimestamp
|
||||
module.exports.genId = genId
|
||||
module.exports.genIdAt = genIdAt
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
//! Server information
|
||||
|
||||
use crate::database::db_conn;
|
||||
use crate::model::entity::meta;
|
||||
use crate::{database::db_conn, model::entity::meta};
|
||||
use sea_orm::{prelude::*, ActiveValue};
|
||||
use std::sync::Mutex;
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
use once_cell::sync::Lazy;
|
||||
use serde::Deserialize;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::{env, fs};
|
||||
|
||||
pub const VERSION: &str = macro_rs::read_version_from_package_json!();
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use std::fmt;
|
||||
use std::str::FromStr;
|
||||
use std::{fmt, str::FromStr};
|
||||
|
||||
#[cfg_attr(test, derive(Debug, PartialEq))]
|
||||
#[crate::export(object)]
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
//!
|
||||
//! ref: <https://nodeinfo.diaspora.software/protocol.html>
|
||||
|
||||
use crate::federation::nodeinfo::schema::*;
|
||||
use crate::util::http_client;
|
||||
use crate::{federation::nodeinfo::schema::*, util::http_client};
|
||||
use isahc::AsyncReadResponseExt;
|
||||
use serde::Deserialize;
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
//! NodeInfo generator
|
||||
|
||||
use crate::config::{local_server_info, CONFIG};
|
||||
use crate::database::{cache, db_conn};
|
||||
use crate::federation::nodeinfo::schema::*;
|
||||
use crate::model::entity::{note, user};
|
||||
use sea_orm::{ColumnTrait, DbErr, EntityTrait, PaginatorTrait, QueryFilter};
|
||||
use crate::{
|
||||
config::{local_server_info, CONFIG},
|
||||
database::{cache, db_conn},
|
||||
federation::nodeinfo::schema::*,
|
||||
model::entity::{note, user},
|
||||
};
|
||||
use sea_orm::prelude::*;
|
||||
use serde_json::json;
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use crate::database::cache;
|
||||
use crate::util::http_client;
|
||||
use crate::{database::cache, util::http_client};
|
||||
use image::{io::Reader, ImageError, ImageFormat};
|
||||
use isahc::ReadResponseExt;
|
||||
use nom_exif::{parse_jpeg_exif, EntryValue, ExifTag};
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
use crate::database::db_conn;
|
||||
use crate::model::entity::{drive_file, note};
|
||||
use crate::{
|
||||
database::db_conn,
|
||||
model::entity::{drive_file, note},
|
||||
};
|
||||
use sea_orm::{prelude::*, QuerySelect};
|
||||
|
||||
#[crate::export(object)]
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
//! Fetch latest Firefish version from the Firefish repository
|
||||
|
||||
use crate::database::cache;
|
||||
use crate::util::http_client;
|
||||
use crate::{database::cache, util::http_client};
|
||||
use isahc::ReadResponseExt;
|
||||
use serde::Deserialize;
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
use crate::config::local_server_info;
|
||||
use crate::database::db_conn;
|
||||
use crate::model::entity::emoji;
|
||||
use crate::{config::local_server_info, database::db_conn, model::entity::emoji};
|
||||
use once_cell::sync::Lazy;
|
||||
use regex::Regex;
|
||||
use sea_orm::prelude::*;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// TODO: We want to get rid of this
|
||||
|
||||
use crate::database::db_conn;
|
||||
use crate::model::entity::attestation_challenge;
|
||||
use crate::{database::db_conn, model::entity::attestation_challenge};
|
||||
use chrono::{Duration, Utc};
|
||||
use sea_orm::prelude::*;
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use crate::config::CONFIG;
|
||||
use crate::database::{cache, db_conn};
|
||||
use crate::federation::acct::Acct;
|
||||
use crate::model::entity::{antenna, blocking, following, note, sea_orm_active_enums::*};
|
||||
use crate::{
|
||||
config::CONFIG,
|
||||
database::{cache, db_conn},
|
||||
federation::acct::Acct,
|
||||
model::entity::{antenna, blocking, following, note, sea_orm_active_enums::*},
|
||||
};
|
||||
use sea_orm::{prelude::*, QuerySelect};
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
use crate::database::{cache, db_conn, redis_conn, redis_key, RedisConnError};
|
||||
use crate::federation::acct::Acct;
|
||||
use crate::misc::get_note_all_texts::{all_texts, PartialNoteToElaborate};
|
||||
use crate::model::entity::{antenna, note};
|
||||
use crate::service::antenna::check_hit::{check_hit_antenna, AntennaCheckError};
|
||||
use crate::service::stream;
|
||||
use crate::util::id::{get_timestamp, InvalidIdError};
|
||||
use crate::{
|
||||
database::{cache, db_conn, redis_conn, redis_key, RedisConnError},
|
||||
federation::acct::Acct,
|
||||
misc::get_note_all_texts::{all_texts, PartialNoteToElaborate},
|
||||
model::entity::{antenna, note},
|
||||
service::antenna::check_hit::{check_hit_antenna, AntennaCheckError},
|
||||
service::stream,
|
||||
util::id::{get_timestamp, InvalidIdError},
|
||||
};
|
||||
use redis::{streams::StreamMaxlen, AsyncCommands, RedisError};
|
||||
use sea_orm::prelude::*;
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
use crate::database::db_conn;
|
||||
use crate::model::entity::note_watching;
|
||||
use crate::util::id::gen_id_at;
|
||||
use crate::{database::db_conn, model::entity::note_watching, util::id::gen_id_at};
|
||||
use sea_orm::{prelude::*, ActiveValue};
|
||||
|
||||
#[crate::export]
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
use crate::config::local_server_info;
|
||||
use crate::database::db_conn;
|
||||
use crate::misc::get_note_summary::{get_note_summary, PartialNoteToSummarize};
|
||||
use crate::model::entity::sw_subscription;
|
||||
use crate::util::http_client;
|
||||
use crate::{
|
||||
config::local_server_info,
|
||||
database::db_conn,
|
||||
misc::get_note_summary::{get_note_summary, PartialNoteToSummarize},
|
||||
model::entity::sw_subscription,
|
||||
util::http_client,
|
||||
};
|
||||
use once_cell::sync::OnceCell;
|
||||
use sea_orm::prelude::*;
|
||||
use web_push::{
|
||||
ContentEncoding, IsahcWebPushClient, SubscriptionInfo, SubscriptionKeys, VapidSignatureBuilder,
|
||||
WebPushClient, WebPushError, WebPushMessageBuilder,
|
||||
};
|
||||
use web_push::*;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
|
|
|
@ -6,8 +6,10 @@ pub mod custom_emoji;
|
|||
pub mod group_chat;
|
||||
pub mod moderation;
|
||||
|
||||
use crate::config::CONFIG;
|
||||
use crate::database::{redis_conn, RedisConnError};
|
||||
use crate::{
|
||||
config::CONFIG,
|
||||
database::{redis_conn, RedisConnError},
|
||||
};
|
||||
use redis::{AsyncCommands, RedisError};
|
||||
|
||||
pub enum Stream {
|
||||
|
@ -50,6 +52,14 @@ pub enum Stream {
|
|||
},
|
||||
}
|
||||
|
||||
#[crate::export]
|
||||
pub enum ChatEvent {
|
||||
Message,
|
||||
Read,
|
||||
Deleted,
|
||||
Typing,
|
||||
}
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("Redis error: {0}")]
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
use crate::model::entity::note;
|
||||
use crate::service::stream::{publish_to_stream, Error, Stream};
|
||||
use crate::{
|
||||
model::entity::note,
|
||||
service::stream::{publish_to_stream, Error, Stream},
|
||||
};
|
||||
|
||||
pub async fn publish(antenna_id: String, note: ¬e::Model) -> Result<(), Error> {
|
||||
publish_to_stream(
|
||||
|
|
|
@ -1,12 +1,4 @@
|
|||
use crate::service::stream::{publish_to_stream, Error, Stream};
|
||||
|
||||
#[crate::export(string_enum = "camelCase")]
|
||||
pub enum ChatEvent {
|
||||
Message,
|
||||
Read,
|
||||
Deleted,
|
||||
Typing,
|
||||
}
|
||||
use crate::service::stream::{publish_to_stream, ChatEvent, Error, Stream};
|
||||
|
||||
// We want to merge `kind` and `object` into a single enum
|
||||
// https://github.com/napi-rs/napi-rs/issues/2036
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::service::stream::{publish_to_stream, Error, Stream};
|
||||
|
||||
#[crate::export(string_enum = "camelCase")]
|
||||
#[crate::export]
|
||||
pub enum ChatIndexEvent {
|
||||
Message,
|
||||
Read,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::service::stream::{chat::ChatEvent, publish_to_stream, Error, Stream};
|
||||
use crate::service::stream::{publish_to_stream, ChatEvent, Error, Stream};
|
||||
|
||||
// We want to merge `kind` and `object` into a single enum
|
||||
// https://github.com/napi-rs/napi-rs/issues/2036
|
||||
|
|
Loading…
Reference in a new issue