@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.
package/dist/index.d.ts CHANGED
@@ -702,6 +702,16 @@ interface WorkflowDefinition {
702
702
  * If provided, workflow appears in Execution Runner UI
703
703
  */
704
704
  interface?: ExecutionInterface;
705
+ /**
706
+ * Lead-gen processing stage this workflow implements (optional).
707
+ * Must match a key in the platform lead-gen stage catalog.
708
+ * Used by org-os graph derivation to surface workflow→stage edges and
709
+ * by pipeline_config validation to confirm each catalog stage has an
710
+ * implementing workflow before a list is activated.
711
+ *
712
+ * Example: stageImplemented: 'verified' on the email-verification workflow.
713
+ */
714
+ stageImplemented?: string;
705
715
  }
706
716
 
707
717
  /**
@@ -1104,7 +1114,7 @@ type Json = string | number | boolean | null | {
1104
1114
  } | Json[];
1105
1115
  type Database = {
1106
1116
  __InternalSupabase: {
1107
- PostgrestVersion: "12.2.3 (519615d)";
1117
+ PostgrestVersion: '12.2.3 (519615d)';
1108
1118
  };
1109
1119
  public: {
1110
1120
  Tables: {
@@ -1147,11 +1157,11 @@ type Database = {
1147
1157
  };
1148
1158
  Relationships: [
1149
1159
  {
1150
- foreignKeyName: "acq_artifacts_organization_id_fkey";
1151
- columns: ["organization_id"];
1160
+ foreignKeyName: 'acq_artifacts_organization_id_fkey';
1161
+ columns: ['organization_id'];
1152
1162
  isOneToOne: false;
1153
- referencedRelation: "organizations";
1154
- referencedColumns: ["id"];
1163
+ referencedRelation: 'organizations';
1164
+ referencedColumns: ['id'];
1155
1165
  }
1156
1166
  ];
1157
1167
  };
@@ -1236,11 +1246,11 @@ type Database = {
1236
1246
  };
1237
1247
  Relationships: [
1238
1248
  {
1239
- foreignKeyName: "acq_companies_organization_id_fkey";
1240
- columns: ["organization_id"];
1249
+ foreignKeyName: 'acq_companies_organization_id_fkey';
1250
+ columns: ['organization_id'];
1241
1251
  isOneToOne: false;
1242
- referencedRelation: "organizations";
1243
- referencedColumns: ["id"];
1252
+ referencedRelation: 'organizations';
1253
+ referencedColumns: ['id'];
1244
1254
  }
1245
1255
  ];
1246
1256
  };
@@ -1331,18 +1341,18 @@ type Database = {
1331
1341
  };
1332
1342
  Relationships: [
1333
1343
  {
1334
- foreignKeyName: "acq_contacts_company_id_fkey";
1335
- columns: ["company_id"];
1344
+ foreignKeyName: 'acq_contacts_company_id_fkey';
1345
+ columns: ['company_id'];
1336
1346
  isOneToOne: false;
1337
- referencedRelation: "acq_companies";
1338
- referencedColumns: ["id"];
1347
+ referencedRelation: 'acq_companies';
1348
+ referencedColumns: ['id'];
1339
1349
  },
1340
1350
  {
1341
- foreignKeyName: "acq_contacts_organization_id_fkey";
1342
- columns: ["organization_id"];
1351
+ foreignKeyName: 'acq_contacts_organization_id_fkey';
1352
+ columns: ['organization_id'];
1343
1353
  isOneToOne: false;
1344
- referencedRelation: "organizations";
1345
- referencedColumns: ["id"];
1354
+ referencedRelation: 'organizations';
1355
+ referencedColumns: ['id'];
1346
1356
  }
1347
1357
  ];
1348
1358
  };
@@ -1379,11 +1389,11 @@ type Database = {
1379
1389
  };
1380
1390
  Relationships: [
1381
1391
  {
1382
- foreignKeyName: "acq_content_organization_id_fkey";
1383
- columns: ["organization_id"];
1392
+ foreignKeyName: 'acq_content_organization_id_fkey';
1393
+ columns: ['organization_id'];
1384
1394
  isOneToOne: false;
1385
- referencedRelation: "organizations";
1386
- referencedColumns: ["id"];
1395
+ referencedRelation: 'organizations';
1396
+ referencedColumns: ['id'];
1387
1397
  }
1388
1398
  ];
1389
1399
  };
@@ -1447,18 +1457,18 @@ type Database = {
1447
1457
  };
1448
1458
  Relationships: [
1449
1459
  {
1450
- foreignKeyName: "acq_content_distributions_content_id_fkey";
1451
- columns: ["content_id"];
1460
+ foreignKeyName: 'acq_content_distributions_content_id_fkey';
1461
+ columns: ['content_id'];
1452
1462
  isOneToOne: false;
1453
- referencedRelation: "acq_content";
1454
- referencedColumns: ["id"];
1463
+ referencedRelation: 'acq_content';
1464
+ referencedColumns: ['id'];
1455
1465
  },
1456
1466
  {
1457
- foreignKeyName: "acq_content_distributions_organization_id_fkey";
1458
- columns: ["organization_id"];
1467
+ foreignKeyName: 'acq_content_distributions_organization_id_fkey';
1468
+ columns: ['organization_id'];
1459
1469
  isOneToOne: false;
1460
- referencedRelation: "organizations";
1461
- referencedColumns: ["id"];
1470
+ referencedRelation: 'organizations';
1471
+ referencedColumns: ['id'];
1462
1472
  }
1463
1473
  ];
1464
1474
  };
@@ -1492,18 +1502,18 @@ type Database = {
1492
1502
  };
1493
1503
  Relationships: [
1494
1504
  {
1495
- foreignKeyName: "acq_deal_notes_deal_id_fkey";
1496
- columns: ["deal_id"];
1505
+ foreignKeyName: 'acq_deal_notes_deal_id_fkey';
1506
+ columns: ['deal_id'];
1497
1507
  isOneToOne: false;
1498
- referencedRelation: "acq_deals";
1499
- referencedColumns: ["id"];
1508
+ referencedRelation: 'acq_deals';
1509
+ referencedColumns: ['id'];
1500
1510
  },
1501
1511
  {
1502
- foreignKeyName: "acq_deal_notes_organization_id_fkey";
1503
- columns: ["organization_id"];
1512
+ foreignKeyName: 'acq_deal_notes_organization_id_fkey';
1513
+ columns: ['organization_id'];
1504
1514
  isOneToOne: false;
1505
- referencedRelation: "organizations";
1506
- referencedColumns: ["id"];
1515
+ referencedRelation: 'organizations';
1516
+ referencedColumns: ['id'];
1507
1517
  }
1508
1518
  ];
1509
1519
  };
@@ -1555,18 +1565,18 @@ type Database = {
1555
1565
  };
1556
1566
  Relationships: [
1557
1567
  {
1558
- foreignKeyName: "acq_deal_tasks_deal_id_fkey";
1559
- columns: ["deal_id"];
1568
+ foreignKeyName: 'acq_deal_tasks_deal_id_fkey';
1569
+ columns: ['deal_id'];
1560
1570
  isOneToOne: false;
1561
- referencedRelation: "acq_deals";
1562
- referencedColumns: ["id"];
1571
+ referencedRelation: 'acq_deals';
1572
+ referencedColumns: ['id'];
1563
1573
  },
1564
1574
  {
1565
- foreignKeyName: "acq_deal_tasks_organization_id_fkey";
1566
- columns: ["organization_id"];
1575
+ foreignKeyName: 'acq_deal_tasks_organization_id_fkey';
1576
+ columns: ['organization_id'];
1567
1577
  isOneToOne: false;
1568
- referencedRelation: "organizations";
1569
- referencedColumns: ["id"];
1578
+ referencedRelation: 'organizations';
1579
+ referencedColumns: ['id'];
1570
1580
  }
1571
1581
  ];
1572
1582
  };
@@ -1678,25 +1688,25 @@ type Database = {
1678
1688
  };
1679
1689
  Relationships: [
1680
1690
  {
1681
- foreignKeyName: "acq_deals_contact_id_fkey";
1682
- columns: ["contact_id"];
1691
+ foreignKeyName: 'acq_deals_contact_id_fkey';
1692
+ columns: ['contact_id'];
1683
1693
  isOneToOne: false;
1684
- referencedRelation: "acq_contacts";
1685
- referencedColumns: ["id"];
1694
+ referencedRelation: 'acq_contacts';
1695
+ referencedColumns: ['id'];
1686
1696
  },
1687
1697
  {
1688
- foreignKeyName: "acq_deals_organization_id_fkey";
1689
- columns: ["organization_id"];
1698
+ foreignKeyName: 'acq_deals_organization_id_fkey';
1699
+ columns: ['organization_id'];
1690
1700
  isOneToOne: false;
1691
- referencedRelation: "organizations";
1692
- referencedColumns: ["id"];
1701
+ referencedRelation: 'organizations';
1702
+ referencedColumns: ['id'];
1693
1703
  },
1694
1704
  {
1695
- foreignKeyName: "acq_deals_source_list_id_fkey";
1696
- columns: ["source_list_id"];
1705
+ foreignKeyName: 'acq_deals_source_list_id_fkey';
1706
+ columns: ['source_list_id'];
1697
1707
  isOneToOne: false;
1698
- referencedRelation: "acq_lists";
1699
- referencedColumns: ["id"];
1708
+ referencedRelation: 'acq_lists';
1709
+ referencedColumns: ['id'];
1700
1710
  }
1701
1711
  ];
1702
1712
  };
@@ -1709,6 +1719,7 @@ type Database = {
1709
1719
  id: string;
1710
1720
  list_id: string;
1711
1721
  pipeline_key: string;
1722
+ processing_state: Json;
1712
1723
  source_execution_id: string | null;
1713
1724
  source_input_hash: string | null;
1714
1725
  source_resource_id: string | null;
@@ -1723,6 +1734,7 @@ type Database = {
1723
1734
  id?: string;
1724
1735
  list_id: string;
1725
1736
  pipeline_key?: string;
1737
+ processing_state?: Json;
1726
1738
  source_execution_id?: string | null;
1727
1739
  source_input_hash?: string | null;
1728
1740
  source_resource_id?: string | null;
@@ -1737,6 +1749,7 @@ type Database = {
1737
1749
  id?: string;
1738
1750
  list_id?: string;
1739
1751
  pipeline_key?: string;
1752
+ processing_state?: Json;
1740
1753
  source_execution_id?: string | null;
1741
1754
  source_input_hash?: string | null;
1742
1755
  source_resource_id?: string | null;
@@ -1745,25 +1758,25 @@ type Database = {
1745
1758
  };
1746
1759
  Relationships: [
1747
1760
  {
1748
- foreignKeyName: "acq_list_companies_company_id_fkey";
1749
- columns: ["company_id"];
1761
+ foreignKeyName: 'acq_list_companies_company_id_fkey';
1762
+ columns: ['company_id'];
1750
1763
  isOneToOne: false;
1751
- referencedRelation: "acq_companies";
1752
- referencedColumns: ["id"];
1764
+ referencedRelation: 'acq_companies';
1765
+ referencedColumns: ['id'];
1753
1766
  },
1754
1767
  {
1755
- foreignKeyName: "acq_list_companies_list_id_fkey";
1756
- columns: ["list_id"];
1768
+ foreignKeyName: 'acq_list_companies_list_id_fkey';
1769
+ columns: ['list_id'];
1757
1770
  isOneToOne: false;
1758
- referencedRelation: "acq_lists";
1759
- referencedColumns: ["id"];
1771
+ referencedRelation: 'acq_lists';
1772
+ referencedColumns: ['id'];
1760
1773
  },
1761
1774
  {
1762
- foreignKeyName: "acq_list_companies_source_execution_id_fkey";
1763
- columns: ["source_execution_id"];
1775
+ foreignKeyName: 'acq_list_companies_source_execution_id_fkey';
1776
+ columns: ['source_execution_id'];
1764
1777
  isOneToOne: false;
1765
- referencedRelation: "execution_logs";
1766
- referencedColumns: ["execution_id"];
1778
+ referencedRelation: 'execution_logs';
1779
+ referencedColumns: ['execution_id'];
1767
1780
  }
1768
1781
  ];
1769
1782
  };
@@ -1791,18 +1804,18 @@ type Database = {
1791
1804
  };
1792
1805
  Relationships: [
1793
1806
  {
1794
- foreignKeyName: "acq_list_executions_execution_id_fkey";
1795
- columns: ["execution_id"];
1807
+ foreignKeyName: 'acq_list_executions_execution_id_fkey';
1808
+ columns: ['execution_id'];
1796
1809
  isOneToOne: false;
1797
- referencedRelation: "execution_logs";
1798
- referencedColumns: ["execution_id"];
1810
+ referencedRelation: 'execution_logs';
1811
+ referencedColumns: ['execution_id'];
1799
1812
  },
1800
1813
  {
1801
- foreignKeyName: "acq_list_executions_list_id_fkey";
1802
- columns: ["list_id"];
1814
+ foreignKeyName: 'acq_list_executions_list_id_fkey';
1815
+ columns: ['list_id'];
1803
1816
  isOneToOne: false;
1804
- referencedRelation: "acq_lists";
1805
- referencedColumns: ["id"];
1817
+ referencedRelation: 'acq_lists';
1818
+ referencedColumns: ['id'];
1806
1819
  }
1807
1820
  ];
1808
1821
  };
@@ -1815,6 +1828,7 @@ type Database = {
1815
1828
  id: string;
1816
1829
  list_id: string;
1817
1830
  pipeline_key: string;
1831
+ processing_state: Json;
1818
1832
  source_execution_id: string | null;
1819
1833
  source_input_hash: string | null;
1820
1834
  source_resource_id: string | null;
@@ -1829,6 +1843,7 @@ type Database = {
1829
1843
  id?: string;
1830
1844
  list_id: string;
1831
1845
  pipeline_key?: string;
1846
+ processing_state?: Json;
1832
1847
  source_execution_id?: string | null;
1833
1848
  source_input_hash?: string | null;
1834
1849
  source_resource_id?: string | null;
@@ -1843,6 +1858,7 @@ type Database = {
1843
1858
  id?: string;
1844
1859
  list_id?: string;
1845
1860
  pipeline_key?: string;
1861
+ processing_state?: Json;
1846
1862
  source_execution_id?: string | null;
1847
1863
  source_input_hash?: string | null;
1848
1864
  source_resource_id?: string | null;
@@ -1851,90 +1867,84 @@ type Database = {
1851
1867
  };
1852
1868
  Relationships: [
1853
1869
  {
1854
- foreignKeyName: "acq_list_members_contact_id_fkey";
1855
- columns: ["contact_id"];
1870
+ foreignKeyName: 'acq_list_members_contact_id_fkey';
1871
+ columns: ['contact_id'];
1856
1872
  isOneToOne: false;
1857
- referencedRelation: "acq_contacts";
1858
- referencedColumns: ["id"];
1873
+ referencedRelation: 'acq_contacts';
1874
+ referencedColumns: ['id'];
1859
1875
  },
1860
1876
  {
1861
- foreignKeyName: "acq_list_members_list_id_fkey";
1862
- columns: ["list_id"];
1877
+ foreignKeyName: 'acq_list_members_list_id_fkey';
1878
+ columns: ['list_id'];
1863
1879
  isOneToOne: false;
1864
- referencedRelation: "acq_lists";
1865
- referencedColumns: ["id"];
1880
+ referencedRelation: 'acq_lists';
1881
+ referencedColumns: ['id'];
1866
1882
  },
1867
1883
  {
1868
- foreignKeyName: "acq_list_members_source_execution_id_fkey";
1869
- columns: ["source_execution_id"];
1884
+ foreignKeyName: 'acq_list_members_source_execution_id_fkey';
1885
+ columns: ['source_execution_id'];
1870
1886
  isOneToOne: false;
1871
- referencedRelation: "execution_logs";
1872
- referencedColumns: ["execution_id"];
1887
+ referencedRelation: 'execution_logs';
1888
+ referencedColumns: ['execution_id'];
1873
1889
  }
1874
1890
  ];
1875
1891
  };
1876
1892
  acq_lists: {
1877
1893
  Row: {
1878
- activity_log: Json;
1879
1894
  batch_ids: string[];
1880
1895
  completed_at: string | null;
1881
- config: Json;
1882
1896
  created_at: string;
1883
1897
  description: string | null;
1898
+ icp: Json;
1884
1899
  id: string;
1885
1900
  instantly_campaign_id: string | null;
1886
1901
  launched_at: string | null;
1887
1902
  metadata: Json;
1888
1903
  name: string;
1889
1904
  organization_id: string;
1890
- pipeline_key: string;
1891
- stage_key: string;
1892
- state_key: string;
1893
- type: string;
1905
+ pipeline_config: Json;
1906
+ scraping_config: Json;
1907
+ status: string;
1894
1908
  };
1895
1909
  Insert: {
1896
- activity_log?: Json;
1897
1910
  batch_ids?: string[];
1898
1911
  completed_at?: string | null;
1899
- config?: Json;
1900
1912
  created_at?: string;
1901
1913
  description?: string | null;
1914
+ icp?: Json;
1902
1915
  id?: string;
1903
1916
  instantly_campaign_id?: string | null;
1904
1917
  launched_at?: string | null;
1905
1918
  metadata?: Json;
1906
1919
  name: string;
1907
1920
  organization_id: string;
1908
- pipeline_key?: string;
1909
- stage_key?: string;
1910
- state_key?: string;
1911
- type?: string;
1921
+ pipeline_config?: Json;
1922
+ scraping_config?: Json;
1923
+ status?: string;
1912
1924
  };
1913
1925
  Update: {
1914
- activity_log?: Json;
1915
1926
  batch_ids?: string[];
1916
1927
  completed_at?: string | null;
1917
- config?: Json;
1918
1928
  created_at?: string;
1919
1929
  description?: string | null;
1930
+ icp?: Json;
1920
1931
  id?: string;
1921
1932
  instantly_campaign_id?: string | null;
1922
1933
  launched_at?: string | null;
1923
1934
  metadata?: Json;
1924
1935
  name?: string;
1925
1936
  organization_id?: string;
1926
- pipeline_key?: string;
1927
- stage_key?: string;
1928
- state_key?: string;
1929
- type?: string;
1937
+ pipeline_config?: Json;
1938
+ scraping_config?: Json;
1939
+ status?: string;
1930
1940
  };
1931
1941
  Relationships: [
1932
1942
  {
1933
- foreignKeyName: "acq_lists_organization_id_fkey";
1934
- columns: ["organization_id"];
1943
+ foreignKeyName: 'acq_lists_organization_id_fkey';
1944
+ columns: ['organization_id'];
1935
1945
  isOneToOne: false;
1936
- referencedRelation: "organizations";
1937
- referencedColumns: ["id"];
1946
+ referencedRelation: 'organizations';
1947
+ referencedColumns: ['id'];
1938
1948
  }
1939
1949
  ];
1940
1950
  };
@@ -2010,18 +2020,18 @@ type Database = {
2010
2020
  };
2011
2021
  Relationships: [
2012
2022
  {
2013
- foreignKeyName: "acq_seo_metrics_organization_id_fkey";
2014
- columns: ["organization_id"];
2023
+ foreignKeyName: 'acq_seo_metrics_organization_id_fkey';
2024
+ columns: ['organization_id'];
2015
2025
  isOneToOne: false;
2016
- referencedRelation: "organizations";
2017
- referencedColumns: ["id"];
2026
+ referencedRelation: 'organizations';
2027
+ referencedColumns: ['id'];
2018
2028
  },
2019
2029
  {
2020
- foreignKeyName: "acq_seo_metrics_seo_page_id_fkey";
2021
- columns: ["seo_page_id"];
2030
+ foreignKeyName: 'acq_seo_metrics_seo_page_id_fkey';
2031
+ columns: ['seo_page_id'];
2022
2032
  isOneToOne: false;
2023
- referencedRelation: "acq_seo_pages";
2024
- referencedColumns: ["id"];
2033
+ referencedRelation: 'acq_seo_pages';
2034
+ referencedColumns: ['id'];
2025
2035
  }
2026
2036
  ];
2027
2037
  };
@@ -2097,11 +2107,11 @@ type Database = {
2097
2107
  };
2098
2108
  Relationships: [
2099
2109
  {
2100
- foreignKeyName: "acq_seo_pages_organization_id_fkey";
2101
- columns: ["organization_id"];
2110
+ foreignKeyName: 'acq_seo_pages_organization_id_fkey';
2111
+ columns: ['organization_id'];
2102
2112
  isOneToOne: false;
2103
- referencedRelation: "organizations";
2104
- referencedColumns: ["id"];
2113
+ referencedRelation: 'organizations';
2114
+ referencedColumns: ['id'];
2105
2115
  }
2106
2116
  ];
2107
2117
  };
@@ -2198,67 +2208,11 @@ type Database = {
2198
2208
  };
2199
2209
  Relationships: [
2200
2210
  {
2201
- foreignKeyName: "acq_social_posts_organization_id_fkey";
2202
- columns: ["organization_id"];
2203
- isOneToOne: false;
2204
- referencedRelation: "organizations";
2205
- referencedColumns: ["id"];
2206
- }
2207
- ];
2208
- };
2209
- acq_touchpoints: {
2210
- Row: {
2211
- artifact_id: string | null;
2212
- channel: string;
2213
- contact_id: string | null;
2214
- created_at: string;
2215
- direction: string;
2216
- id: string;
2217
- kind: string;
2218
- list_id: string | null;
2219
- list_member_id: string | null;
2220
- occurred_at: string;
2221
- organization_id: string;
2222
- payload: Json | null;
2223
- source_execution_id: string | null;
2224
- };
2225
- Insert: {
2226
- artifact_id?: string | null;
2227
- channel: string;
2228
- contact_id?: string | null;
2229
- created_at?: string;
2230
- direction: string;
2231
- id?: string;
2232
- kind: string;
2233
- list_id?: string | null;
2234
- list_member_id?: string | null;
2235
- occurred_at: string;
2236
- organization_id: string;
2237
- payload?: Json | null;
2238
- source_execution_id?: string | null;
2239
- };
2240
- Update: {
2241
- artifact_id?: string | null;
2242
- channel?: string;
2243
- contact_id?: string | null;
2244
- created_at?: string;
2245
- direction?: string;
2246
- id?: string;
2247
- kind?: string;
2248
- list_id?: string | null;
2249
- list_member_id?: string | null;
2250
- occurred_at?: string;
2251
- organization_id?: string;
2252
- payload?: Json | null;
2253
- source_execution_id?: string | null;
2254
- };
2255
- Relationships: [
2256
- {
2257
- foreignKeyName: "acq_touchpoints_organization_id_fkey";
2258
- columns: ["organization_id"];
2211
+ foreignKeyName: 'acq_social_posts_organization_id_fkey';
2212
+ columns: ['organization_id'];
2259
2213
  isOneToOne: false;
2260
- referencedRelation: "organizations";
2261
- referencedColumns: ["id"];
2214
+ referencedRelation: 'organizations';
2215
+ referencedColumns: ['id'];
2262
2216
  }
2263
2217
  ];
2264
2218
  };
@@ -2313,11 +2267,11 @@ type Database = {
2313
2267
  };
2314
2268
  Relationships: [
2315
2269
  {
2316
- foreignKeyName: "activities_organization_id_fkey";
2317
- columns: ["organization_id"];
2270
+ foreignKeyName: 'activities_organization_id_fkey';
2271
+ columns: ['organization_id'];
2318
2272
  isOneToOne: false;
2319
- referencedRelation: "organizations";
2320
- referencedColumns: ["id"];
2273
+ referencedRelation: 'organizations';
2274
+ referencedColumns: ['id'];
2321
2275
  }
2322
2276
  ];
2323
2277
  };
@@ -2348,11 +2302,11 @@ type Database = {
2348
2302
  };
2349
2303
  Relationships: [
2350
2304
  {
2351
- foreignKeyName: "api_keys_organization_id_fkey";
2352
- columns: ["organization_id"];
2305
+ foreignKeyName: 'api_keys_organization_id_fkey';
2306
+ columns: ['organization_id'];
2353
2307
  isOneToOne: false;
2354
- referencedRelation: "organizations";
2355
- referencedColumns: ["id"];
2308
+ referencedRelation: 'organizations';
2309
+ referencedColumns: ['id'];
2356
2310
  }
2357
2311
  ];
2358
2312
  };
@@ -2431,25 +2385,25 @@ type Database = {
2431
2385
  };
2432
2386
  Relationships: [
2433
2387
  {
2434
- foreignKeyName: "command_queue_completed_by_fkey";
2435
- columns: ["completed_by"];
2388
+ foreignKeyName: 'command_queue_completed_by_fkey';
2389
+ columns: ['completed_by'];
2436
2390
  isOneToOne: false;
2437
- referencedRelation: "users";
2438
- referencedColumns: ["id"];
2391
+ referencedRelation: 'users';
2392
+ referencedColumns: ['id'];
2439
2393
  },
2440
2394
  {
2441
- foreignKeyName: "command_queue_organization_id_fkey";
2442
- columns: ["organization_id"];
2395
+ foreignKeyName: 'command_queue_organization_id_fkey';
2396
+ columns: ['organization_id'];
2443
2397
  isOneToOne: false;
2444
- referencedRelation: "organizations";
2445
- referencedColumns: ["id"];
2398
+ referencedRelation: 'organizations';
2399
+ referencedColumns: ['id'];
2446
2400
  },
2447
2401
  {
2448
- foreignKeyName: "command_queue_target_execution_id_fkey";
2449
- columns: ["target_execution_id"];
2402
+ foreignKeyName: 'command_queue_target_execution_id_fkey';
2403
+ columns: ['target_execution_id'];
2450
2404
  isOneToOne: false;
2451
- referencedRelation: "execution_logs";
2452
- referencedColumns: ["execution_id"];
2405
+ referencedRelation: 'execution_logs';
2406
+ referencedColumns: ['execution_id'];
2453
2407
  }
2454
2408
  ];
2455
2409
  };
@@ -2489,18 +2443,18 @@ type Database = {
2489
2443
  };
2490
2444
  Relationships: [
2491
2445
  {
2492
- foreignKeyName: "credentials_created_by_fkey";
2493
- columns: ["created_by"];
2446
+ foreignKeyName: 'credentials_created_by_fkey';
2447
+ columns: ['created_by'];
2494
2448
  isOneToOne: false;
2495
- referencedRelation: "users";
2496
- referencedColumns: ["id"];
2449
+ referencedRelation: 'users';
2450
+ referencedColumns: ['id'];
2497
2451
  },
2498
2452
  {
2499
- foreignKeyName: "credentials_organization_id_fkey";
2500
- columns: ["organization_id"];
2453
+ foreignKeyName: 'credentials_organization_id_fkey';
2454
+ columns: ['organization_id'];
2501
2455
  isOneToOne: false;
2502
- referencedRelation: "organizations";
2503
- referencedColumns: ["id"];
2456
+ referencedRelation: 'organizations';
2457
+ referencedColumns: ['id'];
2504
2458
  }
2505
2459
  ];
2506
2460
  };
@@ -2546,11 +2500,11 @@ type Database = {
2546
2500
  };
2547
2501
  Relationships: [
2548
2502
  {
2549
- foreignKeyName: "deployments_organization_id_fkey";
2550
- columns: ["organization_id"];
2503
+ foreignKeyName: 'deployments_organization_id_fkey';
2504
+ columns: ['organization_id'];
2551
2505
  isOneToOne: false;
2552
- referencedRelation: "organizations";
2553
- referencedColumns: ["id"];
2506
+ referencedRelation: 'organizations';
2507
+ referencedColumns: ['id'];
2554
2508
  }
2555
2509
  ];
2556
2510
  };
@@ -2605,25 +2559,25 @@ type Database = {
2605
2559
  };
2606
2560
  Relationships: [
2607
2561
  {
2608
- foreignKeyName: "execution_errors_execution_id_fkey";
2609
- columns: ["execution_id"];
2562
+ foreignKeyName: 'execution_errors_execution_id_fkey';
2563
+ columns: ['execution_id'];
2610
2564
  isOneToOne: false;
2611
- referencedRelation: "execution_logs";
2612
- referencedColumns: ["execution_id"];
2565
+ referencedRelation: 'execution_logs';
2566
+ referencedColumns: ['execution_id'];
2613
2567
  },
2614
2568
  {
2615
- foreignKeyName: "execution_errors_organization_id_fkey";
2616
- columns: ["organization_id"];
2569
+ foreignKeyName: 'execution_errors_organization_id_fkey';
2570
+ columns: ['organization_id'];
2617
2571
  isOneToOne: false;
2618
- referencedRelation: "organizations";
2619
- referencedColumns: ["id"];
2572
+ referencedRelation: 'organizations';
2573
+ referencedColumns: ['id'];
2620
2574
  },
2621
2575
  {
2622
- foreignKeyName: "execution_errors_resolved_by_fkey";
2623
- columns: ["resolved_by"];
2576
+ foreignKeyName: 'execution_errors_resolved_by_fkey';
2577
+ columns: ['resolved_by'];
2624
2578
  isOneToOne: false;
2625
- referencedRelation: "users";
2626
- referencedColumns: ["id"];
2579
+ referencedRelation: 'users';
2580
+ referencedColumns: ['id'];
2627
2581
  }
2628
2582
  ];
2629
2583
  };
@@ -2705,32 +2659,32 @@ type Database = {
2705
2659
  };
2706
2660
  Relationships: [
2707
2661
  {
2708
- foreignKeyName: "execution_history_organization_id_fkey";
2709
- columns: ["organization_id"];
2662
+ foreignKeyName: 'execution_history_organization_id_fkey';
2663
+ columns: ['organization_id'];
2710
2664
  isOneToOne: false;
2711
- referencedRelation: "organizations";
2712
- referencedColumns: ["id"];
2665
+ referencedRelation: 'organizations';
2666
+ referencedColumns: ['id'];
2713
2667
  },
2714
2668
  {
2715
- foreignKeyName: "execution_logs_origin_execution_id_fkey";
2716
- columns: ["origin_execution_id"];
2669
+ foreignKeyName: 'execution_logs_origin_execution_id_fkey';
2670
+ columns: ['origin_execution_id'];
2717
2671
  isOneToOne: false;
2718
- referencedRelation: "execution_logs";
2719
- referencedColumns: ["execution_id"];
2672
+ referencedRelation: 'execution_logs';
2673
+ referencedColumns: ['execution_id'];
2720
2674
  },
2721
2675
  {
2722
- foreignKeyName: "execution_logs_session_id_fkey";
2723
- columns: ["session_id"];
2676
+ foreignKeyName: 'execution_logs_session_id_fkey';
2677
+ columns: ['session_id'];
2724
2678
  isOneToOne: false;
2725
- referencedRelation: "sessions";
2726
- referencedColumns: ["session_id"];
2679
+ referencedRelation: 'sessions';
2680
+ referencedColumns: ['session_id'];
2727
2681
  },
2728
2682
  {
2729
- foreignKeyName: "execution_logs_user_id_fkey";
2730
- columns: ["user_id"];
2683
+ foreignKeyName: 'execution_logs_user_id_fkey';
2684
+ columns: ['user_id'];
2731
2685
  isOneToOne: false;
2732
- referencedRelation: "users";
2733
- referencedColumns: ["id"];
2686
+ referencedRelation: 'users';
2687
+ referencedColumns: ['id'];
2734
2688
  }
2735
2689
  ];
2736
2690
  };
@@ -2776,18 +2730,18 @@ type Database = {
2776
2730
  };
2777
2731
  Relationships: [
2778
2732
  {
2779
- foreignKeyName: "execution_metrics_execution_id_fkey";
2780
- columns: ["execution_id"];
2733
+ foreignKeyName: 'execution_metrics_execution_id_fkey';
2734
+ columns: ['execution_id'];
2781
2735
  isOneToOne: true;
2782
- referencedRelation: "execution_logs";
2783
- referencedColumns: ["execution_id"];
2736
+ referencedRelation: 'execution_logs';
2737
+ referencedColumns: ['execution_id'];
2784
2738
  },
2785
2739
  {
2786
- foreignKeyName: "execution_metrics_organization_id_fkey";
2787
- columns: ["organization_id"];
2740
+ foreignKeyName: 'execution_metrics_organization_id_fkey';
2741
+ columns: ['organization_id'];
2788
2742
  isOneToOne: false;
2789
- referencedRelation: "organizations";
2790
- referencedColumns: ["id"];
2743
+ referencedRelation: 'organizations';
2744
+ referencedColumns: ['id'];
2791
2745
  }
2792
2746
  ];
2793
2747
  };
@@ -2830,18 +2784,18 @@ type Database = {
2830
2784
  };
2831
2785
  Relationships: [
2832
2786
  {
2833
- foreignKeyName: "notifications_organization_id_fkey";
2834
- columns: ["organization_id"];
2787
+ foreignKeyName: 'notifications_organization_id_fkey';
2788
+ columns: ['organization_id'];
2835
2789
  isOneToOne: false;
2836
- referencedRelation: "organizations";
2837
- referencedColumns: ["id"];
2790
+ referencedRelation: 'organizations';
2791
+ referencedColumns: ['id'];
2838
2792
  },
2839
2793
  {
2840
- foreignKeyName: "notifications_user_id_fkey";
2841
- columns: ["user_id"];
2794
+ foreignKeyName: 'notifications_user_id_fkey';
2795
+ columns: ['user_id'];
2842
2796
  isOneToOne: false;
2843
- referencedRelation: "users";
2844
- referencedColumns: ["id"];
2797
+ referencedRelation: 'users';
2798
+ referencedColumns: ['id'];
2845
2799
  }
2846
2800
  ];
2847
2801
  };
@@ -2896,18 +2850,18 @@ type Database = {
2896
2850
  };
2897
2851
  Relationships: [
2898
2852
  {
2899
- foreignKeyName: "org_invitations_inviter_user_id_fkey";
2900
- columns: ["inviter_user_id"];
2853
+ foreignKeyName: 'org_invitations_inviter_user_id_fkey';
2854
+ columns: ['inviter_user_id'];
2901
2855
  isOneToOne: false;
2902
- referencedRelation: "users";
2903
- referencedColumns: ["id"];
2856
+ referencedRelation: 'users';
2857
+ referencedColumns: ['id'];
2904
2858
  },
2905
2859
  {
2906
- foreignKeyName: "org_invitations_organization_id_fkey";
2907
- columns: ["organization_id"];
2860
+ foreignKeyName: 'org_invitations_organization_id_fkey';
2861
+ columns: ['organization_id'];
2908
2862
  isOneToOne: false;
2909
- referencedRelation: "organizations";
2910
- referencedColumns: ["id"];
2863
+ referencedRelation: 'organizations';
2864
+ referencedColumns: ['id'];
2911
2865
  }
2912
2866
  ];
2913
2867
  };
@@ -2950,18 +2904,18 @@ type Database = {
2950
2904
  };
2951
2905
  Relationships: [
2952
2906
  {
2953
- foreignKeyName: "org_memberships_organization_id_fkey";
2954
- columns: ["organization_id"];
2907
+ foreignKeyName: 'org_memberships_organization_id_fkey';
2908
+ columns: ['organization_id'];
2955
2909
  isOneToOne: false;
2956
- referencedRelation: "organizations";
2957
- referencedColumns: ["id"];
2910
+ referencedRelation: 'organizations';
2911
+ referencedColumns: ['id'];
2958
2912
  },
2959
2913
  {
2960
- foreignKeyName: "org_memberships_user_id_fkey";
2961
- columns: ["user_id"];
2914
+ foreignKeyName: 'org_memberships_user_id_fkey';
2915
+ columns: ['user_id'];
2962
2916
  isOneToOne: false;
2963
- referencedRelation: "users";
2964
- referencedColumns: ["id"];
2917
+ referencedRelation: 'users';
2918
+ referencedColumns: ['id'];
2965
2919
  }
2966
2920
  ];
2967
2921
  };
@@ -2986,25 +2940,25 @@ type Database = {
2986
2940
  };
2987
2941
  Relationships: [
2988
2942
  {
2989
- foreignKeyName: "org_rol_assignments_granted_by_fkey";
2990
- columns: ["granted_by"];
2943
+ foreignKeyName: 'org_rol_assignments_granted_by_fkey';
2944
+ columns: ['granted_by'];
2991
2945
  isOneToOne: false;
2992
- referencedRelation: "users";
2993
- referencedColumns: ["id"];
2946
+ referencedRelation: 'users';
2947
+ referencedColumns: ['id'];
2994
2948
  },
2995
2949
  {
2996
- foreignKeyName: "org_rol_assignments_membership_id_fkey";
2997
- columns: ["membership_id"];
2950
+ foreignKeyName: 'org_rol_assignments_membership_id_fkey';
2951
+ columns: ['membership_id'];
2998
2952
  isOneToOne: false;
2999
- referencedRelation: "org_memberships";
3000
- referencedColumns: ["id"];
2953
+ referencedRelation: 'org_memberships';
2954
+ referencedColumns: ['id'];
3001
2955
  },
3002
2956
  {
3003
- foreignKeyName: "org_rol_assignments_role_id_fkey";
3004
- columns: ["role_id"];
2957
+ foreignKeyName: 'org_rol_assignments_role_id_fkey';
2958
+ columns: ['role_id'];
3005
2959
  isOneToOne: false;
3006
- referencedRelation: "org_rol_definitions";
3007
- referencedColumns: ["id"];
2960
+ referencedRelation: 'org_rol_definitions';
2961
+ referencedColumns: ['id'];
3008
2962
  }
3009
2963
  ];
3010
2964
  };
@@ -3041,11 +2995,11 @@ type Database = {
3041
2995
  };
3042
2996
  Relationships: [
3043
2997
  {
3044
- foreignKeyName: "org_rol_definitions_organization_id_fkey";
3045
- columns: ["organization_id"];
2998
+ foreignKeyName: 'org_rol_definitions_organization_id_fkey';
2999
+ columns: ['organization_id'];
3046
3000
  isOneToOne: false;
3047
- referencedRelation: "organizations";
3048
- referencedColumns: ["id"];
3001
+ referencedRelation: 'organizations';
3002
+ referencedColumns: ['id'];
3049
3003
  }
3050
3004
  ];
3051
3005
  };
@@ -3067,18 +3021,18 @@ type Database = {
3067
3021
  };
3068
3022
  Relationships: [
3069
3023
  {
3070
- foreignKeyName: "org_rol_grants_permission_key_fkey";
3071
- columns: ["permission_key"];
3024
+ foreignKeyName: 'org_rol_grants_permission_key_fkey';
3025
+ columns: ['permission_key'];
3072
3026
  isOneToOne: false;
3073
- referencedRelation: "org_rol_permissions";
3074
- referencedColumns: ["key"];
3027
+ referencedRelation: 'org_rol_permissions';
3028
+ referencedColumns: ['key'];
3075
3029
  },
3076
3030
  {
3077
- foreignKeyName: "org_rol_grants_role_id_fkey";
3078
- columns: ["role_id"];
3031
+ foreignKeyName: 'org_rol_grants_role_id_fkey';
3032
+ columns: ['role_id'];
3079
3033
  isOneToOne: false;
3080
- referencedRelation: "org_rol_definitions";
3081
- referencedColumns: ["id"];
3034
+ referencedRelation: 'org_rol_definitions';
3035
+ referencedColumns: ['id'];
3082
3036
  }
3083
3037
  ];
3084
3038
  };
@@ -3190,25 +3144,25 @@ type Database = {
3190
3144
  };
3191
3145
  Relationships: [
3192
3146
  {
3193
- foreignKeyName: "fk_milestones_project";
3194
- columns: ["project_id"];
3147
+ foreignKeyName: 'fk_milestones_project';
3148
+ columns: ['project_id'];
3195
3149
  isOneToOne: false;
3196
- referencedRelation: "prj_projects";
3197
- referencedColumns: ["id"];
3150
+ referencedRelation: 'prj_projects';
3151
+ referencedColumns: ['id'];
3198
3152
  },
3199
3153
  {
3200
- foreignKeyName: "prj_milestones_organization_id_fkey";
3201
- columns: ["organization_id"];
3154
+ foreignKeyName: 'prj_milestones_organization_id_fkey';
3155
+ columns: ['organization_id'];
3202
3156
  isOneToOne: false;
3203
- referencedRelation: "organizations";
3204
- referencedColumns: ["id"];
3157
+ referencedRelation: 'organizations';
3158
+ referencedColumns: ['id'];
3205
3159
  },
3206
3160
  {
3207
- foreignKeyName: "prj_milestones_project_id_fkey";
3208
- columns: ["project_id"];
3161
+ foreignKeyName: 'prj_milestones_project_id_fkey';
3162
+ columns: ['project_id'];
3209
3163
  isOneToOne: false;
3210
- referencedRelation: "prj_projects";
3211
- referencedColumns: ["id"];
3164
+ referencedRelation: 'prj_projects';
3165
+ referencedColumns: ['id'];
3212
3166
  }
3213
3167
  ];
3214
3168
  };
@@ -3257,67 +3211,67 @@ type Database = {
3257
3211
  };
3258
3212
  Relationships: [
3259
3213
  {
3260
- foreignKeyName: "fk_notes_created_by";
3261
- columns: ["created_by"];
3214
+ foreignKeyName: 'fk_notes_created_by';
3215
+ columns: ['created_by'];
3262
3216
  isOneToOne: false;
3263
- referencedRelation: "users";
3264
- referencedColumns: ["id"];
3217
+ referencedRelation: 'users';
3218
+ referencedColumns: ['id'];
3265
3219
  },
3266
3220
  {
3267
- foreignKeyName: "fk_notes_milestone";
3268
- columns: ["milestone_id"];
3221
+ foreignKeyName: 'fk_notes_milestone';
3222
+ columns: ['milestone_id'];
3269
3223
  isOneToOne: false;
3270
- referencedRelation: "prj_milestones";
3271
- referencedColumns: ["id"];
3224
+ referencedRelation: 'prj_milestones';
3225
+ referencedColumns: ['id'];
3272
3226
  },
3273
3227
  {
3274
- foreignKeyName: "fk_notes_project";
3275
- columns: ["project_id"];
3228
+ foreignKeyName: 'fk_notes_project';
3229
+ columns: ['project_id'];
3276
3230
  isOneToOne: false;
3277
- referencedRelation: "prj_projects";
3278
- referencedColumns: ["id"];
3231
+ referencedRelation: 'prj_projects';
3232
+ referencedColumns: ['id'];
3279
3233
  },
3280
3234
  {
3281
- foreignKeyName: "fk_notes_task";
3282
- columns: ["task_id"];
3235
+ foreignKeyName: 'fk_notes_task';
3236
+ columns: ['task_id'];
3283
3237
  isOneToOne: false;
3284
- referencedRelation: "prj_tasks";
3285
- referencedColumns: ["id"];
3238
+ referencedRelation: 'prj_tasks';
3239
+ referencedColumns: ['id'];
3286
3240
  },
3287
3241
  {
3288
- foreignKeyName: "prj_notes_created_by_fkey";
3289
- columns: ["created_by"];
3242
+ foreignKeyName: 'prj_notes_created_by_fkey';
3243
+ columns: ['created_by'];
3290
3244
  isOneToOne: false;
3291
- referencedRelation: "users";
3292
- referencedColumns: ["id"];
3245
+ referencedRelation: 'users';
3246
+ referencedColumns: ['id'];
3293
3247
  },
3294
3248
  {
3295
- foreignKeyName: "prj_notes_milestone_id_fkey";
3296
- columns: ["milestone_id"];
3249
+ foreignKeyName: 'prj_notes_milestone_id_fkey';
3250
+ columns: ['milestone_id'];
3297
3251
  isOneToOne: false;
3298
- referencedRelation: "prj_milestones";
3299
- referencedColumns: ["id"];
3252
+ referencedRelation: 'prj_milestones';
3253
+ referencedColumns: ['id'];
3300
3254
  },
3301
3255
  {
3302
- foreignKeyName: "prj_notes_organization_id_fkey";
3303
- columns: ["organization_id"];
3256
+ foreignKeyName: 'prj_notes_organization_id_fkey';
3257
+ columns: ['organization_id'];
3304
3258
  isOneToOne: false;
3305
- referencedRelation: "organizations";
3306
- referencedColumns: ["id"];
3259
+ referencedRelation: 'organizations';
3260
+ referencedColumns: ['id'];
3307
3261
  },
3308
3262
  {
3309
- foreignKeyName: "prj_notes_project_id_fkey";
3310
- columns: ["project_id"];
3263
+ foreignKeyName: 'prj_notes_project_id_fkey';
3264
+ columns: ['project_id'];
3311
3265
  isOneToOne: false;
3312
- referencedRelation: "prj_projects";
3313
- referencedColumns: ["id"];
3266
+ referencedRelation: 'prj_projects';
3267
+ referencedColumns: ['id'];
3314
3268
  },
3315
3269
  {
3316
- foreignKeyName: "prj_notes_task_id_fkey";
3317
- columns: ["task_id"];
3270
+ foreignKeyName: 'prj_notes_task_id_fkey';
3271
+ columns: ['task_id'];
3318
3272
  isOneToOne: false;
3319
- referencedRelation: "prj_tasks";
3320
- referencedColumns: ["id"];
3273
+ referencedRelation: 'prj_tasks';
3274
+ referencedColumns: ['id'];
3321
3275
  }
3322
3276
  ];
3323
3277
  };
@@ -3375,39 +3329,39 @@ type Database = {
3375
3329
  };
3376
3330
  Relationships: [
3377
3331
  {
3378
- foreignKeyName: "fk_projects_company";
3379
- columns: ["client_company_id"];
3332
+ foreignKeyName: 'fk_projects_company';
3333
+ columns: ['client_company_id'];
3380
3334
  isOneToOne: false;
3381
- referencedRelation: "acq_companies";
3382
- referencedColumns: ["id"];
3335
+ referencedRelation: 'acq_companies';
3336
+ referencedColumns: ['id'];
3383
3337
  },
3384
3338
  {
3385
- foreignKeyName: "fk_projects_deal";
3386
- columns: ["deal_id"];
3339
+ foreignKeyName: 'fk_projects_deal';
3340
+ columns: ['deal_id'];
3387
3341
  isOneToOne: false;
3388
- referencedRelation: "acq_deals";
3389
- referencedColumns: ["id"];
3342
+ referencedRelation: 'acq_deals';
3343
+ referencedColumns: ['id'];
3390
3344
  },
3391
3345
  {
3392
- foreignKeyName: "prj_projects_client_company_id_fkey";
3393
- columns: ["client_company_id"];
3346
+ foreignKeyName: 'prj_projects_client_company_id_fkey';
3347
+ columns: ['client_company_id'];
3394
3348
  isOneToOne: false;
3395
- referencedRelation: "acq_companies";
3396
- referencedColumns: ["id"];
3349
+ referencedRelation: 'acq_companies';
3350
+ referencedColumns: ['id'];
3397
3351
  },
3398
3352
  {
3399
- foreignKeyName: "prj_projects_deal_id_fkey";
3400
- columns: ["deal_id"];
3353
+ foreignKeyName: 'prj_projects_deal_id_fkey';
3354
+ columns: ['deal_id'];
3401
3355
  isOneToOne: false;
3402
- referencedRelation: "acq_deals";
3403
- referencedColumns: ["id"];
3356
+ referencedRelation: 'acq_deals';
3357
+ referencedColumns: ['id'];
3404
3358
  },
3405
3359
  {
3406
- foreignKeyName: "prj_projects_organization_id_fkey";
3407
- columns: ["organization_id"];
3360
+ foreignKeyName: 'prj_projects_organization_id_fkey';
3361
+ columns: ['organization_id'];
3408
3362
  isOneToOne: false;
3409
- referencedRelation: "organizations";
3410
- referencedColumns: ["id"];
3363
+ referencedRelation: 'organizations';
3364
+ referencedColumns: ['id'];
3411
3365
  }
3412
3366
  ];
3413
3367
  };
@@ -3471,53 +3425,53 @@ type Database = {
3471
3425
  };
3472
3426
  Relationships: [
3473
3427
  {
3474
- foreignKeyName: "fk_tasks_milestone";
3475
- columns: ["milestone_id"];
3428
+ foreignKeyName: 'fk_tasks_milestone';
3429
+ columns: ['milestone_id'];
3476
3430
  isOneToOne: false;
3477
- referencedRelation: "prj_milestones";
3478
- referencedColumns: ["id"];
3431
+ referencedRelation: 'prj_milestones';
3432
+ referencedColumns: ['id'];
3479
3433
  },
3480
3434
  {
3481
- foreignKeyName: "fk_tasks_parent";
3482
- columns: ["parent_task_id"];
3435
+ foreignKeyName: 'fk_tasks_parent';
3436
+ columns: ['parent_task_id'];
3483
3437
  isOneToOne: false;
3484
- referencedRelation: "prj_tasks";
3485
- referencedColumns: ["id"];
3438
+ referencedRelation: 'prj_tasks';
3439
+ referencedColumns: ['id'];
3486
3440
  },
3487
3441
  {
3488
- foreignKeyName: "fk_tasks_project";
3489
- columns: ["project_id"];
3442
+ foreignKeyName: 'fk_tasks_project';
3443
+ columns: ['project_id'];
3490
3444
  isOneToOne: false;
3491
- referencedRelation: "prj_projects";
3492
- referencedColumns: ["id"];
3445
+ referencedRelation: 'prj_projects';
3446
+ referencedColumns: ['id'];
3493
3447
  },
3494
3448
  {
3495
- foreignKeyName: "prj_tasks_milestone_id_fkey";
3496
- columns: ["milestone_id"];
3449
+ foreignKeyName: 'prj_tasks_milestone_id_fkey';
3450
+ columns: ['milestone_id'];
3497
3451
  isOneToOne: false;
3498
- referencedRelation: "prj_milestones";
3499
- referencedColumns: ["id"];
3452
+ referencedRelation: 'prj_milestones';
3453
+ referencedColumns: ['id'];
3500
3454
  },
3501
3455
  {
3502
- foreignKeyName: "prj_tasks_organization_id_fkey";
3503
- columns: ["organization_id"];
3456
+ foreignKeyName: 'prj_tasks_organization_id_fkey';
3457
+ columns: ['organization_id'];
3504
3458
  isOneToOne: false;
3505
- referencedRelation: "organizations";
3506
- referencedColumns: ["id"];
3459
+ referencedRelation: 'organizations';
3460
+ referencedColumns: ['id'];
3507
3461
  },
3508
3462
  {
3509
- foreignKeyName: "prj_tasks_parent_task_id_fkey";
3510
- columns: ["parent_task_id"];
3463
+ foreignKeyName: 'prj_tasks_parent_task_id_fkey';
3464
+ columns: ['parent_task_id'];
3511
3465
  isOneToOne: false;
3512
- referencedRelation: "prj_tasks";
3513
- referencedColumns: ["id"];
3466
+ referencedRelation: 'prj_tasks';
3467
+ referencedColumns: ['id'];
3514
3468
  },
3515
3469
  {
3516
- foreignKeyName: "prj_tasks_project_id_fkey";
3517
- columns: ["project_id"];
3470
+ foreignKeyName: 'prj_tasks_project_id_fkey';
3471
+ columns: ['project_id'];
3518
3472
  isOneToOne: false;
3519
- referencedRelation: "prj_projects";
3520
- referencedColumns: ["id"];
3473
+ referencedRelation: 'prj_projects';
3474
+ referencedColumns: ['id'];
3521
3475
  }
3522
3476
  ];
3523
3477
  };
@@ -3587,25 +3541,25 @@ type Database = {
3587
3541
  };
3588
3542
  Relationships: [
3589
3543
  {
3590
- foreignKeyName: "reported_requests_organization_id_fkey";
3591
- columns: ["organization_id"];
3544
+ foreignKeyName: 'reported_requests_organization_id_fkey';
3545
+ columns: ['organization_id'];
3592
3546
  isOneToOne: false;
3593
- referencedRelation: "organizations";
3594
- referencedColumns: ["id"];
3547
+ referencedRelation: 'organizations';
3548
+ referencedColumns: ['id'];
3595
3549
  },
3596
3550
  {
3597
- foreignKeyName: "reported_requests_project_id_fkey";
3598
- columns: ["project_id"];
3551
+ foreignKeyName: 'reported_requests_project_id_fkey';
3552
+ columns: ['project_id'];
3599
3553
  isOneToOne: false;
3600
- referencedRelation: "prj_projects";
3601
- referencedColumns: ["id"];
3554
+ referencedRelation: 'prj_projects';
3555
+ referencedColumns: ['id'];
3602
3556
  },
3603
3557
  {
3604
- foreignKeyName: "reported_requests_task_id_fkey";
3605
- columns: ["task_id"];
3558
+ foreignKeyName: 'reported_requests_task_id_fkey';
3559
+ columns: ['task_id'];
3606
3560
  isOneToOne: false;
3607
- referencedRelation: "prj_tasks";
3608
- referencedColumns: ["id"];
3561
+ referencedRelation: 'prj_tasks';
3562
+ referencedColumns: ['id'];
3609
3563
  }
3610
3564
  ];
3611
3565
  };
@@ -3645,11 +3599,11 @@ type Database = {
3645
3599
  };
3646
3600
  Relationships: [
3647
3601
  {
3648
- foreignKeyName: "session_messages_session_id_fkey";
3649
- columns: ["session_id"];
3602
+ foreignKeyName: 'session_messages_session_id_fkey';
3603
+ columns: ['session_id'];
3650
3604
  isOneToOne: false;
3651
- referencedRelation: "sessions";
3652
- referencedColumns: ["session_id"];
3605
+ referencedRelation: 'sessions';
3606
+ referencedColumns: ['session_id'];
3653
3607
  }
3654
3608
  ];
3655
3609
  };
@@ -3704,18 +3658,18 @@ type Database = {
3704
3658
  };
3705
3659
  Relationships: [
3706
3660
  {
3707
- foreignKeyName: "fk_organization";
3708
- columns: ["organization_id"];
3661
+ foreignKeyName: 'fk_organization';
3662
+ columns: ['organization_id'];
3709
3663
  isOneToOne: false;
3710
- referencedRelation: "organizations";
3711
- referencedColumns: ["id"];
3664
+ referencedRelation: 'organizations';
3665
+ referencedColumns: ['id'];
3712
3666
  },
3713
3667
  {
3714
- foreignKeyName: "fk_user";
3715
- columns: ["user_id"];
3668
+ foreignKeyName: 'fk_user';
3669
+ columns: ['user_id'];
3716
3670
  isOneToOne: false;
3717
- referencedRelation: "users";
3718
- referencedColumns: ["id"];
3671
+ referencedRelation: 'users';
3672
+ referencedColumns: ['id'];
3719
3673
  }
3720
3674
  ];
3721
3675
  };
@@ -3791,11 +3745,11 @@ type Database = {
3791
3745
  };
3792
3746
  Relationships: [
3793
3747
  {
3794
- foreignKeyName: "task_schedules_organization_id_fkey";
3795
- columns: ["organization_id"];
3748
+ foreignKeyName: 'task_schedules_organization_id_fkey';
3749
+ columns: ['organization_id'];
3796
3750
  isOneToOne: false;
3797
- referencedRelation: "organizations";
3798
- referencedColumns: ["id"];
3751
+ referencedRelation: 'organizations';
3752
+ referencedColumns: ['id'];
3799
3753
  }
3800
3754
  ];
3801
3755
  };
@@ -3850,11 +3804,11 @@ type Database = {
3850
3804
  };
3851
3805
  Relationships: [
3852
3806
  {
3853
- foreignKeyName: "user_profiles_last_visited_org_fkey";
3854
- columns: ["last_visited_org"];
3807
+ foreignKeyName: 'user_profiles_last_visited_org_fkey';
3808
+ columns: ['last_visited_org'];
3855
3809
  isOneToOne: false;
3856
- referencedRelation: "organizations";
3857
- referencedColumns: ["id"];
3810
+ referencedRelation: 'organizations';
3811
+ referencedColumns: ['id'];
3858
3812
  }
3859
3813
  ];
3860
3814
  };
@@ -3903,11 +3857,11 @@ type Database = {
3903
3857
  };
3904
3858
  Relationships: [
3905
3859
  {
3906
- foreignKeyName: "webhook_endpoints_organization_id_fkey";
3907
- columns: ["organization_id"];
3860
+ foreignKeyName: 'webhook_endpoints_organization_id_fkey';
3861
+ columns: ['organization_id'];
3908
3862
  isOneToOne: false;
3909
- referencedRelation: "organizations";
3910
- referencedColumns: ["id"];
3863
+ referencedRelation: 'organizations';
3864
+ referencedColumns: ['id'];
3911
3865
  }
3912
3866
  ];
3913
3867
  };
@@ -4167,35 +4121,49 @@ interface ContactEnrichmentData {
4167
4121
  }>;
4168
4122
  };
4169
4123
  }
4170
- /**
4171
- * Acquisition list for organizing contacts and companies.
4172
- * Transformed from AcqListRow with camelCase properties.
4173
- *
4174
- * Track B: acq_lists adopts the Stateful trait (pipeline_key / stage_key / state_key / activity_log).
4175
- * `status` is preserved as a convenience alias for `state_key` so existing consumers continue to
4176
- * compile until they are migrated to read the trait fields directly.
4177
- */
4124
+ type ListStatus = 'draft' | 'enriching' | 'launched' | 'closing' | 'archived';
4125
+ interface ScrapingConfig {
4126
+ source?: string;
4127
+ query?: string;
4128
+ filters?: Record<string, unknown>;
4129
+ [key: string]: unknown;
4130
+ }
4131
+ interface IcpRubric {
4132
+ targetDescription?: string;
4133
+ minReviewCount?: number;
4134
+ minRating?: number;
4135
+ excludeFranchises?: boolean;
4136
+ customRules?: string;
4137
+ qualificationRubricKey?: string | null;
4138
+ [key: string]: unknown;
4139
+ }
4140
+ interface PipelineStage {
4141
+ key: string;
4142
+ label?: string;
4143
+ description?: string;
4144
+ resourceId?: string;
4145
+ inputTemplate?: Record<string, unknown>;
4146
+ enabled?: boolean;
4147
+ order?: number;
4148
+ }
4149
+ interface PipelineConfig {
4150
+ stages: PipelineStage[];
4151
+ }
4178
4152
  interface AcqList {
4179
4153
  id: string;
4180
4154
  organizationId: string;
4181
4155
  name: string;
4182
4156
  description: string | null;
4183
- type: string;
4184
4157
  batchIds: string[];
4185
4158
  instantlyCampaignId: string | null;
4186
- /** @deprecated Use state_key. Retained as alias mapped from state_key for backward-compatibility. */
4187
- status: string;
4188
- /** Stateful trait: pipeline identifier (always 'lead-gen' for acq_lists). Added by W2 migration. */
4189
- pipelineKey: string;
4190
- /** Stateful trait: stage within the pipeline (always 'lifecycle' for acq_lists). Added by W2 migration. */
4191
- stageKey: string;
4192
- /** Stateful trait: lifecycle state (draft | enriching | launched | closing | archived). Added by W2 migration. */
4193
- stateKey: string;
4159
+ status: ListStatus;
4160
+ scrapingConfig: ScrapingConfig;
4161
+ icp: IcpRubric;
4162
+ pipelineConfig: PipelineConfig;
4194
4163
  metadata: Record<string, unknown>;
4195
4164
  launchedAt: Date | null;
4196
4165
  completedAt: Date | null;
4197
4166
  createdAt: Date;
4198
- config: ListConfig;
4199
4167
  }
