@voltro/plugin-comments 0.83.1 → 0.85.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/CHANGELOG.md +1191 -0
- package/THIRD-PARTY-NOTICES.md +1 -57
- package/dist/errors.d.ts +22 -16
- package/dist/errors.js +9 -2
- package/dist/index.d.ts +104 -16
- package/dist/index.js +371 -206
- package/dist/{rpc-DlFs6xXs.js → rpc-BTQBcdhT.js} +105 -79
- package/dist/rpc.d.ts +104 -73
- package/dist/rpc.js +2 -2
- package/dist/web.d.ts +26 -2
- package/dist/web.js +14 -12
- package/package.json +6 -6
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -5,66 +5,10 @@ property of its respective copyright holders and is used under the terms of
|
|
|
5
5
|
its license. This file is provided for attribution; it grants no rights in
|
|
6
6
|
@voltro/plugin-comments itself, which is proprietary (see LICENSE).
|
|
7
7
|
|
|
8
|
-
Generated from the resolved runtime dependency closure (
|
|
8
|
+
Generated from the resolved runtime dependency closure (11 packages).
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
## @effect/experimental@0.61.1
|
|
13
|
-
|
|
14
|
-
License: MIT
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
MIT License
|
|
18
|
-
|
|
19
|
-
Copyright (c) 2023-present The Contributors
|
|
20
|
-
|
|
21
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
22
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
23
|
-
in the Software without restriction, including without limitation the rights
|
|
24
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
25
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
26
|
-
furnished to do so, subject to the following conditions:
|
|
27
|
-
|
|
28
|
-
The above copyright notice and this permission notice shall be included in all
|
|
29
|
-
copies or substantial portions of the Software.
|
|
30
|
-
|
|
31
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
32
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
33
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
34
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
35
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
36
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
37
|
-
SOFTWARE.
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## @effect/sql@0.52.1
|
|
41
|
-
|
|
42
|
-
License: MIT
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
MIT License
|
|
46
|
-
|
|
47
|
-
Copyright (c) 2023-present The Contributors
|
|
48
|
-
|
|
49
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
50
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
51
|
-
in the Software without restriction, including without limitation the rights
|
|
52
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
53
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
54
|
-
furnished to do so, subject to the following conditions:
|
|
55
|
-
|
|
56
|
-
The above copyright notice and this permission notice shall be included in all
|
|
57
|
-
copies or substantial portions of the Software.
|
|
58
|
-
|
|
59
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
60
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
61
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
62
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
63
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
64
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
65
|
-
SOFTWARE.
|
|
66
|
-
```
|
|
67
|
-
|
|
68
12
|
## @tanstack/devtools-event-client@0.4.4
|
|
69
13
|
|
|
70
14
|
License: MIT
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
|
+
import { YieldableError } from 'effect/Cause';
|
|
2
3
|
|
|
3
4
|
/** The anchor's access check refused the caller — or no access rule is
|
|
4
5
|
* declared at all (fail-closed: undeclared access is a refusal, not a pass).
|
|
@@ -7,34 +8,39 @@ import { Schema } from 'effect';
|
|
|
7
8
|
* pointing here, and this is what they find — "no longer available", not a
|
|
8
9
|
* leak and not a crash. */
|
|
9
10
|
export declare class CommentAccessRefused extends CommentAccessRefused_base {
|
|
11
|
+
get message(): string;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
declare const CommentAccessRefused_base: Schema.
|
|
13
|
-
readonly
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
reason: typeof Schema.String;
|
|
17
|
-
}>;
|
|
14
|
+
declare const CommentAccessRefused_base: Schema.Class<CommentAccessRefused, Schema.TaggedStruct<"CommentAccessRefused", {
|
|
15
|
+
readonly anchor: Schema.String;
|
|
16
|
+
readonly reason: Schema.String;
|
|
17
|
+
}>, YieldableError>;
|
|
18
18
|
|
|
19
19
|
/** The thread / comment id resolves to nothing the caller may see. */
|
|
20
20
|
export declare class CommentNotFound extends CommentNotFound_base {
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
declare const CommentNotFound_base: Schema.
|
|
24
|
-
readonly
|
|
25
|
-
}
|
|
26
|
-
id: typeof Schema.String;
|
|
27
|
-
}>;
|
|
23
|
+
declare const CommentNotFound_base: Schema.Class<CommentNotFound, Schema.TaggedStruct<"CommentNotFound", {
|
|
24
|
+
readonly id: Schema.String;
|
|
25
|
+
}>, YieldableError>;
|
|
28
26
|
|
|
29
27
|
/** Only the author edits or deletes their own comment (a `comments:moderate`
|
|
30
28
|
* scope overrides for delete). */
|
|
31
29
|
export declare class CommentNotYours extends CommentNotYours_base {
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
declare const CommentNotYours_base: Schema.
|
|
35
|
-
readonly
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
declare const CommentNotYours_base: Schema.Class<CommentNotYours, Schema.TaggedStruct<"CommentNotYours", {
|
|
33
|
+
readonly id: Schema.String;
|
|
34
|
+
}>, YieldableError>;
|
|
35
|
+
|
|
36
|
+
/** The app's status policy (`statusPolicy`) refused resolving or reopening
|
|
37
|
+
* this thread for the caller — the thread keeps its status. */
|
|
38
|
+
export declare class CommentStatusRefused extends CommentStatusRefused_base {
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare const CommentStatusRefused_base: Schema.Class<CommentStatusRefused, Schema.TaggedStruct<"CommentStatusRefused", {
|
|
42
|
+
readonly threadId: Schema.String;
|
|
43
|
+
readonly reason: Schema.String;
|
|
44
|
+
}>, YieldableError>;
|
|
39
45
|
|
|
40
46
|
export { }
|
package/dist/errors.js
CHANGED
|
@@ -3,6 +3,13 @@ import { Schema as e } from "effect";
|
|
|
3
3
|
var t = class extends e.TaggedError()("CommentAccessRefused", {
|
|
4
4
|
anchor: e.String,
|
|
5
5
|
reason: e.String
|
|
6
|
-
}) {
|
|
6
|
+
}) {
|
|
7
|
+
get message() {
|
|
8
|
+
return this.reason;
|
|
9
|
+
}
|
|
10
|
+
}, n = class extends e.TaggedError()("CommentNotFound", { id: e.String }) {}, r = class extends e.TaggedError()("CommentNotYours", { id: e.String }) {}, i = class extends e.TaggedError()("CommentStatusRefused", {
|
|
11
|
+
threadId: e.String,
|
|
12
|
+
reason: e.String
|
|
13
|
+
}) {};
|
|
7
14
|
//#endregion
|
|
8
|
-
export { t as CommentAccessRefused, n as CommentNotFound, r as CommentNotYours };
|
|
15
|
+
export { t as CommentAccessRefused, n as CommentNotFound, r as CommentNotYours, i as CommentStatusRefused };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,31 @@ import { ReactivityChannel } from '@voltro/protocol';
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
import { Table } from '@voltro/database';
|
|
7
7
|
import { VoltroPlugin } from '@voltro/protocol';
|
|
8
|
+
import { YieldableError } from 'effect/Cause';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Remove the comments (with their reactions and read markers) of threads
|
|
12
|
+
* that have been resolved for longer than their kind's retention. The thread
|
|
13
|
+
* itself — anchor, passage, kind, status — and its status history stay, and
|
|
14
|
+
* the removal is appended to that history (actor `retention`, with the number
|
|
15
|
+
* of days), so a thread never disappears without a trace. A thread reopened
|
|
16
|
+
* since is not touched. Run it from a schedule over the root store (all
|
|
17
|
+
* tenants) or a request store (one tenant); a second run finds nothing new.
|
|
18
|
+
*/
|
|
19
|
+
export declare const applyCommentRetention: (store: DataStore, retention: CommentRetention, now?: Date) => Promise<{
|
|
20
|
+
readonly threads: number;
|
|
21
|
+
readonly comments: number;
|
|
22
|
+
}>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* What a thread is for. All three share the anchor and the same comments;
|
|
26
|
+
* the kind keeps them apart in the UI and in policy:
|
|
27
|
+
* - `discussion` — talk about the anchored thing (the default);
|
|
28
|
+
* - `note` — a standing editorial note (context for whoever edits next);
|
|
29
|
+
* - `review` — the conversation of a review. A thread is never a task,
|
|
30
|
+
* a suggestion or a decision; those live with their own owners.
|
|
31
|
+
*/
|
|
32
|
+
export declare const COMMENT_THREAD_KINDS: readonly ["discussion", "note", "review"];
|
|
8
33
|
|
|
9
34
|
export declare interface CommentAccessInput {
|
|
10
35
|
/** The thread's anchor, verbatim as the app wrote it. */
|
|
@@ -27,35 +52,30 @@ export declare interface CommentAccessInput {
|
|
|
27
52
|
* pointing here, and this is what they find — "no longer available", not a
|
|
28
53
|
* leak and not a crash. */
|
|
29
54
|
export declare class CommentAccessRefused extends CommentAccessRefused_base {
|
|
55
|
+
get message(): string;
|
|
30
56
|
}
|
|
31
57
|
|
|
32
|
-
declare const CommentAccessRefused_base: Schema.
|
|
33
|
-
readonly
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
reason: typeof Schema.String;
|
|
37
|
-
}>;
|
|
58
|
+
declare const CommentAccessRefused_base: Schema.Class<CommentAccessRefused, Schema.TaggedStruct<"CommentAccessRefused", {
|
|
59
|
+
readonly anchor: Schema.String;
|
|
60
|
+
readonly reason: Schema.String;
|
|
61
|
+
}>, YieldableError>;
|
|
38
62
|
|
|
39
63
|
/** The thread / comment id resolves to nothing the caller may see. */
|
|
40
64
|
export declare class CommentNotFound extends CommentNotFound_base {
|
|
41
65
|
}
|
|
42
66
|
|
|
43
|
-
declare const CommentNotFound_base: Schema.
|
|
44
|
-
readonly
|
|
45
|
-
}
|
|
46
|
-
id: typeof Schema.String;
|
|
47
|
-
}>;
|
|
67
|
+
declare const CommentNotFound_base: Schema.Class<CommentNotFound, Schema.TaggedStruct<"CommentNotFound", {
|
|
68
|
+
readonly id: Schema.String;
|
|
69
|
+
}>, YieldableError>;
|
|
48
70
|
|
|
49
71
|
/** Only the author edits or deletes their own comment (a `comments:moderate`
|
|
50
72
|
* scope overrides for delete). */
|
|
51
73
|
export declare class CommentNotYours extends CommentNotYours_base {
|
|
52
74
|
}
|
|
53
75
|
|
|
54
|
-
declare const CommentNotYours_base: Schema.
|
|
55
|
-
readonly
|
|
56
|
-
}
|
|
57
|
-
id: typeof Schema.String;
|
|
58
|
-
}>;
|
|
76
|
+
declare const CommentNotYours_base: Schema.Class<CommentNotYours, Schema.TaggedStruct<"CommentNotYours", {
|
|
77
|
+
readonly id: Schema.String;
|
|
78
|
+
}>, YieldableError>;
|
|
59
79
|
|
|
60
80
|
export declare interface CommentQuote {
|
|
61
81
|
/** The selected text. */
|
|
@@ -80,6 +100,10 @@ export declare const commentReadsTable: Table<"_voltro_comment_reads", FieldDefi
|
|
|
80
100
|
readonly lastReadAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
81
101
|
}>, true, never>;
|
|
82
102
|
|
|
103
|
+
/** How long the comments of a resolved thread are kept, in days, per kind.
|
|
104
|
+
* A kind left out keeps its comments. */
|
|
105
|
+
export declare type CommentRetention = Partial<Readonly<Record<CommentThreadKind, number>>>;
|
|
106
|
+
|
|
83
107
|
/** One push channel for the whole surface: every comment write publishes, and
|
|
84
108
|
* `comments.list` re-runs for subscribers. Table-granular by design for now —
|
|
85
109
|
* the read-set work (plan 01 P3) is the named narrowing. */
|
|
@@ -112,6 +136,21 @@ declare interface CommentsPluginOptions {
|
|
|
112
136
|
* the caller's tenant unless `crossTenant: true` is set — the seam is
|
|
113
137
|
* tenant-safe by construction, not by every implementor remembering.
|
|
114
138
|
*/
|
|
139
|
+
/**
|
|
140
|
+
* Who may resolve or reopen a thread, on top of the anchor access rule —
|
|
141
|
+
* say, only a publisher reopens a resolved review thread. Answer false to
|
|
142
|
+
* refuse (`CommentStatusRefused`); a throw refuses too. Absent: anyone who
|
|
143
|
+
* may read the anchor. Allowed or not, nothing changes silently — every
|
|
144
|
+
* change is recorded in `_voltro_comment_thread_events`.
|
|
145
|
+
*/
|
|
146
|
+
readonly statusPolicy?: (input: CommentStatusInput) => Promise<boolean>;
|
|
147
|
+
/**
|
|
148
|
+
* Which threads a caller sees, on top of the anchor access rule — say,
|
|
149
|
+
* editorial notes only for the team. A hidden thread is absent from
|
|
150
|
+
* `comments.list` and refuses replies and status changes like a missing
|
|
151
|
+
* one. Absent: every thread on a readable anchor.
|
|
152
|
+
*/
|
|
153
|
+
readonly visibleTo?: (input: CommentVisibilityInput) => boolean;
|
|
115
154
|
readonly resolveMentions?: (input: MentionSearchInput) => Promise<ReadonlyArray<{
|
|
116
155
|
readonly subjectId: string;
|
|
117
156
|
readonly label: string;
|
|
@@ -141,6 +180,48 @@ export declare const commentsTable: Table<"_voltro_comments", FieldDefinitions<{
|
|
|
141
180
|
readonly tenantId: ColumnBuilder<string | null, "text", boolean>;
|
|
142
181
|
}>, true, "byCommentThread">;
|
|
143
182
|
|
|
183
|
+
export declare interface CommentStatusInput {
|
|
184
|
+
readonly thread: CommentThreadFacts;
|
|
185
|
+
readonly to: 'open' | 'resolved';
|
|
186
|
+
readonly subject: CommentAccessInput['subject'];
|
|
187
|
+
readonly store: DataStore | undefined;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** The app's status policy (`statusPolicy`) refused resolving or reopening
|
|
191
|
+
* this thread for the caller — the thread keeps its status. */
|
|
192
|
+
export declare class CommentStatusRefused extends CommentStatusRefused_base {
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
declare const CommentStatusRefused_base: Schema.Class<CommentStatusRefused, Schema.TaggedStruct<"CommentStatusRefused", {
|
|
196
|
+
readonly threadId: Schema.String;
|
|
197
|
+
readonly reason: Schema.String;
|
|
198
|
+
}>, YieldableError>;
|
|
199
|
+
|
|
200
|
+
/** Every status change of a thread — who opened, resolved or reopened it,
|
|
201
|
+
* when, and why. Append-only: nothing here is updated or deleted. */
|
|
202
|
+
export declare const commentThreadEventsTable: Table<"_voltro_comment_thread_events", FieldDefinitions<{
|
|
203
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
204
|
+
readonly threadId: ColumnBuilder<string, "text", boolean>;
|
|
205
|
+
/** null for the opening. */
|
|
206
|
+
readonly fromStatus: ColumnBuilder<string | null, "text", boolean>;
|
|
207
|
+
readonly toStatus: ColumnBuilder<string, "text", boolean>;
|
|
208
|
+
readonly actor: ColumnBuilder<string, "text", boolean>;
|
|
209
|
+
readonly reason: ColumnBuilder<string | null, "text", boolean>;
|
|
210
|
+
readonly at: ColumnBuilder<Date, "timestamp", true>;
|
|
211
|
+
readonly tenantId: ColumnBuilder<string | null, "text", boolean>;
|
|
212
|
+
}>, true, "byThreadEvents">;
|
|
213
|
+
|
|
214
|
+
/** A thread as the app's status and visibility rules see it. */
|
|
215
|
+
export declare interface CommentThreadFacts {
|
|
216
|
+
readonly id: string;
|
|
217
|
+
readonly anchor: string;
|
|
218
|
+
readonly kind: CommentThreadKind;
|
|
219
|
+
readonly status: 'open' | 'resolved';
|
|
220
|
+
readonly createdBy: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export declare type CommentThreadKind = (typeof COMMENT_THREAD_KINDS)[number];
|
|
224
|
+
|
|
144
225
|
export declare const commentThreadsTable: Table<"_voltro_comment_threads", FieldDefinitions<{
|
|
145
226
|
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
146
227
|
/** Free string key (`order:123`, `doc:abc#section-2`) — the app decides the
|
|
@@ -148,12 +229,19 @@ export declare const commentThreadsTable: Table<"_voltro_comment_threads", Field
|
|
|
148
229
|
readonly anchor: ColumnBuilder<string, "text", boolean>;
|
|
149
230
|
/** The selected passage the thread is about (`./quote`), or null. */
|
|
150
231
|
readonly quote: ColumnBuilder<CommentQuote | null, "json", boolean>;
|
|
232
|
+
/** `discussion` | `note` | `review` (`./rpc` COMMENT_THREAD_KINDS). */
|
|
233
|
+
readonly kind: ColumnBuilder<string, "text", true>;
|
|
151
234
|
readonly status: ColumnBuilder<string, "text", true>;
|
|
152
235
|
readonly createdBy: ColumnBuilder<string, "text", boolean>;
|
|
153
236
|
readonly createdAt: ColumnBuilder<Date, "timestamp", true>;
|
|
154
237
|
readonly tenantId: ColumnBuilder<string | null, "text", boolean>;
|
|
155
238
|
}>, true, "byThreadAnchor">;
|
|
156
239
|
|
|
240
|
+
export declare interface CommentVisibilityInput {
|
|
241
|
+
readonly thread: CommentThreadFacts;
|
|
242
|
+
readonly subject: CommentAccessInput['subject'];
|
|
243
|
+
}
|
|
244
|
+
|
|
157
245
|
/**
|
|
158
246
|
* Where `quote` stands in `text` now: `{ start, end }`, or null when the text
|
|
159
247
|
* no longer holds the passage. With the passage more than once, the one whose
|