@amboras-dev/money 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +14 -6
  2. package/dist/ai.cjs +4 -4
  3. package/dist/ai.d.cts +1 -1
  4. package/dist/ai.d.ts +1 -1
  5. package/dist/ai.js +4 -4
  6. package/dist/{allocate-D7tm_t_o.cjs → allocate-CZRg4TOP.cjs} +2 -2
  7. package/dist/{allocate-CdnhvAda.js → allocate-X7_jAtOj.js} +2 -2
  8. package/dist/{amount-DHtvZSSm.cjs → amount-BV0O-aN8.cjs} +3 -3
  9. package/dist/{amount-D7dj76nH.js → amount-BoYBMgK9.js} +3 -3
  10. package/dist/{arithmetic-C-Q_aI49.js → arithmetic-BhNwisjb.js} +3 -3
  11. package/dist/{arithmetic-Bq-8mSal.cjs → arithmetic-DjT4Kzgt.cjs} +3 -3
  12. package/dist/billing.cjs +2 -2
  13. package/dist/billing.d.cts +1 -1
  14. package/dist/billing.d.ts +1 -1
  15. package/dist/billing.js +2 -2
  16. package/dist/commerce.cjs +7 -7
  17. package/dist/commerce.d.cts +2 -2
  18. package/dist/commerce.d.ts +2 -2
  19. package/dist/commerce.js +7 -7
  20. package/dist/{format-BdB7LEIp.js → format-BdPnijvn.js} +11 -2
  21. package/dist/{format-BnA1aLJk.cjs → format-DLhno7eX.cjs} +16 -1
  22. package/dist/fx.cjs +5 -5
  23. package/dist/fx.d.cts +5 -5
  24. package/dist/fx.d.ts +5 -5
  25. package/dist/fx.js +5 -5
  26. package/dist/index.cjs +10 -7
  27. package/dist/index.d.cts +15 -3
  28. package/dist/index.d.ts +15 -3
  29. package/dist/index.js +8 -8
  30. package/dist/input.cjs +4 -4
  31. package/dist/input.d.cts +2 -2
  32. package/dist/input.d.ts +2 -2
  33. package/dist/input.js +4 -4
  34. package/dist/{iso-minor-CtaiIifs.js → iso-minor-CqkWDxHS.js} +1 -1
  35. package/dist/{iso-minor--gQWI1f2.cjs → iso-minor-wSwJN57T.cjs} +1 -1
  36. package/dist/{medusa-DuQ3-KoD.d.cts → medusa-4K8N1pUc.d.cts} +11 -2
  37. package/dist/{medusa-RwqxaDGq.d.ts → medusa-DBXJXXvF.d.ts} +11 -2
  38. package/dist/{medusa-CmxCni-G.js → medusa-DqJY1qpj.js} +17 -2
  39. package/dist/{medusa-OJ2TJOxt.cjs → medusa-lRY9xlsf.cjs} +22 -1
  40. package/dist/{money-CbhsT0fB.d.cts → money-B-3aFjNJ.d.cts} +19 -3
  41. package/dist/{money-CbhsT0fB.d.ts → money-B-3aFjNJ.d.ts} +19 -3
  42. package/dist/{money-D5-vlv0h.cjs → money-B3wH_Z4S.cjs} +35 -5
  43. package/dist/{money-CIgELekG.js → money-WhnGiI00.js} +18 -6
  44. package/dist/{number-text-BpvN6NAo.cjs → number-text-BWu67jUq.cjs} +1 -1
  45. package/dist/{number-text-C82oh6JB.js → number-text-DE-q4jO5.js} +1 -1
  46. package/dist/{percent-Dt8vNIAW.cjs → percent-C0InC2t2.cjs} +1 -1
  47. package/dist/{percent-CKVI_c-m.js → percent-D1VB9xXG.js} +1 -1
  48. package/dist/{rate-DGPfB_jc.cjs → rate-CVeMii4a.cjs} +1 -1
  49. package/dist/{rate-CmeTGNex.d.ts → rate-DBPiYgT1.d.ts} +1 -1
  50. package/dist/{rate-lLPViBuM.js → rate-DicStBue.js} +1 -1
  51. package/dist/{rate-toyS3EMf.d.cts → rate-tqK8ijG0.d.cts} +1 -1
  52. package/dist/{reporting-DEM97DhQ.d.cts → reporting-CG-ai2sM.d.cts} +2 -2
  53. package/dist/{reporting-5xby-Zas.d.ts → reporting-tpGJbqYp.d.ts} +2 -2
  54. package/dist/{retail-BsvpNv1F.js → retail-1mu888J1.js} +3 -3
  55. package/dist/{retail-Mqd-sPMF.d.cts → retail-C_BPLvMj.d.cts} +1 -1
  56. package/dist/{retail-DTk2XAMM.cjs → retail-Cml8YSKg.cjs} +3 -3
  57. package/dist/{retail-BwcFJcVN.d.ts → retail-DRUTTQoJ.d.ts} +1 -1
  58. package/dist/{rounding-oZ832yTD.cjs → rounding-DHBtNCHG.cjs} +1 -1
  59. package/dist/{rounding-CVAPEfq_.js → rounding-g9rvye0k.js} +1 -1
  60. package/dist/sql.cjs +3 -3
  61. package/dist/sql.d.cts +2 -2
  62. package/dist/sql.d.ts +2 -2
  63. package/dist/sql.js +3 -3
  64. package/dist/testing.cjs +33481 -4
  65. package/dist/testing.d.cts +31 -3
  66. package/dist/testing.d.ts +31 -3
  67. package/dist/testing.js +33481 -5
  68. package/dist/{wire-DQZ6fA3c.cjs → wire-Bhuut8cW.cjs} +259 -34
  69. package/dist/{wire-Cd4Q1Jmm.d.ts → wire-CaUN9Vf_.d.ts} +61 -21
  70. package/dist/{wire-CI3Sm1iC.js → wire-sW0yzqth.js} +248 -35
  71. package/dist/{wire-hWuixv3w.d.cts → wire-xjYXv4go.d.cts} +61 -21
  72. package/dist/wire.cjs +3 -1
  73. package/dist/wire.d.cts +2 -2
  74. package/dist/wire.d.ts +2 -2
  75. package/dist/wire.js +2 -2
  76. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { L as DecimalText, R as RoundingMode, b as StorageScale, r as Money, y as FractionDigits } from "./money-CbhsT0fB.cjs";
