/** * This file is part of the NocoBase (R) project. * Copyright (c) 2020-2024 NocoBase Co., Ltd. * Authors: NocoBase Team. * * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. * For more information, please refer to: https://www.nocobase.com/agreement. */ /** * Minimal shape of a previewable file. Accepts the file-manager attachment record * (a superset of these fields) or a bare URL string. All fields are optional so * the helpers stay tolerant of partial records coming from different call sites. */ export interface OfficePreviewFileObject { id?: string | number; storageId?: string | number; url?: string; mimetype?: string; extname?: string; name?: string; filename?: string; title?: string; } export type OfficePreviewFile = string | OfficePreviewFileObject | null | undefined; export interface FileCollectionReference { dataSourceKey: string; collectionName: string; } export interface PermanentFileAccessParams extends FileCollectionReference { appName: string; id: string; } export interface OfficePreviewAPIClient { request(config: { url: string; method: 'post'; headers: Record; }): Promise<{ data: T; }>; } export declare const OFFICE_MIME_TYPES: string[]; export declare const OFFICE_EXTS: string[]; export declare const getOfficeFileExt: (file: OfficePreviewFile) => string; export declare const resolveFileUrl: (file: OfficePreviewFile) => string; export declare const getOfficePreviewUrl: (file: OfficePreviewFile) => string; export declare const parsePermanentFileUrl: (file: OfficePreviewFile) => PermanentFileAccessParams | null; export declare const resolveTemporaryOfficeFileUrl: (apiClient: OfficePreviewAPIClient, file: OfficePreviewFile, fileCollection?: FileCollectionReference) => Promise; export declare const isOfficeFile: (file: OfficePreviewFile) => boolean;