@happyvertical/smrt-facts 0.49.2 → 0.49.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-facts",
5
- "packageVersion": "0.49.2",
5
+ "packageVersion": "0.49.4",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-facts:FactContent": {
8
8
  "name": "factcontent",
@@ -429,8 +429,8 @@
429
429
  "exportName": "FactContentCollection",
430
430
  "collectionExportName": "FactContentCollectionCollection",
431
431
  "schema": {
432
- "tableName": "fact_content_collections",
433
- "ddl": "CREATE TABLE IF NOT EXISTS \"fact_content_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
432
+ "tableName": "fact_contents",
433
+ "ddl": "CREATE TABLE IF NOT EXISTS \"fact_contents\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"fact_id\" UUID NOT NULL,\n \"content_id\" UUID NOT NULL,\n \"relationship\" TEXT NOT NULL DEFAULT 'extracted_from',\n \"metadata\" TEXT DEFAULT '',\n \"tenant_id\" UUID\n);",
434
434
  "columns": {
435
435
  "id": {
436
436
  "type": "UUID",
@@ -456,25 +456,76 @@
456
456
  "type": "TIMESTAMP",
457
457
  "notNull": true,
458
458
  "default": "current_timestamp"
459
+ },
460
+ "fact_id": {
461
+ "type": "UUID",
462
+ "referenceKind": "foreignKey",
463
+ "notNull": true,
464
+ "unique": false,
465
+ "foreignKey": {
466
+ "table": "facts",
467
+ "column": "id",
468
+ "onDelete": "CASCADE",
469
+ "onUpdate": "CASCADE"
470
+ }
471
+ },
472
+ "content_id": {
473
+ "type": "UUID",
474
+ "referenceKind": "crossPackageRef",
475
+ "notNull": true,
476
+ "unique": false
477
+ },
478
+ "relationship": {
479
+ "type": "TEXT",
480
+ "notNull": true,
481
+ "unique": false,
482
+ "default": "extracted_from"
483
+ },
484
+ "metadata": {
485
+ "type": "TEXT",
486
+ "notNull": false,
487
+ "unique": false,
488
+ "default": ""
489
+ },
490
+ "tenant_id": {
491
+ "type": "UUID",
492
+ "referenceKind": "tenantId",
493
+ "notNull": false,
494
+ "unique": false
459
495
  }
460
496
  },
461
497
  "indexes": [
462
498
  {
463
- "name": "fact_content_collections_slug_context_idx",
499
+ "name": "fact_contents_fact_id_content_id_idx",
464
500
  "columns": [
465
- "slug",
466
- "context"
501
+ "fact_id",
502
+ "content_id",
503
+ "relationship"
467
504
  ],
468
505
  "unique": true
469
506
  },
470
507
  {
471
- "name": "fact_content_collections_created_at_idx",
508
+ "name": "fact_contents_slug_context_idx",
509
+ "columns": [
510
+ "slug",
511
+ "context"
512
+ ]
513
+ },
514
+ {
515
+ "name": "fact_contents_tenant_id_created_at_idx",
472
516
  "columns": [
517
+ "tenant_id",
473
518
  "created_at"
474
519
  ]
520
+ },
521
+ {
522
+ "name": "fact_contents_content_id_idx",
523
+ "columns": [
524
+ "content_id"
525
+ ]
475
526
  }
476
527
  ],
477
- "version": "22be8f54"
528
+ "version": "62831c36"
478
529
  }
479
530
  },
