@happyvertical/smrt-messages 0.62.13 → 0.62.14
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/AGENTS.md +7 -1
- package/agents/send-approval.md +101 -0
- package/dist/access.d.ts +33 -1
- package/dist/access.d.ts.map +1 -1
- package/dist/chunks/{AttachmentCollection-Dzz2iKjx.js → AttachmentCollection-C0K7lITr.js} +4 -4
- package/dist/chunks/{AttachmentCollection-Dzz2iKjx.js.map → AttachmentCollection-C0K7lITr.js.map} +1 -1
- package/dist/chunks/{Email-DDMgkm_l.js → Email-DWF2VG_4.js} +6 -6
- package/dist/chunks/{Email-DDMgkm_l.js.map → Email-DWF2VG_4.js.map} +1 -1
- package/dist/chunks/EmailAccountCollection-OLTzu2T0.js +2472 -0
- package/dist/chunks/EmailAccountCollection-OLTzu2T0.js.map +1 -0
- package/dist/chunks/{EmailCollection-lo8WePl-.js → EmailCollection-8HeBXd0F.js} +3 -3
- package/dist/chunks/{EmailCollection-lo8WePl-.js.map → EmailCollection-8HeBXd0F.js.map} +1 -1
- package/dist/chunks/{EmailFolder-Bu7y8-VX.js → EmailFolder-Cl4sKRMB.js} +6 -6
- package/dist/chunks/{EmailFolder-Bu7y8-VX.js.map → EmailFolder-Cl4sKRMB.js.map} +1 -1
- package/dist/chunks/{EmailFolderCollection-BpzzKBhM.js → EmailFolderCollection-L0na2e1L.js} +2 -2
- package/dist/chunks/{EmailFolderCollection-BpzzKBhM.js.map → EmailFolderCollection-L0na2e1L.js.map} +1 -1
- package/dist/chunks/{EmailSender-B-Rtq9du.js → EmailSender-BiAI0LWU.js} +8 -1
- package/dist/chunks/EmailSender-BiAI0LWU.js.map +1 -0
- package/dist/chunks/{Message-BwW51pgG.js → Message-CuvACyOv.js} +76 -9
- package/dist/chunks/Message-CuvACyOv.js.map +1 -0
- package/dist/chunks/{MessageCollection-JjZybSMu.js → MessageCollection-DOErodD3.js} +2 -2
- package/dist/chunks/{MessageCollection-JjZybSMu.js.map → MessageCollection-DOErodD3.js.map} +1 -1
- package/dist/chunks/{MessagingEndpointCollection-FmbtiFJy.js → MessagingEndpointCollection-CE3kQKQU.js} +2 -2
- package/dist/chunks/{MessagingEndpointCollection-FmbtiFJy.js.map → MessagingEndpointCollection-CE3kQKQU.js.map} +1 -1
- package/dist/connect.js +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +110 -14
- package/dist/index.js.map +1 -1
- package/dist/mail-drafts.d.ts +63 -0
- package/dist/mail-drafts.d.ts.map +1 -0
- package/dist/mail-triage.d.ts.map +1 -1
- package/dist/manifest.json +354 -30
- package/dist/models/EmailAccount.d.ts +8 -1
- package/dist/models/EmailAccount.d.ts.map +1 -1
- package/dist/models/Message.d.ts +9 -0
- package/dist/models/Message.d.ts.map +1 -1
- package/dist/send-approval.d.ts +275 -0
- package/dist/send-approval.d.ts.map +1 -0
- package/dist/senders/EmailSender.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +213 -5
- package/dist/smrt-knowledge.okf.md +7 -2
- package/dist/types.d.ts +20 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -11
- package/dist/chunks/EmailAccountCollection-CgZE9YAM.js +0 -1992
- package/dist/chunks/EmailAccountCollection-CgZE9YAM.js.map +0 -1
- package/dist/chunks/EmailSender-B-Rtq9du.js.map +0 -1
- package/dist/chunks/Message-BwW51pgG.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailAccountCollection-OLTzu2T0.js","names":["tenantId","account"],"sources":["../../src/__smrt-register__.ts","../../src/permissions.ts","../../src/access.ts","../../src/models/Account.ts","../../src/send-approval.ts","../../src/mail-sync.ts","../../src/mail-triage.ts","../../src/collections/AccountCollection.ts","../../src/models/EmailAccount.ts","../../src/collections/EmailAccountCollection.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-messages\\\",\\\"packageVersion\\\":\\\"0.62.14\\\",\\\"objects\\\":{\\\"@happyvertical/smrt-messages:AccountCollection\\\":{\\\"name\\\":\\\"accountcollection\\\",\\\"className\\\":\\\"AccountCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:AccountCollection\\\",\\\"collection\\\":\\\"accounts\\\",\\\"filePath\\\":\\\"src/collections/AccountCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"getActive\\\":{\\\"name\\\":\\\"getActive\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Account[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getInactive\\\":{\\\"name\\\":\\\"getInactive\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Account[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByProviderType\\\":{\\\"name\\\":\\\"getByProviderType\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"providerType\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Account[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByType\\\":{\\\"name\\\":\\\"getByType\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountType\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Account[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"search\\\":{\\\"name\\\":\\\"search\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"query\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"filters\\\",\\\"type\\\":\\\"AccountSearchFilters\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Account[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getStats\\\":{\\\"name\\\":\\\"getStats\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByTenant\\\":{\\\"name\\\":\\\"findByTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Account[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findGlobal\\\":{\\\"name\\\":\\\"findGlobal\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Account[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findWithGlobals\\\":{\\\"name\\\":\\\"findWithGlobals\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Account[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Account\\\",\\\"exportName\\\":\\\"AccountCollection\\\",\\\"collectionExportName\\\":\\\"AccountCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:Account\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"accounts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"accounts\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"provider_type\\\\\\\" TEXT,\\\\n \\\\\\\"channel_type\\\\\\\" TEXT,\\\\n \\\\\\\"credential_secret_id\\\\\\\" TEXT,\\\\n \\\\\\\"is_active\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"owner_user_id\\\\\\\" UUID,\\\\n \\\\\\\"label\\\\\\\" TEXT,\\\\n \\\\\\\"connection_status\\\\\\\" TEXT,\\\\n \\\\\\\"status_message\\\\\\\" TEXT,\\\\n \\\\\\\"last_sync_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"settings\\\\\\\" TEXT,\\\\n \\\\\\\"configuration\\\\\\\" TEXT,\\\\n \\\\\\\"email\\\\\\\" TEXT,\\\\n \\\\\\\"sync_interval_minutes\\\\\\\" INTEGER DEFAULT 60,\\\\n \\\\\\\"sync_cursor\\\\\\\" TEXT,\\\\n \\\\\\\"backfill_since\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"cursor_horizon\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_sync_error\\\\\\\" TEXT,\\\\n \\\\\\\"backlog\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"agent_send_policy\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_id\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_name\\\\\\\" TEXT,\\\\n \\\\\\\"bot_user_id\\\\\\\" TEXT,\\\\n \\\\\\\"handle\\\\\\\" TEXT,\\\\n \\\\\\\"twitter_user_id\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"credential_secret_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_active\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":true},\\\"owner_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"label\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"connection_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"status_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"last_sync_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"settings\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"configuration\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"sync_interval_minutes\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":60},\\\"sync_cursor\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backfill_since\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"cursor_horizon\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"last_sync_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backlog\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"agent_send_policy\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bot_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handle\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"twitter_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"accounts_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"accounts_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"accounts_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"accounts_owner_user_id_idx\\\",\\\"columns\\\":[\\\"owner_user_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_81229bbfe8e3\\\",\\\"columns\\\":[\\\"backlog\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"backlog\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_1f9c5f0ee488\\\",\\\"columns\\\":[\\\"sync_interval_minutes\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"sync_interval_minutes\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"ff134288\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:AttachmentCollection\\\":{\\\"name\\\":\\\"attachmentcollection\\\",\\\"className\\\":\\\"AttachmentCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:AttachmentCollection\\\",\\\"collection\\\":\\\"attachments\\\",\\\"filePath\\\":\\\"src/collections/AttachmentCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"backfillAccountIds\\\":{\\\"name\\\":\\\"backfillAccountIds\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByMessage\\\":{\\\"name\\\":\\\"getByMessage\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByContentType\\\":{\\\"name\\\":\\\"getByContentType\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"contentType\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getImages\\\":{\\\"name\\\":\\\"getImages\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getPdfs\\\":{\\\"name\\\":\\\"getPdfs\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getInline\\\":{\\\"name\\\":\\\"getInline\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getRegular\\\":{\\\"name\\\":\\\"getRegular\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getWithExternalFiles\\\":{\\\"name\\\":\\\"getWithExternalFiles\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getTotalSize\\\":{\\\"name\\\":\\\"getTotalSize\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getLargest\\\":{\\\"name\\\":\\\"getLargest\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"limit\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"searchByFilename\\\":{\\\"name\\\":\\\"searchByFilename\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"query\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByExtension\\\":{\\\"name\\\":\\\"getByExtension\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"extension\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getStats\\\":{\\\"name\\\":\\\"getStats\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteByMessage\\\":{\\\"name\\\":\\\"deleteByMessage\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByTenant\\\":{\\\"name\\\":\\\"findByTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findGlobal\\\":{\\\"name\\\":\\\"findGlobal\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findWithGlobals\\\":{\\\"name\\\":\\\"findWithGlobals\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\",\\\"delete\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Attachment\\\",\\\"exportName\\\":\\\"AttachmentCollection\\\",\\\"collectionExportName\\\":\\\"AttachmentCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:Attachment\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"attachments\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"attachments\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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,\\\\n \\\\\\\"message_id\\\\\\\" UUID,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"filename\\\\\\\" TEXT,\\\\n \\\\\\\"content_type\\\\\\\" TEXT,\\\\n \\\\\\\"size\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"content_id\\\\\\\" TEXT,\\\\n \\\\\\\"content_disposition\\\\\\\" TEXT DEFAULT 'attachment',\\\\n \\\\\\\"file_path\\\\\\\" TEXT,\\\\n \\\\\\\"source_url\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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\\\":false,\\\"unique\\\":false},\\\"message_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messages\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"filename\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"content_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"size\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"content_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"content_disposition\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"attachment\\\"},\\\"file_path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"source_url\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"attachments_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"attachments_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"attachments_message_id_idx\\\",\\\"columns\\\":[\\\"message_id\\\"]},{\\\"name\\\":\\\"attachments_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]}],\\\"version\\\":\\\"3f32531c\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:BlacklistCollection\\\":{\\\"name\\\":\\\"blacklistcollection\\\",\\\"className\\\":\\\"BlacklistCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:BlacklistCollection\\\",\\\"collection\\\":\\\"blacklists\\\",\\\"filePath\\\":\\\"src/collections/BlacklistCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"isBlacklisted\\\":{\\\"name\\\":\\\"isBlacklisted\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"email\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getMatchingEntry\\\":{\\\"name\\\":\\\"getMatchingEntry\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"email\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Blacklist | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\",\\\"update\\\",\\\"delete\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Blacklist\\\",\\\"exportName\\\":\\\"BlacklistCollection\\\",\\\"collectionExportName\\\":\\\"BlacklistCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:Blacklist\\\",\\\"inheritedExposure\\\":[\\\"api\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"blacklists\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"blacklists\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"pattern\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"type\\\\\\\" TEXT DEFAULT 'email',\\\\n \\\\\\\"reason\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"auto_archive\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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\\\"},\\\"pattern\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"email\\\"},\\\"reason\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"auto_archive\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":true},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"blacklists_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"blacklists_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"478c8724\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:CorrespondentCollection\\\":{\\\"name\\\":\\\"correspondentcollection\\\",\\\"className\\\":\\\"CorrespondentCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:CorrespondentCollection\\\",\\\"collection\\\":\\\"correspondents\\\",\\\"filePath\\\":\\\"src/collections/CorrespondentCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"correspondents\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Correspondent\\\",\\\"exportName\\\":\\\"CorrespondentCollection\\\",\\\"collectionExportName\\\":\\\"CorrespondentCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:Correspondent\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"correspondents\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"correspondents\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"owner_user_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"address\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"display_name\\\\\\\" TEXT,\\\\n \\\\\\\"message_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"sent_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"received_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"first_contact_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_contact_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"account_ids\\\\\\\" TEXT,\\\\n \\\\\\\"account_breakdown\\\\\\\" TEXT,\\\\n \\\\\\\"profile_id\\\\\\\" UUID\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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},\\\"owner_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"display_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"message_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"sent_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"received_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"first_contact_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_contact_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"account_ids\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"account_breakdown\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"correspondents_tenant_id_owner_user_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"owner_user_id\\\",\\\"address\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"correspondents_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"correspondents_owner_last_contact_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"owner_user_id\\\",\\\"last_contact_at\\\"]},{\\\"name\\\":\\\"correspondents_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"correspondents_owner_user_id_idx\\\",\\\"columns\\\":[\\\"owner_user_id\\\"]},{\\\"name\\\":\\\"correspondents_profile_id_idx\\\",\\\"columns\\\":[\\\"profile_id\\\"]}],\\\"version\\\":\\\"d0cc8363\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:EmailAccountCollection\\\":{\\\"name\\\":\\\"emailaccountcollection\\\",\\\"className\\\":\\\"EmailAccountCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:EmailAccountCollection\\\",\\\"collection\\\":\\\"accounts\\\",\\\"filePath\\\":\\\"src/collections/EmailAccountCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"getActive\\\":{\\\"name\\\":\\\"getActive\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<EmailAccount[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getInactive\\\":{\\\"name\\\":\\\"getInactive\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<EmailAccount[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByProviderType\\\":{\\\"name\\\":\\\"getByProviderType\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"providerType\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailAccount[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByType\\\":{\\\"name\\\":\\\"getByType\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountType\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Account[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"search\\\":{\\\"name\\\":\\\"search\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"query\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"filters\\\",\\\"type\\\":\\\"EmailAccountSearchFilters\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<EmailAccount[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getStats\\\":{\\\"name\\\":\\\"getStats\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByTenant\\\":{\\\"name\\\":\\\"findByTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailAccount[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findGlobal\\\":{\\\"name\\\":\\\"findGlobal\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<EmailAccount[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findWithGlobals\\\":{\\\"name\\\":\\\"findWithGlobals\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailAccount[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByEmail\\\":{\\\"name\\\":\\\"getByEmail\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"email\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailAccount | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByEmailProviderType\\\":{\\\"name\\\":\\\"getByEmailProviderType\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"providerType\\\",\\\"type\\\":\\\"ProviderType\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailAccount[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getNeedingSync\\\":{\\\"name\\\":\\\"getNeedingSync\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"maxAgeMinutes\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<EmailAccount[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"searchEmailAccounts\\\":{\\\"name\\\":\\\"searchEmailAccounts\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"query\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"filters\\\",\\\"type\\\":\\\"EmailAccountSearchFilters\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<EmailAccount[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"syncAll\\\":{\\\"name\\\":\\\"syncAll\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SyncOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Map<string, object>>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getTotalUnreadCount\\\":{\\\"name\\\":\\\"getTotalUnreadCount\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getEmailStats\\\":{\\\"name\\\":\\\"getEmailStats\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"accounts\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"AccountCollection\\\",\\\"exportName\\\":\\\"EmailAccountCollection\\\",\\\"collectionExportName\\\":\\\"EmailAccountCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:EmailAccount\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"accounts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"accounts\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"provider_type\\\\\\\" TEXT,\\\\n \\\\\\\"channel_type\\\\\\\" TEXT,\\\\n \\\\\\\"credential_secret_id\\\\\\\" TEXT,\\\\n \\\\\\\"is_active\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"owner_user_id\\\\\\\" UUID,\\\\n \\\\\\\"label\\\\\\\" TEXT,\\\\n \\\\\\\"connection_status\\\\\\\" TEXT,\\\\n \\\\\\\"status_message\\\\\\\" TEXT,\\\\n \\\\\\\"last_sync_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"settings\\\\\\\" TEXT,\\\\n \\\\\\\"configuration\\\\\\\" TEXT,\\\\n \\\\\\\"email\\\\\\\" TEXT,\\\\n \\\\\\\"sync_interval_minutes\\\\\\\" INTEGER DEFAULT 60,\\\\n \\\\\\\"sync_cursor\\\\\\\" TEXT,\\\\n \\\\\\\"backfill_since\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"cursor_horizon\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_sync_error\\\\\\\" TEXT,\\\\n \\\\\\\"backlog\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"agent_send_policy\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_id\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_name\\\\\\\" TEXT,\\\\n \\\\\\\"bot_user_id\\\\\\\" TEXT,\\\\n \\\\\\\"handle\\\\\\\" TEXT,\\\\n \\\\\\\"twitter_user_id\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"credential_secret_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_active\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":true},\\\"owner_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"label\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"connection_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"status_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"last_sync_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"settings\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"configuration\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"sync_interval_minutes\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":60},\\\"sync_cursor\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backfill_since\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"cursor_horizon\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"last_sync_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backlog\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"agent_send_policy\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bot_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handle\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"twitter_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"accounts_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"accounts_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"accounts_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"accounts_owner_user_id_idx\\\",\\\"columns\\\":[\\\"owner_user_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_81229bbfe8e3\\\",\\\"columns\\\":[\\\"backlog\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"backlog\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_1f9c5f0ee488\\\",\\\"columns\\\":[\\\"sync_interval_minutes\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"sync_interval_minutes\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"ff134288\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:EmailAttachmentCollection\\\":{\\\"name\\\":\\\"emailattachmentcollection\\\",\\\"className\\\":\\\"EmailAttachmentCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:EmailAttachmentCollection\\\",\\\"collection\\\":\\\"emailattachments\\\",\\\"filePath\\\":\\\"src/collections/EmailAttachmentCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"backfillAccountIds\\\":{\\\"name\\\":\\\"backfillAccountIds\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByMessage\\\":{\\\"name\\\":\\\"getByMessage\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByContentType\\\":{\\\"name\\\":\\\"getByContentType\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"contentType\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getImages\\\":{\\\"name\\\":\\\"getImages\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"emailId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<EmailAttachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getPdfs\\\":{\\\"name\\\":\\\"getPdfs\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"emailId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<EmailAttachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getInline\\\":{\\\"name\\\":\\\"getInline\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"emailId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailAttachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getRegular\\\":{\\\"name\\\":\\\"getRegular\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"emailId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailAttachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getWithExternalFiles\\\":{\\\"name\\\":\\\"getWithExternalFiles\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getTotalSize\\\":{\\\"name\\\":\\\"getTotalSize\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getLargest\\\":{\\\"name\\\":\\\"getLargest\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"limit\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"searchByFilename\\\":{\\\"name\\\":\\\"searchByFilename\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"query\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByExtension\\\":{\\\"name\\\":\\\"getByExtension\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"extension\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Attachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getStats\\\":{\\\"name\\\":\\\"getStats\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteByMessage\\\":{\\\"name\\\":\\\"deleteByMessage\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByTenant\\\":{\\\"name\\\":\\\"findByTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailAttachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findGlobal\\\":{\\\"name\\\":\\\"findGlobal\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<EmailAttachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findWithGlobals\\\":{\\\"name\\\":\\\"findWithGlobals\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailAttachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByEmail\\\":{\\\"name\\\":\\\"getByEmail\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"emailId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailAttachment[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteByEmail\\\":{\\\"name\\\":\\\"deleteByEmail\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"emailId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\",\\\"delete\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"AttachmentCollection\\\",\\\"exportName\\\":\\\"EmailAttachmentCollection\\\",\\\"collectionExportName\\\":\\\"EmailAttachmentCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:EmailAttachment\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"email_attachments\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"email_attachments\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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,\\\\n \\\\\\\"message_id\\\\\\\" UUID,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"filename\\\\\\\" TEXT,\\\\n \\\\\\\"content_type\\\\\\\" TEXT,\\\\n \\\\\\\"size\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"content_id\\\\\\\" TEXT,\\\\n \\\\\\\"content_disposition\\\\\\\" TEXT DEFAULT 'attachment',\\\\n \\\\\\\"file_path\\\\\\\" TEXT,\\\\n \\\\\\\"source_url\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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\\\":false,\\\"unique\\\":false},\\\"message_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messages\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"filename\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"content_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"size\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"content_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"content_disposition\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"attachment\\\"},\\\"file_path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"source_url\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"email_attachments_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"email_attachments_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"email_attachments_message_id_idx\\\",\\\"columns\\\":[\\\"message_id\\\"]},{\\\"name\\\":\\\"email_attachments_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]}],\\\"version\\\":\\\"ebed0053\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:EmailCollection\\\":{\\\"name\\\":\\\"emailcollection\\\",\\\"className\\\":\\\"EmailCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:EmailCollection\\\",\\\"collection\\\":\\\"messages\\\",\\\"filePath\\\":\\\"src/collections/EmailCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"search\\\":{\\\"name\\\":\\\"search\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"query\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"filters\\\",\\\"type\\\":\\\"EmailSearchFilters\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Email[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByAccounts\\\":{\\\"name\\\":\\\"getByAccounts\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountIds\\\",\\\"type\\\":\\\"string[]\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByType\\\":{\\\"name\\\":\\\"getByType\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageType\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getUnread\\\":{\\\"name\\\":\\\"getUnread\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Email[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getFlagged\\\":{\\\"name\\\":\\\"getFlagged\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Email[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getRecent\\\":{\\\"name\\\":\\\"getRecent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"limit\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":true},{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Email[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByThread\\\":{\\\"name\\\":\\\"getByThread\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"threadId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Email[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markAllRead\\\":{\\\"name\\\":\\\"markAllRead\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageIds\\\",\\\"type\\\":\\\"string[]\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAccountStats\\\":{\\\"name\\\":\\\"getAccountStats\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getDrafts\\\":{\\\"name\\\":\\\"getDrafts\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getSent\\\":{\\\"name\\\":\\\"getSent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getScheduled\\\":{\\\"name\\\":\\\"getScheduled\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getFailedSends\\\":{\\\"name\\\":\\\"getFailedSends\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getOutbox\\\":{\\\"name\\\":\\\"getOutbox\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByTenant\\\":{\\\"name\\\":\\\"findByTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Email[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findGlobal\\\":{\\\"name\\\":\\\"findGlobal\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Email[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findWithGlobals\\\":{\\\"name\\\":\\\"findWithGlobals\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Email[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByMessageId\\\":{\\\"name\\\":\\\"getByMessageId\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"messageId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Email | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByAccount\\\":{\\\"name\\\":\\\"getByAccount\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Email[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByFolder\\\":{\\\"name\\\":\\\"getByFolder\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"folderId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Email[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getWithAttachments\\\":{\\\"name\\\":\\\"getWithAttachments\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Email[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"countByFolder\\\":{\\\"name\\\":\\\"countByFolder\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"folderId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"countUnreadByFolder\\\":{\\\"name\\\":\\\"countUnreadByFolder\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"folderId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"countUnreadByAccount\\\":{\\\"name\\\":\\\"countUnreadByAccount\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"searchEmails\\\":{\\\"name\\\":\\\"searchEmails\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"query\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"filters\\\",\\\"type\\\":\\\"EmailSearchFilters\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Email[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"semanticMatches\\\":{\\\"name\\\":\\\"semanticMatches\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"query\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"where\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"number\\\"]}],\\\"returnType\\\":\\\"Promise<Array<object> | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markFolderRead\\\":{\\\"name\\\":\\\"markFolderRead\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"folderId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteByFolder\\\":{\\\"name\\\":\\\"deleteByFolder\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"folderId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"messages\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\",\\\"update\\\",\\\"delete\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"MessageCollection\\\",\\\"exportName\\\":\\\"EmailCollection\\\",\\\"collectionExportName\\\":\\\"EmailCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:Email\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"messages\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"messages\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"persona_id\\\\\\\" UUID,\\\\n \\\\\\\"endpoint_id\\\\\\\" UUID,\\\\n \\\\\\\"correlation_id\\\\\\\" TEXT,\\\\n \\\\\\\"thread_id\\\\\\\" TEXT,\\\\n \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"body\\\\\\\" TEXT,\\\\n \\\\\\\"from_address\\\\\\\" TEXT,\\\\n \\\\\\\"from_name\\\\\\\" TEXT,\\\\n \\\\\\\"to_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"date\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"is_read\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_flagged\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"has_attachments\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"size\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"metadata\\\\\\\" TEXT,\\\\n \\\\\\\"send_status\\\\\\\" TEXT DEFAULT 'draft',\\\\n \\\\\\\"sent_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"send_error\\\\\\\" TEXT,\\\\n \\\\\\\"retry_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"max_retries\\\\\\\" INTEGER DEFAULT 3,\\\\n \\\\\\\"scheduled_send_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"in_reply_to_message_id\\\\\\\" UUID,\\\\n \\\\\\\"handled_by_id\\\\\\\" TEXT,\\\\n \\\\\\\"handled_by_kind\\\\\\\" TEXT,\\\\n \\\\\\\"handled_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"message_id\\\\\\\" TEXT,\\\\n \\\\\\\"in_reply_to\\\\\\\" TEXT,\\\\n \\\\\\\"provider_message_id\\\\\\\" TEXT,\\\\n \\\\\\\"cc_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"bcc_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"reply_to_address\\\\\\\" TEXT,\\\\n \\\\\\\"reply_to_name\\\\\\\" TEXT,\\\\n \\\\\\\"text_body\\\\\\\" TEXT,\\\\n \\\\\\\"html_body\\\\\\\" TEXT,\\\\n \\\\\\\"folder_id\\\\\\\" TEXT,\\\\n \\\\\\\"folder_path\\\\\\\" TEXT,\\\\n \\\\\\\"labels\\\\\\\" TEXT,\\\\n \\\\\\\"flags\\\\\\\" TEXT,\\\\n \\\\\\\"is_answered\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_draft\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"raw_message\\\\\\\" TEXT,\\\\n \\\\\\\"headers\\\\\\\" TEXT,\\\\n \\\\\\\"channel_id\\\\\\\" TEXT,\\\\n \\\\\\\"channel_name\\\\\\\" TEXT,\\\\n \\\\\\\"slack_ts\\\\\\\" TEXT,\\\\n \\\\\\\"slack_thread_ts\\\\\\\" TEXT,\\\\n \\\\\\\"reactions\\\\\\\" TEXT,\\\\n \\\\\\\"is_edited\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"message_type\\\\\\\" TEXT,\\\\n \\\\\\\"blocks\\\\\\\" TEXT,\\\\n \\\\\\\"tweet_id\\\\\\\" TEXT,\\\\n \\\\\\\"retweet_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"like_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"reply_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"is_retweet\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_reply\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"media_urls\\\\\\\" TEXT,\\\\n \\\\\\\"hashtags\\\\\\\" TEXT,\\\\n \\\\\\\"mentions\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"persona_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"endpoint_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messaging_endpoints\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"correlation_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"thread_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"from_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"from_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"to_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"date\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"is_read\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_flagged\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"has_attachments\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"size\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"metadata\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"send_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"default\\\":\\\"draft\\\"},\\\"sent_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"send_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"retry_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"max_retries\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":3},\\\"scheduled_send_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"in_reply_to_message_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messages\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"handled_by_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handled_by_kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handled_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"in_reply_to\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"cc_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bcc_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reply_to_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reply_to_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"text_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"html_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"folder_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"folder_path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"labels\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"flags\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_answered\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_draft\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"raw_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"headers\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"slack_ts\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"slack_thread_ts\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reactions\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_edited\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"message_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"blocks\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"tweet_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"retweet_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"like_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"reply_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"is_retweet\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_reply\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"media_urls\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"hashtags\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"mentions\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"messages_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"messages_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"messages_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"messages_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]},{\\\"name\\\":\\\"messages_persona_id_idx\\\",\\\"columns\\\":[\\\"persona_id\\\"]},{\\\"name\\\":\\\"messages_endpoint_id_idx\\\",\\\"columns\\\":[\\\"endpoint_id\\\"]},{\\\"name\\\":\\\"messages_in_reply_to_message_id_idx\\\",\\\"columns\\\":[\\\"in_reply_to_message_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_d0024f738cf4\\\",\\\"columns\\\":[\\\"is_answered\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Email') OR \\\\\\\"is_answered\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_0adcd2453c81\\\",\\\"columns\\\":[\\\"is_draft\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Email') OR \\\\\\\"is_draft\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_428e155c9609\\\",\\\"columns\\\":[\\\"is_edited\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:SlackMessage') OR \\\\\\\"is_edited\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_a17af99e85e3\\\",\\\"columns\\\":[\\\"is_reply\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"is_reply\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_3e30563cba58\\\",\\\"columns\\\":[\\\"is_retweet\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"is_retweet\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_bab2c772ebe6\\\",\\\"columns\\\":[\\\"like_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"like_count\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_c6ad8d47bbc8\\\",\\\"columns\\\":[\\\"reply_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"reply_count\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_43a00e1c098d\\\",\\\"columns\\\":[\\\"retweet_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"retweet_count\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"da95c653\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:EmailFolderCollection\\\":{\\\"name\\\":\\\"emailfoldercollection\\\",\\\"className\\\":\\\"EmailFolderCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:EmailFolderCollection\\\",\\\"collection\\\":\\\"emailfolders\\\",\\\"filePath\\\":\\\"src/collections/EmailFolderCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"getByPath\\\":{\\\"name\\\":\\\"getByPath\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"path\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailFolder | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByAccount\\\":{\\\"name\\\":\\\"getByAccount\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailFolder[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getInbox\\\":{\\\"name\\\":\\\"getInbox\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailFolder | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getSent\\\":{\\\"name\\\":\\\"getSent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailFolder | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getDrafts\\\":{\\\"name\\\":\\\"getDrafts\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailFolder | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getTrash\\\":{\\\"name\\\":\\\"getTrash\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailFolder | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getSpam\\\":{\\\"name\\\":\\\"getSpam\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailFolder | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getSystemFolders\\\":{\\\"name\\\":\\\"getSystemFolders\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailFolder[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getUserFolders\\\":{\\\"name\\\":\\\"getUserFolders\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailFolder[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getSubscribed\\\":{\\\"name\\\":\\\"getSubscribed\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<EmailFolder[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getWithUnread\\\":{\\\"name\\\":\\\"getWithUnread\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<EmailFolder[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"search\\\":{\\\"name\\\":\\\"search\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"query\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"filters\\\",\\\"type\\\":\\\"EmailFolderSearchFilters\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<EmailFolder[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"refreshAllCounts\\\":{\\\"name\\\":\\\"refreshAllCounts\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAccountStats\\\":{\\\"name\\\":\\\"getAccountStats\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createSystemFolders\\\":{\\\"name\\\":\\\"createSystemFolders\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByTenant\\\":{\\\"name\\\":\\\"findByTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailFolder[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findGlobal\\\":{\\\"name\\\":\\\"findGlobal\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<EmailFolder[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findWithGlobals\\\":{\\\"name\\\":\\\"findWithGlobals\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<EmailFolder[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\",\\\"update\\\",\\\"delete\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"EmailFolder\\\",\\\"exportName\\\":\\\"EmailFolderCollection\\\",\\\"collectionExportName\\\":\\\"EmailFolderCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:EmailFolder\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"email_folders\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"email_folders\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"path\\\\\\\" TEXT,\\\\n \\\\\\\"delimiter\\\\\\\" TEXT,\\\\n \\\\\\\"special_use\\\\\\\" TEXT,\\\\n \\\\\\\"message_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"unread_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"subscribed\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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\\\":false,\\\"unique\\\":false},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"delimiter\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"special_use\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"message_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"unread_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"subscribed\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true}},\\\"indexes\\\":[{\\\"name\\\":\\\"email_folders_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"email_folders_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"email_folders_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]}],\\\"version\\\":\\\"cfea127c\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:MessageCollection\\\":{\\\"name\\\":\\\"messagecollection\\\",\\\"className\\\":\\\"MessageCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:MessageCollection\\\",\\\"collection\\\":\\\"messages\\\",\\\"filePath\\\":\\\"src/collections/MessageCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"search\\\":{\\\"name\\\":\\\"search\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"query\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"filters\\\",\\\"type\\\":\\\"MessageSearchFilters\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByAccounts\\\":{\\\"name\\\":\\\"getByAccounts\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountIds\\\",\\\"type\\\":\\\"string[]\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByType\\\":{\\\"name\\\":\\\"getByType\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageType\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getUnread\\\":{\\\"name\\\":\\\"getUnread\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getFlagged\\\":{\\\"name\\\":\\\"getFlagged\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getRecent\\\":{\\\"name\\\":\\\"getRecent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"limit\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":true},{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByThread\\\":{\\\"name\\\":\\\"getByThread\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"threadId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markAllRead\\\":{\\\"name\\\":\\\"markAllRead\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"messageIds\\\",\\\"type\\\":\\\"string[]\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAccountStats\\\":{\\\"name\\\":\\\"getAccountStats\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getDrafts\\\":{\\\"name\\\":\\\"getDrafts\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getSent\\\":{\\\"name\\\":\\\"getSent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getScheduled\\\":{\\\"name\\\":\\\"getScheduled\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getFailedSends\\\":{\\\"name\\\":\\\"getFailedSends\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getOutbox\\\":{\\\"name\\\":\\\"getOutbox\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"accountId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByTenant\\\":{\\\"name\\\":\\\"findByTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findGlobal\\\":{\\\"name\\\":\\\"findGlobal\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findWithGlobals\\\":{\\\"name\\\":\\\"findWithGlobals\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Message\\\",\\\"exportName\\\":\\\"MessageCollection\\\",\\\"collectionExportName\\\":\\\"MessageCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:Message\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"messages\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"messages\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"persona_id\\\\\\\" UUID,\\\\n \\\\\\\"endpoint_id\\\\\\\" UUID,\\\\n \\\\\\\"correlation_id\\\\\\\" TEXT,\\\\n \\\\\\\"thread_id\\\\\\\" TEXT,\\\\n \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"body\\\\\\\" TEXT,\\\\n \\\\\\\"from_address\\\\\\\" TEXT,\\\\n \\\\\\\"from_name\\\\\\\" TEXT,\\\\n \\\\\\\"to_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"date\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"is_read\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_flagged\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"has_attachments\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"size\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"metadata\\\\\\\" TEXT,\\\\n \\\\\\\"send_status\\\\\\\" TEXT DEFAULT 'draft',\\\\n \\\\\\\"sent_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"send_error\\\\\\\" TEXT,\\\\n \\\\\\\"retry_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"max_retries\\\\\\\" INTEGER DEFAULT 3,\\\\n \\\\\\\"scheduled_send_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"in_reply_to_message_id\\\\\\\" UUID,\\\\n \\\\\\\"handled_by_id\\\\\\\" TEXT,\\\\n \\\\\\\"handled_by_kind\\\\\\\" TEXT,\\\\n \\\\\\\"handled_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"message_id\\\\\\\" TEXT,\\\\n \\\\\\\"in_reply_to\\\\\\\" TEXT,\\\\n \\\\\\\"provider_message_id\\\\\\\" TEXT,\\\\n \\\\\\\"cc_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"bcc_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"reply_to_address\\\\\\\" TEXT,\\\\n \\\\\\\"reply_to_name\\\\\\\" TEXT,\\\\n \\\\\\\"text_body\\\\\\\" TEXT,\\\\n \\\\\\\"html_body\\\\\\\" TEXT,\\\\n \\\\\\\"folder_id\\\\\\\" TEXT,\\\\n \\\\\\\"folder_path\\\\\\\" TEXT,\\\\n \\\\\\\"labels\\\\\\\" TEXT,\\\\n \\\\\\\"flags\\\\\\\" TEXT,\\\\n \\\\\\\"is_answered\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_draft\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"raw_message\\\\\\\" TEXT,\\\\n \\\\\\\"headers\\\\\\\" TEXT,\\\\n \\\\\\\"channel_id\\\\\\\" TEXT,\\\\n \\\\\\\"channel_name\\\\\\\" TEXT,\\\\n \\\\\\\"slack_ts\\\\\\\" TEXT,\\\\n \\\\\\\"slack_thread_ts\\\\\\\" TEXT,\\\\n \\\\\\\"reactions\\\\\\\" TEXT,\\\\n \\\\\\\"is_edited\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"message_type\\\\\\\" TEXT,\\\\n \\\\\\\"blocks\\\\\\\" TEXT,\\\\n \\\\\\\"tweet_id\\\\\\\" TEXT,\\\\n \\\\\\\"retweet_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"like_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"reply_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"is_retweet\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_reply\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"media_urls\\\\\\\" TEXT,\\\\n \\\\\\\"hashtags\\\\\\\" TEXT,\\\\n \\\\\\\"mentions\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"persona_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"endpoint_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messaging_endpoints\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"correlation_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"thread_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"from_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"from_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"to_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"date\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"is_read\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_flagged\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"has_attachments\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"size\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"metadata\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"send_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"default\\\":\\\"draft\\\"},\\\"sent_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"send_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"retry_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"max_retries\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":3},\\\"scheduled_send_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"in_reply_to_message_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messages\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"handled_by_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handled_by_kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handled_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"in_reply_to\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"cc_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bcc_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reply_to_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reply_to_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"text_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"html_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"folder_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"folder_path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"labels\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"flags\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_answered\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_draft\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"raw_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"headers\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"slack_ts\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"slack_thread_ts\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reactions\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_edited\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"message_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"blocks\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"tweet_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"retweet_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"like_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"reply_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"is_retweet\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_reply\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"media_urls\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"hashtags\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"mentions\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"messages_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"messages_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"messages_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"messages_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]},{\\\"name\\\":\\\"messages_persona_id_idx\\\",\\\"columns\\\":[\\\"persona_id\\\"]},{\\\"name\\\":\\\"messages_endpoint_id_idx\\\",\\\"columns\\\":[\\\"endpoint_id\\\"]},{\\\"name\\\":\\\"messages_in_reply_to_message_id_idx\\\",\\\"columns\\\":[\\\"in_reply_to_message_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_d0024f738cf4\\\",\\\"columns\\\":[\\\"is_answered\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Email') OR \\\\\\\"is_answered\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_0adcd2453c81\\\",\\\"columns\\\":[\\\"is_draft\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Email') OR \\\\\\\"is_draft\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_428e155c9609\\\",\\\"columns\\\":[\\\"is_edited\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:SlackMessage') OR \\\\\\\"is_edited\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_a17af99e85e3\\\",\\\"columns\\\":[\\\"is_reply\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"is_reply\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_3e30563cba58\\\",\\\"columns\\\":[\\\"is_retweet\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"is_retweet\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_bab2c772ebe6\\\",\\\"columns\\\":[\\\"like_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"like_count\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_c6ad8d47bbc8\\\",\\\"columns\\\":[\\\"reply_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"reply_count\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_43a00e1c098d\\\",\\\"columns\\\":[\\\"retweet_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"retweet_count\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"e51be371\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:MessagingEndpointCollection\\\":{\\\"name\\\":\\\"messagingendpointcollection\\\",\\\"className\\\":\\\"MessagingEndpointCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:MessagingEndpointCollection\\\",\\\"collection\\\":\\\"messagingendpoints\\\",\\\"filePath\\\":\\\"src/collections/MessagingEndpointCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"messaging_endpoints\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"MessagingEndpoint\\\",\\\"exportName\\\":\\\"MessagingEndpointCollection\\\",\\\"collectionExportName\\\":\\\"MessagingEndpointCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:MessagingEndpoint\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"messaging_endpoints\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"messaging_endpoints\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"profile_id\\\\\\\" UUID,\\\\n \\\\\\\"label\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"channel\\\\\\\" TEXT NOT NULL DEFAULT 'email',\\\\n \\\\\\\"address\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"is_active\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE,\\\\n \\\\\\\"verified_at\\\\\\\" TIMESTAMP\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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},\\\"profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"label\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"channel\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"email\\\"},\\\"address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"is_active\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true},\\\"verified_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"messaging_endpoints_tenant_id_channel_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"channel\\\",\\\"label\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"messaging_endpoints_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"messaging_endpoints_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"messaging_endpoints_profile_id_idx\\\",\\\"columns\\\":[\\\"profile_id\\\"]}],\\\"version\\\":\\\"b4466849\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:NotificationDeliveryCollection\\\":{\\\"name\\\":\\\"notificationdeliverycollection\\\",\\\"className\\\":\\\"NotificationDeliveryCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:NotificationDeliveryCollection\\\",\\\"collection\\\":\\\"notificationdeliveries\\\",\\\"filePath\\\":\\\"src/collections/NotificationDeliveryCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"notification_deliveries\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"NotificationDelivery\\\",\\\"exportName\\\":\\\"NotificationDeliveryCollection\\\",\\\"collectionExportName\\\":\\\"NotificationDeliveryCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:NotificationDelivery\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"notification_deliveries\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"notification_deliveries\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"recipient_user_id\\\\\\\" UUID,\\\\n \\\\\\\"recipient_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"recipient_kind\\\\\\\" TEXT NOT NULL DEFAULT 'user',\\\\n \\\\\\\"channel\\\\\\\" TEXT NOT NULL DEFAULT 'email',\\\\n \\\\\\\"source_ref\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"kind\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"required_dispatch_policy\\\\\\\" TEXT,\\\\n \\\\\\\"dispatch_policy_binding\\\\\\\" JSON,\\\\n \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"text_body\\\\\\\" TEXT,\\\\n \\\\\\\"href\\\\\\\" TEXT,\\\\n \\\\\\\"recipient_address\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"recipient_name\\\\\\\" TEXT,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"message_id\\\\\\\" UUID,\\\\n \\\\\\\"status\\\\\\\" TEXT DEFAULT 'pending',\\\\n \\\\\\\"state_version\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"transition_id\\\\\\\" TEXT,\\\\n \\\\\\\"attempts\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"max_attempts\\\\\\\" INTEGER NOT NULL DEFAULT 5,\\\\n \\\\\\\"next_attempt_at\\\\\\\" TEXT,\\\\n \\\\\\\"lease_token\\\\\\\" TEXT,\\\\n \\\\\\\"lease_expires_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"handed_off_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"delivered_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"provider_message_id\\\\\\\" TEXT,\\\\n \\\\\\\"last_error\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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},\\\"recipient_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recipient_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recipient_kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"user\\\"},\\\"channel\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"email\\\"},\\\"source_ref\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"required_dispatch_policy\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"dispatch_policy_binding\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"text_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"href\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recipient_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"recipient_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"message_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messages\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"pending\\\"},\\\"state_version\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"transition_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"attempts\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"max_attempts\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":5},\\\"next_attempt_at\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"lease_token\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"lease_expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"handed_off_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"delivered_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"provider_message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"notification_deliveries_tenant_id_recipient_kind_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"recipient_kind\\\",\\\"recipient_user_id\\\",\\\"recipient_profile_id\\\",\\\"channel\\\",\\\"source_ref\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"notification_deliveries_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"notification_deliveries_user_identity\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"recipient_user_id\\\",\\\"channel\\\",\\\"source_ref\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"notification_deliveries_profile_identity\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"recipient_profile_id\\\",\\\"channel\\\",\\\"source_ref\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"notification_deliveries_due_idx\\\",\\\"columns\\\":[\\\"status\\\",\\\"next_attempt_at\\\"]},{\\\"name\\\":\\\"notification_deliveries_lease_idx\\\",\\\"columns\\\":[\\\"status\\\",\\\"lease_expires_at\\\"]},{\\\"name\\\":\\\"notification_deliveries_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"notification_deliveries_recipient_user_id_idx\\\",\\\"columns\\\":[\\\"recipient_user_id\\\"]},{\\\"name\\\":\\\"notification_deliveries_recipient_profile_id_idx\\\",\\\"columns\\\":[\\\"recipient_profile_id\\\"]},{\\\"name\\\":\\\"notification_deliveries_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]},{\\\"name\\\":\\\"notification_deliveries_message_id_idx\\\",\\\"columns\\\":[\\\"message_id\\\"]}],\\\"version\\\":\\\"547f434f\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:NotificationOptOutCollection\\\":{\\\"name\\\":\\\"notificationoptoutcollection\\\",\\\"className\\\":\\\"NotificationOptOutCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:NotificationOptOutCollection\\\",\\\"collection\\\":\\\"notificationoptouts\\\",\\\"filePath\\\":\\\"src/collections/NotificationOptOutCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"notification_opt_outs\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"NotificationOptOut\\\",\\\"exportName\\\":\\\"NotificationOptOutCollection\\\",\\\"collectionExportName\\\":\\\"NotificationOptOutCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:NotificationOptOut\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"notification_opt_outs\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"notification_opt_outs\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"recipient_user_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"channel\\\\\\\" TEXT NOT NULL DEFAULT 'email',\\\\n \\\\\\\"scope\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"opted_out_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"updated_by\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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},\\\"recipient_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"channel\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"email\\\"},\\\"scope\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"opted_out_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"updated_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"notification_opt_outs_tenant_id_recipient_user_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"recipient_user_id\\\",\\\"channel\\\",\\\"scope\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"notification_opt_outs_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"notification_opt_outs_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"notification_opt_outs_recipient_user_id_idx\\\",\\\"columns\\\":[\\\"recipient_user_id\\\"]}],\\\"version\\\":\\\"a13e93c1\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:PersonaMessageRouteCollection\\\":{\\\"name\\\":\\\"personamessageroutecollection\\\",\\\"className\\\":\\\"PersonaMessageRouteCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:PersonaMessageRouteCollection\\\",\\\"collection\\\":\\\"personamessageroutes\\\",\\\"filePath\\\":\\\"src/collections/PersonaMessageRouteCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"forPersona\\\":{\\\"name\\\":\\\"forPersona\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"personaId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<PersonaMessageRoute[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"persona_message_routes\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"PersonaMessageRoute\\\",\\\"exportName\\\":\\\"PersonaMessageRouteCollection\\\",\\\"collectionExportName\\\":\\\"PersonaMessageRouteCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:PersonaMessageRoute\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"persona_message_routes\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"persona_message_routes\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"persona_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"account_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"endpoint_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"purpose\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"priority\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"enabled\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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},\\\"persona_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"CASCADE\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"endpoint_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messaging_endpoints\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"CASCADE\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"purpose\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"priority\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"enabled\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true}},\\\"indexes\\\":[{\\\"name\\\":\\\"persona_message_routes_tenant_id_persona_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"persona_id\\\",\\\"account_id\\\",\\\"endpoint_id\\\",\\\"purpose\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"persona_message_routes_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"persona_message_routes_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"persona_message_routes_persona_id_idx\\\",\\\"columns\\\":[\\\"persona_id\\\"]},{\\\"name\\\":\\\"persona_message_routes_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]},{\\\"name\\\":\\\"persona_message_routes_endpoint_id_idx\\\",\\\"columns\\\":[\\\"endpoint_id\\\"]}],\\\"version\\\":\\\"3caf446e\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:UserNotificationCollection\\\":{\\\"name\\\":\\\"usernotificationcollection\\\",\\\"className\\\":\\\"UserNotificationCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:UserNotificationCollection\\\",\\\"collection\\\":\\\"usernotifications\\\",\\\"filePath\\\":\\\"src/collections/UserNotificationCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"user_notifications\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UserNotification\\\",\\\"exportName\\\":\\\"UserNotificationCollection\\\",\\\"collectionExportName\\\":\\\"UserNotificationCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:UserNotification\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"user_notifications\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"user_notifications\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"recipient_user_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"kind\\\\\\\" TEXT,\\\\n \\\\\\\"title\\\\\\\" TEXT,\\\\n \\\\\\\"body\\\\\\\" TEXT,\\\\n \\\\\\\"href\\\\\\\" TEXT,\\\\n \\\\\\\"severity\\\\\\\" TEXT DEFAULT 'info',\\\\n \\\\\\\"source_ref\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"occurred_at\\\\\\\" TEXT,\\\\n \\\\\\\"read_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"dismissed_at\\\\\\\" TIMESTAMP\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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},\\\"recipient_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"title\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"href\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"severity\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"info\\\"},\\\"source_ref\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"occurred_at\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"read_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"dismissed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"user_notifications_tenant_id_recipient_user_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"recipient_user_id\\\",\\\"source_ref\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"user_notifications_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"user_notifications_recipient_occurred_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"recipient_user_id\\\",\\\"occurred_at\\\"]},{\\\"name\\\":\\\"user_notifications_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"user_notifications_recipient_user_id_idx\\\",\\\"columns\\\":[\\\"recipient_user_id\\\"]}],\\\"version\\\":\\\"812ca772\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:WhitelistCollection\\\":{\\\"name\\\":\\\"whitelistcollection\\\",\\\"className\\\":\\\"WhitelistCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:WhitelistCollection\\\",\\\"collection\\\":\\\"whitelists\\\",\\\"filePath\\\":\\\"src/collections/WhitelistCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"isWhitelisted\\\":{\\\"name\\\":\\\"isWhitelisted\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"email\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"category\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getMatchingEntry\\\":{\\\"name\\\":\\\"getMatchingEntry\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"email\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Whitelist | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getByCategory\\\":{\\\"name\\\":\\\"getByCategory\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"category\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Whitelist[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\",\\\"update\\\",\\\"delete\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Whitelist\\\",\\\"exportName\\\":\\\"WhitelistCollection\\\",\\\"collectionExportName\\\":\\\"WhitelistCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-messages:Whitelist\\\",\\\"inheritedExposure\\\":[\\\"api\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"whitelists\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"whitelists\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"pattern\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"type\\\\\\\" TEXT DEFAULT 'email',\\\\n \\\\\\\"category\\\\\\\" TEXT,\\\\n \\\\\\\"description\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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\\\"},\\\"pattern\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"email\\\"},\\\"category\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"whitelists_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"whitelists_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"eb5b558d\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:Account\\\":{\\\"name\\\":\\\"account\\\",\\\"className\\\":\\\"Account\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:Account\\\",\\\"collection\\\":\\\"accounts\\\",\\\"filePath\\\":\\\"src/models/Account.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"created_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updated_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true,\\\"mode\\\":\\\"optional\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The display name for this connected messaging account.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The display name for this connected messaging account.\\\"},\\\"providerType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The service that connects this account to your application.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The service that connects this account to your application.\\\"},\\\"channelType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The kind of messaging this account supports, such as email or chat.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The kind of messaging this account supports, such as email or chat.\\\"},\\\"credentialSecretId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"readonly\\\"],\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"required\\\":false,\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"isActive\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this account is enabled for messaging.\\\"},\\\"required\\\":true,\\\"default\\\":true,\\\"description\\\":\\\"Whether this account is enabled for messaging.\\\"},\\\"ownerUserId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The person who owns this account and decides who else may use it.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-users:User\\\",\\\"description\\\":\\\"The person who owns this account and decides who else may use it.\\\"},\\\"label\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"A short name shown beside this account, such as Support or Personal.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"A short name shown beside this account, such as Support or Personal.\\\"},\\\"connectionStatus\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it.\\\"},\\\"statusMessage\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Why the account needs attention, in plain words.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Why the account needs attention, in plain words.\\\"},\\\"lastSyncAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account last checked for new messages.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account last checked for new messages.\\\"},\\\"settings\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"readonly\\\"],\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"required\\\":false,\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"configuration\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The public connection settings for this account; credentials are stored separately.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The public connection settings for this account; credentials are stored separately.\\\"},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account was added.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account was added.\\\"},\\\"updatedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account was last changed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account was last changed.\\\"}},\\\"methods\\\":{\\\"getSettings\\\":{\\\"name\\\":\\\"getSettings\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setSettings\\\":{\\\"name\\\":\\\"setSettings\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"settings\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getConfiguration\\\":{\\\"name\\\":\\\"getConfiguration\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setConfiguration\\\":{\\\"name\\\":\\\"setConfiguration\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"configuration\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markNeedsReconnect\\\":{\\\"name\\\":\\\"markNeedsReconnect\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"reason\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markConnected\\\":{\\\"name\\\":\\\"markConnected\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"activate\\\":{\\\"name\\\":\\\"activate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deactivate\\\":{\\\"name\\\":\\\"deactivate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setCredentials\\\":{\\\"name\\\":\\\"setCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"credentials\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"removeCredentials\\\":{\\\"name\\\":\\\"removeCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createSender\\\":{\\\"name\\\":\\\"createSender\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<MessageSenderInterface>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getCredentials\\\":{\\\"name\\\":\\\"getCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Record<string, unknown> | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableStrategy\\\":\\\"sti\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"tenantScoped\\\":{\\\"mode\\\":\\\"optional\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Account\\\",\\\"collectionExportName\\\":\\\"AccountCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"isActive\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"accounts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"accounts\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"provider_type\\\\\\\" TEXT,\\\\n \\\\\\\"channel_type\\\\\\\" TEXT,\\\\n \\\\\\\"credential_secret_id\\\\\\\" TEXT,\\\\n \\\\\\\"is_active\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"owner_user_id\\\\\\\" UUID,\\\\n \\\\\\\"label\\\\\\\" TEXT,\\\\n \\\\\\\"connection_status\\\\\\\" TEXT,\\\\n \\\\\\\"status_message\\\\\\\" TEXT,\\\\n \\\\\\\"last_sync_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"settings\\\\\\\" TEXT,\\\\n \\\\\\\"configuration\\\\\\\" TEXT,\\\\n \\\\\\\"email\\\\\\\" TEXT,\\\\n \\\\\\\"sync_interval_minutes\\\\\\\" INTEGER DEFAULT 60,\\\\n \\\\\\\"sync_cursor\\\\\\\" TEXT,\\\\n \\\\\\\"backfill_since\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"cursor_horizon\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_sync_error\\\\\\\" TEXT,\\\\n \\\\\\\"backlog\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"agent_send_policy\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_id\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_name\\\\\\\" TEXT,\\\\n \\\\\\\"bot_user_id\\\\\\\" TEXT,\\\\n \\\\\\\"handle\\\\\\\" TEXT,\\\\n \\\\\\\"twitter_user_id\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"credential_secret_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_active\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":true},\\\"owner_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"label\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"connection_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"status_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"last_sync_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"settings\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"configuration\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"sync_interval_minutes\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":60},\\\"sync_cursor\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backfill_since\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"cursor_horizon\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"last_sync_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backlog\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"agent_send_policy\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bot_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handle\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"twitter_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"accounts_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"accounts_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"accounts_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"accounts_owner_user_id_idx\\\",\\\"columns\\\":[\\\"owner_user_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_81229bbfe8e3\\\",\\\"columns\\\":[\\\"backlog\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"backlog\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_1f9c5f0ee488\\\",\\\"columns\\\":[\\\"sync_interval_minutes\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"sync_interval_minutes\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"ff134288\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:Attachment\\\":{\\\"name\\\":\\\"attachment\\\",\\\"className\\\":\\\"Attachment\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:Attachment\\\",\\\"collection\\\":\\\"attachments\\\",\\\"filePath\\\":\\\"src/models/Attachment.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true,\\\"mode\\\":\\\"optional\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"messageId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"related\\\"]},\\\"required\\\":false,\\\"related\\\":\\\"Message\\\"},\\\"accountId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"related\\\"]},\\\"required\\\":false,\\\"related\\\":\\\"Account\\\"},\\\"filename\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"contentType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"size\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":0},\\\"contentId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"contentDisposition\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\",\\\"enum\\\"]},\\\"required\\\":false,\\\"default\\\":\\\"attachment\\\",\\\"enum\\\":[\\\"attachment\\\",\\\"inline\\\"]},\\\"filePath\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"sourceUrl\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false}},\\\"methods\\\":{\\\"loadFromId\\\":{\\\"name\\\":\\\"loadFromId\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"loadFromSlug\\\":{\\\"name\\\":\\\"loadFromSlug\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getMessage\\\":{\\\"name\\\":\\\"getMessage\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isImage\\\":{\\\"name\\\":\\\"isImage\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isPdf\\\":{\\\"name\\\":\\\"isPdf\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isInline\\\":{\\\"name\\\":\\\"isInline\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getExtension\\\":{\\\"name\\\":\\\"getExtension\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getFormattedSize\\\":{\\\"name\\\":\\\"getFormattedSize\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"hasExternalFile\\\":{\\\"name\\\":\\\"hasExternalFile\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"readContent\\\":{\\\"name\\\":\\\"readContent\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Buffer | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\",\\\"delete\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"skipApiCheck\\\":true},\\\"tenantScoped\\\":{\\\"mode\\\":\\\"optional\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Attachment\\\",\\\"collectionExportName\\\":\\\"AttachmentCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"size\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"attachments\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"attachments\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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,\\\\n \\\\\\\"message_id\\\\\\\" UUID,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"filename\\\\\\\" TEXT,\\\\n \\\\\\\"content_type\\\\\\\" TEXT,\\\\n \\\\\\\"size\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"content_id\\\\\\\" TEXT,\\\\n \\\\\\\"content_disposition\\\\\\\" TEXT DEFAULT 'attachment',\\\\n \\\\\\\"file_path\\\\\\\" TEXT,\\\\n \\\\\\\"source_url\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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\\\":false,\\\"unique\\\":false},\\\"message_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messages\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"filename\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"content_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"size\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"content_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"content_disposition\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"attachment\\\"},\\\"file_path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"source_url\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"attachments_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"attachments_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"attachments_message_id_idx\\\",\\\"columns\\\":[\\\"message_id\\\"]},{\\\"name\\\":\\\"attachments_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]}],\\\"version\\\":\\\"3f32531c\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:Blacklist\\\":{\\\"name\\\":\\\"blacklist\\\",\\\"className\\\":\\\"Blacklist\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:Blacklist\\\",\\\"collection\\\":\\\"blacklists\\\",\\\"description\\\":\\\"Block entries for email filtering\\\",\\\"filePath\\\":\\\"src/models/Blacklist.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"pattern\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":false,\\\"default\\\":\\\"\\\"},\\\"type\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\",\\\"enum\\\"]},\\\"required\\\":false,\\\"default\\\":\\\"email\\\",\\\"enum\\\":[\\\"email\\\",\\\"domain\\\",\\\"regex\\\"]},\\\"reason\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":false,\\\"default\\\":\\\"\\\"},\\\"autoArchive\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":false,\\\"default\\\":true},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"autoFilter\\\":true,\\\"autoPopulate\\\":true,\\\"allowSuperAdminBypass\\\":false},\\\"generated\\\":true,\\\"source\\\":\\\"tenantScoped_decorator\\\",\\\"sqlType\\\":\\\"UUID\\\"},\\\"required\\\":true}},\\\"methods\\\":{\\\"matches\\\":{\\\"name\\\":\\\"matches\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"email\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\",\\\"update\\\",\\\"delete\\\"]},\\\"cli\\\":{\\\"skipApiCheck\\\":true},\\\"tenantScoped\\\":true,\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Blacklist\\\",\\\"collectionExportName\\\":\\\"BlacklistCollection\\\",\\\"validationRules\\\":[],\\\"schema\\\":{\\\"tableName\\\":\\\"blacklists\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"blacklists\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"pattern\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"type\\\\\\\" TEXT DEFAULT 'email',\\\\n \\\\\\\"reason\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"auto_archive\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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\\\"},\\\"pattern\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"email\\\"},\\\"reason\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"auto_archive\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":true},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"blacklists_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"blacklists_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"478c8724\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:Correspondent\\\":{\\\"name\\\":\\\"correspondent\\\",\\\"className\\\":\\\"Correspondent\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:Correspondent\\\",\\\"collection\\\":\\\"correspondents\\\",\\\"description\\\":\\\"Someone one person writes to or hears from, derived from that person's synced mail (#5132).\\\",\\\"filePath\\\":\\\"src/models/Correspondent.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"requiredFor\\\",\\\"__tenancy\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"requiredFor\\\":\\\"tenant-scope\\\"},\\\"required\\\":true},\\\"ownerUserId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\",\\\"related\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true,\\\"related\\\":\\\"@happyvertical/smrt-users:User\\\"},\\\"address\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true},\\\"displayName\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"messageCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":0},\\\"sentCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":0},\\\"receivedCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":0},\\\"firstContactAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"lastContactAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"accountIds\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"accountBreakdown\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"profileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"related\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-profiles:Profile\\\"}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"correspondents\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false,\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"owner_user_id\\\",\\\"address\\\"],\\\"indexes\\\":[{\\\"name\\\":\\\"correspondents_owner_last_contact_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"ownerUserId\\\",\\\"lastContactAt\\\"]}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"}},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Correspondent\\\",\\\"collectionExportName\\\":\\\"CorrespondentCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"ownerUserId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"crossPackageRef\\\"},{\\\"field\\\":\\\"address\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"messageCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"sentCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"receivedCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"correspondents\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"correspondents\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"owner_user_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"address\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"display_name\\\\\\\" TEXT,\\\\n \\\\\\\"message_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"sent_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"received_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"first_contact_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_contact_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"account_ids\\\\\\\" TEXT,\\\\n \\\\\\\"account_breakdown\\\\\\\" TEXT,\\\\n \\\\\\\"profile_id\\\\\\\" UUID\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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},\\\"owner_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"display_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"message_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"sent_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"received_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"first_contact_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_contact_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"account_ids\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"account_breakdown\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"correspondents_tenant_id_owner_user_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"owner_user_id\\\",\\\"address\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"correspondents_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"correspondents_owner_last_contact_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"owner_user_id\\\",\\\"last_contact_at\\\"]},{\\\"name\\\":\\\"correspondents_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"correspondents_owner_user_id_idx\\\",\\\"columns\\\":[\\\"owner_user_id\\\"]},{\\\"name\\\":\\\"correspondents_profile_id_idx\\\",\\\"columns\\\":[\\\"profile_id\\\"]}],\\\"version\\\":\\\"d0cc8363\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:Email\\\":{\\\"name\\\":\\\"email\\\",\\\"className\\\":\\\"Email\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:Email\\\",\\\"collection\\\":\\\"messages\\\",\\\"filePath\\\":\\\"src/models/Email.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"created_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updated_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"required\\\":false,\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true},\\\"required\\\":false},\\\"accountId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The connected account used to receive or send this message.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"Account\\\",\\\"description\\\":\\\"The connected account used to receive or send this message.\\\"},\\\"personaId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"description\\\",\\\"related\\\",\\\"required\\\"],\\\"required\\\":false,\\\"description\\\":\\\"The assistant identity associated with this message, when one was used.\\\",\\\"nullable\\\":true},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-personas:AgentPersona\\\",\\\"description\\\":\\\"The assistant identity associated with this message, when one was used.\\\"},\\\"endpointId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The saved destination used to deliver this message.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"MessagingEndpoint\\\",\\\"description\\\":\\\"The saved destination used to deliver this message.\\\"},\\\"correlationId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"A tracking reference that connects this message to related activity.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"A tracking reference that connects this message to related activity.\\\"},\\\"threadId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The conversation this message belongs to.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The conversation this message belongs to.\\\"},\\\"subject\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The subject shown in the message list.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The subject shown in the message list.\\\"},\\\"body\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The message content in plain text.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The message content in plain text.\\\"},\\\"fromAddress\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The address the message was sent from.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The address the message was sent from.\\\"},\\\"fromName\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The sender name shown beside their address.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The sender name shown beside their address.\\\"},\\\"toAddresses\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The people or addresses receiving this message.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The people or addresses receiving this message.\\\"},\\\"date\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When the message was sent or received.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When the message was sent or received.\\\"},\\\"isRead\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this message has been marked as read.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether this message has been marked as read.\\\"},\\\"isFlagged\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this message is flagged for follow-up.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether this message is flagged for follow-up.\\\"},\\\"hasAttachments\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether files are attached to this message.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether files are attached to this message.\\\"},\\\"size\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"The size of the message in bytes.\\\"},\\\"required\\\":true,\\\"default\\\":0,\\\"description\\\":\\\"The size of the message in bytes.\\\"},\\\"metadata\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Additional details supplied by the messaging connection.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Additional details supplied by the messaging connection.\\\"},\\\"sendStatus\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\",\\\"enum\\\"],\\\"description\\\":\\\"The latest sending state: draft, sending, sent, or failed. Received mail may also show draft here.\\\"},\\\"required\\\":false,\\\"default\\\":\\\"draft\\\",\\\"description\\\":\\\"The latest sending state: draft, sending, sent, or failed. Received mail may also show draft here.\\\",\\\"enum\\\":[\\\"draft\\\",\\\"pending\\\",\\\"sending\\\",\\\"sent\\\",\\\"failed\\\",\\\"scheduled\\\"]},\\\"sentAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When the message was successfully sent.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When the message was successfully sent.\\\"},\\\"sendError\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The reason the latest send attempt failed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The reason the latest send attempt failed.\\\"},\\\"retryCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"How many times delivery has been retried.\\\"},\\\"required\\\":true,\\\"default\\\":0,\\\"description\\\":\\\"How many times delivery has been retried.\\\"},\\\"maxRetries\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"The maximum number of delivery retries allowed.\\\"},\\\"required\\\":true,\\\"default\\\":3,\\\"description\\\":\\\"The maximum number of delivery retries allowed.\\\"},\\\"scheduledSendAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this message is scheduled to be sent.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this message is scheduled to be sent.\\\"},\\\"inReplyToMessageId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The earlier message this one replies to.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"Message\\\",\\\"description\\\":\\\"The earlier message this one replies to.\\\"},\\\"handledById\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"The person or assistant who last acted on this message.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"The person or assistant who last acted on this message.\\\",\\\"readonly\\\":true},\\\"handledByKind\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"Whether a person or an assistant last acted on this message.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"Whether a person or an assistant last acted on this message.\\\",\\\"readonly\\\":true},\\\"handledAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"When someone last acted on this message.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"When someone last acted on this message.\\\",\\\"readonly\\\":true},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this message was recorded.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this message was recorded.\\\"},\\\"updatedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this message was last changed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this message was last changed.\\\"},\\\"messageId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The email reference assigned by the sender for tracking replies.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The email reference assigned by the sender for tracking replies.\\\"},\\\"inReplyTo\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The sender-assigned reference of the email being replied to.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The sender-assigned reference of the email being replied to.\\\"},\\\"providerMessageId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The mail server's own id for this email, used to keep mailbox sync from storing it twice.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The mail server's own id for this email, used to keep mailbox sync from storing it twice.\\\"},\\\"ccAddresses\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Recipients receiving a visible copy of this email.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Recipients receiving a visible copy of this email.\\\"},\\\"bccAddresses\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Recipients receiving a copy without appearing in the visible recipient list.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Recipients receiving a copy without appearing in the visible recipient list.\\\"},\\\"replyToAddress\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The address replies should be sent to.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The address replies should be sent to.\\\"},\\\"replyToName\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The name associated with the reply address.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The name associated with the reply address.\\\"},\\\"textBody\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The plain-text version of the email.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The plain-text version of the email.\\\"},\\\"htmlBody\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The formatted version of the email.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The formatted version of the email.\\\"},\\\"folderId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The mailbox folder reference supplied by the email connection.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The mailbox folder reference supplied by the email connection.\\\"},\\\"folderPath\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The location of this email within the mailbox folders.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The location of this email within the mailbox folders.\\\"},\\\"labels\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Labels applied to this email by the mailbox provider.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Labels applied to this email by the mailbox provider.\\\"},\\\"flags\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Mailbox markers such as read, answered, or flagged.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Mailbox markers such as read, answered, or flagged.\\\"},\\\"isAnswered\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this email has been replied to.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether this email has been replied to.\\\"},\\\"isDraft\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this email is saved as an unfinished draft.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether this email is saved as an unfinished draft.\\\"},\\\"rawMessage\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The original email content as received from the mail server.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The original email content as received from the mail server.\\\"},\\\"headers\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Delivery and routing details included with the email.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Delivery and routing details included with the email.\\\"}},\\\"methods\\\":{\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SmrtSaveOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"delete\\\":{\\\"name\\\":\\\"delete\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"Date | string\\\"]}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getToAddresses\\\":{\\\"name\\\":\\\"getToAddresses\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Array<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setToAddresses\\\":{\\\"name\\\":\\\"setToAddresses\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"addresses\\\",\\\"type\\\":\\\"Array<object>\\\",\\\"optional\\\":false,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getMetadata\\\":{\\\"name\\\":\\\"getMetadata\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setMetadata\\\":{\\\"name\\\":\\\"setMetadata\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"data\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markRead\\\":{\\\"name\\\":\\\"markRead\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markUnread\\\":{\\\"name\\\":\\\"markUnread\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"toggleFlagged\\\":{\\\"name\\\":\\\"toggleFlagged\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isUnread\\\":{\\\"name\\\":\\\"isUnread\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getPreview\\\":{\\\"name\\\":\\\"getPreview\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"maxLength\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"string\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"loadFromId\\\":{\\\"name\\\":\\\"loadFromId\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"loadFromSlug\\\":{\\\"name\\\":\\\"loadFromSlug\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAccount\\\":{\\\"name\\\":\\\"getAccount\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getEndpoint\\\":{\\\"name\\\":\\\"getEndpoint\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getThreadMessages\\\":{\\\"name\\\":\\\"getThreadMessages\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAttachments\\\":{\\\"name\\\":\\\"getAttachments\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"send\\\":{\\\"name\\\":\\\"send\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SendEmailOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<MessageSendResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getHandledBy\\\":{\\\"name\\\":\\\"getHandledBy\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"object | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isSendOutcomeUnknown\\\":{\\\"name\\\":\\\"isSendOutcomeUnknown\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"abandonSendAttempt\\\":{\\\"name\\\":\\\"abandonSendAttempt\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"reason\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"retrySend\\\":{\\\"name\\\":\\\"retrySend\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SendEmailOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<MessageSendResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createReply\\\":{\\\"name\\\":\\\"createReply\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"boolean\\\"]}],\\\"returnType\\\":\\\"Email\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createForward\\\":{\\\"name\\\":\\\"createForward\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Email\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"triage\\\":{\\\"name\\\":\\\"triage\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"action\\\",\\\"type\\\":\\\"MailTriageAction\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<MailTriageResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getCcAddresses\\\":{\\\"name\\\":\\\"getCcAddresses\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Array<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getBccAddresses\\\":{\\\"name\\\":\\\"getBccAddresses\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Array<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getLabels\\\":{\\\"name\\\":\\\"getLabels\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setLabels\\\":{\\\"name\\\":\\\"setLabels\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"labels\\\",\\\"type\\\":\\\"string[]\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getFlags\\\":{\\\"name\\\":\\\"getFlags\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setFlags\\\":{\\\"name\\\":\\\"setFlags\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"flags\\\",\\\"type\\\":\\\"string[]\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getHeaders\\\":{\\\"name\\\":\\\"getHeaders\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, string | string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setHeaders\\\":{\\\"name\\\":\\\"setHeaders\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"headers\\\",\\\"type\\\":\\\"Record<string, string | string[]>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getFolder\\\":{\\\"name\\\":\\\"getFolder\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getThreadEmails\\\":{\\\"name\\\":\\\"getThreadEmails\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Email[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getReferences\\\":{\\\"name\\\":\\\"getReferences\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableStrategy\\\":\\\"sti\\\",\\\"embeddings\\\":{\\\"fields\\\":[\\\"subject\\\",\\\"textBody\\\"],\\\"provider\\\":\\\"auto\\\",\\\"autoGenerate\\\":false},\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\",\\\"update\\\",\\\"delete\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"skipApiCheck\\\":true},\\\"widenParentExposure\\\":{\\\"api\\\":[\\\"create\\\",\\\"update\\\",\\\"delete\\\"]},\\\"tableName\\\":\\\"messages\\\"},\\\"extends\\\":\\\"Message\\\",\\\"exportName\\\":\\\"Email\\\",\\\"collectionExportName\\\":\\\"EmailCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"isRead\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"isFlagged\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"hasAttachments\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"size\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"retryCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"maxRetries\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"isAnswered\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"isDraft\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"messages\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"messages\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"persona_id\\\\\\\" UUID,\\\\n \\\\\\\"endpoint_id\\\\\\\" UUID,\\\\n \\\\\\\"correlation_id\\\\\\\" TEXT,\\\\n \\\\\\\"thread_id\\\\\\\" TEXT,\\\\n \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"body\\\\\\\" TEXT,\\\\n \\\\\\\"from_address\\\\\\\" TEXT,\\\\n \\\\\\\"from_name\\\\\\\" TEXT,\\\\n \\\\\\\"to_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"date\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"is_read\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_flagged\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"has_attachments\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"size\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"metadata\\\\\\\" TEXT,\\\\n \\\\\\\"send_status\\\\\\\" TEXT DEFAULT 'draft',\\\\n \\\\\\\"sent_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"send_error\\\\\\\" TEXT,\\\\n \\\\\\\"retry_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"max_retries\\\\\\\" INTEGER DEFAULT 3,\\\\n \\\\\\\"scheduled_send_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"in_reply_to_message_id\\\\\\\" UUID,\\\\n \\\\\\\"handled_by_id\\\\\\\" TEXT,\\\\n \\\\\\\"handled_by_kind\\\\\\\" TEXT,\\\\n \\\\\\\"handled_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"message_id\\\\\\\" TEXT,\\\\n \\\\\\\"in_reply_to\\\\\\\" TEXT,\\\\n \\\\\\\"provider_message_id\\\\\\\" TEXT,\\\\n \\\\\\\"cc_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"bcc_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"reply_to_address\\\\\\\" TEXT,\\\\n \\\\\\\"reply_to_name\\\\\\\" TEXT,\\\\n \\\\\\\"text_body\\\\\\\" TEXT,\\\\n \\\\\\\"html_body\\\\\\\" TEXT,\\\\n \\\\\\\"folder_id\\\\\\\" TEXT,\\\\n \\\\\\\"folder_path\\\\\\\" TEXT,\\\\n \\\\\\\"labels\\\\\\\" TEXT,\\\\n \\\\\\\"flags\\\\\\\" TEXT,\\\\n \\\\\\\"is_answered\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_draft\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"raw_message\\\\\\\" TEXT,\\\\n \\\\\\\"headers\\\\\\\" TEXT,\\\\n \\\\\\\"channel_id\\\\\\\" TEXT,\\\\n \\\\\\\"channel_name\\\\\\\" TEXT,\\\\n \\\\\\\"slack_ts\\\\\\\" TEXT,\\\\n \\\\\\\"slack_thread_ts\\\\\\\" TEXT,\\\\n \\\\\\\"reactions\\\\\\\" TEXT,\\\\n \\\\\\\"is_edited\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"message_type\\\\\\\" TEXT,\\\\n \\\\\\\"blocks\\\\\\\" TEXT,\\\\n \\\\\\\"tweet_id\\\\\\\" TEXT,\\\\n \\\\\\\"retweet_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"like_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"reply_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"is_retweet\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_reply\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"media_urls\\\\\\\" TEXT,\\\\n \\\\\\\"hashtags\\\\\\\" TEXT,\\\\n \\\\\\\"mentions\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"persona_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"endpoint_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messaging_endpoints\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"correlation_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"thread_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"from_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"from_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"to_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"date\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"is_read\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_flagged\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"has_attachments\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"size\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"metadata\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"send_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"default\\\":\\\"draft\\\"},\\\"sent_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"send_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"retry_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"max_retries\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":3},\\\"scheduled_send_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"in_reply_to_message_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messages\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"handled_by_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handled_by_kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handled_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"in_reply_to\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"cc_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bcc_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reply_to_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reply_to_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"text_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"html_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"folder_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"folder_path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"labels\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"flags\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_answered\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_draft\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"raw_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"headers\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"slack_ts\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"slack_thread_ts\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reactions\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_edited\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"message_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"blocks\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"tweet_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"retweet_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"like_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"reply_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"is_retweet\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_reply\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"media_urls\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"hashtags\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"mentions\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"messages_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"messages_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"messages_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"messages_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]},{\\\"name\\\":\\\"messages_persona_id_idx\\\",\\\"columns\\\":[\\\"persona_id\\\"]},{\\\"name\\\":\\\"messages_endpoint_id_idx\\\",\\\"columns\\\":[\\\"endpoint_id\\\"]},{\\\"name\\\":\\\"messages_in_reply_to_message_id_idx\\\",\\\"columns\\\":[\\\"in_reply_to_message_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_d0024f738cf4\\\",\\\"columns\\\":[\\\"is_answered\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Email') OR \\\\\\\"is_answered\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_0adcd2453c81\\\",\\\"columns\\\":[\\\"is_draft\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Email') OR \\\\\\\"is_draft\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_428e155c9609\\\",\\\"columns\\\":[\\\"is_edited\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:SlackMessage') OR \\\\\\\"is_edited\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_a17af99e85e3\\\",\\\"columns\\\":[\\\"is_reply\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"is_reply\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_3e30563cba58\\\",\\\"columns\\\":[\\\"is_retweet\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"is_retweet\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_bab2c772ebe6\\\",\\\"columns\\\":[\\\"like_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"like_count\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_c6ad8d47bbc8\\\",\\\"columns\\\":[\\\"reply_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"reply_count\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_43a00e1c098d\\\",\\\"columns\\\":[\\\"retweet_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"retweet_count\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"da95c653\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:EmailAccount\\\":{\\\"name\\\":\\\"emailaccount\\\",\\\"className\\\":\\\"EmailAccount\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:EmailAccount\\\",\\\"collection\\\":\\\"accounts\\\",\\\"filePath\\\":\\\"src/models/EmailAccount.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"created_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updated_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"required\\\":false,\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true},\\\"required\\\":false},\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The display name for this connected messaging account.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The display name for this connected messaging account.\\\"},\\\"providerType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The service that connects this account to your application.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The service that connects this account to your application.\\\"},\\\"channelType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The kind of messaging this account supports, such as email or chat.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The kind of messaging this account supports, such as email or chat.\\\"},\\\"credentialSecretId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"readonly\\\"],\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"required\\\":false,\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"isActive\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this account is enabled for messaging.\\\"},\\\"required\\\":true,\\\"default\\\":true,\\\"description\\\":\\\"Whether this account is enabled for messaging.\\\"},\\\"ownerUserId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The person who owns this account and decides who else may use it.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-users:User\\\",\\\"description\\\":\\\"The person who owns this account and decides who else may use it.\\\"},\\\"label\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"A short name shown beside this account, such as Support or Personal.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"A short name shown beside this account, such as Support or Personal.\\\"},\\\"connectionStatus\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it.\\\"},\\\"statusMessage\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Why the account needs attention, in plain words.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Why the account needs attention, in plain words.\\\"},\\\"lastSyncAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account last checked for new messages.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account last checked for new messages.\\\"},\\\"settings\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"readonly\\\"],\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"required\\\":false,\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"configuration\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The public connection settings for this account; credentials are stored separately.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The public connection settings for this account; credentials are stored separately.\\\"},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account was added.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account was added.\\\"},\\\"updatedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account was last changed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account was last changed.\\\"},\\\"email\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The email address associated with this mailbox.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The email address associated with this mailbox.\\\"},\\\"syncIntervalMinutes\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"The time in minutes between scheduled mailbox checks.\\\"},\\\"required\\\":true,\\\"default\\\":60,\\\"description\\\":\\\"The time in minutes between scheduled mailbox checks.\\\"},\\\"syncCursor\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"Where the next mailbox check resumes.\\\",\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"Where the next mailbox check resumes.\\\",\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"backfillSince\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Mail older than this date is not stored. Empty means the whole mailbox.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Mail older than this date is not stored. Empty means the whole mailbox.\\\"},\\\"cursorHorizon\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"The backfill date the saved mailbox position was built under.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"The backfill date the saved mailbox position was built under.\\\",\\\"readonly\\\":true},\\\"lastSyncError\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Why the last mailbox check failed, if it did.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Why the last mailbox check failed, if it did.\\\"},\\\"backlog\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether more mail was still waiting after the last check.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether more mail was still waiting after the last check.\\\"},\\\"agentSendPolicy\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\",\\\"enum\\\"],\\\"description\\\":\\\"Whether an assistant may send from this mailbox on its own, or needs a person to approve each message first.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"Whether an assistant may send from this mailbox on its own, or needs a person to approve each message first.\\\",\\\"enum\\\":[\\\"require_approval\\\",\\\"auto_send\\\"],\\\"readonly\\\":true}},\\\"methods\\\":{\\\"getSettings\\\":{\\\"name\\\":\\\"getSettings\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setSettings\\\":{\\\"name\\\":\\\"setSettings\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"settings\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getConfiguration\\\":{\\\"name\\\":\\\"getConfiguration\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setConfiguration\\\":{\\\"name\\\":\\\"setConfiguration\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"configuration\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markNeedsReconnect\\\":{\\\"name\\\":\\\"markNeedsReconnect\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"reason\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markConnected\\\":{\\\"name\\\":\\\"markConnected\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"activate\\\":{\\\"name\\\":\\\"activate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deactivate\\\":{\\\"name\\\":\\\"deactivate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setCredentials\\\":{\\\"name\\\":\\\"setCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"credentials\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"removeCredentials\\\":{\\\"name\\\":\\\"removeCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createSender\\\":{\\\"name\\\":\\\"createSender\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<MessageSenderInterface>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getCredentials\\\":{\\\"name\\\":\\\"getCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Record<string, unknown> | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"childOptions\\\":{\\\"name\\\":\\\"childOptions\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createClient\\\":{\\\"name\\\":\\\"createClient\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"readIntakeMessage\\\":{\\\"name\\\":\\\"readIntakeMessage\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"locator\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"maxBytes\\\",\\\"type\\\":\\\"number\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"imapIdentity\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\",\\\"number\\\"]}],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"syncFrom\\\":{\\\"name\\\":\\\"syncFrom\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SyncOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<SyncResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"syncChanges\\\":{\\\"name\\\":\\\"syncChanges\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"MailSyncOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<MailSyncResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"triage\\\":{\\\"name\\\":\\\"triage\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"action\\\",\\\"type\\\":\\\"MailTriageAction\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"emailIds\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":false,\\\"typeUnresolved\\\":true}],\\\"returnType\\\":\\\"Promise<MailTriageResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"fetchThread\\\":{\\\"name\\\":\\\"fetchThread\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"threadId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getFolders\\\":{\\\"name\\\":\\\"getFolders\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getEmails\\\":{\\\"name\\\":\\\"getEmails\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"limit\\\",\\\"type\\\":\\\"number\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getUnreadCount\\\":{\\\"name\\\":\\\"getUnreadCount\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"syncAll\\\":{\\\"name\\\":\\\"syncAll\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"args\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Map<string, object>>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"migrateToSecrets\\\":{\\\"name\\\":\\\"migrateToSecrets\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableStrategy\\\":\\\"sti\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"tableName\\\":\\\"accounts\\\"},\\\"extends\\\":\\\"Account\\\",\\\"exportName\\\":\\\"EmailAccount\\\",\\\"collectionExportName\\\":\\\"EmailAccountCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"isActive\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"syncIntervalMinutes\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"backlog\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"accounts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"accounts\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"provider_type\\\\\\\" TEXT,\\\\n \\\\\\\"channel_type\\\\\\\" TEXT,\\\\n \\\\\\\"credential_secret_id\\\\\\\" TEXT,\\\\n \\\\\\\"is_active\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"owner_user_id\\\\\\\" UUID,\\\\n \\\\\\\"label\\\\\\\" TEXT,\\\\n \\\\\\\"connection_status\\\\\\\" TEXT,\\\\n \\\\\\\"status_message\\\\\\\" TEXT,\\\\n \\\\\\\"last_sync_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"settings\\\\\\\" TEXT,\\\\n \\\\\\\"configuration\\\\\\\" TEXT,\\\\n \\\\\\\"email\\\\\\\" TEXT,\\\\n \\\\\\\"sync_interval_minutes\\\\\\\" INTEGER DEFAULT 60,\\\\n \\\\\\\"sync_cursor\\\\\\\" TEXT,\\\\n \\\\\\\"backfill_since\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"cursor_horizon\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_sync_error\\\\\\\" TEXT,\\\\n \\\\\\\"backlog\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"agent_send_policy\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_id\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_name\\\\\\\" TEXT,\\\\n \\\\\\\"bot_user_id\\\\\\\" TEXT,\\\\n \\\\\\\"handle\\\\\\\" TEXT,\\\\n \\\\\\\"twitter_user_id\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"credential_secret_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_active\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":true},\\\"owner_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"label\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"connection_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"status_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"last_sync_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"settings\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"configuration\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"sync_interval_minutes\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":60},\\\"sync_cursor\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backfill_since\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"cursor_horizon\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"last_sync_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backlog\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"agent_send_policy\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bot_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handle\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"twitter_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"accounts_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"accounts_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"accounts_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"accounts_owner_user_id_idx\\\",\\\"columns\\\":[\\\"owner_user_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_81229bbfe8e3\\\",\\\"columns\\\":[\\\"backlog\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"backlog\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_1f9c5f0ee488\\\",\\\"columns\\\":[\\\"sync_interval_minutes\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"sync_interval_minutes\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"ff134288\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:EmailAttachment\\\":{\\\"name\\\":\\\"emailattachment\\\",\\\"className\\\":\\\"EmailAttachment\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:EmailAttachment\\\",\\\"collection\\\":\\\"emailattachments\\\",\\\"filePath\\\":\\\"src/models/EmailAttachment.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true,\\\"mode\\\":\\\"optional\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"required\\\":false,\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true},\\\"required\\\":false},\\\"messageId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"related\\\"]},\\\"required\\\":false,\\\"related\\\":\\\"Message\\\"},\\\"accountId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"related\\\"]},\\\"required\\\":false,\\\"related\\\":\\\"Account\\\"},\\\"filename\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"contentType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"size\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":0},\\\"contentId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"contentDisposition\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\",\\\"enum\\\"]},\\\"required\\\":false,\\\"default\\\":\\\"attachment\\\",\\\"enum\\\":[\\\"attachment\\\",\\\"inline\\\"]},\\\"filePath\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"sourceUrl\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false}},\\\"methods\\\":{\\\"loadFromId\\\":{\\\"name\\\":\\\"loadFromId\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"loadFromSlug\\\":{\\\"name\\\":\\\"loadFromSlug\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getMessage\\\":{\\\"name\\\":\\\"getMessage\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isImage\\\":{\\\"name\\\":\\\"isImage\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isPdf\\\":{\\\"name\\\":\\\"isPdf\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isInline\\\":{\\\"name\\\":\\\"isInline\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getExtension\\\":{\\\"name\\\":\\\"getExtension\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getFormattedSize\\\":{\\\"name\\\":\\\"getFormattedSize\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"hasExternalFile\\\":{\\\"name\\\":\\\"hasExternalFile\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"readContent\\\":{\\\"name\\\":\\\"readContent\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Buffer | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getEmail\\\":{\\\"name\\\":\\\"getEmail\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\",\\\"delete\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"skipApiCheck\\\":true},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"Attachment\\\",\\\"exportName\\\":\\\"EmailAttachment\\\",\\\"collectionExportName\\\":\\\"EmailAttachmentCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"size\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"email_attachments\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"email_attachments\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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,\\\\n \\\\\\\"message_id\\\\\\\" UUID,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"filename\\\\\\\" TEXT,\\\\n \\\\\\\"content_type\\\\\\\" TEXT,\\\\n \\\\\\\"size\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"content_id\\\\\\\" TEXT,\\\\n \\\\\\\"content_disposition\\\\\\\" TEXT DEFAULT 'attachment',\\\\n \\\\\\\"file_path\\\\\\\" TEXT,\\\\n \\\\\\\"source_url\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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\\\":false,\\\"unique\\\":false},\\\"message_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messages\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"filename\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"content_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"size\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"content_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"content_disposition\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"attachment\\\"},\\\"file_path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"source_url\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"email_attachments_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"email_attachments_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"email_attachments_message_id_idx\\\",\\\"columns\\\":[\\\"message_id\\\"]},{\\\"name\\\":\\\"email_attachments_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]}],\\\"version\\\":\\\"ebed0053\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:EmailFolder\\\":{\\\"name\\\":\\\"emailfolder\\\",\\\"className\\\":\\\"EmailFolder\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:EmailFolder\\\",\\\"collection\\\":\\\"emailfolders\\\",\\\"filePath\\\":\\\"src/models/EmailFolder.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true,\\\"mode\\\":\\\"optional\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"accountId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"related\\\"]},\\\"required\\\":false,\\\"related\\\":\\\"Account\\\"},\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"path\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"delimiter\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"specialUse\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"messageCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":0},\\\"unreadCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":0},\\\"subscribed\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":true},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updatedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false}},\\\"methods\\\":{\\\"loadFromId\\\":{\\\"name\\\":\\\"loadFromId\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"loadFromSlug\\\":{\\\"name\\\":\\\"loadFromSlug\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAccount\\\":{\\\"name\\\":\\\"getAccount\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getEmails\\\":{\\\"name\\\":\\\"getEmails\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"limit\\\",\\\"type\\\":\\\"number\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getUnreadEmails\\\":{\\\"name\\\":\\\"getUnreadEmails\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"limit\\\",\\\"type\\\":\\\"number\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"refreshCounts\\\":{\\\"name\\\":\\\"refreshCounts\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isInbox\\\":{\\\"name\\\":\\\"isInbox\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isSent\\\":{\\\"name\\\":\\\"isSent\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isDrafts\\\":{\\\"name\\\":\\\"isDrafts\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isTrash\\\":{\\\"name\\\":\\\"isTrash\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isSpam\\\":{\\\"name\\\":\\\"isSpam\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isSystemFolder\\\":{\\\"name\\\":\\\"isSystemFolder\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"subscribe\\\":{\\\"name\\\":\\\"subscribe\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"unsubscribe\\\":{\\\"name\\\":\\\"unsubscribe\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\",\\\"update\\\",\\\"delete\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"skipApiCheck\\\":true},\\\"tenantScoped\\\":{\\\"mode\\\":\\\"optional\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"EmailFolder\\\",\\\"collectionExportName\\\":\\\"EmailFolderCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"messageCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"unreadCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"subscribed\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"email_folders\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"email_folders\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"path\\\\\\\" TEXT,\\\\n \\\\\\\"delimiter\\\\\\\" TEXT,\\\\n \\\\\\\"special_use\\\\\\\" TEXT,\\\\n \\\\\\\"message_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"unread_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"subscribed\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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\\\":false,\\\"unique\\\":false},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"delimiter\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"special_use\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"message_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"unread_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"subscribed\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true}},\\\"indexes\\\":[{\\\"name\\\":\\\"email_folders_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"email_folders_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"email_folders_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]}],\\\"version\\\":\\\"cfea127c\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:Message\\\":{\\\"name\\\":\\\"message\\\",\\\"className\\\":\\\"Message\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:Message\\\",\\\"collection\\\":\\\"messages\\\",\\\"filePath\\\":\\\"src/models/Message.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"created_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updated_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true,\\\"mode\\\":\\\"optional\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"accountId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The connected account used to receive or send this message.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"Account\\\",\\\"description\\\":\\\"The connected account used to receive or send this message.\\\"},\\\"personaId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"description\\\",\\\"related\\\",\\\"required\\\"],\\\"description\\\":\\\"The assistant identity associated with this message, when one was used.\\\",\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-personas:AgentPersona\\\",\\\"description\\\":\\\"The assistant identity associated with this message, when one was used.\\\"},\\\"endpointId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The saved destination used to deliver this message.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"MessagingEndpoint\\\",\\\"description\\\":\\\"The saved destination used to deliver this message.\\\"},\\\"correlationId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"A tracking reference that connects this message to related activity.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"A tracking reference that connects this message to related activity.\\\"},\\\"threadId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The conversation this message belongs to.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The conversation this message belongs to.\\\"},\\\"subject\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The subject shown in the message list.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The subject shown in the message list.\\\"},\\\"body\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The message content in plain text.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The message content in plain text.\\\"},\\\"fromAddress\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The address the message was sent from.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The address the message was sent from.\\\"},\\\"fromName\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The sender name shown beside their address.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The sender name shown beside their address.\\\"},\\\"toAddresses\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The people or addresses receiving this message.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The people or addresses receiving this message.\\\"},\\\"date\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When the message was sent or received.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When the message was sent or received.\\\"},\\\"isRead\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this message has been marked as read.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether this message has been marked as read.\\\"},\\\"isFlagged\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this message is flagged for follow-up.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether this message is flagged for follow-up.\\\"},\\\"hasAttachments\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether files are attached to this message.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether files are attached to this message.\\\"},\\\"size\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"The size of the message in bytes.\\\"},\\\"required\\\":true,\\\"default\\\":0,\\\"description\\\":\\\"The size of the message in bytes.\\\"},\\\"metadata\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Additional details supplied by the messaging connection.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Additional details supplied by the messaging connection.\\\"},\\\"sendStatus\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\",\\\"enum\\\"],\\\"description\\\":\\\"The latest sending state: draft, sending, sent, or failed. Received mail may also show draft here.\\\"},\\\"required\\\":false,\\\"default\\\":\\\"draft\\\",\\\"description\\\":\\\"The latest sending state: draft, sending, sent, or failed. Received mail may also show draft here.\\\",\\\"enum\\\":[\\\"draft\\\",\\\"pending\\\",\\\"sending\\\",\\\"sent\\\",\\\"failed\\\",\\\"scheduled\\\"]},\\\"sentAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When the message was successfully sent.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When the message was successfully sent.\\\"},\\\"sendError\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The reason the latest send attempt failed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The reason the latest send attempt failed.\\\"},\\\"retryCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"How many times delivery has been retried.\\\"},\\\"required\\\":true,\\\"default\\\":0,\\\"description\\\":\\\"How many times delivery has been retried.\\\"},\\\"maxRetries\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"The maximum number of delivery retries allowed.\\\"},\\\"required\\\":true,\\\"default\\\":3,\\\"description\\\":\\\"The maximum number of delivery retries allowed.\\\"},\\\"scheduledSendAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this message is scheduled to be sent.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this message is scheduled to be sent.\\\"},\\\"inReplyToMessageId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The earlier message this one replies to.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"Message\\\",\\\"description\\\":\\\"The earlier message this one replies to.\\\"},\\\"handledById\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"The person or assistant who last acted on this message.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"The person or assistant who last acted on this message.\\\",\\\"readonly\\\":true},\\\"handledByKind\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"Whether a person or an assistant last acted on this message.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"Whether a person or an assistant last acted on this message.\\\",\\\"readonly\\\":true},\\\"handledAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"When someone last acted on this message.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"When someone last acted on this message.\\\",\\\"readonly\\\":true},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this message was recorded.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this message was recorded.\\\"},\\\"updatedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this message was last changed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this message was last changed.\\\"}},\\\"methods\\\":{\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SmrtSaveOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"delete\\\":{\\\"name\\\":\\\"delete\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"Date | string\\\"]}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getToAddresses\\\":{\\\"name\\\":\\\"getToAddresses\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Array<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setToAddresses\\\":{\\\"name\\\":\\\"setToAddresses\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"addresses\\\",\\\"type\\\":\\\"Array<object>\\\",\\\"optional\\\":false,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getMetadata\\\":{\\\"name\\\":\\\"getMetadata\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setMetadata\\\":{\\\"name\\\":\\\"setMetadata\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"data\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markRead\\\":{\\\"name\\\":\\\"markRead\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markUnread\\\":{\\\"name\\\":\\\"markUnread\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"toggleFlagged\\\":{\\\"name\\\":\\\"toggleFlagged\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isUnread\\\":{\\\"name\\\":\\\"isUnread\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getPreview\\\":{\\\"name\\\":\\\"getPreview\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"maxLength\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"string\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"loadFromId\\\":{\\\"name\\\":\\\"loadFromId\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"loadFromSlug\\\":{\\\"name\\\":\\\"loadFromSlug\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAccount\\\":{\\\"name\\\":\\\"getAccount\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getEndpoint\\\":{\\\"name\\\":\\\"getEndpoint\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getThreadMessages\\\":{\\\"name\\\":\\\"getThreadMessages\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAttachments\\\":{\\\"name\\\":\\\"getAttachments\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"send\\\":{\\\"name\\\":\\\"send\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SendMessageOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<MessageSendResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getHandledBy\\\":{\\\"name\\\":\\\"getHandledBy\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"object | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isSendOutcomeUnknown\\\":{\\\"name\\\":\\\"isSendOutcomeUnknown\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"abandonSendAttempt\\\":{\\\"name\\\":\\\"abandonSendAttempt\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"reason\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"retrySend\\\":{\\\"name\\\":\\\"retrySend\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SendMessageOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<MessageSendResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createReply\\\":{\\\"name\\\":\\\"createReply\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"_options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"boolean\\\"]}],\\\"returnType\\\":\\\"Message\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createForward\\\":{\\\"name\\\":\\\"createForward\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Message\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableStrategy\\\":\\\"sti\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"skipApiCheck\\\":true},\\\"tenantScoped\\\":{\\\"mode\\\":\\\"optional\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Message\\\",\\\"collectionExportName\\\":\\\"MessageCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"isRead\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"isFlagged\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"hasAttachments\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"size\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"retryCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"maxRetries\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"messages\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"messages\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"persona_id\\\\\\\" UUID,\\\\n \\\\\\\"endpoint_id\\\\\\\" UUID,\\\\n \\\\\\\"correlation_id\\\\\\\" TEXT,\\\\n \\\\\\\"thread_id\\\\\\\" TEXT,\\\\n \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"body\\\\\\\" TEXT,\\\\n \\\\\\\"from_address\\\\\\\" TEXT,\\\\n \\\\\\\"from_name\\\\\\\" TEXT,\\\\n \\\\\\\"to_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"date\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"is_read\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_flagged\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"has_attachments\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"size\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"metadata\\\\\\\" TEXT,\\\\n \\\\\\\"send_status\\\\\\\" TEXT DEFAULT 'draft',\\\\n \\\\\\\"sent_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"send_error\\\\\\\" TEXT,\\\\n \\\\\\\"retry_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"max_retries\\\\\\\" INTEGER DEFAULT 3,\\\\n \\\\\\\"scheduled_send_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"in_reply_to_message_id\\\\\\\" UUID,\\\\n \\\\\\\"handled_by_id\\\\\\\" TEXT,\\\\n \\\\\\\"handled_by_kind\\\\\\\" TEXT,\\\\n \\\\\\\"handled_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"message_id\\\\\\\" TEXT,\\\\n \\\\\\\"in_reply_to\\\\\\\" TEXT,\\\\n \\\\\\\"provider_message_id\\\\\\\" TEXT,\\\\n \\\\\\\"cc_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"bcc_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"reply_to_address\\\\\\\" TEXT,\\\\n \\\\\\\"reply_to_name\\\\\\\" TEXT,\\\\n \\\\\\\"text_body\\\\\\\" TEXT,\\\\n \\\\\\\"html_body\\\\\\\" TEXT,\\\\n \\\\\\\"folder_id\\\\\\\" TEXT,\\\\n \\\\\\\"folder_path\\\\\\\" TEXT,\\\\n \\\\\\\"labels\\\\\\\" TEXT,\\\\n \\\\\\\"flags\\\\\\\" TEXT,\\\\n \\\\\\\"is_answered\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_draft\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"raw_message\\\\\\\" TEXT,\\\\n \\\\\\\"headers\\\\\\\" TEXT,\\\\n \\\\\\\"channel_id\\\\\\\" TEXT,\\\\n \\\\\\\"channel_name\\\\\\\" TEXT,\\\\n \\\\\\\"slack_ts\\\\\\\" TEXT,\\\\n \\\\\\\"slack_thread_ts\\\\\\\" TEXT,\\\\n \\\\\\\"reactions\\\\\\\" TEXT,\\\\n \\\\\\\"is_edited\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"message_type\\\\\\\" TEXT,\\\\n \\\\\\\"blocks\\\\\\\" TEXT,\\\\n \\\\\\\"tweet_id\\\\\\\" TEXT,\\\\n \\\\\\\"retweet_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"like_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"reply_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"is_retweet\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_reply\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"media_urls\\\\\\\" TEXT,\\\\n \\\\\\\"hashtags\\\\\\\" TEXT,\\\\n \\\\\\\"mentions\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"persona_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"endpoint_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messaging_endpoints\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"correlation_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"thread_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"from_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"from_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"to_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"date\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"is_read\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_flagged\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"has_attachments\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"size\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"metadata\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"send_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"default\\\":\\\"draft\\\"},\\\"sent_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"send_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"retry_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"max_retries\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":3},\\\"scheduled_send_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"in_reply_to_message_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messages\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"handled_by_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handled_by_kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handled_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"in_reply_to\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"cc_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bcc_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reply_to_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reply_to_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"text_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"html_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"folder_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"folder_path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"labels\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"flags\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_answered\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_draft\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"raw_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"headers\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"slack_ts\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"slack_thread_ts\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reactions\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_edited\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"message_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"blocks\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"tweet_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"retweet_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"like_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"reply_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"is_retweet\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_reply\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"media_urls\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"hashtags\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"mentions\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"messages_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"messages_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"messages_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"messages_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]},{\\\"name\\\":\\\"messages_persona_id_idx\\\",\\\"columns\\\":[\\\"persona_id\\\"]},{\\\"name\\\":\\\"messages_endpoint_id_idx\\\",\\\"columns\\\":[\\\"endpoint_id\\\"]},{\\\"name\\\":\\\"messages_in_reply_to_message_id_idx\\\",\\\"columns\\\":[\\\"in_reply_to_message_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_d0024f738cf4\\\",\\\"columns\\\":[\\\"is_answered\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Email') OR \\\\\\\"is_answered\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_0adcd2453c81\\\",\\\"columns\\\":[\\\"is_draft\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Email') OR \\\\\\\"is_draft\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_428e155c9609\\\",\\\"columns\\\":[\\\"is_edited\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:SlackMessage') OR \\\\\\\"is_edited\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_a17af99e85e3\\\",\\\"columns\\\":[\\\"is_reply\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"is_reply\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_3e30563cba58\\\",\\\"columns\\\":[\\\"is_retweet\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"is_retweet\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_bab2c772ebe6\\\",\\\"columns\\\":[\\\"like_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"like_count\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_c6ad8d47bbc8\\\",\\\"columns\\\":[\\\"reply_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"reply_count\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_43a00e1c098d\\\",\\\"columns\\\":[\\\"retweet_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"retweet_count\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"e51be371\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:MessagingEndpoint\\\":{\\\"name\\\":\\\"messagingendpoint\\\",\\\"className\\\":\\\"MessagingEndpoint\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:MessagingEndpoint\\\",\\\"collection\\\":\\\"messagingendpoints\\\",\\\"filePath\\\":\\\"src/models/MessagingEndpoint.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"requiredFor\\\",\\\"__tenancy\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"requiredFor\\\":\\\"tenant-scope\\\"},\\\"required\\\":true},\\\"profileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"related\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-profiles:Profile\\\"},\\\"label\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true},\\\"channel\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"default\\\"],\\\"required\\\":true},\\\"required\\\":true,\\\"default\\\":\\\"email\\\"},\\\"address\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"sensitive\\\"],\\\"required\\\":true,\\\"sensitive\\\":true},\\\"required\\\":true,\\\"sensitive\\\":true},\\\"isActive\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":true},\\\"verifiedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updatedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false}},\\\"methods\\\":{\\\"getAddress\\\":{\\\"name\\\":\\\"getAddress\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"T\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setAddress\\\":{\\\"name\\\":\\\"setAddress\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"address\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getMaskedAddress\\\":{\\\"name\\\":\\\"getMaskedAddress\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"messaging_endpoints\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"channel\\\",\\\"label\\\"],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"}},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"MessagingEndpoint\\\",\\\"collectionExportName\\\":\\\"MessagingEndpointCollection\\\",\\\"displayLabelField\\\":\\\"label\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"label\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"channel\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"address\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"isActive\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"messaging_endpoints\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"messaging_endpoints\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"profile_id\\\\\\\" UUID,\\\\n \\\\\\\"label\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"channel\\\\\\\" TEXT NOT NULL DEFAULT 'email',\\\\n \\\\\\\"address\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"is_active\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE,\\\\n \\\\\\\"verified_at\\\\\\\" TIMESTAMP\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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},\\\"profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"label\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"channel\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"email\\\"},\\\"address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"is_active\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true},\\\"verified_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"messaging_endpoints_tenant_id_channel_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"channel\\\",\\\"label\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"messaging_endpoints_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"messaging_endpoints_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"messaging_endpoints_profile_id_idx\\\",\\\"columns\\\":[\\\"profile_id\\\"]}],\\\"version\\\":\\\"b4466849\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:NotificationDelivery\\\":{\\\"name\\\":\\\"notificationdelivery\\\",\\\"className\\\":\\\"NotificationDelivery\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:NotificationDelivery\\\",\\\"collection\\\":\\\"notificationdeliveries\\\",\\\"description\\\":\\\"One durable, source-keyed notification delivery to one person over one external channel (the outbox row behind NotificationOutboxService).\\\",\\\"filePath\\\":\\\"src/models/NotificationDelivery.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"requiredFor\\\",\\\"__tenancy\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"requiredFor\\\":\\\"tenant-scope\\\"},\\\"required\\\":true},\\\"recipientUserId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"related\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-users:User\\\"},\\\"recipientProfileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"related\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-profiles:Profile\\\"},\\\"recipientKind\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\",\\\"default\\\",\\\"enum\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true,\\\"default\\\":\\\"user\\\",\\\"enum\\\":[\\\"user\\\",\\\"profile\\\"]},\\\"channel\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\",\\\"default\\\",\\\"enum\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true,\\\"default\\\":\\\"email\\\",\\\"enum\\\":[\\\"email\\\"]},\\\"sourceRef\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"idempotency\\\"},\\\"required\\\":true},\\\"kind\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true},\\\"requiredDispatchPolicy\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"dispatchPolicyBinding\\\":{\\\"type\\\":\\\"json\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"subject\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"textBody\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"href\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"recipientAddress\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true},\\\"recipientName\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"accountId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"related\\\"]},\\\"required\\\":false,\\\"related\\\":\\\"Account\\\"},\\\"messageId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"related\\\"]},\\\"required\\\":false,\\\"related\\\":\\\"Message\\\"},\\\"status\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\",\\\"enum\\\"]},\\\"required\\\":false,\\\"default\\\":\\\"pending\\\",\\\"enum\\\":[\\\"pending\\\",\\\"sending\\\",\\\"sent\\\",\\\"failed\\\",\\\"uncertain\\\",\\\"cancelled\\\"]},\\\"stateVersion\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":0},\\\"transitionId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"attempts\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":0},\\\"maxAttempts\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":5},\\\"nextAttemptAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"leaseToken\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"leaseExpiresAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"handedOffAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"deliveredAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"providerMessageId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"lastError\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false}},\\\"methods\\\":{\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SmrtSaveOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"delete\\\":{\\\"name\\\":\\\"delete\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"transition\\\":{\\\"name\\\":\\\"transition\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"changes\\\",\\\"type\\\":\\\"NotificationDeliveryTransition\\\",\\\"optional\\\":false,\\\"resolvedType\\\":\\\"Partial<Pick<NotificationDelivery, 'messageId' | 'status' | 'attempts' | 'nextAttemptAt' | 'leaseToken' | 'leaseExpiresAt' | 'handedOffAt' | 'deliveredAt' | 'providerMessageId' | 'lastError'>>\\\"},{\\\"name\\\":\\\"expected\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"notification_deliveries\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false,\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"recipient_kind\\\",\\\"recipient_user_id\\\",\\\"recipient_profile_id\\\",\\\"channel\\\",\\\"source_ref\\\"],\\\"indexes\\\":[{\\\"name\\\":\\\"notification_deliveries_user_identity\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"recipientUserId\\\",\\\"channel\\\",\\\"sourceRef\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"notification_deliveries_profile_identity\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"recipientProfileId\\\",\\\"channel\\\",\\\"sourceRef\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"notification_deliveries_due_idx\\\",\\\"columns\\\":[\\\"status\\\",\\\"nextAttemptAt\\\"]},{\\\"name\\\":\\\"notification_deliveries_lease_idx\\\",\\\"columns\\\":[\\\"status\\\",\\\"leaseExpiresAt\\\"]}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"}},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"NotificationDelivery\\\",\\\"collectionExportName\\\":\\\"NotificationDeliveryCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"recipientKind\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"channel\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"sourceRef\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"kind\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"recipientAddress\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"stateVersion\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"attempts\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"maxAttempts\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"notification_deliveries\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"notification_deliveries\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"recipient_user_id\\\\\\\" UUID,\\\\n \\\\\\\"recipient_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"recipient_kind\\\\\\\" TEXT NOT NULL DEFAULT 'user',\\\\n \\\\\\\"channel\\\\\\\" TEXT NOT NULL DEFAULT 'email',\\\\n \\\\\\\"source_ref\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"kind\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"required_dispatch_policy\\\\\\\" TEXT,\\\\n \\\\\\\"dispatch_policy_binding\\\\\\\" JSON,\\\\n \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"text_body\\\\\\\" TEXT,\\\\n \\\\\\\"href\\\\\\\" TEXT,\\\\n \\\\\\\"recipient_address\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"recipient_name\\\\\\\" TEXT,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"message_id\\\\\\\" UUID,\\\\n \\\\\\\"status\\\\\\\" TEXT DEFAULT 'pending',\\\\n \\\\\\\"state_version\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"transition_id\\\\\\\" TEXT,\\\\n \\\\\\\"attempts\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"max_attempts\\\\\\\" INTEGER NOT NULL DEFAULT 5,\\\\n \\\\\\\"next_attempt_at\\\\\\\" TEXT,\\\\n \\\\\\\"lease_token\\\\\\\" TEXT,\\\\n \\\\\\\"lease_expires_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"handed_off_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"delivered_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"provider_message_id\\\\\\\" TEXT,\\\\n \\\\\\\"last_error\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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},\\\"recipient_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recipient_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recipient_kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"user\\\"},\\\"channel\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"email\\\"},\\\"source_ref\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"required_dispatch_policy\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"dispatch_policy_binding\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"text_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"href\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recipient_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"recipient_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"message_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messages\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"pending\\\"},\\\"state_version\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"transition_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"attempts\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"max_attempts\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":5},\\\"next_attempt_at\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"lease_token\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"lease_expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"handed_off_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"delivered_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"provider_message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"notification_deliveries_tenant_id_recipient_kind_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"recipient_kind\\\",\\\"recipient_user_id\\\",\\\"recipient_profile_id\\\",\\\"channel\\\",\\\"source_ref\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"notification_deliveries_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"notification_deliveries_user_identity\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"recipient_user_id\\\",\\\"channel\\\",\\\"source_ref\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"notification_deliveries_profile_identity\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"recipient_profile_id\\\",\\\"channel\\\",\\\"source_ref\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"notification_deliveries_due_idx\\\",\\\"columns\\\":[\\\"status\\\",\\\"next_attempt_at\\\"]},{\\\"name\\\":\\\"notification_deliveries_lease_idx\\\",\\\"columns\\\":[\\\"status\\\",\\\"lease_expires_at\\\"]},{\\\"name\\\":\\\"notification_deliveries_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"notification_deliveries_recipient_user_id_idx\\\",\\\"columns\\\":[\\\"recipient_user_id\\\"]},{\\\"name\\\":\\\"notification_deliveries_recipient_profile_id_idx\\\",\\\"columns\\\":[\\\"recipient_profile_id\\\"]},{\\\"name\\\":\\\"notification_deliveries_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]},{\\\"name\\\":\\\"notification_deliveries_message_id_idx\\\",\\\"columns\\\":[\\\"message_id\\\"]}],\\\"version\\\":\\\"547f434f\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:NotificationOptOut\\\":{\\\"name\\\":\\\"notificationoptout\\\",\\\"className\\\":\\\"NotificationOptOut\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:NotificationOptOut\\\",\\\"collection\\\":\\\"notificationoptouts\\\",\\\"description\\\":\\\"One person's opt-out of one notification channel for one scope, in one tenant: the preference store behind the outbox's isSuppressed hook.\\\",\\\"filePath\\\":\\\"src/models/NotificationOptOut.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"requiredFor\\\",\\\"__tenancy\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"requiredFor\\\":\\\"tenant-scope\\\"},\\\"required\\\":true},\\\"recipientUserId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\",\\\"related\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true,\\\"related\\\":\\\"@happyvertical/smrt-users:User\\\"},\\\"channel\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"default\\\",\\\"enum\\\"],\\\"required\\\":true},\\\"required\\\":true,\\\"default\\\":\\\"email\\\",\\\"enum\\\":[\\\"email\\\"]},\\\"scope\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true},\\\"optedOutAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updatedBy\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"notification_opt_outs\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false,\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"recipient_user_id\\\",\\\"channel\\\",\\\"scope\\\"],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"}},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"NotificationOptOut\\\",\\\"collectionExportName\\\":\\\"NotificationOptOutCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"recipientUserId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"crossPackageRef\\\"},{\\\"field\\\":\\\"channel\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"scope\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"notification_opt_outs\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"notification_opt_outs\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"recipient_user_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"channel\\\\\\\" TEXT NOT NULL DEFAULT 'email',\\\\n \\\\\\\"scope\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"opted_out_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"updated_by\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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},\\\"recipient_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"channel\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"email\\\"},\\\"scope\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"opted_out_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"updated_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"notification_opt_outs_tenant_id_recipient_user_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"recipient_user_id\\\",\\\"channel\\\",\\\"scope\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"notification_opt_outs_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"notification_opt_outs_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"notification_opt_outs_recipient_user_id_idx\\\",\\\"columns\\\":[\\\"recipient_user_id\\\"]}],\\\"version\\\":\\\"a13e93c1\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:PersonaMessageRoute\\\":{\\\"name\\\":\\\"personamessageroute\\\",\\\"className\\\":\\\"PersonaMessageRoute\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:PersonaMessageRoute\\\",\\\"collection\\\":\\\"personamessageroutes\\\",\\\"filePath\\\":\\\"src/models/PersonaMessageRoute.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"requiredFor\\\",\\\"__tenancy\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"requiredFor\\\":\\\"tenant-scope\\\"},\\\"required\\\":true},\\\"personaId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\",\\\"related\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true,\\\"related\\\":\\\"@happyvertical/smrt-personas:AgentPersona\\\"},\\\"accountId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\",\\\"related\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true,\\\"related\\\":\\\"Account\\\"},\\\"endpointId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\",\\\"related\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true,\\\"related\\\":\\\"MessagingEndpoint\\\"},\\\"purpose\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\"],\\\"required\\\":true},\\\"required\\\":true},\\\"priority\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":0},\\\"enabled\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":true},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updatedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"persona_message_routes\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"persona_id\\\",\\\"account_id\\\",\\\"endpoint_id\\\",\\\"purpose\\\"],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"}},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"PersonaMessageRoute\\\",\\\"collectionExportName\\\":\\\"PersonaMessageRouteCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"personaId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"crossPackageRef\\\"},{\\\"field\\\":\\\"accountId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"endpointId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"purpose\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"priority\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"enabled\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"persona_message_routes\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"persona_message_routes\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"persona_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"account_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"endpoint_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"purpose\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"priority\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"enabled\\\\\\\" BOOLEAN NOT NULL DEFAULT TRUE\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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},\\\"persona_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"CASCADE\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"endpoint_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messaging_endpoints\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"CASCADE\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"purpose\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"priority\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"enabled\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":true}},\\\"indexes\\\":[{\\\"name\\\":\\\"persona_message_routes_tenant_id_persona_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"persona_id\\\",\\\"account_id\\\",\\\"endpoint_id\\\",\\\"purpose\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"persona_message_routes_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"persona_message_routes_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"persona_message_routes_persona_id_idx\\\",\\\"columns\\\":[\\\"persona_id\\\"]},{\\\"name\\\":\\\"persona_message_routes_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]},{\\\"name\\\":\\\"persona_message_routes_endpoint_id_idx\\\",\\\"columns\\\":[\\\"endpoint_id\\\"]}],\\\"version\\\":\\\"3caf446e\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:SlackAccount\\\":{\\\"name\\\":\\\"slackaccount\\\",\\\"className\\\":\\\"SlackAccount\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:SlackAccount\\\",\\\"collection\\\":\\\"accounts\\\",\\\"filePath\\\":\\\"src/models/SlackAccount.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"created_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updated_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"required\\\":false,\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true},\\\"required\\\":false},\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The display name for this connected messaging account.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The display name for this connected messaging account.\\\"},\\\"providerType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The service that connects this account to your application.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The service that connects this account to your application.\\\"},\\\"channelType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The kind of messaging this account supports, such as email or chat.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The kind of messaging this account supports, such as email or chat.\\\"},\\\"credentialSecretId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"readonly\\\"],\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"required\\\":false,\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"isActive\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this account is enabled for messaging.\\\"},\\\"required\\\":true,\\\"default\\\":true,\\\"description\\\":\\\"Whether this account is enabled for messaging.\\\"},\\\"ownerUserId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The person who owns this account and decides who else may use it.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-users:User\\\",\\\"description\\\":\\\"The person who owns this account and decides who else may use it.\\\"},\\\"label\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"A short name shown beside this account, such as Support or Personal.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"A short name shown beside this account, such as Support or Personal.\\\"},\\\"connectionStatus\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it.\\\"},\\\"statusMessage\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Why the account needs attention, in plain words.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Why the account needs attention, in plain words.\\\"},\\\"lastSyncAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account last checked for new messages.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account last checked for new messages.\\\"},\\\"settings\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"readonly\\\"],\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"required\\\":false,\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"configuration\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The public connection settings for this account; credentials are stored separately.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The public connection settings for this account; credentials are stored separately.\\\"},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account was added.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account was added.\\\"},\\\"updatedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account was last changed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account was last changed.\\\"},\\\"workspaceId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The identifier of the connected workspace.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The identifier of the connected workspace.\\\"},\\\"workspaceName\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The name of the connected workspace.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The name of the connected workspace.\\\"},\\\"botUserId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The bot user your application posts as in this workspace.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The bot user your application posts as in this workspace.\\\"}},\\\"methods\\\":{\\\"getSettings\\\":{\\\"name\\\":\\\"getSettings\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setSettings\\\":{\\\"name\\\":\\\"setSettings\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"settings\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getConfiguration\\\":{\\\"name\\\":\\\"getConfiguration\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setConfiguration\\\":{\\\"name\\\":\\\"setConfiguration\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"configuration\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markNeedsReconnect\\\":{\\\"name\\\":\\\"markNeedsReconnect\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"reason\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markConnected\\\":{\\\"name\\\":\\\"markConnected\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"activate\\\":{\\\"name\\\":\\\"activate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deactivate\\\":{\\\"name\\\":\\\"deactivate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setCredentials\\\":{\\\"name\\\":\\\"setCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"credentials\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"removeCredentials\\\":{\\\"name\\\":\\\"removeCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createSender\\\":{\\\"name\\\":\\\"createSender\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<MessageSenderInterface>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getCredentials\\\":{\\\"name\\\":\\\"getCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Record<string, unknown> | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableStrategy\\\":\\\"sti\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"tableName\\\":\\\"accounts\\\"},\\\"extends\\\":\\\"Account\\\",\\\"exportName\\\":\\\"SlackAccount\\\",\\\"collectionExportName\\\":\\\"SlackAccountCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"isActive\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"accounts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"accounts\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"provider_type\\\\\\\" TEXT,\\\\n \\\\\\\"channel_type\\\\\\\" TEXT,\\\\n \\\\\\\"credential_secret_id\\\\\\\" TEXT,\\\\n \\\\\\\"is_active\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"owner_user_id\\\\\\\" UUID,\\\\n \\\\\\\"label\\\\\\\" TEXT,\\\\n \\\\\\\"connection_status\\\\\\\" TEXT,\\\\n \\\\\\\"status_message\\\\\\\" TEXT,\\\\n \\\\\\\"last_sync_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"settings\\\\\\\" TEXT,\\\\n \\\\\\\"configuration\\\\\\\" TEXT,\\\\n \\\\\\\"email\\\\\\\" TEXT,\\\\n \\\\\\\"sync_interval_minutes\\\\\\\" INTEGER DEFAULT 60,\\\\n \\\\\\\"sync_cursor\\\\\\\" TEXT,\\\\n \\\\\\\"backfill_since\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"cursor_horizon\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_sync_error\\\\\\\" TEXT,\\\\n \\\\\\\"backlog\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"agent_send_policy\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_id\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_name\\\\\\\" TEXT,\\\\n \\\\\\\"bot_user_id\\\\\\\" TEXT,\\\\n \\\\\\\"handle\\\\\\\" TEXT,\\\\n \\\\\\\"twitter_user_id\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"credential_secret_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_active\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":true},\\\"owner_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"label\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"connection_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"status_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"last_sync_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"settings\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"configuration\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"sync_interval_minutes\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":60},\\\"sync_cursor\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backfill_since\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"cursor_horizon\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"last_sync_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backlog\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"agent_send_policy\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bot_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handle\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"twitter_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"accounts_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"accounts_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"accounts_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"accounts_owner_user_id_idx\\\",\\\"columns\\\":[\\\"owner_user_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_81229bbfe8e3\\\",\\\"columns\\\":[\\\"backlog\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"backlog\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_1f9c5f0ee488\\\",\\\"columns\\\":[\\\"sync_interval_minutes\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"sync_interval_minutes\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"ff134288\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:SlackMessage\\\":{\\\"name\\\":\\\"slackmessage\\\",\\\"className\\\":\\\"SlackMessage\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:SlackMessage\\\",\\\"collection\\\":\\\"messages\\\",\\\"filePath\\\":\\\"src/models/SlackMessage.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"created_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updated_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"required\\\":false,\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true},\\\"required\\\":false},\\\"accountId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The connected account used to receive or send this message.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"Account\\\",\\\"description\\\":\\\"The connected account used to receive or send this message.\\\"},\\\"personaId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"description\\\",\\\"related\\\",\\\"required\\\"],\\\"required\\\":false,\\\"description\\\":\\\"The assistant identity associated with this message, when one was used.\\\",\\\"nullable\\\":true},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-personas:AgentPersona\\\",\\\"description\\\":\\\"The assistant identity associated with this message, when one was used.\\\"},\\\"endpointId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The saved destination used to deliver this message.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"MessagingEndpoint\\\",\\\"description\\\":\\\"The saved destination used to deliver this message.\\\"},\\\"correlationId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"A tracking reference that connects this message to related activity.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"A tracking reference that connects this message to related activity.\\\"},\\\"threadId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The conversation this message belongs to.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The conversation this message belongs to.\\\"},\\\"subject\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The subject shown in the message list.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The subject shown in the message list.\\\"},\\\"body\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The message content in plain text.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The message content in plain text.\\\"},\\\"fromAddress\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The address the message was sent from.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The address the message was sent from.\\\"},\\\"fromName\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The sender name shown beside their address.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The sender name shown beside their address.\\\"},\\\"toAddresses\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The people or addresses receiving this message.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The people or addresses receiving this message.\\\"},\\\"date\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When the message was sent or received.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When the message was sent or received.\\\"},\\\"isRead\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this message has been marked as read.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether this message has been marked as read.\\\"},\\\"isFlagged\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this message is flagged for follow-up.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether this message is flagged for follow-up.\\\"},\\\"hasAttachments\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether files are attached to this message.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether files are attached to this message.\\\"},\\\"size\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"The size of the message in bytes.\\\"},\\\"required\\\":true,\\\"default\\\":0,\\\"description\\\":\\\"The size of the message in bytes.\\\"},\\\"metadata\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Additional details supplied by the messaging connection.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Additional details supplied by the messaging connection.\\\"},\\\"sendStatus\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\",\\\"enum\\\"],\\\"description\\\":\\\"The latest sending state: draft, sending, sent, or failed. Received mail may also show draft here.\\\"},\\\"required\\\":false,\\\"default\\\":\\\"draft\\\",\\\"description\\\":\\\"The latest sending state: draft, sending, sent, or failed. Received mail may also show draft here.\\\",\\\"enum\\\":[\\\"draft\\\",\\\"pending\\\",\\\"sending\\\",\\\"sent\\\",\\\"failed\\\",\\\"scheduled\\\"]},\\\"sentAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When the message was successfully sent.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When the message was successfully sent.\\\"},\\\"sendError\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The reason the latest send attempt failed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The reason the latest send attempt failed.\\\"},\\\"retryCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"How many times delivery has been retried.\\\"},\\\"required\\\":true,\\\"default\\\":0,\\\"description\\\":\\\"How many times delivery has been retried.\\\"},\\\"maxRetries\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"The maximum number of delivery retries allowed.\\\"},\\\"required\\\":true,\\\"default\\\":3,\\\"description\\\":\\\"The maximum number of delivery retries allowed.\\\"},\\\"scheduledSendAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this message is scheduled to be sent.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this message is scheduled to be sent.\\\"},\\\"inReplyToMessageId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The earlier message this one replies to.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"Message\\\",\\\"description\\\":\\\"The earlier message this one replies to.\\\"},\\\"handledById\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"The person or assistant who last acted on this message.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"The person or assistant who last acted on this message.\\\",\\\"readonly\\\":true},\\\"handledByKind\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"Whether a person or an assistant last acted on this message.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"Whether a person or an assistant last acted on this message.\\\",\\\"readonly\\\":true},\\\"handledAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"When someone last acted on this message.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"When someone last acted on this message.\\\",\\\"readonly\\\":true},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this message was recorded.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this message was recorded.\\\"},\\\"updatedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this message was last changed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this message was last changed.\\\"},\\\"channelId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The identifier of the channel this message is in.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The identifier of the channel this message is in.\\\"},\\\"channelName\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The name of the channel this message was posted in.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The name of the channel this message was posted in.\\\"},\\\"slackTs\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The workspace's own reference for this message.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The workspace's own reference for this message.\\\"},\\\"slackThreadTs\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The workspace's own reference for the thread this message belongs to.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The workspace's own reference for the thread this message belongs to.\\\"},\\\"reactions\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The reactions people added to this message.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The reactions people added to this message.\\\"},\\\"isEdited\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this message was edited after posting.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether this message was edited after posting.\\\"},\\\"messageType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The kind of message, such as one from a person or a bot.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The kind of message, such as one from a person or a bot.\\\"},\\\"blocks\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The rich layout of the message as the workspace stores it.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The rich layout of the message as the workspace stores it.\\\"}},\\\"methods\\\":{\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SmrtSaveOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"delete\\\":{\\\"name\\\":\\\"delete\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"Date | string\\\"]}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getToAddresses\\\":{\\\"name\\\":\\\"getToAddresses\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Array<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setToAddresses\\\":{\\\"name\\\":\\\"setToAddresses\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"addresses\\\",\\\"type\\\":\\\"Array<object>\\\",\\\"optional\\\":false,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getMetadata\\\":{\\\"name\\\":\\\"getMetadata\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setMetadata\\\":{\\\"name\\\":\\\"setMetadata\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"data\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markRead\\\":{\\\"name\\\":\\\"markRead\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markUnread\\\":{\\\"name\\\":\\\"markUnread\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"toggleFlagged\\\":{\\\"name\\\":\\\"toggleFlagged\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isUnread\\\":{\\\"name\\\":\\\"isUnread\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getPreview\\\":{\\\"name\\\":\\\"getPreview\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"maxLength\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"string\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"loadFromId\\\":{\\\"name\\\":\\\"loadFromId\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"loadFromSlug\\\":{\\\"name\\\":\\\"loadFromSlug\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAccount\\\":{\\\"name\\\":\\\"getAccount\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getEndpoint\\\":{\\\"name\\\":\\\"getEndpoint\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getThreadMessages\\\":{\\\"name\\\":\\\"getThreadMessages\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAttachments\\\":{\\\"name\\\":\\\"getAttachments\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"send\\\":{\\\"name\\\":\\\"send\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SendMessageOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<MessageSendResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getHandledBy\\\":{\\\"name\\\":\\\"getHandledBy\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"object | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isSendOutcomeUnknown\\\":{\\\"name\\\":\\\"isSendOutcomeUnknown\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"abandonSendAttempt\\\":{\\\"name\\\":\\\"abandonSendAttempt\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"reason\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"retrySend\\\":{\\\"name\\\":\\\"retrySend\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SendMessageOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<MessageSendResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createReply\\\":{\\\"name\\\":\\\"createReply\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"_options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"boolean\\\"]}],\\\"returnType\\\":\\\"Message\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createForward\\\":{\\\"name\\\":\\\"createForward\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Message\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getReactions\\\":{\\\"name\\\":\\\"getReactions\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Array<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getBlocks\\\":{\\\"name\\\":\\\"getBlocks\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isInThread\\\":{\\\"name\\\":\\\"isInThread\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getTotalReactions\\\":{\\\"name\\\":\\\"getTotalReactions\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"number\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableStrategy\\\":\\\"sti\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"skipApiCheck\\\":true},\\\"widenParentExposure\\\":{\\\"api\\\":[\\\"create\\\"]},\\\"tableName\\\":\\\"messages\\\"},\\\"extends\\\":\\\"Message\\\",\\\"exportName\\\":\\\"SlackMessage\\\",\\\"collectionExportName\\\":\\\"SlackMessageCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"isRead\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"isFlagged\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"hasAttachments\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"size\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"retryCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"maxRetries\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"isEdited\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"messages\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"messages\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"persona_id\\\\\\\" UUID,\\\\n \\\\\\\"endpoint_id\\\\\\\" UUID,\\\\n \\\\\\\"correlation_id\\\\\\\" TEXT,\\\\n \\\\\\\"thread_id\\\\\\\" TEXT,\\\\n \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"body\\\\\\\" TEXT,\\\\n \\\\\\\"from_address\\\\\\\" TEXT,\\\\n \\\\\\\"from_name\\\\\\\" TEXT,\\\\n \\\\\\\"to_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"date\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"is_read\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_flagged\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"has_attachments\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"size\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"metadata\\\\\\\" TEXT,\\\\n \\\\\\\"send_status\\\\\\\" TEXT DEFAULT 'draft',\\\\n \\\\\\\"sent_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"send_error\\\\\\\" TEXT,\\\\n \\\\\\\"retry_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"max_retries\\\\\\\" INTEGER DEFAULT 3,\\\\n \\\\\\\"scheduled_send_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"in_reply_to_message_id\\\\\\\" UUID,\\\\n \\\\\\\"handled_by_id\\\\\\\" TEXT,\\\\n \\\\\\\"handled_by_kind\\\\\\\" TEXT,\\\\n \\\\\\\"handled_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"message_id\\\\\\\" TEXT,\\\\n \\\\\\\"in_reply_to\\\\\\\" TEXT,\\\\n \\\\\\\"provider_message_id\\\\\\\" TEXT,\\\\n \\\\\\\"cc_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"bcc_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"reply_to_address\\\\\\\" TEXT,\\\\n \\\\\\\"reply_to_name\\\\\\\" TEXT,\\\\n \\\\\\\"text_body\\\\\\\" TEXT,\\\\n \\\\\\\"html_body\\\\\\\" TEXT,\\\\n \\\\\\\"folder_id\\\\\\\" TEXT,\\\\n \\\\\\\"folder_path\\\\\\\" TEXT,\\\\n \\\\\\\"labels\\\\\\\" TEXT,\\\\n \\\\\\\"flags\\\\\\\" TEXT,\\\\n \\\\\\\"is_answered\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_draft\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"raw_message\\\\\\\" TEXT,\\\\n \\\\\\\"headers\\\\\\\" TEXT,\\\\n \\\\\\\"channel_id\\\\\\\" TEXT,\\\\n \\\\\\\"channel_name\\\\\\\" TEXT,\\\\n \\\\\\\"slack_ts\\\\\\\" TEXT,\\\\n \\\\\\\"slack_thread_ts\\\\\\\" TEXT,\\\\n \\\\\\\"reactions\\\\\\\" TEXT,\\\\n \\\\\\\"is_edited\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"message_type\\\\\\\" TEXT,\\\\n \\\\\\\"blocks\\\\\\\" TEXT,\\\\n \\\\\\\"tweet_id\\\\\\\" TEXT,\\\\n \\\\\\\"retweet_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"like_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"reply_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"is_retweet\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_reply\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"media_urls\\\\\\\" TEXT,\\\\n \\\\\\\"hashtags\\\\\\\" TEXT,\\\\n \\\\\\\"mentions\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"persona_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"endpoint_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messaging_endpoints\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"correlation_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"thread_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"from_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"from_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"to_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"date\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"is_read\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_flagged\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"has_attachments\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"size\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"metadata\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"send_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"default\\\":\\\"draft\\\"},\\\"sent_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"send_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"retry_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"max_retries\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":3},\\\"scheduled_send_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"in_reply_to_message_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messages\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"handled_by_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handled_by_kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handled_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"in_reply_to\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"cc_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bcc_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reply_to_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reply_to_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"text_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"html_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"folder_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"folder_path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"labels\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"flags\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_answered\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_draft\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"raw_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"headers\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"slack_ts\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"slack_thread_ts\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reactions\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_edited\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"message_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"blocks\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"tweet_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"retweet_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"like_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"reply_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"is_retweet\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_reply\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"media_urls\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"hashtags\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"mentions\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"messages_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"messages_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"messages_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"messages_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]},{\\\"name\\\":\\\"messages_persona_id_idx\\\",\\\"columns\\\":[\\\"persona_id\\\"]},{\\\"name\\\":\\\"messages_endpoint_id_idx\\\",\\\"columns\\\":[\\\"endpoint_id\\\"]},{\\\"name\\\":\\\"messages_in_reply_to_message_id_idx\\\",\\\"columns\\\":[\\\"in_reply_to_message_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_d0024f738cf4\\\",\\\"columns\\\":[\\\"is_answered\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Email') OR \\\\\\\"is_answered\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_0adcd2453c81\\\",\\\"columns\\\":[\\\"is_draft\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Email') OR \\\\\\\"is_draft\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_428e155c9609\\\",\\\"columns\\\":[\\\"is_edited\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:SlackMessage') OR \\\\\\\"is_edited\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_a17af99e85e3\\\",\\\"columns\\\":[\\\"is_reply\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"is_reply\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_3e30563cba58\\\",\\\"columns\\\":[\\\"is_retweet\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"is_retweet\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_bab2c772ebe6\\\",\\\"columns\\\":[\\\"like_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"like_count\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_c6ad8d47bbc8\\\",\\\"columns\\\":[\\\"reply_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"reply_count\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_43a00e1c098d\\\",\\\"columns\\\":[\\\"retweet_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"retweet_count\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"2f466c21\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:TelegramAccount\\\":{\\\"name\\\":\\\"telegramaccount\\\",\\\"className\\\":\\\"TelegramAccount\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:TelegramAccount\\\",\\\"collection\\\":\\\"accounts\\\",\\\"filePath\\\":\\\"src/models/TelegramAccount.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"created_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updated_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"required\\\":false,\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true},\\\"required\\\":false},\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The display name for this connected messaging account.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The display name for this connected messaging account.\\\"},\\\"providerType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The service that connects this account to your application.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The service that connects this account to your application.\\\"},\\\"channelType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The kind of messaging this account supports, such as email or chat.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The kind of messaging this account supports, such as email or chat.\\\"},\\\"credentialSecretId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"readonly\\\"],\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"required\\\":false,\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"isActive\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this account is enabled for messaging.\\\"},\\\"required\\\":true,\\\"default\\\":true,\\\"description\\\":\\\"Whether this account is enabled for messaging.\\\"},\\\"ownerUserId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The person who owns this account and decides who else may use it.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-users:User\\\",\\\"description\\\":\\\"The person who owns this account and decides who else may use it.\\\"},\\\"label\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"A short name shown beside this account, such as Support or Personal.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"A short name shown beside this account, such as Support or Personal.\\\"},\\\"connectionStatus\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it.\\\"},\\\"statusMessage\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Why the account needs attention, in plain words.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Why the account needs attention, in plain words.\\\"},\\\"lastSyncAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account last checked for new messages.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account last checked for new messages.\\\"},\\\"settings\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"readonly\\\"],\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"required\\\":false,\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"configuration\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The public connection settings for this account; credentials are stored separately.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The public connection settings for this account; credentials are stored separately.\\\"},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account was added.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account was added.\\\"},\\\"updatedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account was last changed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account was last changed.\\\"}},\\\"methods\\\":{\\\"getSettings\\\":{\\\"name\\\":\\\"getSettings\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setSettings\\\":{\\\"name\\\":\\\"setSettings\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"settings\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getConfiguration\\\":{\\\"name\\\":\\\"getConfiguration\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setConfiguration\\\":{\\\"name\\\":\\\"setConfiguration\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"configuration\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markNeedsReconnect\\\":{\\\"name\\\":\\\"markNeedsReconnect\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"reason\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markConnected\\\":{\\\"name\\\":\\\"markConnected\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"activate\\\":{\\\"name\\\":\\\"activate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deactivate\\\":{\\\"name\\\":\\\"deactivate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setCredentials\\\":{\\\"name\\\":\\\"setCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"credentials\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"removeCredentials\\\":{\\\"name\\\":\\\"removeCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createSender\\\":{\\\"name\\\":\\\"createSender\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<MessageSenderInterface>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getCredentials\\\":{\\\"name\\\":\\\"getCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Record<string, unknown> | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableStrategy\\\":\\\"sti\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"tableName\\\":\\\"accounts\\\"},\\\"extends\\\":\\\"Account\\\",\\\"exportName\\\":\\\"TelegramAccount\\\",\\\"collectionExportName\\\":\\\"TelegramAccountCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"isActive\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"accounts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"accounts\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"provider_type\\\\\\\" TEXT,\\\\n \\\\\\\"channel_type\\\\\\\" TEXT,\\\\n \\\\\\\"credential_secret_id\\\\\\\" TEXT,\\\\n \\\\\\\"is_active\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"owner_user_id\\\\\\\" UUID,\\\\n \\\\\\\"label\\\\\\\" TEXT,\\\\n \\\\\\\"connection_status\\\\\\\" TEXT,\\\\n \\\\\\\"status_message\\\\\\\" TEXT,\\\\n \\\\\\\"last_sync_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"settings\\\\\\\" TEXT,\\\\n \\\\\\\"configuration\\\\\\\" TEXT,\\\\n \\\\\\\"email\\\\\\\" TEXT,\\\\n \\\\\\\"sync_interval_minutes\\\\\\\" INTEGER DEFAULT 60,\\\\n \\\\\\\"sync_cursor\\\\\\\" TEXT,\\\\n \\\\\\\"backfill_since\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"cursor_horizon\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_sync_error\\\\\\\" TEXT,\\\\n \\\\\\\"backlog\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"agent_send_policy\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_id\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_name\\\\\\\" TEXT,\\\\n \\\\\\\"bot_user_id\\\\\\\" TEXT,\\\\n \\\\\\\"handle\\\\\\\" TEXT,\\\\n \\\\\\\"twitter_user_id\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"credential_secret_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_active\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":true},\\\"owner_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"label\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"connection_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"status_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"last_sync_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"settings\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"configuration\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"sync_interval_minutes\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":60},\\\"sync_cursor\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backfill_since\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"cursor_horizon\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"last_sync_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backlog\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"agent_send_policy\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bot_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handle\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"twitter_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"accounts_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"accounts_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"accounts_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"accounts_owner_user_id_idx\\\",\\\"columns\\\":[\\\"owner_user_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_81229bbfe8e3\\\",\\\"columns\\\":[\\\"backlog\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"backlog\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_1f9c5f0ee488\\\",\\\"columns\\\":[\\\"sync_interval_minutes\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"sync_interval_minutes\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"ff134288\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:Tweet\\\":{\\\"name\\\":\\\"tweet\\\",\\\"className\\\":\\\"Tweet\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:Tweet\\\",\\\"collection\\\":\\\"messages\\\",\\\"filePath\\\":\\\"src/models/Tweet.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"created_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updated_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"required\\\":false,\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true},\\\"required\\\":false},\\\"accountId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The connected account used to receive or send this message.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"Account\\\",\\\"description\\\":\\\"The connected account used to receive or send this message.\\\"},\\\"personaId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"description\\\",\\\"related\\\",\\\"required\\\"],\\\"required\\\":false,\\\"description\\\":\\\"The assistant identity associated with this message, when one was used.\\\",\\\"nullable\\\":true},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-personas:AgentPersona\\\",\\\"description\\\":\\\"The assistant identity associated with this message, when one was used.\\\"},\\\"endpointId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The saved destination used to deliver this message.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"MessagingEndpoint\\\",\\\"description\\\":\\\"The saved destination used to deliver this message.\\\"},\\\"correlationId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"A tracking reference that connects this message to related activity.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"A tracking reference that connects this message to related activity.\\\"},\\\"threadId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The conversation this message belongs to.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The conversation this message belongs to.\\\"},\\\"subject\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The subject shown in the message list.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The subject shown in the message list.\\\"},\\\"body\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The message content in plain text.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The message content in plain text.\\\"},\\\"fromAddress\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The address the message was sent from.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The address the message was sent from.\\\"},\\\"fromName\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The sender name shown beside their address.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The sender name shown beside their address.\\\"},\\\"toAddresses\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The people or addresses receiving this message.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The people or addresses receiving this message.\\\"},\\\"date\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When the message was sent or received.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When the message was sent or received.\\\"},\\\"isRead\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this message has been marked as read.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether this message has been marked as read.\\\"},\\\"isFlagged\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this message is flagged for follow-up.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether this message is flagged for follow-up.\\\"},\\\"hasAttachments\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether files are attached to this message.\\\"},\\\"required\\\":true,\\\"default\\\":false,\\\"description\\\":\\\"Whether files are attached to this message.\\\"},\\\"size\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"The size of the message in bytes.\\\"},\\\"required\\\":true,\\\"default\\\":0,\\\"description\\\":\\\"The size of the message in bytes.\\\"},\\\"metadata\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Additional details supplied by the messaging connection.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Additional details supplied by the messaging connection.\\\"},\\\"sendStatus\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\",\\\"enum\\\"],\\\"description\\\":\\\"The latest sending state: draft, sending, sent, or failed. Received mail may also show draft here.\\\"},\\\"required\\\":false,\\\"default\\\":\\\"draft\\\",\\\"description\\\":\\\"The latest sending state: draft, sending, sent, or failed. Received mail may also show draft here.\\\",\\\"enum\\\":[\\\"draft\\\",\\\"pending\\\",\\\"sending\\\",\\\"sent\\\",\\\"failed\\\",\\\"scheduled\\\"]},\\\"sentAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When the message was successfully sent.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When the message was successfully sent.\\\"},\\\"sendError\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The reason the latest send attempt failed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The reason the latest send attempt failed.\\\"},\\\"retryCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"How many times delivery has been retried.\\\"},\\\"required\\\":true,\\\"default\\\":0,\\\"description\\\":\\\"How many times delivery has been retried.\\\"},\\\"maxRetries\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"The maximum number of delivery retries allowed.\\\"},\\\"required\\\":true,\\\"default\\\":3,\\\"description\\\":\\\"The maximum number of delivery retries allowed.\\\"},\\\"scheduledSendAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this message is scheduled to be sent.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this message is scheduled to be sent.\\\"},\\\"inReplyToMessageId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The earlier message this one replies to.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"Message\\\",\\\"description\\\":\\\"The earlier message this one replies to.\\\"},\\\"handledById\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"The person or assistant who last acted on this message.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"The person or assistant who last acted on this message.\\\",\\\"readonly\\\":true},\\\"handledByKind\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"Whether a person or an assistant last acted on this message.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"Whether a person or an assistant last acted on this message.\\\",\\\"readonly\\\":true},\\\"handledAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"readonly\\\",\\\"description\\\"],\\\"description\\\":\\\"When someone last acted on this message.\\\",\\\"readonly\\\":true},\\\"required\\\":false,\\\"description\\\":\\\"When someone last acted on this message.\\\",\\\"readonly\\\":true},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this message was recorded.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this message was recorded.\\\"},\\\"updatedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this message was last changed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this message was last changed.\\\"},\\\"tweetId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"retweetCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":0},\\\"likeCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":0},\\\"replyCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":0},\\\"isRetweet\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":false},\\\"isReply\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":true,\\\"default\\\":false},\\\"mediaUrls\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"hashtags\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"mentions\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false}},\\\"methods\\\":{\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SmrtSaveOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"delete\\\":{\\\"name\\\":\\\"delete\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"Date | string\\\"]}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getToAddresses\\\":{\\\"name\\\":\\\"getToAddresses\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Array<object>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setToAddresses\\\":{\\\"name\\\":\\\"setToAddresses\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"addresses\\\",\\\"type\\\":\\\"Array<object>\\\",\\\"optional\\\":false,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getMetadata\\\":{\\\"name\\\":\\\"getMetadata\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setMetadata\\\":{\\\"name\\\":\\\"setMetadata\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"data\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markRead\\\":{\\\"name\\\":\\\"markRead\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markUnread\\\":{\\\"name\\\":\\\"markUnread\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"toggleFlagged\\\":{\\\"name\\\":\\\"toggleFlagged\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isUnread\\\":{\\\"name\\\":\\\"isUnread\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getPreview\\\":{\\\"name\\\":\\\"getPreview\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"maxLength\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"string\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"loadFromId\\\":{\\\"name\\\":\\\"loadFromId\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"loadFromSlug\\\":{\\\"name\\\":\\\"loadFromSlug\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAccount\\\":{\\\"name\\\":\\\"getAccount\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getEndpoint\\\":{\\\"name\\\":\\\"getEndpoint\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getThreadMessages\\\":{\\\"name\\\":\\\"getThreadMessages\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Message[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAttachments\\\":{\\\"name\\\":\\\"getAttachments\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"send\\\":{\\\"name\\\":\\\"send\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SendMessageOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<MessageSendResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getHandledBy\\\":{\\\"name\\\":\\\"getHandledBy\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"object | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isSendOutcomeUnknown\\\":{\\\"name\\\":\\\"isSendOutcomeUnknown\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"abandonSendAttempt\\\":{\\\"name\\\":\\\"abandonSendAttempt\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"reason\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"retrySend\\\":{\\\"name\\\":\\\"retrySend\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SendMessageOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<MessageSendResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createReply\\\":{\\\"name\\\":\\\"createReply\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"_options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"boolean\\\"]}],\\\"returnType\\\":\\\"Message\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createForward\\\":{\\\"name\\\":\\\"createForward\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Message\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getMediaUrls\\\":{\\\"name\\\":\\\"getMediaUrls\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getHashtags\\\":{\\\"name\\\":\\\"getHashtags\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getMentions\\\":{\\\"name\\\":\\\"getMentions\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getEngagement\\\":{\\\"name\\\":\\\"getEngagement\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"number\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableStrategy\\\":\\\"sti\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"skipApiCheck\\\":true},\\\"widenParentExposure\\\":{\\\"api\\\":[\\\"create\\\"]},\\\"tableName\\\":\\\"messages\\\"},\\\"extends\\\":\\\"Message\\\",\\\"exportName\\\":\\\"Tweet\\\",\\\"collectionExportName\\\":\\\"TweetCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"isRead\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"isFlagged\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"hasAttachments\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"size\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"retryCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"maxRetries\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"retweetCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"likeCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"replyCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"isRetweet\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"},{\\\"field\\\":\\\"isReply\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"messages\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"messages\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"account_id\\\\\\\" UUID,\\\\n \\\\\\\"persona_id\\\\\\\" UUID,\\\\n \\\\\\\"endpoint_id\\\\\\\" UUID,\\\\n \\\\\\\"correlation_id\\\\\\\" TEXT,\\\\n \\\\\\\"thread_id\\\\\\\" TEXT,\\\\n \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"body\\\\\\\" TEXT,\\\\n \\\\\\\"from_address\\\\\\\" TEXT,\\\\n \\\\\\\"from_name\\\\\\\" TEXT,\\\\n \\\\\\\"to_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"date\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"is_read\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_flagged\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"has_attachments\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"size\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"metadata\\\\\\\" TEXT,\\\\n \\\\\\\"send_status\\\\\\\" TEXT DEFAULT 'draft',\\\\n \\\\\\\"sent_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"send_error\\\\\\\" TEXT,\\\\n \\\\\\\"retry_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"max_retries\\\\\\\" INTEGER DEFAULT 3,\\\\n \\\\\\\"scheduled_send_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"in_reply_to_message_id\\\\\\\" UUID,\\\\n \\\\\\\"handled_by_id\\\\\\\" TEXT,\\\\n \\\\\\\"handled_by_kind\\\\\\\" TEXT,\\\\n \\\\\\\"handled_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"message_id\\\\\\\" TEXT,\\\\n \\\\\\\"in_reply_to\\\\\\\" TEXT,\\\\n \\\\\\\"provider_message_id\\\\\\\" TEXT,\\\\n \\\\\\\"cc_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"bcc_addresses\\\\\\\" TEXT,\\\\n \\\\\\\"reply_to_address\\\\\\\" TEXT,\\\\n \\\\\\\"reply_to_name\\\\\\\" TEXT,\\\\n \\\\\\\"text_body\\\\\\\" TEXT,\\\\n \\\\\\\"html_body\\\\\\\" TEXT,\\\\n \\\\\\\"folder_id\\\\\\\" TEXT,\\\\n \\\\\\\"folder_path\\\\\\\" TEXT,\\\\n \\\\\\\"labels\\\\\\\" TEXT,\\\\n \\\\\\\"flags\\\\\\\" TEXT,\\\\n \\\\\\\"is_answered\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_draft\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"raw_message\\\\\\\" TEXT,\\\\n \\\\\\\"headers\\\\\\\" TEXT,\\\\n \\\\\\\"channel_id\\\\\\\" TEXT,\\\\n \\\\\\\"channel_name\\\\\\\" TEXT,\\\\n \\\\\\\"slack_ts\\\\\\\" TEXT,\\\\n \\\\\\\"slack_thread_ts\\\\\\\" TEXT,\\\\n \\\\\\\"reactions\\\\\\\" TEXT,\\\\n \\\\\\\"is_edited\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"message_type\\\\\\\" TEXT,\\\\n \\\\\\\"blocks\\\\\\\" TEXT,\\\\n \\\\\\\"tweet_id\\\\\\\" TEXT,\\\\n \\\\\\\"retweet_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"like_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"reply_count\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"is_retweet\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"is_reply\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"media_urls\\\\\\\" TEXT,\\\\n \\\\\\\"hashtags\\\\\\\" TEXT,\\\\n \\\\\\\"mentions\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"account_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"accounts\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"persona_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"endpoint_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messaging_endpoints\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"correlation_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"thread_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"from_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"from_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"to_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"date\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"is_read\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_flagged\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"has_attachments\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"size\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"metadata\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"send_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"default\\\":\\\"draft\\\"},\\\"sent_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"send_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"retry_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"max_retries\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":3},\\\"scheduled_send_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"in_reply_to_message_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"messages\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"handled_by_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handled_by_kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handled_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"in_reply_to\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_message_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"cc_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bcc_addresses\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reply_to_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reply_to_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"text_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"html_body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"folder_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"folder_path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"labels\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"flags\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_answered\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_draft\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"raw_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"headers\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"slack_ts\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"slack_thread_ts\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"reactions\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_edited\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"message_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"blocks\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"tweet_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"retweet_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"like_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"reply_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"is_retweet\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"is_reply\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"media_urls\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"hashtags\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"mentions\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"messages_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"messages_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"messages_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"messages_account_id_idx\\\",\\\"columns\\\":[\\\"account_id\\\"]},{\\\"name\\\":\\\"messages_persona_id_idx\\\",\\\"columns\\\":[\\\"persona_id\\\"]},{\\\"name\\\":\\\"messages_endpoint_id_idx\\\",\\\"columns\\\":[\\\"endpoint_id\\\"]},{\\\"name\\\":\\\"messages_in_reply_to_message_id_idx\\\",\\\"columns\\\":[\\\"in_reply_to_message_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_d0024f738cf4\\\",\\\"columns\\\":[\\\"is_answered\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Email') OR \\\\\\\"is_answered\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_0adcd2453c81\\\",\\\"columns\\\":[\\\"is_draft\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Email') OR \\\\\\\"is_draft\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_428e155c9609\\\",\\\"columns\\\":[\\\"is_edited\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:SlackMessage') OR \\\\\\\"is_edited\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_a17af99e85e3\\\",\\\"columns\\\":[\\\"is_reply\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"is_reply\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_3e30563cba58\\\",\\\"columns\\\":[\\\"is_retweet\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"is_retweet\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_bab2c772ebe6\\\",\\\"columns\\\":[\\\"like_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"like_count\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_c6ad8d47bbc8\\\",\\\"columns\\\":[\\\"reply_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"reply_count\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_43a00e1c098d\\\",\\\"columns\\\":[\\\"retweet_count\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:Tweet') OR \\\\\\\"retweet_count\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"8541efa0\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:TwitterAccount\\\":{\\\"name\\\":\\\"twitteraccount\\\",\\\"className\\\":\\\"TwitterAccount\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:TwitterAccount\\\",\\\"collection\\\":\\\"accounts\\\",\\\"filePath\\\":\\\"src/models/TwitterAccount.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"created_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updated_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"required\\\":false,\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true},\\\"required\\\":false},\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The display name for this connected messaging account.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The display name for this connected messaging account.\\\"},\\\"providerType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The service that connects this account to your application.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The service that connects this account to your application.\\\"},\\\"channelType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The kind of messaging this account supports, such as email or chat.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The kind of messaging this account supports, such as email or chat.\\\"},\\\"credentialSecretId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"readonly\\\"],\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"required\\\":false,\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"isActive\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this account is enabled for messaging.\\\"},\\\"required\\\":true,\\\"default\\\":true,\\\"description\\\":\\\"Whether this account is enabled for messaging.\\\"},\\\"ownerUserId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The person who owns this account and decides who else may use it.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-users:User\\\",\\\"description\\\":\\\"The person who owns this account and decides who else may use it.\\\"},\\\"label\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"A short name shown beside this account, such as Support or Personal.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"A short name shown beside this account, such as Support or Personal.\\\"},\\\"connectionStatus\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it.\\\"},\\\"statusMessage\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Why the account needs attention, in plain words.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Why the account needs attention, in plain words.\\\"},\\\"lastSyncAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account last checked for new messages.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account last checked for new messages.\\\"},\\\"settings\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"readonly\\\"],\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"required\\\":false,\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"configuration\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The public connection settings for this account; credentials are stored separately.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The public connection settings for this account; credentials are stored separately.\\\"},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account was added.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account was added.\\\"},\\\"updatedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account was last changed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account was last changed.\\\"},\\\"handle\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"twitterUserId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false}},\\\"methods\\\":{\\\"getSettings\\\":{\\\"name\\\":\\\"getSettings\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setSettings\\\":{\\\"name\\\":\\\"setSettings\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"settings\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getConfiguration\\\":{\\\"name\\\":\\\"getConfiguration\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setConfiguration\\\":{\\\"name\\\":\\\"setConfiguration\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"configuration\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markNeedsReconnect\\\":{\\\"name\\\":\\\"markNeedsReconnect\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"reason\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markConnected\\\":{\\\"name\\\":\\\"markConnected\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"activate\\\":{\\\"name\\\":\\\"activate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deactivate\\\":{\\\"name\\\":\\\"deactivate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setCredentials\\\":{\\\"name\\\":\\\"setCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"credentials\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"removeCredentials\\\":{\\\"name\\\":\\\"removeCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createSender\\\":{\\\"name\\\":\\\"createSender\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<MessageSenderInterface>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getCredentials\\\":{\\\"name\\\":\\\"getCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Record<string, unknown> | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableStrategy\\\":\\\"sti\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"tableName\\\":\\\"accounts\\\"},\\\"extends\\\":\\\"Account\\\",\\\"exportName\\\":\\\"TwitterAccount\\\",\\\"collectionExportName\\\":\\\"TwitterAccountCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"isActive\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"accounts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"accounts\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"provider_type\\\\\\\" TEXT,\\\\n \\\\\\\"channel_type\\\\\\\" TEXT,\\\\n \\\\\\\"credential_secret_id\\\\\\\" TEXT,\\\\n \\\\\\\"is_active\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"owner_user_id\\\\\\\" UUID,\\\\n \\\\\\\"label\\\\\\\" TEXT,\\\\n \\\\\\\"connection_status\\\\\\\" TEXT,\\\\n \\\\\\\"status_message\\\\\\\" TEXT,\\\\n \\\\\\\"last_sync_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"settings\\\\\\\" TEXT,\\\\n \\\\\\\"configuration\\\\\\\" TEXT,\\\\n \\\\\\\"email\\\\\\\" TEXT,\\\\n \\\\\\\"sync_interval_minutes\\\\\\\" INTEGER DEFAULT 60,\\\\n \\\\\\\"sync_cursor\\\\\\\" TEXT,\\\\n \\\\\\\"backfill_since\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"cursor_horizon\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_sync_error\\\\\\\" TEXT,\\\\n \\\\\\\"backlog\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"agent_send_policy\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_id\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_name\\\\\\\" TEXT,\\\\n \\\\\\\"bot_user_id\\\\\\\" TEXT,\\\\n \\\\\\\"handle\\\\\\\" TEXT,\\\\n \\\\\\\"twitter_user_id\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"credential_secret_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_active\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":true},\\\"owner_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"label\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"connection_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"status_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"last_sync_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"settings\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"configuration\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"sync_interval_minutes\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":60},\\\"sync_cursor\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backfill_since\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"cursor_horizon\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"last_sync_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backlog\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"agent_send_policy\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bot_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handle\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"twitter_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"accounts_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"accounts_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"accounts_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"accounts_owner_user_id_idx\\\",\\\"columns\\\":[\\\"owner_user_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_81229bbfe8e3\\\",\\\"columns\\\":[\\\"backlog\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"backlog\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_1f9c5f0ee488\\\",\\\"columns\\\":[\\\"sync_interval_minutes\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"sync_interval_minutes\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"ff134288\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:UserNotification\\\":{\\\"name\\\":\\\"usernotification\\\",\\\"className\\\":\\\"UserNotification\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:UserNotification\\\",\\\"collection\\\":\\\"usernotifications\\\",\\\"description\\\":\\\"One in-app notification for one person, with its own read state.\\\",\\\"filePath\\\":\\\"src/models/UserNotification.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"requiredFor\\\",\\\"__tenancy\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"requiredFor\\\":\\\"tenant-scope\\\"},\\\"required\\\":true},\\\"recipientUserId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\",\\\"related\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true,\\\"related\\\":\\\"@happyvertical/smrt-users:User\\\"},\\\"kind\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"title\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"body\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"href\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"severity\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\",\\\"enum\\\"]},\\\"required\\\":false,\\\"default\\\":\\\"info\\\",\\\"enum\\\":[\\\"info\\\",\\\"success\\\",\\\"warning\\\",\\\"error\\\"]},\\\"sourceRef\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"idempotency\\\"},\\\"required\\\":true},\\\"occurredAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"readAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"dismissedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"user_notifications\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false,\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"recipient_user_id\\\",\\\"source_ref\\\"],\\\"indexes\\\":[{\\\"name\\\":\\\"user_notifications_recipient_occurred_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"recipientUserId\\\",\\\"occurredAt\\\"]}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"}},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UserNotification\\\",\\\"collectionExportName\\\":\\\"UserNotificationCollection\\\",\\\"displayLabelField\\\":\\\"title\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"recipientUserId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"crossPackageRef\\\"},{\\\"field\\\":\\\"sourceRef\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"user_notifications\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"user_notifications\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"recipient_user_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"kind\\\\\\\" TEXT,\\\\n \\\\\\\"title\\\\\\\" TEXT,\\\\n \\\\\\\"body\\\\\\\" TEXT,\\\\n \\\\\\\"href\\\\\\\" TEXT,\\\\n \\\\\\\"severity\\\\\\\" TEXT DEFAULT 'info',\\\\n \\\\\\\"source_ref\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"occurred_at\\\\\\\" TEXT,\\\\n \\\\\\\"read_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"dismissed_at\\\\\\\" TIMESTAMP\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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},\\\"recipient_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"title\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"body\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"href\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"severity\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"info\\\"},\\\"source_ref\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"occurred_at\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"read_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"dismissed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"user_notifications_tenant_id_recipient_user_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"recipient_user_id\\\",\\\"source_ref\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"user_notifications_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"user_notifications_recipient_occurred_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"recipient_user_id\\\",\\\"occurred_at\\\"]},{\\\"name\\\":\\\"user_notifications_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"user_notifications_recipient_user_id_idx\\\",\\\"columns\\\":[\\\"recipient_user_id\\\"]}],\\\"version\\\":\\\"812ca772\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:Whitelist\\\":{\\\"name\\\":\\\"whitelist\\\",\\\"className\\\":\\\"Whitelist\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:Whitelist\\\",\\\"collection\\\":\\\"whitelists\\\",\\\"description\\\":\\\"Allow-only entries for email filtering\\\",\\\"filePath\\\":\\\"src/models/Whitelist.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"pattern\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":false,\\\"default\\\":\\\"\\\"},\\\"type\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\",\\\"enum\\\"]},\\\"required\\\":false,\\\"default\\\":\\\"email\\\",\\\"enum\\\":[\\\"email\\\",\\\"domain\\\",\\\"regex\\\"]},\\\"category\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"description\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"]},\\\"required\\\":false,\\\"default\\\":\\\"\\\"},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"autoFilter\\\":true,\\\"autoPopulate\\\":true,\\\"allowSuperAdminBypass\\\":false},\\\"generated\\\":true,\\\"source\\\":\\\"tenantScoped_decorator\\\",\\\"sqlType\\\":\\\"UUID\\\"},\\\"required\\\":true}},\\\"methods\\\":{\\\"matches\\\":{\\\"name\\\":\\\"matches\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"email\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\",\\\"create\\\",\\\"update\\\",\\\"delete\\\"]},\\\"cli\\\":{\\\"skipApiCheck\\\":true},\\\"tenantScoped\\\":true,\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Whitelist\\\",\\\"collectionExportName\\\":\\\"WhitelistCollection\\\",\\\"validationRules\\\":[],\\\"schema\\\":{\\\"tableName\\\":\\\"whitelists\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"whitelists\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\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 \\\\\\\"pattern\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"type\\\\\\\" TEXT DEFAULT 'email',\\\\n \\\\\\\"category\\\\\\\" TEXT,\\\\n \\\\\\\"description\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"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\\\"},\\\"pattern\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"email\\\"},\\\"category\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"whitelists_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"whitelists_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"eb5b558d\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"},\\\"@happyvertical/smrt-messages:ZulipAccount\\\":{\\\"name\\\":\\\"zulipaccount\\\",\\\"className\\\":\\\"ZulipAccount\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-messages:ZulipAccount\\\",\\\"collection\\\":\\\"accounts\\\",\\\"filePath\\\":\\\"src/models/ZulipAccount.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-messages\\\",\\\"fields\\\":{\\\"created_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"updated_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"required\\\":false,\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true},\\\"required\\\":false},\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The display name for this connected messaging account.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The display name for this connected messaging account.\\\"},\\\"providerType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The service that connects this account to your application.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The service that connects this account to your application.\\\"},\\\"channelType\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The kind of messaging this account supports, such as email or chat.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The kind of messaging this account supports, such as email or chat.\\\"},\\\"credentialSecretId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"readonly\\\"],\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"required\\\":false,\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"isActive\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"default\\\"],\\\"description\\\":\\\"Whether this account is enabled for messaging.\\\"},\\\"required\\\":true,\\\"default\\\":true,\\\"description\\\":\\\"Whether this account is enabled for messaging.\\\"},\\\"ownerUserId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\",\\\"related\\\"],\\\"description\\\":\\\"The person who owns this account and decides who else may use it.\\\"},\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-users:User\\\",\\\"description\\\":\\\"The person who owns this account and decides who else may use it.\\\"},\\\"label\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"A short name shown beside this account, such as Support or Personal.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"A short name shown beside this account, such as Support or Personal.\\\"},\\\"connectionStatus\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it.\\\"},\\\"statusMessage\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"Why the account needs attention, in plain words.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"Why the account needs attention, in plain words.\\\"},\\\"lastSyncAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account last checked for new messages.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account last checked for new messages.\\\"},\\\"settings\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"readonly\\\"],\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"required\\\":false,\\\"sensitive\\\":true,\\\"readonly\\\":true},\\\"configuration\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"The public connection settings for this account; credentials are stored separately.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"The public connection settings for this account; credentials are stored separately.\\\"},\\\"createdAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account was added.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account was added.\\\"},\\\"updatedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"description\\\"],\\\"description\\\":\\\"When this account was last changed.\\\"},\\\"required\\\":false,\\\"description\\\":\\\"When this account was last changed.\\\"}},\\\"methods\\\":{\\\"getSettings\\\":{\\\"name\\\":\\\"getSettings\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setSettings\\\":{\\\"name\\\":\\\"setSettings\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"settings\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getConfiguration\\\":{\\\"name\\\":\\\"getConfiguration\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setConfiguration\\\":{\\\"name\\\":\\\"setConfiguration\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"configuration\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markNeedsReconnect\\\":{\\\"name\\\":\\\"markNeedsReconnect\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"reason\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markConnected\\\":{\\\"name\\\":\\\"markConnected\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"activate\\\":{\\\"name\\\":\\\"activate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deactivate\\\":{\\\"name\\\":\\\"deactivate\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setCredentials\\\":{\\\"name\\\":\\\"setCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"credentials\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"removeCredentials\\\":{\\\"name\\\":\\\"removeCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createSender\\\":{\\\"name\\\":\\\"createSender\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<MessageSenderInterface>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getCredentials\\\":{\\\"name\\\":\\\"getCredentials\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Record<string, unknown> | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableStrategy\\\":\\\"sti\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"tableName\\\":\\\"accounts\\\"},\\\"extends\\\":\\\"Account\\\",\\\"exportName\\\":\\\"ZulipAccount\\\",\\\"collectionExportName\\\":\\\"ZulipAccountCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"isActive\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"accounts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"accounts\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"provider_type\\\\\\\" TEXT,\\\\n \\\\\\\"channel_type\\\\\\\" TEXT,\\\\n \\\\\\\"credential_secret_id\\\\\\\" TEXT,\\\\n \\\\\\\"is_active\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"owner_user_id\\\\\\\" UUID,\\\\n \\\\\\\"label\\\\\\\" TEXT,\\\\n \\\\\\\"connection_status\\\\\\\" TEXT,\\\\n \\\\\\\"status_message\\\\\\\" TEXT,\\\\n \\\\\\\"last_sync_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"settings\\\\\\\" TEXT,\\\\n \\\\\\\"configuration\\\\\\\" TEXT,\\\\n \\\\\\\"email\\\\\\\" TEXT,\\\\n \\\\\\\"sync_interval_minutes\\\\\\\" INTEGER DEFAULT 60,\\\\n \\\\\\\"sync_cursor\\\\\\\" TEXT,\\\\n \\\\\\\"backfill_since\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"cursor_horizon\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_sync_error\\\\\\\" TEXT,\\\\n \\\\\\\"backlog\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"agent_send_policy\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_id\\\\\\\" TEXT,\\\\n \\\\\\\"workspace_name\\\\\\\" TEXT,\\\\n \\\\\\\"bot_user_id\\\\\\\" TEXT,\\\\n \\\\\\\"handle\\\\\\\" TEXT,\\\\n \\\\\\\"twitter_user_id\\\\\\\" TEXT\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"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\\\":false},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"provider_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"channel_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"credential_secret_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"is_active\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":true},\\\"owner_user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false},\\\"label\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"connection_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"status_message\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"last_sync_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"settings\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"configuration\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"sync_interval_minutes\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":60},\\\"sync_cursor\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backfill_since\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"cursor_horizon\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false},\\\"last_sync_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"backlog\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":false},\\\"agent_send_policy\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"workspace_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"bot_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"handle\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"twitter_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"accounts_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"accounts_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"accounts_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"accounts_owner_user_id_idx\\\",\\\"columns\\\":[\\\"owner_user_id\\\"]}],\\\"checks\\\":[{\\\"name\\\":\\\"smrt_ck_81229bbfe8e3\\\",\\\"columns\\\":[\\\"backlog\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"backlog\\\\\\\" IS NOT NULL\\\"},{\\\"name\\\":\\\"smrt_ck_1f9c5f0ee488\\\",\\\"columns\\\":[\\\"sync_interval_minutes\\\"],\\\"expression\\\":\\\"_meta_type NOT IN ('@happyvertical/smrt-messages:EmailAccount') OR \\\\\\\"sync_interval_minutes\\\\\\\" IS NOT NULL\\\"}],\\\"version\\\":\\\"ff134288\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-messages\\\"}},\\\"moduleType\\\":\\\"smrt\\\",\\\"recipes\\\":[{\\\"id\\\":\\\"messages.mailbox\\\",\\\"className\\\":\\\"MailboxRecipe\\\",\\\"label\\\":\\\"Mailbox\\\",\\\"summary\\\":\\\"Read and compose email from your connected accounts.\\\",\\\"synonyms\\\":[\\\"email\\\",\\\"inbox\\\",\\\"mail\\\"],\\\"models\\\":[\\\"@happyvertical/smrt-messages:Email\\\",\\\"@happyvertical/smrt-messages:EmailAccount\\\"],\\\"nav\\\":[{\\\"label\\\":\\\"Mailbox\\\",\\\"model\\\":\\\"@happyvertical/smrt-messages:Email\\\",\\\"icon\\\":\\\"folder\\\",\\\"description\\\":\\\"Read email from your connected accounts.\\\",\\\"key\\\":\\\"mailbox\\\",\\\"noun\\\":\\\"email\\\"},{\\\"label\\\":\\\"Failed sends\\\",\\\"model\\\":\\\"@happyvertical/smrt-messages:Email\\\",\\\"icon\\\":\\\"fileText\\\",\\\"description\\\":\\\"Review email whose last send attempt failed.\\\",\\\"key\\\":\\\"failed-sends\\\",\\\"noun\\\":\\\"email\\\",\\\"filter\\\":{\\\"field\\\":\\\"sendStatus\\\",\\\"value\\\":\\\"failed\\\"}}],\\\"requires\\\":[],\\\"group\\\":{\\\"id\\\":\\\"messages\\\",\\\"label\\\":\\\"Messaging\\\",\\\"summary\\\":\\\"Choose email and personal updates independently.\\\"},\\\"section\\\":{\\\"id\\\":\\\"messages\\\",\\\"label\\\":\\\"Messaging\\\",\\\"icon\\\":\\\"folder\\\",\\\"description\\\":\\\"Read email and keep up with updates addressed to you.\\\"},\\\"options\\\":{\\\"@happyvertical/smrt-messages:Email\\\":{\\\"fields\\\":{\\\"created_at\\\":{\\\"help\\\":\\\"When this email was first recorded.\\\"},\\\"updated_at\\\":{\\\"help\\\":\\\"When this email record was last changed.\\\"}}},\\\"@happyvertical/smrt-messages:EmailAccount\\\":{\\\"fields\\\":{\\\"created_at\\\":{\\\"help\\\":\\\"When this mailbox connection was first recorded.\\\"},\\\"updated_at\\\":{\\\"help\\\":\\\"When this mailbox connection was last changed.\\\"}}}},\\\"help\\\":{\\\"markdown\\\":\\\"## Your mailbox\\\\nRead messages, open a conversation, or compose an email using a connected account.\\\\nChoose the sender account, add recipients, and check the subject and message before sending.\\\\n\\\\n## Failed sends\\\\nUse Failed sends to review email whose last send attempt failed. Returning to the mailbox shows all email again.\\\\nCheck the failure and sender connection before retrying through your application. This view does not resend email automatically.\\\\n\\\\n## Preview\\\\nThe playground uses fictional messages. Sending and saving are mocked and never contact a mail server.\\\\n\\\\n## Connect an account\\\\nYour application administrator connects an authorized email provider on the server. Real sending and mailbox synchronization require that connection; a preview does not verify delivery.\\\\n\\\",\\\"fieldRefs\\\":[]},\\\"surfaces\\\":[{\\\"kind\\\":\\\"route\\\",\\\"path\\\":\\\"/messages/mailbox\\\",\\\"export\\\":\\\"@happyvertical/smrt-messages/svelte#MessageList\\\",\\\"label\\\":\\\"Mailbox\\\"},{\\\"kind\\\":\\\"playground\\\",\\\"export\\\":\\\"@happyvertical/smrt-messages/svelte#MailboxDemo\\\",\\\"label\\\":\\\"Mailbox with mocked sending\\\"}],\\\"providers\\\":[{\\\"id\\\":\\\"email-inbox\\\",\\\"kind\\\":\\\"email\\\",\\\"options\\\":[\\\"imap\\\",\\\"pop3\\\",\\\"gmail\\\",\\\"jmap\\\"],\\\"required\\\":true},{\\\"id\\\":\\\"email-send\\\",\\\"kind\\\":\\\"email\\\",\\\"options\\\":[\\\"smtp\\\",\\\"gmail\\\"],\\\"required\\\":false}],\\\"runtime\\\":\\\"both\\\",\\\"demoSeed\\\":{\\\"data\\\":{\\\"accounts\\\":[{\\\"id\\\":\\\"demo-account\\\",\\\"name\\\":\\\"Demo Inbox\\\",\\\"providerType\\\":\\\"email\\\",\\\"email\\\":\\\"you@example.com\\\",\\\"isActive\\\":true}],\\\"messages\\\":[{\\\"id\\\":\\\"demo-welcome\\\",\\\"type\\\":\\\"email\\\",\\\"accountId\\\":\\\"demo-account\\\",\\\"subject\\\":\\\"Welcome to your mailbox\\\",\\\"body\\\":\\\"Fictional mail. Sending is mocked; nothing leaves this browser.\\\",\\\"senderName\\\":\\\"Demo colleague\\\",\\\"senderAddress\\\":\\\"colleague@example.com\\\",\\\"recipientAddresses\\\":[{\\\"address\\\":\\\"you@example.com\\\"}],\\\"date\\\":\\\"2026-01-01T12:00:00Z\\\",\\\"isRead\\\":false,\\\"isFlagged\\\":false,\\\"hasAttachments\\\":false}]}},\\\"demo\\\":{\\\"mode\\\":\\\"server\\\",\\\"reasons\\\":[\\\"Needs a server because its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-profiles, @happyvertical/smrt-secrets, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3615, #3617, #3624, #3626, #3627).\\\"]}},{\\\"id\\\":\\\"messages.notifications\\\",\\\"className\\\":\\\"NotificationsRecipe\\\",\\\"label\\\":\\\"Notifications\\\",\\\"summary\\\":\\\"See updates addressed to you and mark them read.\\\",\\\"synonyms\\\":[\\\"alerts\\\",\\\"notification bell\\\"],\\\"models\\\":[\\\"@happyvertical/smrt-messages:UserNotification\\\"],\\\"nav\\\":[],\\\"requires\\\":[],\\\"group\\\":{\\\"id\\\":\\\"messages\\\",\\\"label\\\":\\\"Messaging\\\",\\\"summary\\\":\\\"Choose email and personal updates independently.\\\"},\\\"section\\\":{\\\"id\\\":\\\"messages\\\",\\\"label\\\":\\\"Messaging\\\",\\\"icon\\\":\\\"folder\\\",\\\"description\\\":\\\"Read email and keep up with updates addressed to you.\\\"},\\\"help\\\":{\\\"markdown\\\":\\\"## Notifications\\\\nOpen the notification bell to see updates addressed to you. Unread updates have a visible marker.\\\\nChoose Mark read for one update or Mark all read for every unread update in your authorized accounts.\\\\nFollow a notification link to open its related record when one is available.\\\\n\\\\n## Availability\\\\nNotifications are scoped to the signed-in person. Your application connects the notification provider and may enable live updates. If loading fails, try again after the connection returns.\\\\n\\\",\\\"fieldRefs\\\":[]},\\\"surfaces\\\":[{\\\"kind\\\":\\\"shell-widget\\\",\\\"slot\\\":\\\"header.end\\\",\\\"export\\\":\\\"@happyvertical/smrt-svelte/notifications#NotificationBell\\\",\\\"label\\\":\\\"Notifications\\\"}],\\\"providers\\\":[{\\\"id\\\":\\\"notifications\\\",\\\"kind\\\":\\\"notifications\\\",\\\"options\\\":[\\\"user-notification-service\\\"],\\\"required\\\":true}],\\\"runtime\\\":\\\"both\\\",\\\"demoSeed\\\":{\\\"data\\\":{\\\"items\\\":[{\\\"id\\\":\\\"demo-notification\\\",\\\"title\\\":\\\"You were mentioned\\\",\\\"body\\\":\\\"A fictional update for the demo user.\\\",\\\"occurredAt\\\":\\\"2026-01-01T12:00:00Z\\\",\\\"severity\\\":\\\"info\\\",\\\"readAt\\\":null}]}},\\\"demo\\\":{\\\"mode\\\":\\\"server\\\",\\\"reasons\\\":[\\\"Needs a server because its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-profiles, @happyvertical/smrt-secrets, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3615, #3617, #3624, #3626, #3627).\\\"]}},{\\\"id\\\":\\\"messages.slack\\\",\\\"className\\\":\\\"SlackRecipe\\\",\\\"label\\\":\\\"Slack\\\",\\\"summary\\\":\\\"Read Slack messages from your connected workspaces.\\\",\\\"synonyms\\\":[\\\"slack\\\",\\\"slack messages\\\",\\\"slack channels\\\",\\\"workspace chat\\\",\\\"team chat\\\"],\\\"models\\\":[\\\"@happyvertical/smrt-messages:SlackMessage\\\",\\\"@happyvertical/smrt-messages:SlackAccount\\\"],\\\"nav\\\":[{\\\"label\\\":\\\"Slack messages\\\",\\\"model\\\":\\\"@happyvertical/smrt-messages:SlackMessage\\\",\\\"icon\\\":\\\"folder\\\",\\\"description\\\":\\\"Read messages from your connected workspaces by channel.\\\",\\\"key\\\":\\\"slack-messages\\\",\\\"noun\\\":\\\"message\\\"},{\\\"label\\\":\\\"Slack workspaces\\\",\\\"model\\\":\\\"@happyvertical/smrt-messages:SlackAccount\\\",\\\"icon\\\":\\\"users\\\",\\\"description\\\":\\\"The workspaces your application is connected to.\\\",\\\"noun\\\":\\\"workspace\\\"}],\\\"requires\\\":[],\\\"group\\\":{\\\"id\\\":\\\"messages\\\",\\\"label\\\":\\\"Messaging\\\",\\\"summary\\\":\\\"Choose email and personal updates independently.\\\"},\\\"section\\\":{\\\"id\\\":\\\"messages\\\",\\\"label\\\":\\\"Messaging\\\",\\\"icon\\\":\\\"folder\\\",\\\"description\\\":\\\"Read email and keep up with updates addressed to you.\\\"},\\\"options\\\":{\\\"@happyvertical/smrt-messages:SlackMessage\\\":{\\\"fields\\\":{\\\"channelName\\\":{\\\"label\\\":\\\"Channel\\\",\\\"order\\\":1},\\\"body\\\":{\\\"label\\\":\\\"Message\\\",\\\"order\\\":2},\\\"threadId\\\":{\\\"label\\\":\\\"Thread\\\",\\\"order\\\":3},\\\"sendStatus\\\":{\\\"label\\\":\\\"Sent status\\\",\\\"order\\\":4},\\\"accountId\\\":{\\\"label\\\":\\\"Workspace\\\",\\\"order\\\":5},\\\"fromName\\\":{\\\"label\\\":\\\"From\\\",\\\"visibility\\\":\\\"advanced\\\"},\\\"fromAddress\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"toAddresses\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"subject\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"date\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"isRead\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"isFlagged\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"isEdited\\\":{\\\"label\\\":\\\"Edited\\\",\\\"visibility\\\":\\\"advanced\\\"},\\\"messageType\\\":{\\\"label\\\":\\\"Message kind\\\",\\\"visibility\\\":\\\"advanced\\\"},\\\"reactions\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"hasAttachments\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"channelId\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"sentAt\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"sendError\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"scheduledSendAt\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"inReplyToMessageId\\\":{\\\"label\\\":\\\"Replying to\\\",\\\"visibility\\\":\\\"advanced\\\"},\\\"personaId\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"endpointId\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"retryCount\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"maxRetries\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"size\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"correlationId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"slackTs\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"slackThreadTs\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"blocks\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"metadata\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"tenantId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"created_at\\\":{\\\"help\\\":\\\"When this message was first recorded.\\\"},\\\"updated_at\\\":{\\\"help\\\":\\\"When this message record was last changed.\\\"}}},\\\"@happyvertical/smrt-messages:SlackAccount\\\":{\\\"fields\\\":{\\\"name\\\":{\\\"order\\\":1},\\\"workspaceName\\\":{\\\"label\\\":\\\"Workspace\\\",\\\"order\\\":2},\\\"isActive\\\":{\\\"label\\\":\\\"Enabled\\\",\\\"order\\\":3},\\\"lastSyncAt\\\":{\\\"label\\\":\\\"Last checked\\\",\\\"order\\\":4},\\\"workspaceId\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"credentialSecretId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"settings\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"botUserId\\\":{\\\"label\\\":\\\"Bot user\\\",\\\"visibility\\\":\\\"advanced\\\"},\\\"providerType\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"channelType\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"configuration\\\":{\\\"visibility\\\":\\\"advanced\\\"},\\\"tenantId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"created_at\\\":{\\\"help\\\":\\\"When this workspace connection was first recorded.\\\"},\\\"updated_at\\\":{\\\"help\\\":\\\"When this workspace connection was last changed.\\\"}}}},\\\"help\\\":{\\\"markdown\\\":\\\"## Overview\\\\n\\\\nSlack shows the messages from the workspaces your application is connected to,\\\\nin one place beside your email. Each message keeps the channel it was posted\\\\nin, the thread it belongs to, the reactions people added and whether it was\\\\nedited, so you can catch up on a conversation without opening Slack.\\\\n\\\\n## Tasks\\\\n\\\\nWorkspaces are connected by your application administrator on the server.\\\\nMessages arrive from those connected workspaces; here you read them and see\\\\nwhere each one stands.\\\\n\\\\n### Find a message in a channel\\\\n\\\\n1. Open Slack messages.\\\\n2. Look at the **{field:SlackMessage.channelName}** to find the channel you want.\\\\n3. Open a message to read the **{field:SlackMessage.body}** and see who it is from.\\\\n\\\\n### Follow a thread\\\\n\\\\n1. Open a message that is part of a conversation.\\\\n2. Use its **{field:SlackMessage.threadId}** to find the other messages in the same thread.\\\\n3. Read them oldest first; the **{field:SlackMessage.reactions}** show how people responded.\\\\n\\\\n### See whether a message was changed\\\\n\\\\n1. Open the message.\\\\n2. Check **{field:SlackMessage.isEdited}** to see whether it was edited after it was posted.\\\\n\\\\n### Draft a message\\\\n\\\\n1. Open Slack messages and choose **New**.\\\\n2. Type the **{field:SlackMessage.channelName}** it is for and the **{field:SlackMessage.body}**.\\\\n3. Save. This records the draft; your application sends it through the connected workspace, and the **{field:SlackMessage.sendStatus}** shows where it stands.\\\\n\\\\n### See which workspaces are connected\\\\n\\\\n1. Open Slack workspaces.\\\\n2. Look at the **{field:SlackAccount.workspaceName}** and whether it is **{field:SlackAccount.isActive}**.\\\\n3. Check **{field:SlackAccount.lastSyncAt}** to see when messages were last collected. Connecting or changing a workspace is done by your application administrator, not here.\\\\n\\\",\\\"fieldRefs\\\":[\\\"SlackAccount.isActive\\\",\\\"SlackAccount.lastSyncAt\\\",\\\"SlackAccount.workspaceName\\\",\\\"SlackMessage.body\\\",\\\"SlackMessage.channelName\\\",\\\"SlackMessage.isEdited\\\",\\\"SlackMessage.reactions\\\",\\\"SlackMessage.sendStatus\\\",\\\"SlackMessage.threadId\\\"]},\\\"demo\\\":{\\\"mode\\\":\\\"server\\\",\\\"reasons\\\":[\\\"Needs a server because its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-profiles, @happyvertical/smrt-secrets, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3615, #3617, #3624, #3626, #3627).\\\"]}}],\\\"smrtDependencies\\\":[\\\"@happyvertical/smrt-approvals\\\",\\\"@happyvertical/smrt-core\\\",\\\"@happyvertical/smrt-jobs\\\",\\\"@happyvertical/smrt-ledgers\\\",\\\"@happyvertical/smrt-profiles\\\",\\\"@happyvertical/smrt-secrets\\\",\\\"@happyvertical/smrt-tenancy\\\",\\\"@happyvertical/smrt-users\\\"],\\\"browser\\\":{\\\"status\\\":\\\"server-only\\\",\\\"issues\\\":[\\\"#3615\\\",\\\"#3617\\\",\\\"#3624\\\",\\\"#3626\\\",\\\"#3627\\\"],\\\"via\\\":[\\\"@happyvertical/smrt-jobs\\\",\\\"@happyvertical/smrt-profiles\\\",\\\"@happyvertical/smrt-secrets\\\",\\\"@happyvertical/smrt-tenancy\\\",\\\"@happyvertical/smrt-users\\\"]},\\\"stampsConstructors\\\":true}\"));\n","import {\n type PermissionDefinition,\n registerPermissionDefinitions,\n} from '@happyvertical/smrt-users/permission-registry';\nimport type { MailScope } from './access.js';\n\nexport const SEND_MESSAGES_PERMISSION = 'messages.send';\nexport const MANAGE_MESSAGE_ROUTES_PERMISSION = 'messages.manage-routes';\nexport const MANAGE_MESSAGE_CREDENTIALS_PERMISSION =\n 'messages.manage-credentials';\n/** Tenant-level ceilings for the per-account mail scopes (see `access.ts`). */\nexport const READ_MAIL_PERMISSION = 'messages.read';\nexport const TRIAGE_MAIL_PERMISSION = 'messages.triage';\nexport const DRAFT_MAIL_PERMISSION = 'messages.draft';\nexport const MANAGE_MAIL_ACCESS_PERMISSION = 'messages.manage-access';\n\nexport const MESSAGING_PERMISSION_DEFINITIONS: PermissionDefinition[] = [\n {\n slug: SEND_MESSAGES_PERMISSION,\n category: 'messages',\n name: 'Send Messages',\n description: 'Allows send on messages',\n },\n {\n slug: MANAGE_MESSAGE_ROUTES_PERMISSION,\n category: 'messages',\n name: 'Manage Message Routes',\n description: 'Manage persona messaging endpoints and route bindings',\n },\n {\n slug: MANAGE_MESSAGE_CREDENTIALS_PERMISSION,\n category: 'messages',\n name: 'Manage Message Credentials',\n description: 'Create accounts and replace write-only provider credentials',\n },\n {\n slug: TRIAGE_MAIL_PERMISSION,\n category: 'messages',\n name: 'Triage Messages',\n // Must equal the description generated for Email.triage(), like `send`\n // above: the catalog refuses two descriptions for one slug.\n description: 'Allows triage on messages',\n },\n {\n slug: DRAFT_MAIL_PERMISSION,\n category: 'messages',\n name: 'Draft Mail',\n description:\n 'Write mail drafts; a mail account grant narrows this per account',\n },\n {\n slug: MANAGE_MAIL_ACCESS_PERMISSION,\n category: 'messages',\n name: 'Manage Mail Access',\n description:\n 'Grant or revoke per-account mail access; only an account owner or a delegating grantee may use it on that account',\n },\n];\n\n/**\n * Tenant `messages.*` permissions for the built-in system roles. Per-account\n * mail access (grants, `MailAccessService`) is checked against smrt-users role\n * permissions, so a fresh app fails closed for everyone, owners included,\n * until these exist.\n *\n * - `owner`, `admin`: every mail scope plus `manage-credentials` and\n * `manage-access`\n * - `member`: the four scope ceilings (read, triage, draft, send)\n * - `viewer`: read\n *\n * Tenant ceilings only: a non-owner still needs a per-account grant before\n * seeing any mail. `manage-routes` (persona routing) is not part of the mail\n * matrix.\n */\nexport const MESSAGES_ROLE_PERMISSION_MATRIX: Readonly<\n Record<'owner' | 'admin' | 'member' | 'viewer', readonly string[]>\n> = Object.freeze({\n owner: Object.freeze([\n READ_MAIL_PERMISSION,\n TRIAGE_MAIL_PERMISSION,\n DRAFT_MAIL_PERMISSION,\n SEND_MESSAGES_PERMISSION,\n MANAGE_MESSAGE_CREDENTIALS_PERMISSION,\n MANAGE_MAIL_ACCESS_PERMISSION,\n ]),\n admin: Object.freeze([\n READ_MAIL_PERMISSION,\n TRIAGE_MAIL_PERMISSION,\n DRAFT_MAIL_PERMISSION,\n SEND_MESSAGES_PERMISSION,\n MANAGE_MESSAGE_CREDENTIALS_PERMISSION,\n MANAGE_MAIL_ACCESS_PERMISSION,\n ]),\n member: Object.freeze([\n READ_MAIL_PERMISSION,\n TRIAGE_MAIL_PERMISSION,\n DRAFT_MAIL_PERMISSION,\n SEND_MESSAGES_PERMISSION,\n ]),\n viewer: Object.freeze([READ_MAIL_PERMISSION]),\n});\n\nexport interface SeedMessagesRolePermissionsResult {\n /** Slugs newly granted per system role; empty on a rerun. */\n added: Record<string, string[]>;\n /** Built-in roles absent from the database (not created here). */\n missingRoles: string[];\n}\n\n/**\n * Register the messaging permission catalog entries and grant\n * {@link MESSAGES_ROLE_PERMISSION_MATRIX} to the system roles. Idempotent and\n * additive: reruns add nothing, nothing is ever removed (`prune: false`), and\n * only system roles (no tenant, `isSystem`) are touched, so tenant-defined\n * roles keep whatever the tenant chose. Throws if a slug is not in the\n * catalog after sync.\n */\nexport async function seedMessagesRolePermissions(options: {\n db: unknown;\n}): Promise<SeedMessagesRolePermissionsResult> {\n ensureMessagingPermissionsRegistered();\n const { RolePermissionCollection } = await import(\n '@happyvertical/smrt-users'\n );\n const grants = await RolePermissionCollection.create(options as never);\n const result = await grants.seedRolePermissions(\n MESSAGES_ROLE_PERMISSION_MATRIX as unknown as Record<string, string[]>,\n { prune: false, systemRolesOnly: true },\n );\n const missing = Object.entries(result.missingPermissions).filter(\n ([, slugs]) => slugs.length > 0,\n );\n if (missing.length > 0) {\n throw new Error(\n `Messaging permissions missing from the catalog after sync: ${missing\n .map(([role, slugs]) => `${role}: ${slugs.join(', ')}`)\n .join('; ')}`,\n );\n }\n return {\n added: Object.fromEntries(\n Object.entries(result.added).filter(([, slugs]) => slugs.length > 0),\n ),\n missingRoles: result.missingRoles,\n };\n}\n\nexport interface MessagingPrincipal {\n readonly id?: string;\n /**\n * The smrt-users `User` id that owns mail accounts. Defaults to `id`; set it\n * when the principal id is something else (an agent credential id).\n */\n readonly userId?: string;\n readonly tenantId?: string;\n /** Host ceiling on mail scopes (agent credential); omit for none. */\n readonly scopes?: readonly MailScope[];\n /** Host ceiling on mail account ids (agent allow-list); omit for none. */\n readonly accountIds?: readonly string[];\n can(slug: string): boolean;\n}\n\nexport function messagingPrincipalFromPermissions(\n permissions: Iterable<string>,\n options: {\n id?: string;\n userId?: string;\n tenantId?: string;\n scopes?: readonly MailScope[];\n accountIds?: readonly string[];\n } = {},\n): MessagingPrincipal {\n const granted = new Set(permissions);\n return {\n ...options,\n can: (slug) => granted.has(slug),\n };\n}\n\nexport function assertMessagingPermission(\n principal: MessagingPrincipal,\n tenantId: string,\n permission: string,\n): void {\n if (principal.tenantId && principal.tenantId !== tenantId) {\n throw new Error('Messaging principal does not belong to this tenant.');\n }\n if (!principal.can(permission)) {\n throw new Error(`Missing required permission '${permission}'.`);\n }\n}\n\nlet registered = false;\n\nexport function ensureMessagingPermissionsRegistered(): void {\n if (registered) return;\n registered = true;\n registerPermissionDefinitions(MESSAGING_PERMISSION_DEFINITIONS);\n}\n","/**\n * Per-account mail access: an optional owner plus grants (read, triage, draft,\n * send) for people and host-mapped agent accounts, on smrt-users\n * `ResourceGrant`.\n *\n * Optional by default: a mail account with no `ownerUserId` keeps today's\n * tenant-wide behavior. An app that wants private or shared mailboxes sets an\n * owner and calls {@link configureMailAccess} once at startup; from then on\n * reads of an owned account's emails, folders and attachments are limited to\n * the owner and read grantees (enforced in the collection layer by\n * `access-enforcement.ts`, never by UI), and sending through an owned account\n * needs the `send` scope.\n *\n * The acting principal comes from the host through `resolvePrincipal`, so\n * smrt never knows the host's credential model (a session cookie, an agent\n * bearer token). Fail closed: an owned account is invisible to a missing,\n * foreign-tenant or ceiling-excluded principal. There is no tenant-admin or\n * super-admin bypass on content; trusted server work (sync, outbox) opts in\n * explicitly with {@link runWithMailSystemAccess}.\n *\n * Grants live in `ResourceGrant` (resource type {@link MAIL_ACCOUNT_RESOURCE_TYPE},\n * permission `messages.<scope>`). smrt-users composes them after tenant RBAC:\n * the grantee must also hold the tenant-level `messages.<scope>` permission,\n * which acts as the tenant's ceiling; the exact grant then narrows it per\n * account. The owner implicitly holds every scope on their own accounts and\n * needs no grant.\n *\n * @packageDocumentation\n */\n\nimport type { SmrtClassOptions } from '@happyvertical/smrt-core';\nimport { createHandoffContext, getCurrentTenant } from './host.js';\nimport {\n DRAFT_MAIL_PERMISSION,\n MANAGE_MAIL_ACCESS_PERMISSION,\n READ_MAIL_PERMISSION,\n TRIAGE_MAIL_PERMISSION,\n} from './permissions.js';\nimport type { AgentSendPolicy } from './types.js';\n\nexport const MAIL_SCOPES = ['read', 'triage', 'draft', 'send'] as const;\nexport type MailScope = (typeof MAIL_SCOPES)[number];\n\n/** `ResourceGrant.resourceType` for a mail account. */\nexport const MAIL_ACCOUNT_RESOURCE_TYPE = 'messages:account';\n\nconst SCOPE_PERMISSIONS: Record<MailScope, string> = {\n read: READ_MAIL_PERMISSION,\n triage: TRIAGE_MAIL_PERMISSION,\n draft: DRAFT_MAIL_PERMISSION,\n send: 'messages.send',\n};\n\n/** The tenant permission slug that is the ceiling for a mail scope. */\nexport function mailScopePermission(scope: MailScope): string {\n return SCOPE_PERMISSIONS[scope];\n}\n\nexport function isMailScope(value: unknown): value is MailScope {\n return (MAIL_SCOPES as readonly unknown[]).includes(value);\n}\n\n/** The acting principal, as the host knows it. */\nexport interface MailPrincipal {\n /** Host identity recorded for audit (a user id, an agent credential id). */\n id: string;\n /** Tenant the principal authenticated into. Must equal the account's. */\n tenantId: string;\n /**\n * The smrt-users `User` id that owns accounts and holds `ResourceGrant`\n * rows. People are their own user; an agent account is a `User` row the host\n * maps its credential to.\n */\n userId: string;\n /**\n * `'person'` (or `'human'`) for a person; anything else, including no\n * label, is treated as an agent: its sends follow the account's agent send\n * policy and it can never approve a held send.\n */\n kind?: string;\n /**\n * Host ceiling on scopes (for example an agent credential's mail scopes).\n * Intersected with the owner/grant decision; omit for no ceiling. An empty\n * list grants nothing.\n */\n scopes?: readonly MailScope[];\n /**\n * Host ceiling on account ids (for example `allowedMailAccountIds`).\n * Intersected with the owner/grant decision; omit for no ceiling. An empty\n * list grants nothing.\n */\n accountIds?: readonly string[];\n}\n\nexport interface MailAccessResolverContext {\n tenantId: string | null;\n}\n\n/** Returns the acting principal for the current request or job, or null. */\nexport type MailAccessResolver = (\n context: MailAccessResolverContext,\n) =>\n | MailPrincipal\n | null\n | undefined\n | Promise<MailPrincipal | null | undefined>;\n\nexport interface MailAccessConfig {\n /** Database options used to read accounts and grants. Required. */\n options: SmrtClassOptions;\n /** The host's access-check hook. Without it every owned account is closed. */\n resolvePrincipal?: MailAccessResolver;\n}\n\ninterface MailAccessState {\n config: MailAccessConfig | null;\n /** Database options seen on a mail row, used until the host configures. */\n learned: Map<unknown, SmrtClassOptions>;\n system: ReturnType<typeof createHandoffContext<true>>;\n}\n\nconst STATE_KEY = Symbol.for('@happyvertical/smrt-messages:mail-access');\n\n// Shared through globalThis: module-local state splits when a bundler or test\n// runner loads this module twice, and a split would silently drop enforcement.\nfunction state(): MailAccessState {\n const holder = globalThis as Record<symbol, unknown>;\n let current = holder[STATE_KEY] as MailAccessState | undefined;\n if (!current) {\n current = {\n config: null,\n learned: new Map(),\n system: createHandoffContext<true>(),\n };\n holder[STATE_KEY] = current;\n }\n return current;\n}\n\n/**\n * Turn on mail access enforcement for this process. Call once at startup,\n * after the database is available. Calling again replaces the configuration.\n */\nexport function configureMailAccess(config: MailAccessConfig): void {\n state().config = { ...config, options: withoutListBounds(config.options) };\n}\n\n/** Remove the configuration (tests). Owned accounts then fail closed. */\nexport function resetMailAccess(): void {\n state().config = null;\n state().learned.clear();\n}\n\n/**\n * Remember the database a mail row was read with. Until the host calls\n * {@link configureMailAccess}, this lets the policy still find owned accounts\n * and hide their mail (no principal resolver means no one is a principal).\n */\n/**\n * The options with their list bounds removed. `create()` forwards\n * `defaultListLimit`/`maxListLimit` from any options bag, and an access\n * decision needs every account: a truncated read would leave owned accounts\n * out of the denied set and leak their mail.\n */\nexport function withoutListBounds<T extends object>(options: T): T {\n return { ...options, defaultListLimit: undefined, maxListLimit: undefined };\n}\n\nexport function learnMailAccessOptions(\n options: SmrtClassOptions | undefined,\n): void {\n const current = state();\n if (current.config || !options) return;\n // One entry per database, so a process with several keeps each of them.\n const key = options.db ?? options;\n current.learned.delete(key);\n current.learned.set(key, withoutListBounds(options));\n if (current.learned.size > 16) {\n const oldest = current.learned.keys().next().value;\n current.learned.delete(oldest);\n }\n}\n\n/** Every policy in force: the configured one, else one per learned database. */\nexport function getEffectiveMailAccessConfigs(): MailAccessConfig[] {\n const current = state();\n if (current.config) return [current.config];\n return [...current.learned.values()].map((options) => ({ options }));\n}\n\n/** The configured policy, else a closed one over the learned database. */\nexport function getEffectiveMailAccessConfig(): MailAccessConfig | null {\n const current = state();\n if (current.config) return current.config;\n const latest = [...current.learned.values()].pop();\n return latest ? { options: latest } : null;\n}\n\nexport function getMailAccessConfig(): MailAccessConfig | null {\n return state().config;\n}\n\n/**\n * Run trusted server work (mailbox sync, the notification outbox) with the\n * per-account policy lifted. This is the only bypass; tenant-admin and\n * super-admin contexts do not lift it.\n */\nexport function runWithMailSystemAccess<T>(fn: () => T): T {\n return state().system.run(true, fn);\n}\n\nexport function inMailSystemAccess(): boolean {\n return state().system.getStore() === true;\n}\n\n/** The minimal account shape the policy reads. */\nexport interface MailAccessSubject {\n id?: string | null;\n tenantId?: string | null;\n ownerUserId?: string | null;\n}\n\nexport type MailAccessReason =\n | 'unowned'\n | 'system'\n | 'owner'\n | 'grant'\n | 'not_configured'\n | 'no_principal'\n | 'tenant_mismatch'\n | 'ceiling'\n | 'denied';\n\nexport interface MailAccessDecision {\n allowed: boolean;\n reason: MailAccessReason;\n}\n\n/** Thrown by {@link assertMailAccess}; carries a 403-class status. */\nexport class MailAccessError extends Error {\n readonly status = 403;\n constructor(\n readonly scope: MailScope,\n readonly reason: MailAccessReason,\n ) {\n super(`Mail access denied for scope '${scope}'.`);\n this.name = 'MailAccessError';\n }\n}\n\nasync function resolvePrincipal(\n config: MailAccessConfig,\n): Promise<MailPrincipal | null> {\n if (!config.resolvePrincipal) return null;\n const principal = await config.resolvePrincipal({\n tenantId: getCurrentTenant()?.tenantId ?? null,\n });\n if (\n !principal ||\n typeof principal.id !== 'string' ||\n !principal.id ||\n typeof principal.userId !== 'string' ||\n !principal.userId ||\n typeof principal.tenantId !== 'string' ||\n !principal.tenantId\n ) {\n return null;\n }\n return principal;\n}\n\n/**\n * The acting principal for the current request or job, as the host's\n * `resolvePrincipal` returns it, or null (nothing configured, no resolver, or\n * a malformed principal).\n */\nexport async function resolveMailPrincipal(): Promise<MailPrincipal | null> {\n const config = getEffectiveMailAccessConfig();\n return config ? await resolvePrincipal(config) : null;\n}\n\n/**\n * True only for a principal the host explicitly labels a person (`kind`\n * `'person'` or `'human'`). Fail closed: a missing or unknown label is an\n * agent, so it is held for approval and can never approve.\n */\nexport function isPersonMailPrincipal(\n principal: Pick<MailPrincipal, 'kind'> | null | undefined,\n): boolean {\n return principal?.kind === 'person' || principal?.kind === 'human';\n}\n\nasync function hasGrant(\n config: MailAccessConfig,\n principal: MailPrincipal,\n account: MailAccessSubject,\n scope: MailScope,\n): Promise<boolean> {\n const { checkResourceOperationPermission } = await import(\n '@happyvertical/smrt-users'\n );\n const accountId = account.id ?? '';\n const tenantId = account.tenantId ?? '';\n if (!accountId || !tenantId) return false;\n const decision = await checkResourceOperationPermission({\n ...config.options,\n collection: 'messages',\n action: scope,\n tenantId,\n userId: principal.userId,\n // No tenant-admin or super-admin bypass on mail content, even for an\n // ambient system context: only an exact grant opens a shared account.\n allowSuperAdminBypass: false,\n allowSystemContextBypass: false,\n resource: {\n tenantId,\n resourceType: MAIL_ACCOUNT_RESOURCE_TYPE,\n resourceId: accountId,\n },\n verifyResource: (resource) =>\n resource.tenantId === tenantId &&\n resource.resourceType === MAIL_ACCOUNT_RESOURCE_TYPE &&\n resource.resourceId === accountId,\n });\n return decision.allowed;\n}\n\n/**\n * Decide whether the current principal holds `scope` on `account`. Never\n * throws for a denial; a lookup failure denies.\n */\nexport async function decideMailAccess(\n account: MailAccessSubject,\n scope: MailScope,\n principalOverride?: MailPrincipal | null,\n): Promise<MailAccessDecision> {\n if (inMailSystemAccess()) return { allowed: true, reason: 'system' };\n const config = getEffectiveMailAccessConfig();\n const owned = Boolean(account.ownerUserId);\n if (!config) {\n // Nothing configured: unowned accounts keep the framework default\n // (tenant-wide); an owned account cannot be checked, so it is closed.\n return owned\n ? { allowed: false, reason: 'not_configured' }\n : { allowed: true, reason: 'unowned' };\n }\n const principal =\n principalOverride !== undefined\n ? principalOverride\n : await resolvePrincipal(config);\n if (!principal) {\n return owned\n ? { allowed: false, reason: 'no_principal' }\n : { allowed: true, reason: 'unowned' };\n }\n if (account.tenantId && principal.tenantId !== account.tenantId) {\n return { allowed: false, reason: 'tenant_mismatch' };\n }\n const currentTenant = getCurrentTenant()?.tenantId;\n if (currentTenant && currentTenant !== principal.tenantId) {\n return { allowed: false, reason: 'tenant_mismatch' };\n }\n if (principal.scopes && !principal.scopes.includes(scope)) {\n return { allowed: false, reason: 'ceiling' };\n }\n if (\n principal.accountIds &&\n (!account.id || !principal.accountIds.includes(account.id))\n ) {\n return { allowed: false, reason: 'ceiling' };\n }\n if (!owned) return { allowed: true, reason: 'unowned' };\n if (account.ownerUserId === principal.userId) {\n return { allowed: true, reason: 'owner' };\n }\n try {\n return (await hasGrant(config, principal, account, scope))\n ? { allowed: true, reason: 'grant' }\n : { allowed: false, reason: 'denied' };\n } catch {\n return { allowed: false, reason: 'denied' };\n }\n}\n\nexport async function canAccessMailAccount(\n account: MailAccessSubject,\n scope: MailScope,\n): Promise<boolean> {\n return (await decideMailAccess(account, scope)).allowed;\n}\n\nexport async function assertMailAccess(\n account: MailAccessSubject,\n scope: MailScope,\n): Promise<void> {\n const decision = await decideMailAccess(account, scope);\n if (!decision.allowed) throw new MailAccessError(scope, decision.reason);\n}\n\n/**\n * Ids of accounts in the current tenant context on which the current\n * principal lacks `scope`. Empty when nothing is configured or the call runs\n * in {@link runWithMailSystemAccess}.\n */\nexport async function deniedMailAccountIds(\n scope: MailScope,\n): Promise<string[]> {\n if (inMailSystemAccess()) return [];\n const { AccountCollection } = await import(\n './collections/AccountCollection.js'\n );\n const denied = new Set<string>();\n // Without a configured policy every database a mail collection has opened\n // is checked: ids are unique, so a union never hides the wrong thing.\n for (const config of getEffectiveMailAccessConfigs()) {\n let accounts: Awaited<\n ReturnType<InstanceType<typeof AccountCollection>['list']>\n >;\n try {\n accounts = await runWithMailSystemAccess(async () =>\n (await AccountCollection.create(config.options)).list({}),\n );\n } catch (error) {\n // A learned database that has since been closed holds nothing to read\n // through it; forget it. Any other failure stays fail-closed.\n if (!state().config && /CLIENT_CLOSED/.test(String(error))) {\n state().learned.delete(config.options.db ?? config.options);\n continue;\n }\n throw error;\n }\n const principal = await resolvePrincipal(config);\n for (const account of accounts) {\n if (!account.id) continue;\n const decision = await decideMailAccess(\n {\n id: account.id,\n tenantId: account.tenantId,\n ownerUserId: account.ownerUserId,\n },\n scope,\n principal,\n );\n if (!decision.allowed) denied.add(account.id);\n }\n }\n return [...denied];\n}\n\n/** Whether the current principal may read mail of `accountId` (empty: yes). */\nexport async function accountReadable(\n accountId: string | null | undefined,\n options: SmrtClassOptions | undefined,\n): Promise<boolean> {\n if (inMailSystemAccess()) return true;\n learnMailAccessOptions(options);\n if (!accountId) return true;\n const config = getEffectiveMailAccessConfig();\n if (!config) return true;\n const { AccountCollection } = await import(\n './collections/AccountCollection.js'\n );\n const account = await runWithMailSystemAccess(async () =>\n (await AccountCollection.create(config.options)).get({ id: accountId }),\n );\n // An account that cannot be found (deleted by another path, or outside this\n // tenant) must not turn its mail into tenant-wide mail: fail closed.\n if (!account) return false;\n return (\n await decideMailAccess(\n {\n id: account.id,\n tenantId: account.tenantId,\n ownerUserId: account.ownerUserId,\n },\n 'read',\n )\n ).allowed;\n}\n\n/**\n * Gate for direct hydration (`new Email({ id }).initialize()`,\n * `loadRelated('messageId')`), which bypasses collection read hooks: throws\n * when the loaded row belongs to an account closed to the principal.\n */\nexport async function assertHydratedMailAccess(row: {\n accountId?: string | null;\n messageId?: string | null;\n options?: unknown;\n}): Promise<void> {\n if (inMailSystemAccess()) return;\n const options = row.options as SmrtClassOptions | undefined;\n let accountId = row.accountId || null;\n if (!accountId && row.messageId && options) {\n const { MessageCollection } = await import(\n './collections/MessageCollection.js'\n );\n const message = await runWithMailSystemAccess(async () =>\n (await MessageCollection.create(options)).get({ id: row.messageId }),\n );\n if (!message) throw new MailAccessError('read', 'denied');\n accountId = message.accountId || null;\n }\n if (!(await accountReadable(accountId, options))) {\n throw new MailAccessError('read', 'denied');\n }\n}\n\n// ───────────────────────────────────────────────────────────────────────────\n// Grant administration\n// ───────────────────────────────────────────────────────────────────────────\n\nexport interface MailAccessAdmin {\n /** The acting user (`MailPrincipal.userId`). */\n userId: string;\n tenantId: string;\n /**\n * The host's label for the actor (`MailPrincipal.kind`). Only a person may\n * change an account's agent send policy; other operations ignore it.\n */\n kind?: string;\n}\n\nexport interface GrantMailAccessInput {\n accountId: string;\n /** The grantee's smrt-users `User` id (a person, or a host-mapped agent). */\n userId: string;\n scope: MailScope;\n effect?: 'grant' | 'deny';\n canDelegate?: boolean;\n /** For a delegated grant: the actor's own delegable grant. */\n parentGrantId?: string | null;\n}\n\n/**\n * Owner-controlled grant administration. Tenant RBAC (`messages.manage-access`)\n * is necessary but never sufficient: the actor must also own the account, or\n * delegate from their own delegable grant. A tenant administrator therefore\n * cannot read, grant themselves, or take over someone else's mailbox.\n */\nexport class MailAccessService {\n constructor(\n private readonly options: SmrtClassOptions,\n private readonly actor: MailAccessAdmin,\n ) {}\n\n private async account(accountId: string) {\n const { AccountCollection } = await import(\n './collections/AccountCollection.js'\n );\n const { withTenant } = await import('./host.js');\n return withTenant({ tenantId: this.actor.tenantId }, async () => {\n const collection = await AccountCollection.create(\n withoutListBounds(this.options),\n );\n const account = await collection.get({ id: accountId });\n if (!account || account.tenantId !== this.actor.tenantId) {\n throw new Error('Mail account was not found in this tenant.');\n }\n return account;\n });\n }\n\n /** Tenant RBAC ceiling for administering mail access (grants, owner). */\n private async assertManageAccess(): Promise<void> {\n const { assertOperationPermission } = await import(\n '@happyvertical/smrt-users'\n );\n await assertOperationPermission({\n ...this.options,\n collection: 'messages',\n action: 'manage-access',\n tenantId: this.actor.tenantId,\n userId: this.actor.userId,\n allowSuperAdminBypass: false,\n allowSystemContextBypass: false,\n onDeny: 'throw',\n });\n }\n\n /** The new owner must be a real, active member of this tenant. */\n private async assertTenantMember(userId: string): Promise<void> {\n const users = await import('@happyvertical/smrt-users');\n const memberships = await users.MembershipCollection.create(this.options);\n const rows = await memberships.list({\n where: { tenantId: this.actor.tenantId, userId, status: 'active' },\n limit: 1,\n });\n if (!rows.length) {\n throw new Error('The new owner must be an active member of this tenant.');\n }\n }\n\n private async inTenant<T>(fn: () => Promise<T>): Promise<T> {\n const { withTenant } = await import('./host.js');\n return withTenant({ tenantId: this.actor.tenantId }, fn);\n }\n\n private resourceFor(accountId: string) {\n return {\n tenantId: this.actor.tenantId,\n resourceType: MAIL_ACCOUNT_RESOURCE_TYPE,\n resourceId: accountId,\n };\n }\n\n private async grantsApi() {\n const users = await import('@happyvertical/smrt-users');\n const verifyResource = (resource: {\n tenantId: string;\n resourceType: string;\n resourceId: string;\n }) =>\n resource.tenantId === this.actor.tenantId &&\n resource.resourceType === MAIL_ACCOUNT_RESOURCE_TYPE;\n return { users, verifyResource };\n }\n\n grant(input: GrantMailAccessInput) {\n return this.inTenant(() => this.grantImpl(input));\n }\n\n revoke(grantId: string): Promise<void> {\n return this.inTenant(() => this.revokeImpl(grantId));\n }\n\n list(accountId: string) {\n return this.inTenant(() => this.listImpl(accountId));\n }\n\n setOwner(accountId: string, ownerUserId: string): Promise<void> {\n return this.inTenant(() => this.setOwnerImpl(accountId, ownerUserId));\n }\n\n /**\n * Set what happens when an agent sends from this mail account (smrt#5141).\n * Owner only, person only, and the tenant `messages.manage-access` ceiling.\n * Lowering to `require_approval` is instant (a kill switch); raising to\n * `auto_send` needs `confirmAutoSend: true`, like smrt-social's public latch.\n */\n setAgentSendPolicy(\n accountId: string,\n policy: AgentSendPolicy,\n options: { confirmAutoSend?: boolean } = {},\n ): Promise<void> {\n return this.inTenant(() =>\n this.setAgentSendPolicyImpl(accountId, policy, options),\n );\n }\n\n private async setAgentSendPolicyImpl(\n accountId: string,\n policy: AgentSendPolicy,\n options: { confirmAutoSend?: boolean },\n ): Promise<void> {\n if (policy !== 'require_approval' && policy !== 'auto_send') {\n throw new Error('Unknown agent send policy.');\n }\n if (!isPersonMailPrincipal(this.actor)) {\n throw new Error('Only a person can change the agent send policy.');\n }\n const account = await this.account(accountId);\n if (!('agentSendPolicy' in account)) {\n throw new Error('The agent send policy applies to mail accounts only.');\n }\n if (!account.ownerUserId || account.ownerUserId !== this.actor.userId) {\n throw new Error(\n 'Only the account owner can change the agent send policy.',\n );\n }\n await this.assertManageAccess();\n if (policy === 'auto_send' && options.confirmAutoSend !== true) {\n throw new Error(\n 'Letting agents send without approval needs explicit confirmation (confirmAutoSend).',\n );\n }\n const mail = account as typeof account & {\n agentSendPolicy: AgentSendPolicy | null;\n };\n mail.agentSendPolicy = policy;\n mail.updatedAt = new Date();\n await mail.save();\n }\n\n private async grantImpl(input: GrantMailAccessInput) {\n if (!isMailScope(input.scope)) throw new Error('Unknown mail scope.');\n const account = await this.account(input.accountId);\n if (!account.ownerUserId) {\n throw new Error('Set an owner on this mail account before sharing it.');\n }\n if (input.userId === this.actor.userId && !input.parentGrantId) {\n // Self-grants are meaningless for the owner and an escalation for\n // anyone else.\n throw new Error('A mail grant must name another user.');\n }\n const isOwner = account.ownerUserId === this.actor.userId;\n if (!isOwner && !input.parentGrantId) {\n throw new Error('Only the account owner can grant mail access.');\n }\n if (isOwner && input.parentGrantId) {\n throw new Error('An owner grants directly, not by delegation.');\n }\n if (!isOwner && (input.effect === 'deny' || input.canDelegate === true)) {\n // A delegate passes access on; they never block others or widen the chain.\n throw new Error(\n 'A delegate can only pass on a plain, non-delegable grant.',\n );\n }\n const { users, verifyResource } = await this.grantsApi();\n const service = new users.ResourceGrantService(this.options);\n return service.create({\n actor: {\n collection: 'messages',\n action: 'manage-access',\n tenantId: this.actor.tenantId,\n userId: this.actor.userId,\n allowSuperAdminBypass: false,\n allowSystemContextBypass: false,\n },\n authorization: {\n collection: 'messages',\n action: input.scope,\n tenantId: this.actor.tenantId,\n userId: this.actor.userId,\n allowSuperAdminBypass: false,\n allowSystemContextBypass: false,\n resource: this.resourceFor(input.accountId),\n verifyResource,\n },\n grant: {\n ...this.resourceFor(input.accountId),\n userId: input.userId,\n permission: mailScopePermission(input.scope),\n effect: input.effect ?? 'grant',\n canDelegate: input.canDelegate ?? false,\n parentGrantId: input.parentGrantId ?? null,\n },\n });\n }\n\n /** Revoke a grant. Delegated children stop working with their ancestor. */\n private async revokeImpl(grantId: string): Promise<void> {\n const { users, verifyResource } = await this.grantsApi();\n const grants = await users.ResourceGrantCollection.create(\n withoutListBounds(this.options),\n );\n const grant = await grants.get({ id: grantId });\n if (\n !grant ||\n grant.tenantId !== this.actor.tenantId ||\n grant.resourceType !== MAIL_ACCOUNT_RESOURCE_TYPE\n ) {\n throw new Error('Mail grant not found.');\n }\n const account = await this.account(grant.resourceId);\n if (account.ownerUserId !== this.actor.userId) {\n throw new Error('Only the account owner can revoke mail access.');\n }\n await new users.ResourceGrantService(this.options).revoke(grantId, {\n actor: {\n collection: 'messages',\n action: 'manage-access',\n tenantId: this.actor.tenantId,\n userId: this.actor.userId,\n allowSuperAdminBypass: false,\n allowSystemContextBypass: false,\n },\n verifyResource,\n });\n }\n\n /** Owner-only listing of who holds what on one account. */\n private async listImpl(accountId: string) {\n const account = await this.account(accountId);\n if (account.ownerUserId !== this.actor.userId) {\n throw new Error('Only the account owner can list mail access.');\n }\n await this.assertManageAccess();\n const { users } = await this.grantsApi();\n const grants = await users.ResourceGrantCollection.create(\n withoutListBounds(this.options),\n );\n const rows = await grants.list({\n where: {\n tenantId: this.actor.tenantId,\n resourceType: MAIL_ACCOUNT_RESOURCE_TYPE,\n resourceId: accountId,\n },\n });\n return rows.filter((grant) => grant.isActive());\n }\n\n /**\n * Set or change the owner. An owned account changes hands only by its\n * owner. An unowned account can be claimed by a tenant administrator\n * holding `messages.manage-credentials` (the migration path from\n * tenant-wide to owned).\n */\n private async setOwnerImpl(\n accountId: string,\n ownerUserId: string,\n ): Promise<void> {\n const account = await this.account(accountId);\n if (account.ownerUserId) {\n if (account.ownerUserId !== this.actor.userId) {\n throw new Error('Only the account owner can transfer ownership.');\n }\n await this.assertManageAccess();\n } else {\n const { assertOperationPermission } = await import(\n '@happyvertical/smrt-users'\n );\n await assertOperationPermission({\n ...this.options,\n collection: 'messages',\n action: 'manage-credentials',\n tenantId: this.actor.tenantId,\n userId: this.actor.userId,\n allowSuperAdminBypass: false,\n allowSystemContextBypass: false,\n onDeny: 'throw',\n });\n }\n await this.assertTenantMember(ownerUserId);\n // An opt-in to agent auto-send belongs to the owner who made it; a new\n // owner starts from the default (held for approval).\n if (account.ownerUserId !== ownerUserId && 'agentSendPolicy' in account) {\n (account as { agentSendPolicy: unknown }).agentSendPolicy = null;\n }\n account.ownerUserId = ownerUserId;\n account.updatedAt = new Date();\n await account.save();\n }\n}\n\nexport { MANAGE_MAIL_ACCESS_PERMISSION };\n","/**\n * Account model - Base class for all messaging account types (STI)\n *\n * Common fields shared across email, Slack, Twitter accounts, etc.\n */\n\n// Register the package manifest before this module's @smrt() decorator\n// runs, whichever chunk the library build places it in (#3098).\nimport '../__smrt-register__.js';\nimport {\n crossPackageRef,\n field,\n SmrtObject,\n smrt,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy/decorators';\nimport {\n createAccountSecretService,\n getCurrentTenant,\n withTenant,\n} from '../host.js';\nimport type { AccountOptions, MessageSenderInterface } from '../types';\n\n@TenantScoped({ mode: 'optional' })\n@smrt({\n tableStrategy: 'sti',\n api: { include: ['list', 'get'] },\n mcp: { include: ['list', 'get'] },\n cli: { include: ['list', 'get'] },\n})\nexport class Account extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-messages\";\n @tenantId({ nullable: true })\n tenantId: string | null = null;\n\n @field({\n description: 'The display name for this connected messaging account.',\n })\n name = '';\n @field({\n description: 'The service that connects this account to your application.',\n })\n providerType = '';\n @field({\n description:\n 'The kind of messaging this account supports, such as email or chat.',\n })\n channelType = '';\n // credentialSecretId stores the Secret's NAME (keyed by name + tenant\n // context in smrt-secrets), NOT its primary-key id — see setCredentials()/\n // getCredentials() which call tenant-bound SecretService operations by name.\n // So it is deliberately NOT a @crossPackageRef id FK.\n @field({ sensitive: true, readonly: true })\n credentialSecretId: string | null = null;\n @field({ description: 'Whether this account is enabled for messaging.' })\n isActive = true;\n /**\n * The person who owns this account. Optional at framework level: an account\n * with no owner keeps tenant-wide access. An app that wants private or\n * shared mailboxes sets it (and hardens it to required); see `access.ts`.\n */\n @crossPackageRef('@happyvertical/smrt-users:User')\n @field({\n description:\n 'The person who owns this account and decides who else may use it.',\n })\n ownerUserId: string | null = null;\n @field({\n description:\n 'A short name shown beside this account, such as Support or Personal.',\n })\n label: string | null = null;\n @field({\n description:\n 'Whether the saved sign-in still works: connected, or needs_reconnect after the server refused it.',\n })\n connectionStatus: string | null = null;\n @field({\n description: 'Why the account needs attention, in plain words.',\n })\n statusMessage: string | null = null;\n @field({ description: 'When this account last checked for new messages.' })\n lastSyncAt: Date | null = null;\n // JSON. Sensitive (#1540): may hold a plaintext credential fallback, so it is\n // excluded from generated API/MCP responses and rejected as a `where` filter\n // key.\n @field({ sensitive: true, readonly: true })\n settings = ''; // JSON\n /** Non-secret provider configuration such as a Zulip site URL. */\n @field({\n description:\n 'The public connection settings for this account; credentials are stored separately.',\n })\n configuration = '{}';\n\n // Timestamps\n @field({ description: 'When this account was added.' })\n createdAt = new Date();\n @field({ description: 'When this account was last changed.' })\n updatedAt = new Date();\n\n constructor(options: AccountOptions = {}) {\n super(options);\n\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n if (options.name !== undefined) this.name = options.name;\n if (options.providerType !== undefined)\n this.providerType = options.providerType;\n if (options.channelType !== undefined)\n this.channelType = options.channelType;\n if (options.credentialSecretId !== undefined)\n this.credentialSecretId = options.credentialSecretId || null;\n if (options.isActive !== undefined) this.isActive = options.isActive;\n if (options.ownerUserId !== undefined)\n this.ownerUserId = options.ownerUserId || null;\n if (options.label !== undefined) this.label = options.label || null;\n if (options.connectionStatus !== undefined)\n this.connectionStatus = options.connectionStatus || null;\n if (options.statusMessage !== undefined)\n this.statusMessage = options.statusMessage || null;\n if (options.lastSyncAt !== undefined)\n this.lastSyncAt = options.lastSyncAt || null;\n if (options.settings !== undefined) this.settings = options.settings;\n if (options.configuration !== undefined)\n this.configuration = options.configuration;\n if (options.createdAt) this.createdAt = options.createdAt;\n if (options.updatedAt) this.updatedAt = options.updatedAt;\n }\n\n /**\n * Get settings as parsed object\n */\n getSettings(): Record<string, unknown> {\n if (!this.settings) return {};\n try {\n return JSON.parse(this.settings);\n } catch {\n return {};\n }\n }\n\n /**\n * Set settings from object\n */\n setSettings(settings: Record<string, unknown>): void {\n this.settings = JSON.stringify(settings);\n }\n\n getConfiguration(): Record<string, unknown> {\n try {\n return JSON.parse(this.configuration || '{}');\n } catch {\n return {};\n }\n }\n\n setConfiguration(configuration: Record<string, unknown>): void {\n this.configuration = JSON.stringify(configuration);\n }\n\n get hasCredentials(): boolean {\n return Boolean(this.credentialSecretId || this.settings);\n }\n\n /** Whether this account needs its sign-in entered again. */\n get needsReconnect(): boolean {\n return this.connectionStatus === 'needs_reconnect';\n }\n\n /**\n * Record that the server refused this account's sign-in, so the host can ask\n * the owner to reconnect instead of failing every sync silently.\n */\n async markNeedsReconnect(reason: string): Promise<void> {\n this.connectionStatus = 'needs_reconnect';\n this.statusMessage = reason.slice(0, 200);\n this.updatedAt = new Date();\n await this.save();\n }\n\n /** Record a working sign-in (after connect, reconnect, or a good sync). */\n async markConnected(): Promise<void> {\n if (this.connectionStatus === 'connected' && !this.statusMessage) return;\n this.connectionStatus = 'connected';\n this.statusMessage = null;\n this.updatedAt = new Date();\n await this.save();\n }\n\n /**\n * Activate account\n */\n async activate(): Promise<void> {\n this.isActive = true;\n this.updatedAt = new Date();\n await this.save();\n }\n\n /**\n * Deactivate account\n */\n async deactivate(): Promise<void> {\n this.isActive = false;\n this.updatedAt = new Date();\n await this.save();\n }\n\n /**\n * Store credentials securely using smrt-secrets\n */\n async setCredentials(\n credentials: Record<string, unknown>,\n options: {\n description?: string;\n category?: string;\n } = {},\n ): Promise<void> {\n if (!this.id) {\n throw new Error('Account must be persisted before storing credentials.');\n }\n const secretService = await createAccountSecretService(this.db);\n\n const secretName = `${this.channelType || 'messaging'}-account-${this.id}`;\n const secretValue = JSON.stringify(credentials);\n const tenantId = this.requireCredentialTenantId('store credentials');\n\n await secretService.storeForTenant(\n tenantId,\n this.credentialSecretId || secretName,\n secretValue,\n {\n description: options.description || `Credentials for ${this.name}`,\n category: options.category || 'messaging',\n },\n );\n\n this.credentialSecretId ||= secretName;\n this.updatedAt = new Date();\n await this.withCredentialTenantContext(() => this.save());\n }\n\n /**\n * Delete the stored credential from smrt-secrets (used when the account is\n * removed, so a removed mailbox never leaves a live secret behind).\n */\n async removeCredentials(): Promise<void> {\n if (!this.credentialSecretId) return;\n const tenantId = this.requireCredentialTenantId('remove credentials');\n const secretService = await createAccountSecretService(this.db);\n const name = this.credentialSecretId;\n await withTenant({ tenantId }, () => secretService.delete(name));\n this.credentialSecretId = null;\n }\n\n /**\n * Create a sender for this account.\n * Subclasses must override to return a concrete sender.\n */\n async createSender(): Promise<MessageSenderInterface> {\n const { getMessagingProvider } = await import('../providers.js');\n const provider = getMessagingProvider(this.providerType);\n if (!provider?.createSender) {\n throw new Error(\n `createSender() not implemented for account type '${this.providerType}'`,\n );\n }\n return provider.createSender(this);\n }\n\n /**\n * Retrieve stored credentials\n */\n async getCredentials(): Promise<Record<string, unknown> | null> {\n if (!this.credentialSecretId) {\n return this.getSettings();\n }\n\n const tenantId = this.requireCredentialTenantId('retrieve credentials');\n const secretService = await createAccountSecretService(this.db);\n\n try {\n const secret = await secretService.retrieveForTenant(\n tenantId,\n this.credentialSecretId,\n );\n return JSON.parse(secret.value);\n } catch {\n return null;\n }\n }\n\n private getCredentialTenantId(): string | null {\n return this.tenantId || getCurrentTenant()?.tenantId || null;\n }\n\n private requireCredentialTenantId(action: string): string {\n const tenantId = this.getCredentialTenantId();\n if (!tenantId) {\n throw new Error(`Tenant context required to ${action}.`);\n }\n return tenantId;\n }\n\n private async withCredentialTenantContext<T>(\n fn: () => Promise<T>,\n ): Promise<T> {\n const tenantId = this.getCredentialTenantId();\n if (!tenantId || getCurrentTenant()?.tenantId === tenantId) return fn();\n return withTenant({ tenantId }, fn);\n }\n}\n","/**\n * Agent send policy and the held-send approval flow (smrt#5141, Epic I).\n *\n * An agent never sends mail as the account owner and, by default, never sends\n * at all without a person: when an agent principal calls `Message.send()` on a\n * mail account whose policy is `require_approval` (the default; null means\n * the same), the draft is held under a pending approval and nothing leaves\n * until a person holding `send` on that account approves it. `auto_send` is\n * the owner's explicit opt-in per account ({@link MailAccessService}\n * `setAgentSendPolicy`), or the host's per rule\n * ({@link MailSendApprovalConfig.resolveAgentSendPolicy}). Person sends, and\n * sends with no principal (sync, the notification outbox, unconfigured\n * hosts), are unaffected.\n *\n * Who is a person comes from the host: only `MailPrincipal.kind` `'person'`\n * or `'human'` counts (see {@link isPersonMailPrincipal}). Everything else,\n * including a missing label, is an agent.\n *\n * The approval itself lives in the generic approvals primitive\n * (`@happyvertical/smrt-approvals`). This package does not depend on it: the\n * host wires `createApprovalMailSendGate({ service })` from that package into\n * {@link configureMailSendApprovals}, which satisfies the structural\n * {@link MailSendApprovalGate} below. Without a gate, agent sends under\n * `require_approval` are refused (fail closed).\n *\n * Binding: a held send is bound to {@link mailSendBindingHash} of the stored\n * draft (recipients, sender, subject, bodies, threading headers, account and\n * the stored attachment rows). Any change after the request, including a new\n * attachment row, makes the approval unusable for the changed draft.\n *\n * @packageDocumentation\n */\n\nimport {\n getActiveAuditOptions,\n type SmrtClassOptions,\n} from '@happyvertical/smrt-core';\nimport {\n decideMailAccess,\n isPersonMailPrincipal,\n type MailPrincipal,\n resolveMailPrincipal,\n runWithMailSystemAccess,\n withoutListBounds,\n} from './access.js';\nimport { notificationSha256, withTenant } from './host.js';\nimport type { Account } from './models/Account.js';\nimport type { Message } from './models/Message.js';\nimport type {\n AgentSendPolicy,\n MessageSendResult,\n SendMessageOptions,\n} from './types.js';\n\n// ───────────────────────────────────────────────────────────────────────────\n// Structural gate (implemented by smrt-approvals' createApprovalMailSendGate)\n// ───────────────────────────────────────────────────────────────────────────\n\n/** An actor as the gate sees it. `id` is the smrt-users `User` id. */\nexport interface MailSendApprovalActor {\n id: string;\n /** Host label; only `person` or `human` can decide. */\n kind: string | null;\n /** Tenant permission slugs this package verified for the actor. */\n permissions?: readonly string[];\n}\n\n/** One held send as the gate reports it. */\nexport interface MailSendApprovalView {\n approvalId: string;\n messageId: string;\n status: string;\n bindingHash: string;\n requesterId: string;\n requesterType: string;\n consumed: boolean;\n live: boolean;\n /** Distinct person approvers of the bound revision. */\n approverIds: string[];\n}\n\nexport type MailSendApprovalOutcome =\n | { ok: true; view: MailSendApprovalView }\n | { ok: false; reason: string; view?: MailSendApprovalView };\n\n/**\n * `approved`: a person approved this revision and it waits for an approving\n * person to release it. `check` never consumes: the requester cannot send.\n */\nexport type MailSendApprovalCheckResult =\n | { state: 'approved'; approvalId: string; approverIds: string[] }\n | { state: 'pending'; approvalId: string; created: boolean }\n | { state: 'refused'; reason: string; approvalId?: string };\n\n/** What a host must wire in; smrt-approvals provides it. */\nexport interface MailSendApprovalGate {\n check(request: {\n tenantId: string;\n messageId: string;\n bindingHash: string;\n requester: MailSendApprovalActor;\n summary: string;\n }): Promise<MailSendApprovalCheckResult>;\n get(\n tenantId: string,\n approvalId: string,\n reader: MailSendApprovalActor,\n ): Promise<MailSendApprovalView | null>;\n decide(input: {\n tenantId: string;\n approvalId: string;\n decider: MailSendApprovalActor;\n decision: 'approve' | 'reject';\n reason?: string;\n expectedBindingHash: string;\n revisedBindingHash?: string;\n }): Promise<MailSendApprovalOutcome>;\n consume(input: {\n tenantId: string;\n approvalId: string;\n consumer: MailSendApprovalActor;\n bindingHash: string;\n verifyApprovers(approverIds: string[]): Promise<boolean>;\n }): Promise<MailSendApprovalOutcome>;\n}\n\n/** Host hook context for a per-rule policy. */\nexport interface AgentSendPolicyContext {\n account: Account;\n message: Message;\n /** Null for a persona route sent without a signed-in principal. */\n principal: MailPrincipal | null;\n}\n\nexport interface MailSendApprovalConfig {\n /** The approval gate. Without it, held agent sends are refused. */\n gate?: MailSendApprovalGate;\n /**\n * Per-rule override (for example a routing rule that opted in to\n * auto-send). Return a policy to use it, or null/undefined to fall back to\n * the account's `agentSendPolicy`. Host code only: never let a request\n * choose the result.\n */\n resolveAgentSendPolicy?: (\n context: AgentSendPolicyContext,\n ) =>\n | AgentSendPolicy\n | null\n | undefined\n | Promise<AgentSendPolicy | null | undefined>;\n}\n\n/** Tenant permission a person needs to approve a held send. */\nexport const APPROVE_HELD_SEND_PERMISSION = 'messages.send';\n\nconst STATE_KEY = Symbol.for('@happyvertical/smrt-messages:send-approval');\n\nfunction state(): { config: MailSendApprovalConfig | null } {\n const holder = globalThis as Record<symbol, unknown>;\n let current = holder[STATE_KEY] as\n | { config: MailSendApprovalConfig | null }\n | undefined;\n if (!current) {\n current = { config: null };\n holder[STATE_KEY] = current;\n }\n return current;\n}\n\n/** Wire the approval gate and optional per-rule policy hook. Call at startup. */\nexport function configureMailSendApprovals(\n config: MailSendApprovalConfig,\n): void {\n state().config = { ...config };\n}\n\n/** Remove the configuration (tests). Held agent sends are then refused. */\nexport function resetMailSendApprovals(): void {\n state().config = null;\n}\n\n// ───────────────────────────────────────────────────────────────────────────\n// Policy, binding and handled-by\n// ───────────────────────────────────────────────────────────────────────────\n\n/** Stamp who handled a message (not saved here). */\nexport function stampHandledBy(\n message: Message,\n principal: MailPrincipal | null,\n at: Date = new Date(),\n): void {\n if (!principal) return;\n message.handledById = principal.userId;\n message.handledByKind = isPersonMailPrincipal(principal) ? 'person' : 'agent';\n message.handledAt = at;\n}\n\n/** Who handled a thread: the latest handler first, then the others. */\nexport function threadHandledBy(\n messages: ReadonlyArray<\n Pick<Message, 'handledById' | 'handledByKind' | 'handledAt'>\n >,\n): Array<{ id: string; kind: string; at: Date | null }> {\n const latest = new Map<\n string,\n { id: string; kind: string; at: Date | null }\n >();\n for (const message of messages) {\n if (!message.handledById) continue;\n const at = message.handledAt ? new Date(message.handledAt) : null;\n const seen = latest.get(message.handledById);\n if (!seen || (at && (!seen.at || at.getTime() > seen.at.getTime()))) {\n latest.set(message.handledById, {\n id: message.handledById,\n kind: message.handledByKind || 'agent',\n at,\n });\n }\n }\n return [...latest.values()].sort(\n (a, b) => (b.at?.getTime() ?? 0) - (a.at?.getTime() ?? 0),\n );\n}\n\n/**\n * Record a mail action through the host's audit context\n * (`withAuditContext()` from smrt-core), when one is active: the host's\n * trusted actor id, the action (for example `messages.send.held`) and the\n * message. A writer failure propagates, so an unauditable action fails.\n * Mail models are not `audit: true`: that would demand a writer on every\n * sync and outbox write, which an app that does not audit mail never has.\n */\nexport async function auditMailAction(\n action: string,\n message: Message,\n changes: Record<string, { before: unknown; after: unknown }> = {},\n): Promise<void> {\n const audit = getActiveAuditOptions();\n if (!audit?.writer || !audit.actorId?.trim()) return;\n await audit.writer(\n {\n actorId: audit.actorId,\n reason: audit.reason,\n source: audit.source,\n onBehalfOfId: audit.onBehalfOfId ?? null,\n action,\n resourceType: '@happyvertical/smrt-messages:Message',\n resourceId: String(message.id ?? ''),\n tenantId: message.tenantId ?? null,\n changes,\n },\n message.db,\n );\n}\n\n/**\n * The policy for one agent send: the host's per-rule answer if it gives\n * one, else the account's `agentSendPolicy`. Anything but an explicit\n * `auto_send` is `require_approval`. Accounts without the field (non-mail\n * channels) are not governed and return null.\n */\nexport async function effectiveAgentSendPolicy(\n account: Account,\n message: Message,\n principal: MailPrincipal | null,\n): Promise<AgentSendPolicy | null> {\n if (!('agentSendPolicy' in account)) return null;\n const hook = state().config?.resolveAgentSendPolicy;\n if (hook) {\n const ruled = await hook({ account, message, principal });\n if (ruled === 'auto_send' || ruled === 'require_approval') return ruled;\n }\n return (account as Account & { agentSendPolicy?: string | null })\n .agentSendPolicy === 'auto_send'\n ? 'auto_send'\n : 'require_approval';\n}\n\nfunction readField(source: object, name: string): unknown {\n const value = (source as Record<string, unknown>)[name];\n // Storage normalizes an empty optional reference to null; so does the hash.\n return value === undefined || value === '' ? null : value;\n}\n\ntype AttachmentRowLike = {\n id?: string | null;\n filename: string;\n contentType: string;\n size: number;\n contentId: string;\n contentDisposition: string;\n filePath: string;\n sourceUrl: string;\n};\n\n/** One attachment row and its bytes, as bound into a held send. */\nfunction attachmentBinding(\n row: AttachmentRowLike,\n bytes: Uint8Array | null,\n): unknown[] {\n let content: string | null = null;\n if (row.filePath) content = bytes ? notificationSha256(bytes) : 'unreadable';\n return [\n row.id,\n row.filename,\n row.contentType,\n row.size,\n row.contentId,\n row.contentDisposition,\n row.filePath,\n row.sourceUrl,\n content,\n ];\n}\n\nfunction sortBindings(bound: unknown[][]): unknown[][] {\n return bound.sort((a, b) => String(a[0]).localeCompare(String(b[0])));\n}\n\n// The attachment rows and bytes an approval released, per message instance,\n// checked by `EmailSender` against exactly what it hands the transport.\nconst approvedAttachments = new WeakMap<Message, string>();\n\n/**\n * Called by `EmailSender` with the stored rows and the bytes it is about to\n * transmit. For a send an approval released, refuses (throws) unless they\n * are exactly the approved rows and bytes. A no-op for other sends.\n */\nexport function assertApprovedAttachments(\n message: Message,\n sent: Array<{ row: AttachmentRowLike; content: Uint8Array | null }>,\n): void {\n const expected = approvedAttachments.get(message);\n if (expected === undefined) return;\n approvedAttachments.delete(message);\n const actual = JSON.stringify(\n sortBindings(\n sent.map(({ row, content }) => attachmentBinding(row, content)),\n ),\n );\n if (actual !== expected) {\n throw new Error(\n 'The attachments changed after the send was approved; nothing was sent.',\n );\n }\n}\n\n/**\n * Hash of everything a send transmits for `message`, from the given\n * instance's fields plus the stored attachment rows. Compare it only between\n * two reads of the same message.\n */\nexport async function mailSendBindingHash(\n message: Message,\n snapshot?: { attachments?: unknown[][] },\n): Promise<string> {\n const fields = [\n 'accountId',\n 'fromAddress',\n 'fromName',\n 'toAddresses',\n 'ccAddresses',\n 'bccAddresses',\n 'subject',\n 'body',\n 'textBody',\n 'htmlBody',\n 'inReplyTo',\n 'inReplyToMessageId',\n 'threadId',\n 'headers',\n ].map((name) => [name, readField(message, name)]);\n const attachments = message.id\n ? await runWithMailSystemAccess(async () => {\n const { AttachmentCollection } = await import(\n './collections/AttachmentCollection.js'\n );\n const rows = await (\n await AttachmentCollection.create(\n withoutListBounds(message.options) as never,\n )\n ).list({ where: { messageId: message.id } });\n const bound: unknown[][] = [];\n for (const row of rows) {\n // Bind the bytes, not just the path: a file rewritten in place\n // after approval must not leave under the approval.\n bound.push(\n attachmentBinding(\n row,\n row.filePath ? await row.readContent() : null,\n ),\n );\n }\n return sortBindings(bound);\n })\n : [];\n if (snapshot) snapshot.attachments = attachments;\n return notificationSha256(\n JSON.stringify({ v: 2, id: message.id ?? null, fields, attachments }),\n );\n}\n\n/** A fresh read of the stored message, bypassing the read policy. */\nasync function loadStored(\n options: SmrtClassOptions,\n messageId: string,\n): Promise<Message | null> {\n return await runWithMailSystemAccess(async () => {\n const { MessageCollection } = await import(\n './collections/MessageCollection.js'\n );\n return (await (\n await MessageCollection.create(options as never)\n ).get({\n id: messageId,\n })) as Message | null;\n });\n}\n\nfunction actorOf(\n principal: MailPrincipal,\n permissions: readonly string[] = [],\n): MailSendApprovalActor {\n return {\n id: principal.userId,\n kind: isPersonMailPrincipal(principal) ? 'person' : 'agent',\n permissions,\n };\n}\n\n/**\n * Whether `userId` holds the tenant `messages.send` permission (smrt-users\n * RBAC, no super-admin or system bypass). Needed on every account: an\n * unowned account's per-account decision ('unowned') checks no permission.\n */\nasync function holdsTenantSend(\n options: SmrtClassOptions,\n tenantId: string,\n userId: string,\n): Promise<boolean> {\n try {\n const { checkOperationPermission } = await import(\n '@happyvertical/smrt-users'\n );\n const decision = await checkOperationPermission({\n ...(withoutListBounds(options) as SmrtClassOptions),\n collection: 'messages',\n action: 'send',\n tenantId,\n userId,\n allowSuperAdminBypass: false,\n allowSystemContextBypass: false,\n } as never);\n return decision.allowed;\n } catch {\n return false;\n }\n}\n\n/**\n * Every counted approver must be a person who holds the tenant\n * `messages.send` permission and `send` on the account, now.\n */\nfunction approverVerifier(account: Account, options: SmrtClassOptions) {\n return async (approverIds: string[]): Promise<boolean> => {\n if (approverIds.length === 0 || !account.tenantId) return false;\n for (const id of approverIds) {\n if (!(await holdsTenantSend(options, account.tenantId, id))) return false;\n const decision = await decideMailAccess(\n {\n id: account.id,\n tenantId: account.tenantId,\n ownerUserId: account.ownerUserId,\n },\n 'send',\n {\n id,\n userId: id,\n tenantId: String(account.tenantId),\n kind: 'person',\n },\n );\n if (!decision.allowed) return false;\n }\n return true;\n };\n}\n\n// The binding an approval released, per message instance, re-checked by\n// `Message.send()` after it claims the row and before the provider handoff.\nconst approvedBindings = new WeakMap<Message, string>();\n\n/** Remember the approved binding for `message`'s next send. */\nfunction markApprovedBinding(message: Message, bindingHash: string): void {\n approvedBindings.set(message, bindingHash);\n}\n\n/**\n * Called by `Message.send()` after its claim: true when this send was\n * released by an approval and the draft (fields or attachment rows) no longer\n * matches it. Clears the marker either way.\n */\nexport async function approvedDraftChanged(message: Message): Promise<boolean> {\n const expected = approvedBindings.get(message);\n if (expected === undefined) return false;\n approvedBindings.delete(message);\n const snapshot: { attachments?: unknown[][] } = {};\n if ((await mailSendBindingHash(message, snapshot)) !== expected) return true;\n approvedAttachments.set(message, JSON.stringify(snapshot.attachments ?? []));\n return false;\n}\n\nfunction refusedResult(error: string): MessageSendResult {\n return { success: false, error, sentAt: new Date() };\n}\n\n/**\n * Called by `Message.send()` after the `send` scope check. Returns null when\n * the send may go ahead, or the result to return instead (held or refused).\n * Never sends and never changes the draft's content.\n */\nexport async function holdAgentSend(\n message: Message,\n account: Account,\n options: SendMessageOptions | undefined,\n principal: MailPrincipal | null,\n): Promise<MessageSendResult | null> {\n // An approving person's release (MailSendApprovalService) is re-checked\n // against the approved binding after the claim, never held again.\n if (approvedBindings.has(message)) return null;\n const gate = state().config?.gate;\n // A persona route is an agent send whoever invoked it.\n const persona = message.personaId ? String(message.personaId) : null;\n if (!persona && isPersonMailPrincipal(principal)) return null;\n // Without a principal and without a gate the host never opted in to\n // attributed mail (persona routes included): unchanged behaviour. Sync and\n // the outbox run under system access and never reach this.\n if (!principal && !gate) return null;\n const policy = await effectiveAgentSendPolicy(account, message, principal);\n if (policy === null || policy === 'auto_send') return null;\n\n if (!gate) {\n return refusedResult(\n \"Agent sends from this mailbox need a person's approval, and no approval gate is configured.\",\n );\n }\n if (!principal && !persona) {\n return refusedResult(\n 'A send from this mailbox needs a signed-in person or agent.',\n );\n }\n const requester: MailSendApprovalActor = persona\n ? { id: `persona:${persona}`, kind: 'agent' }\n : { id: (principal as MailPrincipal).userId, kind: 'agent' };\n const tenantId = message.tenantId ?? account.tenantId;\n if (!tenantId || !message.id || !message.isPersisted) {\n return refusedResult(\n 'Save the draft in a tenant before submitting it for approval.',\n );\n }\n if (\n (options as { attachments?: unknown[] } | undefined)?.attachments?.length\n ) {\n // Send-time bytes are not stored, so no person could review them and\n // nothing could bind them once this call returns. Store them as\n // Attachment rows on the message (bound byte for byte) instead.\n return refusedResult(\n 'A held send cannot carry send-time attachments; store them as attachments on the message.',\n );\n }\n // Bind the stored draft, and refuse when the caller's copy differs from it:\n // a person approves what is stored, so nothing else may leave.\n const stored = await loadStored(\n message.options as SmrtClassOptions,\n message.id,\n );\n if (!stored || stored.tenantId !== message.tenantId) {\n return refusedResult('The draft was not found.');\n }\n const bindingHash = await mailSendBindingHash(stored);\n if ((await mailSendBindingHash(message)) !== bindingHash) {\n return refusedResult(\n 'The draft has unsaved changes; save it before submitting it for approval.',\n );\n }\n // Approval rows are readable tenant-wide; never copy mail content into\n // them. A decider reads the draft through MailSendApprovalService.get().\n const summary = 'An agent asked to send an email.';\n const checked = await gate.check({\n tenantId,\n messageId: message.id,\n bindingHash,\n requester,\n summary,\n });\n if (checked.state === 'approved') {\n // Approved sends leave only when an approving person releases them.\n return {\n success: false,\n error: 'Approved; it is sent when the approving person releases it.',\n pendingApproval: { approvalId: checked.approvalId, created: false },\n sentAt: new Date(),\n };\n }\n if (checked.state === 'refused') {\n return refusedResult(`The send was not approved (${checked.reason}).`);\n }\n if (checked.created) {\n await auditMailAction('messages.send.held', message, {\n approval: { before: null, after: checked.approvalId },\n });\n }\n return {\n success: false,\n error: 'Waiting for a person to approve this send.',\n pendingApproval: {\n approvalId: checked.approvalId,\n created: checked.created,\n },\n sentAt: new Date(),\n };\n}\n\n// ───────────────────────────────────────────────────────────────────────────\n// The person's side: approve, edit-then-approve, reject\n// ───────────────────────────────────────────────────────────────────────────\n\n/** Edits a person makes before approving (edit-then-approve). */\nexport interface HeldSendEdits {\n subject?: string;\n body?: string;\n textBody?: string;\n htmlBody?: string;\n toAddresses?: Array<{ address: string; name?: string }>;\n ccAddresses?: Array<{ address: string; name?: string }>;\n bccAddresses?: Array<{ address: string; name?: string }>;\n}\n\nexport type HeldSendDecisionResult =\n | { state: 'sent'; approvalId: string; result: MessageSendResult }\n | { state: 'pending'; approvalId: string }\n | { state: 'rejected'; approvalId: string }\n | { state: 'refused'; approvalId: string; reason: string };\n\nexport class HeldSendError extends Error {\n readonly status: number;\n constructor(\n readonly reason: string,\n message: string,\n status = 403,\n ) {\n super(message);\n this.name = 'HeldSendError';\n this.status = status;\n }\n}\n\n/**\n * The person's side of a held send. The acting principal comes from the\n * host's mail access resolver; it must be a person holding `read` and `send`\n * on the draft's account. Approving sends the draft as that person.\n */\nexport class MailSendApprovalService {\n constructor(private readonly options: SmrtClassOptions) {}\n\n private async context(approvalId: string) {\n const gate = state().config?.gate;\n if (!gate) {\n throw new HeldSendError(\n 'not_configured',\n 'No approval gate is configured.',\n 409,\n );\n }\n const principal = await resolveMailPrincipal();\n if (!principal)\n throw new HeldSendError('no_principal', 'Sign in first.', 401);\n if (!isPersonMailPrincipal(principal)) {\n throw new HeldSendError(\n 'not_person',\n 'Only a person can decide a held send.',\n );\n }\n return await withTenant({ tenantId: principal.tenantId }, async () => {\n const view = await gate.get(\n principal.tenantId,\n approvalId,\n actorOf(principal),\n );\n if (!view)\n throw new HeldSendError('not_found', 'Held send not found.', 404);\n const message = await loadStored(this.options, view.messageId);\n if (!message || message.tenantId !== principal.tenantId) {\n throw new HeldSendError('not_found', 'Held send not found.', 404);\n }\n const account = await message.getAccount();\n if (!account || account.tenantId !== principal.tenantId) {\n throw new HeldSendError('not_found', 'Held send not found.', 404);\n }\n // Only an unsent draft (or a definitely failed send) can be decided:\n // edits must never rewrite a message that left or may have left.\n const retryable =\n message.sendStatus === 'failed' && !message.isSendOutcomeUnknown();\n if (message.sendStatus !== 'draft' && !retryable) {\n throw new HeldSendError(\n 'not_a_draft',\n `The message is already ${message.sendStatus}.`,\n 409,\n );\n }\n // The tenant permission is checked explicitly: on an unowned account\n // the per-account decision is 'unowned' and checks none.\n if (\n !(await holdsTenantSend(\n this.options,\n principal.tenantId,\n principal.userId,\n ))\n ) {\n throw new HeldSendError(\n 'forbidden',\n \"Deciding this send needs the 'messages.send' permission.\",\n );\n }\n for (const scope of ['read', 'send'] as const) {\n const decision = await decideMailAccess(account, scope, principal);\n if (!decision.allowed) {\n throw new HeldSendError(\n 'forbidden',\n `Deciding this send needs '${scope}' on the mailbox.`,\n );\n }\n }\n return { gate, principal, view, message, account };\n });\n }\n\n /** The held send and its draft, for a person who could decide it. */\n async get(approvalId: string) {\n const { view, message } = await this.context(approvalId);\n return { view, message };\n }\n\n /**\n * Approve (optionally with edits) and, once the approval is complete, send\n * the draft as the approving person. Edits are bound into the approval\n * (edit-then-approve) before they are saved, so nothing but the reviewed\n * revision can be released.\n */\n async approve(\n approvalId: string,\n input: { edits?: HeldSendEdits; reason?: string } = {},\n ): Promise<HeldSendDecisionResult> {\n const { gate, principal, view, message, account } =\n await this.context(approvalId);\n return await withTenant({ tenantId: principal.tenantId }, async () => {\n const tenantId = principal.tenantId;\n const requested = await mailSendBindingHash(message);\n if (requested !== view.bindingHash) {\n return {\n state: 'refused',\n approvalId,\n reason: 'draft_changed',\n } as const;\n }\n let revisedHash: string | undefined;\n if (input.edits && Object.keys(input.edits).length > 0) {\n applyEdits(message, input.edits);\n stampHandledBy(message, principal);\n revisedHash = await mailSendBindingHash(message);\n if (revisedHash === requested) revisedHash = undefined;\n }\n const decided = await gate.decide({\n tenantId,\n approvalId,\n decider: actorOf(principal, [APPROVE_HELD_SEND_PERMISSION]),\n decision: 'approve',\n reason: input.reason,\n expectedBindingHash: requested,\n ...(revisedHash ? { revisedBindingHash: revisedHash } : {}),\n });\n if (!decided.ok) {\n return {\n state: 'refused',\n approvalId,\n reason: decided.reason,\n } as const;\n }\n await auditMailAction(\n revisedHash\n ? 'messages.send.approved-with-edits'\n : 'messages.send.approved',\n message,\n { approval: { before: approvalId, after: decided.view.status } },\n );\n if (revisedHash) {\n // Persist exactly the revision that was approved. A concurrent write\n // to the draft makes the stored hash differ and consume refuses.\n await runWithMailSystemAccess(() => message.save());\n }\n if (decided.view.status !== 'approved') {\n return { state: 'pending', approvalId } as const;\n }\n return await this.releaseAs(\n gate,\n principal,\n account,\n approvalId,\n message,\n );\n });\n }\n\n /**\n * Send an already approved draft (for example approved through a generic\n * approvals inbox) as one of the people who approved it. Single use.\n */\n async release(approvalId: string): Promise<HeldSendDecisionResult> {\n const { gate, principal, view, message, account } =\n await this.context(approvalId);\n if (view.status !== 'approved' || view.consumed || !view.live) {\n return { state: 'refused', approvalId, reason: 'not_releasable' };\n }\n if (!view.approverIds.includes(principal.userId)) {\n return { state: 'refused', approvalId, reason: 'not_an_approver' };\n }\n return await withTenant({ tenantId: principal.tenantId }, () =>\n this.releaseAs(gate, principal, account, approvalId, message),\n );\n }\n\n /** Reject a held send. The draft stays a draft; the reason is audited. */\n async reject(\n approvalId: string,\n reason: string,\n ): Promise<HeldSendDecisionResult> {\n if (!reason?.trim()) {\n throw new HeldSendError('invalid', 'A rejection needs a reason.', 400);\n }\n const { gate, principal, view, message } = await this.context(approvalId);\n const decided = await gate.decide({\n tenantId: principal.tenantId,\n approvalId,\n decider: actorOf(principal, [APPROVE_HELD_SEND_PERMISSION]),\n decision: 'reject',\n reason,\n expectedBindingHash: view.bindingHash,\n });\n if (!decided.ok) {\n return { state: 'refused', approvalId, reason: decided.reason };\n }\n await auditMailAction('messages.send.rejected', message, {\n approval: { before: approvalId, after: 'rejected' },\n });\n return { state: 'rejected', approvalId };\n }\n\n /** Consume a complete approval and send the stored draft as the person. */\n private async releaseAs(\n gate: MailSendApprovalGate,\n principal: MailPrincipal,\n account: Account,\n approvalId: string,\n approved: Message,\n ): Promise<HeldSendDecisionResult> {\n if (!approved.id) {\n return { state: 'refused', approvalId, reason: 'not_found' };\n }\n const message = await loadStored(this.options, approved.id);\n if (!message) return { state: 'refused', approvalId, reason: 'not_found' };\n const bindingHash = await mailSendBindingHash(message);\n const used = await gate.consume({\n tenantId: principal.tenantId,\n approvalId,\n consumer: actorOf(principal),\n bindingHash,\n verifyApprovers: approverVerifier(account, this.options),\n });\n if (!used.ok) return { state: 'refused', approvalId, reason: used.reason };\n // The person sends: person sends are not held. `send()` claims the row\n // against the revision just hashed and re-checks the binding (attachment\n // rows included) after the claim, so a concurrent edit sends nothing.\n markApprovedBinding(message, bindingHash);\n const result = await message.send();\n return { state: 'sent', approvalId, result };\n }\n}\n\nfunction applyEdits(message: Message, edits: HeldSendEdits): void {\n const target = message as Message & Record<string, unknown>;\n if (edits.subject !== undefined) target.subject = edits.subject;\n if (edits.body !== undefined) {\n target.body = edits.body;\n // The sender transmits textBody before body: keep them together.\n if (edits.textBody === undefined && 'textBody' in target)\n target.textBody = edits.body;\n }\n if (edits.textBody !== undefined && 'textBody' in target)\n target.textBody = edits.textBody;\n if (edits.htmlBody !== undefined && 'htmlBody' in target)\n target.htmlBody = edits.htmlBody;\n if (edits.toAddresses !== undefined)\n target.toAddresses = JSON.stringify(edits.toAddresses);\n if (edits.ccAddresses !== undefined && 'ccAddresses' in target)\n target.ccAddresses = JSON.stringify(edits.ccAddresses);\n if (edits.bccAddresses !== undefined && 'bccAddresses' in target)\n target.bccAddresses = JSON.stringify(edits.bccAddresses);\n target.updatedAt = new Date();\n}\n","/**\n * Cursor-based incremental mailbox sync (Epic I, #5130).\n *\n * `EmailAccount.syncChanges()` drives the mail server's change feed\n * (`EmailClient.getChanges()`, implemented by the JMAP adapter). The feed\n * cursor is opaque. Each batch is applied first and the cursor is saved only\n * afterwards, so a failed batch is simply fetched again, and applying a batch\n * twice is harmless because every row is keyed on the server's message id.\n * A `resync-required` answer clears the cursor and starts a full pass.\n *\n * Exactly one sync runs per account at a time (one lane per account): the\n * background job is deduplicated per account (see `mail-sync-jobs.ts`) and\n * direct calls queue behind each other inside this process.\n *\n * @packageDocumentation\n */\n\nimport type {\n ChangeFeedBatch,\n EmailClient,\n EmailMessage,\n Folder,\n} from '@happyvertical/email';\nimport { ObjectRegistry } from '@happyvertical/smrt-core';\nimport type { EmailCollection } from './collections/EmailCollection';\nimport type { EmailFolderCollection } from './collections/EmailFolderCollection';\nimport type { Email } from './models/Email';\nimport type { EmailAccount } from './models/EmailAccount';\nimport type { EmailFolder } from './models/EmailFolder';\n\nexport interface MailSyncOptions {\n /** Messages requested per batch. Default 100. */\n limit?: number;\n /** Most batches one run applies before stopping with `hasMore`. Default 500. */\n maxBatches?: number;\n /**\n * Store no message dated before this (a `Date` or an ISO string, so it\n * survives a job's JSON args). Overrides `EmailAccount.backfillSince` for\n * this run; `null` lifts the account's horizon. Messages already stored are\n * still updated.\n */\n since?: Date | string | null;\n}\n\nexport type MailSyncSkipReason = 'inactive' | 'needs-reconnect' | 'unsupported';\n\nexport interface MailSyncResult {\n /** `skipped` runs touched nothing (no client was built for closed accounts). */\n status: 'synced' | 'skipped';\n skipped?: MailSyncSkipReason;\n batches: number;\n added: number;\n changed: number;\n removed: number;\n /** The server rejected the saved cursor and a full pass was started. */\n resynced: boolean;\n /** The run stopped at `maxBatches` with more changes waiting. */\n hasMore: boolean;\n /** Messages left out because they are dated before the backfill horizon. */\n beforeHorizon: number;\n duration: number;\n}\n\nconst DEFAULT_LIMIT = 100;\nconst DEFAULT_MAX_BATCHES = 500;\nconst PRUNE_PAGE = 500;\n\n// One lane per account within this process; across processes the job dedupe\n// slot keeps a single sync job per account.\nconst lanes = new Map<string, Promise<unknown>>();\n\nexport async function inLane<T>(\n accountId: string,\n run: () => Promise<T>,\n): Promise<T> {\n const previous = lanes.get(accountId) ?? Promise.resolve();\n const next = previous.then(run, run);\n const tail = next.catch(() => undefined);\n lanes.set(accountId, tail);\n try {\n return await next;\n } finally {\n if (lanes.get(accountId) === tail) lanes.delete(accountId);\n }\n}\n\n/** Copy a server message onto an Email row. Shared by every sync path. */\nexport function applyServerMessage(\n email: Email,\n msg: EmailMessage,\n location: { folderId: string; folderPath: string },\n options: { keepBodies?: boolean; deriveState?: boolean } = {},\n): void {\n email.messageId = msg.messageId || '';\n email.threadId = msg.threadId || '';\n email.inReplyTo = msg.inReplyTo || '';\n email.fromAddress = msg.from?.address || '';\n email.fromName = msg.from?.name || '';\n email.toAddresses = JSON.stringify(msg.to || []);\n email.ccAddresses = JSON.stringify(msg.cc || []);\n email.bccAddresses = JSON.stringify(msg.bcc || []);\n email.replyToAddress = msg.replyTo?.address || '';\n email.replyToName = msg.replyTo?.name || '';\n email.subject = msg.subject || '';\n email.date = msg.date || null;\n // A metadata-only change (flags, folder move) must not blank a stored body.\n const metadataOnly =\n options.keepBodies && msg.text === undefined && msg.html === undefined;\n if (!metadataOnly) {\n email.textBody = msg.text || '';\n email.htmlBody = msg.html || '';\n email.body = msg.text || '';\n }\n email.folderId = location.folderId;\n email.folderPath = location.folderPath;\n email.labels = JSON.stringify(msg.labels || []);\n email.flags = JSON.stringify(msg.flags || []);\n email.hasAttachments =\n (msg.attachments && msg.attachments.length > 0) || false;\n email.size = msg.size || 0;\n email.headers = JSON.stringify(msg.headers || {});\n email.updatedAt = new Date();\n if (options.deriveState) {\n const flags = new Set((msg.flags || []).map((f) => f.toLowerCase()));\n email.isRead = flags.has('\\\\seen');\n email.isFlagged = flags.has('\\\\flagged');\n email.isAnswered = flags.has('\\\\answered');\n email.isDraft = flags.has('\\\\draft');\n }\n}\n\n/**\n * JMAP folders are mailboxes a message may sit in several at once; keep them\n * all as labels when the server sent no provider labels. Shared by sync and\n * triage write-back so both store a server message identically.\n */\nexport function withMailboxLabels(msg: EmailMessage): EmailMessage {\n return msg.labels?.length || !msg.folders?.length\n ? msg\n : { ...msg, labels: msg.folders };\n}\n\nexport interface SyncContext {\n account: EmailAccount;\n accountId: string;\n emails: EmailCollection;\n folders: EmailFolderCollection;\n childOptions: Record<string, unknown>;\n /** folder path -> folder row id */\n folderIds: Map<string, string>;\n /** Backfill horizon in effect for this run, if any. */\n horizon?: Date | null;\n /** Messages skipped for being older than the horizon. */\n beforeHorizon?: number;\n}\n\nexport async function ensureFolder(\n ctx: SyncContext,\n path: string,\n details: Partial<Folder> = {},\n): Promise<string> {\n let folder: EmailFolder | null = await ctx.folders.getByPath(\n ctx.accountId,\n path,\n );\n if (!folder) {\n const { EmailFolder: EmailFolderModel } = await import(\n './models/EmailFolder'\n );\n folder = new (ObjectRegistry.resolveEffectiveConstructor(EmailFolderModel))(\n {\n ...ctx.childOptions,\n accountId: ctx.accountId,\n name: details.name || path,\n path,\n },\n );\n await folder.initialize();\n }\n if (details.name !== undefined) folder.name = details.name;\n if (details.delimiter !== undefined) folder.delimiter = details.delimiter;\n folder.specialUse = details.specialUse ?? folder.specialUse ?? '';\n if (details.subscribed !== undefined) folder.subscribed = details.subscribed;\n folder.updatedAt = new Date();\n await folder.save();\n const id = folder.id ?? '';\n ctx.folderIds.set(path, id);\n return id;\n}\n\nexport async function folderIdFor(\n ctx: SyncContext,\n path: string,\n): Promise<string> {\n if (!path) return '';\n return ctx.folderIds.get(path) ?? (await ensureFolder(ctx, path));\n}\n\nasync function findByProviderId(\n ctx: SyncContext,\n providerMessageId: string,\n): Promise<Email[]> {\n return (await ctx.emails.list({\n where: { accountId: ctx.accountId, providerMessageId },\n })) as Email[];\n}\n\nasync function upsertMessage(\n ctx: SyncContext,\n msg: EmailMessage,\n touched: Set<string>,\n isChange: boolean,\n): Promise<void> {\n if (!msg.id)\n throw new Error('Mail change feed returned a message without an id');\n const [existing] = await findByProviderId(ctx, msg.id);\n if (\n !existing &&\n ctx.horizon &&\n msg.date &&\n new Date(msg.date).getTime() < ctx.horizon.getTime()\n ) {\n ctx.beforeHorizon = (ctx.beforeHorizon ?? 0) + 1;\n return;\n }\n const folderPath = msg.folder ?? msg.folders?.[0] ?? '';\n const folderId = await folderIdFor(ctx, folderPath);\n let email = existing;\n if (!email) {\n const { Email: EmailModel } = await import('./models/Email');\n email = new (ObjectRegistry.resolveEffectiveConstructor(EmailModel))({\n ...ctx.childOptions,\n accountId: ctx.accountId,\n });\n await email.initialize();\n } else if (email.folderId) {\n touched.add(email.folderId);\n }\n email.providerMessageId = msg.id;\n applyServerMessage(\n email,\n withMailboxLabels(msg),\n { folderId, folderPath },\n { keepBodies: isChange, deriveState: true },\n );\n await email.save();\n if (folderId) touched.add(folderId);\n}\n\nasync function removeMessages(\n ctx: SyncContext,\n ids: string[],\n touched: Set<string>,\n): Promise<number> {\n let removed = 0;\n for (const id of ids) {\n for (const email of await findByProviderId(ctx, id)) {\n if (email.folderId) touched.add(email.folderId);\n await email.delete();\n removed++;\n }\n }\n return removed;\n}\n\n/** Drop stored messages the server no longer has after a complete full pass. */\nasync function pruneUnseen(\n ctx: SyncContext,\n seen: Set<string>,\n touched: Set<string>,\n): Promise<number> {\n let removed = 0;\n for (let offset = 0; ; offset += PRUNE_PAGE) {\n const page = (await ctx.emails.list({\n where: { accountId: ctx.accountId },\n limit: PRUNE_PAGE,\n offset,\n })) as Email[];\n for (const email of page) {\n if (!email.providerMessageId || seen.has(email.providerMessageId))\n continue;\n if (email.folderId) touched.add(email.folderId);\n await email.delete();\n removed++;\n offset--; // the next row slid into this slot\n }\n if (page.length < PRUNE_PAGE) return removed;\n }\n}\n\nexport async function refreshCounts(\n ctx: SyncContext,\n folderIds: Set<string>,\n): Promise<void> {\n for (const folderId of folderIds) {\n const folder = await ctx.folders.get({ id: folderId });\n if (!folder) continue;\n folder.messageCount = await ctx.emails.countByFolder(folderId);\n folder.unreadCount = await ctx.emails.countUnreadByFolder(folderId);\n await folder.save();\n }\n}\n\n/**\n * Recompute every folder's counts from the stored messages. A batch that\n * deleted or moved messages and then failed before refreshCounts() leaves its\n * mutations persisted but the cursor unmoved; on replay those rows are gone or\n * already moved, so the folders they left never enter `touched`. Reconciling\n * every folder up front repairs that.\n */\nasync function reconcileAllCounts(ctx: SyncContext): Promise<void> {\n const folders = (await ctx.folders.list({\n where: { accountId: ctx.accountId },\n })) as Array<{ id?: string }>;\n await refreshCounts(\n ctx,\n new Set(folders.map((f) => f.id).filter((id): id is string => !!id)),\n );\n}\n\nasync function applyBatch(\n ctx: SyncContext,\n batch: ChangeFeedBatch,\n seen: Set<string> | null,\n): Promise<{\n added: number;\n changed: number;\n removed: number;\n touched: Set<string>;\n}> {\n const touched = new Set<string>();\n for (const folder of batch.folders ?? []) {\n await ensureFolder(ctx, folder.path, folder);\n }\n for (const msg of batch.added) {\n await upsertMessage(ctx, msg, touched, false);\n if (seen && msg.id) seen.add(msg.id);\n }\n for (const msg of batch.changed) {\n await upsertMessage(ctx, msg, touched, true);\n if (seen && msg.id) seen.add(msg.id);\n }\n const removed = await removeMessages(ctx, batch.removed, touched);\n return {\n added: batch.added.length,\n changed: batch.changed.length,\n removed,\n touched,\n };\n}\n\n/** Whether `next` reaches back further than the horizon a cursor was built under. */\nfunction widensHorizon(\n built: Date | null,\n next: Date | null | undefined,\n): boolean {\n if (!built) return false; // built unbounded: nothing was dropped\n if (!next) return true;\n return next.getTime() < new Date(built).getTime();\n}\n\nfunction resolveHorizon(\n since: MailSyncOptions['since'],\n stored: Date | null,\n): Date | null {\n const value = since === undefined ? stored : since;\n if (!value) return null;\n const date = new Date(value);\n if (Number.isNaN(date.getTime())) {\n throw new Error(`Invalid mail backfill horizon: ${String(value)}`);\n }\n return date;\n}\n\n/** Copy the fields a sync run changes (and the revision token) onto `target`. */\nfunction mirrorAccountState(from: EmailAccount, to: EmailAccount): void {\n to.syncCursor = from.syncCursor;\n to.cursorHorizon = from.cursorHorizon;\n to.lastSyncAt = from.lastSyncAt;\n to.connectionStatus = from.connectionStatus;\n to.statusMessage = from.statusMessage;\n to.lastSyncError = from.lastSyncError;\n to.backlog = from.backlog;\n to.isActive = from.isActive;\n to.updatedAt = from.updatedAt;\n (to as unknown as { updated_at: unknown }).updated_at = (\n from as unknown as { updated_at: unknown }\n ).updated_at;\n}\n\nasync function persistCursor(\n account: EmailAccount,\n cursor: string | null,\n horizon: Date | null = null,\n): Promise<void> {\n account.syncCursor = cursor;\n // The cursor now covers mail as far back as this horizon (null: everything).\n account.cursorHorizon = horizon;\n account.updatedAt = new Date();\n await account.save();\n}\n\nexport async function rethrowAfterAuthCheck(\n account: EmailAccount,\n error: unknown,\n isAuthFailure: (e: unknown) => boolean,\n options: { recordError?: boolean } = {},\n): Promise<never> {\n const err = error instanceof Error ? error : new Error(String(error));\n if (options.recordError) {\n // Persist why the run failed; never touches connectionStatus here.\n account.lastSyncError = err.message.slice(0, 500);\n account.updatedAt = new Date();\n await account.save().catch(() => undefined);\n }\n if (isAuthFailure(err)) {\n // The server refused the saved sign-in: ask the owner to reconnect, and\n // tell the job runner that retrying cannot help.\n await account.markNeedsReconnect(err.message).catch(() => undefined);\n (err as Error & { retryable?: boolean }).retryable = false;\n }\n throw err;\n}\n\n/**\n * Sync one account from its server's change feed. See the module comment;\n * call `EmailAccount.syncChanges()` rather than this directly.\n */\nexport async function syncMailChanges(\n source: EmailAccount,\n options: MailSyncOptions = {},\n deps: {\n createClient: (account: EmailAccount) => Promise<EmailClient>;\n childOptions: Record<string, unknown>;\n isAuthFailure: (error: unknown) => boolean;\n },\n): Promise<MailSyncResult> {\n if (!source.id) {\n throw new Error('EmailAccount.syncChanges requires a persisted account');\n }\n const accountId = source.id;\n return inLane(accountId, async () => {\n const startedAt = Date.now();\n const result: MailSyncResult = {\n status: 'synced',\n batches: 0,\n added: 0,\n changed: 0,\n removed: 0,\n resynced: false,\n hasMore: false,\n beforeHorizon: 0,\n duration: 0,\n };\n const skip = (reason: MailSyncSkipReason): MailSyncResult => ({\n ...result,\n status: 'skipped',\n skipped: reason,\n duration: Date.now() - startedAt,\n });\n\n // Another run in this lane may have moved the cursor or closed the\n // account since the caller loaded it, and the row is revision-guarded: work\n // on the stored row, and copy the outcome back onto the caller's instance.\n const { EmailAccountCollection } = await import(\n './collections/EmailAccountCollection'\n );\n const accounts = await EmailAccountCollection.create(deps.childOptions);\n const account =\n ((await accounts.get({ id: accountId })) as EmailAccount | null) ??\n source;\n try {\n return await runLane(account);\n } finally {\n if (account !== source) mirrorAccountState(account, source);\n }\n\n async function runLane(account: EmailAccount): Promise<MailSyncResult> {\n if (!account.isActive) return skip('inactive');\n if (account.needsReconnect) return skip('needs-reconnect');\n\n const limit = options.limit ?? DEFAULT_LIMIT;\n const maxBatches = options.maxBatches ?? DEFAULT_MAX_BATCHES;\n let client: EmailClient | undefined;\n try {\n client = await deps.createClient(account);\n await client.connect();\n if (typeof client.getChanges !== 'function') return skip('unsupported');\n\n const { EmailCollection: EmailCollectionClass } = await import(\n './collections/EmailCollection'\n );\n const { EmailFolderCollection: FolderCollectionClass } = await import(\n './collections/EmailFolderCollection'\n );\n const ctx: SyncContext = {\n account,\n accountId,\n emails: await EmailCollectionClass.create(deps.childOptions),\n folders: await FolderCollectionClass.create(deps.childOptions),\n childOptions: deps.childOptions,\n folderIds: new Map(),\n horizon: resolveHorizon(options.since, account.backfillSince),\n beforeHorizon: 0,\n };\n\n await reconcileAllCounts(ctx);\n\n // A saved cursor is past mail the horizon it was built under dropped.\n // Widening or clearing the horizon must refetch that mail: restart\n // with a full pass (which also prunes). Narrowing needs nothing.\n if (\n account.syncCursor &&\n widensHorizon(account.cursorHorizon, ctx.horizon)\n ) {\n await persistCursor(account, null, ctx.horizon);\n }\n let cursor: string | undefined = account.syncCursor || undefined;\n // A pass that starts without a cursor sees every server message, so what\n // it did not see is gone; a resumed pass cannot know and never prunes.\n let seen: Set<string> | null = cursor === undefined ? new Set() : null;\n\n while (result.batches < maxBatches) {\n const next = await client.getChanges({\n cursor,\n limit,\n includeBodies: true,\n });\n // (not the SDK's isResyncRequired: this module must not load the email SDK)\n if (next.status === 'resync-required') {\n if (result.resynced) {\n throw new Error(\n `Mail server asked for a second resync in one run (${next.reason})`,\n );\n }\n result.resynced = true;\n cursor = undefined;\n seen = new Set();\n await persistCursor(account, null, ctx.horizon);\n continue;\n }\n\n const applied = await applyBatch(ctx, next, seen);\n result.batches++;\n result.added += applied.added;\n result.changed += applied.changed;\n result.removed += applied.removed;\n if (seen && next.initial && !next.hasMore) {\n result.removed += await pruneUnseen(ctx, seen, applied.touched);\n }\n await refreshCounts(ctx, applied.touched);\n\n // Only now is the batch durable: the cursor may move past it.\n await persistCursor(account, next.cursor, ctx.horizon ?? null);\n cursor = next.cursor;\n if (!next.hasMore) break;\n if (result.batches >= maxBatches) result.hasMore = true;\n }\n\n result.beforeHorizon = ctx.beforeHorizon ?? 0;\n account.lastSyncAt = new Date();\n account.connectionStatus = 'connected';\n account.statusMessage = null;\n account.lastSyncError = null;\n account.backlog = result.hasMore;\n account.updatedAt = new Date();\n await account.save();\n result.duration = Date.now() - startedAt;\n return result;\n } catch (error) {\n return rethrowAfterAuthCheck(account, error, deps.isAuthFailure, {\n recordError: true,\n });\n } finally {\n await client?.disconnect().catch(() => undefined);\n }\n }\n });\n}\n","/**\n * Triage write-back (Epic I, #5131): mark read or unread, star, archive,\n * spam, label and move, written to the mail server first and to the local row\n * second.\n *\n * `EmailAccount.triage()` (or `Email.triage()`) is the entry point. The rules:\n *\n * - Access first. The acting principal needs both `read` and `triage` on the\n * message's account (`decideMailAccess`, fail closed). Nothing is sent to\n * the server or written locally for a refused call.\n * - Server first. The provider's write-back call runs before any row changes.\n * The result is per message: the local row is updated only for ids the\n * server accepted, and every refusal is reported in `failed`.\n * - The local row is the server's own word. After the server accepts an id the\n * message is read back and stored exactly as sync stores it, so the next\n * sync of the same message is a no-op and cannot flap. If the read-back\n * fails the id is reported in `stale` and the next sync fixes the row.\n * - Triage runs in the account's sync lane, so in this process it never\n * interleaves with a sync of the same account.\n * - Idempotent: every write-back operation is absolute (set or clear), so\n * repeating a call changes nothing.\n * - Providers without the matching `writeBack` capability fail with\n * {@link MailWriteBackUnsupportedError} before anything is changed.\n *\n * @packageDocumentation\n */\n\nimport type {\n EmailClient,\n EmailClientCapabilities,\n EmailMessage,\n WriteBackResult,\n} from '@happyvertical/email';\nimport {\n assertMailAccess,\n inMailSystemAccess,\n MailAccessError,\n resolveMailPrincipal,\n runWithMailSystemAccess,\n} from './access.js';\nimport type { EmailCollection } from './collections/EmailCollection.js';\nimport type { EmailFolderCollection } from './collections/EmailFolderCollection.js';\nimport {\n applyServerMessage,\n folderIdFor,\n inLane,\n refreshCounts,\n rethrowAfterAuthCheck,\n type SyncContext,\n withMailboxLabels,\n} from './mail-sync.js';\nimport type { Email } from './models/Email.js';\nimport type { EmailAccount } from './models/EmailAccount.js';\nimport { auditMailAction, stampHandledBy } from './send-approval.js';\n\n/** What to do to the selected messages. */\nexport type MailTriageAction =\n | { kind: 'markRead' }\n | { kind: 'markUnread' }\n | { kind: 'star' }\n | { kind: 'unstar' }\n /** Out of the inbox and into the archive; other labels are kept. */\n | { kind: 'archive' }\n /** Into the junk mailbox, flagged as spam. */\n | { kind: 'markSpam' }\n /** Back to the inbox, flagged as not spam. */\n | { kind: 'unmarkSpam' }\n /** Add mailbox/label membership (paths as stored on `EmailFolder`, names, ids). */\n | { kind: 'addLabels'; labels: string[] }\n | { kind: 'removeLabels'; labels: string[] }\n /** Make `folder` the only mailbox a message is in. */\n | { kind: 'move'; folder: string };\n\nexport type MailTriageActionKind = MailTriageAction['kind'];\n\n/** The `writeBack` capability each action needs. */\nexport type MailWriteBackCapability = 'flags' | 'labels' | 'archive' | 'spam';\n\nconst ACTION_CAPABILITY: Record<MailTriageActionKind, MailWriteBackCapability> =\n {\n markRead: 'flags',\n markUnread: 'flags',\n star: 'flags',\n unstar: 'flags',\n archive: 'archive',\n markSpam: 'spam',\n unmarkSpam: 'spam',\n addLabels: 'labels',\n removeLabels: 'labels',\n move: 'labels',\n };\n\nconst CAPABILITY_METHOD = {\n flags: 'updateFlags',\n labels: 'updateLabels',\n archive: 'archive',\n spam: 'markSpam',\n} as const;\n\n/** Thrown, before anything is changed, when the provider cannot do the action. */\nexport class MailWriteBackUnsupportedError extends Error {\n readonly code = 'WRITE_BACK_UNSUPPORTED';\n constructor(\n readonly action: MailTriageActionKind,\n readonly capability: MailWriteBackCapability,\n readonly providerType: string,\n ) {\n super(\n `Mail provider '${providerType}' cannot write '${action}' back to the server (no '${capability}' write-back).`,\n );\n this.name = 'MailWriteBackUnsupportedError';\n }\n}\n\nexport interface MailTriageFailure {\n /** The local `Email` row id. */\n id: string;\n /**\n * `notFound` (no such row on this account), `notSynced` (the row has no\n * server id yet), or the server's own code (`notFound`, `forbidden`, ...).\n */\n code: string;\n message?: string;\n}\n\nexport interface MailTriageResult {\n action: MailTriageActionKind;\n accountId: string;\n /** Local `Email` row ids the server accepted and whose rows now match it. */\n updated: string[];\n /** Ids that were refused, or never reached the server. Nothing changed for these. */\n failed: MailTriageFailure[];\n /**\n * Ids the server accepted but whose row could not be refreshed. The server is\n * right and the row is behind; the next sync corrects it.\n */\n stale: string[];\n /**\n * Set when the server refused the saved sign-in after earlier work already\n * landed: the account is now marked for reconnection and the partial result\n * is still returned rather than thrown away.\n */\n needsReconnect?: boolean;\n}\n\nexport interface MailTriageDeps {\n createClient: (account: EmailAccount) => Promise<EmailClient>;\n childOptions: Record<string, unknown>;\n isAuthFailure: (error: unknown) => boolean;\n}\n\nfunction parseLabels(email: Email): string[] {\n const labels = email.getLabels();\n return labels.length > 0\n ? labels\n : email.folderPath\n ? [email.folderPath]\n : [];\n}\n\nfunction assertValid(action: MailTriageAction): void {\n if (!(action.kind in ACTION_CAPABILITY)) {\n throw new TypeError(\n `Unknown triage action '${(action as { kind: string }).kind}'`,\n );\n }\n const names =\n action.kind === 'addLabels' || action.kind === 'removeLabels'\n ? action.labels\n : action.kind === 'move'\n ? [action.folder]\n : null;\n if (\n names &&\n (!Array.isArray(names) ||\n names.length === 0 ||\n names.some((n) => typeof n !== 'string' || !n.trim()))\n ) {\n throw new TypeError(\n `Triage action '${action.kind}' needs at least one non-empty label or folder name`,\n );\n }\n}\n\nfunction requireCapability(\n action: MailTriageActionKind,\n client: EmailClient,\n capabilities: EmailClientCapabilities,\n providerType: string,\n): void {\n const capability = ACTION_CAPABILITY[action];\n const method = CAPABILITY_METHOD[capability];\n if (\n !capabilities.writeBack?.[capability] ||\n typeof client[method] !== 'function'\n ) {\n throw new MailWriteBackUnsupportedError(action, capability, providerType);\n }\n}\n\n/**\n * Resolve a requested mailbox against the account's known folders: exact path,\n * then case-insensitive path, then a unique case-insensitive display name.\n * Unknown names pass through for the server to judge.\n */\nasync function resolveMailbox(\n folders: EmailFolderCollection,\n accountId: string,\n requested: string,\n): Promise<string> {\n const wanted = requested.trim();\n const known = await folders.getByAccount(accountId);\n const lower = wanted.toLowerCase();\n const exact = known.find((f) => f.path === wanted);\n if (exact?.path) return exact.path;\n const byPath = known.filter((f) => f.path?.toLowerCase() === lower);\n if (byPath.length === 1 && byPath[0].path) return byPath[0].path;\n const byName = known.filter((f) => f.name?.toLowerCase() === lower);\n if (byName.length === 1 && byName[0].path) return byName[0].path;\n return wanted;\n}\n\n/** One server call: the provider ids it covers, and how to make it. */\ninterface Call {\n ids: string[];\n run: () => Promise<WriteBackResult>;\n /** Never touches the server (nothing to change there). */\n local?: boolean;\n}\n\nfunction plan(\n action: MailTriageAction,\n client: EmailClient,\n rows: Map<string, Email>,\n destination: string | null,\n): Call[] {\n const ids = [...rows.keys()];\n switch (action.kind) {\n case 'markRead':\n return [\n { ids, run: () => client.updateFlags!(ids, { add: ['\\\\Seen'] }) },\n ];\n case 'markUnread':\n return [\n { ids, run: () => client.updateFlags!(ids, { remove: ['\\\\Seen'] }) },\n ];\n case 'star':\n return [\n { ids, run: () => client.updateFlags!(ids, { add: ['\\\\Flagged'] }) },\n ];\n case 'unstar':\n return [\n { ids, run: () => client.updateFlags!(ids, { remove: ['\\\\Flagged'] }) },\n ];\n case 'archive':\n return [{ ids, run: () => client.archive!(ids) }];\n case 'markSpam':\n return [{ ids, run: () => client.markSpam!(ids, true) }];\n case 'unmarkSpam':\n return [{ ids, run: () => client.markSpam!(ids, false) }];\n case 'addLabels': {\n const add = [...new Set(action.labels)];\n return [{ ids, run: () => client.updateLabels!(ids, { add }) }];\n }\n case 'removeLabels': {\n const remove = [...new Set(action.labels)];\n return [{ ids, run: () => client.updateLabels!(ids, { remove }) }];\n }\n case 'move': {\n // Each message leaves the mailboxes it is in now; messages with the same\n // current mailboxes share one call.\n const target = destination ?? action.folder;\n const groups = new Map<string, { remove: string[]; ids: string[] }>();\n const inPlace: string[] = [];\n for (const [id, row] of rows) {\n const labels = parseLabels(row);\n const remove = labels.filter((label) => label !== target).sort();\n if (remove.length === 0 && labels.includes(target)) {\n inPlace.push(id); // already exactly there: nothing to tell the server\n continue;\n }\n const key = JSON.stringify(remove);\n const group = groups.get(key) ?? { remove, ids: [] };\n group.ids.push(id);\n groups.set(key, group);\n }\n const calls: Call[] = [...groups.values()].map((group) => ({\n ids: group.ids,\n run: () =>\n client.updateLabels!(group.ids, {\n add: [target],\n ...(group.remove.length > 0 ? { remove: group.remove } : {}),\n }),\n }));\n if (inPlace.length > 0) {\n calls.unshift({\n ids: inPlace,\n local: true,\n run: async () => ({ updated: inPlace, failed: [] }),\n });\n }\n return calls;\n }\n }\n}\n\n/**\n * Write a triage action for `emailIds` (local `Email` row ids of `account`) to\n * the server, then update the accepted rows. See the module comment; call\n * `EmailAccount.triage()` rather than this directly.\n */\nexport async function triageMailMessages(\n suppliedAccount: EmailAccount,\n action: MailTriageAction,\n emailIds: readonly string[],\n deps: MailTriageDeps,\n): Promise<MailTriageResult> {\n if (!suppliedAccount.id) {\n throw new Error('EmailAccount.triage requires a persisted account');\n }\n const accountId = suppliedAccount.id;\n let account = suppliedAccount;\n assertValid(action);\n // Fail closed before touching anything. Triage acts on what the principal\n // can see, so it takes the read scope as well as the triage scope.\n await assertMailAccess(account, 'read');\n await assertMailAccess(account, 'triage');\n // Recorded as \"handled by\" on each row the server accepted.\n const actor = inMailSystemAccess() ? null : await resolveMailPrincipal();\n\n const result: MailTriageResult = {\n action: action.kind,\n accountId,\n updated: [],\n failed: [],\n stale: [],\n };\n const requested = [...new Set(emailIds)];\n if (requested.length === 0) return result;\n\n return inLane(accountId, async () => {\n // The caller's instance may be stale: the account can have been claimed,\n // transferred or had a grant revoked while this call waited for the lane.\n // Re-authorize against the stored row before any server call or write.\n const { EmailAccountCollection: AccountCollectionClass } = await import(\n './collections/EmailAccountCollection.js'\n );\n const stored = (await runWithMailSystemAccess(async () =>\n (\n await AccountCollectionClass.create(deps.childOptions)\n ).get({\n id: accountId,\n }),\n )) as EmailAccount | null;\n if (!stored?.id) throw new MailAccessError('read', 'denied');\n await assertMailAccess(stored, 'read');\n await assertMailAccess(stored, 'triage');\n account = stored;\n if (!account.isActive || !suppliedAccount.isActive) {\n throw new Error('Mail account is inactive');\n }\n if (account.needsReconnect || suppliedAccount.needsReconnect) {\n throw new Error('Mail account needs to be reconnected');\n }\n return runWithMailSystemAccess(async () => {\n const { EmailCollection: EmailCollectionClass } = await import(\n './collections/EmailCollection.js'\n );\n const { EmailFolderCollection: FolderCollectionClass } = await import(\n './collections/EmailFolderCollection.js'\n );\n const emails: EmailCollection = await EmailCollectionClass.create(\n deps.childOptions,\n );\n const folders: EmailFolderCollection = await FolderCollectionClass.create(\n deps.childOptions,\n );\n\n // Which rows can go to the server at all.\n const rows = new Map<string, Email>(); // provider id -> row\n const byLocalId = new Map<string, Email>();\n for (const id of requested) {\n const row = (await emails.get({ id })) as Email | null;\n if (!row || row.accountId !== accountId) {\n result.failed.push({ id, code: 'notFound' });\n } else if (!row.providerMessageId) {\n result.failed.push({\n id,\n code: 'notSynced',\n message: 'The message has not been synced from the server yet',\n });\n } else if (rows.has(row.providerMessageId)) {\n result.failed.push({\n id,\n code: 'duplicate',\n message: 'Another selected row has the same server id',\n });\n } else {\n rows.set(row.providerMessageId, row);\n byLocalId.set(id, row);\n }\n }\n\n const client = await deps.createClient(account);\n try {\n await client.connect();\n requireCapability(\n action.kind,\n client,\n await client.getCapabilities(),\n account.providerType,\n );\n if (rows.size === 0) return result;\n\n const destination =\n action.kind === 'move'\n ? await resolveMailbox(folders, accountId, action.folder)\n : null;\n\n const ctx: SyncContext = {\n account,\n accountId,\n emails,\n folders,\n childOptions: deps.childOptions,\n folderIds: new Map(),\n };\n const touched = new Set<string>();\n const accepted = new Set<string>();\n\n const calls = plan(action, client, rows, destination);\n let firstError: unknown;\n let authError: unknown;\n let completed = 0;\n for (const call of calls) {\n let outcome: WriteBackResult;\n if (authError) {\n outcome = { updated: [], failed: [] };\n for (const id of call.ids)\n outcome.failed.push({\n id,\n code: 'skipped',\n message: 'Not attempted: the server refused the sign-in',\n });\n } else {\n try {\n outcome = await call.run();\n if (!call.local) completed++;\n } catch (error) {\n // Earlier calls were already applied on the server: report this\n // call's ids as failed and carry on, never lose the rest.\n firstError ??= error;\n if (deps.isAuthFailure(error)) authError = error;\n outcome = { updated: [], failed: [] };\n for (const id of call.ids)\n outcome.failed.push({\n id,\n code: 'serverError',\n message: 'The server call failed before reporting an outcome',\n });\n }\n }\n const wanted = new Set(call.ids);\n const settled = new Set<string>();\n for (const providerId of outcome.updated) {\n if (!wanted.has(providerId) || settled.has(providerId)) continue;\n settled.add(providerId);\n accepted.add(providerId);\n }\n for (const failure of outcome.failed) {\n const row = rows.get(failure.id);\n if (!row?.id || settled.has(failure.id) || !wanted.has(failure.id))\n continue;\n settled.add(failure.id);\n result.failed.push({\n id: row.id,\n code: failure.code,\n ...(failure.message ? { message: failure.message } : {}),\n });\n }\n for (const providerId of call.ids) {\n if (settled.has(providerId)) continue;\n const row = rows.get(providerId);\n if (!row?.id) continue;\n result.failed.push({\n id: row.id,\n code: 'unknown',\n message: 'Server did not report an outcome for this message',\n });\n }\n }\n\n // The server accepted these: store each as the server now has it.\n let readBackAuthError: unknown;\n for (const providerId of accepted) {\n const row = rows.get(providerId);\n if (!row?.id) continue;\n if (readBackAuthError) {\n // The sign-in was refused: the server applied it, the row lags.\n result.stale.push(row.id);\n continue;\n }\n try {\n if (row.folderId) touched.add(row.folderId);\n const fresh: EmailMessage = await client.getMessage(providerId);\n const folderPath = fresh.folder ?? fresh.folders?.[0] ?? '';\n const folderId = folderPath\n ? await folderIdFor(ctx, folderPath)\n : '';\n applyServerMessage(\n row,\n withMailboxLabels(fresh),\n { folderId, folderPath },\n { keepBodies: true, deriveState: true },\n );\n stampHandledBy(row, actor);\n await row.save();\n if (actor)\n await auditMailAction(`messages.triage.${action.kind}`, row);\n if (folderId) touched.add(folderId);\n result.updated.push(row.id);\n } catch (error) {\n result.stale.push(row.id);\n if (deps.isAuthFailure(error)) readBackAuthError = error;\n }\n }\n if (touched.size > 0) await refreshCounts(ctx, touched).catch(() => {});\n // Nothing reached the server: surface the cause as an error.\n if (firstError && completed === 0) throw firstError;\n const lateAuthError = authError ?? readBackAuthError;\n if (lateAuthError) {\n // Earlier work landed on the server: keep the result and flag the\n // reconnect rather than throwing the outcome away.\n const err =\n lateAuthError instanceof Error\n ? lateAuthError\n : new Error(String(lateAuthError));\n await account.markNeedsReconnect(err.message).catch(() => undefined);\n result.needsReconnect = true;\n }\n return result;\n } catch (error) {\n return rethrowAfterAuthCheck(account, error, deps.isAuthFailure);\n } finally {\n await client.disconnect().catch(() => undefined);\n }\n });\n });\n}\n","/**\n * AccountCollection - Unified collection for polymorphic account queries\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { queryGlobal, queryWithGlobals } from '../host.js';\nimport { Account } from '../models/Account';\nimport type { AccountSearchFilters } from '../types';\n\nexport class AccountCollection extends SmrtCollection<Account> {\n static readonly _itemClass = Account;\n\n /**\n * Get active accounts\n */\n async getActive(): Promise<Account[]> {\n return await this.list({ where: { isActive: true } });\n }\n\n /**\n * Get inactive accounts\n */\n async getInactive(): Promise<Account[]> {\n return await this.list({ where: { isActive: false } });\n }\n\n /**\n * Get accounts by provider type\n */\n async getByProviderType(providerType: string): Promise<Account[]> {\n return await this.list({ where: { providerType } });\n }\n\n /**\n * Get accounts by STI type.\n *\n * Accepts either the full discriminator (e.g. \"@happyvertical/smrt-messages:EmailAccount\")\n * or the short type name (e.g. \"EmailAccount\").\n */\n async getByType(accountType: string): Promise<Account[]> {\n if (accountType.includes(':') || accountType.startsWith('@')) {\n return await this.list({ where: { _meta_type: accountType } });\n }\n const allAccounts = await this.list({});\n return allAccounts.filter((a) => {\n const metaType = (a as { _meta_type?: string })._meta_type || '';\n return metaType.endsWith(`:${accountType}`);\n });\n }\n\n /**\n * Search accounts with filters\n */\n async search(\n query: string,\n filters?: AccountSearchFilters,\n ): Promise<Account[]> {\n let accounts = await this.list({});\n\n if (query) {\n const lowerQuery = query.toLowerCase();\n accounts = accounts.filter((a) =>\n a.name?.toLowerCase().includes(lowerQuery),\n );\n }\n\n if (filters) {\n if (filters.providerType) {\n accounts = accounts.filter(\n (a) => a.providerType === filters.providerType,\n );\n }\n if (filters.isActive !== undefined) {\n accounts = accounts.filter((a) => a.isActive === filters.isActive);\n }\n if (filters.accountType) {\n accounts = accounts.filter((a) => {\n const metaType = (a as { _meta_type?: string })._meta_type || '';\n return metaType.includes(filters.accountType as string);\n });\n }\n }\n\n return accounts;\n }\n\n /**\n * Get account statistics\n */\n async getStats(): Promise<{\n total: number;\n active: number;\n inactive: number;\n byType: Record<string, number>;\n }> {\n const accounts = await this.list({});\n const byType: Record<string, number> = {};\n\n for (const account of accounts) {\n const metaType =\n (account as { _meta_type?: string })._meta_type || 'Unknown';\n const shortType = metaType.split(':').pop() || metaType;\n byType[shortType] = (byType[shortType] || 0) + 1;\n }\n\n return {\n total: accounts.length,\n active: accounts.filter((a) => a.isActive).length,\n inactive: accounts.filter((a) => !a.isActive).length,\n byType,\n };\n }\n\n // ─────────────────────────────────────────────────────────────────────────\n // Tenant Helper Methods\n // ─────────────────────────────────────────────────────────────────────────\n\n async findByTenant(tenantId: string): Promise<Account[]> {\n return this.list({ where: { tenantId } });\n }\n\n // Account is the @TenantScoped STI base — see MessageCollection. Route through\n // the raw helpers; no `_meta_type` so the base returns ALL account subtypes.\n async findGlobal(): Promise<Account[]> {\n return queryGlobal<Account>(this);\n }\n\n async findWithGlobals(tenantId: string): Promise<Account[]> {\n return queryWithGlobals<Account>(this, tenantId, 'Account.findWithGlobals');\n }\n}\n","/**\n * EmailAccount model - Email account extending the Account STI base\n *\n * Retains email-specific fields and sync capability.\n */\n\n// Register the package manifest before this module's @smrt() decorator\n// runs, whichever chunk the library build places it in (#3098).\nimport '../__smrt-register__.js';\nimport type { FetchOptions, GetEmailClientOptions } from '@happyvertical/email';\nimport { field, ObjectRegistry, smrt } from '@happyvertical/smrt-core';\nimport { runWithMailSystemAccess } from '../access.js';\nimport {\n applyServerMessage,\n type MailSyncOptions,\n type MailSyncResult,\n} from '../mail-sync.js';\nimport {\n type MailTriageAction,\n type MailTriageResult,\n triageMailMessages,\n} from '../mail-triage.js';\nimport type {\n AgentSendPolicy,\n EmailAccountOptions,\n MessageSenderInterface,\n ProviderType,\n SyncOptions,\n SyncResult,\n} from '../types';\nimport { Account } from './Account';\n\n/** Whether an error means the server refused the account's sign-in. */\nexport function isMailAuthFailure(error: unknown): boolean {\n const code = (error as { code?: unknown } | null)?.code;\n if (code === 'EAUTH' || code === 'AUTHENTICATIONFAILED') return true;\n const message = error instanceof Error ? error.message : String(error);\n return /\\b(auth(entication|orization)?\\s*(failed|failure|error)|invalid credentials|login failed|unauthori[sz]ed|401|invalid_grant)\\b/i.test(\n message,\n );\n}\n\n@smrt({\n tableStrategy: 'sti',\n api: { include: ['list', 'get'] },\n mcp: { include: ['list', 'get'] },\n cli: { include: ['list', 'get'] },\n})\nexport class EmailAccount extends Account { static __smrtPackage__ = \"@happyvertical/smrt-messages\";\n @field({ description: 'The email address associated with this mailbox.' })\n email = '';\n @field({\n description: 'The time in minutes between scheduled mailbox checks.',\n })\n syncIntervalMinutes = 60;\n /**\n * Opaque resume point of the mail server's change feed. Written only after\n * the batch it came from has been applied; null means the next sync starts\n * with a full pass. Internal state: never exposed over generated surfaces.\n */\n @field({\n sensitive: true,\n readonly: true,\n description: 'Where the next mailbox check resumes.',\n })\n syncCursor: string | null = null;\n /**\n * Backfill horizon. When set, sync stores no message dated before this\n * moment unless it is already stored (mail with no date is always kept).\n * Null (the default) means the whole mailbox. Applied while syncing: the\n * change feed itself cannot filter by date, so the server still sends the\n * older mail and it is dropped before storage.\n */\n @field({\n description:\n 'Mail older than this date is not stored. Empty means the whole mailbox.',\n })\n backfillSince: Date | null = null;\n /**\n * The backfill horizon `syncCursor` was built under (null: unbounded, also\n * every cursor saved before horizons existed). A run whose horizon reaches\n * further back, or is cleared, discards the cursor and runs a full pass so\n * the older mail is fetched. Internal state.\n */\n @field({\n readonly: true,\n description:\n 'The backfill date the saved mailbox position was built under.',\n })\n cursorHorizon: Date | null = null;\n /**\n * Why the last sync run failed, in plain words. Written on any failed run\n * (including sign-in refusals, which also set `needs_reconnect`) and cleared\n * by the next successful run. A transient failure never changes\n * `connectionStatus`.\n */\n @field({ description: 'Why the last mailbox check failed, if it did.' })\n lastSyncError: string | null = null;\n /** True when the last successful run stopped with more changes waiting. */\n @field({\n description: 'Whether more mail was still waiting after the last check.',\n })\n backlog = false;\n /**\n * What happens when an agent sends from this mailbox. Null (the default)\n * and `require_approval` hold the draft for a person's approval;\n * `auto_send` is the owner's explicit opt-in. Person sends are unaffected.\n * Change it through `MailAccessService.setAgentSendPolicy()` (owner only).\n */\n @field({\n readonly: true,\n description:\n 'Whether an assistant may send from this mailbox on its own, or needs a person to approve each message first.',\n })\n agentSendPolicy: AgentSendPolicy | null = null;\n\n constructor(options: EmailAccountOptions = {}) {\n super(options);\n if (options.agentSendPolicy !== undefined)\n this.agentSendPolicy = options.agentSendPolicy;\n\n if (options.email !== undefined) this.email = options.email;\n if (options.providerType !== undefined)\n this.providerType = options.providerType;\n if (options.syncIntervalMinutes !== undefined)\n this.syncIntervalMinutes = options.syncIntervalMinutes;\n if (options.syncCursor !== undefined)\n this.syncCursor = options.syncCursor || null;\n if (options.backfillSince !== undefined)\n this.backfillSince = options.backfillSince || null;\n if (options.cursorHorizon !== undefined)\n this.cursorHorizon = options.cursorHorizon || null;\n if (options.lastSyncError !== undefined)\n this.lastSyncError = options.lastSyncError || null;\n if (options.backlog !== undefined) this.backlog = options.backlog;\n this.channelType = 'email';\n }\n\n /**\n * Options for child rows (folders/emails) created during sync: carries the DB\n * connection + tenant context from this account, but strips this account's own\n * identity fields. When this account was hydrated from the DB, `this.options`\n * holds the account row's `id`/`slug`/`_skipLoad`; spreading those into a new\n * child would make every synced row inherit the account's primary key and\n * upsert over each other. Internal: the mail sync engine reuses it.\n */\n childOptions(): Record<string, unknown> {\n const rest = { ...(this.options as Record<string, unknown>) };\n delete rest.id;\n delete rest.slug;\n delete rest._skipLoad;\n return rest;\n }\n\n /**\n * Create a sender for this email account\n */\n override async createSender(): Promise<MessageSenderInterface> {\n const client = await this.createClient();\n await client.connect();\n const { EmailSender } = await import('../senders/EmailSender');\n return new EmailSender(client, this);\n }\n\n /**\n * Create an EmailClient from stored settings\n * Retrieves credentials from smrt-secrets if credentialSecretId is set\n *\n * The client factory comes from the messaging provider registry rather than\n * a direct `@happyvertical/email` import so the email SDK\n * (googleapis/nodemailer) never becomes reachable from provider-neutral\n * consumer bundles (#1979). Server code that uses email accounts must\n * import '@happyvertical/smrt-messages/providers/email' (or\n * '/providers/all') once during startup.\n */\n async createClient() {\n const { getMessagingProvider } = await import('../providers.js');\n const createEmailClient = getMessagingProvider(\n this.providerType,\n )?.createEmailClient;\n if (!createEmailClient) {\n throw new Error(\n `Email provider '${this.providerType}' has no client implementation registered. ` +\n \"Import '@happyvertical/smrt-messages/providers/email' (or '/providers/all') \" +\n 'during server startup to enable outbound email and mailbox sync.',\n );\n }\n const settings: Record<string, unknown> = {\n ...this.getConfiguration(),\n ...((await this.getCredentials()) ?? {}),\n };\n delete settings.email;\n if (this.providerType === 'jmap') {\n // The stored sign-in is flat (token, or username + password); the JMAP\n // client wants one `auth` value.\n const { token, username, password } = settings;\n for (const key of ['token', 'username', 'password']) delete settings[key];\n if (settings.auth === undefined) {\n if (typeof token === 'string' && token) {\n settings.auth = { type: 'bearer', token };\n } else if (\n typeof username === 'string' &&\n typeof password === 'string'\n ) {\n settings.auth = { user: username, pass: password };\n }\n }\n }\n\n return await createEmailClient({\n type: this.providerType as ProviderType,\n ...settings,\n } as GetEmailClientOptions);\n }\n\n /**\n * Read an immutable body/attachment-byte snapshot for an authorized intake host.\n * Does not sync, acknowledge, mark read or advance mailbox checkpoints.\n * Metadata-only providers fail explicitly; provider paths are never dereferenced.\n */\n async readIntakeMessage(\n locator: string,\n maxBytes: number,\n imapIdentity?: { folder: string; uidValidity: number; uid: string },\n ) {\n if (!this.id || !this.isActive || !locator) {\n throw new Error('Email intake account unavailable');\n }\n const client = await this.createClient();\n try {\n await client.connect();\n if (this.providerType === 'imap') {\n if (\n !imapIdentity?.folder ||\n !imapIdentity.uid ||\n !Number.isSafeInteger(imapIdentity.uidValidity)\n ) {\n throw new Error(\n 'IMAP intake requires folder and immutable UID identity',\n );\n }\n const folder = await client.selectFolder(imapIdentity.folder);\n if (folder.uidValidity !== imapIdentity.uidValidity) {\n throw new Error('IMAP intake identity changed');\n }\n }\n const message = await client.getMessage(locator);\n if (this.providerType === 'imap' && message.id !== imapIdentity?.uid) {\n throw new Error('IMAP intake identity changed');\n }\n const { snapshotEmailForIntake } = await import('../intake-snapshot.js');\n return snapshotEmailForIntake(this.id, message, maxBytes);\n } finally {\n await client.disconnect();\n }\n }\n\n /**\n * Sync emails from the email server to the database\n */\n async syncFrom(options: SyncOptions = {}): Promise<SyncResult> {\n // Sync is trusted server work: it must read the rows it dedupes against\n // whatever account policy the host enforces for people and agents.\n return runWithMailSystemAccess(() => this.syncFromScoped(options));\n }\n\n private async syncFromScoped(options: SyncOptions): Promise<SyncResult> {\n const startTime = Date.now();\n const result: SyncResult = {\n folders: [],\n messagesProcessed: 0,\n messagesDownloaded: 0,\n messagesSkipped: 0,\n errors: [],\n duration: 0,\n };\n\n try {\n // Create email client\n const client = await this.createClient();\n await client.connect();\n\n // Get folders to sync\n const foldersToSync = options.folders || ['INBOX'];\n result.folders = foldersToSync;\n\n // Import collections\n const { EmailCollection } = await import(\n '../collections/EmailCollection'\n );\n const { EmailFolderCollection } = await import(\n '../collections/EmailFolderCollection'\n );\n\n const emailCollection = await EmailCollection.create(this.options);\n const folderCollection = await EmailFolderCollection.create(this.options);\n\n if (!this.id) {\n throw new Error(\n 'EmailAccount.syncFrom requires a persisted account (missing id)',\n );\n }\n const accountId = this.id;\n for (const folderName of foldersToSync) {\n try {\n // Ensure folder exists in database\n let folder = await folderCollection.getByPath(accountId, folderName);\n\n if (!folder) {\n // Create folder record\n const { EmailFolder } = await import('./EmailFolder');\n folder = new (ObjectRegistry.resolveEffectiveConstructor(\n EmailFolder,\n ))({\n ...this.childOptions(),\n accountId,\n name: folderName,\n path: folderName,\n });\n // initialize() binds the DB connection; without it save() throws\n // \"Database accessed before initialization\" and sync persists nothing.\n await folder.initialize();\n await folder.save();\n }\n\n // Fetch messages from server\n const fetchOptions: FetchOptions = {\n folder: folderName,\n limit: options.batchSize || 100,\n };\n\n if (options.since) {\n fetchOptions.since = options.since;\n }\n if (options.before) {\n fetchOptions.before = options.before;\n }\n\n const messages = await client.fetch(fetchOptions);\n\n for (const msg of messages) {\n result.messagesProcessed++;\n\n try {\n // Check if message already exists\n const existingEmail = await emailCollection.getByMessageId(\n accountId,\n msg.messageId || '',\n );\n\n if (existingEmail && !options.fullSync) {\n result.messagesSkipped++;\n continue;\n }\n\n // Create or update email record\n const { Email } = await import('./Email');\n let email = existingEmail;\n if (!email) {\n email = new (ObjectRegistry.resolveEffectiveConstructor(Email))(\n {\n ...this.childOptions(),\n accountId,\n },\n );\n // Bind the DB connection before save() (existingEmail is already\n // initialized via the query that loaded it).\n await email.initialize();\n }\n\n applyServerMessage(email, msg, {\n folderId: folder.id ?? '',\n folderPath: folderName,\n });\n\n await email.save();\n result.messagesDownloaded++;\n\n // Report progress\n if (options.onProgress) {\n options.onProgress({\n folder: folderName,\n processed: result.messagesProcessed,\n total: messages.length,\n downloaded: result.messagesDownloaded,\n skipped: result.messagesSkipped,\n errors: result.errors.length,\n });\n }\n } catch (error) {\n const err =\n error instanceof Error ? error : new Error(String(error));\n result.errors.push(err);\n if (options.onError) {\n options.onError(err, msg);\n }\n }\n }\n\n // Update folder counts\n const folderId = folder.id ?? '';\n folder.messageCount = await emailCollection.countByFolder(folderId);\n folder.unreadCount =\n await emailCollection.countUnreadByFolder(folderId);\n await folder.save();\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n result.errors.push(err);\n if (options.onError) {\n options.onError(err);\n }\n }\n }\n\n // Update last sync time\n this.lastSyncAt = new Date();\n if (!result.errors.length) {\n this.connectionStatus = 'connected';\n this.statusMessage = null;\n }\n this.updatedAt = new Date();\n await this.save();\n\n await client.disconnect();\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n result.errors.push(err);\n if (isMailAuthFailure(err)) {\n // The server refused the saved sign-in: surface it for reconnection\n // rather than failing every later sync the same silent way.\n try {\n await this.markNeedsReconnect(err.message);\n } catch {\n // The sync error is already recorded; do not mask it.\n }\n }\n if (options.onError) {\n options.onError(err);\n }\n }\n\n result.duration = Date.now() - startTime;\n return result;\n }\n\n /**\n * Sync new, changed and deleted mail since the last run, from the server's\n * change feed (JMAP). The feed cursor is saved on `syncCursor` only after\n * each batch has been applied; replaying a batch is harmless; a rejected\n * cursor restarts with a full pass. One run per account at a time.\n *\n * Closed accounts (inactive, or needing reconnection) are skipped. A server\n * that refuses the sign-in marks the account `needs_reconnect` and throws an\n * error flagged `retryable: false`. Every other failure throws and leaves the\n * cursor where it was, so the job can simply retry.\n *\n * This is the method the sync job runs (`enqueueMailSync`).\n */\n async syncChanges(options: MailSyncOptions = {}): Promise<MailSyncResult> {\n return runWithMailSystemAccess(async () => {\n const { syncMailChanges } = await import('../mail-sync.js');\n return syncMailChanges(this, options, {\n createClient: (account) => account.createClient(),\n childOptions: this.childOptions(),\n isAuthFailure: isMailAuthFailure,\n });\n });\n }\n\n /**\n * Triage synced messages: mark read or unread, star, archive, spam, label or\n * move. `emailIds` are local `Email` row ids of this account.\n *\n * Needs the `read` and `triage` scopes on this account (`MailAccessError`\n * otherwise, nothing sent or changed). The change is written to the mail\n * server first; only messages the server accepted are updated locally, and\n * the rest come back in `failed` with the server's reason. A provider\n * without the matching write-back capability throws\n * `MailWriteBackUnsupportedError`. Repeating a call changes nothing.\n *\n * Local rows are stored as the server reports them after the change, so the\n * next sync agrees with them. See `mail-triage.ts`.\n */\n async triage(\n action: MailTriageAction,\n emailIds: readonly string[],\n ): Promise<MailTriageResult> {\n return triageMailMessages(this, action, emailIds, {\n createClient: (account) => account.createClient(),\n childOptions: this.childOptions(),\n isAuthFailure: isMailAuthFailure,\n });\n }\n\n /**\n * Every message in one server-side conversation, oldest first, read straight\n * from the mail server (providers with native threads, such as JMAP).\n * Returns null when the provider has no thread lookup.\n */\n async fetchThread(threadId: string) {\n const client = await this.createClient();\n try {\n await client.connect();\n if (typeof client.getThread !== 'function') return null;\n return await client.getThread(threadId);\n } finally {\n await client.disconnect().catch(() => undefined);\n }\n }\n\n /**\n * Get all folders for this account\n */\n async getFolders() {\n const { EmailFolderCollection } = await import(\n '../collections/EmailFolderCollection'\n );\n const collection = await EmailFolderCollection.create(this.options);\n\n return await collection.list({ where: { accountId: this.id } });\n }\n\n /**\n * Get all emails for this account\n */\n async getEmails(limit?: number) {\n const { EmailCollection } = await import('../collections/EmailCollection');\n const collection = await EmailCollection.create(this.options);\n\n const options: { where: Record<string, unknown>; limit?: number } = {\n where: { accountId: this.id },\n };\n if (limit) {\n options.limit = limit;\n }\n\n return await collection.list(options);\n }\n\n /**\n * Get unread email count\n */\n async getUnreadCount(): Promise<number> {\n const { EmailCollection } = await import('../collections/EmailCollection');\n const collection = await EmailCollection.create(this.options);\n\n return await collection.countUnreadByAccount(this.id ?? '');\n }\n\n /**\n * Store credentials securely using smrt-secrets (email-specific)\n */\n override async setCredentials(\n credentials: Record<string, unknown>,\n options: {\n description?: string;\n category?: string;\n } = {},\n ): Promise<void> {\n await super.setCredentials(credentials, {\n description: options.description || `Email credentials for ${this.name}`,\n category: options.category || 'email',\n });\n }\n\n /**\n * Sync all active email accounts (for job runner)\n *\n * NOTE: This is a class-wide operation, not per-instance. It syncs ALL active\n * accounts, ignoring `this` instance. It exists as an instance method because\n * the TaskRunner dispatches via `objectType: 'EmailAccount', method: 'syncAll'`\n * which requires an instance method signature.\n */\n async syncAll(\n args?: Record<string, unknown>,\n ): Promise<Map<string, { success: boolean; error?: Error }>> {\n const { EmailAccountCollection } = await import(\n '../collections/EmailAccountCollection'\n );\n const collection = await EmailAccountCollection.create({\n db: this.db,\n });\n return collection.syncAll(args as SyncOptions | undefined);\n }\n\n /**\n * Migrate from plain-text settings to secrets\n */\n async migrateToSecrets(): Promise<void> {\n if (this.credentialSecretId) {\n return;\n }\n\n const settings = this.getSettings();\n if (Object.keys(settings).length === 0) {\n return;\n }\n\n await this.setCredentials(settings, {\n description: `Migrated IMAP credentials for ${this.name}`,\n });\n }\n}\n","/**\n * EmailAccountCollection - Collection manager for EmailAccount objects\n *\n * Extends AccountCollection with email-specific query methods.\n */\n\nimport { queryGlobal, queryWithGlobals } from '../host.js';\nimport { EmailAccount } from '../models/EmailAccount';\nimport type {\n EmailAccountSearchFilters,\n ProviderType,\n SyncOptions,\n} from '../types';\nimport { AccountCollection } from './AccountCollection';\n\nexport class EmailAccountCollection extends AccountCollection {\n static override readonly _itemClass = EmailAccount;\n\n /**\n * Get account by email address\n */\n async getByEmail(email: string): Promise<EmailAccount | null> {\n const accounts = await this.list({ where: { email } });\n return (accounts[0] as EmailAccount) || null;\n }\n\n /**\n * Get accounts by email provider type\n */\n async getByEmailProviderType(\n providerType: ProviderType,\n ): Promise<EmailAccount[]> {\n return (await this.list({ where: { providerType } })) as EmailAccount[];\n }\n\n /**\n * Get active email accounts\n */\n override async getActive(): Promise<EmailAccount[]> {\n return (await this.list({ where: { isActive: true } })) as EmailAccount[];\n }\n\n /**\n * Get inactive email accounts\n */\n override async getInactive(): Promise<EmailAccount[]> {\n return (await this.list({ where: { isActive: false } })) as EmailAccount[];\n }\n\n /**\n * Get accounts that need syncing\n */\n async getNeedingSync(maxAgeMinutes = 60): Promise<EmailAccount[]> {\n const allAccounts = await this.getActive();\n const cutoffTime = new Date(Date.now() - maxAgeMinutes * 60 * 1000);\n\n return allAccounts.filter(\n (account) => !account.lastSyncAt || account.lastSyncAt < cutoffTime,\n ) as EmailAccount[];\n }\n\n /**\n * Search email accounts with filters.\n * Alias: `search()` for backward compatibility.\n */\n override async search(\n query: string,\n filters?: EmailAccountSearchFilters,\n ): Promise<EmailAccount[]> {\n return this.searchEmailAccounts(query, filters);\n }\n\n /**\n * Get accounts by email provider type.\n * Alias: `getByProviderType()` for backward compatibility.\n */\n override async getByProviderType(\n providerType: string,\n ): Promise<EmailAccount[]> {\n return this.getByEmailProviderType(providerType as ProviderType);\n }\n\n /**\n * Get email account statistics.\n * Alias: `getStats()` for backward compatibility.\n */\n override async getStats(): Promise<{\n total: number;\n active: number;\n inactive: number;\n byType: Record<string, number>;\n }> {\n const stats = await this.getEmailStats();\n return {\n total: stats.total,\n active: stats.active,\n inactive: stats.inactive,\n byType: stats.byProvider as unknown as Record<string, number>,\n };\n }\n\n /**\n * Search email accounts with filters\n */\n async searchEmailAccounts(\n query: string,\n filters?: EmailAccountSearchFilters,\n ): Promise<EmailAccount[]> {\n let accounts = (await this.list({})) as EmailAccount[];\n\n // Filter by query\n if (query) {\n const lowerQuery = query.toLowerCase();\n accounts = accounts.filter(\n (a) =>\n a.name?.toLowerCase().includes(lowerQuery) ||\n a.email?.toLowerCase().includes(lowerQuery),\n );\n }\n\n // Apply filters\n if (filters) {\n if (filters.providerType) {\n accounts = accounts.filter(\n (a) => a.providerType === filters.providerType,\n );\n }\n if (filters.email) {\n const emailLower = filters.email.toLowerCase();\n accounts = accounts.filter((a) =>\n a.email?.toLowerCase().includes(emailLower),\n );\n }\n if (filters.isActive !== undefined) {\n accounts = accounts.filter((a) => a.isActive === filters.isActive);\n }\n }\n\n return accounts;\n }\n\n /**\n * Sync all active email accounts\n */\n async syncAll(\n options?: SyncOptions,\n ): Promise<Map<string, { success: boolean; error?: Error }>> {\n const results = new Map<string, { success: boolean; error?: Error }>();\n const accounts = await this.getActive();\n\n for (const account of accounts) {\n const ea = account as EmailAccount;\n const accountId = ea.id ?? ea.email ?? 'unknown';\n try {\n await ea.syncFrom(options);\n results.set(accountId, { success: true });\n } catch (error) {\n results.set(accountId, {\n success: false,\n error: error instanceof Error ? error : new Error(String(error)),\n });\n }\n }\n\n return results;\n }\n\n /**\n * Get total unread count across all email accounts\n */\n async getTotalUnreadCount(): Promise<number> {\n const accounts = await this.getActive();\n let total = 0;\n\n for (const account of accounts) {\n total += await (account as EmailAccount).getUnreadCount();\n }\n\n return total;\n }\n\n /**\n * Get email account statistics\n */\n async getEmailStats(): Promise<{\n total: number;\n active: number;\n inactive: number;\n byProvider: Record<ProviderType, number>;\n }> {\n const accounts = (await this.list({})) as EmailAccount[];\n\n const byProvider: Record<ProviderType, number> = {\n smtp: 0,\n imap: 0,\n pop3: 0,\n gmail: 0,\n jmap: 0,\n };\n\n for (const account of accounts) {\n const pt = account.providerType as ProviderType;\n if (pt in byProvider) {\n byProvider[pt]++;\n }\n }\n\n return {\n total: accounts.length,\n active: accounts.filter((a) => a.isActive).length,\n inactive: accounts.filter((a) => !a.isActive).length,\n byProvider,\n };\n }\n\n // ─────────────────────────────────────────────────────────────────────────\n // Tenant Helper Methods\n // ─────────────────────────────────────────────────────────────────────────\n\n override async findByTenant(tenantId: string): Promise<EmailAccount[]> {\n return this.list({ where: { tenantId } }) as Promise<EmailAccount[]>;\n }\n\n // EmailAccount inherits Account's @TenantScoped recognition (#1596); see\n // EmailCollection for why these route through the raw helpers. They auto-scope\n // to the EmailAccount `_meta_type` (via getStiChildMetaType) so the shared\n // `accounts` table never returns sibling Account subtypes. (#1600)\n override async findGlobal(): Promise<EmailAccount[]> {\n return queryGlobal<EmailAccount>(this);\n }\n\n override async findWithGlobals(tenantId: string): Promise<EmailAccount[]> {\n return queryWithGlobals<EmailAccount>(\n this,\n tenantId,\n 'EmailAccount.findWithGlobals',\n );\n }\n}\n"],"mappings":";;;;;;AAOA,eAAe,wBAAwB,KAAK,MAAM,irnTAAqo0V,CAAC;;;ACDjr0V,IAAM,2BAA2B;AACjC,IAAM,mCAAmC;AACzC,IAAM,wCACX;AAEK,IAAM,uBAAuB;AAC7B,IAAM,yBAAyB;AAC/B,IAAM,wBAAwB;AAC9B,IAAM,gCAAgC;AAEtC,IAAM,mCAA2D;CACtE;EACE,MAAM;EACN,UAAU;EACV,MAAM;EACN,aAAa;CACf;CACA;EACE,MAAM;EACN,UAAU;EACV,MAAM;EACN,aAAa;CACf;CACA;EACE,MAAM;EACN,UAAU;EACV,MAAM;EACN,aAAa;CACf;CACA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