@univerjs/protocol 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/types/index.d.ts +16 -0
- package/lib/types/ts/univer/permission.d.ts +34 -0
- package/lib/types/ts/v1/apply.d.ts +88 -0
- package/lib/types/ts/v1/comb.d.ts +110 -0
- package/lib/types/ts/v1/file.d.ts +28 -0
- package/lib/types/ts/v1/user.d.ts +18 -0
- package/lib/types/utils.d.ts +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { isError } from './utils';
|
|
2
|
+
export type { Changeset as IChangeset, Mutation as IMutation } from './ts/univer/changeset';
|
|
3
|
+
export { ErrorCode, type Error as IError } from './ts/univer/constants/errors';
|
|
4
|
+
export { UniverType } from './ts/univer/constants/univer';
|
|
5
|
+
export type { DocumentMeta as IDocumentMeta } from './ts/univer/doc';
|
|
6
|
+
export type { Resource as IResource } from './ts/univer/resource';
|
|
7
|
+
export type { Snapshot as ISnapshot } from './ts/univer/snapshot';
|
|
8
|
+
export { CellValueType, type CellData as ICellData, type CellValue as ICellValue, type RowData as IRowData, type RowData_ItemsEntry as IRowDataItemsEntry, type SheetBlock as ISheetBlock, type SheetBlockMeta as ISheetBlockMeta, type WorkbookMeta as IWorkbookMeta, type WorkbookMeta_BlockMetaEntry as IWorkbookMeta_BlockMetaEntry, type WorkbookMeta_SheetsEntry as IWorkbookMeta_SheetsEntry, type WorksheetMeta as IWorksheetMeta, } from './ts/univer/workbook';
|
|
9
|
+
export { type ApplyRequest as IApplyRequest, type ApplyResponse as IApplyResponse, type CreateUnitRequest as ICreateUnitRequest, type CreateUnitResponse as ICreateUnitResponse, type DisposeRequest as IDisposeRequest, type DisposeResponse as IDisposeResponse, type WorkbookCreateMeta as IWorkbookCreateMeta, type EnsureSnapshotRequest as IEnsureSnapshotRequest, type EnsureSnapshotResponse as IEnsureSnapshotResponse, } from './ts/v1/apply';
|
|
10
|
+
export { CmdRspCode, CombCmd, type CombInfoResponse as ICombInfoResponse, type CombJoinInfo as ICombJoinInfo, type CombJoinRequest as ICombJoinRequest, type CombJoinResponse as ICombJoinResponse, type CombJoinResponse_RoomInfo as ICombJoinResponseRoomInfo, type CombJoinResponse_RoomInfosEntry as ICombJoinResponseRoomInfosEntry, type CombLeaveRequest as ICombLeaveRequest, type CombService as ICombService, type ConnectResponse as IConnectResponse, type Member as IMember, type NewChangesRequest as INewChangesRequest, type NewChangesResponse as INewChangesResponse, } from './ts/v1/comb';
|
|
11
|
+
export { type FetchMissingChangesetsRequest as IFetchMissingChangesetsRequest, type FetchMissingChangesetsResponse as IFetchMissingChangesetsResponse, type GetResourcesRequest as IGetResourcesRequest, type GetResourcesResponse as IGetResourcesResponse, type GetSheetBlockRequest as IGetSheetBlockRequest, type GetSheetBlockResponse as IGetSheetBlockResponse, type GetSnapshotRequest as IGetSnapshotRequest, type GetSnapshotResponse as IGetSnapshotResponse, type GetUnitOnRevRequest as IGetUnitOnRevRequest, type GetUnitOnRevResponse as IGetUnitOnRevResponse, type SaveChangesetRequest as ISaveChangesetRequest, type SaveChangesetResponse as ISaveChangesetResponse, type SaveSheetBlockRequest as ISaveSheetBlockRequest, type SaveSheetBlockResponse as ISaveSheetBlockResponse, type SaveSnapshotRequest as ISaveSnapshotRequest, type SaveSnapshotResponse as ISaveSnapshotResponse, type SnapshotService as ISnapshotService, } from './ts/v1/snapshot';
|
|
12
|
+
export { type CollaMsg as ICollaMsg, type CollaMsgJoin as ICollaMsgJoin, type CollaMsgLeave as ICollaMsgLeave, type UpdateCursor as IUpdateCursor, type LiveShareRequestHost as ILiveShareRequestHost, type LiveShareNewHost as ILiveShareNewHost, type LiveShareOperation as ILiveShareOperation, type LiveShareOperation_Operation as ILiveShareOperation_Operation, type LiveShareOperation_OperationsEntry as ILiveShareOperation_OperationsEntry, type LiveShareTerminate as ILiveShareTerminate, type CollaMsgErrorEvent as ICollaMsgErrorEvent, } from './ts/univer/colla_msg';
|
|
13
|
+
export { type FileService as IFileService, type FileUploadMeta as IuploadFileRequestMeta, type FileUploadRequest as IFileUploadRequest, type UploadResponse as IUploadResponse, } from './ts/v1/file';
|
|
14
|
+
export type { GetUserResponse as IGetUserResponse, User as IUser, GetUserRequest as IGetUserRequest } from './ts/v1/user';
|
|
15
|
+
export type { Collaborator as ICollaborator, CreateRequest as ICreateRequest, CreateRequest_SelectRangeObject as ICreateRequest_SelectRangeObject, CreateRequest_WorksheetObject as ICreateRequest_WorksheetObject, CreateResponse as ICreateResponse, CreateCollaboratorRequest as ICreateCollaboratorRequest, CreateCollaboratorResponse as ICreateCollaboratorResponse, UpdateCollaboratorRequest as IUpdateCollaboratorRequest, UpdateCollaboratorResponse as IUpdateCollaboratorResponse, DeleteCollaboratorRequest as IDeleteCollaboratorRequest, DeleteCollaboratorResponse as IDeleteCollaboratorResponse, ListCollaboratorRequest as IListCollaboratorRequest, ListCollaboratorResponse as IListCollaboratorResponse, AllowedRequest as IAllowedRequest, ActionInfo as IActionInfo, AllowedResponse as IAllowedResponse, AuthzService as IAuthzService, } from './ts/v1/authz';
|
|
16
|
+
export type { UnitRoleKV as IUnitRoleKV, UnitRole as IUnitRole, UnitObject as IUnitObject, UnitPermissionStrategy as IUnitPermissionStrategy, UnitAction as IUnitAction, } from './ts/univer/permission';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const protobufPackage = "univer";
|
|
2
|
+
export declare enum UnitAction {
|
|
3
|
+
View = 0,
|
|
4
|
+
Edit = 1,
|
|
5
|
+
ManageCollaborator = 2,
|
|
6
|
+
Print = 3,
|
|
7
|
+
Duplicate = 4,
|
|
8
|
+
Comment = 5,
|
|
9
|
+
Copy = 6,
|
|
10
|
+
Share = 7,
|
|
11
|
+
UNRECOGNIZED = -1
|
|
12
|
+
}
|
|
13
|
+
export declare enum UnitRole {
|
|
14
|
+
Reader = 0,
|
|
15
|
+
Editor = 1,
|
|
16
|
+
Owner = 2,
|
|
17
|
+
UNRECOGNIZED = -1
|
|
18
|
+
}
|
|
19
|
+
export declare enum UnitObject {
|
|
20
|
+
Unkonwn = 0,
|
|
21
|
+
Workbook = 1,
|
|
22
|
+
Worksheet = 2,
|
|
23
|
+
SelectRange = 3,
|
|
24
|
+
Document = 4,
|
|
25
|
+
UNRECOGNIZED = -1
|
|
26
|
+
}
|
|
27
|
+
export interface UnitRoleKV {
|
|
28
|
+
role: UnitRole;
|
|
29
|
+
name: string;
|
|
30
|
+
}
|
|
31
|
+
export interface UnitPermissionStrategy {
|
|
32
|
+
role: UnitRole;
|
|
33
|
+
action: UnitAction;
|
|
34
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Metadata } from "@grpc/grpc-js";
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import type { Changeset } from "../univer/changeset";
|
|
4
|
+
import type { Error } from "../univer/constants/errors";
|
|
5
|
+
import type { UniverType } from "../univer/constants/univer";
|
|
6
|
+
import type { Snapshot } from "../univer/snapshot";
|
|
7
|
+
import type { CustomCellTemplate } from "../univer/unit_template";
|
|
8
|
+
export declare const protobufPackage = "univerpro.v1";
|
|
9
|
+
/** The meta required to create a new unit. */
|
|
10
|
+
export interface WorkbookCreateMeta {
|
|
11
|
+
/**
|
|
12
|
+
* If you want to create an empty sheet, make this undefined or a empty
|
|
13
|
+
* string.
|
|
14
|
+
*/
|
|
15
|
+
templateID?: string | undefined;
|
|
16
|
+
/** Name of the unit. It should be localized. */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Locale of the unit. */
|
|
19
|
+
locale: string;
|
|
20
|
+
customCell?: CustomCellTemplate | undefined;
|
|
21
|
+
}
|
|
22
|
+
export interface CreateUnitRequest {
|
|
23
|
+
unitID: string;
|
|
24
|
+
type: UniverType;
|
|
25
|
+
name: string;
|
|
26
|
+
creator: string;
|
|
27
|
+
/** If `type` is UniverType.UNIVER_SHEEET, this is requried. */
|
|
28
|
+
workbookMeta?: WorkbookCreateMeta | undefined;
|
|
29
|
+
}
|
|
30
|
+
export interface CreateUnitResponse {
|
|
31
|
+
error: Error | undefined;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* ApplyRequest is almost the same as a Changeset.
|
|
35
|
+
* See `changeset.proto` for details.
|
|
36
|
+
*/
|
|
37
|
+
export interface ApplyRequest {
|
|
38
|
+
unitID: string;
|
|
39
|
+
type: UniverType;
|
|
40
|
+
/** changeset to apply */
|
|
41
|
+
changeset: Changeset | undefined;
|
|
42
|
+
/** changsetset to fast forward to, these cs has been applied to the document */
|
|
43
|
+
fastForward: Changeset[];
|
|
44
|
+
}
|
|
45
|
+
export interface ApplyResponse {
|
|
46
|
+
error: Error | undefined;
|
|
47
|
+
/** The revision of the document right now */
|
|
48
|
+
revision: number;
|
|
49
|
+
}
|
|
50
|
+
export interface DisposeRequest {
|
|
51
|
+
unitID: string;
|
|
52
|
+
}
|
|
53
|
+
export interface DisposeResponse {
|
|
54
|
+
error: Error | undefined;
|
|
55
|
+
}
|
|
56
|
+
export interface EnsureSnapshotRequest {
|
|
57
|
+
unitID: string;
|
|
58
|
+
type: UniverType;
|
|
59
|
+
revision: number;
|
|
60
|
+
}
|
|
61
|
+
export interface EnsureSnapshotResponse {
|
|
62
|
+
error: Error | undefined;
|
|
63
|
+
snapshot: Snapshot | undefined;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* This service is used to apply changesets to a document.
|
|
67
|
+
* It is implements in Node.js. See `univer-pro/apps/univer-collaboration-server`.
|
|
68
|
+
*/
|
|
69
|
+
export interface ApplyService {
|
|
70
|
+
/**
|
|
71
|
+
* Create a unit with given meta.
|
|
72
|
+
* Apply service would save the snapshot to the snapshot service.
|
|
73
|
+
*/
|
|
74
|
+
CreateUnit(request: CreateUnitRequest, metadata?: Metadata): Observable<CreateUnitResponse>;
|
|
75
|
+
/** Apply a changeset to he document. */
|
|
76
|
+
Apply(request: ApplyRequest, metadata?: Metadata): Observable<ApplyResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Dispose a document from the server. It would help to free up some memory.
|
|
79
|
+
* Should be called when the last collaboration member leaves the room.
|
|
80
|
+
*/
|
|
81
|
+
Dispose(request: DisposeRequest, metadata?: Metadata): Observable<DisposeResponse>;
|
|
82
|
+
/**
|
|
83
|
+
* Ensure the snapshot at a given number would be saved to the snapshot service.
|
|
84
|
+
* Normally used for exporting because the server written in Go
|
|
85
|
+
* cannot apply changesets.
|
|
86
|
+
*/
|
|
87
|
+
EnsureSnapshot(request: EnsureSnapshotRequest, metadata?: Metadata): Observable<EnsureSnapshotResponse>;
|
|
88
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Metadata } from "@grpc/grpc-js";
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import type { Empty } from "../google/protobuf/empty";
|
|
4
|
+
import type { Changeset } from "../univer/changeset";
|
|
5
|
+
import type { CollaMsg } from "../univer/colla_msg";
|
|
6
|
+
import type { Error } from "../univer/constants/errors";
|
|
7
|
+
import type { UniverType } from "../univer/constants/univer";
|
|
8
|
+
export declare const protobufPackage = "universer.v1";
|
|
9
|
+
/** more details: https://c3fgartrp2.feishu.cn/docx/OS47dk8BCo1ZeKxXiNvcDLuZn2g#PymGdupuyoYfvTxv1EBciV7in9b */
|
|
10
|
+
export declare enum CombCmd {
|
|
11
|
+
/** UNKNOWN_CMD - unknown cmd */
|
|
12
|
+
UNKNOWN_CMD = 0,
|
|
13
|
+
/** HELLO - call hello to get comb info, this is essential after you connect to the server */
|
|
14
|
+
HELLO = 1,
|
|
15
|
+
/** JOIN - call join to join couple of rooms */
|
|
16
|
+
JOIN = 2,
|
|
17
|
+
/** LEAVE - call leave to leave a room */
|
|
18
|
+
LEAVE = 3,
|
|
19
|
+
/** INGEST - call ingest to broadcast a message to a room */
|
|
20
|
+
INGEST = 4,
|
|
21
|
+
/** HEARTBEAT - call heartbeat to keep the connection alive */
|
|
22
|
+
HEARTBEAT = 5,
|
|
23
|
+
/**
|
|
24
|
+
* RECV - RECV not a cmd actually, you never call a RECV cmd.
|
|
25
|
+
* when you receive a message from comb(may be created by another user), the cmd will be RECV
|
|
26
|
+
*/
|
|
27
|
+
RECV = 6,
|
|
28
|
+
UNRECOGNIZED = -1
|
|
29
|
+
}
|
|
30
|
+
export declare enum CmdRspCode {
|
|
31
|
+
UNKNOWN_CODE = 0,
|
|
32
|
+
OK = 1,
|
|
33
|
+
FAIL = 2,
|
|
34
|
+
UNRECOGNIZED = -1
|
|
35
|
+
}
|
|
36
|
+
export interface ConnectResponse {
|
|
37
|
+
error: Error | undefined;
|
|
38
|
+
memberID: string;
|
|
39
|
+
}
|
|
40
|
+
export interface BroadcastRequest {
|
|
41
|
+
roomID: string;
|
|
42
|
+
message: string;
|
|
43
|
+
}
|
|
44
|
+
export interface NewChangesRequest {
|
|
45
|
+
unitID: string;
|
|
46
|
+
memberID: string;
|
|
47
|
+
type: UniverType;
|
|
48
|
+
changeset: Changeset | undefined;
|
|
49
|
+
}
|
|
50
|
+
export interface NewChangesResponse {
|
|
51
|
+
error: Error | undefined;
|
|
52
|
+
}
|
|
53
|
+
export interface CombMsg {
|
|
54
|
+
cmd: CombCmd;
|
|
55
|
+
/** route key is used to route the message to the right room */
|
|
56
|
+
routeKey: string;
|
|
57
|
+
code: CmdRspCode;
|
|
58
|
+
reason: string;
|
|
59
|
+
traceID: string;
|
|
60
|
+
rule: Rule | undefined;
|
|
61
|
+
collaMsg?: CollaMsg | undefined;
|
|
62
|
+
infoRsp?: CombInfoResponse | undefined;
|
|
63
|
+
joinRsp?: CombJoinResponse | undefined;
|
|
64
|
+
joinReq?: CombJoinRequest | undefined;
|
|
65
|
+
leaveReq?: CombLeaveRequest | undefined;
|
|
66
|
+
}
|
|
67
|
+
export interface CombJoinInfo {
|
|
68
|
+
roomID: string;
|
|
69
|
+
/** extra args for joining the room */
|
|
70
|
+
args: string;
|
|
71
|
+
}
|
|
72
|
+
export interface CombJoinRequest {
|
|
73
|
+
rooms: CombJoinInfo[];
|
|
74
|
+
}
|
|
75
|
+
export interface CombJoinResponse {
|
|
76
|
+
roomInfos: {
|
|
77
|
+
[key: string]: CombJoinResponse_RoomInfo;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export interface CombJoinResponse_RoomInfo {
|
|
81
|
+
roomID: string;
|
|
82
|
+
members: Member[];
|
|
83
|
+
}
|
|
84
|
+
export interface CombJoinResponse_RoomInfosEntry {
|
|
85
|
+
key: string;
|
|
86
|
+
value: CombJoinResponse_RoomInfo | undefined;
|
|
87
|
+
}
|
|
88
|
+
export interface CombInfoResponse {
|
|
89
|
+
memberID: string;
|
|
90
|
+
}
|
|
91
|
+
export interface CombLeaveRequest {
|
|
92
|
+
roomID: string;
|
|
93
|
+
/** extra args for leaving the room */
|
|
94
|
+
args: string;
|
|
95
|
+
}
|
|
96
|
+
export interface Member {
|
|
97
|
+
memberID: string;
|
|
98
|
+
name: string;
|
|
99
|
+
avatar?: string | undefined;
|
|
100
|
+
}
|
|
101
|
+
export interface Rule {
|
|
102
|
+
/** exclude member */
|
|
103
|
+
excludeMember: string[];
|
|
104
|
+
/** only member */
|
|
105
|
+
onlyMember: string[];
|
|
106
|
+
}
|
|
107
|
+
export interface CombService {
|
|
108
|
+
NewChanges(request: NewChangesRequest, metadata?: Metadata): Observable<NewChangesResponse>;
|
|
109
|
+
Broadcast(request: BroadcastRequest, metadata?: Metadata): Observable<Empty>;
|
|
110
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Metadata } from "@grpc/grpc-js";
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import type { Error } from "../univer/constants/errors";
|
|
4
|
+
export declare const protobufPackage = "universer.v1";
|
|
5
|
+
export interface SignUrlRequest {
|
|
6
|
+
fileID: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SignUrlResponse {
|
|
9
|
+
error: Error | undefined;
|
|
10
|
+
url: string;
|
|
11
|
+
}
|
|
12
|
+
export interface FileUploadMeta {
|
|
13
|
+
fileName: string;
|
|
14
|
+
fileHash: string;
|
|
15
|
+
fileSize: number;
|
|
16
|
+
}
|
|
17
|
+
export interface FileUploadRequest {
|
|
18
|
+
data?: Uint8Array | undefined;
|
|
19
|
+
meta?: FileUploadMeta | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface UploadResponse {
|
|
22
|
+
error: Error | undefined;
|
|
23
|
+
fileID: string;
|
|
24
|
+
}
|
|
25
|
+
export interface FileService {
|
|
26
|
+
SignUrl(request: SignUrlRequest, metadata?: Metadata): Observable<SignUrlResponse>;
|
|
27
|
+
Upload(request: Observable<FileUploadRequest>, metadata?: Metadata): Observable<UploadResponse>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Metadata } from "@grpc/grpc-js";
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import type { Error } from "../univer/constants/errors";
|
|
4
|
+
export declare const protobufPackage = "universer.v1";
|
|
5
|
+
export interface User {
|
|
6
|
+
userID: string;
|
|
7
|
+
name: string;
|
|
8
|
+
avatar: string;
|
|
9
|
+
}
|
|
10
|
+
export interface GetUserRequest {
|
|
11
|
+
}
|
|
12
|
+
export interface GetUserResponse {
|
|
13
|
+
error: Error | undefined;
|
|
14
|
+
user: User | undefined;
|
|
15
|
+
}
|
|
16
|
+
export interface UserService {
|
|
17
|
+
GetUser(request: GetUserRequest, metadata?: Metadata): Observable<GetUserResponse>;
|
|
18
|
+
}
|