@univerjs/protocol 0.1.0

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.
Files changed (40) hide show
  1. package/README.md +3 -0
  2. package/lib/cjs/index.js +1 -0
  3. package/lib/es/index.js +13 -0
  4. package/lib/types/index.d.ts +13 -0
  5. package/lib/types/ts/google/api/annotations.d.ts +1 -0
  6. package/lib/types/ts/google/api/http.d.ts +352 -0
  7. package/lib/types/ts/google/protobuf/descriptor.d.ts +825 -0
  8. package/lib/types/ts/google/protobuf/duration.d.ts +78 -0
  9. package/lib/types/ts/google/protobuf/empty.d.ts +14 -0
  10. package/lib/types/ts/google/protobuf/struct.d.ts +65 -0
  11. package/lib/types/ts/google/protobuf/timestamp.d.ts +107 -0
  12. package/lib/types/ts/tagger/tagger.d.ts +1 -0
  13. package/lib/types/ts/univer/changeset.d.ts +19 -0
  14. package/lib/types/ts/univer/colla_msg.d.ts +76 -0
  15. package/lib/types/ts/univer/constants/errors.d.ts +32 -0
  16. package/lib/types/ts/univer/constants/univer.d.ts +8 -0
  17. package/lib/types/ts/univer/doc.d.ts +12 -0
  18. package/lib/types/ts/univer/drawing.d.ts +7 -0
  19. package/lib/types/ts/univer/resource.d.ts +6 -0
  20. package/lib/types/ts/univer/snapshot.d.ts +12 -0
  21. package/lib/types/ts/univer/unit_template.d.ts +9 -0
  22. package/lib/types/ts/univer/univer_file.d.ts +33 -0
  23. package/lib/types/ts/univer/workbook.d.ts +112 -0
  24. package/lib/types/ts/v1/apply.d.ts +72 -0
  25. package/lib/types/ts/v1/comb.d.ts +109 -0
  26. package/lib/types/ts/v1/conf.d.ts +88 -0
  27. package/lib/types/ts/v1/connector.d.ts +74 -0
  28. package/lib/types/ts/v1/exchange.d.ts +83 -0
  29. package/lib/types/ts/v1/file.d.ts +14 -0
  30. package/lib/types/ts/v1/snapshot.d.ts +130 -0
  31. package/lib/types/ts/v1/source_connector/api.d.ts +110 -0
  32. package/lib/types/ts/v1/source_connector/conf.d.ts +29 -0
  33. package/lib/types/ts/v1/source_connector/displayer.d.ts +16 -0
  34. package/lib/types/ts/v1/source_connector/source.d.ts +46 -0
  35. package/lib/types/ts/v1/source_connector/stream_view.d.ts +31 -0
  36. package/lib/types/ts/v1/transform.d.ts +38 -0
  37. package/lib/types/ts/validate/validate.d.ts +950 -0
  38. package/lib/types/utils.d.ts +8 -0
  39. package/lib/umd/index.js +1 -0
  40. package/package.json +47 -0
