@univerjs-pro/collaboration-database-sqlite 1.0.0-insiders.20260808-70eefdd → 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 ADDED
@@ -0,0 +1,83 @@
1
+ # @univerjs-pro/collaboration-database-sqlite
2
+
3
+ English | [简体中文](./README.zh-CN.md)
4
+
5
+ A persistent SQLite `IDatabaseAdapter` using the stable synchronous `libsql` API. Requires Node.js 22 or later.
6
+
7
+ ## Create the Adapter
8
+
9
+ ```bash
10
+ pnpm add \
11
+ @univerjs-pro/collaboration-service \
12
+ @univerjs-pro/collaboration-database-sqlite
13
+ ```
14
+
15
+ The caller must create the database parent directory first:
16
+
17
+ ```ts
18
+ import { mkdir } from 'node:fs/promises';
19
+ import { SQLiteDatabaseAdapter } from '@univerjs-pro/collaboration-database-sqlite';
20
+ import { UniverCollabService } from '@univerjs-pro/collaboration-service';
21
+
22
+ await mkdir('./data', { recursive: true });
23
+
24
+ const database = new SQLiteDatabaseAdapter({
25
+ filename: './data/collaboration.sqlite',
26
+ busyTimeoutMs: 5_000,
27
+ });
28
+ const service = new UniverCollabService({ dbAdapter: database });
29
+
30
+ await service.dispose();
31
+ await database.dispose();
32
+ ```
33
+
34
+ Pass the Adapter to `UniverCollabService` as `dbAdapter`.
35
+
36
+ ## Persistence guarantees
37
+
38
+ The Adapter uses foreign keys and `BEGIN IMMEDIATE` write transactions to guarantee:
39
+
40
+ - atomic creation of the initial snapshot and Sheet blocks;
41
+ - revision CAS with atomic changeset and head publication;
42
+ - a snapshot becomes visible to new reads only after all of its dependencies are complete;
43
+ - soft-delete, recovery, and hard-delete batches are all-or-nothing;
44
+ - hard delete keeps a permanent deletion marker that prevents Unit ID reuse.
45
+
46
+ It stores only core collaboration data. Product resources, users, ACLs, History, Comment, and Worktree are managed by the application or their respective Adapters.
47
+
48
+ ## SQLite behavior
49
+
50
+ - It does not change `journal_mode`; configure WAL, checkpointing, or backup policy before opening the Adapter when needed.
51
+ - Core tables use the `collaboration_` prefix.
52
+ - Schema version `('core', 2)` is stored in `collaboration_schema_versions`; `PRAGMA user_version` is not used.
53
+ - Changeset scalar columns and the submission unique constraint provide database-level integrity, while commits use revision CAS and do not query the submission key.
54
+ - An empty database is initialized automatically. Incomplete or unsupported core schemas are rejected.
55
+
56
+ This implementation suits local applications and small-to-medium single-Node deployments.
57
+
58
+ ## Explicit v1 → v2 migration
59
+
60
+ V2 adds required `creator_id` (creator) and `created_at_ms` (creation time, Unix milliseconds)
61
+ to `collaboration_units`, and required `created_at_ms` (commit time, Unix milliseconds)
62
+ to `collaboration_changesets`.
63
+
64
+ Stop writers and back up the file,
65
+ then migrate before constructing the Adapter. Opening an old database does not migrate it automatically.
66
+
67
+ ```ts
68
+ import { migrateSQLiteCoreV1ToV2 } from '@univerjs-pro/collaboration-database-sqlite';
69
+
70
+ await migrateSQLiteCoreV1ToV2({ filename: './data/collaboration.sqlite' });
71
+ ```
72
+
73
+ Missing data is filled using these rules:
74
+
75
+ - Unit creator and creation time: revision 1's `user_id` and `committed_at` in `collaboration_history_revisions` in the same database.
76
+ - Changeset time: payload `createTime` (seconds), then the matching History revision's `committed_at` (milliseconds).
77
+ - Missing or invalid information: `anonymous` for the creator and the migration start time for timestamps.
78
+ These fallback values do not represent historical facts.
79
+
80
+ Optional `resolveUnitCreation(unitID)` and `resolveChangesetCreatedAt(unitID, revision)` callbacks
81
+ replace the defaults. They may be async and return `{ creatorID, createdAt }` and a timestamp,
82
+ respectively, using Unix milliseconds. They cover soft-deleted Units too and must not write to
83
+ the same database. Invalid callback results or exceptions roll back the migration.
@@ -0,0 +1,84 @@
1
+ # @univerjs-pro/collaboration-database-sqlite
2
+
3
+ [English](./README.md) | [简体中文](./README.zh-CN.md)
4
+
5
+ 持久化 SQLite `IDatabaseAdapter`,使用稳定的 `libsql` 同步接口,支持 Node.js 22
6
+ 及以上版本。
7
+
8
+ ## 创建 Adapter
9
+
10
+ ```bash
11
+ pnpm add \
12
+ @univerjs-pro/collaboration-service \
13
+ @univerjs-pro/collaboration-database-sqlite
14
+ ```
15
+
16
+ 调用方需要先创建数据库父目录:
17
+
18
+ ```ts
19
+ import { mkdir } from 'node:fs/promises';
20
+ import { SQLiteDatabaseAdapter } from '@univerjs-pro/collaboration-database-sqlite';
21
+ import { UniverCollabService } from '@univerjs-pro/collaboration-service';
22
+
23
+ await mkdir('./data', { recursive: true });
24
+
25
+ const database = new SQLiteDatabaseAdapter({
26
+ filename: './data/collaboration.sqlite',
27
+ busyTimeoutMs: 5_000,
28
+ });
29
+ const service = new UniverCollabService({ dbAdapter: database });
30
+
31
+ await service.dispose();
32
+ await database.dispose();
33
+ ```
34
+
35
+ 将 Adapter 作为 `dbAdapter` 传给 `UniverCollabService`。
36
+
37
+ ## 持久化保证
38
+
39
+ Adapter 使用 foreign keys 和 `BEGIN IMMEDIATE` 写事务,保证:
40
+
41
+ - 初始 snapshot 与 Sheet blocks 原子创建;
42
+ - revision CAS 与 changeset/head 原子发布;
43
+ - snapshot 依赖完整后才对新读取可见;
44
+ - 软删除、恢复和 hard delete 批次全有或全无;
45
+ - hard delete 保留永久删除标记,禁止 Unit ID 复用。
46
+
47
+ 它只保存协同核心数据。产品资源、用户、ACL、History、Comment 和 Worktree 分别由应用
48
+ 或对应 Adapter 管理。
49
+
50
+ ## SQLite 行为
51
+
52
+ - 不主动修改 `journal_mode`;需要 WAL、checkpoint 或备份策略时由应用在打开前配置。
53
+ - 核心表使用 `collaboration_` 前缀。
54
+ - schema 版本以 `('core', 2)` 写入 `collaboration_schema_versions`,不占用
55
+ `PRAGMA user_version`。
56
+ - changeset 标量列和 submission unique constraint 提供数据库级完整性;提交只做 revision
57
+ CAS,不按 submission key 点查。
58
+ - 空库会自动初始化;不完整或不支持的核心 schema 会被拒绝。
59
+
60
+ 本实现适合本地应用和中小规模单 Node 部署。
61
+
62
+ ## 显式 v1 → v2 迁移
63
+
64
+ v2 为 `collaboration_units` 新增必填的 `creator_id`(创建者)和
65
+ `created_at_ms`(创建时间,Unix 毫秒),为 `collaboration_changesets` 新增必填的
66
+ `created_at_ms`(提交时间,Unix 毫秒)。
67
+
68
+ 停止写入并备份后,在构造 Adapter 前执行;打开旧库不会自动迁移。
69
+
70
+ ```ts
71
+ import { migrateSQLiteCoreV1ToV2 } from '@univerjs-pro/collaboration-database-sqlite';
72
+
73
+ await migrateSQLiteCoreV1ToV2({ filename: './data/collaboration.sqlite' });
74
+ ```
75
+
76
+ 默认按以下规则补齐数据:
77
+
78
+ - Unit 创建者和时间:同一数据库中 `collaboration_history_revisions` 的 revision 1 记录中的 `user_id`、`committed_at`。
79
+ - Changeset 时间:优先使用 payload 的 `createTime`(秒),其次使用对应 History revision 的 `committed_at`(毫秒)。
80
+ - 信息缺失或非法:创建者使用 `anonymous`,时间使用本次迁移开始时间。这些兜底值不代表真实历史。
81
+
82
+ 可选回调 `resolveUnitCreation(unitID)` 和 `resolveChangesetCreatedAt(unitID, revision)`
83
+ 可覆盖默认策略,分别返回 `{ creatorID, createdAt }` 和时间值,时间均为 Unix 毫秒,支持异步。
84
+ 回调也包含软删除 Unit,不得写入同一数据库;返回非法值或抛出异常会使迁移整体回滚。
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object['defineProperty'](exports,Symbol['toStringTag'],{'value':'Module'});var e=Object['create'],t=Object['defineProperty'],n=Object['getOwnPropertyDescriptor'],r=Object['getOwnPropertyNames'],i=Object['getPrototypeOf'],a=Object['prototype']['hasOwnProperty'],o=(_0xe229f5,_0x11c701,_0x3a2a84,_0x2e21e1)=>{if(_0x11c701&&typeof _0x11c701=='object'||typeof _0x11c701=='function'){for(var _0x845417=r(_0x11c701),_0x1d834a=0x0,_0xcb6d8c=_0x845417['length'],_0x328613;_0x1d834a<_0xcb6d8c;_0x1d834a++)_0x328613=_0x845417[_0x1d834a],!a['call'](_0xe229f5,_0x328613)&&_0x328613!==_0x3a2a84&&t(_0xe229f5,_0x328613,{'get':(_0x208d12=>_0x11c701[_0x208d12])['bind'](null,_0x328613),'enumerable':!(_0x2e21e1=n(_0x11c701,_0x328613))||_0x2e21e1['enumerable']});}return _0xe229f5;},s=(_0x1b7163,_0x5d0754,_0x207b63)=>(_0x207b63=_0x1b7163==null?{}:e(i(_0x1b7163)),o(_0x5d0754||!_0x1b7163||!_0x1b7163['__esModule']?t(_0x207b63,'default',{'value':_0x1b7163,'enumerable':!0x0}):_0x207b63,_0x1b7163));let c=require('libsql');c=s(c,0x1);let l=require('@univerjs-pro/collaboration-service');var u=0x1388,d='__univerCollaborationBinary',f='core',p=0x1,m=['collaboration_units','collaboration_unit_tombstones','collaboration_snapshots','collaboration_changesets','collaboration_sheet_blocks','collaboration_resources'],h=class{['_database'];['_disposed']=!0x1;constructor(_0x1a0350){g(_0x1a0350),this['_database']=new c['default'](_0x1a0350['filename'],{'timeout':_0x1a0350['busyTimeoutMs']??u});try{this['_database']['exec']('PRAGMA\x20foreign_keys\x20=\x20ON;'),this['_database']['exec']('PRAGMA\x20busy_timeout\x20=\x20'+(_0x1a0350['busyTimeoutMs']??u)+';'),this['_initializeSchema']();}catch(_0xd7e931){throw this['_database']['close'](),_0xd7e931;}}async['getUnit'](_0x272aa3,_0xf99e2b){this['_assertOpen']();let _0x5bb40a=this['_database']['prepare']('SELECT\x20unit_id,\x20type,\x20head_revision,\x20soft_deleted_at_ms\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20unit_id\x20=\x20?\x20AND\x20soft_deleted_at_ms\x20IS\x20NULL')['get'](_0xf99e2b);return _0x5bb40a?b(_0x5bb40a):null;}async['getSnapshot'](_0x12add4,_0x1f3181,_0x15df3d){this['_assertOpen']();let _0x3e5e85=_0x15df3d?.['revision'];if(_0x3e5e85!==void 0x0&&_0x3e5e85<0x0)throw x('Snapshot\x20revision\x20cannot\x20be\x20negative');let _0x3d03e0=this['_getActiveUnitRow'](_0x1f3181);if(!_0x3d03e0)return null;let _0x1f2d5e=_0x3e5e85===void 0x0||_0x3e5e85===0x0?_0x3d03e0['head_revision']:Math['min'](_0x3e5e85,_0x3d03e0['head_revision']),_0x1bc427=this['_database']['prepare']('SELECT\x20collaboration_snapshots.payload_json\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_snapshots\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20JOIN\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20collaboration_units.unit_id\x20=\x20collaboration_snapshots.unit_id\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20collaboration_snapshots.unit_id\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_snapshots.revision\x20<=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_units.soft_deleted_at_ms\x20IS\x20NULL\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20collaboration_snapshots.revision\x20DESC\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20LIMIT\x201')['get'](_0x1f3181,_0x1f2d5e);return _0x1bc427?T(_0x1bc427['payload_json']):null;}async['getChangesets'](_0x2a8b7b,_0x24fc1a,_0x20de82){if(this['_assertOpen'](),_0x20de82['from']<0x0||_0x20de82['to']<0x0)throw x('Changeset\x20range\x20revisions\x20cannot\x20be\x20negative');let _0x17572c=this['_database']['prepare']('SELECT\x20collaboration_units.head_revision,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20collaboration_changesets.payload_json\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20LEFT\x20JOIN\x20collaboration_changesets\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20collaboration_changesets.unit_id\x20=\x20collaboration_units.unit_id\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_changesets.revision\x20>\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_changesets.revision\x20<=\x20CASE\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20?\x20=\x200\x20THEN\x20collaboration_units.head_revision\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ELSE\x20MIN(?,\x20collaboration_units.head_revision)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20END\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20collaboration_units.unit_id\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_units.soft_deleted_at_ms\x20IS\x20NULL\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20collaboration_changesets.revision\x20ASC')['all'](_0x20de82['from'],_0x20de82['to'],_0x20de82['to'],_0x24fc1a),_0x3446f1=_0x17572c[0x0];return _0x3446f1?{'changesets':_0x17572c['flatMap'](_0x36828c=>_0x36828c['payload_json']?[T(_0x36828c['payload_json'])]:[]),'latestRevision':_0x3446f1['head_revision']}:{'changesets':[],'latestRevision':0x0};}async['getSubmission'](_0xa81bf7,_0x42d82d,_0x26de6d,_0x4e8113){this['_assertOpen']();let _0x7888b0=this['_database']['prepare']('SELECT\x20collaboration_changesets.payload_json\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_changesets\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20JOIN\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20collaboration_units.unit_id\x20=\x20collaboration_changesets.unit_id\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20collaboration_changesets.unit_id\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_changesets.sid\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_changesets.req_id\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_units.soft_deleted_at_ms\x20IS\x20NULL')['get'](_0x42d82d,_0x26de6d,_0x4e8113);return _0x7888b0?T(_0x7888b0['payload_json']):null;}async['createUnit'](_0x456350,_0x3c46aa){this['_assertOpen'](),_(_0x3c46aa);let _0x46950d=w(_0x3c46aa['snapshot']),_0x377a3a=(_0x3c46aa['sheetBlocks']??[])['map'](_0x281776=>({'id':_0x281776['id'],'payload':w(_0x281776)}));return this['_transaction'](()=>{if(this['_hasTombstone'](_0x3c46aa['record']['unitID']))throw x('Cannot\x20reuse\x20a\x20hard-deleted\x20unit\x20ID');let _0x352e04=this['_getStoredUnitRow'](_0x3c46aa['record']['unitID']);if(_0x352e04){if(_0x352e04['soft_deleted_at_ms']!==null)throw x('Cannot\x20reuse\x20a\x20soft-deleted\x20unit\x20ID');return{'status':'already-exists','record':b(_0x352e04)};}return this['_database']['prepare']('INSERT\x20INTO\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(unit_id,\x20type,\x20head_revision,\x20soft_deleted_at_ms)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(?,\x20?,\x201,\x20NULL)')['run'](_0x3c46aa['record']['unitID'],_0x3c46aa['record']['type']),this['_writeSheetBlocks'](_0x3c46aa['record']['unitID'],_0x377a3a),this['_database']['prepare']('INSERT\x20INTO\x20collaboration_snapshots\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(unit_id,\x20revision,\x20type,\x20payload_json)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(?,\x201,\x20?,\x20?)')['run'](_0x3c46aa['record']['unitID'],_0x3c46aa['record']['type'],_0x46950d),{'status':'created','record':{..._0x3c46aa['record']}};});}async['deleteUnits'](_0x4eea8a,_0x362e09){return this['_assertOpen'](),this['_transaction'](()=>{let _0x302943=C(_0x362e09['unitIDs'])['map'](_0x451cec=>{let _0x51f38f=this['_getStoredUnitRow'](_0x451cec);if(!_0x51f38f){if(_0x362e09['hardDelete']&&this['_hasTombstone'](_0x451cec))return{'unitID':_0x451cec,'status':'already-hard-deleted'};throw new l['CollabError']('UNIT_NOT_FOUND','Cannot\x20delete\x20a\x20missing\x20unit');}return _0x362e09['hardDelete']?{'unitID':_0x451cec,'status':'hard-deleted'}:{'unitID':_0x451cec,'status':_0x51f38f['soft_deleted_at_ms']===null?'soft-deleted':'already-soft-deleted'};}),_0x33a642=this['_database']['prepare']('UPDATE\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20SET\x20soft_deleted_at_ms\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20unit_id\x20=\x20?\x20AND\x20soft_deleted_at_ms\x20IS\x20NULL'),_0x4ee677=this['_database']['prepare']('INSERT\x20INTO\x20collaboration_unit_tombstones\x20(unit_id,\x20purged_at)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(?,\x20?)'),_0x5690bf=this['_database']['prepare']('DELETE\x20FROM\x20collaboration_units\x20WHERE\x20unit_id\x20=\x20?'),_0x236e12=Date['now']();for(let _0x2f7ae1 of _0x302943)_0x2f7ae1['status']==='soft-deleted'?_0x33a642['run'](_0x236e12,_0x2f7ae1['unitID']):_0x2f7ae1['status']==='hard-deleted'&&(_0x4ee677['run'](_0x2f7ae1['unitID'],_0x236e12),_0x5690bf['run'](_0x2f7ae1['unitID']));return{'units':_0x302943};});}async['recoverUnits'](_0xf0829f,_0x5c4dd8){return this['_assertOpen'](),this['_transaction'](()=>{let _0x334139=C(_0x5c4dd8['unitIDs'])['map'](_0x5a72db=>{let _0x15826a=this['_getStoredUnitRow'](_0x5a72db);if(!_0x15826a)throw this['_hasTombstone'](_0x5a72db)?x('Cannot\x20recover\x20a\x20hard-deleted\x20unit'):new l['CollabError']('UNIT_NOT_FOUND','Cannot\x20recover\x20a\x20missing\x20unit');return{'unitID':_0x5a72db,'status':_0x15826a['soft_deleted_at_ms']===null?'already-active':'recovered'};}),_0x556c63=this['_database']['prepare']('UPDATE\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20SET\x20soft_deleted_at_ms\x20=\x20NULL\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20unit_id\x20=\x20?\x20AND\x20soft_deleted_at_ms\x20IS\x20NOT\x20NULL');for(let _0x4bbfc0 of _0x334139)_0x4bbfc0['status']==='recovered'&&_0x556c63['run'](_0x4bbfc0['unitID']);return{'units':_0x334139};});}async['commitChangeset'](_0x2f63b3,_0x406ce4){this['_assertOpen'](),v(_0x406ce4['changeset']);let _0xb989d2=w(_0x406ce4['changeset']);return this['_transaction'](()=>{let {changeset:_0x2c75e3,expectedHeadRevision:_0x102e68}=_0x406ce4,_0x584339=this['_getActiveUnitRow'](_0x2c75e3['unitID']);if(!_0x584339)throw new l['CollabError']('UNIT_NOT_FOUND','Cannot\x20commit\x20to\x20a\x20missing\x20unit');let _0x585e81=this['_database']['prepare']('SELECT\x20payload_json\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_changesets\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20unit_id\x20=\x20?\x20AND\x20sid\x20=\x20?\x20AND\x20req_id\x20=\x20?')['get'](_0x2c75e3['unitID'],_0x2c75e3['sid'],_0x2c75e3['reqId']);if(_0x585e81)return{'status':'already-committed','changeset':T(_0x585e81['payload_json'])};if(_0x584339['head_revision']!==_0x102e68)return{'status':'revision-mismatch','actualHeadRevision':_0x584339['head_revision']};if(y(b(_0x584339),_0x406ce4),this['_database']['prepare']('INSERT\x20INTO\x20collaboration_changesets\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(unit_id,\x20revision,\x20base_revision,\x20sid,\x20req_id,\x20payload_json)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(?,\x20?,\x20?,\x20?,\x20?,\x20?)')['run'](_0x2c75e3['unitID'],_0x2c75e3['revision'],_0x2c75e3['baseRev'],_0x2c75e3['sid'],_0x2c75e3['reqId'],_0xb989d2),this['_database']['prepare']('UPDATE\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20SET\x20head_revision\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20unit_id\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20head_revision\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20soft_deleted_at_ms\x20IS\x20NULL')['run'](_0x2c75e3['revision'],_0x2c75e3['unitID'],_0x102e68)['changes']!==0x1)throw new l['CollabError']('INTERNAL_ERROR','SQLite\x20head\x20changed\x20inside\x20an\x20exclusive\x20write\x20transaction');return{'status':'committed','changeset':T(_0xb989d2),'headRevision':_0x2c75e3['revision']};});}async['saveSnapshot'](_0x5877e6,_0x2d28a0){this['_assertOpen']();let _0x16e926=w(_0x2d28a0['snapshot']),_0x307a47=(_0x2d28a0['sheetBlocks']??[])['map'](_0x4eed96=>({'id':_0x4eed96['id'],'payload':w(_0x4eed96)}));this['_transaction'](()=>{let _0x192bf0=this['_getActiveUnitRow'](_0x2d28a0['snapshot']['unitID']);if(!_0x192bf0)throw new l['CollabError']('UNIT_NOT_FOUND','Cannot\x20snapshot\x20a\x20missing\x20unit');if(_0x2d28a0['snapshot']['type']!==_0x192bf0['type']||_0x2d28a0['snapshot']['rev']<0x1||_0x2d28a0['snapshot']['rev']>_0x192bf0['head_revision'])throw x('Snapshot\x20does\x20not\x20match\x20the\x20stored\x20unit\x20head');this['_writeSheetBlocks'](_0x2d28a0['snapshot']['unitID'],_0x307a47),this['_database']['prepare']('INSERT\x20INTO\x20collaboration_snapshots\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(unit_id,\x20revision,\x20type,\x20payload_json)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(?,\x20?,\x20?,\x20?)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20CONFLICT(unit_id,\x20revision)\x20DO\x20UPDATE\x20SET\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type\x20=\x20excluded.type,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20payload_json\x20=\x20excluded.payload_json')['run'](_0x2d28a0['snapshot']['unitID'],_0x2d28a0['snapshot']['rev'],_0x2d28a0['snapshot']['type'],_0x16e926);});}async['getSheetBlock'](_0x3c8aa2,_0x4d1b8d,_0x4310f6){this['_assertOpen']();let _0xafa10a=this['_database']['prepare']('SELECT\x20collaboration_sheet_blocks.payload_json\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_sheet_blocks\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20JOIN\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20collaboration_units.unit_id\x20=\x20collaboration_sheet_blocks.unit_id\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20collaboration_sheet_blocks.unit_id\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_sheet_blocks.block_id\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_units.soft_deleted_at_ms\x20IS\x20NULL')['get'](_0x4d1b8d,_0x4310f6);return _0xafa10a?T(_0xafa10a['payload_json']):null;}async['dispose'](){this['_disposed']||(this['_disposed']=!0x0,this['_database']['close']());}['_initializeSchema'](){this['_transaction'](()=>{if(!this['_hasTable']('collaboration_schema_versions')){if(this['_hasAnyCoreTable']())throw S('SQLite\x20collaboration\x20core\x20tables\x20exist\x20without\x20a\x20schema\x20version');this['_database']['exec']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20collaboration_schema_versions\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20component\x20TEXT\x20PRIMARY\x20KEY,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20version\x20INTEGER\x20NOT\x20NULL\x20CHECK\x20(version\x20>=\x201)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x20\x20\x20\x20\x20\x20\x20\x20');}let _0xfb19df=this['_database']['prepare']('SELECT\x20version\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_schema_versions\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20component\x20=\x20?')['get'](f);if(_0xfb19df){if(_0xfb19df['version']!==p)throw S('SQLite\x20collaboration\x20core\x20schema\x20version\x20'+_0xfb19df['version']+'\x20is\x20not\x20supported');let _0x108fc4=m['filter'](_0x4cc1e3=>!this['_hasTable'](_0x4cc1e3));if(_0x108fc4['length']>0x0)throw S('SQLite\x20collaboration\x20core\x20schema\x20v1\x20is\x20incomplete:\x20missing\x20'+_0x108fc4['join'](',\x20'));return;}if(this['_hasAnyCoreTable']())throw S('SQLite\x20collaboration\x20core\x20tables\x20exist\x20without\x20a\x20schema\x20version');this['_database']['exec']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20collaboration_units\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20unit_id\x20TEXT\x20PRIMARY\x20KEY,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type\x20INTEGER\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20head_revision\x20INTEGER\x20NOT\x20NULL\x20CHECK\x20(head_revision\x20>=\x201),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20soft_deleted_at_ms\x20INTEGER\x0a\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20collaboration_unit_tombstones\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20unit_id\x20TEXT\x20PRIMARY\x20KEY,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20purged_at\x20INTEGER\x20NOT\x20NULL\x0a\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20collaboration_snapshots\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20unit_id\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20revision\x20INTEGER\x20NOT\x20NULL\x20CHECK\x20(revision\x20>=\x201),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type\x20INTEGER\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20payload_json\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20PRIMARY\x20KEY\x20(unit_id,\x20revision),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FOREIGN\x20KEY\x20(unit_id)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20REFERENCES\x20collaboration_units(unit_id)\x20ON\x20DELETE\x20CASCADE\x0a\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20collaboration_changesets\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20unit_id\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20revision\x20INTEGER\x20NOT\x20NULL\x20CHECK\x20(revision\x20>=\x202),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20base_revision\x20INTEGER\x20NOT\x20NULL\x20CHECK\x20(base_revision\x20>=\x201),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20sid\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20req_id\x20INTEGER\x20NOT\x20NULL\x20CHECK\x20(req_id\x20>=\x201),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20payload_json\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20PRIMARY\x20KEY\x20(unit_id,\x20revision),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20UNIQUE\x20(unit_id,\x20sid,\x20req_id),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FOREIGN\x20KEY\x20(unit_id)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20REFERENCES\x20collaboration_units(unit_id)\x20ON\x20DELETE\x20CASCADE\x0a\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20collaboration_sheet_blocks\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20unit_id\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20block_id\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20payload_json\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20PRIMARY\x20KEY\x20(unit_id,\x20block_id),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FOREIGN\x20KEY\x20(unit_id)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20REFERENCES\x20collaboration_units(unit_id)\x20ON\x20DELETE\x20CASCADE\x0a\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20collaboration_resources\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20unit_id\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20resource_id\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20payload_json\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20PRIMARY\x20KEY\x20(unit_id,\x20resource_id),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FOREIGN\x20KEY\x20(unit_id)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20REFERENCES\x20collaboration_units(unit_id)\x20ON\x20DELETE\x20CASCADE\x0a\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20INDEX\x20collaboration_snapshots_nearest_revision\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20collaboration_snapshots(unit_id,\x20revision\x20DESC);\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20INDEX\x20collaboration_changesets_revision_range\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20collaboration_changesets(unit_id,\x20revision\x20ASC);\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20collaboration_schema_versions\x20(component,\x20version)\x0a\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(\x27core\x27,\x201);\x0a\x20\x20\x20\x20\x20\x20');});}['_getActiveUnitRow'](_0x171ea5){return this['_database']['prepare']('SELECT\x20unit_id,\x20type,\x20head_revision,\x20soft_deleted_at_ms\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20unit_id\x20=\x20?\x20AND\x20soft_deleted_at_ms\x20IS\x20NULL')['get'](_0x171ea5)??null;}['_getStoredUnitRow'](_0x495a48){return this['_database']['prepare']('SELECT\x20unit_id,\x20type,\x20head_revision,\x20soft_deleted_at_ms\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20unit_id\x20=\x20?')['get'](_0x495a48)??null;}['_hasTombstone'](_0x1bee02){return!!this['_database']['prepare']('SELECT\x201\x20FROM\x20collaboration_unit_tombstones\x20WHERE\x20unit_id\x20=\x20?')['get'](_0x1bee02);}['_hasTable'](_0x30e622){return!!this['_database']['prepare']('SELECT\x201\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20sqlite_schema\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20type\x20=\x20\x27table\x27\x20AND\x20name\x20=\x20?')['get'](_0x30e622);}['_hasAnyCoreTable'](){return m['some'](_0x47093d=>this['_hasTable'](_0x47093d));}['_writeSheetBlocks'](_0x4936b2,_0x28e27c){let _0x13efe0=this['_database']['prepare']('INSERT\x20INTO\x20collaboration_sheet_blocks\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20(unit_id,\x20block_id,\x20payload_json)\x0a\x20\x20\x20\x20\x20\x20\x20VALUES\x20(?,\x20?,\x20?)\x0a\x20\x20\x20\x20\x20\x20\x20ON\x20CONFLICT(unit_id,\x20block_id)\x20DO\x20UPDATE\x20SET\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20payload_json\x20=\x20excluded.payload_json');for(let _0x577705 of _0x28e27c)_0x13efe0['run'](_0x4936b2,_0x577705['id'],_0x577705['payload']);}['_transaction'](_0x19175f){this['_database']['exec']('BEGIN\x20IMMEDIATE;');try{let _0x486362=_0x19175f();return this['_database']['exec']('COMMIT;'),_0x486362;}catch(_0x30e333){throw this['_database']['inTransaction']&&this['_database']['exec']('ROLLBACK;'),_0x30e333;}}['_assertOpen'](){if(this['_disposed'])throw new l['CollabError']('INTERNAL_ERROR','SQLite\x20Database\x20Adapter\x20is\x20disposed');}};function g(_0x1b7353){if(!_0x1b7353['filename'])throw x('SQLite\x20filename\x20is\x20required');if(_0x1b7353['busyTimeoutMs']!==void 0x0&&(!Number['isSafeInteger'](_0x1b7353['busyTimeoutMs'])||_0x1b7353['busyTimeoutMs']<0x0))throw x('SQLite\x20busyTimeoutMs\x20must\x20be\x20a\x20non-negative\x20integer');}function _(_0x11659c){let {record:_0x5bdf29,snapshot:_0x4b98a9}=_0x11659c;if(_0x5bdf29['headRevision']!==0x1||_0x4b98a9['rev']!==0x1||_0x4b98a9['unitID']!==_0x5bdf29['unitID']||_0x4b98a9['type']!==_0x5bdf29['type'])throw x('Initial\x20unit\x20record\x20and\x20snapshot\x20must\x20match\x20at\x20revision\x201');}function v(_0x3efacb){if(!_0x3efacb['sid']||!Number['isSafeInteger'](_0x3efacb['reqId'])||_0x3efacb['reqId']<0x1)throw x('Changeset\x20sid\x20and\x20positive\x20integer\x20reqId\x20are\x20required');}function y(_0x88407b,_0x21d29e){let {changeset:_0x253fe5,expectedHeadRevision:_0x1848fa}=_0x21d29e;if(_0x253fe5['type']!==_0x88407b['type']||_0x253fe5['baseRev']!==_0x1848fa||_0x253fe5['revision']!==_0x1848fa+0x1)throw x('Confirmed\x20changeset\x20must\x20match\x20the\x20unit\x20type\x20and\x20expected\x20revision');}function b(_0x430ccd){return{'unitID':_0x430ccd['unit_id'],'type':_0x430ccd['type'],'headRevision':_0x430ccd['head_revision']};}function x(_0x2dd0b3){return new l['CollabError']('INVALID_REQUEST',_0x2dd0b3);}function S(_0xb4c4e5){return new l['CollabError']('INTERNAL_ERROR',_0xb4c4e5);}function C(_0x4ea04a){return[...new Set(_0x4ea04a)];}function w(_0x3537d8){return JSON['stringify'](_0x3537d8,(_0x373eb7,_0x738403)=>_0x738403 instanceof Uint8Array?{[d]:Buffer['from'](_0x738403)['toString']('base64')}:_0x738403);}function T(_0x3bbe69){return JSON['parse'](_0x3bbe69,(_0x5942a2,_0x4fcd85)=>E(_0x4fcd85)?Uint8Array['from'](Buffer['from'](_0x4fcd85[d],'base64')):_0x4fcd85);}function E(_0x3bf646){return typeof _0x3bf646=='object'&&!!_0x3bf646&&Object['keys'](_0x3bf646)['length']===0x1&&typeof _0x3bf646[d]=='string';}exports['SQLiteDatabaseAdapter']=h;
1
+ Object['defineProperty'](exports,Symbol['toStringTag'],{'value':'Module'});var e=Object['create'],t=Object['defineProperty'],n=Object['getOwnPropertyDescriptor'],r=Object['getOwnPropertyNames'],i=Object['getPrototypeOf'],a=Object['prototype']['hasOwnProperty'],o=(_0x56bfd4,_0x407acd,_0x5e3575,_0x2c2a80)=>{if(_0x407acd&&typeof _0x407acd=='object'||typeof _0x407acd=='function'){for(var _0x36f654=r(_0x407acd),_0xeb113c=0x0,_0x185a3c=_0x36f654['length'],_0x1aeac3;_0xeb113c<_0x185a3c;_0xeb113c++)_0x1aeac3=_0x36f654[_0xeb113c],!a['call'](_0x56bfd4,_0x1aeac3)&&_0x1aeac3!==_0x5e3575&&t(_0x56bfd4,_0x1aeac3,{'get':(_0x17a9e4=>_0x407acd[_0x17a9e4])['bind'](null,_0x1aeac3),'enumerable':!(_0x2c2a80=n(_0x407acd,_0x1aeac3))||_0x2c2a80['enumerable']});}return _0x56bfd4;},s=(_0x2ea5fc,_0x3ed852,_0x4a8d05)=>(_0x4a8d05=_0x2ea5fc==null?{}:e(i(_0x2ea5fc)),o(_0x3ed852||!_0x2ea5fc||!_0x2ea5fc['__esModule']?t(_0x4a8d05,'default',{'value':_0x2ea5fc,'enumerable':!0x0}):_0x4a8d05,_0x2ea5fc));let c=require('libsql');c=s(c,0x1);let l=require('@univerjs-pro/collaboration-service');var u=0x1388,d='__univerCollaborationBinary',f='core',p=0x2,m=['collaboration_units','collaboration_unit_tombstones','collaboration_snapshots','collaboration_changesets','collaboration_sheet_blocks'],h=class{['_database'];['_disposed']=!0x1;constructor(_0x237695){g(_0x237695),this['_database']=new c['default'](_0x237695['filename'],{'timeout':_0x237695['busyTimeoutMs']??u});try{this['_database']['exec']('PRAGMA\x20foreign_keys\x20=\x20ON;'),this['_database']['exec']('PRAGMA\x20busy_timeout\x20=\x20'+(_0x237695['busyTimeoutMs']??u)+';'),this['_initializeSchema']();}catch(_0x325262){throw this['_database']['close'](),_0x325262;}}async['getUnit'](_0x24aea5,_0x3d5040){this['_assertOpen']();let _0x173f06=this['_database']['prepare']('SELECT\x20unit_id,\x20type,\x20head_revision,\x20creator_id,\x20created_at_ms,\x20soft_deleted_at_ms\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20unit_id\x20=\x20?\x20AND\x20soft_deleted_at_ms\x20IS\x20NULL')['get'](_0x3d5040);return _0x173f06?v(_0x173f06):null;}async['getSnapshot'](_0xf3d6b1,_0x506ba4,_0xbb3570){this['_assertOpen']();let _0x478fb0=_0xbb3570?.['revision'];if(_0x478fb0!==void 0x0&&_0x478fb0<0x0)throw y('Snapshot\x20revision\x20cannot\x20be\x20negative');let _0x6d16d7=this['_database']['prepare']('SELECT\x20collaboration_snapshots.payload_json\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_snapshots\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20JOIN\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20collaboration_units.unit_id\x20=\x20collaboration_snapshots.unit_id\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20collaboration_snapshots.unit_id\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+(_0x478fb0===void 0x0?'':'AND\x20collaboration_snapshots.revision\x20<=\x20?')+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_units.soft_deleted_at_ms\x20IS\x20NULL\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20collaboration_snapshots.revision\x20DESC\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20LIMIT\x201')['get'](_0x506ba4,..._0x478fb0===void 0x0?[]:[_0x478fb0]);return _0x6d16d7?C(_0x6d16d7['payload_json']):null;}async['getSnapshotInfo'](_0x2dc12e,_0x498107,_0x31b273){this['_assertOpen']();let _0x1f6ab6=_0x31b273?.['revision'];if(_0x1f6ab6!==void 0x0&&_0x1f6ab6<0x0)throw y('Snapshot\x20revision\x20cannot\x20be\x20negative');let _0xbf3865=this['_database']['prepare']('SELECT\x20snapshots.unit_id\x20AS\x20unitID,\x20snapshots.type,\x20snapshots.revision\x20AS\x20rev\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_snapshots\x20AS\x20snapshots\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20JOIN\x20collaboration_units\x20AS\x20units\x20ON\x20units.unit_id\x20=\x20snapshots.unit_id\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20snapshots.unit_id\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20units.soft_deleted_at_ms\x20IS\x20NULL\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+(_0x1f6ab6===void 0x0?'':'AND\x20snapshots.revision\x20<=\x20?')+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20snapshots.revision\x20DESC\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20LIMIT\x201')['get'](_0x498107,..._0x1f6ab6===void 0x0?[]:[_0x1f6ab6]);return _0xbf3865?{'unitID':_0xbf3865['unitID'],'type':_0xbf3865['type'],'rev':_0xbf3865['rev']}:null;}async['getChangesets'](_0x287af2,_0x30288c,_0x4a274e){if(this['_assertOpen'](),_0x4a274e['from']<0x0||_0x4a274e['to']!==void 0x0&&_0x4a274e['to']<0x0)throw y('Changeset\x20range\x20revisions\x20cannot\x20be\x20negative');let _0x49ee7c=this['_database']['prepare']('SELECT\x20collaboration_changesets.payload_json\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20LEFT\x20JOIN\x20collaboration_changesets\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20collaboration_changesets.unit_id\x20=\x20collaboration_units.unit_id\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_changesets.revision\x20>\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+(_0x4a274e['to']===void 0x0?'':'AND\x20collaboration_changesets.revision\x20<=\x20?')+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20collaboration_units.unit_id\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_units.soft_deleted_at_ms\x20IS\x20NULL\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20collaboration_changesets.revision\x20ASC')['all'](_0x4a274e['from'],..._0x4a274e['to']===void 0x0?[]:[_0x4a274e['to']],_0x30288c);return _0x49ee7c['length']===0x0?null:_0x49ee7c['flatMap'](_0x5eb9f7=>_0x5eb9f7['payload_json']?[C(_0x5eb9f7['payload_json'])]:[]);}async['createUnit'](_0x327d38,_0x50f566){this['_assertOpen'](),_(_0x50f566);let _0x24720d=S(_0x50f566['snapshot']),_0xa548a9=(_0x50f566['sheetBlocks']??[])['map'](_0x2506f7=>({'id':_0x2506f7['id'],'payload':S(_0x2506f7)}));return this['_transaction'](()=>{if(this['_hasTombstone'](_0x50f566['record']['unitID']))throw y('Cannot\x20reuse\x20a\x20hard-deleted\x20unit\x20ID');let _0x8ad735=this['_getStoredUnitRow'](_0x50f566['record']['unitID']);if(_0x8ad735){if(_0x8ad735['soft_deleted_at_ms']!==null)throw y('Cannot\x20reuse\x20a\x20soft-deleted\x20unit\x20ID');return{'status':'already-exists','record':v(_0x8ad735)};}return this['_database']['prepare']('INSERT\x20INTO\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(unit_id,\x20type,\x20head_revision,\x20creator_id,\x20created_at_ms,\x20soft_deleted_at_ms)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(?,\x20?,\x201,\x20?,\x20?,\x20NULL)')['run'](_0x50f566['record']['unitID'],_0x50f566['record']['type'],_0x50f566['record']['creatorID'],_0x50f566['record']['createdAt']),this['_writeSheetBlocks'](_0x50f566['record']['unitID'],_0xa548a9),this['_database']['prepare']('INSERT\x20INTO\x20collaboration_snapshots\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(unit_id,\x20revision,\x20type,\x20payload_json)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(?,\x201,\x20?,\x20?)')['run'](_0x50f566['record']['unitID'],_0x50f566['record']['type'],_0x24720d),{'status':'created','record':{..._0x50f566['record']}};});}async['deleteUnits'](_0x3b6d49,_0x149023){return this['_assertOpen'](),this['_transaction'](()=>{let _0x1944f7=x(_0x149023['unitIDs'])['map'](_0x56720b=>{let _0x93c68e=this['_getStoredUnitRow'](_0x56720b);if(!_0x93c68e){if(_0x149023['hardDelete']&&this['_hasTombstone'](_0x56720b))return{'unitID':_0x56720b,'status':'already-hard-deleted'};throw new l['CollabError']('UNIT_NOT_FOUND','Cannot\x20delete\x20a\x20missing\x20unit');}return _0x149023['hardDelete']?{'unitID':_0x56720b,'status':'hard-deleted'}:{'unitID':_0x56720b,'status':_0x93c68e['soft_deleted_at_ms']===null?'soft-deleted':'already-soft-deleted'};}),_0x500da5=this['_database']['prepare']('UPDATE\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20SET\x20soft_deleted_at_ms\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20unit_id\x20=\x20?\x20AND\x20soft_deleted_at_ms\x20IS\x20NULL'),_0x5e92c7=this['_database']['prepare']('INSERT\x20INTO\x20collaboration_unit_tombstones\x20(unit_id,\x20purged_at)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(?,\x20?)'),_0x5d74d4=this['_database']['prepare']('DELETE\x20FROM\x20collaboration_units\x20WHERE\x20unit_id\x20=\x20?'),_0xbd76e4=Date['now']();for(let _0x2e1e2f of _0x1944f7)_0x2e1e2f['status']==='soft-deleted'?_0x500da5['run'](_0xbd76e4,_0x2e1e2f['unitID']):_0x2e1e2f['status']==='hard-deleted'&&(_0x5e92c7['run'](_0x2e1e2f['unitID'],_0xbd76e4),_0x5d74d4['run'](_0x2e1e2f['unitID']));return{'units':_0x1944f7};});}async['recoverUnits'](_0x152a24,_0xf6180e){return this['_assertOpen'](),this['_transaction'](()=>{let _0x42115c=x(_0xf6180e['unitIDs'])['map'](_0x46a959=>{let _0x90cec5=this['_getStoredUnitRow'](_0x46a959);if(!_0x90cec5)throw this['_hasTombstone'](_0x46a959)?y('Cannot\x20recover\x20a\x20hard-deleted\x20unit'):new l['CollabError']('UNIT_NOT_FOUND','Cannot\x20recover\x20a\x20missing\x20unit');return{'unitID':_0x46a959,'status':_0x90cec5['soft_deleted_at_ms']===null?'already-active':'recovered'};}),_0x538b33=this['_database']['prepare']('UPDATE\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20SET\x20soft_deleted_at_ms\x20=\x20NULL\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20unit_id\x20=\x20?\x20AND\x20soft_deleted_at_ms\x20IS\x20NOT\x20NULL');for(let _0x3b29ec of _0x42115c)_0x3b29ec['status']==='recovered'&&_0x538b33['run'](_0x3b29ec['unitID']);return{'units':_0x42115c};});}async['commitChangeset'](_0x1c38c7,_0x507f0f){return this['_assertOpen'](),this['_transaction'](()=>{let {changeset:_0x461ec0}=_0x507f0f,_0x5a56dd=this['_getActiveUnitRow'](_0x461ec0['unitID']);if(!_0x5a56dd)throw new l['CollabError']('UNIT_NOT_FOUND','Cannot\x20commit\x20to\x20a\x20missing\x20unit');if(_0x5a56dd['head_revision']!==_0x461ec0['revision']-0x1)return{'status':'revision-mismatch','actualHeadRevision':_0x5a56dd['head_revision']};let _0x4a48f3=Date['now'](),_0x4896fe=S({..._0x461ec0,'createTime':Math['floor'](_0x4a48f3/0x3e8)});if(this['_database']['prepare']('INSERT\x20INTO\x20collaboration_changesets\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(unit_id,\x20revision,\x20base_revision,\x20sid,\x20req_id,\x20created_at_ms,\x20payload_json)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(?,\x20?,\x20?,\x20?,\x20?,\x20?,\x20?)')['run'](_0x461ec0['unitID'],_0x461ec0['revision'],_0x461ec0['baseRev'],_0x461ec0['sid'],_0x461ec0['reqId'],_0x4a48f3,_0x4896fe),this['_database']['prepare']('UPDATE\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20SET\x20head_revision\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20unit_id\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20head_revision\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20soft_deleted_at_ms\x20IS\x20NULL')['run'](_0x461ec0['revision'],_0x461ec0['unitID'],_0x461ec0['revision']-0x1)['changes']!==0x1)throw new l['CollabError']('INTERNAL_ERROR','SQLite\x20head\x20changed\x20inside\x20an\x20exclusive\x20write\x20transaction');return{'status':'committed','changeset':C(_0x4896fe),'headRevision':_0x461ec0['revision']};});}async['saveSnapshot'](_0xd6605,_0x407dfd){this['_assertOpen']();let _0x364958=S(_0x407dfd['snapshot']),_0x14ff4f=(_0x407dfd['sheetBlocks']??[])['map'](_0x4855b0=>({'id':_0x4855b0['id'],'payload':S(_0x4855b0)}));this['_transaction'](()=>{let _0x543d00=this['_getActiveUnitRow'](_0x407dfd['snapshot']['unitID']);if(!_0x543d00)throw new l['CollabError']('UNIT_NOT_FOUND','Cannot\x20snapshot\x20a\x20missing\x20unit');if(_0x407dfd['snapshot']['type']!==_0x543d00['type']||_0x407dfd['snapshot']['rev']<0x1||_0x407dfd['snapshot']['rev']>_0x543d00['head_revision'])throw y('Snapshot\x20does\x20not\x20match\x20the\x20stored\x20unit\x20head');this['_writeSheetBlocks'](_0x407dfd['snapshot']['unitID'],_0x14ff4f),this['_database']['prepare']('INSERT\x20INTO\x20collaboration_snapshots\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(unit_id,\x20revision,\x20type,\x20payload_json)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(?,\x20?,\x20?,\x20?)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20CONFLICT(unit_id,\x20revision)\x20DO\x20UPDATE\x20SET\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type\x20=\x20excluded.type,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20payload_json\x20=\x20excluded.payload_json')['run'](_0x407dfd['snapshot']['unitID'],_0x407dfd['snapshot']['rev'],_0x407dfd['snapshot']['type'],_0x364958);});}async['getSheetBlock'](_0x56bfcb,_0x2046ca,_0x5fe0cc){this['_assertOpen']();let _0x3d3c90=this['_database']['prepare']('SELECT\x20collaboration_sheet_blocks.payload_json\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_sheet_blocks\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20JOIN\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20collaboration_units.unit_id\x20=\x20collaboration_sheet_blocks.unit_id\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20collaboration_sheet_blocks.unit_id\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_sheet_blocks.block_id\x20=\x20?\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20collaboration_units.soft_deleted_at_ms\x20IS\x20NULL')['get'](_0x2046ca,_0x5fe0cc);return _0x3d3c90?C(_0x3d3c90['payload_json']):null;}async['dispose'](){this['_disposed']||(this['_disposed']=!0x0,this['_database']['close']());}['_initializeSchema'](){this['_transaction'](()=>{if(!this['_hasTable']('collaboration_schema_versions')){if(this['_hasAnyCoreTable']())throw b('SQLite\x20collaboration\x20core\x20tables\x20exist\x20without\x20a\x20schema\x20version');this['_database']['exec']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20collaboration_schema_versions\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20component\x20TEXT\x20PRIMARY\x20KEY,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20version\x20INTEGER\x20NOT\x20NULL\x20CHECK\x20(version\x20>=\x201)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x20\x20\x20\x20\x20\x20\x20\x20');}let _0x59f37a=this['_database']['prepare']('SELECT\x20version\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_schema_versions\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20component\x20=\x20?')['get'](f);if(_0x59f37a){if(_0x59f37a['version']!==p)throw b('SQLite\x20collaboration\x20core\x20schema\x20version\x20'+_0x59f37a['version']+'\x20is\x20not\x20supported;\x20version\x201\x20requires\x20explicit\x20migrateSQLiteCoreV1ToV2\x20with\x20a\x20Unit\x20creation\x20resolver');let _0x26e771=m['filter'](_0x5cb3c0=>!this['_hasTable'](_0x5cb3c0));if(_0x26e771['length']>0x0)throw b('SQLite\x20collaboration\x20core\x20schema\x20v'+_0x59f37a['version']+'\x20is\x20incomplete:\x20missing\x20'+_0x26e771['join'](',\x20'));if(!this['_database']['prepare']('PRAGMA\x20table_info(collaboration_changesets)')['all']()['some'](_0x9332ca=>_0x9332ca['name']==='created_at_ms'&&_0x9332ca['notnull']===0x1))throw b('Changeset\x20schema\x20requires\x20NOT\x20NULL\x20created_at_ms');let _0xb0777c=this['_database']['prepare']('PRAGMA\x20table_info(collaboration_units)')['all']();if(!['creator_id','created_at_ms']['every'](_0x2df818=>_0xb0777c['some'](_0xb0588e=>_0xb0588e['name']===_0x2df818&&_0xb0588e['notnull']===0x1)))throw b('SQLite\x20collaboration\x20core\x20schema\x20v2\x20requires\x20NOT\x20NULL\x20creator_id\x20and\x20created_at_ms');return;}if(this['_hasAnyCoreTable']())throw b('SQLite\x20collaboration\x20core\x20tables\x20exist\x20without\x20a\x20schema\x20version');this['_database']['exec']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20collaboration_units\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20unit_id\x20TEXT\x20PRIMARY\x20KEY,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type\x20INTEGER\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20head_revision\x20INTEGER\x20NOT\x20NULL\x20CHECK\x20(head_revision\x20>=\x201),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20creator_id\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20created_at_ms\x20INTEGER\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20soft_deleted_at_ms\x20INTEGER\x0a\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20collaboration_unit_tombstones\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20unit_id\x20TEXT\x20PRIMARY\x20KEY,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20purged_at\x20INTEGER\x20NOT\x20NULL\x0a\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20collaboration_snapshots\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20unit_id\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20revision\x20INTEGER\x20NOT\x20NULL\x20CHECK\x20(revision\x20>=\x201),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type\x20INTEGER\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20payload_json\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20PRIMARY\x20KEY\x20(unit_id,\x20revision),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FOREIGN\x20KEY\x20(unit_id)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20REFERENCES\x20collaboration_units(unit_id)\x20ON\x20DELETE\x20CASCADE\x0a\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20collaboration_changesets\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20unit_id\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20revision\x20INTEGER\x20NOT\x20NULL\x20CHECK\x20(revision\x20>=\x202),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20base_revision\x20INTEGER\x20NOT\x20NULL\x20CHECK\x20(base_revision\x20>=\x201),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20sid\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20req_id\x20INTEGER\x20NOT\x20NULL\x20CHECK\x20(req_id\x20>=\x201),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20created_at_ms\x20INTEGER\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20payload_json\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20PRIMARY\x20KEY\x20(unit_id,\x20revision),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20UNIQUE\x20(unit_id,\x20sid,\x20req_id),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FOREIGN\x20KEY\x20(unit_id)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20REFERENCES\x20collaboration_units(unit_id)\x20ON\x20DELETE\x20CASCADE\x0a\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20collaboration_sheet_blocks\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20unit_id\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20block_id\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20payload_json\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20PRIMARY\x20KEY\x20(unit_id,\x20block_id),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FOREIGN\x20KEY\x20(unit_id)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20REFERENCES\x20collaboration_units(unit_id)\x20ON\x20DELETE\x20CASCADE\x0a\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20INDEX\x20collaboration_snapshots_nearest_revision\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20collaboration_snapshots(unit_id,\x20revision\x20DESC);\x0a\x20\x20\x20\x20\x20\x20\x20\x20CREATE\x20INDEX\x20collaboration_changesets_revision_range\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20collaboration_changesets(unit_id,\x20revision\x20ASC);\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20collaboration_schema_versions\x20(component,\x20version)\x0a\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(\x27core\x27,\x202);\x0a\x20\x20\x20\x20\x20\x20');});}['_getActiveUnitRow'](_0x1b83ca){return this['_database']['prepare']('SELECT\x20unit_id,\x20type,\x20head_revision,\x20creator_id,\x20created_at_ms,\x20soft_deleted_at_ms\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20unit_id\x20=\x20?\x20AND\x20soft_deleted_at_ms\x20IS\x20NULL')['get'](_0x1b83ca)??null;}['_getStoredUnitRow'](_0x56133b){return this['_database']['prepare']('SELECT\x20unit_id,\x20type,\x20head_revision,\x20creator_id,\x20created_at_ms,\x20soft_deleted_at_ms\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20collaboration_units\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20unit_id\x20=\x20?')['get'](_0x56133b)??null;}['_hasTombstone'](_0x4f8f62){return!!this['_database']['prepare']('SELECT\x201\x20FROM\x20collaboration_unit_tombstones\x20WHERE\x20unit_id\x20=\x20?')['get'](_0x4f8f62);}['_hasTable'](_0x267523){return!!this['_database']['prepare']('SELECT\x201\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20sqlite_schema\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20type\x20=\x20\x27table\x27\x20AND\x20name\x20=\x20?')['get'](_0x267523);}['_hasAnyCoreTable'](){return m['some'](_0x18fead=>this['_hasTable'](_0x18fead));}['_writeSheetBlocks'](_0x1a5551,_0x5c5231){let _0x120fcd=this['_database']['prepare']('INSERT\x20INTO\x20collaboration_sheet_blocks\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20(unit_id,\x20block_id,\x20payload_json)\x0a\x20\x20\x20\x20\x20\x20\x20VALUES\x20(?,\x20?,\x20?)\x0a\x20\x20\x20\x20\x20\x20\x20ON\x20CONFLICT(unit_id,\x20block_id)\x20DO\x20UPDATE\x20SET\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20payload_json\x20=\x20excluded.payload_json');for(let _0x4f431e of _0x5c5231)_0x120fcd['run'](_0x1a5551,_0x4f431e['id'],_0x4f431e['payload']);}['_transaction'](_0x9e6c51){this['_database']['exec']('BEGIN\x20IMMEDIATE;');try{let _0x35b341=_0x9e6c51();return this['_database']['exec']('COMMIT;'),_0x35b341;}catch(_0xf5c2e0){throw this['_database']['inTransaction']&&this['_database']['exec']('ROLLBACK;'),_0xf5c2e0;}}['_assertOpen'](){if(this['_disposed'])throw new l['CollabError']('INTERNAL_ERROR','SQLite\x20Database\x20Adapter\x20is\x20disposed');}};function g(_0x533388){if(!_0x533388['filename'])throw y('SQLite\x20filename\x20is\x20required');if(_0x533388['busyTimeoutMs']!==void 0x0&&(!Number['isSafeInteger'](_0x533388['busyTimeoutMs'])||_0x533388['busyTimeoutMs']<0x0))throw y('SQLite\x20busyTimeoutMs\x20must\x20be\x20a\x20non-negative\x20integer');}function _(_0x364808){let {record:_0x59a62d,snapshot:_0x495b62}=_0x364808;if(_0x59a62d['headRevision']!==0x1||_0x495b62['rev']!==0x1||_0x495b62['unitID']!==_0x59a62d['unitID']||_0x495b62['type']!==_0x59a62d['type'])throw y('Initial\x20unit\x20record\x20and\x20snapshot\x20must\x20match\x20at\x20revision\x201');if(typeof _0x59a62d['creatorID']!='string'||_0x59a62d['creatorID']['length']===0x0||!Number['isSafeInteger'](_0x59a62d['createdAt'])||_0x59a62d['createdAt']<0x0)throw y('Unit\x20creation\x20requires\x20creatorID\x20and\x20createdAt\x20in\x20Unix\x20milliseconds');}function v(_0x5de30e){return{'unitID':_0x5de30e['unit_id'],'type':_0x5de30e['type'],'headRevision':_0x5de30e['head_revision'],'creatorID':_0x5de30e['creator_id'],'createdAt':_0x5de30e['created_at_ms']};}function y(_0x22d290){return new l['CollabError']('INVALID_REQUEST',_0x22d290);}function b(_0x30c0ae){return new l['CollabError']('INTERNAL_ERROR',_0x30c0ae);}function x(_0xd62a5f){return[...new Set(_0xd62a5f)];}function S(_0x23ce94){return JSON['stringify'](_0x23ce94,function(_0x1c9b16,_0x4424bf){let _0x5d1e45=this[_0x1c9b16];return _0x5d1e45 instanceof Uint8Array?{[d]:Buffer['from'](_0x5d1e45)['toString']('base64')}:_0x4424bf;});}function C(_0x86e333){return JSON['parse'](_0x86e333,(_0x2d620b,_0x20d80d)=>w(_0x20d80d)?Uint8Array['from'](Buffer['from'](_0x20d80d[d],'base64')):_0x20d80d);}function w(_0xf3bab9){return typeof _0xf3bab9=='object'&&!!_0xf3bab9&&Object['keys'](_0xf3bab9)['length']===0x1&&typeof _0xf3bab9[d]=='string';}async function T(_0x486e08){let _0x50a430=Date['now'](),_0x5a3cde=new c['default'](_0x486e08['filename'],{'fileMustExist':!0x0}),_0x14b031=!0x1;try{if(_0x5a3cde['exec']('PRAGMA\x20foreign_keys\x20=\x20OFF;\x20PRAGMA\x20legacy_alter_table\x20=\x20ON;\x20BEGIN\x20IMMEDIATE;'),_0x14b031=!0x0,_0x5a3cde['prepare']('SELECT\x20version\x20FROM\x20collaboration_schema_versions\x20WHERE\x20component\x20=\x20\x27core\x27')['get']()?.['version']!==0x1)throw new l['CollabError']('INVALID_REQUEST','migrateSQLiteCoreV1ToV2\x20requires\x20core\x20schema\x20version\x201');for(let _0x30d383 of['collaboration_unit_tombstones','collaboration_snapshots','collaboration_changesets','collaboration_sheet_blocks'])_0x5a3cde['prepare']('SELECT\x201\x20FROM\x20'+_0x30d383+'\x20LIMIT\x200')['all']();let _0x59d581=_0x5a3cde['prepare']('SELECT\x201\x20FROM\x20sqlite_schema\x20WHERE\x20type\x20=\x20\x27table\x27\x20AND\x20name\x20=\x20\x27collaboration_history_revisions\x27')['get']()?_0x5a3cde['prepare']('SELECT\x20user_id,\x20committed_at\x20FROM\x20collaboration_history_revisions\x20WHERE\x20unit_id\x20=\x20?\x20AND\x20revision\x20=\x20?'):void 0x0,_0x428446=(_0x1cf28b,_0x51df61)=>_0x59d581?.['get'](_0x1cf28b,_0x51df61),_0x263786=_0x5a3cde['prepare']('PRAGMA\x20table_info(collaboration_units)')['all'](),_0xd9dda8=['unit_id','type','head_revision','soft_deleted_at_ms'];if(_0x263786['length']!==_0xd9dda8['length']||_0xd9dda8['some'](_0xf545ab=>!_0x263786['some'](_0x25b9a1=>_0x25b9a1['name']===_0xf545ab)))throw new l['CollabError']('INVALID_REQUEST','Core\x20v1\x20Unit\x20columns\x20differ\x20from\x20the\x20supported\x20schema;\x20refusing\x20a\x20potentially\x20lossy\x20migration');let _0x790fe4=_0x5a3cde['prepare']('SELECT\x20sql\x20FROM\x20sqlite_schema\x20WHERE\x20tbl_name\x20=\x20\x27collaboration_units\x27\x20AND\x20type\x20IN\x20(\x27index\x27,\x20\x27trigger\x27)\x20AND\x20sql\x20IS\x20NOT\x20NULL')['all']();_0x5a3cde['exec']('CREATE\x20TABLE\x20collaboration_units_v2\x20(\x0a\x20\x20\x20\x20\x20\x20unit_id\x20TEXT\x20PRIMARY\x20KEY,\x0a\x20\x20\x20\x20\x20\x20type\x20INTEGER\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20head_revision\x20INTEGER\x20NOT\x20NULL\x20CHECK\x20(head_revision\x20>=\x201),\x0a\x20\x20\x20\x20\x20\x20creator_id\x20TEXT\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20created_at_ms\x20INTEGER\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20soft_deleted_at_ms\x20INTEGER\x0a\x20\x20\x20\x20);');let _0x5ed011=_0x5a3cde['prepare']('SELECT\x20unit_id,\x20type,\x20head_revision,\x20soft_deleted_at_ms\x20FROM\x20collaboration_units\x20ORDER\x20BY\x20unit_id')['all'](),_0x3dea0a=_0x5a3cde['prepare']('INSERT\x20INTO\x20collaboration_units_v2\x20VALUES\x20(?,\x20?,\x20?,\x20?,\x20?,\x20?)');for(let _0x1f5027 of _0x5ed011){let _0x50c6d5=_0x486e08['resolveUnitCreation']?void 0x0:_0x428446(_0x1f5027['unit_id'],0x1),_0x392bf7=_0x486e08['resolveUnitCreation']?await _0x486e08['resolveUnitCreation'](_0x1f5027['unit_id']):{'creatorID':_0x50c6d5?.['user_id']||'anonymous','createdAt':E(_0x50c6d5?.['committed_at'])?_0x50c6d5['committed_at']:_0x50a430};if(!_0x392bf7||typeof _0x392bf7['creatorID']!='string'||_0x392bf7['creatorID']['length']===0x0||!Number['isSafeInteger'](_0x392bf7['createdAt'])||_0x392bf7['createdAt']<0x0)throw new l['CollabError']('INVALID_REQUEST','Missing\x20or\x20invalid\x20creation\x20facts\x20for\x20Unit\x20'+_0x1f5027['unit_id']);_0x3dea0a['run'](_0x1f5027['unit_id'],_0x1f5027['type'],_0x1f5027['head_revision'],_0x392bf7['creatorID'],_0x392bf7['createdAt'],_0x1f5027['soft_deleted_at_ms']);}_0x5a3cde['exec']('DROP\x20TABLE\x20collaboration_units;\x20ALTER\x20TABLE\x20collaboration_units_v2\x20RENAME\x20TO\x20collaboration_units;');for(let _0x1016f2 of _0x790fe4)_0x5a3cde['exec'](_0x1016f2['sql']);let _0x5d195=_0x5a3cde['prepare']('SELECT\x20sql\x20FROM\x20sqlite_schema\x20WHERE\x20type\x20=\x20\x27table\x27\x20AND\x20name\x20=\x20\x27collaboration_changesets\x27')['get'](),_0x150ce3=_0x5a3cde['prepare']('PRAGMA\x20table_info(collaboration_changesets)')['all']();if(_0x150ce3['some'](_0x330dd8=>_0x330dd8['name']==='created_at_ms'))throw new l['CollabError']('INVALID_REQUEST','Unexpected\x20changeset\x20creation-time\x20column\x20in\x20legacy\x20schema');let _0x28fa8c=_0x5a3cde['prepare']('SELECT\x20sql\x20FROM\x20sqlite_schema\x20WHERE\x20tbl_name\x20=\x20\x27collaboration_changesets\x27\x20AND\x20type\x20IN\x20(\x27index\x27,\x20\x27trigger\x27)\x20AND\x20sql\x20IS\x20NOT\x20NULL')['all']();_0x5a3cde['exec']('CREATE\x20TABLE\x20collaboration_changesets_new\x20(\x0a\x20\x20\x20\x20\x20\x20created_at_ms\x20INTEGER\x20NOT\x20NULL,\x0a\x20\x20\x20\x20\x20\x20'+_0x5d195['sql']['slice'](_0x5d195['sql']['indexOf']('(')+0x1));let _0x390b4a=_0x5a3cde['prepare']('SELECT\x20*\x20FROM\x20collaboration_changesets\x20ORDER\x20BY\x20unit_id,\x20revision')['all'](),_0xadaf72=_0x150ce3['map'](_0x44c488=>'\x22'+_0x44c488['name']['replaceAll']('\x22','\x22\x22')+'\x22')['join'](',\x20'),_0x2dc2a8=_0x5a3cde['prepare']('INSERT\x20INTO\x20collaboration_changesets_new\x20('+_0xadaf72+',\x20created_at_ms)\x20VALUES\x20('+_0x150ce3['map'](()=>'?')['join'](',\x20')+',\x20?)');for(let _0x2810a6 of _0x390b4a){let _0x4ca2f9=JSON['parse'](_0x2810a6['payload_json']),_0x5d418d=typeof _0x4ca2f9['createTime']=='number'?_0x4ca2f9['createTime']*0x3e8:void 0x0,_0xff7374=!_0x486e08['resolveChangesetCreatedAt']&&!E(_0x5d418d)?_0x428446(_0x2810a6['unit_id'],_0x2810a6['revision'])?.['committed_at']:void 0x0,_0x9b9790=_0x486e08['resolveChangesetCreatedAt']?await _0x486e08['resolveChangesetCreatedAt'](_0x2810a6['unit_id'],_0x2810a6['revision']):E(_0x5d418d)?_0x5d418d:E(_0xff7374)?_0xff7374:_0x50a430;if(!Number['isSafeInteger'](_0x9b9790)||_0x9b9790<0x0)throw new l['CollabError']('INVALID_REQUEST','Missing\x20or\x20invalid\x20changeset\x20time\x20for\x20Unit\x20'+_0x2810a6['unit_id']+'\x20revision\x20'+_0x2810a6['revision']);_0x4ca2f9['createTime']=Math['floor'](_0x9b9790/0x3e8),_0x2dc2a8['run'](..._0x150ce3['map'](_0x45dc4d=>_0x45dc4d['name']==='payload_json'?JSON['stringify'](_0x4ca2f9):_0x2810a6[_0x45dc4d['name']]),_0x9b9790);}_0x5a3cde['exec']('DROP\x20TABLE\x20collaboration_changesets;\x20ALTER\x20TABLE\x20collaboration_changesets_new\x20RENAME\x20TO\x20collaboration_changesets;');for(let _0x30a6f1 of _0x28fa8c)_0x5a3cde['exec'](_0x30a6f1['sql']);if(_0x5a3cde['prepare']('PRAGMA\x20foreign_key_check')['all']()['length']>0x0)throw new l['CollabError']('INVALID_REQUEST','Foreign\x20key\x20validation\x20failed\x20during\x20core\x20migration');_0x5a3cde['exec']('UPDATE\x20collaboration_schema_versions\x20SET\x20version\x20=\x202\x20WHERE\x20component\x20=\x20\x27core\x27;\x20COMMIT;'),_0x14b031=!0x1;}finally{try{_0x14b031&&_0x5a3cde['exec']('ROLLBACK;');}finally{_0x5a3cde['close']();}}}function E(_0x4f3c59){return typeof _0x4f3c59=='number'&&Number['isSafeInteger'](_0x4f3c59)&&_0x4f3c59>=0x0;}exports['SQLiteDatabaseAdapter']=h,exports['migrateSQLiteCoreV1ToV2']=T;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ChangesetRange, CommitChangesetInput, CommitChangesetResult, CreateUnitDatabaseInput, CreateUnitDatabaseResult, DatabaseContext, DeleteUnitsDatabaseInput, DeleteUnitsDatabaseResult, IDatabaseAdapter, RecoverUnitsDatabaseInput, RecoverUnitsDatabaseResult, SaveSnapshotInput, UnitRecord } from "@univerjs-pro/collaboration-service";
1
+ import { CommitChangesetInput, CommitChangesetResult, CreateUnitDatabaseInput, CreateUnitDatabaseResult, DatabaseContext, DeleteUnitsDatabaseInput, DeleteUnitsDatabaseResult, IDatabaseAdapter, RecoverUnitsDatabaseInput, RecoverUnitsDatabaseResult, SaveSnapshotInput, SnapshotInfo, UnitRecord } from "@univerjs-pro/collaboration-service";
2
2
  import { IChangeset, ISheetBlock, ISnapshot } from "@univerjs/protocol";
