@univerjs-pro/collaboration-history-service 1.0.0-rc.0 → 1.0.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.
- package/README.md +17 -34
- package/README.zh-CN.md +19 -41
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +48 -107
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,22 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
English | [简体中文](./README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Version history for Univer collaboration, with history lists, author filters, and changeset reads.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```text
|
|
10
|
-
Transport
|
|
11
|
-
→ UniverHistoryEndpoint
|
|
12
|
-
→ UniverHistoryService
|
|
13
|
-
→ History Database Adapter
|
|
14
|
-
```
|
|
7
|
+
Core stores Unit creation information, changesets, and snapshots. History stores only the segment index and reads Core data to build history lists.
|
|
15
8
|
|
|
16
9
|
## Installation and creation
|
|
17
10
|
|
|
18
11
|
```bash
|
|
19
12
|
pnpm add \
|
|
20
|
-
@univerjs-pro/collaboration-service \
|
|
21
13
|
@univerjs-pro/collaboration-history-service \
|
|
22
14
|
@univerjs-pro/collaboration-history-endpoint \
|
|
23
15
|
@univerjs-pro/collaboration-history-database-sqlite
|
|
@@ -25,10 +17,7 @@ pnpm add \
|
|
|
25
17
|
|
|
26
18
|
```ts
|
|
27
19
|
import { SQLiteHistoryDatabaseAdapter } from '@univerjs-pro/collaboration-history-database-sqlite';
|
|
28
|
-
import {
|
|
29
|
-
DefaultHistoryPolicy,
|
|
30
|
-
UniverHistoryService,
|
|
31
|
-
} from '@univerjs-pro/collaboration-history-service';
|
|
20
|
+
import { UniverHistoryService } from '@univerjs-pro/collaboration-history-service';
|
|
32
21
|
|
|
33
22
|
const historyDatabase = new SQLiteHistoryDatabaseAdapter({
|
|
34
23
|
filename: './data/collaboration.sqlite',
|
|
@@ -36,32 +25,33 @@ const historyDatabase = new SQLiteHistoryDatabaseAdapter({
|
|
|
36
25
|
const historyService = new UniverHistoryService({
|
|
37
26
|
collabService,
|
|
38
27
|
dbAdapter: historyDatabase,
|
|
39
|
-
policy: new DefaultHistoryPolicy({ timeIntervalMs: 60_000 }),
|
|
40
28
|
userProvider: {
|
|
41
29
|
async getUsers(userIDs) {
|
|
42
30
|
return applicationUsers.findMany(userIDs);
|
|
43
31
|
},
|
|
44
32
|
},
|
|
45
33
|
});
|
|
46
|
-
|
|
47
|
-
const attachment = historyService.attach(collabService);
|
|
48
34
|
```
|
|
49
35
|
|
|
50
|
-
|
|
36
|
+
Pass your existing Collaboration Service as `collabService`. History updates automatically after Unit creation and edits. Omit `dbAdapter` to use temporary in-memory storage; use a persistent Adapter to retain History across restarts.
|
|
37
|
+
|
|
38
|
+
`userProvider.getUsers` returns user details for the supplied IDs. `applicationUsers` represents your application's user directory. Missing user details are displayed with placeholders.
|
|
39
|
+
|
|
40
|
+
To connect the frontend History UI, register History Endpoint.
|
|
51
41
|
|
|
52
42
|
## History middleware
|
|
53
43
|
|
|
54
|
-
|
|
44
|
+
Configure authorization for all three History read actions through middleware.
|
|
55
45
|
|
|
56
|
-
| Action | When
|
|
46
|
+
| Action | When | Visible fields | Retry semantics | Typical use |
|
|
57
47
|
| --- | --- | --- | --- | --- |
|
|
58
|
-
| `getHistoryList` |
|
|
59
|
-
| `listHistoryCreators` |
|
|
60
|
-
| `getHistoryChangesets` |
|
|
61
|
-
| `indexUnitCreated` | After index Request creation, before writing revision-1 index data | `userID`, `customData`, `request` | Once per logical index; not repeated on collaboration database revision conflicts | Index scope, tenant, audit |
|
|
62
|
-
| `indexChangeset` | After changeset index Request creation, before writing index data | `userID`, `customData`, `request` | Once per logical index; not repeated on collaboration database revision conflicts | Index filtering, tenant, audit |
|
|
48
|
+
| `getHistoryList` | Before reading the history list | `userID`, `customData`, `request` with Unit, pagination and filters | Once per call | Unit read ACL, pagination audit |
|
|
49
|
+
| `listHistoryCreators` | Before reading the author list | `userID`, `customData`, `request.unitID` | Once per call | Unit read ACL |
|
|
50
|
+
| `getHistoryChangesets` | Before reading changesets | `userID`, `customData`, `request` with Unit and revision range | Once per call | Unit read ACL, range limits |
|
|
63
51
|
|
|
64
52
|
```ts
|
|
53
|
+
import { CollabError } from '@univerjs-pro/collaboration-service';
|
|
54
|
+
|
|
65
55
|
historyService.use('getHistoryList', async (ctx, next) => {
|
|
66
56
|
if (!await acl.canRead(ctx.userID, ctx.request.unitID)) {
|
|
67
57
|
throw new CollabError('PERMISSION_DENIED', 'History is not accessible');
|
|
@@ -70,19 +60,12 @@ historyService.use('getHistoryList', async (ctx, next) => {
|
|
|
70
60
|
});
|
|
71
61
|
```
|
|
72
62
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
When an application reads History Service directly, SDK result fields use `userID/userIDs/unitID`. `UniverHistoryEndpoint` maps them at the HTTP protocol boundary to the `userId/userIds/unitId` fields required by the frontend protocol. No manual conversion is needed when using History Client.
|
|
76
|
-
|
|
77
|
-
## Reliability and disposal
|
|
78
|
-
|
|
79
|
-
The convenient `attach()` updates the index in-process but does not guarantee that every update completes. Failure does not affect already committed collaboration data. For strictly lossless indexing, write a transactional outbox in the collaboration commit transaction and have a retryable background worker call `indexUnitCreated()` or `indexChangeset()`.
|
|
63
|
+
## Disposal
|
|
80
64
|
|
|
81
65
|
```ts
|
|
82
|
-
attachment.dispose();
|
|
83
66
|
await historyService.dispose();
|
|
84
67
|
await collabService.dispose();
|
|
85
68
|
await historyDatabase.dispose();
|
|
86
69
|
```
|
|
87
70
|
|
|
88
|
-
|
|
71
|
+
Stop incoming requests before disposal. The application manages the injected Services and Database Adapters.
|
package/README.zh-CN.md
CHANGED
|
@@ -2,23 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
[English](./README.md) | [简体中文](./README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
用户的历史条目、补全创建者资料,并提供 History Endpoint 使用的服务契约。
|
|
5
|
+
为 Univer 协同提供版本历史,支持历史列表、作者筛选和 changeset 读取。
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
```text
|
|
11
|
-
Transport
|
|
12
|
-
→ UniverHistoryEndpoint
|
|
13
|
-
→ UniverHistoryService
|
|
14
|
-
→ History Database Adapter
|
|
15
|
-
```
|
|
7
|
+
Core 保存 Unit 创建信息、changesets 和 snapshot 等核心数据;History 只保存分段索引,
|
|
8
|
+
查询时从 Core 获取数据并生成历史列表。
|
|
16
9
|
|
|
17
10
|
## 安装与创建
|
|
18
11
|
|
|
19
12
|
```bash
|
|
20
13
|
pnpm add \
|
|
21
|
-
@univerjs-pro/collaboration-service \
|
|
22
14
|
@univerjs-pro/collaboration-history-service \
|
|
23
15
|
@univerjs-pro/collaboration-history-endpoint \
|
|
24
16
|
@univerjs-pro/collaboration-history-database-sqlite
|
|
@@ -26,10 +18,7 @@ pnpm add \
|
|
|
26
18
|
|
|
27
19
|
```ts
|
|
28
20
|
import { SQLiteHistoryDatabaseAdapter } from '@univerjs-pro/collaboration-history-database-sqlite';
|
|
29
|
-
import {
|
|
30
|
-
DefaultHistoryPolicy,
|
|
31
|
-
UniverHistoryService,
|
|
32
|
-
} from '@univerjs-pro/collaboration-history-service';
|
|
21
|
+
import { UniverHistoryService } from '@univerjs-pro/collaboration-history-service';
|
|
33
22
|
|
|
34
23
|
const historyDatabase = new SQLiteHistoryDatabaseAdapter({
|
|
35
24
|
filename: './data/collaboration.sqlite',
|
|
@@ -37,34 +26,35 @@ const historyDatabase = new SQLiteHistoryDatabaseAdapter({
|
|
|
37
26
|
const historyService = new UniverHistoryService({
|
|
38
27
|
collabService,
|
|
39
28
|
dbAdapter: historyDatabase,
|
|
40
|
-
policy: new DefaultHistoryPolicy({ timeIntervalMs: 60_000 }),
|
|
41
29
|
userProvider: {
|
|
42
30
|
async getUsers(userIDs) {
|
|
43
31
|
return applicationUsers.findMany(userIDs);
|
|
44
32
|
},
|
|
45
33
|
},
|
|
46
34
|
});
|
|
47
|
-
|
|
48
|
-
const attachment = historyService.attach(collabService);
|
|
49
35
|
```
|
|
50
36
|
|
|
51
|
-
`
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
`collabService` 传入已有的协同 Service,创建实例后自动随 Unit 创建和编辑更新历史。
|
|
38
|
+
省略 `dbAdapter` 时使用临时内存存储;需要重启后保留历史时,配置持久化 Adapter。
|
|
39
|
+
|
|
40
|
+
`userProvider.getUsers` 根据传入的用户 ID 返回用户资料。示例中的 `applicationUsers`
|
|
41
|
+
代表应用的用户目录;缺少资料时显示占位用户。
|
|
42
|
+
|
|
43
|
+
接入前端 History UI 时,注册 History Endpoint。
|
|
54
44
|
|
|
55
45
|
## History middleware
|
|
56
46
|
|
|
57
|
-
History
|
|
47
|
+
为三个 History 读取 action 配置权限 middleware。
|
|
58
48
|
|
|
59
49
|
| Action | 触发时机 | 可见字段 | 重试语义 | 典型用途 |
|
|
60
50
|
| --- | --- | --- | --- | --- |
|
|
61
|
-
| `getHistoryList` |
|
|
62
|
-
| `listHistoryCreators` |
|
|
63
|
-
| `getHistoryChangesets` |
|
|
64
|
-
| `indexUnitCreated` | 创建索引 Request 后、写 revision 1 索引数据前 | `userID`、`customData`、`request` | 每次逻辑索引一次;协同数据库 revision 冲突重试时不重复 | 索引范围、tenant 和审计 |
|
|
65
|
-
| `indexChangeset` | changeset 索引 Request 创建后、写索引数据前 | `userID`、`customData`、`request` | 每次逻辑索引一次;协同数据库 revision 冲突重试时不重复 | 索引过滤、tenant 和审计 |
|
|
51
|
+
| `getHistoryList` | 读取历史列表前 | `userID`、`customData`、含 Unit、分页和筛选参数的 `request` | 每次调用一次 | Unit 读取 ACL、分页审计 |
|
|
52
|
+
| `listHistoryCreators` | 读取作者列表前 | `userID`、`customData`、`request.unitID` | 每次调用一次 | Unit 读取 ACL |
|
|
53
|
+
| `getHistoryChangesets` | 读取 changesets 前 | `userID`、`customData`、含 Unit 和 revision 范围的 `request` | 每次调用一次 | Unit 读取 ACL、范围限制 |
|
|
66
54
|
|
|
67
55
|
```ts
|
|
56
|
+
import { CollabError } from '@univerjs-pro/collaboration-service';
|
|
57
|
+
|
|
68
58
|
historyService.use('getHistoryList', async (ctx, next) => {
|
|
69
59
|
if (!await acl.canRead(ctx.userID, ctx.request.unitID)) {
|
|
70
60
|
throw new CollabError('PERMISSION_DENIED', 'History is not accessible');
|
|
@@ -73,24 +63,12 @@ historyService.use('getHistoryList', async (ctx, next) => {
|
|
|
73
63
|
});
|
|
74
64
|
```
|
|
75
65
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
应用直接读取 History Service 时,SDK 自有结果字段使用 `userID/userIDs/unitID`;
|
|
79
|
-
`UniverHistoryEndpoint` 会在 HTTP 协议边界自动映射为前端协议所需的
|
|
80
|
-
`userId/userIds/unitId`。使用 History Client 时无需手动转换。
|
|
81
|
-
|
|
82
|
-
## 可靠性与资源释放
|
|
83
|
-
|
|
84
|
-
便捷的 `attach()` 在进程内更新索引,但不保证每次更新都完成;失败不影响已提交的协同
|
|
85
|
-
数据。若应用要求索引严格不丢失,应在协同提交事务中写 transactional outbox,再由可重复
|
|
86
|
-
执行的后台任务调用 `indexUnitCreated()` 或
|
|
87
|
-
`indexChangeset()`。
|
|
66
|
+
## 资源释放
|
|
88
67
|
|
|
89
68
|
```ts
|
|
90
|
-
attachment.dispose();
|
|
91
69
|
await historyService.dispose();
|
|
92
70
|
await collabService.dispose();
|
|
93
71
|
await historyDatabase.dispose();
|
|
94
72
|
```
|
|
95
73
|
|
|
96
|
-
|
|
74
|
+
释放前先停止接收请求。注入的 Service 和 Database Adapter 由应用管理。
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object['defineProperty'](exports,Symbol['toStringTag'],{'value':'Module'});let e=require('@univerjs-pro/collaboration'),t=require('@univerjs-pro/collaboration-service');function n(_0x24e743){let _0x589720=[..._0x24e743]['sort']((_0x28d9ec,_0x3ba89c)=>_0x28d9ec['revision']-_0x3ba89c['revision']),_0x1ed38d=new Map();for(let _0x43be4a of _0x589720){let _0x23912b=_0x1ed38d['get'](_0x43be4a['historyRevision'])??[];_0x23912b['push'](_0x43be4a),_0x1ed38d['set'](_0x43be4a['historyRevision'],_0x23912b);}return[..._0x1ed38d['values']()]['map'](_0x49151d=>{let _0x53dc4f=_0x49151d[0x0],_0x57a05a=_0x49151d['at'](-0x1),_0x103117=i(_0x49151d['map'](_0xb7c98=>_0xb7c98['userID'])),_0x5c1d4f=i(_0x49151d['flatMap'](_0x45b026=>_0x45b026['commands'])),_0x415201=_0x49151d['find'](_0x2dd11b=>_0x2dd11b['restoredRevision']!==void 0x0)?.['restoredRevision'];return{'historyId':_0x53dc4f['unitID']+':'+_0x53dc4f['historyRevision'],'unitID':_0x53dc4f['unitID'],'type':_0x53dc4f['type'],'startRevision':_0x53dc4f['revision'],'endRevision':_0x57a05a['revision'],'userID':_0x53dc4f['userID'],'userIDs':_0x103117,'commands':_0x5c1d4f,'createdAt':_0x53dc4f['committedAt'],'startRevisionCreatedAt':_0x53dc4f['committedAt'],'endRevisionCreatedAt':_0x57a05a['committedAt'],..._0x53dc4f['additionalFields']===void 0x0?{}:{'additionalFields':_0x53dc4f['additionalFields']},'origin':_0x53dc4f['origin'],..._0x415201===void 0x0?{}:{'restoredRevision':_0x415201}};});}function r(_0x51e3a0,_0x3946b8){let _0x517b15=new Set(_0x3946b8['userIDs']??[]),_0x3c80ec=_0x51e3a0['filter'](_0x29b372=>(_0x3946b8['beforeRevision']===void 0x0||_0x29b372['startRevision']<_0x3946b8['beforeRevision'])&&(_0x3946b8['origin']===void 0x0||_0x3946b8['origin']===0x0||_0x29b372['origin']===_0x3946b8['origin'])&&(_0x517b15['size']===0x0||_0x29b372['userIDs']['some'](_0x26da77=>_0x517b15['has'](_0x26da77))))['sort']((_0x4d9a5e,_0x4ed3e7)=>_0x4ed3e7['startRevision']-_0x4d9a5e['startRevision']);return{'records':_0x3c80ec['slice'](0x0,_0x3946b8['length']),'hasMore':_0x3c80ec['length']>_0x3946b8['length']};}function i(_0x118145){return[...new Set(_0x118145)];}var a=class{['_entries']=new Map();['_disposed']=!0x1;async['getIndexState'](_0x20be22){this['_assertOpen']();let _0x3263e2=o(this['_entries']['get'](_0x20be22));if(!_0x3263e2)return null;let _0x578f0e=this['_entries']['get'](_0x20be22)?.['get'](_0x3263e2['historyRevision']);if(!_0x578f0e)throw Error('History\x20Database\x20Adapter\x20contains\x20an\x20invalid\x20history\x20revision');return{'unitID':_0x20be22,'type':_0x3263e2['type'],'latestRevision':_0x3263e2['revision'],'currentHistoryRevision':_0x3263e2['historyRevision'],'currentHistoryCreatedAt':_0x578f0e['committedAt'],'forceNextHistory':_0x3263e2['forceNextHistory']};}async['getRevision'](_0xab4663,_0x3aa073){return this['_assertOpen'](),this['_entries']['get'](_0xab4663)?.['get'](_0x3aa073)??null;}async['appendRevision'](_0x22d322,_0x45148a){this['_assertOpen']();let _0x4a4d3e=this['_entries']['get'](_0x22d322['unitID'])??new Map();if(_0x4a4d3e['has'](_0x22d322['revision']))return{'status':'already-indexed'};let _0x594262=o(_0x4a4d3e)?.['revision']??0x0;return _0x594262!==_0x45148a['expectedLatestRevision']||_0x22d322['revision']!==_0x594262+0x1?{'status':'revision-conflict','actualLatestRevision':_0x594262}:(_0x4a4d3e['set'](_0x22d322['revision'],structuredClone(_0x22d322)),this['_entries']['set'](_0x22d322['unitID'],_0x4a4d3e),{'status':'appended'});}async['listRecords'](_0x329a70,_0x40c6a9){return this['_assertOpen'](),r(n([...this['_entries']['get'](_0x329a70)?.['values']()??[]]),_0x40c6a9);}async['listCreators'](_0x410c1b){this['_assertOpen']();let _0x34891b=new Map();for(let _0x30f034 of this['_entries']['get'](_0x410c1b)?.['values']()??[]){let _0x2a7f8c=_0x34891b['get'](_0x30f034['userID'])??new Set();_0x2a7f8c['add'](_0x30f034['origin']),_0x34891b['set'](_0x30f034['userID'],_0x2a7f8c);}return[..._0x34891b]['map'](([_0x49e6d2,_0x4c4e30])=>({'userID':_0x49e6d2,'origins':[..._0x4c4e30]}));}async['dispose'](){this['_disposed']||(this['_disposed']=!0x0,this['_entries']['clear']());}['_assertOpen'](){if(this['_disposed'])throw Error('History\x20Database\x20Adapter\x20is\x20disposed');}};function o(_0x3f4836){if(!_0x3f4836?.['size'])return;let _0x354e52;for(let _0x4e5a22 of _0x3f4836['values']())(!_0x354e52||_0x4e5a22['revision']>_0x354e52['revision'])&&(_0x354e52=_0x4e5a22);return _0x354e52;}var s=class{['_timeIntervalMs'];['_singleHistoryMutationIds'];constructor(_0x1613c8={}){if(this['_timeIntervalMs']=_0x1613c8['timeIntervalMs']??0xea60,!Number['isSafeInteger'](this['_timeIntervalMs'])||this['_timeIntervalMs']<0x0)throw TypeError('timeIntervalMs\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');this['_singleHistoryMutationIds']=_0x1613c8['singleHistoryMutationIds']??e['SINGLE_HISTORY_MUTATIONS'];}['evaluate'](_0x38e5fc){if(!_0x38e5fc['state']||_0x38e5fc['revision']===0x1)return{'startsNewHistory':!0x0,'forceNextHistory':!0x1};let _0x457bff=!!_0x38e5fc['changeset']?.['mutations']['some'](_0x29d763=>this['_singleHistoryMutationIds']['has'](_0x29d763['id']));return{'startsNewHistory':_0x38e5fc['state']['forceNextHistory']||_0x457bff||_0x38e5fc['committedAt']-_0x38e5fc['state']['currentHistoryCreatedAt']>=this['_timeIntervalMs'],'forceNextHistory':_0x457bff};}},c=class{['_middlewares']=new Map();['use'](_0xa8ff4,_0xd65f7f){let _0x10267e=this['_middlewares']['get'](_0xa8ff4)??[],_0xf1d36f=_0xd65f7f;_0x10267e['push'](_0xf1d36f),this['_middlewares']['set'](_0xa8ff4,_0x10267e);let _0xe9a44a=!0x1;return{'dispose':()=>{if(_0xe9a44a)return;_0xe9a44a=!0x0;let _0x23a1fb=_0x10267e['indexOf'](_0xf1d36f);_0x23a1fb>=0x0&&_0x10267e['splice'](_0x23a1fb,0x1);}};}async['run'](_0x1daaa0,_0x51ac8a,_0x4e48c5){let _0x1882f6=[...this['_middlewares']['get'](_0x1daaa0)??[]],_0x3cbb19=async _0x341c76=>{let _0x47bc14=_0x1882f6[_0x341c76];if(!_0x47bc14){await _0x4e48c5();return;}let _0x2b7630=!0x1,_0x57774e,_0x5ce4ba=()=>{if(_0x2b7630)throw Error('Middleware\x20for\x20action\x20'+_0x1daaa0+'\x20called\x20next()\x20more\x20than\x20once');return _0x2b7630=!0x0,_0x57774e=_0x3cbb19(_0x341c76+0x1),_0x57774e;};try{await _0x47bc14(_0x51ac8a,_0x5ce4ba);}catch(_0x552e5f){if(_0x57774e)try{await _0x57774e;}catch{}throw _0x552e5f;}if(!_0x2b7630)throw Error('Middleware\x20for\x20action\x20'+_0x1daaa0+'\x20completed\x20without\x20calling\x20next()');await _0x57774e;};await _0x3cbb19(0x0);}['clear'](){this['_middlewares']['clear']();}},l='univer.mutation.create-unit',u='univer.mutation.revert-version',d=class{['_collabService'];['_dbAdapter'];['_ownsDbAdapter'];['_policy'];['_userProvider'];['_logger'];['_maxIndexRetries'];['_middleware']=new c();['_attachments']=new Set();['_calls']=new Set();['_indexQueues']=new Map();['_state']='running';constructor(_0x221430){if(!_0x221430?.['collabService'])throw TypeError('UniverHistoryService\x20requires\x20a\x20collabService');if(this['_collabService']=_0x221430['collabService'],this['_dbAdapter']=_0x221430['dbAdapter']??new a(),this['_ownsDbAdapter']=_0x221430['dbAdapter']===void 0x0,this['_policy']=_0x221430['policy']??new s(),this['_userProvider']=_0x221430['userProvider'],this['_logger']=_0x221430['logger'],this['_maxIndexRetries']=_0x221430['maxIndexRetries']??0x3,!Number['isSafeInteger'](this['_maxIndexRetries'])||this['_maxIndexRetries']<0x0)throw TypeError('maxIndexRetries\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');}['use'](_0x217142,_0x540633){return this['_assertRunning'](),this['_middleware']['use'](_0x217142,_0x540633);}['getHistoryList'](_0x52afb8,_0x89ebb8){return this['_call'](async()=>{let _0xd7a1f7=p(_0x89ebb8),_0x55ade6=f(_0x52afb8),_0x29a58e={..._0xd7a1f7,'request':_0x55ade6},_0x1668a7;return await this['_middleware']['run']('getHistoryList',_0x29a58e,async()=>{if(m(_0x52afb8['unitID']),!Number['isSafeInteger'](_0x52afb8['length'])||_0x52afb8['length']<0x1||_0x52afb8['length']>0x64)throw C('length\x20must\x20be\x20an\x20integer\x20from\x201\x20to\x20100');let _0x4155a7=_(_0x52afb8['lastLabel']),_0x2d35e8=await this['_databaseCall'](()=>this['_dbAdapter']['listRecords'](_0x52afb8['unitID'],{'length':_0x52afb8['length'],..._0x4155a7===void 0x0?{}:{'beforeRevision':_0x4155a7},..._0x52afb8['origin']===void 0x0?{}:{'origin':_0x52afb8['origin']},..._0x52afb8['userIDs']===void 0x0?{}:{'userIDs':_0x52afb8['userIDs']}})),_0x3f3a34=await this['_resolveUsers'](w(_0x2d35e8['records']['flatMap'](_0x16479a=>_0x16479a['userIDs'])),_0xd7a1f7,_0x55ade6),_0x440009={};for(let _0x3bfb81 of _0x2d35e8['records'])_0x440009[_0x3bfb81['historyId']]=await this['_historyData'](_0x3bfb81);_0x1668a7={'hasMore':_0x2d35e8['hasMore'],'lastLabel':_0x2d35e8['records']['at'](-0x1)?.['startRevision']['toString']()??'','entities':{'datas':_0x440009,'users':_0x3f3a34},'historyIds':_0x2d35e8['records']['map'](_0x55080a=>_0x55080a['historyId'])};}),_0x1668a7;});}['listHistoryCreators'](_0x47dcde,_0x3b651e){return this['_call'](async()=>{let _0x292c06=p(_0x3b651e),_0x52beeb=f(_0x47dcde),_0x4b9d76={..._0x292c06,'request':_0x52beeb},_0x2f9c7b;return await this['_middleware']['run']('listHistoryCreators',_0x4b9d76,async()=>{m(_0x47dcde['unitID']);let _0x426fb1=await this['_databaseCall'](()=>this['_dbAdapter']['listCreators'](_0x47dcde['unitID'])),_0xf8003=await this['_resolveUsers'](_0x426fb1['map'](_0x13a46b=>_0x13a46b['userID']),_0x292c06,_0x52beeb);_0x2f9c7b={'creators':_0x426fb1['map'](_0x5b0df4=>{let _0x1b88df=_0xf8003[_0x5b0df4['userID']]??x(_0x5b0df4['userID']);return{'userID':_0x5b0df4['userID'],'name':_0x1b88df['name'],'avatar':_0x1b88df['avatar'],'origins':_0x5b0df4['origins']};})};}),_0x2f9c7b;});}['getHistoryChangesets'](_0x457150,_0x4f8d7b){return this['_call'](async()=>{let _0x81d8a4=p(_0x4f8d7b),_0x41e848=f(_0x457150),_0x3b3afe={..._0x81d8a4,'request':_0x41e848},_0x2c5057;return await this['_middleware']['run']('getHistoryChangesets',_0x3b3afe,async()=>{if(m(_0x457150['unitID']),h('startRevision',_0x457150['startRevision']),h('endRevision',_0x457150['endRevision']),_0x457150['endRevision']<_0x457150['startRevision'])throw C('endRevision\x20must\x20not\x20precede\x20startRevision');let _0x328593=await this['_databaseCall'](()=>this['_dbAdapter']['getIndexState'](_0x457150['unitID']));if(!_0x328593)throw new t['CollabError']('UNIT_NOT_FOUND','History\x20for\x20Unit\x20'+_0x457150['unitID']+'\x20does\x20not\x20exist');if(_0x457150['endRevision']>_0x328593['latestRevision'])throw C('endRevision\x20exceeds\x20the\x20latest\x20indexed\x20revision');let _0x298b68=await this['_collabService']['getChangesets']({'unitID':_0x457150['unitID'],'type':_0x328593['type'],'from':_0x457150['startRevision']-0x1,'to':_0x457150['endRevision']},_0x81d8a4),_0x3fabef=new Set(_0x298b68['changesets']['map'](_0x4a4ea4=>_0x4a4ea4['userID']));for(let _0x5aec79=_0x457150['startRevision'];_0x5aec79<=_0x457150['endRevision'];_0x5aec79+=0x1){let _0x492d89=await this['_databaseCall'](()=>this['_dbAdapter']['getRevision'](_0x457150['unitID'],_0x5aec79));_0x492d89&&_0x3fabef['add'](_0x492d89['userID']);}_0x2c5057={'changesets':_0x298b68['changesets'],'users':await this['_resolveUsers']([..._0x3fabef],_0x81d8a4,_0x41e848)};}),_0x2c5057;});}['indexUnitCreated'](_0x4ada37,_0x3d3c66){return this['_call'](()=>this['_executeIndexUnitCreated'](_0x4ada37,p(_0x3d3c66)));}['indexChangeset'](_0x51262e,_0x977e26){return this['_call'](()=>this['_executeIndexChangeset'](_0x51262e,p(_0x977e26)));}['attach'](_0x5a3619=this['_collabService']){this['_assertRunning']();let _0x2af2fc=[_0x5a3619['on']('unitCreated',_0x5eb5cb=>{this['_enqueue'](_0x5eb5cb['record']['unitID'],()=>this['_executeIndexUnitCreated']({'unitID':_0x5eb5cb['record']['unitID'],'type':_0x5eb5cb['record']['type'],'createdAt':_0x5eb5cb['createdAt']},{'userID':_0x5eb5cb['userID'],'customData':_0x5eb5cb['customData']}));}),_0x5a3619['on']('changesetCommitted',_0x4b9c53=>{this['_enqueue'](_0x4b9c53['changeset']['unitID'],()=>this['_executeIndexChangeset']({'changeset':_0x4b9c53['changeset'],'committedAt':_0x4b9c53['committedAt']},{'userID':_0x4b9c53['userID'],'customData':_0x4b9c53['customData']}));})],_0x248720=!0x1,_0x225497={'dispose':()=>{if(!_0x248720){_0x248720=!0x0;for(let _0x119dc9 of _0x2af2fc)_0x119dc9['dispose']();this['_attachments']['delete'](_0x225497);}}};return this['_attachments']['add'](_0x225497),_0x225497;}async['dispose'](){if(this['_state']!=='disposed'){if(this['_state']==='disposing'){await Promise['allSettled']([...this['_calls'],...this['_indexQueues']['values']()]);return;}this['_state']='disposing';for(let _0x1213cb of[...this['_attachments']])_0x1213cb['dispose']();await Promise['allSettled']([...this['_calls'],...this['_indexQueues']['values']()]),this['_middleware']['clear'](),this['_indexQueues']['clear'](),this['_ownsDbAdapter']&&await this['_dbAdapter']['dispose']?.(),this['_state']='disposed';}}async['_executeIndexUnitCreated'](_0x57b844,_0x10bb11){let _0x430500=f(_0x57b844),_0x15dd33={..._0x10bb11,'request':_0x430500},_0x527579;return await this['_middleware']['run']('indexUnitCreated',_0x15dd33,async()=>{g(_0x57b844['unitID'],_0x57b844['type'],0x1,_0x57b844['createdAt']);let _0x28d337={'unitID':_0x57b844['unitID'],'type':_0x57b844['type'],'revision':0x1,'userID':_0x10bb11['userID'],'commands':[l],'committedAt':_0x57b844['createdAt'],'origin':0x1,'historyRevision':0x1,'forceNextHistory':!0x1};_0x527579=await this['_appendWithRetry'](_0x28d337,()=>_0x28d337);}),_0x527579;}async['_executeIndexChangeset'](_0x3928f3,_0x479b27){let _0x438ad2=f(_0x3928f3),_0x8a74b6={..._0x479b27,'request':_0x438ad2},_0x17a7ad;return await this['_middleware']['run']('indexChangeset',_0x8a74b6,async()=>{let {changeset:_0x5e6073}=_0x3928f3;if(g(_0x5e6073['unitID'],_0x5e6073['type'],_0x5e6073['revision'],_0x3928f3['committedAt']),_0x5e6073['revision']<0x2)throw C('Confirmed\x20changeset\x20revision\x20must\x20be\x20at\x20least\x202');if(!_0x5e6073['userID'])throw C('changeset.userID\x20is\x20required');_0x17a7ad=await this['_appendWithRetry']({'unitID':_0x5e6073['unitID'],'type':_0x5e6073['type'],'revision':_0x5e6073['revision'],'userID':_0x5e6073['userID'],'commands':w(_0x5e6073['mutations']['map'](_0x5ecd53=>_0x5ecd53['id'])),'committedAt':_0x3928f3['committedAt'],..._0x5e6073['additionalFields']===void 0x0?{}:{'additionalFields':_0x5e6073['additionalFields']},'origin':v(_0x5e6073['additionalFields']),'historyRevision':_0x5e6073['revision'],'forceNextHistory':!0x1,...y(_0x5e6073)},_0x103ae4=>{if(!_0x103ae4)throw S(_0x5e6073['unitID'],_0x5e6073['revision'],0x0);if(_0x103ae4['type']!==_0x5e6073['type'])throw C('Changeset\x20type\x20does\x20not\x20match\x20indexed\x20Unit\x20type');if(_0x5e6073['revision']!==_0x103ae4['latestRevision']+0x1)throw S(_0x5e6073['unitID'],_0x5e6073['revision'],_0x103ae4['latestRevision']);let _0x559835=this['_policy']['evaluate']({'state':_0x103ae4,'unitID':_0x5e6073['unitID'],'type':_0x5e6073['type'],'revision':_0x5e6073['revision'],'committedAt':_0x3928f3['committedAt'],'changeset':_0x5e6073});return{'unitID':_0x5e6073['unitID'],'type':_0x5e6073['type'],'revision':_0x5e6073['revision'],'userID':_0x5e6073['userID'],'commands':w(_0x5e6073['mutations']['map'](_0x136f34=>_0x136f34['id'])),'committedAt':_0x3928f3['committedAt'],..._0x5e6073['additionalFields']===void 0x0?{}:{'additionalFields':_0x5e6073['additionalFields']},'origin':v(_0x5e6073['additionalFields']),'historyRevision':_0x559835['startsNewHistory']?_0x5e6073['revision']:_0x103ae4['currentHistoryRevision'],'forceNextHistory':_0x559835['forceNextHistory'],...y(_0x5e6073)};});}),_0x17a7ad;}async['_appendWithRetry'](_0x7d8223,_0x5b294b){for(let _0x23e59c=0x0;_0x23e59c<=this['_maxIndexRetries'];_0x23e59c+=0x1){let _0x5636c5=await this['_databaseCall'](()=>this['_dbAdapter']['getIndexState'](_0x7d8223['unitID']));if(await this['_databaseCall'](()=>this['_dbAdapter']['getRevision'](_0x7d8223['unitID'],_0x7d8223['revision'])))return{'status':'already-indexed','revision':_0x7d8223['revision']};let _0x5506fb=_0x5b294b(_0x5636c5),_0x18ff14=await this['_databaseCall'](()=>this['_dbAdapter']['appendRevision'](_0x5506fb,{'expectedLatestRevision':_0x5636c5?.['latestRevision']??0x0}));if(_0x18ff14['status']==='appended')return{'status':'indexed','revision':_0x5506fb['revision']};if(_0x18ff14['status']==='already-indexed')return{'status':'already-indexed','revision':_0x5506fb['revision']};}throw new t['CollabError']('ADAPTER_FAILURE','History\x20Database\x20Adapter\x20CAS\x20retries\x20were\x20exhausted',{'retryable':!0x0});}async['_historyData'](_0x1e9f9d){let _0x148f45='';if(_0x1e9f9d['restoredRevision']!==void 0x0){let _0x1e8ff5=await this['_databaseCall'](()=>this['_dbAdapter']['getRevision'](_0x1e9f9d['unitID'],_0x1e9f9d['restoredRevision']));_0x148f45=_0x1e8ff5?String(_0x1e8ff5['committedAt']):'';}return{'userID':_0x1e9f9d['userID'],'unitID':_0x1e9f9d['unitID'],'command':_0x1e9f9d['commands'],'createTime':String(_0x1e9f9d['createdAt']),'recoverTime':_0x148f45,'startRevision':_0x1e9f9d['startRevision'],'endRevision':_0x1e9f9d['endRevision'],...b(_0x1e9f9d),'origin':_0x1e9f9d['origin'],'startRevCreateTime':_0x1e9f9d['startRevisionCreatedAt'],'endRevCreateTime':_0x1e9f9d['endRevisionCreatedAt'],'userIDs':_0x1e9f9d['userIDs']};}async['_resolveUsers'](_0x16cbb3,_0x21265b,_0x867464){let _0x2849e8=w(_0x16cbb3['filter'](Boolean)),_0x84401=[];if(this['_userProvider']&&_0x2849e8['length'])try{_0x84401=await this['_userProvider']['getUsers'](_0x2849e8,{..._0x21265b,'request':_0x867464});}catch(_0x3b5ddb){this['_logError']('History\x20user\x20lookup\x20failed',_0x3b5ddb);}let _0x3316f1={};for(let _0x205622 of _0x84401)_0x205622?.['userID']&&_0x2849e8['includes'](_0x205622['userID'])&&(_0x3316f1[_0x205622['userID']]=_0x205622);for(let _0xae69ef of _0x2849e8)_0x3316f1[_0xae69ef]??=x(_0xae69ef);return _0x3316f1;}['_enqueue'](_0x47f7a0,_0x1c1df1){if(this['_state']!=='running')return;let _0x485319=(this['_indexQueues']['get'](_0x47f7a0)??Promise['resolve']())['catch'](()=>void 0x0)['then'](_0x1c1df1)['then'](()=>void 0x0)['catch'](_0x4425c7=>{this['_logError']('History\x20background\x20indexing\x20failed',_0x4425c7);})['finally'](()=>{this['_indexQueues']['get'](_0x47f7a0)===_0x485319&&this['_indexQueues']['delete'](_0x47f7a0);});this['_indexQueues']['set'](_0x47f7a0,_0x485319);}['_call'](_0xbf48ec){this['_assertRunning']();let _0x3aa5d6=_0xbf48ec();return this['_calls']['add'](_0x3aa5d6),_0x3aa5d6['then'](()=>this['_calls']['delete'](_0x3aa5d6),()=>this['_calls']['delete'](_0x3aa5d6)),_0x3aa5d6;}async['_databaseCall'](_0x290230){try{return await _0x290230();}catch(_0x4f4e67){throw _0x4f4e67 instanceof t['CollabError']?_0x4f4e67:new t['CollabError']('ADAPTER_FAILURE','History\x20Database\x20Adapter\x20failed',{'retryable':!0x0,'cause':_0x4f4e67});}}['_assertRunning'](){if(this['_state']!=='running')throw new t['CollabError']('INTERNAL_ERROR','History\x20Service\x20is\x20'+this['_state'],{'retryable':!0x0});}['_logError'](_0x4b1deb,_0x4ca86a){try{this['_logger']?.['error'](_0x4b1deb,{'error':_0x4ca86a instanceof Error?_0x4ca86a['message']:String(_0x4ca86a)});}catch{}}};function f(_0x5c851a){return{..._0x5c851a};}function p(_0x529fe2){if(!_0x529fe2||typeof _0x529fe2!='object')throw C('context\x20must\x20be\x20an\x20object');if(typeof _0x529fe2['userID']!='string'||_0x529fe2['userID']['length']===0x0)throw C('userID\x20must\x20be\x20a\x20non-empty\x20string');if(_0x529fe2['customData']!==void 0x0&&(_0x529fe2['customData']===null||typeof _0x529fe2['customData']!='object'||Array['isArray'](_0x529fe2['customData'])))throw C('customData\x20must\x20be\x20an\x20object');return{'userID':_0x529fe2['userID'],'customData':_0x529fe2['customData']??Object['create'](null)};}function m(_0xb42a42){if(!_0xb42a42)throw C('unitID\x20is\x20required');}function h(_0x36ad43,_0x901a){if(!Number['isSafeInteger'](_0x901a)||_0x901a<0x1)throw C(_0x36ad43+'\x20must\x20be\x20a\x20positive\x20safe\x20integer');}function g(_0x2142b9,_0x2d585c,_0x485d53,_0x4bb0f4){if(m(_0x2142b9),h('revision',_0x485d53),!Number['isSafeInteger'](_0x4bb0f4)||_0x4bb0f4<0x0)throw C('History\x20timestamp\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');}function _(_0xf0baf7){if(!_0xf0baf7)return;let _0x45ecd9=Number(_0xf0baf7);return h('lastLabel',_0x45ecd9),_0x45ecd9;}function v(_0x22264a){if(!_0x22264a)return 0x1;try{let _0x2d3854=JSON['parse'](_0x22264a);return _0x2d3854['origin']===0x2?0x2:(_0x2d3854['origin'],0x1);}catch{return 0x1;}}function y(_0x2ce5d0){let _0x48120b=_0x2ce5d0['mutations']['find'](_0x442f22=>_0x442f22['id']===u);if(!_0x48120b)return{};try{let _0x2a550b=JSON['parse'](_0x48120b['data']);return Number['isSafeInteger'](_0x2a550b['revision'])&&_0x2a550b['revision']>=0x1?{'restoredRevision':_0x2a550b['revision']}:{};}catch{return{};}}function b(_0x3da638){return _0x3da638['additionalFields']===void 0x0?_0x3da638['restoredRevision']===void 0x0?{}:{'additionalFields':JSON['stringify']({'restoredRevision':_0x3da638['restoredRevision']})}:{'additionalFields':_0x3da638['additionalFields']};}function x(_0x5c76ea){return{'userID':_0x5c76ea,'name':_0x5c76ea,'avatar':'','anonymous':!0x0,'canBindAnonymous':!0x1,'phone':'','email':'','createTimestamp':0x0};}function S(_0x25189c,_0x417b83,_0x1c45aa){return new t['CollabError']('ADAPTER_FAILURE','History\x20for\x20Unit\x20'+_0x25189c+'\x20cannot\x20index\x20revision\x20'+_0x417b83+'\x20after\x20'+_0x1c45aa,{'retryable':!0x0});}function C(_0x584a2b){return new t['CollabError']('INVALID_REQUEST',_0x584a2b);}function w(_0x4cb55d){return[...new Set(_0x4cb55d)];}exports['DefaultHistoryPolicy']=s,exports['MemoryHistoryDatabaseAdapter']=a,exports['UniverHistoryService']=d,exports['buildHistoryRecords']=n,exports['selectHistoryRecords']=r;
|
|
1
|
+
Object['defineProperty'](exports,Symbol['toStringTag'],{'value':'Module'});let e=require('@univerjs-pro/collaboration'),t=require('@univerjs-pro/collaboration-service');function n(_0x5c3e83,_0x5046c5){let _0x37cacf=0x0,_0x229e84=_0x5c3e83['length'];for(;_0x37cacf<_0x229e84;){let _0x58b228=_0x37cacf+_0x229e84>>>0x1;_0x5c3e83[_0x58b228]['startRevision']<=_0x5046c5?_0x37cacf=_0x58b228+0x1:_0x229e84=_0x58b228;}return _0x37cacf;}function r(_0x109b5b,_0x447221){let _0x367b5f=new Set(_0x447221['userIDs']??[]),_0x59f34e=[],_0x967bcb=Math['min'](_0x447221['throughRevision'],(_0x447221['beforeRevision']??0x1/0x0)-0x1);for(let _0x1dc4b0=n(_0x109b5b,_0x967bcb)-0x1;_0x1dc4b0>=0x0;_0x1dc4b0--){let _0xbccc22=_0x109b5b[_0x1dc4b0];if(!(_0x447221['origin']&&_0xbccc22['origin']!==_0x447221['origin'])&&!(_0x367b5f['size']&&!_0x367b5f['has'](_0xbccc22['userID']))){if(_0x59f34e['length']===_0x447221['length'])return{'records':_0x59f34e,'hasMore':!0x0};_0x59f34e['push']({'record':{..._0xbccc22},'endRevision':Math['min'](_0x447221['throughRevision'],(_0x109b5b[_0x1dc4b0+0x1]?.['startRevision']??0x1/0x0)-0x1)});}}return{'records':_0x59f34e,'hasMore':!0x1};}function i(_0x3608b9,_0x511aca){let _0x206e8d=new Map();for(let _0xa3cafc of _0x3608b9){if(_0xa3cafc['startRevision']>_0x511aca)break;let _0x4bc87d=_0x206e8d['get'](_0xa3cafc['userID'])??new Set();_0x4bc87d['add'](_0xa3cafc['origin']),_0x206e8d['set'](_0xa3cafc['userID'],_0x4bc87d);}return[..._0x206e8d]['sort'](([_0x2c4531],[_0x20ffb0])=>_0x2c4531<_0x20ffb0?-0x1:+(_0x2c4531>_0x20ffb0))['map'](([_0x28bf2a,_0x36fcb9])=>({'userID':_0x28bf2a,'origins':[..._0x36fcb9]['sort']((_0x1eb5e5,_0x46fd0b)=>_0x1eb5e5-_0x46fd0b)}));}function a(_0x4ddcea,_0x2dd3e3){return _0x4ddcea['unitID']===_0x2dd3e3['unitID']&&_0x4ddcea['startRevision']===_0x2dd3e3['startRevision']&&_0x4ddcea['userID']===_0x2dd3e3['userID']&&_0x4ddcea['createdAt']===_0x2dd3e3['createdAt']&&_0x4ddcea['origin']===_0x2dd3e3['origin']&&_0x4ddcea['additionalFields']===_0x2dd3e3['additionalFields'];}function o(_0xa892ff){if(!_0xa892ff['unitID']||!_0xa892ff['userID']||!Number['isSafeInteger'](_0xa892ff['startRevision'])||_0xa892ff['startRevision']<0x1||!Number['isSafeInteger'](_0xa892ff['createdAt'])||_0xa892ff['createdAt']<0x0)throw TypeError('History\x20record\x20is\x20invalid');}var s=class{['_records']=new Map();['_disposed']=!0x1;async['getLatestRecord'](_0xfd1af3,_0x3d39e7){this['_assertOpen']();let _0x3c280a=this['_records']['get'](_0x3d39e7)?.['at'](-0x1);return _0x3c280a?{..._0x3c280a}:null;}async['appendRecord'](_0x285f4b,_0xb91058,_0xbe6da7){this['_assertOpen'](),o(_0xb91058);let _0x41720b=this['_records']['get'](_0xb91058['unitID'])??[],_0xa3925f=_0x41720b[n(_0x41720b,_0xb91058['startRevision'])-0x1];if(_0xa3925f?.['startRevision']===_0xb91058['startRevision'])return{'status':a(_0xa3925f,_0xb91058)?'already-exists':'conflict'};let _0x57ffa6=_0x41720b['at'](-0x1)?.['startRevision']??null;return _0x57ffa6!==_0xbe6da7['expectedLatestStartRevision']||_0xb91058['startRevision']<=(_0x57ffa6??0x0)?{'status':'conflict'}:(_0x41720b['push']({..._0xb91058}),this['_records']['set'](_0xb91058['unitID'],_0x41720b),{'status':'appended'});}async['listRecords'](_0x1aef76,_0x4a2e69,_0x4a9e46){return this['_assertOpen'](),r(this['_records']['get'](_0x4a2e69)??[],_0x4a9e46);}async['listCreators'](_0x5e061a,_0x3623a9,_0x38987e){return this['_assertOpen'](),i(this['_records']['get'](_0x3623a9)??[],_0x38987e['throughRevision']);}async['dispose'](){this['_disposed']=!0x0,this['_records']['clear']();}['_assertOpen'](){if(this['_disposed'])throw Error('Memory\x20History\x20Database\x20Adapter\x20is\x20disposed');}},c=class{['_timeIntervalMs'];['_singleHistoryMutationIds'];constructor(_0x36d8e4={}){if(this['_timeIntervalMs']=_0x36d8e4['timeIntervalMs']??0xea60,!Number['isSafeInteger'](this['_timeIntervalMs'])||this['_timeIntervalMs']<0x0)throw TypeError('timeIntervalMs\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');this['_singleHistoryMutationIds']=_0x36d8e4['singleHistoryMutationIds']??e['SINGLE_HISTORY_MUTATIONS'];}['evaluate'](_0x2f8ed8){let _0x2552f8=!!_0x2f8ed8['changeset']['mutations']['some'](_0x559c15=>this['_singleHistoryMutationIds']['has'](_0x559c15['id']));return{'startsNewHistory':_0x2f8ed8['currentRecord']===null||_0x2552f8||_0x2f8ed8['changeset']['createTime']*0x3e8-_0x2f8ed8['currentRecord']['createdAt']>=this['_timeIntervalMs'],'forceNextHistory':_0x2552f8};}},l=class{['_middlewares']=new Map();['use'](_0x1b5ce0,_0x163acc){let _0x58921c=this['_middlewares']['get'](_0x1b5ce0)??[],_0x174719=_0x163acc;_0x58921c['push'](_0x174719),this['_middlewares']['set'](_0x1b5ce0,_0x58921c);let _0x38faf8=!0x1;return{'dispose':()=>{if(_0x38faf8)return;_0x38faf8=!0x0;let _0x275f3a=_0x58921c['indexOf'](_0x174719);_0x275f3a>=0x0&&_0x58921c['splice'](_0x275f3a,0x1);}};}async['run'](_0x2196a4,_0x48655d,_0x88744b){let _0x1e9683=[...this['_middlewares']['get'](_0x2196a4)??[]],_0x5e0ee4=async _0xf712a8=>{let _0x3c9c77=_0x1e9683[_0xf712a8];if(!_0x3c9c77){await _0x88744b();return;}let _0xec8714=!0x1,_0x28dcc5,_0x13a023=()=>{if(_0xec8714)throw Error('Middleware\x20for\x20action\x20'+_0x2196a4+'\x20called\x20next()\x20more\x20than\x20once');return _0xec8714=!0x0,_0x28dcc5=_0x5e0ee4(_0xf712a8+0x1),_0x28dcc5;};try{await _0x3c9c77(_0x48655d,_0x13a023);}catch(_0xe9c3b3){if(_0x28dcc5)try{await _0x28dcc5;}catch{}throw _0xe9c3b3;}if(!_0xec8714)throw Error('Middleware\x20for\x20action\x20'+_0x2196a4+'\x20completed\x20without\x20calling\x20next()');await _0x28dcc5;};await _0x5e0ee4(0x0);}['clear'](){this['_middlewares']['clear']();}},u=0x100;function d(_0x3838f7){let _0x4ef1c4=_0x3838f7['createTime'];if(_0x4ef1c4===void 0x0||!Number['isSafeInteger'](_0x4ef1c4)||_0x4ef1c4<0x0||!Number['isSafeInteger'](_0x4ef1c4*0x3e8))throw new t['CollabError']('ADAPTER_FAILURE','History\x20requires\x20a\x20valid\x20persisted\x20changeset\x20createTime');return _0x4ef1c4*0x3e8;}async function f(_0xca3159,_0x38cae2,_0x733705){let _0x5dc573=await _0xca3159['dbAdapter']['getUnit'](_0x38cae2,_0x733705);if(!_0x5dc573)throw new t['CollabError']('UNIT_NOT_FOUND','Unit\x20'+_0x733705+'\x20does\x20not\x20exist');if(_0x5dc573['unitID']!==_0x733705||!_0x5dc573['creatorID']||!Number['isSafeInteger'](_0x5dc573['createdAt'])||_0x5dc573['createdAt']<0x0||!Number['isSafeInteger'](_0x5dc573['headRevision'])||_0x5dc573['headRevision']<0x1)throw new t['CollabError']('ADAPTER_FAILURE','History\x20received\x20invalid\x20Unit\x20creation\x20facts');return _0x5dc573;}function p(_0x318185,_0x3f58c5,_0x4faecf){if(_0x318185['unitID']!==_0x3f58c5['unitID']||_0x318185['type']!==_0x3f58c5['type']||_0x318185['revision']!==_0x4faecf||!_0x318185['userID'])throw new t['CollabError']('ADAPTER_FAILURE','History\x20received\x20incomplete\x20or\x20invalid\x20changesets');d(_0x318185);}async function*m(_0x666f91,_0x782175,_0x42c1d5,_0x3e22fb,_0x32f724){let _0x466cd5=Math['max'](_0x3e22fb,0x1);for(;_0x466cd5<_0x32f724;){let _0x95454e=Math['min'](_0x466cd5+u,_0x32f724),{changesets:_0x3be59e}=await _0x666f91['getChangesets']({'unitID':_0x42c1d5['unitID'],'type':_0x42c1d5['type'],'from':_0x466cd5,'to':_0x95454e},_0x782175);if(_0x3be59e['length']!==_0x95454e-_0x466cd5)throw new t['CollabError']('ADAPTER_FAILURE','History\x20requires\x20continuous\x20Core\x20changesets');_0x3be59e['forEach']((_0xaa016a,_0x13e909)=>p(_0xaa016a,_0x42c1d5,_0x466cd5+_0x13e909+0x1)),yield _0x3be59e,_0x466cd5=_0x95454e;}}var h=class extends Error{},g=class{['_core'];['_database'];['_policy'];['_maxCachedUnits'];['_maxRetries'];['_log'];['_states']=new Map();['_queues']=new Map();['_initializations']=new Map();constructor(_0x4d43f3,_0x543eea,_0x6b6df9,_0x1267c6,_0x556e35,_0x29b6fd){this['_core']=_0x4d43f3,this['_database']=_0x543eea,this['_policy']=_0x6b6df9,this['_maxCachedUnits']=_0x1267c6,this['_maxRetries']=_0x556e35,this['_log']=_0x29b6fd;}['committed'](_0x416291,_0x5e5e12){let {unitID:_0x51973a,revision:_0x176325}=_0x5e5e12;this['_background'](_0x51973a,()=>this['_sync'](_0x416291,_0x51973a,_0x176325,_0x5e5e12));}['created'](_0x342b9c,_0x4431d3){this['_background'](_0x4431d3['unitID'],()=>this['_sync'](_0x342b9c,_0x4431d3['unitID'],0x1));}['initializeIfEmpty'](_0x24062f,_0x5e94fb){let _0x4beeb3=this['_initializations']['get'](_0x5e94fb['unitID']);if(_0x4beeb3)return _0x4beeb3;let _0x157b6d,_0x1037ab,_0x58db42=new Promise((_0x5e6ded,_0x3bb052)=>{_0x157b6d=_0x5e6ded,_0x1037ab=_0x3bb052;});return this['_initializations']['set'](_0x5e94fb['unitID'],_0x58db42),this['_serialize'](_0x5e94fb['unitID'],async()=>{try{if(await this['_database']['getLatestRecord'](_0x24062f,_0x5e94fb['unitID'])){_0x157b6d(null);return;}let _0x1df626=_(_0x5e94fb),_0x5097ed=[_0x1df626['currentRecord']];for await(let _0x4ec516 of m(this['_core'],_0x24062f,_0x5e94fb,0x1,_0x5e94fb['headRevision']))for(let _0x4d70c3 of _0x4ec516){let _0x282a28=this['_advance'](_0x1df626,_0x4d70c3);_0x282a28['currentRecord']!==_0x1df626['currentRecord']&&_0x5097ed['push'](_0x282a28['currentRecord']),_0x1df626=_0x282a28;}_0x157b6d(_0x5097ed);let _0x17d983=null;for(let _0x92d863 of _0x5097ed)await this['_append'](_0x24062f,_0x92d863,_0x17d983),_0x17d983=_0x92d863['startRevision'];this['_remember'](_0x1df626);}catch(_0x592cf7){throw this['_states']['delete'](_0x5e94fb['unitID']),_0x1037ab(_0x592cf7),_0x592cf7;}finally{this['_initializations']['get'](_0x5e94fb['unitID'])===_0x58db42&&this['_initializations']['delete'](_0x5e94fb['unitID']);}})['catch'](this['_log']),_0x58db42;}async['dispose'](){for(;this['_queues']['size'];)await Promise['allSettled']([...this['_queues']['values']()]);this['_states']['clear'](),this['_initializations']['clear']();}async['_sync'](_0x247ec3,_0x2c06f5,_0x3df447,_0x3b2b62){for(let _0xef4ef=0x0;_0xef4ef<=this['_maxRetries'];_0xef4ef++)try{let _0x495ea2=this['_states']['get'](_0x2c06f5)??await this['_restore'](_0x247ec3,_0x2c06f5);if(_0x3df447<=_0x495ea2['processedRevision']){this['_remember'](_0x495ea2);return;}if(_0x3b2b62&&_0x3b2b62['revision']===_0x495ea2['processedRevision']+0x1)p(_0x3b2b62,_0x495ea2['unit'],_0x3b2b62['revision']),_0x495ea2=await this['_apply'](_0x247ec3,_0x495ea2,_0x3b2b62);else{for await(let _0x311259 of m(this['_core'],_0x247ec3,_0x495ea2['unit'],_0x495ea2['processedRevision'],_0x3df447))for(let _0x21eea2 of _0x311259)_0x495ea2=await this['_apply'](_0x247ec3,_0x495ea2,_0x21eea2);}this['_remember'](_0x495ea2);return;}catch(_0x145b88){if(this['_states']['delete'](_0x2c06f5),!(_0x145b88 instanceof h)||_0xef4ef===this['_maxRetries'])throw _0x145b88;}}async['_restore'](_0x94c977,_0x44fbe2){let _0x2e7a01=await f(this['_core'],_0x94c977,_0x44fbe2),_0x52067c=await this['_database']['getLatestRecord'](_0x94c977,_0x44fbe2);if(!_0x52067c){let _0x430e6c=_(_0x2e7a01);return await this['_append'](_0x94c977,_0x430e6c['currentRecord'],null),_0x430e6c;}if(_0x52067c['startRevision']>_0x2e7a01['headRevision'])throw new t['CollabError']('ADAPTER_FAILURE','History\x20boundary\x20exceeds\x20Core\x20head');if(_0x52067c['startRevision']===0x1)return{..._(_0x2e7a01),'currentRecord':_0x52067c};let _0x47ec89=await this['_database']['listRecords'](_0x94c977,_0x44fbe2,{'throughRevision':_0x52067c['startRevision'],'beforeRevision':_0x52067c['startRevision'],'length':0x1});for await(let _0x1ee2d1 of m(this['_core'],_0x94c977,_0x2e7a01,_0x52067c['startRevision']-0x1,_0x52067c['startRevision'])){let _0x1cb654=_0x1ee2d1[0x0],_0x5b63ec=this['_policy']['evaluate']({'unitID':_0x44fbe2,'type':_0x2e7a01['type'],'currentRecord':_0x47ec89['records'][0x0]?.['record']??null,'changeset':_0x1cb654});return{'unit':_0x2e7a01,'processedRevision':_0x52067c['startRevision'],'currentRecord':_0x52067c,'forceNextHistory':_0x5b63ec['forceNextHistory']};}throw new t['CollabError']('ADAPTER_FAILURE','History\x20starting\x20changeset\x20is\x20missing');}['_advance'](_0x444731,_0x35adc9){p(_0x35adc9,_0x444731['unit'],_0x444731['processedRevision']+0x1);let _0x341359=this['_policy']['evaluate']({'unitID':_0x444731['unit']['unitID'],'type':_0x444731['unit']['type'],'currentRecord':_0x444731['currentRecord'],'changeset':_0x35adc9}),_0x1aa5fb=_0x444731['currentRecord']['startRevision']===0x1||_0x444731['forceNextHistory']||_0x341359['startsNewHistory']?{'unitID':_0x35adc9['unitID'],'startRevision':_0x35adc9['revision'],'userID':_0x35adc9['userID'],'createdAt':d(_0x35adc9),'origin':v(_0x35adc9['additionalFields']),..._0x35adc9['additionalFields']===void 0x0?{}:{'additionalFields':_0x35adc9['additionalFields']}}:_0x444731['currentRecord'];return{'unit':_0x444731['unit'],'processedRevision':_0x35adc9['revision'],'currentRecord':_0x1aa5fb,'forceNextHistory':_0x341359['forceNextHistory']};}async['_apply'](_0x1b0b41,_0x5aa862,_0x1d4bbb){let _0x5d6c73=this['_advance'](_0x5aa862,_0x1d4bbb);return _0x5d6c73['currentRecord']!==_0x5aa862['currentRecord']&&await this['_append'](_0x1b0b41,_0x5d6c73['currentRecord'],_0x5aa862['currentRecord']['startRevision']),this['_remember'](_0x5d6c73),_0x5d6c73;}async['_append'](_0x1a638f,_0x2d443a,_0x20f744){if((await this['_database']['appendRecord'](_0x1a638f,_0x2d443a,{'expectedLatestStartRevision':_0x20f744}))['status']==='conflict')throw new h('History\x20boundary\x20changed\x20during\x20indexing');}['_remember'](_0x419676){for(this['_states']['delete'](_0x419676['unit']['unitID']),this['_states']['set'](_0x419676['unit']['unitID'],_0x419676);this['_states']['size']>this['_maxCachedUnits'];)this['_states']['delete'](this['_states']['keys']()['next']()['value']);}['_serialize'](_0x2a1004,_0x37fe14){let _0x17ffe5=(this['_queues']['get'](_0x2a1004)??Promise['resolve']())['then'](_0x37fe14,_0x37fe14),_0x15ad20=_0x17ffe5['then'](()=>void 0x0,()=>void 0x0)['finally'](()=>{this['_queues']['get'](_0x2a1004)===_0x15ad20&&this['_queues']['delete'](_0x2a1004);});return this['_queues']['set'](_0x2a1004,_0x15ad20),_0x17ffe5;}['_background'](_0x4e1af4,_0x2d642d){this['_serialize'](_0x4e1af4,_0x2d642d)['catch'](this['_log']);}};function _(_0x5b8957){return{'unit':_0x5b8957,'processedRevision':0x1,'forceNextHistory':!0x1,'currentRecord':{'unitID':_0x5b8957['unitID'],'startRevision':0x1,'userID':_0x5b8957['creatorID'],'createdAt':_0x5b8957['createdAt'],'origin':0x1}};}function v(_0x580b16){if(!_0x580b16)return 0x1;try{return JSON['parse'](_0x580b16)?.['origin']===0x2?0x2:0x1;}catch{return 0x1;}}async function y(_0x16bf04,_0x34e177,_0x41c334,_0x5eb583){let _0x571800=[..._0x5eb583]['sort']((_0x43389f,_0x431ebe)=>_0x43389f['record']['startRevision']-_0x431ebe['record']['startRevision'])['map'](_0x934cc8=>({'range':_0x934cc8,'commands':new Set(_0x934cc8['record']['startRevision']===0x1?['univer.mutation.create-unit']:[]),'users':new Set(_0x934cc8['record']['startRevision']===0x1?[_0x41c334['creatorID']]:[]),'startTime':_0x934cc8['record']['startRevision']===0x1?_0x41c334['createdAt']:_0x934cc8['record']['createdAt'],'endTime':_0x934cc8['record']['createdAt']})),_0x9727e6=new Map([[0x1,_0x41c334['createdAt']]]);for(let _0x36b031=0x0;_0x36b031<_0x571800['length'];){let _0x2a6851=_0x36b031;for(;_0x2a6851+0x1<_0x571800['length']&&_0x571800[_0x2a6851]['range']['endRevision']+0x1===_0x571800[_0x2a6851+0x1]['range']['record']['startRevision'];)_0x2a6851++;let _0x4611af=_0x36b031,_0x70fe50=_0x571800[_0x36b031]['range']['record']['startRevision']-0x1,_0x4b195f=_0x571800[_0x2a6851]['range']['endRevision'];for await(let _0x6b1506 of m(_0x16bf04,_0x34e177,_0x41c334,_0x70fe50,_0x4b195f))for(let _0x4e8692 of _0x6b1506){for(;_0x4e8692['revision']>_0x571800[_0x4611af]['range']['endRevision'];)_0x4611af++;let _0x34bfcd=_0x571800[_0x4611af],_0x335faa=d(_0x4e8692);_0x4e8692['revision']===_0x34bfcd['range']['record']['startRevision']&&(_0x34bfcd['startTime']=_0x335faa),_0x34bfcd['endTime']=_0x335faa,_0x34bfcd['users']['add'](_0x4e8692['userID']);for(let _0x4fa9e3 of _0x4e8692['mutations']){if(_0x34bfcd['commands']['add'](_0x4fa9e3['id']),_0x4fa9e3['id']!=='univer.mutation.revert-version')continue;let _0x1311ad;try{_0x1311ad=JSON['parse'](_0x4fa9e3['data'])['revision'];}catch{throw new t['CollabError']('ADAPTER_FAILURE','History\x20contains\x20invalid\x20restore\x20data');}if(typeof _0x1311ad!='number'||!Number['isSafeInteger'](_0x1311ad)||_0x1311ad<0x1||_0x1311ad>=_0x4e8692['revision'])throw new t['CollabError']('ADAPTER_FAILURE','History\x20contains\x20an\x20invalid\x20restore\x20revision');_0x34bfcd['restoredRevision']??=_0x1311ad;}}_0x36b031=_0x2a6851+0x1;}let _0x36c894=new Set(_0x571800['flatMap'](_0x6125d2=>_0x6125d2['restoredRevision']===void 0x0?[]:[_0x6125d2['restoredRevision']]));for(let _0xece46c of _0x36c894)if(!_0x9727e6['has'](_0xece46c)){for await(let _0x526ab1 of m(_0x16bf04,_0x34e177,_0x41c334,_0xece46c-0x1,_0xece46c))_0x9727e6['set'](_0xece46c,d(_0x526ab1[0x0]));}let _0x239d6b=Object['create'](null);for(let _0x470588 of _0x571800){let _0x58fffa=_0x470588['range']['record'],_0x2a62b1=_0x58fffa['additionalFields']??(_0x470588['restoredRevision']===void 0x0?void 0x0:JSON['stringify']({'restoredRevision':_0x470588['restoredRevision']}));_0x239d6b[_0x41c334['unitID']+':'+_0x58fffa['startRevision']]={'unitID':_0x41c334['unitID'],'userID':_0x58fffa['userID'],'userIDs':[..._0x470588['users']],'command':[..._0x470588['commands']],'createTime':String(_0x58fffa['createdAt']),'startRevision':_0x58fffa['startRevision'],'endRevision':_0x470588['range']['endRevision'],'startRevCreateTime':_0x470588['startTime'],'endRevCreateTime':_0x470588['endTime'],'recoverTime':_0x470588['restoredRevision']===void 0x0?'':String(_0x9727e6['get'](_0x470588['restoredRevision'])),'origin':_0x58fffa['origin'],..._0x2a62b1===void 0x0?{}:{'additionalFields':_0x2a62b1}};}return _0x239d6b;}var b=class{['_options'];['_dbAdapter'];['_middleware']=new l();['_indexer'];['_subscriptions']=[];['_calls']=new Set();['_state']='running';['_disposePromise'];constructor(_0x2f3567){if(this['_options']=_0x2f3567,!_0x2f3567?.['collabService']||!_0x2f3567['collabService']['dbAdapter'])throw TypeError('History\x20requires\x20collabService\x20with\x20a\x20dbAdapter');let _0x2d969b=_0x2f3567['maxIndexRetries']??0x3,_0x4d298c=_0x2f3567['maxCachedUnits']??0x3e8;if(!Number['isSafeInteger'](_0x2d969b)||_0x2d969b<0x0)throw TypeError('maxIndexRetries\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');if(!Number['isSafeInteger'](_0x4d298c)||_0x4d298c<0x1)throw TypeError('maxCachedUnits\x20must\x20be\x20a\x20positive\x20safe\x20integer');this['_dbAdapter']=_0x2f3567['dbAdapter']??new s(),this['_indexer']=new g(_0x2f3567['collabService'],this['_dbAdapter'],_0x2f3567['policy']??new c(),_0x4d298c,_0x2d969b,_0xe82ff7=>this['_logError']('History\x20background\x20indexing\x20failed',_0xe82ff7));try{this['_subscriptions']['push'](_0x2f3567['collabService']['on']('unitCreated',_0xded141=>this['_indexer']['created'](_0xded141,_0xded141['record']))),this['_subscriptions']['push'](_0x2f3567['collabService']['on']('changesetCommitted',_0x347087=>this['_indexer']['committed'](_0x347087,_0x347087['changeset'])));}catch(_0x4e6c47){for(let _0x182d4d of this['_subscriptions'])_0x182d4d['dispose']();throw _0x4e6c47;}}['use'](_0x19bad3,_0x1b4e48){return this['_assertRunning'](),this['_middleware']['use'](_0x19bad3,_0x1b4e48);}['getHistoryList'](_0x3194cc,_0x445e43){return this['_read']('getHistoryList',_0x3194cc,_0x445e43,async _0x394f9a=>{if(!Number['isSafeInteger'](_0x3194cc['length'])||_0x3194cc['length']<0x1||_0x3194cc['length']>0x64)throw E('length\x20must\x20be\x20an\x20integer\x20from\x201\x20to\x20100');if(_0x3194cc['origin']!==void 0x0&&![0x0,0x1,0x2]['includes'](_0x3194cc['origin']))throw E('Invalid\x20History\x20origin');let _0x45317b=w(_0x3194cc['lastLabel']),_0x18ccdb=await f(this['_options']['collabService'],_0x394f9a,_0x3194cc['unitID']),_0x3d8ffe={'throughRevision':_0x18ccdb['headRevision'],'length':_0x3194cc['length'],..._0x45317b===void 0x0?{}:{'beforeRevision':_0x45317b},..._0x3194cc['origin']===void 0x0?{}:{'origin':_0x3194cc['origin']},..._0x3194cc['userIDs']===void 0x0?{}:{'userIDs':_0x3194cc['userIDs']}},_0x3c840a=await this['_dbAdapter']['listRecords'](_0x394f9a,_0x18ccdb['unitID'],_0x3d8ffe);if(!_0x3c840a['records']['length']&&!await this['_dbAdapter']['getLatestRecord'](_0x394f9a,_0x18ccdb['unitID'])){let _0x51864e=await this['_indexer']['initializeIfEmpty'](_0x394f9a,_0x18ccdb);_0x3c840a=_0x51864e?r(_0x51864e,_0x3d8ffe):await this['_dbAdapter']['listRecords'](_0x394f9a,_0x18ccdb['unitID'],_0x3d8ffe);}let _0x4c4c67=await y(this['_options']['collabService'],_0x394f9a,_0x18ccdb,_0x3c840a['records']),_0x489f51=await this['_resolveUsers'](Object['values'](_0x4c4c67)['flatMap'](_0x5c7546=>_0x5c7546['userIDs']),_0x394f9a);return{'hasMore':_0x3c840a['hasMore'],'lastLabel':_0x3c840a['records']['at'](-0x1)?.['record']['startRevision']['toString']()??'','entities':{'datas':_0x4c4c67,'users':_0x489f51},'historyIds':_0x3c840a['records']['map'](({record:_0x49a24c})=>_0x49a24c['unitID']+':'+_0x49a24c['startRevision'])};});}['listHistoryCreators'](_0x56e442,_0x2e85e6){return this['_read']('listHistoryCreators',_0x56e442,_0x2e85e6,async _0x25c8eb=>{let _0x3693eb=await f(this['_options']['collabService'],_0x25c8eb,_0x56e442['unitID']),_0x579ec7={'throughRevision':_0x3693eb['headRevision']},_0x482afe=await this['_dbAdapter']['listCreators'](_0x25c8eb,_0x3693eb['unitID'],_0x579ec7);if(!_0x482afe['length']&&!await this['_dbAdapter']['getLatestRecord'](_0x25c8eb,_0x3693eb['unitID'])){let _0x481939=await this['_indexer']['initializeIfEmpty'](_0x25c8eb,_0x3693eb);_0x482afe=_0x481939?i(_0x481939,_0x3693eb['headRevision']):await this['_dbAdapter']['listCreators'](_0x25c8eb,_0x3693eb['unitID'],_0x579ec7);}let _0x4a234c=await this['_resolveUsers'](_0x482afe['map'](_0x3c9ad1=>_0x3c9ad1['userID']),_0x25c8eb);return{'creators':_0x482afe['map'](_0x3f4467=>({..._0x3f4467,'name':_0x4a234c[_0x3f4467['userID']]['name'],'avatar':_0x4a234c[_0x3f4467['userID']]['avatar']}))};});}['getHistoryChangesets'](_0x467748,_0x3b487e){return this['_read']('getHistoryChangesets',_0x467748,_0x3b487e,async _0x4815f2=>{if(C('startRevision',_0x467748['startRevision']),C('endRevision',_0x467748['endRevision']),_0x467748['endRevision']<_0x467748['startRevision'])throw E('endRevision\x20must\x20not\x20precede\x20startRevision');let _0x5eed02=await f(this['_options']['collabService'],_0x4815f2,_0x467748['unitID']);if(_0x467748['endRevision']>_0x5eed02['headRevision'])throw E('endRevision\x20exceeds\x20Core\x20head');let _0x2e7aec=[];for await(let _0xc6f2ce of m(this['_options']['collabService'],_0x4815f2,_0x5eed02,_0x467748['startRevision']-0x1,_0x467748['endRevision']))_0x2e7aec['push'](..._0xc6f2ce);let _0x119ca5=_0x2e7aec['map'](_0x505b40=>_0x505b40['userID']);return _0x467748['startRevision']===0x1&&_0x119ca5['push'](_0x5eed02['creatorID']),{'changesets':_0x2e7aec,'users':await this['_resolveUsers'](_0x119ca5,_0x4815f2)};});}['dispose'](){if(this['_disposePromise'])return this['_disposePromise'];this['_state']='disposing';for(let _0x288d4f of this['_subscriptions']['splice'](0x0))_0x288d4f['dispose']();return this['_disposePromise']=((async()=>{await Promise['allSettled']([...this['_calls']]),await this['_indexer']['dispose'](),this['_middleware']['clear'](),this['_options']['dbAdapter']||await this['_dbAdapter']['dispose']?.(),this['_state']='disposed';})()),this['_disposePromise'];}['_read'](_0x14195f,_0x25f06f,_0xdab384,_0x2530a4){this['_assertRunning']();let _0x5f4b1e=((async()=>{let _0x3b9ad0={...x(_0xdab384),'request':{..._0x25f06f}},_0x3bb03a;return await this['_middleware']['run'](_0x14195f,_0x3b9ad0,async()=>{S(_0x25f06f['unitID']);try{_0x3bb03a=await _0x2530a4(_0x3b9ad0);}catch(_0x50bf48){throw _0x50bf48 instanceof t['CollabError']?_0x50bf48:new t['CollabError']('ADAPTER_FAILURE','History\x20read\x20failed',{'cause':_0x50bf48,'retryable':!0x0});}}),_0x3bb03a;})());return this['_calls']['add'](_0x5f4b1e),_0x5f4b1e['then'](()=>this['_calls']['delete'](_0x5f4b1e),()=>this['_calls']['delete'](_0x5f4b1e)),_0x5f4b1e;}async['_resolveUsers'](_0x374984,_0x5df125){let _0x4cfe9e=new Set(_0x374984),_0x23dac5=Object['create'](null);if(_0x4cfe9e['size']&&this['_options']['userProvider'])try{for(let _0x39662e of await this['_options']['userProvider']['getUsers']([..._0x4cfe9e],_0x5df125))_0x4cfe9e['has'](_0x39662e['userID'])&&(_0x23dac5[_0x39662e['userID']]=_0x39662e);}catch(_0x1ac84d){this['_logError']('History\x20user\x20lookup\x20failed',_0x1ac84d);}for(let _0x87aa16 of _0x4cfe9e)_0x23dac5[_0x87aa16]??=T(_0x87aa16);return _0x23dac5;}['_assertRunning'](){if(this['_state']!=='running')throw new t['CollabError']('INTERNAL_ERROR','History\x20Service\x20is\x20'+this['_state']);}['_logError'](_0x479c54,_0x3f2f96){try{this['_options']['logger']?.['error'](_0x479c54,{'error':_0x3f2f96 instanceof Error?_0x3f2f96['message']:String(_0x3f2f96)});}catch{}}};function x(_0x15fefe){if(!_0x15fefe||typeof _0x15fefe!='object')throw E('context\x20must\x20be\x20an\x20object');if(typeof _0x15fefe['userID']!='string'||_0x15fefe['userID']['length']===0x0)throw E('userID\x20must\x20be\x20a\x20non-empty\x20string');if(_0x15fefe['customData']!==void 0x0&&(_0x15fefe['customData']===null||typeof _0x15fefe['customData']!='object'||Array['isArray'](_0x15fefe['customData'])))throw E('customData\x20must\x20be\x20an\x20object');return{'userID':_0x15fefe['userID'],'customData':_0x15fefe['customData']??Object['create'](null)};}function S(_0x5559e8){if(!_0x5559e8)throw E('unitID\x20is\x20required');}function C(_0x17dbd9,_0xd0b8bd){if(!Number['isSafeInteger'](_0xd0b8bd)||_0xd0b8bd<0x1)throw E(_0x17dbd9+'\x20must\x20be\x20a\x20positive\x20safe\x20integer');}function w(_0x3b78a4){if(!_0x3b78a4)return;let _0x1c5c4e=Number(_0x3b78a4);return C('lastLabel',_0x1c5c4e),_0x1c5c4e;}function T(_0x32aa5c){return{'userID':_0x32aa5c,'name':_0x32aa5c,'avatar':'','anonymous':!0x0,'canBindAnonymous':!0x1,'phone':'','email':'','createTimestamp':0x0};}function E(_0x2ecb8d){return new t['CollabError']('INVALID_REQUEST',_0x2ecb8d);}exports['DefaultHistoryPolicy']=c,exports['MemoryHistoryDatabaseAdapter']=s,exports['UniverHistoryService']=b;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IChangeset, IUser, UniverType } from "@univerjs/protocol";
|
|
2
1
|
import { CollabContext, CustomData, Disposable, ILogger, IUniverCollabService } from "@univerjs-pro/collaboration-service";
|
|
2
|
+
import { IChangeset, IUser, UniverType } from "@univerjs/protocol";
|
|
3
3
|
|
|
4
4
|
//#region src/types.d.ts
|
|
5
5
|
type HistoryOrigin = 0 | 1 | 2;
|
|
@@ -18,15 +18,6 @@ interface GetHistoryChangesetsInput {
|
|
|
18
18
|
readonly startRevision: number;
|
|
19
19
|
readonly endRevision: number;
|
|
20
20
|
}
|
|
21
|
-
interface IndexUnitCreatedInput {
|
|
22
|
-
readonly unitID: string;
|
|
23
|
-
readonly type: UniverType;
|
|
24
|
-
readonly createdAt: number;
|
|
25
|
-
}
|
|
26
|
-
interface IndexChangesetInput {
|
|
27
|
-
readonly changeset: IChangeset;
|
|
28
|
-
readonly committedAt: number;
|
|
29
|
-
}
|
|
30
21
|
interface HistoryData {
|
|
31
22
|
readonly userID: string;
|
|
32
23
|
readonly unitID: string;
|
|
@@ -63,19 +54,10 @@ interface GetHistoryChangesetsResult {
|
|
|
63
54
|
readonly changesets: readonly IChangeset[];
|
|
64
55
|
readonly users: Readonly<Record<string, IUser>>;
|
|
65
56
|
}
|
|
66
|
-
type IndexHistoryResult = {
|
|
67
|
-
readonly status: "indexed";
|
|
68
|
-
readonly revision: number;
|
|
69
|
-
} | {
|
|
70
|
-
readonly status: "already-indexed";
|
|
71
|
-
readonly revision: number;
|
|
72
|
-
};
|
|
73
57
|
interface GetHistoryListRequest extends GetHistoryListInput {}
|
|
74
58
|
interface ListHistoryCreatorsRequest extends ListHistoryCreatorsInput {}
|
|
75
59
|
interface GetHistoryChangesetsRequest extends GetHistoryChangesetsInput {}
|
|
76
|
-
|
|
77
|
-
interface IndexChangesetRequest extends IndexChangesetInput {}
|
|
78
|
-
type HistoryRequest = GetHistoryListRequest | ListHistoryCreatorsRequest | GetHistoryChangesetsRequest | IndexUnitCreatedRequest | IndexChangesetRequest;
|
|
60
|
+
type HistoryRequest = GetHistoryListRequest | ListHistoryCreatorsRequest | GetHistoryChangesetsRequest;
|
|
79
61
|
interface HistoryUserProviderContext {
|
|
80
62
|
readonly userID: string;
|
|
81
63
|
readonly customData: CustomData;
|
|
@@ -86,101 +68,83 @@ interface IHistoryUserProvider {
|
|
|
86
68
|
}
|
|
87
69
|
//#endregion
|
|
88
70
|
//#region src/database-adapter.d.ts
|
|
89
|
-
interface
|
|
90
|
-
readonly unitID: string;
|
|
91
|
-
readonly type: UniverType;
|
|
92
|
-
readonly revision: number;
|
|
71
|
+
interface HistoryDatabaseContext {
|
|
93
72
|
readonly userID: string;
|
|
94
|
-
readonly
|
|
95
|
-
readonly
|
|
96
|
-
readonly additionalFields?: string;
|
|
97
|
-
readonly origin: HistoryOrigin;
|
|
98
|
-
readonly historyRevision: number;
|
|
99
|
-
readonly forceNextHistory: boolean;
|
|
100
|
-
readonly restoredRevision?: number;
|
|
101
|
-
}
|
|
102
|
-
interface HistoryIndexState {
|
|
103
|
-
readonly unitID: string;
|
|
104
|
-
readonly type: UniverType;
|
|
105
|
-
readonly latestRevision: number;
|
|
106
|
-
readonly currentHistoryRevision: number;
|
|
107
|
-
readonly currentHistoryCreatedAt: number;
|
|
108
|
-
readonly forceNextHistory: boolean;
|
|
73
|
+
readonly customData: CustomData;
|
|
74
|
+
readonly request: object;
|
|
109
75
|
}
|
|
110
76
|
interface HistoryRecord {
|
|
111
|
-
readonly historyId: string;
|
|
112
77
|
readonly unitID: string;
|
|
113
|
-
readonly type: UniverType;
|
|
114
78
|
readonly startRevision: number;
|
|
115
|
-
readonly endRevision: number;
|
|
116
79
|
readonly userID: string;
|
|
117
|
-
readonly userIDs: readonly string[];
|
|
118
|
-
readonly commands: readonly string[];
|
|
119
80
|
readonly createdAt: number;
|
|
120
|
-
readonly startRevisionCreatedAt: number;
|
|
121
|
-
readonly endRevisionCreatedAt: number;
|
|
122
|
-
readonly additionalFields?: string;
|
|
123
81
|
readonly origin: HistoryOrigin;
|
|
124
|
-
readonly
|
|
82
|
+
readonly additionalFields?: string;
|
|
83
|
+
}
|
|
84
|
+
interface HistoryRecordRange {
|
|
85
|
+
readonly record: HistoryRecord;
|
|
86
|
+
readonly endRevision: number;
|
|
125
87
|
}
|
|
126
88
|
interface ListHistoryRecordsOptions {
|
|
127
|
-
readonly
|
|
89
|
+
readonly throughRevision: number;
|
|
128
90
|
readonly beforeRevision?: number;
|
|
91
|
+
readonly length: number;
|
|
129
92
|
readonly origin?: HistoryOrigin;
|
|
130
93
|
readonly userIDs?: readonly string[];
|
|
131
94
|
}
|
|
132
95
|
interface ListHistoryRecordsResult {
|
|
133
|
-
readonly records: readonly
|
|
96
|
+
readonly records: readonly HistoryRecordRange[];
|
|
134
97
|
readonly hasMore: boolean;
|
|
135
98
|
}
|
|
136
99
|
interface HistoryCreatorIndex {
|
|
137
100
|
readonly userID: string;
|
|
138
101
|
readonly origins: readonly HistoryOrigin[];
|
|
139
102
|
}
|
|
140
|
-
type
|
|
103
|
+
type AppendHistoryRecordResult = {
|
|
141
104
|
readonly status: "appended";
|
|
142
105
|
} | {
|
|
143
|
-
readonly status: "already-
|
|
106
|
+
readonly status: "already-exists";
|
|
144
107
|
} | {
|
|
145
|
-
readonly status: "
|
|
146
|
-
readonly actualLatestRevision: number;
|
|
108
|
+
readonly status: "conflict";
|
|
147
109
|
};
|
|
148
110
|
interface IHistoryDatabaseAdapter {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
111
|
+
getLatestRecord(context: HistoryDatabaseContext, unitID: string): Promise<HistoryRecord | null>;
|
|
112
|
+
appendRecord(context: HistoryDatabaseContext, record: HistoryRecord, options: {
|
|
113
|
+
readonly expectedLatestStartRevision: number | null;
|
|
114
|
+
}): Promise<AppendHistoryRecordResult>;
|
|
115
|
+
listRecords(context: HistoryDatabaseContext, unitID: string, options: ListHistoryRecordsOptions): Promise<ListHistoryRecordsResult>;
|
|
116
|
+
listCreators(context: HistoryDatabaseContext, unitID: string, options: {
|
|
117
|
+
readonly throughRevision: number;
|
|
118
|
+
}): Promise<readonly HistoryCreatorIndex[]>;
|
|
156
119
|
dispose?(): Promise<void>;
|
|
157
120
|
}
|
|
158
|
-
declare function buildHistoryRecords(entries: readonly HistoryRevision[]): readonly HistoryRecord[];
|
|
159
|
-
declare function selectHistoryRecords(records: readonly HistoryRecord[], options: ListHistoryRecordsOptions): ListHistoryRecordsResult;
|
|
160
121
|
//#endregion
|
|
161
122
|
//#region src/memory-history-database-adapter.d.ts
|
|
162
123
|
declare class MemoryHistoryDatabaseAdapter implements IHistoryDatabaseAdapter {
|
|
163
|
-
private readonly
|
|
124
|
+
private readonly _records;
|
|
164
125
|
private _disposed;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
126
|
+
getLatestRecord(_context: HistoryDatabaseContext, unitID: string): Promise<HistoryRecord | null>;
|
|
127
|
+
appendRecord(_context: HistoryDatabaseContext, record: HistoryRecord, options: {
|
|
128
|
+
readonly expectedLatestStartRevision: number | null;
|
|
129
|
+
}): Promise<AppendHistoryRecordResult>;
|
|
130
|
+
listRecords(_context: HistoryDatabaseContext, unitID: string, options: ListHistoryRecordsOptions): Promise<ListHistoryRecordsResult>;
|
|
131
|
+
listCreators(_context: HistoryDatabaseContext, unitID: string, options: {
|
|
132
|
+
readonly throughRevision: number;
|
|
133
|
+
}): Promise<readonly HistoryCreatorIndex[]>;
|
|
172
134
|
dispose(): Promise<void>;
|
|
173
135
|
private _assertOpen;
|
|
174
136
|
}
|
|
175
137
|
//#endregion
|
|
176
138
|
//#region src/policy.d.ts
|
|
139
|
+
interface HistoryPolicyRecord {
|
|
140
|
+
readonly startRevision: number;
|
|
141
|
+
readonly createdAt: number;
|
|
142
|
+
}
|
|
177
143
|
interface HistoryPolicyInput {
|
|
178
|
-
readonly state: HistoryIndexState | null;
|
|
179
144
|
readonly unitID: string;
|
|
180
145
|
readonly type: UniverType;
|
|
181
|
-
readonly
|
|
182
|
-
readonly
|
|
183
|
-
readonly changeset?: IChangeset;
|
|
146
|
+
readonly currentRecord: HistoryPolicyRecord | null;
|
|
147
|
+
readonly changeset: Readonly<IChangeset>;
|
|
184
148
|
}
|
|
185
149
|
interface HistoryPolicyDecision {
|
|
186
150
|
readonly startsNewHistory: boolean;
|
|
@@ -201,7 +165,7 @@ declare class DefaultHistoryPolicy implements IHistoryPolicy {
|
|
|
201
165
|
}
|
|
202
166
|
//#endregion
|
|
203
167
|
//#region src/middleware.d.ts
|
|
204
|
-
type HistoryMiddlewareAction = "getHistoryList" | "listHistoryCreators" | "getHistoryChangesets"
|
|
168
|
+
type HistoryMiddlewareAction = "getHistoryList" | "listHistoryCreators" | "getHistoryChangesets";
|
|
205
169
|
type HistoryMiddlewareNext = () => Promise<void>;
|
|
206
170
|
type HistoryMiddleware<TContext> = (context: TContext, next: HistoryMiddlewareNext) => void | Promise<void>;
|
|
207
171
|
interface BaseHistoryMiddlewareContext {
|
|
@@ -217,18 +181,10 @@ interface ListHistoryCreatorsMiddlewareContext extends BaseHistoryMiddlewareCont
|
|
|
217
181
|
interface GetHistoryChangesetsMiddlewareContext extends BaseHistoryMiddlewareContext {
|
|
218
182
|
readonly request: GetHistoryChangesetsRequest;
|
|
219
183
|
}
|
|
220
|
-
interface IndexUnitCreatedMiddlewareContext extends BaseHistoryMiddlewareContext {
|
|
221
|
-
readonly request: IndexUnitCreatedRequest;
|
|
222
|
-
}
|
|
223
|
-
interface IndexChangesetMiddlewareContext extends BaseHistoryMiddlewareContext {
|
|
224
|
-
readonly request: IndexChangesetRequest;
|
|
225
|
-
}
|
|
226
184
|
interface HistoryMiddlewareMap {
|
|
227
185
|
readonly getHistoryList: HistoryMiddleware<GetHistoryListMiddlewareContext>;
|
|
228
186
|
readonly listHistoryCreators: HistoryMiddleware<ListHistoryCreatorsMiddlewareContext>;
|
|
229
187
|
readonly getHistoryChangesets: HistoryMiddleware<GetHistoryChangesetsMiddlewareContext>;
|
|
230
|
-
readonly indexUnitCreated: HistoryMiddleware<IndexUnitCreatedMiddlewareContext>;
|
|
231
|
-
readonly indexChangeset: HistoryMiddleware<IndexChangesetMiddlewareContext>;
|
|
232
188
|
}
|
|
233
189
|
//#endregion
|
|
234
190
|
//#region src/service.d.ts
|
|
@@ -239,49 +195,34 @@ interface UniverHistoryServiceOptions {
|
|
|
239
195
|
readonly userProvider?: IHistoryUserProvider;
|
|
240
196
|
readonly logger?: ILogger;
|
|
241
197
|
readonly maxIndexRetries?: number;
|
|
198
|
+
readonly maxCachedUnits?: number;
|
|
242
199
|
}
|
|
243
200
|
interface IUniverHistoryService {
|
|
244
201
|
use<K extends HistoryMiddlewareAction>(action: K, middleware: HistoryMiddlewareMap[K]): Disposable;
|
|
245
202
|
getHistoryList(input: GetHistoryListInput, context: CollabContext): Promise<GetHistoryListResult>;
|
|
246
203
|
listHistoryCreators(input: ListHistoryCreatorsInput, context: CollabContext): Promise<ListHistoryCreatorsResult>;
|
|
247
204
|
getHistoryChangesets(input: GetHistoryChangesetsInput, context: CollabContext): Promise<GetHistoryChangesetsResult>;
|
|
248
|
-
indexUnitCreated(input: IndexUnitCreatedInput, context: CollabContext): Promise<IndexHistoryResult>;
|
|
249
|
-
indexChangeset(input: IndexChangesetInput, context: CollabContext): Promise<IndexHistoryResult>;
|
|
250
|
-
attach(collabService?: IUniverCollabService): Disposable;
|
|
251
205
|
dispose(): Promise<void>;
|
|
252
206
|
}
|
|
253
207
|
declare class UniverHistoryService implements IUniverHistoryService {
|
|
254
|
-
private readonly
|
|
208
|
+
private readonly _options;
|
|
255
209
|
private readonly _dbAdapter;
|
|
256
|
-
private readonly _ownsDbAdapter;
|
|
257
|
-
private readonly _policy;
|
|
258
|
-
private readonly _userProvider;
|
|
259
|
-
private readonly _logger;
|
|
260
|
-
private readonly _maxIndexRetries;
|
|
261
210
|
private readonly _middleware;
|
|
262
|
-
private readonly
|
|
211
|
+
private readonly _indexer;
|
|
212
|
+
private readonly _subscriptions;
|
|
263
213
|
private readonly _calls;
|
|
264
|
-
private readonly _indexQueues;
|
|
265
214
|
private _state;
|
|
266
|
-
|
|
215
|
+
private _disposePromise;
|
|
216
|
+
constructor(_options: UniverHistoryServiceOptions);
|
|
267
217
|
use<K extends HistoryMiddlewareAction>(action: K, middleware: HistoryMiddlewareMap[K]): Disposable;
|
|
268
218
|
getHistoryList(input: GetHistoryListInput, context: CollabContext): Promise<GetHistoryListResult>;
|
|
269
219
|
listHistoryCreators(input: ListHistoryCreatorsInput, context: CollabContext): Promise<ListHistoryCreatorsResult>;
|
|
270
220
|
getHistoryChangesets(input: GetHistoryChangesetsInput, context: CollabContext): Promise<GetHistoryChangesetsResult>;
|
|
271
|
-
indexUnitCreated(input: IndexUnitCreatedInput, context: CollabContext): Promise<IndexHistoryResult>;
|
|
272
|
-
indexChangeset(input: IndexChangesetInput, context: CollabContext): Promise<IndexHistoryResult>;
|
|
273
|
-
attach(collabService?: IUniverCollabService): Disposable;
|
|
274
221
|
dispose(): Promise<void>;
|
|
275
|
-
private
|
|
276
|
-
private _executeIndexChangeset;
|
|
277
|
-
private _appendWithRetry;
|
|
278
|
-
private _historyData;
|
|
222
|
+
private _read;
|
|
279
223
|
private _resolveUsers;
|
|
280
|
-
private _enqueue;
|
|
281
|
-
private _call;
|
|
282
|
-
private _databaseCall;
|
|
283
224
|
private _assertRunning;
|
|
284
225
|
private _logError;
|
|
285
226
|
}
|
|
286
227
|
//#endregion
|
|
287
|
-
export { type
|
|
228
|
+
export { type AppendHistoryRecordResult, type BaseHistoryMiddlewareContext, DefaultHistoryPolicy, type DefaultHistoryPolicyOptions, type GetHistoryChangesetsInput, type GetHistoryChangesetsMiddlewareContext, type GetHistoryChangesetsRequest, type GetHistoryChangesetsResult, type GetHistoryListInput, type GetHistoryListMiddlewareContext, type GetHistoryListRequest, type GetHistoryListResult, type HistoryCreator, type HistoryCreatorIndex, type HistoryData, type HistoryDatabaseContext, type HistoryMiddleware, type HistoryMiddlewareAction, type HistoryMiddlewareMap, type HistoryMiddlewareNext, type HistoryOrigin, type HistoryPolicyDecision, type HistoryPolicyInput, type HistoryPolicyRecord, type HistoryRecord, type HistoryRecordRange, type HistoryRequest, type HistoryUserProviderContext, type IHistoryDatabaseAdapter, type IHistoryPolicy, type IHistoryUserProvider, type IUniverHistoryService, type ListHistoryCreatorsInput, type ListHistoryCreatorsMiddlewareContext, type ListHistoryCreatorsRequest, type ListHistoryCreatorsResult, type ListHistoryRecordsOptions, type ListHistoryRecordsResult, MemoryHistoryDatabaseAdapter, UniverHistoryService, type UniverHistoryServiceOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function _0x5a5b(_0x38d7d8,_0x3e7fc4){_0x38d7d8=_0x38d7d8-0xab;const _0x296dc3=_0x296d();let _0x5a5bbc=_0x296dc3[_0x38d7d8];return _0x5a5bbc;}const _0x26a456=_0x5a5b;(function(_0x297ced,_0x420d08){const _0x6ac400=_0x5a5b,_0x46d585=_0x297ced();while(!![]){try{const _0x1f07e3=-parseInt(_0x6ac400(0xb7))/0x1*(parseInt(_0x6ac400(0xac))/0x2)+parseInt(_0x6ac400(0xb2))/0x3+-parseInt(_0x6ac400(0xb5))/0x4+parseInt(_0x6ac400(0xb0))/0x5*(-parseInt(_0x6ac400(0xb3))/0x6)+-parseInt(_0x6ac400(0xaf))/0x7+parseInt(_0x6ac400(0xb1))/0x8*(parseInt(_0x6ac400(0xb6))/0x9)+parseInt(_0x6ac400(0xab))/0xa;if(_0x1f07e3===_0x420d08)break;else _0x46d585['push'](_0x46d585['shift']());}catch(_0x20c6ad){_0x46d585['push'](_0x46d585['shift']());}}}(_0x296d,0x5f27e));import _0x30a718 from'./index.cjs';const facadeExport0=_0x30a718[_0x26a456(0xad)],facadeExport1=_0x30a718[_0x26a456(0xae)],facadeExport2=_0x30a718[_0x26a456(0xb4)];function _0x296d(){const _0x1d92fd=['MemoryHistoryDatabaseAdapter','3213693XKphwp','927175upRmoF','32oZuUUA','980607wubfkc','12GwoLSv','UniverHistoryService','547416DuUhJw','4167YDKNrL','1Vzyfiu','16676170IlRJKk','1279514KfLPfk','DefaultHistoryPolicy'];_0x296d=function(){return _0x1d92fd;};return _0x296d();}export{facadeExport0 as DefaultHistoryPolicy,facadeExport1 as MemoryHistoryDatabaseAdapter,facadeExport2 as UniverHistoryService};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs-pro/collaboration-history-service",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@univerjs-pro/collaboration": "1.0.0
|
|
20
|
-
"@univerjs-pro/collaboration-service": "1.0.0
|
|
21
|
-
"@univerjs/protocol": "1.0.0
|
|
19
|
+
"@univerjs-pro/collaboration": "1.0.0",
|
|
20
|
+
"@univerjs-pro/collaboration-service": "1.0.0",
|
|
21
|
+
"@univerjs/protocol": "1.0.0"
|
|
22
22
|
}
|
|
23
23
|
}
|