@agentbadge/database 0.2.0 → 0.4.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.
@@ -1,4 +1,6 @@
1
1
  import { type PrismaDb } from "./repositories/event-repository.js";
2
+ import { AgentWalletRepository } from "./repositories/agent-wallet-repository.js";
3
+ import { SpendLedgerRepository } from "./repositories/spend-ledger-repository.js";
2
4
  import { type ChatSubscriptionStore, type ScanResultStore, type Store } from "./store.js";
3
5
  export interface DatabaseConfig {
4
6
  url?: string;
@@ -9,6 +11,8 @@ export interface Database {
9
11
  events: Store;
10
12
  scanResults: ScanResultStore;
11
13
  chatSubscriptions: ChatSubscriptionStore;
14
+ agentWallets: AgentWalletRepository | null;
15
+ spendLedger: SpendLedgerRepository | null;
12
16
  health(): Promise<boolean>;
13
17
  close(): Promise<void>;
14
18
  }
package/dist/database.js CHANGED
@@ -3,6 +3,8 @@ import contractJson from "./prisma/contract.json" with { type: "json" };
3
3
  import { EventRepository } from "./repositories/event-repository.js";
4
4
  import { ScanResultRepository } from "./repositories/scan-result-repository.js";
5
5
  import { ChatSubscriptionRepository } from "./repositories/chat-subscription-repository.js";
6
+ import { AgentWalletRepository } from "./repositories/agent-wallet-repository.js";
7
+ import { SpendLedgerRepository } from "./repositories/spend-ledger-repository.js";
6
8
  import { InMemoryChatSubscriptionStore, InMemoryScanResultStore, InMemoryStore, } from "./store.js";
7
9
  export function createDatabase(config) {
8
10
  const enabled = config.enabled !== false && Boolean(config.url);
@@ -13,6 +15,8 @@ export function createDatabase(config) {
13
15
  events,
14
16
  scanResults: new InMemoryScanResultStore(),
15
17
  chatSubscriptions: new InMemoryChatSubscriptionStore(),
18
+ agentWallets: null,
19
+ spendLedger: null,
16
20
  health: () => Promise.resolve(false),
17
21
  close: () => Promise.resolve(),
18
22
  };
@@ -23,6 +27,8 @@ export function createDatabase(config) {
23
27
  events: new EventRepository(db),
24
28
  scanResults: new ScanResultRepository(db),
25
29
  chatSubscriptions: new ChatSubscriptionRepository(db),
30
+ agentWallets: new AgentWalletRepository(db),
31
+ spendLedger: new SpendLedgerRepository(db),
26
32
  health: async () => {
27
33
  try {
28
34
  const plan = db.raw.sql `SELECT 1 AS health`.returnsRow({ health: "pg/int4@1" }).build();
package/dist/index.d.ts CHANGED
@@ -9,4 +9,10 @@ export type { ChatSubscription, ChatSubscriptionCreate, ChatSubscriptionStore, C
9
9
  export { EventRepository } from "./repositories/event-repository.js";
10
10
  export { ScanResultRepository } from "./repositories/scan-result-repository.js";
11
11
  export { ChatSubscriptionRepository } from "./repositories/chat-subscription-repository.js";
12
+ export { VenueRepository } from "./repositories/venue-repository.js";
13
+ export type { VenueJobUpsert, VenueOfferUpsert, } from "./repositories/venue-repository.js";
14
+ export { AgentWalletRepository } from "./repositories/agent-wallet-repository.js";
15
+ export type { AgentWalletUpsert } from "./repositories/agent-wallet-repository.js";
16
+ export { SpendLedgerRepository } from "./repositories/spend-ledger-repository.js";
17
+ export type { SpendEventInsert } from "./repositories/spend-ledger-repository.js";
12
18
  export type { PrismaDb } from "./repositories/event-repository.js";
package/dist/index.js CHANGED
@@ -6,3 +6,6 @@ export { InMemoryChatSubscriptionStore, InMemoryScanResultStore, InMemoryStore,
6
6
  export { EventRepository } from "./repositories/event-repository.js";
7
7
  export { ScanResultRepository } from "./repositories/scan-result-repository.js";
8
8
  export { ChatSubscriptionRepository } from "./repositories/chat-subscription-repository.js";
9
+ export { VenueRepository } from "./repositories/venue-repository.js";
10
+ export { AgentWalletRepository } from "./repositories/agent-wallet-repository.js";
11
+ export { SpendLedgerRepository } from "./repositories/spend-ledger-repository.js";