480
531
  "@happyvertical/smrt-facts:FactEvidence": {
@@ -946,7 +997,7 @@
946
997
  "collectionExportName": "FactEvidenceCollectionCollection",
947
998
  "schema": {
948
999
  "tableName": "fact_evidences",
949
- "ddl": "CREATE TABLE IF NOT EXISTS \"fact_evidences\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1000
+ "ddl": "CREATE TABLE IF NOT EXISTS \"fact_evidences\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"fact_id\" UUID NOT NULL,\n \"evidence_key\" TEXT NOT NULL DEFAULT '',\n \"status\" TEXT NOT NULL DEFAULT 'supports',\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"source_url\" TEXT DEFAULT '',\n \"source_title\" TEXT DEFAULT '',\n \"quote\" TEXT DEFAULT '',\n \"locator\" TEXT DEFAULT '',\n \"extraction_method\" TEXT DEFAULT '',\n \"confidence\" REAL DEFAULT 0,\n \"metadata\" TEXT DEFAULT '',\n \"tenant_id\" UUID\n);",
950
1001
  "columns": {
951
1002
  "id": {
952
1003
  "type": "UUID",
@@ -972,25 +1023,117 @@
972
1023
  "type": "TIMESTAMP",
973
1024
  "notNull": true,
974
1025
  "default": "current_timestamp"
1026
+ },
1027
+ "fact_id": {
1028
+ "type": "UUID",
1029
+ "referenceKind": "foreignKey",
1030
+ "notNull": true,
1031
+ "unique": false,
1032
+ "foreignKey": {
1033
+ "table": "facts",
1034
+ "column": "id",
1035
+ "onDelete": "CASCADE",
1036
+ "onUpdate": "CASCADE"
1037
+ }
1038
+ },
1039
+ "evidence_key": {
1040
+ "type": "TEXT",
1041
+ "notNull": true,
1042
+ "unique": false,
1043
+ "default": ""
1044
+ },
1045
+ "status": {
1046
+ "type": "TEXT",
1047
+ "notNull": true,
1048
+ "unique": false,
1049
+ "default": "supports"
1050
+ },
1051
+ "source_kind": {
1052
+ "type": "TEXT",
1053
+ "notNull": false,
1054
+ "unique": false,
1055
+ "default": ""
1056
+ },
1057
+ "source_id": {
1058
+ "type": "TEXT",
1059
+ "notNull": false,
1060
+ "unique": false,
1061
+ "default": ""
1062
+ },
1063
+ "source_url": {
1064
+ "type": "TEXT",
1065
+ "notNull": false,
1066
+ "unique": false,
1067
+ "default": ""
1068
+ },
1069
+ "source_title": {
1070
+ "type": "TEXT",
1071
+ "notNull": false,
1072
+ "unique": false,
1073
+ "default": ""
1074
+ },
1075
+ "quote": {
1076
+ "type": "TEXT",
1077
+ "notNull": false,
1078
+ "unique": false,
1079
+ "default": ""
1080
+ },
1081
+ "locator": {
1082
+ "type": "TEXT",
1083
+ "notNull": false,
1084
+ "unique": false,
1085
+ "default": ""
1086
+ },
1087
+ "extraction_method": {
1088
+ "type": "TEXT",
1089
+ "notNull": false,
1090
+ "unique": false,
1091
+ "default": ""
1092
+ },
1093
+ "confidence": {
1094
+ "type": "REAL",
1095
+ "notNull": false,
1096
+ "unique": false,
1097
+ "default": 0
1098
+ },
1099
+ "metadata": {
1100
+ "type": "TEXT",
1101
+ "notNull": false,
1102
+ "unique": false,
1103
+ "default": ""
1104
+ },
1105
+ "tenant_id": {
1106
+ "type": "UUID",
1107
+ "referenceKind": "tenantId",
1108
+ "notNull": false,
1109
+ "unique": false
975
1110
  }
976
1111
  },
977
1112
  "indexes": [
1113
+ {
1114
+ "name": "fact_evidences_fact_id_evidence_key_idx",
1115
+ "columns": [
1116
+ "fact_id",
1117
+ "evidence_key"
1118
+ ],
1119
+ "unique": true
1120
+ },
978
1121
  {
979
1122
  "name": "fact_evidences_slug_context_idx",
980
1123
  "columns": [
981
1124
  "slug",
982
1125
  "context"
983
- ],
984
- "unique": true
1126
+ ]
985
1127
  },
986
1128
  {
987
- "name": "fact_evidences_created_at_idx",
1129
+ "name": "fact_evidences_tenant_id_created_at_idx",
988
1130
  "columns": [
1131
+ "tenant_id",
989
1132
  "created_at"
990
1133
  ]
991
1134
  }
992
1135
  ],
993
- "version": "80329e4f"
1136
+ "version": "7f1e96c4"
994
1137
  }
995
1138
  },
