@happyvertical/smrt-reactions 0.57.46 → 0.57.47
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/dist/chunks/src-iXPteaLV.js +263 -0
- package/dist/chunks/src-iXPteaLV.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/manifest.json +19 -1
- package/dist/server.js +1 -1
- package/dist/smrt-knowledge.json +3 -3
- package/package.json +6 -6
- package/dist/chunks/src-D0VSA-4U.js +0 -263
- package/dist/chunks/src-D0VSA-4U.js.map +0 -1
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { ObjectRegistry, SmrtCollection, SmrtObject, SmrtPolymorphicAssociation, ValidationError, crossPackageRef, field, foreignKey, smrt } from "@happyvertical/smrt-core";
|
|
2
|
+
import { TenantScoped, tenantId } from "@happyvertical/smrt-tenancy";
|
|
3
|
+
//#region src/__smrt-register__.ts
|
|
4
|
+
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-reactions","packageVersion":"0.57.47","objects":{"@happyvertical/smrt-reactions:ReactionCollection":{"name":"reactioncollection","className":"ReactionCollection","qualifiedName":"@happyvertical/smrt-reactions:ReactionCollection","collection":"reactions","filePath":"/home/runner/work/smrt/smrt/packages/reactions/src/collections/index.ts","packageName":"@happyvertical/smrt-reactions","fields":{},"methods":{},"decoratorConfig":{"tableName":"record_reactions","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"Reaction","exportName":"ReactionCollection","collectionExportName":"ReactionCollectionCollection","collectionOf":"@happyvertical/smrt-reactions:Reaction","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"record_reactions","ddl":"CREATE TABLE IF NOT EXISTS \\"record_reactions\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"meta_type\\" TEXT NOT NULL,\\n \\"meta_id\\" TEXT NOT NULL,\\n \\"role\\" TEXT NOT NULL,\\n \\"sort_order\\" INTEGER DEFAULT 0,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"actor_profile_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT NOT NULL DEFAULT 'like'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"meta_type":{"type":"TEXT","notNull":true,"unique":false},"meta_id":{"type":"TEXT","notNull":true,"unique":false},"role":{"type":"TEXT","notNull":true,"unique":false},"sort_order":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"kind":{"type":"TEXT","notNull":true,"unique":false,"default":"like"}},"indexes":[{"name":"record_reactions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"record_reactions_actor_kind","columns":["tenant_id","meta_type","meta_id","actor_profile_id","kind"],"unique":true},{"name":"record_reactions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"record_reactions_meta_type_meta_id_idx","columns":["meta_type","meta_id"]},{"name":"record_reactions_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"678ebe0f"},"importPath":"@happyvertical/smrt-reactions"},"@happyvertical/smrt-reactions:PollCollection":{"name":"pollcollection","className":"PollCollection","qualifiedName":"@happyvertical/smrt-reactions:PollCollection","collection":"polls","filePath":"/home/runner/work/smrt/smrt/packages/reactions/src/collections/index.ts","packageName":"@happyvertical/smrt-reactions","fields":{},"methods":{},"decoratorConfig":{"tableName":"record_polls","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"Poll","exportName":"PollCollection","collectionExportName":"PollCollectionCollection","collectionOf":"@happyvertical/smrt-reactions:Poll","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"record_polls","ddl":"CREATE TABLE IF NOT EXISTS \\"record_polls\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"meta_type\\" TEXT NOT NULL,\\n \\"meta_id\\" TEXT NOT NULL,\\n \\"role\\" TEXT NOT NULL,\\n \\"sort_order\\" INTEGER DEFAULT 0,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"question\\" TEXT NOT NULL,\\n \\"options_json\\" TEXT,\\n \\"opens_at\\" TIMESTAMP,\\n \\"closes_at\\" TIMESTAMP,\\n \\"visibility\\" TEXT DEFAULT 'always',\\n \\"one_vote_per_actor\\" BOOLEAN NOT NULL DEFAULT TRUE,\\n \\"anonymous_tally\\" BOOLEAN NOT NULL DEFAULT TRUE,\\n \\"closed\\" BOOLEAN NOT NULL DEFAULT FALSE\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"meta_type":{"type":"TEXT","notNull":true,"unique":false},"meta_id":{"type":"TEXT","notNull":true,"unique":false},"role":{"type":"TEXT","notNull":true,"unique":false},"sort_order":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"question":{"type":"TEXT","notNull":true,"unique":false},"options_json":{"type":"TEXT","notNull":false,"unique":false},"opens_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"closes_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"visibility":{"type":"TEXT","notNull":false,"unique":false,"default":"always"},"one_vote_per_actor":{"type":"BOOLEAN","notNull":true,"unique":false,"default":true},"anonymous_tally":{"type":"BOOLEAN","notNull":true,"unique":false,"default":true},"closed":{"type":"BOOLEAN","notNull":true,"unique":false,"default":false}},"indexes":[{"name":"record_polls_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"record_polls_target","columns":["tenant_id","meta_type","meta_id"]},{"name":"record_polls_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"record_polls_meta_type_meta_id_idx","columns":["meta_type","meta_id"]}],"version":"f6713370"},"importPath":"@happyvertical/smrt-reactions"},"@happyvertical/smrt-reactions:PollVoteCollection":{"name":"pollvotecollection","className":"PollVoteCollection","qualifiedName":"@happyvertical/smrt-reactions:PollVoteCollection","collection":"pollvotes","filePath":"/home/runner/work/smrt/smrt/packages/reactions/src/collections/index.ts","packageName":"@happyvertical/smrt-reactions","fields":{},"methods":{},"decoratorConfig":{"tableName":"poll_votes","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"PollVote","exportName":"PollVoteCollection","collectionExportName":"PollVoteCollectionCollection","collectionOf":"@happyvertical/smrt-reactions:PollVote","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"poll_votes","ddl":"CREATE TABLE IF NOT EXISTS \\"poll_votes\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"poll_id\\" UUID NOT NULL,\\n \\"actor_profile_id\\" UUID NOT NULL,\\n \\"option_id\\" TEXT NOT NULL,\\n \\"participation_snapshot\\" TEXT NOT NULL\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"poll_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"record_polls","column":"id","onDelete":"NO ACTION","onUpdate":"NO ACTION"}},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"option_id":{"type":"TEXT","notNull":true,"unique":false},"participation_snapshot":{"type":"TEXT","notNull":true,"unique":false}},"indexes":[{"name":"poll_votes_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"poll_votes_actor","columns":["tenant_id","poll_id","actor_profile_id"],"unique":true},{"name":"poll_votes_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"poll_votes_poll_id_idx","columns":["poll_id"]},{"name":"poll_votes_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"c22797d0"},"importPath":"@happyvertical/smrt-reactions"},"@happyvertical/smrt-reactions:Poll":{"name":"poll","className":"Poll","qualifiedName":"@happyvertical/smrt-reactions:Poll","collection":"polls","filePath":"/home/runner/work/smrt/smrt/packages/reactions/src/models/Poll.ts","packageName":"@happyvertical/smrt-reactions","fields":{"metaType":{"type":"text","required":true,"_meta":{"required":true}},"metaId":{"type":"text","required":true,"_meta":{"required":true}},"role":{"type":"text","required":true,"_meta":{"required":true}},"sortOrder":{"type":"integer","required":false,"default":0},"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false}}},"question":{"type":"text","required":true,"_meta":{"required":true}},"optionsJson":{"type":"text","required":false,"_meta":{"readonly":true},"readonly":true},"opensAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"closesAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"visibility":{"type":"text","required":false,"default":"always","enum":["always","after_vote","after_close"]},"oneVotePerActor":{"type":"boolean","required":true,"default":true},"anonymousTally":{"type":"boolean","required":true,"default":true},"closed":{"type":"boolean","required":true,"default":false}},"methods":{"hydrate":{"name":"hydrate","async":true,"parameters":[],"returnType":"Promise<T | null>","isStatic":false,"isPublic":true},"assertWriteAuthority":{"name":"assertWriteAuthority","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"record_polls","api":false,"mcp":false,"cli":false,"hooks":{"beforeDelete":"assertWriteAuthority"},"indexes":[{"name":"record_polls_target","columns":["tenantId","metaType","metaId"]}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtPolymorphicAssociation","exportName":"Poll","collectionExportName":"PollCollection","validationRules":[{"field":"metaType","rule":"required","fieldType":"text"},{"field":"metaId","rule":"required","fieldType":"text"},{"field":"role","rule":"required","fieldType":"text"},{"field":"question","rule":"required","fieldType":"text"},{"field":"oneVotePerActor","rule":"required","fieldType":"boolean"},{"field":"anonymousTally","rule":"required","fieldType":"boolean"},{"field":"closed","rule":"required","fieldType":"boolean"}],"schema":{"tableName":"record_polls","ddl":"CREATE TABLE IF NOT EXISTS \\"record_polls\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"meta_type\\" TEXT NOT NULL,\\n \\"meta_id\\" TEXT NOT NULL,\\n \\"role\\" TEXT NOT NULL,\\n \\"sort_order\\" INTEGER DEFAULT 0,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"question\\" TEXT NOT NULL,\\n \\"options_json\\" TEXT,\\n \\"opens_at\\" TIMESTAMP,\\n \\"closes_at\\" TIMESTAMP,\\n \\"visibility\\" TEXT DEFAULT 'always',\\n \\"one_vote_per_actor\\" BOOLEAN NOT NULL DEFAULT TRUE,\\n \\"anonymous_tally\\" BOOLEAN NOT NULL DEFAULT TRUE,\\n \\"closed\\" BOOLEAN NOT NULL DEFAULT FALSE\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"meta_type":{"type":"TEXT","notNull":true,"unique":false},"meta_id":{"type":"TEXT","notNull":true,"unique":false},"role":{"type":"TEXT","notNull":true,"unique":false},"sort_order":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"question":{"type":"TEXT","notNull":true,"unique":false},"options_json":{"type":"TEXT","notNull":false,"unique":false},"opens_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"closes_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"visibility":{"type":"TEXT","notNull":false,"unique":false,"default":"always"},"one_vote_per_actor":{"type":"BOOLEAN","notNull":true,"unique":false,"default":true},"anonymous_tally":{"type":"BOOLEAN","notNull":true,"unique":false,"default":true},"closed":{"type":"BOOLEAN","notNull":true,"unique":false,"default":false}},"indexes":[{"name":"record_polls_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"record_polls_target","columns":["tenant_id","meta_type","meta_id"]},{"name":"record_polls_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"record_polls_meta_type_meta_id_idx","columns":["meta_type","meta_id"]}],"version":"f6713370"},"importPath":"@happyvertical/smrt-reactions"},"@happyvertical/smrt-reactions:PollVote":{"name":"pollvote","className":"PollVote","qualifiedName":"@happyvertical/smrt-reactions:PollVote","collection":"pollvotes","description":"Append-only through PollService; no generated write API.","filePath":"/home/runner/work/smrt/smrt/packages/reactions/src/models/PollVote.ts","packageName":"@happyvertical/smrt-reactions","fields":{"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false}}},"pollId":{"type":"foreignKey","required":true,"related":"Poll","_meta":{"required":true,"onDelete":"NO ACTION","onUpdate":"NO ACTION"}},"actorProfileId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-profiles:Profile"},"optionId":{"type":"text","required":true,"_meta":{"required":true,"readonly":true},"readonly":true},"participationSnapshot":{"type":"text","required":true,"_meta":{"required":true,"readonly":true},"readonly":true}},"methods":{"assertWriteAuthority":{"name":"assertWriteAuthority","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"poll_votes","api":false,"mcp":false,"cli":false,"hooks":{"beforeDelete":"assertWriteAuthority"},"indexes":[{"name":"poll_votes_actor","columns":["tenantId","pollId","actorProfileId"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"PollVote","collectionExportName":"PollVoteCollection","validationRules":[{"field":"pollId","rule":"required","fieldType":"foreignKey"},{"field":"actorProfileId","rule":"required","fieldType":"crossPackageRef"},{"field":"optionId","rule":"required","fieldType":"text"},{"field":"participationSnapshot","rule":"required","fieldType":"text"}],"schema":{"tableName":"poll_votes","ddl":"CREATE TABLE IF NOT EXISTS \\"poll_votes\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"poll_id\\" UUID NOT NULL,\\n \\"actor_profile_id\\" UUID NOT NULL,\\n \\"option_id\\" TEXT NOT NULL,\\n \\"participation_snapshot\\" TEXT NOT NULL\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"poll_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"record_polls","column":"id","onDelete":"NO ACTION","onUpdate":"NO ACTION"}},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"option_id":{"type":"TEXT","notNull":true,"unique":false},"participation_snapshot":{"type":"TEXT","notNull":true,"unique":false}},"indexes":[{"name":"poll_votes_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"poll_votes_actor","columns":["tenant_id","poll_id","actor_profile_id"],"unique":true},{"name":"poll_votes_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"poll_votes_poll_id_idx","columns":["poll_id"]},{"name":"poll_votes_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"c22797d0"},"importPath":"@happyvertical/smrt-reactions"},"@happyvertical/smrt-reactions:Reaction":{"name":"reaction","className":"Reaction","qualifiedName":"@happyvertical/smrt-reactions:Reaction","collection":"reactions","filePath":"/home/runner/work/smrt/smrt/packages/reactions/src/models/Reaction.ts","packageName":"@happyvertical/smrt-reactions","fields":{"metaType":{"type":"text","required":true,"_meta":{"required":true}},"metaId":{"type":"text","required":true,"_meta":{"required":true}},"role":{"type":"text","required":true,"_meta":{"required":true}},"sortOrder":{"type":"integer","required":false,"default":0},"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false}}},"actorProfileId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-profiles:Profile"},"kind":{"type":"text","required":true,"default":"like","_meta":{"required":true},"enum":["like","love","celebrate","insightful","support"]}},"methods":{"hydrate":{"name":"hydrate","async":true,"parameters":[],"returnType":"Promise<T | null>","isStatic":false,"isPublic":true},"assertWriteAuthority":{"name":"assertWriteAuthority","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"record_reactions","api":false,"mcp":false,"cli":false,"hooks":{"beforeDelete":"assertWriteAuthority"},"indexes":[{"name":"record_reactions_actor_kind","columns":["tenantId","metaType","metaId","actorProfileId","kind"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtPolymorphicAssociation","exportName":"Reaction","collectionExportName":"ReactionCollection","validationRules":[{"field":"metaType","rule":"required","fieldType":"text"},{"field":"metaId","rule":"required","fieldType":"text"},{"field":"role","rule":"required","fieldType":"text"},{"field":"actorProfileId","rule":"required","fieldType":"crossPackageRef"},{"field":"kind","rule":"required","fieldType":"text"}],"schema":{"tableName":"record_reactions","ddl":"CREATE TABLE IF NOT EXISTS \\"record_reactions\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"meta_type\\" TEXT NOT NULL,\\n \\"meta_id\\" TEXT NOT NULL,\\n \\"role\\" TEXT NOT NULL,\\n \\"sort_order\\" INTEGER DEFAULT 0,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"actor_profile_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT NOT NULL DEFAULT 'like'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"meta_type":{"type":"TEXT","notNull":true,"unique":false},"meta_id":{"type":"TEXT","notNull":true,"unique":false},"role":{"type":"TEXT","notNull":true,"unique":false},"sort_order":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"kind":{"type":"TEXT","notNull":true,"unique":false,"default":"like"}},"indexes":[{"name":"record_reactions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"record_reactions_actor_kind","columns":["tenant_id","meta_type","meta_id","actor_profile_id","kind"],"unique":true},{"name":"record_reactions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"record_reactions_meta_type_meta_id_idx","columns":["meta_type","meta_id"]},{"name":"record_reactions_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"678ebe0f"},"importPath":"@happyvertical/smrt-reactions"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-comments","@happyvertical/smrt-core","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3624"],"via":["@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/write-authority.ts
|
|
7
|
+
var authority = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
async function withParticipationWrite(executor, work) {
|
|
9
|
+
authority.set(executor, (authority.get(executor) ?? 0) + 1);
|
|
10
|
+
try {
|
|
11
|
+
return await work();
|
|
12
|
+
} finally {
|
|
13
|
+
const remaining = (authority.get(executor) ?? 1) - 1;
|
|
14
|
+
if (remaining) authority.set(executor, remaining);
|
|
15
|
+
else authority.delete(executor);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function assertParticipationWrite(executor) {
|
|
19
|
+
if (!authority.has(executor)) throw new ValidationError("Participation records require service write authority.", "VALIDATION_PARTICIPATION_AUTHORITY");
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/models/Poll.ts
|
|
23
|
+
var __defProp$2 = Object.defineProperty;
|
|
24
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
25
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value
|
|
30
|
+
}) : obj[key] = value;
|
|
31
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
32
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
33
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
34
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
38
|
+
var Poll = class extends SmrtPolymorphicAssociation {
|
|
39
|
+
tenantId = "";
|
|
40
|
+
question = "";
|
|
41
|
+
optionsJson = "[]";
|
|
42
|
+
opensAt = null;
|
|
43
|
+
closesAt = null;
|
|
44
|
+
visibility = "always";
|
|
45
|
+
oneVotePerActor = true;
|
|
46
|
+
anonymousTally = true;
|
|
47
|
+
closed = false;
|
|
48
|
+
constructor(options = {}) {
|
|
49
|
+
super(options);
|
|
50
|
+
if (options.tenantId !== void 0) this.tenantId = options.tenantId;
|
|
51
|
+
if (options.question !== void 0) this.question = options.question;
|
|
52
|
+
if (options.optionsJson !== void 0) this.optionsJson = options.optionsJson;
|
|
53
|
+
if (options.opensAt !== void 0) this.opensAt = options.opensAt;
|
|
54
|
+
if (options.closesAt !== void 0) this.closesAt = options.closesAt;
|
|
55
|
+
if (options.visibility !== void 0) this.visibility = options.visibility;
|
|
56
|
+
if (options.anonymousTally !== void 0) this.anonymousTally = options.anonymousTally;
|
|
57
|
+
if (options.closed !== void 0) this.closed = options.closed;
|
|
58
|
+
}
|
|
59
|
+
assertWriteAuthority() {
|
|
60
|
+
assertParticipationWrite(this.db);
|
|
61
|
+
}
|
|
62
|
+
async validateBeforeSave() {
|
|
63
|
+
assertParticipationWrite(this.db);
|
|
64
|
+
await super.validateBeforeSave();
|
|
65
|
+
this.pollOptions;
|
|
66
|
+
if (this.id) {
|
|
67
|
+
const existing = await this.getCanonicalPersistedRow({ id: this.id });
|
|
68
|
+
if (existing && (existing.options_json !== this.optionsJson || existing.tenant_id !== this.tenantId || existing.meta_type !== this.metaType || existing.meta_id !== this.metaId)) throw new ValidationError("Poll target and options are immutable.", "VALIDATION_IMMUTABLE_POLL");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
get pollOptions() {
|
|
72
|
+
const parsed = JSON.parse(this.optionsJson);
|
|
73
|
+
if (!Array.isArray(parsed) || parsed.length < 2 || parsed.length > 50 || parsed.some((o) => !o || typeof o.id !== "string" || !o.id.trim() || typeof o.label !== "string" || !o.label.trim()) || new Set(parsed.map((o) => o.id)).size !== parsed.length) throw new TypeError("Invalid poll options.");
|
|
74
|
+
return parsed.map((o) => ({
|
|
75
|
+
id: o.id,
|
|
76
|
+
label: o.label
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
__publicField$2(Poll, "__smrtPackage__", "@happyvertical/smrt-reactions");
|
|
81
|
+
__decorateClass$2([tenantId()], Poll.prototype, "tenantId", 2);
|
|
82
|
+
__decorateClass$2([field({ required: true })], Poll.prototype, "question", 2);
|
|
83
|
+
__decorateClass$2([field({
|
|
84
|
+
type: "text",
|
|
85
|
+
readonly: true
|
|
86
|
+
})], Poll.prototype, "optionsJson", 2);
|
|
87
|
+
__decorateClass$2([field({
|
|
88
|
+
type: "datetime",
|
|
89
|
+
nullable: true
|
|
90
|
+
})], Poll.prototype, "opensAt", 2);
|
|
91
|
+
__decorateClass$2([field({
|
|
92
|
+
type: "datetime",
|
|
93
|
+
nullable: true
|
|
94
|
+
})], Poll.prototype, "closesAt", 2);
|
|
95
|
+
__decorateClass$2([field()], Poll.prototype, "visibility", 2);
|
|
96
|
+
__decorateClass$2([field()], Poll.prototype, "oneVotePerActor", 2);
|
|
97
|
+
__decorateClass$2([field()], Poll.prototype, "anonymousTally", 2);
|
|
98
|
+
__decorateClass$2([field()], Poll.prototype, "closed", 2);
|
|
99
|
+
Poll = __decorateClass$2([TenantScoped({ mode: "required" }), smrt({
|
|
100
|
+
tableName: "record_polls",
|
|
101
|
+
api: false,
|
|
102
|
+
mcp: false,
|
|
103
|
+
cli: false,
|
|
104
|
+
hooks: { beforeDelete: "assertWriteAuthority" },
|
|
105
|
+
indexes: [{
|
|
106
|
+
name: "record_polls_target",
|
|
107
|
+
columns: [
|
|
108
|
+
"tenantId",
|
|
109
|
+
"metaType",
|
|
110
|
+
"metaId"
|
|
111
|
+
]
|
|
112
|
+
}]
|
|
113
|
+
})], Poll);
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/models/PollVote.ts
|
|
116
|
+
var __defProp$1 = Object.defineProperty;
|
|
117
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
118
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
|
|
119
|
+
enumerable: true,
|
|
120
|
+
configurable: true,
|
|
121
|
+
writable: true,
|
|
122
|
+
value
|
|
123
|
+
}) : obj[key] = value;
|
|
124
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
125
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
126
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
127
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
128
|
+
return result;
|
|
129
|
+
};
|
|
130
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
131
|
+
var PollVote = class extends SmrtObject {
|
|
132
|
+
tenantId = "";
|
|
133
|
+
pollId = "";
|
|
134
|
+
actorProfileId = "";
|
|
135
|
+
optionId = "";
|
|
136
|
+
participationSnapshot = "{}";
|
|
137
|
+
constructor(options = {}) {
|
|
138
|
+
super(options);
|
|
139
|
+
if (options.tenantId !== void 0) this.tenantId = options.tenantId;
|
|
140
|
+
if (options.pollId !== void 0) this.pollId = options.pollId;
|
|
141
|
+
if (options.actorProfileId !== void 0) this.actorProfileId = options.actorProfileId;
|
|
142
|
+
if (options.optionId !== void 0) this.optionId = options.optionId;
|
|
143
|
+
if (options.participationSnapshot !== void 0) this.participationSnapshot = options.participationSnapshot;
|
|
144
|
+
}
|
|
145
|
+
assertWriteAuthority() {
|
|
146
|
+
assertParticipationWrite(this.db);
|
|
147
|
+
}
|
|
148
|
+
async validateBeforeSave() {
|
|
149
|
+
assertParticipationWrite(this.db);
|
|
150
|
+
await super.validateBeforeSave();
|
|
151
|
+
const evidence = JSON.parse(this.participationSnapshot);
|
|
152
|
+
if (!evidence || typeof evidence !== "object" || Array.isArray(evidence) || Object.keys(evidence).length === 0) throw new TypeError("Participation snapshot must be a nonempty JSON object.");
|
|
153
|
+
if (this.id) {
|
|
154
|
+
const existing = await this.getCanonicalPersistedRow({ id: this.id });
|
|
155
|
+
if (existing && (existing.participation_snapshot !== this.participationSnapshot || existing.option_id !== this.optionId || existing.tenant_id !== this.tenantId || existing.poll_id !== this.pollId || existing.actor_profile_id !== this.actorProfileId)) throw new ValidationError("Recorded votes are immutable.", "VALIDATION_IMMUTABLE_VOTE");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
__publicField$1(PollVote, "__smrtPackage__", "@happyvertical/smrt-reactions");
|
|
160
|
+
__decorateClass$1([tenantId()], PollVote.prototype, "tenantId", 2);
|
|
161
|
+
__decorateClass$1([foreignKey(Poll, {
|
|
162
|
+
required: true,
|
|
163
|
+
onUpdate: "NO ACTION",
|
|
164
|
+
onDelete: "NO ACTION"
|
|
165
|
+
})], PollVote.prototype, "pollId", 2);
|
|
166
|
+
__decorateClass$1([crossPackageRef("@happyvertical/smrt-profiles:Profile", { required: true })], PollVote.prototype, "actorProfileId", 2);
|
|
167
|
+
__decorateClass$1([field({
|
|
168
|
+
required: true,
|
|
169
|
+
readonly: true
|
|
170
|
+
})], PollVote.prototype, "optionId", 2);
|
|
171
|
+
__decorateClass$1([field({
|
|
172
|
+
type: "text",
|
|
173
|
+
required: true,
|
|
174
|
+
readonly: true
|
|
175
|
+
})], PollVote.prototype, "participationSnapshot", 2);
|
|
176
|
+
PollVote = __decorateClass$1([TenantScoped({ mode: "required" }), smrt({
|
|
177
|
+
tableName: "poll_votes",
|
|
178
|
+
api: false,
|
|
179
|
+
mcp: false,
|
|
180
|
+
cli: false,
|
|
181
|
+
hooks: { beforeDelete: "assertWriteAuthority" },
|
|
182
|
+
indexes: [{
|
|
183
|
+
name: "poll_votes_actor",
|
|
184
|
+
columns: [
|
|
185
|
+
"tenantId",
|
|
186
|
+
"pollId",
|
|
187
|
+
"actorProfileId"
|
|
188
|
+
],
|
|
189
|
+
unique: true
|
|
190
|
+
}]
|
|
191
|
+
})], PollVote);
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/models/Reaction.ts
|
|
194
|
+
var __defProp = Object.defineProperty;
|
|
195
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
196
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
197
|
+
enumerable: true,
|
|
198
|
+
configurable: true,
|
|
199
|
+
writable: true,
|
|
200
|
+
value
|
|
201
|
+
}) : obj[key] = value;
|
|
202
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
203
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
204
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
205
|
+
if (kind && result) __defProp(target, key, result);
|
|
206
|
+
return result;
|
|
207
|
+
};
|
|
208
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
209
|
+
var Reaction = class extends SmrtPolymorphicAssociation {
|
|
210
|
+
tenantId = "";
|
|
211
|
+
actorProfileId = "";
|
|
212
|
+
kind = "like";
|
|
213
|
+
constructor(options = {}) {
|
|
214
|
+
super(options);
|
|
215
|
+
if (options.tenantId !== void 0) this.tenantId = options.tenantId;
|
|
216
|
+
if (options.actorProfileId !== void 0) this.actorProfileId = options.actorProfileId;
|
|
217
|
+
if (options.kind !== void 0) this.kind = options.kind;
|
|
218
|
+
}
|
|
219
|
+
assertWriteAuthority() {
|
|
220
|
+
assertParticipationWrite(this.db);
|
|
221
|
+
}
|
|
222
|
+
async validateBeforeSave() {
|
|
223
|
+
assertParticipationWrite(this.db);
|
|
224
|
+
await super.validateBeforeSave();
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
__publicField(Reaction, "__smrtPackage__", "@happyvertical/smrt-reactions");
|
|
228
|
+
__decorateClass([tenantId()], Reaction.prototype, "tenantId", 2);
|
|
229
|
+
__decorateClass([crossPackageRef("@happyvertical/smrt-profiles:Profile", { required: true })], Reaction.prototype, "actorProfileId", 2);
|
|
230
|
+
__decorateClass([field({ required: true })], Reaction.prototype, "kind", 2);
|
|
231
|
+
Reaction = __decorateClass([TenantScoped({ mode: "required" }), smrt({
|
|
232
|
+
tableName: "record_reactions",
|
|
233
|
+
api: false,
|
|
234
|
+
mcp: false,
|
|
235
|
+
cli: false,
|
|
236
|
+
hooks: { beforeDelete: "assertWriteAuthority" },
|
|
237
|
+
indexes: [{
|
|
238
|
+
name: "record_reactions_actor_kind",
|
|
239
|
+
columns: [
|
|
240
|
+
"tenantId",
|
|
241
|
+
"metaType",
|
|
242
|
+
"metaId",
|
|
243
|
+
"actorProfileId",
|
|
244
|
+
"kind"
|
|
245
|
+
],
|
|
246
|
+
unique: true
|
|
247
|
+
}]
|
|
248
|
+
})], Reaction);
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/collections/index.ts
|
|
251
|
+
var ReactionCollection = class extends SmrtCollection {
|
|
252
|
+
static _itemClass = Reaction;
|
|
253
|
+
};
|
|
254
|
+
var PollCollection = class extends SmrtCollection {
|
|
255
|
+
static _itemClass = Poll;
|
|
256
|
+
};
|
|
257
|
+
var PollVoteCollection = class extends SmrtCollection {
|
|
258
|
+
static _itemClass = PollVote;
|
|
259
|
+
};
|
|
260
|
+
//#endregion
|
|
261
|
+
export { PollVote as a, Reaction as i, PollVoteCollection as n, Poll as o, ReactionCollection as r, withParticipationWrite as s, PollCollection as t };
|
|
262
|
+
|
|
263
|
+
//# sourceMappingURL=src-iXPteaLV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-iXPteaLV.js","names":[],"sources":["../../src/__smrt-register__.ts","../../src/write-authority.ts","../../src/models/Poll.ts","../../src/models/PollVote.ts","../../src/models/Reaction.ts","../../src/collections/index.ts"],"sourcesContent":["// Generated by @happyvertical/smrt-core smrtPlugin at library build time.\n// The package manifest is inlined so self-registration cannot miss when a\n// downstream bundler relocates this module away from dist/manifest.json\n// (https://github.com/happyvertical/smrt/issues/1506,\n// https://github.com/happyvertical/smrt/issues/1507).\nimport { ObjectRegistry } from '@happyvertical/smrt-core';\n\nObjectRegistry.registerPackageManifest(JSON.parse(\"{\\\"version\\\":\\\"1.0.0\\\",\\\"timestamp\\\":0,\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"packageVersion\\\":\\\"0.57.47\\\",\\\"objects\\\":{\\\"@happyvertical/smrt-reactions:ReactionCollection\\\":{\\\"name\\\":\\\"reactioncollection\\\",\\\"className\\\":\\\"ReactionCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-reactions:ReactionCollection\\\",\\\"collection\\\":\\\"reactions\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/reactions/src/collections/index.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"record_reactions\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Reaction\\\",\\\"exportName\\\":\\\"ReactionCollection\\\",\\\"collectionExportName\\\":\\\"ReactionCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-reactions:Reaction\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"record_reactions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"record_reactions\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"meta_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"role\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"sort_order\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"actor_profile_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"kind\\\\\\\" TEXT NOT NULL DEFAULT 'like'\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"meta_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"role\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"sort_order\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"actor_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"like\\\"}},\\\"indexes\\\":[{\\\"name\\\":\\\"record_reactions_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"record_reactions_actor_kind\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"meta_type\\\",\\\"meta_id\\\",\\\"actor_profile_id\\\",\\\"kind\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"record_reactions_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"record_reactions_meta_type_meta_id_idx\\\",\\\"columns\\\":[\\\"meta_type\\\",\\\"meta_id\\\"]},{\\\"name\\\":\\\"record_reactions_actor_profile_id_idx\\\",\\\"columns\\\":[\\\"actor_profile_id\\\"]}],\\\"version\\\":\\\"678ebe0f\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-reactions\\\"},\\\"@happyvertical/smrt-reactions:PollCollection\\\":{\\\"name\\\":\\\"pollcollection\\\",\\\"className\\\":\\\"PollCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-reactions:PollCollection\\\",\\\"collection\\\":\\\"polls\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/reactions/src/collections/index.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"record_polls\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Poll\\\",\\\"exportName\\\":\\\"PollCollection\\\",\\\"collectionExportName\\\":\\\"PollCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-reactions:Poll\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"record_polls\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"record_polls\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"meta_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"role\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"sort_order\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"question\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"options_json\\\\\\\" TEXT,\\\\n \\\\\\\"opens_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"closes_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"visibility\\\\\\\" TEXT DEFAULT 'always',\\\\n \\\\\\\"one_vote_per_actor\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE,\\\\n \\\\\\\"anonymous_tally\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE,\\\\n \\\\\\\"closed\\\\\\\" BOOLEAN NOT NULL DEFAULT FALSE\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"meta_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"role\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"sort_order\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"question\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"options_json\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"opens_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"closes_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"visibility\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"always\\\"},\\\"one_vote_per_actor\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true},\\\"anonymous_tally\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true},\\\"closed\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"record_polls_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"record_polls_target\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"meta_type\\\",\\\"meta_id\\\"]},{\\\"name\\\":\\\"record_polls_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"record_polls_meta_type_meta_id_idx\\\",\\\"columns\\\":[\\\"meta_type\\\",\\\"meta_id\\\"]}],\\\"version\\\":\\\"f6713370\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-reactions\\\"},\\\"@happyvertical/smrt-reactions:PollVoteCollection\\\":{\\\"name\\\":\\\"pollvotecollection\\\",\\\"className\\\":\\\"PollVoteCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-reactions:PollVoteCollection\\\",\\\"collection\\\":\\\"pollvotes\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/reactions/src/collections/index.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"poll_votes\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"PollVote\\\",\\\"exportName\\\":\\\"PollVoteCollection\\\",\\\"collectionExportName\\\":\\\"PollVoteCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-reactions:PollVote\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"poll_votes\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"poll_votes\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"poll_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"actor_profile_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"option_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"participation_snapshot\\\\\\\" TEXT NOT NULL\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"poll_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"record_polls\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"NO ACTION\\\"}},\\\"actor_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"option_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"participation_snapshot\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"poll_votes_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"poll_votes_actor\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"poll_id\\\",\\\"actor_profile_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"poll_votes_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"poll_votes_poll_id_idx\\\",\\\"columns\\\":[\\\"poll_id\\\"]},{\\\"name\\\":\\\"poll_votes_actor_profile_id_idx\\\",\\\"columns\\\":[\\\"actor_profile_id\\\"]}],\\\"version\\\":\\\"c22797d0\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-reactions\\\"},\\\"@happyvertical/smrt-reactions:Poll\\\":{\\\"name\\\":\\\"poll\\\",\\\"className\\\":\\\"Poll\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-reactions:Poll\\\",\\\"collection\\\":\\\"polls\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/reactions/src/models/Poll.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"fields\\\":{\\\"metaType\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"metaId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"role\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"sortOrder\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":false,\\\"default\\\":0},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false}}},\\\"question\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"optionsJson\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"readonly\\\":true},\\\"readonly\\\":true},\\\"opensAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"closesAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"visibility\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"always\\\",\\\"enum\\\":[\\\"always\\\",\\\"after_vote\\\",\\\"after_close\\\"]},\\\"oneVotePerActor\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":true,\\\"default\\\":true},\\\"anonymousTally\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":true,\\\"default\\\":true},\\\"closed\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":true,\\\"default\\\":false}},\\\"methods\\\":{\\\"hydrate\\\":{\\\"name\\\":\\\"hydrate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<T | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"assertWriteAuthority\\\":{\\\"name\\\":\\\"assertWriteAuthority\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"record_polls\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false,\\\"hooks\\\":{\\\"beforeDelete\\\":\\\"assertWriteAuthority\\\"},\\\"indexes\\\":[{\\\"name\\\":\\\"record_polls_target\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"metaType\\\",\\\"metaId\\\"]}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtPolymorphicAssociation\\\",\\\"exportName\\\":\\\"Poll\\\",\\\"collectionExportName\\\":\\\"PollCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"metaType\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"metaId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"role\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"question\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"oneVotePerActor\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"anonymousTally\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"closed\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"record_polls\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"record_polls\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"meta_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"role\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"sort_order\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"question\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"options_json\\\\\\\" TEXT,\\\\n \\\\\\\"opens_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"closes_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"visibility\\\\\\\" TEXT DEFAULT 'always',\\\\n \\\\\\\"one_vote_per_actor\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE,\\\\n \\\\\\\"anonymous_tally\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE,\\\\n \\\\\\\"closed\\\\\\\" BOOLEAN NOT NULL DEFAULT FALSE\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"meta_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"role\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"sort_order\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"question\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"options_json\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"opens_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"closes_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"visibility\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"always\\\"},\\\"one_vote_per_actor\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true},\\\"anonymous_tally\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true},\\\"closed\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"record_polls_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"record_polls_target\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"meta_type\\\",\\\"meta_id\\\"]},{\\\"name\\\":\\\"record_polls_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"record_polls_meta_type_meta_id_idx\\\",\\\"columns\\\":[\\\"meta_type\\\",\\\"meta_id\\\"]}],\\\"version\\\":\\\"f6713370\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-reactions\\\"},\\\"@happyvertical/smrt-reactions:PollVote\\\":{\\\"name\\\":\\\"pollvote\\\",\\\"className\\\":\\\"PollVote\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-reactions:PollVote\\\",\\\"collection\\\":\\\"pollvotes\\\",\\\"description\\\":\\\"Append-only through PollService; no generated write API.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/reactions/src/models/PollVote.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false}}},\\\"pollId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Poll\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"NO ACTION\\\"}},\\\"actorProfileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":true,\\\"related\\\":\\\"@happyvertical/smrt-profiles:Profile\\\"},\\\"optionId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"readonly\\\":true},\\\"readonly\\\":true},\\\"participationSnapshot\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"readonly\\\":true},\\\"readonly\\\":true}},\\\"methods\\\":{\\\"assertWriteAuthority\\\":{\\\"name\\\":\\\"assertWriteAuthority\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"poll_votes\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false,\\\"hooks\\\":{\\\"beforeDelete\\\":\\\"assertWriteAuthority\\\"},\\\"indexes\\\":[{\\\"name\\\":\\\"poll_votes_actor\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"pollId\\\",\\\"actorProfileId\\\"],\\\"unique\\\":true}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"PollVote\\\",\\\"collectionExportName\\\":\\\"PollVoteCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"pollId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"actorProfileId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"crossPackageRef\\\"},{\\\"field\\\":\\\"optionId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"participationSnapshot\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"poll_votes\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"poll_votes\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"poll_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"actor_profile_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"option_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"participation_snapshot\\\\\\\" TEXT NOT NULL\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"poll_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"record_polls\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"NO ACTION\\\"}},\\\"actor_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"option_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"participation_snapshot\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"poll_votes_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"poll_votes_actor\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"poll_id\\\",\\\"actor_profile_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"poll_votes_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"poll_votes_poll_id_idx\\\",\\\"columns\\\":[\\\"poll_id\\\"]},{\\\"name\\\":\\\"poll_votes_actor_profile_id_idx\\\",\\\"columns\\\":[\\\"actor_profile_id\\\"]}],\\\"version\\\":\\\"c22797d0\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-reactions\\\"},\\\"@happyvertical/smrt-reactions:Reaction\\\":{\\\"name\\\":\\\"reaction\\\",\\\"className\\\":\\\"Reaction\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-reactions:Reaction\\\",\\\"collection\\\":\\\"reactions\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/reactions/src/models/Reaction.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"fields\\\":{\\\"metaType\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"metaId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"role\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"sortOrder\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":false,\\\"default\\\":0},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false}}},\\\"actorProfileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":true,\\\"related\\\":\\\"@happyvertical/smrt-profiles:Profile\\\"},\\\"kind\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"default\\\":\\\"like\\\",\\\"_meta\\\":{\\\"required\\\":true},\\\"enum\\\":[\\\"like\\\",\\\"love\\\",\\\"celebrate\\\",\\\"insightful\\\",\\\"support\\\"]}},\\\"methods\\\":{\\\"hydrate\\\":{\\\"name\\\":\\\"hydrate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<T | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"assertWriteAuthority\\\":{\\\"name\\\":\\\"assertWriteAuthority\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"record_reactions\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false,\\\"hooks\\\":{\\\"beforeDelete\\\":\\\"assertWriteAuthority\\\"},\\\"indexes\\\":[{\\\"name\\\":\\\"record_reactions_actor_kind\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"metaType\\\",\\\"metaId\\\",\\\"actorProfileId\\\",\\\"kind\\\"],\\\"unique\\\":true}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtPolymorphicAssociation\\\",\\\"exportName\\\":\\\"Reaction\\\",\\\"collectionExportName\\\":\\\"ReactionCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"metaType\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"metaId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"role\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"actorProfileId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"crossPackageRef\\\"},{\\\"field\\\":\\\"kind\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"record_reactions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"record_reactions\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"meta_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"role\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"sort_order\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"actor_profile_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"kind\\\\\\\" TEXT NOT NULL DEFAULT 'like'\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"meta_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"role\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"sort_order\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"actor_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"like\\\"}},\\\"indexes\\\":[{\\\"name\\\":\\\"record_reactions_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"record_reactions_actor_kind\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"meta_type\\\",\\\"meta_id\\\",\\\"actor_profile_id\\\",\\\"kind\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"record_reactions_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"record_reactions_meta_type_meta_id_idx\\\",\\\"columns\\\":[\\\"meta_type\\\",\\\"meta_id\\\"]},{\\\"name\\\":\\\"record_reactions_actor_profile_id_idx\\\",\\\"columns\\\":[\\\"actor_profile_id\\\"]}],\\\"version\\\":\\\"678ebe0f\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-reactions\\\"}},\\\"moduleType\\\":\\\"smrt\\\",\\\"smrtDependencies\\\":[\\\"@happyvertical/smrt-comments\\\",\\\"@happyvertical/smrt-core\\\",\\\"@happyvertical/smrt-tenancy\\\"],\\\"browser\\\":{\\\"status\\\":\\\"server-only\\\",\\\"issues\\\":[\\\"#3624\\\"],\\\"via\\\":[\\\"@happyvertical/smrt-tenancy\\\"]},\\\"stampsConstructors\\\":true}\"));\n","import { ValidationError } from '@happyvertical/smrt-core';\n\n/** Authority belongs only to a unique operation transaction, never a root adapter. */\nconst authority = new WeakMap<object, number>();\n/** Package-private authority; never re-export from a public entry point. */\nexport async function withParticipationWrite<T>(\n executor: object,\n work: () => Promise<T>,\n): Promise<T> {\n authority.set(executor, (authority.get(executor) ?? 0) + 1);\n try {\n return await work();\n } finally {\n const remaining = (authority.get(executor) ?? 1) - 1;\n if (remaining) authority.set(executor, remaining);\n else authority.delete(executor);\n }\n}\nexport function assertParticipationWrite(executor: object): void {\n if (!authority.has(executor))\n throw new ValidationError(\n 'Participation records require service write authority.',\n 'VALIDATION_PARTICIPATION_AUTHORITY',\n );\n}\n","import {\n field,\n SmrtPolymorphicAssociation,\n type SmrtPolymorphicAssociationOptions,\n smrt,\n ValidationError,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\nimport type { PollOption, PollVisibility } from '../types.js';\nimport { assertParticipationWrite } from '../write-authority.js';\nexport interface PollOptions extends SmrtPolymorphicAssociationOptions {\n tenantId?: string;\n question?: string;\n optionsJson?: string;\n opensAt?: Date | null;\n closesAt?: Date | null;\n visibility?: PollVisibility;\n anonymousTally?: boolean;\n closed?: boolean;\n}\n@TenantScoped({ mode: 'required' })\n@smrt({\n tableName: 'record_polls',\n api: false,\n mcp: false,\n cli: false,\n hooks: { beforeDelete: 'assertWriteAuthority' },\n indexes: [\n {\n name: 'record_polls_target',\n columns: ['tenantId', 'metaType', 'metaId'],\n },\n ],\n})\nexport class Poll extends SmrtPolymorphicAssociation { static __smrtPackage__ = \"@happyvertical/smrt-reactions\";\n @tenantId() tenantId = '';\n @field({ required: true }) question = '';\n @field({ type: 'text', readonly: true }) optionsJson = '[]';\n @field({ type: 'datetime', nullable: true }) opensAt: Date | null = null;\n @field({ type: 'datetime', nullable: true }) closesAt: Date | null = null;\n @field() visibility: PollVisibility = 'always';\n @field() oneVotePerActor = true;\n @field() anonymousTally = true;\n @field() closed = false;\n constructor(options: PollOptions = {}) {\n super(options);\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n if (options.question !== undefined) this.question = options.question;\n if (options.optionsJson !== undefined)\n this.optionsJson = options.optionsJson;\n if (options.opensAt !== undefined) this.opensAt = options.opensAt;\n if (options.closesAt !== undefined) this.closesAt = options.closesAt;\n if (options.visibility !== undefined) this.visibility = options.visibility;\n if (options.anonymousTally !== undefined)\n this.anonymousTally = options.anonymousTally;\n if (options.closed !== undefined) this.closed = options.closed;\n }\n assertWriteAuthority(): void {\n assertParticipationWrite(this.db);\n }\n protected override async validateBeforeSave(): Promise<void> {\n assertParticipationWrite(this.db);\n await super.validateBeforeSave();\n this.pollOptions;\n if (this.id) {\n const existing = await this.getCanonicalPersistedRow({ id: this.id });\n if (\n existing &&\n (existing.options_json !== this.optionsJson ||\n existing.tenant_id !== this.tenantId ||\n existing.meta_type !== this.metaType ||\n existing.meta_id !== this.metaId)\n )\n throw new ValidationError(\n 'Poll target and options are immutable.',\n 'VALIDATION_IMMUTABLE_POLL',\n );\n }\n }\n get pollOptions(): PollOption[] {\n const parsed: unknown = JSON.parse(this.optionsJson);\n if (\n !Array.isArray(parsed) ||\n parsed.length < 2 ||\n parsed.length > 50 ||\n parsed.some(\n (o) =>\n !o ||\n typeof o.id !== 'string' ||\n !o.id.trim() ||\n typeof o.label !== 'string' ||\n !o.label.trim(),\n ) ||\n new Set(parsed.map((o) => o.id)).size !== parsed.length\n )\n throw new TypeError('Invalid poll options.');\n return parsed.map((o) => ({ id: o.id, label: o.label }));\n }\n}\n","import {\n crossPackageRef,\n field,\n foreignKey,\n type SmrtClassOptions,\n SmrtObject,\n smrt,\n ValidationError,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\nimport { assertParticipationWrite } from '../write-authority.js';\nimport { Poll } from './Poll.js';\nexport interface PollVoteOptions extends SmrtClassOptions {\n tenantId?: string;\n pollId?: string;\n optionId?: string;\n actorProfileId?: string;\n participationSnapshot?: string;\n}\n/** Append-only through PollService; no generated write API. */\n@TenantScoped({ mode: 'required' })\n@smrt({\n tableName: 'poll_votes',\n api: false,\n mcp: false,\n cli: false,\n hooks: { beforeDelete: 'assertWriteAuthority' },\n indexes: [\n {\n name: 'poll_votes_actor',\n columns: ['tenantId', 'pollId', 'actorProfileId'],\n unique: true,\n },\n ],\n})\nexport class PollVote extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-reactions\";\n @tenantId() tenantId = '';\n @foreignKey(Poll, {\n required: true,\n onUpdate: 'NO ACTION',\n onDelete: 'NO ACTION',\n })\n pollId = '';\n @crossPackageRef('@happyvertical/smrt-profiles:Profile', { required: true })\n actorProfileId = '';\n @field({ required: true, readonly: true }) optionId = '';\n @field({ type: 'text', required: true, readonly: true })\n participationSnapshot = '{}';\n constructor(options: PollVoteOptions = {}) {\n super(options);\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n if (options.pollId !== undefined) this.pollId = options.pollId;\n if (options.actorProfileId !== undefined)\n this.actorProfileId = options.actorProfileId;\n if (options.optionId !== undefined) this.optionId = options.optionId;\n if (options.participationSnapshot !== undefined)\n this.participationSnapshot = options.participationSnapshot;\n }\n assertWriteAuthority(): void {\n assertParticipationWrite(this.db);\n }\n protected override async validateBeforeSave(): Promise<void> {\n assertParticipationWrite(this.db);\n await super.validateBeforeSave();\n const evidence: unknown = JSON.parse(this.participationSnapshot);\n if (\n !evidence ||\n typeof evidence !== 'object' ||\n Array.isArray(evidence) ||\n Object.keys(evidence).length === 0\n )\n throw new TypeError(\n 'Participation snapshot must be a nonempty JSON object.',\n );\n if (this.id) {\n const existing = await this.getCanonicalPersistedRow({ id: this.id });\n if (\n existing &&\n (existing.participation_snapshot !== this.participationSnapshot ||\n existing.option_id !== this.optionId ||\n existing.tenant_id !== this.tenantId ||\n existing.poll_id !== this.pollId ||\n existing.actor_profile_id !== this.actorProfileId)\n )\n throw new ValidationError(\n 'Recorded votes are immutable.',\n 'VALIDATION_IMMUTABLE_VOTE',\n );\n }\n }\n}\n","import {\n crossPackageRef,\n field,\n SmrtPolymorphicAssociation,\n type SmrtPolymorphicAssociationOptions,\n smrt,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\nimport type { ReactionKind } from '../types.js';\nimport { assertParticipationWrite } from '../write-authority.js';\n\n@TenantScoped({ mode: 'required' })\n@smrt({\n tableName: 'record_reactions',\n api: false,\n mcp: false,\n cli: false,\n hooks: { beforeDelete: 'assertWriteAuthority' },\n indexes: [\n {\n name: 'record_reactions_actor_kind',\n columns: ['tenantId', 'metaType', 'metaId', 'actorProfileId', 'kind'],\n unique: true,\n },\n ],\n})\nexport class Reaction extends SmrtPolymorphicAssociation { static __smrtPackage__ = \"@happyvertical/smrt-reactions\";\n @tenantId() tenantId = '';\n @crossPackageRef('@happyvertical/smrt-profiles:Profile', { required: true })\n actorProfileId = '';\n @field({ required: true }) kind: ReactionKind = 'like';\n constructor(\n options: SmrtPolymorphicAssociationOptions & {\n tenantId?: string;\n actorProfileId?: string;\n kind?: ReactionKind;\n } = {},\n ) {\n super(options);\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n if (options.actorProfileId !== undefined)\n this.actorProfileId = options.actorProfileId;\n if (options.kind !== undefined) this.kind = options.kind;\n }\n assertWriteAuthority(): void {\n assertParticipationWrite(this.db);\n }\n protected override async validateBeforeSave(): Promise<void> {\n assertParticipationWrite(this.db);\n await super.validateBeforeSave();\n }\n}\n","import { SmrtCollection } from '@happyvertical/smrt-core';\nimport { Poll } from '../models/Poll.js';\nimport { PollVote } from '../models/PollVote.js';\nimport { Reaction } from '../models/Reaction.js';\nexport class ReactionCollection extends SmrtCollection<Reaction> {\n static readonly _itemClass = Reaction;\n}\nexport class PollCollection extends SmrtCollection<Poll> {\n static readonly _itemClass = Poll;\n}\nexport class PollVoteCollection extends SmrtCollection<PollVote> {\n static readonly _itemClass = PollVote;\n}\n"],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as PollVote, i as Reaction, n as PollVoteCollection, o as Poll, r as ReactionCollection, t as PollCollection } from "./chunks/src-
|
|
1
|
+
import { a as PollVote, i as Reaction, n as PollVoteCollection, o as Poll, r as ReactionCollection, t as PollCollection } from "./chunks/src-iXPteaLV.js";
|
|
2
2
|
import { REACTION_KINDS } from "./types.js";
|
|
3
3
|
export { Poll, PollCollection, PollVote, PollVoteCollection, REACTION_KINDS, Reaction, ReactionCollection };
|
package/dist/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": "1.0.0",
|
|
3
3
|
"timestamp": 0,
|
|
4
4
|
"packageName": "@happyvertical/smrt-reactions",
|
|
5
|
-
"packageVersion": "0.57.
|
|
5
|
+
"packageVersion": "0.57.47",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/smrt-reactions:ReactionCollection": {
|
|
8
8
|
"name": "reactioncollection",
|
|
@@ -23,6 +23,12 @@
|
|
|
23
23
|
"extendsTypeArg": "Reaction",
|
|
24
24
|
"exportName": "ReactionCollection",
|
|
25
25
|
"collectionExportName": "ReactionCollectionCollection",
|
|
26
|
+
"collectionOf": "@happyvertical/smrt-reactions:Reaction",
|
|
27
|
+
"inheritedExposure": [
|
|
28
|
+
"api",
|
|
29
|
+
"mcp",
|
|
30
|
+
"cli"
|
|
31
|
+
],
|
|
26
32
|
"schema": {
|
|
27
33
|
"tableName": "record_reactions",
|
|
28
34
|
"ddl": "CREATE TABLE IF NOT EXISTS \"record_reactions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"meta_type\" TEXT NOT NULL,\n \"meta_id\" TEXT NOT NULL,\n \"role\" TEXT NOT NULL,\n \"sort_order\" INTEGER DEFAULT 0,\n \"tenant_id\" UUID NOT NULL,\n \"actor_profile_id\" UUID NOT NULL,\n \"kind\" TEXT NOT NULL DEFAULT 'like'\n);",
|
|
@@ -157,6 +163,12 @@
|
|
|
157
163
|
"extendsTypeArg": "Poll",
|
|
158
164
|
"exportName": "PollCollection",
|
|
159
165
|
"collectionExportName": "PollCollectionCollection",
|
|
166
|
+
"collectionOf": "@happyvertical/smrt-reactions:Poll",
|
|
167
|
+
"inheritedExposure": [
|
|
168
|
+
"api",
|
|
169
|
+
"mcp",
|
|
170
|
+
"cli"
|
|
171
|
+
],
|
|
160
172
|
"schema": {
|
|
161
173
|
"tableName": "record_polls",
|
|
162
174
|
"ddl": "CREATE TABLE IF NOT EXISTS \"record_polls\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"meta_type\" TEXT NOT NULL,\n \"meta_id\" TEXT NOT NULL,\n \"role\" TEXT NOT NULL,\n \"sort_order\" INTEGER DEFAULT 0,\n \"tenant_id\" UUID NOT NULL,\n \"question\" TEXT NOT NULL,\n \"options_json\" TEXT,\n \"opens_at\" TIMESTAMP,\n \"closes_at\" TIMESTAMP,\n \"visibility\" TEXT DEFAULT 'always',\n \"one_vote_per_actor\" BOOLEAN NOT NULL DEFAULT TRUE,\n \"anonymous_tally\" BOOLEAN NOT NULL DEFAULT TRUE,\n \"closed\" BOOLEAN NOT NULL DEFAULT FALSE\n);",
|
|
@@ -314,6 +326,12 @@
|
|
|
314
326
|
"extendsTypeArg": "PollVote",
|
|
315
327
|
"exportName": "PollVoteCollection",
|
|
316
328
|
"collectionExportName": "PollVoteCollectionCollection",
|
|
329
|
+
"collectionOf": "@happyvertical/smrt-reactions:PollVote",
|
|
330
|
+
"inheritedExposure": [
|
|
331
|
+
"api",
|
|
332
|
+
"mcp",
|
|
333
|
+
"cli"
|
|
334
|
+
],
|
|
317
335
|
"schema": {
|
|
318
336
|
"tableName": "poll_votes",
|
|
319
337
|
"ddl": "CREATE TABLE IF NOT EXISTS \"poll_votes\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"poll_id\" UUID NOT NULL,\n \"actor_profile_id\" UUID NOT NULL,\n \"option_id\" TEXT NOT NULL,\n \"participation_snapshot\" TEXT NOT NULL\n);",
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as PollVote, i as Reaction, n as PollVoteCollection, o as Poll, r as ReactionCollection, s as withParticipationWrite, t as PollCollection } from "./chunks/src-
|
|
1
|
+
import { a as PollVote, i as Reaction, n as PollVoteCollection, o as Poll, r as ReactionCollection, s as withParticipationWrite, t as PollCollection } from "./chunks/src-iXPteaLV.js";
|
|
2
2
|
import { REACTION_KINDS } from "./types.js";
|
|
3
3
|
import { ObjectRegistry } from "@happyvertical/smrt-core";
|
|
4
4
|
import { withTenant } from "@happyvertical/smrt-tenancy";
|
package/dist/smrt-knowledge.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"sensitiveFieldsExcluded": true,
|
|
4
4
|
"generatedAt": "1970-01-01T00:00:00.000Z",
|
|
5
5
|
"packageName": "@happyvertical/smrt-reactions",
|
|
6
|
-
"packageVersion": "0.57.
|
|
6
|
+
"packageVersion": "0.57.47",
|
|
7
7
|
"sourceManifestPath": "dist/manifest.json",
|
|
8
8
|
"agentDocPath": "AGENTS.md",
|
|
9
9
|
"sourceHashes": {
|
|
10
|
-
"manifest": "
|
|
11
|
-
"packageJson": "
|
|
10
|
+
"manifest": "0eefca05d7928639a6e576667041a610bc8a3847e97b0a26d55b50e80e8cd4fd",
|
|
11
|
+
"packageJson": "088384f460b694707350a03f8efd392a7e2da2932fdce3d07b4b8e267352cc5c",
|
|
12
12
|
"agents": "c19832881616c1b4a422da22a888b71dfdeb4eea25974c30c6209f9d8c2242aa"
|
|
13
13
|
},
|
|
14
14
|
"exports": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-reactions",
|
|
3
|
-
"version": "0.57.
|
|
3
|
+
"version": "0.57.47",
|
|
4
4
|
"description": "Tenant-scoped reactions and lightweight polls with shared participation enforcement",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@happyvertical/smrt-core": "0.57.
|
|
32
|
-
"@happyvertical/smrt-tenancy": "0.57.
|
|
33
|
-
"@happyvertical/smrt-comments": "0.57.
|
|
34
|
-
"@happyvertical/sql": "^0.111.
|
|
31
|
+
"@happyvertical/smrt-core": "0.57.47",
|
|
32
|
+
"@happyvertical/smrt-tenancy": "0.57.47",
|
|
33
|
+
"@happyvertical/smrt-comments": "0.57.47",
|
|
34
|
+
"@happyvertical/sql": "^0.111.3"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"svelte": "^5.57.0"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"directory": "packages/reactions"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@happyvertical/smrt-vitest": "0.57.
|
|
52
|
+
"@happyvertical/smrt-vitest": "0.57.47",
|
|
53
53
|
"@sveltejs/package": "^2.5.8",
|
|
54
54
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
55
55
|
"@testing-library/svelte": "^5.4.2",
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import { ObjectRegistry, SmrtCollection, SmrtObject, SmrtPolymorphicAssociation, ValidationError, crossPackageRef, field, foreignKey, smrt } from "@happyvertical/smrt-core";
|
|
2
|
-
import { TenantScoped, tenantId } from "@happyvertical/smrt-tenancy";
|
|
3
|
-
//#region src/__smrt-register__.ts
|
|
4
|
-
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-reactions","packageVersion":"0.57.46","objects":{"@happyvertical/smrt-reactions:ReactionCollection":{"name":"reactioncollection","className":"ReactionCollection","qualifiedName":"@happyvertical/smrt-reactions:ReactionCollection","collection":"reactions","filePath":"/home/runner/work/smrt/smrt/packages/reactions/src/collections/index.ts","packageName":"@happyvertical/smrt-reactions","fields":{},"methods":{},"decoratorConfig":{"tableName":"record_reactions","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"Reaction","exportName":"ReactionCollection","collectionExportName":"ReactionCollectionCollection","schema":{"tableName":"record_reactions","ddl":"CREATE TABLE IF NOT EXISTS \\"record_reactions\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"meta_type\\" TEXT NOT NULL,\\n \\"meta_id\\" TEXT NOT NULL,\\n \\"role\\" TEXT NOT NULL,\\n \\"sort_order\\" INTEGER DEFAULT 0,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"actor_profile_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT NOT NULL DEFAULT 'like'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"meta_type":{"type":"TEXT","notNull":true,"unique":false},"meta_id":{"type":"TEXT","notNull":true,"unique":false},"role":{"type":"TEXT","notNull":true,"unique":false},"sort_order":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"kind":{"type":"TEXT","notNull":true,"unique":false,"default":"like"}},"indexes":[{"name":"record_reactions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"record_reactions_actor_kind","columns":["tenant_id","meta_type","meta_id","actor_profile_id","kind"],"unique":true},{"name":"record_reactions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"record_reactions_meta_type_meta_id_idx","columns":["meta_type","meta_id"]},{"name":"record_reactions_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"678ebe0f"},"importPath":"@happyvertical/smrt-reactions"},"@happyvertical/smrt-reactions:PollCollection":{"name":"pollcollection","className":"PollCollection","qualifiedName":"@happyvertical/smrt-reactions:PollCollection","collection":"polls","filePath":"/home/runner/work/smrt/smrt/packages/reactions/src/collections/index.ts","packageName":"@happyvertical/smrt-reactions","fields":{},"methods":{},"decoratorConfig":{"tableName":"record_polls","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"Poll","exportName":"PollCollection","collectionExportName":"PollCollectionCollection","schema":{"tableName":"record_polls","ddl":"CREATE TABLE IF NOT EXISTS \\"record_polls\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"meta_type\\" TEXT NOT NULL,\\n \\"meta_id\\" TEXT NOT NULL,\\n \\"role\\" TEXT NOT NULL,\\n \\"sort_order\\" INTEGER DEFAULT 0,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"question\\" TEXT NOT NULL,\\n \\"options_json\\" TEXT,\\n \\"opens_at\\" TIMESTAMP,\\n \\"closes_at\\" TIMESTAMP,\\n \\"visibility\\" TEXT DEFAULT 'always',\\n \\"one_vote_per_actor\\" BOOLEAN NOT NULL DEFAULT TRUE,\\n \\"anonymous_tally\\" BOOLEAN NOT NULL DEFAULT TRUE,\\n \\"closed\\" BOOLEAN NOT NULL DEFAULT FALSE\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"meta_type":{"type":"TEXT","notNull":true,"unique":false},"meta_id":{"type":"TEXT","notNull":true,"unique":false},"role":{"type":"TEXT","notNull":true,"unique":false},"sort_order":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"question":{"type":"TEXT","notNull":true,"unique":false},"options_json":{"type":"TEXT","notNull":false,"unique":false},"opens_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"closes_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"visibility":{"type":"TEXT","notNull":false,"unique":false,"default":"always"},"one_vote_per_actor":{"type":"BOOLEAN","notNull":true,"unique":false,"default":true},"anonymous_tally":{"type":"BOOLEAN","notNull":true,"unique":false,"default":true},"closed":{"type":"BOOLEAN","notNull":true,"unique":false,"default":false}},"indexes":[{"name":"record_polls_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"record_polls_target","columns":["tenant_id","meta_type","meta_id"]},{"name":"record_polls_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"record_polls_meta_type_meta_id_idx","columns":["meta_type","meta_id"]}],"version":"f6713370"},"importPath":"@happyvertical/smrt-reactions"},"@happyvertical/smrt-reactions:PollVoteCollection":{"name":"pollvotecollection","className":"PollVoteCollection","qualifiedName":"@happyvertical/smrt-reactions:PollVoteCollection","collection":"pollvotes","filePath":"/home/runner/work/smrt/smrt/packages/reactions/src/collections/index.ts","packageName":"@happyvertical/smrt-reactions","fields":{},"methods":{},"decoratorConfig":{"tableName":"poll_votes","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"PollVote","exportName":"PollVoteCollection","collectionExportName":"PollVoteCollectionCollection","schema":{"tableName":"poll_votes","ddl":"CREATE TABLE IF NOT EXISTS \\"poll_votes\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"poll_id\\" UUID NOT NULL,\\n \\"actor_profile_id\\" UUID NOT NULL,\\n \\"option_id\\" TEXT NOT NULL,\\n \\"participation_snapshot\\" TEXT NOT NULL\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"poll_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"record_polls","column":"id","onDelete":"NO ACTION","onUpdate":"NO ACTION"}},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"option_id":{"type":"TEXT","notNull":true,"unique":false},"participation_snapshot":{"type":"TEXT","notNull":true,"unique":false}},"indexes":[{"name":"poll_votes_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"poll_votes_actor","columns":["tenant_id","poll_id","actor_profile_id"],"unique":true},{"name":"poll_votes_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"poll_votes_poll_id_idx","columns":["poll_id"]},{"name":"poll_votes_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"c22797d0"},"importPath":"@happyvertical/smrt-reactions"},"@happyvertical/smrt-reactions:Poll":{"name":"poll","className":"Poll","qualifiedName":"@happyvertical/smrt-reactions:Poll","collection":"polls","filePath":"/home/runner/work/smrt/smrt/packages/reactions/src/models/Poll.ts","packageName":"@happyvertical/smrt-reactions","fields":{"metaType":{"type":"text","required":true,"_meta":{"required":true}},"metaId":{"type":"text","required":true,"_meta":{"required":true}},"role":{"type":"text","required":true,"_meta":{"required":true}},"sortOrder":{"type":"integer","required":false,"default":0},"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false}}},"question":{"type":"text","required":true,"_meta":{"required":true}},"optionsJson":{"type":"text","required":false,"_meta":{"readonly":true},"readonly":true},"opensAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"closesAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"visibility":{"type":"text","required":false,"default":"always","enum":["always","after_vote","after_close"]},"oneVotePerActor":{"type":"boolean","required":true,"default":true},"anonymousTally":{"type":"boolean","required":true,"default":true},"closed":{"type":"boolean","required":true,"default":false}},"methods":{"hydrate":{"name":"hydrate","async":true,"parameters":[],"returnType":"Promise<T | null>","isStatic":false,"isPublic":true},"assertWriteAuthority":{"name":"assertWriteAuthority","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"record_polls","api":false,"mcp":false,"cli":false,"hooks":{"beforeDelete":"assertWriteAuthority"},"indexes":[{"name":"record_polls_target","columns":["tenantId","metaType","metaId"]}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtPolymorphicAssociation","exportName":"Poll","collectionExportName":"PollCollection","validationRules":[{"field":"metaType","rule":"required","fieldType":"text"},{"field":"metaId","rule":"required","fieldType":"text"},{"field":"role","rule":"required","fieldType":"text"},{"field":"question","rule":"required","fieldType":"text"},{"field":"oneVotePerActor","rule":"required","fieldType":"boolean"},{"field":"anonymousTally","rule":"required","fieldType":"boolean"},{"field":"closed","rule":"required","fieldType":"boolean"}],"schema":{"tableName":"record_polls","ddl":"CREATE TABLE IF NOT EXISTS \\"record_polls\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"meta_type\\" TEXT NOT NULL,\\n \\"meta_id\\" TEXT NOT NULL,\\n \\"role\\" TEXT NOT NULL,\\n \\"sort_order\\" INTEGER DEFAULT 0,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"question\\" TEXT NOT NULL,\\n \\"options_json\\" TEXT,\\n \\"opens_at\\" TIMESTAMP,\\n \\"closes_at\\" TIMESTAMP,\\n \\"visibility\\" TEXT DEFAULT 'always',\\n \\"one_vote_per_actor\\" BOOLEAN NOT NULL DEFAULT TRUE,\\n \\"anonymous_tally\\" BOOLEAN NOT NULL DEFAULT TRUE,\\n \\"closed\\" BOOLEAN NOT NULL DEFAULT FALSE\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"meta_type":{"type":"TEXT","notNull":true,"unique":false},"meta_id":{"type":"TEXT","notNull":true,"unique":false},"role":{"type":"TEXT","notNull":true,"unique":false},"sort_order":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"question":{"type":"TEXT","notNull":true,"unique":false},"options_json":{"type":"TEXT","notNull":false,"unique":false},"opens_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"closes_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"visibility":{"type":"TEXT","notNull":false,"unique":false,"default":"always"},"one_vote_per_actor":{"type":"BOOLEAN","notNull":true,"unique":false,"default":true},"anonymous_tally":{"type":"BOOLEAN","notNull":true,"unique":false,"default":true},"closed":{"type":"BOOLEAN","notNull":true,"unique":false,"default":false}},"indexes":[{"name":"record_polls_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"record_polls_target","columns":["tenant_id","meta_type","meta_id"]},{"name":"record_polls_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"record_polls_meta_type_meta_id_idx","columns":["meta_type","meta_id"]}],"version":"f6713370"},"importPath":"@happyvertical/smrt-reactions"},"@happyvertical/smrt-reactions:PollVote":{"name":"pollvote","className":"PollVote","qualifiedName":"@happyvertical/smrt-reactions:PollVote","collection":"pollvotes","description":"Append-only through PollService; no generated write API.","filePath":"/home/runner/work/smrt/smrt/packages/reactions/src/models/PollVote.ts","packageName":"@happyvertical/smrt-reactions","fields":{"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false}}},"pollId":{"type":"foreignKey","required":true,"related":"Poll","_meta":{"required":true,"onDelete":"NO ACTION","onUpdate":"NO ACTION"}},"actorProfileId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-profiles:Profile"},"optionId":{"type":"text","required":true,"_meta":{"required":true,"readonly":true},"readonly":true},"participationSnapshot":{"type":"text","required":true,"_meta":{"required":true,"readonly":true},"readonly":true}},"methods":{"assertWriteAuthority":{"name":"assertWriteAuthority","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"poll_votes","api":false,"mcp":false,"cli":false,"hooks":{"beforeDelete":"assertWriteAuthority"},"indexes":[{"name":"poll_votes_actor","columns":["tenantId","pollId","actorProfileId"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"PollVote","collectionExportName":"PollVoteCollection","validationRules":[{"field":"pollId","rule":"required","fieldType":"foreignKey"},{"field":"actorProfileId","rule":"required","fieldType":"crossPackageRef"},{"field":"optionId","rule":"required","fieldType":"text"},{"field":"participationSnapshot","rule":"required","fieldType":"text"}],"schema":{"tableName":"poll_votes","ddl":"CREATE TABLE IF NOT EXISTS \\"poll_votes\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"poll_id\\" UUID NOT NULL,\\n \\"actor_profile_id\\" UUID NOT NULL,\\n \\"option_id\\" TEXT NOT NULL,\\n \\"participation_snapshot\\" TEXT NOT NULL\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"poll_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"record_polls","column":"id","onDelete":"NO ACTION","onUpdate":"NO ACTION"}},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"option_id":{"type":"TEXT","notNull":true,"unique":false},"participation_snapshot":{"type":"TEXT","notNull":true,"unique":false}},"indexes":[{"name":"poll_votes_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"poll_votes_actor","columns":["tenant_id","poll_id","actor_profile_id"],"unique":true},{"name":"poll_votes_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"poll_votes_poll_id_idx","columns":["poll_id"]},{"name":"poll_votes_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"c22797d0"},"importPath":"@happyvertical/smrt-reactions"},"@happyvertical/smrt-reactions:Reaction":{"name":"reaction","className":"Reaction","qualifiedName":"@happyvertical/smrt-reactions:Reaction","collection":"reactions","filePath":"/home/runner/work/smrt/smrt/packages/reactions/src/models/Reaction.ts","packageName":"@happyvertical/smrt-reactions","fields":{"metaType":{"type":"text","required":true,"_meta":{"required":true}},"metaId":{"type":"text","required":true,"_meta":{"required":true}},"role":{"type":"text","required":true,"_meta":{"required":true}},"sortOrder":{"type":"integer","required":false,"default":0},"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false}}},"actorProfileId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-profiles:Profile"},"kind":{"type":"text","required":true,"default":"like","_meta":{"required":true},"enum":["like","love","celebrate","insightful","support"]}},"methods":{"hydrate":{"name":"hydrate","async":true,"parameters":[],"returnType":"Promise<T | null>","isStatic":false,"isPublic":true},"assertWriteAuthority":{"name":"assertWriteAuthority","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"record_reactions","api":false,"mcp":false,"cli":false,"hooks":{"beforeDelete":"assertWriteAuthority"},"indexes":[{"name":"record_reactions_actor_kind","columns":["tenantId","metaType","metaId","actorProfileId","kind"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtPolymorphicAssociation","exportName":"Reaction","collectionExportName":"ReactionCollection","validationRules":[{"field":"metaType","rule":"required","fieldType":"text"},{"field":"metaId","rule":"required","fieldType":"text"},{"field":"role","rule":"required","fieldType":"text"},{"field":"actorProfileId","rule":"required","fieldType":"crossPackageRef"},{"field":"kind","rule":"required","fieldType":"text"}],"schema":{"tableName":"record_reactions","ddl":"CREATE TABLE IF NOT EXISTS \\"record_reactions\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"meta_type\\" TEXT NOT NULL,\\n \\"meta_id\\" TEXT NOT NULL,\\n \\"role\\" TEXT NOT NULL,\\n \\"sort_order\\" INTEGER DEFAULT 0,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"actor_profile_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT NOT NULL DEFAULT 'like'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"meta_type":{"type":"TEXT","notNull":true,"unique":false},"meta_id":{"type":"TEXT","notNull":true,"unique":false},"role":{"type":"TEXT","notNull":true,"unique":false},"sort_order":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"actor_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"kind":{"type":"TEXT","notNull":true,"unique":false,"default":"like"}},"indexes":[{"name":"record_reactions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"record_reactions_actor_kind","columns":["tenant_id","meta_type","meta_id","actor_profile_id","kind"],"unique":true},{"name":"record_reactions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"record_reactions_meta_type_meta_id_idx","columns":["meta_type","meta_id"]},{"name":"record_reactions_actor_profile_id_idx","columns":["actor_profile_id"]}],"version":"678ebe0f"},"importPath":"@happyvertical/smrt-reactions"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-comments","@happyvertical/smrt-core","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3624"],"via":["@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/write-authority.ts
|
|
7
|
-
var authority = /* @__PURE__ */ new WeakMap();
|
|
8
|
-
async function withParticipationWrite(executor, work) {
|
|
9
|
-
authority.set(executor, (authority.get(executor) ?? 0) + 1);
|
|
10
|
-
try {
|
|
11
|
-
return await work();
|
|
12
|
-
} finally {
|
|
13
|
-
const remaining = (authority.get(executor) ?? 1) - 1;
|
|
14
|
-
if (remaining) authority.set(executor, remaining);
|
|
15
|
-
else authority.delete(executor);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function assertParticipationWrite(executor) {
|
|
19
|
-
if (!authority.has(executor)) throw new ValidationError("Participation records require service write authority.", "VALIDATION_PARTICIPATION_AUTHORITY");
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/models/Poll.ts
|
|
23
|
-
var __defProp$2 = Object.defineProperty;
|
|
24
|
-
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
25
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value
|
|
30
|
-
}) : obj[key] = value;
|
|
31
|
-
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
32
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
33
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
34
|
-
if (kind && result) __defProp$2(target, key, result);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
38
|
-
var Poll = class extends SmrtPolymorphicAssociation {
|
|
39
|
-
tenantId = "";
|
|
40
|
-
question = "";
|
|
41
|
-
optionsJson = "[]";
|
|
42
|
-
opensAt = null;
|
|
43
|
-
closesAt = null;
|
|
44
|
-
visibility = "always";
|
|
45
|
-
oneVotePerActor = true;
|
|
46
|
-
anonymousTally = true;
|
|
47
|
-
closed = false;
|
|
48
|
-
constructor(options = {}) {
|
|
49
|
-
super(options);
|
|
50
|
-
if (options.tenantId !== void 0) this.tenantId = options.tenantId;
|
|
51
|
-
if (options.question !== void 0) this.question = options.question;
|
|
52
|
-
if (options.optionsJson !== void 0) this.optionsJson = options.optionsJson;
|
|
53
|
-
if (options.opensAt !== void 0) this.opensAt = options.opensAt;
|
|
54
|
-
if (options.closesAt !== void 0) this.closesAt = options.closesAt;
|
|
55
|
-
if (options.visibility !== void 0) this.visibility = options.visibility;
|
|
56
|
-
if (options.anonymousTally !== void 0) this.anonymousTally = options.anonymousTally;
|
|
57
|
-
if (options.closed !== void 0) this.closed = options.closed;
|
|
58
|
-
}
|
|
59
|
-
assertWriteAuthority() {
|
|
60
|
-
assertParticipationWrite(this.db);
|
|
61
|
-
}
|
|
62
|
-
async validateBeforeSave() {
|
|
63
|
-
assertParticipationWrite(this.db);
|
|
64
|
-
await super.validateBeforeSave();
|
|
65
|
-
this.pollOptions;
|
|
66
|
-
if (this.id) {
|
|
67
|
-
const existing = await this.getCanonicalPersistedRow({ id: this.id });
|
|
68
|
-
if (existing && (existing.options_json !== this.optionsJson || existing.tenant_id !== this.tenantId || existing.meta_type !== this.metaType || existing.meta_id !== this.metaId)) throw new ValidationError("Poll target and options are immutable.", "VALIDATION_IMMUTABLE_POLL");
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
get pollOptions() {
|
|
72
|
-
const parsed = JSON.parse(this.optionsJson);
|
|
73
|
-
if (!Array.isArray(parsed) || parsed.length < 2 || parsed.length > 50 || parsed.some((o) => !o || typeof o.id !== "string" || !o.id.trim() || typeof o.label !== "string" || !o.label.trim()) || new Set(parsed.map((o) => o.id)).size !== parsed.length) throw new TypeError("Invalid poll options.");
|
|
74
|
-
return parsed.map((o) => ({
|
|
75
|
-
id: o.id,
|
|
76
|
-
label: o.label
|
|
77
|
-
}));
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
__publicField$2(Poll, "__smrtPackage__", "@happyvertical/smrt-reactions");
|
|
81
|
-
__decorateClass$2([tenantId()], Poll.prototype, "tenantId", 2);
|
|
82
|
-
__decorateClass$2([field({ required: true })], Poll.prototype, "question", 2);
|
|
83
|
-
__decorateClass$2([field({
|
|
84
|
-
type: "text",
|
|
85
|
-
readonly: true
|
|
86
|
-
})], Poll.prototype, "optionsJson", 2);
|
|
87
|
-
__decorateClass$2([field({
|
|
88
|
-
type: "datetime",
|
|
89
|
-
nullable: true
|
|
90
|
-
})], Poll.prototype, "opensAt", 2);
|
|
91
|
-
__decorateClass$2([field({
|
|
92
|
-
type: "datetime",
|
|
93
|
-
nullable: true
|
|
94
|
-
})], Poll.prototype, "closesAt", 2);
|
|
95
|
-
__decorateClass$2([field()], Poll.prototype, "visibility", 2);
|
|
96
|
-
__decorateClass$2([field()], Poll.prototype, "oneVotePerActor", 2);
|
|
97
|
-
__decorateClass$2([field()], Poll.prototype, "anonymousTally", 2);
|
|
98
|
-
__decorateClass$2([field()], Poll.prototype, "closed", 2);
|
|
99
|
-
Poll = __decorateClass$2([TenantScoped({ mode: "required" }), smrt({
|
|
100
|
-
tableName: "record_polls",
|
|
101
|
-
api: false,
|
|
102
|
-
mcp: false,
|
|
103
|
-
cli: false,
|
|
104
|
-
hooks: { beforeDelete: "assertWriteAuthority" },
|
|
105
|
-
indexes: [{
|
|
106
|
-
name: "record_polls_target",
|
|
107
|
-
columns: [
|
|
108
|
-
"tenantId",
|
|
109
|
-
"metaType",
|
|
110
|
-
"metaId"
|
|
111
|
-
]
|
|
112
|
-
}]
|
|
113
|
-
})], Poll);
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region src/models/PollVote.ts
|
|
116
|
-
var __defProp$1 = Object.defineProperty;
|
|
117
|
-
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
118
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
|
|
119
|
-
enumerable: true,
|
|
120
|
-
configurable: true,
|
|
121
|
-
writable: true,
|
|
122
|
-
value
|
|
123
|
-
}) : obj[key] = value;
|
|
124
|
-
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
125
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
126
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
127
|
-
if (kind && result) __defProp$1(target, key, result);
|
|
128
|
-
return result;
|
|
129
|
-
};
|
|
130
|
-
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
131
|
-
var PollVote = class extends SmrtObject {
|
|
132
|
-
tenantId = "";
|
|
133
|
-
pollId = "";
|
|
134
|
-
actorProfileId = "";
|
|
135
|
-
optionId = "";
|
|
136
|
-
participationSnapshot = "{}";
|
|
137
|
-
constructor(options = {}) {
|
|
138
|
-
super(options);
|
|
139
|
-
if (options.tenantId !== void 0) this.tenantId = options.tenantId;
|
|
140
|
-
if (options.pollId !== void 0) this.pollId = options.pollId;
|
|
141
|
-
if (options.actorProfileId !== void 0) this.actorProfileId = options.actorProfileId;
|
|
142
|
-
if (options.optionId !== void 0) this.optionId = options.optionId;
|
|
143
|
-
if (options.participationSnapshot !== void 0) this.participationSnapshot = options.participationSnapshot;
|
|
144
|
-
}
|
|
145
|
-
assertWriteAuthority() {
|
|
146
|
-
assertParticipationWrite(this.db);
|
|
147
|
-
}
|
|
148
|
-
async validateBeforeSave() {
|
|
149
|
-
assertParticipationWrite(this.db);
|
|
150
|
-
await super.validateBeforeSave();
|
|
151
|
-
const evidence = JSON.parse(this.participationSnapshot);
|
|
152
|
-
if (!evidence || typeof evidence !== "object" || Array.isArray(evidence) || Object.keys(evidence).length === 0) throw new TypeError("Participation snapshot must be a nonempty JSON object.");
|
|
153
|
-
if (this.id) {
|
|
154
|
-
const existing = await this.getCanonicalPersistedRow({ id: this.id });
|
|
155
|
-
if (existing && (existing.participation_snapshot !== this.participationSnapshot || existing.option_id !== this.optionId || existing.tenant_id !== this.tenantId || existing.poll_id !== this.pollId || existing.actor_profile_id !== this.actorProfileId)) throw new ValidationError("Recorded votes are immutable.", "VALIDATION_IMMUTABLE_VOTE");
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
__publicField$1(PollVote, "__smrtPackage__", "@happyvertical/smrt-reactions");
|
|
160
|
-
__decorateClass$1([tenantId()], PollVote.prototype, "tenantId", 2);
|
|
161
|
-
__decorateClass$1([foreignKey(Poll, {
|
|
162
|
-
required: true,
|
|
163
|
-
onUpdate: "NO ACTION",
|
|
164
|
-
onDelete: "NO ACTION"
|
|
165
|
-
})], PollVote.prototype, "pollId", 2);
|
|
166
|
-
__decorateClass$1([crossPackageRef("@happyvertical/smrt-profiles:Profile", { required: true })], PollVote.prototype, "actorProfileId", 2);
|
|
167
|
-
__decorateClass$1([field({
|
|
168
|
-
required: true,
|
|
169
|
-
readonly: true
|
|
170
|
-
})], PollVote.prototype, "optionId", 2);
|
|
171
|
-
__decorateClass$1([field({
|
|
172
|
-
type: "text",
|
|
173
|
-
required: true,
|
|
174
|
-
readonly: true
|
|
175
|
-
})], PollVote.prototype, "participationSnapshot", 2);
|
|
176
|
-
PollVote = __decorateClass$1([TenantScoped({ mode: "required" }), smrt({
|
|
177
|
-
tableName: "poll_votes",
|
|
178
|
-
api: false,
|
|
179
|
-
mcp: false,
|
|
180
|
-
cli: false,
|
|
181
|
-
hooks: { beforeDelete: "assertWriteAuthority" },
|
|
182
|
-
indexes: [{
|
|
183
|
-
name: "poll_votes_actor",
|
|
184
|
-
columns: [
|
|
185
|
-
"tenantId",
|
|
186
|
-
"pollId",
|
|
187
|
-
"actorProfileId"
|
|
188
|
-
],
|
|
189
|
-
unique: true
|
|
190
|
-
}]
|
|
191
|
-
})], PollVote);
|
|
192
|
-
//#endregion
|
|
193
|
-
//#region src/models/Reaction.ts
|
|
194
|
-
var __defProp = Object.defineProperty;
|
|
195
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
196
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
197
|
-
enumerable: true,
|
|
198
|
-
configurable: true,
|
|
199
|
-
writable: true,
|
|
200
|
-
value
|
|
201
|
-
}) : obj[key] = value;
|
|
202
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
203
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
204
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
205
|
-
if (kind && result) __defProp(target, key, result);
|
|
206
|
-
return result;
|
|
207
|
-
};
|
|
208
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
209
|
-
var Reaction = class extends SmrtPolymorphicAssociation {
|
|
210
|
-
tenantId = "";
|
|
211
|
-
actorProfileId = "";
|
|
212
|
-
kind = "like";
|
|
213
|
-
constructor(options = {}) {
|
|
214
|
-
super(options);
|
|
215
|
-
if (options.tenantId !== void 0) this.tenantId = options.tenantId;
|
|
216
|
-
if (options.actorProfileId !== void 0) this.actorProfileId = options.actorProfileId;
|
|
217
|
-
if (options.kind !== void 0) this.kind = options.kind;
|
|
218
|
-
}
|
|
219
|
-
assertWriteAuthority() {
|
|
220
|
-
assertParticipationWrite(this.db);
|
|
221
|
-
}
|
|
222
|
-
async validateBeforeSave() {
|
|
223
|
-
assertParticipationWrite(this.db);
|
|
224
|
-
await super.validateBeforeSave();
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
__publicField(Reaction, "__smrtPackage__", "@happyvertical/smrt-reactions");
|
|
228
|
-
__decorateClass([tenantId()], Reaction.prototype, "tenantId", 2);
|
|
229
|
-
__decorateClass([crossPackageRef("@happyvertical/smrt-profiles:Profile", { required: true })], Reaction.prototype, "actorProfileId", 2);
|
|
230
|
-
__decorateClass([field({ required: true })], Reaction.prototype, "kind", 2);
|
|
231
|
-
Reaction = __decorateClass([TenantScoped({ mode: "required" }), smrt({
|
|
232
|
-
tableName: "record_reactions",
|
|
233
|
-
api: false,
|
|
234
|
-
mcp: false,
|
|
235
|
-
cli: false,
|
|
236
|
-
hooks: { beforeDelete: "assertWriteAuthority" },
|
|
237
|
-
indexes: [{
|
|
238
|
-
name: "record_reactions_actor_kind",
|
|
239
|
-
columns: [
|
|
240
|
-
"tenantId",
|
|
241
|
-
"metaType",
|
|
242
|
-
"metaId",
|
|
243
|
-
"actorProfileId",
|
|
244
|
-
"kind"
|
|
245
|
-
],
|
|
246
|
-
unique: true
|
|
247
|
-
}]
|
|
248
|
-
})], Reaction);
|
|
249
|
-
//#endregion
|
|
250
|
-
//#region src/collections/index.ts
|
|
251
|
-
var ReactionCollection = class extends SmrtCollection {
|
|
252
|
-
static _itemClass = Reaction;
|
|
253
|
-
};
|
|
254
|
-
var PollCollection = class extends SmrtCollection {
|
|
255
|
-
static _itemClass = Poll;
|
|
256
|
-
};
|
|
257
|
-
var PollVoteCollection = class extends SmrtCollection {
|
|
258
|
-
static _itemClass = PollVote;
|
|
259
|
-
};
|
|
260
|
-
//#endregion
|
|
261
|
-
export { PollVote as a, Reaction as i, PollVoteCollection as n, Poll as o, ReactionCollection as r, withParticipationWrite as s, PollCollection as t };
|
|
262
|
-
|
|
263
|
-
//# sourceMappingURL=src-D0VSA-4U.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"src-D0VSA-4U.js","names":[],"sources":["../../src/__smrt-register__.ts","../../src/write-authority.ts","../../src/models/Poll.ts","../../src/models/PollVote.ts","../../src/models/Reaction.ts","../../src/collections/index.ts"],"sourcesContent":["// Generated by @happyvertical/smrt-core smrtPlugin at library build time.\n// The package manifest is inlined so self-registration cannot miss when a\n// downstream bundler relocates this module away from dist/manifest.json\n// (https://github.com/happyvertical/smrt/issues/1506,\n// https://github.com/happyvertical/smrt/issues/1507).\nimport { ObjectRegistry } from '@happyvertical/smrt-core';\n\nObjectRegistry.registerPackageManifest(JSON.parse(\"{\\\"version\\\":\\\"1.0.0\\\",\\\"timestamp\\\":0,\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"packageVersion\\\":\\\"0.57.46\\\",\\\"objects\\\":{\\\"@happyvertical/smrt-reactions:ReactionCollection\\\":{\\\"name\\\":\\\"reactioncollection\\\",\\\"className\\\":\\\"ReactionCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-reactions:ReactionCollection\\\",\\\"collection\\\":\\\"reactions\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/reactions/src/collections/index.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"record_reactions\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Reaction\\\",\\\"exportName\\\":\\\"ReactionCollection\\\",\\\"collectionExportName\\\":\\\"ReactionCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"record_reactions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"record_reactions\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"meta_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"role\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"sort_order\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"actor_profile_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"kind\\\\\\\" TEXT NOT NULL DEFAULT 'like'\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"meta_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"role\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"sort_order\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"actor_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"like\\\"}},\\\"indexes\\\":[{\\\"name\\\":\\\"record_reactions_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"record_reactions_actor_kind\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"meta_type\\\",\\\"meta_id\\\",\\\"actor_profile_id\\\",\\\"kind\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"record_reactions_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"record_reactions_meta_type_meta_id_idx\\\",\\\"columns\\\":[\\\"meta_type\\\",\\\"meta_id\\\"]},{\\\"name\\\":\\\"record_reactions_actor_profile_id_idx\\\",\\\"columns\\\":[\\\"actor_profile_id\\\"]}],\\\"version\\\":\\\"678ebe0f\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-reactions\\\"},\\\"@happyvertical/smrt-reactions:PollCollection\\\":{\\\"name\\\":\\\"pollcollection\\\",\\\"className\\\":\\\"PollCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-reactions:PollCollection\\\",\\\"collection\\\":\\\"polls\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/reactions/src/collections/index.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"record_polls\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Poll\\\",\\\"exportName\\\":\\\"PollCollection\\\",\\\"collectionExportName\\\":\\\"PollCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"record_polls\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"record_polls\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"meta_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"role\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"sort_order\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"question\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"options_json\\\\\\\" TEXT,\\\\n \\\\\\\"opens_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"closes_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"visibility\\\\\\\" TEXT DEFAULT 'always',\\\\n \\\\\\\"one_vote_per_actor\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE,\\\\n \\\\\\\"anonymous_tally\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE,\\\\n \\\\\\\"closed\\\\\\\" BOOLEAN NOT NULL DEFAULT FALSE\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"meta_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"role\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"sort_order\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"question\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"options_json\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"opens_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"closes_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"visibility\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"always\\\"},\\\"one_vote_per_actor\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true},\\\"anonymous_tally\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true},\\\"closed\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"record_polls_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"record_polls_target\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"meta_type\\\",\\\"meta_id\\\"]},{\\\"name\\\":\\\"record_polls_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"record_polls_meta_type_meta_id_idx\\\",\\\"columns\\\":[\\\"meta_type\\\",\\\"meta_id\\\"]}],\\\"version\\\":\\\"f6713370\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-reactions\\\"},\\\"@happyvertical/smrt-reactions:PollVoteCollection\\\":{\\\"name\\\":\\\"pollvotecollection\\\",\\\"className\\\":\\\"PollVoteCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-reactions:PollVoteCollection\\\",\\\"collection\\\":\\\"pollvotes\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/reactions/src/collections/index.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"poll_votes\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"PollVote\\\",\\\"exportName\\\":\\\"PollVoteCollection\\\",\\\"collectionExportName\\\":\\\"PollVoteCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"poll_votes\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"poll_votes\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"poll_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"actor_profile_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"option_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"participation_snapshot\\\\\\\" TEXT NOT NULL\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"poll_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"record_polls\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"NO ACTION\\\"}},\\\"actor_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"option_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"participation_snapshot\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"poll_votes_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"poll_votes_actor\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"poll_id\\\",\\\"actor_profile_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"poll_votes_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"poll_votes_poll_id_idx\\\",\\\"columns\\\":[\\\"poll_id\\\"]},{\\\"name\\\":\\\"poll_votes_actor_profile_id_idx\\\",\\\"columns\\\":[\\\"actor_profile_id\\\"]}],\\\"version\\\":\\\"c22797d0\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-reactions\\\"},\\\"@happyvertical/smrt-reactions:Poll\\\":{\\\"name\\\":\\\"poll\\\",\\\"className\\\":\\\"Poll\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-reactions:Poll\\\",\\\"collection\\\":\\\"polls\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/reactions/src/models/Poll.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"fields\\\":{\\\"metaType\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"metaId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"role\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"sortOrder\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":false,\\\"default\\\":0},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false}}},\\\"question\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"optionsJson\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"readonly\\\":true},\\\"readonly\\\":true},\\\"opensAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"closesAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"visibility\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"always\\\",\\\"enum\\\":[\\\"always\\\",\\\"after_vote\\\",\\\"after_close\\\"]},\\\"oneVotePerActor\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":true,\\\"default\\\":true},\\\"anonymousTally\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":true,\\\"default\\\":true},\\\"closed\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":true,\\\"default\\\":false}},\\\"methods\\\":{\\\"hydrate\\\":{\\\"name\\\":\\\"hydrate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<T | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"assertWriteAuthority\\\":{\\\"name\\\":\\\"assertWriteAuthority\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"record_polls\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false,\\\"hooks\\\":{\\\"beforeDelete\\\":\\\"assertWriteAuthority\\\"},\\\"indexes\\\":[{\\\"name\\\":\\\"record_polls_target\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"metaType\\\",\\\"metaId\\\"]}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtPolymorphicAssociation\\\",\\\"exportName\\\":\\\"Poll\\\",\\\"collectionExportName\\\":\\\"PollCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"metaType\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"metaId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"role\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"question\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"oneVotePerActor\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"anonymousTally\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"closed\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"record_polls\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"record_polls\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"meta_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"role\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"sort_order\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"question\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"options_json\\\\\\\" TEXT,\\\\n \\\\\\\"opens_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"closes_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"visibility\\\\\\\" TEXT DEFAULT 'always',\\\\n \\\\\\\"one_vote_per_actor\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE,\\\\n \\\\\\\"anonymous_tally\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE,\\\\n \\\\\\\"closed\\\\\\\" BOOLEAN NOT NULL DEFAULT FALSE\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"meta_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"role\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"sort_order\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"question\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"options_json\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"opens_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"closes_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"visibility\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"always\\\"},\\\"one_vote_per_actor\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true},\\\"anonymous_tally\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true},\\\"closed\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"record_polls_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"record_polls_target\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"meta_type\\\",\\\"meta_id\\\"]},{\\\"name\\\":\\\"record_polls_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"record_polls_meta_type_meta_id_idx\\\",\\\"columns\\\":[\\\"meta_type\\\",\\\"meta_id\\\"]}],\\\"version\\\":\\\"f6713370\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-reactions\\\"},\\\"@happyvertical/smrt-reactions:PollVote\\\":{\\\"name\\\":\\\"pollvote\\\",\\\"className\\\":\\\"PollVote\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-reactions:PollVote\\\",\\\"collection\\\":\\\"pollvotes\\\",\\\"description\\\":\\\"Append-only through PollService; no generated write API.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/reactions/src/models/PollVote.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false}}},\\\"pollId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Poll\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"NO ACTION\\\"}},\\\"actorProfileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":true,\\\"related\\\":\\\"@happyvertical/smrt-profiles:Profile\\\"},\\\"optionId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"readonly\\\":true},\\\"readonly\\\":true},\\\"participationSnapshot\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"readonly\\\":true},\\\"readonly\\\":true}},\\\"methods\\\":{\\\"assertWriteAuthority\\\":{\\\"name\\\":\\\"assertWriteAuthority\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"poll_votes\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false,\\\"hooks\\\":{\\\"beforeDelete\\\":\\\"assertWriteAuthority\\\"},\\\"indexes\\\":[{\\\"name\\\":\\\"poll_votes_actor\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"pollId\\\",\\\"actorProfileId\\\"],\\\"unique\\\":true}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"PollVote\\\",\\\"collectionExportName\\\":\\\"PollVoteCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"pollId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"actorProfileId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"crossPackageRef\\\"},{\\\"field\\\":\\\"optionId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"participationSnapshot\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"poll_votes\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"poll_votes\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"poll_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"actor_profile_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"option_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"participation_snapshot\\\\\\\" TEXT NOT NULL\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"poll_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"record_polls\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"NO ACTION\\\"}},\\\"actor_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"option_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"participation_snapshot\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"poll_votes_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"poll_votes_actor\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"poll_id\\\",\\\"actor_profile_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"poll_votes_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"poll_votes_poll_id_idx\\\",\\\"columns\\\":[\\\"poll_id\\\"]},{\\\"name\\\":\\\"poll_votes_actor_profile_id_idx\\\",\\\"columns\\\":[\\\"actor_profile_id\\\"]}],\\\"version\\\":\\\"c22797d0\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-reactions\\\"},\\\"@happyvertical/smrt-reactions:Reaction\\\":{\\\"name\\\":\\\"reaction\\\",\\\"className\\\":\\\"Reaction\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-reactions:Reaction\\\",\\\"collection\\\":\\\"reactions\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/reactions/src/models/Reaction.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-reactions\\\",\\\"fields\\\":{\\\"metaType\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"metaId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"role\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"sortOrder\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":false,\\\"default\\\":0},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false}}},\\\"actorProfileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":true,\\\"related\\\":\\\"@happyvertical/smrt-profiles:Profile\\\"},\\\"kind\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"default\\\":\\\"like\\\",\\\"_meta\\\":{\\\"required\\\":true},\\\"enum\\\":[\\\"like\\\",\\\"love\\\",\\\"celebrate\\\",\\\"insightful\\\",\\\"support\\\"]}},\\\"methods\\\":{\\\"hydrate\\\":{\\\"name\\\":\\\"hydrate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<T | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"assertWriteAuthority\\\":{\\\"name\\\":\\\"assertWriteAuthority\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"record_reactions\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false,\\\"hooks\\\":{\\\"beforeDelete\\\":\\\"assertWriteAuthority\\\"},\\\"indexes\\\":[{\\\"name\\\":\\\"record_reactions_actor_kind\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"metaType\\\",\\\"metaId\\\",\\\"actorProfileId\\\",\\\"kind\\\"],\\\"unique\\\":true}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtPolymorphicAssociation\\\",\\\"exportName\\\":\\\"Reaction\\\",\\\"collectionExportName\\\":\\\"ReactionCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"metaType\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"metaId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"role\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"actorProfileId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"crossPackageRef\\\"},{\\\"field\\\":\\\"kind\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"record_reactions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"record_reactions\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"meta_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"role\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"sort_order\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"actor_profile_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"kind\\\\\\\" TEXT NOT NULL DEFAULT 'like'\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"meta_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"role\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"sort_order\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"actor_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"like\\\"}},\\\"indexes\\\":[{\\\"name\\\":\\\"record_reactions_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"record_reactions_actor_kind\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"meta_type\\\",\\\"meta_id\\\",\\\"actor_profile_id\\\",\\\"kind\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"record_reactions_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"record_reactions_meta_type_meta_id_idx\\\",\\\"columns\\\":[\\\"meta_type\\\",\\\"meta_id\\\"]},{\\\"name\\\":\\\"record_reactions_actor_profile_id_idx\\\",\\\"columns\\\":[\\\"actor_profile_id\\\"]}],\\\"version\\\":\\\"678ebe0f\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-reactions\\\"}},\\\"moduleType\\\":\\\"smrt\\\",\\\"smrtDependencies\\\":[\\\"@happyvertical/smrt-comments\\\",\\\"@happyvertical/smrt-core\\\",\\\"@happyvertical/smrt-tenancy\\\"],\\\"browser\\\":{\\\"status\\\":\\\"server-only\\\",\\\"issues\\\":[\\\"#3624\\\"],\\\"via\\\":[\\\"@happyvertical/smrt-tenancy\\\"]},\\\"stampsConstructors\\\":true}\"));\n","import { ValidationError } from '@happyvertical/smrt-core';\n\n/** Authority belongs only to a unique operation transaction, never a root adapter. */\nconst authority = new WeakMap<object, number>();\n/** Package-private authority; never re-export from a public entry point. */\nexport async function withParticipationWrite<T>(\n executor: object,\n work: () => Promise<T>,\n): Promise<T> {\n authority.set(executor, (authority.get(executor) ?? 0) + 1);\n try {\n return await work();\n } finally {\n const remaining = (authority.get(executor) ?? 1) - 1;\n if (remaining) authority.set(executor, remaining);\n else authority.delete(executor);\n }\n}\nexport function assertParticipationWrite(executor: object): void {\n if (!authority.has(executor))\n throw new ValidationError(\n 'Participation records require service write authority.',\n 'VALIDATION_PARTICIPATION_AUTHORITY',\n );\n}\n","import {\n field,\n SmrtPolymorphicAssociation,\n type SmrtPolymorphicAssociationOptions,\n smrt,\n ValidationError,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\nimport type { PollOption, PollVisibility } from '../types.js';\nimport { assertParticipationWrite } from '../write-authority.js';\nexport interface PollOptions extends SmrtPolymorphicAssociationOptions {\n tenantId?: string;\n question?: string;\n optionsJson?: string;\n opensAt?: Date | null;\n closesAt?: Date | null;\n visibility?: PollVisibility;\n anonymousTally?: boolean;\n closed?: boolean;\n}\n@TenantScoped({ mode: 'required' })\n@smrt({\n tableName: 'record_polls',\n api: false,\n mcp: false,\n cli: false,\n hooks: { beforeDelete: 'assertWriteAuthority' },\n indexes: [\n {\n name: 'record_polls_target',\n columns: ['tenantId', 'metaType', 'metaId'],\n },\n ],\n})\nexport class Poll extends SmrtPolymorphicAssociation { static __smrtPackage__ = \"@happyvertical/smrt-reactions\";\n @tenantId() tenantId = '';\n @field({ required: true }) question = '';\n @field({ type: 'text', readonly: true }) optionsJson = '[]';\n @field({ type: 'datetime', nullable: true }) opensAt: Date | null = null;\n @field({ type: 'datetime', nullable: true }) closesAt: Date | null = null;\n @field() visibility: PollVisibility = 'always';\n @field() oneVotePerActor = true;\n @field() anonymousTally = true;\n @field() closed = false;\n constructor(options: PollOptions = {}) {\n super(options);\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n if (options.question !== undefined) this.question = options.question;\n if (options.optionsJson !== undefined)\n this.optionsJson = options.optionsJson;\n if (options.opensAt !== undefined) this.opensAt = options.opensAt;\n if (options.closesAt !== undefined) this.closesAt = options.closesAt;\n if (options.visibility !== undefined) this.visibility = options.visibility;\n if (options.anonymousTally !== undefined)\n this.anonymousTally = options.anonymousTally;\n if (options.closed !== undefined) this.closed = options.closed;\n }\n assertWriteAuthority(): void {\n assertParticipationWrite(this.db);\n }\n protected override async validateBeforeSave(): Promise<void> {\n assertParticipationWrite(this.db);\n await super.validateBeforeSave();\n this.pollOptions;\n if (this.id) {\n const existing = await this.getCanonicalPersistedRow({ id: this.id });\n if (\n existing &&\n (existing.options_json !== this.optionsJson ||\n existing.tenant_id !== this.tenantId ||\n existing.meta_type !== this.metaType ||\n existing.meta_id !== this.metaId)\n )\n throw new ValidationError(\n 'Poll target and options are immutable.',\n 'VALIDATION_IMMUTABLE_POLL',\n );\n }\n }\n get pollOptions(): PollOption[] {\n const parsed: unknown = JSON.parse(this.optionsJson);\n if (\n !Array.isArray(parsed) ||\n parsed.length < 2 ||\n parsed.length > 50 ||\n parsed.some(\n (o) =>\n !o ||\n typeof o.id !== 'string' ||\n !o.id.trim() ||\n typeof o.label !== 'string' ||\n !o.label.trim(),\n ) ||\n new Set(parsed.map((o) => o.id)).size !== parsed.length\n )\n throw new TypeError('Invalid poll options.');\n return parsed.map((o) => ({ id: o.id, label: o.label }));\n }\n}\n","import {\n crossPackageRef,\n field,\n foreignKey,\n type SmrtClassOptions,\n SmrtObject,\n smrt,\n ValidationError,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\nimport { assertParticipationWrite } from '../write-authority.js';\nimport { Poll } from './Poll.js';\nexport interface PollVoteOptions extends SmrtClassOptions {\n tenantId?: string;\n pollId?: string;\n optionId?: string;\n actorProfileId?: string;\n participationSnapshot?: string;\n}\n/** Append-only through PollService; no generated write API. */\n@TenantScoped({ mode: 'required' })\n@smrt({\n tableName: 'poll_votes',\n api: false,\n mcp: false,\n cli: false,\n hooks: { beforeDelete: 'assertWriteAuthority' },\n indexes: [\n {\n name: 'poll_votes_actor',\n columns: ['tenantId', 'pollId', 'actorProfileId'],\n unique: true,\n },\n ],\n})\nexport class PollVote extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-reactions\";\n @tenantId() tenantId = '';\n @foreignKey(Poll, {\n required: true,\n onUpdate: 'NO ACTION',\n onDelete: 'NO ACTION',\n })\n pollId = '';\n @crossPackageRef('@happyvertical/smrt-profiles:Profile', { required: true })\n actorProfileId = '';\n @field({ required: true, readonly: true }) optionId = '';\n @field({ type: 'text', required: true, readonly: true })\n participationSnapshot = '{}';\n constructor(options: PollVoteOptions = {}) {\n super(options);\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n if (options.pollId !== undefined) this.pollId = options.pollId;\n if (options.actorProfileId !== undefined)\n this.actorProfileId = options.actorProfileId;\n if (options.optionId !== undefined) this.optionId = options.optionId;\n if (options.participationSnapshot !== undefined)\n this.participationSnapshot = options.participationSnapshot;\n }\n assertWriteAuthority(): void {\n assertParticipationWrite(this.db);\n }\n protected override async validateBeforeSave(): Promise<void> {\n assertParticipationWrite(this.db);\n await super.validateBeforeSave();\n const evidence: unknown = JSON.parse(this.participationSnapshot);\n if (\n !evidence ||\n typeof evidence !== 'object' ||\n Array.isArray(evidence) ||\n Object.keys(evidence).length === 0\n )\n throw new TypeError(\n 'Participation snapshot must be a nonempty JSON object.',\n );\n if (this.id) {\n const existing = await this.getCanonicalPersistedRow({ id: this.id });\n if (\n existing &&\n (existing.participation_snapshot !== this.participationSnapshot ||\n existing.option_id !== this.optionId ||\n existing.tenant_id !== this.tenantId ||\n existing.poll_id !== this.pollId ||\n existing.actor_profile_id !== this.actorProfileId)\n )\n throw new ValidationError(\n 'Recorded votes are immutable.',\n 'VALIDATION_IMMUTABLE_VOTE',\n );\n }\n }\n}\n","import {\n crossPackageRef,\n field,\n SmrtPolymorphicAssociation,\n type SmrtPolymorphicAssociationOptions,\n smrt,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\nimport type { ReactionKind } from '../types.js';\nimport { assertParticipationWrite } from '../write-authority.js';\n\n@TenantScoped({ mode: 'required' })\n@smrt({\n tableName: 'record_reactions',\n api: false,\n mcp: false,\n cli: false,\n hooks: { beforeDelete: 'assertWriteAuthority' },\n indexes: [\n {\n name: 'record_reactions_actor_kind',\n columns: ['tenantId', 'metaType', 'metaId', 'actorProfileId', 'kind'],\n unique: true,\n },\n ],\n})\nexport class Reaction extends SmrtPolymorphicAssociation { static __smrtPackage__ = \"@happyvertical/smrt-reactions\";\n @tenantId() tenantId = '';\n @crossPackageRef('@happyvertical/smrt-profiles:Profile', { required: true })\n actorProfileId = '';\n @field({ required: true }) kind: ReactionKind = 'like';\n constructor(\n options: SmrtPolymorphicAssociationOptions & {\n tenantId?: string;\n actorProfileId?: string;\n kind?: ReactionKind;\n } = {},\n ) {\n super(options);\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n if (options.actorProfileId !== undefined)\n this.actorProfileId = options.actorProfileId;\n if (options.kind !== undefined) this.kind = options.kind;\n }\n assertWriteAuthority(): void {\n assertParticipationWrite(this.db);\n }\n protected override async validateBeforeSave(): Promise<void> {\n assertParticipationWrite(this.db);\n await super.validateBeforeSave();\n }\n}\n","import { SmrtCollection } from '@happyvertical/smrt-core';\nimport { Poll } from '../models/Poll.js';\nimport { PollVote } from '../models/PollVote.js';\nimport { Reaction } from '../models/Reaction.js';\nexport class ReactionCollection extends SmrtCollection<Reaction> {\n static readonly _itemClass = Reaction;\n}\nexport class PollCollection extends SmrtCollection<Poll> {\n static readonly _itemClass = Poll;\n}\nexport class PollVoteCollection extends SmrtCollection<PollVote> {\n static readonly _itemClass = PollVote;\n}\n"],"mappings":"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"}
|