mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-24 05:07:06 +08:00
feat(native): cache & job runtime
This commit is contained in:
Vendored
+168
@@ -1,5 +1,52 @@
|
||||
/* auto-generated by NAPI-RS */
|
||||
/* eslint-disable */
|
||||
export declare class BackendRuntime {
|
||||
cleanupExpiredPendingBlobs(cutoffMs: number, limit: number): Promise<RuntimeBlobCleanupResult>
|
||||
releaseDeletedBlobs(workspaceId: string, limit: number): Promise<RuntimeBlobCleanupResult>
|
||||
acquireCoordinationLease(key: string, owner: string, ttlMs: number): Promise<CoordinationLeaseGrant | null>
|
||||
releaseCoordinationLease(key: string, owner: string, fencingToken: number): Promise<boolean>
|
||||
renewCoordinationLease(key: string, owner: string, fencingToken: number, ttlMs: number): Promise<boolean>
|
||||
compactPendingDocUpdates(workspaceId: string, docId: string, batchLimit: number, historyMinIntervalMs: number, owner: string, leaseTtlMs: number): Promise<RuntimeDocCompactionResult>
|
||||
putRuntimeGateIfAbsent(key: string, ttlMs: number): Promise<boolean>
|
||||
cleanupExpiredRuntimeGates(limit: number): Promise<number>
|
||||
cleanupExpiredUserSessions(limit: number): Promise<number>
|
||||
cleanupExpiredSnapshotHistories(limit: number): Promise<number>
|
||||
objectStorageHealth(): RuntimeObjectStorageHealth
|
||||
objectStoragePut(key: string, body: Buffer, metadata?: RuntimeObjectStoragePutOptions | undefined | null): Promise<void>
|
||||
objectStoragePresignPut(key: string, metadata?: RuntimeObjectStoragePutOptions | undefined | null): Promise<RuntimePresignedObjectRequest>
|
||||
objectStorageCreateMultipartUpload(key: string, metadata?: RuntimeObjectStoragePutOptions | undefined | null): Promise<RuntimeMultipartUploadInit | null>
|
||||
objectStoragePresignUploadPart(key: string, uploadId: string, partNumber: number): Promise<RuntimePresignedObjectRequest>
|
||||
objectStorageListMultipartUploadParts(key: string, uploadId: string): Promise<Array<RuntimeMultipartUploadPart>>
|
||||
objectStorageCompleteMultipartUpload(key: string, uploadId: string, parts: Array<RuntimeMultipartUploadPart>): Promise<void>
|
||||
objectStorageAbortMultipartUpload(key: string, uploadId: string): Promise<void>
|
||||
objectStorageHead(key: string): Promise<RuntimeObjectMetadata | null>
|
||||
objectStorageGet(key: string): Promise<RuntimeObjectGetResult | null>
|
||||
objectStorageList(prefix?: string | undefined | null): Promise<Array<RuntimeObjectListEntry>>
|
||||
objectStorageDelete(key: string): Promise<void>
|
||||
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>
|
||||
createVerificationToken(tokenType: number, credential: string | undefined | null, ttlMs: number): Promise<string>
|
||||
getVerificationToken(tokenType: number, token: string, keep?: boolean | undefined | null): Promise<RuntimeVerificationTokenRecord | null>
|
||||
verifyVerificationToken(tokenType: number, token: string, credential?: string | undefined | null, keep?: boolean | undefined | null): Promise<RuntimeVerificationTokenRecord | null>
|
||||
cleanupExpiredVerificationTokens(limit: number): Promise<number>
|
||||
upsertMagicLinkOtp(email: string, otpHash: string, token: string, clientNonce: string | undefined | null, ttlMs: number): Promise<void>
|
||||
consumeMagicLinkOtp(email: string, otpHash: string, clientNonce?: string | undefined | null): Promise<RuntimeMagicLinkOtpConsumeResult>
|
||||
createWorkspaceInviteLink(workspaceId: string, inviteId: string, inviterUserId: string, ttlMs: number): Promise<RuntimeWorkspaceInviteLinkRecord>
|
||||
getWorkspaceInviteLink(workspaceId: string): Promise<RuntimeWorkspaceInviteLinkRecord | null>
|
||||
getWorkspaceInviteLinkById(inviteId: string): Promise<RuntimeWorkspaceInviteLinkRecord | null>
|
||||
revokeWorkspaceInviteLink(workspaceId: string): Promise<boolean>
|
||||
cleanupExpiredRuntimeStates(limit: number): Promise<number>
|
||||
refreshWorkspaceAdminStatsDirty(batchLimit: number, owner: string, leaseTtlMs: number): Promise<RuntimeWorkspaceStatsRefreshResult>
|
||||
recalibrateWorkspaceAdminStats(lastSid: number, batchLimit: number, owner: string, leaseTtlMs: number): Promise<RuntimeWorkspaceStatsRecalibrationResult>
|
||||
writeWorkspaceAdminStatsDailySnapshot(owner: string, leaseTtlMs: number): Promise<RuntimeWorkspaceStatsSnapshotResult>
|
||||
constructor()
|
||||
start(): Promise<void>
|
||||
stop(): Promise<void>
|
||||
health(): Promise<BackendRuntimeHealth>
|
||||
runMigrations(): Promise<void>
|
||||
}
|
||||
|
||||
export declare class LlmStreamHandle {
|
||||
abort(): void
|
||||
}
|
||||
@@ -74,6 +121,12 @@ export interface AssertSafeUrlRequest {
|
||||
url: string
|
||||
}
|
||||
|
||||
export interface BackendRuntimeHealth {
|
||||
started: boolean
|
||||
databaseConnected: boolean
|
||||
objectStorageConfigured: boolean
|
||||
}
|
||||
|
||||
export declare function buildPublicRootDoc(rootDocBin: Buffer, docMetas: Array<PublicDocMetaInput>): Buffer
|
||||
|
||||
export interface BuiltInPromptRenderContract {
|
||||
@@ -164,6 +217,12 @@ export interface CommandResponse {
|
||||
error?: LicenseError
|
||||
}
|
||||
|
||||
export interface CoordinationLeaseGrant {
|
||||
key: string
|
||||
owner: string
|
||||
fencingToken: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts markdown content to AFFiNE-compatible y-octo document binary.
|
||||
*
|
||||
@@ -738,6 +797,115 @@ export declare function resolveEntitlementV1(input: ResolveEntitlementInput): Re
|
||||
|
||||
export declare function runNativeActionRecipePreparedStream(input: ActionRuntimeInput, callback: ((err: Error | null, arg: string) => void)): LlmStreamHandle
|
||||
|
||||
export interface RuntimeBlobCleanupResult {
|
||||
scanned: number
|
||||
deleted: number
|
||||
abortedMultipart: number
|
||||
workspaceIds: Array<string>
|
||||
}
|
||||
|
||||
export interface RuntimeDocCompactionResult {
|
||||
leaseAcquired: boolean
|
||||
merged: boolean
|
||||
workspaceId: string
|
||||
docId: string
|
||||
updatesMerged: number
|
||||
historyCreated: boolean
|
||||
}
|
||||
|
||||
export interface RuntimeMagicLinkOtpConsumeResult {
|
||||
ok: boolean
|
||||
token?: string
|
||||
reason?: string
|
||||
}
|
||||
|
||||
export interface RuntimeMultipartUploadInit {
|
||||
uploadId: string
|
||||
expiresAtMs: number
|
||||
}
|
||||
|
||||
export interface RuntimeMultipartUploadPart {
|
||||
partNumber: number
|
||||
etag: string
|
||||
}
|
||||
|
||||
export interface RuntimeObjectGetResult {
|
||||
body: Buffer
|
||||
metadata: RuntimeObjectMetadata
|
||||
}
|
||||
|
||||
export interface RuntimeObjectListEntry {
|
||||
key: string
|
||||
contentLength: number
|
||||
lastModifiedMs: number
|
||||
}
|
||||
|
||||
export interface RuntimeObjectMetadata {
|
||||
contentType: string
|
||||
contentLength: number
|
||||
lastModifiedMs: number
|
||||
checksumCrc32?: string
|
||||
}
|
||||
|
||||
export interface RuntimeObjectStorageHealth {
|
||||
configured: boolean
|
||||
provider?: string
|
||||
bucket?: string
|
||||
endpoint?: string
|
||||
region?: string
|
||||
hasCredentials: boolean
|
||||
forcePathStyle: boolean
|
||||
requestTimeoutMs?: number
|
||||
minPartSize?: number
|
||||
presignExpiresInSeconds?: number
|
||||
presignSignContentTypeForPut?: boolean
|
||||
usePresignedUrl: boolean
|
||||
clientBuildable: boolean
|
||||
}
|
||||
|
||||
export interface RuntimeObjectStoragePutOptions {
|
||||
contentType?: string
|
||||
contentLength?: number
|
||||
checksumCrc32?: string
|
||||
}
|
||||
|
||||
export interface RuntimePresignedObjectRequest {
|
||||
url: string
|
||||
headersJson: string
|
||||
expiresAtMs: number
|
||||
}
|
||||
|
||||
export interface RuntimeVerificationTokenRecord {
|
||||
tokenType: number
|
||||
token: string
|
||||
credential?: string
|
||||
expiresAtMs: number
|
||||
}
|
||||
|
||||
export interface RuntimeWorkspaceInviteLinkRecord {
|
||||
workspaceId: string
|
||||
inviteId: string
|
||||
inviterUserId: string
|
||||
expiresAtMs: number
|
||||
}
|
||||
|
||||
export interface RuntimeWorkspaceStatsRecalibrationResult {
|
||||
processed: number
|
||||
lastSid: number
|
||||
skipped: boolean
|
||||
}
|
||||
|
||||
export interface RuntimeWorkspaceStatsRefreshResult {
|
||||
processed: number
|
||||
backlog: number
|
||||
skipped: boolean
|
||||
}
|
||||
|
||||
export interface RuntimeWorkspaceStatsSnapshotResult {
|
||||
snapshotted: number
|
||||
skipped: boolean
|
||||
}
|
||||
|
||||
export declare function safeFetch(request: SafeFetchRequest): Promise<SafeFetchResponse>
|
||||
|
||||
export type SafeFetchMethod = 'get'|
|
||||
|
||||
Reference in New Issue
Block a user