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
+36
View File
@@ -0,0 +1,36 @@
// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
import { token } from "@conusai-kit/core"
import type { InvoiceTerms, InvoiceView, SeriesView } from "../contract/index.js"
export interface Page<T> {
rows: T[]
after?: string
}
export interface InvoicingReads {
list(after?: string): Promise<Page<InvoiceView>>
get(id: string): Promise<InvoiceView>
series(after?: string): Promise<Page<SeriesView>>
ubl(id: string): Promise<{ filename: string; xml: string }>
}
export interface InvoicingService extends InvoicingReads {
draft(data: InvoiceTerms, key: string): Promise<InvoiceView>
update(id: string, data: InvoiceTerms, revision: string, key: string): Promise<InvoiceView>
transition(
operation: "issue" | "credit" | "void",
input: { invoiceId: string; expectedVersion: string; key: string; seriesId?: string; reason?: string },
): Promise<InvoiceView>
createSeries(input: {
code: string
prefix: string
kind: "invoice" | "credit_note"
key: string
}): Promise<SeriesView>
}
export const readsOf = (service: InvoicingReads): InvoicingReads => ({
list: (after) => service.list(after),
get: (id) => service.get(id),
series: (after) => service.series(after),
ubl: (id) => service.ubl(id),
})
export const INVOICING_SERVICE = token<InvoicingService>("invoicing.service", {
views: { read: readsOf, write: readsOf },
})