@elevasis/sdk 1.13.1 → 1.14.0

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.
@@ -483,6 +483,16 @@ interface WorkflowDefinition {
483
483
  * If provided, workflow appears in Execution Runner UI
484
484
  */
485
485
  interface?: ExecutionInterface;
486
+ /**
487
+ * Lead-gen processing stage this workflow implements (optional).
488
+ * Must match a key in the platform lead-gen stage catalog.
489
+ * Used by org-os graph derivation to surface workflow→stage edges and
490
+ * by pipeline_config validation to confirm each catalog stage has an
491
+ * implementing workflow before a list is activated.
492
+ *
493
+ * Example: stageImplemented: 'verified' on the email-verification workflow.
494
+ */
495
+ stageImplemented?: string;
486
496
  }
487
497
 
488
498
  /**
@@ -885,7 +895,7 @@ type Json = string | number | boolean | null | {
885
895
  } | Json[];
886
896
  type Database = {
887
897
  __InternalSupabase: {
888
- PostgrestVersion: "12.2.3 (519615d)";
898
+ PostgrestVersion: '12.2.3 (519615d)';
889
899
  };
890
900
  public: {
891
901
  Tables: {
@@ -928,11 +938,11 @@ type Database = {
928
938
  };
929
939
  Relationships: [
930
940
  {
931
- foreignKeyName: "acq_artifacts_organization_id_fkey";
932
- columns: ["organization_id"];
941
+ foreignKeyName: 'acq_artifacts_organization_id_fkey';
942
+ columns: ['organization_id'];
933
943
  isOneToOne: false;
934
- referencedRelation: "organizations";
935
- referencedColumns: ["id"];
944
+ referencedRelation: 'organizations';
945
+ referencedColumns: ['id'];
936
946
  }
937
947
  ];
938
948
  };
@@ -1017,11 +1027,11 @@ type Database = {
1017
1027
  };
1018
1028
  Relationships: [
1019
1029
  {
1020
- foreignKeyName: "acq_companies_organization_id_fkey";
1021
- columns: ["organization_id"];
1030
+ foreignKeyName: 'acq_companies_organization_id_fkey';
1031
+ columns: ['organization_id'];
1022
1032
  isOneToOne: false;
1023
- referencedRelation: "organizations";
1024
- referencedColumns: ["id"];
1033
+ referencedRelation: 'organizations';
1034
+ referencedColumns: ['id'];
1025
1035
  }
1026
1036
  ];
1027
1037
  };
@@ -1112,18 +1122,18 @@ type Database = {
1112
1122
  };
1113
1123
  Relationships: [
1114
1124
  {
1115
- foreignKeyName: "acq_contacts_company_id_fkey";
1116
- columns: ["company_id"];
1125
+ foreignKeyName: 'acq_contacts_company_id_fkey';
1126
+ columns: ['company_id'];
1117
1127
  isOneToOne: false;
1118
- referencedRelation: "acq_companies";
1119
- referencedColumns: ["id"];
1128
+ referencedRelation: 'acq_companies';
1129
+ referencedColumns: ['id'];
1120
1130
  },
1121
1131
  {
1122
- foreignKeyName: "acq_contacts_organization_id_fkey";
1123
- columns: ["organization_id"];
1132
+ foreignKeyName: 'acq_contacts_organization_id_fkey';
1133
+ columns: ['organization_id'];
1124
1134
  isOneToOne: false;
1125
- referencedRelation: "organizations";
1126
- referencedColumns: ["id"];
1135
+ referencedRelation: 'organizations';
1136
+ referencedColumns: ['id'];
1127
1137
  }
1128
1138
  ];
1129
1139
  };
@@ -1160,11 +1170,11 @@ type Database = {
1160
1170
  };
1161
1171
  Relationships: [
1162
1172
  {
1163
- foreignKeyName: "acq_content_organization_id_fkey";
1164
- columns: ["organization_id"];
1173
+ foreignKeyName: 'acq_content_organization_id_fkey';
1174
+ columns: ['organization_id'];
1165
1175
  isOneToOne: false;
1166
- referencedRelation: "organizations";
1167
- referencedColumns: ["id"];
1176
+ referencedRelation: 'organizations';
1177
+ referencedColumns: ['id'];
1168
1178
  }
1169
1179
  ];
1170
1180
  };
@@ -1228,18 +1238,18 @@ type Database = {
1228
1238
  };
1229
1239
  Relationships: [
1230
1240
  {
1231
- foreignKeyName: "acq_content_distributions_content_id_fkey";
1232
- columns: ["content_id"];
1241
+ foreignKeyName: 'acq_content_distributions_content_id_fkey';
1242
+ columns: ['content_id'];
1233
1243
  isOneToOne: false;
1234
- referencedRelation: "acq_content";
1235
- referencedColumns: ["id"];
1244
+ referencedRelation: 'acq_content';
1245
+ referencedColumns: ['id'];
1236
1246
  },
1237
1247
  {
1238
- foreignKeyName: "acq_content_distributions_organization_id_fkey";
1239
- columns: ["organization_id"];
1248
+ foreignKeyName: 'acq_content_distributions_organization_id_fkey';
1249
+ columns: ['organization_id'];
1240
1250
  isOneToOne: false;
1241
- referencedRelation: "organizations";
1242
- referencedColumns: ["id"];
1251
+ referencedRelation: 'organizations';
1252
+ referencedColumns: ['id'];
1243
1253
  }
1244
1254
  ];
1245
1255
  };
@@ -1273,18 +1283,18 @@ type Database = {
1273
1283
  };
1274
1284
  Relationships: [
1275
1285
  {
1276
- foreignKeyName: "acq_deal_notes_deal_id_fkey";
1277
- columns: ["deal_id"];
1286
+ foreignKeyName: 'acq_deal_notes_deal_id_fkey';
1287
+ columns: ['deal_id'];
1278
1288
  isOneToOne: false;
1279
- referencedRelation: "acq_deals";
1280
- referencedColumns: ["id"];
1289
+ referencedRelation: 'acq_deals';
1290
+ referencedColumns: ['id'];
1281
1291
  },
1282
1292
  {
1283
- foreignKeyName: "acq_deal_notes_organization_id_fkey";
1284
- columns: ["organization_id"];
1293
+ foreignKeyName: 'acq_deal_notes_organization_id_fkey';
1294
+ columns: ['organization_id'];
1285
1295
  isOneToOne: false;
1286
- referencedRelation: "organizations";
1287
- referencedColumns: ["id"];
1296
+ referencedRelation: 'organizations';
1297
+ referencedColumns: ['id'];
1288
1298
  }
1289
1299
  ];
1290
1300
  };
@@ -1336,18 +1346,18 @@ type Database = {
1336
1346
  };
1337
1347
  Relationships: [
1338
1348
  {
1339
- foreignKeyName: "acq_deal_tasks_deal_id_fkey";
1340
- columns: ["deal_id"];
1349
+ foreignKeyName: 'acq_deal_tasks_deal_id_fkey';
1350
+ columns: ['deal_id'];
1341
1351
  isOneToOne: false;
1342
- referencedRelation: "acq_deals";
1343
- referencedColumns: ["id"];
1352
+ referencedRelation: 'acq_deals';
1353
+ referencedColumns: ['id'];
1344
1354
  },
1345
1355
  {
1346
- foreignKeyName: "acq_deal_tasks_organization_id_fkey";
1347
- columns: ["organization_id"];
1356
+ foreignKeyName: 'acq_deal_tasks_organization_id_fkey';
1357
+ columns: ['organization_id'];
1348
1358
  isOneToOne: false;
1349
- referencedRelation: "organizations";
1350
- referencedColumns: ["id"];
1359
+ referencedRelation: 'organizations';
1360
+ referencedColumns: ['id'];
1351
1361
  }
1352
1362
  ];
1353
1363
  };
@@ -1459,25 +1469,25 @@ type Database = {
1459
1469
  };
1460
1470
  Relationships: [
1461
1471
  {
1462
- foreignKeyName: "acq_deals_contact_id_fkey";
1463
- columns: ["contact_id"];
1472
+ foreignKeyName: 'acq_deals_contact_id_fkey';
1473
+ columns: ['contact_id'];
1464
1474
  isOneToOne: false;
1465
- referencedRelation: "acq_contacts";
1466
- referencedColumns: ["id"];
1475
+ referencedRelation: 'acq_contacts';
1476
+ referencedColumns: ['id'];
1467
1477
  },
1468
1478
  {
1469
- foreignKeyName: "acq_deals_organization_id_fkey";
1470
- columns: ["organization_id"];
1479
+ foreignKeyName: 'acq_deals_organization_id_fkey';
1480
+ columns: ['organization_id'];
1471
1481
  isOneToOne: false;
1472
- referencedRelation: "organizations";
1473
- referencedColumns: ["id"];
1482
+ referencedRelation: 'organizations';
1483
+ referencedColumns: ['id'];
1474
1484
  },
1475
1485
  {
1476
- foreignKeyName: "acq_deals_source_list_id_fkey";
1477
- columns: ["source_list_id"];
1486
+ foreignKeyName: 'acq_deals_source_list_id_fkey';
1487
+ columns: ['source_list_id'];
1478
1488
  isOneToOne: false;
1479
- referencedRelation: "acq_lists";
1480
- referencedColumns: ["id"];
1489
+ referencedRelation: 'acq_lists';
1490
+ referencedColumns: ['id'];
1481
1491
  }
1482
1492
  ];
1483
1493
  };
@@ -1490,6 +1500,7 @@ type Database = {
1490
1500
  id: string;
1491
1501
  list_id: string;
1492
1502
  pipeline_key: string;
1503
+ processing_state: Json;
1493
1504
  source_execution_id: string | null;
1494
1505
  source_input_hash: string | null;
1495
1506
  source_resource_id: string | null;
@@ -1504,6 +1515,7 @@ type Database = {
1504
1515
  id?: string;
1505
1516
  list_id: string;
1506
1517
  pipeline_key?: string;
1518
+ processing_state?: Json;
1507
1519
  source_execution_id?: string | null;
1508
1520
  source_input_hash?: string | null;
1509
1521
  source_resource_id?: string | null;
@@ -1518,6 +1530,7 @@ type Database = {
1518
1530
  id?: string;
1519
1531
  list_id?: string;
1520
1532
  pipeline_key?: string;
1533
+ processing_state?: Json;
1521
1534
  source_execution_id?: string | null;
1522
1535
  source_input_hash?: string | null;
1523
1536
  source_resource_id?: string | null;
@@ -1526,25 +1539,25 @@ type Database = {
1526
1539
  };
1527
1540
  Relationships: [
1528
1541
  {
1529
- foreignKeyName: "acq_list_companies_company_id_fkey";
1530
- columns: ["company_id"];
1542
+ foreignKeyName: 'acq_list_companies_company_id_fkey';
1543
+ columns: ['company_id'];
1531
1544
  isOneToOne: false;
1532
- referencedRelation: "acq_companies";
1533
- referencedColumns: ["id"];
1545
+ referencedRelation: 'acq_companies';
1546
+ referencedColumns: ['id'];
1534
1547
  },
1535
1548
  {
1536
- foreignKeyName: "acq_list_companies_list_id_fkey";
1537
- columns: ["list_id"];
1549
+ foreignKeyName: 'acq_list_companies_list_id_fkey';
1550
+ columns: ['list_id'];
1538
1551
  isOneToOne: false;
1539
- referencedRelation: "acq_lists";
1540
- referencedColumns: ["id"];
1552
+ referencedRelation: 'acq_lists';
1553
+ referencedColumns: ['id'];
1541
1554
  },
1542
1555
  {
1543
- foreignKeyName: "acq_list_companies_source_execution_id_fkey";
1544
- columns: ["source_execution_id"];
1556
+ foreignKeyName: 'acq_list_companies_source_execution_id_fkey';
1557
+ columns: ['source_execution_id'];
1545
1558
  isOneToOne: false;
1546
- referencedRelation: "execution_logs";
1547
- referencedColumns: ["execution_id"];
1559
+ referencedRelation: 'execution_logs';
1560
+ referencedColumns: ['execution_id'];
1548
1561
  }
1549
1562
  ];
1550
1563
  };
@@ -1572,18 +1585,18 @@ type Database = {
1572
1585
  };
1573
1586
  Relationships: [
1574
1587
  {
1575
- foreignKeyName: "acq_list_executions_execution_id_fkey";
1576
- columns: ["execution_id"];
1588
+ foreignKeyName: 'acq_list_executions_execution_id_fkey';
1589
+ columns: ['execution_id'];
1577
1590
  isOneToOne: false;
1578
- referencedRelation: "execution_logs";
1579
- referencedColumns: ["execution_id"];
1591
+ referencedRelation: 'execution_logs';
1592
+ referencedColumns: ['execution_id'];
1580
1593
  },
1581
1594
  {
1582
- foreignKeyName: "acq_list_executions_list_id_fkey";
1583
- columns: ["list_id"];
1595
+ foreignKeyName: 'acq_list_executions_list_id_fkey';
1596
+ columns: ['list_id'];
1584
1597
  isOneToOne: false;
1585
- referencedRelation: "acq_lists";
1586
- referencedColumns: ["id"];
1598
+ referencedRelation: 'acq_lists';
1599
+ referencedColumns: ['id'];
1587
1600
  }
1588
1601
  ];
1589
1602
  };
@@ -1596,6 +1609,7 @@ type Database = {
1596
1609
  id: string;
1597
1610
  list_id: string;
1598
1611
  pipeline_key: string;
1612
+ processing_state: Json;
1599
1613
  source_execution_id: string | null;
1600
1614
  source_input_hash: string | null;
1601
1615
  source_resource_id: string | null;
@@ -1610,6 +1624,7 @@ type Database = {
1610
1624
  id?: string;
1611
1625
  list_id: string;
1612
1626
  pipeline_key?: string;
1627
+ processing_state?: Json;
1613
1628
  source_execution_id?: string | null;
1614
1629
  source_input_hash?: string | null;
1615
1630
  source_resource_id?: string | null;
@@ -1624,6 +1639,7 @@ type Database = {
1624
1639
  id?: string;
1625
1640
  list_id?: string;
1626
1641
  pipeline_key?: string;
1642
+ processing_state?: Json;
1627
1643
  source_execution_id?: string | null;
1628
1644
  source_input_hash?: string | null;
1629
1645
  source_resource_id?: string | null;
@@ -1632,90 +1648,84 @@ type Database = {
1632
1648
  };
1633
1649
  Relationships: [
1634
1650
  {
1635
- foreignKeyName: "acq_list_members_contact_id_fkey";
1636
- columns: ["contact_id"];
1651
+ foreignKeyName: 'acq_list_members_contact_id_fkey';
1652
+ columns: ['contact_id'];
1637
1653
  isOneToOne: false;
1638
- referencedRelation: "acq_contacts";
1639
- referencedColumns: ["id"];
1654
+ referencedRelation: 'acq_contacts';
1655
+ referencedColumns: ['id'];
1640
1656
  },
1641
1657
  {
1642
- foreignKeyName: "acq_list_members_list_id_fkey";
1643
- columns: ["list_id"];
1658
+ foreignKeyName: 'acq_list_members_list_id_fkey';
1659
+ columns: ['list_id'];
1644
1660
  isOneToOne: false;
1645
- referencedRelation: "acq_lists";
1646
- referencedColumns: ["id"];
1661
+ referencedRelation: 'acq_lists';
1662
+ referencedColumns: ['id'];
1647
1663
  },
1648
1664
  {
1649
- foreignKeyName: "acq_list_members_source_execution_id_fkey";
1650
- columns: ["source_execution_id"];
1665
+ foreignKeyName: 'acq_list_members_source_execution_id_fkey';
1666
+ columns: ['source_execution_id'];
1651
1667
  isOneToOne: false;
1652
- referencedRelation: "execution_logs";
1653
- referencedColumns: ["execution_id"];
1668
+ referencedRelation: 'execution_logs';
1669
+ referencedColumns: ['execution_id'];
1654
1670
  }
1655
1671
  ];
1656
1672
  };
1657
1673
  acq_lists: {
1658
1674
  Row: {
1659
- activity_log: Json;
1660
1675
  batch_ids: string[];
1661
1676
  completed_at: string | null;
1662
- config: Json;
1663
1677
  created_at: string;
1664
1678
  description: string | null;
1679
+ icp: Json;
1665
1680
  id: string;
1666
1681
  instantly_campaign_id: string | null;
1667
1682
  launched_at: string | null;
1668
1683
  metadata: Json;
1669
1684
  name: string;
1670
1685
  organization_id: string;
1671
- pipeline_key: string;
1672
- stage_key: string;
1673
- state_key: string;
1674
- type: string;
1686
+ pipeline_config: Json;
1687
+ scraping_config: Json;
1688
+ status: string;
1675
1689
  };
1676
1690
  Insert: {
1677
- activity_log?: Json;
1678
1691
  batch_ids?: string[];
1679
1692
  completed_at?: string | null;
1680
- config?: Json;
1681
1693
  created_at?: string;
1682
1694
  description?: string | null;
1695
+ icp?: Json;
1683
1696
  id?: string;
1684
1697
  instantly_campaign_id?: string | null;
1685
1698
  launched_at?: string | null;
1686
1699
  metadata?: Json;
1687
1700
  name: string;
1688
1701
  organization_id: string;
1689
- pipeline_key?: string;
1690
- stage_key?: string;
1691
- state_key?: string;
1692
- type?: string;
1702
+ pipeline_config?: Json;
1703
+ scraping_config?: Json;
1704
+ status?: string;
1693
1705
  };
1694
1706
  Update: {
1695
- activity_log?: Json;
1696
1707
  batch_ids?: string[];
1697
1708
  completed_at?: string | null;
1698
- config?: Json;
1699
1709
  created_at?: string;
1700
1710
  description?: string | null;
1711
+ icp?: Json;
1701
1712
  id?: string;
1702
1713
  instantly_campaign_id?: string | null;
1703
1714
  launched_at?: string | null;
1704
1715
  metadata?: Json;
1705
1716
  name?: string;
1706
1717
  organization_id?: string;
1707
- pipeline_key?: string;
1708
- stage_key?: string;
1709
- state_key?: string;
1710
- type?: string;
1718
+ pipeline_config?: Json;
1719
+ scraping_config?: Json;
1720
+ status?: string;
1711
1721
  };
1712
1722
  Relationships: [
1713
1723
  {
1714
- foreignKeyName: "acq_lists_organization_id_fkey";
1715
- columns: ["organization_id"];
1724
+ foreignKeyName: 'acq_lists_organization_id_fkey';
1725
+ columns: ['organization_id'];
1716
1726
  isOneToOne: false;
1717
- referencedRelation: "organizations";
1718
- referencedColumns: ["id"];
1727
+ referencedRelation: 'organizations';
1728
+ referencedColumns: ['id'];
1719
1729
  }
1720
1730
  ];
1721
1731
  };
@@ -1791,18 +1801,18 @@ type Database = {
1791
1801
  };
1792
1802
  Relationships: [
1793
1803
  {
1794
- foreignKeyName: "acq_seo_metrics_organization_id_fkey";
1795
- columns: ["organization_id"];
1804
+ foreignKeyName: 'acq_seo_metrics_organization_id_fkey';
1805
+ columns: ['organization_id'];
1796
1806
  isOneToOne: false;
1797
- referencedRelation: "organizations";
1798
- referencedColumns: ["id"];
1807
+ referencedRelation: 'organizations';
1808
+ referencedColumns: ['id'];
1799
1809
  },
1800
1810
  {
1801
- foreignKeyName: "acq_seo_metrics_seo_page_id_fkey";
1802
- columns: ["seo_page_id"];
1811
+ foreignKeyName: 'acq_seo_metrics_seo_page_id_fkey';
1812
+ columns: ['seo_page_id'];
1803
1813
  isOneToOne: false;
1804
- referencedRelation: "acq_seo_pages";
1805
- referencedColumns: ["id"];
1814
+ referencedRelation: 'acq_seo_pages';
1815
+ referencedColumns: ['id'];
1806
1816
  }
1807
1817
  ];
1808
1818
  };
@@ -1878,11 +1888,11 @@ type Database = {
1878
1888
  };
1879
1889
  Relationships: [
1880
1890
  {
1881
- foreignKeyName: "acq_seo_pages_organization_id_fkey";
1882
- columns: ["organization_id"];
1891
+ foreignKeyName: 'acq_seo_pages_organization_id_fkey';
1892
+ columns: ['organization_id'];
1883
1893
  isOneToOne: false;
1884
- referencedRelation: "organizations";
1885
- referencedColumns: ["id"];
1894
+ referencedRelation: 'organizations';
1895
+ referencedColumns: ['id'];
1886
1896
  }
1887
1897
  ];
1888
1898
  };
@@ -1979,67 +1989,11 @@ type Database = {
1979
1989
  };
1980
1990
  Relationships: [
1981
1991
  {
1982
- foreignKeyName: "acq_social_posts_organization_id_fkey";
1983
- columns: ["organization_id"];
1984
- isOneToOne: false;
1985
- referencedRelation: "organizations";
1986
- referencedColumns: ["id"];
1987
- }
1988
- ];
1989
- };
1990
- acq_touchpoints: {
1991
- Row: {
1992
- artifact_id: string | null;
1993
- channel: string;
1994
- contact_id: string | null;
1995
- created_at: string;
1996
- direction: string;
1997
- id: string;
1998
- kind: string;
1999
- list_id: string | null;
2000
- list_member_id: string | null;
2001
- occurred_at: string;
2002
- organization_id: string;
2003
- payload: Json | null;
2004
- source_execution_id: string | null;
2005
- };
2006
- Insert: {
2007
- artifact_id?: string | null;
2008
- channel: string;
2009
- contact_id?: string | null;
2010
- created_at?: string;
2011
- direction: string;
2012
- id?: string;
2013
- kind: string;
2014
- list_id?: string | null;
2015
- list_member_id?: string | null;
2016
- occurred_at: string;
2017
- organization_id: string;
2018
- payload?: Json | null;
2019
- source_execution_id?: string | null;
2020
- };
2021
- Update: {
2022
- artifact_id?: string | null;
2023
- channel?: string;
2024
- contact_id?: string | null;
2025
- created_at?: string;
2026
- direction?: string;
2027
- id?: string;
2028
- kind?: string;
2029
- list_id?: string | null;
2030
- list_member_id?: string | null;
2031
- occurred_at?: string;
2032
- organization_id?: string;
2033
- payload?: Json | null;
2034
- source_execution_id?: string | null;
2035
- };
2036
- Relationships: [
2037
- {
2038
- foreignKeyName: "acq_touchpoints_organization_id_fkey";
2039
- columns: ["organization_id"];
1992
+ foreignKeyName: 'acq_social_posts_organization_id_fkey';
1993
+ columns: ['organization_id'];
2040
1994
  isOneToOne: false;
2041
- referencedRelation: "organizations";
2042
- referencedColumns: ["id"];
1995
+ referencedRelation: 'organizations';
1996
+ referencedColumns: ['id'];
2043
1997
  }
2044
1998
  ];
2045
1999
  };
@@ -2094,11 +2048,11 @@ type Database = {
2094
2048
  };
2095
2049
  Relationships: [
2096
2050
  {
2097
- foreignKeyName: "activities_organization_id_fkey";
2098
- columns: ["organization_id"];
2051
+ foreignKeyName: 'activities_organization_id_fkey';
2052
+ columns: ['organization_id'];
2099
2053
  isOneToOne: false;
2100
- referencedRelation: "organizations";
2101
- referencedColumns: ["id"];
2054
+ referencedRelation: 'organizations';
2055
+ referencedColumns: ['id'];
2102
2056
  }
2103
2057
  ];
2104
2058
  };
@@ -2129,11 +2083,11 @@ type Database = {
2129
2083
  };
2130
2084
  Relationships: [
2131
2085
  {
2132
- foreignKeyName: "api_keys_organization_id_fkey";
2133
- columns: ["organization_id"];
2086
+ foreignKeyName: 'api_keys_organization_id_fkey';
2087
+ columns: ['organization_id'];
2134
2088
  isOneToOne: false;
2135
- referencedRelation: "organizations";
2136
- referencedColumns: ["id"];
2089
+ referencedRelation: 'organizations';
2090
+ referencedColumns: ['id'];
2137
2091
  }
2138
2092
  ];
2139
2093
  };
@@ -2212,25 +2166,25 @@ type Database = {
2212
2166
  };
2213
2167
  Relationships: [
2214
2168
  {
2215
- foreignKeyName: "command_queue_completed_by_fkey";
2216
- columns: ["completed_by"];
2169
+ foreignKeyName: 'command_queue_completed_by_fkey';
2170
+ columns: ['completed_by'];
2217
2171
  isOneToOne: false;
2218
- referencedRelation: "users";
2219
- referencedColumns: ["id"];
2172
+ referencedRelation: 'users';
2173
+ referencedColumns: ['id'];
2220
2174
  },
2221
2175
  {
2222
- foreignKeyName: "command_queue_organization_id_fkey";
2223
- columns: ["organization_id"];
2176
+ foreignKeyName: 'command_queue_organization_id_fkey';
2177
+ columns: ['organization_id'];
2224
2178
  isOneToOne: false;
2225
- referencedRelation: "organizations";
2226
- referencedColumns: ["id"];
2179
+ referencedRelation: 'organizations';
2180
+ referencedColumns: ['id'];
2227
2181
  },
2228
2182
  {
2229
- foreignKeyName: "command_queue_target_execution_id_fkey";
2230
- columns: ["target_execution_id"];
2183
+ foreignKeyName: 'command_queue_target_execution_id_fkey';
2184
+ columns: ['target_execution_id'];
2231
2185
  isOneToOne: false;
2232
- referencedRelation: "execution_logs";
2233
- referencedColumns: ["execution_id"];
2186
+ referencedRelation: 'execution_logs';
2187
+ referencedColumns: ['execution_id'];
2234
2188
  }
2235
2189
  ];
2236
2190
  };
@@ -2270,18 +2224,18 @@ type Database = {
2270
2224
  };
2271
2225
  Relationships: [
2272
2226
  {
2273
- foreignKeyName: "credentials_created_by_fkey";
2274
- columns: ["created_by"];
2227
+ foreignKeyName: 'credentials_created_by_fkey';
2228
+ columns: ['created_by'];
2275
2229
  isOneToOne: false;
2276
- referencedRelation: "users";
2277
- referencedColumns: ["id"];
2230
+ referencedRelation: 'users';
2231
+ referencedColumns: ['id'];
2278
2232
  },
2279
2233
  {
2280
- foreignKeyName: "credentials_organization_id_fkey";
2281
- columns: ["organization_id"];
2234
+ foreignKeyName: 'credentials_organization_id_fkey';
2235
+ columns: ['organization_id'];
2282
2236
  isOneToOne: false;
2283
- referencedRelation: "organizations";
2284
- referencedColumns: ["id"];
2237
+ referencedRelation: 'organizations';
2238
+ referencedColumns: ['id'];
2285
2239
  }
2286
2240
  ];
2287
2241
  };
@@ -2327,11 +2281,11 @@ type Database = {
2327
2281
  };
2328
2282
  Relationships: [
2329
2283
  {
2330
- foreignKeyName: "deployments_organization_id_fkey";
2331
- columns: ["organization_id"];
2284
+ foreignKeyName: 'deployments_organization_id_fkey';
2285
+ columns: ['organization_id'];
2332
2286
  isOneToOne: false;
2333
- referencedRelation: "organizations";
2334
- referencedColumns: ["id"];
2287
+ referencedRelation: 'organizations';
2288
+ referencedColumns: ['id'];
2335
2289
  }
2336
2290
  ];
2337
2291
  };
@@ -2386,25 +2340,25 @@ type Database = {
2386
2340
  };
2387
2341
  Relationships: [
2388
2342
  {
2389
- foreignKeyName: "execution_errors_execution_id_fkey";
2390
- columns: ["execution_id"];
2343
+ foreignKeyName: 'execution_errors_execution_id_fkey';
2344
+ columns: ['execution_id'];
2391
2345
  isOneToOne: false;
2392
- referencedRelation: "execution_logs";
2393
- referencedColumns: ["execution_id"];
2346
+ referencedRelation: 'execution_logs';
2347
+ referencedColumns: ['execution_id'];
2394
2348
  },
2395
2349
  {
2396
- foreignKeyName: "execution_errors_organization_id_fkey";
2397
- columns: ["organization_id"];
2350
+ foreignKeyName: 'execution_errors_organization_id_fkey';
2351
+ columns: ['organization_id'];
2398
2352
  isOneToOne: false;
2399
- referencedRelation: "organizations";
2400
- referencedColumns: ["id"];
2353
+ referencedRelation: 'organizations';
2354
+ referencedColumns: ['id'];
2401
2355
  },
2402
2356
  {
2403
- foreignKeyName: "execution_errors_resolved_by_fkey";
2404
- columns: ["resolved_by"];
2357
+ foreignKeyName: 'execution_errors_resolved_by_fkey';
2358
+ columns: ['resolved_by'];
2405
2359
  isOneToOne: false;
2406
- referencedRelation: "users";
2407
- referencedColumns: ["id"];
2360
+ referencedRelation: 'users';
2361
+ referencedColumns: ['id'];
2408
2362
  }
2409
2363
  ];
2410
2364
  };
@@ -2486,32 +2440,32 @@ type Database = {
2486
2440
  };
2487
2441
  Relationships: [
2488
2442
  {
2489
- foreignKeyName: "execution_history_organization_id_fkey";
2490
- columns: ["organization_id"];
2443
+ foreignKeyName: 'execution_history_organization_id_fkey';
2444
+ columns: ['organization_id'];
2491
2445
  isOneToOne: false;
2492
- referencedRelation: "organizations";
2493
- referencedColumns: ["id"];
2446
+ referencedRelation: 'organizations';
2447
+ referencedColumns: ['id'];
2494
2448
  },
2495
2449
  {
2496
- foreignKeyName: "execution_logs_origin_execution_id_fkey";
2497
- columns: ["origin_execution_id"];
2450
+ foreignKeyName: 'execution_logs_origin_execution_id_fkey';
2451
+ columns: ['origin_execution_id'];
2498
2452
  isOneToOne: false;
2499
- referencedRelation: "execution_logs";
2500
- referencedColumns: ["execution_id"];
2453
+ referencedRelation: 'execution_logs';
2454
+ referencedColumns: ['execution_id'];
2501
2455
  },
2502
2456
  {
2503
- foreignKeyName: "execution_logs_session_id_fkey";
2504
- columns: ["session_id"];
2457
+ foreignKeyName: 'execution_logs_session_id_fkey';
2458
+ columns: ['session_id'];
2505
2459
  isOneToOne: false;
2506
- referencedRelation: "sessions";
2507
- referencedColumns: ["session_id"];
2460
+ referencedRelation: 'sessions';
2461
+ referencedColumns: ['session_id'];
2508
2462
  },
2509
2463
  {
2510
- foreignKeyName: "execution_logs_user_id_fkey";
2511
- columns: ["user_id"];
2464
+ foreignKeyName: 'execution_logs_user_id_fkey';
2465
+ columns: ['user_id'];
2512
2466
  isOneToOne: false;
2513
- referencedRelation: "users";
2514
- referencedColumns: ["id"];
2467
+ referencedRelation: 'users';
2468
+ referencedColumns: ['id'];
2515
2469
  }
2516
2470
  ];
2517
2471
  };
@@ -2557,18 +2511,18 @@ type Database = {
2557
2511
  };
2558
2512
  Relationships: [
2559
2513
  {
2560
- foreignKeyName: "execution_metrics_execution_id_fkey";
2561
- columns: ["execution_id"];
2514
+ foreignKeyName: 'execution_metrics_execution_id_fkey';
2515
+ columns: ['execution_id'];
2562
2516
  isOneToOne: true;
2563
- referencedRelation: "execution_logs";
2564
- referencedColumns: ["execution_id"];
2517
+ referencedRelation: 'execution_logs';
2518
+ referencedColumns: ['execution_id'];
2565
2519
  },
2566
2520
  {
2567
- foreignKeyName: "execution_metrics_organization_id_fkey";
2568
- columns: ["organization_id"];
2521
+ foreignKeyName: 'execution_metrics_organization_id_fkey';
2522
+ columns: ['organization_id'];
2569
2523
  isOneToOne: false;
2570
- referencedRelation: "organizations";
2571
- referencedColumns: ["id"];
2524
+ referencedRelation: 'organizations';
2525
+ referencedColumns: ['id'];
2572
2526
  }
2573
2527
  ];
2574
2528
  };
@@ -2611,18 +2565,18 @@ type Database = {
2611
2565
  };
2612
2566
  Relationships: [
2613
2567
  {
2614
- foreignKeyName: "notifications_organization_id_fkey";
2615
- columns: ["organization_id"];
2568
+ foreignKeyName: 'notifications_organization_id_fkey';
2569
+ columns: ['organization_id'];
2616
2570
  isOneToOne: false;
2617
- referencedRelation: "organizations";
2618
- referencedColumns: ["id"];
2571
+ referencedRelation: 'organizations';
2572
+ referencedColumns: ['id'];
2619
2573
  },
2620
2574
  {
2621
- foreignKeyName: "notifications_user_id_fkey";
2622
- columns: ["user_id"];
2575
+ foreignKeyName: 'notifications_user_id_fkey';
2576
+ columns: ['user_id'];
2623
2577
  isOneToOne: false;
2624
- referencedRelation: "users";
2625
- referencedColumns: ["id"];
2578
+ referencedRelation: 'users';
2579
+ referencedColumns: ['id'];
2626
2580
  }
2627
2581
  ];
2628
2582
  };
@@ -2677,18 +2631,18 @@ type Database = {
2677
2631
  };
2678
2632
  Relationships: [
2679
2633
  {
2680
- foreignKeyName: "org_invitations_inviter_user_id_fkey";
2681
- columns: ["inviter_user_id"];
2634
+ foreignKeyName: 'org_invitations_inviter_user_id_fkey';
2635
+ columns: ['inviter_user_id'];
2682
2636
  isOneToOne: false;
2683
- referencedRelation: "users";
2684
- referencedColumns: ["id"];
2637
+ referencedRelation: 'users';
2638
+ referencedColumns: ['id'];
2685
2639
  },
2686
2640
  {
2687
- foreignKeyName: "org_invitations_organization_id_fkey";
2688
- columns: ["organization_id"];
2641
+ foreignKeyName: 'org_invitations_organization_id_fkey';
2642
+ columns: ['organization_id'];
2689
2643
  isOneToOne: false;
2690
- referencedRelation: "organizations";
2691
- referencedColumns: ["id"];
2644
+ referencedRelation: 'organizations';
2645
+ referencedColumns: ['id'];
2692
2646
  }
2693
2647
  ];
2694
2648
  };
@@ -2731,18 +2685,18 @@ type Database = {
2731
2685
  };
2732
2686
  Relationships: [
2733
2687
  {
2734
- foreignKeyName: "org_memberships_organization_id_fkey";
2735
- columns: ["organization_id"];
2688
+ foreignKeyName: 'org_memberships_organization_id_fkey';
2689
+ columns: ['organization_id'];
2736
2690
  isOneToOne: false;
2737
- referencedRelation: "organizations";
2738
- referencedColumns: ["id"];
2691
+ referencedRelation: 'organizations';
2692
+ referencedColumns: ['id'];
2739
2693
  },
2740
2694
  {
2741
- foreignKeyName: "org_memberships_user_id_fkey";
2742
- columns: ["user_id"];
2695
+ foreignKeyName: 'org_memberships_user_id_fkey';
2696
+ columns: ['user_id'];
2743
2697
  isOneToOne: false;
2744
- referencedRelation: "users";
2745
- referencedColumns: ["id"];
2698
+ referencedRelation: 'users';
2699
+ referencedColumns: ['id'];
2746
2700
  }
2747
2701
  ];
2748
2702
  };
@@ -2767,25 +2721,25 @@ type Database = {
2767
2721
  };
2768
2722
  Relationships: [
2769
2723
  {
2770
- foreignKeyName: "org_rol_assignments_granted_by_fkey";
2771
- columns: ["granted_by"];
2724
+ foreignKeyName: 'org_rol_assignments_granted_by_fkey';
2725
+ columns: ['granted_by'];
2772
2726
  isOneToOne: false;
2773
- referencedRelation: "users";
2774
- referencedColumns: ["id"];
2727
+ referencedRelation: 'users';
2728
+ referencedColumns: ['id'];
2775
2729
  },
2776
2730
  {
2777
- foreignKeyName: "org_rol_assignments_membership_id_fkey";
2778
- columns: ["membership_id"];
2731
+ foreignKeyName: 'org_rol_assignments_membership_id_fkey';
2732
+ columns: ['membership_id'];
2779
2733
  isOneToOne: false;
2780
- referencedRelation: "org_memberships";
2781
- referencedColumns: ["id"];
2734
+ referencedRelation: 'org_memberships';
2735
+ referencedColumns: ['id'];
2782
2736
  },
2783
2737
  {
2784
- foreignKeyName: "org_rol_assignments_role_id_fkey";
2785
- columns: ["role_id"];
2738
+ foreignKeyName: 'org_rol_assignments_role_id_fkey';
2739
+ columns: ['role_id'];
2786
2740
  isOneToOne: false;
2787
- referencedRelation: "org_rol_definitions";
2788
- referencedColumns: ["id"];
2741
+ referencedRelation: 'org_rol_definitions';
2742
+ referencedColumns: ['id'];
2789
2743
  }
2790
2744
  ];
2791
2745
  };
@@ -2822,11 +2776,11 @@ type Database = {
2822
2776
  };
2823
2777
  Relationships: [
2824
2778
  {
2825
- foreignKeyName: "org_rol_definitions_organization_id_fkey";
2826
- columns: ["organization_id"];
2779
+ foreignKeyName: 'org_rol_definitions_organization_id_fkey';
2780
+ columns: ['organization_id'];
2827
2781
  isOneToOne: false;
2828
- referencedRelation: "organizations";
2829
- referencedColumns: ["id"];
2782
+ referencedRelation: 'organizations';
2783
+ referencedColumns: ['id'];
2830
2784
  }
2831
2785
  ];
2832
2786
  };
@@ -2848,18 +2802,18 @@ type Database = {
2848
2802
  };
2849
2803
  Relationships: [
2850
2804
  {
2851
- foreignKeyName: "org_rol_grants_permission_key_fkey";
2852
- columns: ["permission_key"];
2805
+ foreignKeyName: 'org_rol_grants_permission_key_fkey';
2806
+ columns: ['permission_key'];
2853
2807
  isOneToOne: false;
2854
- referencedRelation: "org_rol_permissions";
2855
- referencedColumns: ["key"];
2808
+ referencedRelation: 'org_rol_permissions';
2809
+ referencedColumns: ['key'];
2856
2810
  },
2857
2811
  {
2858
- foreignKeyName: "org_rol_grants_role_id_fkey";
2859
- columns: ["role_id"];
2812
+ foreignKeyName: 'org_rol_grants_role_id_fkey';
2813
+ columns: ['role_id'];
2860
2814
  isOneToOne: false;
2861
- referencedRelation: "org_rol_definitions";
2862
- referencedColumns: ["id"];
2815
+ referencedRelation: 'org_rol_definitions';
2816
+ referencedColumns: ['id'];
2863
2817
  }
2864
2818
  ];
2865
2819
  };
@@ -2971,25 +2925,25 @@ type Database = {
2971
2925
  };
2972
2926
  Relationships: [
2973
2927
  {
2974
- foreignKeyName: "fk_milestones_project";
2975
- columns: ["project_id"];
2928
+ foreignKeyName: 'fk_milestones_project';
2929
+ columns: ['project_id'];
2976
2930
  isOneToOne: false;
2977
- referencedRelation: "prj_projects";
2978
- referencedColumns: ["id"];
2931
+ referencedRelation: 'prj_projects';
2932
+ referencedColumns: ['id'];
2979
2933
  },
2980
2934
  {
2981
- foreignKeyName: "prj_milestones_organization_id_fkey";
2982
- columns: ["organization_id"];
2935
+ foreignKeyName: 'prj_milestones_organization_id_fkey';
2936
+ columns: ['organization_id'];
2983
2937
  isOneToOne: false;
2984
- referencedRelation: "organizations";
2985
- referencedColumns: ["id"];
2938
+ referencedRelation: 'organizations';
2939
+ referencedColumns: ['id'];
2986
2940
  },
2987
2941
  {
2988
- foreignKeyName: "prj_milestones_project_id_fkey";
2989
- columns: ["project_id"];
2942
+ foreignKeyName: 'prj_milestones_project_id_fkey';
2943
+ columns: ['project_id'];
2990
2944
  isOneToOne: false;
2991
- referencedRelation: "prj_projects";
2992
- referencedColumns: ["id"];
2945
+ referencedRelation: 'prj_projects';
2946
+ referencedColumns: ['id'];
2993
2947
  }
2994
2948
  ];
2995
2949
  };
@@ -3038,67 +2992,67 @@ type Database = {
3038
2992
  };
3039
2993
  Relationships: [
3040
2994
  {
3041
- foreignKeyName: "fk_notes_created_by";
3042
- columns: ["created_by"];
2995
+ foreignKeyName: 'fk_notes_created_by';
2996
+ columns: ['created_by'];
3043
2997
  isOneToOne: false;
3044
- referencedRelation: "users";
3045
- referencedColumns: ["id"];
2998
+ referencedRelation: 'users';
2999
+ referencedColumns: ['id'];
3046
3000
  },
3047
3001
  {
3048
- foreignKeyName: "fk_notes_milestone";
3049
- columns: ["milestone_id"];
3002
+ foreignKeyName: 'fk_notes_milestone';
3003
+ columns: ['milestone_id'];
3050
3004
  isOneToOne: false;
3051
- referencedRelation: "prj_milestones";
3052
- referencedColumns: ["id"];
3005
+ referencedRelation: 'prj_milestones';
3006
+ referencedColumns: ['id'];
3053
3007
  },
3054
3008
  {
3055
- foreignKeyName: "fk_notes_project";
3056
- columns: ["project_id"];
3009
+ foreignKeyName: 'fk_notes_project';
3010
+ columns: ['project_id'];
3057
3011
  isOneToOne: false;
3058
- referencedRelation: "prj_projects";
3059
- referencedColumns: ["id"];
3012
+ referencedRelation: 'prj_projects';
3013
+ referencedColumns: ['id'];
3060
3014
  },
3061
3015
  {
3062
- foreignKeyName: "fk_notes_task";
3063
- columns: ["task_id"];
3016
+ foreignKeyName: 'fk_notes_task';
3017
+ columns: ['task_id'];
3064
3018
  isOneToOne: false;
3065
- referencedRelation: "prj_tasks";
3066
- referencedColumns: ["id"];
3019
+ referencedRelation: 'prj_tasks';
3020
+ referencedColumns: ['id'];
3067
3021
  },
3068
3022
  {
3069
- foreignKeyName: "prj_notes_created_by_fkey";
3070
- columns: ["created_by"];
3023
+ foreignKeyName: 'prj_notes_created_by_fkey';
3024
+ columns: ['created_by'];
3071
3025
  isOneToOne: false;
3072
- referencedRelation: "users";
3073
- referencedColumns: ["id"];
3026
+ referencedRelation: 'users';
3027
+ referencedColumns: ['id'];
3074
3028
  },
3075
3029
  {
3076
- foreignKeyName: "prj_notes_milestone_id_fkey";
3077
- columns: ["milestone_id"];
3030
+ foreignKeyName: 'prj_notes_milestone_id_fkey';
3031
+ columns: ['milestone_id'];
3078
3032
  isOneToOne: false;
3079
- referencedRelation: "prj_milestones";
3080
- referencedColumns: ["id"];
3033
+ referencedRelation: 'prj_milestones';
3034
+ referencedColumns: ['id'];
3081
3035
  },
3082
3036
  {
3083
- foreignKeyName: "prj_notes_organization_id_fkey";
3084
- columns: ["organization_id"];
3037
+ foreignKeyName: 'prj_notes_organization_id_fkey';
3038
+ columns: ['organization_id'];
3085
3039
  isOneToOne: false;
3086
- referencedRelation: "organizations";
3087
- referencedColumns: ["id"];
3040
+ referencedRelation: 'organizations';
3041
+ referencedColumns: ['id'];
3088
3042
  },
3089
3043
  {
3090
- foreignKeyName: "prj_notes_project_id_fkey";
3091
- columns: ["project_id"];
3044
+ foreignKeyName: 'prj_notes_project_id_fkey';
3045
+ columns: ['project_id'];
3092
3046
  isOneToOne: false;
3093
- referencedRelation: "prj_projects";
3094
- referencedColumns: ["id"];
3047
+ referencedRelation: 'prj_projects';
3048
+ referencedColumns: ['id'];
3095
3049
  },
3096
3050
  {
3097
- foreignKeyName: "prj_notes_task_id_fkey";
3098
- columns: ["task_id"];
3051
+ foreignKeyName: 'prj_notes_task_id_fkey';
3052
+ columns: ['task_id'];
3099
3053
  isOneToOne: false;
3100
- referencedRelation: "prj_tasks";
3101
- referencedColumns: ["id"];
3054
+ referencedRelation: 'prj_tasks';
3055
+ referencedColumns: ['id'];
3102
3056
  }
3103
3057
  ];
3104
3058
  };
@@ -3156,39 +3110,39 @@ type Database = {
3156
3110
  };
3157
3111
  Relationships: [
3158
3112
  {
3159
- foreignKeyName: "fk_projects_company";
3160
- columns: ["client_company_id"];
3113
+ foreignKeyName: 'fk_projects_company';
3114
+ columns: ['client_company_id'];
3161
3115
  isOneToOne: false;
3162
- referencedRelation: "acq_companies";
3163
- referencedColumns: ["id"];
3116
+ referencedRelation: 'acq_companies';
3117
+ referencedColumns: ['id'];
3164
3118
  },
3165
3119
  {
3166
- foreignKeyName: "fk_projects_deal";
3167
- columns: ["deal_id"];
3120
+ foreignKeyName: 'fk_projects_deal';
3121
+ columns: ['deal_id'];
3168
3122
  isOneToOne: false;
3169
- referencedRelation: "acq_deals";
3170
- referencedColumns: ["id"];
3123
+ referencedRelation: 'acq_deals';
3124
+ referencedColumns: ['id'];
3171
3125
  },
3172
3126
  {
3173
- foreignKeyName: "prj_projects_client_company_id_fkey";
3174
- columns: ["client_company_id"];
3127
+ foreignKeyName: 'prj_projects_client_company_id_fkey';
3128
+ columns: ['client_company_id'];
3175
3129
  isOneToOne: false;
3176
- referencedRelation: "acq_companies";
3177
- referencedColumns: ["id"];
3130
+ referencedRelation: 'acq_companies';
3131
+ referencedColumns: ['id'];
3178
3132
  },
3179
3133
  {
3180
- foreignKeyName: "prj_projects_deal_id_fkey";
3181
- columns: ["deal_id"];
3134
+ foreignKeyName: 'prj_projects_deal_id_fkey';
3135
+ columns: ['deal_id'];
3182
3136
  isOneToOne: false;
3183
- referencedRelation: "acq_deals";
3184
- referencedColumns: ["id"];
3137
+ referencedRelation: 'acq_deals';
3138
+ referencedColumns: ['id'];
3185
3139
  },
3186
3140
  {
3187
- foreignKeyName: "prj_projects_organization_id_fkey";
3188
- columns: ["organization_id"];
3141
+ foreignKeyName: 'prj_projects_organization_id_fkey';
3142
+ columns: ['organization_id'];
3189
3143
  isOneToOne: false;
3190
- referencedRelation: "organizations";
3191
- referencedColumns: ["id"];
3144
+ referencedRelation: 'organizations';
3145
+ referencedColumns: ['id'];
3192
3146
  }
3193
3147
  ];
3194
3148
  };
@@ -3252,53 +3206,53 @@ type Database = {
3252
3206
  };
3253
3207
  Relationships: [
3254
3208
  {
3255
- foreignKeyName: "fk_tasks_milestone";
3256
- columns: ["milestone_id"];
3209
+ foreignKeyName: 'fk_tasks_milestone';
3210
+ columns: ['milestone_id'];
3257
3211
  isOneToOne: false;
3258
- referencedRelation: "prj_milestones";
3259
- referencedColumns: ["id"];
3212
+ referencedRelation: 'prj_milestones';
3213
+ referencedColumns: ['id'];
3260
3214
  },
3261
3215
  {
3262
- foreignKeyName: "fk_tasks_parent";
3263
- columns: ["parent_task_id"];
3216
+ foreignKeyName: 'fk_tasks_parent';
3217
+ columns: ['parent_task_id'];
3264
3218
  isOneToOne: false;
3265
- referencedRelation: "prj_tasks";
3266
- referencedColumns: ["id"];
3219
+ referencedRelation: 'prj_tasks';
3220
+ referencedColumns: ['id'];
3267
3221
  },
3268
3222
  {
3269
- foreignKeyName: "fk_tasks_project";
3270
- columns: ["project_id"];
3223
+ foreignKeyName: 'fk_tasks_project';
3224
+ columns: ['project_id'];
3271
3225
  isOneToOne: false;
3272
- referencedRelation: "prj_projects";
3273
- referencedColumns: ["id"];
3226
+ referencedRelation: 'prj_projects';
3227
+ referencedColumns: ['id'];
3274
3228
  },
3275
3229
  {
3276
- foreignKeyName: "prj_tasks_milestone_id_fkey";
3277
- columns: ["milestone_id"];
3230
+ foreignKeyName: 'prj_tasks_milestone_id_fkey';
3231
+ columns: ['milestone_id'];
3278
3232
  isOneToOne: false;
3279
- referencedRelation: "prj_milestones";
3280
- referencedColumns: ["id"];
3233
+ referencedRelation: 'prj_milestones';
3234
+ referencedColumns: ['id'];
3281
3235
  },
3282
3236
  {
3283
- foreignKeyName: "prj_tasks_organization_id_fkey";
3284
- columns: ["organization_id"];
3237
+ foreignKeyName: 'prj_tasks_organization_id_fkey';
3238
+ columns: ['organization_id'];
3285
3239
  isOneToOne: false;
3286
- referencedRelation: "organizations";
3287
- referencedColumns: ["id"];
3240
+ referencedRelation: 'organizations';
3241
+ referencedColumns: ['id'];
3288
3242
  },
3289
3243
  {
3290
- foreignKeyName: "prj_tasks_parent_task_id_fkey";
3291
- columns: ["parent_task_id"];
3244
+ foreignKeyName: 'prj_tasks_parent_task_id_fkey';
3245
+ columns: ['parent_task_id'];
3292
3246
  isOneToOne: false;
3293
- referencedRelation: "prj_tasks";
3294
- referencedColumns: ["id"];
3247
+ referencedRelation: 'prj_tasks';
3248
+ referencedColumns: ['id'];
3295
3249
  },
3296
3250
  {
3297
- foreignKeyName: "prj_tasks_project_id_fkey";
3298
- columns: ["project_id"];
3251
+ foreignKeyName: 'prj_tasks_project_id_fkey';
3252
+ columns: ['project_id'];
3299
3253
  isOneToOne: false;
3300
- referencedRelation: "prj_projects";
3301
- referencedColumns: ["id"];
3254
+ referencedRelation: 'prj_projects';
3255
+ referencedColumns: ['id'];
3302
3256
  }
3303
3257
  ];
3304
3258
  };
@@ -3368,25 +3322,25 @@ type Database = {
3368
3322
  };
3369
3323
  Relationships: [
3370
3324
  {
3371
- foreignKeyName: "reported_requests_organization_id_fkey";
3372
- columns: ["organization_id"];
3325
+ foreignKeyName: 'reported_requests_organization_id_fkey';
3326
+ columns: ['organization_id'];
3373
3327
  isOneToOne: false;
3374
- referencedRelation: "organizations";
3375
- referencedColumns: ["id"];
3328
+ referencedRelation: 'organizations';
3329
+ referencedColumns: ['id'];
3376
3330
  },
3377
3331
  {
3378
- foreignKeyName: "reported_requests_project_id_fkey";
3379
- columns: ["project_id"];
3332
+ foreignKeyName: 'reported_requests_project_id_fkey';
3333
+ columns: ['project_id'];
3380
3334
  isOneToOne: false;
3381
- referencedRelation: "prj_projects";
3382
- referencedColumns: ["id"];
3335
+ referencedRelation: 'prj_projects';
3336
+ referencedColumns: ['id'];
3383
3337
  },
3384
3338
  {
3385
- foreignKeyName: "reported_requests_task_id_fkey";
3386
- columns: ["task_id"];
3339
+ foreignKeyName: 'reported_requests_task_id_fkey';
3340
+ columns: ['task_id'];
3387
3341
  isOneToOne: false;
3388
- referencedRelation: "prj_tasks";
3389
- referencedColumns: ["id"];
3342
+ referencedRelation: 'prj_tasks';
3343
+ referencedColumns: ['id'];
3390
3344
  }
3391
3345
  ];
3392
3346
  };
@@ -3426,11 +3380,11 @@ type Database = {
3426
3380
  };
3427
3381
  Relationships: [
3428
3382
  {
3429
- foreignKeyName: "session_messages_session_id_fkey";
3430
- columns: ["session_id"];
3383
+ foreignKeyName: 'session_messages_session_id_fkey';
3384
+ columns: ['session_id'];
3431
3385
  isOneToOne: false;
3432
- referencedRelation: "sessions";
3433
- referencedColumns: ["session_id"];
3386
+ referencedRelation: 'sessions';
3387
+ referencedColumns: ['session_id'];
3434
3388
  }
3435
3389
  ];
3436
3390
  };
@@ -3485,18 +3439,18 @@ type Database = {
3485
3439
  };
3486
3440
  Relationships: [
3487
3441
  {
3488
- foreignKeyName: "fk_organization";
3489
- columns: ["organization_id"];
3442
+ foreignKeyName: 'fk_organization';
3443
+ columns: ['organization_id'];
3490
3444
  isOneToOne: false;
3491
- referencedRelation: "organizations";
3492
- referencedColumns: ["id"];
3445
+ referencedRelation: 'organizations';
3446
+ referencedColumns: ['id'];
3493
3447
  },
3494
3448
  {
3495
- foreignKeyName: "fk_user";
3496
- columns: ["user_id"];
3449
+ foreignKeyName: 'fk_user';
3450
+ columns: ['user_id'];
3497
3451
  isOneToOne: false;
3498
- referencedRelation: "users";
3499
- referencedColumns: ["id"];
3452
+ referencedRelation: 'users';
3453
+ referencedColumns: ['id'];
3500
3454
  }
3501
3455
  ];
3502
3456
  };
@@ -3572,11 +3526,11 @@ type Database = {
3572
3526
  };
3573
3527
  Relationships: [
3574
3528
  {
3575
- foreignKeyName: "task_schedules_organization_id_fkey";
3576
- columns: ["organization_id"];
3529
+ foreignKeyName: 'task_schedules_organization_id_fkey';
3530
+ columns: ['organization_id'];
3577
3531
  isOneToOne: false;
3578
- referencedRelation: "organizations";
3579
- referencedColumns: ["id"];
3532
+ referencedRelation: 'organizations';
3533
+ referencedColumns: ['id'];
3580
3534
  }
3581
3535
  ];
3582
3536
  };
@@ -3631,11 +3585,11 @@ type Database = {
3631
3585
  };
3632
3586
  Relationships: [
3633
3587
  {
3634
- foreignKeyName: "user_profiles_last_visited_org_fkey";
3635
- columns: ["last_visited_org"];
3588
+ foreignKeyName: 'user_profiles_last_visited_org_fkey';
3589
+ columns: ['last_visited_org'];
3636
3590
  isOneToOne: false;
3637
- referencedRelation: "organizations";
3638
- referencedColumns: ["id"];
3591
+ referencedRelation: 'organizations';
3592
+ referencedColumns: ['id'];
3639
3593
  }
3640
3594
  ];
3641
3595
  };
@@ -3684,11 +3638,11 @@ type Database = {
3684
3638
  };
3685
3639
  Relationships: [
3686
3640
  {
3687
- foreignKeyName: "webhook_endpoints_organization_id_fkey";
3688
- columns: ["organization_id"];
3641
+ foreignKeyName: 'webhook_endpoints_organization_id_fkey';
3642
+ columns: ['organization_id'];
3689
3643
  isOneToOne: false;
3690
- referencedRelation: "organizations";
3691
- referencedColumns: ["id"];
3644
+ referencedRelation: 'organizations';
3645
+ referencedColumns: ['id'];
3692
3646
  }
3693
3647
  ];
3694
3648
  };
@@ -3948,35 +3902,49 @@ interface ContactEnrichmentData {
3948
3902
  }>;
3949
3903
  };
3950
3904
  }
3951
- /**
3952
- * Acquisition list for organizing contacts and companies.
3953
- * Transformed from AcqListRow with camelCase properties.
3954
- *
3955
- * Track B: acq_lists adopts the Stateful trait (pipeline_key / stage_key / state_key / activity_log).
3956
- * `status` is preserved as a convenience alias for `state_key` so existing consumers continue to
3957
- * compile until they are migrated to read the trait fields directly.
3958
- */
3905
+ type ListStatus = 'draft' | 'enriching' | 'launched' | 'closing' | 'archived';
3906
+ interface ScrapingConfig {
3907
+ source?: string;
3908
+ query?: string;
3909
+ filters?: Record<string, unknown>;
3910
+ [key: string]: unknown;
3911
+ }
3912
+ interface IcpRubric {
3913
+ targetDescription?: string;
3914
+ minReviewCount?: number;
3915
+ minRating?: number;
3916
+ excludeFranchises?: boolean;
3917
+ customRules?: string;
3918
+ qualificationRubricKey?: string | null;
3919
+ [key: string]: unknown;
3920
+ }
3921
+ interface PipelineStage {
3922
+ key: string;
3923
+ label?: string;
3924
+ description?: string;
3925
+ resourceId?: string;
3926
+ inputTemplate?: Record<string, unknown>;
3927
+ enabled?: boolean;
3928
+ order?: number;
3929
+ }
3930
+ interface PipelineConfig {
3931
+ stages: PipelineStage[];
3932
+ }
3959
3933
  interface AcqList {
3960
3934
  id: string;
3961
3935
  organizationId: string;
3962
3936
  name: string;
3963
3937
  description: string | null;
3964
- type: string;
3965
3938
  batchIds: string[];
3966
3939
  instantlyCampaignId: string | null;
3967
- /** @deprecated Use state_key. Retained as alias mapped from state_key for backward-compatibility. */
3968
- status: string;
3969
- /** Stateful trait: pipeline identifier (always 'lead-gen' for acq_lists). Added by W2 migration. */
3970
- pipelineKey: string;
3971
- /** Stateful trait: stage within the pipeline (always 'lifecycle' for acq_lists). Added by W2 migration. */
3972
- stageKey: string;
3973
- /** Stateful trait: lifecycle state (draft | enriching | launched | closing | archived). Added by W2 migration. */
3974
- stateKey: string;
3940
+ status: ListStatus;
3941
+ scrapingConfig: ScrapingConfig;
3942
+ icp: IcpRubric;
3943
+ pipelineConfig: PipelineConfig;
3975
3944
  metadata: Record<string, unknown>;
3976
3945
  launchedAt: Date | null;
3977
3946
  completedAt: Date | null;
3978
3947
  createdAt: Date;
3979
- config: ListConfig;
3980
3948
  }