996
1139
  "@happyvertical/smrt-facts:FactSource": {
@@ -1251,7 +1394,8 @@
1251
1394
  "context",
1252
1395
  "_meta_type"
1253
1396
  ],
1254
- "unique": true
1397
+ "unique": true,
1398
+ "nullsNotDistinct": true
1255
1399
  },
1256
1400
  {
1257
1401
  "name": "fact_sources_meta_type_idx",
@@ -1398,8 +1542,8 @@
1398
1542
  "exportName": "FactSourceCollection",
1399
1543
  "collectionExportName": "FactSourceCollectionCollection",
1400
1544
  "schema": {
1401
- "tableName": "fact_source_collections",
1402
- "ddl": "CREATE TABLE IF NOT EXISTS \"fact_source_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1545
+ "tableName": "fact_sources",
1546
+ "ddl": "CREATE TABLE IF NOT EXISTS \"fact_sources\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"fact_id\" UUID,\n \"source_type\" TEXT DEFAULT '',\n \"source_url\" TEXT DEFAULT '',\n \"source_title\" TEXT DEFAULT '',\n \"credibility\" REAL DEFAULT 0,\n \"extracted_at\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT '',\n \"tenant_id\" UUID\n);",
1403
1547
  "columns": {
1404
1548
  "id": {
1405
1549
  "type": "UUID",
@@ -1416,6 +1560,14 @@
1416
1560
  "notNull": true,
1417
1561
  "default": ""
1418
1562
  },
1563
+ "_meta_type": {
1564
+ "type": "TEXT",
1565
+ "notNull": true
1566
+ },
1567
+ "_meta_data": {
1568
+ "type": "JSON",
1569
+ "notNull": false
1570
+ },
1419
1571
  "created_at": {
1420
1572
  "type": "TIMESTAMP",
1421
1573
  "notNull": true,
@@ -1425,25 +1577,86 @@
1425
1577
  "type": "TIMESTAMP",
1426
1578
  "notNull": true,
1427
1579
  "default": "current_timestamp"
1580
+ },
1581
+ "fact_id": {
1582
+ "type": "UUID",
1583
+ "referenceKind": "foreignKey",
1584
+ "notNull": false,
1585
+ "foreignKey": {
1586
+ "table": "facts",
1587
+ "column": "id",
1588
+ "onDelete": "NO ACTION",
1589
+ "onUpdate": "CASCADE"
1590
+ }
1591
+ },
1592
+ "source_type": {
1593
+ "type": "TEXT",
1594
+ "notNull": false,
1595
+ "default": ""
1596
+ },
1597
+ "source_url": {
1598
+ "type": "TEXT",
1599
+ "notNull": false,
1600
+ "default": ""
1601
+ },
1602
+ "source_title": {
1603
+ "type": "TEXT",
1604
+ "notNull": false,
1605
+ "default": ""
1606
+ },
1607
+ "credibility": {
1608
+ "type": "REAL",
1609
+ "notNull": false,
1610
+ "default": 0
1611
+ },
1612
+ "extracted_at": {
1613
+ "type": "TIMESTAMP",
1614
+ "notNull": false
1615
+ },
1616
+ "metadata": {
1617
+ "type": "TEXT",
1618
+ "notNull": false,
1619
+ "default": ""
1620
+ },
1621
+ "tenant_id": {
1622
+ "type": "UUID",
1623
+ "referenceKind": "tenantId",
1624
+ "notNull": false
1428
1625
  }
1429
1626
  },
1430
1627
  "indexes": [
1431
1628
  {
1432
- "name": "fact_source_collections_slug_context_idx",
1629
+ "name": "fact_sources_slug_context_meta_type_idx",
1433
1630
  "columns": [
1631
+ "tenant_id",
1434
1632
  "slug",
1435
- "context"
1633
+ "context",
1634
+ "_meta_type"
1436
1635
  ],
1437
- "unique": true
1636
+ "unique": true,
1637
+ "nullsNotDistinct": true
1638
+ },
1639
+ {
1640
+ "name": "fact_sources_meta_type_idx",
1641
+ "columns": [
1642
+ "_meta_type"
1643
+ ]
1438
1644
  },
1439
1645
  {
1440
- "name": "fact_source_collections_created_at_idx",
1646
+ "name": "fact_sources_tenant_id_created_at_idx",
1441
1647
  "columns": [
1648
+ "tenant_id",
1442
1649
  "created_at"
1443
1650
  ]
1651
+ },
1652
+ {
1653
+ "name": "fact_sources_fact_id_idx",
1654
+ "columns": [
1655
+ "fact_id"
1656
+ ]
1444
1657
  }
1445
1658
  ],
1446
- "version": "36f4adef"
1659
+ "version": "9d0f874e"
1447
1660
  }
1448
1661
  },
