Skip to content

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.

feat(protocol): add board snapshot metadata (#7184)

白熱81d176b0aab6
diff --git a/packages/protocol/src/index.ts b/packages/protocol/src/index.ts
index 8b3ef21900..416d9bb86b 100644
--- a/packages/protocol/src/index.ts
+++ b/packages/protocol/src/index.ts
@@ -18,6 +18,7 @@ export type {
IDeserializedSheetBlock,
IGetDeserializedSheetBlockResponse,
} from './other/sheet-block';
+export type { IBoardMeta } from './ts/univer/board';
export type {
IChangeset,
ICommand,
diff --git a/packages/protocol/src/ts/univer/board.ts b/packages/protocol/src/ts/univer/board.ts
new file mode 100644
index 0000000000..4eef160af7
--- /dev/null
+++ b/packages/protocol/src/ts/univer/board.ts
@@ -0,0 +1,27 @@
+/**
+ * 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.
+ */
+
+import type { IResource } from './resource';
+
+export interface IBoardMeta {
+ unitID: string;
+ rev: number;
+ creator: string;
+ name: string;
+ resources: IResource[];
+ /** The original meta data in JSON format. */
+ originalMeta: Uint8Array;
+}
diff --git a/packages/protocol/src/ts/univer/constants/univer.ts b/packages/protocol/src/ts/univer/constants/univer.ts
index 1292cf46af..858f18cb67 100644
--- a/packages/protocol/src/ts/univer/constants/univer.ts
+++ b/packages/protocol/src/ts/univer/constants/univer.ts
@@ -21,5 +21,6 @@ export enum UniverType {
UNIVER_SLIDE = 3,
UNIVER_PROJECT = 4,
UNIVER_BASE = 5,
+ UNIVER_BOARD = 6,
UNRECOGNIZED = -1,
}
diff --git a/packages/protocol/src/ts/univer/permission.ts b/packages/protocol/src/ts/univer/permission.ts
index b122afad82..6da1727e8e 100644
--- a/packages/protocol/src/ts/univer/permission.ts
+++ b/packages/protocol/src/ts/univer/permission.ts
@@ -105,6 +105,8 @@ export enum UnitObject {
SelectRange = 3,
Document = 4,
Slide = 5,
+ Base = 6,
+ Board = 7,
UNRECOGNIZED = -1,
}
diff --git a/packages/protocol/src/ts/univer/snapshot.ts b/packages/protocol/src/ts/univer/snapshot.ts
index 756dd9da99..e1ed4aca3e 100644
--- a/packages/protocol/src/ts/univer/snapshot.ts
+++ b/packages/protocol/src/ts/univer/snapshot.ts
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import type { IBoardMeta } from './board';
import type { UniverType } from './constants/univer';
import type { IDocumentMeta } from './doc';
import type { ISlideMeta } from './slide';
@@ -27,6 +28,7 @@ export interface ISnapshot {
workbook: IWorkbookMeta | undefined;
doc: IDocumentMeta | undefined;
slide: ISlideMeta | undefined;
+ board: IBoardMeta | undefined;
}
export interface ITableInfo {
diff --git a/packages/protocol/src/ts/univerpro/v1/apply.ts b/packages/protocol/src/ts/univerpro/v1/apply.ts
index 7399ea7a2b..7d1829a71a 100644
--- a/packages/protocol/src/ts/univerpro/v1/apply.ts
+++ b/packages/protocol/src/ts/univerpro/v1/apply.ts
@@ -76,6 +76,8 @@ export interface ICreateUnitRequest {
/** Other meta for other types of univer. */
initialSheets: IInitialSheet[];
workbookDataJson: string;
+ /** two types: traditional and modern, default is modern */
+ docType?: string | undefined;
}
export interface ICreateUnitResponse {
diff --git a/packages/protocol/src/ts/universer/v1/snapshot.ts b/packages/protocol/src/ts/universer/v1/snapshot.ts
index ab6885b82c..02624efd54 100644
--- a/packages/protocol/src/ts/universer/v1/snapshot.ts
+++ b/packages/protocol/src/ts/universer/v1/snapshot.ts
@@ -169,6 +169,8 @@ export interface ICreateUnitRequest {
table?:
| ISheetTable
| undefined;
+ /** two types: traditional and modern, default is modern */
+ docType?: string | undefined;
/** used for integration with customer system */
idempotencyKey?:
| string