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 ISlideMeta interface (#7001)

白熱332c311233a0
diff --git a/packages/protocol/src/index.ts b/packages/protocol/src/index.ts
index b971c3b855..9bbc85d275 100644
--- a/packages/protocol/src/index.ts
+++ b/packages/protocol/src/index.ts
@@ -42,10 +42,7 @@ export {
type IUpdateCursor,
type IUpdatePermissionObj,
} from './ts/univer/colla-msg';
-export {
- ErrorCode,
- type IError,
-} from './ts/univer/constants/errors';
+export { ErrorCode, type IError } from './ts/univer/constants/errors';
export { UniverType } from './ts/univer/constants/univer';
export type { IDocumentMeta } from './ts/univer/doc';
@@ -55,9 +52,7 @@ export {
type IRow,
type IRowCell,
} from './ts/univer/initial-sheet';
-export type {
- IUnitRoleKV,
-} from './ts/univer/permission';
+export type { IUnitRoleKV } from './ts/univer/permission';
export {
ObjectScope,
UnitAction,
@@ -66,6 +61,8 @@ export {
} from './ts/univer/permission';
export type { IRange } from './ts/univer/range';
+export type { ISlideMeta } from './ts/univer/slide';
+
export type {
ISnapshot,
ITableInfo,
@@ -221,6 +218,10 @@ export {
type IGetSheetBlockResponse,
type IGetUnitOnRevRequest,
type IGetUnitOnRevResponse,
+ type IMGetChangesetsByRevisionRequest,
+ type IMGetChangesetsByRevisionResponse,
+ type IMGetUnitMetaRequest,
+ type IMGetUnitMetaResponse,
type IReportUnitRoutingStatsRequest,
type IReportUnitRoutingStatsResponse,
type ISaveChangesetRequest,
@@ -230,12 +231,15 @@ export {
type ISaveSnapshotRequest,
type ISaveSnapshotResponse,
type ISnapshotService,
+ type IUnitMeta,
} from './ts/universer/v1/snapshot';
export type {
IGetSessionTicketResponse,
IGetUserResponse,
IListUsersResponse,
+ IMigrateRequest,
+ IMigrateResponse,
IUser,
} from './ts/universer/v1/user';
diff --git a/packages/protocol/src/ts/univer/colla-msg.ts b/packages/protocol/src/ts/univer/colla-msg.ts
index 41552d0bc0..2741bbd2ee 100644
--- a/packages/protocol/src/ts/univer/colla-msg.ts
+++ b/packages/protocol/src/ts/univer/colla-msg.ts
@@ -58,6 +58,7 @@ export interface ICollaMsgJoin {
memberID: string;
name: string;
avatar: string;
+ userID: string;
}
export interface ICollaMsgLeave {
diff --git a/packages/protocol/src/ts/univer/slide.ts b/packages/protocol/src/ts/univer/slide.ts
new file mode 100644
index 0000000000..38dcb1c38e
--- /dev/null
+++ b/packages/protocol/src/ts/univer/slide.ts
@@ -0,0 +1,28 @@
+/**
+ * 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 ISlideMeta {
+ 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/snapshot.ts b/packages/protocol/src/ts/univer/snapshot.ts
index 26d03075ae..756dd9da99 100644
--- a/packages/protocol/src/ts/univer/snapshot.ts
+++ b/packages/protocol/src/ts/univer/snapshot.ts
@@ -16,6 +16,7 @@
import type { UniverType } from './constants/univer';
import type { IDocumentMeta } from './doc';
+import type { ISlideMeta } from './slide';
import type { IWorkbookMeta } from './workbook';
export interface ISnapshot {
@@ -25,6 +26,7 @@ export interface ISnapshot {
rev: number;
workbook: IWorkbookMeta | undefined;
doc: IDocumentMeta | undefined;
+ slide: ISlideMeta | undefined;
}
export interface ITableInfo {
diff --git a/packages/protocol/src/ts/universer/v1/comb.ts b/packages/protocol/src/ts/universer/v1/comb.ts
index 7b928cb9a6..1e6c2a17ee 100644
--- a/packages/protocol/src/ts/universer/v1/comb.ts
+++ b/packages/protocol/src/ts/universer/v1/comb.ts
@@ -108,6 +108,7 @@ export interface IMember {
memberID: string;
name: string;
avatar?: string | undefined;
+ userID: string;
}
interface IRule {
diff --git a/packages/protocol/src/ts/universer/v1/snapshot.ts b/packages/protocol/src/ts/universer/v1/snapshot.ts
index 4ab3dbee5c..916d2c63aa 100644
--- a/packages/protocol/src/ts/universer/v1/snapshot.ts
+++ b/packages/protocol/src/ts/universer/v1/snapshot.ts
@@ -59,6 +59,24 @@ interface IGetUnitMetaResponse {
updateTime: string;
}
+export interface IMGetUnitMetaRequest {
+ unitIds: string[];
+}
+
+export interface IMGetUnitMetaResponse {
+ error: IError | undefined;
+ metas: { [key: string]: IUnitMeta };
+}
+
+export interface IUnitMeta {
+ unitId: string;
+ name: string;
+ creator: string;
+ type: UniverType;
+ createTime: string;
+ updateTime: string;
+}
+
interface IGetSheetTableInfoRequest {
unitID: string;
type: UniverType;
@@ -206,6 +224,16 @@ export interface IFetchMissingChangesetsResponse {
latestRevision?: number | undefined;
}
+export interface IMGetChangesetsByRevisionRequest {
+ unitId: string;
+ revisions: number[];
+}
+
+export interface IMGetChangesetsByRevisionResponse {
+ error: IError | undefined;
+ changesets: IChangeset[];
+}
+
export interface ISaveSnapshotRequest {
unitID: string;
type: UniverType;
@@ -385,4 +413,12 @@ export interface ISnapshotService {
request: IReportUnitRoutingStatsRequest,
metadata?: Metadata,
): Observable<IReportUnitRoutingStatsResponse>;
+ MGetChangesetsByRevision(
+ request: IMGetChangesetsByRevisionRequest,
+ metadata?: Metadata,
+ ): Observable<IMGetChangesetsByRevisionResponse>;
+ MGetUnitMeta(
+ request: IMGetUnitMetaRequest,
+ metadata?: Metadata,
+ ): Observable<IMGetUnitMetaResponse>;
}
diff --git a/packages/protocol/src/ts/universer/v1/user.ts b/packages/protocol/src/ts/universer/v1/user.ts
index 7cdd9c7ca1..4d5ff978fc 100644
--- a/packages/protocol/src/ts/universer/v1/user.ts
+++ b/packages/protocol/src/ts/universer/v1/user.ts
@@ -50,3 +50,12 @@ export interface IGetSessionTicketResponse {
error: IError | undefined;
ticket: string;
}
+
+export interface IMigrateRequest {
+ fromUserId: string;
+ toUserId: string;
+}
+
+export interface IMigrateResponse {
+ error: IError | undefined;
+}