mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-18 18:41:52 +08:00
feat(server): refactor mail queue (#15204)
This commit is contained in:
Vendored
+131
@@ -27,6 +27,18 @@ export declare class BackendRuntime {
|
||||
cleanupExpiredRuntimeGates(limit: number): Promise<number>
|
||||
cleanupExpiredUserSessions(limit: number): Promise<number>
|
||||
cleanupExpiredSnapshotHistories(limit: number): Promise<number>
|
||||
isInviteAbuseUserQuarantinedOrBanned(userId: string): Promise<boolean>
|
||||
isInviteAbuseWorkspaceQuarantined(workspaceId: string): Promise<boolean>
|
||||
claimInviteAbuseAction(actionId: string, workerId: string): Promise<boolean>
|
||||
claimRetryableInviteAbuseActions(workerId: string, limit: number): Promise<Array<RuntimeInviteAbuseClaimedAction>>
|
||||
markInviteAbuseAction(actionId: string, workerId: string, status: string, error?: string | undefined | null): Promise<boolean>
|
||||
assertWorkspaceInviteQuotaV1(input: RuntimeWorkspaceInviteQuotaInput): Promise<RuntimeWorkspaceInviteQuotaDecision>
|
||||
commitWorkspaceInviteQuotaV1(reservationId: string, usage: RuntimeWorkspaceInviteQuotaUsage): Promise<boolean>
|
||||
releaseWorkspaceInviteQuotaV1(reservationId: string): Promise<boolean>
|
||||
assertMailDeliveryQuotaV1(input: RuntimeMailDeliveryQuotaInput): Promise<RuntimeMailDeliveryQuotaDecision>
|
||||
commitMailDeliveryQuotaV1(reservationId: string): Promise<boolean>
|
||||
releaseMailDeliveryQuotaV1(reservationId: string): Promise<boolean>
|
||||
cleanupExpiredRollingQuota(limit: number): Promise<number>
|
||||
createAuthChallenge(purpose: string, token: string, payload: any, ttlMs: number): Promise<boolean>
|
||||
getAuthChallenge(purpose: string, token: string): Promise<any | null>
|
||||
consumeAuthChallenge(purpose: string, token: string): Promise<any | null>
|
||||
@@ -254,6 +266,33 @@ export interface CommandResponse {
|
||||
error?: LicenseError
|
||||
}
|
||||
|
||||
export interface ContentPolicyMatch {
|
||||
type: string
|
||||
reason: string
|
||||
value?: string
|
||||
span?: ContentPolicyMatchSpan
|
||||
}
|
||||
|
||||
export interface ContentPolicyMatchSpan {
|
||||
start: number
|
||||
end: number
|
||||
}
|
||||
|
||||
export interface ContentPolicyScanInput {
|
||||
value: string
|
||||
checks?: Array<string>
|
||||
}
|
||||
|
||||
export interface ContentPolicyScanResult {
|
||||
version: number
|
||||
original: string
|
||||
normalized: string
|
||||
skeleton: string
|
||||
matched: boolean
|
||||
matches: Array<ContentPolicyMatch>
|
||||
flags: Array<string>
|
||||
}
|
||||
|
||||
export interface CoordinationLeaseGrant {
|
||||
key: string
|
||||
owner: string
|
||||
@@ -914,12 +953,62 @@ export interface RuntimeDocHistoryInput {
|
||||
historyMaxAgeMs: number
|
||||
}
|
||||
|
||||
export interface RuntimeInviteAbuseActionRequired {
|
||||
action: string
|
||||
subjectKey: string
|
||||
evidenceId: string
|
||||
actionId: string
|
||||
}
|
||||
|
||||
export interface RuntimeInviteAbuseClaimedAction {
|
||||
action: string
|
||||
subjectKey: string
|
||||
evidenceId: string
|
||||
actionId: string
|
||||
actorUserId: string
|
||||
workspaceId: string
|
||||
}
|
||||
|
||||
export interface RuntimeMagicLinkOtpConsumeResult {
|
||||
ok: boolean
|
||||
token?: string
|
||||
reason?: string
|
||||
}
|
||||
|
||||
export interface RuntimeMailDeliveryQuotaDecision {
|
||||
allowed: boolean
|
||||
reservationId?: string
|
||||
mailClass: string
|
||||
retryAfterSeconds?: number
|
||||
reason?: string
|
||||
scopeKey?: string
|
||||
windowSeconds?: number
|
||||
limit?: number
|
||||
current?: number
|
||||
requested?: number
|
||||
}
|
||||
|
||||
export interface RuntimeMailDeliveryQuotaInput {
|
||||
requestId?: string
|
||||
mailName: string
|
||||
recipient: RuntimeMailDeliveryQuotaRecipientInput
|
||||
metadata: RuntimeMailDeliveryQuotaMetadataInput
|
||||
source?: RuntimeQuotaSourceInput
|
||||
}
|
||||
|
||||
export interface RuntimeMailDeliveryQuotaMetadataInput {
|
||||
actorUserId?: string
|
||||
workspaceId?: string
|
||||
notificationId?: string
|
||||
abuseSubjectKey?: string
|
||||
}
|
||||
|
||||
export interface RuntimeMailDeliveryQuotaRecipientInput {
|
||||
email: string
|
||||
domain: string
|
||||
userId?: string
|
||||
}
|
||||
|
||||
export interface RuntimeMultipartUploadInit {
|
||||
uploadId: string
|
||||
expiresAtMs: number
|
||||
@@ -960,6 +1049,19 @@ export interface RuntimePresignedObjectRequest {
|
||||
expiresAtMs: number
|
||||
}
|
||||
|
||||
export interface RuntimeQuotaSourceInput {
|
||||
trusted: boolean
|
||||
ip?: string
|
||||
country?: string
|
||||
asn?: number
|
||||
rayId?: string
|
||||
}
|
||||
|
||||
export interface RuntimeQuotaTargetDomainInput {
|
||||
domain: string
|
||||
count: number
|
||||
}
|
||||
|
||||
export interface RuntimeVerificationTokenRecord {
|
||||
tokenType: number
|
||||
token: string
|
||||
@@ -974,6 +1076,33 @@ export interface RuntimeWorkspaceInviteLinkRecord {
|
||||
expiresAtMs: number
|
||||
}
|
||||
|
||||
export interface RuntimeWorkspaceInviteQuotaDecision {
|
||||
allowed: boolean
|
||||
reservationId?: string
|
||||
retryAfterSeconds?: number
|
||||
reason?: string
|
||||
scopeKey?: string
|
||||
windowSeconds?: number
|
||||
limit?: number
|
||||
current?: number
|
||||
requested?: number
|
||||
actionRequired?: RuntimeInviteAbuseActionRequired
|
||||
}
|
||||
|
||||
export interface RuntimeWorkspaceInviteQuotaInput {
|
||||
actorUserId: string
|
||||
workspaceId: string
|
||||
requestId?: string
|
||||
targetCount: number
|
||||
targetDomains: Array<RuntimeQuotaTargetDomainInput>
|
||||
source?: RuntimeQuotaSourceInput
|
||||
}
|
||||
|
||||
export interface RuntimeWorkspaceInviteQuotaUsage {
|
||||
targetCount: number
|
||||
targetDomains: Array<RuntimeQuotaTargetDomainInput>
|
||||
}
|
||||
|
||||
export interface RuntimeWorkspaceStatsDailyRecalibrationResult {
|
||||
processed: number
|
||||
lastSid: number
|
||||
@@ -1030,6 +1159,8 @@ export interface SafeFetchResponse {
|
||||
body: Buffer
|
||||
}
|
||||
|
||||
export declare function scanContentPolicyV1(input: ContentPolicyScanInput): ContentPolicyScanResult
|
||||
|
||||
export interface StorageProviderCapabilities {
|
||||
put: boolean
|
||||
get: boolean
|
||||
|
||||
Reference in New Issue
Block a user