ConusAI vendor v0.1.0-beta.114
ci / gate (push) Waiting to run

This commit is contained in:
ConusAI vendor v0.1.0-beta.114
2026-11-14 09:56:45 +00:00
commit 1ce8d23c35
867 changed files with 122104 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
import { token } from "@conusai-kit/core"
import type {
AccountView,
BalanceView,
EntryView,
RecordTerms,
TransactionView,
VerificationView,
} from "../contract/index.js"
export interface Page<T> {
rows: T[]
after?: string
}
export interface LedgerReads {
accounts(after?: string): Promise<Page<AccountView>>
account(id: string): Promise<AccountView>
balances(accountId?: string, after?: string): Promise<Page<BalanceView>>
entries(accountId: string, after?: string): Promise<Page<EntryView>>
transactions(after?: string): Promise<Page<TransactionView>>
transaction(id: string): Promise<TransactionView>
verify(): Promise<VerificationView>
}
export interface LedgerService extends LedgerReads {
createAccount(input: Omit<AccountView, "accountId" | "revision" | "status">, key: string): Promise<AccountView>
updateAccount(
id: string,
input: Pick<AccountView, "name" | "status" | "allowNegative">,
revision: string,
key: string,
): Promise<AccountView>
record(terms: RecordTerms, key: string): Promise<TransactionView>
transition(action: "post" | "void" | "reverse", id: string, revision: string, key: string): Promise<TransactionView>
}
export const readsOf = (service: LedgerReads): LedgerReads => ({
accounts: (after) => service.accounts(after),
account: (id) => service.account(id),
balances: (id, after) => service.balances(id, after),
entries: (id, after) => service.entries(id, after),
transactions: (after) => service.transactions(after),
transaction: (id) => service.transaction(id),
verify: () => service.verify(),
})
export const LEDGER_SERVICE = token<LedgerService>("ledger.service", { views: { read: readsOf, write: readsOf } })