@businesskit/agent 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/.claude/settings.json +16 -0
  2. package/.claude/settings.local.json +11 -0
  3. package/.env.example +10 -0
  4. package/CLAUDE.md +32 -13
  5. package/PLAN.md +95 -134
  6. package/REFERENCE.md +60 -24
  7. package/agents/_base.ts +352 -44
  8. package/agents/analytics/SOUL.md +11 -0
  9. package/agents/analytics/analytics.ts +405 -0
  10. package/agents/business/SOUL.md +11 -0
  11. package/agents/{csuite/cbo.ts → business/business.ts} +2 -2
  12. package/agents/ceo/SOUL.md +15 -0
  13. package/agents/{csuite → ceo}/ceo.ts +33 -8
  14. package/agents/content/SOUL.md +11 -0
  15. package/agents/content/content.ts +379 -0
  16. package/agents/copywriting/SOUL.md +11 -0
  17. package/agents/courses/SOUL.md +11 -0
  18. package/agents/courses/courses.ts +451 -0
  19. package/agents/docs/SOUL.md +11 -0
  20. package/agents/forms/SOUL.md +11 -0
  21. package/agents/forms/forms.ts +364 -0
  22. package/agents/hiring/SOUL.md +11 -0
  23. package/agents/hiring/hiring.ts +314 -0
  24. package/agents/marketing/SOUL.md +15 -0
  25. package/agents/{csuite/cmo.ts → marketing/marketing.ts} +3 -3
  26. package/agents/newsletter/SOUL.md +11 -0
  27. package/agents/operations/SOUL.md +11 -0
  28. package/agents/operations/operations.ts +157 -0
  29. package/agents/sales/SOUL.md +44 -0
  30. package/agents/sales/sales.ts +883 -0
  31. package/agents/scheduler/SOUL.md +11 -0
  32. package/agents/{growth → scheduler}/scheduler.ts +2 -2
  33. package/agents/seo/SOUL.md +11 -0
  34. package/agents/{growth/seo-agent.ts → seo/seo.ts} +60 -54
  35. package/agents/social/SOUL.md +11 -0
  36. package/agents/social/social.ts +744 -0
  37. package/agents/store/SOUL.md +11 -0
  38. package/agents/store/store.ts +514 -0
  39. package/cli.ts +44 -25
  40. package/lib/cms.ts +88 -0
  41. package/lib/db.ts +58 -11
  42. package/lib/enums.ts +25 -0
  43. package/lib/groups.ts +122 -0
  44. package/lib/id.ts +38 -10
  45. package/lib/profile.ts +44 -8
  46. package/lib/schema.ts +2015 -0
  47. package/lib/validate.ts +33 -0
  48. package/package.json +1 -1
  49. package/scripts/generate-schema.ts +244 -0
  50. package/setup.ts +16 -2
  51. package/skills/schema/SKILL.md +57 -16
  52. package/tsconfig.json +2 -1
  53. package/agents/creators/blog-writer.ts +0 -347
  54. package/agents/creators/course-creator.ts +0 -106
  55. package/agents/creators/crm-agent.ts +0 -479
  56. package/agents/creators/forms-builder.ts +0 -90
  57. package/agents/creators/jobs-manager.ts +0 -82
  58. package/agents/creators/store-manager.ts +0 -138
  59. package/agents/csuite/coo.ts +0 -115
  60. package/agents/growth/analytics-agent.ts +0 -52
  61. package/agents/growth/social-agent.ts +0 -346
  62. /package/{ingest.md → .claude/commands/ingest.md} +0 -0
  63. /package/agents/{creators/copywriter.ts → copywriting/copywriting.ts} +0 -0
  64. /package/agents/{creators/docs-writer.ts → docs/docs.ts} +0 -0
  65. /package/agents/{creators/newsletter-writer.ts → newsletter/newsletter.ts} +0 -0
  66. /package/{ABOUT-ME.md → context/about-me.md} +0 -0
  67. /package/{brand-voice.md → context/brand-voice.md} +0 -0
  68. /package/{working-style.md → context/working-style.md} +0 -0