1449
1662
  "@happyvertical/smrt-facts:FactSubject": {
@@ -1889,8 +2102,8 @@
1889
2102
  "exportName": "FactSubjectCollection",
1890
2103
  "collectionExportName": "FactSubjectCollectionCollection",
1891
2104
  "schema": {
1892
- "tableName": "fact_subject_collections",
1893
- "ddl": "CREATE TABLE IF NOT EXISTS \"fact_subject_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
2105
+ "tableName": "fact_subjects",
2106
+ "ddl": "CREATE TABLE IF NOT EXISTS \"fact_subjects\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"fact_id\" UUID NOT NULL,\n \"entity_type\" TEXT NOT NULL DEFAULT '',\n \"entity_id\" TEXT NOT NULL DEFAULT '',\n \"role\" TEXT DEFAULT 'subject',\n \"metadata\" TEXT DEFAULT '',\n \"tenant_id\" UUID\n);",
1894
2107
  "columns": {
1895
2108
  "id": {
1896
2109
  "type": "UUID",
@@ -1916,25 +2129,76 @@
1916
2129
  "type": "TIMESTAMP",
1917
2130
  "notNull": true,
1918
2131
  "default": "current_timestamp"
2132
+ },
2133
+ "fact_id": {
2134
+ "type": "UUID",
2135
+ "referenceKind": "foreignKey",
2136
+ "notNull": true,
2137
+ "unique": false,
2138
+ "foreignKey": {
2139
+ "table": "facts",
2140
+ "column": "id",
2141
+ "onDelete": "CASCADE",
2142
+ "onUpdate": "CASCADE"
2143
+ }
2144
+ },
2145
+ "entity_type": {
2146
+ "type": "TEXT",
2147
+ "notNull": true,
2148
+ "unique": false,
2149
+ "default": ""
2150
+ },
2151
+ "entity_id": {
2152
+ "type": "TEXT",
2153
+ "notNull": true,
2154
+ "unique": false,
2155
+ "default": ""
2156
+ },
2157
+ "role": {
2158
+ "type": "TEXT",
2159
+ "notNull": false,
2160
+ "unique": false,
2161
+ "default": "subject"
2162
+ },
2163
+ "metadata": {
2164
+ "type": "TEXT",
2165
+ "notNull": false,
2166
+ "unique": false,
2167
+ "default": ""
2168
+ },
2169
+ "tenant_id": {
2170
+ "type": "UUID",
2171
+ "referenceKind": "tenantId",
2172
+ "notNull": false,
2173
+ "unique": false
1919
2174
  }
1920
2175
  },
1921
2176
  "indexes": [
1922
2177
  {
1923
- "name": "fact_subject_collections_slug_context_idx",
2178
+ "name": "fact_subjects_fact_id_entity_type_idx",
1924
2179
  "columns": [
1925
- "slug",
1926
- "context"
2180
+ "fact_id",
2181
+ "entity_type",
2182
+ "entity_id"
1927
2183
  ],
1928
2184
  "unique": true
1929
2185
  },
1930
2186
  {
1931
- "name": "fact_subject_collections_created_at_idx",
2187
+ "name": "fact_subjects_slug_context_idx",
2188
+ "columns": [
2189
+ "slug",
2190
+ "context"
2191
+ ]
2192
+ },
2193
+ {
2194
+ "name": "fact_subjects_tenant_id_created_at_idx",
1932
2195
  "columns": [
2196
+ "tenant_id",
1933
2197
  "created_at"
1934
2198
  ]
1935
2199
  }
1936
2200
  ],
1937
- "version": "0ce73db4"
2201
+ "version": "cb6eca71"
1938
2202
  }
1939
2203
  },
