@univerjs/thread-comment 1.0.0-insiders.20260813-7c9aa50 → 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/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { CommandType, Disposable, ICommandService, IConfigService, IResourceManagerService, Inject, Injector, LifecycleService, LifecycleStages, Plugin, UniverInstanceType, createIdentifier, dateKit, merge, mergeOverrideWithDependencies } from "@univerjs/core";
1
+ import { CommandType, Disposable, ICommandService, IConfigService, IUniverInstanceService, Inject, Injector, LifecycleService, LifecycleStages, Plugin, UniverInstanceType, UserManagerService, createIdentifier, dateKit, generateRandomId, merge, mergeOverrideWithDependencies } from "@univerjs/core";
2
2
  import { Subject } from "rxjs";
3
3
 
4
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
4
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
5
5
  function _typeof(o) {
6
6
  "@babel/helpers - typeof";
7
7
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -12,7 +12,7 @@ function _typeof(o) {
12
12
  }
13
13
 
14
14
  //#endregion
15
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
15
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
16
16
  function toPrimitive(t, r) {
17
17
  if ("object" != _typeof(t) || !t) return t;
18
18
  var e = t[Symbol.toPrimitive];
@@ -25,14 +25,14 @@ function toPrimitive(t, r) {
25
25
  }
26
26
 
27
27
  //#endregion
28
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
28
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
29
29
  function toPropertyKey(t) {
30
30
  var i = toPrimitive(t, "string");
31
31
  return "symbol" == _typeof(i) ? i : i + "";
32
32
  }
33
33
 
34
34
  //#endregion
35
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
35
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
36
36
  function _defineProperty(e, r, t) {
37
37
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
38
38
  value: t,
@@ -57,18 +57,29 @@ var ThreadCommentDataSourceService = class extends Disposable {
57
57
  constructor() {
58
58
  super();
59
59
  _defineProperty(this, "_dataSource", null);
60
+ _defineProperty(this, "_pendingAdds", /* @__PURE__ */ new Map());
60
61
  _defineProperty(this, "syncUpdateMutationToColla", true);
61
62
  }
62
63
  async getThreadComment(unitId, subUnitId, threadId) {
63
64
  if (this._dataSource) return (await this._dataSource.listComments(unitId, subUnitId, [threadId]))[0];
64
65
  return null;
65
66
  }
66
- async addComment(comment) {
67
- const savedComment = this._dataSource ? await this._dataSource.addComment(comment) : comment;
68
- return {
69
- ...savedComment,
70
- threadId: savedComment.threadId || savedComment.id
71
- };
67
+ addComment(comment) {
68
+ const key = `${comment.unitId}\0${comment.subUnitId}\0${comment.id}`;
69
+ const pending = this._pendingAdds.get(key);
70
+ if (pending) return pending;
71
+ const request = (async () => {
72
+ const savedComment = this._dataSource ? await this._dataSource.addComment(comment) : comment;
73
+ return {
74
+ ...savedComment,
75
+ threadId: savedComment.threadId || savedComment.id
76
+ };
77
+ })();
78
+ this._pendingAdds.set(key, request);
79
+ request.finally(() => {
80
+ if (this._pendingAdds.get(key) === request) this._pendingAdds.delete(key);
81
+ }).catch(() => void 0);
82
+ return request;
72
83
  }
73
84
  async updateComment(comment) {
74
85
  if (this._dataSource) return this._dataSource.updateComment(comment);
@@ -82,11 +93,16 @@ var ThreadCommentDataSourceService = class extends Disposable {
82
93
  if (this._dataSource) return this._dataSource.deleteComment(unitId, subUnitId, threadId, commentId);
83
94
  return true;
84
95
  }
96
+ async deleteThread(unitId, subUnitId, threadId) {
97
+ var _this$_dataSource;
98
+ if ((_this$_dataSource = this._dataSource) === null || _this$_dataSource === void 0 ? void 0 : _this$_dataSource.deleteThread) return this._dataSource.deleteThread(unitId, subUnitId, threadId);
99
+ return this.deleteComment(unitId, subUnitId, threadId, threadId);
100
+ }
85
101
  async listThreadComments(unitId, subUnitId, threadIds) {
86
102
  if (this.dataSource) return this.dataSource.listComments(unitId, subUnitId, threadIds);
87
103
  return false;
88
104
  }
89
- saveToSnapshot(unitComments, unitId) {
105
+ saveToSnapshot(unitComments, _unitId) {
90
106
  if (this._dataSource) {
91
107
  const map = {};
92
108
  Object.keys(unitComments).forEach((subUnitId) => {
@@ -101,7 +117,87 @@ var ThreadCommentDataSourceService = class extends Disposable {
101
117
  const IThreadCommentDataSourceService = createIdentifier("univer.thread-comment.data-source-service");
102
118
 
103
119
  //#endregion
104
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
120
+ //#region src/types/comment-anchor.ts
121
+ /**
122
+ * Copyright 2023-present DreamNum Co., Ltd.
123
+ *
124
+ * Licensed under the Apache License, Version 2.0 (the "License");
125
+ * you may not use this file except in compliance with the License.
126
+ * You may obtain a copy of the License at
127
+ *
128
+ * http://www.apache.org/licenses/LICENSE-2.0
129
+ *
130
+ * Unless required by applicable law or agreed to in writing, software
131
+ * distributed under the License is distributed on an "AS IS" BASIS,
132
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133
+ * See the License for the specific language governing permissions and
134
+ * limitations under the License.
135
+ */
136
+ let ThreadCommentAnchorKind = /* @__PURE__ */ function(ThreadCommentAnchorKind) {
137
+ /** A cell comment managed by the Sheets range Facade. */
138
+ ThreadCommentAnchorKind["SHEET_CELL"] = "sheet-cell";
139
+ /** A Sheet image, chart, Shape, or other drawing element. */
140
+ ThreadCommentAnchorKind["SHEET_DRAWING"] = "sheet-drawing";
141
+ /** A fixed text range comment managed by the Docs text range Facade. */
142
+ ThreadCommentAnchorKind["DOC_TEXT_RANGE"] = "doc-text-range";
143
+ /** A Document image, chart, Shape, or other drawing element. */
144
+ ThreadCommentAnchorKind["DOC_DRAWING"] = "doc-drawing";
145
+ /** A Slide page element identified by a stable element ID. */
146
+ ThreadCommentAnchorKind["SLIDE_ELEMENT"] = "slide-element";
147
+ /** A free position normalized to the Slide page size. */
148
+ ThreadCommentAnchorKind["SLIDE_POSITION"] = "slide-position";
149
+ /** A Board element identified by a stable element ID. */
150
+ ThreadCommentAnchorKind["BOARD_ELEMENT"] = "board-element";
151
+ /** A free position in Board world coordinates. */
152
+ ThreadCommentAnchorKind["BOARD_POSITION"] = "board-position";
153
+ /** A Base record identified by stable table and record IDs. */
154
+ ThreadCommentAnchorKind["BASE_RECORD"] = "base-record";
155
+ return ThreadCommentAnchorKind;
156
+ }({});
157
+ const THREAD_COMMENT_ANCHOR_PREFIX = "univer-comment-anchor:";
158
+ function isNonEmptyString(value) {
159
+ return typeof value === "string" && value.length > 0;
160
+ }
161
+ function isOptionalString(value) {
162
+ return value === void 0 || isNonEmptyString(value);
163
+ }
164
+ function isFiniteNumber(value) {
165
+ return typeof value === "number" && Number.isFinite(value);
166
+ }
167
+ function isThreadCommentAnchor(value) {
168
+ if (!value || typeof value !== "object") return false;
169
+ switch (Reflect.get(value, "kind")) {
170
+ case "sheet-drawing":
171
+ case "doc-drawing":
172
+ case "slide-element":
173
+ case "board-element": return isNonEmptyString(Reflect.get(value, "elementId")) && isOptionalString(Reflect.get(value, "pageId"));
174
+ case "slide-position":
175
+ case "board-position": return isFiniteNumber(Reflect.get(value, "x")) && isFiniteNumber(Reflect.get(value, "y")) && isOptionalString(Reflect.get(value, "pageId"));
176
+ case "base-record": return isNonEmptyString(Reflect.get(value, "tableId")) && isNonEmptyString(Reflect.get(value, "recordId"));
177
+ default: return false;
178
+ }
179
+ }
180
+ function serializeThreadCommentAnchor(anchor) {
181
+ if (!isThreadCommentAnchor(anchor)) throw new TypeError("Invalid thread comment anchor");
182
+ return `${THREAD_COMMENT_ANCHOR_PREFIX}${JSON.stringify({
183
+ v: 1,
184
+ anchor
185
+ })}`;
186
+ }
187
+ function deserializeThreadCommentAnchor(ref) {
188
+ if (!ref.startsWith(THREAD_COMMENT_ANCHOR_PREFIX)) return null;
189
+ try {
190
+ const value = JSON.parse(ref.slice(22));
191
+ if (!value || typeof value !== "object" || Reflect.get(value, "v") !== 1) return null;
192
+ const anchor = Reflect.get(value, "anchor");
193
+ return isThreadCommentAnchor(anchor) ? anchor : null;
194
+ } catch {
195
+ return null;
196
+ }
197
+ }
198
+
199
+ //#endregion
200
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
105
201
  function __decorateParam(paramIndex, decorator) {
106
202
  return function(target, key) {
107
203
  decorator(target, key, paramIndex);
@@ -109,7 +205,7 @@ function __decorateParam(paramIndex, decorator) {
109
205
  }
110
206
 
111
207
  //#endregion
112
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
208
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
113
209
  function __decorate(decorators, target, key, desc) {
114
210
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
115
211
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -120,12 +216,15 @@ function __decorate(decorators, target, key, desc) {
120
216
  //#endregion
121
217
  //#region src/models/thread-comment.model.ts
122
218
  let ThreadCommentModel = class ThreadCommentModel extends Disposable {
123
- constructor(_dataSourceService, _lifecycleService) {
219
+ constructor(_dataSourceService, _lifecycleService, _univerInstanceService) {
124
220
  super();
125
221
  this._dataSourceService = _dataSourceService;
126
222
  this._lifecycleService = _lifecycleService;
223
+ this._univerInstanceService = _univerInstanceService;
127
224
  _defineProperty(this, "_commentsMap", /* @__PURE__ */ new Map());
128
225
  _defineProperty(this, "_threadMap", /* @__PURE__ */ new Map());
226
+ _defineProperty(this, "_syncVersions", /* @__PURE__ */ new Map());
227
+ _defineProperty(this, "_nextSyncVersion", 0);
129
228
  _defineProperty(this, "_commentUpdate$", new Subject());
130
229
  _defineProperty(this, "commentUpdate$", this._commentUpdate$.asObservable());
131
230
  _defineProperty(this, "_tasks", []);
@@ -186,22 +285,47 @@ let ThreadCommentModel = class ThreadCommentModel extends Disposable {
186
285
  }
187
286
  return subUnitMap;
188
287
  }
288
+ _syncKey(unitId, subUnitId, threadId) {
289
+ return `${unitId}\0${subUnitId}\0${threadId}`;
290
+ }
291
+ _invalidateSync(unitId, subUnitId, threadId) {
292
+ this._syncVersions.delete(this._syncKey(unitId, subUnitId, threadId));
293
+ }
189
294
  _replaceComment(unitId, subUnitId, comment) {
190
295
  const commentMap = this._ensureCommentMap(unitId, subUnitId);
191
296
  const currentComment = commentMap.get(comment.id);
192
297
  if (!currentComment) {
193
- this.addComment(unitId, subUnitId, comment);
298
+ if ("ref" in comment && typeof comment.ref === "string") this.addComment(unitId, subUnitId, {
299
+ ...comment,
300
+ ref: comment.ref
301
+ });
194
302
  return;
195
303
  }
196
- const { children, ...rest } = comment;
304
+ const { children = [], ...rest } = comment;
305
+ const seenChildIds = /* @__PURE__ */ new Set([comment.id]);
306
+ const safeChildren = children.filter((child) => {
307
+ const current = commentMap.get(child.id);
308
+ if (child.threadId !== comment.threadId || seenChildIds.has(child.id) || current && current.threadId !== comment.threadId) return false;
309
+ seenChildIds.add(child.id);
310
+ return true;
311
+ });
197
312
  const newComment = {
198
313
  ...rest,
314
+ authorName: rest.authorName ?? (rest.personId === currentComment.personId ? currentComment.authorName : void 0),
199
315
  ref: currentComment.ref
200
316
  };
201
317
  commentMap.set(comment.id, newComment);
202
- children === null || children === void 0 || children.forEach((child) => {
318
+ if (!newComment.parentId) this._ensureThreadMap(unitId, subUnitId).set(newComment.threadId, newComment);
319
+ const remoteCommentIds = /* @__PURE__ */ new Set([comment.id, ...safeChildren.map((child) => child.id)]);
320
+ commentMap.forEach((localComment, commentId) => {
321
+ if (localComment.threadId === comment.threadId && !remoteCommentIds.has(commentId)) this._deleteComment(unitId, subUnitId, commentId);
322
+ });
323
+ safeChildren.forEach((child) => {
324
+ var _commentMap$get, _commentMap$get2;
203
325
  commentMap.set(child.id, {
204
326
  ...child,
327
+ authorName: child.authorName ?? (child.personId === ((_commentMap$get = commentMap.get(child.id)) === null || _commentMap$get === void 0 ? void 0 : _commentMap$get.personId) ? (_commentMap$get2 = commentMap.get(child.id)) === null || _commentMap$get2 === void 0 ? void 0 : _commentMap$get2.authorName : void 0),
328
+ parentId: comment.id,
205
329
  ref: ""
206
330
  });
207
331
  });
@@ -230,11 +354,39 @@ let ThreadCommentModel = class ThreadCommentModel extends Disposable {
230
354
  });
231
355
  return;
232
356
  }
357
+ const versions = new Map(threadIds.map((threadId) => {
358
+ const key = this._syncKey(unitId, subUnitId, threadId);
359
+ const version = ++this._nextSyncVersion;
360
+ this._syncVersions.set(key, version);
361
+ return [threadId, {
362
+ key,
363
+ version
364
+ }];
365
+ }));
366
+ const releaseVersions = () => versions.forEach(({ key, version }) => {
367
+ if (this._syncVersions.get(key) === version) this._syncVersions.delete(key);
368
+ });
369
+ let comments;
370
+ try {
371
+ comments = await this._dataSourceService.listThreadComments(unitId, subUnitId, threadIds);
372
+ } catch (error) {
373
+ releaseVersions();
374
+ throw error;
375
+ }
376
+ if (!comments) {
377
+ releaseVersions();
378
+ return;
379
+ }
380
+ const deleteThreads = new Set(threadIds.filter((threadId) => {
381
+ const request = versions.get(threadId);
382
+ return this._syncVersions.get(request.key) === request.version;
383
+ }));
384
+ if (!deleteThreads.size) {
385
+ releaseVersions();
386
+ return;
387
+ }
233
388
  const threadMap = this._ensureThreadMap(unitId, subUnitId);
234
389
  const commentMap = this._ensureCommentMap(unitId, subUnitId);
235
- const comments = await this._dataSourceService.listThreadComments(unitId, subUnitId, threadIds);
236
- if (!comments) return;
237
- const deleteThreads = new Set(threadIds);
238
390
  comments.forEach((comment) => {
239
391
  if (!deleteThreads.has(comment.threadId)) return;
240
392
  this._replaceComment(unitId, subUnitId, comment);
@@ -243,18 +395,21 @@ let ThreadCommentModel = class ThreadCommentModel extends Disposable {
243
395
  deleteThreads.forEach((id) => {
244
396
  threadMap.delete(id);
245
397
  commentMap.forEach((comment, commentId) => {
246
- if (comment.threadId === id) commentMap.delete(commentId);
398
+ if (comment.threadId === id) this._deleteComment(unitId, subUnitId, commentId);
247
399
  });
248
400
  });
401
+ releaseVersions();
249
402
  }
250
403
  addComment(unitId, subUnitId, origin, shouldSync) {
251
404
  const commentMap = this._ensureCommentMap(unitId, subUnitId);
405
+ if (commentMap.has(origin.id)) return true;
252
406
  const { parentId, children = [], ...rest } = origin;
253
407
  const comment = {
254
408
  ...rest,
255
409
  parentId: parentId === origin.id ? void 0 : parentId
256
410
  };
257
411
  if (!comment.threadId) comment.threadId = comment.parentId || comment.id;
412
+ this._invalidateSync(unitId, subUnitId, comment.threadId);
258
413
  const addCommentItem = (item) => {
259
414
  commentMap.set(item.id, item);
260
415
  this._commentUpdate$.next({
@@ -269,14 +424,22 @@ let ThreadCommentModel = class ThreadCommentModel extends Disposable {
269
424
  const threadMap = this._ensureThreadMap(unitId, subUnitId);
270
425
  if (!comment.parentId) {
271
426
  threadMap.set(comment.threadId, comment);
272
- for (const child of children) addCommentItem(child);
427
+ for (const child of children) {
428
+ if (child.id === comment.id || child.threadId !== comment.threadId || commentMap.has(child.id)) continue;
429
+ addCommentItem({
430
+ ...child,
431
+ parentId: comment.id,
432
+ ref: ""
433
+ });
434
+ }
273
435
  }
274
436
  if (shouldSync) this.syncThreadComments(unitId, subUnitId, [comment.threadId]);
275
437
  return true;
276
438
  }
277
439
  updateComment(unitId, subUnitId, payload, silent) {
278
440
  const oldComment = this._ensureCommentMap(unitId, subUnitId).get(payload.commentId);
279
- if (!oldComment) return true;
441
+ if (!oldComment) return false;
442
+ this._invalidateSync(unitId, subUnitId, oldComment.threadId);
280
443
  oldComment.updated = true;
281
444
  oldComment.text = payload.text;
282
445
  oldComment.attachments = payload.attachments;
@@ -293,6 +456,7 @@ let ThreadCommentModel = class ThreadCommentModel extends Disposable {
293
456
  updateCommentRef(unitId, subUnitId, payload, silent) {
294
457
  const oldComment = this._ensureCommentMap(unitId, subUnitId).get(payload.commentId);
295
458
  if (!oldComment) return false;
459
+ this._invalidateSync(unitId, subUnitId, oldComment.threadId);
296
460
  oldComment.ref = payload.ref;
297
461
  this._commentUpdate$.next({
298
462
  unitId,
@@ -307,6 +471,7 @@ let ThreadCommentModel = class ThreadCommentModel extends Disposable {
307
471
  resolveComment(unitId, subUnitId, commentId, resolved) {
308
472
  const oldComment = this._ensureCommentMap(unitId, subUnitId).get(commentId);
309
473
  if (!oldComment) return false;
474
+ this._invalidateSync(unitId, subUnitId, oldComment.threadId);
310
475
  oldComment.resolved = resolved;
311
476
  this._commentUpdate$.next({
312
477
  unitId,
@@ -355,6 +520,7 @@ let ThreadCommentModel = class ThreadCommentModel extends Disposable {
355
520
  const commentMap = this._ensureCommentMap(unitId, subUnitId);
356
521
  const current = commentMap.get(commentId);
357
522
  if (!current) return;
523
+ this._invalidateSync(unitId, subUnitId, current.threadId);
358
524
  commentMap.delete(commentId);
359
525
  this._commentUpdate$.next({
360
526
  unitId,
@@ -368,6 +534,7 @@ let ThreadCommentModel = class ThreadCommentModel extends Disposable {
368
534
  });
369
535
  }
370
536
  deleteThread(unitId, subUnitId, threadId) {
537
+ this._invalidateSync(unitId, subUnitId, threadId);
371
538
  this._ensureThreadMap(unitId, subUnitId).delete(threadId);
372
539
  this._ensureCommentMap(unitId, subUnitId).forEach((comment) => {
373
540
  if (comment.threadId === threadId) this._deleteComment(unitId, subUnitId, comment.id);
@@ -382,21 +549,46 @@ let ThreadCommentModel = class ThreadCommentModel extends Disposable {
382
549
  }
383
550
  deleteUnit(unitId) {
384
551
  const unitMap = this._commentsMap.get(unitId);
385
- if (!unitMap) return;
386
- unitMap.forEach((subUnitMap, subUnitId) => {
552
+ unitMap === null || unitMap === void 0 || unitMap.forEach((subUnitMap, subUnitId) => {
387
553
  subUnitMap.forEach((comment) => {
388
554
  this.deleteComment(unitId, subUnitId, comment.id);
389
555
  });
390
556
  });
557
+ this._commentsMap.delete(unitId);
558
+ this._threadMap.delete(unitId);
559
+ this._tasks = this._tasks.filter((task) => task.unitId !== unitId);
560
+ const syncPrefix = `${unitId}\0`;
561
+ this._syncVersions.forEach((_version, key) => {
562
+ if (key.startsWith(syncPrefix)) this._syncVersions.delete(key);
563
+ });
391
564
  }
392
565
  getUnit(unitId) {
393
- const unitMap = this._threadMap.get(unitId);
566
+ const unitMap = this._commentsMap.get(unitId);
394
567
  if (!unitMap) return [];
395
568
  const threads = [];
396
- unitMap.forEach((subUnitSet, subUnitId) => {
397
- subUnitSet.forEach((threadComment, threadId) => {
398
- const thread = this.getThread(unitId, subUnitId, threadId);
399
- if (thread) threads.push(thread);
569
+ unitMap.forEach((commentMap, subUnitId) => {
570
+ const threadInfos = /* @__PURE__ */ new Map();
571
+ commentMap.forEach((comment) => {
572
+ let thread = threadInfos.get(comment.threadId);
573
+ if (!thread) {
574
+ thread = {
575
+ unitId,
576
+ subUnitId,
577
+ threadId: comment.threadId,
578
+ children: [],
579
+ relativeUsers: /* @__PURE__ */ new Set()
580
+ };
581
+ threadInfos.set(comment.threadId, thread);
582
+ }
583
+ if (comment.parentId) thread.children.push(comment);
584
+ else thread.root = comment;
585
+ thread.relativeUsers.add(comment.personId);
586
+ });
587
+ threadInfos.forEach((thread) => {
588
+ if (thread.root) threads.push({
589
+ ...thread,
590
+ root: thread.root
591
+ });
400
592
  });
401
593
  });
402
594
  return threads;
@@ -411,8 +603,40 @@ let ThreadCommentModel = class ThreadCommentModel extends Disposable {
411
603
  });
412
604
  return all;
413
605
  }
606
+ getAnchorKind(unitId, ref) {
607
+ const anchor = deserializeThreadCommentAnchor(ref);
608
+ if (anchor) return anchor.kind;
609
+ switch (this._univerInstanceService.getUnitType(unitId)) {
610
+ case UniverInstanceType.UNIVER_SHEET: return "sheet-cell";
611
+ case UniverInstanceType.UNIVER_DOC: return "doc-text-range";
612
+ default: return null;
613
+ }
614
+ }
615
+ query(query = {}) {
616
+ const unitIds = query.unitIds ? new Set(query.unitIds) : null;
617
+ const subUnitIds = query.subUnitIds ? new Set(query.subUnitIds) : null;
618
+ const anchorKinds = query.anchorKinds ? new Set(query.anchorKinds) : null;
619
+ const authorIds = query.authorIds ? new Set(query.authorIds) : null;
620
+ return this.getAll().flatMap(({ unitId, threads }) => {
621
+ if (unitIds && !unitIds.has(unitId)) return [];
622
+ return threads.filter((thread) => {
623
+ if (subUnitIds && !subUnitIds.has(thread.subUnitId)) return false;
624
+ if (query.resolved !== void 0 && Boolean(thread.root.resolved) !== query.resolved) return false;
625
+ if (anchorKinds) {
626
+ const anchorKind = this.getAnchorKind(unitId, thread.root.ref);
627
+ if (!anchorKind || !anchorKinds.has(anchorKind)) return false;
628
+ }
629
+ if (authorIds && ![thread.root, ...thread.children].some((comment) => authorIds.has(comment.personId))) return false;
630
+ return true;
631
+ });
632
+ });
633
+ }
414
634
  };
415
- ThreadCommentModel = __decorate([__decorateParam(0, Inject(IThreadCommentDataSourceService)), __decorateParam(1, Inject(LifecycleService))], ThreadCommentModel);
635
+ ThreadCommentModel = __decorate([
636
+ __decorateParam(0, Inject(IThreadCommentDataSourceService)),
637
+ __decorateParam(1, Inject(LifecycleService)),
638
+ __decorateParam(2, IUniverInstanceService)
639
+ ], ThreadCommentModel);
416
640
 
417
641
  //#endregion
418
642
  //#region src/commands/mutations/comment.mutation.ts
@@ -470,17 +694,48 @@ const DeleteCommentMutation = {
470
694
 
471
695
  //#endregion
472
696
  //#region src/commands/commands/comment.command.ts
697
+ const latestWriteVersions = /* @__PURE__ */ new WeakMap();
698
+ function startCommentWrite(comment, kind) {
699
+ const versions = latestWriteVersions.get(comment) ?? {
700
+ resolve: 0,
701
+ update: 0
702
+ };
703
+ const version = versions[kind] + 1;
704
+ versions[kind] = version;
705
+ latestWriteVersions.set(comment, versions);
706
+ return version;
707
+ }
708
+ function isLatestCommentWrite(comment, kind, version) {
709
+ var _latestWriteVersions$;
710
+ return ((_latestWriteVersions$ = latestWriteVersions.get(comment)) === null || _latestWriteVersions$ === void 0 ? void 0 : _latestWriteVersions$[kind]) === version;
711
+ }
473
712
  const AddCommentCommand = {
474
713
  id: "thread-comment.command.add-comment",
475
714
  type: CommandType.COMMAND,
476
715
  async handler(accessor, params) {
716
+ var _threadCommentModel$g, _threadCommentModel$g2;
477
717
  if (!params) return false;
478
718
  const commandService = accessor.get(ICommandService);
479
719
  const dataSourceService = accessor.get(IThreadCommentDataSourceService);
720
+ const threadCommentModel = accessor.get(ThreadCommentModel);
480
721
  const { comment: originComment } = params;
481
- const comment = await dataSourceService.addComment(originComment);
482
- const syncUpdateMutationToColla = dataSourceService.syncUpdateMutationToColla;
483
722
  const isRoot = !originComment.parentId;
723
+ if (!isRoot && ((_threadCommentModel$g = threadCommentModel.getRootComment(params.unitId, params.subUnitId, originComment.threadId)) === null || _threadCommentModel$g === void 0 ? void 0 : _threadCommentModel$g.id) !== originComment.parentId) return false;
724
+ const comment = {
725
+ ...await dataSourceService.addComment(originComment),
726
+ unitId: params.unitId,
727
+ subUnitId: params.subUnitId,
728
+ ref: originComment.ref,
729
+ parentId: originComment.parentId,
730
+ ...!isRoot ? { threadId: originComment.threadId } : {}
731
+ };
732
+ const syncUpdateMutationToColla = dataSourceService.syncUpdateMutationToColla;
733
+ if (!isRoot && ((_threadCommentModel$g2 = threadCommentModel.getRootComment(params.unitId, params.subUnitId, originComment.threadId)) === null || _threadCommentModel$g2 === void 0 ? void 0 : _threadCommentModel$g2.id) !== originComment.parentId) {
734
+ try {
735
+ await dataSourceService.deleteComment(params.unitId, params.subUnitId, comment.threadId, comment.id);
736
+ } catch {}
737
+ return false;
738
+ }
484
739
  const redo = {
485
740
  id: AddCommentMutation.id,
486
741
  params: {
@@ -505,16 +760,16 @@ const UpdateCommentCommand = {
505
760
  const current = threadCommentModel.getComment(unitId, subUnitId, payload.commentId);
506
761
  if (!current) return false;
507
762
  const { children, ...currentComment } = current;
763
+ const writeVersion = startCommentWrite(current, "update");
508
764
  if (!await dataSourceService.updateComment({
509
765
  ...currentComment,
510
766
  ...payload
511
- })) return false;
767
+ }) || threadCommentModel.getComment(unitId, subUnitId, payload.commentId) !== current || !isLatestCommentWrite(current, "update", writeVersion)) return false;
512
768
  const redo = {
513
769
  id: UpdateCommentMutation.id,
514
770
  params
515
771
  };
516
- commandService.executeCommand(redo.id, redo.params, { onlyLocal: !syncUpdateMutationToColla });
517
- return true;
772
+ return commandService.executeCommand(redo.id, redo.params, { onlyLocal: !syncUpdateMutationToColla });
518
773
  }
519
774
  };
520
775
  const ResolveCommentCommand = {
@@ -524,13 +779,15 @@ const ResolveCommentCommand = {
524
779
  if (!params) return false;
525
780
  const { unitId, subUnitId, resolved, commentId } = params;
526
781
  const dataSourceService = accessor.get(IThreadCommentDataSourceService);
527
- const currentComment = accessor.get(ThreadCommentModel).getComment(unitId, subUnitId, commentId);
782
+ const threadCommentModel = accessor.get(ThreadCommentModel);
783
+ const currentComment = threadCommentModel.getComment(unitId, subUnitId, commentId);
528
784
  const syncUpdateMutationToColla = dataSourceService.syncUpdateMutationToColla;
529
785
  if (!currentComment) return false;
786
+ const writeVersion = startCommentWrite(currentComment, "resolve");
530
787
  if (!await dataSourceService.resolveComment({
531
788
  ...currentComment,
532
789
  resolved
533
- })) return false;
790
+ }) || threadCommentModel.getComment(unitId, subUnitId, commentId) !== currentComment || !isLatestCommentWrite(currentComment, "resolve", writeVersion)) return false;
534
791
  return accessor.get(ICommandService).executeCommand(ResolveCommentMutation.id, params, { onlyLocal: !syncUpdateMutationToColla });
535
792
  }
536
793
  };
@@ -568,7 +825,7 @@ const DeleteCommentTreeCommand = {
568
825
  const { unitId, subUnitId, commentId } = params;
569
826
  const commentWithChildren = threadCommentModel.getCommentWithChildren(unitId, subUnitId, commentId);
570
827
  if (!commentWithChildren) return false;
571
- if (!await dataSourceService.deleteComment(unitId, subUnitId, commentWithChildren.root.threadId, commentId)) return false;
828
+ if (!(dataSourceService.deleteThread ? await dataSourceService.deleteThread(unitId, subUnitId, commentWithChildren.root.threadId) : await dataSourceService.deleteComment(unitId, subUnitId, commentWithChildren.root.threadId, commentWithChildren.root.id))) return false;
572
829
  return await commandService.executeCommand(DeleteCommentMutation.id, {
573
830
  unitId,
574
831
  subUnitId,
@@ -599,90 +856,226 @@ function getDT(date) {
599
856
  }
600
857
 
601
858
  //#endregion
602
- //#region src/types/const/index.ts
603
- /**
604
- * Copyright 2023-present DreamNum Co., Ltd.
605
- *
606
- * Licensed under the Apache License, Version 2.0 (the "License");
607
- * you may not use this file except in compliance with the License.
608
- * You may obtain a copy of the License at
609
- *
610
- * http://www.apache.org/licenses/LICENSE-2.0
611
- *
612
- * Unless required by applicable law or agreed to in writing, software
613
- * distributed under the License is distributed on an "AS IS" BASIS,
614
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
615
- * See the License for the specific language governing permissions and
616
- * limitations under the License.
617
- */
618
- const TC_PLUGIN_NAME = "UNIVER_THREAD_COMMENT_PLUGIN";
859
+ //#region src/services/thread-comment-api.service.ts
860
+ const DOCUMENT_BODY_ARRAY_FIELDS = [
861
+ "renderedPageBreaks",
862
+ "textRuns",
863
+ "paragraphs",
864
+ "sectionBreaks",
865
+ "customBlocks",
866
+ "tables",
867
+ "columnGroups",
868
+ "blockRanges",
869
+ "customRanges",
870
+ "customDecorations"
871
+ ];
872
+ function isThreadCommentDocumentBody(value) {
873
+ if (!value || typeof value !== "object") return false;
874
+ if (typeof Reflect.get(value, "dataStream") !== "string") return false;
875
+ if (DOCUMENT_BODY_ARRAY_FIELDS.some((field) => {
876
+ const fieldValue = Reflect.get(value, field);
877
+ return fieldValue !== void 0 && !Array.isArray(fieldValue);
878
+ })) return false;
879
+ const payloads = Reflect.get(value, "payloads");
880
+ return payloads === void 0 || payloads !== null && typeof payloads === "object" && !Array.isArray(payloads) && Object.values(payloads).every((item) => typeof item === "string");
881
+ }
882
+ function normalizeThreadCommentContent(content) {
883
+ if (typeof content !== "string") {
884
+ if (!isThreadCommentDocumentBody(content)) throw new TypeError("Invalid thread comment content");
885
+ if (!content.dataStream.replace(/[\r\n]/g, "").trim()) throw new TypeError("Thread comment content cannot be empty");
886
+ return content;
887
+ }
888
+ if (!content.trim()) throw new TypeError("Thread comment content cannot be empty");
889
+ return { dataStream: content.replace(/\r\n?|\n/g, "\r").replace(/\r*$/, "\r\n") };
890
+ }
891
+ function toFacadeInfo(thread, anchorKind) {
892
+ return {
893
+ unitId: thread.unitId,
894
+ subUnitId: thread.subUnitId,
895
+ threadId: thread.threadId,
896
+ root: thread.root,
897
+ children: thread.children,
898
+ anchorKind,
899
+ anchor: deserializeThreadCommentAnchor(thread.root.ref),
900
+ relativeUserIds: Array.from(thread.relativeUsers)
901
+ };
902
+ }
903
+ let ThreadCommentFacadeService = class ThreadCommentFacadeService {
904
+ constructor(_commandService, _model, _userManagerService) {
905
+ this._commandService = _commandService;
906
+ this._model = _model;
907
+ this._userManagerService = _userManagerService;
908
+ }
909
+ createCommentAsync(options) {
910
+ const id = options.id ?? generateRandomId();
911
+ const threadId = options.threadId ?? id;
912
+ const personId = options.personId ?? this._userManagerService.getCurrentUser().userID;
913
+ return this._commandService.executeCommand(AddCommentCommand.id, {
914
+ unitId: options.unitId,
915
+ subUnitId: options.subUnitId,
916
+ comment: {
917
+ id,
918
+ threadId,
919
+ unitId: options.unitId,
920
+ subUnitId: options.subUnitId,
921
+ ref: serializeThreadCommentAnchor(options.anchor),
922
+ text: normalizeThreadCommentContent(options.content),
923
+ attachments: options.attachments ?? [],
924
+ dT: getDT(options.dateTime),
925
+ authorName: options.authorName,
926
+ personId
927
+ }
928
+ });
929
+ }
930
+ replyCommentAsync(options) {
931
+ const root = this._model.getRootComment(options.unitId, options.subUnitId, options.threadId);
932
+ if (!root) return Promise.resolve(false);
933
+ return this._commandService.executeCommand(AddCommentCommand.id, {
934
+ unitId: options.unitId,
935
+ subUnitId: options.subUnitId,
936
+ comment: {
937
+ id: options.id ?? generateRandomId(),
938
+ threadId: options.threadId,
939
+ parentId: root.id,
940
+ unitId: options.unitId,
941
+ subUnitId: options.subUnitId,
942
+ ref: root.ref,
943
+ text: normalizeThreadCommentContent(options.content),
944
+ attachments: options.attachments ?? [],
945
+ dT: getDT(options.dateTime),
946
+ authorName: options.authorName,
947
+ personId: options.personId ?? this._userManagerService.getCurrentUser().userID
948
+ }
949
+ });
950
+ }
951
+ updateCommentAsync(options) {
952
+ return this._commandService.executeCommand(UpdateCommentCommand.id, {
953
+ unitId: options.unitId,
954
+ subUnitId: options.subUnitId,
955
+ payload: {
956
+ commentId: options.commentId,
957
+ text: normalizeThreadCommentContent(options.content),
958
+ attachments: options.attachments,
959
+ updateT: getDT(options.dateTime)
960
+ }
961
+ });
962
+ }
963
+ deleteCommentAsync(options) {
964
+ return this._commandService.executeCommand(options.deleteThread ? DeleteCommentTreeCommand.id : DeleteCommentCommand.id, {
965
+ unitId: options.unitId,
966
+ subUnitId: options.subUnitId,
967
+ commentId: options.commentId
968
+ });
969
+ }
970
+ resolveCommentAsync(options) {
971
+ return this._commandService.executeCommand(ResolveCommentCommand.id, {
972
+ unitId: options.unitId,
973
+ subUnitId: options.subUnitId,
974
+ commentId: options.commentId,
975
+ resolved: options.resolved ?? true
976
+ });
977
+ }
978
+ getComments(query = {}) {
979
+ return this._model.query(query).map((thread) => toFacadeInfo(thread, this._model.getAnchorKind(thread.unitId, thread.root.ref)));
980
+ }
981
+ async listCommentsAsync(query = {}) {
982
+ const knownThreads = this._model.query({
983
+ unitIds: query.unitIds,
984
+ subUnitIds: query.subUnitIds
985
+ });
986
+ const groups = /* @__PURE__ */ new Map();
987
+ knownThreads.forEach((thread) => {
988
+ const key = `${thread.unitId}\0${thread.subUnitId}`;
989
+ const group = groups.get(key) ?? {
990
+ unitId: thread.unitId,
991
+ subUnitId: thread.subUnitId,
992
+ threadIds: []
993
+ };
994
+ group.threadIds.push(thread.threadId);
995
+ groups.set(key, group);
996
+ });
997
+ await Promise.all(Array.from(groups.values()).map((group) => this._model.syncThreadComments(group.unitId, group.subUnitId, group.threadIds)));
998
+ return this._model.query(query).map((thread) => toFacadeInfo(thread, this._model.getAnchorKind(thread.unitId, thread.root.ref)));
999
+ }
1000
+ };
1001
+ ThreadCommentFacadeService = __decorate([
1002
+ __decorateParam(0, Inject(ICommandService)),
1003
+ __decorateParam(1, Inject(ThreadCommentModel)),
1004
+ __decorateParam(2, Inject(UserManagerService))
1005
+ ], ThreadCommentFacadeService);
619
1006
 
620
1007
  //#endregion
621
- //#region src/controllers/tc-resource.controller.ts
622
- const SHEET_UNIVER_THREAD_COMMENT_PLUGIN = `SHEET_${TC_PLUGIN_NAME}`;
623
- let ThreadCommentResourceController = class ThreadCommentResourceController extends Disposable {
624
- constructor(_resourceManagerService, _threadCommentModel, _threadCommentDataSourceService) {
625
- super();
626
- this._resourceManagerService = _resourceManagerService;
627
- this._threadCommentModel = _threadCommentModel;
628
- this._threadCommentDataSourceService = _threadCommentDataSourceService;
629
- this._initSnapshot();
630
- }
631
- _initSnapshot() {
632
- const toJson = (unitID) => {
633
- const map = this._threadCommentModel.getUnit(unitID);
1008
+ //#region src/common/tc-resource.ts
1009
+ function isStringArray(value) {
1010
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
1011
+ }
1012
+ function isSnapshotComment(value, allowChildren = true) {
1013
+ if (!value || typeof value !== "object") return false;
1014
+ const comment = value;
1015
+ return typeof comment.id === "string" && comment.id.length > 0 && typeof comment.threadId === "string" && comment.threadId.length > 0 && (typeof comment.ref === "string" || !allowChildren && comment.ref === void 0) && (comment.authorName === void 0 || typeof comment.authorName === "string") && (comment.text === void 0 || isThreadCommentDocumentBody(comment.text)) && (comment.attachments === void 0 || isStringArray(comment.attachments)) && (comment.mentions === void 0 || isStringArray(comment.mentions)) && (!allowChildren || comment.children === void 0 || Array.isArray(comment.children) && comment.children.every((child) => isSnapshotComment(child, false)));
1016
+ }
1017
+ function createThreadCommentResourceHook(threadCommentModel, threadCommentDataSourceService, pluginName, businesses) {
1018
+ return {
1019
+ pluginName,
1020
+ businesses,
1021
+ toJson: (unitID) => {
1022
+ const map = threadCommentModel.getUnit(unitID);
634
1023
  const resultMap = {};
635
- if (map) {
636
- map.forEach((info) => {
637
- const subUnitComments = resultMap[info.subUnitId] ?? [];
638
- subUnitComments.push({
639
- ...info.root,
640
- children: info.children
641
- });
642
- resultMap[info.subUnitId] = subUnitComments;
1024
+ map.forEach((info) => {
1025
+ const subUnitComments = resultMap[info.subUnitId] ?? [];
1026
+ subUnitComments.push({
1027
+ ...info.root,
1028
+ children: info.children
643
1029
  });
644
- return JSON.stringify(this._threadCommentDataSourceService.saveToSnapshot(resultMap, unitID));
645
- }
646
- return "";
647
- };
648
- const parseJson = (json) => {
1030
+ resultMap[info.subUnitId] = subUnitComments;
1031
+ });
1032
+ return JSON.stringify(threadCommentDataSourceService.saveToSnapshot(resultMap, unitID));
1033
+ },
1034
+ parseJson: (json) => {
649
1035
  if (!json) return {};
650
1036
  try {
651
- return JSON.parse(json);
652
- } catch (err) {
1037
+ const value = JSON.parse(json);
1038
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
1039
+ return Object.fromEntries(Object.entries(value).flatMap(([subUnitId, comments]) => Array.isArray(comments) ? [[subUnitId, comments.filter((comment) => isSnapshotComment(comment))]] : []));
1040
+ } catch {
653
1041
  return {};
654
1042
  }
655
- };
656
- this.disposeWithMe(this._resourceManagerService.registerPluginResource({
657
- pluginName: SHEET_UNIVER_THREAD_COMMENT_PLUGIN,
658
- businesses: [UniverInstanceType.UNIVER_SHEET, UniverInstanceType.UNIVER_DOC],
659
- toJson: (unitID) => toJson(unitID),
660
- parseJson: (json) => parseJson(json),
661
- onUnLoad: (unitID) => {
662
- this._threadCommentModel.deleteUnit(unitID);
663
- },
664
- onLoad: async (unitID, value) => {
665
- Object.keys(value).forEach((subunitId) => {
666
- const commentList = value[subunitId];
667
- commentList.forEach((comment) => {
668
- this._threadCommentModel.addComment(unitID, subunitId, comment);
1043
+ },
1044
+ onUnLoad: (unitID) => {
1045
+ threadCommentModel.deleteUnit(unitID);
1046
+ },
1047
+ onLoad: (unitID, value) => {
1048
+ Object.keys(value).forEach((subunitId) => {
1049
+ const commentList = value[subunitId];
1050
+ commentList.forEach((comment) => {
1051
+ var _comment$children;
1052
+ const seenIds = /* @__PURE__ */ new Set([comment.id]);
1053
+ const children = (_comment$children = comment.children) === null || _comment$children === void 0 ? void 0 : _comment$children.filter((child) => {
1054
+ if (child.threadId !== comment.threadId || seenIds.has(child.id)) return false;
1055
+ seenIds.add(child.id);
1056
+ return true;
1057
+ }).map((child) => ({
1058
+ ...child,
1059
+ unitId: unitID,
1060
+ subUnitId: subunitId
1061
+ }));
1062
+ threadCommentModel.addComment(unitID, subunitId, {
1063
+ ...comment,
1064
+ unitId: unitID,
1065
+ subUnitId: subunitId,
1066
+ children
669
1067
  });
670
- this._threadCommentModel.syncThreadComments(unitID, subunitId, commentList.map((i) => i.threadId));
671
1068
  });
672
- }
673
- }));
674
- }
675
- };
676
- ThreadCommentResourceController = __decorate([
677
- __decorateParam(0, IResourceManagerService),
678
- __decorateParam(1, Inject(ThreadCommentModel)),
679
- __decorateParam(2, IThreadCommentDataSourceService)
680
- ], ThreadCommentResourceController);
1069
+ threadCommentModel.syncThreadComments(unitID, subunitId, commentList.map((i) => i.threadId));
1070
+ });
1071
+ }
1072
+ };
1073
+ }
681
1074
 
682
1075
  //#endregion
683
1076
  //#region package.json
684
1077
  var name = "@univerjs/thread-comment";
685
- var version = "1.0.0-insiders.20260813-7c9aa50";
1078
+ var version = "1.0.0";
686
1079
 
687
1080
  //#endregion
688
1081
  //#region src/config/config.ts
@@ -690,6 +1083,25 @@ const THREAD_COMMENT_PLUGIN_CONFIG_KEY = "thread-comment.config";
690
1083
  const configSymbol = Symbol(THREAD_COMMENT_PLUGIN_CONFIG_KEY);
691
1084
  const defaultPluginConfig = {};
692
1085
 
1086
+ //#endregion
1087
+ //#region src/types/const/index.ts
1088
+ /**
1089
+ * Copyright 2023-present DreamNum Co., Ltd.
1090
+ *
1091
+ * Licensed under the Apache License, Version 2.0 (the "License");
1092
+ * you may not use this file except in compliance with the License.
1093
+ * You may obtain a copy of the License at
1094
+ *
1095
+ * http://www.apache.org/licenses/LICENSE-2.0
1096
+ *
1097
+ * Unless required by applicable law or agreed to in writing, software
1098
+ * distributed under the License is distributed on an "AS IS" BASIS,
1099
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1100
+ * See the License for the specific language governing permissions and
1101
+ * limitations under the License.
1102
+ */
1103
+ const TC_PLUGIN_NAME = "UNIVER_THREAD_COMMENT_PLUGIN";
1104
+
693
1105
  //#endregion
694
1106
  //#region src/plugin.ts
695
1107
  let UniverThreadCommentPlugin = class UniverThreadCommentPlugin extends Plugin {
@@ -707,7 +1119,7 @@ let UniverThreadCommentPlugin = class UniverThreadCommentPlugin extends Plugin {
707
1119
  mergeOverrideWithDependencies([
708
1120
  [IThreadCommentDataSourceService, { useClass: ThreadCommentDataSourceService }],
709
1121
  [ThreadCommentModel],
710
- [ThreadCommentResourceController]
1122
+ [ThreadCommentFacadeService]
711
1123
  ], (_this$_config = this._config) === null || _this$_config === void 0 ? void 0 : _this$_config.overrides).forEach((d) => {
712
1124
  this._injector.add(d);
713
1125
  });
@@ -725,7 +1137,6 @@ let UniverThreadCommentPlugin = class UniverThreadCommentPlugin extends Plugin {
725
1137
  ].forEach((command) => {
726
1138
  this._commandService.registerCommand(command);
727
1139
  });
728
- this._injector.get(ThreadCommentResourceController);
729
1140
  }
730
1141
  };
731
1142
  _defineProperty(UniverThreadCommentPlugin, "pluginName", TC_PLUGIN_NAME);
@@ -739,4 +1150,4 @@ UniverThreadCommentPlugin = __decorate([
739
1150
  ], UniverThreadCommentPlugin);
740
1151
 
741
1152
  //#endregion
742
- export { AddCommentCommand, AddCommentMutation, DeleteCommentCommand, DeleteCommentMutation, DeleteCommentTreeCommand, IThreadCommentDataSourceService, ResolveCommentCommand, ResolveCommentMutation, SHEET_UNIVER_THREAD_COMMENT_PLUGIN, TC_PLUGIN_NAME, ThreadCommentDataSourceService, ThreadCommentModel, ThreadCommentResourceController, UniverThreadCommentPlugin, UpdateCommentCommand, UpdateCommentMutation, UpdateCommentRefMutation, getDT };
1153
+ export { AddCommentCommand, AddCommentMutation, DeleteCommentCommand, DeleteCommentMutation, DeleteCommentTreeCommand, IThreadCommentDataSourceService, ResolveCommentCommand, ResolveCommentMutation, TC_PLUGIN_NAME, ThreadCommentAnchorKind, ThreadCommentDataSourceService, ThreadCommentFacadeService, ThreadCommentModel, UniverThreadCommentPlugin, UpdateCommentCommand, UpdateCommentMutation, UpdateCommentRefMutation, createThreadCommentResourceHook, deserializeThreadCommentAnchor, getDT, isThreadCommentAnchor, isThreadCommentDocumentBody, normalizeThreadCommentContent, serializeThreadCommentAnchor };