@classytic/primitives 0.19.0 → 0.20.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 (45) hide show
  1. package/CHANGELOG.md +906 -751
  2. package/README.md +160 -159
  3. package/dist/approval.d.mts +49 -10
  4. package/dist/approval.mjs +44 -10
  5. package/dist/bank-transaction.d.mts +1 -1
  6. package/dist/cadence-BFQVC1Qp.d.mts +107 -0
  7. package/dist/cadence.d.mts +1 -92
  8. package/dist/cadence.mjs +133 -4
  9. package/dist/calendar-B6fm-FbR.d.mts +46 -0
  10. package/dist/calendar.d.mts +1 -45
  11. package/dist/canonical.mjs +17 -0
  12. package/dist/context.d.mts +28 -1
  13. package/dist/currency.d.mts +2 -2
  14. package/dist/currency.mjs +134 -19
  15. package/dist/event-infra.d.mts +1 -34
  16. package/dist/event-infra.mjs +16 -46
  17. package/dist/idempotency.d.mts +253 -0
  18. package/dist/idempotency.mjs +226 -0
  19. package/dist/memory-outbox.d.mts +64 -0
  20. package/dist/memory-outbox.mjs +172 -0
  21. package/dist/monetization.d.mts +1 -1
  22. package/dist/money-DPo9fLBi.d.mts +347 -0
  23. package/dist/money.d.mts +1 -140
  24. package/dist/money.mjs +6 -15
  25. package/dist/outbox.d.mts +49 -1
  26. package/dist/outbox.mjs +64 -1
  27. package/dist/payment-events.d.mts +132 -4
  28. package/dist/payment-events.mjs +22 -2
  29. package/dist/payment-gateway.d.mts +210 -7
  30. package/dist/payment-gateway.mjs +18 -1
  31. package/dist/period.d.mts +138 -7
  32. package/dist/period.mjs +316 -5
  33. package/dist/person-parse.d.mts +82 -0
  34. package/dist/person-parse.mjs +109 -0
  35. package/dist/proration.d.mts +2 -2
  36. package/dist/proration.mjs +18 -6
  37. package/dist/sla-policy.d.mts +1 -1
  38. package/dist/state-machine.mjs +13 -0
  39. package/dist/suspension.d.mts +1 -1
  40. package/dist/timezone-tlG7ygwx.d.mts +114 -0
  41. package/dist/timezone.d.mts +2 -100
  42. package/dist/timezone.mjs +38 -3
  43. package/dist/unit-cost-rate.d.mts +1 -2
  44. package/package.json +244 -232
  45. package/dist/currency-BCJnJBlb.d.mts +0 -119