1940
2204
  "@happyvertical/smrt-facts:FactTag": {
@@ -2300,8 +2564,8 @@
2300
2564
  "exportName": "FactTagCollection",
2301
2565
  "collectionExportName": "FactTagCollectionCollection",
2302
2566
  "schema": {
2303
- "tableName": "fact_tag_collections",
2304
- "ddl": "CREATE TABLE IF NOT EXISTS \"fact_tag_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
2567
+ "tableName": "fact_tags",
2568
+ "ddl": "CREATE TABLE IF NOT EXISTS \"fact_tags\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"fact_id\" UUID NOT NULL,\n \"tag_slug\" TEXT NOT NULL DEFAULT '',\n \"metadata\" TEXT DEFAULT '',\n \"tenant_id\" UUID\n);",
2305
2569
  "columns": {
2306
2570
  "id": {
2307
2571
  "type": "UUID",
@@ -2327,25 +2591,63 @@
2327
2591
  "type": "TIMESTAMP",
2328
2592
  "notNull": true,
2329
2593
  "default": "current_timestamp"
2594
+ },
2595
+ "fact_id": {
2596
+ "type": "UUID",
2597
+ "referenceKind": "foreignKey",
2598
+ "notNull": true,
2599
+ "unique": false,
2600
+ "foreignKey": {
2601
+ "table": "facts",
2602
+ "column": "id",
2603
+ "onDelete": "CASCADE",
2604
+ "onUpdate": "CASCADE"
2605
+ }
2606
+ },
2607
+ "tag_slug": {
2608
+ "type": "TEXT",
2609
+ "notNull": true,
2610
+ "unique": false,
2611
+ "default": ""
2612
+ },
2613
+ "metadata": {
2614
+ "type": "TEXT",
2615
+ "notNull": false,
2616
+ "unique": false,
2617
+ "default": ""
2618
+ },
2619
+ "tenant_id": {
2620
+ "type": "UUID",
2621
+ "referenceKind": "tenantId",
2622
+ "notNull": false,
2623
+ "unique": false
2330
2624
  }
2331
2625
  },
2332
2626
  "indexes": [
2333
2627
  {
2334
- "name": "fact_tag_collections_slug_context_idx",
2628
+ "name": "fact_tags_fact_id_tag_slug_idx",
2629
+ "columns": [
2630
+ "fact_id",
2631
+ "tag_slug"
2632
+ ],
2633
+ "unique": true
2634
+ },
2635
+ {
2636
+ "name": "fact_tags_slug_context_idx",
2335
2637
  "columns": [
2336
2638
  "slug",
2337
2639
  "context"
2338
- ],
2339
- "unique": true
2640
+ ]
2340
2641
  },
2341
2642
  {
2342
- "name": "fact_tag_collections_created_at_idx",
2643
+ "name": "fact_tags_tenant_id_created_at_idx",
2343
2644
  "columns": [
2645
+ "tenant_id",
2344
2646
  "created_at"
2345
2647
  ]
2346
2648
  }
2347
2649
  ],
2348
- "version": "4bac3c1d"
2650
+ "version": "79df8b59"
2349
2651
  }
2350
2652
  },
2351
2653
  "@happyvertical/smrt-facts:Fact": {
@@ -2377,6 +2679,17 @@
2377
2679
  "required": false,
2378
2680
  "default": ""
2379
2681
  },
2682
+ "catalogSearch": {
2683
+ "type": "text",
2684
+ "required": false,
2685
+ "_meta": {
2686
+ "nullable": true,
2687
+ "readonly": true,
2688
+ "sensitive": true
2689
+ },
2690
+ "sensitive": true,
2691
+ "readonly": true
2692
+ },
2380
2693
  "type": {
2381
2694
  "type": "text",
2382
2695
  "required": true,
@@ -2633,7 +2946,7 @@
2633
2946
  ],
