LCOV - code coverage report
Current view: top level - src/platform/billing/sdk - safeInt64.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 33.3 % 3 1
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : /**
       2              :  * The generated zod schemas coerce every int64 to `bigint` and accept the
       3              :  * whole signed range, while the generated types the host reads through say
       4              :  * `number`. `Number()` on a value past 2^53 rounds silently, so a value the
       5              :  * host cannot hold exactly is refused rather than reshaped: the read then
       6              :  * fails as malformed, the way a body the core cannot decode does.
       7              :  */
       8         2356 : const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER)
       9              : 
      10            0 : export function asSafeNumber(value: bigint): number | undefined {
      11            0 :   return value >= -MAX_SAFE && value <= MAX_SAFE ? Number(value) : undefined
      12              : }
        

Generated by: LCOV version 2.0-1