UNPKG

@eristack/qups

Version:

Quantity / unit price / subtotal (QUPS) with 2-of-3 sources of truth, plus modifiers and tax — business line pricing on @eristack/money

30 lines • 1.61 kB
import { PricingLine } from "./line.js"; import type { PricingField, PricingLineRecord, PricingLineStore, PricingProfile, PricingProfileStore, RegisterProfileInput, SaveLineInput, UpdateProfileInput } from "./stores/types.js"; import type { QupsTruthMode } from "./qups.js"; export interface CreateQupsOptions { profiles?: PricingProfileStore; lines?: PricingLineStore; clock?: () => Date; idFactory?: () => string; } export interface QupsApi { registerProfile(input: RegisterProfileInput): Promise<PricingProfile>; updateProfile(input: UpdateProfileInput): Promise<PricingProfile>; getProfile(entityKey: string): Promise<PricingProfile | null>; getProfileById(id: string): Promise<PricingProfile | null>; listProfiles(entityKey: string): Promise<PricingProfile[]>; saveLine(input: SaveLineInput): Promise<PricingLineRecord>; getLine(id: string): Promise<PricingLineRecord | null>; listLines(ownerKey: string): Promise<PricingLineRecord[]>; deleteLine(id: string): Promise<void>; hydrateLine(record: PricingLineRecord): PricingLine; /** Headless map of field key → { value, currency? } for forms/APIs. */ lineFields(record: PricingLineRecord): Record<string, { value: string; currency?: string; }>; fieldsFor(truth: QupsTruthMode, profile?: PricingProfile | null): Omit<PricingField, "id" | "profileId">[]; editableKeys(fields: readonly Pick<PricingField, "key" | "enabled" | "role">[]): string[]; } export declare function createQups(options?: CreateQupsOptions): QupsApi; //# sourceMappingURL=create-qups.d.ts.map