2634
2947
  "schema": {
2635
2948
  "tableName": "facts",
2636
- "ddl": "CREATE TABLE IF NOT EXISTS \"facts\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"text_refined\" TEXT DEFAULT '',\n \"text_raw\" TEXT DEFAULT '',\n \"type\" TEXT DEFAULT 'assertion',\n \"status\" TEXT DEFAULT 'pending',\n \"domain\" TEXT DEFAULT '',\n \"previous_fact_id\" UUID,\n \"evolution_type\" TEXT DEFAULT 'original',\n \"source_count\" INTEGER DEFAULT 0,\n \"confidence\" REAL DEFAULT 0,\n \"metadata\" TEXT DEFAULT '',\n \"tenant_id\" UUID\n);",
2949
+ "ddl": "CREATE TABLE IF NOT EXISTS \"facts\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"text_refined\" TEXT DEFAULT '',\n \"text_raw\" TEXT DEFAULT '',\n \"catalog_search\" TEXT,\n \"type\" TEXT DEFAULT 'assertion',\n \"status\" TEXT DEFAULT 'pending',\n \"domain\" TEXT DEFAULT '',\n \"previous_fact_id\" UUID,\n \"evolution_type\" TEXT DEFAULT 'original',\n \"source_count\" INTEGER DEFAULT 0,\n \"confidence\" REAL DEFAULT 0,\n \"metadata\" TEXT DEFAULT '',\n \"tenant_id\" UUID\n);",
2637
2950
  "columns": {
2638
2951
  "id": {
2639
2952
  "type": "UUID",
@@ -2678,6 +2991,10 @@
2678
2991
  "notNull": false,
2679
2992
  "default": ""
2680
2993
  },
2994
+ "catalog_search": {
2995
+ "type": "TEXT",
2996
+ "notNull": false
2997
+ },
2681
2998
  "type": {
2682
2999
  "type": "TEXT",
2683
3000
  "notNull": false,
@@ -2739,7 +3056,8 @@
2739
3056
  "context",
2740
3057
  "_meta_type"
2741
3058
  ],
2742
- "unique": true
3059
+ "unique": true,
3060
+ "nullsNotDistinct": true
2743
3061
  },
2744
3062
  {
2745
3063
  "name": "facts_meta_type_idx",
@@ -2761,7 +3079,7 @@
2761
3079
  ]
2762
3080
  }
2763
3081
  ],
2764
- "version": "ba4a9468"
3082
+ "version": "a0a442b8"
2765
3083
  }
2766
3084
  },
2767
3085
  "@happyvertical/smrt-facts:FactCollection": {
@@ -2906,6 +3224,20 @@
2906
3224
  "isStatic": false,
2907
3225
  "isPublic": true
2908
3226
  },