3
3
 
4
4
  //#region src/sqlite-database-adapter.d.ts
@@ -14,11 +14,13 @@ declare class SQLiteDatabaseAdapter implements IDatabaseAdapter {
14
14
  getSnapshot(_context: DatabaseContext, unitID: string, options?: {
15
15
  readonly revision?: number;
16
16
  }): Promise<ISnapshot | null>;
17
+ getSnapshotInfo(_context: DatabaseContext, unitID: string, options?: {
18
+ readonly revision?: number;
19
+ }): Promise<SnapshotInfo | null>;
17
20
  getChangesets(_context: DatabaseContext, unitID: string, range: {
18
21
  readonly from: number;
19
- readonly to: number;
20
- }): Promise<ChangesetRange>;
21
- getSubmission(_context: DatabaseContext, unitID: string, sid: string, reqId: number): Promise<IChangeset | null>;
22
+ readonly to?: number;
23
+ }): Promise<readonly IChangeset[] | null>;
22
24
  createUnit(_context: DatabaseContext, input: CreateUnitDatabaseInput): Promise<CreateUnitDatabaseResult>;
23
25
  deleteUnits(_context: DatabaseContext, input: DeleteUnitsDatabaseInput): Promise<DeleteUnitsDatabaseResult>;
24
26
  recoverUnits(_context: DatabaseContext, input: RecoverUnitsDatabaseInput): Promise<RecoverUnitsDatabaseResult>;