2
- import { K as PspId } from "./wire-hWuixv3w.cjs";
1
+ import { R as DecimalText, b as FractionDigits, i as Money, x as StorageScale, z as RoundingMode } from "./money-B-3aFjNJ.cjs";
2
+ import { Y as PspId } from "./wire-xjYXv4go.cjs";
3
3
  //#region src/testing/check-wire-digits.d.ts
4
4
  /**
5
5
  * Mismatch messages (empty when consistent) between `psp`'s encoder and `documented(code)`, the
@@ -94,4 +94,32 @@ interface GoldenVector {
94
94
  /** Wire bytes for every PSP x presented currency x storage amount (18900 vectors). */
95
95
  export declare const PSP_GOLDEN_VECTORS: readonly GoldenVector[];
96
96
  //#endregion
97
- export type { CurrencyCase, DestinationAmountVector, DestinationTextVector, GoldenPspId, GoldenVector, MedusaAmountShape, RoundingVector };
97
+ //#region src/testing/golden-psp-fractional.d.ts
98
+ /**
99
+ * Where the package departs on purpose from what the codec does with a fractional amount:
100
+ * `'sub-unit'` a positive amount whose wire is 0 is refused (`error` contains `SUB_UNIT_REFUSAL`);
101
+ * `'exact-half-up'` a tie at the wire digits that Medusa's float `toFixed` rounded down is rounded
102
+ * half-up exactly; `'real-amount'` a refusal that named a `toFixed` neighbour of the amount names
103
+ * the amount as held.
104
+ */
105
+ type FractionalPolicy = 'sub-unit' | 'exact-half-up' | 'real-amount';
106
+ /**
107
+ * One encode of a FRACTIONAL storage amount (Medusa keeps unrounded totals): `wire` and `error` are
108
+ * what encodeWire gives; where it departs from the codec on purpose, `policy` says why and `medusa`
109
+ * holds the codec's own wire or message.
110
+ */
111
+ interface FractionalGoldenVector {
112
+ readonly psp: GoldenPspId;
113
+ readonly currency: string;
114
+ readonly convention: GoldenVector['convention'];
115
+ /** The storage amount as canonical decimal text (`'107.8175'`). */
116
+ readonly stored: string;
117
+ readonly wire: number | string | null;
118
+ readonly error: string | null;
119
+ readonly policy: FractionalPolicy | null;
120
+ readonly medusa: number | string | null;
121
+ }
122
+ /** Fractional storage amounts for every PSP x presented currency (10500 vectors). */
123
+ export declare const PSP_FRACTIONAL_GOLDEN_VECTORS: readonly FractionalGoldenVector[];
124
+ //#endregion
125
+ export type { CurrencyCase, DestinationAmountVector, DestinationTextVector, FractionalGoldenVector, FractionalPolicy, GoldenPspId, GoldenVector, MedusaAmountShape, RoundingVector };
package/dist/testing.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { L as DecimalText, R as RoundingMode, b as StorageScale, r as Money, y as FractionDigits } from "./money-CbhsT0fB.js";
2
- import { K as PspId } from "./wire-Cd4Q1Jmm.js";
1
+ import { R as DecimalText, b as FractionDigits, i as Money, x as StorageScale, z as RoundingMode } from "./money-B-3aFjNJ.js";
2
+ import { Y as PspId } from "./wire-CaUN9Vf_.js";
3
3
  //#region src/testing/check-wire-digits.d.ts
