/** * What a committed-use deal would have been worth **on the traffic you * actually had**. * * Providers sell committed-use and reserved-capacity contracts, and every team * that signs one is doing arithmetic in a spreadsheet against a number they * guessed. That is exactly the failure this product exists to end — and it is * the highest-stakes instance of it, because the guess is annual and signed. * * ## An as-if calculation, and the wording never blurs it * * "On the traffic you actually had, this commitment would have saved $X" is a * measurement of the past. * * "You will save $X" is a claim about the future, and this product has refused * that at every scale since 1.27. Nothing here projects, extrapolates, fits a * trend or annualises a partial month. Every figure describes months that * happened, and the type says so in a field a machine reader can check. * * ## Both directions, because one direction is the sales pitch * * A commitment is a **floor** as well as a discount. Below the floor you pay * for capacity you did not use, and a saving quoted without that half is not * an analysis — it is the vendor's slide. * * So every month is priced both ways, the months that would have fallen short * are counted and named, and what the unused floor would have cost is its own * figure rather than netted quietly against the good months. * * ## The shortfall risk is a count, not a probability * * "Three of your last twelve months would have fallen short, by $400, $150 and * $2,900" is a measurement. "There is a 25% chance of shortfall" is a model of * a distribution nobody fitted, presented with the authority of arithmetic. * Only the first is available from a log, so only the first is printed. */ /** The deal, as the provider states it. */ export interface CommitmentTerms { /** * What you commit to spending each month, **after** the discount — which is * how these contracts are almost always written. * * If your discounted usage comes in under this, you pay this anyway. */ monthlyFloorUsd: number; /** The discount, 0-1. 0.2 is twenty per cent off. */ discount: number; /** How many months the commitment runs. */ months: number; } /** One measured month, as the caller sliced it. */ export interface MeasuredMonth { /** `YYYY-MM`. */ month: string; usd: number; } export interface MonthReplay { month: string; /** What was actually paid, with no commitment. */ listUsd: number; /** What the discounted usage would have come to. */ discountedUsd: number; /** What would actually have been paid: the floor, or the discounted usage. */ paidUsd: number; /** Positive means the commitment saved money that month. */ savingUsd: number; /** Whether the floor was the binding number — a month that fell short. */ shortfall: boolean; /** What the unused floor cost, in a month that fell short. Zero otherwise. */ unusedFloorUsd: number; } export type CommitmentUnknown = 'no-history' | 'too-few-months' | 'partial-months-excluded-everything'; export interface CommitmentReplay { /** * Always `measured-past`. There is no other value, and the field exists so a * machine reader cannot mistake this for a projection — the same reason * every other document in this product carries its provenance. */ provenance: 'measured-past'; months: MonthReplay[]; /** Summed over the months replayed, positive meaning the deal won. */ netUsd: number; /** What the good months saved, before the shortfalls are taken off. */ savedInGoodMonthsUsd: number; /** * What the shortfall months cost, kept as its own figure. * * Netted against the savings it disappears, and the disappearing is the * whole trick a vendor's slide relies on. */ lostToUnusedFloorUsd: number; /** How many of the measured months would have fallen short. A count, never a rate. */ shortfallMonths: number; /** * The monthly spend at which the commitment stops losing money. * * Equal to the floor: below it you pay the floor for less usage. Above it * the saving grows, first as (spend − floor) and then, once discounted usage * clears the floor, as spend × discount. */ breakEvenMonthlyUsd: number; /** * Measured spread across the months replayed — lowest and highest, and how * far the range spans as a share of the median. * * The honest form of "shortfall risk": a reader looking at a range wider than * the floor can see the deal is a bet, without anybody modelling a * distribution nobody fitted. */ spread: { lowUsd: number; highUsd: number; medianUsd: number; } | null; /** Set when nothing could be replayed. A refusal never arrives bare. */ unknown: CommitmentUnknown | null; /** How many whole months would settle it, when there are too few. */ monthsNeeded: number | null; } /** * The fewest whole months worth replaying a commitment against. * * Three. Two months cannot show a shortfall pattern and one cannot show * anything at all — and a commitment is signed for a year, so an answer from a * single month is a year-long decision made on a fortnight of evidence. */ export declare const MIN_MONTHS_FOR_REPLAY = 3; export declare function replayCommitment(history: readonly MeasuredMonth[], terms: CommitmentTerms): CommitmentReplay; /** * Whether the replay covers as long as the commitment runs. * * Kept separate from the refusals because it does not stop the arithmetic: six * months of history against a twelve-month deal is a real answer about six * months, and saying so is more useful than refusing. What it must not do is * go unsaid — a twelve-month decision read off half a year of evidence, with * nothing on the page marking the gap, is the spreadsheet this module was * written to replace. */ export declare function coversTheTerm(replay: CommitmentReplay, terms: CommitmentTerms): { covered: number; ofMonths: number; short: boolean; }; //# sourceMappingURL=commitment.d.ts.map