package/lib/schema.ts ADDED
@@ -0,0 +1,2015 @@
1
+ // lib/schema.ts
2
+ // AUTO-GENERATED by scripts/generate-schema.ts — DO NOT EDIT.
3
+ // Source: businesskit-files/*.ts (copies of app-side schema).
4
+ // Regenerate: npm run schema:gen
5
+ //
6
+ // What this gives you:
7
+ // - One `interface <PascalTable>` per UserDB table
8
+ // - Enum literal unions for columns with `-- 'a'|'b'|'c'` comment hints
9
+ // - `TABLES` const for typo-safe table references
10
+ //
11
+ // Rows returned by libSQL's Client are `Record<string, Value>` — cast via
12
+ // `as unknown as <Interface>` at the call site after SELECT.
13
+
14
+ // ── agent.ts ────────────────────────────────────────────────────
15
+
16
+ export interface Agents {
17
+ id: string | null
18
+ profile_id: string
19
+ display_name: string
20
+ title: string | null
21
+ reports_to: string | null
22
+ capabilities: string | null
23
+ instructions: 'claude-code-local' | 'claude-api' | 'openai' | 'gemini' | null
24
+ thinking_effort: 'auto' | 'low' | 'medium' | 'high'
25
+ timeout_sec: number
26
+ interrupt_grace_sec: number
27
+ enable_chrome: number
28
+ skip_permissions: number
29
+ extra_args: string | null
30
+ env_vars: string
31
+ heartbeat_interval_sec: number
32
+ can_assign_tasks: number
33
+ auto_approve: number
34
+ is_paused: number
35
+ paused_until: number | null
36
+ status: 'idle' | 'running' | 'paused' | 'error'
37
+ last_run_at: number | null
38
+ last_run_status: string | null
39
+ created_at: number
40
+ updated_at: number
41
+ }
42
+
43
+ export interface AgentSkills {
44
+ id: number | null
45
+ profile_id: string
46
+ name: string
47
+ slug: string
48
+ description: string | null
49
+ tags: string
50
+ content: string
51
+ source: 'manual' | 'generated'
52
+ approval_status: string
53
+ embedding: Uint8Array | null
54
+ version: number
55
+ updated_at: string
56
+ }
57
+
58
+ export interface SkillFiles {
59
+ id: number | null
60
+ skill_id: number
61
+ path: string
62
+ category: string
63
+ content: string
64
+ updated_at: string
65
+ }
66
+
67
+ export interface AgentMemory {
68
+ id: number | null
69
+ profile_id: string
70
+ session_date: string
71
+ agent: string
72
+ action: string
73
+ metadata: string
74
+ created_at: string
75
+ }
76
+
77
+ export interface AgentNotes {
78
+ id: string | null
79
+ profile_id: string
80
+ content: string
81
+ thought: 'user' | 'agent'
82
+ }
83
+
84
+ export interface AgentFiles {
85
+ id: string | null
86
+ profile_id: string
87
+ file_name: string
88
+ file_path: string
89
+ size_bytes: number
90
+ content: string | null
91
+ agent_types: string
92
+ created_at: string
93
+ }
94
+
95
+ export interface AgentTasks {
96
+ id: string | null
97
+ profile_id: string
98
+ agent: string
99
+ title: string
100
+ description: string | null
101
+ command: 'weeklyBriefing' | 'runPublishQueue' | 'hotLeads'
102
+ source: 'user' | 'agent'
103
+ run_once: 'pending' | 'active' | 'running' | 'done' | 'paused' | 'failed' | 'cancelled'
104
+ last_run_at: number | null
105
+ last_run_status: string | null
106
+ next_run_at: number | null
107
+ hidden: number
108
+ created_at: number
109
+ updated_at: number
110
+ }
111
+
112
+ export interface AgentReports {
113
+ id: string | null
114
+ profile_id: string
115
+ agent: string
116
+ title: string
117
+ type: 'briefing' | 'audit' | 'revenue' | 'seo' | 'crm' | 'analytics' | 'general'
118
+ summary: string | null
119
+ created_at: string
120
+ }
121
+
122
+ export interface AgentKb {
123
+ id: string | null
124
+ profile_id: string
125
+ entry_type: string
126
+ framework: string
127
+ slug: 'convertkit' | 'email-deliverability' | 'icp-match'
128
+ stale: number
129
+ agent: string
130
+ hidden: number
131
+ created_at: string
132
+ updated_at: string
133
+ }
134
+
135
+ export interface AgentConversations {
136
+ id: string | null
137
+ profile_id: string
138
+ title: string | null
139
+ agent: string | null
140
+ harness_type: string | null
141
+ harness_status: string
142
+ current_phase: number
143
+ messages: string
144
+ deep_mode: number
145
+ todos: string
146
+ workspace_ids: string
147
+ hidden: number
148
+ created_at: number
149
+ updated_at: number
150
+ }
151
+
152
+ export interface AgentAudit {
153
+ id: string | null
154
+ ts: number
155
+ agent_type: string
156
+ table_name: string
157
+ row_id: string
158
+ action: string
159
+ diff: string | null
160
+ idempotency_key: string | null
161
+ }
162
+
163
+ // ── content.ts ──────────────────────────────────────────────────
164
+
165
+ export interface Content {
166
+ id: string | null
167
+ cms_id: string | null
168
+ category_id: string | null
169
+ profile_id: string
170
+ media_id: string | null
171
+ user_id: string
172
+ slug: string
173
+ title: string
174
+ subtitle: string | null
175
+ content: string | null
176
+ excerpt: string | null
177
+ hero_image_url: string | null
178
+ cta_button_url: string | null
179
+ cta_button_text: string | null
180
+ additional_details: string
181
+ published: number
182
+ hidden: number
183
+ date: string | null
184
+ collection_id: string | null
185
+ hide_author: number
186
+ image_ads: string
187
+ add_product: string
188
+ add_people: string
189
+ video_url: string | null
190
+ files_url: string
191
+ faqs: string
192
+ ai_summary: string | null
193
+ custom_design: string | null
194
+ seo_title: string | null
195
+ seo_description: string | null
196
+ seo_keywords: string | null
197
+ word_count: number | null
198
+ reading_time_mins: number | null
199
+ internal_links: number | null
200
+ external_links: number | null
201
+ sources: string | null
202
+ sent_count: number
203
+ location: string | null
204
+ social_links: string
205
+ website: string | null
206
+ logo_url: string | null
207
+ name: string | null
208
+ tagline: string | null
209
+ highlights: string
210
+ hide_info: number
211
+ created_at: string
212
+ updated_at: string
213
+ }
214
+
215
+ export interface ContentReaction {
216
+ id: string | null
217
+ content_id: string
218
+ profile_id: string
219
+ user_id: string | null
220
+ reaction_type: string
221
+ created_at: string
222
+ }
223
+
224
+ export interface ContentComment {
225
+ id: string | null
226
+ content_id: string
227
+ profile_id: string
228
+ user_id: string | null
229
+ author_name: string | null
230
+ author_email: string | null
231
+ content: string
232
+ parent_id: string | null
233
+ status: string
234
+ created_at: string
235
+ updated_at: string
236
+ }
237
+
238
+ export interface Cms {
239
+ id: string | null
240
+ profile_id: string | null
241
+ slug: string
242
+ title: string
243
+ description: string | null
244
+ category_id: string | null
245
+ nav_active: number
246
+ menu_active: number
247
+ footer_active: number
248
+ section: string | null
249
+ subscribe_form: number
250
+ ads_code_sidebar: string | null
251
+ ads_code_top: string | null
252
+ ads_code_bottom: string | null
253
+ hide_info: number
254
+ created_at: string
255
+ updated_at: string
256
+ }
257
+
258
+ export interface ContentViews {
259
+ id: string | null
260
+ content_id: string | null
261
+ doc_id: number | null
262
+ product_id: string | null
263
+ form_id: string | null
264
+ job_listing_id: string | null
265
+ community_id: string | null
266
+ page_id: string | null
267
+ profile_id: string
268
+ viewer_id: string | null
269
+ ip_address: string | null
270
+ user_agent: string | null
271
+ device: string | null
272
+ os: string | null
273
+ browser: string | null
274
+ referrer: string | null
275
+ country: string | null
276
+ city: string | null
277
+ timezone: string | null
278
+ is_bot: number
279
+ viewed_at: string
280
+ }
281
+
282
+ export interface ContentAnalytics {
283
+ id: string | null
284
+ content_id: string
285
+ profile_id: string
286
+ bot_views: number
287
+ total_views: number
288
+ total_reactions: number
289
+ total_comments: number
290
+ device_breakdown: string
291
+ os_breakdown: string
292
+ browser_breakdown: string
293
+ country_breakdown: string
294
+ city_breakdown: string
295
+ referrer_breakdown: string
296
+ views_7d: string
297
+ views_30d: string
298
+ views_12m: string
299
+ views_lifetime: string
300
+ last_aggregated_at: string
301
+ }
302
+
303
+ export interface CmsAnalytics {
304
+ id: string | null
305
+ cms_id: string
306
+ profile_id: string
307
+ total_posts: number
308
+ total_draft: number
309
+ total_published: number
310
+ bot_views: number
311
+ total_views: number
312
+ total_reactions: number
313
+ total_comments: number
314
+ total_submissions: number
315
+ total_applications: number
316
+ device_breakdown: string
317
+ os_breakdown: string
318
+ browser_breakdown: string
319
+ country_breakdown: string
320
+ city_breakdown: string
321
+ referrer_breakdown: string
322
+ views_7d: string
323
+ views_30d: string
324
+ views_12m: string
325
+ views_lifetime: string
326
+ last_aggregated_at: string
327
+ created_at: string
328
+ updated_at: string
329
+ }
330
+
331
+ export interface DocAnalytics {
332
+ id: string | null
333
+ doc_id: number
334
+ profile_id: string
335
+ bot_views: number
336
+ total_views: number
337
+ sad: number
338
+ neutral: number
339
+ happy: number
340
+ total_reactions: number
341
+ total_comments: number
342
+ device_breakdown: string
343
+ os_breakdown: string
344
+ browser_breakdown: string
345
+ country_breakdown: string
346
+ city_breakdown: string
347
+ referrer_breakdown: string
348
+ views_7d: string
349
+ views_30d: string
350
+ views_12m: string
351
+ views_lifetime: string
352
+ last_aggregated_at: string
353
+ }
354
+
355
+ export interface DocCollections {
356
+ id: number | null
357
+ slug: string
358
+ title: string
359
+ description: string | null
360
+ icon: string | null
361
+ sort_order: number
362
+ is_default: number
363
+ created_at: string
364
+ }
365
+
366
+ export interface DocArticles {
367
+ id: number | null
368
+ collection_id: number
369
+ profile_id: string
370
+ user_id: string
371
+ slug: string
372
+ title: string
373
+ excerpt: string | null
374
+ body: string
375
+ published: number
376
+ hidden: number
377
+ hide_author: number
378
+ image_ads: string
379
+ add_product: string
380
+ add_people: string
381
+ video_url: string | null
382
+ files_url: string
383
+ faqs: string
384
+ views: number
385
+ votes_json: string
386
+ ai_summary: string | null
387
+ custom_design: string | null
388
+ sources: string | null
389
+ created_at: string
390
+ updated_at: string
391
+ }
392
+
393
+ // ── crm.ts ──────────────────────────────────────────────────────
394
+
395
+ export interface CrmContacts {
396
+ id: string | null
397
+ profile_id: string
398
+ user_id: string | null
399
+ last_name: string | null
400
+ email: string | null
401
+ phone: string | null
402
+ avatar_url: string | null
403
+ company: string | null
404
+ job_title: string | null
405
+ website: string | null
406
+ contact_type: 'brand' | 'agency' | 'influencer' | 'professional'
407
+ country: string | null
408
+ timezone: string | null
409
+ recent_post: string | null
410
+ recent_post_url: string | null
411
+ recent_post_at: number | null
412
+ pain_point: 'solo' | '2-10' | '11-50' | '51-200' | null
413
+ business_model: 'b2b' | 'b2c' | 'marketplace' | null
414
+ lead_score_reason: string | null
415
+ icp_match: 'strong' | 'moderate' | 'weak' | 'unknown'
416
+ next_follow_up_at: number | null
417
+ follow_up_count: number
418
+ next_action: string | null
419
+ dm_sent: number
420
+ dm_sent_at: number | null
421
+ conversation_thread: string
422
+ last_reply_channel: 'dm' | 'email' | null
423
+ email_draft: string | null
424
+ email_sent: number
425
+ email_sent_at: 'lead' | 'prospect' | 'customer' | 'churned' | 'archived' | null
426
+ tags: string
427
+ custom_fields: string
428
+ notes: string | null
429
+ message: string | null
430
+ os: string | null
431
+ browser: string | null
432
+ referrer: string | null
433
+ utm_source: string | null
434
+ utm_medium: string | null
435
+ utm_campaign: string | null
436
+ utm_term: string | null
437
+ utm_content: string | null
438
+ total_purchases: number
439
+ last_purchase_at: 'active' | 'cancelled' | 'paused' | 'trial' | null
440
+ subscription_value_cents: number
441
+ subscription_renewal_at: number | null
442
+ mrr_cents: number
443
+ last_activity_at: number | null
444
+ unread_count: 'pending' | 'researching' | 'enriched' | 'outreach_ready' | 'closed'
445
+ agent_confidence: number | null
446
+ agent_error: string | null
447
+ agent_retry_count: number
448
+ agent_last_run_at: number | null
449
+ agent_next_run_at: number | null
450
+ agent_context: string
451
+ agent_paused_until: number | null
452
+ auto_approve: 'new_post' | 'replied' | 'opened_email' | 'purchase' | 'form_submit' | 'n8n_trigger'
453
+ signal_data: string
454
+ enrichment_source: string | null
455
+ duplicate_of: string | null
456
+ disqualified: number
457
+ disqualified_reason: string | null
458
+ merged_into: string | null
459
+ merged_at: number | null
460
+ created_at: number
461
+ updated_at: number
462
+ }
463
+
464
+ export interface CrmDeals {
465
+ id: string | null
466
+ profile_id: string
467
+ contact_id: string
468
+ title: string
469
+ value_cents: number
470
+ currency: string
471
+ stage: string
472
+ expected_close_at: number | null
473
+ closed_at: number | null
474
+ lost_reason: string | null
475
+ notes: string | null
476
+ product_id: string | null
477
+ line_items: string
478
+ updated_at: number
479
+ }
480
+
481
+ export interface CrmActivities {
482
+ id: string | null
483
+ profile_id: string
484
+ contact_id: string
485
+ deal_id: string | null
486
+ type: 'dm' | 'email' | 'call' | 'meeting' | 'note' | 'task_done'
487
+ sender: string
488
+ subject: string | null
489
+ body: string | null
490
+ outcome: string | null
491
+ metadata: string
492
+ searchable_context: 'pending_approval' | 'approved' | 'rejected' | 'auto_sent' | null
493
+ approved_at: number | null
494
+ read_at: number | null
495
+ created_at: number
496
+ }
497
+
498
+ export interface CrmTasks {
499
+ id: string | null
500
+ profile_id: string
501
+ contact_id: string | null
502
+ deal_id: string | null
503
+ title: string
504
+ description: string | null
505
+ due_at: number | null
506
+ priority: string
507
+ status: string
508
+ completed_at: number | null
509
+ created_at: number
510
+ updated_at: number
511
+ }
512
+
513
+ export interface CrmNotes {
514
+ id: string | null
515
+ profile_id: string
516
+ contact_id: string
517
+ deal_id: string | null
518
+ body: string
519
+ pinned: number
520
+ created_at: number
521
+ updated_at: number
522
+ }
523
+
524
+ export interface CrmGroups {
525
+ id: string | null
526
+ profile_id: string
527
+ name: string
528
+ icon: string | null
529
+ color: string | null
530
+ contact_count: number
531
+ created_at: number
532
+ }
533
+
534
+ export interface CrmContactGroups {
535
+ contact_id: string
536
+ group_id: string
537
+ added_at: number
538
+ }
539
+
540
+ export interface CrmTemplates {
541
+ id: string | null
542
+ profile_id: string
543
+ name: string
544
+ type: 'dm' | 'email' | 'follow_up' | 'proposal'
545
+ body: string
546
+ platform: 'twitter' | 'linkedin' | null
547
+ use_count: number
548
+ reply_rate_pct: number
549
+ created_at: number
550
+ updated_at: number
551
+ }
552
+
553
+ export interface CrmProposals {
554
+ id: string | null
555
+ profile_id: string
556
+ contact_id: string | null
557
+ deal_id: string | null
558
+ title: string
559
+ body: string
560
+ excerpt: string | null
561
+ public_slug: string
562
+ status: 'draft' | 'sent' | 'viewed' | 'signed' | 'paid' | 'expired' | 'declined'
563
+ view_count: number
564
+ click: string | null
565
+ client_name: string | null
566
+ client_email: string | null
567
+ client_company: string | null
568
+ signed_name: string | null
569
+ signed_email: string | null
570
+ signed_at: number | null
571
+ signature_data: string | null
572
+ signature_type: 'draw' | 'type' | null
573
+ signature_ua: string | null
574
+ payment_required: number
575
+ payment_amount_cents: number | null
576
+ payment_currency: string
577
+ payment_processor: string | null
578
+ payment_reference: string | null
579
+ payment_status: string | null
580
+ payment_url: string | null
581
+ payment_url_expires_at: number | null
582
+ paid_at: number | null
583
+ deposit_required: number
584
+ deposit_amount_cents: number | null
585
+ deposit_paid_at: number | null
586
+ deposit_reference: string | null
587
+ cta_label: string | null
588
+ cta_url: string | null
589
+ reminder_count: number
590
+ last_reminder_at: number | null
591
+ next_reminder_at: number | null
592
+ template_id: string | null
593
+ ai_generated: number
594
+ hidden: number
595
+ created_at: number
596
+ updated_at: number
597
+ }
598
+
599
+ export interface CrmInvoices {
600
+ id: string | null
601
+ profile_id: string
602
+ contact_id: string | null
603
+ deal_id: string | null
604
+ proposal_id: string | null
605
+ invoice_number: string
606
+ public_slug: string
607
+ status: 'draft' | 'sent' | 'viewed' | 'paid' | 'overdue' | 'cancelled' | 'refunded'
608
+ client_email: string | null
609
+ client_company: string | null
610
+ client_address: string | null
611
+ line_items: string
612
+ discount_cents: number
613
+ tax_cents: number
614
+ total_cents: number
615
+ currency: string
616
+ issued_at: number | null
617
+ due_at: number | null
618
+ sent_at: number | null
619
+ view_count: number
620
+ overdue_notified_at: number | null
621
+ payment_processor: string | null
622
+ payment_reference: string | null
623
+ payment_status: string | null
624
+ payment_link: string | null
625
+ payment_method: string | null
626
+ reminder_count: number
627
+ last_reminder_at: number | null
628
+ next_reminder_at: number | null
629
+ notes: string | null
630
+ memo: string | null
631
+ hidden: number
632
+ created_at: number
633
+ updated_at: number
634
+ }
635
+
636
+ export interface CrmImports {
637
+ id: string | null
638
+ profile_id: string
639
+ filename: string | null
640
+ source: 'csv' | 'linkedin' | 'twitter' | 'apollo' | 'agent' | null
641
+ imported: number
642
+ skipped: number
643
+ failed: number
644
+ status: string
645
+ error: string | null
646
+ created_at: number
647
+ }
648
+
649
+ export interface CrmAnalytics {
650
+ profile_id: string | null
651
+ total_contacts: number
652
+ total_leads: number
653
+ total_prospects: number
654
+ total_customers: number
655
+ total_archived: number
656
+ total_converted: number
657
+ total_deals: number
658
+ open_deals: number
659
+ won_deals: number
660
+ lost_deals: number
661
+ total_deal_value_cents: number
662
+ won_deal_value_cents: number
663
+ forecast_this_month_cents: number
664
+ forecast_next_month_cents: number
665
+ total_outreach_sent: number
666
+ total_replies: number
667
+ total_calls_booked: number
668
+ reply_rate_pct: number
669
+ conversion_rate_pct: number
670
+ total_agent_actions: number
671
+ total_pending_approvals: number
672
+ total_approved: number
673
+ total_rejected: number
674
+ avg_lead_score: number
675
+ contacts_7d: string
676
+ contacts_30d: string
677
+ contacts_12m: string
678
+ contacts_lifetime: string
679
+ utm_source_breakdown: string
680
+ utm_medium_breakdown: string
681
+ utm_campaign_breakdown: string
682
+ referrer_breakdown: string
683
+ device_breakdown: string
684
+ country_breakdown: string
685
+ source_breakdown: string
686
+ stage_breakdown: string
687
+ channel_breakdown: string
688
+ updated_at: number
689
+ last_aggregated_at: number
690
+ }
691
+
692
+ // ── forms.ts ────────────────────────────────────────────────────
693
+
694
+ export interface Forms {
695
+ id: string | null
696
+ profile_id: string
697
+ media_id: string | null
698
+ title: string
699
+ slug: string
700
+ published: number
701
+ hidden: number
702
+ thank_you_settings: string | null
703
+ collection_id: string | null
704
+ created_at: string
705
+ }
706
+
707
+ export interface Questions {
708
+ id: string | null
709
+ form_id: string
710
+ type: string
711
+ title: string
712
+ description: string | null
713
+ position: number
714
+ options: string | null
715
+ embed_url: string | null
716
+ required: number
717
+ settings: string | null
718
+ }
719
+
720
+ export interface Submissions {
721
+ id: string | null
722
+ form_id: string
723
+ answers: string
724
+ last_question_index: number
725
+ status: string
726
+ device: string | null
727
+ os: string | null
728
+ browser: string | null
729
+ referrer: string | null
730
+ city: string | null
731
+ country: string | null
732
+ timezone: string | null
733
+ ip_address: string | null
734
+ user_agent: string | null
735
+ utm_source: string | null
736
+ utm_medium: string | null
737
+ utm_campaign: string | null
738
+ started_at: string | null
739
+ submitted_at: string | null
740
+ duration_ms: number | null
741
+ created_at: string
742
+ }
743
+
744
+ export interface FormAnalytics {
745
+ id: string | null
746
+ form_id: string
747
+ bot_views: number
748
+ views: number
749
+ total_views: number
750
+ views_device_breakdown: string
751
+ views_os_breakdown: string
752
+ views_browser_breakdown: string
753
+ views_country_breakdown: string
754
+ views_city_breakdown: string
755
+ views_referrer_breakdown: string
756
+ views_7d: string
757
+ views_30d: string
758
+ views_12m: string
759
+ views_lifetime: string
760
+ visits: number
761
+ starts: number
762
+ partials: number
763
+ submissions: number
764
+ avg_completion_ms: number
765
+ trends_7d: string
766
+ trends_30d: string
767
+ trends_12m: string
768
+ lifetime: string
769
+ device: string
770
+ os: string
771
+ browser: string
772
+ referrer: string
773
+ country: string
774
+ city: string
775
+ utm_source: string
776
+ utm_medium: string
777
+ utm_campaign: string
778
+ last_aggregated_at: number | null
779
+ updated_at: string
780
+ }
781
+
782
+ // ── jobs.ts ─────────────────────────────────────────────────────
783
+
784
+ export interface JobListings {
785
+ id: string | null
786
+ profile_id: string
787
+ media_id: string | null
788
+ user_id: string
789
+ ai_summary: string | null
790
+ title: string
791
+ company: string
792
+ location: string
793
+ location_type: string
794
+ employment_type: string
795
+ salary_min: number | null
796
+ salary_max: number | null
797
+ salary_currency: string
798
+ excerpt: string | null
799
+ description: string
800
+ requirements: string | null
801
+ slug: string
802
+ published: number
803
+ hidden: number
804
+ image_url: string | null
805
+ additional_details: string | null
806
+ total_applicants: number
807
+ created_at: string
808
+ updated_at: string
809
+ expires_at: string | null
810
+ collection_id: string | null
811
+ form_settings: string
812
+ }
813
+
814
+ export interface JobApplications {
815
+ id: string | null
816
+ job_id: string
817
+ profile_id: string
818
+ resume_url: string | null
819
+ resume_filename: string | null
820
+ resume_size_mb: number | null
821
+ resume_type: string | null
822
+ full_name: string
823
+ email: string
824
+ phone: string | null
825
+ city: string | null
826
+ country: string | null
827
+ date_of_birth: string | null
828
+ country_of_residence: string | null
829
+ physical_location: string | null
830
+ timezone: string | null
831
+ weekly_availability: string | null
832
+ linkedin: string | null
833
+ leetcode: string | null
834
+ github: string | null
835
+ codechef: string | null
836
+ codeforces: string | null
837
+ summary: string | null
838
+ education: string
839
+ work_experience: string
840
+ projects: string
841
+ publications: string
842
+ certifications: string
843
+ awards: string
844
+ portfolio: string | null
845
+ other_links: string
846
+ skills: string
847
+ terms_accepted: number
848
+ resume_updated: number
849
+ status: string
850
+ duration_ms: number | null
851
+ cf_country: string | null
852
+ cf_city: string | null
853
+ os: string | null
854
+ device: string | null
855
+ browser: string | null
856
+ ip_address: string | null
857
+ referrer: string | null
858
+ utm_source: string | null
859
+ utm_medium: string | null
860
+ utm_campaign: string | null
861
+ created_at: string
862
+ updated_at: string
863
+ }
864
+
865
+ export interface JobAnalytics {
866
+ id: string | null
867
+ job_id: string
868
+ profile_id: string
869
+ bot_views: number
870
+ total_views: number
871
+ total_visits: number
872
+ total_applications: number
873
+ device_breakdown: string
874
+ os_breakdown: string
875
+ browser_breakdown: string
876
+ country_breakdown: string
877
+ city_breakdown: string
878
+ referrer_breakdown: string
879
+ utm_source_breakdown: string
880
+ utm_medium_breakdown: string
881
+ utm_campaign_breakdown: string
882
+ views_device_breakdown: string
883
+ views_os_breakdown: string
884
+ views_browser_breakdown: string
885
+ views_country_breakdown: string
886
+ views_city_breakdown: string
887
+ views_referrer_breakdown: string
888
+ views_7d: string
889
+ views_30d: string
890
+ views_12m: string
891
+ views_lifetime: string
892
+ applications_7d: string
893
+ applications_30d: string
894
+ applications_12m: string
895
+ applications_lifetime: string
896
+ last_aggregated_at: number | null
897
+ updated_at: string
898
+ }
899
+
900
+ // ── provision.ts ────────────────────────────────────────────────
901
+
902
+ export interface SchemaMigrations {
903
+ id: string | null
904
+ applied_at: number
905
+ duration_ms: number | null
906
+ error: string | null
907
+ }
908
+
909
+ export interface Users {
910
+ id: string | null
911
+ workos_id: string | null
912
+ email: string
913
+ first_name: string | null
914
+ last_name: string | null
915
+ username: string | null
916
+ bio: string | null
917
+ location: string | null
918
+ website: string | null
919
+ social_links: string
920
+ profile_picture_url: string | null
921
+ created_at: number
922
+ updated_at: number
923
+ last_login: number | null
924
+ is_active: number
925
+ }
926
+
927
+ export interface Credentials {
928
+ id: string | null
929
+ profile_id: string | null
930
+ ses_access_key: string | null
931
+ ses_secret_key: string | null
932
+ ses_region: string | null
933
+ ses_from_email: string | null
934
+ openai_api_key: string | null
935
+ anthropic_api_key: string | null
936
+ resend_api_key: string | null
937
+ n8n_webhook_url: string | null
938
+ created_at: number
939
+ updated_at: number
940
+ }
941
+
942
+ export interface Settings {
943
+ id: string | null
944
+ profile_id: string
945
+ site_title: string | null
946
+ tagline: string | null
947
+ site_description: string | null
948
+ logo_url: string | null
949
+ favicon: string | null
950
+ og_title: string | null
951
+ og_description: string | null
952
+ og_image: string | null
953
+ canonical_url: string | null
954
+ robots: string
955
+ google_tag_manager_id: string | null
956
+ ga_tracking_id: string | null
957
+ google_site_verification: string | null
958
+ timezone: string | null
959
+ location: string | null
960
+ industry: string | null
961
+ theme: string
962
+ working_hours: string
963
+ crm_auto_approve: number
964
+ pipeline_stages: string
965
+ invoice_sequence: number
966
+ proposal_sequence: number
967
+ created_at: number
968
+ updated_at: number
969
+ }
970
+
971
+ export interface Categories {
972
+ id: string | null
973
+ name: string
974
+ slug: string
975
+ description: string | null
976
+ created_at: number
977
+ order_index: number
978
+ }
979
+
980
+ export interface Profiles {
981
+ id: string | null
982
+ user_id: string
983
+ slug: string
984
+ title: string
985
+ bio: string | null
986
+ navigation_menu: string
987
+ created_at: number
988
+ updated_at: number
989
+ enabled_categories: string
990
+ home_visibility: string
991
+ category_visibility: string
992
+ avatar_url: string | null
993
+ home_page: string | null
994
+ about: string | null
995
+ profile_theme: string
996
+ collect_emails: string
997
+ collect_emails_enabled: number
998
+ social_links: string
999
+ about_visibility: string
1000
+ landing_visibility: string
1001
+ cover_images: string
1002
+ info_visibility: string
1003
+ chat_agent_enabled: number
1004
+ chat_agent_model: string
1005
+ chat_agent_greeting: string | null
1006
+ chat_agent_personality: string | null
1007
+ chat_agent_accent_color: string
1008
+ voice_agent_enabled: number
1009
+ voice_agent_show_circle: number
1010
+ voice_agent_personality: string | null
1011
+ support_email: string | null
1012
+ from_email: string | null
1013
+ chat_widget_tab: string
1014
+ page_visibility: string
1015
+ type: string | null
1016
+ niche: string | null
1017
+ minimum_age: number
1018
+ resume: string | null
1019
+ }
1020
+
1021
+ export interface Links {
1022
+ id: string | null
1023
+ profile_id: string
1024
+ media_id: string | null
1025
+ category_id: string
1026
+ title: string
1027
+ url: string
1028
+ description: string | null
1029
+ image_url: string | null
1030
+ order_index: number
1031
+ is_active: number
1032
+ created_at: number
1033
+ updated_at: number
1034
+ keywords: string
1035
+ hidden_from_profile: number
1036
+ sale_price: string | null
1037
+ price: string | null
1038
+ button_text: string | null
1039
+ location: string | null
1040
+ date: string | null
1041
+ collection_name: string | null
1042
+ video_url: string | null
1043
+ logo_url: string | null
1044
+ post_url: string | null
1045
+ platform_name: string | null
1046
+ collection_id: string | null
1047
+ slug: string | null
1048
+ in_app: number
1049
+ geo_redirect: string
1050
+ }
1051
+
1052
+ export interface LinkAnalytics {
1053
+ id: string | null
1054
+ link_id: string
1055
+ profile_id: string
1056
+ total_clicks: number
1057
+ device_clicks: string
1058
+ os_clicks: string
1059
+ browser_clicks: string
1060
+ country_clicks: string
1061
+ city_clicks: string
1062
+ referrer_clicks: string
1063
+ analytics_lifetime: string
1064
+ analytics_24h: string
1065
+ analytics_7d: string
1066
+ analytics_30d: string
1067
+ analytics_12m: string
1068
+ utm_source_clicks: string
1069
+ utm_medium_clicks: string
1070
+ utm_campaign_clicks: string
1071
+ created_at: number
1072
+ updated_at: number
1073
+ last_aggregated_at: number
1074
+ bot_clicks: number
1075
+ }
1076
+
1077
+ export interface LinkAnalyticsByCategory {
1078
+ id: string | null
1079
+ profile_id: string
1080
+ category_id: string
1081
+ total_links: number
1082
+ active_links: number
1083
+ total_clicks: number
1084
+ bot_clicks: number
1085
+ bot_views: number
1086
+ total_views: number
1087
+ views_device_breakdown: string
1088
+ views_os_breakdown: string
1089
+ views_browser_breakdown: string
1090
+ views_country_breakdown: string
1091
+ views_city_breakdown: string
1092
+ views_referrer_breakdown: string
1093
+ views_7d: string
1094
+ views_30d: string
1095
+ views_12m: string
1096
+ views_lifetime: string
1097
+ device_clicks: string
1098
+ os_clicks: string
1099
+ browser_clicks: string
1100
+ country_clicks: string
1101
+ city_clicks: string
1102
+ referrer_clicks: string
1103
+ analytics_lifetime: string
1104
+ analytics_7d: string
1105
+ analytics_30d: string
1106
+ analytics_12m: string
1107
+ last_aggregated_at: string
1108
+ created_at: string
1109
+ updated_at: string
1110
+ }
1111
+
1112
+ export interface ClicksAnalytics {
1113
+ id: string | null
1114
+ link_id: string
1115
+ profile_id: string
1116
+ device: string | null
1117
+ os: string | null
1118
+ browser: string | null
1119
+ country: string | null
1120
+ city: string | null
1121
+ referrer: string | null
1122
+ utm_source: string | null
1123
+ utm_medium: string | null
1124
+ utm_campaign: string | null
1125
+ clicked_at: number
1126
+ is_bot: number
1127
+ }
1128
+
1129
+ export interface ProfileData {
1130
+ id: string | null
1131
+ profile_id: string
1132
+ data: string
1133
+ created_at: number
1134
+ updated_at: number
1135
+ }
1136
+
1137
+ export interface Collections {
1138
+ id: string | null
1139
+ profile_id: string
1140
+ media_id: string | null
1141
+ title: string
1142
+ slug: string
1143
+ description: string | null
1144
+ icon: string | null
1145
+ sort_order: number
1146
+ type: string | null
1147
+ category_id: string | null
1148
+ category_slug: string | null
1149
+ seo_title: string | null
1150
+ seo_description: string | null
1151
+ seo_og_image: string | null
1152
+ seo_robots: string | null
1153
+ seo_block_indexing: number
1154
+ created_at: string
1155
+ updated_at: string
1156
+ }
1157
+
1158
+ export interface CategoryPages {
1159
+ id: string | null
1160
+ profile_id: string
1161
+ media_id: string | null
1162
+ category_id: string | null
1163
+ category_slug: string
1164
+ seo_title: string | null
1165
+ seo_description: string | null
1166
+ seo_og_image: string | null
1167
+ seo_robots: string | null
1168
+ seo_block_indexing: number
1169
+ title: string | null
1170
+ description: string | null
1171
+ ads_code_sidebar: string | null
1172
+ ads_code_top: string | null
1173
+ ads_code_bottom: string | null
1174
+ published: number
1175
+ hidden: number
1176
+ image_ads: string
1177
+ is_active: number
1178
+ nav_active: number
1179
+ menu_active: number
1180
+ footer_active: number
1181
+ section: string
1182
+ created_at: number
1183
+ updated_at: number
1184
+ }
1185
+
1186
+ export interface Products {
1187
+ id: string | null
1188
+ profile_id: string
1189
+ media_id: string | null
1190
+ slider_id: string | null
1191
+ external_product_id: string | null
1192
+ user_id: string
1193
+ community_id: string | null
1194
+ type: string
1195
+ title: string
1196
+ excerpt: string | null
1197
+ description: string | null
1198
+ price_cents: number
1199
+ sale_price_cents: number | null
1200
+ currency: string
1201
+ is_active: number
1202
+ thumbnail_url: string | null
1203
+ hero_image_url: string | null
1204
+ slug: string | null
1205
+ file_url: string | null
1206
+ lessons: string | null
1207
+ total_lessons: number
1208
+ add_people: string
1209
+ location_map: string | null
1210
+ media_url: string
1211
+ forms_id: string | null
1212
+ duration_minutes: number | null
1213
+ calendar_link: string | null
1214
+ scheduling_provider: string | null
1215
+ scheduling_metadata: string | null
1216
+ webinar_link: string | null
1217
+ webinar_platform: string | null
1218
+ webinar_schedule: string | null
1219
+ billing_interval: string | null
1220
+ features: string | null
1221
+ tags: string | null
1222
+ settings: string | null
1223
+ visibility: string
1224
+ max_sales: number | null
1225
+ created_at: number
1226
+ updated_at: number
1227
+ published_at: number | null
1228
+ archived_at: number | null
1229
+ cover_video_url: string | null
1230
+ product_rating: string
1231
+ additional_details: string
1232
+ show_total_sales: number
1233
+ meeting_settings: string | null
1234
+ button_text: string | null
1235
+ webinar_settings: string | null
1236
+ category_id: string | null
1237
+ cta_clicks: number
1238
+ platform_name: string | null
1239
+ platform_url: string | null
1240
+ post_frequency: string | null
1241
+ event_settings: string | null
1242
+ cta_button: string
1243
+ unit: number
1244
+ published: number
1245
+ hidden: number
1246
+ hide_author: number
1247
+ image_ads: string
1248
+ collection_id: string | null
1249
+ confirmation_email_subject: string | null
1250
+ confirmation_email_body: string | null
1251
+ up_sell: string
1252
+ ai_summary: string | null
1253
+ course_access_type: string
1254
+ course_access_config: string
1255
+ seo_title: string | null
1256
+ seo_description: string | null
1257
+ seo_og_image: string | null
1258
+ seo_robots: string | null
1259
+ seo_block_indexing: number
1260
+ }
1261
+
1262
+ export interface ProductAnalytics {
1263
+ id: string | null
1264
+ product_id: string
1265
+ profile_id: string
1266
+ total_sales: number
1267
+ total_revenue_cents: number
1268
+ bot_views: number
1269
+ total_views: number
1270
+ views_device_breakdown: string
1271
+ views_os_breakdown: string
1272
+ views_browser_breakdown: string
1273
+ views_country_breakdown: string
1274
+ views_city_breakdown: string
1275
+ views_referrer_breakdown: string
1276
+ views_7d: string
1277
+ views_30d: string
1278
+ views_12m: string
1279
+ views_lifetime: string
1280
+ device_breakdown: string
1281
+ os_breakdown: string
1282
+ browser_breakdown: string
1283
+ country_breakdown: string
1284
+ city_breakdown: string
1285
+ referrer_breakdown: string
1286
+ sales_7d: string
1287
+ sales_30d: string
1288
+ sales_12m: string
1289
+ sales_lifetime: string
1290
+ created_at: number
1291
+ updated_at: number
1292
+ revenue_7d: string
1293
+ revenue_30d: string
1294
+ revenue_12m: string
1295
+ revenue_lifetime: string
1296
+ sales_utm_source: string
1297
+ sales_utm_medium: string
1298
+ sales_utm_campaign: string
1299
+ email_opens: number
1300
+ email_clicks: number
1301
+ last_aggregated_at: number
1302
+ }
1303
+
1304
+ export interface ProfileAnalytics {
1305
+ id: string
1306
+ profile_id: string
1307
+ bot_views: number
1308
+ total_views: number
1309
+ views_device_breakdown: string
1310
+ views_os_breakdown: string
1311
+ views_browser_breakdown: string
1312
+ views_country_breakdown: string
1313
+ views_city_breakdown: string
1314
+ views_referrer_breakdown: string
1315
+ views_7d: string
1316
+ views_30d: string
1317
+ views_12m: string
1318
+ views_lifetime: string
1319
+ total_clicks: number
1320
+ total_sales: number
1321
+ total_earnings: number
1322
+ bot_clicks: number
1323
+ device_clicks: string
1324
+ os_clicks: string
1325
+ browser_clicks: string
1326
+ country_clicks: string
1327
+ city_clicks: string
1328
+ referrer_clicks: string
1329
+ analytics_lifetime: string
1330
+ analytics_24h: string
1331
+ analytics_7d: string
1332
+ analytics_30d: string
1333
+ analytics_12m: string
1334
+ created_at: number
1335
+ updated_at: number
1336
+ sales_7d: string
1337
+ sales_30d: string
1338
+ sales_12m: string
1339
+ sales_lifetime: string
1340
+ sales_device: string
1341
+ sales_os: string
1342
+ sales_browser: string
1343
+ sales_countries: string
1344
+ sales_cities: string
1345
+ sales_referrer: string
1346
+ revenue_7d: string
1347
+ revenue_30d: string
1348
+ revenue_12m: string
1349
+ revenue_lifetime: string
1350
+ utm_source_clicks: string
1351
+ utm_medium_clicks: string
1352
+ utm_campaign_clicks: string
1353
+ sales_utm_source: string
1354
+ sales_utm_medium: string
1355
+ sales_utm_campaign: string
1356
+ total_products: number
1357
+ total_links: number
1358
+ active_links: number
1359
+ product_email_opens: number
1360
+ product_email_clicks: number
1361
+ last_aggregated_at: number
1362
+ }
1363
+
1364
+ export interface Purchases {
1365
+ id: string | null
1366
+ profile_id: string
1367
+ user_id: string
1368
+ product_id: string
1369
+ community_member_id: string | null
1370
+ transaction_id: string | null
1371
+ email: string
1372
+ customer_name: string | null
1373
+ amount_cents: number
1374
+ platform_fee_cents: number
1375
+ currency: string
1376
+ payment_processor: string
1377
+ payment_reference: string | null
1378
+ payment_status: string
1379
+ status: string
1380
+ access_token: string
1381
+ access_token_secret: string | null
1382
+ access_token_expires_at: number | null
1383
+ last_accessed_at: number | null
1384
+ access_count: number
1385
+ course_progress: string | null
1386
+ course_completed: number
1387
+ review_reply: string | null
1388
+ course_completion_date: number | null
1389
+ consultancy_scheduled_at: number | null
1390
+ consultancy_meeting_link: string | null
1391
+ consultancy_status: string | null
1392
+ subscription_id: string | null
1393
+ subscription_status: string | null
1394
+ subscription_current_period_end: number | null
1395
+ webinar_access_link: string | null
1396
+ webinar_scheduled_at: number | null
1397
+ ip_address: string | null
1398
+ user_agent: string | null
1399
+ metadata: string | null
1400
+ created_at: number
1401
+ updated_at: number
1402
+ rating_star: number | null
1403
+ rating_review: string | null
1404
+ rated_at: number | null
1405
+ buyer_avatar_url: string | null
1406
+ slots: string | null
1407
+ meeting_link: string | null
1408
+ customer_message: string | null
1409
+ rating_reply: string | null
1410
+ approval_status: string
1411
+ device: string | null
1412
+ os: string | null
1413
+ browser: string | null
1414
+ referrer: string | null
1415
+ city: string | null
1416
+ country: string | null
1417
+ timezone: string | null
1418
+ utm_source: string | null
1419
+ utm_medium: string | null
1420
+ utm_campaign: string | null
1421
+ refunded_at: number | null
1422
+ refund_reason: string | null
1423
+ }
1424
+
1425
+ export interface Sessions {
1426
+ id: string | null
1427
+ user_id: string
1428
+ session_token: string
1429
+ expires_at: string
1430
+ created_at: string | null
1431
+ ip_address: string | null
1432
+ user_agent: string | null
1433
+ }
1434
+
1435
+ export interface Subscribers {
1436
+ id: string | null
1437
+ profile_id: string
1438
+ email: string
1439
+ name: string | null
1440
+ phone: string | null
1441
+ referrer_domain: string | null
1442
+ timezone: string | null
1443
+ browser_name: string | null
1444
+ os_name: string | null
1445
+ device_type: string | null
1446
+ ip_address: string | null
1447
+ country: string | null
1448
+ city: string | null
1449
+ is_blocked: string
1450
+ is_unsubscribed: string
1451
+ blocked_at: number | null
1452
+ unsubscribed_at: number | null
1453
+ block_reason: string | null
1454
+ signup_timestamp: number
1455
+ }
1456
+
1457
+ export interface Gateways {
1458
+ id: string | null
1459
+ profile_id: string
1460
+ provider: string
1461
+ is_active: number
1462
+ is_test_mode: number
1463
+ credentials: string
1464
+ created_at: number
1465
+ }
1466
+
1467
+ export interface Pages {
1468
+ id: string | null
1469
+ profile_id: string
1470
+ media_id: string | null
1471
+ user_id: string
1472
+ title: string
1473
+ slug: string
1474
+ excerpt: string | null
1475
+ text_field: string | null
1476
+ hero_slider: string | null
1477
+ hero_section: string | null
1478
+ testimonials: string | null
1479
+ pricing: string | null
1480
+ faq: string | null
1481
+ trusted_by: string | null
1482
+ intro_section: string | null
1483
+ heighlights: string | null
1484
+ category_visibility: string | null
1485
+ curriculum: string | null
1486
+ people_section: string | null
1487
+ about_section: string | null
1488
+ cta_section: string | null
1489
+ nav_active: number
1490
+ menu_active: number
1491
+ footer_active: number
1492
+ published: number
1493
+ hidden: number
1494
+ is_active: number
1495
+ order_index: number
1496
+ ai_summary: string | null
1497
+ lead_magnet: string | null
1498
+ text_area: string | null
1499
+ subscribe_chat: string | null
1500
+ content_list: string | null
1501
+ custom_design_a: string | null
1502
+ custom_design_b: string | null
1503
+ custom_design_c: string | null
1504
+ section_a: string | null
1505
+ section_b: string | null
1506
+ section_c: string | null
1507
+ section_d: string | null
1508
+ section_e: string | null
1509
+ section_f: string | null
1510
+ section_g: string | null
1511
+ section_h: string | null
1512
+ section_i: string | null
1513
+ section_j: string | null
1514
+ contact_us: string | null
1515
+ subscribe: string | null
1516
+ slider: string | null
1517
+ created_at: number
1518
+ updated_at: number
1519
+ }
1520
+
1521
+ export interface PageAnalytics {
1522
+ id: string | null
1523
+ page_id: string
1524
+ profile_id: string
1525
+ bot_views: number
1526
+ total_views: number
1527
+ views_device_breakdown: string
1528
+ views_os_breakdown: string
1529
+ views_browser_breakdown: string
1530
+ views_country_breakdown: string
1531
+ views_city_breakdown: string
1532
+ views_referrer_breakdown: string
1533
+ views_7d: string
1534
+ views_30d: string
1535
+ views_12m: string
1536
+ views_lifetime: string
1537
+ last_aggregated_at: string
1538
+ updated_at: string
1539
+ }
1540
+
1541
+ export interface CmsTables {
1542
+ id: string | null
1543
+ profile_id: string
1544
+ user_id: string
1545
+ slug: string
1546
+ title: string
1547
+ subtitle: string | null
1548
+ content: string | null
1549
+ excerpt: string | null
1550
+ hero_image_url: string | null
1551
+ cta_button_url: string | null
1552
+ cta_button_text: string | null
1553
+ faqs: string
1554
+ additional_details: string
1555
+ published: number
1556
+ hidden: number
1557
+ date: string | null
1558
+ collection_id: string | null
1559
+ hide_author: number
1560
+ image_ads: string
1561
+ ai_summary: string | null
1562
+ custom_design: string | null
1563
+ seo_title: string | null
1564
+ seo_description: string | null
1565
+ seo_keywords: string | null
1566
+ word_count: number | null
1567
+ reading_time_mins: number | null
1568
+ internal_links: number | null
1569
+ external_links: number | null
1570
+ sources: string | null
1571
+ social_links: string
1572
+ website: string | null
1573
+ logo_url: string | null
1574
+ name: string | null
1575
+ tagline: string | null
1576
+ highlights: string
1577
+ hide_info: number
1578
+ cms_id: string | null
1579
+ location: string | null
1580
+ created_at: string
1581
+ updated_at: string
1582
+ }
1583
+
1584
+ export interface Media {
1585
+ id: string | null
1586
+ profile_id: string
1587
+ name: string
1588
+ media_type: string
1589
+ url: string
1590
+ alt_text: string | null
1591
+ thumbnail_url: string | null
1592
+ size_bytes: number | null
1593
+ mime_type: string | null
1594
+ created_at: number
1595
+ }
1596
+
1597
+ export interface Sliders {
1598
+ id: string | null
1599
+ profile_id: string
1600
+ title: string
1601
+ created_at: number
1602
+ }
1603
+
1604
+ export interface SliderItems {
1605
+ id: string | null
1606
+ profile_id: string
1607
+ slider_id: string
1608
+ media_id: string | null
1609
+ position: number
1610
+ caption: string | null
1611
+ link: string | null
1612
+ created_at: number
1613
+ }
1614
+
1615
+ // ── social.ts ───────────────────────────────────────────────────
1616
+
1617
+ export interface Connections {
1618
+ id: string | null
1619
+ profile_id: string
1620
+ name: 'zernio' | 'twitter_direct' | 'instagram_direct' | 'facebook_direct'
1621
+ url: string | null
1622
+ username: string | null
1623
+ password: string | null
1624
+ is_active: number
1625
+ is_verified: number
1626
+ last_error: string | null
1627
+ error_count: number
1628
+ created_at: number
1629
+ updated_at: number
1630
+ }
1631
+
1632
+ export interface SocialAccounts {
1633
+ id: string | null
1634
+ profile_id: string
1635
+ connection_id: string
1636
+ connection_mode: 'zernio_platform' | 'zernio_byok' | 'direct' | 'n8n'
1637
+ zernio_profile_id: 'twitter' | 'instagram' | 'facebook' | 'linkedin' | 'tiktok' | null
1638
+ }
1639
+
1640
+ export interface SocialPostGroups {
1641
+ id: string | null
1642
+ profile_id: string
1643
+ created_at: number
1644
+ }
1645
+
1646
+ export interface SocialPosts {
1647
+ id: string | null
1648
+ profile_id: string
1649
+ account_id: 'twitter' | 'instagram' | 'facebook' | 'linkedin' | 'tiktok'
1650
+ direct: string | null
1651
+ or: string | null
1652
+ platform_post_url: string | null
1653
+ zernio_account_id: string | null
1654
+ media_items: string
1655
+ link_title: string | null
1656
+ link_description: string | null
1657
+ link_thumbnail_url: 'draft' | 'scheduled' | 'queued' | 'publishing' | 'published' | null
1658
+ publish_now: number
1659
+ use_queue: number
1660
+ queue_slot_id: string | null
1661
+ set: 'pending' | 'approved' | 'rejected' | 'auto_sent'
1662
+ approved_at: 'manual' | 'agent' | 'blog_crosspost' | 'product_launch' | null
1663
+ ai_prompt: string | null
1664
+ NULL: string
1665
+ ai_label: 'promotional' | 'educational' | 'engagement' | 'testimonial' | 'announcement' | null
1666
+ }
1667
+
1668
+ export interface SocialPostAnalytics {
1669
+ id: string | null
1670
+ post_id: string
1671
+ comments: number
1672
+ shares: number
1673
+ reposts: number
1674
+ reach: number
1675
+ clicks: number
1676
+ completion_rate_pct: number | null
1677
+ same: string | null
1678
+ post_city_breakdown: string | null
1679
+ post_age_breakdown: string | null
1680
+ post_gender_breakdown: string | null
1681
+ post_device_breakdown: string | null
1682
+ analytics_synced_at: number | null
1683
+ created_at: number
1684
+ updated_at: number
1685
+ }
1686
+
1687
+ export interface SocialAnalytics {
1688
+ id: string | null
1689
+ profile_id: string
1690
+ account_id: string
1691
+ follower_change_7d: number
1692
+ follower_change_30d: number
1693
+ total_comments: number
1694
+ total_shares: number
1695
+ total_impressions: number
1696
+ total_reach: number
1697
+ total_clicks: number
1698
+ total_saves: number
1699
+ total_views: number
1700
+ avg_engagement_rate: number
1701
+ posts_30d: string
1702
+ posts_12m: string
1703
+ impressions_7d: string
1704
+ impressions_30d: string
1705
+ impressions_12m: string
1706
+ engagement_7d: string
1707
+ engagement_30d: string
1708
+ engagement_12m: string
1709
+ follower_7d: string
1710
+ follower_30d: string
1711
+ best_time_breakdown: string
1712
+ content_type_breakdown: string
1713
+ last_aggregated_at: number | null
1714
+ last_synced_at: number | null
1715
+ updated_at: number
1716
+ }
1717
+
1718
+ export interface SocialMediaKit {
1719
+ id: string | null
1720
+ profile_id: string
1721
+ total_followers: number
1722
+ total_reach_30d: number
1723
+ avg_engagement_rate: number
1724
+ follower_growth_30d: number
1725
+ platform_breakdown: string
1726
+ audience_country_breakdown: string
1727
+ audience_city_breakdown: string
1728
+ audience_gender_breakdown: string
1729
+ audience_age_breakdown: string
1730
+ audience_language_breakdown: string
1731
+ audience_interest_breakdown: string
1732
+ audience_device_breakdown: string
1733
+ top_posts: string
1734
+ content_type_breakdown: string
1735
+ best_time_breakdown: string
1736
+ show_country: number
1737
+ show_city: number
1738
+ show_gender: number
1739
+ show_age: number
1740
+ show_platform_breakdown: number
1741
+ show_engagement_rate: number
1742
+ last_computed_at: number | null
1743
+ created_at: number
1744
+ updated_at: number
1745
+ }
1746
+
1747
+ export interface SocialQueue {
1748
+ id: string | null
1749
+ profile_id: string
1750
+ account_id: string
1751
+ zernio_slot_id: string | null
1752
+ day_of_week: number
1753
+ is_active: number
1754
+ last_used_at: number | null
1755
+ next_scheduled_at: number | null
1756
+ created_at: number
1757
+ updated_at: number
1758
+ }
1759
+
1760
+ export interface SocialInbox {
1761
+ id: string | null
1762
+ profile_id: string
1763
+ account_id: string
1764
+ inbox_source: 'zernio' | 'direct' | 'n8n' | 'manual'
1765
+ zernio_message_id: 'dm' | 'comment' | 'review' | null
1766
+ sender_username: string | null
1767
+ sender_display_name: string | null
1768
+ sender_avatar_url: string | null
1769
+ sender_profile_url: string | null
1770
+ sender_follower_count: number | null
1771
+ media_urls: string
1772
+ review_title: 'unread' | 'read' | 'replied' | 'archived' | 'spam' | null
1773
+ is_pinned: number
1774
+ sentiment: 'positive' | 'neutral' | 'negative' | null
1775
+ replied_at: number | null
1776
+ replied_by: 'agent' | 'user' | null
1777
+ agent_sentiment: string | null
1778
+ agent_suggested_action: 'reply' | 'archive' | 'escalate' | 'add_to_crm' | 'ignore' | null
1779
+ approval_status: 'pending' | 'approved' | 'rejected' | 'auto_sent'
1780
+ created_at: number
1781
+ updated_at: number
1782
+ }
1783
+
1784
+ export interface SocialLabels {
1785
+ id: string | null
1786
+ profile_id: string
1787
+ name: string
1788
+ color: string
1789
+ icon: string | null
1790
+ usage_count: number
1791
+ created_at: number
1792
+ }
1793
+
1794
+ export interface SocialAutomations {
1795
+ id: string | null
1796
+ profile_id: string
1797
+ account_id: string | null
1798
+ description: string | null
1799
+ automation_family: 'content' | 'engagement'
1800
+ ai_prompt_template: string | null
1801
+ use_queue: number
1802
+ is_active: number
1803
+ last_triggered_at: number | null
1804
+ trigger_count: number
1805
+ dm_sent_count: number
1806
+ crm_leads_created: number
1807
+ last_error: string | null
1808
+ created_at: number
1809
+ updated_at: number
1810
+ }
1811
+
1812
+ export interface SocialAutomationLogs {
1813
+ id: string | null
1814
+ profile_id: string
1815
+ automation_id: string
1816
+ trigger_type: string
1817
+ triggered_at: number
1818
+ commenter_username: string | null
1819
+ commenter_display_name: string | null
1820
+ comment_content: string | null
1821
+ keyword_matched: 'sent' | 'failed' | 'skipped' | null
1822
+ comment_reply_sent: number
1823
+ created_at: number
1824
+ }
1825
+
1826
+ export interface SocialSequences {
1827
+ id: string | null
1828
+ profile_id: string
1829
+ account_id: string
1830
+ zernio_sequence_id: string | null
1831
+ name: string
1832
+ description: string | null
1833
+ platform: string
1834
+ status: 'draft' | 'active' | 'paused' | 'archived'
1835
+ total_completed: number
1836
+ total_unsubscribed: number
1837
+ total_replied: number
1838
+ reply_rate_pct: number
1839
+ is_active: number
1840
+ activated_at: number | null
1841
+ created_at: number
1842
+ updated_at: number
1843
+ }
1844
+
1845
+ export interface SocialSequenceSteps {
1846
+ id: string | null
1847
+ sequence_id: string
1848
+ profile_id: string
1849
+ step_order: number
1850
+ delay_minutes: number
1851
+ message_text: string
1852
+ media_urls: string
1853
+ created_at: number
1854
+ }
1855
+
1856
+ export interface SocialSequenceEnrollments {
1857
+ id: string | null
1858
+ sequence_id: string
1859
+ profile_id: string
1860
+ zernio_enrollment_id: string | null
1861
+ zernio_contact_id: string | null
1862
+ contact_platform_id: string
1863
+ contact_username: string | null
1864
+ contact_display_name: string | null
1865
+ crm_contact_id: string | null
1866
+ status: 'active' | 'completed' | 'unsubscribed' | 'failed' | 'paused'
1867
+ last_message_sent_at: number | null
1868
+ next_message_at: number | null
1869
+ replied: number
1870
+ replied_at: number | null
1871
+ enrolled_at: number
1872
+ completed_at: number | null
1873
+ created_at: number
1874
+ updated_at: number
1875
+ }
1876
+
1877
+ export interface SocialBroadcasts {
1878
+ id: string | null
1879
+ profile_id: string
1880
+ account_id: string
1881
+ zernio_broadcast_id: string | null
1882
+ name: string
1883
+ platform: string
1884
+ message_text: string
1885
+ media_urls: string
1886
+ status: 'draft' | 'scheduled' | 'sending' | 'sent' | 'cancelled' | 'failed'
1887
+ sent_at: number | null
1888
+ recipient_count: number
1889
+ delivered_count: number
1890
+ failed_count: number
1891
+ reply_count: number
1892
+ segment_config: string | null
1893
+ created_at: number
1894
+ updated_at: number
1895
+ }
1896
+
1897
+ export interface SocialCompetitors {
1898
+ id: string | null
1899
+ profile_id: string
1900
+ platform: string
1901
+ display_name: string | null
1902
+ avatar_url: string | null
1903
+ bio: string | null
1904
+ platform_url: string | null
1905
+ website: string | null
1906
+ category: string | null
1907
+ is_verified: number
1908
+ following_count: number
1909
+ platform_post_count: number
1910
+ avg_engagement_rate: number
1911
+ avg_comments_per_post: number
1912
+ avg_views_per_post: number
1913
+ audience_age_breakdown: string | null
1914
+ audience_gender_breakdown: 'competitor' | 'inspiration' | 'partner' | 'client' | 'influencer' | 'watch' | null
1915
+ last_analyzed_at: number | null
1916
+ track_posts: number
1917
+ created_at: number
1918
+ updated_at: number
1919
+ }
1920
+
1921
+ export interface SocialCompetitorPosts {
1922
+ id: string | null
1923
+ profile_id: string
1924
+ competitor_id: string
1925
+ platform_post_id: string
1926
+ }
1927
+
1928
+ export const TABLES = {
1929
+ agents: 'agents' as const,
1930
+ agent_skills: 'agent_skills' as const,
1931
+ skill_files: 'skill_files' as const,
1932
+ agent_memory: 'agent_memory' as const,
1933
+ agent_notes: 'agent_notes' as const,
1934
+ agent_files: 'agent_files' as const,
1935
+ agent_tasks: 'agent_tasks' as const,
1936
+ agent_reports: 'agent_reports' as const,
1937
+ agent_kb: 'agent_kb' as const,
1938
+ agent_conversations: 'agent_conversations' as const,
1939
+ agent_audit: 'agent_audit' as const,
1940
+ content: 'content' as const,
1941
+ content_reaction: 'content_reaction' as const,
1942
+ content_comment: 'content_comment' as const,
1943
+ cms: 'cms' as const,
1944
+ content_views: 'content_views' as const,
1945
+ content_analytics: 'content_analytics' as const,
1946
+ cms_analytics: 'cms_analytics' as const,
1947
+ doc_analytics: 'doc_analytics' as const,
1948
+ doc_collections: 'doc_collections' as const,
1949
+ doc_articles: 'doc_articles' as const,
1950
+ crm_contacts: 'crm_contacts' as const,
1951
+ crm_deals: 'crm_deals' as const,
1952
+ crm_activities: 'crm_activities' as const,
1953
+ crm_tasks: 'crm_tasks' as const,
1954
+ crm_notes: 'crm_notes' as const,
1955
+ crm_groups: 'crm_groups' as const,
1956
+ crm_contact_groups: 'crm_contact_groups' as const,
1957
+ crm_templates: 'crm_templates' as const,
1958
+ crm_proposals: 'crm_proposals' as const,
1959
+ crm_invoices: 'crm_invoices' as const,
1960
+ crm_imports: 'crm_imports' as const,
1961
+ crm_analytics: 'crm_analytics' as const,
1962
+ forms: 'forms' as const,
1963
+ questions: 'questions' as const,
1964
+ submissions: 'submissions' as const,
1965
+ form_analytics: 'form_analytics' as const,
1966
+ job_listings: 'job_listings' as const,
1967
+ job_applications: 'job_applications' as const,
1968
+ job_analytics: 'job_analytics' as const,
1969
+ _schema_migrations: '_schema_migrations' as const,
1970
+ users: 'users' as const,
1971
+ credentials: 'credentials' as const,
1972
+ settings: 'settings' as const,
1973
+ categories: 'categories' as const,
1974
+ profiles: 'profiles' as const,
1975
+ links: 'links' as const,
1976
+ link_analytics: 'link_analytics' as const,
1977
+ link_analytics_by_category: 'link_analytics_by_category' as const,
1978
+ clicks_analytics: 'clicks_analytics' as const,
1979
+ profile_data: 'profile_data' as const,
1980
+ collections: 'collections' as const,
1981
+ category_pages: 'category_pages' as const,
1982
+ products: 'products' as const,
1983
+ product_analytics: 'product_analytics' as const,
1984
+ profile_analytics: 'profile_analytics' as const,
1985
+ purchases: 'purchases' as const,
1986
+ sessions: 'sessions' as const,
1987
+ subscribers: 'subscribers' as const,
1988
+ gateways: 'gateways' as const,
1989
+ pages: 'pages' as const,
1990
+ page_analytics: 'page_analytics' as const,
1991
+ cms_tables: 'cms_tables' as const,
1992
+ media: 'media' as const,
1993
+ sliders: 'sliders' as const,
1994
+ slider_items: 'slider_items' as const,
1995
+ connections: 'connections' as const,
1996
+ social_accounts: 'social_accounts' as const,
1997
+ social_post_groups: 'social_post_groups' as const,
1998
+ social_posts: 'social_posts' as const,
1999
+ social_post_analytics: 'social_post_analytics' as const,
2000
+ social_analytics: 'social_analytics' as const,
2001
+ social_media_kit: 'social_media_kit' as const,
2002
+ social_queue: 'social_queue' as const,
2003
+ social_inbox: 'social_inbox' as const,
2004
+ social_labels: 'social_labels' as const,
2005
+ social_automations: 'social_automations' as const,
2006
+ social_automation_logs: 'social_automation_logs' as const,
2007
+ social_sequences: 'social_sequences' as const,
2008
+ social_sequence_steps: 'social_sequence_steps' as const,
2009
+ social_sequence_enrollments: 'social_sequence_enrollments' as const,
2010
+ social_broadcasts: 'social_broadcasts' as const,
2011
+ social_competitors: 'social_competitors' as const,
2012
+ social_competitor_posts: 'social_competitor_posts' as const,
2013
+ }
2014
+
2015
+ export type TableName = keyof typeof TABLES