@happyvertical/smrt-facts 0.51.32 → 0.51.33
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/__smrt-register__.d.ts +2 -0
- package/dist/__smrt-register__.d.ts.map +1 -0
- package/dist/__tests__/fixtures/decision-claim-support-3166.d.ts +33 -0
- package/dist/__tests__/fixtures/decision-claim-support-3166.d.ts.map +1 -0
- package/dist/catalog-search.d.ts +7 -0
- package/dist/catalog-search.d.ts.map +1 -0
- package/dist/fact-content.d.ts +39 -0
- package/dist/fact-content.d.ts.map +1 -0
- package/dist/fact-contents.d.ts +32 -0
- package/dist/fact-contents.d.ts.map +1 -0
- package/dist/fact-evidence.d.ts +37 -0
- package/dist/fact-evidence.d.ts.map +1 -0
- package/dist/fact-evidences.d.ts +32 -0
- package/dist/fact-evidences.d.ts.map +1 -0
- package/dist/fact-source.d.ts +29 -0
- package/dist/fact-source.d.ts.map +1 -0
- package/dist/fact-sources.d.ts +50 -0
- package/dist/fact-sources.d.ts.map +1 -0
- package/dist/fact-subject.d.ts +28 -0
- package/dist/fact-subject.d.ts.map +1 -0
- package/dist/fact-subjects.d.ts +56 -0
- package/dist/fact-subjects.d.ts.map +1 -0
- package/dist/fact-tag.d.ts +34 -0
- package/dist/fact-tag.d.ts.map +1 -0
- package/dist/fact-tags.d.ts +51 -0
- package/dist/fact-tags.d.ts.map +1 -0
- package/dist/fact.d.ts +77 -0
- package/dist/fact.d.ts.map +1 -0
- package/dist/facts.d.ts +173 -0
- package/dist/facts.d.ts.map +1 -0
- package/dist/index.d.ts +25 -854
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/manifest.json +1 -1
- package/dist/prompts.d.ts +5 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +4 -4
- package/dist/types.d.ts +258 -382
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +26 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__smrt-register__.d.ts","sourceRoot":"","sources":["../src/__smrt-register__.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { FactClaimSupportCandidate, FactClaimSupportStatus } from '../../types';
|
|
2
|
+
export interface RationaleConstraint {
|
|
3
|
+
kind: 'candidate_scope' | 'grounded' | 'missing_portion' | 'empty_claim';
|
|
4
|
+
example: string;
|
|
5
|
+
requiredTerms: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface DecisionClaimSupportFixture {
|
|
8
|
+
id: 'direct-support' | 'candidate-miss' | 'combined-support' | 'direct-contradiction' | 'conflicting-sources' | 'partial-support' | 'empty-candidates' | 'empty-claim';
|
|
9
|
+
claim: string;
|
|
10
|
+
candidates: FactClaimSupportCandidate[];
|
|
11
|
+
expectedStatus: FactClaimSupportStatus;
|
|
12
|
+
expectedSupportingFactIds: string[];
|
|
13
|
+
expectedSupportingEvidenceIds: string[];
|
|
14
|
+
expectedContradictingFactIds: string[];
|
|
15
|
+
expectedContradictingEvidenceIds: string[];
|
|
16
|
+
rationaleConstraint: RationaleConstraint;
|
|
17
|
+
}
|
|
18
|
+
export interface InvalidDecisionClaimSupportResponseFixture {
|
|
19
|
+
claim: string;
|
|
20
|
+
candidates: FactClaimSupportCandidate[];
|
|
21
|
+
rawResponse: {
|
|
22
|
+
status: FactClaimSupportStatus;
|
|
23
|
+
supportingFactIds: string[];
|
|
24
|
+
supportingEvidenceIds: string[];
|
|
25
|
+
contradictingFactIds: string[];
|
|
26
|
+
contradictingEvidenceIds: string[];
|
|
27
|
+
};
|
|
28
|
+
expectedNormalizedStatus: 'needs_review';
|
|
29
|
+
expectedErrors: Array<'unknown_fact' | 'evidence_fact_mismatch'>;
|
|
30
|
+
}
|
|
31
|
+
export declare const decisionClaimSupportFixtures: DecisionClaimSupportFixture[];
|
|
32
|
+
export declare const invalidDecisionClaimSupportResponseFixture: InvalidDecisionClaimSupportResponseFixture;
|
|
33
|
+
//# sourceMappingURL=decision-claim-support-3166.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision-claim-support-3166.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/decision-claim-support-3166.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,iBAAiB,GAAG,UAAU,GAAG,iBAAiB,GAAG,aAAa,CAAC;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EACE,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,sBAAsB,GACtB,qBAAqB,GACrB,iBAAiB,GACjB,kBAAkB,GAClB,aAAa,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,yBAAyB,EAAE,CAAC;IACxC,cAAc,EAAE,sBAAsB,CAAC;IACvC,yBAAyB,EAAE,MAAM,EAAE,CAAC;IACpC,6BAA6B,EAAE,MAAM,EAAE,CAAC;IACxC,4BAA4B,EAAE,MAAM,EAAE,CAAC;IACvC,gCAAgC,EAAE,MAAM,EAAE,CAAC;IAC3C,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C;AAED,MAAM,WAAW,0CAA0C;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,yBAAyB,EAAE,CAAC;IACxC,WAAW,EAAE;QACX,MAAM,EAAE,sBAAsB,CAAC;QAC/B,iBAAiB,EAAE,MAAM,EAAE,CAAC;QAC5B,qBAAqB,EAAE,MAAM,EAAE,CAAC;QAChC,oBAAoB,EAAE,MAAM,EAAE,CAAC;QAC/B,wBAAwB,EAAE,MAAM,EAAE,CAAC;KACpC,CAAC;IACF,wBAAwB,EAAE,cAAc,CAAC;IACzC,cAAc,EAAE,KAAK,CAAC,cAAc,GAAG,wBAAwB,CAAC,CAAC;CAClE;AAED,eAAO,MAAM,4BAA4B,EAAE,2BAA2B,EAkLrE,CAAC;AAEF,eAAO,MAAM,0CAA0C,EAAE,0CAwBtD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encode JavaScript lowercase UTF-16 units as aligned ASCII tokens. SQL's
|
|
3
|
+
* Unicode/collation rules never participate in substring matching. The `x`
|
|
4
|
+
* separator cannot occur inside a hex unit, so matches cannot start mid-unit.
|
|
5
|
+
*/
|
|
6
|
+
export declare function encodeCatalogSearch(value: string): string;
|
|
7
|
+
//# sourceMappingURL=catalog-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-search.d.ts","sourceRoot":"","sources":["../src/catalog-search.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOzD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FactContent model - Join table between facts and content
|
|
3
|
+
*
|
|
4
|
+
* Links facts to content objects (from @happyvertical/smrt-content)
|
|
5
|
+
* with relationship classification and metadata.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
8
|
+
import type { FactContentOptions, FactContentRelationship } from './types';
|
|
9
|
+
export declare class FactContent extends SmrtObject {
|
|
10
|
+
factId: string;
|
|
11
|
+
contentId: string;
|
|
12
|
+
relationship: string;
|
|
13
|
+
metadata: string;
|
|
14
|
+
tenantId: string | null;
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
constructor(options?: FactContentOptions);
|
|
18
|
+
/**
|
|
19
|
+
* Get the relationship type as a typed value
|
|
20
|
+
*/
|
|
21
|
+
getRelationship(): FactContentRelationship;
|
|
22
|
+
/**
|
|
23
|
+
* Get metadata as parsed object
|
|
24
|
+
*/
|
|
25
|
+
getMetadata(): Record<string, unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Set metadata from object
|
|
28
|
+
*/
|
|
29
|
+
setMetadata(data: Record<string, unknown>): void;
|
|
30
|
+
/**
|
|
31
|
+
* Update metadata by merging with existing values
|
|
32
|
+
*/
|
|
33
|
+
updateMetadata(updates: Record<string, unknown>): void;
|
|
34
|
+
/**
|
|
35
|
+
* Get the fact this content link belongs to
|
|
36
|
+
*/
|
|
37
|
+
getFact(): Promise<import('./fact').Fact | null>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=fact-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fact-content.d.ts","sourceRoot":"","sources":["../src/fact-content.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAIL,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAE3E,qBAOa,WAAY,SAAQ,UAAU;IAEzC,MAAM,EAAE,MAAM,CAAM;IAGpB,SAAS,EAAE,MAAM,CAAM;IAGvB,YAAY,EAAE,MAAM,CAAoB;IAGxC,QAAQ,EAAE,MAAM,CAAM;IAGtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAG/B,SAAS,EAAE,IAAI,CAAc;IAE7B,SAAS,EAAE,IAAI,CAAc;gBAEjB,OAAO,GAAE,kBAAuB;IAgB5C;;OAEG;IACH,eAAe,IAAI,uBAAuB;IAI1C;;OAEG;IACH,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAYtC;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIhD;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAKtD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;CAOvD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FactContentCollection — junction collection for Fact ↔ Content links.
|
|
3
|
+
*
|
|
4
|
+
* Generic junction surface (byLeft/byRight/attach/detach/setLinks) comes from
|
|
5
|
+
* `SmrtJunction`. The remaining methods are tenant-scoping helpers.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtJunction } from '@happyvertical/smrt-core';
|
|
8
|
+
import { FactContent } from './fact-content';
|
|
9
|
+
export declare class FactContentCollection extends SmrtJunction<FactContent> {
|
|
10
|
+
static readonly _itemClass: typeof FactContent;
|
|
11
|
+
protected leftField: string;
|
|
12
|
+
protected rightField: string;
|
|
13
|
+
protected sortField: string | null;
|
|
14
|
+
protected positionField: string | null;
|
|
15
|
+
findByTenant(tenantId: string): Promise<FactContent[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Find all global (tenant-less) fact-content links.
|
|
18
|
+
*
|
|
19
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
20
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
21
|
+
* flagged as an isolation violation). (#1600)
|
|
22
|
+
*/
|
|
23
|
+
findGlobal(): Promise<FactContent[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Find fact-content links for a tenant including global links.
|
|
26
|
+
*
|
|
27
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
28
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
29
|
+
*/
|
|
30
|
+
findWithGlobals(tenantId: string): Promise<FactContent[]>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=fact-contents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fact-contents.d.ts","sourceRoot":"","sources":["../src/fact-contents.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAQ,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAO7C,qBACa,qBAAsB,SAAQ,YAAY,CAAC,WAAW,CAAC;IAClE,MAAM,CAAC,QAAQ,CAAC,UAAU,qBAAe;IACzC,SAAS,CAAC,SAAS,SAAY;IAC/B,SAAS,CAAC,UAAU,SAAe;IAEnC,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC1C,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAQ;IAMxC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAI5D;;;;;;OAMG;IACG,UAAU,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAI1C;;;;;OAKG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAOhE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FactEvidence model - specific provenance spans for facts
|
|
3
|
+
*
|
|
4
|
+
* FactSource remains the coarse source summary. FactEvidence records the
|
|
5
|
+
* concrete excerpt/span/artifact that supports a fact.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
8
|
+
import type { FactEvidenceOptions, FactEvidenceStatus } from './types';
|
|
9
|
+
export declare class FactEvidence extends SmrtObject {
|
|
10
|
+
factId: string;
|
|
11
|
+
evidenceKey: string;
|
|
12
|
+
status: FactEvidenceStatus;
|
|
13
|
+
sourceKind: string;
|
|
14
|
+
sourceId: string;
|
|
15
|
+
sourceUrl: string;
|
|
16
|
+
sourceTitle: string;
|
|
17
|
+
quote: string;
|
|
18
|
+
locator: string;
|
|
19
|
+
extractionMethod: string;
|
|
20
|
+
/**
|
|
21
|
+
* Extraction confidence in `[0, 1]`. The `0.0` initializer is load-bearing:
|
|
22
|
+
* SMRT maps `= 0` to INTEGER and `= 0.0` to DECIMAL, so an INTEGER column
|
|
23
|
+
* would truncate every meaningful score to 0 or 1 and PostgreSQL would
|
|
24
|
+
* reject the save outright (`22P02`). Matches `Fact.confidence` and
|
|
25
|
+
* `FactSource.credibility` (#2361).
|
|
26
|
+
*/
|
|
27
|
+
confidence: number;
|
|
28
|
+
metadata: string;
|
|
29
|
+
tenantId: string | null;
|
|
30
|
+
createdAt: Date;
|
|
31
|
+
updatedAt: Date;
|
|
32
|
+
constructor(options?: FactEvidenceOptions);
|
|
33
|
+
getMetadata(): Record<string, unknown>;
|
|
34
|
+
setMetadata(data: Record<string, unknown>): void;
|
|
35
|
+
updateMetadata(updates: Record<string, unknown>): void;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=fact-evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fact-evidence.d.ts","sourceRoot":"","sources":["../src/fact-evidence.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqB,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAE/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAkBvE,qBAQa,YAAa,SAAQ,UAAU;IAE1C,MAAM,EAAE,MAAM,CAAM;IAGpB,WAAW,EAAE,MAAM,CAAM;IAGzB,MAAM,EAAE,kBAAkB,CAAc;IAGxC,UAAU,EAAE,MAAM,CAAM;IAGxB,QAAQ,EAAE,MAAM,CAAM;IAGtB,SAAS,EAAE,MAAM,CAAM;IAGvB,WAAW,EAAE,MAAM,CAAM;IAGzB,KAAK,EAAE,MAAM,CAAM;IAGnB,OAAO,EAAE,MAAM,CAAM;IAGrB,gBAAgB,EAAE,MAAM,CAAM;IAE9B;;;;;;OAMG;IAEH,UAAU,EAAE,MAAM,CAAO;IAGzB,QAAQ,EAAE,MAAM,CAAM;IAGtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAG/B,SAAS,EAAE,IAAI,CAAc;IAG7B,SAAS,EAAE,IAAI,CAAc;gBAEjB,OAAO,GAAE,mBAAwB;IA2B7C,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAYtC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIhD,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAIvD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FactEvidenceCollection - Collection manager for concrete fact evidence.
|
|
3
|
+
*/
|
|
4
|
+
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
5
|
+
import { FactEvidence } from './fact-evidence';
|
|
6
|
+
import type { FactEvidenceOptions, FactEvidenceStatus } from './types';
|
|
7
|
+
export declare function createFactEvidenceKey(input: Pick<FactEvidenceOptions, 'sourceKind' | 'sourceId' | 'sourceUrl' | 'locator' | 'quote'>): string;
|
|
8
|
+
export declare class FactEvidenceCollection extends SmrtCollection<FactEvidence> {
|
|
9
|
+
static readonly _itemClass: typeof FactEvidence;
|
|
10
|
+
getForFact(factId: string): Promise<FactEvidence[]>;
|
|
11
|
+
getForSource(sourceKind: string, sourceId: string): Promise<FactEvidence[]>;
|
|
12
|
+
getForSources(sources: Array<{
|
|
13
|
+
sourceKind: string;
|
|
14
|
+
sourceId: string;
|
|
15
|
+
}>): Promise<FactEvidence[]>;
|
|
16
|
+
bulkUpdateStatus(evidenceIds: string[], status: FactEvidenceStatus, options?: {
|
|
17
|
+
reason?: string;
|
|
18
|
+
reviewedBy?: string | null;
|
|
19
|
+
}): Promise<FactEvidence[]>;
|
|
20
|
+
replaceGeneratedForSources(sources: Array<{
|
|
21
|
+
sourceKind: string;
|
|
22
|
+
sourceId: string;
|
|
23
|
+
}>, options?: {
|
|
24
|
+
generatedBy?: string;
|
|
25
|
+
contentId?: string;
|
|
26
|
+
tenantId?: string | null;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
deletedEvidenceIds: string[];
|
|
29
|
+
}>;
|
|
30
|
+
upsertEvidence(options: FactEvidenceOptions): Promise<FactEvidence>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=fact-evidences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fact-evidences.d.ts","sourceRoot":"","sources":["../src/fact-evidences.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAuCvE,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,IAAI,CACT,mBAAmB,EACnB,YAAY,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAC9D,GACA,MAAM,CAUR;AAED,qBAAa,sBAAuB,SAAQ,cAAc,CAAC,YAAY,CAAC;IACtE,MAAM,CAAC,QAAQ,CAAC,UAAU,sBAAgB;IAEpC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAInD,YAAY,CAChB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,EAAE,CAAC;IAOpB,aAAa,CACjB,OAAO,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,GACvD,OAAO,CAAC,YAAY,EAAE,CAAC;IAoBpB,gBAAgB,CACpB,WAAW,EAAE,MAAM,EAAE,EACrB,MAAM,EAAE,kBAAkB,EAC1B,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAO,GAC5D,OAAO,CAAC,YAAY,EAAE,CAAC;IAwBpB,0BAA0B,CAC9B,OAAO,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,EACxD,OAAO,GAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACrB,GACL,OAAO,CAAC;QAAE,kBAAkB,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IA4DtC,cAAc,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC;CA2C1E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FactSource model - Provenance tracking for facts
|
|
3
|
+
*
|
|
4
|
+
* Records where a fact came from, including source URL, type,
|
|
5
|
+
* credibility, and extraction timestamp.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
8
|
+
import type { FactSourceOptions } from './types';
|
|
9
|
+
export declare class FactSource extends SmrtObject {
|
|
10
|
+
factId: string;
|
|
11
|
+
sourceType: string;
|
|
12
|
+
sourceUrl: string;
|
|
13
|
+
sourceTitle: string;
|
|
14
|
+
credibility: number;
|
|
15
|
+
extractedAt: Date;
|
|
16
|
+
metadata: string;
|
|
17
|
+
tenantId: string | null;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
updatedAt: Date;
|
|
20
|
+
constructor(options?: FactSourceOptions);
|
|
21
|
+
getMetadata(): Record<string, unknown>;
|
|
22
|
+
setMetadata(data: Record<string, unknown>): void;
|
|
23
|
+
updateMetadata(updates: Record<string, unknown>): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get the fact this source belongs to
|
|
26
|
+
*/
|
|
27
|
+
getFact(): Promise<import('./fact').Fact | null>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=fact-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fact-source.d.ts","sourceRoot":"","sources":["../src/fact-source.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqB,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAE/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,qBAOa,UAAW,SAAQ,UAAU;IAExC,MAAM,EAAE,MAAM,CAAM;IAGpB,UAAU,EAAE,MAAM,CAAM;IAExB,SAAS,EAAE,MAAM,CAAM;IAEvB,WAAW,EAAE,MAAM,CAAM;IAEzB,WAAW,EAAE,MAAM,CAAO;IAE1B,WAAW,EAAE,IAAI,CAAc;IAE/B,QAAQ,EAAE,MAAM,CAAM;IAGtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAG/B,SAAS,EAAE,IAAI,CAAc;IAE7B,SAAS,EAAE,IAAI,CAAc;gBAEjB,OAAO,GAAE,iBAAsB;IAoB3C,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAYtC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIhD,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAKtD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;CAOvD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FactSourceCollection - Collection manager for FactSource objects
|
|
3
|
+
*
|
|
4
|
+
* Provides queries for sources by fact, type, and credibility.
|
|
5
|
+
*/
|
|
6
|
+
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
7
|
+
import { FactSource } from './fact-source';
|
|
8
|
+
export declare class FactSourceCollection extends SmrtCollection<FactSource> {
|
|
9
|
+
static readonly _itemClass: typeof FactSource;
|
|
10
|
+
/**
|
|
11
|
+
* Get all sources for a given fact
|
|
12
|
+
*/
|
|
13
|
+
getForFact(factId: string): Promise<FactSource[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Count sources for a given fact
|
|
16
|
+
*/
|
|
17
|
+
countForFact(factId: string): Promise<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Get sources by type
|
|
20
|
+
*/
|
|
21
|
+
getByType(sourceType: string): Promise<FactSource[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Get sources with credibility above a threshold
|
|
24
|
+
*/
|
|
25
|
+
getHighCredibility(minCredibility?: number): Promise<FactSource[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Get average credibility for a fact's sources
|
|
28
|
+
*/
|
|
29
|
+
getAverageCredibility(factId: string): Promise<number>;
|
|
30
|
+
/**
|
|
31
|
+
* Find all sources belonging to a specific tenant
|
|
32
|
+
*/
|
|
33
|
+
findByTenant(tenantId: string): Promise<FactSource[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Find all global (tenant-less) sources.
|
|
36
|
+
*
|
|
37
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
38
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
39
|
+
* flagged as an isolation violation). (#1600)
|
|
40
|
+
*/
|
|
41
|
+
findGlobal(): Promise<FactSource[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Find sources for a tenant including global sources.
|
|
44
|
+
*
|
|
45
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
46
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
47
|
+
*/
|
|
48
|
+
findWithGlobals(tenantId: string): Promise<FactSource[]>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=fact-sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fact-sources.d.ts","sourceRoot":"","sources":["../src/fact-sources.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,qBAAa,oBAAqB,SAAQ,cAAc,CAAC,UAAU,CAAC;IAClE,MAAM,CAAC,QAAQ,CAAC,UAAU,oBAAc;IAExC;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAIvD;;OAEG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKnD;;OAEG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAI1D;;OAEG;IACG,kBAAkB,CACtB,cAAc,GAAE,MAAY,GAC3B,OAAO,CAAC,UAAU,EAAE,CAAC;IAIxB;;OAEG;IACG,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAW5D;;OAEG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAI3D;;;;;;OAMG;IACG,UAAU,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAIzC;;;;;OAKG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CAO/D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FactSubject model - Polymorphic entity linking for facts
|
|
3
|
+
*
|
|
4
|
+
* Links facts to any entity type (profiles, places, events, etc.)
|
|
5
|
+
* using polymorphic entityType + entityId with role classification.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
8
|
+
import type { FactSubjectOptions, SubjectRole } from './types';
|
|
9
|
+
export declare class FactSubject extends SmrtObject {
|
|
10
|
+
factId: string;
|
|
11
|
+
entityType: string;
|
|
12
|
+
entityId: string;
|
|
13
|
+
role: string;
|
|
14
|
+
metadata: string;
|
|
15
|
+
tenantId: string | null;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
updatedAt: Date;
|
|
18
|
+
constructor(options?: FactSubjectOptions);
|
|
19
|
+
getRole(): SubjectRole;
|
|
20
|
+
getMetadata(): Record<string, unknown>;
|
|
21
|
+
setMetadata(data: Record<string, unknown>): void;
|
|
22
|
+
updateMetadata(updates: Record<string, unknown>): void;
|
|
23
|
+
/**
|
|
24
|
+
* Get the fact this subject is linked to
|
|
25
|
+
*/
|
|
26
|
+
getFact(): Promise<import('./fact').Fact | null>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=fact-subject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fact-subject.d.ts","sourceRoot":"","sources":["../src/fact-subject.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqB,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAE/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE/D,qBAOa,WAAY,SAAQ,UAAU;IAEzC,MAAM,EAAE,MAAM,CAAM;IAGpB,UAAU,EAAE,MAAM,CAAM;IAGxB,QAAQ,EAAE,MAAM,CAAM;IAGtB,IAAI,EAAE,MAAM,CAAa;IAEzB,QAAQ,EAAE,MAAM,CAAM;IAGtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAG/B,SAAS,EAAE,IAAI,CAAc;IAE7B,SAAS,EAAE,IAAI,CAAc;gBAEjB,OAAO,GAAE,kBAAuB;IAgB5C,OAAO,IAAI,WAAW;IAItB,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAYtC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIhD,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAKtD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;CAOvD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FactSubjectCollection - Collection manager for FactSubject objects
|
|
3
|
+
*
|
|
4
|
+
* Provides queries for polymorphic entity linking, including
|
|
5
|
+
* link/unlink operations and entity-centric lookups.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
8
|
+
import { FactSubject } from './fact-subject';
|
|
9
|
+
import type { SubjectRole } from './types';
|
|
10
|
+
export declare class FactSubjectCollection extends SmrtCollection<FactSubject> {
|
|
11
|
+
static readonly _itemClass: typeof FactSubject;
|
|
12
|
+
/**
|
|
13
|
+
* Get all subjects linked to a fact
|
|
14
|
+
*/
|
|
15
|
+
getForFact(factId: string): Promise<FactSubject[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Get all fact-subject links for a given entity
|
|
18
|
+
*/
|
|
19
|
+
getForEntity(entityType: string, entityId: string): Promise<FactSubject[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Link an entity to a fact
|
|
22
|
+
*/
|
|
23
|
+
linkEntity(factId: string, entityType: string, entityId: string, role?: SubjectRole): Promise<FactSubject>;
|
|
24
|
+
/**
|
|
25
|
+
* Unlink an entity from a fact
|
|
26
|
+
*/
|
|
27
|
+
unlinkEntity(factId: string, entityType: string, entityId: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Get subjects by role for a fact
|
|
30
|
+
*/
|
|
31
|
+
getByRole(factId: string, role: SubjectRole): Promise<FactSubject[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Count entities linked to a fact
|
|
34
|
+
*/
|
|
35
|
+
countForFact(factId: string): Promise<number>;
|
|
36
|
+
/**
|
|
37
|
+
* Find all subjects belonging to a specific tenant
|
|
38
|
+
*/
|
|
39
|
+
findByTenant(tenantId: string): Promise<FactSubject[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Find all global (tenant-less) subjects.
|
|
42
|
+
*
|
|
43
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
44
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
45
|
+
* flagged as an isolation violation). (#1600)
|
|
46
|
+
*/
|
|
47
|
+
findGlobal(): Promise<FactSubject[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Find subjects for a tenant including global subjects.
|
|
50
|
+
*
|
|
51
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
52
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
53
|
+
*/
|
|
54
|
+
findWithGlobals(tenantId: string): Promise<FactSubject[]>;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=fact-subjects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fact-subjects.d.ts","sourceRoot":"","sources":["../src/fact-subjects.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,qBAAa,qBAAsB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACpE,MAAM,CAAC,QAAQ,CAAC,UAAU,qBAAe;IAEzC;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAIxD;;OAEG;IACG,YAAY,CAChB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,WAAW,EAAE,CAAC;IAIzB;;OAEG;IACG,UAAU,CACd,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,WAAuB,GAC5B,OAAO,CAAC,WAAW,CAAC;IASvB;;OAEG;IACG,YAAY,CAChB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAShB;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAI1E;;OAEG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IASnD;;OAEG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAI5D;;;;;;OAMG;IACG,UAAU,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAI1C;;;;;OAKG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAOhE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FactTag model - Join table between facts and tags
|
|
3
|
+
*
|
|
4
|
+
* Links facts to tags via tag slug (not tag ID),
|
|
5
|
+
* enabling categorization and discovery of facts.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
8
|
+
import type { FactTagOptions } from './types';
|
|
9
|
+
export declare class FactTag extends SmrtObject {
|
|
10
|
+
factId: string;
|
|
11
|
+
tagSlug: string;
|
|
12
|
+
metadata: string;
|
|
13
|
+
tenantId: string | null;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
updatedAt: Date;
|
|
16
|
+
constructor(options?: FactTagOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Get metadata as parsed object
|
|
19
|
+
*/
|
|
20
|
+
getMetadata(): Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Set metadata from object
|
|
23
|
+
*/
|
|
24
|
+
setMetadata(data: Record<string, unknown>): void;
|
|
25
|
+
/**
|
|
26
|
+
* Update metadata by merging with existing values
|
|
27
|
+
*/
|
|
28
|
+
updateMetadata(updates: Record<string, unknown>): void;
|
|
29
|
+
/**
|
|
30
|
+
* Get the fact this tag link belongs to
|
|
31
|
+
*/
|
|
32
|
+
getFact(): Promise<import('./fact').Fact | null>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=fact-tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fact-tag.d.ts","sourceRoot":"","sources":["../src/fact-tag.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqB,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAE/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,qBAOa,OAAQ,SAAQ,UAAU;IAErC,MAAM,EAAE,MAAM,CAAM;IAGpB,OAAO,EAAE,MAAM,CAAM;IAGrB,QAAQ,EAAE,MAAM,CAAM;IAGtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAG/B,SAAS,EAAE,IAAI,CAAc;IAE7B,SAAS,EAAE,IAAI,CAAc;gBAEjB,OAAO,GAAE,cAAmB;IAcxC;;OAEG;IACH,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAYtC;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIhD;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAKtD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;CAOvD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FactTagCollection - Collection manager for FactTag objects
|
|
3
|
+
*
|
|
4
|
+
* Provides queries for fact-tag links, including
|
|
5
|
+
* add/remove operations and tag-centric lookups.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
8
|
+
import { FactTag } from './fact-tag';
|
|
9
|
+
export declare class FactTagCollection extends SmrtCollection<FactTag> {
|
|
10
|
+
static readonly _itemClass: typeof FactTag;
|
|
11
|
+
/**
|
|
12
|
+
* Get all tag links for a fact
|
|
13
|
+
*/
|
|
14
|
+
getForFact(factId: string): Promise<FactTag[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Get all fact links for a tag slug
|
|
17
|
+
*/
|
|
18
|
+
getForTag(tagSlug: string): Promise<FactTag[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Add a tag to a fact
|
|
21
|
+
*/
|
|
22
|
+
addTag(factId: string, tagSlug: string): Promise<FactTag>;
|
|
23
|
+
/**
|
|
24
|
+
* Remove a tag from a fact
|
|
25
|
+
*/
|
|
26
|
+
removeTag(factId: string, tagSlug: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Get all tag slugs for a fact
|
|
29
|
+
*/
|
|
30
|
+
getTagSlugs(factId: string): Promise<string[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Find all fact-tag links belonging to a specific tenant
|
|
33
|
+
*/
|
|
34
|
+
findByTenant(tenantId: string): Promise<FactTag[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Find all global (tenant-less) fact-tag links.
|
|
37
|
+
*
|
|
38
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
39
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
40
|
+
* flagged as an isolation violation). (#1600)
|
|
41
|
+
*/
|
|
42
|
+
findGlobal(): Promise<FactTag[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Find fact-tag links for a tenant including global links.
|
|
45
|
+
*
|
|
46
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
47
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
48
|
+
*/
|
|
49
|
+
findWithGlobals(tenantId: string): Promise<FactTag[]>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=fact-tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fact-tags.d.ts","sourceRoot":"","sources":["../src/fact-tags.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,OAAO,CAAC;IAC5D,MAAM,CAAC,QAAQ,CAAC,UAAU,iBAAW;IAErC;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAIpD;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAIpD;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAO/D;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS/D;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IASpD;;OAEG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAIxD;;;;;;OAMG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAItC;;;;;OAKG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAG5D"}
|
package/dist/fact.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fact model - Atomic knowledge unit with provenance tracking
|
|
3
|
+
*
|
|
4
|
+
* Core entity for distributed memory. Facts represent individual pieces
|
|
5
|
+
* of knowledge with semantic embeddings for similarity search, evolution
|
|
6
|
+
* tracking via previousFactId (self-referencing chain: original →
|
|
7
|
+
* correction/contradiction/refinement), and confidence scoring.
|
|
8
|
+
*
|
|
9
|
+
* Note: this is an evolution chain, not a structural hierarchy. Fact
|
|
10
|
+
* deliberately does NOT extend SmrtHierarchical — `parentId` is reserved
|
|
11
|
+
* for true structural hierarchy (Place, Event, Tag, Account, Zone). See
|
|
12
|
+
* R3-C in the relationships-v2 release for the rationale behind the
|
|
13
|
+
* semantic distinction.
|
|
14
|
+
*/
|
|
15
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
16
|
+
import type { EvolutionType, FactMetadata, FactOptions, FactStatus, FactType } from './types';
|
|
17
|
+
export declare class Fact extends SmrtObject {
|
|
18
|
+
textRefined: string;
|
|
19
|
+
textRaw: string;
|
|
20
|
+
/** Derived search storage. NULL requires the explicit catalog backfill. */
|
|
21
|
+
catalogSearch: string | null;
|
|
22
|
+
type: string;
|
|
23
|
+
status: string;
|
|
24
|
+
domain: string;
|
|
25
|
+
/**
|
|
26
|
+
* Self-referencing pointer to the predecessor fact in an evolution chain.
|
|
27
|
+
*
|
|
28
|
+
* This is NOT a structural hierarchy edge — Fact does not extend
|
|
29
|
+
* SmrtHierarchical. The chain represents knowledge evolution: an original
|
|
30
|
+
* fact, then corrections, refinements, contradictions, or extensions of
|
|
31
|
+
* that fact. See `evolutionType` for the kind of step.
|
|
32
|
+
*/
|
|
33
|
+
previousFactId: string;
|
|
34
|
+
evolutionType: string;
|
|
35
|
+
sourceCount: number;
|
|
36
|
+
confidence: number;
|
|
37
|
+
metadata: string;
|
|
38
|
+
tenantId: string | null;
|
|
39
|
+
createdAt: Date;
|
|
40
|
+
updatedAt: Date;
|
|
41
|
+
constructor(options?: FactOptions);
|
|
42
|
+
protected getPersistenceDerivedColumns(): readonly string[];
|
|
43
|
+
protected normalizePersistenceData(data: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
44
|
+
getMetadata(): FactMetadata;
|
|
45
|
+
setMetadata(data: FactMetadata): void;
|
|
46
|
+
updateMetadata(updates: Partial<FactMetadata>): void;
|
|
47
|
+
getType(): FactType;
|
|
48
|
+
getStatus(): FactStatus;
|
|
49
|
+
getEvolutionType(): EvolutionType;
|
|
50
|
+
isActive(): boolean;
|
|
51
|
+
isSuperseded(): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether this fact has a predecessor in the evolution chain.
|
|
54
|
+
*
|
|
55
|
+
* Returns false for the framework default (`''`) and for any nullish
|
|
56
|
+
* value — defensive against rows whose `previous_fact_id` column is
|
|
57
|
+
* NULL (e.g. after a migration that left root facts un-backfilled).
|
|
58
|
+
*/
|
|
59
|
+
hasPredecessor(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Get the predecessor fact (the prior version in the evolution chain).
|
|
62
|
+
*/
|
|
63
|
+
getPredecessor(): Promise<Fact | null>;
|
|
64
|
+
/**
|
|
65
|
+
* Get successor facts (facts that evolved directly from this one).
|
|
66
|
+
*/
|
|
67
|
+
getSuccessors(): Promise<Fact[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Get all sources for this fact
|
|
70
|
+
*/
|
|
71
|
+
getSources(): Promise<import('./fact-source').FactSource[]>;
|
|
72
|
+
/**
|
|
73
|
+
* Get all subjects linked to this fact
|
|
74
|
+
*/
|
|
75
|
+
getSubjects(): Promise<import('./fact-subject').FactSubject[]>;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=fact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fact.d.ts","sourceRoot":"","sources":["../src/fact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAqB,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAG/E,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,WAAW,EACX,UAAU,EACV,QAAQ,EACT,MAAM,SAAS,CAAC;AAWjB,qBAgBa,IAAK,SAAQ,UAAU;IAElC,WAAW,EAAE,MAAM,CAAM;IAGzB,OAAO,EAAE,MAAM,CAAM;IAErB,2EAA2E;IAE3E,aAAa,EAAE,MAAM,GAAG,IAAI,CAAQ;IAGpC,IAAI,EAAE,MAAM,CAAe;IAG3B,MAAM,EAAE,MAAM,CAAa;IAG3B,MAAM,EAAE,MAAM,CAAM;IAEpB;;;;;;;OAOG;IAEH,cAAc,EAAE,MAAM,CAAM;IAG5B,aAAa,EAAE,MAAM,CAAc;IAGnC,WAAW,EAAE,MAAM,CAAK;IAGxB,UAAU,EAAE,MAAM,CAAO;IAGzB,QAAQ,EAAE,MAAM,CAAM;IAGtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAG/B,SAAS,EAAE,IAAI,CAAc;IAE7B,SAAS,EAAE,IAAI,CAAc;gBAEjB,OAAO,GAAE,WAAgB;cAwBlB,4BAA4B,IAAI,SAAS,MAAM,EAAE;cAIjD,wBAAwB,CACzC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACtC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAc1B,WAAW,IAAI,YAAY;IAW3B,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAIrC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI;IAMpD,OAAO,IAAI,QAAQ;IAInB,SAAS,IAAI,UAAU;IAIvB,gBAAgB,IAAI,aAAa;IAIjC,QAAQ,IAAI,OAAO;IAInB,YAAY,IAAI,OAAO;IAIvB;;;;;;OAMG;IACH,cAAc,IAAI,OAAO;IAIzB;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAQ5C;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAMtC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,eAAe,EAAE,UAAU,EAAE,CAAC;IAMjE;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,gBAAgB,EAAE,WAAW,EAAE,CAAC;CAKrE"}
|