3981
3949
  /**
3982
3950
  * Company record in the acquisition database.
@@ -4088,616 +4056,6 @@ interface AcqDealTask {
4088
4056
  updatedAt: string;
4089
4057
  createdByUserId: string | null;
4090
4058
  }
4091
- /**
4092
- * One ordered step in a list's pipeline. Maps to a deployed workflow
4093
- * (e.g. 'lgn-03-company-qualification-workflow'). The `inputTemplate`
4094
- * is merged with `{ listId }` at run time to form the workflow input.
4095
- */
4096
- interface PipelineStep {
4097
- /** Stable key, e.g. 'scrape' | 'extract' | 'qualify' | 'discover' | 'verify' | 'personalize'. */
4098
- key: string;
4099
- /** Human label rendered in the UI stepper. */
4100
- label: string;
4101
- /** Deployed workflow resourceId (e.g. 'lgn-03-company-qualification-workflow'). */
4102
- resourceId: string;
4103
- /** Input defaults merged with `{ listId }` at dispatch. */
4104
- inputTemplate: Record<string, unknown>;
4105
- /** Whether the UI shows the Run button. */
4106
- enabled: boolean;
4107
- /** Display order (ascending). */
4108
- order: number;
4109
- }
4110
- type CompanyListStage = 'populated' | 'extracted' | 'qualified';
4111
- type ContactListStage = 'discovered' | 'verified' | 'personalized' | 'uploaded';
4112
- /**
4113
- * Per-list pipeline configuration stored as jsonb in `acq_lists.config`.
4114
- *
4115
- * `qualification` is the only required subtree. Every other subtree is optional
4116
- * and inherits global defaults when omitted: workflows resolve values as
4117
- * `list.config.foo ?? globalDefaults.foo`. Seeded rows from
4118
- * `20260413000100_backfill_list_configs.sql` only populate `qualification`
4119
- * and `scraping`; the rest was intentionally omitted.
4120
- */
4121
- interface ListConfig {
4122
- qualification: {
4123
- /** One-line description of the target vertical/segment. */
4124
- targetDescription: string;
4125
- /** Minimum Google review count to qualify. */
4126
- minReviewCount: number;
4127
- /** Minimum Google star rating to qualify (e.g. 3.0). */
4128
- minRating: number;
4129
- /** Whether to exclude franchises/chains during qualification. */
4130
- excludeFranchises: boolean;
4131
- /** Free-form LLM rules layered on top of the structured criteria. */
4132
- customRules: string;
4133
- /**
4134
- * Free-form text key identifying the ICP qualification rubric applied to this list.
4135
- * Decision C4: stays as free-form text until an Org OS rubric registry lands.
4136
- */
4137
- qualificationRubricKey?: string | null;
4138
- };
4139
- enrichment?: {
4140
- emailDiscovery?: {
4141
- primary: 'tomba' | 'anymailfinder';
4142
- credentialName?: string;
4143
- };
4144
- emailVerification?: {
4145
- provider: 'millionverifier';
4146
- threshold?: 'ok' | 'ok+catch_all';
4147
- };
4148
- };
4149
- personalization?: {
4150
- industryContext?: string;
4151
- /** Email body template with tags like {{opening_line}} / {{category_pain}}. */
4152
- emailBody?: string;
4153
- creativeDirection?: string;
4154
- /** Contradiction-prevention rules layered into the personalization prompt. */
4155
- exclusionRules?: string[];
4156
- };
4157
- pipeline?: {
4158
- steps: PipelineStep[];
4159
- };
4160
- }
4161
-
4162
- /**
4163
- * Lead Service Types
4164
- * CRUD operation types for the acquisition platform (lists, companies, contacts, deals)
4165
- *
4166
- * Implementation: apps/api/src/acquisition/lead-service.ts (LeadService class)
4167
- */
4168
-
4169
- interface PaginatedResult<T> {
4170
- data: T[];
4171
- total: number;
4172
- limit: number;
4173
- offset: number;
4174
- }
4175
- interface CreateListParams {
4176
- organizationId: string;
4177
- name: string;
4178
- description?: string;
4179
- type?: string;
4180
- batchIds?: string[];
4181
- instantlyCampaignId?: string;
4182
- status?: string;
4183
- metadata?: Record<string, unknown>;
4184
- config?: ListConfig;
4185
- }
4186
- interface UpdateListParams {
4187
- name?: string;
4188
- description?: string;
4189
- status?: string;
4190
- batchIds?: string[];
4191
- }
4192
- interface CreateCompanyParams {
4193
- organizationId: string;
4194
- name: string;
4195
- domain?: string;
4196
- linkedinUrl?: string;
4197
- website?: string;
4198
- numEmployees?: number;
4199
- foundedYear?: number;
4200
- locationCity?: string;
4201
- locationState?: string;
4202
- category?: string;
4203
- source?: string;
4204
- batchId?: string;
4205
- verticalResearch?: string;
4206
- }
4207
- interface UpdateCompanyParams {
4208
- name?: string;
4209
- domain?: string;
4210
- linkedinUrl?: string;
4211
- website?: string;
4212
- numEmployees?: number;
4213
- foundedYear?: number;
4214
- locationCity?: string;
4215
- locationState?: string;
4216
- category?: string;
4217
- segment?: string;
4218
- pipelineStatus?: Record<string, unknown>;
4219
- enrichmentData?: Record<string, unknown>;
4220
- source?: string;
4221
- batchId?: string;
4222
- status?: 'active' | 'invalid';
4223
- verticalResearch?: string | null;
4224
- /** Track A: flat qualification score column (null until a scoring rubric is defined) */
4225
- qualificationScore?: number | null;
4226
- /** Track A: flat qualification signals jsonb — mirrors the former pipeline_status.qualification shape */
4227
- qualificationSignals?: Record<string, unknown> | null;
4228
- /** Track A: key identifying the rubric used for qualification */
4229
- qualificationRubricKey?: string | null;
4230
- }
4231
- type UpsertCompanyParams = CreateCompanyParams;
4232
- interface CompanyFilters {
4233
- listId?: string;
4234
- search?: string;
4235
- domain?: string;
4236
- website?: string;
4237
- segment?: string;
4238
- category?: string;
4239
- pipelineStatus?: Record<string, unknown>;
4240
- /** Exclude companies whose pipeline_status contains this value (PostgREST NOT contains) */
4241
- pipelineStatusNot?: Record<string, unknown>;
4242
- batchId?: string;
4243
- status?: 'active' | 'invalid';
4244
- includeAll?: boolean;
4245
- excludeColumns?: Array<'enrichmentData' | 'pipelineStatus'>;
4246
- }
4247
- interface CreateContactParams {
4248
- organizationId: string;
4249
- email: string;
4250
- companyId?: string;
4251
- firstName?: string;
4252
- lastName?: string;
4253
- linkedinUrl?: string;
4254
- title?: string;
4255
- source?: string;
4256
- sourceId?: string;
4257
- batchId?: string;
4258
- }
4259
- interface UpdateContactParams {
4260
- companyId?: string;
4261
- emailValid?: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN';
4262
- firstName?: string;
4263
- lastName?: string;
4264
- linkedinUrl?: string;
4265
- title?: string;
4266
- headline?: string;
4267
- filterReason?: string;
4268
- openingLine?: string;
4269
- pipelineStatus?: Record<string, unknown>;
4270
- enrichmentData?: Record<string, unknown>;
4271
- status?: 'active' | 'invalid';
4272
- }
4273
- type UpsertContactParams = CreateContactParams;
4274
- interface ContactFilters {
4275
- listId?: string;
4276
- search?: string;
4277
- openingLineIsNull?: boolean;
4278
- pipelineStatus?: Record<string, unknown>;
4279
- batchId?: string;
4280
- contactStatus?: 'active' | 'invalid';
4281
- }
4282
- interface UpsertDealParams {
4283
- organizationId: string;
4284
- /** Contact email — dedupe key together with organization_id */
4285
- contactEmail: string;
4286
- /** Optional contact ID for foreign key join */
4287
- contactId?: string;
4288
- /** Campaign list that generated this deal (FK to acq_lists) */
4289
- sourceListId?: string;
4290
- /** Deal origin: 'instantly', 'referral', 'inbound', 'manual' */
4291
- sourceType?: 'instantly' | 'referral' | 'inbound' | 'manual';
4292
- /** Optional discovery data JSONB to set on upsert */
4293
- discoveryData?: unknown;
4294
- /** Optional proposal data JSONB to set on upsert */
4295
- proposalData?: unknown;
4296
- }
4297
- interface UpdateDiscoveryDataParams {
4298
- organizationId: string;
4299
- contactEmail: string;
4300
- discoveryData: unknown;
4301
- submittedBy?: string;
4302
- }
4303
- interface UpdateProposalDataParams {
4304
- organizationId: string;
4305
- contactEmail: string;
4306
- proposalData: unknown;
4307
- proposalPdfUrl?: string;
4308
- }
4309
- interface MarkProposalSentParams {
4310
- organizationId: string;
4311
- contactEmail: string;
4312
- }
4313
- interface MarkProposalReviewedParams {
4314
- organizationId: string;
4315
- contactEmail: string;
4316
- reviewedBy: string;
4317
- proposalData?: unknown;
4318
- }
4319
- interface UpdateCloseLostReasonParams {
4320
- organizationId: string;
4321
- dealId: string;
4322
- reason: string;
4323
- }
4324
- interface UpdateFeesParams {
4325
- organizationId: string;
4326
- contactEmail?: string;
4327
- dealId?: string;
4328
- initialFee?: number;
4329
- monthlyFee?: number;
4330
- }
4331
- interface TransitionItemParams {
4332
- organizationId: string;
4333
- dealId: string;
4334
- pipelineKey: string;
4335
- stageKey: string;
4336
- stateKey?: string | null;
4337
- reason?: string;
4338
- expectedUpdatedAt?: string;
4339
- }
4340
- interface SetContactNurtureParams {
4341
- organizationId: string;
4342
- contactEmail: string;
4343
- nurture?: boolean;
4344
- }
4345
- interface CancelSchedulesAndHitlByEmailParams {
4346
- organizationId: string;
4347
- email: string;
4348
- }
4349
- interface CancelHitlByDealIdParams {
4350
- organizationId: string;
4351
- dealId: string;
4352
- }
4353
- interface ClearDealFieldsParams {
4354
- organizationId: string;
4355
- contactEmail?: string;
4356
- dealId?: string;
4357
- fields: ('proposalPdfUrl' | 'proposalGeneratedAt' | 'initialFee' | 'monthlyFee' | 'closedLostReason' | 'closedLostAt' | 'discoveryData' | 'discoverySubmittedAt')[];
4358
- }
4359
- interface DeleteDealParams {
4360
- organizationId: string;
4361
- dealId: string;
4362
- }
4363
- interface GetDealByIdParams {
4364
- dealId: string;
4365
- organizationId: string;
4366
- }
4367
- interface GetContactByIdParams {
4368
- contactId: string;
4369
- organizationId: string;
4370
- }
4371
- interface GetCompanyByIdParams {
4372
- companyId: string;
4373
- organizationId: string;
4374
- }
4375
- interface UpsertSocialPostParams {
4376
- organizationId: string;
4377
- platform: string;
4378
- platformPostId: string;
4379
- authorName: string;
4380
- authorUrl?: string | null;
4381
- postTitle: string;
4382
- postText: string;
4383
- postUrl: string;
4384
- engagementCount?: number;
4385
- commentsCount?: number;
4386
- postedAt: string;
4387
- metadata?: Record<string, unknown>;
4388
- relevanceScore?: number;
4389
- matchedKeywords?: string[];
4390
- matchedQuery?: string | null;
4391
- initialDraft?: string | null;
4392
- finalResponse?: string | null;
4393
- sourceCategory?: string | null;
4394
- }
4395
- interface UpsertSocialPostsResult {
4396
- inserted: number;
4397
- duplicatesSkipped: number;
4398
- }
4399
- interface AcqDeal {
4400
- id: string;
4401
- organizationId: string;
4402
- contactEmail: string;
4403
- pipelineKey: string;
4404
- stageKey?: string | null;
4405
- stateKey?: string | null;
4406
- discoveryData?: Json | null;
4407
- proposalData?: Json | null;
4408
- proposalSentAt?: string | null;
4409
- proposalPdfUrl?: string | null;
4410
- signatureEnvelopeId?: string | null;
4411
- sourceListId?: string | null;
4412
- sourceType?: string | null;
4413
- activityLog: DealActivityEntry[];
4414
- createdAt: Date;
4415
- updatedAt: Date;
4416
- }
4417
- interface DealActivityEntry {
4418
- type: string;
4419
- title: string;
4420
- description?: string;
4421
- payload?: Record<string, unknown>;
4422
- occurredAt: string;
4423
- }
4424
- interface AcqDealNote {
4425
- id: string;
4426
- dealId: string;
4427
- organizationId: string;
4428
- authorUserId: string | null;
4429
- body: string;
4430
- createdAt: string;
4431
- updatedAt: string;
4432
- }
4433
- interface CreateDealNoteParams {
4434
- organizationId: string;
4435
- dealId: string;
4436
- body: string;
4437
- authorUserId?: string;
4438
- }
4439
- interface ListDealNotesParams {
4440
- organizationId: string;
4441
- dealId: string;
4442
- }
4443
- interface CreateDealTaskParams {
4444
- organizationId: string;
4445
- dealId: string;
4446
- title: string;
4447
- description?: string | null;
4448
- kind?: AcqDealTaskKind;
4449
- dueAt?: string | null;
4450
- assigneeUserId?: string | null;
4451
- createdByUserId?: string | null;
4452
- }
4453
- interface ListDealTasksParams {
4454
- organizationId: string;
4455
- dealId: string;
4456
- }
4457
- interface ListDealTasksDueParams {
4458
- organizationId: string;
4459
- assigneeUserId?: string | null;
4460
- /** Window filter: 'overdue' = past due, 'today' = due today only, 'today_and_overdue' (default) = both, 'upcoming' = future */
4461
- window?: 'overdue' | 'today' | 'today_and_overdue' | 'upcoming';
4462
- }
4463
- interface CompleteDealTaskParams {
4464
- organizationId: string;
4465
- taskId: string;
4466
- completedByUserId: string | null;
4467
- }
4468
- interface RecordDealActivityParams {
4469
- organizationId: string;
4470
- dealId: string;
4471
- type: string;
4472
- title: string;
4473
- description?: string;
4474
- payload?: Record<string, unknown>;
4475
- }
4476
- interface DealStageSummary {
4477
- stage: string;
4478
- count: number;
4479
- oldestUpdatedAt: string | null;
4480
- newestUpdatedAt: string | null;
4481
- }
4482
- interface StaleDeal {
4483
- id: string;
4484
- contactEmail: string;
4485
- stageKey: string;
4486
- updatedAt: string;
4487
- daysStale: number;
4488
- }
4489
- interface DealPipelineAnalytics {
4490
- totalDeals: number;
4491
- stageSummary: DealStageSummary[];
4492
- staleDeals: StaleDeal[];
4493
- recentActivity: AcqDeal[];
4494
- }
4495
- interface DealFilters {
4496
- stage?: string;
4497
- search?: string;
4498
- limit?: number;
4499
- offset?: number;
4500
- }
4501
- interface AddContactsToListParams {
4502
- organizationId: string;
4503
- listId: string;
4504
- contactIds: string[];
4505
- }
4506
- interface AddContactsToListResult {
4507
- added: number;
4508
- alreadyExisted: number;
4509
- }
4510
- interface UpdateCompanyStageParams {
4511
- organizationId: string;
4512
- listId: string;
4513
- companyId: string;
4514
- stage: CompanyListStage;
4515
- executionId?: string;
4516
- }
4517
- interface UpdateContactStageParams {
4518
- organizationId: string;
4519
- listId: string;
4520
- contactId: string;
4521
- stage: ContactListStage;
4522
- executionId?: string;
4523
- }
4524
- interface RecordListExecutionParams {
4525
- organizationId: string;
4526
- listId: string;
4527
- executionId: string;
4528
- configSnapshot?: Record<string, unknown>;
4529
- }
4530
- interface BulkImportParams {
4531
- organizationId: string;
4532
- contacts: CreateContactParams[];
4533
- listId?: string;
4534
- }
4535
- interface BulkImportResult {
4536
- created: number;
4537
- updated: number;
4538
- errors: Array<{
4539
- email: string;
4540
- error: string;
4541
- }>;
4542
- }
4543
- interface BulkImportCompanyEntry {
4544
- name: string;
4545
- domain: string;
4546
- website?: string;
4547
- locationCity?: string;
4548
- locationState?: string;
4549
- category?: string;
4550
- source?: string;
4551
- enrichmentData?: Record<string, unknown>;
4552
- pipelineStatus?: Record<string, unknown>;
4553
- }
4554
- interface BulkImportCompaniesParams {
4555
- organizationId: string;
4556
- batchId: string;
4557
- companies: BulkImportCompanyEntry[];
4558
- }
4559
- interface BulkImportCompaniesResult {
4560
- created: number;
4561
- skipped: number;
4562
- errors: Array<{
4563
- companyName: string;
4564
- error: string;
4565
- }>;
4566
- }
4567
-
4568
- /**
4569
- * Origin resource type - where an execution/task originated from.
4570
- * Used for audit trails and tracking execution lineage.
4571
- */
4572
- type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
4573
-
4574
- /**
4575
- * Target for schedule execution - identifies what resource to execute.
4576
- * Unlike ExecutionTarget, payload is NOT included here because schedules
4577
- * store payload in the scheduleConfig (varies per step/item).
4578
- */
4579
- interface ScheduleTarget {
4580
- resourceType: 'agent' | 'workflow';
4581
- resourceId: string;
4582
- }
4583
- /**
4584
- * Optional origin tracking for schedules.
4585
- * Unlike OriginTracking (which is required), these fields are all optional
4586
- * for schedules created directly via API (not triggered by another resource).
4587
- */
4588
- interface ScheduleOriginTracking {
4589
- originExecutionId?: string;
4590
- originResourceType?: OriginResourceType;
4591
- originResourceId?: string;
4592
- }
4593
- type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
4594
- interface RecurringScheduleConfig {
4595
- type: 'recurring';
4596
- cron?: string;
4597
- interval?: 'daily' | 'weekly' | 'monthly';
4598
- time?: string;
4599
- timezone: string;
4600
- payload: Record<string, unknown>;
4601
- endAt?: string | null;
4602
- overduePolicy?: 'skip' | 'execute';
4603
- }
4604
- interface RelativeScheduleConfig {
4605
- type: 'relative';
4606
- anchorAt: string;
4607
- anchorLabel?: string;
4608
- items: RelativeScheduleItem[];
4609
- overduePolicy?: 'skip' | 'execute';
4610
- }
4611
- interface RelativeScheduleItem {
4612
- offset: string;
4613
- payload: Record<string, unknown>;
4614
- label?: string;
4615
- }
4616
- interface AbsoluteScheduleConfig {
4617
- type: 'absolute';
4618
- items: AbsoluteScheduleItem[];
4619
- overduePolicy?: 'skip' | 'execute';
4620
- }
4621
- interface AbsoluteScheduleItem {
4622
- runAt: string;
4623
- payload: Record<string, unknown>;
4624
- label?: string;
4625
- }
4626
- interface TaskSchedule extends ScheduleOriginTracking {
4627
- id: string;
4628
- organizationId: string;
4629
- name: string;
4630
- description?: string;
4631
- target: ScheduleTarget;
4632
- scheduleConfig: TaskScheduleConfig;
4633
- nextRunAt?: Date;
4634
- currentStep: number;
4635
- status: 'active' | 'paused' | 'completed' | 'cancelled';
4636
- lastRunAt?: Date;
4637
- lastExecutionId?: string;
4638
- maxRetries: number;
4639
- idempotencyKey?: string;
4640
- createdAt: Date;
4641
- updatedAt: Date;
4642
- }
4643
- interface CreateScheduleInput extends ScheduleOriginTracking {
4644
- organizationId: string;
4645
- name: string;
4646
- description?: string;
4647
- target: ScheduleTarget;
4648
- scheduleConfig: TaskScheduleConfig;
4649
- maxRetries?: number;
4650
- idempotencyKey?: string;
4651
- metadata?: Record<string, unknown>;
4652
- }
4653
-
4654
- type NotificationRow = Database['public']['Tables']['notifications']['Row'];
4655
- interface CreateNotificationParams {
4656
- userId: string;
4657
- organizationId: string;
4658
- category: NotificationRow['category'];
4659
- title: string;
4660
- message: string;
4661
- actionUrl?: string;
4662
- }
4663
-
4664
- type ProjectRow = Database['public']['Tables']['prj_projects']['Row'];
4665
- type MilestoneRow = Database['public']['Tables']['prj_milestones']['Row'];
4666
- type TaskRow = Database['public']['Tables']['prj_tasks']['Row'];
4667
- type NoteRow = Database['public']['Tables']['prj_notes']['Row'];
4668
- interface ProjectWithCounts extends ProjectRow {
4669
- milestoneCount: number;
4670
- taskCount: number;
4671
- completedMilestones?: number;
4672
- completedTasks?: number;
4673
- }
4674
- interface ProjectDetail extends ProjectRow {
4675
- milestones: MilestoneRow[];
4676
- tasks: TaskRow[];
4677
- company: {
4678
- id: string;
4679
- name: string;
4680
- domain: string | null;
4681
- } | null;
4682
- }
4683
-
4684
- /**
4685
- * Canonical vocabulary for `acq_touchpoints.kind`.
4686
- * DB CHECK constraint was dropped (Decision #9); validation lives here.
4687
- * Subtype/intent detail (e.g. triggered_by_action, subtype) goes in the touchpoint `payload` JSONB.
4688
- */
4689
-
4690
- declare const TouchpointKindSchema: z.ZodEnum<{
4691
- initial: "initial";
4692
- followup: "followup";
4693
- reply: "reply";
4694
- nudge: "nudge";
4695
- reminder: "reminder";
4696
- breakup: "breakup";
4697
- bounce: "bounce";
4698
- auto_reply: "auto_reply";
4699
- }>;
4700
- type TouchpointKind = z.infer<typeof TouchpointKindSchema>;
4701
4059
 