package/package.json CHANGED
@@ -1,232 +1,244 @@
1
- {
2
- "name": "@classytic/primitives",
3
- "version": "0.19.0",
4
- "description": "Framework-agnostic TypeScript primitives shared across Classytic packages — Money, events, pagination, tenant config, and other building blocks.",
5
- "author": "Classytic",
6
- "license": "MIT",
7
- "homepage": "https://www.npmjs.com/package/@classytic/primitives",
8
- "bugs": {
9
- "url": "https://github.com/classytic/primitives/issues"
10
- },
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/classytic/primitives.git"
14
- },
15
- "publishConfig": {
16
- "access": "public"
17
- },
18
- "type": "module",
19
- "sideEffects": false,
20
- "engines": {
21
- "node": ">=22"
22
- },
23
- "exports": {
24
- "./money": {
25
- "types": "./dist/money.d.mts",
26
- "default": "./dist/money.mjs"
27
- },
28
- "./currency": {
29
- "types": "./dist/currency.d.mts",
30
- "default": "./dist/currency.mjs"
31
- },
32
- "./unit-cost-rate": {
33
- "types": "./dist/unit-cost-rate.d.mts",
34
- "default": "./dist/unit-cost-rate.mjs"
35
- },
36
- "./address": {
37
- "types": "./dist/address.d.mts",
38
- "default": "./dist/address.mjs"
39
- },
40
- "./period": {
41
- "types": "./dist/period.d.mts",
42
- "default": "./dist/period.mjs"
43
- },
44
- "./calendar": {
45
- "types": "./dist/calendar.d.mts",
46
- "default": "./dist/calendar.mjs"
47
- },
48
- "./timezone": {
49
- "types": "./dist/timezone.d.mts",
50
- "default": "./dist/timezone.mjs"
51
- },
52
- "./reference": {
53
- "types": "./dist/reference.d.mts",
54
- "default": "./dist/reference.mjs"
55
- },
56
- "./context": {
57
- "types": "./dist/context.d.mts",
58
- "default": "./dist/context.mjs"
59
- },
60
- "./events": {
61
- "types": "./dist/events.d.mts",
62
- "default": "./dist/events.mjs"
63
- },
64
- "./event-infra": {
65
- "types": "./dist/event-infra.d.mts",
66
- "default": "./dist/event-infra.mjs"
67
- },
68
- "./outbox": {
69
- "types": "./dist/outbox.d.mts",
70
- "default": "./dist/outbox.mjs"
71
- },
72
- "./result": {
73
- "types": "./dist/result.d.mts",
74
- "default": "./dist/result.mjs"
75
- },
76
- "./brand": {
77
- "types": "./dist/brand.d.mts",
78
- "default": "./dist/brand.mjs"
79
- },
80
- "./split-allocation": {
81
- "types": "./dist/split-allocation.d.mts",
82
- "default": "./dist/split-allocation.mjs"
83
- },
84
- "./approval": {
85
- "types": "./dist/approval.d.mts",
86
- "default": "./dist/approval.mjs"
87
- },
88
- "./cadence": {
89
- "types": "./dist/cadence.d.mts",
90
- "default": "./dist/cadence.mjs"
91
- },
92
- "./hold": {
93
- "types": "./dist/hold.d.mts",
94
- "default": "./dist/hold.mjs"
95
- },
96
- "./sla": {
97
- "types": "./dist/sla.d.mts",
98
- "default": "./dist/sla.mjs"
99
- },
100
- "./shelf-life": {
101
- "types": "./dist/shelf-life.d.mts",
102
- "default": "./dist/shelf-life.mjs"
103
- },
104
- "./person": {
105
- "types": "./dist/person.d.mts",
106
- "default": "./dist/person.mjs"
107
- },
108
- "./identity-verification": {
109
- "types": "./dist/identity-verification.d.mts",
110
- "default": "./dist/identity-verification.mjs"
111
- },
112
- "./otp": {
113
- "types": "./dist/otp.d.mts",
114
- "default": "./dist/otp.mjs"
115
- },
116
- "./state-machine": {
117
- "types": "./dist/state-machine.d.mts",
118
- "default": "./dist/state-machine.mjs"
119
- },
120
- "./bank-transaction": {
121
- "types": "./dist/bank-transaction.d.mts",
122
- "default": "./dist/bank-transaction.mjs"
123
- },
124
- "./payment-gateway": {
125
- "types": "./dist/payment-gateway.d.mts",
126
- "default": "./dist/payment-gateway.mjs"
127
- },
128
- "./payment-method-kind": {
129
- "types": "./dist/payment-method-kind.d.mts",
130
- "default": "./dist/payment-method-kind.mjs"
131
- },
132
- "./payment-allocation-status": {
133
- "types": "./dist/payment-allocation-status.d.mts",
134
- "default": "./dist/payment-allocation-status.mjs"
135
- },
136
- "./monetization": {
137
- "types": "./dist/monetization.d.mts",
138
- "default": "./dist/monetization.mjs"
139
- },
140
- "./proration": {
141
- "types": "./dist/proration.d.mts",
142
- "default": "./dist/proration.mjs"
143
- },
144
- "./payment-events": {
145
- "types": "./dist/payment-events.d.mts",
146
- "default": "./dist/payment-events.mjs"
147
- },
148
- "./phone": {
149
- "types": "./dist/phone.d.mts",
150
- "default": "./dist/phone.mjs"
151
- },
152
- "./status-history": {
153
- "types": "./dist/status-history.d.mts",
154
- "default": "./dist/status-history.mjs"
155
- },
156
- "./condition": {
157
- "types": "./dist/condition.d.mts",
158
- "default": "./dist/condition.mjs"
159
- },
160
- "./mixin": {
161
- "types": "./dist/mixin.d.mts",
162
- "default": "./dist/mixin.mjs"
163
- },
164
- "./sla-policy": {
165
- "types": "./dist/sla-policy.d.mts",
166
- "default": "./dist/sla-policy.mjs"
167
- },
168
- "./retention": {
169
- "types": "./dist/retention.d.mts",
170
- "default": "./dist/retention.mjs"
171
- },
172
- "./canonical": {
173
- "types": "./dist/canonical.d.mts",
174
- "default": "./dist/canonical.mjs"
175
- },
176
- "./package.json": "./package.json",
177
- "./state-diagram": {
178
- "types": "./dist/state-diagram.d.mts",
179
- "default": "./dist/state-diagram.mjs"
180
- },
181
- "./suspension": {
182
- "types": "./dist/suspension.d.mts",
183
- "default": "./dist/suspension.mjs"
184
- },
185
- "./subject": {
186
- "types": "./dist/subject.d.mts",
187
- "default": "./dist/subject.mjs"
188
- }
189
- },
190
- "files": [
191
- "dist",
192
- "README.md",
193
- "CHANGELOG.md",
194
- "LICENSE"
195
- ],
196
- "scripts": {
197
- "build": "tsdown",
198
- "dev": "tsdown --watch",
199
- "typecheck": "tsc --noEmit",
200
- "lint": "biome check src/ tests/",
201
- "lint:fix": "biome check --write src/ tests/",
202
- "test": "vitest run --project unit --project integration",
203
- "test:unit": "vitest run --project unit",
204
- "test:integration": "vitest run --project integration",
205
- "test:all": "vitest run",
206
- "test:watch": "vitest --project unit --project integration",
207
- "test:smoke": "node tests/smoke/smoke.mjs",
208
- "push": "classytic-push",
209
- "prepublishOnly": "npm run typecheck && npm run test && npm run build && npm run test:smoke",
210
- "release": "npm run build && npm run typecheck && npm publish --access public"
211
- },
212
- "devDependencies": {
213
- "@biomejs/biome": "^2.4.9",
214
- "@classytic/dev-tools": "^0.2.0",
215
- "@types/node": "^25.5.0",
216
- "tsdown": "^0.21.7",
217
- "typescript": "^5.7.0",
218
- "vitest": "^3.0.0"
219
- },
220
- "keywords": [
221
- "typescript",
222
- "types",
223
- "primitives",
224
- "money",
225
- "currency",
226
- "pagination",
227
- "domain-event",
228
- "tenant",
229
- "classytic",
230
- "commerce"
231
- ]
232
- }
1
+ {
2
+ "name": "@classytic/primitives",
3
+ "version": "0.20.0",
4
+ "description": "Framework-agnostic TypeScript primitives shared across Classytic packages — Money, events, pagination, tenant config, and other building blocks.",
5
+ "author": "Classytic",
6
+ "license": "MIT",
7
+ "homepage": "https://www.npmjs.com/package/@classytic/primitives",
8
+ "bugs": {
9
+ "url": "https://github.com/classytic/primitives/issues"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/classytic/primitives.git"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "type": "module",
19
+ "sideEffects": false,
20
+ "engines": {
21
+ "node": ">=22"
22
+ },
23
+ "exports": {
24
+ "./money": {
25
+ "types": "./dist/money.d.mts",
26
+ "default": "./dist/money.mjs"
27
+ },
28
+ "./currency": {
29
+ "types": "./dist/currency.d.mts",
30
+ "default": "./dist/currency.mjs"
31
+ },
32
+ "./unit-cost-rate": {
33
+ "types": "./dist/unit-cost-rate.d.mts",
34
+ "default": "./dist/unit-cost-rate.mjs"
35
+ },
36
+ "./address": {
37
+ "types": "./dist/address.d.mts",
38
+ "default": "./dist/address.mjs"
39
+ },
40
+ "./period": {
41
+ "types": "./dist/period.d.mts",
42
+ "default": "./dist/period.mjs"
43
+ },
44
+ "./calendar": {
45
+ "types": "./dist/calendar.d.mts",
46
+ "default": "./dist/calendar.mjs"
47
+ },
48
+ "./timezone": {
49
+ "types": "./dist/timezone.d.mts",
50
+ "default": "./dist/timezone.mjs"
51
+ },
52
+ "./reference": {
53
+ "types": "./dist/reference.d.mts",
54
+ "default": "./dist/reference.mjs"
55
+ },
56
+ "./context": {
57
+ "types": "./dist/context.d.mts",
58
+ "default": "./dist/context.mjs"
59
+ },
60
+ "./events": {
61
+ "types": "./dist/events.d.mts",
62
+ "default": "./dist/events.mjs"
63
+ },
64
+ "./memory-outbox": {
65
+ "types": "./dist/memory-outbox.d.mts",
66
+ "default": "./dist/memory-outbox.mjs"
67
+ },
68
+ "./event-infra": {
69
+ "types": "./dist/event-infra.d.mts",
70
+ "default": "./dist/event-infra.mjs"
71
+ },
72
+ "./outbox": {
73
+ "types": "./dist/outbox.d.mts",
74
+ "default": "./dist/outbox.mjs"
75
+ },
76
+ "./result": {
77
+ "types": "./dist/result.d.mts",
78
+ "default": "./dist/result.mjs"
79
+ },
80
+ "./brand": {
81
+ "types": "./dist/brand.d.mts",
82
+ "default": "./dist/brand.mjs"
83
+ },
84
+ "./split-allocation": {
85
+ "types": "./dist/split-allocation.d.mts",
86
+ "default": "./dist/split-allocation.mjs"
87
+ },
88
+ "./approval": {
89
+ "types": "./dist/approval.d.mts",
90
+ "default": "./dist/approval.mjs"
91
+ },
92
+ "./idempotency": {
93
+ "types": "./dist/idempotency.d.mts",
94
+ "default": "./dist/idempotency.mjs"
95
+ },
96
+ "./cadence": {
97
+ "types": "./dist/cadence.d.mts",
98
+ "default": "./dist/cadence.mjs"
99
+ },
100
+ "./hold": {
101
+ "types": "./dist/hold.d.mts",
102
+ "default": "./dist/hold.mjs"
103
+ },
104
+ "./sla": {
105
+ "types": "./dist/sla.d.mts",
106
+ "default": "./dist/sla.mjs"
107
+ },
108
+ "./shelf-life": {
109
+ "types": "./dist/shelf-life.d.mts",
110
+ "default": "./dist/shelf-life.mjs"
111
+ },
112
+ "./person": {
113
+ "types": "./dist/person.d.mts",
114
+ "default": "./dist/person.mjs"
115
+ },
116
+ "./person-parse": {
117
+ "types": "./dist/person-parse.d.mts",
118
+ "default": "./dist/person-parse.mjs"
119
+ },
120
+ "./identity-verification": {
121
+ "types": "./dist/identity-verification.d.mts",
122
+ "default": "./dist/identity-verification.mjs"
123
+ },
124
+ "./otp": {
125
+ "types": "./dist/otp.d.mts",
126
+ "default": "./dist/otp.mjs"
127
+ },
128
+ "./state-machine": {
129
+ "types": "./dist/state-machine.d.mts",
130
+ "default": "./dist/state-machine.mjs"
131
+ },
132
+ "./bank-transaction": {
133
+ "types": "./dist/bank-transaction.d.mts",
134
+ "default": "./dist/bank-transaction.mjs"
135
+ },
136
+ "./payment-gateway": {
137
+ "types": "./dist/payment-gateway.d.mts",
138
+ "default": "./dist/payment-gateway.mjs"
139
+ },
140
+ "./payment-method-kind": {
141
+ "types": "./dist/payment-method-kind.d.mts",
142
+ "default": "./dist/payment-method-kind.mjs"
143
+ },
144
+ "./payment-allocation-status": {
145
+ "types": "./dist/payment-allocation-status.d.mts",
146
+ "default": "./dist/payment-allocation-status.mjs"
147
+ },
148
+ "./monetization": {
149
+ "types": "./dist/monetization.d.mts",
150
+ "default": "./dist/monetization.mjs"
151
+ },
152
+ "./proration": {
153
+ "types": "./dist/proration.d.mts",
154
+ "default": "./dist/proration.mjs"
155
+ },
156
+ "./payment-events": {
157
+ "types": "./dist/payment-events.d.mts",
158
+ "default": "./dist/payment-events.mjs"
159
+ },
160
+ "./phone": {
161
+ "types": "./dist/phone.d.mts",
162
+ "default": "./dist/phone.mjs"
163
+ },
164
+ "./status-history": {
165
+ "types": "./dist/status-history.d.mts",
166
+ "default": "./dist/status-history.mjs"
167
+ },
168
+ "./condition": {
169
+ "types": "./dist/condition.d.mts",
170
+ "default": "./dist/condition.mjs"
171
+ },
172
+ "./mixin": {
173
+ "types": "./dist/mixin.d.mts",
174
+ "default": "./dist/mixin.mjs"
175
+ },
176
+ "./sla-policy": {
177
+ "types": "./dist/sla-policy.d.mts",
178
+ "default": "./dist/sla-policy.mjs"
179
+ },
180
+ "./retention": {
181
+ "types": "./dist/retention.d.mts",
182
+ "default": "./dist/retention.mjs"
183
+ },
184
+ "./canonical": {
185
+ "types": "./dist/canonical.d.mts",
186
+ "default": "./dist/canonical.mjs"
187
+ },
188
+ "./package.json": "./package.json",
189
+ "./state-diagram": {
190
+ "types": "./dist/state-diagram.d.mts",
191
+ "default": "./dist/state-diagram.mjs"
192
+ },
193
+ "./suspension": {
194
+ "types": "./dist/suspension.d.mts",
195
+ "default": "./dist/suspension.mjs"
196
+ },
197
+ "./subject": {
198
+ "types": "./dist/subject.d.mts",
199
+ "default": "./dist/subject.mjs"
200
+ }
201
+ },
202
+ "files": [
203
+ "dist",
204
+ "README.md",
205
+ "CHANGELOG.md",
206
+ "LICENSE"
207
+ ],
208
+ "scripts": {
209
+ "build": "tsdown",
210
+ "dev": "tsdown --watch",
211
+ "typecheck": "tsc --noEmit",
212
+ "lint": "biome check src/ tests/",
213
+ "lint:fix": "biome check --write src/ tests/",
214
+ "test": "vitest run --project unit --project integration",
215
+ "test:unit": "vitest run --project unit",
216
+ "test:integration": "vitest run --project integration",
217
+ "test:all": "vitest run",
218
+ "test:watch": "vitest --project unit --project integration",
219
+ "test:smoke": "node tests/smoke/smoke.mjs",
220
+ "push": "classytic-push",
221
+ "prepublishOnly": "npm run typecheck && npm run test && npm run build && npm run test:smoke",
222
+ "release": "npm run build && npm run typecheck && npm publish --access public"
223
+ },
224
+ "devDependencies": {
225
+ "@biomejs/biome": "^2.4.9",
226
+ "@classytic/dev-tools": "^0.2.0",
227
+ "@types/node": "^25.5.0",
228
+ "tsdown": "^0.21.7",
229
+ "typescript": "^5.7.0",
230
+ "vitest": "^3.0.0"
231
+ },
232
+ "keywords": [
233
+ "typescript",
234
+ "types",
235
+ "primitives",
236
+ "money",
237
+ "currency",
238
+ "pagination",
239
+ "domain-event",
240
+ "tenant",
241
+ "classytic",
242
+ "commerce"
243
+ ]
244
+ }
@@ -1,119 +0,0 @@
1
- import { t as Brand } from "./brand-LLXqoh5J.mjs";
2
-
3
- //#region src/money/currency.d.ts
4
- /**
5
- * ISO 4217 currency code (3 uppercase letters).
6
- *
7
- * Branded `string` — any 3-letter string is structurally valid, but the brand
8
- * prevents accidental mixing with raw strings. Use {@link toCurrencyCode} to
9
- * construct one safely.
10
- */
11
- type CurrencyCode = Brand<string, 'CurrencyCode'>;
12
- /**
13
- * Common ISO 4217 codes. Non-exhaustive — add more at the consumer level if
14
- * needed. Listed here because shared-types ships with these by default.
15
- */
16
- declare const CURRENCIES: {
17
- readonly USD: "USD";
18
- readonly EUR: "EUR";
19
- readonly GBP: "GBP";
20
- readonly JPY: "JPY";
21
- readonly CNY: "CNY";
22
- readonly INR: "INR";
23
- readonly BDT: "BDT";
24
- readonly AED: "AED";
25
- readonly SAR: "SAR";
26
- readonly PKR: "PKR";
27
- readonly NPR: "NPR";
28
- readonly LKR: "LKR";
29
- readonly MYR: "MYR";
30
- readonly SGD: "SGD";
31
- readonly AUD: "AUD";
32
- readonly CAD: "CAD";
33
- readonly CHF: "CHF";
34
- readonly HKD: "HKD";
35
- readonly THB: "THB";
36
- readonly IDR: "IDR";
37
- };
38
- /**
39
- * Number of minor units per major unit for common currencies.
40
- *
41
- * ISO 4217 defines most currencies with 2 decimal places (cents). A few are
42
- * zero-decimal (JPY, KRW) or three-decimal (BHD, KWD, JOD). When a currency
43
- * isn't in this table, {@link minorUnitFactor} returns 100 as the safe default.
44
- */
45
- declare const MINOR_UNIT_FACTOR: Readonly<Record<string, number>>;
46
- /**
47
- * ISO 4217 format — 3 uppercase letters. Exported so consumers can embed
48
- * the SAME pattern in JSON-Schema-representable validators (zod `.regex`,
49
- * Mongoose `match`, OpenAPI `pattern`) instead of hand-rolling a copy:
50
- * `.refine(isCurrencyCode)` validates at runtime but is dropped by
51
- * `z.toJSONSchema`, losing the constraint from generated API docs.
52
- * `isCurrencyCode` / `toCurrencyCode` remain the runtime API.
53
- */
54
- declare const CURRENCY_PATTERN: RegExp;
55
- /**
56
- * Narrow a raw string to a {@link CurrencyCode}. Returns `null` if the string
57
- * is not a valid ISO 4217 format (3 uppercase letters). This does not verify
58
- * the code is registered with ISO — use your own whitelist for that.
59
- */
60
- declare function toCurrencyCode(value: string): CurrencyCode | null;
61
- /** Type predicate for `unknown` input. */
62
- declare function isCurrencyCode(value: unknown): value is CurrencyCode;
63
- /**
64
- * Minor units per major unit (e.g. 100 for USD, 1 for JPY, 1000 for KWD).
65
- * Falls back to 100 when the currency is unknown — matches the ISO 4217 default.
66
- */
67
- declare function minorUnitFactor(currency: string): number;
68
- /**
69
- * Frozen FX conversion record — the cost of record for cross-currency
70
- * transactions. Stored alongside a base-currency amount at the seam where
71
- * currency crossed (procurement receipt, landed-cost entry, foreign refund).
72
- *
73
- * Invariant: once written, never mutated. Revaluation is a new snapshot on
74
- * a new document — rewriting an existing snapshot corrupts audit history.
75
- *
76
- * `rate` is expressed as: 1 sourceCurrency = rate * baseCurrency
77
- * (e.g. USD→BDT at 110 means rate = 110, so sourceAmount 10 USD → baseAmount 1100 BDT).
78
- * This matches how banks quote — the source is the "from" currency.
79
- */
80
- interface FxSnapshot {
81
- /** Currency the transaction was invoiced / quoted in. ISO 4217. */
82
- sourceCurrency: string;
83
- /** Organisation's functional currency the base amount is expressed in. */
84
- baseCurrency: string;
85
- /** 1 unit of sourceCurrency equals this many units of baseCurrency. */
86
- rate: number;
87
- /** When the rate was captured — NOT when the document was last touched. */
88
- snapshotAt: Date;
89
- /**
90
- * Optional provenance tag — e.g. 'manual', 'bangladesh-bank',
91
- * 'openexchangerates.org', 'supplier-invoice'. Free-form; hosts use it for
92
- * audit filtering and re-pricing policy.
93
- */
94
- source?: string;
95
- }
96
- /**
97
- * Apply an {@link FxSnapshot} to a source-currency amount. Returns the
98
- * equivalent base-currency amount. No rounding — callers that persist into
99
- * an integer minor-unit column must round explicitly with a deterministic
100
- * rule (`Math.round`, banker's rounding, floor for duty-conservative
101
- * postings, etc.).
102
- */
103
- declare function convertWithSnapshot(sourceAmount: number, fx: FxSnapshot): number;
104
- /**
105
- * Reverse an {@link FxSnapshot} — reconstruct the source-currency amount
106
- * from a stored base amount. Useful for reporting "cost in original
107
- * currency". Not round-trip safe under rounding; prefer storing the
108
- * original source amount alongside the base amount when audit fidelity
109
- * matters.
110
- */
111
- declare function reverseWithSnapshot(baseAmount: number, fx: FxSnapshot): number;
112
- /**
113
- * Structural validation — checks shape only. Does NOT verify the rate is
114
- * economically sensible (8.5 USD→BDT would pass this check). Host-level
115
- * guards / anomaly detection handle that.
116
- */
117
- declare function isFxSnapshot(value: unknown): value is FxSnapshot;
118
- //#endregion
119
- export { MINOR_UNIT_FACTOR as a, isFxSnapshot as c, toCurrencyCode as d, FxSnapshot as i, minorUnitFactor as l, CURRENCY_PATTERN as n, convertWithSnapshot as o, CurrencyCode as r, isCurrencyCode as s, CURRENCIES as t, reverseWithSnapshot as u };