@refactorlabs/recount 0.9.0 → 0.10.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.
package/dist/index.d.cts CHANGED
@@ -1,11 +1,36 @@
1
1
  type JsonObject = Record<string, unknown> | unknown[];
2
2
  type Metadata = Record<string, string | number | boolean | null>;
3
3
  type TableHighlight = 'danger' | 'warn' | 'success' | 'info' | 'muted';
4
- type TableColumn = string | {
4
+ type CellFormat = 'money' | 'number' | 'percent' | 'integer' | 'text';
5
+ /** How Recount formats a number: in a column, a typed cell or a calculation. */
6
+ type CellFormatOptions = {
7
+ format?: CellFormat;
8
+ /** ISO 4217 code, such as `'AUD'`. */
9
+ currency?: string;
10
+ unit?: string;
11
+ /** Decimal places shown, 0-6. */
12
+ places?: number;
13
+ };
14
+ type SignHighlight = {
15
+ positive?: TableHighlight;
16
+ negative?: TableHighlight;
17
+ zero?: TableHighlight;
18
+ };
19
+ type TableColumn = string | ({
5
20
  label: string;
6
21
  span?: number;
7
22
  highlight?: TableHighlight;
8
- };
23
+ /** Colours each numeric cell by its sign. */
24
+ signHighlight?: SignHighlight;
25
+ } & CellFormatOptions);
26
+ /** A cell carrying its own format, for key/value tables where each row has its own unit. */
27
+ type TableTypedCell = {
28
+ readonly __cell: true;
29
+ readonly value: number | string | boolean | null | {
30
+ __redacted: true;
31
+ };
32
+ readonly span?: number;
33
+ } & Readonly<CellFormatOptions>;
9
34
  type TableCellSpan = {
10
35
  readonly __cellSpan: true;
11
36
  readonly span: number;
@@ -22,7 +47,8 @@ type TableSection = {
22
47
  cellHighlights?: (TableHighlight | null)[][];
23
48
  summary?: TableSummaryStat[];
24
49
  };
25
- type TableData = {
50
+ /** A table of rows or sections. */
51
+ type TableRowsData = {
26
52
  title?: string;
27
53
  columns: TableColumn[];
28
54
  /** Flat rows - required when `sections` is not provided. */
@@ -32,11 +58,96 @@ type TableData = {
32
58
  summary?: TableSummaryStat[];
33
59
  /** Named sections sharing the same columns. Mutually exclusive with `rows`. */
34
60
  sections?: [TableSection, ...TableSection[]];
61
+ calculations?: never;
62
+ };
63
+ /** A table drawn by Recount from calculations. It can't also have columns, rows or sections. */
64
+ type TableCalculationData = {
65
+ title?: string;
66
+ calculations: Calculation[];
67
+ columns?: never;
68
+ rows?: never;
69
+ sections?: never;
35
70
  };
71
+ type TableData = TableRowsData | TableCalculationData;
36
72
  /** TableData with flat rows guaranteed present. Returned by build(), tableFromObject(), tableFromRecords(). */
37
- type TableDataFlat = TableData & {
73
+ type TableDataFlat = TableRowsData & {
38
74
  rows: unknown[][];
39
75
  };
76
+ /**
77
+ * A value an input or line holds: a number, a decimal string (`'0.0316'`)
78
+ * that keeps more precision than a float, text, a boolean, `null` (not
79
+ * calculated) or redacted.
80
+ */
81
+ type CalculationValue = number | string | boolean | null | {
82
+ __redacted: true;
83
+ };
84
+ type CalculationAlerts = 'none' | 'warn' | 'error';
85
+ type CalculationLineKind = 'charge' | 'step' | 'working' | 'subtotal' | 'total' | 'info';
86
+ /** An absolute amount in the line's unit (`0.01`), or a percentage (`'0.1%'`). */
87
+ type CalculationTolerance = number | `${number}%`;
88
+ /** A figure from another system that a line should match. */
89
+ type CalculationExpected = {
90
+ value: CalculationValue;
91
+ source?: string;
92
+ tolerance?: CalculationTolerance;
93
+ /** Opts this reconciliation alone into alerts. */
94
+ level?: SpanAlertLevel;
95
+ reason?: string;
96
+ };
97
+ type CalculationInput = {
98
+ key: string;
99
+ label?: string;
100
+ value: CalculationValue;
101
+ unit?: string;
102
+ places?: number;
103
+ source?: string;
104
+ sourceSpan?: string;
105
+ description?: string;
106
+ };
107
+ type CalculationLine = {
108
+ key: string;
109
+ label?: string;
110
+ /** The engine's figure. Left out on a derived line, Recount works it out. */
111
+ value?: CalculationValue;
112
+ /** What the value is derived from, which Recount checks. `null` = stated. */
113
+ formula?: string | null;
114
+ /** A number or formula; `null` when it wasn't calculated, so the line isn't either. */
115
+ quantity?: number | string | null;
116
+ rate?: number | string | null;
117
+ times?: number | string | null;
118
+ quantityUnit?: string;
119
+ rateUnit?: string;
120
+ unit?: string;
121
+ places?: number;
122
+ kind?: CalculationLineKind;
123
+ primary?: boolean;
124
+ tags?: string[];
125
+ highlight?: TableHighlight;
126
+ detail?: string;
127
+ explain?: string;
128
+ source?: string;
129
+ sourceSpan?: string;
130
+ expected?: CalculationExpected;
131
+ tolerance?: CalculationTolerance;
132
+ alerts?: CalculationAlerts;
133
+ };
134
+ type CalculationLayout = 'charges' | 'steps';
135
+ type CalculationColumnLabels = Partial<Record<'charge' | 'quantity' | 'rate' | 'amount' | 'step' | 'working' | 'value', string>>;
136
+ type Calculation = {
137
+ version?: 1;
138
+ key: string;
139
+ title?: string;
140
+ layout?: CalculationLayout;
141
+ currency?: string;
142
+ places?: number;
143
+ tolerance?: CalculationTolerance;
144
+ alerts?: CalculationAlerts;
145
+ columnLabels?: CalculationColumnLabels;
146
+ inputs?: CalculationInput[];
147
+ lines: CalculationLine[];
148
+ notes?: string[];
149
+ summary?: TableSummaryStat[];
150
+ };
40
151
  type ChartType = 'line' | 'bar' | 'pie' | 'scatter';
41
152
  type ChartSeries = {
42
153
  name?: string;
@@ -174,6 +285,10 @@ type TableSpanOptions = SpanBaseOptions & {
174
285
  input?: TableData;
175
286
  output?: TableData;
176
287
  };
288
+ type CalculationSpanOptions = SpanBaseOptions & {
289
+ /** Which side of the table span holds the calculations. Defaults to `'output'`. */
290
+ side?: 'input' | 'output';
291
+ };
177
292
  type ChartSpanOptions = SpanBaseOptions & {
178
293
  input?: ChartData;
179
294
  output?: ChartData;
@@ -254,6 +369,192 @@ type IngestResult = {
254
369
  traceId: string;
255
370
  };
256
371
 
372
+ /** A number, a decimal object, or a formula of earlier keys (`'days'`, `'daily_usage * 365.25'`). */
373
+ type Operand = number | string | DecimalLike;
374
+ /** A decimal library's value, such as a decimal.js `Decimal` or a big.js `Big`. */
375
+ type DecimalLike = {
376
+ toFixed(): string;
377
+ };
378
+ type CalculationOptions = {
379
+ title?: string;
380
+ /** `'charges'` (Charge, Quantity, Rate, Amount) or `'steps'` (Step, Working, Value). */
381
+ layout?: CalculationLayout;
382
+ /** ISO 4217 code: the unit of charges-layout lines that give none. */
383
+ currency?: string;
384
+ /** Decimal places money is shown to, 0-6. Defaults to 2. */
385
+ places?: number;
386
+ /** How far a stated value may be from its formula and still pass. */
387
+ tolerance?: CalculationTolerance;
388
+ /** Opts into alerts for failed checks, and into showing checks in portals. */
389
+ alerts?: CalculationAlerts;
390
+ columnLabels?: CalculationColumnLabels;
391
+ summary?: TableSummaryStat[];
392
+ };
393
+ type InputOptions = {
394
+ label?: string;
395
+ unit?: string;
396
+ places?: number;
397
+ /** Where it came from, such as `'Extracted bill'`. */
398
+ source?: string;
399
+ /** The name of the span that produced it. */
400
+ sourceSpan?: string;
401
+ description?: string;
402
+ /** Sends the value as redacted. */
403
+ redact?: boolean;
404
+ };
405
+ type LineOptions = {
406
+ /** The engine's figure. Leave it out and Recount works it out from the formula. */
407
+ value?: unknown;
408
+ unit?: string;
409
+ quantityUnit?: string;
410
+ rateUnit?: string;
411
+ places?: number;
412
+ /** The calculation's headline figure. */
413
+ primary?: boolean;
414
+ tags?: string[];
415
+ /** Adds the `tax_free` tag, which `taxIncluded()` leaves out by default. */
416
+ taxFree?: boolean;
417
+ highlight?: TableHighlight;
418
+ /** A second line under the label. `{key}` placeholders are filled in. */
419
+ detail?: string;
420
+ /** The steps layout's Working text, such as `'{monthly_bill} ÷ {days} days'`. */
421
+ explain?: string;
422
+ source?: string;
423
+ sourceSpan?: string;
424
+ /** A figure from another system this line should match. */
425
+ expected?: CalculationExpected;
426
+ tolerance?: CalculationTolerance;
427
+ alerts?: CalculationAlerts;
428
+ /** Sends the value as redacted. */
429
+ redact?: boolean;
430
+ };
431
+ type ChargeOptions = LineOptions & {
432
+ quantity: Operand;
433
+ rate: Operand;
434
+ times?: Operand;
435
+ };
436
+ type StatedOptions = LineOptions & {
437
+ /** Shown only: a stated line's quantity and rate aren't checked. */
438
+ quantity?: Operand;
439
+ rate?: Operand;
440
+ times?: Operand;
441
+ kind?: CalculationLineKind;
442
+ };
443
+ type TierBand = {
444
+ /** How much of the quantity this band takes per period; `null` takes the rest. */
445
+ size: number | string | DecimalLike | null;
446
+ rate: Operand;
447
+ label?: string;
448
+ /** The engine's figure for this band, when it has one. */
449
+ value?: unknown;
450
+ };
451
+ type TiersOptions = Omit<LineOptions, 'unit' | 'quantityUnit' | 'explain'> & {
452
+ label?: string;
453
+ /** The quantity per period that's split across the bands, such as `'daily_usage'`. */
454
+ quantity: Operand;
455
+ /** How many periods the bands apply over, such as `'days'`. Defaults to 1. */
456
+ periods?: Operand;
457
+ bands: TierBand[];
458
+ /** The quantity's unit, such as `'MJ'`. */
459
+ unit?: string;
460
+ /** The period the band sizes are per, such as `'day'`, for labels. */
461
+ per?: string;
462
+ /** `'last'` charges anything beyond the last band at its rate. */
463
+ overflow?: 'none' | 'last';
464
+ };
465
+ type PercentOfOptions = LineOptions & {
466
+ /** The line keys the percentage is of. */
467
+ of: string | string[];
468
+ /** A fraction (`-0.03` for a 3% discount) or the key of one. */
469
+ rate: Operand;
470
+ };
471
+ type TaxIncludedOptions = LineOptions & {
472
+ /** The line keys that include the tax. Defaults to every charge above not tagged `tax_free`. */
473
+ of?: string | string[];
474
+ /** Instead of `of`: every line above with this tag. */
475
+ tagged?: string;
476
+ /** The tax rate as a fraction, such as `0.1`, or the key of one. */
477
+ rate: Operand;
478
+ };
479
+ type BuiltCalculation = {
480
+ /** Undefined when there's nothing to send, such as no lines. */
481
+ calculation: Calculation | undefined;
482
+ problems: string[];
483
+ };
484
+ type Defined<NK> = Exclude<NK, undefined>;
485
+ declare class CalculationBuilder<K extends string = never> {
486
+ #private;
487
+ constructor(key: string, options?: CalculationOptions);
488
+ /** A value the calculation starts from: a usage, a rate, or a constant like 365.25 days. */
489
+ input<NK extends string>(key: NK, value: unknown, options?: InputOptions): CalculationBuilder<K | NK>;
490
+ /** A charge: `quantity * rate` (`* times`), checked against `value`. */
491
+ charge<NK extends string | undefined>(key: NK, label: string, options: ChargeOptions): CalculationBuilder<K | Defined<NK>>;
492
+ /** One step of a workings chain, with the formula it's derived by. */
493
+ step<NK extends string | undefined>(key: NK, label: string, formula: string, valueOrOptions?: unknown, options?: LineOptions): CalculationBuilder<K | Defined<NK>>;
494
+ /** An intermediate quantity, shown muted and left out of `sum_kind()`. */
495
+ working<NK extends string | undefined>(key: NK, label: string, formula: string, options?: LineOptions): CalculationBuilder<K | Defined<NK>>;
496
+ /** A value the engine gives with no formula. Its quantity and rate are shown, not checked. */
497
+ stated<NK extends string | undefined>(key: NK, label: string, options: StatedOptions): CalculationBuilder<K | Defined<NK>>;
498
+ /** A subtotal, such as charges before discounts. `null` formula = stated. */
499
+ subtotal<NK extends string | undefined>(key: NK, label: string, formula: string | null, options?: LineOptions): CalculationBuilder<K | Defined<NK>>;
500
+ /** A total, such as `round(sum_kind('charge'), 2)`. `null` formula = stated. */
501
+ total<NK extends string | undefined>(key: NK, label: string, formula: string | null, options?: LineOptions): CalculationBuilder<K | Defined<NK>>;
502
+ /** A muted line that isn't summed, such as tax included or a % difference. */
503
+ info<NK extends string | undefined>(key: NK, label: string, formula: string | null, options?: LineOptions): CalculationBuilder<K | Defined<NK>>;
504
+ /**
505
+ * A tiered charge: per band, a working line for its quantity and a
506
+ * charge, then a subtotal keyed `key` that's checked against `value`.
507
+ * Band n's quantity is `clamp(quantity - before_n, 0, size_n) * periods`.
508
+ */
509
+ tiers<NK extends string | undefined>(key: NK, options: TiersOptions): CalculationBuilder<K | Defined<NK>>;
510
+ /** A percentage of other lines, such as a discount: `rate * sum(of)`. */
511
+ percentOf<NK extends string | undefined>(key: NK, label: string, options: PercentOfOptions): CalculationBuilder<K | Defined<NK>>;
512
+ /** The tax a total includes: `sum(of) * rate / (1 + rate)`. */
513
+ taxIncluded<NK extends string | undefined>(key: NK, label: string, options: TaxIncludedOptions): CalculationBuilder<K | Defined<NK>>;
514
+ /** A line in the wire shape, for anything the helpers don't cover. */
515
+ line<NK extends string>(line: CalculationLine & {
516
+ key: NK;
517
+ }): CalculationBuilder<K | NK>;
518
+ /** A muted row under the lines. `{key}` placeholders are filled in. */
519
+ note(text: string): this;
520
+ /** A key, checked by TypeScript, for writing formulas: `` `${c.ref('days')} * 2` ``. */
521
+ ref<P extends K>(key: P): P;
522
+ /** Every key given so far, for editor completion: `c.keys.days`. */
523
+ get keys(): {
524
+ readonly [P in K]: P;
525
+ };
526
+ /** What's wrong with the calculation, such as a formula naming an unknown key. */
527
+ get problems(): readonly string[];
528
+ /** The calculation as it's sent. Attach calls build it for you. */
529
+ build(): Calculation;
530
+ /** @internal Builds once, never throws. */
531
+ compile(): BuiltCalculation;
532
+ }
533
+ /** Starts a calculation: inputs, then lines in display order. */
534
+ declare function calculation(key: string, options?: CalculationOptions): CalculationBuilder;
535
+ type CalculationLike = CalculationBuilder<string> | Calculation;
536
+ /** Common units, so they're spelled the way Recount formats them. Units are free text. */
537
+ declare const units: {
538
+ readonly percent: "%";
539
+ readonly days: "days";
540
+ readonly months: "months";
541
+ readonly years: "years";
542
+ readonly hours: "hours";
543
+ readonly kWh: "kWh";
544
+ readonly MWh: "MWh";
545
+ readonly MJ: "MJ";
546
+ readonly GJ: "GJ";
547
+ readonly kW: "kW";
548
+ readonly kVA: "kVA";
549
+ readonly kWhPerYear: "kWh/yr";
550
+ readonly m2: "m²";
551
+ readonly panels: "panels";
552
+ /** A rate per something: `units.per('AUD', 'kWh')` is `'AUD/kWh'`. */
553
+ readonly per: (unit: string, per: string) => string;
554
+ /** `units.perDay('AUD')` is `'AUD/day'`. */
555
+ readonly perDay: (unit: string) => string;
556
+ };
557
+
257
558
  declare class SpanGroup {
258
559
  #private;
259
560
  span(type: 'table', name: string, options?: TableSpanOptions): this;
@@ -268,8 +569,10 @@ declare class SpanGroup {
268
569
  }): this;
269
570
  span(type: Exclude<SpanType, 'group'>, name: string, options?: SpanOptions): this;
270
571
  addMessage(name: string, text?: string, opts?: MessageSpanOptions): this;
572
+ /** A table span holding these calculations, as a child of the group. */
573
+ calculation(name: string, calcs: CalculationLike | CalculationLike[], options?: CalculationSpanOptions): this;
271
574
  alert(label: string, level: SpanAlertLevel, options?: SpanAlertOptions): this;
272
- _flush(push: (type: string, name: string, opts?: SpanOptions) => void, options?: Pick<GroupSpanOptions, 'limit' | 'sample' | 'sampleThreshold'>): void;
575
+ _flush(push: (type: string, name: string, opts?: SpanOptions) => void, options?: Pick<GroupSpanOptions, 'limit' | 'sample' | 'sampleThreshold'>, log?: (msg: string) => void): void;
273
576
  }
274
577
  declare class Trace {
275
578
  #private;
@@ -288,6 +591,8 @@ declare class Trace {
288
591
  group(name: string, builder: (g: SpanGroup) => void, options?: GroupSpanOptions): this;
289
592
  alert(label: string, level: SpanAlertLevel, options?: SpanAlertOptions): this;
290
593
  addMessage(name: string, text?: string, opts?: MessageSpanOptions): this;
594
+ /** A table span holding these calculations. Pass builders without `.build()`. */
595
+ calculation(name: string, calcs: CalculationLike | CalculationLike[], options?: CalculationSpanOptions): this;
291
596
  addMetadata(data: Metadata): this;
292
597
  setEnvironment(environment: string): this;
293
598
  /**
@@ -313,6 +618,13 @@ declare class Recount {
313
618
  }
314
619
 
315
620
  declare function spanCell(value: unknown, span: number): TableCellSpan;
621
+ /**
622
+ * A cell Recount formats itself, for key/value tables where each row has
623
+ * its own unit: `cell(18481.65, { format: 'number', unit: 'MJ' })`.
624
+ */
625
+ declare function cell(value: TableTypedCell['value'], options?: CellFormatOptions & {
626
+ span?: number;
627
+ }): TableTypedCell;
316
628
  declare class TableBuilder {
317
629
  private _title?;
318
630
  private _source?;
@@ -329,6 +641,8 @@ declare class TableBuilder {
329
641
  private _extraRows;
330
642
  private _summary?;
331
643
  private _redactFields;
644
+ private _formats;
645
+ private _signHighlights;
332
646
  constructor(title?: string);
333
647
  redact(fields: string[]): this;
334
648
  private _shouldRedact;
@@ -336,6 +650,17 @@ declare class TableBuilder {
336
650
  fromRecords<T extends Record<string, unknown>>(data: T[]): this;
337
651
  pick(...keys: string[]): this;
338
652
  label(map: Record<string, string>): this;
653
+ /**
654
+ * Has Recount format these columns (records) or rows (objects), so send
655
+ * the numbers as they are: `.format({ cost: { format: 'money', currency: 'AUD' } })`.
656
+ * Formatted values aren't affected by `.round()`.
657
+ */
658
+ format(map: Record<string, CellFormatOptions>): this;
659
+ /**
660
+ * Colours a column's numbers (records) or a row (objects) by sign:
661
+ * `.signHighlight('saving', { positive: 'success', negative: 'danger' })`.
662
+ */
663
+ signHighlight(key: string, highlight: SignHighlight): this;
339
664
  round(decimals: number): this;
340
665
  transformValues(map: Record<string, (v: unknown) => unknown>): this;
341
666
  spanColumn(key: string, span: number): this;
@@ -344,13 +669,14 @@ declare class TableBuilder {
344
669
  highlightCells(key: string, fn: (value: unknown) => TableHighlight | null): this;
345
670
  appendRow(cells: unknown[], highlight?: TableHighlight): this;
346
671
  summary(stats: TableSummaryStat[]): this;
347
- build(): TableData & {
672
+ build(): TableRowsData & {
348
673
  rows: unknown[][];
349
674
  };
350
675
  buildSection(): TableSection;
351
676
  private _build;
352
677
  private _resolveLabel;
353
678
  private _resolveColumn;
679
+ private _finalValue;
354
680
  private _mergeRowHighlights;
355
681
  private _buildRowHighlights;
356
682
  private _buildFromObject;
@@ -360,20 +686,20 @@ declare function table(title?: string): TableBuilder;
360
686
  declare function tableFromObject({ title, data }: {
361
687
  title?: string;
362
688
  data: Record<string, unknown>;
363
- }): TableData & {
689
+ }): TableRowsData & {
364
690
  rows: unknown[][];
365
691
  };
366
692
  declare function tableFromRecords<T extends Record<string, unknown>>({ title, data }: {
367
693
  title?: string;
368
694
  data: T[];
369
- }): TableData & {
695
+ }): TableRowsData & {
370
696
  rows: unknown[][];
371
697
  };
372
698
  declare function tableSections({ title, columns, sections }: {
373
699
  title?: string;
374
700
  columns?: TableColumn[];
375
701
  sections: [TableSection | TableBuilder, ...(TableSection | TableBuilder)[]];
376
- }): TableData & {
702
+ }): TableRowsData & {
377
703
  sections: [TableSection, ...TableSection[]];
378
704
  };
379
705
 
@@ -421,7 +747,8 @@ declare function addSpan(type: 'message', name: string, opts?: MessageSpanOption
421
747
  declare function addSpan<T>(type: Exclude<SpanType, 'group'>, name: string, fn: () => Promise<T>): Promise<T>;
422
748
  declare function addSpan<T>(type: Exclude<SpanType, 'group'>, name: string, opts: SpanOptions, fn: () => Promise<T>): Promise<T>;
423
749
  declare function addGroup(name: string, builder: (g: SpanGroup) => void, options?: GroupSpanOptions): void;
424
- declare function addMessage(name: string, text: string, opts?: MessageSpanOptions): void;
750
+ declare function addMessage(name: string, text?: string, opts?: MessageSpanOptions): void;
751
+ declare function addCalculation(name: string, calcs: CalculationLike | CalculationLike[], opts?: CalculationSpanOptions): void;
425
752
  declare function addAlert(label: string, level: SpanAlertLevel, opts?: SpanAlertOptions): void;
426
753
  declare function named<T>(name: string, fn: () => Promise<T>): Promise<T>;
427
754
  declare function addMetadata(data: Metadata): void;
@@ -437,6 +764,7 @@ declare const recount: {
437
764
  addSpan: typeof addSpan;
438
765
  addGroup: typeof addGroup;
439
766
  addMessage: typeof addMessage;
767
+ addCalculation: typeof addCalculation;
440
768
  addAlert: typeof addAlert;
441
769
  addMetadata: typeof addMetadata;
442
770
  fetch: typeof fetch;
@@ -445,11 +773,31 @@ declare const recount: {
445
773
  tableFromRecords: typeof tableFromRecords;
446
774
  tableSections: typeof tableSections;
447
775
  spanCell: typeof spanCell;
776
+ cell: typeof cell;
777
+ calculation: typeof calculation;
448
778
  chart: typeof chart;
449
779
  chartFromRecords: typeof chartFromRecords;
780
+ units: {
781
+ readonly percent: "%";
782
+ readonly days: "days";
783
+ readonly months: "months";
784
+ readonly years: "years";
785
+ readonly hours: "hours";
786
+ readonly kWh: "kWh";
787
+ readonly MWh: "MWh";
788
+ readonly MJ: "MJ";
789
+ readonly GJ: "GJ";
790
+ readonly kW: "kW";
791
+ readonly kVA: "kVA";
792
+ readonly kWhPerYear: "kWh/yr";
793
+ readonly m2: "m²";
794
+ readonly panels: "panels";
795
+ readonly per: (unit: string, per: string) => string;
796
+ readonly perDay: (unit: string) => string;
797
+ };
450
798
  REDACTED: {
451
799
  readonly __redacted: true;
452
800
  };
453
801
  };
454
802
 
455
- export { type ChartData, type ChartReferenceLine, type ChartSeries, type ChartSpanOptions, type ChartType, type DbParamValue, type DbSpanMetadata, type DbSpanOptions, type GroupSpanOptions, type HttpContentType, type HttpMethod, type HttpRequestInput, type HttpResponseOutput, type HttpSpanOptions, type ImageSpanData, type ImageSpanOptions, type IngestPayload, type IngestResult, type JsonObject, type JsonSpanOptions, type LlmMessage, type LlmSpanInput, type LlmSpanOptions, type LlmSpanOutput, type MessageSpanLevel, type MessageSpanOptions, type Metadata, REDACTED, Recount, RecountError, type RecountOptions, type RetentionPeriod, type Span, type SpanAlert, type SpanAlertCheck, type SpanAlertLevel, type SpanAlertOptions, type SpanBaseOptions, SpanGroup, type SpanOptions, type SpanType, type TableCellSpan, type TableColumn, type TableData, type TableDataFlat, type TableHighlight, type TableSection, type TableSpanOptions, type TableSummaryStat, type TraceOptions, addAlert, addGroup, addMessage, addMetadata, addSpan, chart, chartFromRecords, recount as default, fetch, init, named, spanCell, startTrace, table, tableFromObject, tableFromRecords, tableSections };
803
+ export { type Calculation, type CalculationAlerts, CalculationBuilder, type CalculationColumnLabels, type CalculationExpected, type CalculationInput, type CalculationLayout, type CalculationLike, type CalculationLine, type CalculationLineKind, type CalculationOptions, type CalculationSpanOptions, type CalculationTolerance, type CalculationValue, type CellFormat, type CellFormatOptions, type ChargeOptions, type ChartData, type ChartReferenceLine, type ChartSeries, type ChartSpanOptions, type ChartType, type DbParamValue, type DbSpanMetadata, type DbSpanOptions, type DecimalLike, type GroupSpanOptions, type HttpContentType, type HttpMethod, type HttpRequestInput, type HttpResponseOutput, type HttpSpanOptions, type ImageSpanData, type ImageSpanOptions, type IngestPayload, type IngestResult, type InputOptions, type JsonObject, type JsonSpanOptions, type LineOptions, type LlmMessage, type LlmSpanInput, type LlmSpanOptions, type LlmSpanOutput, type MessageSpanLevel, type MessageSpanOptions, type Metadata, type Operand, type PercentOfOptions, REDACTED, Recount, RecountError, type RecountOptions, type RetentionPeriod, type SignHighlight, type Span, type SpanAlert, type SpanAlertCheck, type SpanAlertLevel, type SpanAlertOptions, type SpanBaseOptions, SpanGroup, type SpanOptions, type SpanType, type StatedOptions, type TableCalculationData, type TableCellSpan, type TableColumn, type TableData, type TableDataFlat, type TableHighlight, type TableRowsData, type TableSection, type TableSpanOptions, type TableSummaryStat, type TableTypedCell, type TaxIncludedOptions, type TierBand, type TiersOptions, type TraceOptions, addAlert, addCalculation, addGroup, addMessage, addMetadata, addSpan, calculation, cell, chart, chartFromRecords, recount as default, fetch, init, named, spanCell, startTrace, table, tableFromObject, tableFromRecords, tableSections, units };