Automate issuer overlay creation from ticker searches

This commit is contained in:
2026-03-19 20:44:58 -04:00
parent 17de3dd72d
commit 391d6d34ce
79 changed files with 4746 additions and 695 deletions

View File

@@ -1,7 +1,7 @@
import type { Database } from 'bun:sqlite';
export type FinancialSchemaRepairMode = 'auto' | 'check-only' | 'off';
export type FinancialIngestionHealthMode = 'healthy' | 'repaired' | 'drifted' | 'failed';
type FinancialSchemaRepairMode = 'auto' | 'check-only' | 'off';
type FinancialIngestionHealthMode = 'healthy' | 'repaired' | 'drifted' | 'failed';
type CriticalIndexDefinition = {
name: string;
@@ -16,7 +16,7 @@ type DuplicateRule = {
partitionColumns: string[];
};
export type FinancialIngestionIndexStatus = {
type FinancialIngestionIndexStatus = {
name: string;
table: string;
expectedColumns: string[];
@@ -26,13 +26,13 @@ export type FinancialIngestionIndexStatus = {
healthy: boolean;
};
export type FinancialIngestionDuplicateStatus = {
type FinancialIngestionDuplicateStatus = {
table: string;
duplicateGroups: number;
duplicateRows: number;
};
export type FinancialIngestionSchemaReport = {
type FinancialIngestionSchemaReport = {
ok: boolean;
checkedAt: string;
indexes: FinancialIngestionIndexStatus[];
@@ -42,7 +42,7 @@ export type FinancialIngestionSchemaReport = {
duplicates: FinancialIngestionDuplicateStatus[];
};
export type FinancialIngestionSchemaRepairResult = {
type FinancialIngestionSchemaRepairResult = {
attempted: boolean;
requestedMode: FinancialSchemaRepairMode;
missingIndexesBefore: string[];
@@ -56,7 +56,7 @@ export type FinancialIngestionSchemaRepairResult = {
reportAfter: FinancialIngestionSchemaReport;
};
export type FinancialIngestionSchemaEnsureResult = {
type FinancialIngestionSchemaEnsureResult = {
ok: boolean;
mode: FinancialIngestionHealthMode;
requestedMode: FinancialSchemaRepairMode;
@@ -317,7 +317,7 @@ function createOrRecreateIndex(client: Database, definition: CriticalIndexDefini
client.exec(definition.createSql);
}
export function repairFinancialIngestionSchema(
function repairFinancialIngestionSchema(
client: Database,
options: {
mode?: FinancialSchemaRepairMode;
@@ -496,7 +496,7 @@ export function ensureFinancialIngestionSchemaHealthy(
}
}
export function isMissingOnConflictConstraintError(error: unknown) {
function isMissingOnConflictConstraintError(error: unknown) {
return error instanceof Error
&& error.message.toLowerCase().includes('on conflict clause does not match any primary key or unique constraint');
}
@@ -529,7 +529,7 @@ export async function withFinancialIngestionSchemaRetry<T>(input: {
}
}
export const __financialIngestionSchemaInternals = {
const __financialIngestionSchemaInternals = {
CRITICAL_INDEX_DEFINITIONS,
UNIQUE_DUPLICATE_RULES,
clearBundleCache,