@voltro/plugin-comments 0.84.0 → 0.86.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 +1215 -0
- package/THIRD-PARTY-NOTICES.md +5 -89
- package/dist/errors.d.ts +22 -16
- package/dist/errors.js +9 -2
- package/dist/index.d.ts +104 -16
- package/dist/index.js +382 -219
- package/dist/quote.js +25 -0
- package/dist/rpc.d.ts +104 -73
- package/dist/rpc.js +194 -2
- package/dist/web.d.ts +26 -2
- package/dist/web.js +15 -12
- package/package.json +6 -6
- package/dist/rpc-DlFs6xXs.js +0 -188
package/dist/rpc-DlFs6xXs.js
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { CommentAccessRefused as e, CommentNotFound as t, CommentNotYours as n } from "./errors.js";
|
|
2
|
-
import { Schema as r } from "effect";
|
|
3
|
-
import { defineMutation as i, defineQuery as a, reactivityChannel as o } from "@voltro/protocol";
|
|
4
|
-
//#region src/quote.ts
|
|
5
|
-
var s = 1e3, c = 32, l = (e, t, n) => {
|
|
6
|
-
let r = Math.max(0, Math.min(t, n)), i = Math.min(e.length, Math.max(t, n), r + s), a = e.slice(Math.max(0, r - c), r), o = e.slice(i, i + c);
|
|
7
|
-
return {
|
|
8
|
-
exact: e.slice(r, i),
|
|
9
|
-
...a === "" ? {} : { prefix: a },
|
|
10
|
-
...o === "" ? {} : { suffix: o }
|
|
11
|
-
};
|
|
12
|
-
}, u = (e, t) => {
|
|
13
|
-
if (t.exact === "") return null;
|
|
14
|
-
let n = null;
|
|
15
|
-
for (let r = e.indexOf(t.exact); r !== -1; r = e.indexOf(t.exact, r + 1)) {
|
|
16
|
-
let i = e.slice(0, r), a = e.slice(r + t.exact.length), o = (t.prefix !== void 0 && i.endsWith(t.prefix) ? 1 : 0) + (t.suffix !== void 0 && a.startsWith(t.suffix) ? 1 : 0);
|
|
17
|
-
(n === null || o > n.score) && (n = {
|
|
18
|
-
start: r,
|
|
19
|
-
score: o
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return n === null ? null : {
|
|
23
|
-
start: n.start,
|
|
24
|
-
end: n.start + t.exact.length
|
|
25
|
-
};
|
|
26
|
-
}, d = "@voltro/plugin-comments", f = o("comments"), p = r.Struct({
|
|
27
|
-
id: r.String,
|
|
28
|
-
threadId: r.String,
|
|
29
|
-
body: r.String,
|
|
30
|
-
authorSubjectId: r.String,
|
|
31
|
-
mentions: r.Array(r.String),
|
|
32
|
-
editedAt: r.NullOr(r.String),
|
|
33
|
-
createdAt: r.String,
|
|
34
|
-
reactions: r.Array(r.Struct({
|
|
35
|
-
emoji: r.String,
|
|
36
|
-
count: r.Number,
|
|
37
|
-
mine: r.Boolean
|
|
38
|
-
}))
|
|
39
|
-
}), m = r.Struct({
|
|
40
|
-
exact: r.String.pipe(r.minLength(1), r.maxLength(s)),
|
|
41
|
-
prefix: r.optional(r.String.pipe(r.maxLength(32))),
|
|
42
|
-
suffix: r.optional(r.String.pipe(r.maxLength(32)))
|
|
43
|
-
}), h = r.Struct({
|
|
44
|
-
id: r.String,
|
|
45
|
-
anchor: r.String,
|
|
46
|
-
quote: r.NullOr(m),
|
|
47
|
-
status: r.Literal("open", "resolved"),
|
|
48
|
-
createdBy: r.String,
|
|
49
|
-
createdAt: r.String,
|
|
50
|
-
comments: r.Array(p),
|
|
51
|
-
unreadCount: r.Number
|
|
52
|
-
}), g = a({
|
|
53
|
-
name: "comments.list",
|
|
54
|
-
source: f,
|
|
55
|
-
input: r.Struct({ anchor: r.String }),
|
|
56
|
-
output: r.Array(h),
|
|
57
|
-
error: e,
|
|
58
|
-
openAccess: "delegated: the executor runs the app-declared anchor access rule (viaEntity guard or scope) and is fail-closed — an undeclared rule refuses every read"
|
|
59
|
-
}), _ = i({
|
|
60
|
-
name: "comments.create",
|
|
61
|
-
input: r.Struct({
|
|
62
|
-
anchor: r.String,
|
|
63
|
-
body: r.String,
|
|
64
|
-
threadId: r.optional(r.String),
|
|
65
|
-
mentions: r.optional(r.Array(r.String)),
|
|
66
|
-
quote: r.optional(m)
|
|
67
|
-
}),
|
|
68
|
-
output: r.Struct({
|
|
69
|
-
threadId: r.String,
|
|
70
|
-
commentId: r.String
|
|
71
|
-
}),
|
|
72
|
-
error: r.Union(e, t),
|
|
73
|
-
openAccess: "delegated: the executor runs the app-declared anchor access rule before any write; the author is always the calling subject"
|
|
74
|
-
}), v = i({
|
|
75
|
-
name: "comments.edit",
|
|
76
|
-
input: r.Struct({
|
|
77
|
-
commentId: r.String,
|
|
78
|
-
body: r.String
|
|
79
|
-
}),
|
|
80
|
-
output: r.Struct({ ok: r.Boolean }),
|
|
81
|
-
error: r.Union(e, t, n),
|
|
82
|
-
openAccess: "author-scoped: only the comment's own author may edit, checked in the executor on top of the anchor access rule"
|
|
83
|
-
}), y = i({
|
|
84
|
-
name: "comments.resolve",
|
|
85
|
-
input: r.Struct({
|
|
86
|
-
threadId: r.String,
|
|
87
|
-
resolved: r.Boolean
|
|
88
|
-
}),
|
|
89
|
-
output: r.Struct({ ok: r.Boolean }),
|
|
90
|
-
error: r.Union(e, t),
|
|
91
|
-
openAccess: "delegated: anchor access rule in the executor — anyone who may read the anchor may resolve/reopen (the Liveblocks semantic)"
|
|
92
|
-
}), b = i({
|
|
93
|
-
name: "comments.delete",
|
|
94
|
-
input: r.Struct({ commentId: r.String }),
|
|
95
|
-
output: r.Struct({ ok: r.Boolean }),
|
|
96
|
-
error: r.Union(e, t, n),
|
|
97
|
-
openAccess: "author-scoped, with a comments:moderate scope override — both checked in the executor on top of the anchor access rule"
|
|
98
|
-
}), x = i({
|
|
99
|
-
name: "comments.react",
|
|
100
|
-
input: r.Struct({
|
|
101
|
-
commentId: r.String,
|
|
102
|
-
emoji: r.String
|
|
103
|
-
}),
|
|
104
|
-
output: r.Struct({ reacted: r.Boolean }),
|
|
105
|
-
error: r.Union(e, t),
|
|
106
|
-
openAccess: "delegated: anchor access rule in the executor; the toggle writes only the calling subject's own reaction row"
|
|
107
|
-
}), S = i({
|
|
108
|
-
name: "comments.markRead",
|
|
109
|
-
input: r.Struct({ threadId: r.String }),
|
|
110
|
-
output: r.Struct({ ok: r.Boolean }),
|
|
111
|
-
error: t,
|
|
112
|
-
openAccess: "self-scoped write: stamps only the calling subject's own read marker for the thread"
|
|
113
|
-
}), C = a({
|
|
114
|
-
name: "comments.mentionSearch",
|
|
115
|
-
input: r.Struct({ query: r.String }),
|
|
116
|
-
output: r.Array(r.Struct({
|
|
117
|
-
subjectId: r.String,
|
|
118
|
-
label: r.String
|
|
119
|
-
})),
|
|
120
|
-
openAccess: "delegated: the app-declared mention resolver receives the CALLING subject and its default filters to the caller's tenant — cross-tenant subjects are structurally unreachable"
|
|
121
|
-
}), w = [
|
|
122
|
-
{
|
|
123
|
-
tag: "comments.list",
|
|
124
|
-
kind: "query",
|
|
125
|
-
import: {
|
|
126
|
-
module: "@voltro/plugin-comments/rpc",
|
|
127
|
-
name: "listDescriptor"
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
tag: "comments.create",
|
|
132
|
-
kind: "mutation",
|
|
133
|
-
import: {
|
|
134
|
-
module: "@voltro/plugin-comments/rpc",
|
|
135
|
-
name: "createDescriptor"
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
tag: "comments.edit",
|
|
140
|
-
kind: "mutation",
|
|
141
|
-
import: {
|
|
142
|
-
module: "@voltro/plugin-comments/rpc",
|
|
143
|
-
name: "editDescriptor"
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
tag: "comments.resolve",
|
|
148
|
-
kind: "mutation",
|
|
149
|
-
import: {
|
|
150
|
-
module: "@voltro/plugin-comments/rpc",
|
|
151
|
-
name: "resolveDescriptor"
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
tag: "comments.delete",
|
|
156
|
-
kind: "mutation",
|
|
157
|
-
import: {
|
|
158
|
-
module: "@voltro/plugin-comments/rpc",
|
|
159
|
-
name: "deleteDescriptor"
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
tag: "comments.react",
|
|
164
|
-
kind: "mutation",
|
|
165
|
-
import: {
|
|
166
|
-
module: "@voltro/plugin-comments/rpc",
|
|
167
|
-
name: "reactDescriptor"
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
tag: "comments.markRead",
|
|
172
|
-
kind: "mutation",
|
|
173
|
-
import: {
|
|
174
|
-
module: "@voltro/plugin-comments/rpc",
|
|
175
|
-
name: "markReadDescriptor"
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
tag: "comments.mentionSearch",
|
|
180
|
-
kind: "query",
|
|
181
|
-
import: {
|
|
182
|
-
module: "@voltro/plugin-comments/rpc",
|
|
183
|
-
name: "mentionSearchDescriptor"
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
];
|
|
187
|
-
//#endregion
|
|
188
|
-
export { b as a, S as c, y as d, s as f, _ as i, C as l, l as m, f as n, v as o, u as p, w as r, g as s, d as t, x as u };
|