@fiderail/db 0.0.0-stage → 2.3.1
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/LICENSE +21 -0
- package/README.md +50 -2
- package/dist/baseline.d.ts +4 -0
- package/dist/baseline.js +152 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +28 -0
- package/dist/migrate-cli.d.ts +3 -0
- package/dist/migrate-cli.js +45 -0
- package/dist/migrate-sqlite-to-pg.d.ts +44 -0
- package/dist/migrate-sqlite-to-pg.js +339 -0
- package/dist/postgres-repo.d.ts +47 -0
- package/dist/postgres-repo.js +1138 -0
- package/dist/sqlite-repo.d.ts +32 -0
- package/dist/sqlite-repo.js +1241 -0
- package/dist/state-root-signer.d.ts +33 -0
- package/dist/state-root-signer.js +81 -0
- package/package.json +56 -4
- package/sql/001_init_v2.sql +231 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DatabaseSync } from "node:sqlite";
|
|
2
|
+
import { type ChainKey } from "@fiderail/spec";
|
|
3
|
+
import { type AgentTrustProfile, type FideRailRepository, type RepositoryStats } from "@fiderail/core";
|
|
4
|
+
export type SqliteRepositoryStats = RepositoryStats & {
|
|
5
|
+
moderateTrustProfiles: number;
|
|
6
|
+
earliestPaymentAt: string | null;
|
|
7
|
+
};
|
|
8
|
+
export interface SqlitePayerActivitySummary {
|
|
9
|
+
chain: ChainKey;
|
|
10
|
+
address: string;
|
|
11
|
+
txCount: number;
|
|
12
|
+
distinctPayees: number;
|
|
13
|
+
totalUsd: number;
|
|
14
|
+
firstSeenAt: string | null;
|
|
15
|
+
lastSeenAt: string | null;
|
|
16
|
+
activeUtcDays: number;
|
|
17
|
+
hasReciprocalLoop: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface SqliteRepositoryInstance extends FideRailRepository {
|
|
20
|
+
readonly dbPath: string;
|
|
21
|
+
readonly rawDb: DatabaseSync;
|
|
22
|
+
getStats(): Promise<SqliteRepositoryStats>;
|
|
23
|
+
getPayerActivity(chain: ChainKey, address: string): Promise<SqlitePayerActivitySummary | null>;
|
|
24
|
+
listChainProfiles(chain: ChainKey): Promise<AgentTrustProfile[]>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Opens or initializes a SQLite WAL repository using Node's built-in `node:sqlite`.
|
|
28
|
+
* Preserves online schema upgrade compatibility with existing SQLite databases, eliminates
|
|
29
|
+
* full-table-scan single-address lookups, and streams recomputation via `stmt.iterate()`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function openSqliteRepository(dbPath: string): SqliteRepositoryInstance;
|
|
32
|
+
//# sourceMappingURL=sqlite-repo.d.ts.map
|