4200
4168
  /**
4201
4169
  * Company record in the acquisition database.
@@ -4307,678 +4275,6 @@ interface AcqDealTask {
4307
4275
  updatedAt: string;
4308
4276
  createdByUserId: string | null;
4309
4277
  }
4310
- /**
4311
- * One ordered step in a list's pipeline. Maps to a deployed workflow
4312
- * (e.g. 'lgn-03-company-qualification-workflow'). The `inputTemplate`
4313
- * is merged with `{ listId }` at run time to form the workflow input.
4314
- */
4315
- interface PipelineStep {
4316
- /** Stable key, e.g. 'scrape' | 'extract' | 'qualify' | 'discover' | 'verify' | 'personalize'. */
4317
- key: string;
4318
- /** Human label rendered in the UI stepper. */
4319
- label: string;
4320
- /** Deployed workflow resourceId (e.g. 'lgn-03-company-qualification-workflow'). */
4321
- resourceId: string;
4322
- /** Input defaults merged with `{ listId }` at dispatch. */
4323
- inputTemplate: Record<string, unknown>;
4324
- /** Whether the UI shows the Run button. */
4325
- enabled: boolean;
4326
- /** Display order (ascending). */
4327
- order: number;
4328
- }
4329
- type CompanyListStage = 'populated' | 'extracted' | 'qualified';
4330
- type ContactListStage = 'discovered' | 'verified' | 'personalized' | 'uploaded';
4331
- /**
4332
- * Per-list pipeline configuration stored as jsonb in `acq_lists.config`.
4333
- *
4334
- * `qualification` is the only required subtree. Every other subtree is optional
4335
- * and inherits global defaults when omitted: workflows resolve values as
4336
- * `list.config.foo ?? globalDefaults.foo`. Seeded rows from
4337
- * `20260413000100_backfill_list_configs.sql` only populate `qualification`
4338
- * and `scraping`; the rest was intentionally omitted.
4339
- */
4340
- interface ListConfig {
4341
- qualification: {
4342
- /** One-line description of the target vertical/segment. */
4343
- targetDescription: string;
4344
- /** Minimum Google review count to qualify. */
4345
- minReviewCount: number;
4346
- /** Minimum Google star rating to qualify (e.g. 3.0). */
4347
- minRating: number;
4348
- /** Whether to exclude franchises/chains during qualification. */
4349
- excludeFranchises: boolean;
4350
- /** Free-form LLM rules layered on top of the structured criteria. */
4351
- customRules: string;
4352
- /**
4353
- * Free-form text key identifying the ICP qualification rubric applied to this list.
4354
- * Decision C4: stays as free-form text until an Org OS rubric registry lands.
4355
- */
4356
- qualificationRubricKey?: string | null;
4357
- };
4358
- enrichment?: {
4359
- emailDiscovery?: {
4360
- primary: 'tomba' | 'anymailfinder';
4361
- credentialName?: string;
4362
- };
4363
- emailVerification?: {
4364
- provider: 'millionverifier';
4365
- threshold?: 'ok' | 'ok+catch_all';
4366
- };
4367
- };
4368
- personalization?: {
4369
- industryContext?: string;
4370
- /** Email body template with tags like {{opening_line}} / {{category_pain}}. */
4371
- emailBody?: string;
4372
- creativeDirection?: string;
4373
- /** Contradiction-prevention rules layered into the personalization prompt. */
4374
- exclusionRules?: string[];
4375
- };
4376
- pipeline?: {
4377
- steps: PipelineStep[];
4378
- };
4379
- }
4380
-
4381
- /**
4382
- * Lead Service Types
4383
- * CRUD operation types for the acquisition platform (lists, companies, contacts, deals)
4384
- *
4385
- * Implementation: apps/api/src/acquisition/lead-service.ts (LeadService class)
4386
- */
4387
-
4388
- interface PaginatedResult<T> {
4389
- data: T[];
4390
- total: number;
4391
- limit: number;
4392
- offset: number;
4393
- }
4394
- interface CreateListParams {
4395
- organizationId: string;
4396
- name: string;
4397
- description?: string;
4398
- type?: string;
4399
- batchIds?: string[];
4400
- instantlyCampaignId?: string;
4401
- status?: string;
4402
- metadata?: Record<string, unknown>;
4403
- config?: ListConfig;
4404
- }
4405
- interface UpdateListParams {
4406
- name?: string;
4407
- description?: string;
4408
- status?: string;
4409
- batchIds?: string[];
4410
- }
4411
- interface CreateCompanyParams {
4412
- organizationId: string;
4413
- name: string;
4414
- domain?: string;
4415
- linkedinUrl?: string;
4416
- website?: string;
4417
- numEmployees?: number;
4418
- foundedYear?: number;
4419
- locationCity?: string;
4420
- locationState?: string;
4421
- category?: string;
4422
- source?: string;
4423
- batchId?: string;
4424
- verticalResearch?: string;
4425
- }
4426
- interface UpdateCompanyParams {
4427
- name?: string;
4428
- domain?: string;
4429
- linkedinUrl?: string;
4430
- website?: string;
4431
- numEmployees?: number;
4432
- foundedYear?: number;
4433
- locationCity?: string;
4434
- locationState?: string;
4435
- category?: string;
4436
- segment?: string;
4437
- pipelineStatus?: Record<string, unknown>;
4438
- enrichmentData?: Record<string, unknown>;
4439
- source?: string;
4440
- batchId?: string;
4441
- status?: 'active' | 'invalid';
4442
- verticalResearch?: string | null;
4443
- /** Track A: flat qualification score column (null until a scoring rubric is defined) */
4444
- qualificationScore?: number | null;
4445
- /** Track A: flat qualification signals jsonb — mirrors the former pipeline_status.qualification shape */
4446
- qualificationSignals?: Record<string, unknown> | null;
4447
- /** Track A: key identifying the rubric used for qualification */
4448
- qualificationRubricKey?: string | null;
4449
- }
4450
- type UpsertCompanyParams = CreateCompanyParams;
4451
- interface CompanyFilters {
4452
- listId?: string;
4453
- search?: string;
4454
- domain?: string;
4455
- website?: string;
4456
- segment?: string;
4457
- category?: string;
4458
- pipelineStatus?: Record<string, unknown>;
4459
- /** Exclude companies whose pipeline_status contains this value (PostgREST NOT contains) */
4460
- pipelineStatusNot?: Record<string, unknown>;
4461
- batchId?: string;
4462
- status?: 'active' | 'invalid';
4463
- includeAll?: boolean;
4464
- excludeColumns?: Array<'enrichmentData' | 'pipelineStatus'>;
4465
- }
4466
- interface CreateContactParams {
4467
- organizationId: string;
4468
- email: string;
4469
- companyId?: string;
4470
- firstName?: string;
4471
- lastName?: string;
4472
- linkedinUrl?: string;
4473
- title?: string;
4474
- source?: string;
4475
- sourceId?: string;
4476
- batchId?: string;
4477
- }
4478
- interface UpdateContactParams {
4479
- companyId?: string;
4480
- emailValid?: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN';
4481
- firstName?: string;
4482
- lastName?: string;
4483
- linkedinUrl?: string;
4484
- title?: string;
4485
- headline?: string;
4486
- filterReason?: string;
4487
- openingLine?: string;
4488
- pipelineStatus?: Record<string, unknown>;
4489
- enrichmentData?: Record<string, unknown>;
4490
- status?: 'active' | 'invalid';
4491
- }
4492
- type UpsertContactParams = CreateContactParams;
4493
- interface ContactFilters {
4494
- listId?: string;
4495
- search?: string;
4496
- openingLineIsNull?: boolean;
4497
- pipelineStatus?: Record<string, unknown>;
4498
- batchId?: string;
4499
- contactStatus?: 'active' | 'invalid';
4500
- }
4501
- interface UpsertDealParams {
4502
- organizationId: string;
4503
- /** Contact email — dedupe key together with organization_id */
4504
- contactEmail: string;
4505
- /** Optional contact ID for foreign key join */
4506
- contactId?: string;
4507
- /** Campaign list that generated this deal (FK to acq_lists) */
4508
- sourceListId?: string;
4509
- /** Deal origin: 'instantly', 'referral', 'inbound', 'manual' */
4510
- sourceType?: 'instantly' | 'referral' | 'inbound' | 'manual';
4511
- /** Optional discovery data JSONB to set on upsert */
4512
- discoveryData?: unknown;
4513
- /** Optional proposal data JSONB to set on upsert */
4514
- proposalData?: unknown;
4515
- }
4516
- interface UpdateDiscoveryDataParams {
4517
- organizationId: string;
4518
- contactEmail: string;
4519
- discoveryData: unknown;
4520
- submittedBy?: string;
4521
- }
4522
- interface UpdateProposalDataParams {
4523
- organizationId: string;
4524
- contactEmail: string;
4525
- proposalData: unknown;
4526
- proposalPdfUrl?: string;
4527
- }
4528
- interface MarkProposalSentParams {
4529
- organizationId: string;
4530
- contactEmail: string;
4531
- }
4532
- interface MarkProposalReviewedParams {
4533
- organizationId: string;
4534
- contactEmail: string;
4535
- reviewedBy: string;
4536
- proposalData?: unknown;
4537
- }
4538
- interface UpdateCloseLostReasonParams {
4539
- organizationId: string;
4540
- dealId: string;
4541
- reason: string;
4542
- }
4543
- interface UpdateFeesParams {
4544
- organizationId: string;
4545
- contactEmail?: string;
4546
- dealId?: string;
4547
- initialFee?: number;
4548
- monthlyFee?: number;
4549
- }
4550
- interface TransitionItemParams {
4551
- organizationId: string;
4552
- dealId: string;
4553
- pipelineKey: string;
4554
- stageKey: string;
4555
- stateKey?: string | null;
4556
- reason?: string;
4557
- expectedUpdatedAt?: string;
4558
- }
4559
- interface SetContactNurtureParams {
4560
- organizationId: string;
4561
- contactEmail: string;
4562
- nurture?: boolean;
4563
- }
4564
- interface CancelSchedulesAndHitlByEmailParams {
4565
- organizationId: string;
4566
- email: string;
4567
- }
4568
- interface CancelHitlByDealIdParams {
4569
- organizationId: string;
4570
- dealId: string;
4571
- }
4572
- interface ClearDealFieldsParams {
4573
- organizationId: string;
4574
- contactEmail?: string;
4575
- dealId?: string;
4576
- fields: ('proposalPdfUrl' | 'proposalGeneratedAt' | 'initialFee' | 'monthlyFee' | 'closedLostReason' | 'closedLostAt' | 'discoveryData' | 'discoverySubmittedAt')[];
4577
- }
4578
- interface DeleteDealParams {
4579
- organizationId: string;
4580
- dealId: string;
4581
- }
4582
- interface GetDealByIdParams {
4583
- dealId: string;
4584
- organizationId: string;
4585
- }
4586
- interface GetContactByIdParams {
4587
- contactId: string;
4588
- organizationId: string;
4589
- }
4590
- interface GetCompanyByIdParams {
4591
- companyId: string;
4592
- organizationId: string;
4593
- }
4594
- interface UpsertSocialPostParams {
4595
- organizationId: string;
4596
- platform: string;
4597
- platformPostId: string;
4598
- authorName: string;
4599
- authorUrl?: string | null;
4600
- postTitle: string;
4601
- postText: string;
4602
- postUrl: string;
4603
- engagementCount?: number;
4604
- commentsCount?: number;
4605
- postedAt: string;
4606
- metadata?: Record<string, unknown>;
4607
- relevanceScore?: number;
4608
- matchedKeywords?: string[];
4609
- matchedQuery?: string | null;
4610
- initialDraft?: string | null;
4611
- finalResponse?: string | null;
4612
- sourceCategory?: string | null;
4613
- }
4614
- interface UpsertSocialPostsResult {
4615
- inserted: number;
4616
- duplicatesSkipped: number;
4617
- }
4618
- interface AcqDeal {
4619
- id: string;
4620
- organizationId: string;
4621
- contactEmail: string;
4622
- pipelineKey: string;
4623
- stageKey?: string | null;
4624
- stateKey?: string | null;
4625
- discoveryData?: Json | null;
4626
- proposalData?: Json | null;
4627
- proposalSentAt?: string | null;
4628
- proposalPdfUrl?: string | null;
4629
- signatureEnvelopeId?: string | null;
4630
- sourceListId?: string | null;
4631
- sourceType?: string | null;
4632
- activityLog: DealActivityEntry[];
4633
- createdAt: Date;
4634
- updatedAt: Date;
4635
- }
4636
- interface DealActivityEntry {
4637
- type: string;
4638
- title: string;
4639
- description?: string;
4640
- payload?: Record<string, unknown>;
4641
- occurredAt: string;
4642
- }
4643
- interface AcqDealNote {
4644
- id: string;
4645
- dealId: string;
4646
- organizationId: string;
4647
- authorUserId: string | null;
4648
- body: string;
4649
- createdAt: string;
4650
- updatedAt: string;
4651
- }
4652
- interface CreateDealNoteParams {
4653
- organizationId: string;
4654
- dealId: string;
4655
- body: string;
4656
- authorUserId?: string;
4657
- }
4658
- interface ListDealNotesParams {
4659
- organizationId: string;
4660
- dealId: string;
4661
- }
4662
- interface CreateDealTaskParams {
4663
- organizationId: string;
4664
- dealId: string;
4665
- title: string;
4666
- description?: string | null;
4667
- kind?: AcqDealTaskKind;
4668
- dueAt?: string | null;
4669
- assigneeUserId?: string | null;
4670
- createdByUserId?: string | null;
4671
- }
4672
- interface ListDealTasksParams {
4673
- organizationId: string;
4674
- dealId: string;
4675
- }
4676
- interface ListDealTasksDueParams {
4677
- organizationId: string;
4678
- assigneeUserId?: string | null;
4679
- /** Window filter: 'overdue' = past due, 'today' = due today only, 'today_and_overdue' (default) = both, 'upcoming' = future */
4680
- window?: 'overdue' | 'today' | 'today_and_overdue' | 'upcoming';
4681
- }
4682
- interface CompleteDealTaskParams {
4683
- organizationId: string;
4684
- taskId: string;
4685
- completedByUserId: string | null;
4686
- }
4687
- interface RecordDealActivityParams {
4688
- organizationId: string;
4689
- dealId: string;
4690
- type: string;
4691
- title: string;
4692
- description?: string;
4693
- payload?: Record<string, unknown>;
4694
- }
4695
- interface DealStageSummary {
4696
- stage: string;
4697
- count: number;
4698
- oldestUpdatedAt: string | null;
4699
- newestUpdatedAt: string | null;
4700
- }
4701
- interface StaleDeal {
4702
- id: string;
4703
- contactEmail: string;
4704
- stageKey: string;
4705
- updatedAt: string;
4706
- daysStale: number;
4707
- }
4708
- interface DealPipelineAnalytics {
4709
- totalDeals: number;
4710
- stageSummary: DealStageSummary[];
4711
- staleDeals: StaleDeal[];
4712
- recentActivity: AcqDeal[];
4713
- }
4714
- interface DealFilters {
4715
- stage?: string;
4716
- search?: string;
4717
- limit?: number;
4718
- offset?: number;
4719
- }
4720
- interface AddContactsToListParams {
4721
- organizationId: string;
4722
- listId: string;
4723
- contactIds: string[];
4724
- }
4725
- interface AddContactsToListResult {
4726
- added: number;
4727
- alreadyExisted: number;
4728
- }
4729
- interface UpdateCompanyStageParams {
4730
- organizationId: string;
4731
- listId: string;
4732
- companyId: string;
4733
- stage: CompanyListStage;
4734
- executionId?: string;
4735
- }
4736
- interface UpdateContactStageParams {
4737
- organizationId: string;
4738
- listId: string;
4739
- contactId: string;
4740
- stage: ContactListStage;
4741
- executionId?: string;
4742
- }
4743
- interface RecordListExecutionParams {
4744
- organizationId: string;
4745
- listId: string;
4746
- executionId: string;
4747
- configSnapshot?: Record<string, unknown>;
4748
- }
4749
- interface BulkImportParams {
4750
- organizationId: string;
4751
- contacts: CreateContactParams[];
4752
- listId?: string;
4753
- }
4754
- interface BulkImportResult {
4755
- created: number;
4756
- updated: number;
4757
- errors: Array<{
4758
- email: string;
4759
- error: string;
4760
- }>;
4761
- }
4762
- interface BulkImportCompanyEntry {
4763
- name: string;
4764
- domain: string;
4765
- website?: string;
4766
- locationCity?: string;
4767
- locationState?: string;
4768
- category?: string;
4769
- source?: string;
4770
- enrichmentData?: Record<string, unknown>;
4771
- pipelineStatus?: Record<string, unknown>;
4772
- }
4773
- interface BulkImportCompaniesParams {
4774
- organizationId: string;
4775
- batchId: string;
4776
- companies: BulkImportCompanyEntry[];
4777
- }
4778
- interface BulkImportCompaniesResult {
4779
- created: number;
4780
- skipped: number;
4781
- errors: Array<{
4782
- companyName: string;
4783
- error: string;
4784
- }>;
4785
- }
4786
-
4787
- /**
4788
- * Origin resource type - where an execution/task originated from.
4789
- * Used for audit trails and tracking execution lineage.
4790
- */
4791
- type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
4792
-
4793
- /**
4794
- * Target for schedule execution - identifies what resource to execute.
4795
- * Unlike ExecutionTarget, payload is NOT included here because schedules
4796
- * store payload in the scheduleConfig (varies per step/item).
4797
- */
4798
- interface ScheduleTarget {
4799
- resourceType: 'agent' | 'workflow';
4800
- resourceId: string;
4801
- }
4802
- /**
4803
- * Optional origin tracking for schedules.
4804
- * Unlike OriginTracking (which is required), these fields are all optional
4805
- * for schedules created directly via API (not triggered by another resource).
4806
- */
4807
- interface ScheduleOriginTracking {
4808
- originExecutionId?: string;
4809
- originResourceType?: OriginResourceType;
4810
- originResourceId?: string;
4811
- }
4812
- type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
4813
- interface RecurringScheduleConfig {
4814
- type: 'recurring';
4815
- cron?: string;
4816
- interval?: 'daily' | 'weekly' | 'monthly';
4817
- time?: string;
4818
- timezone: string;
4819
- payload: Record<string, unknown>;
4820
- endAt?: string | null;
4821
- overduePolicy?: 'skip' | 'execute';
4822
- }
4823
- interface RelativeScheduleConfig {
4824
- type: 'relative';
4825
- anchorAt: string;
4826
- anchorLabel?: string;
4827
- items: RelativeScheduleItem[];
4828
- overduePolicy?: 'skip' | 'execute';
4829
- }
4830
- interface RelativeScheduleItem {
4831
- offset: string;
4832
- payload: Record<string, unknown>;
4833
- label?: string;
4834
- }
4835
- interface AbsoluteScheduleConfig {
4836
- type: 'absolute';
4837
- items: AbsoluteScheduleItem[];
4838
- overduePolicy?: 'skip' | 'execute';
4839
- }
4840
- interface AbsoluteScheduleItem {
4841
- runAt: string;
4842
- payload: Record<string, unknown>;
4843
- label?: string;
4844
- }
4845
- interface TaskSchedule extends ScheduleOriginTracking {
4846
- id: string;
4847
- organizationId: string;
4848
- name: string;
4849
- description?: string;
4850
- target: ScheduleTarget;
4851
- scheduleConfig: TaskScheduleConfig;
4852
- nextRunAt?: Date;
4853
- currentStep: number;
4854
- status: 'active' | 'paused' | 'completed' | 'cancelled';
4855
- lastRunAt?: Date;
4856
- lastExecutionId?: string;
4857
- maxRetries: number;
4858
- idempotencyKey?: string;
4859
- createdAt: Date;
4860
- updatedAt: Date;
4861
- }
4862
- interface CreateScheduleInput extends ScheduleOriginTracking {
4863
- organizationId: string;
4864
- name: string;
4865
- description?: string;
4866
- target: ScheduleTarget;
4867
- scheduleConfig: TaskScheduleConfig;
4868
- maxRetries?: number;
4869
- idempotencyKey?: string;
4870
- metadata?: Record<string, unknown>;
4871
- }
4872
-
4873
- type NotificationRow = Database['public']['Tables']['notifications']['Row'];
4874
- interface CreateNotificationParams {
4875
- userId: string;
4876
- organizationId: string;
4877
- category: NotificationRow['category'];
4878
- title: string;
4879
- message: string;
4880
- actionUrl?: string;
4881
- }
4882
-
4883
- type ProjectRow = Database['public']['Tables']['prj_projects']['Row'];
4884
- type MilestoneRow = Database['public']['Tables']['prj_milestones']['Row'];
4885
- type TaskRow = Database['public']['Tables']['prj_tasks']['Row'];
4886
- type NoteRow = Database['public']['Tables']['prj_notes']['Row'];
4887
- interface ProjectWithCounts extends ProjectRow {
4888
- milestoneCount: number;
4889
- taskCount: number;
4890
- completedMilestones?: number;
4891
- completedTasks?: number;
4892
- }
4893
- interface ProjectDetail extends ProjectRow {
4894
- milestones: MilestoneRow[];
4895
- tasks: TaskRow[];
4896
- company: {
4897
- id: string;
4898
- name: string;
4899
- domain: string | null;
4900
- } | null;
4901
- }
4902
-
4903
- declare const ActivityEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4904
- type: z.ZodLiteral<"stage_change">;
4905
- timestamp: z.ZodString;
4906
- stageBefore: z.ZodString;
4907
- stageAfter: z.ZodString;
4908
- reason: z.ZodOptional<z.ZodString>;
4909
- }, z.core.$strip>, z.ZodObject<{
4910
- type: z.ZodLiteral<"state_change">;
4911
- timestamp: z.ZodString;
4912
- stateBefore: z.ZodNullable<z.ZodString>;
4913
- stateAfter: z.ZodNullable<z.ZodString>;
4914
- reason: z.ZodOptional<z.ZodString>;
4915
- }, z.core.$strip>, z.ZodObject<{
4916
- type: z.ZodLiteral<"action_taken">;
4917
- timestamp: z.ZodString;
4918
- actionKey: z.ZodString;
4919
- payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4920
- }, z.core.$strip>, z.ZodObject<{
4921
- type: z.ZodLiteral<"approval_created">;
4922
- timestamp: z.ZodString;
4923
- commandId: z.ZodString;
4924
- dealStageBefore: z.ZodOptional<z.ZodString>;
4925
- dealStageAfter: z.ZodOptional<z.ZodString>;
4926
- }, z.core.$strip>, z.ZodObject<{
4927
- type: z.ZodLiteral<"approval_resolved">;
4928
- timestamp: z.ZodString;
4929
- commandId: z.ZodString;
4930
- resolution: z.ZodEnum<{
4931
- superseded: "superseded";
4932
- }>;
4933
- originResourceType: z.ZodOptional<z.ZodString>;
4934
- }, z.core.$strip>, z.ZodObject<{
4935
- type: z.ZodLiteral<"approval_stale">;
4936
- timestamp: z.ZodString;
4937
- commandId: z.ZodString;
4938
- dealStageBefore: z.ZodOptional<z.ZodString>;
4939
- dealStageAfter: z.ZodOptional<z.ZodString>;
4940
- }, z.core.$strip>, z.ZodObject<{
4941
- type: z.ZodLiteral<"task_created">;
4942
- timestamp: z.ZodString;
4943
- taskId: z.ZodString;
4944
- }, z.core.$strip>, z.ZodObject<{
4945
- type: z.ZodLiteral<"deal_created">;
4946
- timestamp: z.ZodString;
4947
- }, z.core.$strip>], "type">;
4948
- type ActivityEvent = z.infer<typeof ActivityEventSchema>;
4949
-
4950
- interface Action {
4951
- key: string;
4952
- label: string;
4953
- payloadSchema?: z.ZodTypeAny;
4954
- }
4955
- interface ActionDef {
4956
- key: string;
4957
- label: string;
4958
- isAvailableFor: (deal: AcqDealRow) => boolean;
4959
- workflowId: string;
4960
- payloadSchema?: z.ZodTypeAny;
4961
- }
4962
- declare const DEFAULT_CRM_ACTIONS: ActionDef[];
4963
- declare function deriveActions(deal: AcqDealRow, actions?: ActionDef[]): Action[];
4964
-
4965
- /**
4966
- * Canonical vocabulary for `acq_touchpoints.kind`.
4967
- * DB CHECK constraint was dropped (Decision #9); validation lives here.
4968
- * Subtype/intent detail (e.g. triggered_by_action, subtype) goes in the touchpoint `payload` JSONB.
4969
- */
4970
-
4971
- declare const TouchpointKindSchema: z.ZodEnum<{
4972
- initial: "initial";
4973
- followup: "followup";
4974
- reply: "reply";
4975
- nudge: "nudge";
4976
- reminder: "reminder";
4977
- breakup: "breakup";
4978
- bounce: "bounce";
4979
- auto_reply: "auto_reply";
4980
- }>;
4981
- type TouchpointKind = z.infer<typeof TouchpointKindSchema>;
4982
4278
 