@@ -37,4 +39,12 @@ declare class SQLiteDatabaseAdapter implements IDatabaseAdapter {
37
39
  private _assertOpen;
38
40
  }
39
41
  //#endregion
40
- export { SQLiteDatabaseAdapter, type SQLiteDatabaseAdapterOptions };
42
+ //#region src/migrations/v1-to-v2.d.ts
43
+ interface SQLiteCoreV1ToV2MigrationOptions {
44
+ readonly filename: string;
45
+ readonly resolveUnitCreation?: (unitID: string) => Pick<UnitRecord, "creatorID" | "createdAt"> | Promise<Pick<UnitRecord, "creatorID" | "createdAt">>;
46
+ readonly resolveChangesetCreatedAt?: (unitID: string, revision: number) => number | Promise<number>;
47
+ }
48
+ declare function migrateSQLiteCoreV1ToV2(options: SQLiteCoreV1ToV2MigrationOptions): Promise<void>;
49
+ //#endregion
50
+ export { type SQLiteCoreV1ToV2MigrationOptions, SQLiteDatabaseAdapter, type SQLiteDatabaseAdapterOptions, migrateSQLiteCoreV1ToV2 };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- (function(_0x254353,_0x2ef0c6){const _0x4270db=_0x2f2a,_0x573d2a=_0x254353();while(!![]){try{const _0x4f8fff=-parseInt(_0x4270db(0x152))/0x1+-parseInt(_0x4270db(0x14e))/0x2*(parseInt(_0x4270db(0x14c))/0x3)+parseInt(_0x4270db(0x149))/0x4*(-parseInt(_0x4270db(0x14b))/0x5)+-parseInt(_0x4270db(0x14a))/0x6*(-parseInt(_0x4270db(0x151))/0x7)+-parseInt(_0x4270db(0x148))/0x8+parseInt(_0x4270db(0x14f))/0x9*(parseInt(_0x4270db(0x14d))/0xa)+-parseInt(_0x4270db(0x153))/0xb*(-parseInt(_0x4270db(0x150))/0xc);if(_0x4f8fff===_0x2ef0c6)break;else _0x573d2a['push'](_0x573d2a['shift']());}catch(_0x48feb6){_0x573d2a['push'](_0x573d2a['shift']());}}}(_0x5d4e,0xd2ebf));import _0x18da86 from'./index.cjs';function _0x2f2a(_0x29d2e4,_0x43dca0){_0x29d2e4=_0x29d2e4-0x148;const _0x5d4ea7=_0x5d4e();let _0x2f2a5e=_0x5d4ea7[_0x29d2e4];return _0x2f2a5e;}function _0x5d4e(){const _0xcb0b4a=['3358158VWixoX','30RPHfxO','249jSBlGh','50jAvybL','28354BUDQmf','3055653oANESe','6504sFIjvH','7VdqkUk','1226112IxSaia','49137XmoknG','11251328FQdwcj','3492emjtVT'];_0x5d4e=function(){return _0xcb0b4a;};return _0x5d4e();}const facadeExport0=_0x18da86['SQLiteDatabaseAdapter'];export{facadeExport0 as SQLiteDatabaseAdapter};
1
+ const _0xcab19d=_0x193b;(function(_0x20f623,_0x12241e){const _0x8e63f1=_0x193b,_0xdd03f=_0x20f623();while(!![]){try{const _0x37890e=parseInt(_0x8e63f1(0x14a))/0x1*(-parseInt(_0x8e63f1(0x14e))/0x2)+parseInt(_0x8e63f1(0x14c))/0x3*(parseInt(_0x8e63f1(0x151))/0x4)+-parseInt(_0x8e63f1(0x14b))/0x5*(-parseInt(_0x8e63f1(0x14d))/0x6)+-parseInt(_0x8e63f1(0x153))/0x7*(parseInt(_0x8e63f1(0x149))/0x8)+parseInt(_0x8e63f1(0x154))/0x9+-parseInt(_0x8e63f1(0x14f))/0xa*(parseInt(_0x8e63f1(0x150))/0xb)+parseInt(_0x8e63f1(0x147))/0xc;if(_0x37890e===_0x12241e)break;else _0xdd03f['push'](_0xdd03f['shift']());}catch(_0x27f3a7){_0xdd03f['push'](_0xdd03f['shift']());}}}(_0x29cf,0xc9695));function _0x193b(_0x205a1d,_0x1ed04a){_0x205a1d=_0x205a1d-0x147;const _0x29cfb6=_0x29cf();let _0x193b04=_0x29cfb6[_0x205a1d];return _0x193b04;}import _0x44a6ed from'./index.cjs';const facadeExport0=_0x44a6ed[_0xcab19d(0x152)],facadeExport1=_0x44a6ed[_0xcab19d(0x148)];export{facadeExport0 as SQLiteDatabaseAdapter,facadeExport1 as migrateSQLiteCoreV1ToV2};function _0x29cf(){const _0x70e865=['442895whVJXr','21otniyS','66wvOmbQ','4SMaGjU','1580CiwOPb','59070zEBLyf','106952eZXekh','SQLiteDatabaseAdapter','7doNMiO','4928823uwsZut','31441608fausSI','migrateSQLiteCoreV1ToV2','11275016elhgyV','623249ABjnEQ'];_0x29cf=function(){return _0x70e865;};return _0x29cf();}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },
7
- "version": "1.0.0-insiders.20260808-70eefdd",
7
+ "version": "1.0.0",
8
8
  "main": "./dist/index.cjs",
9
9
  "module": "./dist/index.mjs",
10
10
  "types": "./dist/index.d.ts",
@@ -19,11 +19,8 @@
19
19
  "dist"
20
20
  ],
21
21
  "dependencies": {
22
- "@univerjs-pro/collaboration-service": "1.0.0-insiders.20260808-70eefdd",
23
- "@univerjs/protocol": "1.0.0-insiders.20260808-70eefdd",
22
+ "@univerjs-pro/collaboration-service": "1.0.0",
23
+ "@univerjs/protocol": "1.0.0",
24
24
  "libsql": "^0.5.29"
25
- },
26
- "publishConfig": {
27
- "access": "public"
28
25
  }
29
- }
26
+ }