@happyvertical/smrt-reactions 0.0.0-stage → 0.57.23

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.
Files changed (43) hide show
  1. package/AGENTS.md +5 -0
  2. package/CLAUDE.md +1 -0
  3. package/LICENSE +7 -0
  4. package/README.md +38 -2
  5. package/dist/__smrt-register__.d.ts +2 -0
  6. package/dist/__smrt-register__.d.ts.map +1 -0
  7. package/dist/chunks/src-Cfi_AjeE.js +263 -0
  8. package/dist/chunks/src-Cfi_AjeE.js.map +1 -0
  9. package/dist/collections/index.d.ts +14 -0
  10. package/dist/collections/index.d.ts.map +1 -0
  11. package/dist/index.d.ts +10 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +3 -0
  14. package/dist/manifest.json +1265 -0
  15. package/dist/models/Poll.d.ts +28 -0
  16. package/dist/models/Poll.d.ts.map +1 -0
  17. package/dist/models/PollVote.d.ts +20 -0
  18. package/dist/models/PollVote.d.ts.map +1 -0
  19. package/dist/models/Reaction.d.ts +15 -0
  20. package/dist/models/Reaction.d.ts.map +1 -0
  21. package/dist/server.d.ts +4 -0
  22. package/dist/server.d.ts.map +1 -0
  23. package/dist/server.js +323 -0
  24. package/dist/server.js.map +1 -0
  25. package/dist/services.d.ts +59 -0
  26. package/dist/services.d.ts.map +1 -0
  27. package/dist/smrt-knowledge.json +480 -0
  28. package/dist/svelte/PollCard.svelte +40 -0
  29. package/dist/svelte/PollCard.svelte.d.ts +13 -0
  30. package/dist/svelte/PollCard.svelte.d.ts.map +1 -0
  31. package/dist/svelte/ReactionBar.svelte +33 -0
  32. package/dist/svelte/ReactionBar.svelte.d.ts +13 -0
  33. package/dist/svelte/ReactionBar.svelte.d.ts.map +1 -0
  34. package/dist/svelte/index.d.ts +3 -0
  35. package/dist/svelte/index.d.ts.map +1 -0
  36. package/dist/svelte/index.js +2 -0
  37. package/dist/types.d.ts +63 -0
  38. package/dist/types.d.ts.map +1 -0
  39. package/dist/types.js +12 -0
  40. package/dist/types.js.map +1 -0
  41. package/dist/write-authority.d.ts +4 -0
  42. package/dist/write-authority.d.ts.map +1 -0
  43. package/package.json +67 -3
