@absolutejs/sync-pack-comments 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/dist/index.d.ts CHANGED
@@ -132,7 +132,41 @@ export type CommentsPackConfig<Ctx = CollectionContext, AuthorRow = unknown> = {
132
132
  search?: {
133
133
  topK?: number;
134
134
  };
135
+ /**
136
+ * When set, register a `comment_reactions` table + matching collection
137
+ * + react / unreact / toggleReaction mutations. Each row is one
138
+ * actor's reaction with a single emoji on a single comment, deterministic
139
+ * id `${commentId}:${actorId}:${emoji}` for idempotent toggling.
140
+ */
141
+ reactions?: ReactionsConfig;
135
142
  };
143
+ /** Config for the optional reactions surface. */
144
+ export type ReactionsConfig = {
145
+ /**
146
+ * Allowed emojis. Setting this filters react mutations — anything
147
+ * outside the list is rejected. Empty array (default) means any
148
+ * single-character or grapheme string is accepted.
149
+ */
150
+ allowedEmojis?: string[];
151
+ /**
152
+ * Custom row id generator for reaction rows. Default
153
+ * `(commentId, actorId, emoji) => \`${commentId}:${actorId}:${emoji}\``.
154
+ */
155
+ newId?: (commentId: string, actorId: string, emoji: string) => string;
156
+ };
157
+ /** A reaction row — one per (comment, actor, emoji). */
158
+ export type CommentReactionRow = {
159
+ id: string;
160
+ commentId: string;
161
+ actorId: string;
162
+ emoji: string;
163
+ createdAt: number;
164
+ };
165
+ /** Thrown when a react mutation supplies an emoji outside `allowedEmojis`. */
166
+ export declare class CommentReactionNotAllowedError extends Error {
167
+ readonly emoji: string;
168
+ constructor(emoji: string);
169
+ }
136
170
  /**
137
171
  * Config for the optional `comments-with-author` join collection.
138
172
  *
package/dist/index.js CHANGED
@@ -55,6 +55,15 @@ class CommentParentMismatchError extends Error {
55
55
  this.parentCommentId = parentCommentId;
56
56
  }
57
57
  }
58
+
59
+ class CommentReactionNotAllowedError extends Error {
60
+ emoji;
61
+ constructor(emoji) {
62
+ super(`Comment reaction "${emoji}" is not in the configured allowedEmojis`);
63
+ this.name = "CommentReactionNotAllowedError";
64
+ this.emoji = emoji;
65
+ }
66
+ }
58
67
  var DEFAULT_MAX_DEPTH = 8;
59
68
  var DEFAULT_USER_TABLE = "users";
60
69
  var resolveActor = (getActorId, ctx) => {
@@ -85,11 +94,35 @@ var createCommentsPack = (config) => {
85
94
  const search = config.search;
86
95
  const searchCollectionName = `${prefix}comments-search`;
87
96
  const searchTopK = search?.topK ?? 20;
97
+ const reactionsConfig = config.reactions;
98
+ const reactionsTable = `${prefix}comment_reactions`;
99
+ const reactionsCollectionName = reactionsTable;
100
+ const reactMutationName = `${prefix}comments:react`;
101
+ const unreactMutationName = `${prefix}comments:unreact`;
102
+ const toggleReactionMutationName = `${prefix}comments:toggleReaction`;
103
+ const reactionId = reactionsConfig?.newId ?? ((commentId, actorId, emoji) => `${commentId}:${actorId}:${emoji}`);
104
+ const reactionStore = new Map;
105
+ const reactionReader = {
106
+ all: () => [...reactionStore.values()]
107
+ };
108
+ const reactionWriter = {
109
+ delete: (row) => {
110
+ reactionStore.delete(row.id);
111
+ },
112
+ insert: (data) => {
113
+ reactionStore.set(data.id, data);
114
+ return data;
115
+ },
116
+ update: (data) => {
117
+ reactionStore.set(data.id, data);
118
+ return data;
119
+ }
120
+ };
88
121
  const pack = {
89
122
  name: "@absolutejs/sync-pack-comments",
90
- ownsTables: [table],
123
+ ownsTables: reactionsConfig === undefined ? [table] : [table, reactionsTable],
91
124
  readsTables: joinUsers === undefined ? [] : [userTable],
92
- version: "0.3.0",
125
+ version: "0.4.0",
93
126
  schemas: defineSchema({
94
127
  [table]: {
95
128
  fields: {
@@ -254,14 +287,167 @@ var createCommentsPack = (config) => {
254
287
  })
255
288
  ];
256
289
  }
290
+ if (reactionsConfig !== undefined) {
291
+ const allowed = reactionsConfig.allowedEmojis;
292
+ const isAllowed = (emoji) => allowed === undefined || allowed.length === 0 ? true : allowed.includes(emoji);
293
+ pack.schemas = {
294
+ ...pack.schemas ?? {},
295
+ [reactionsTable]: {
296
+ fields: {
297
+ actorId: field.string,
298
+ commentId: field.string,
299
+ createdAt: field.number,
300
+ emoji: field.string,
301
+ id: field.string
302
+ }
303
+ }
304
+ };
305
+ pack.readers = {
306
+ ...pack.readers ?? {},
307
+ [reactionsTable]: reactionReader
308
+ };
309
+ pack.writers = {
310
+ ...pack.writers ?? {},
311
+ [reactionsTable]: reactionWriter
312
+ };
313
+ pack.permissions = {
314
+ ...pack.permissions ?? {},
315
+ [reactionsTable]: {
316
+ read: (ctx, row) => {
317
+ const comment = store.getById(row.commentId);
318
+ if (comment === undefined)
319
+ return false;
320
+ return canReadResource(comment.resourceId, ctx);
321
+ },
322
+ insert: (ctx, row) => {
323
+ const callerId = getActorId(ctx);
324
+ return callerId !== undefined && row.actorId === callerId;
325
+ },
326
+ update: (ctx, row) => {
327
+ const callerId = getActorId(ctx);
328
+ return callerId !== undefined && row.actorId === callerId;
329
+ },
330
+ delete: (ctx, row) => {
331
+ const callerId = getActorId(ctx);
332
+ if (callerId === undefined)
333
+ return false;
334
+ if (row.actorId !== undefined) {
335
+ return row.actorId === callerId;
336
+ }
337
+ const id = row.id;
338
+ if (id === undefined)
339
+ return false;
340
+ return reactionStore.get(id)?.actorId === callerId;
341
+ }
342
+ }
343
+ };
344
+ pack.collections = [
345
+ ...pack.collections ?? [],
346
+ defineCollection({
347
+ name: reactionsCollectionName,
348
+ tables: [reactionsTable],
349
+ key: (row) => row.id,
350
+ hydrate: (params, ctx) => {
351
+ const comment = store.getById(params.commentId);
352
+ if (comment === undefined || !canReadResource(comment.resourceId, ctx)) {
353
+ return [];
354
+ }
355
+ return reactionReader.all(ctx).filter((row) => row.commentId === params.commentId);
356
+ },
357
+ match: (row, params, ctx) => {
358
+ if (row.commentId !== params.commentId)
359
+ return false;
360
+ const comment = store.getById(params.commentId);
361
+ return comment !== undefined && canReadResource(comment.resourceId, ctx);
362
+ },
363
+ authorize: (params, ctx) => {
364
+ const comment = store.getById(params.commentId);
365
+ return comment !== undefined && canReadResource(comment.resourceId, ctx);
366
+ }
367
+ })
368
+ ];
369
+ pack.mutations = [
370
+ ...pack.mutations ?? [],
371
+ defineMutation({
372
+ name: reactMutationName,
373
+ handler: async (args, ctx, actions) => {
374
+ if (!isAllowed(args.emoji)) {
375
+ throw new CommentReactionNotAllowedError(args.emoji);
376
+ }
377
+ const actorId = resolveActor(getActorId, ctx);
378
+ const comment = store.getById(args.commentId);
379
+ if (comment === undefined) {
380
+ throw new UnauthorizedError(`comments:react on missing comment "${args.commentId}"`);
381
+ }
382
+ if (!canReadResource(comment.resourceId, ctx)) {
383
+ throw new UnauthorizedError(`comments:react on comment "${args.commentId}" (no read access)`);
384
+ }
385
+ const id = reactionId(args.commentId, actorId, args.emoji);
386
+ const existing = reactionStore.get(id);
387
+ if (existing !== undefined)
388
+ return existing;
389
+ const row = {
390
+ actorId,
391
+ commentId: args.commentId,
392
+ createdAt: now(),
393
+ emoji: args.emoji,
394
+ id
395
+ };
396
+ return await actions.insert(reactionsTable, row);
397
+ }
398
+ }),
399
+ defineMutation({
400
+ name: unreactMutationName,
401
+ handler: async (args, ctx, actions) => {
402
+ const actorId = resolveActor(getActorId, ctx);
403
+ const id = reactionId(args.commentId, actorId, args.emoji);
404
+ if (reactionStore.get(id) === undefined)
405
+ return;
406
+ await actions.delete(reactionsTable, { id });
407
+ }
408
+ }),
409
+ defineMutation({
410
+ name: toggleReactionMutationName,
411
+ handler: async (args, ctx, actions) => {
412
+ if (!isAllowed(args.emoji)) {
413
+ throw new CommentReactionNotAllowedError(args.emoji);
414
+ }
415
+ const actorId = resolveActor(getActorId, ctx);
416
+ const comment = store.getById(args.commentId);
417
+ if (comment === undefined) {
418
+ throw new UnauthorizedError(`comments:toggleReaction on missing comment "${args.commentId}"`);
419
+ }
420
+ if (!canReadResource(comment.resourceId, ctx)) {
421
+ throw new UnauthorizedError(`comments:toggleReaction on comment "${args.commentId}" (no read access)`);
422
+ }
423
+ const id = reactionId(args.commentId, actorId, args.emoji);
424
+ const existing = reactionStore.get(id);
425
+ if (existing === undefined) {
426
+ const row = {
427
+ actorId,
428
+ commentId: args.commentId,
429
+ createdAt: now(),
430
+ emoji: args.emoji,
431
+ id
432
+ };
433
+ await actions.insert(reactionsTable, row);
434
+ return { reacted: true };
435
+ }
436
+ await actions.delete(reactionsTable, { id });
437
+ return { reacted: false };
438
+ }
439
+ })
440
+ ];
441
+ }
257
442
  return defineSyncPack(pack);
258
443
  };
259
444
  export {
260
445
  createInMemoryCommentsStore,
261
446
  createCommentsPack,
447
+ CommentReactionNotAllowedError,
262
448
  CommentParentMismatchError,
263
449
  CommentDepthExceededError
264
450
  };
265
451
 
266
- //# debugId=04A2B1840A2D711C64756E2164756E21
452
+ //# debugId=E866CDC5A3F3646264756E2164756E21
267
453
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * `@absolutejs/sync-pack-comments` — threaded comments on host-side resources\n * as a sync pack.\n *\n * Owns a single `comments` table. Per-resource read access is gated through\n * host-injected `canReadResource(resourceId, ctx)`. Edits are author-only;\n * deletes are author or moderator. Optional `bodyCrdt` config wires the\n * body field through `registerCrdt` for conflict-free editing. Optional\n * `joinUsers` config registers a `comments-with-author` join collection\n * that pairs each comment with the host's user row.\n *\n * @example\n * ```ts\n * import { createSyncEngine } from '@absolutejs/sync/engine';\n * import { createCommentsPack } from '@absolutejs/sync-pack-comments';\n *\n * const engine = createSyncEngine();\n * engine.registerPack(createCommentsPack({\n * getActorId: (ctx) => ctx.session.userId,\n * canReadResource: (resourceId, ctx) =>\n * hostAcl.canRead(resourceId, ctx.session.userId),\n * maxDepth: 8,\n * }));\n * ```\n */\n\nimport {\n\tcreateTextIndex,\n\tdefineCollection,\n\tdefineJoinCollection,\n\tdefineMutation,\n\tdefineSchema,\n\tdefineSearchCollection,\n\tdefineSyncPack,\n\tfield,\n\tUnauthorizedError,\n\ttype CollectionContext,\n\ttype CrdtMergeable,\n\ttype SyncPack,\n\ttype TableReader,\n\ttype TableWriter\n} from '@absolutejs/sync/engine';\n\n/** A comment row stored in the pack's owned table. */\nexport type CommentRow = {\n\tid: string;\n\tresourceId: string;\n\t/** Null on top-level comments, the parent's id on replies. */\n\tparentCommentId: string | null;\n\tauthorId: string;\n\tbody: string;\n\t/** Depth in the thread (0 for top-level, parent.depth + 1 for replies). */\n\tdepth: number;\n\tcreatedAt: number;\n\t/** Null until the comment is edited; otherwise the timestamp of the most\n\t * recent edit. */\n\teditedAt: number | null;\n};\n\n/** Storage adapter the pack uses for the comments table. */\nexport type CommentsStore = {\n\treader: TableReader<CollectionContext>;\n\twriter: TableWriter<CommentRow, CollectionContext, unknown>;\n\t/** Lookup by row id; used by edit + delete mutations to verify ownership\n\t * and by create to walk the parent chain for depth math. */\n\tgetById: (id: string) => CommentRow | undefined;\n};\n\n/** Default in-memory store. Each pack instance creates its own. */\nexport const createInMemoryCommentsStore = (): CommentsStore => {\n\tconst rows = new Map<string, CommentRow>();\n\treturn {\n\t\tgetById: (id) => rows.get(id),\n\t\treader: {\n\t\t\tall: () => [...rows.values()]\n\t\t},\n\t\twriter: {\n\t\t\tdelete: (row) => {\n\t\t\t\trows.delete((row as { id: string }).id);\n\t\t\t},\n\t\t\tinsert: (data) => {\n\t\t\t\trows.set(data.id, data);\n\t\t\t\treturn data;\n\t\t\t},\n\t\t\tupdate: (data) => {\n\t\t\t\tconst prior = rows.get(data.id);\n\t\t\t\tconst merged = { ...(prior ?? {}), ...data } as CommentRow;\n\t\t\t\trows.set(data.id, merged);\n\t\t\t\treturn merged;\n\t\t\t}\n\t\t}\n\t};\n};\n\n/** Thrown when a reply would exceed the configured `maxDepth`. */\nexport class CommentDepthExceededError extends Error {\n\treadonly maxDepth: number;\n\treadonly attemptedDepth: number;\n\tconstructor(maxDepth: number, attemptedDepth: number) {\n\t\tsuper(\n\t\t\t`Comment reply rejected: depth ${attemptedDepth} exceeds maxDepth ${maxDepth}`\n\t\t);\n\t\tthis.name = 'CommentDepthExceededError';\n\t\tthis.maxDepth = maxDepth;\n\t\tthis.attemptedDepth = attemptedDepth;\n\t}\n}\n\n/** Thrown when the requested parent comment doesn't exist or doesn't match. */\nexport class CommentParentMismatchError extends Error {\n\treadonly parentCommentId: string;\n\tconstructor(parentCommentId: string) {\n\t\tsuper(\n\t\t\t`Parent comment ${parentCommentId} not found, or its resourceId doesn't match the reply's resourceId`\n\t\t);\n\t\tthis.name = 'CommentParentMismatchError';\n\t\tthis.parentCommentId = parentCommentId;\n\t}\n}\n\n/** Factory config. `canReadResource` is the only required field. */\nexport type CommentsPackConfig<\n\tCtx = CollectionContext,\n\tAuthorRow = unknown\n> = {\n\t/**\n\t * Prefix applied to the owned table name AND every collection/mutation\n\t * the pack exposes. Default `\"\"`. Use a non-empty prefix when\n\t * registering multiple comments packs on one engine (e.g. one per\n\t * product surface).\n\t */\n\tprefix?: string;\n\t/**\n\t * Extract the current actor id from the app's ctx. Default:\n\t * `(ctx) => ctx.userId`. **This is the only contract the pack assumes\n\t * about the app's ctx**, alongside `canReadResource` / `canModerate`.\n\t */\n\tgetActorId?: (ctx: Ctx) => string | undefined;\n\t/**\n\t * Gate read access on a resource. The host knows which resources a\n\t * given ctx can read — the pack does NOT duplicate the host's ACL.\n\t * Required: pack reads return zero rows otherwise.\n\t */\n\tcanReadResource: (resourceId: string, ctx: Ctx) => boolean;\n\t/**\n\t * Optional moderation predicate. Used by `comments:delete` — author OR\n\t * moderator can delete. Default `() => false` (only authors delete).\n\t */\n\tcanModerate?: (ctx: Ctx) => boolean;\n\t/**\n\t * Maximum thread depth (top-level = 0, first reply = 1, ...). Replies\n\t * past this depth reject with {@link CommentDepthExceededError}.\n\t * Default `8`.\n\t */\n\tmaxDepth?: number;\n\t/**\n\t * When provided, register the comment row's `body` field as a CRDT via\n\t * `engine.registerCrdt`. The engine then merges concurrent edits\n\t * instead of overwriting. Typically `yjsText` from\n\t * `@absolutejs/sync-yjs` — the pack does NOT import Yjs; the host\n\t * provides the mergeable.\n\t */\n\tbodyCrdt?: CrdtMergeable<unknown>;\n\t/**\n\t * Override the storage adapter. Default: a per-instance in-memory\n\t * store. Pass your own for a persistent backend (Drizzle, Postgres,\n\t * Redis, ...).\n\t */\n\tstore?: CommentsStore;\n\t/** Wall-clock function. Default `Date.now`. */\n\tnow?: () => number;\n\t/**\n\t * Generate a fresh row id. Default `crypto.randomUUID()`. Override for\n\t * deterministic ids in tests, or to route through your existing id\n\t * scheme.\n\t */\n\tnewId?: () => string;\n\t/**\n\t * When set, the pack additionally registers a `comments-with-author`\n\t * join collection. The host's user table must have a registered\n\t * reader/writer (so user-row changes propagate into the join). The\n\t * pack itself does NOT own the users table; it only `readsTables`\n\t * the configured name.\n\t */\n\tjoinUsers?: JoinUsersConfig<Ctx, AuthorRow>;\n\t/**\n\t * When set, register a `comments-search` full-text search collection\n\t * over the body field. The subscription's `params` is the query string;\n\t * results are the ranked top-K, re-ranked live as comments are added,\n\t * edited, or removed. Per-row read permission (which routes through\n\t * `canReadResource`) still filters hits per caller.\n\t */\n\tsearch?: { topK?: number };\n};\n\n/**\n * Config for the optional `comments-with-author` join collection.\n *\n * The pack does not own the host's user table. The host supplies the\n * right-side hydrate (typically reading from its registered reader) and\n * the join key. The engine maintains the join incrementally — changes to\n * either side fan in through `engine.applyChange`.\n */\nexport type JoinUsersConfig<Ctx, AuthorRow = unknown> = {\n\t/**\n\t * The host's user table name. Surfaced in `readsTables` so the\n\t * dependency graph is reviewable. Default `\"users\"`.\n\t */\n\ttable?: string;\n\t/**\n\t * Get the user's id (the join field). Default `(user) => user.id`.\n\t */\n\tkey?: (user: AuthorRow) => string;\n\t/**\n\t * Host-side hydrate for the users side of the join. The pack passes\n\t * the subscription params + ctx; this returns the candidate users.\n\t * Returning all users (small set) or just the authors referenced by\n\t * the comments are both fine — the engine inner-joins on `authorId\n\t * === id` after hydrate.\n\t */\n\thydrate: (\n\t\tparams: { resourceId: string },\n\t\tctx: Ctx\n\t) => Iterable<AuthorRow> | Promise<Iterable<AuthorRow>>;\n};\n\n/** A joined row emitted by the `comments-with-author` collection. */\nexport type CommentWithAuthor<AuthorRow = unknown> = CommentRow & {\n\tauthor: AuthorRow;\n};\n\nconst DEFAULT_MAX_DEPTH = 8;\nconst DEFAULT_USER_TABLE = 'users';\n\nconst resolveActor = (\n\tgetActorId: NonNullable<CommentsPackConfig['getActorId']>,\n\tctx: unknown\n): string => {\n\tconst actorId = getActorId(ctx as CollectionContext);\n\tif (actorId === undefined || actorId === '') {\n\t\tthrow new UnauthorizedError('comments mutation (no actor id)');\n\t}\n\treturn actorId;\n};\n\n/**\n * Build a {@link SyncPack} that exposes threaded comments. Each call returns\n * a fresh pack with its own store (unless a custom `store` is supplied).\n *\n * The `AuthorRow` generic is only consulted by the\n * `comments-with-author` join collection (when `joinUsers` is set); pass\n * it to recover types for the joined output. With no `joinUsers`, default\n * `unknown` is fine.\n */\nexport const createCommentsPack = <\n\tCtx = CollectionContext,\n\tAuthorRow = unknown\n>(\n\tconfig: CommentsPackConfig<Ctx, AuthorRow>\n): SyncPack => {\n\tconst prefix = config.prefix ?? '';\n\tconst table = `${prefix}comments`;\n\tconst collectionName = table;\n\tconst createMutationName = `${prefix}comments:create`;\n\tconst editMutationName = `${prefix}comments:edit`;\n\tconst deleteMutationName = `${prefix}comments:delete`;\n\tconst maxDepth = config.maxDepth ?? DEFAULT_MAX_DEPTH;\n\tconst store = config.store ?? createInMemoryCommentsStore();\n\tconst now = config.now ?? Date.now;\n\tconst newId =\n\t\tconfig.newId ?? (() => globalThis.crypto.randomUUID());\n\tconst getActorId = (config.getActorId ??\n\t\t((ctx: CollectionContext) =>\n\t\t\t(ctx as { userId?: string }).userId)) as (\n\t\tctx: CollectionContext\n\t) => string | undefined;\n\tconst canReadResource = config.canReadResource as (\n\t\tresourceId: string,\n\t\tctx: CollectionContext\n\t) => boolean;\n\tconst canModerate = (config.canModerate ?? (() => false)) as (\n\t\tctx: CollectionContext\n\t) => boolean;\n\n\ttype Params = { resourceId: string };\n\n\tconst joinUsers = config.joinUsers;\n\tconst userTable = joinUsers?.table ?? DEFAULT_USER_TABLE;\n\tconst joinCollectionName = `${prefix}comments-with-author`;\n\tconst userKey = (joinUsers?.key ?? ((row: unknown) =>\n\t\t(row as { id: string }).id)) as (user: unknown) => string;\n\tconst search = config.search;\n\tconst searchCollectionName = `${prefix}comments-search`;\n\tconst searchTopK = search?.topK ?? 20;\n\n\tconst pack: SyncPack = {\n\t\tname: '@absolutejs/sync-pack-comments',\n\t\townsTables: [table],\n\t\treadsTables: joinUsers === undefined ? [] : [userTable],\n\t\tversion: '0.3.0',\n\n\t\tschemas: defineSchema({\n\t\t\t[table]: {\n\t\t\t\tfields: {\n\t\t\t\t\tid: field.string,\n\t\t\t\t\tresourceId: field.string,\n\t\t\t\t\tparentCommentId: (value) =>\n\t\t\t\t\t\tvalue === null || typeof value === 'string',\n\t\t\t\t\tauthorId: field.string,\n\t\t\t\t\tbody: field.string,\n\t\t\t\t\tdepth: field.number,\n\t\t\t\t\tcreatedAt: field.number,\n\t\t\t\t\teditedAt: (value) =>\n\t\t\t\t\t\tvalue === null || typeof value === 'number'\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\n\t\treaders: { [table]: store.reader },\n\t\twriters: { [table]: store.writer },\n\n\t\tpermissions: {\n\t\t\t[table]: {\n\t\t\t\tread: (ctx: unknown, row: CommentRow) =>\n\t\t\t\t\tcanReadResource(row.resourceId, ctx as CollectionContext),\n\t\t\t\t// The pack's own create handler stamps `authorId` from the\n\t\t\t\t// resolved actor, so this check passes inside the pack.\n\t\t\t\t// A host-side `actions.insert(\"comments\", { ... })` that\n\t\t\t\t// tried to forge an `authorId` would be rejected here.\n\t\t\t\tinsert: (ctx: unknown, row: CommentRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\treturn callerId !== undefined && row.authorId === callerId;\n\t\t\t\t},\n\t\t\t\t// Edits: author only. Same row-level check as insert.\n\t\t\t\tupdate: (ctx: unknown, row: CommentRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\treturn callerId !== undefined && row.authorId === callerId;\n\t\t\t\t},\n\t\t\t\t// Deletes: author OR moderator. `actions.delete` may pass\n\t\t\t\t// the full row or just the key; if `authorId` isn't in the\n\t\t\t\t// supplied subject we look it up from the store.\n\t\t\t\tdelete: (ctx: unknown, row: CommentRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\tif (callerId === undefined) return false;\n\t\t\t\t\tconst authorId =\n\t\t\t\t\t\t(row as { authorId?: string }).authorId ??\n\t\t\t\t\t\t(() => {\n\t\t\t\t\t\t\tconst id = (row as { id?: string }).id;\n\t\t\t\t\t\t\treturn id === undefined\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: store.getById(id)?.authorId;\n\t\t\t\t\t\t})();\n\t\t\t\t\tif (authorId === undefined) return false;\n\t\t\t\t\tif (authorId === callerId) return true;\n\t\t\t\t\treturn canModerate(ctx as CollectionContext);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tcollections: [\n\t\t\tdefineCollection<CommentRow, Params, CollectionContext>({\n\t\t\t\tname: collectionName,\n\t\t\t\ttables: [table],\n\t\t\t\tkey: (row) => row.id,\n\t\t\t\thydrate: (params, ctx) =>\n\t\t\t\t\t(store.reader.all(ctx) as CommentRow[]).filter(\n\t\t\t\t\t\t(row) =>\n\t\t\t\t\t\t\trow.resourceId === params.resourceId &&\n\t\t\t\t\t\t\tcanReadResource(row.resourceId, ctx)\n\t\t\t\t\t),\n\t\t\t\tmatch: (row, params, ctx) =>\n\t\t\t\t\trow.resourceId === params.resourceId &&\n\t\t\t\t\tcanReadResource(row.resourceId, ctx),\n\t\t\t\tauthorize: (params, ctx) =>\n\t\t\t\t\tcanReadResource(params.resourceId, ctx)\n\t\t\t})\n\t\t],\n\n\t\tmutations: [\n\t\t\tdefineMutation<\n\t\t\t\t{\n\t\t\t\t\tresourceId: string;\n\t\t\t\t\tbody: string;\n\t\t\t\t\tparentCommentId?: string | null;\n\t\t\t\t},\n\t\t\t\tCollectionContext,\n\t\t\t\tCommentRow\n\t\t\t>({\n\t\t\t\tname: createMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tif (!canReadResource(args.resourceId, ctx)) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:create on resource \"${args.resourceId}\"`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tlet depth = 0;\n\t\t\t\t\tif (\n\t\t\t\t\t\targs.parentCommentId !== undefined &&\n\t\t\t\t\t\targs.parentCommentId !== null\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst parent = store.getById(args.parentCommentId);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tparent === undefined ||\n\t\t\t\t\t\t\tparent.resourceId !== args.resourceId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new CommentParentMismatchError(\n\t\t\t\t\t\t\t\targs.parentCommentId\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdepth = parent.depth + 1;\n\t\t\t\t\t\tif (depth > maxDepth) {\n\t\t\t\t\t\t\tthrow new CommentDepthExceededError(\n\t\t\t\t\t\t\t\tmaxDepth,\n\t\t\t\t\t\t\t\tdepth\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst row: CommentRow = {\n\t\t\t\t\t\tid: newId(),\n\t\t\t\t\t\tresourceId: args.resourceId,\n\t\t\t\t\t\tparentCommentId: args.parentCommentId ?? null,\n\t\t\t\t\t\tauthorId: actorId,\n\t\t\t\t\t\tbody: args.body,\n\t\t\t\t\t\tdepth,\n\t\t\t\t\t\tcreatedAt: now(),\n\t\t\t\t\t\teditedAt: null\n\t\t\t\t\t};\n\t\t\t\t\treturn (await actions.insert(table, row)) as CommentRow;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tdefineMutation<\n\t\t\t\t{ commentId: string; body: string },\n\t\t\t\tCollectionContext,\n\t\t\t\tCommentRow\n\t\t\t>({\n\t\t\t\tname: editMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst existing = store.getById(args.commentId);\n\t\t\t\t\tif (existing === undefined) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:edit on missing comment \"${args.commentId}\"`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (existing.authorId !== actorId) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:edit on \"${args.commentId}\" (not author)`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst updated: CommentRow = {\n\t\t\t\t\t\t...existing,\n\t\t\t\t\t\tbody: args.body,\n\t\t\t\t\t\teditedAt: now()\n\t\t\t\t\t};\n\t\t\t\t\treturn (await actions.update(table, updated)) as CommentRow;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tdefineMutation<{ commentId: string }, CollectionContext, void>({\n\t\t\t\tname: deleteMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst existing = store.getById(args.commentId);\n\t\t\t\t\tif (existing === undefined) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:delete on missing comment \"${args.commentId}\"`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst isAuthor = existing.authorId === actorId;\n\t\t\t\t\tconst isModerator = canModerate(ctx);\n\t\t\t\t\tif (!isAuthor && !isModerator) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:delete on \"${args.commentId}\" (not author, not moderator)`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tawait actions.delete(table, { id: args.commentId });\n\t\t\t\t}\n\t\t\t})\n\t\t]\n\t};\n\n\tif (config.bodyCrdt !== undefined) {\n\t\tpack.crdt = { [table]: { body: config.bodyCrdt } };\n\t}\n\n\tif (search !== undefined) {\n\t\tpack.searchCollections = [\n\t\t\tdefineSearchCollection<CommentRow>({\n\t\t\t\tname: searchCollectionName,\n\t\t\t\ttable,\n\t\t\t\tindex: () =>\n\t\t\t\t\tcreateTextIndex<CommentRow>({\n\t\t\t\t\t\tfields: ['body'],\n\t\t\t\t\t\tkey: (row) => row.id\n\t\t\t\t\t}),\n\t\t\t\tkey: (row) => row.id,\n\t\t\t\tlimit: searchTopK,\n\t\t\t\tsource: () =>\n\t\t\t\t\tstore.reader.all({}) as Iterable<CommentRow>\n\t\t\t})\n\t\t];\n\t}\n\n\tif (joinUsers !== undefined) {\n\t\tconst usersHydrate = joinUsers.hydrate;\n\t\tpack.joinCollections = [\n\t\t\tdefineJoinCollection<\n\t\t\t\tCommentRow,\n\t\t\t\tunknown,\n\t\t\t\tCommentWithAuthor,\n\t\t\t\tParams,\n\t\t\t\tCollectionContext\n\t\t\t>({\n\t\t\t\tname: joinCollectionName,\n\t\t\t\tkey: (out) => out.id,\n\t\t\t\tleft: {\n\t\t\t\t\ttable,\n\t\t\t\t\thydrate: (params, ctx) =>\n\t\t\t\t\t\t(store.reader.all(ctx) as CommentRow[]).filter(\n\t\t\t\t\t\t\t(row) =>\n\t\t\t\t\t\t\t\trow.resourceId === params.resourceId &&\n\t\t\t\t\t\t\t\tcanReadResource(row.resourceId, ctx)\n\t\t\t\t\t\t),\n\t\t\t\t\tkey: (row) => row.id,\n\t\t\t\t\ton: (row) => row.authorId,\n\t\t\t\t\t// Per-resource read gate, also applied to incoming changes.\n\t\t\t\t\tmatch: (row, params, ctx) =>\n\t\t\t\t\t\trow.resourceId === params.resourceId &&\n\t\t\t\t\t\tcanReadResource(row.resourceId, ctx)\n\t\t\t\t},\n\t\t\t\tright: {\n\t\t\t\t\ttable: userTable,\n\t\t\t\t\thydrate: (params, ctx) =>\n\t\t\t\t\t\tusersHydrate(params, ctx as Ctx) as Iterable<unknown>,\n\t\t\t\t\tkey: (user) => userKey(user),\n\t\t\t\t\ton: (user) => userKey(user)\n\t\t\t\t},\n\t\t\t\tselect: (comment, author) => ({ ...comment, author }),\n\t\t\t\tauthorize: (params, ctx) =>\n\t\t\t\t\tcanReadResource(params.resourceId, ctx)\n\t\t\t})\n\t\t];\n\t}\n\n\treturn defineSyncPack(pack);\n};\n"
5
+ "/**\n * `@absolutejs/sync-pack-comments` — threaded comments on host-side resources\n * as a sync pack.\n *\n * Owns a single `comments` table. Per-resource read access is gated through\n * host-injected `canReadResource(resourceId, ctx)`. Edits are author-only;\n * deletes are author or moderator. Optional `bodyCrdt` config wires the\n * body field through `registerCrdt` for conflict-free editing. Optional\n * `joinUsers` config registers a `comments-with-author` join collection\n * that pairs each comment with the host's user row.\n *\n * @example\n * ```ts\n * import { createSyncEngine } from '@absolutejs/sync/engine';\n * import { createCommentsPack } from '@absolutejs/sync-pack-comments';\n *\n * const engine = createSyncEngine();\n * engine.registerPack(createCommentsPack({\n * getActorId: (ctx) => ctx.session.userId,\n * canReadResource: (resourceId, ctx) =>\n * hostAcl.canRead(resourceId, ctx.session.userId),\n * maxDepth: 8,\n * }));\n * ```\n */\n\nimport {\n\tcreateTextIndex,\n\tdefineCollection,\n\tdefineJoinCollection,\n\tdefineMutation,\n\tdefineSchema,\n\tdefineSearchCollection,\n\tdefineSyncPack,\n\tfield,\n\tUnauthorizedError,\n\ttype CollectionContext,\n\ttype CrdtMergeable,\n\ttype SyncPack,\n\ttype TableReader,\n\ttype TableWriter\n} from '@absolutejs/sync/engine';\n\n/** A comment row stored in the pack's owned table. */\nexport type CommentRow = {\n\tid: string;\n\tresourceId: string;\n\t/** Null on top-level comments, the parent's id on replies. */\n\tparentCommentId: string | null;\n\tauthorId: string;\n\tbody: string;\n\t/** Depth in the thread (0 for top-level, parent.depth + 1 for replies). */\n\tdepth: number;\n\tcreatedAt: number;\n\t/** Null until the comment is edited; otherwise the timestamp of the most\n\t * recent edit. */\n\teditedAt: number | null;\n};\n\n/** Storage adapter the pack uses for the comments table. */\nexport type CommentsStore = {\n\treader: TableReader<CollectionContext>;\n\twriter: TableWriter<CommentRow, CollectionContext, unknown>;\n\t/** Lookup by row id; used by edit + delete mutations to verify ownership\n\t * and by create to walk the parent chain for depth math. */\n\tgetById: (id: string) => CommentRow | undefined;\n};\n\n/** Default in-memory store. Each pack instance creates its own. */\nexport const createInMemoryCommentsStore = (): CommentsStore => {\n\tconst rows = new Map<string, CommentRow>();\n\treturn {\n\t\tgetById: (id) => rows.get(id),\n\t\treader: {\n\t\t\tall: () => [...rows.values()]\n\t\t},\n\t\twriter: {\n\t\t\tdelete: (row) => {\n\t\t\t\trows.delete((row as { id: string }).id);\n\t\t\t},\n\t\t\tinsert: (data) => {\n\t\t\t\trows.set(data.id, data);\n\t\t\t\treturn data;\n\t\t\t},\n\t\t\tupdate: (data) => {\n\t\t\t\tconst prior = rows.get(data.id);\n\t\t\t\tconst merged = { ...(prior ?? {}), ...data } as CommentRow;\n\t\t\t\trows.set(data.id, merged);\n\t\t\t\treturn merged;\n\t\t\t}\n\t\t}\n\t};\n};\n\n/** Thrown when a reply would exceed the configured `maxDepth`. */\nexport class CommentDepthExceededError extends Error {\n\treadonly maxDepth: number;\n\treadonly attemptedDepth: number;\n\tconstructor(maxDepth: number, attemptedDepth: number) {\n\t\tsuper(\n\t\t\t`Comment reply rejected: depth ${attemptedDepth} exceeds maxDepth ${maxDepth}`\n\t\t);\n\t\tthis.name = 'CommentDepthExceededError';\n\t\tthis.maxDepth = maxDepth;\n\t\tthis.attemptedDepth = attemptedDepth;\n\t}\n}\n\n/** Thrown when the requested parent comment doesn't exist or doesn't match. */\nexport class CommentParentMismatchError extends Error {\n\treadonly parentCommentId: string;\n\tconstructor(parentCommentId: string) {\n\t\tsuper(\n\t\t\t`Parent comment ${parentCommentId} not found, or its resourceId doesn't match the reply's resourceId`\n\t\t);\n\t\tthis.name = 'CommentParentMismatchError';\n\t\tthis.parentCommentId = parentCommentId;\n\t}\n}\n\n/** Factory config. `canReadResource` is the only required field. */\nexport type CommentsPackConfig<\n\tCtx = CollectionContext,\n\tAuthorRow = unknown\n> = {\n\t/**\n\t * Prefix applied to the owned table name AND every collection/mutation\n\t * the pack exposes. Default `\"\"`. Use a non-empty prefix when\n\t * registering multiple comments packs on one engine (e.g. one per\n\t * product surface).\n\t */\n\tprefix?: string;\n\t/**\n\t * Extract the current actor id from the app's ctx. Default:\n\t * `(ctx) => ctx.userId`. **This is the only contract the pack assumes\n\t * about the app's ctx**, alongside `canReadResource` / `canModerate`.\n\t */\n\tgetActorId?: (ctx: Ctx) => string | undefined;\n\t/**\n\t * Gate read access on a resource. The host knows which resources a\n\t * given ctx can read — the pack does NOT duplicate the host's ACL.\n\t * Required: pack reads return zero rows otherwise.\n\t */\n\tcanReadResource: (resourceId: string, ctx: Ctx) => boolean;\n\t/**\n\t * Optional moderation predicate. Used by `comments:delete` — author OR\n\t * moderator can delete. Default `() => false` (only authors delete).\n\t */\n\tcanModerate?: (ctx: Ctx) => boolean;\n\t/**\n\t * Maximum thread depth (top-level = 0, first reply = 1, ...). Replies\n\t * past this depth reject with {@link CommentDepthExceededError}.\n\t * Default `8`.\n\t */\n\tmaxDepth?: number;\n\t/**\n\t * When provided, register the comment row's `body` field as a CRDT via\n\t * `engine.registerCrdt`. The engine then merges concurrent edits\n\t * instead of overwriting. Typically `yjsText` from\n\t * `@absolutejs/sync-yjs` — the pack does NOT import Yjs; the host\n\t * provides the mergeable.\n\t */\n\tbodyCrdt?: CrdtMergeable<unknown>;\n\t/**\n\t * Override the storage adapter. Default: a per-instance in-memory\n\t * store. Pass your own for a persistent backend (Drizzle, Postgres,\n\t * Redis, ...).\n\t */\n\tstore?: CommentsStore;\n\t/** Wall-clock function. Default `Date.now`. */\n\tnow?: () => number;\n\t/**\n\t * Generate a fresh row id. Default `crypto.randomUUID()`. Override for\n\t * deterministic ids in tests, or to route through your existing id\n\t * scheme.\n\t */\n\tnewId?: () => string;\n\t/**\n\t * When set, the pack additionally registers a `comments-with-author`\n\t * join collection. The host's user table must have a registered\n\t * reader/writer (so user-row changes propagate into the join). The\n\t * pack itself does NOT own the users table; it only `readsTables`\n\t * the configured name.\n\t */\n\tjoinUsers?: JoinUsersConfig<Ctx, AuthorRow>;\n\t/**\n\t * When set, register a `comments-search` full-text search collection\n\t * over the body field. The subscription's `params` is the query string;\n\t * results are the ranked top-K, re-ranked live as comments are added,\n\t * edited, or removed. Per-row read permission (which routes through\n\t * `canReadResource`) still filters hits per caller.\n\t */\n\tsearch?: { topK?: number };\n\t/**\n\t * When set, register a `comment_reactions` table + matching collection\n\t * + react / unreact / toggleReaction mutations. Each row is one\n\t * actor's reaction with a single emoji on a single comment, deterministic\n\t * id `${commentId}:${actorId}:${emoji}` for idempotent toggling.\n\t */\n\treactions?: ReactionsConfig;\n};\n\n/** Config for the optional reactions surface. */\nexport type ReactionsConfig = {\n\t/**\n\t * Allowed emojis. Setting this filters react mutations — anything\n\t * outside the list is rejected. Empty array (default) means any\n\t * single-character or grapheme string is accepted.\n\t */\n\tallowedEmojis?: string[];\n\t/**\n\t * Custom row id generator for reaction rows. Default\n\t * `(commentId, actorId, emoji) => \\`${commentId}:${actorId}:${emoji}\\``.\n\t */\n\tnewId?: (\n\t\tcommentId: string,\n\t\tactorId: string,\n\t\temoji: string\n\t) => string;\n};\n\n/** A reaction row — one per (comment, actor, emoji). */\nexport type CommentReactionRow = {\n\tid: string;\n\tcommentId: string;\n\tactorId: string;\n\temoji: string;\n\tcreatedAt: number;\n};\n\n/** Thrown when a react mutation supplies an emoji outside `allowedEmojis`. */\nexport class CommentReactionNotAllowedError extends Error {\n\treadonly emoji: string;\n\tconstructor(emoji: string) {\n\t\tsuper(\n\t\t\t`Comment reaction \"${emoji}\" is not in the configured allowedEmojis`\n\t\t);\n\t\tthis.name = 'CommentReactionNotAllowedError';\n\t\tthis.emoji = emoji;\n\t}\n}\n\n/**\n * Config for the optional `comments-with-author` join collection.\n *\n * The pack does not own the host's user table. The host supplies the\n * right-side hydrate (typically reading from its registered reader) and\n * the join key. The engine maintains the join incrementally — changes to\n * either side fan in through `engine.applyChange`.\n */\nexport type JoinUsersConfig<Ctx, AuthorRow = unknown> = {\n\t/**\n\t * The host's user table name. Surfaced in `readsTables` so the\n\t * dependency graph is reviewable. Default `\"users\"`.\n\t */\n\ttable?: string;\n\t/**\n\t * Get the user's id (the join field). Default `(user) => user.id`.\n\t */\n\tkey?: (user: AuthorRow) => string;\n\t/**\n\t * Host-side hydrate for the users side of the join. The pack passes\n\t * the subscription params + ctx; this returns the candidate users.\n\t * Returning all users (small set) or just the authors referenced by\n\t * the comments are both fine — the engine inner-joins on `authorId\n\t * === id` after hydrate.\n\t */\n\thydrate: (\n\t\tparams: { resourceId: string },\n\t\tctx: Ctx\n\t) => Iterable<AuthorRow> | Promise<Iterable<AuthorRow>>;\n};\n\n/** A joined row emitted by the `comments-with-author` collection. */\nexport type CommentWithAuthor<AuthorRow = unknown> = CommentRow & {\n\tauthor: AuthorRow;\n};\n\nconst DEFAULT_MAX_DEPTH = 8;\nconst DEFAULT_USER_TABLE = 'users';\n\nconst resolveActor = (\n\tgetActorId: NonNullable<CommentsPackConfig['getActorId']>,\n\tctx: unknown\n): string => {\n\tconst actorId = getActorId(ctx as CollectionContext);\n\tif (actorId === undefined || actorId === '') {\n\t\tthrow new UnauthorizedError('comments mutation (no actor id)');\n\t}\n\treturn actorId;\n};\n\n/**\n * Build a {@link SyncPack} that exposes threaded comments. Each call returns\n * a fresh pack with its own store (unless a custom `store` is supplied).\n *\n * The `AuthorRow` generic is only consulted by the\n * `comments-with-author` join collection (when `joinUsers` is set); pass\n * it to recover types for the joined output. With no `joinUsers`, default\n * `unknown` is fine.\n */\nexport const createCommentsPack = <\n\tCtx = CollectionContext,\n\tAuthorRow = unknown\n>(\n\tconfig: CommentsPackConfig<Ctx, AuthorRow>\n): SyncPack => {\n\tconst prefix = config.prefix ?? '';\n\tconst table = `${prefix}comments`;\n\tconst collectionName = table;\n\tconst createMutationName = `${prefix}comments:create`;\n\tconst editMutationName = `${prefix}comments:edit`;\n\tconst deleteMutationName = `${prefix}comments:delete`;\n\tconst maxDepth = config.maxDepth ?? DEFAULT_MAX_DEPTH;\n\tconst store = config.store ?? createInMemoryCommentsStore();\n\tconst now = config.now ?? Date.now;\n\tconst newId =\n\t\tconfig.newId ?? (() => globalThis.crypto.randomUUID());\n\tconst getActorId = (config.getActorId ??\n\t\t((ctx: CollectionContext) =>\n\t\t\t(ctx as { userId?: string }).userId)) as (\n\t\tctx: CollectionContext\n\t) => string | undefined;\n\tconst canReadResource = config.canReadResource as (\n\t\tresourceId: string,\n\t\tctx: CollectionContext\n\t) => boolean;\n\tconst canModerate = (config.canModerate ?? (() => false)) as (\n\t\tctx: CollectionContext\n\t) => boolean;\n\n\ttype Params = { resourceId: string };\n\n\tconst joinUsers = config.joinUsers;\n\tconst userTable = joinUsers?.table ?? DEFAULT_USER_TABLE;\n\tconst joinCollectionName = `${prefix}comments-with-author`;\n\tconst userKey = (joinUsers?.key ?? ((row: unknown) =>\n\t\t(row as { id: string }).id)) as (user: unknown) => string;\n\tconst search = config.search;\n\tconst searchCollectionName = `${prefix}comments-search`;\n\tconst searchTopK = search?.topK ?? 20;\n\tconst reactionsConfig = config.reactions;\n\tconst reactionsTable = `${prefix}comment_reactions`;\n\tconst reactionsCollectionName = reactionsTable;\n\tconst reactMutationName = `${prefix}comments:react`;\n\tconst unreactMutationName = `${prefix}comments:unreact`;\n\tconst toggleReactionMutationName = `${prefix}comments:toggleReaction`;\n\tconst reactionId =\n\t\treactionsConfig?.newId ??\n\t\t((commentId: string, actorId: string, emoji: string) =>\n\t\t\t`${commentId}:${actorId}:${emoji}`);\n\tconst reactionStore = new Map<string, CommentReactionRow>();\n\tconst reactionReader: TableReader<CollectionContext> = {\n\t\tall: () => [...reactionStore.values()]\n\t};\n\tconst reactionWriter: TableWriter<\n\t\tCommentReactionRow,\n\t\tCollectionContext,\n\t\tunknown\n\t> = {\n\t\tdelete: (row) => {\n\t\t\treactionStore.delete((row as { id: string }).id);\n\t\t},\n\t\tinsert: (data) => {\n\t\t\treactionStore.set(data.id, data);\n\t\t\treturn data;\n\t\t},\n\t\tupdate: (data) => {\n\t\t\treactionStore.set(data.id, data);\n\t\t\treturn data;\n\t\t}\n\t};\n\n\tconst pack: SyncPack = {\n\t\tname: '@absolutejs/sync-pack-comments',\n\t\townsTables:\n\t\t\treactionsConfig === undefined ? [table] : [table, reactionsTable],\n\t\treadsTables: joinUsers === undefined ? [] : [userTable],\n\t\tversion: '0.4.0',\n\n\t\tschemas: defineSchema({\n\t\t\t[table]: {\n\t\t\t\tfields: {\n\t\t\t\t\tid: field.string,\n\t\t\t\t\tresourceId: field.string,\n\t\t\t\t\tparentCommentId: (value) =>\n\t\t\t\t\t\tvalue === null || typeof value === 'string',\n\t\t\t\t\tauthorId: field.string,\n\t\t\t\t\tbody: field.string,\n\t\t\t\t\tdepth: field.number,\n\t\t\t\t\tcreatedAt: field.number,\n\t\t\t\t\teditedAt: (value) =>\n\t\t\t\t\t\tvalue === null || typeof value === 'number'\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\n\t\treaders: { [table]: store.reader },\n\t\twriters: { [table]: store.writer },\n\n\t\tpermissions: {\n\t\t\t[table]: {\n\t\t\t\tread: (ctx: unknown, row: CommentRow) =>\n\t\t\t\t\tcanReadResource(row.resourceId, ctx as CollectionContext),\n\t\t\t\t// The pack's own create handler stamps `authorId` from the\n\t\t\t\t// resolved actor, so this check passes inside the pack.\n\t\t\t\t// A host-side `actions.insert(\"comments\", { ... })` that\n\t\t\t\t// tried to forge an `authorId` would be rejected here.\n\t\t\t\tinsert: (ctx: unknown, row: CommentRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\treturn callerId !== undefined && row.authorId === callerId;\n\t\t\t\t},\n\t\t\t\t// Edits: author only. Same row-level check as insert.\n\t\t\t\tupdate: (ctx: unknown, row: CommentRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\treturn callerId !== undefined && row.authorId === callerId;\n\t\t\t\t},\n\t\t\t\t// Deletes: author OR moderator. `actions.delete` may pass\n\t\t\t\t// the full row or just the key; if `authorId` isn't in the\n\t\t\t\t// supplied subject we look it up from the store.\n\t\t\t\tdelete: (ctx: unknown, row: CommentRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\tif (callerId === undefined) return false;\n\t\t\t\t\tconst authorId =\n\t\t\t\t\t\t(row as { authorId?: string }).authorId ??\n\t\t\t\t\t\t(() => {\n\t\t\t\t\t\t\tconst id = (row as { id?: string }).id;\n\t\t\t\t\t\t\treturn id === undefined\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: store.getById(id)?.authorId;\n\t\t\t\t\t\t})();\n\t\t\t\t\tif (authorId === undefined) return false;\n\t\t\t\t\tif (authorId === callerId) return true;\n\t\t\t\t\treturn canModerate(ctx as CollectionContext);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tcollections: [\n\t\t\tdefineCollection<CommentRow, Params, CollectionContext>({\n\t\t\t\tname: collectionName,\n\t\t\t\ttables: [table],\n\t\t\t\tkey: (row) => row.id,\n\t\t\t\thydrate: (params, ctx) =>\n\t\t\t\t\t(store.reader.all(ctx) as CommentRow[]).filter(\n\t\t\t\t\t\t(row) =>\n\t\t\t\t\t\t\trow.resourceId === params.resourceId &&\n\t\t\t\t\t\t\tcanReadResource(row.resourceId, ctx)\n\t\t\t\t\t),\n\t\t\t\tmatch: (row, params, ctx) =>\n\t\t\t\t\trow.resourceId === params.resourceId &&\n\t\t\t\t\tcanReadResource(row.resourceId, ctx),\n\t\t\t\tauthorize: (params, ctx) =>\n\t\t\t\t\tcanReadResource(params.resourceId, ctx)\n\t\t\t})\n\t\t],\n\n\t\tmutations: [\n\t\t\tdefineMutation<\n\t\t\t\t{\n\t\t\t\t\tresourceId: string;\n\t\t\t\t\tbody: string;\n\t\t\t\t\tparentCommentId?: string | null;\n\t\t\t\t},\n\t\t\t\tCollectionContext,\n\t\t\t\tCommentRow\n\t\t\t>({\n\t\t\t\tname: createMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tif (!canReadResource(args.resourceId, ctx)) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:create on resource \"${args.resourceId}\"`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tlet depth = 0;\n\t\t\t\t\tif (\n\t\t\t\t\t\targs.parentCommentId !== undefined &&\n\t\t\t\t\t\targs.parentCommentId !== null\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst parent = store.getById(args.parentCommentId);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tparent === undefined ||\n\t\t\t\t\t\t\tparent.resourceId !== args.resourceId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new CommentParentMismatchError(\n\t\t\t\t\t\t\t\targs.parentCommentId\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdepth = parent.depth + 1;\n\t\t\t\t\t\tif (depth > maxDepth) {\n\t\t\t\t\t\t\tthrow new CommentDepthExceededError(\n\t\t\t\t\t\t\t\tmaxDepth,\n\t\t\t\t\t\t\t\tdepth\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst row: CommentRow = {\n\t\t\t\t\t\tid: newId(),\n\t\t\t\t\t\tresourceId: args.resourceId,\n\t\t\t\t\t\tparentCommentId: args.parentCommentId ?? null,\n\t\t\t\t\t\tauthorId: actorId,\n\t\t\t\t\t\tbody: args.body,\n\t\t\t\t\t\tdepth,\n\t\t\t\t\t\tcreatedAt: now(),\n\t\t\t\t\t\teditedAt: null\n\t\t\t\t\t};\n\t\t\t\t\treturn (await actions.insert(table, row)) as CommentRow;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tdefineMutation<\n\t\t\t\t{ commentId: string; body: string },\n\t\t\t\tCollectionContext,\n\t\t\t\tCommentRow\n\t\t\t>({\n\t\t\t\tname: editMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst existing = store.getById(args.commentId);\n\t\t\t\t\tif (existing === undefined) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:edit on missing comment \"${args.commentId}\"`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (existing.authorId !== actorId) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:edit on \"${args.commentId}\" (not author)`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst updated: CommentRow = {\n\t\t\t\t\t\t...existing,\n\t\t\t\t\t\tbody: args.body,\n\t\t\t\t\t\teditedAt: now()\n\t\t\t\t\t};\n\t\t\t\t\treturn (await actions.update(table, updated)) as CommentRow;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tdefineMutation<{ commentId: string }, CollectionContext, void>({\n\t\t\t\tname: deleteMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst existing = store.getById(args.commentId);\n\t\t\t\t\tif (existing === undefined) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:delete on missing comment \"${args.commentId}\"`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst isAuthor = existing.authorId === actorId;\n\t\t\t\t\tconst isModerator = canModerate(ctx);\n\t\t\t\t\tif (!isAuthor && !isModerator) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:delete on \"${args.commentId}\" (not author, not moderator)`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tawait actions.delete(table, { id: args.commentId });\n\t\t\t\t}\n\t\t\t})\n\t\t]\n\t};\n\n\tif (config.bodyCrdt !== undefined) {\n\t\tpack.crdt = { [table]: { body: config.bodyCrdt } };\n\t}\n\n\tif (search !== undefined) {\n\t\tpack.searchCollections = [\n\t\t\tdefineSearchCollection<CommentRow>({\n\t\t\t\tname: searchCollectionName,\n\t\t\t\ttable,\n\t\t\t\tindex: () =>\n\t\t\t\t\tcreateTextIndex<CommentRow>({\n\t\t\t\t\t\tfields: ['body'],\n\t\t\t\t\t\tkey: (row) => row.id\n\t\t\t\t\t}),\n\t\t\t\tkey: (row) => row.id,\n\t\t\t\tlimit: searchTopK,\n\t\t\t\tsource: () =>\n\t\t\t\t\tstore.reader.all({}) as Iterable<CommentRow>\n\t\t\t})\n\t\t];\n\t}\n\n\tif (joinUsers !== undefined) {\n\t\tconst usersHydrate = joinUsers.hydrate;\n\t\tpack.joinCollections = [\n\t\t\tdefineJoinCollection<\n\t\t\t\tCommentRow,\n\t\t\t\tunknown,\n\t\t\t\tCommentWithAuthor,\n\t\t\t\tParams,\n\t\t\t\tCollectionContext\n\t\t\t>({\n\t\t\t\tname: joinCollectionName,\n\t\t\t\tkey: (out) => out.id,\n\t\t\t\tleft: {\n\t\t\t\t\ttable,\n\t\t\t\t\thydrate: (params, ctx) =>\n\t\t\t\t\t\t(store.reader.all(ctx) as CommentRow[]).filter(\n\t\t\t\t\t\t\t(row) =>\n\t\t\t\t\t\t\t\trow.resourceId === params.resourceId &&\n\t\t\t\t\t\t\t\tcanReadResource(row.resourceId, ctx)\n\t\t\t\t\t\t),\n\t\t\t\t\tkey: (row) => row.id,\n\t\t\t\t\ton: (row) => row.authorId,\n\t\t\t\t\t// Per-resource read gate, also applied to incoming changes.\n\t\t\t\t\tmatch: (row, params, ctx) =>\n\t\t\t\t\t\trow.resourceId === params.resourceId &&\n\t\t\t\t\t\tcanReadResource(row.resourceId, ctx)\n\t\t\t\t},\n\t\t\t\tright: {\n\t\t\t\t\ttable: userTable,\n\t\t\t\t\thydrate: (params, ctx) =>\n\t\t\t\t\t\tusersHydrate(params, ctx as Ctx) as Iterable<unknown>,\n\t\t\t\t\tkey: (user) => userKey(user),\n\t\t\t\t\ton: (user) => userKey(user)\n\t\t\t\t},\n\t\t\t\tselect: (comment, author) => ({ ...comment, author }),\n\t\t\t\tauthorize: (params, ctx) =>\n\t\t\t\t\tcanReadResource(params.resourceId, ctx)\n\t\t\t})\n\t\t];\n\t}\n\n\tif (reactionsConfig !== undefined) {\n\t\tconst allowed = reactionsConfig.allowedEmojis;\n\t\tconst isAllowed = (emoji: string): boolean =>\n\t\t\tallowed === undefined || allowed.length === 0\n\t\t\t\t? true\n\t\t\t\t: allowed.includes(emoji);\n\n\t\tpack.schemas = {\n\t\t\t...(pack.schemas ?? {}),\n\t\t\t[reactionsTable]: {\n\t\t\t\tfields: {\n\t\t\t\t\tactorId: field.string,\n\t\t\t\t\tcommentId: field.string,\n\t\t\t\t\tcreatedAt: field.number,\n\t\t\t\t\temoji: field.string,\n\t\t\t\t\tid: field.string\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tpack.readers = {\n\t\t\t...(pack.readers ?? {}),\n\t\t\t[reactionsTable]: reactionReader\n\t\t};\n\t\tpack.writers = {\n\t\t\t...(pack.writers ?? {}),\n\t\t\t[reactionsTable]: reactionWriter\n\t\t};\n\t\tpack.permissions = {\n\t\t\t...(pack.permissions ?? {}),\n\t\t\t[reactionsTable]: {\n\t\t\t\t// Reactions are visible to anyone who can read the comment's\n\t\t\t\t// resource. We look the comment up to gate on canReadResource.\n\t\t\t\tread: (ctx: unknown, row: CommentReactionRow) => {\n\t\t\t\t\tconst comment = store.getById(row.commentId);\n\t\t\t\t\tif (comment === undefined) return false;\n\t\t\t\t\treturn canReadResource(\n\t\t\t\t\t\tcomment.resourceId,\n\t\t\t\t\t\tctx as CollectionContext\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\t// Per-row writes: the row's actorId must match the caller.\n\t\t\t\tinsert: (ctx: unknown, row: CommentReactionRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\treturn callerId !== undefined && row.actorId === callerId;\n\t\t\t\t},\n\t\t\t\tupdate: (ctx: unknown, row: CommentReactionRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\treturn callerId !== undefined && row.actorId === callerId;\n\t\t\t\t},\n\t\t\t\tdelete: (ctx: unknown, row: CommentReactionRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\tif (callerId === undefined) return false;\n\t\t\t\t\tif (\n\t\t\t\t\t\t(row as { actorId?: string }).actorId !== undefined\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn (row as { actorId: string }).actorId === callerId;\n\t\t\t\t\t}\n\t\t\t\t\tconst id = (row as { id?: string }).id;\n\t\t\t\t\tif (id === undefined) return false;\n\t\t\t\t\treturn reactionStore.get(id)?.actorId === callerId;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tpack.collections = [\n\t\t\t...(pack.collections ?? []),\n\t\t\tdefineCollection<\n\t\t\t\tCommentReactionRow,\n\t\t\t\t{ commentId: string },\n\t\t\t\tCollectionContext\n\t\t\t>({\n\t\t\t\tname: reactionsCollectionName,\n\t\t\t\ttables: [reactionsTable],\n\t\t\t\tkey: (row) => row.id,\n\t\t\t\thydrate: (params, ctx) => {\n\t\t\t\t\tconst comment = store.getById(params.commentId);\n\t\t\t\t\tif (\n\t\t\t\t\t\tcomment === undefined ||\n\t\t\t\t\t\t!canReadResource(comment.resourceId, ctx)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\treturn (\n\t\t\t\t\t\treactionReader.all(ctx) as CommentReactionRow[]\n\t\t\t\t\t).filter((row) => row.commentId === params.commentId);\n\t\t\t\t},\n\t\t\t\tmatch: (row, params, ctx) => {\n\t\t\t\t\tif (row.commentId !== params.commentId) return false;\n\t\t\t\t\tconst comment = store.getById(params.commentId);\n\t\t\t\t\treturn (\n\t\t\t\t\t\tcomment !== undefined &&\n\t\t\t\t\t\tcanReadResource(comment.resourceId, ctx)\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tauthorize: (params, ctx) => {\n\t\t\t\t\tconst comment = store.getById(params.commentId);\n\t\t\t\t\treturn (\n\t\t\t\t\t\tcomment !== undefined &&\n\t\t\t\t\t\tcanReadResource(comment.resourceId, ctx)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t})\n\t\t];\n\n\t\tpack.mutations = [\n\t\t\t...(pack.mutations ?? []),\n\t\t\tdefineMutation<\n\t\t\t\t{ commentId: string; emoji: string },\n\t\t\t\tCollectionContext,\n\t\t\t\tCommentReactionRow\n\t\t\t>({\n\t\t\t\tname: reactMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tif (!isAllowed(args.emoji)) {\n\t\t\t\t\t\tthrow new CommentReactionNotAllowedError(args.emoji);\n\t\t\t\t\t}\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst comment = store.getById(args.commentId);\n\t\t\t\t\tif (comment === undefined) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:react on missing comment \"${args.commentId}\"`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (!canReadResource(comment.resourceId, ctx)) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:react on comment \"${args.commentId}\" (no read access)`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst id = reactionId(args.commentId, actorId, args.emoji);\n\t\t\t\t\tconst existing = reactionStore.get(id);\n\t\t\t\t\tif (existing !== undefined) return existing;\n\t\t\t\t\tconst row: CommentReactionRow = {\n\t\t\t\t\t\tactorId,\n\t\t\t\t\t\tcommentId: args.commentId,\n\t\t\t\t\t\tcreatedAt: now(),\n\t\t\t\t\t\temoji: args.emoji,\n\t\t\t\t\t\tid\n\t\t\t\t\t};\n\t\t\t\t\treturn (await actions.insert(\n\t\t\t\t\t\treactionsTable,\n\t\t\t\t\t\trow\n\t\t\t\t\t)) as CommentReactionRow;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tdefineMutation<\n\t\t\t\t{ commentId: string; emoji: string },\n\t\t\t\tCollectionContext,\n\t\t\t\tvoid\n\t\t\t>({\n\t\t\t\tname: unreactMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst id = reactionId(args.commentId, actorId, args.emoji);\n\t\t\t\t\tif (reactionStore.get(id) === undefined) return;\n\t\t\t\t\tawait actions.delete(reactionsTable, { id });\n\t\t\t\t}\n\t\t\t}),\n\t\t\tdefineMutation<\n\t\t\t\t{ commentId: string; emoji: string },\n\t\t\t\tCollectionContext,\n\t\t\t\t{ reacted: boolean }\n\t\t\t>({\n\t\t\t\tname: toggleReactionMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tif (!isAllowed(args.emoji)) {\n\t\t\t\t\t\tthrow new CommentReactionNotAllowedError(args.emoji);\n\t\t\t\t\t}\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst comment = store.getById(args.commentId);\n\t\t\t\t\tif (comment === undefined) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:toggleReaction on missing comment \"${args.commentId}\"`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (!canReadResource(comment.resourceId, ctx)) {\n\t\t\t\t\t\tthrow new UnauthorizedError(\n\t\t\t\t\t\t\t`comments:toggleReaction on comment \"${args.commentId}\" (no read access)`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst id = reactionId(args.commentId, actorId, args.emoji);\n\t\t\t\t\tconst existing = reactionStore.get(id);\n\t\t\t\t\tif (existing === undefined) {\n\t\t\t\t\t\tconst row: CommentReactionRow = {\n\t\t\t\t\t\t\tactorId,\n\t\t\t\t\t\t\tcommentId: args.commentId,\n\t\t\t\t\t\t\tcreatedAt: now(),\n\t\t\t\t\t\t\temoji: args.emoji,\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t};\n\t\t\t\t\t\tawait actions.insert(reactionsTable, row);\n\t\t\t\t\t\treturn { reacted: true };\n\t\t\t\t\t}\n\t\t\t\t\tawait actions.delete(reactionsTable, { id });\n\t\t\t\t\treturn { reacted: false };\n\t\t\t\t}\n\t\t\t})\n\t\t];\n\t}\n\n\treturn defineSyncPack(pack);\n};\n"
6
6
  ],
7
- "mappings": ";;AA0BA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2CO,IAAM,8BAA8B,MAAqB;AAAA,EAC/D,MAAM,OAAO,IAAI;AAAA,EACjB,OAAO;AAAA,IACN,SAAS,CAAC,OAAO,KAAK,IAAI,EAAE;AAAA,IAC5B,QAAQ;AAAA,MACP,KAAK,MAAM,CAAC,GAAG,KAAK,OAAO,CAAC;AAAA,IAC7B;AAAA,IACA,QAAQ;AAAA,MACP,QAAQ,CAAC,QAAQ;AAAA,QAChB,KAAK,OAAQ,IAAuB,EAAE;AAAA;AAAA,MAEvC,QAAQ,CAAC,SAAS;AAAA,QACjB,KAAK,IAAI,KAAK,IAAI,IAAI;AAAA,QAC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,gBAAgB,EAAE,GAAG,CAAC;AAAA;AAAA,MAE7C,CAAC;AAAA,MACD,eAIE;AAAA,QACD,MAAM;AAAA,QACN,SAAS,OAAO,MAAM,KAAK,YAAY;AAAA,UACtC,IAAI,CAAC,UAAU,KAAK,KAAK,GAAG;AAAA,YAC3B,MAAM,IAAI,+BAA+B,KAAK,KAAK;AAAA,UACpD;AAAA,UACA,MAAM,UAAU,aAAa,YAAY,GAAG;AAAA,UAC5C,MAAM,UAAU,MAAM,QAAQ,KAAK,SAAS;AAAA,UAC5C,IAAI,YAAY,WAAW;AAAA,YAC1B,MAAM,IAAI,kBACT,+CAA+C,KAAK,YACrD;AAAA,UACD;AAAA,UACA,IAAI,CAAC,gBAAgB,QAAQ,YAAY,GAAG,GAAG;AAAA,YAC9C,MAAM,IAAI,kBACT,uCAAuC,KAAK,6BAC7C;AAAA,UACD;AAAA,UACA,MAAM,KAAK,WAAW,KAAK,WAAW,SAAS,KAAK,KAAK;AAAA,UACzD,MAAM,WAAW,cAAc,IAAI,EAAE;AAAA,UACrC,IAAI,aAAa,WAAW;AAAA,YAC3B,MAAM,MAA0B;AAAA,cAC/B;AAAA,cACA,WAAW,KAAK;AAAA,cAChB,WAAW,IAAI;AAAA,cACf,OAAO,KAAK;AAAA,cACZ;AAAA,YACD;AAAA,YACA,MAAM,QAAQ,OAAO,gBAAgB,GAAG;AAAA,YACxC,OAAO,EAAE,SAAS,KAAK;AAAA,UACxB;AAAA,UACA,MAAM,QAAQ,OAAO,gBAAgB,EAAE,GAAG,CAAC;AAAA,UAC3C,OAAO,EAAE,SAAS,MAAM;AAAA;AAAA,MAE1B,CAAC;AAAA,IACF;AAAA,EACD;AAAA,EAEA,OAAO,eAAe,IAAI;AAAA;",
8
+ "debugId": "E866CDC5A3F3646264756E2164756E21",
9
9
  "names": []
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/sync-pack-comments",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Threaded comments pack for @absolutejs/sync — per-resource ACL-scoped, author/moderator gates, optional CRDT bodies",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,7 +11,7 @@
11
11
  "module": "./dist/index.js",
12
12
  "types": "./dist/index.d.ts",
13
13
  "type": "module",
14
- "license": "CC BY-NC 4.0",
14
+ "license": "Apache-2.0",
15
15
  "author": "Alex Kahn",
16
16
  "publishConfig": {
17
17
  "access": "public"