4983
4279
  declare const DealSchemas: {
4984
4280
  DealIdParams: z.ZodObject<{
@@ -5232,6 +4528,591 @@ declare const DealSchemas: {
5232
4528
  }, z.core.$strip>>;
5233
4529
  };
5234
4530
 
4531
+ /**
4532
+ * Lead Service Types
4533
+ * CRUD operation types for the acquisition platform (lists, companies, contacts, deals)
4534
+ *
4535
+ * Implementation: apps/api/src/acquisition/lead-service.ts (LeadService class)
4536
+ */
4537
+
4538
+ interface PaginatedResult<T> {
4539
+ data: T[];
4540
+ total: number;
4541
+ limit: number;
4542
+ offset: number;
4543
+ }
4544
+ interface CreateListParams {
4545
+ organizationId: string;
4546
+ name: string;
4547
+ description?: string;
4548
+ type?: string;
4549
+ batchIds?: string[];
4550
+ instantlyCampaignId?: string;
4551
+ status?: ListStatus;
4552
+ metadata?: Record<string, unknown>;
4553
+ scrapingConfig?: ScrapingConfig;
4554
+ icp?: IcpRubric;
4555
+ pipelineConfig?: PipelineConfig;
4556
+ }
4557
+ interface UpdateListParams {
4558
+ name?: string;
4559
+ description?: string;
4560
+ batchIds?: string[];
4561
+ }
4562
+ interface CreateCompanyParams {
4563
+ organizationId: string;
4564
+ name: string;
4565
+ domain?: string;
4566
+ linkedinUrl?: string;
4567
+ website?: string;
4568
+ numEmployees?: number;
4569
+ foundedYear?: number;
4570
+ locationCity?: string;
4571
+ locationState?: string;
4572
+ category?: string;
4573
+ source?: string;
4574
+ batchId?: string;
4575
+ verticalResearch?: string;
4576
+ }
4577
+ interface UpdateCompanyParams {
4578
+ name?: string;
4579
+ domain?: string;
4580
+ linkedinUrl?: string;
4581
+ website?: string;
4582
+ numEmployees?: number;
4583
+ foundedYear?: number;
4584
+ locationCity?: string;
4585
+ locationState?: string;
4586
+ category?: string;
4587
+ segment?: string;
4588
+ pipelineStatus?: Record<string, unknown>;
4589
+ enrichmentData?: Record<string, unknown>;
4590
+ source?: string;
4591
+ batchId?: string;
4592
+ status?: 'active' | 'invalid';
4593
+ verticalResearch?: string | null;
4594
+ /** Track A: flat qualification score column (null until a scoring rubric is defined) */
4595
+ qualificationScore?: number | null;
4596
+ /** Track A: flat qualification signals jsonb — mirrors the former pipeline_status.qualification shape */
4597
+ qualificationSignals?: Record<string, unknown> | null;
4598
+ /** Track A: key identifying the rubric used for qualification */
4599
+ qualificationRubricKey?: string | null;
4600
+ }
4601
+ type UpsertCompanyParams = CreateCompanyParams;
4602
+ interface CompanyFilters {
4603
+ listId?: string;
4604
+ search?: string;
4605
+ domain?: string;
4606
+ website?: string;
4607
+ segment?: string;
4608
+ category?: string;
4609
+ pipelineStatus?: Record<string, unknown>;
4610
+ /** Exclude companies whose pipeline_status contains this value (PostgREST NOT contains) */
4611
+ pipelineStatusNot?: Record<string, unknown>;
4612
+ batchId?: string;
4613
+ status?: 'active' | 'invalid';
4614
+ includeAll?: boolean;
4615
+ excludeColumns?: Array<'enrichmentData' | 'pipelineStatus'>;
4616
+ }
4617
+ interface CreateContactParams {
4618
+ organizationId: string;
4619
+ email: string;
4620
+ companyId?: string;
4621
+ firstName?: string;
4622
+ lastName?: string;
4623
+ linkedinUrl?: string;
4624
+ title?: string;
4625
+ source?: string;
4626
+ sourceId?: string;
4627
+ batchId?: string;
4628
+ }
4629
+ interface UpdateContactParams {
4630
+ companyId?: string;
4631
+ emailValid?: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN';
4632
+ firstName?: string;
4633
+ lastName?: string;
4634
+ linkedinUrl?: string;
4635
+ title?: string;
4636
+ headline?: string;
4637
+ filterReason?: string;
4638
+ openingLine?: string;
4639
+ pipelineStatus?: Record<string, unknown>;
4640
+ enrichmentData?: Record<string, unknown>;
4641
+ status?: 'active' | 'invalid';
4642
+ }
4643
+ type UpsertContactParams = CreateContactParams;
4644
+ interface ContactFilters {
4645
+ listId?: string;
4646
+ search?: string;
4647
+ openingLineIsNull?: boolean;
4648
+ pipelineStatus?: Record<string, unknown>;
4649
+ batchId?: string;
4650
+ contactStatus?: 'active' | 'invalid';
4651
+ }
4652
+ interface UpsertDealParams {
4653
+ organizationId: string;
4654
+ /** Contact email — dedupe key together with organization_id */
4655
+ contactEmail: string;
4656
+ /** Optional contact ID for foreign key join */
4657
+ contactId?: string;
4658
+ /** Campaign list that generated this deal (FK to acq_lists) */
4659
+ sourceListId?: string;
4660
+ /** Deal origin: 'instantly', 'referral', 'inbound', 'manual' */
4661
+ sourceType?: 'instantly' | 'referral' | 'inbound' | 'manual';
4662
+ /** Optional discovery data JSONB to set on upsert */
4663
+ discoveryData?: unknown;
4664
+ /** Optional proposal data JSONB to set on upsert */
4665
+ proposalData?: unknown;
4666
+ }
4667
+ interface UpdateDiscoveryDataParams {
4668
+ organizationId: string;
4669
+ contactEmail: string;
4670
+ discoveryData: unknown;
4671
+ submittedBy?: string;
4672
+ }
4673
+ interface UpdateProposalDataParams {
4674
+ organizationId: string;
4675
+ contactEmail: string;
4676
+ proposalData: unknown;
4677
+ proposalPdfUrl?: string;
4678
+ }
4679
+ interface MarkProposalSentParams {
4680
+ organizationId: string;
4681
+ contactEmail: string;
4682
+ }
4683
+ interface MarkProposalReviewedParams {
4684
+ organizationId: string;
4685
+ contactEmail: string;
4686
+ reviewedBy: string;
4687
+ proposalData?: unknown;
4688
+ }
4689
+ interface UpdateCloseLostReasonParams {
4690
+ organizationId: string;
4691
+ dealId: string;
4692
+ reason: string;
4693
+ }
4694
+ interface UpdateFeesParams {
4695
+ organizationId: string;
4696
+ contactEmail?: string;
4697
+ dealId?: string;
4698
+ initialFee?: number;
4699
+ monthlyFee?: number;
4700
+ }
4701
+ interface TransitionItemParams {
4702
+ organizationId: string;
4703
+ dealId: string;
4704
+ pipelineKey: string;
4705
+ stageKey: string;
4706
+ stateKey?: string | null;
4707
+ reason?: string;
4708
+ expectedUpdatedAt?: string;
4709
+ }
4710
+ interface SetContactNurtureParams {
4711
+ organizationId: string;
4712
+ contactEmail: string;
4713
+ nurture?: boolean;
4714
+ }
4715
+ interface CancelSchedulesAndHitlByEmailParams {
4716
+ organizationId: string;
4717
+ email: string;
4718
+ }
4719
+ interface CancelHitlByDealIdParams {
4720
+ organizationId: string;
4721
+ dealId: string;
4722
+ }
4723
+ interface ClearDealFieldsParams {
4724
+ organizationId: string;
4725
+ contactEmail?: string;
4726
+ dealId?: string;
4727
+ fields: ('proposalPdfUrl' | 'proposalGeneratedAt' | 'initialFee' | 'monthlyFee' | 'closedLostReason' | 'closedLostAt' | 'discoveryData' | 'discoverySubmittedAt')[];
4728
+ }
4729
+ interface DeleteDealParams {
4730
+ organizationId: string;
4731
+ dealId: string;
4732
+ }
4733
+ interface GetDealByIdParams {
4734
+ dealId: string;
4735
+ organizationId: string;
4736
+ }
4737
+ interface GetContactByIdParams {
4738
+ contactId: string;
4739
+ organizationId: string;
4740
+ }
4741
+ interface GetCompanyByIdParams {
4742
+ companyId: string;
4743
+ organizationId: string;
4744
+ }
4745
+ interface UpsertSocialPostParams {
4746
+ organizationId: string;
4747
+ platform: string;
4748
+ platformPostId: string;
4749
+ authorName: string;
4750
+ authorUrl?: string | null;
4751
+ postTitle: string;
4752
+ postText: string;
4753
+ postUrl: string;
4754
+ engagementCount?: number;
4755
+ commentsCount?: number;
4756
+ postedAt: string;
4757
+ metadata?: Record<string, unknown>;
4758
+ relevanceScore?: number;
4759
+ matchedKeywords?: string[];
4760
+ matchedQuery?: string | null;
4761
+ initialDraft?: string | null;
4762
+ finalResponse?: string | null;
4763
+ sourceCategory?: string | null;
4764
+ }
4765
+ interface UpsertSocialPostsResult {
4766
+ inserted: number;
4767
+ duplicatesSkipped: number;
4768
+ }
4769
+ interface AcqDeal {
4770
+ id: string;
4771
+ organizationId: string;
4772
+ contactEmail: string;
4773
+ pipelineKey: string;
4774
+ stageKey?: string | null;
4775
+ stateKey?: string | null;
4776
+ discoveryData?: Json | null;
4777
+ proposalData?: Json | null;
4778
+ proposalSentAt?: string | null;
4779
+ proposalPdfUrl?: string | null;
4780
+ signatureEnvelopeId?: string | null;
4781
+ sourceListId?: string | null;
4782
+ sourceType?: string | null;
4783
+ activityLog: DealActivityEntry[];
4784
+ createdAt: Date;
4785
+ updatedAt: Date;
4786
+ }
4787
+ interface DealActivityEntry {
4788
+ type: string;
4789
+ title: string;
4790
+ description?: string;
4791
+ payload?: Record<string, unknown>;
4792
+ occurredAt: string;
4793
+ }
4794
+ interface AcqDealNote {
4795
+ id: string;
4796
+ dealId: string;
4797
+ organizationId: string;
4798
+ authorUserId: string | null;
4799
+ body: string;
4800
+ createdAt: string;
4801
+ updatedAt: string;
4802
+ }
4803
+ interface CreateDealNoteParams {
4804
+ organizationId: string;
4805
+ dealId: string;
4806
+ body: string;
4807
+ authorUserId?: string;
4808
+ }
4809
+ interface ListDealNotesParams {
4810
+ organizationId: string;
4811
+ dealId: string;
4812
+ }
4813
+ interface CreateDealTaskParams {
4814
+ organizationId: string;
4815
+ dealId: string;
4816
+ title: string;
4817
+ description?: string | null;
4818
+ kind?: AcqDealTaskKind;
4819
+ dueAt?: string | null;
4820
+ assigneeUserId?: string | null;
4821
+ createdByUserId?: string | null;
4822
+ }
4823
+ interface ListDealTasksParams {
4824
+ organizationId: string;
4825
+ dealId: string;
4826
+ }
4827
+ interface ListDealTasksDueParams {
4828
+ organizationId: string;
4829
+ assigneeUserId?: string | null;
4830
+ /** Window filter: 'overdue' = past due, 'today' = due today only, 'today_and_overdue' (default) = both, 'upcoming' = future */
4831
+ window?: 'overdue' | 'today' | 'today_and_overdue' | 'upcoming';
4832
+ }
4833
+ interface CompleteDealTaskParams {
4834
+ organizationId: string;
4835
+ taskId: string;
4836
+ completedByUserId: string | null;
4837
+ }
4838
+ interface RecordDealActivityParams {
4839
+ organizationId: string;
4840
+ dealId: string;
4841
+ type: string;
4842
+ title: string;
4843
+ description?: string;
4844
+ payload?: Record<string, unknown>;
4845
+ }
4846
+ interface DealStageSummary {
4847
+ stage: string;
4848
+ count: number;
4849
+ oldestUpdatedAt: string | null;
4850
+ newestUpdatedAt: string | null;
4851
+ }
4852
+ interface StaleDeal {
4853
+ id: string;
4854
+ contactEmail: string;
4855
+ stageKey: string;
4856
+ updatedAt: string;
4857
+ daysStale: number;
4858
+ }
4859
+ interface DealPipelineAnalytics {
4860
+ totalDeals: number;
4861
+ stageSummary: DealStageSummary[];
4862
+ staleDeals: StaleDeal[];
4863
+ recentActivity: AcqDeal[];
4864
+ }
4865
+ interface DealFilters {
4866
+ stage?: string;
4867
+ search?: string;
4868
+ limit?: number;
4869
+ offset?: number;
4870
+ }
4871
+ interface AddContactsToListParams {
4872
+ organizationId: string;
4873
+ listId: string;
4874
+ contactIds: string[];
4875
+ }
4876
+ interface AddContactsToListResult {
4877
+ added: number;
4878
+ alreadyExisted: number;
4879
+ }
4880
+ interface UpdateCompanyStageParams {
4881
+ organizationId: string;
4882
+ listId: string;
4883
+ companyId: string;
4884
+ stage: string;
4885
+ executionId?: string;
4886
+ }
4887
+ interface UpdateContactStageParams {
4888
+ organizationId: string;
4889
+ listId: string;
4890
+ contactId: string;
4891
+ stage: string;
4892
+ executionId?: string;
4893
+ }
4894
+ interface RecordListExecutionParams {
4895
+ organizationId: string;
4896
+ listId: string;
4897
+ executionId: string;
4898
+ configSnapshot?: Record<string, unknown>;
4899
+ }
4900
+ interface BulkImportParams {
4901
+ organizationId: string;
4902
+ contacts: CreateContactParams[];
4903
+ listId?: string;
4904
+ }
4905
+ interface BulkImportResult {
4906
+ created: number;
4907
+ updated: number;
4908
+ errors: Array<{
4909
+ email: string;
4910
+ error: string;
4911
+ }>;
4912
+ }
4913
+ interface BulkImportCompanyEntry {
4914
+ name: string;
4915
+ domain: string;
4916
+ website?: string;
4917
+ locationCity?: string;
4918
+ locationState?: string;
4919
+ category?: string;
4920
+ source?: string;
4921
+ enrichmentData?: Record<string, unknown>;
4922
+ pipelineStatus?: Record<string, unknown>;
4923
+ }
4924
+ interface BulkImportCompaniesParams {
4925
+ organizationId: string;
4926
+ batchId: string;
4927
+ companies: BulkImportCompanyEntry[];
4928
+ }
4929
+ interface BulkImportCompaniesResult {
4930
+ created: number;
4931
+ skipped: number;
4932
+ errors: Array<{
4933
+ companyName: string;
4934
+ error: string;
4935
+ }>;
4936
+ }
4937
+
4938
+ /**
4939
+ * Origin resource type - where an execution/task originated from.
4940
+ * Used for audit trails and tracking execution lineage.
4941
+ */
4942
+ type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
4943
+
4944
+ /**
4945
+ * Target for schedule execution - identifies what resource to execute.
4946
+ * Unlike ExecutionTarget, payload is NOT included here because schedules
4947
+ * store payload in the scheduleConfig (varies per step/item).
4948
+ */
4949
+ interface ScheduleTarget {
4950
+ resourceType: 'agent' | 'workflow';
4951
+ resourceId: string;
4952
+ }
4953
+ /**
4954
+ * Optional origin tracking for schedules.
4955
+ * Unlike OriginTracking (which is required), these fields are all optional
4956
+ * for schedules created directly via API (not triggered by another resource).
4957
+ */
4958
+ interface ScheduleOriginTracking {
4959
+ originExecutionId?: string;
4960
+ originResourceType?: OriginResourceType;
4961
+ originResourceId?: string;
4962
+ }
4963
+ type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
4964
+ interface RecurringScheduleConfig {
4965
+ type: 'recurring';
4966
+ cron?: string;
4967
+ interval?: 'daily' | 'weekly' | 'monthly';
4968
+ time?: string;
4969
+ timezone: string;
4970
+ payload: Record<string, unknown>;
4971
+ endAt?: string | null;
4972
+ overduePolicy?: 'skip' | 'execute';
4973
+ }
4974
+ interface RelativeScheduleConfig {
4975
+ type: 'relative';
4976
+ anchorAt: string;
4977
+ anchorLabel?: string;
4978
+ items: RelativeScheduleItem[];
4979
+ overduePolicy?: 'skip' | 'execute';
4980
+ }
4981
+ interface RelativeScheduleItem {
4982
+ offset: string;
4983
+ payload: Record<string, unknown>;
4984
+ label?: string;
4985
+ }
4986
+ interface AbsoluteScheduleConfig {
4987
+ type: 'absolute';
4988
+ items: AbsoluteScheduleItem[];
4989
+ overduePolicy?: 'skip' | 'execute';
4990
+ }
4991
+ interface AbsoluteScheduleItem {
4992
+ runAt: string;
4993
+ payload: Record<string, unknown>;
4994
+ label?: string;
4995
+ }
4996
+ interface TaskSchedule extends ScheduleOriginTracking {
4997
+ id: string;
4998
+ organizationId: string;
4999
+ name: string;
5000
+ description?: string;
5001
+ target: ScheduleTarget;
5002
+ scheduleConfig: TaskScheduleConfig;
5003
+ nextRunAt?: Date;
5004
+ currentStep: number;
5005
+ status: 'active' | 'paused' | 'completed' | 'cancelled';
5006
+ lastRunAt?: Date;
5007
+ lastExecutionId?: string;
5008
+ maxRetries: number;
5009
+ idempotencyKey?: string;
5010
+ createdAt: Date;
5011
+ updatedAt: Date;
5012
+ }
5013
+ interface CreateScheduleInput extends ScheduleOriginTracking {
5014
+ organizationId: string;
5015
+ name: string;
5016
+ description?: string;
5017
+ target: ScheduleTarget;
5018
+ scheduleConfig: TaskScheduleConfig;
5019
+ maxRetries?: number;
5020
+ idempotencyKey?: string;
5021
+ metadata?: Record<string, unknown>;
5022
+ }
5023
+
5024
+ type NotificationRow = Database['public']['Tables']['notifications']['Row'];
5025
+ interface CreateNotificationParams {
5026
+ userId: string;
5027
+ organizationId: string;
5028
+ category: NotificationRow['category'];
5029
+ title: string;
5030
+ message: string;
5031
+ actionUrl?: string;
5032
+ }
5033
+
5034
+ type ProjectRow = Database['public']['Tables']['prj_projects']['Row'];
5035
+ type MilestoneRow = Database['public']['Tables']['prj_milestones']['Row'];
5036
+ type TaskRow = Database['public']['Tables']['prj_tasks']['Row'];
5037
+ type NoteRow = Database['public']['Tables']['prj_notes']['Row'];
5038
+ interface ProjectWithCounts extends ProjectRow {
5039
+ milestoneCount: number;
5040
+ taskCount: number;
5041
+ completedMilestones?: number;
5042
+ completedTasks?: number;
5043
+ }
5044
+ interface ProjectDetail extends ProjectRow {
5045
+ milestones: MilestoneRow[];
5046
+ tasks: TaskRow[];
5047
+ company: {
5048
+ id: string;
5049
+ name: string;
5050
+ domain: string | null;
5051
+ } | null;
5052
+ }
5053
+
5054
+ declare const ActivityEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5055
+ type: z.ZodLiteral<"stage_change">;
5056
+ timestamp: z.ZodString;
5057
+ stageBefore: z.ZodString;
5058
+ stageAfter: z.ZodString;
5059
+ reason: z.ZodOptional<z.ZodString>;
5060
+ }, z.core.$strip>, z.ZodObject<{
5061
+ type: z.ZodLiteral<"state_change">;
5062
+ timestamp: z.ZodString;
5063
+ stateBefore: z.ZodNullable<z.ZodString>;
5064
+ stateAfter: z.ZodNullable<z.ZodString>;
5065
+ reason: z.ZodOptional<z.ZodString>;
5066
+ }, z.core.$strip>, z.ZodObject<{
5067
+ type: z.ZodLiteral<"action_taken">;
5068
+ timestamp: z.ZodString;
5069
+ actionKey: z.ZodString;
5070
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5071
+ }, z.core.$strip>, z.ZodObject<{
5072
+ type: z.ZodLiteral<"approval_created">;
5073
+ timestamp: z.ZodString;
5074
+ commandId: z.ZodString;
5075
+ dealStageBefore: z.ZodOptional<z.ZodString>;
5076
+ dealStageAfter: z.ZodOptional<z.ZodString>;
5077
+ }, z.core.$strip>, z.ZodObject<{
5078
+ type: z.ZodLiteral<"approval_resolved">;
5079
+ timestamp: z.ZodString;
5080
+ commandId: z.ZodString;
5081
+ resolution: z.ZodEnum<{
5082
+ superseded: "superseded";
5083
+ }>;
5084
+ originResourceType: z.ZodOptional<z.ZodString>;
5085
+ }, z.core.$strip>, z.ZodObject<{
5086
+ type: z.ZodLiteral<"approval_stale">;
5087
+ timestamp: z.ZodString;
5088
+ commandId: z.ZodString;
5089
+ dealStageBefore: z.ZodOptional<z.ZodString>;
5090
+ dealStageAfter: z.ZodOptional<z.ZodString>;
5091
+ }, z.core.$strip>, z.ZodObject<{
5092
+ type: z.ZodLiteral<"task_created">;
5093
+ timestamp: z.ZodString;
5094
+ taskId: z.ZodString;
5095
+ }, z.core.$strip>, z.ZodObject<{
5096
+ type: z.ZodLiteral<"deal_created">;
5097
+ timestamp: z.ZodString;
5098
+ }, z.core.$strip>], "type">;
5099
+ type ActivityEvent = z.infer<typeof ActivityEventSchema>;
5100
+
5101
+ interface Action {
5102
+ key: string;
5103
+ label: string;
5104
+ payloadSchema?: z.ZodTypeAny;
5105
+ }
5106
+ interface ActionDef {
5107
+ key: string;
5108
+ label: string;
5109
+ isAvailableFor: (deal: AcqDealRow) => boolean;
5110
+ workflowId: string;
5111
+ payloadSchema?: z.ZodTypeAny;
5112
+ }
5113
+ declare const DEFAULT_CRM_ACTIONS: ActionDef[];
5114
+ declare function deriveActions(deal: AcqDealRow, actions?: ActionDef[]): Action[];
5115
+
5235
5116
  /**
5236
5117
  * A single CRM activity entry (note, stage change, or deal creation).
5237
5118
  * Matches the CrmActivityEntry interface from useRecentCrmActivity.ts.
@@ -8016,23 +7897,6 @@ type LeadToolMap = {
8016
7897
  };
8017
7898
  result: UpsertSocialPostsResult;
8018
7899
  };
8019
- recordTouchpoint: {
8020
- params: {
8021
- contactId?: string;
8022
- listMemberId?: string;
8023
- listId?: string;
8024
- direction: 'inbound' | 'outbound';
8025
- channel: string;
8026
- kind: TouchpointKind;
8027
- payload?: Record<string, unknown>;
8028
- artifactId?: string;
8029
- sourceExecutionId?: string;
8030
- occurredAt?: string;
8031
- };
8032
- result: {
8033
- id: string;
8034
- };
8035
- };
8036
7900
  setDealStateKey: {
8037
7901
  params: {
8038
7902
  dealId: string;
@@ -8058,35 +7922,17 @@ type LeadToolMap = {
8058
7922
  };
8059
7923
  result: DealDetail | null;
8060
7924
  };
8061
- listDealTouchpoints: {
8062
- params: {
8063
- dealId: string;
8064
- kind?: string;
8065
- limit?: number;
8066
- };
8067
- result: Array<{
8068
- id: string;
8069
- organization_id: string;
8070
- contact_id: string | null;
8071
- list_id: string | null;
8072
- list_member_id: string | null;
8073
- direction: string;
8074
- channel: string;
8075
- kind: string;
8076
- payload: Record<string, unknown> | null;
8077
- artifact_id: string | null;
8078
- source_execution_id: string | null;
8079
- occurred_at: string;
8080
- created_at: string;
8081
- }>;
8082
- };
8083
7925
  };
8084
7926
  type ListToolMap = {
8085
7927
  getConfig: {
8086
7928
  params: {
8087
7929
  listId: string;
8088
7930
  };
8089
- result: ListConfig;
7931
+ result: {
7932
+ scrapingConfig: ScrapingConfig;
7933
+ icp: IcpRubric;
7934
+ pipelineConfig: PipelineConfig;
7935
+ };
8090
7936
  };
8091
7937
  recordExecution: {
8092
7938
  params: Omit<RecordListExecutionParams, 'organizationId'>;