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

34 lines • 1.53 kB
import { PricingLine, type PricingLineInput } from "../line.js"; import type { ModifierSpec } from "../modifier.js"; import type { QupsTruthMode } from "../qups.js"; import type { PricingFieldValue, PricingLineRecord, PricingModifierRecord, PricingTaxDefaults } from "./types.js"; export declare function modifiersToRecords(modifiers: readonly ModifierSpec[], idFactory: () => string): PricingModifierRecord[]; export declare function recordsToModifiers(modifiers: readonly PricingModifierRecord[], fallbackCurrency: string): ModifierSpec[]; /** Hydrate a persisted row into a live PricingLine (recomputes derived values). */ export declare function pricingLineFromRecord(record: PricingLineRecord): PricingLine; export declare function recordFromPricingLine(options: { id: string; ownerKey: string; line: PricingLine; profileId?: string; fieldValues?: PricingFieldValue[]; position?: number; createdAt: Date; updatedAt: Date; idFactory: () => string; }): PricingLineRecord; export declare function pricingLineInputFromParts(input: { truth: QupsTruthMode; currency: string; quantity?: string; unitPrice?: string; subtotal?: string; modifiers?: readonly ModifierSpec[]; tax?: PricingTaxDefaults; }): PricingLineInput; /** Headless view of built-in columns + custom field values for forms/APIs. */ export declare function lineFieldMap(record: PricingLineRecord): Record<string, { value: string; currency?: string; }>; //# sourceMappingURL=serialize.d.ts.map