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

36 lines • 1.71 kB
import type { QupsTruthMode } from "../qups.js"; import type { BuiltinPricingFieldKey, PricingField, PricingFieldKind } from "./types.js"; /** Which of Q / UP / S are sources of truth vs derived for a given mode. */ export declare function qupsRolesFor(truth: QupsTruthMode): Record<"quantity" | "unit_price" | "subtotal", "source" | "derived">; type FieldSeed = Omit<PricingField, "id" | "profileId">; export declare function isBuiltinFieldKey(key: string): key is BuiltinPricingFieldKey; /** * Build a headless field catalog from a truth mode. * Money fields are first-class (`unit_price`, `subtotal`) — one shared `currency` * column plus `*_amount` SQL columns, not separate catalog entries. */ export declare function fieldsForTruth(truth: QupsTruthMode, options?: { includeModifiers?: boolean; includeTax?: boolean; includeNetGross?: boolean; includeTotal?: boolean; extras?: readonly { key: string; label?: string; kind?: PricingFieldKind; required?: boolean; }[]; }): FieldSeed[]; /** Re-apply QUPS source/derived roles after a truth change; keep customs as-is. */ export declare function syncFieldRoles(fields: readonly FieldSeed[], truth: QupsTruthMode): FieldSeed[]; export declare function editableFieldKeys(fields: readonly Pick<PricingField, "key" | "enabled" | "role">[]): string[]; /** * Headless column map for a money field key → { amountCol, currencyCol }. * QUPS lines use one shared `currency` column for all money amounts. */ export declare function moneyColumnPair(key: "unit_price" | "subtotal" | "tax" | "net" | "gross"): { amount: string; currency: string; }; export {}; //# sourceMappingURL=fields.d.ts.map