@univerjs-pro/collaboration-history-service 1.0.0-rc.0 → 1.0.1
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(_0x3adac9,_0x422f63){let _0x878440=0x0,_0x29ad21=_0x3adac9['length'];for(;_0x878440<_0x29ad21;){let _0x23ebfa=_0x878440+_0x29ad21>>>0x1;_0x3adac9[_0x23ebfa]['startRevision']<=_0x422f63?_0x878440=_0x23ebfa+0x1:_0x29ad21=_0x23ebfa;}return _0x878440;}function r(_0x120f26,_0x205f34){let _0x5b797b=new Set(_0x205f34['userIDs']??[]),_0x131d08=[],_0x531f02=Math['min'](_0x205f34['throughRevision'],(_0x205f34['beforeRevision']??0x1/0x0)-0x1);for(let _0x35879d=n(_0x120f26,_0x531f02)-0x1;_0x35879d>=0x0;_0x35879d--){let _0x2be7a9=_0x120f26[_0x35879d];if(!(_0x205f34['origin']&&_0x2be7a9['origin']!==_0x205f34['origin'])&&!(_0x5b797b['size']&&!_0x5b797b['has'](_0x2be7a9['userID']))){if(_0x131d08['length']===_0x205f34['length'])return{'records':_0x131d08,'hasMore':!0x0};_0x131d08['push']({'record':{..._0x2be7a9},'endRevision':Math['min'](_0x205f34['throughRevision'],(_0x120f26[_0x35879d+0x1]?.['startRevision']??0x1/0x0)-0x1)});}}return{'records':_0x131d08,'hasMore':!0x1};}function i(_0xe307ce,_0x9dc9a){let _0x4504f5=new Map();for(let _0x472460 of _0xe307ce){if(_0x472460['startRevision']>_0x9dc9a)break;let _0x158e26=_0x4504f5['get'](_0x472460['userID'])??new Set();_0x158e26['add'](_0x472460['origin']),_0x4504f5['set'](_0x472460['userID'],_0x158e26);}return[..._0x4504f5]['sort'](([_0x22af8a],[_0x147806])=>_0x22af8a<_0x147806?-0x1:+(_0x22af8a>_0x147806))['map'](([_0x12a9f7,_0x43baa5])=>({'userID':_0x12a9f7,'origins':[..._0x43baa5]['sort']((_0x3ff7a3,_0x5c23a6)=>_0x3ff7a3-_0x5c23a6)}));}function a(_0x17f69f,_0x50ffc6){return _0x17f69f['unitID']===_0x50ffc6['unitID']&&_0x17f69f['startRevision']===_0x50ffc6['startRevision']&&_0x17f69f['userID']===_0x50ffc6['userID']&&_0x17f69f['createdAt']===_0x50ffc6['createdAt']&&_0x17f69f['origin']===_0x50ffc6['origin']&&_0x17f69f['additionalFields']===_0x50ffc6['additionalFields'];}function o(_0x5ecb01){if(!_0x5ecb01['unitID']||!_0x5ecb01['userID']||!Number['isSafeInteger'](_0x5ecb01['startRevision'])||_0x5ecb01['startRevision']<0x1||!Number['isSafeInteger'](_0x5ecb01['createdAt'])||_0x5ecb01['createdAt']<0x0)throw TypeError('History\x20record\x20is\x20invalid');}var s=class{['_records']=new Map();['_disposed']=!0x1;async['getLatestRecord'](_0x53cc84,_0x321d49){this['_assertOpen']();let _0x4021d6=this['_records']['get'](_0x321d49)?.['at'](-0x1);return _0x4021d6?{..._0x4021d6}:null;}async['appendRecord'](_0x14193c,_0xd71cc0,_0x3b20c2){this['_assertOpen'](),o(_0xd71cc0);let _0x3662e5=this['_records']['get'](_0xd71cc0['unitID'])??[],_0x14387b=_0x3662e5[n(_0x3662e5,_0xd71cc0['startRevision'])-0x1];if(_0x14387b?.['startRevision']===_0xd71cc0['startRevision'])return{'status':a(_0x14387b,_0xd71cc0)?'already-exists':'conflict'};let _0x539da7=_0x3662e5['at'](-0x1)?.['startRevision']??null;return _0x539da7!==_0x3b20c2['expectedLatestStartRevision']||_0xd71cc0['startRevision']<=(_0x539da7??0x0)?{'status':'conflict'}:(_0x3662e5['push']({..._0xd71cc0}),this['_records']['set'](_0xd71cc0['unitID'],_0x3662e5),{'status':'appended'});}async['listRecords'](_0x585592,_0x5ea6d3,_0x2230a2){return this['_assertOpen'](),r(this['_records']['get'](_0x5ea6d3)??[],_0x2230a2);}async['listCreators'](_0x25e496,_0x1c423a,_0x29ed79){return this['_assertOpen'](),i(this['_records']['get'](_0x1c423a)??[],_0x29ed79['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(_0x577070={}){if(this['_timeIntervalMs']=_0x577070['timeIntervalMs']??0xea60,!Number['isSafeInteger'](this['_timeIntervalMs'])||this['_timeIntervalMs']<0x0)throw TypeError('timeIntervalMs\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');this['_singleHistoryMutationIds']=_0x577070['singleHistoryMutationIds']??e['SINGLE_HISTORY_MUTATIONS'];}['evaluate'](_0x2e1612){let _0x13196b=!!_0x2e1612['changeset']['mutations']['some'](_0xaf9fc7=>this['_singleHistoryMutationIds']['has'](_0xaf9fc7['id']));return{'startsNewHistory':_0x2e1612['currentRecord']===null||_0x13196b||_0x2e1612['changeset']['createTime']*0x3e8-_0x2e1612['currentRecord']['createdAt']>=this['_timeIntervalMs'],'forceNextHistory':_0x13196b};}},l=class{['_middlewares']=new Map();['use'](_0x1e8237,_0x382d21){let _0x41786a=this['_middlewares']['get'](_0x1e8237)??[],_0xacf178=_0x382d21;_0x41786a['push'](_0xacf178),this['_middlewares']['set'](_0x1e8237,_0x41786a);let _0x9358de=!0x1;return{'dispose':()=>{if(_0x9358de)return;_0x9358de=!0x0;let _0x1b37ef=_0x41786a['indexOf'](_0xacf178);_0x1b37ef>=0x0&&_0x41786a['splice'](_0x1b37ef,0x1);}};}async['run'](_0x10e491,_0x55e39d,_0x139f1f){let _0x5be210=[...this['_middlewares']['get'](_0x10e491)??[]],_0x4bde9e=async _0x45d70d=>{let _0x5262ca=_0x5be210[_0x45d70d];if(!_0x5262ca){await _0x139f1f();return;}let _0x490538=!0x1,_0x332b1e,_0x57ce95=()=>{if(_0x490538)throw Error('Middleware\x20for\x20action\x20'+_0x10e491+'\x20called\x20next()\x20more\x20than\x20once');return _0x490538=!0x0,_0x332b1e=_0x4bde9e(_0x45d70d+0x1),_0x332b1e;};try{await _0x5262ca(_0x55e39d,_0x57ce95);}catch(_0x52517c){if(_0x332b1e)try{await _0x332b1e;}catch{}throw _0x52517c;}if(!_0x490538)throw Error('Middleware\x20for\x20action\x20'+_0x10e491+'\x20completed\x20without\x20calling\x20next()');await _0x332b1e;};await _0x4bde9e(0x0);}['clear'](){this['_middlewares']['clear']();}},u=0x100;function d(_0x5ea9b7){let _0x19c65b=_0x5ea9b7['createTime'];if(_0x19c65b===void 0x0||!Number['isSafeInteger'](_0x19c65b)||_0x19c65b<0x0||!Number['isSafeInteger'](_0x19c65b*0x3e8))throw new t['CollabError']('ADAPTER_FAILURE','History\x20requires\x20a\x20valid\x20persisted\x20changeset\x20createTime');return _0x19c65b*0x3e8;}async function f(_0x11bfde,_0x5d7ee9,_0x929555){let _0x2fd409=await _0x11bfde['dbAdapter']['getUnit'](_0x5d7ee9,_0x929555);if(!_0x2fd409)throw new t['CollabError']('UNIT_NOT_FOUND','Unit\x20'+_0x929555+'\x20does\x20not\x20exist');if(_0x2fd409['unitID']!==_0x929555||!_0x2fd409['creatorID']||!Number['isSafeInteger'](_0x2fd409['createdAt'])||_0x2fd409['createdAt']<0x0||!Number['isSafeInteger'](_0x2fd409['headRevision'])||_0x2fd409['headRevision']<0x1)throw new t['CollabError']('ADAPTER_FAILURE','History\x20received\x20invalid\x20Unit\x20creation\x20facts');return _0x2fd409;}function p(_0x389149,_0xc0959c,_0x4056bd){if(_0x389149['unitID']!==_0xc0959c['unitID']||_0x389149['type']!==_0xc0959c['type']||_0x389149['revision']!==_0x4056bd||!_0x389149['userID'])throw new t['CollabError']('ADAPTER_FAILURE','History\x20received\x20incomplete\x20or\x20invalid\x20changesets');d(_0x389149);}async function*m(_0x55f683,_0xd4196c,_0x967442,_0x5a0e15,_0x58737e){let _0x49d5cc=Math['max'](_0x5a0e15,0x1);for(;_0x49d5cc<_0x58737e;){let _0xa71a2=Math['min'](_0x49d5cc+u,_0x58737e),{changesets:_0x28fe4e}=await _0x55f683['getChangesets']({'unitID':_0x967442['unitID'],'type':_0x967442['type'],'from':_0x49d5cc,'to':_0xa71a2},_0xd4196c);if(_0x28fe4e['length']!==_0xa71a2-_0x49d5cc)throw new t['CollabError']('ADAPTER_FAILURE','History\x20requires\x20continuous\x20Core\x20changesets');_0x28fe4e['forEach']((_0x4d9aac,_0x515be9)=>p(_0x4d9aac,_0x967442,_0x49d5cc+_0x515be9+0x1)),yield _0x28fe4e,_0x49d5cc=_0xa71a2;}}var h=class extends Error{},g=class{['_core'];['_database'];['_policy'];['_maxCachedUnits'];['_maxRetries'];['_log'];['_states']=new Map();['_queues']=new Map();['_initializations']=new Map();constructor(_0x38e1b7,_0x59d58d,_0x233c62,_0x2616fa,_0x1091f4,_0x233ba5){this['_core']=_0x38e1b7,this['_database']=_0x59d58d,this['_policy']=_0x233c62,this['_maxCachedUnits']=_0x2616fa,this['_maxRetries']=_0x1091f4,this['_log']=_0x233ba5;}['committed'](_0x2d6935,_0x517228){let {unitID:_0x39f0e1,revision:_0x5898e3}=_0x517228;this['_background'](_0x39f0e1,()=>this['_sync'](_0x2d6935,_0x39f0e1,_0x5898e3,_0x517228));}['created'](_0x52a833,_0x532cd4){this['_background'](_0x532cd4['unitID'],()=>this['_sync'](_0x52a833,_0x532cd4['unitID'],0x1));}['initializeIfEmpty'](_0x2340e7,_0x41ee7b){let _0x58f227=this['_initializations']['get'](_0x41ee7b['unitID']);if(_0x58f227)return _0x58f227;let _0x50c50f,_0x1dacbf,_0x1b02bf=new Promise((_0xdced8f,_0x127ae3)=>{_0x50c50f=_0xdced8f,_0x1dacbf=_0x127ae3;});return this['_initializations']['set'](_0x41ee7b['unitID'],_0x1b02bf),this['_serialize'](_0x41ee7b['unitID'],async()=>{try{if(await this['_database']['getLatestRecord'](_0x2340e7,_0x41ee7b['unitID'])){_0x50c50f(null);return;}let _0xa8697c=_(_0x41ee7b),_0x39fcc5=[_0xa8697c['currentRecord']];for await(let _0x481719 of m(this['_core'],_0x2340e7,_0x41ee7b,0x1,_0x41ee7b['headRevision']))for(let _0x692fc5 of _0x481719){let _0x192ae8=this['_advance'](_0xa8697c,_0x692fc5);_0x192ae8['currentRecord']!==_0xa8697c['currentRecord']&&_0x39fcc5['push'](_0x192ae8['currentRecord']),_0xa8697c=_0x192ae8;}_0x50c50f(_0x39fcc5);let _0x4438f1=null;for(let _0x1637e0 of _0x39fcc5)await this['_append'](_0x2340e7,_0x1637e0,_0x4438f1),_0x4438f1=_0x1637e0['startRevision'];this['_remember'](_0xa8697c);}catch(_0x2b70a2){throw this['_states']['delete'](_0x41ee7b['unitID']),_0x1dacbf(_0x2b70a2),_0x2b70a2;}finally{this['_initializations']['get'](_0x41ee7b['unitID'])===_0x1b02bf&&this['_initializations']['delete'](_0x41ee7b['unitID']);}})['catch'](this['_log']),_0x1b02bf;}async['dispose'](){for(;this['_queues']['size'];)await Promise['allSettled']([...this['_queues']['values']()]);this['_states']['clear'](),this['_initializations']['clear']();}async['_sync'](_0x228703,_0x567ef0,_0x431be3,_0xe88a0b){for(let _0x17bb52=0x0;_0x17bb52<=this['_maxRetries'];_0x17bb52++)try{let _0x415ad2=this['_states']['get'](_0x567ef0)??await this['_restore'](_0x228703,_0x567ef0);if(_0x431be3<=_0x415ad2['processedRevision']){this['_remember'](_0x415ad2);return;}if(_0xe88a0b&&_0xe88a0b['revision']===_0x415ad2['processedRevision']+0x1)p(_0xe88a0b,_0x415ad2['unit'],_0xe88a0b['revision']),_0x415ad2=await this['_apply'](_0x228703,_0x415ad2,_0xe88a0b);else{for await(let _0x5d8fdd of m(this['_core'],_0x228703,_0x415ad2['unit'],_0x415ad2['processedRevision'],_0x431be3))for(let _0x3a4e1f of _0x5d8fdd)_0x415ad2=await this['_apply'](_0x228703,_0x415ad2,_0x3a4e1f);}this['_remember'](_0x415ad2);return;}catch(_0x5b4499){if(this['_states']['delete'](_0x567ef0),!(_0x5b4499 instanceof h)||_0x17bb52===this['_maxRetries'])throw _0x5b4499;}}async['_restore'](_0x4ff926,_0x228d13){let _0x1a26c5=await f(this['_core'],_0x4ff926,_0x228d13),_0x2a8c38=await this['_database']['getLatestRecord'](_0x4ff926,_0x228d13);if(!_0x2a8c38){let _0x1a9de0=_(_0x1a26c5);return await this['_append'](_0x4ff926,_0x1a9de0['currentRecord'],null),_0x1a9de0;}if(_0x2a8c38['startRevision']>_0x1a26c5['headRevision'])throw new t['CollabError']('ADAPTER_FAILURE','History\x20boundary\x20exceeds\x20Core\x20head');if(_0x2a8c38['startRevision']===0x1)return{..._(_0x1a26c5),'currentRecord':_0x2a8c38};let _0xf7b4a0=await this['_database']['listRecords'](_0x4ff926,_0x228d13,{'throughRevision':_0x2a8c38['startRevision'],'beforeRevision':_0x2a8c38['startRevision'],'length':0x1});for await(let _0x24fbb4 of m(this['_core'],_0x4ff926,_0x1a26c5,_0x2a8c38['startRevision']-0x1,_0x2a8c38['startRevision'])){let _0x1b99ce=_0x24fbb4[0x0],_0x281f5b=this['_policy']['evaluate']({'unitID':_0x228d13,'type':_0x1a26c5['type'],'currentRecord':_0xf7b4a0['records'][0x0]?.['record']??null,'changeset':_0x1b99ce});return{'unit':_0x1a26c5,'processedRevision':_0x2a8c38['startRevision'],'currentRecord':_0x2a8c38,'forceNextHistory':_0x281f5b['forceNextHistory']};}throw new t['CollabError']('ADAPTER_FAILURE','History\x20starting\x20changeset\x20is\x20missing');}['_advance'](_0x40431b,_0x1b3986){p(_0x1b3986,_0x40431b['unit'],_0x40431b['processedRevision']+0x1);let _0x5e21ea=this['_policy']['evaluate']({'unitID':_0x40431b['unit']['unitID'],'type':_0x40431b['unit']['type'],'currentRecord':_0x40431b['currentRecord'],'changeset':_0x1b3986}),_0x241cf2=_0x40431b['currentRecord']['startRevision']===0x1||_0x40431b['forceNextHistory']||_0x5e21ea['startsNewHistory']?{'unitID':_0x1b3986['unitID'],'startRevision':_0x1b3986['revision'],'userID':_0x1b3986['userID'],'createdAt':d(_0x1b3986),'origin':v(_0x1b3986['additionalFields']),..._0x1b3986['additionalFields']===void 0x0?{}:{'additionalFields':_0x1b3986['additionalFields']}}:_0x40431b['currentRecord'];return{'unit':_0x40431b['unit'],'processedRevision':_0x1b3986['revision'],'currentRecord':_0x241cf2,'forceNextHistory':_0x5e21ea['forceNextHistory']};}async['_apply'](_0x183d44,_0x45bd7d,_0x17cc84){let _0x39f72d=this['_advance'](_0x45bd7d,_0x17cc84);return _0x39f72d['currentRecord']!==_0x45bd7d['currentRecord']&&await this['_append'](_0x183d44,_0x39f72d['currentRecord'],_0x45bd7d['currentRecord']['startRevision']),this['_remember'](_0x39f72d),_0x39f72d;}async['_append'](_0x512524,_0x35f999,_0x52fbaf){if((await this['_database']['appendRecord'](_0x512524,_0x35f999,{'expectedLatestStartRevision':_0x52fbaf}))['status']==='conflict')throw new h('History\x20boundary\x20changed\x20during\x20indexing');}['_remember'](_0x436c99){for(this['_states']['delete'](_0x436c99['unit']['unitID']),this['_states']['set'](_0x436c99['unit']['unitID'],_0x436c99);this['_states']['size']>this['_maxCachedUnits'];)this['_states']['delete'](this['_states']['keys']()['next']()['value']);}['_serialize'](_0x493d44,_0x22d738){let _0xd8a16b=(this['_queues']['get'](_0x493d44)??Promise['resolve']())['then'](_0x22d738,_0x22d738),_0x1df406=_0xd8a16b['then'](()=>void 0x0,()=>void 0x0)['finally'](()=>{this['_queues']['get'](_0x493d44)===_0x1df406&&this['_queues']['delete'](_0x493d44);});return this['_queues']['set'](_0x493d44,_0x1df406),_0xd8a16b;}['_background'](_0x57a8f5,_0x26e885){this['_serialize'](_0x57a8f5,_0x26e885)['catch'](this['_log']);}};function _(_0x59c177){return{'unit':_0x59c177,'processedRevision':0x1,'forceNextHistory':!0x1,'currentRecord':{'unitID':_0x59c177['unitID'],'startRevision':0x1,'userID':_0x59c177['creatorID'],'createdAt':_0x59c177['createdAt'],'origin':0x1}};}function v(_0x2f2a6d){if(!_0x2f2a6d)return 0x1;try{return JSON['parse'](_0x2f2a6d)?.['origin']===0x2?0x2:0x1;}catch{return 0x1;}}async function y(_0x17723e,_0x15ed64,_0x59dcbf,_0x3c27b4){let _0x119ff2=[..._0x3c27b4]['sort']((_0xb87f43,_0x1883a2)=>_0xb87f43['record']['startRevision']-_0x1883a2['record']['startRevision'])['map'](_0x4ca1dc=>({'range':_0x4ca1dc,'commands':new Set(_0x4ca1dc['record']['startRevision']===0x1?['univer.mutation.create-unit']:[]),'users':new Set(_0x4ca1dc['record']['startRevision']===0x1?[_0x59dcbf['creatorID']]:[]),'startTime':_0x4ca1dc['record']['startRevision']===0x1?_0x59dcbf['createdAt']:_0x4ca1dc['record']['createdAt'],'endTime':_0x4ca1dc['record']['createdAt']})),_0x5cd699=new Map([[0x1,_0x59dcbf['createdAt']]]);for(let _0x47c57f=0x0;_0x47c57f<_0x119ff2['length'];){let _0x518598=_0x47c57f;for(;_0x518598+0x1<_0x119ff2['length']&&_0x119ff2[_0x518598]['range']['endRevision']+0x1===_0x119ff2[_0x518598+0x1]['range']['record']['startRevision'];)_0x518598++;let _0x2e882e=_0x47c57f,_0x4631b0=_0x119ff2[_0x47c57f]['range']['record']['startRevision']-0x1,_0x12f2ce=_0x119ff2[_0x518598]['range']['endRevision'];for await(let _0x559fbc of m(_0x17723e,_0x15ed64,_0x59dcbf,_0x4631b0,_0x12f2ce))for(let _0x2e315a of _0x559fbc){for(;_0x2e315a['revision']>_0x119ff2[_0x2e882e]['range']['endRevision'];)_0x2e882e++;let _0x5eba24=_0x119ff2[_0x2e882e],_0x3e6664=d(_0x2e315a);_0x2e315a['revision']===_0x5eba24['range']['record']['startRevision']&&(_0x5eba24['startTime']=_0x3e6664),_0x5eba24['endTime']=_0x3e6664,_0x5eba24['users']['add'](_0x2e315a['userID']);for(let _0x1c4d75 of _0x2e315a['mutations']){if(_0x5eba24['commands']['add'](_0x1c4d75['id']),_0x1c4d75['id']!=='univer.mutation.revert-version')continue;let _0x2e20a5;try{_0x2e20a5=JSON['parse'](_0x1c4d75['data'])['revision'];}catch{throw new t['CollabError']('ADAPTER_FAILURE','History\x20contains\x20invalid\x20restore\x20data');}if(typeof _0x2e20a5!='number'||!Number['isSafeInteger'](_0x2e20a5)||_0x2e20a5<0x1||_0x2e20a5>=_0x2e315a['revision'])throw new t['CollabError']('ADAPTER_FAILURE','History\x20contains\x20an\x20invalid\x20restore\x20revision');_0x5eba24['restoredRevision']??=_0x2e20a5;}}_0x47c57f=_0x518598+0x1;}let _0xe4fbca=new Set(_0x119ff2['flatMap'](_0x29d0b6=>_0x29d0b6['restoredRevision']===void 0x0?[]:[_0x29d0b6['restoredRevision']]));for(let _0x105a01 of _0xe4fbca)if(!_0x5cd699['has'](_0x105a01)){for await(let _0x138fd5 of m(_0x17723e,_0x15ed64,_0x59dcbf,_0x105a01-0x1,_0x105a01))_0x5cd699['set'](_0x105a01,d(_0x138fd5[0x0]));}let _0xccc803=Object['create'](null);for(let _0x187e93 of _0x119ff2){let _0x5165e8=_0x187e93['range']['record'],_0x11ac47=_0x5165e8['additionalFields']??(_0x187e93['restoredRevision']===void 0x0?void 0x0:JSON['stringify']({'restoredRevision':_0x187e93['restoredRevision']}));_0xccc803[_0x59dcbf['unitID']+':'+_0x5165e8['startRevision']]={'unitID':_0x59dcbf['unitID'],'userID':_0x5165e8['userID'],'userIDs':[..._0x187e93['users']],'command':[..._0x187e93['commands']],'createTime':String(_0x5165e8['createdAt']),'startRevision':_0x5165e8['startRevision'],'endRevision':_0x187e93['range']['endRevision'],'startRevCreateTime':_0x187e93['startTime'],'endRevCreateTime':_0x187e93['endTime'],'recoverTime':_0x187e93['restoredRevision']===void 0x0?'':String(_0x5cd699['get'](_0x187e93['restoredRevision'])),'origin':_0x5165e8['origin'],..._0x11ac47===void 0x0?{}:{'additionalFields':_0x11ac47}};}return _0xccc803;}var b=class{['_options'];['_dbAdapter'];['_middleware']=new l();['_indexer'];['_subscriptions']=[];['_calls']=new Set();['_state']='running';['_disposePromise'];constructor(_0x21f246){if(this['_options']=_0x21f246,!_0x21f246?.['collabService']||!_0x21f246['collabService']['dbAdapter'])throw TypeError('History\x20requires\x20collabService\x20with\x20a\x20dbAdapter');let _0x18abb4=_0x21f246['maxIndexRetries']??0x3,_0x5c603f=_0x21f246['maxCachedUnits']??0x3e8;if(!Number['isSafeInteger'](_0x18abb4)||_0x18abb4<0x0)throw TypeError('maxIndexRetries\x20must\x20be\x20a\x20non-negative\x20safe\x20integer');if(!Number['isSafeInteger'](_0x5c603f)||_0x5c603f<0x1)throw TypeError('maxCachedUnits\x20must\x20be\x20a\x20positive\x20safe\x20integer');this['_dbAdapter']=_0x21f246['dbAdapter']??new s(),this['_indexer']=new g(_0x21f246['collabService'],this['_dbAdapter'],_0x21f246['policy']??new c(),_0x5c603f,_0x18abb4,_0x44e4a0=>this['_logError']('History\x20background\x20indexing\x20failed',_0x44e4a0));try{this['_subscriptions']['push'](_0x21f246['collabService']['on']('unitCreated',_0x1f580f=>this['_indexer']['created'](_0x1f580f,_0x1f580f['record']))),this['_subscriptions']['push'](_0x21f246['collabService']['on']('changesetCommitted',_0x2ef6c1=>this['_indexer']['committed'](_0x2ef6c1,_0x2ef6c1['changeset'])));}catch(_0x1d492a){for(let _0x542513 of this['_subscriptions'])_0x542513['dispose']();throw _0x1d492a;}}['use'](_0x337469,_0x360d25){return this['_assertRunning'](),this['_middleware']['use'](_0x337469,_0x360d25);}['getHistoryList'](_0x27d810,_0x46fd7d){return this['_read']('getHistoryList',_0x27d810,_0x46fd7d,async _0x4dbbaa=>{if(!Number['isSafeInteger'](_0x27d810['length'])||_0x27d810['length']<0x1||_0x27d810['length']>0x64)throw E('length\x20must\x20be\x20an\x20integer\x20from\x201\x20to\x20100');if(_0x27d810['origin']!==void 0x0&&![0x0,0x1,0x2]['includes'](_0x27d810['origin']))throw E('Invalid\x20History\x20origin');let _0xf841a8=w(_0x27d810['lastLabel']),_0x41b232=await f(this['_options']['collabService'],_0x4dbbaa,_0x27d810['unitID']),_0x43a938={'throughRevision':_0x41b232['headRevision'],'length':_0x27d810['length'],..._0xf841a8===void 0x0?{}:{'beforeRevision':_0xf841a8},..._0x27d810['origin']===void 0x0?{}:{'origin':_0x27d810['origin']},..._0x27d810['userIDs']===void 0x0?{}:{'userIDs':_0x27d810['userIDs']}},_0x5c3757=await this['_dbAdapter']['listRecords'](_0x4dbbaa,_0x41b232['unitID'],_0x43a938);if(!_0x5c3757['records']['length']&&!await this['_dbAdapter']['getLatestRecord'](_0x4dbbaa,_0x41b232['unitID'])){let _0x19c0fb=await this['_indexer']['initializeIfEmpty'](_0x4dbbaa,_0x41b232);_0x5c3757=_0x19c0fb?r(_0x19c0fb,_0x43a938):await this['_dbAdapter']['listRecords'](_0x4dbbaa,_0x41b232['unitID'],_0x43a938);}let _0x2ff3fd=await y(this['_options']['collabService'],_0x4dbbaa,_0x41b232,_0x5c3757['records']),_0x4e3638=await this['_resolveUsers'](Object['values'](_0x2ff3fd)['flatMap'](_0xd9dcc3=>_0xd9dcc3['userIDs']),_0x4dbbaa);return{'hasMore':_0x5c3757['hasMore'],'lastLabel':_0x5c3757['records']['at'](-0x1)?.['record']['startRevision']['toString']()??'','entities':{'datas':_0x2ff3fd,'users':_0x4e3638},'historyIds':_0x5c3757['records']['map'](({record:_0x156fd6})=>_0x156fd6['unitID']+':'+_0x156fd6['startRevision'])};});}['listHistoryCreators'](_0x1b8e81,_0x40481f){return this['_read']('listHistoryCreators',_0x1b8e81,_0x40481f,async _0x2e3391=>{let _0x30b9ce=await f(this['_options']['collabService'],_0x2e3391,_0x1b8e81['unitID']),_0x4a8337={'throughRevision':_0x30b9ce['headRevision']},_0x1f0567=await this['_dbAdapter']['listCreators'](_0x2e3391,_0x30b9ce['unitID'],_0x4a8337);if(!_0x1f0567['length']&&!await this['_dbAdapter']['getLatestRecord'](_0x2e3391,_0x30b9ce['unitID'])){let _0x36af83=await this['_indexer']['initializeIfEmpty'](_0x2e3391,_0x30b9ce);_0x1f0567=_0x36af83?i(_0x36af83,_0x30b9ce['headRevision']):await this['_dbAdapter']['listCreators'](_0x2e3391,_0x30b9ce['unitID'],_0x4a8337);}let _0x211eb3=await this['_resolveUsers'](_0x1f0567['map'](_0x4b1eb5=>_0x4b1eb5['userID']),_0x2e3391);return{'creators':_0x1f0567['map'](_0x356121=>({..._0x356121,'name':_0x211eb3[_0x356121['userID']]['name'],'avatar':_0x211eb3[_0x356121['userID']]['avatar']}))};});}['getHistoryChangesets'](_0x2f97c9,_0x1ff337){return this['_read']('getHistoryChangesets',_0x2f97c9,_0x1ff337,async _0x41caea=>{if(C('startRevision',_0x2f97c9['startRevision']),C('endRevision',_0x2f97c9['endRevision']),_0x2f97c9['endRevision']<_0x2f97c9['startRevision'])throw E('endRevision\x20must\x20not\x20precede\x20startRevision');let _0x18bce5=await f(this['_options']['collabService'],_0x41caea,_0x2f97c9['unitID']);if(_0x2f97c9['endRevision']>_0x18bce5['headRevision'])throw E('endRevision\x20exceeds\x20Core\x20head');let _0x913c4f=[];for await(let _0x40d9c3 of m(this['_options']['collabService'],_0x41caea,_0x18bce5,_0x2f97c9['startRevision']-0x1,_0x2f97c9['endRevision']))_0x913c4f['push'](..._0x40d9c3);let _0xb2dea4=_0x913c4f['map'](_0x215649=>_0x215649['userID']);return _0x2f97c9['startRevision']===0x1&&_0xb2dea4['push'](_0x18bce5['creatorID']),{'changesets':_0x913c4f,'users':await this['_resolveUsers'](_0xb2dea4,_0x41caea)};});}['dispose'](){if(this['_disposePromise'])return this['_disposePromise'];this['_state']='disposing';for(let _0x6e723 of this['_subscriptions']['splice'](0x0))_0x6e723['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'](_0x14d514,_0x3bde9a,_0xcf37e8,_0x2119a3){this['_assertRunning']();let _0x6a6754=((async()=>{let _0x5b1c4f={...x(_0xcf37e8),'request':{..._0x3bde9a}},_0x21c886;return await this['_middleware']['run'](_0x14d514,_0x5b1c4f,async()=>{S(_0x3bde9a['unitID']);try{_0x21c886=await _0x2119a3(_0x5b1c4f);}catch(_0x2c76c9){throw _0x2c76c9 instanceof t['CollabError']?_0x2c76c9:new t['CollabError']('ADAPTER_FAILURE','History\x20read\x20failed',{'cause':_0x2c76c9,'retryable':!0x0});}}),_0x21c886;})());return this['_calls']['add'](_0x6a6754),_0x6a6754['then'](()=>this['_calls']['delete'](_0x6a6754),()=>this['_calls']['delete'](_0x6a6754)),_0x6a6754;}async['_resolveUsers'](_0x1dff58,_0xb44aa3){let _0x2a6444=new Set(_0x1dff58),_0x42c73a=Object['create'](null);if(_0x2a6444['size']&&this['_options']['userProvider'])try{for(let _0x4bb4f5 of await this['_options']['userProvider']['getUsers']([..._0x2a6444],_0xb44aa3))_0x2a6444['has'](_0x4bb4f5['userID'])&&(_0x42c73a[_0x4bb4f5['userID']]=_0x4bb4f5);}catch(_0x1f1666){this['_logError']('History\x20user\x20lookup\x20failed',_0x1f1666);}for(let _0x36ce6c of _0x2a6444)_0x42c73a[_0x36ce6c]??=T(_0x36ce6c);return _0x42c73a;}['_assertRunning'](){if(this['_state']!=='running')throw new t['CollabError']('INTERNAL_ERROR','History\x20Service\x20is\x20'+this['_state']);}['_logError'](_0x5e552d,_0x2773f4){try{this['_options']['logger']?.['error'](_0x5e552d,{'error':_0x2773f4 instanceof Error?_0x2773f4['message']:String(_0x2773f4)});}catch{}}};function x(_0x19894b){if(!_0x19894b||typeof _0x19894b!='object')throw E('context\x20must\x20be\x20an\x20object');if(typeof _0x19894b['userID']!='string'||_0x19894b['userID']['length']===0x0)throw E('userID\x20must\x20be\x20a\x20non-empty\x20string');if(_0x19894b['customData']!==void 0x0&&(_0x19894b['customData']===null||typeof _0x19894b['customData']!='object'||Array['isArray'](_0x19894b['customData'])))throw E('customData\x20must\x20be\x20an\x20object');return{'userID':_0x19894b['userID'],'customData':_0x19894b['customData']??Object['create'](null)};}function S(_0x32e8e5){if(!_0x32e8e5)throw E('unitID\x20is\x20required');}function C(_0x229abb,_0x4bc41c){if(!Number['isSafeInteger'](_0x4bc41c)||_0x4bc41c<0x1)throw E(_0x229abb+'\x20must\x20be\x20a\x20positive\x20safe\x20integer');}function w(_0x517b9f){if(!_0x517b9f)return;let _0x402652=Number(_0x517b9f);return C('lastLabel',_0x402652),_0x402652;}function T(_0x2c1754){return{'userID':_0x2c1754,'name':_0x2c1754,'avatar':'','anonymous':!0x0,'canBindAnonymous':!0x1,'phone':'','email':'','createTimestamp':0x0};}function E(_0x2611c7){return new t['CollabError']('INVALID_REQUEST',_0x2611c7);}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
|
+
const _0x2d933a=_0x4eb2;(function(_0x332b3b,_0x27f50c){const _0x51f384=_0x4eb2,_0x53cd35=_0x332b3b();while(!![]){try{const _0x132fb3=parseInt(_0x51f384(0x1e9))/0x1+-parseInt(_0x51f384(0x1e0))/0x2+-parseInt(_0x51f384(0x1e3))/0x3*(parseInt(_0x51f384(0x1e7))/0x4)+-parseInt(_0x51f384(0x1eb))/0x5*(-parseInt(_0x51f384(0x1e1))/0x6)+-parseInt(_0x51f384(0x1e5))/0x7*(parseInt(_0x51f384(0x1ea))/0x8)+parseInt(_0x51f384(0x1e6))/0x9+-parseInt(_0x51f384(0x1ec))/0xa*(-parseInt(_0x51f384(0x1e4))/0xb);if(_0x132fb3===_0x27f50c)break;else _0x53cd35['push'](_0x53cd35['shift']());}catch(_0x318779){_0x53cd35['push'](_0x53cd35['shift']());}}}(_0x321b,0x7e97a));import _0x58a706 from'./index.cjs';function _0x4eb2(_0x3b4aa3,_0x37452a){_0x3b4aa3=_0x3b4aa3-0x1e0;const _0x321b99=_0x321b();let _0x4eb2b4=_0x321b99[_0x3b4aa3];return _0x4eb2b4;}const facadeExport0=_0x58a706[_0x2d933a(0x1e2)],facadeExport1=_0x58a706[_0x2d933a(0x1ed)],facadeExport2=_0x58a706[_0x2d933a(0x1e8)];export{facadeExport0 as DefaultHistoryPolicy,facadeExport1 as MemoryHistoryDatabaseAdapter,facadeExport2 as UniverHistoryService};function _0x321b(){const _0x42e139=['16BorESN','UniverHistoryService','493810woIeyH','7593928jnNhBG','150295Pwsymk','30pfHwsr','MemoryHistoryDatabaseAdapter','531400QuxCcl','108rlZeOs','DefaultHistoryPolicy','216597cRAgTu','1430957WVNUMx','7BhsNgx','5374134KwqSkR'];_0x321b=function(){return _0x42e139;};return _0x321b();}
|
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.
|
|
4
|
+
"version": "1.0.1",
|
|
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.
|
|
20
|
-
"@univerjs-pro/collaboration-service": "1.0.
|
|
21
|
-
"@univerjs/protocol": "1.0.
|
|
19
|
+
"@univerjs-pro/collaboration": "1.0.1",
|
|
20
|
+
"@univerjs-pro/collaboration-service": "1.0.1",
|
|
21
|
+
"@univerjs/protocol": "1.0.1"
|
|
22
22
|
}
|
|
23
23
|
}
|