Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(protocol): add pdf metadata contract (#7251)
VicKun5338c1f5c734
diff --git a/packages/protocol/src/index.ts b/packages/protocol/src/index.tsindex 416d9bb86b..74574f797a 100644--- a/packages/protocol/src/index.ts+++ b/packages/protocol/src/index.ts@@ -47,6 +47,7 @@ export { UniverType } from './ts/univer/constants/univer';export type { IDocumentMeta } from './ts/univer/doc';export { CellType } from './ts/univer/initial-sheet';export type { IInitialSheet, IRow, IRowCell } from './ts/univer/initial-sheet';+export type { IPdfAssetRef, IPdfMeta } from './ts/univer/pdf';export type { IUnitRoleKV } from './ts/univer/permission';export {ObjectScope,@@ -60,6 +61,7 @@ export type {ISnapshot,ITableInfo,} from './ts/univer/snapshot';+export type { IUnit } from './ts/univer/univer-file';export { CellValueType } from './ts/univer/workbook';export type { ICellData, ISheetBlock, ISheetBlockMeta, IWorkbookMeta, IWorksheetMeta } from './ts/univer/workbook';export type {diff --git a/packages/protocol/src/ts/univer/constants/univer.ts b/packages/protocol/src/ts/univer/constants/univer.tsindex 858f18cb67..6c36dd248d 100644--- a/packages/protocol/src/ts/univer/constants/univer.ts+++ b/packages/protocol/src/ts/univer/constants/univer.ts@@ -22,5 +22,6 @@ export enum UniverType {UNIVER_PROJECT = 4,UNIVER_BASE = 5,UNIVER_BOARD = 6,+ UNIVER_PDF = 7,UNRECOGNIZED = -1,}diff --git a/packages/protocol/src/ts/univer/pdf.ts b/packages/protocol/src/ts/univer/pdf.tsnew file mode 100644index 0000000000..371a925375--- /dev/null+++ b/packages/protocol/src/ts/univer/pdf.ts@@ -0,0 +1,41 @@+/**+ * Copyright 2023-present DreamNum Co., Ltd.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++export interface IPdfAssetRef {+ assetId: string;+ kind: string;+ fileId: string;+ mimeType: string;+ size: number;+}++export interface IPdfMeta {+ unitID: string;+ rev: number;+ creator: string;+ name: string;+ sourcePdfFileId?: string | undefined;+ modelJsonFileId?: string | undefined;+ decodeManifestFileId?: string | undefined;+ pdfModelSchema?: string | undefined;+ pdfModelSchemaVersion?: number | undefined;+ decoderKind?: string | undefined;+ decoderVersion?: string | undefined;+ assets?: IPdfAssetRef[] | undefined;+ editorStateJsonFileId?: string | undefined;+ exportPatchJsonFileId?: string | undefined;+ originalMeta: Uint8Array;+}diff --git a/packages/protocol/src/ts/univer/permission.ts b/packages/protocol/src/ts/univer/permission.tsindex 6da1727e8e..1978fdd327 100644--- a/packages/protocol/src/ts/univer/permission.ts+++ b/packages/protocol/src/ts/univer/permission.ts@@ -107,6 +107,7 @@ export enum UnitObject {Slide = 5,Base = 6,Board = 7,+ Pdf = 8,UNRECOGNIZED = -1,}diff --git a/packages/protocol/src/ts/univer/snapshot.ts b/packages/protocol/src/ts/univer/snapshot.tsindex e1ed4aca3e..4980d2b53b 100644--- a/packages/protocol/src/ts/univer/snapshot.ts+++ b/packages/protocol/src/ts/univer/snapshot.ts@@ -17,6 +17,7 @@import type { IBoardMeta } from './board';import type { UniverType } from './constants/univer';import type { IDocumentMeta } from './doc';+import type { IPdfMeta } from './pdf';import type { ISlideMeta } from './slide';import type { IWorkbookMeta } from './workbook';@@ -29,6 +30,7 @@ export interface ISnapshot {doc: IDocumentMeta | undefined;slide: ISlideMeta | undefined;board: IBoardMeta | undefined;+ pdf?: IPdfMeta | undefined;}export interface ITableInfo {diff --git a/packages/protocol/src/ts/univer/univer-file.ts b/packages/protocol/src/ts/univer/univer-file.tsindex b77830aa1c..380ce65971 100644--- a/packages/protocol/src/ts/univer/univer-file.ts+++ b/packages/protocol/src/ts/univer/univer-file.ts@@ -17,6 +17,7 @@import type { UniverType } from './constants/univer';import type { IDocumentMeta } from './doc';import type { IDrawingMeta } from './drawing';+import type { IPdfMeta } from './pdf';import type { IWorkbookMeta } from './workbook';export interface IUnit {@@ -26,4 +27,5 @@ export interface IUnit {workbook?: IWorkbookMeta | undefined;document?: IDocumentMeta | undefined;drawing?: IDrawingMeta | undefined;+ pdf?: IPdfMeta | undefined;}