4
4
  /**
5
5
  * Mismatch messages (empty when consistent) between `psp`'s encoder and `documented(code)`, the
@@ -94,4 +94,32 @@ interface GoldenVector {
94
94
  /** Wire bytes for every PSP x presented currency x storage amount (18900 vectors). */
95
95
  export declare const PSP_GOLDEN_VECTORS: readonly GoldenVector[];
96
96
  //#endregion
97
- export type { CurrencyCase, DestinationAmountVector, DestinationTextVector, GoldenPspId, GoldenVector, MedusaAmountShape, RoundingVector };
97
+ //#region src/testing/golden-psp-fractional.d.ts
98
+ /**
99
+ * Where the package departs on purpose from what the codec does with a fractional amount:
100
+ * `'sub-unit'` a positive amount whose wire is 0 is refused (`error` contains `SUB_UNIT_REFUSAL`);
101
+ * `'exact-half-up'` a tie at the wire digits that Medusa's float `toFixed` rounded down is rounded
102
+ * half-up exactly; `'real-amount'` a refusal that named a `toFixed` neighbour of the amount names
103
+ * the amount as held.
104
+ */
105
+ type FractionalPolicy = 'sub-unit' | 'exact-half-up' | 'real-amount';
106
+ /**
107
+ * One encode of a FRACTIONAL storage amount (Medusa keeps unrounded totals): `wire` and `error` are
108
+ * what encodeWire gives; where it departs from the codec on purpose, `policy` says why and `medusa`
109
+ * holds the codec's own wire or message.
110
+ */
111
+ interface FractionalGoldenVector {
112
+ readonly psp: GoldenPspId;
113
+ readonly currency: string;
114
+ readonly convention: GoldenVector['convention'];
115
+ /** The storage amount as canonical decimal text (`'107.8175'`). */
116
+ readonly stored: string;
117
+ readonly wire: number | string | null;
118
+ readonly error: string | null;
119
+ readonly policy: FractionalPolicy | null;
120
+ readonly medusa: number | string | null;
121
+ }
122
+ /** Fractional storage amounts for every PSP x presented currency (10500 vectors). */
123
+ export declare const PSP_FRACTIONAL_GOLDEN_VECTORS: readonly FractionalGoldenVector[];
124
+ //#endregion
125
+ export type { CurrencyCase, DestinationAmountVector, DestinationTextVector, FractionalGoldenVector, FractionalPolicy, GoldenPspId, GoldenVector, MedusaAmountShape, RoundingVector };