@@ -0,0 +1,78 @@
1
+ export declare const protobufPackage = "google.protobuf";
2
+ /**
3
+ * A Duration represents a signed, fixed-length span of time represented
4
+ * as a count of seconds and fractions of seconds at nanosecond
5
+ * resolution. It is independent of any calendar and concepts like "day"
6
+ * or "month". It is related to Timestamp in that the difference between
7
+ * two Timestamp values is a Duration and it can be added or subtracted
8
+ * from a Timestamp. Range is approximately +-10,000 years.
9
+ *
10
+ * # Examples
11
+ *
12
+ * Example 1: Compute Duration from two Timestamps in pseudo code.
13
+ *
14
+ * Timestamp start = ...;
15
+ * Timestamp end = ...;
16
+ * Duration duration = ...;
17
+ *
18
+ * duration.seconds = end.seconds - start.seconds;
19
+ * duration.nanos = end.nanos - start.nanos;
20
+ *
21
+ * if (duration.seconds < 0 && duration.nanos > 0) {
22
+ * duration.seconds += 1;
23
+ * duration.nanos -= 1000000000;
24
+ * } else if (duration.seconds > 0 && duration.nanos < 0) {
25
+ * duration.seconds -= 1;
26
+ * duration.nanos += 1000000000;
27
+ * }
28
+ *
29
+ * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
30
+ *
31
+ * Timestamp start = ...;
32
+ * Duration duration = ...;
33
+ * Timestamp end = ...;
34
+ *
35
+ * end.seconds = start.seconds + duration.seconds;
36
+ * end.nanos = start.nanos + duration.nanos;
37
+ *
38
+ * if (end.nanos < 0) {
39
+ * end.seconds -= 1;
40
+ * end.nanos += 1000000000;
41
+ * } else if (end.nanos >= 1000000000) {
42
+ * end.seconds += 1;
43
+ * end.nanos -= 1000000000;
44
+ * }
45
+ *
46
+ * Example 3: Compute Duration from datetime.timedelta in Python.
47
+ *
48
+ * td = datetime.timedelta(days=3, minutes=10)
49
+ * duration = Duration()
50
+ * duration.FromTimedelta(td)
51
+ *
52
+ * # JSON Mapping
53
+ *
54
+ * In JSON format, the Duration type is encoded as a string rather than an
55
+ * object, where the string ends in the suffix "s" (indicating seconds) and
56
+ * is preceded by the number of seconds, with nanoseconds expressed as
57
+ * fractional seconds. For example, 3 seconds with 0 nanoseconds should be
58
+ * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
59
+ * be expressed in JSON format as "3.000000001s", and 3 seconds and 1
60
+ * microsecond should be expressed in JSON format as "3.000001s".
61
+ */
62
+ export interface Duration {
63
+ /**
64
+ * Signed seconds of the span of time. Must be from -315,576,000,000
65
+ * to +315,576,000,000 inclusive. Note: these bounds are computed from:
66
+ * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
67
+ */
68
+ seconds: number;
69
+ /**
70
+ * Signed fractions of a second at nanosecond resolution of the span
71
+ * of time. Durations less than one second are represented with a 0
72
+ * `seconds` field and a positive or negative `nanos` field. For durations
73
+ * of one second or more, a non-zero value for the `nanos` field must be
74
+ * of the same sign as the `seconds` field. Must be from -999,999,999
75
+ * to +999,999,999 inclusive.
76
+ */
77
+ nanos: number;
78
+ }
@@ -0,0 +1,14 @@
1
+ export declare const protobufPackage = "google.protobuf";
2
+ /**
3
+ * A generic empty message that you can re-use to avoid defining duplicated
4
+ * empty messages in your APIs. A typical example is to use it as the request
5
+ * or the response type of an API method. For instance:
6
+ *
7
+ * service Foo {
8
+ * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
9
+ * }
10
+ *
11
+ * The JSON representation for `Empty` is empty JSON object `{}`.
12
+ */
13
+ export interface Empty {
14
+ }
@@ -0,0 +1,65 @@
1
+ export declare const protobufPackage = "google.protobuf";
2
+ /**
3
+ * `NullValue` is a singleton enumeration to represent the null value for the
4
+ * `Value` type union.
5
+ *
6
+ * The JSON representation for `NullValue` is JSON `null`.
7
+ */
8
+ export declare enum NullValue {
9
+ /** NULL_VALUE - Null value. */
10
+ NULL_VALUE = 0,
11
+ UNRECOGNIZED = -1
12
+ }
13
+ /**
14
+ * `Struct` represents a structured data value, consisting of fields
15
+ * which map to dynamically typed values. In some languages, `Struct`
16
+ * might be supported by a native representation. For example, in
17
+ * scripting languages like JS a struct is represented as an
18
+ * object. The details of that representation are described together
19
+ * with the proto support for the language.
20
+ *
21
+ * The JSON representation for `Struct` is JSON object.
22
+ */
23
+ export interface Struct {
24
+ /** Unordered map of dynamically typed values. */
25
+ fields: {
26
+ [key: string]: any | undefined;
27
+ };
28
+ }
29
+ export interface Struct_FieldsEntry {
30
+ key: string;
31
+ value: any | undefined;
32
+ }
33
+ /**
34
+ * `Value` represents a dynamically typed value which can be either
35
+ * null, a number, a string, a boolean, a recursive struct value, or a
36
+ * list of values. A producer of value is expected to set one of these
37
+ * variants. Absence of any variant indicates an error.
38
+ *
39
+ * The JSON representation for `Value` is JSON value.
40
+ */
41
+ export interface Value {
42
+ /** Represents a null value. */
43
+ nullValue?: NullValue | undefined;
44
+ /** Represents a double value. */
45
+ numberValue?: number | undefined;
46
+ /** Represents a string value. */
47
+ stringValue?: string | undefined;
48
+ /** Represents a boolean value. */
49
+ boolValue?: boolean | undefined;
50
+ /** Represents a structured value. */
51
+ structValue?: {
52
+ [key: string]: any;
53
+ } | undefined;
54
+ /** Represents a repeated `Value`. */
55
+ listValue?: Array<any> | undefined;
56
+ }
57
+ /**
58
+ * `ListValue` is a wrapper around a repeated field of values.
59
+ *
60
+ * The JSON representation for `ListValue` is JSON array.
61
+ */
62
+ export interface ListValue {
63
+ /** Repeated field of dynamically typed values. */
64
+ values: any[];
65
+ }
@@ -0,0 +1,107 @@
1
+ export declare const protobufPackage = "google.protobuf";
2
+ /**
3
+ * A Timestamp represents a point in time independent of any time zone or local
4
+ * calendar, encoded as a count of seconds and fractions of seconds at
5
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
6
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
7
+ * Gregorian calendar backwards to year one.
8
+ *
9
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
10
+ * second table is needed for interpretation, using a [24-hour linear
11
+ * smear](https://developers.google.com/time/smear).
12
+ *
13
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
14
+ * restricting to that range, we ensure that we can convert to and from [RFC
15
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
16
+ *
17
+ * # Examples
18
+ *
19
+ * Example 1: Compute Timestamp from POSIX `time()`.
20
+ *
21
+ * Timestamp timestamp;
22
+ * timestamp.set_seconds(time(NULL));
23
+ * timestamp.set_nanos(0);
24
+ *
25
+ * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
26
+ *
27
+ * struct timeval tv;
28
+ * gettimeofday(&tv, NULL);
29
+ *
30
+ * Timestamp timestamp;
31
+ * timestamp.set_seconds(tv.tv_sec);
32
+ * timestamp.set_nanos(tv.tv_usec * 1000);
33
+ *
34
+ * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
35
+ *
36
+ * FILETIME ft;
37
+ * GetSystemTimeAsFileTime(&ft);
38
+ * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
39
+ *
40
+ * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
41
+ * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
42
+ * Timestamp timestamp;
43
+ * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
44
+ * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
45
+ *
46
+ * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
47
+ *
48
+ * long millis = System.currentTimeMillis();
49
+ *
50
+ * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
51
+ * .setNanos((int) ((millis % 1000) * 1000000)).build();
52
+ *
53
+ * Example 5: Compute Timestamp from Java `Instant.now()`.
54
+ *
55
+ * Instant now = Instant.now();
56
+ *
57
+ * Timestamp timestamp =
58
+ * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
59
+ * .setNanos(now.getNano()).build();
60
+ *
61
+ * Example 6: Compute Timestamp from current time in Python.
62
+ *
63
+ * timestamp = Timestamp()
64
+ * timestamp.GetCurrentTime()
65
+ *
66
+ * # JSON Mapping
67
+ *
68
+ * In JSON format, the Timestamp type is encoded as a string in the
69
+ * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
70
+ * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
71
+ * where {year} is always expressed using four digits while {month}, {day},
72
+ * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
73
+ * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
74
+ * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
75
+ * is required. A proto3 JSON serializer should always use UTC (as indicated by
76
+ * "Z") when printing the Timestamp type and a proto3 JSON parser should be
77
+ * able to accept both UTC and other timezones (as indicated by an offset).
78
+ *
79
+ * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
80
+ * 01:30 UTC on January 15, 2017.
81
+ *
82
+ * In JavaScript, one can convert a Date object to this format using the
83
+ * standard
84
+ * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
85
+ * method. In Python, a standard `datetime.datetime` object can be converted
86
+ * to this format using
87
+ * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
88
+ * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
89
+ * the Joda Time's [`ISODateTimeFormat.dateTime()`](
90
+ * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
91
+ * ) to obtain a formatter capable of generating timestamps in this format.
92
+ */
93
+ export interface Timestamp {
94
+ /**
95
+ * Represents seconds of UTC time since Unix epoch
96
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
97
+ * 9999-12-31T23:59:59Z inclusive.
98
+ */
99
+ seconds: number;
100
+ /**
101
+ * Non-negative fractions of a second at nanosecond resolution. Negative
102
+ * second values with fractions must still have non-negative nanos values
103
+ * that count forward in time. Must be from 0 to 999,999,999
104
+ * inclusive.
105
+ */
106
+ nanos: number;
107
+ }
@@ -0,0 +1 @@
1
+ export declare const protobufPackage = "tagger";
@@ -0,0 +1,19 @@
1
+ import type { UniverType } from "./constants/univer";
2
+ export declare const protobufPackage = "univer";
3
+ /** It should be the same as `ICommandInfo` in the frontend. */
4
+ export interface Mutation {
5
+ /** ID of the mutation */
6
+ id: string;
7
+ /** serialized params */
8
+ data: string;
9
+ }
10
+ export interface Changeset {
11
+ /** unitID of the Univer document */
12
+ unitID: string;
13
+ type: UniverType;
14
+ baseRev: number;
15
+ revision: number;
16
+ userID: string;
17
+ mutations: Mutation[];
18
+ memberID: string;
19
+ }
@@ -0,0 +1,76 @@
1
+ import type { Changeset } from "./changeset";
2
+ export declare const protobufPackage = "univer";
3
+ export interface CollaMsg {
4
+ eventID: string;
5
+ joinEvent?: CollaMsgJoin | undefined;
6
+ leaveEvent?: CollaMsgLeave | undefined;
7
+ newCsEvent?: NewChangesets | undefined;
8
+ csAckEvent?: ChangesetAck | undefined;
9
+ csRejEvent?: ChangesetRej | undefined;
10
+ updateCursorEvent?: UpdateCursor | undefined;
11
+ liveShareRequestHost?: LiveShareRequestHost | undefined;
12
+ liveShareNewHost?: LiveShareNewHost | undefined;
13
+ liveShareOperation?: LiveShareOperation | undefined;
14
+ liveShareTerminate?: LiveShareTerminate | undefined;
15
+ errorEvent?: CollaMsgErrorEvent | undefined;
16
+ }
17
+ export interface CollaMsgJoin {
18
+ memberID: string;
19
+ name: string;
20
+ avatar: string;
21
+ }
22
+ export interface CollaMsgLeave {
23
+ memberID: string;
24
+ name: string;
25
+ }
26
+ export interface NewChangesets {
27
+ cs: Changeset | undefined;
28
+ }
29
+ export interface ChangesetAck {
30
+ cs: Changeset | undefined;
31
+ }
32
+ export interface ChangesetRej {
33
+ cs: Changeset | undefined;
34
+ }
35
+ export interface UpdateCursor {
36
+ unitID: string;
37
+ /**
38
+ * Member ID of the user in the collaboration session.
39
+ * If a user open a document multi times, there will be different memberIDs.
40
+ */
41
+ memberID: string;
42
+ selection: string;
43
+ }
44
+ export interface LiveShareRequestHost {
45
+ unitID: string;
46
+ userID: string;
47
+ }
48
+ export interface LiveShareNewHost {
49
+ presenter: string;
50
+ unitID: string;
51
+ userID: string;
52
+ }
53
+ export interface LiveShareOperation {
54
+ unitID: string;
55
+ presenter: string;
56
+ /** key is Operation.id */
57
+ operations: {
58
+ [key: string]: LiveShareOperation_Operation;
59
+ };
60
+ }
61
+ export interface LiveShareOperation_Operation {
62
+ id: string;
63
+ params?: string | undefined;
64
+ }
65
+ export interface LiveShareOperation_OperationsEntry {
66
+ key: string;
67
+ value: LiveShareOperation_Operation | undefined;
68
+ }
69
+ export interface LiveShareTerminate {
70
+ unitID: string;
71
+ }
72
+ /** define msg for errors */
73
+ export interface CollaMsgErrorEvent {
74
+ code: number;
75
+ reason: string;
76
+ }
@@ -0,0 +1,32 @@
1
+ export declare const protobufPackage = "univer.constants";
2
+ export declare enum ErrorCode {
3
+ /** UNDEFINED - general codes */
4
+ UNDEFINED = 0,
5
+ OK = 1,
6
+ INTERNAL_ERROR = 2,
7
+ PERMISSION_DENIED = 3,
8
+ NOT_FOUND = 4,
9
+ UNAUTHENTICATED = 5,
10
+ ALREADY_EXISTS = 6,
11
+ INVALID_ARGUMENT = 7,
12
+ /** CHANGESET_REVISION_CONFILICT - changeset codes with 5000 shift */
13
+ CHANGESET_REVISION_CONFILICT = 5001,
14
+ /** SNAPSHOT_INVALID_SNAPSHOT - snapshotError codes with 6000 shift */
15
+ SNAPSHOT_INVALID_SNAPSHOT = 6001,
16
+ /** APPLY_REJECT - apply service codes with 7000 shift */
17
+ APPLY_REJECT = 7001,
18
+ /** APPLY_NON_SEQUENTIAL_REVISION - apply service expects sequential revisions, otherwise return this code */
19
+ APPLY_NON_SEQUENTIAL_REVISION = 7002,
20
+ /** APPLY_REVISION_CONFILICT - save changeset failed because of revision exists */
21
+ APPLY_REVISION_CONFILICT = 7003,
22
+ /** CONNECTOR_DATA_TOO_LARGE - connector codes with 8000 shift */
23
+ CONNECTOR_DATA_TOO_LARGE = 8001,
24
+ /** LICENSE_MAX_UNITS_EXCEEDED - license code with 9000 shift */
25
+ LICENSE_MAX_UNITS_EXCEEDED = 9001,
26
+ LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED = 9002,
27
+ UNRECOGNIZED = -1
28
+ }
29
+ export interface Error {
30
+ code: ErrorCode;
31
+ message: string;
32
+ }
@@ -0,0 +1,8 @@
1
+ export declare const protobufPackage = "univer.constants";
2
+ export declare enum UniverType {
3
+ UNIVER_UNKNOWN = 0,
4
+ UNIVER_DOC = 1,
5
+ UNIVER_SHEET = 2,
6
+ UNIVER_SLIDE = 3,
7
+ UNRECOGNIZED = -1
8
+ }
@@ -0,0 +1,12 @@
1
+ import type { Resource } from "./resource";
2
+ export declare const protobufPackage = "univer";
3
+ export interface DocumentMeta {
4
+ unitID: string;
5
+ rev: number;
6
+ creator: string;
7
+ name: string;
8
+ /** The key is sheet id */
9
+ resources: Resource[];
10
+ /** The original meta data in JSON format. */
11
+ originalMeta: Uint8Array;
12
+ }
@@ -0,0 +1,7 @@
1
+ export declare const protobufPackage = "univer";
2
+ export interface DrawingMeta {
3
+ unitID: string;
4
+ name: string;
5
+ /** The original meta data in JSON format. */
6
+ originalMeta: Uint8Array;
7
+ }
@@ -0,0 +1,6 @@
1
+ export declare const protobufPackage = "univer";
2
+ export interface Resource {
3
+ id?: string | undefined;
4
+ name: string;
5
+ data: string;
6
+ }
@@ -0,0 +1,12 @@
1
+ import type { UniverType } from "./constants/univer";
2
+ import type { DocumentMeta } from "./doc";
3
+ import type { WorkbookMeta } from "./workbook";
4
+ export declare const protobufPackage = "univer";
5
+ export interface Snapshot {
6
+ /** unitID of the Univer document */
7
+ unitID: string;
8
+ type: UniverType;
9
+ rev: number;
10
+ workbook: WorkbookMeta | undefined;
11
+ doc: DocumentMeta | undefined;
12
+ }
@@ -0,0 +1,9 @@
1
+ export declare const protobufPackage = "univer";
2
+ /** CustomCellTemplate is the template used for make some drawing on sheet, like draw a cute mario XD. */
3
+ export interface CustomCellTemplate {
4
+ rowCount: number;
5
+ colCount: number;
6
+ rowHeight: number;
7
+ colWidth: number;
8
+ showGridlines: number;
9
+ }
@@ -0,0 +1,33 @@
1
+ import type { UniverType } from "./constants/univer";
2
+ import type { DocumentMeta } from "./doc";
3
+ import type { DrawingMeta } from "./drawing";
4
+ import type { WorkbookMeta } from "./workbook";
5
+ export declare const protobufPackage = "univer";
6
+ export interface UniverFile {
7
+ univerID: string;
8
+ name: string;
9
+ /** key: unitID, value: unit */
10
+ units: {
11
+ [key: string]: Unit;
12
+ };
13
+ /** display the unit tree */
14
+ root: UnitTreeNode | undefined;
15
+ }
16
+ export interface UniverFile_UnitsEntry {
17
+ key: string;
18
+ value: Unit | undefined;
19
+ }
20
+ export interface Unit {
21
+ unitID: string;
22
+ name: string;
23
+ type: UniverType;
24
+ workbook?: WorkbookMeta | undefined;
25
+ document?: DocumentMeta | undefined;
26
+ drawing?: DrawingMeta | undefined;
27
+ }
28
+ export interface UnitTreeNode {
29
+ /** the leaf node */
30
+ unitIDs: string[];
31
+ /** the non-leaf node */
32
+ nodes: UnitTreeNode[];
33
+ }
@@ -0,0 +1,112 @@
1
+ import type { DocumentMeta } from "./doc";
2
+ import type { Resource } from "./resource";
3
+ export declare const protobufPackage = "univer";
4
+ export declare enum CellValueType {
5
+ UNKNOWN = 0,
6
+ STRING = 1,
7
+ NUMBER = 2,
8
+ BOOLEAN = 3,
9
+ FORCE_STRING = 4,
10
+ UNRECOGNIZED = -1
11
+ }
12
+ export interface WorksheetMeta {
13
+ type: number;
14
+ id: string;
15
+ name: string;
16
+ rowCount: number;
17
+ columnCount: number;
18
+ /** The original meta data in JSON format. Cell data is excluded. */
19
+ originalMeta: Uint8Array;
20
+ }
21
+ export interface WorkbookMeta {
22
+ unitID: string;
23
+ rev: number;
24
+ creator: string;
25
+ name: string;
26
+ sheetOrder: string[];
27
+ /** The key is sheet id */
28
+ sheets: {
29
+ [key: string]: WorksheetMeta;
30
+ };
31
+ /**
32
+ * Questions: should snapshot server read the celldata?
33
+ * map<string, univer.Resource> resources = 8; // The key is sheet id
34
+ */
35
+ resources: Resource[];
36
+ /** The key is sheet id */
37
+ blockMeta: {
38
+ [key: string]: SheetBlockMeta;
39
+ };
40
+ /** The original meta data in JSON format. Cell data is excluded. */
41
+ originalMeta: Uint8Array;
42
+ }
43
+ export interface WorkbookMeta_SheetsEntry {
44
+ key: string;
45
+ value: WorksheetMeta | undefined;
46
+ }
47
+ export interface WorkbookMeta_BlockMetaEntry {
48
+ key: string;
49
+ value: SheetBlockMeta | undefined;
50
+ }
51
+ /** import/export would use this message */
52
+ export interface CellDataMatrix {
53
+ /** The key is the row number */
54
+ rows: {
55
+ [key: number]: RowData;
56
+ };
57
+ }
58
+ export interface CellDataMatrix_RowsEntry {
59
+ key: number;
60
+ value: RowData | undefined;
61
+ }
62
+ export interface RowData {
63
+ rowNumber: number;
64
+ /** The key is the column number */
65
+ items: {
66
+ [key: number]: CellItem;
67
+ };
68
+ }
69
+ export interface RowData_ItemsEntry {
70
+ key: number;
71
+ value: CellItem | undefined;
72
+ }
73
+ export interface CellItem {
74
+ cell?: CellData | undefined;
75
+ data?: SomeData | undefined;
76
+ }
77
+ export interface SomeData {
78
+ id: string;
79
+ name: string;
80
+ }
81
+ export interface CellValue {
82
+ strV?: string | undefined;
83
+ numV?: number | undefined;
84
+ boolV?: boolean | undefined;
85
+ }
86
+ /** Represents the data for a cell. */
87
+ export interface CellData {
88
+ /** The value of the cell. */
89
+ v: CellValue | undefined;
90
+ /** The type of the cell value. */
91
+ t: CellValueType;
92
+ /** univer doc */
93
+ p: DocumentMeta | undefined;
94
+ /** style */
95
+ s: string;
96
+ /** formula */
97
+ f: string;
98
+ /** formula refId */
99
+ si: string;
100
+ }
101
+ export interface SheetBlock {
102
+ /** block id, generate by backend server */
103
+ id: string;
104
+ startRow: number;
105
+ endRow: number;
106
+ data: Uint8Array;
107
+ }
108
+ export interface SheetBlockMeta {
109
+ sheetID: string;
110
+ /** sheet block ids */
111
+ blocks: string[];
112
+ }
@@ -0,0 +1,72 @@
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 { CustomCellTemplate } from "../univer/unit_template";
7
+ export declare const protobufPackage = "univerpro.v1";
8
+ /** The meta required to create a new unit. */
9
+ export interface WorkbookCreateMeta {
10
+ /**
11
+ * If you want to create an empty sheet, make this undefined or a empty
12
+ * string.
13
+ */
14
+ templateID?: string | undefined;
15
+ /** Name of the unit. It should be localized. */
16
+ name: string;
17
+ /** Locale of the unit. */
18
+ locale: string;
19
+ customCell?: CustomCellTemplate | undefined;
20
+ }
21
+ export interface CreateUnitRequest {
22
+ unitID: string;
23
+ type: UniverType;
24
+ name: string;
25
+ creator: string;
26
+ /** If `type` is UniverType.UNIVER_SHEEET, this is requried. */
27
+ workbookMeta?: WorkbookCreateMeta | undefined;
28
+ }
29
+ export interface CreateUnitResponse {
30
+ error: Error | undefined;
31
+ }
32
+ /**
33
+ * ApplyRequest is almost the same as a Changeset.
34
+ * See `changeset.proto` for details.
35
+ */
36
+ export interface ApplyRequest {
37
+ unitID: string;
38
+ type: UniverType;
39
+ /** changeset to apply */
40
+ changeset: Changeset | undefined;
41
+ /** changsetset to fast forward to, these cs has been applied to the document */
42
+ fastForward: Changeset[];
43
+ }
44
+ export interface ApplyResponse {
45
+ error: Error | undefined;
46
+ /** The revision of the document right now */
47
+ revision: number;
48
+ }
49
+ export interface DisposeRequest {
50
+ unitID: string;
51
+ }
52
+ export interface DisposeResponse {
53
+ error: Error | undefined;
54
+ }
55
+ /**
56
+ * This service is used to apply changesets to a document.
57
+ * It is implements in Node.js. See `univer-pro/apps/univer-collaboration-server`.
58
+ */
59
+ export interface ApplyService {
60
+ /**
61
+ * Create a unit with given meta.
62
+ * Apply service would save the snapshot to the snapshot service.
63
+ */
64
+ CreateUnit(request: CreateUnitRequest, metadata?: Metadata): Observable<CreateUnitResponse>;
65
+ /** Apply a changeset to he document. */
66
+ Apply(request: ApplyRequest, metadata?: Metadata): Observable<ApplyResponse>;
67
+ /**
68
+ * Dispose a document from the server. It would help to free up some memory.
69
+ * Should be called when the last collaboration member leaves the room.
70
+ */
71
+ Dispose(request: DisposeRequest, metadata?: Metadata): Observable<DisposeResponse>;
72
+ }