3227
+ "backfillCatalogSearch": {
3228
+ "name": "backfillCatalogSearch",
3229
+ "async": true,
3230
+ "parameters": [
3231
+ {
3232
+ "name": "batchSize",
3233
+ "type": "any",
3234
+ "optional": true
3235
+ }
3236
+ ],
3237
+ "returnType": "Promise<object>",
3238
+ "isStatic": false,
3239
+ "isPublic": true
3240
+ },
2909
3241
  "getForContent": {
2910
3242
  "name": "getForContent",
2911
3243
  "async": true,
@@ -3112,8 +3444,8 @@
3112
3444
  "exportName": "FactCollection",
3113
3445
  "collectionExportName": "FactCollectionCollection",
3114
3446
  "schema": {
3115
- "tableName": "fact_collections",
3116
- "ddl": "CREATE TABLE IF NOT EXISTS \"fact_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
3447
+ "tableName": "facts",
3448
+ "ddl": "CREATE TABLE IF NOT EXISTS \"facts\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"text_refined\" TEXT DEFAULT '',\n \"text_raw\" TEXT DEFAULT '',\n \"catalog_search\" TEXT,\n \"type\" TEXT DEFAULT 'assertion',\n \"status\" TEXT DEFAULT 'pending',\n \"domain\" TEXT DEFAULT '',\n \"previous_fact_id\" UUID,\n \"evolution_type\" TEXT DEFAULT 'original',\n \"source_count\" INTEGER DEFAULT 0,\n \"confidence\" REAL DEFAULT 0,\n \"metadata\" TEXT DEFAULT '',\n \"tenant_id\" UUID\n);",
3117
3449
  "columns": {
3118
3450
  "id": {
3119
3451
  "type": "UUID",
@@ -3130,6 +3462,14 @@
3130
3462
  "notNull": true,
3131
3463
  "default": ""
3132
3464
  },
3465
+ "_meta_type": {
3466
+ "type": "TEXT",
3467
+ "notNull": true
3468
+ },
3469
+ "_meta_data": {
3470
+ "type": "JSON",
3471
+ "notNull": false
3472
+ },
3133
3473
  "created_at": {
3134
3474
  "type": "TIMESTAMP",
3135
3475
  "notNull": true,
@@ -3139,25 +3479,106 @@
3139
3479
  "type": "TIMESTAMP",
3140
3480
  "notNull": true,
3141
3481
  "default": "current_timestamp"
3482
+ },
3483
+ "text_refined": {
3484
+ "type": "TEXT",
3485
+ "notNull": false,
3486
+ "default": ""
3487
+ },
3488
+ "text_raw": {
3489
+ "type": "TEXT",
3490
+ "notNull": false,
3491
+ "default": ""
3492
+ },
3493
+ "catalog_search": {
3494
+ "type": "TEXT",
3495
+ "notNull": false
3496
+ },
3497
+ "type": {
3498
+ "type": "TEXT",
3499
+ "notNull": false,
3500
+ "default": "assertion"
3501
+ },
3502
+ "status": {
3503
+ "type": "TEXT",
3504
+ "notNull": false,
3505
+ "default": "pending"
3506
+ },
3507
+ "domain": {
3508
+ "type": "TEXT",
3509
+ "notNull": false,
3510
+ "default": ""
3511
+ },
3512
+ "previous_fact_id": {
3513
+ "type": "UUID",
3514
+ "referenceKind": "foreignKey",
3515
+ "notNull": false,
3516
+ "foreignKey": {
3517
+ "table": "facts",
3518
+ "column": "id",
3519
+ "onDelete": "NO ACTION",
3520
+ "onUpdate": "CASCADE"
3521
+ }
3522
+ },
3523
+ "evolution_type": {
3524
+ "type": "TEXT",
3525
+ "notNull": false,
3526
+ "default": "original"
3527
+ },
3528
+ "source_count": {
3529
+ "type": "INTEGER",
3530
+ "notNull": false,
3531
+ "default": 0
3532
+ },
3533
+ "confidence": {
3534
+ "type": "REAL",
3535
+ "notNull": false,
3536
+ "default": 0
3537
+ },
3538
+ "metadata": {
3539
+ "type": "TEXT",
3540
+ "notNull": false,
3541
+ "default": ""
3542
+ },
3543
+ "tenant_id": {
3544
+ "type": "UUID",
3545
+ "referenceKind": "tenantId",
3546
+ "notNull": false
3142
3547
  }
3143
3548
  },
3144
3549
  "indexes": [
3145
3550
  {
3146
- "name": "fact_collections_slug_context_idx",
3551
+ "name": "facts_slug_context_meta_type_idx",
3147
3552
  "columns": [
3553
+ "tenant_id",
3148
3554
  "slug",
3149
- "context"
3555
+ "context",
3556
+ "_meta_type"
3150
3557
  ],
3151
- "unique": true
3558
+ "unique": true,
3559
+ "nullsNotDistinct": true
3152
3560
  },
3153
3561
  {
3154
- "name": "fact_collections_created_at_idx",
3562
+ "name": "facts_meta_type_idx",
3563
+ "columns": [
3564
+ "_meta_type"
3565
+ ]
3566
+ },
3567
+ {
3568
+ "name": "facts_tenant_id_created_at_idx",
3155
3569
  "columns": [
3570
+ "tenant_id",
3156
3571
  "created_at"
3157
3572
  ]
3573
+ },
3574
+ {
3575
+ "name": "facts_previous_fact_id_idx",
3576
+ "columns": [
3577
+ "previous_fact_id"
3578
+ ]
3158
3579
  }
3159
3580
  ],
3160
- "version": "3008a4e3"
3581
+ "version": "a0a442b8"
3161
3582
  }
3162
3583
  }
3163
3584
  },