@@ -0,0 +1,480 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "sensitiveFieldsExcluded": true,
4
+ "generatedAt": "1970-01-01T00:00:00.000Z",
5
+ "packageName": "@happyvertical/smrt-reactions",
6
+ "packageVersion": "0.57.23",
7
+ "sourceManifestPath": "dist/manifest.json",
8
+ "agentDocPath": "AGENTS.md",
9
+ "sourceHashes": {
10
+ "manifest": "dd8a5c8bd862498b9a0b070bf6914e56ef8c6ac2c01b3551341dd72404c943fa",
11
+ "packageJson": "02a43d588921330e91e3b07ac886bcc67df020e2b522ee1cfb73a692b5b02839",
12
+ "agents": "c19832881616c1b4a422da22a888b71dfdeb4eea25974c30c6209f9d8c2242aa"
13
+ },
14
+ "exports": [
15
+ ".",
16
+ "./manifest",
17
+ "./manifest.json",
18
+ "./server",
19
+ "./svelte"
20
+ ],
21
+ "dependencies": {
22
+ "@happyvertical/smrt-core": "workspace:*",
23
+ "@happyvertical/smrt-tenancy": "workspace:*",
24
+ "@happyvertical/smrt-comments": "workspace:*",
25
+ "@happyvertical/sql": "catalog:",
26
+ "@happyvertical/smrt-vitest": "workspace:*",
27
+ "@sveltejs/package": "^2.5.8",
28
+ "@sveltejs/vite-plugin-svelte": "^7.3.0",
29
+ "@testing-library/svelte": "^5.4.2",
30
+ "@types/node": "24.13.6",
31
+ "svelte": "^5.57.0",
32
+ "svelte-check": "^4.7.6",
33
+ "typescript": "6.0.3",
34
+ "vite": "8.1.6",
35
+ "vitest": "4.1.10"
36
+ },
37
+ "smrtDependencies": [
38
+ "@happyvertical/smrt-comments",
39
+ "@happyvertical/smrt-core",
40
+ "@happyvertical/smrt-tenancy",
41
+ "@happyvertical/smrt-vitest"
42
+ ],
43
+ "sdkDependencies": [
44
+ "@happyvertical/sql"
45
+ ],
46
+ "tags": [
47
+ "cross-package"
48
+ ],
49
+ "risks": [
50
+ "cross-package-refs:2",
51
+ "polymorphic-associations:2",
52
+ "sensitive-fields-excluded"
53
+ ],
54
+ "objects": [
55
+ {
56
+ "name": "ReactionCollection",
57
+ "qualifiedName": "@happyvertical/smrt-reactions:ReactionCollection",
58
+ "collection": "reactions",
59
+ "tableName": "record_reactions",
60
+ "packageName": "@happyvertical/smrt-reactions",
61
+ "extends": "SmrtCollection",
62
+ "fields": [],
63
+ "relationships": [],
64
+ "methods": [],
65
+ "surfaces": [],
66
+ "relationshipFeatures": [
67
+ "uuidColumns"
68
+ ],
69
+ "tags": [],
70
+ "risks": []
71
+ },
72
+ {
73
+ "name": "PollCollection",
74
+ "qualifiedName": "@happyvertical/smrt-reactions:PollCollection",
75
+ "collection": "polls",
76
+ "tableName": "record_polls",
77
+ "packageName": "@happyvertical/smrt-reactions",
78
+ "extends": "SmrtCollection",
79
+ "fields": [],
80
+ "relationships": [],
81
+ "methods": [],
82
+ "surfaces": [],
83
+ "relationshipFeatures": [
84
+ "uuidColumns"
85
+ ],
86
+ "tags": [],
87
+ "risks": []
88
+ },
89
+ {
90
+ "name": "PollVoteCollection",
91
+ "qualifiedName": "@happyvertical/smrt-reactions:PollVoteCollection",
92
+ "collection": "pollvotes",
93
+ "tableName": "poll_votes",
94
+ "packageName": "@happyvertical/smrt-reactions",
95
+ "extends": "SmrtCollection",
96
+ "fields": [],
97
+ "relationships": [],
98
+ "methods": [],
99
+ "surfaces": [],
100
+ "relationshipFeatures": [
101
+ "uuidColumns"
102
+ ],
103
+ "tags": [],
104
+ "risks": []
105
+ },
106
+ {
107
+ "name": "Poll",
108
+ "qualifiedName": "@happyvertical/smrt-reactions:Poll",
109
+ "collection": "polls",
110
+ "tableName": "record_polls",
111
+ "packageName": "@happyvertical/smrt-reactions",
112
+ "extends": "SmrtPolymorphicAssociation",
113
+ "fields": [
114
+ {
115
+ "name": "metaType",
116
+ "type": "text",
117
+ "required": true,
118
+ "columnType": "TEXT"
119
+ },
120
+ {
121
+ "name": "metaId",
122
+ "type": "text",
123
+ "required": true,
124
+ "columnType": "TEXT"
125
+ },
126
+ {
127
+ "name": "role",
128
+ "type": "text",
129
+ "required": true,
130
+ "columnType": "TEXT"
131
+ },
132
+ {
133
+ "name": "sortOrder",
134
+ "type": "integer",
135
+ "required": false,
136
+ "columnType": "INTEGER",
137
+ "default": 0
138
+ },
139
+ {
140
+ "name": "tenantId",
141
+ "type": "text",
142
+ "required": true,
143
+ "columnType": "UUID"
144
+ },
145
+ {
146
+ "name": "question",
147
+ "type": "text",
148
+ "required": true,
149
+ "columnType": "TEXT"
150
+ },
151
+ {
152
+ "name": "optionsJson",
153
+ "type": "text",
154
+ "required": false,
155
+ "columnType": "TEXT",
156
+ "readonly": true
157
+ },
158
+ {
159
+ "name": "opensAt",
160
+ "type": "datetime",
161
+ "required": false,
162
+ "columnType": "TIMESTAMP"
163
+ },
164
+ {
165
+ "name": "closesAt",
166
+ "type": "datetime",
167
+ "required": false,
168
+ "columnType": "TIMESTAMP"
169
+ },
170
+ {
171
+ "name": "visibility",
172
+ "type": "text",
173
+ "required": false,
174
+ "columnType": "TEXT",
175
+ "default": "always"
176
+ },
177
+ {
178
+ "name": "oneVotePerActor",
179
+ "type": "boolean",
180
+ "required": true,
181
+ "columnType": "BOOLEAN",
182
+ "default": true
183
+ },
184
+ {
185
+ "name": "anonymousTally",
186
+ "type": "boolean",
187
+ "required": true,
188
+ "columnType": "BOOLEAN",
189
+ "default": true
190
+ },
191
+ {
192
+ "name": "closed",
193
+ "type": "boolean",
194
+ "required": true,
195
+ "columnType": "BOOLEAN",
196
+ "default": false
197
+ }
198
+ ],
199
+ "relationships": [],
200
+ "methods": [
201
+ "assertWriteAuthority",
202
+ "hydrate"
203
+ ],
204
+ "methodSignatures": [
205
+ {
206
+ "name": "assertWriteAuthority",
207
+ "returns": "void"
208
+ },
209
+ {
210
+ "name": "hydrate",
211
+ "async": true,
212
+ "returns": "Promise<T | null>"
213
+ }
214
+ ],
215
+ "tenant": {
216
+ "scoped": true,
217
+ "mode": "required",
218
+ "field": "tenantId"
219
+ },
220
+ "conflictColumns": [
221
+ "tenant_id",
222
+ "slug",
223
+ "context"
224
+ ],
225
+ "surfaces": [],
226
+ "withheldSurfaces": [
227
+ {
228
+ "kind": "api",
229
+ "operation": "assertWriteAuthority",
230
+ "code": "api-disabled",
231
+ "reason": "api is disabled",
232
+ "objectName": "@happyvertical/smrt-reactions:Poll"
233
+ },
234
+ {
235
+ "kind": "api",
236
+ "operation": "hydrate",
237
+ "code": "api-disabled",
238
+ "reason": "api is disabled",
239
+ "objectName": "@happyvertical/smrt-reactions:Poll"
240
+ }
241
+ ],
242
+ "relationshipFeatures": [
243
+ "SmrtPolymorphicAssociation",
244
+ "uuidColumns"
245
+ ],
246
+ "tags": [],
247
+ "risks": []
248
+ },
249
+ {
250
+ "name": "PollVote",
251
+ "qualifiedName": "@happyvertical/smrt-reactions:PollVote",
252
+ "collection": "pollvotes",
253
+ "description": "Append-only through PollService; no generated write API.",
254
+ "tableName": "poll_votes",
255
+ "packageName": "@happyvertical/smrt-reactions",
256
+ "extends": "SmrtObject",
257
+ "fields": [
258
+ {
259
+ "name": "tenantId",
260
+ "type": "text",
261
+ "required": true,
262
+ "columnType": "UUID"
263
+ },
264
+ {
265
+ "name": "pollId",
266
+ "type": "foreignKey",
267
+ "required": true,
268
+ "related": "Poll",
269
+ "columnType": "UUID"
270
+ },
271
+ {
272
+ "name": "actorProfileId",
273
+ "type": "crossPackageRef",
274
+ "required": true,
275
+ "related": "@happyvertical/smrt-profiles:Profile",
276
+ "columnType": "UUID"
277
+ },
278
+ {
279
+ "name": "optionId",
280
+ "type": "text",
281
+ "required": true,
282
+ "columnType": "TEXT",
283
+ "readonly": true
284
+ },
285
+ {
286
+ "name": "participationSnapshot",
287
+ "type": "text",
288
+ "required": true,
289
+ "columnType": "TEXT",
290
+ "readonly": true
291
+ }
292
+ ],
293
+ "relationships": [
294
+ {
295
+ "name": "pollId",
296
+ "type": "foreignKey",
297
+ "required": true,
298
+ "related": "Poll",
299
+ "columnType": "UUID"
300
+ },
301
+ {
302
+ "name": "actorProfileId",
303
+ "type": "crossPackageRef",
304
+ "required": true,
305
+ "related": "@happyvertical/smrt-profiles:Profile",
306
+ "columnType": "UUID"
307
+ }
308
+ ],
309
+ "methods": [
310
+ "assertWriteAuthority"
311
+ ],
312
+ "methodSignatures": [
313
+ {
314
+ "name": "assertWriteAuthority",
315
+ "returns": "void"
316
+ }
317
+ ],
318
+ "tenant": {
319
+ "scoped": true,
320
+ "mode": "required",
321
+ "field": "tenantId"
322
+ },
323
+ "conflictColumns": [
324
+ "tenant_id",
325
+ "slug",
326
+ "context"
327
+ ],
328
+ "surfaces": [],
329
+ "withheldSurfaces": [
330
+ {
331
+ "kind": "api",
332
+ "operation": "assertWriteAuthority",
333
+ "code": "api-disabled",
334
+ "reason": "api is disabled",
335
+ "objectName": "@happyvertical/smrt-reactions:PollVote"
336
+ }
337
+ ],
338
+ "relationshipFeatures": [
339
+ "crossPackageRef",
340
+ "foreignKey",
341
+ "uuidColumns"
342
+ ],
343
+ "tags": [],
344
+ "risks": []
345
+ },
346
+ {
347
+ "name": "Reaction",
348
+ "qualifiedName": "@happyvertical/smrt-reactions:Reaction",
349
+ "collection": "reactions",
350
+ "tableName": "record_reactions",
351
+ "packageName": "@happyvertical/smrt-reactions",
352
+ "extends": "SmrtPolymorphicAssociation",
353
+ "fields": [
354
+ {
355
+ "name": "metaType",
356
+ "type": "text",
357
+ "required": true,
358
+ "columnType": "TEXT"
359
+ },
360
+ {
361
+ "name": "metaId",
362
+ "type": "text",
363
+ "required": true,
364
+ "columnType": "TEXT"
365
+ },
366
+ {
367
+ "name": "role",
368
+ "type": "text",
369
+ "required": true,
370
+ "columnType": "TEXT"
371
+ },
372
+ {
373
+ "name": "sortOrder",
374
+ "type": "integer",
375
+ "required": false,
376
+ "columnType": "INTEGER",
377
+ "default": 0
378
+ },
379
+ {
380
+ "name": "tenantId",
381
+ "type": "text",
382
+ "required": true,
383
+ "columnType": "UUID"
384
+ },
385
+ {
386
+ "name": "actorProfileId",
387
+ "type": "crossPackageRef",
388
+ "required": true,
389
+ "related": "@happyvertical/smrt-profiles:Profile",
390
+ "columnType": "UUID"
391
+ },
392
+ {
393
+ "name": "kind",
394
+ "type": "text",
395
+ "required": true,
396
+ "columnType": "TEXT",
397
+ "default": "like"
398
+ }
399
+ ],
400
+ "relationships": [
401
+ {
402
+ "name": "actorProfileId",
403
+ "type": "crossPackageRef",
404
+ "required": true,
405
+ "related": "@happyvertical/smrt-profiles:Profile",
406
+ "columnType": "UUID"
407
+ }
408
+ ],
409
+ "methods": [
410
+ "assertWriteAuthority",
411
+ "hydrate"
412
+ ],
413
+ "methodSignatures": [
414
+ {
415
+ "name": "assertWriteAuthority",
416
+ "returns": "void"
417
+ },
418
+ {
419
+ "name": "hydrate",
420
+ "async": true,
421
+ "returns": "Promise<T | null>"
422
+ }
423
+ ],
424
+ "tenant": {
425
+ "scoped": true,
426
+ "mode": "required",
427
+ "field": "tenantId"
428
+ },
429
+ "conflictColumns": [
430
+ "tenant_id",
431
+ "slug",
432
+ "context"
433
+ ],
434
+ "surfaces": [],
435
+ "withheldSurfaces": [
436
+ {
437
+ "kind": "api",
438
+ "operation": "assertWriteAuthority",
439
+ "code": "api-disabled",
440
+ "reason": "api is disabled",
441
+ "objectName": "@happyvertical/smrt-reactions:Reaction"
442
+ },
443
+ {
444
+ "kind": "api",
445
+ "operation": "hydrate",
446
+ "code": "api-disabled",
447
+ "reason": "api is disabled",
448
+ "objectName": "@happyvertical/smrt-reactions:Reaction"
449
+ }
450
+ ],
451
+ "relationshipFeatures": [
452
+ "SmrtPolymorphicAssociation",
453
+ "crossPackageRef",
454
+ "uuidColumns"
455
+ ],
456
+ "tags": [],
457
+ "risks": []
458
+ }
459
+ ],
460
+ "surfaces": [],
461
+ "prompts": [],
462
+ "relationshipsV2": {
463
+ "foreignKeyFields": 1,
464
+ "crossPackageRefFields": 2,
465
+ "junctionCollections": 0,
466
+ "hierarchicalObjects": 0,
467
+ "polymorphicAssociations": 2,
468
+ "uuidColumns": 18
469
+ },
470
+ "agentDoc": "# @happyvertical/smrt-reactions\n\nThe model-only root exports models/collections/types; `/server` exports ParticipationRuntime. Its factory owns SQLite/PostgreSQL connections and returns reaction/poll services that require trusted host actor/profile binding and record authorization. ParticipationService from smrt-comments/participation exclusively owns entitlement, bans and quota; mutations share its transaction. DuckDB is refused before open pending SDK #1452. Models require package-private executor-bound write authority (unique transaction executors only) and disable generated mutation endpoints: hosts call services. PollVote rows retain immutable snapshot evidence; never amend a recorded vote or poll options. Svelte receives authorized projections/callbacks, never credentials or actor lists.\n\nRun package `test`, `typecheck`, `check`, `build`; PostgreSQL CI uses `test:postgres`. See README.md and agents/test-design.md.\n",
471
+ "browser": {
472
+ "status": "server-only",
473
+ "issues": [
474
+ "#3624"
475
+ ],
476
+ "via": [
477
+ "@happyvertical/smrt-tenancy"
478
+ ]
479
+ }
480
+ }
@@ -0,0 +1,40 @@
1
+ <script lang="ts">
2
+ import type { PollProjection } from '../types.js';
3
+
4
+ interface Props {
5
+ /** Authorized poll options, selection and optionally visible aggregate results. */
6
+ poll: PollProjection;
7
+ /** Prevents voting when the host does not permit interaction. */
8
+ disabled?: boolean;
9
+ /** Records a choice through a host-authorized service action. */
10
+ onVote: (optionId: string) => Promise<void>;
11
+ }
12
+ let { poll, disabled = false, onVote }: Props = $props();
13
+ let busy = $state(false);
14
+ let error = $state('');
15
+ async function vote(optionId: string) {
16
+ if (disabled || busy || poll.closed || poll.selectedOptionId !== null) return;
17
+ busy = true;
18
+ error = '';
19
+ try {
20
+ await onVote(optionId);
21
+ } catch {
22
+ error = 'Unable to record vote. Please try again.';
23
+ } finally {
24
+ busy = false;
25
+ }
26
+ }
27
+ </script>
28
+ <section aria-label={poll.question} aria-busy={busy} data-smrt-component="PollCard">
29
+ <h3>{poll.question}</h3>
30
+ {#if poll.closed}<p>Voting is closed.</p>{/if}
31
+ <ul>
32
+ {#each poll.options as option (option.id)}
33
+ <li><button type="button" disabled={disabled || busy || poll.closed || poll.selectedOptionId !== null} aria-pressed={poll.selectedOptionId === option.id} onclick={() => vote(option.id)}>{option.label}</button>
34
+ {#if poll.results !== null}<span aria-label={`${option.label} votes`}>{poll.results[option.id] ?? 0}</span>{/if}
35
+ </li>
36
+ {/each}
37
+ </ul>
38
+ {#if poll.totalVotes !== null}<p>{poll.totalVotes} total votes</p>{/if}
39
+ {#if error}<p role="alert">{error}</p>{/if}
40
+ </section>
@@ -0,0 +1,13 @@
1
+ import type { PollProjection } from '../types.js';
2
+ interface Props {
3
+ /** Authorized poll options, selection and optionally visible aggregate results. */
4
+ poll: PollProjection;
5
+ /** Prevents voting when the host does not permit interaction. */
6
+ disabled?: boolean;
7
+ /** Records a choice through a host-authorized service action. */
8
+ onVote: (optionId: string) => Promise<void>;
9
+ }
10
+ declare const PollCard: import("svelte").Component<Props, {}, "">;
11
+ type PollCard = ReturnType<typeof PollCard>;
12
+ export default PollCard;
13
+ //# sourceMappingURL=PollCard.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PollCard.svelte.d.ts","sourceRoot":"","sources":["../../src/svelte/PollCard.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,UAAU,KAAK;IACb,mFAAmF;IACnF,IAAI,EAAE,cAAc,CAAC;IACrB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iEAAiE;IACjE,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAoCD,QAAA,MAAM,QAAQ,2CAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,33 @@
1
+ <script lang="ts">
2
+ import type { ReactionKind, ReactionTally } from '../types.js';
3
+
4
+ interface Props {
5
+ /** Authorized aggregate counts and selected reaction state for the current actor. */
6
+ reactions: ReactionTally[];
7
+ /** Prevents changes when the host does not permit interaction. */
8
+ disabled?: boolean;
9
+ /** Applies the desired reaction state through a host-authorized service action. */
10
+ onChange: (kind: ReactionKind, active: boolean) => Promise<void>;
11
+ }
12
+ let { reactions, disabled = false, onChange }: Props = $props();
13
+ let busy = $state(false);
14
+ let error = $state('');
15
+ async function change(kind: ReactionKind, active: boolean) {
16
+ if (disabled || busy) return;
17
+ busy = true;
18
+ error = '';
19
+ try {
20
+ await onChange(kind, active);
21
+ } catch {
22
+ error = 'Unable to update reaction. Please try again.';
23
+ } finally {
24
+ busy = false;
25
+ }
26
+ }
27
+ </script>
28
+ <div role="group" aria-label="Reactions" aria-busy={busy} data-smrt-component="ReactionBar">
29
+ {#each reactions as reaction (reaction.kind)}
30
+ <button type="button" disabled={disabled || busy} aria-pressed={reaction.selected} onclick={() => change(reaction.kind, !reaction.selected)}>{reaction.kind} <span>{reaction.count}</span></button>
31
+ {/each}
32
+ </div>
33
+ {#if error}<p role="alert" data-smrt-component="ReactionBar">{error}</p>{/if}
@@ -0,0 +1,13 @@
1
+ import type { ReactionKind, ReactionTally } from '../types.js';
2
+ interface Props {
3
+ /** Authorized aggregate counts and selected reaction state for the current actor. */
4
+ reactions: ReactionTally[];
5
+ /** Prevents changes when the host does not permit interaction. */
6
+ disabled?: boolean;
7
+ /** Applies the desired reaction state through a host-authorized service action. */
8
+ onChange: (kind: ReactionKind, active: boolean) => Promise<void>;
9
+ }
10
+ declare const ReactionBar: import("svelte").Component<Props, {}, "">;
11
+ type ReactionBar = ReturnType<typeof ReactionBar>;
12
+ export default ReactionBar;
13
+ //# sourceMappingURL=ReactionBar.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactionBar.svelte.d.ts","sourceRoot":"","sources":["../../src/svelte/ReactionBar.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG/D,UAAU,KAAK;IACb,qFAAqF;IACrF,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,kEAAkE;IAClE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mFAAmF;IACnF,QAAQ,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE;AA6BD,QAAA,MAAM,WAAW,2CAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as PollCard } from './PollCard.svelte';
2
+ export { default as ReactionBar } from './ReactionBar.svelte';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/svelte/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as PollCard } from './PollCard.svelte';
2
+ export { default as ReactionBar } from './ReactionBar.svelte';
@@ -0,0 +1,63 @@
1
+ import type { ParticipationAuthorizer, ParticipationTarget } from '@happyvertical/smrt-comments/participation';
2
+ /** Host authenticates both IDs and verifies that the profile belongs to this user. */
3
+ export interface ParticipationActor {
4
+ tenantId: string;
5
+ userId: string;
6
+ profileId: string;
7
+ }
8
+ export interface RecordAccess extends ParticipationActor, ParticipationTarget {
9
+ action: 'read' | 'react' | 'vote' | 'manage';
10
+ }
11
+ /** Owned supported connection configuration; arbitrary executors are not accepted. */
12
+ export interface ParticipationDatabaseConfig {
13
+ type: 'sqlite' | 'postgres';
14
+ url: string;
15
+ cache?: false;
16
+ dbid?: string;
17
+ authToken?: string;
18
+ encryptionKey?: string;
19
+ transactionQueueTimeout?: number;
20
+ max?: number;
21
+ connectionTimeoutMillis?: number;
22
+ idleTimeoutMillis?: number;
23
+ }
24
+ export interface ServiceOptions {
25
+ database: ParticipationDatabaseConfig;
26
+ actor: ParticipationActor;
27
+ authorizeRecord: (access: RecordAccess) => Promise<boolean>;
28
+ /** Required: hosts compose their subscriptions and eligibility/record-date hooks here. */
29
+ participation: ParticipationAuthorizer;
30
+ now?: () => Date;
31
+ }
32
+ export type ReactionKind = 'like' | 'love' | 'celebrate' | 'insightful' | 'support';
33
+ export declare const REACTION_KINDS: readonly ReactionKind[];
34
+ export interface PollOption {
35
+ id: string;
36
+ label: string;
37
+ }
38
+ export type PollVisibility = 'always' | 'after_vote' | 'after_close';
39
+ export interface CreatePollInput {
40
+ recordType: string;
41
+ recordId: string;
42
+ question: string;
43
+ options: readonly PollOption[];
44
+ opensAt?: Date | null;
45
+ closesAt?: Date | null;
46
+ visibility?: PollVisibility;
47
+ anonymousTally?: boolean;
48
+ }
49
+ export interface PollProjection {
50
+ id: string;
51
+ question: string;
52
+ options: PollOption[];
53
+ closed: boolean;
54
+ selectedOptionId: string | null;
55
+ results: Record<string, number> | null;
56
+ totalVotes: number | null;
57
+ }
58
+ export interface ReactionTally {
59
+ kind: ReactionKind;
60
+ count: number;
61
+ selected: boolean;
62
+ }
63
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,4CAA4C,CAAC;AAEpD,sFAAsF;AACtF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,YAAa,SAAQ,kBAAkB,EAAE,mBAAmB;IAC3E,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;CAC9C;AACD,sFAAsF;AACtF,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AACD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,2BAA2B,CAAC;IACtC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,eAAe,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D,0FAA0F;IAC1F,aAAa,EAAE,uBAAuB,CAAC;IACvC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AACD,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,WAAW,GACX,YAAY,GACZ,SAAS,CAAC;AACd,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAMjD,CAAC;AACF,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,YAAY,GAAG,aAAa,CAAC;AACrE,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AACD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACvC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AACD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,12 @@
1
+ //#region src/types.ts
2
+ var REACTION_KINDS = [
3
+ "like",
4
+ "love",
5
+ "celebrate",
6
+ "insightful",
7
+ "support"
8
+ ];
9
+ //#endregion
10
+ export { REACTION_KINDS };
11
+
12
+ //# sourceMappingURL=types.js.map