Typreferenz
Vollständige TypeScript-Typdefinitionen, die von @sonar/sdk exportiert werden.
Dokumenttypen
Document
Repräsentiert ein einzelnes Dokument im Sonar-System.
interface Document { id: string; // Eindeutige Dokumentkennung name: string; // Dokumentanzeigename extension: string; // Dateierweiterung (z.B. "pdf") size: string; // Dateigröße in Bytes (als String) type: string; // MIME-Typ (z.B. "application/pdf") status: boolean; // Aktivstatus uploadFrom: string; // Upload-Quellkennung uploadDate: string; // ISO 8601 Upload-Zeitstempel isSigned: boolean; // Ob das Dokument signiert wurde isUsed: boolean; // Ob das Dokument in Verwendung ist fileHash?: string; // SHA-Hash des Dateiinhalts signatureType?: SignatureType; // Art der angewendeten Signatur lastSignedAt?: string; // ISO 8601 Zeitstempel der letzten Signatur signature?: DocumentSignature; // Signaturdetails parentDocumentId?: string | null; // Übergeordnetes Dokument in der Signaturkette originalDocumentId?: string | null; // Originaldokument in der Kette signatureChainOrder?: number; // Position in der Signaturkette isLatestVersion?: boolean; // Ob dies die neueste Version ist createdAt: string; // ISO 8601 Erstellungszeitstempel updatedAt: string; // ISO 8601 Letzter Aktualisierungszeitstempel}DocumentSignature
interface DocumentSignature { signedAt: string; // ISO 8601 Zeitstempel der Signierung certificateId: string; // ID des Signaturzertifikats signatureHash?: string; // Hash der Signatur pageNumber?: number; // Seite, auf der die Signatur erscheint isPadesCompliant?: boolean; // Ob die Signatur PAdES-konform ist}DocumentClassification
type DocumentClassification = 'generated' | 'uploaded' | 'signed';SignatureType
type SignatureType = 'SIMPLE' | 'ADVANCE' | 'AES';DocumentUploadSource
type DocumentUploadSource = | 'session-chat' | 'session-call' | 'user-documents' | 'session-recording' | 'queue-documents' | 'application-settings-appearance';ListDocumentsParams
interface ListDocumentsParams { page?: number; // Min.: 1, Standard: 1 limit?: number; // Min.: 1, Max.: 100, Standard: 20 classification?: DocumentClassification; isSigned?: boolean; type?: string; // MIME-Typ-Filter uploadFrom?: DocumentUploadSource; sessionId?: string; // MongoDB ObjectId fromDate?: string | Date; // ISO 8601 toDate?: string | Date; // ISO 8601}ListDocumentsResponse
interface ListDocumentsResponse { docs: Document[]; totalDocs: number; limit: number; totalPages: number; page: number; pagingCounter: number; hasPrevPage: boolean; hasNextPage: boolean; prevPage: number | null; nextPage: number | null;}UploadDocumentParams
interface UploadDocumentParams { file: Buffer | Blob | NodeJS.ReadableStream; filename?: string; contentType?: string; name?: string; uploadFrom?: DocumentUploadSource; identity?: string; classification?: DocumentClassification;}DownloadResponse
interface DownloadResponse { data: ArrayBuffer; contentType: string; filename: string; size: number;}DownloadUrlParams
interface DownloadUrlParams { expiresIn?: number; // URL-Ablauf in Sekunden (Min.: 60, Max.: 3600, Standard: 300)}DownloadUrlResponse
interface DownloadUrlResponse { documentId: string; name: string; url: string; expiresIn: number;}DeleteDocumentResponse
interface DeleteDocumentResponse { documentId: string;}BatchDeleteParams
interface BatchDeleteParams { documentIds: string[]; // Max.: 500}BatchDeleteResponse
interface BatchDeleteResponse { deleted: number; failed: number; total: number;}ExportDocumentsParams
interface ExportDocumentsParams { documentIds: string[]; // Min.: 1, Max.: 500}SignatureChain
interface SignatureChain { originalDocumentId: string; chainLength: number; documents: SignatureChainDocument[];}SignatureChainDocument
interface SignatureChainDocument { id: string; name: string; isSigned: boolean; signatureType?: SignatureType; signature?: { signedAt: string; certificateId: string; isPadesCompliant?: boolean; }; signatureChainOrder: number; isLatestVersion: boolean; parentDocumentId?: string | null; originalDocumentId?: string | null; createdAt: string;}ScopeAction
type ScopeAction = 'read' | 'upload' | 'update' | 'export' | 'delete';Bereichstypen
AllowedScopesResponse
interface AllowedScopesResponse { keyPrefix: string; name: string; scopes: string[];}ScopeCategory
interface ScopeCategory { id: string; label: string; types: ScopeType[];}ScopeType
interface ScopeType { id: string; label: string; scopes: ScopeEntry[];}ScopeEntry
interface ScopeEntry { value: string; label: string;}ScopeValue
type ScopeValue = (typeof Scope)[keyof typeof Scope];Fehlertypen
APIErrorResponse
interface APIErrorResponse { success: false; code: string; message: string; errors?: Array<{ field: string; code: string; message: string; }>;}ErrorCode
type ErrorCode = | 'MISSING_API_KEY' | 'INVALID_API_KEY' | 'EXPIRED_API_KEY' | 'REVOKED_API_KEY' | 'INSUFFICIENT_SCOPE' | 'IP_NOT_ALLOWED' | 'RATE_LIMIT_EXCEEDED' | 'DOCUMENT_NOT_FOUND' | 'RESOURCE_NOT_FOUND' | 'INVALID_REQUEST' | 'INVALID_PARAMETER' | 'EXPORT_LIMIT_EXCEEDED' | 'EXPORT_SIZE_EXCEEDED' | 'EXPORT_NO_FILES' | 'INTERNAL_ERROR';Vollständige Exporte
Alles, was von @sonar/sdk exportiert wird:
// Haupt-Clientexport { SonarSDK } from './client';
// Konfigurationexport type { SonarSDKConfig } from './types/config';
// Dokumenttypenexport type { Document, DocumentSignature, DocumentClassification, SignatureType, ListDocumentsParams, ListDocumentsResponse, ExportDocumentsParams, UploadDocumentParams, DocumentUploadSource, DownloadResponse, DownloadUrlParams, DownloadUrlResponse, DeleteDocumentResponse, BatchDeleteParams, BatchDeleteResponse, ScopeAction, SignatureChainDocument, SignatureChain,} from './types/documents';
// Bereichstypen & Konstantenexport { Scope } from './types/scopes';export type { AllowedScopesResponse, ScopeValue, ScopeCategory, ScopeType, ScopeEntry,} from './types/scopes';
// Fehlertypenexport type { APIErrorResponse, ErrorCode } from './types/errors';
// Fehlerklassenexport { SonarSDKError, AuthenticationError, RateLimitError, DocumentNotFoundError, ValidationError,} from './utils/errors';