4702
4060
  declare const DealSchemas: {
4703
4061
  DealIdParams: z.ZodObject<{
@@ -4951,6 +4309,529 @@ declare const DealSchemas: {
4951
4309
  }, z.core.$strip>>;
4952
4310
  };
4953
4311
 
4312
+ /**
4313
+ * Lead Service Types
4314
+ * CRUD operation types for the acquisition platform (lists, companies, contacts, deals)
4315
+ *
4316
+ * Implementation: apps/api/src/acquisition/lead-service.ts (LeadService class)
4317
+ */
4318
+
4319
+ interface PaginatedResult<T> {
4320
+ data: T[];
4321
+ total: number;
4322
+ limit: number;
4323
+ offset: number;
4324
+ }
4325
+ interface CreateListParams {
4326
+ organizationId: string;
4327
+ name: string;
4328
+ description?: string;
4329
+ type?: string;
4330
+ batchIds?: string[];
4331
+ instantlyCampaignId?: string;
4332
+ status?: ListStatus;
4333
+ metadata?: Record<string, unknown>;
4334
+ scrapingConfig?: ScrapingConfig;
4335
+ icp?: IcpRubric;
4336
+ pipelineConfig?: PipelineConfig;
4337
+ }
4338
+ interface UpdateListParams {
4339
+ name?: string;
4340
+ description?: string;
4341
+ batchIds?: string[];
4342
+ }
4343
+ interface CreateCompanyParams {
4344
+ organizationId: string;
4345
+ name: string;
4346
+ domain?: string;
4347
+ linkedinUrl?: string;
4348
+ website?: string;
4349
+ numEmployees?: number;
4350
+ foundedYear?: number;
4351
+ locationCity?: string;
4352
+ locationState?: string;
4353
+ category?: string;
4354
+ source?: string;
4355
+ batchId?: string;
4356
+ verticalResearch?: string;
4357
+ }
4358
+ interface UpdateCompanyParams {
4359
+ name?: string;
4360
+ domain?: string;
4361
+ linkedinUrl?: string;
4362
+ website?: string;
4363
+ numEmployees?: number;
4364
+ foundedYear?: number;
4365
+ locationCity?: string;
4366
+ locationState?: string;
4367
+ category?: string;
4368
+ segment?: string;
4369
+ pipelineStatus?: Record<string, unknown>;
4370
+ enrichmentData?: Record<string, unknown>;
4371
+ source?: string;
4372
+ batchId?: string;
4373
+ status?: 'active' | 'invalid';
4374
+ verticalResearch?: string | null;
4375
+ /** Track A: flat qualification score column (null until a scoring rubric is defined) */
4376
+ qualificationScore?: number | null;
4377
+ /** Track A: flat qualification signals jsonb — mirrors the former pipeline_status.qualification shape */
4378
+ qualificationSignals?: Record<string, unknown> | null;
4379
+ /** Track A: key identifying the rubric used for qualification */
4380
+ qualificationRubricKey?: string | null;
4381
+ }
4382
+ type UpsertCompanyParams = CreateCompanyParams;
4383
+ interface CompanyFilters {
4384
+ listId?: string;
4385
+ search?: string;
4386
+ domain?: string;
4387
+ website?: string;
4388
+ segment?: string;
4389
+ category?: string;
4390
+ pipelineStatus?: Record<string, unknown>;
4391
+ /** Exclude companies whose pipeline_status contains this value (PostgREST NOT contains) */
4392
+ pipelineStatusNot?: Record<string, unknown>;
4393
+ batchId?: string;
4394
+ status?: 'active' | 'invalid';
4395
+ includeAll?: boolean;
4396
+ excludeColumns?: Array<'enrichmentData' | 'pipelineStatus'>;
4397
+ }
4398
+ interface CreateContactParams {
4399
+ organizationId: string;
4400
+ email: string;
4401
+ companyId?: string;
4402
+ firstName?: string;
4403
+ lastName?: string;
4404
+ linkedinUrl?: string;
4405
+ title?: string;
4406
+ source?: string;
4407
+ sourceId?: string;
4408
+ batchId?: string;
4409
+ }
4410
+ interface UpdateContactParams {
4411
+ companyId?: string;
4412
+ emailValid?: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN';
4413
+ firstName?: string;
4414
+ lastName?: string;
4415
+ linkedinUrl?: string;
4416
+ title?: string;
4417
+ headline?: string;
4418
+ filterReason?: string;
4419
+ openingLine?: string;
4420
+ pipelineStatus?: Record<string, unknown>;
4421
+ enrichmentData?: Record<string, unknown>;
4422
+ status?: 'active' | 'invalid';
4423
+ }
4424
+ type UpsertContactParams = CreateContactParams;
4425
+ interface ContactFilters {
4426
+ listId?: string;
4427
+ search?: string;
4428
+ openingLineIsNull?: boolean;
4429
+ pipelineStatus?: Record<string, unknown>;
4430
+ batchId?: string;
4431
+ contactStatus?: 'active' | 'invalid';
4432
+ }
4433
+ interface UpsertDealParams {
4434
+ organizationId: string;
4435
+ /** Contact email — dedupe key together with organization_id */
4436
+ contactEmail: string;
4437
+ /** Optional contact ID for foreign key join */
4438
+ contactId?: string;
4439
+ /** Campaign list that generated this deal (FK to acq_lists) */
4440
+ sourceListId?: string;
4441
+ /** Deal origin: 'instantly', 'referral', 'inbound', 'manual' */
4442
+ sourceType?: 'instantly' | 'referral' | 'inbound' | 'manual';
4443
+ /** Optional discovery data JSONB to set on upsert */
4444
+ discoveryData?: unknown;
4445
+ /** Optional proposal data JSONB to set on upsert */
4446
+ proposalData?: unknown;
4447
+ }
4448
+ interface UpdateDiscoveryDataParams {
4449
+ organizationId: string;
4450
+ contactEmail: string;
4451
+ discoveryData: unknown;
4452
+ submittedBy?: string;
4453
+ }
4454
+ interface UpdateProposalDataParams {
4455
+ organizationId: string;
4456
+ contactEmail: string;
4457
+ proposalData: unknown;
4458
+ proposalPdfUrl?: string;
4459
+ }
4460
+ interface MarkProposalSentParams {
4461
+ organizationId: string;
4462
+ contactEmail: string;
4463
+ }
4464
+ interface MarkProposalReviewedParams {
4465
+ organizationId: string;
4466
+ contactEmail: string;
4467
+ reviewedBy: string;
4468
+ proposalData?: unknown;
4469
+ }
4470
+ interface UpdateCloseLostReasonParams {
4471
+ organizationId: string;
4472
+ dealId: string;
4473
+ reason: string;
4474
+ }
4475
+ interface UpdateFeesParams {
4476
+ organizationId: string;
4477
+ contactEmail?: string;
4478
+ dealId?: string;
4479
+ initialFee?: number;
4480
+ monthlyFee?: number;
4481
+ }
4482
+ interface TransitionItemParams {
4483
+ organizationId: string;
4484
+ dealId: string;
4485
+ pipelineKey: string;
4486
+ stageKey: string;
4487
+ stateKey?: string | null;
4488
+ reason?: string;
4489
+ expectedUpdatedAt?: string;
4490
+ }
4491
+ interface SetContactNurtureParams {
4492
+ organizationId: string;
4493
+ contactEmail: string;
4494
+ nurture?: boolean;
4495
+ }
4496
+ interface CancelSchedulesAndHitlByEmailParams {
4497
+ organizationId: string;
4498
+ email: string;
4499
+ }
4500
+ interface CancelHitlByDealIdParams {
4501
+ organizationId: string;
4502
+ dealId: string;
4503
+ }
4504
+ interface ClearDealFieldsParams {
4505
+ organizationId: string;
4506
+ contactEmail?: string;
4507
+ dealId?: string;
4508
+ fields: ('proposalPdfUrl' | 'proposalGeneratedAt' | 'initialFee' | 'monthlyFee' | 'closedLostReason' | 'closedLostAt' | 'discoveryData' | 'discoverySubmittedAt')[];
4509
+ }
4510
+ interface DeleteDealParams {
4511
+ organizationId: string;
4512
+ dealId: string;
4513
+ }
4514
+ interface GetDealByIdParams {
4515
+ dealId: string;
4516
+ organizationId: string;
4517
+ }
4518
+ interface GetContactByIdParams {
4519
+ contactId: string;
4520
+ organizationId: string;
4521
+ }
4522
+ interface GetCompanyByIdParams {
4523
+ companyId: string;
4524
+ organizationId: string;
4525
+ }
4526
+ interface UpsertSocialPostParams {
4527
+ organizationId: string;
4528
+ platform: string;
4529
+ platformPostId: string;
4530
+ authorName: string;
4531
+ authorUrl?: string | null;
4532
+ postTitle: string;
4533
+ postText: string;
4534
+ postUrl: string;
4535
+ engagementCount?: number;
4536
+ commentsCount?: number;
4537
+ postedAt: string;
4538
+ metadata?: Record<string, unknown>;
4539
+ relevanceScore?: number;
4540
+ matchedKeywords?: string[];
4541
+ matchedQuery?: string | null;
4542
+ initialDraft?: string | null;
4543
+ finalResponse?: string | null;
4544
+ sourceCategory?: string | null;
4545
+ }
4546
+ interface UpsertSocialPostsResult {
4547
+ inserted: number;
4548
+ duplicatesSkipped: number;
4549
+ }
4550
+ interface AcqDeal {
4551
+ id: string;
4552
+ organizationId: string;
4553
+ contactEmail: string;
4554
+ pipelineKey: string;
4555
+ stageKey?: string | null;
4556
+ stateKey?: string | null;
4557
+ discoveryData?: Json | null;
4558
+ proposalData?: Json | null;
4559
+ proposalSentAt?: string | null;
4560
+ proposalPdfUrl?: string | null;
4561
+ signatureEnvelopeId?: string | null;
4562
+ sourceListId?: string | null;
4563
+ sourceType?: string | null;
4564
+ activityLog: DealActivityEntry[];
4565
+ createdAt: Date;
4566
+ updatedAt: Date;
4567
+ }
4568
+ interface DealActivityEntry {
4569
+ type: string;
4570
+ title: string;
4571
+ description?: string;
4572
+ payload?: Record<string, unknown>;
4573
+ occurredAt: string;
4574
+ }
4575
+ interface AcqDealNote {
4576
+ id: string;
4577
+ dealId: string;
4578
+ organizationId: string;
4579
+ authorUserId: string | null;
4580
+ body: string;
4581
+ createdAt: string;
4582
+ updatedAt: string;
4583
+ }
4584
+ interface CreateDealNoteParams {
4585
+ organizationId: string;
4586
+ dealId: string;
4587
+ body: string;
4588
+ authorUserId?: string;
4589
+ }
4590
+ interface ListDealNotesParams {
4591
+ organizationId: string;
4592
+ dealId: string;
4593
+ }
4594
+ interface CreateDealTaskParams {
4595
+ organizationId: string;
4596
+ dealId: string;
4597
+ title: string;
4598
+ description?: string | null;
4599
+ kind?: AcqDealTaskKind;
4600
+ dueAt?: string | null;
4601
+ assigneeUserId?: string | null;
4602
+ createdByUserId?: string | null;
4603
+ }
4604
+ interface ListDealTasksParams {
4605
+ organizationId: string;
4606
+ dealId: string;
4607
+ }
4608
+ interface ListDealTasksDueParams {
4609
+ organizationId: string;
4610
+ assigneeUserId?: string | null;
4611
+ /** Window filter: 'overdue' = past due, 'today' = due today only, 'today_and_overdue' (default) = both, 'upcoming' = future */
4612
+ window?: 'overdue' | 'today' | 'today_and_overdue' | 'upcoming';
4613
+ }
4614
+ interface CompleteDealTaskParams {
4615
+ organizationId: string;
4616
+ taskId: string;
4617
+ completedByUserId: string | null;
4618
+ }
4619
+ interface RecordDealActivityParams {
4620
+ organizationId: string;
4621
+ dealId: string;
4622
+ type: string;
4623
+ title: string;
4624
+ description?: string;
4625
+ payload?: Record<string, unknown>;
4626
+ }
4627
+ interface DealStageSummary {
4628
+ stage: string;
4629
+ count: number;
4630
+ oldestUpdatedAt: string | null;
4631
+ newestUpdatedAt: string | null;
4632
+ }
4633
+ interface StaleDeal {
4634
+ id: string;
4635
+ contactEmail: string;
4636
+ stageKey: string;
4637
+ updatedAt: string;
4638
+ daysStale: number;
4639
+ }
4640
+ interface DealPipelineAnalytics {
4641
+ totalDeals: number;
4642
+ stageSummary: DealStageSummary[];
4643
+ staleDeals: StaleDeal[];
4644
+ recentActivity: AcqDeal[];
4645
+ }
4646
+ interface DealFilters {
4647
+ stage?: string;
4648
+ search?: string;
4649
+ limit?: number;
4650
+ offset?: number;
4651
+ }
4652
+ interface AddContactsToListParams {
4653
+ organizationId: string;
4654
+ listId: string;
4655
+ contactIds: string[];
4656
+ }
4657
+ interface AddContactsToListResult {
4658
+ added: number;
4659
+ alreadyExisted: number;
4660
+ }
4661
+ interface UpdateCompanyStageParams {
4662
+ organizationId: string;
4663
+ listId: string;
4664
+ companyId: string;
4665
+ stage: string;
4666
+ executionId?: string;
4667
+ }
4668
+ interface UpdateContactStageParams {
4669
+ organizationId: string;
4670
+ listId: string;
4671
+ contactId: string;
4672
+ stage: string;
4673
+ executionId?: string;
4674
+ }
4675
+ interface RecordListExecutionParams {
4676
+ organizationId: string;
4677
+ listId: string;
4678
+ executionId: string;
4679
+ configSnapshot?: Record<string, unknown>;
4680
+ }
4681
+ interface BulkImportParams {
4682
+ organizationId: string;
4683
+ contacts: CreateContactParams[];
4684
+ listId?: string;
4685
+ }
4686
+ interface BulkImportResult {
4687
+ created: number;
4688
+ updated: number;
4689
+ errors: Array<{
4690
+ email: string;
4691
+ error: string;
4692
+ }>;
4693
+ }
4694
+ interface BulkImportCompanyEntry {
4695
+ name: string;
4696
+ domain: string;
4697
+ website?: string;
4698
+ locationCity?: string;
4699
+ locationState?: string;
4700
+ category?: string;
4701
+ source?: string;
4702
+ enrichmentData?: Record<string, unknown>;
4703
+ pipelineStatus?: Record<string, unknown>;
4704
+ }
4705
+ interface BulkImportCompaniesParams {
4706
+ organizationId: string;
4707
+ batchId: string;
4708
+ companies: BulkImportCompanyEntry[];
4709
+ }
4710
+ interface BulkImportCompaniesResult {
4711
+ created: number;
4712
+ skipped: number;
4713
+ errors: Array<{
4714
+ companyName: string;
4715
+ error: string;
4716
+ }>;
4717
+ }
4718
+
4719
+ /**
4720
+ * Origin resource type - where an execution/task originated from.
4721
+ * Used for audit trails and tracking execution lineage.
4722
+ */
4723
+ type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
4724
+
4725
+ /**
4726
+ * Target for schedule execution - identifies what resource to execute.
4727
+ * Unlike ExecutionTarget, payload is NOT included here because schedules
4728
+ * store payload in the scheduleConfig (varies per step/item).
4729
+ */
4730
+ interface ScheduleTarget {
4731
+ resourceType: 'agent' | 'workflow';
4732
+ resourceId: string;
4733
+ }
4734
+ /**
4735
+ * Optional origin tracking for schedules.
4736
+ * Unlike OriginTracking (which is required), these fields are all optional
4737
+ * for schedules created directly via API (not triggered by another resource).
4738
+ */
4739
+ interface ScheduleOriginTracking {
4740
+ originExecutionId?: string;
4741
+ originResourceType?: OriginResourceType;
4742
+ originResourceId?: string;
4743
+ }
4744
+ type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
4745
+ interface RecurringScheduleConfig {
4746
+ type: 'recurring';
4747
+ cron?: string;
4748
+ interval?: 'daily' | 'weekly' | 'monthly';
4749
+ time?: string;
4750
+ timezone: string;
4751
+ payload: Record<string, unknown>;
4752
+ endAt?: string | null;
4753
+ overduePolicy?: 'skip' | 'execute';
4754
+ }
4755
+ interface RelativeScheduleConfig {
4756
+ type: 'relative';
4757
+ anchorAt: string;
4758
+ anchorLabel?: string;
4759
+ items: RelativeScheduleItem[];
4760
+ overduePolicy?: 'skip' | 'execute';
4761
+ }
4762
+ interface RelativeScheduleItem {
4763
+ offset: string;
4764
+ payload: Record<string, unknown>;
4765
+ label?: string;
4766
+ }
4767
+ interface AbsoluteScheduleConfig {
4768
+ type: 'absolute';
4769
+ items: AbsoluteScheduleItem[];
4770
+ overduePolicy?: 'skip' | 'execute';
4771
+ }
4772
+ interface AbsoluteScheduleItem {
4773
+ runAt: string;
4774
+ payload: Record<string, unknown>;
4775
+ label?: string;
4776
+ }
4777
+ interface TaskSchedule extends ScheduleOriginTracking {
4778
+ id: string;
4779
+ organizationId: string;
4780
+ name: string;
4781
+ description?: string;
4782
+ target: ScheduleTarget;
4783
+ scheduleConfig: TaskScheduleConfig;
4784
+ nextRunAt?: Date;
4785
+ currentStep: number;
4786
+ status: 'active' | 'paused' | 'completed' | 'cancelled';
4787
+ lastRunAt?: Date;
4788
+ lastExecutionId?: string;
4789
+ maxRetries: number;
4790
+ idempotencyKey?: string;
4791
+ createdAt: Date;
4792
+ updatedAt: Date;
4793
+ }
4794
+ interface CreateScheduleInput extends ScheduleOriginTracking {
4795
+ organizationId: string;
4796
+ name: string;
4797
+ description?: string;
4798
+ target: ScheduleTarget;
4799
+ scheduleConfig: TaskScheduleConfig;
4800
+ maxRetries?: number;
4801
+ idempotencyKey?: string;
4802
+ metadata?: Record<string, unknown>;
4803
+ }
4804
+
4805
+ type NotificationRow = Database['public']['Tables']['notifications']['Row'];
4806
+ interface CreateNotificationParams {
4807
+ userId: string;
4808
+ organizationId: string;
4809
+ category: NotificationRow['category'];
4810
+ title: string;
4811
+ message: string;
4812
+ actionUrl?: string;
4813
+ }
4814
+
4815
+ type ProjectRow = Database['public']['Tables']['prj_projects']['Row'];
4816
+ type MilestoneRow = Database['public']['Tables']['prj_milestones']['Row'];
4817
+ type TaskRow = Database['public']['Tables']['prj_tasks']['Row'];
4818
+ type NoteRow = Database['public']['Tables']['prj_notes']['Row'];
4819
+ interface ProjectWithCounts extends ProjectRow {
4820
+ milestoneCount: number;
4821
+ taskCount: number;
4822
+ completedMilestones?: number;
4823
+ completedTasks?: number;
4824
+ }
4825
+ interface ProjectDetail extends ProjectRow {
4826
+ milestones: MilestoneRow[];
4827
+ tasks: TaskRow[];
4828
+ company: {
4829
+ id: string;
4830
+ name: string;
4831
+ domain: string | null;
4832
+ } | null;
4833
+ }
4834
+
4954
4835
  /**
4955
4836
  * A single CRM activity entry (note, stage change, or deal creation).
4956
4837
  * Matches the CrmActivityEntry interface from useRecentCrmActivity.ts.
@@ -7728,23 +7609,6 @@ type LeadToolMap = {
7728
7609
  };
7729
7610
  result: UpsertSocialPostsResult;
7730
7611
  };
7731
- recordTouchpoint: {
7732
- params: {
7733
- contactId?: string;
7734
- listMemberId?: string;
7735
- listId?: string;
7736
- direction: 'inbound' | 'outbound';
7737
- channel: string;
7738
- kind: TouchpointKind;
7739
- payload?: Record<string, unknown>;
7740
- artifactId?: string;
7741
- sourceExecutionId?: string;
7742
- occurredAt?: string;
7743
- };
7744
- result: {
7745
- id: string;
7746
- };
7747
- };
7748
7612
  setDealStateKey: {
7749
7613
  params: {
7750
7614
  dealId: string;
@@ -7770,35 +7634,17 @@ type LeadToolMap = {
7770
7634
  };
7771
7635
  result: DealDetail | null;
7772
7636
  };
7773
- listDealTouchpoints: {
7774
- params: {
7775
- dealId: string;
7776
- kind?: string;
7777
- limit?: number;
7778
- };
7779
- result: Array<{
7780
- id: string;
7781
- organization_id: string;
7782
- contact_id: string | null;
7783
- list_id: string | null;
7784
- list_member_id: string | null;
7785
- direction: string;
7786
- channel: string;
7787
- kind: string;
7788
- payload: Record<string, unknown> | null;
7789
- artifact_id: string | null;
7790
- source_execution_id: string | null;
7791
- occurred_at: string;
7792
- created_at: string;
7793
- }>;
7794
- };
7795
7637
  };
7796
7638
  type ListToolMap = {
7797
7639
  getConfig: {
7798
7640
  params: {
7799
7641
  listId: string;
7800
7642
  };
7801
- result: ListConfig;
7643
+ result: {
7644
+ scrapingConfig: ScrapingConfig;
7645
+ icp: IcpRubric;
7646
+ pipelineConfig: PipelineConfig;
7647
+ };
7802
7648
  };
7803
7649
  recordExecution: {
7804
7650
  params: Omit<RecordListExecutionParams, 'organizationId'>;