@reifydb/core 0.9.3 → 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.ts CHANGED
@@ -8,8 +8,8 @@ declare const ROW_NUMBER_KEY = "#rownum";
8
8
  */
9
9
  declare class BlobValue implements Value {
10
10
  readonly type: Type;
11
- private readonly bytes?;
12
- constructor(value?: Uint8Array | ArrayBuffer | string | number[]);
11
+ private readonly bytes;
12
+ constructor(value: Uint8Array | ArrayBuffer | string | number[]);
13
13
  /**
14
14
  * Create a new BLOB from raw bytes
15
15
  */
@@ -66,7 +66,7 @@ declare class BlobValue implements Value {
66
66
  * Format as hex string with 0x prefix
67
67
  */
68
68
  toString(): string;
69
- valueOf(): Uint8Array | undefined;
69
+ valueOf(): Uint8Array;
70
70
  /**
71
71
  * Get the internal representation
72
72
  */
@@ -79,25 +79,29 @@ declare class BlobValue implements Value {
79
79
  * Helper to parse a string as hex
80
80
  */
81
81
  private static parseString;
82
- toJSON(): string | null;
82
+ toJSON(): string;
83
83
  encode(): TypeValuePair;
84
84
  }
85
85
 
86
86
  declare class BooleanValue implements Value {
87
87
  readonly type: Type;
88
- readonly value?: boolean;
89
- constructor(value?: boolean);
88
+ readonly value: boolean;
89
+ constructor(value: boolean);
90
90
  static parse(str: string): BooleanValue;
91
- valueOf(): boolean | undefined;
91
+ valueOf(): boolean;
92
92
  toString(): string;
93
93
  /**
94
94
  * Compare two boolean values for equality
95
95
  */
96
96
  equals(other: Value): boolean;
97
- toJSON(): boolean | null;
97
+ toJSON(): boolean;
98
98
  encode(): TypeValuePair;
99
99
  }
100
100
 
101
+ interface DateComponents {
102
+ months: number;
103
+ days: number;
104
+ }
101
105
  /**
102
106
  * A date value representing a calendar date (year, month, day) without time information.
103
107
  * Always interpreted in UTC.
@@ -105,9 +109,9 @@ declare class BooleanValue implements Value {
105
109
  */
106
110
  declare class DateValue implements Value {
107
111
  readonly type: Type;
108
- private readonly months?;
109
- private readonly days?;
110
- constructor(value?: Date | string | number);
112
+ private readonly months;
113
+ private readonly days;
114
+ constructor(value: Date | string | number | DateComponents);
111
115
  /**
112
116
  * Create a DateValue from year, month (1-12), and day (1-31)
113
117
  */
@@ -174,12 +178,12 @@ declare class DateValue implements Value {
174
178
  */
175
179
  declare class TimeValue implements Value {
176
180
  readonly type: Type;
177
- readonly value?: bigint;
181
+ readonly value: bigint;
178
182
  private static readonly NANOS_PER_SECOND;
179
183
  private static readonly NANOS_PER_MINUTE;
180
184
  private static readonly NANOS_PER_HOUR;
181
185
  private static readonly NANOS_PER_DAY;
182
- constructor(value?: bigint | string | number);
186
+ constructor(value: bigint | string | number);
183
187
  /**
184
188
  * Create a TimeValue from hour, minute, second, and nanosecond
185
189
  */
@@ -228,7 +232,7 @@ declare class TimeValue implements Value {
228
232
  * Format as HH:MM:SS.nnnnnnnnn string
229
233
  */
230
234
  toString(): string;
231
- valueOf(): bigint | undefined;
235
+ valueOf(): bigint;
232
236
  /**
233
237
  * Helper to parse HH:MM:SS[.nnnnnnnnn] format
234
238
  */
@@ -237,7 +241,7 @@ declare class TimeValue implements Value {
237
241
  * Compare two Time values for equality
238
242
  */
239
243
  equals(other: Value): boolean;
240
- toJSON(): string | null;
244
+ toJSON(): string;
241
245
  encode(): TypeValuePair;
242
246
  }
243
247
 
@@ -246,12 +250,17 @@ declare class TimeValue implements Value {
246
250
  * Always in UTC timezone.
247
251
  * Internally stored as months, days, and nanoseconds.
248
252
  */
253
+ interface DateTimeComponents {
254
+ months: number;
255
+ days: number;
256
+ nanos: bigint;
257
+ }
249
258
  declare class DateTimeValue implements Value {
250
259
  readonly type: Type;
251
- private readonly months?;
252
- private readonly days?;
253
- private readonly nanos?;
254
- constructor(value?: Date | string | number | bigint);
260
+ private readonly months;
261
+ private readonly days;
262
+ private readonly nanos;
263
+ constructor(value: Date | string | number | bigint | DateTimeComponents);
255
264
  /**
256
265
  * Create a DateTimeValue from year, month, day, hour, minute, second, nanosecond
257
266
  */
@@ -316,7 +325,7 @@ declare class DateTimeValue implements Value {
316
325
  * Format as ISO 8601 string with nanosecond precision and Z suffix
317
326
  */
318
327
  toString(): string;
319
- valueOf(): Date | undefined;
328
+ valueOf(): Date;
320
329
  /**
321
330
  * Get the internal representation as a Date
322
331
  */
@@ -333,137 +342,165 @@ declare class DateTimeValue implements Value {
333
342
  * Compare two datetimes for equality
334
343
  */
335
344
  equals(other: Value): boolean;
336
- toJSON(): string | null;
345
+ toJSON(): string;
337
346
  encode(): TypeValuePair;
338
347
  }
339
348
 
340
349
  declare class DecimalValue implements Value {
341
350
  readonly type: Type;
342
- readonly value?: string;
343
- constructor(value?: string);
351
+ readonly value: string;
352
+ constructor(value: string);
344
353
  static parse(str: string): DecimalValue;
345
- valueOf(): string | undefined;
354
+ valueOf(): string;
346
355
  toString(): string;
347
356
  equals(other: Value): boolean;
348
- toJSON(): string | null;
357
+ toJSON(): string;
349
358
  encode(): TypeValuePair;
350
359
  }
351
360
 
361
+ declare function digestType(inner: string, accuracy: number): DigestType;
362
+ declare function digestTypeName(type: DigestType): string;
363
+ declare class DigestValue implements Value {
364
+ readonly type: DigestType;
365
+ readonly inner: DigestInnerType;
366
+ readonly accuracy: number;
367
+ readonly count: bigint;
368
+ private readonly bytes;
369
+ constructor(bytes: Uint8Array);
370
+ static parse(str: string, type: DigestType): DigestValue;
371
+ asBytes(): Uint8Array;
372
+ toString(): string;
373
+ equals(other: Value): boolean;
374
+ toJSON(): string;
375
+ encode(): TypeValuePair;
376
+ }
377
+
378
+ declare const FIXED_POINT_MAX_PRECISION = 76;
379
+ declare const FIXED_POINT_NARROW_PRECISION = 38;
380
+ declare const DECIMAL_DEFAULT_SCALE = 10;
381
+ declare function decimalType(precision?: number, scale?: number): DecimalType;
382
+ declare function fixedPointType(kind: FixedPointKind, precision: number, scale: number): FixedPointType;
383
+ declare function isFixedPointType(t: Type): t is FixedPointType;
384
+ declare function fixedPointKind(t: FixedPointType): FixedPointKind;
385
+ declare function fixedPointPrecision(t: FixedPointType): number;
386
+ declare function fixedPointScale(t: FixedPointType): number;
387
+ declare function fixedPointTypeName(t: FixedPointType): string;
388
+
352
389
  declare class Float4Value implements Value {
353
390
  private static readonly MAX_VALUE;
354
391
  private static readonly MIN_VALUE;
355
392
  private static readonly MIN_POSITIVE;
356
393
  readonly type: Type;
357
- readonly value?: number;
358
- constructor(value?: number);
394
+ readonly value: number;
395
+ constructor(value: number);
359
396
  static parse(str: string): Float4Value;
360
- valueOf(): number | undefined;
397
+ valueOf(): number;
361
398
  toString(): string;
362
399
  /**
363
400
  * Compare two Float4 values for equality with limited precision
364
401
  */
365
402
  equals(other: Value): boolean;
366
- toJSON(): string | null;
403
+ toJSON(): string;
367
404
  encode(): TypeValuePair;
368
405
  }
369
406
 
370
407
  declare class Float8Value implements Value {
371
408
  readonly type: Type;
372
- readonly value?: number;
373
- constructor(value?: number);
409
+ readonly value: number;
410
+ constructor(value: number);
374
411
  static parse(str: string): Float8Value;
375
- valueOf(): number | undefined;
412
+ valueOf(): number;
376
413
  toString(): string;
377
414
  /**
378
415
  * Compare two Float8 values for equality
379
416
  */
380
417
  equals(other: Value): boolean;
381
- toJSON(): string | null;
418
+ toJSON(): string;
382
419
  encode(): TypeValuePair;
383
420
  }
384
421
 
385
422
  declare class Int1Value implements Value {
386
423
  readonly type: Type;
387
- readonly value?: number;
424
+ readonly value: number;
388
425
  private static readonly MIN_VALUE;
389
426
  private static readonly MAX_VALUE;
390
- constructor(value?: number);
427
+ constructor(value: number);
391
428
  static parse(str: string): Int1Value;
392
- valueOf(): number | undefined;
429
+ valueOf(): number;
393
430
  toString(): string;
394
431
  /**
395
432
  * Compare two Int1 values for equality
396
433
  */
397
434
  equals(other: Value): boolean;
398
- toJSON(): string | null;
435
+ toJSON(): string;
399
436
  encode(): TypeValuePair;
400
437
  }
401
438
 
402
439
  declare class Int2Value implements Value {
403
440
  readonly type: Type;
404
- readonly value?: number;
441
+ readonly value: number;
405
442
  private static readonly MIN_VALUE;
406
443
  private static readonly MAX_VALUE;
407
- constructor(value?: number);
444
+ constructor(value: number);
408
445
  static parse(str: string): Int2Value;
409
- valueOf(): number | undefined;
446
+ valueOf(): number;
410
447
  toString(): string;
411
448
  /**
412
449
  * Compare two Int2 values for equality
413
450
  */
414
451
  equals(other: Value): boolean;
415
- toJSON(): string | null;
452
+ toJSON(): string;
416
453
  encode(): TypeValuePair;
417
454
  }
418
455
 
419
456
  declare class Int4Value implements Value {
420
457
  readonly type: Type;
421
- readonly value?: number;
458
+ readonly value: number;
422
459
  private static readonly MIN_VALUE;
423
460
  private static readonly MAX_VALUE;
424
- constructor(value?: number);
461
+ constructor(value: number);
425
462
  static parse(str: string): Int4Value;
426
- valueOf(): number | undefined;
463
+ valueOf(): number;
427
464
  toString(): string;
428
465
  /**
429
466
  * Compare two Int4 values for equality
430
467
  */
431
468
  equals(other: Value): boolean;
432
- toJSON(): string | null;
469
+ toJSON(): string;
433
470
  encode(): TypeValuePair;
434
471
  }
435
472
 
436
473
  declare class Int8Value implements Value {
437
474
  readonly type: Type;
438
- readonly value?: bigint;
475
+ readonly value: bigint;
439
476
  private static readonly MIN_VALUE;
440
477
  private static readonly MAX_VALUE;
441
- constructor(value?: bigint | number);
478
+ constructor(value: bigint | number);
442
479
  static parse(str: string): Int8Value;
443
- valueOf(): bigint | undefined;
480
+ valueOf(): bigint;
444
481
  toString(): string;
445
482
  /**
446
483
  * Compare two Int8 values for equality
447
484
  */
448
485
  equals(other: Value): boolean;
449
- toJSON(): string | null;
486
+ toJSON(): string;
450
487
  encode(): TypeValuePair;
451
488
  }
452
489
 
453
490
  declare class Int16Value implements Value {
454
491
  readonly type: Type;
455
- readonly value?: bigint;
492
+ readonly value: bigint;
456
493
  private static readonly MIN_VALUE;
457
494
  private static readonly MAX_VALUE;
458
- constructor(value?: bigint | number | string);
495
+ constructor(value: bigint | number | string);
459
496
  static parse(str: string): Int16Value;
460
- valueOf(): bigint | undefined;
497
+ valueOf(): bigint;
461
498
  toString(): string;
462
499
  /**
463
500
  * Compare two Int16 values for equality
464
501
  */
465
502
  equals(other: Value): boolean;
466
- toJSON(): string | null;
503
+ toJSON(): string;
467
504
  encode(): TypeValuePair;
468
505
  }
469
506
 
@@ -473,10 +510,10 @@ declare class Int16Value implements Value {
473
510
  */
474
511
  declare class DurationValue implements Value {
475
512
  readonly type: Type;
476
- private readonly months?;
477
- private readonly days?;
478
- private readonly nanos?;
479
- constructor(value?: {
513
+ private readonly months;
514
+ private readonly days;
515
+ private readonly nanos;
516
+ constructor(value: {
480
517
  months: number;
481
518
  days: number;
482
519
  nanos: bigint;
@@ -619,93 +656,93 @@ declare class DurationValue implements Value {
619
656
  * Compare two durations for equality
620
657
  */
621
658
  equals(other: Value): boolean;
622
- toJSON(): string | null;
659
+ toJSON(): string;
623
660
  encode(): TypeValuePair;
624
661
  }
625
662
 
626
663
  declare class Uint1Value implements Value {
627
664
  readonly type: Type;
628
- readonly value?: number;
665
+ readonly value: number;
629
666
  private static readonly MIN_VALUE;
630
667
  private static readonly MAX_VALUE;
631
- constructor(value?: number);
668
+ constructor(value: number);
632
669
  static parse(str: string): Uint1Value;
633
- valueOf(): number | undefined;
670
+ valueOf(): number;
634
671
  toString(): string;
635
672
  /**
636
673
  * Compare two Uint1 values for equality
637
674
  */
638
675
  equals(other: Value): boolean;
639
- toJSON(): string | null;
676
+ toJSON(): string;
640
677
  encode(): TypeValuePair;
641
678
  }
642
679
 
643
680
  declare class Uint2Value implements Value {
644
681
  readonly type: Type;
645
- readonly value?: number;
682
+ readonly value: number;
646
683
  private static readonly MIN_VALUE;
647
684
  private static readonly MAX_VALUE;
648
- constructor(value?: number);
685
+ constructor(value: number);
649
686
  static parse(str: string): Uint2Value;
650
- valueOf(): number | undefined;
687
+ valueOf(): number;
651
688
  toString(): string;
652
689
  /**
653
690
  * Compare two Uint2 values for equality
654
691
  */
655
692
  equals(other: Value): boolean;
656
- toJSON(): string | null;
693
+ toJSON(): string;
657
694
  encode(): TypeValuePair;
658
695
  }
659
696
 
660
697
  declare class Uint4Value implements Value {
661
698
  readonly type: Type;
662
- readonly value?: number;
699
+ readonly value: number;
663
700
  private static readonly MIN_VALUE;
664
701
  private static readonly MAX_VALUE;
665
- constructor(value?: number);
702
+ constructor(value: number);
666
703
  static parse(str: string): Uint4Value;
667
- valueOf(): number | undefined;
704
+ valueOf(): number;
668
705
  toString(): string;
669
706
  /**
670
707
  * Compare two Uint4 values for equality
671
708
  */
672
709
  equals(other: Value): boolean;
673
- toJSON(): string | null;
710
+ toJSON(): string;
674
711
  encode(): TypeValuePair;
675
712
  }
676
713
 
677
714
  declare class Uint8Value implements Value {
678
715
  readonly type: Type;
679
- readonly value?: bigint;
716
+ readonly value: bigint;
680
717
  private static readonly MIN_VALUE;
681
718
  private static readonly MAX_VALUE;
682
- constructor(value?: bigint | number);
719
+ constructor(value: bigint | number);
683
720
  static parse(str: string): Uint8Value;
684
- valueOf(): bigint | undefined;
721
+ valueOf(): bigint;
685
722
  toNumber(): number | undefined;
686
723
  toString(): string;
687
724
  /**
688
725
  * Compare two Uint8 values for equality
689
726
  */
690
727
  equals(other: Value): boolean;
691
- toJSON(): string | null;
728
+ toJSON(): string;
692
729
  encode(): TypeValuePair;
693
730
  }
694
731
 
695
732
  declare class Uint16Value implements Value {
696
733
  readonly type: Type;
697
- readonly value?: bigint;
734
+ readonly value: bigint;
698
735
  private static readonly MIN_VALUE;
699
736
  private static readonly MAX_VALUE;
700
- constructor(value?: bigint | number | string);
737
+ constructor(value: bigint | number | string);
701
738
  static parse(str: string): Uint16Value;
702
- valueOf(): bigint | undefined;
739
+ valueOf(): bigint;
703
740
  toString(): string;
704
741
  /**
705
742
  * Compare two Uint16 values for equality
706
743
  */
707
744
  equals(other: Value): boolean;
708
- toJSON(): string | null;
745
+ toJSON(): string;
709
746
  encode(): TypeValuePair;
710
747
  }
711
748
 
@@ -745,16 +782,16 @@ declare class Option<T> {
745
782
 
746
783
  declare class Utf8Value implements Value {
747
784
  readonly type: Type;
748
- readonly value?: string;
749
- constructor(value?: string);
785
+ readonly value: string;
786
+ constructor(value: string);
750
787
  static parse(str: string): Utf8Value;
751
- valueOf(): string | undefined;
788
+ valueOf(): string;
752
789
  toString(): string;
753
790
  /**
754
791
  * Compare two Utf8 values for equality
755
792
  */
756
793
  equals(other: Value): boolean;
757
- toJSON(): string | null;
794
+ toJSON(): string;
758
795
  encode(): TypeValuePair;
759
796
  }
760
797
 
@@ -763,8 +800,8 @@ declare class Utf8Value implements Value {
763
800
  */
764
801
  declare class Uuid4Value implements Value {
765
802
  readonly type: Type;
766
- private readonly uuid?;
767
- constructor(value?: string);
803
+ private readonly uuid;
804
+ constructor(value: string);
768
805
  /**
769
806
  * Generate a new random UUID v4
770
807
  */
@@ -805,7 +842,7 @@ declare class Uuid4Value implements Value {
805
842
  * Format as string
806
843
  */
807
844
  toString(): string;
808
- valueOf(): string | undefined;
845
+ valueOf(): string;
809
846
  /**
810
847
  * Get the internal representation
811
848
  */
@@ -818,7 +855,7 @@ declare class Uuid4Value implements Value {
818
855
  * Compare two UUID4 values (for ordering)
819
856
  */
820
857
  compare(other: Uuid4Value): number;
821
- toJSON(): string | null;
858
+ toJSON(): string;
822
859
  encode(): TypeValuePair;
823
860
  }
824
861
 
@@ -827,8 +864,8 @@ declare class Uuid4Value implements Value {
827
864
  */
828
865
  declare class Uuid7Value implements Value {
829
866
  readonly type: Type;
830
- private readonly uuid?;
831
- constructor(value?: string);
867
+ private readonly uuid;
868
+ constructor(value: string);
832
869
  /**
833
870
  * Generate a new timestamp-based UUID v7
834
871
  */
@@ -873,7 +910,7 @@ declare class Uuid7Value implements Value {
873
910
  * Format as string
874
911
  */
875
912
  toString(): string;
876
- valueOf(): string | undefined;
913
+ valueOf(): string;
877
914
  /**
878
915
  * Get the internal representation
879
916
  */
@@ -887,7 +924,7 @@ declare class Uuid7Value implements Value {
887
924
  * UUID v7 has timestamp-based ordering for UUIDs generated close in time
888
925
  */
889
926
  compare(other: Uuid7Value): number;
890
- toJSON(): string | null;
927
+ toJSON(): string;
891
928
  encode(): TypeValuePair;
892
929
  }
893
930
 
@@ -896,8 +933,8 @@ declare class Uuid7Value implements Value {
896
933
  */
897
934
  declare class IdentityIdValue implements Value {
898
935
  readonly type: Type;
899
- readonly value?: string;
900
- constructor(value?: string);
936
+ readonly value: string;
937
+ constructor(value: string);
901
938
  /**
902
939
  * Generate a new IdentityId with a UUID v7
903
940
  */
@@ -913,7 +950,7 @@ declare class IdentityIdValue implements Value {
913
950
  /**
914
951
  * Get the UUID string value
915
952
  */
916
- valueOf(): string | undefined;
953
+ valueOf(): string;
917
954
  /**
918
955
  * Format as string
919
956
  */
@@ -930,7 +967,28 @@ declare class IdentityIdValue implements Value {
930
967
  * Compare two IdentityId values for equality
931
968
  */
932
969
  equals(other: Value): boolean;
933
- toJSON(): string | null;
970
+ toJSON(): string;
971
+ encode(): TypeValuePair;
972
+ }
973
+
974
+ declare class ListValue implements Value {
975
+ readonly items: Value[];
976
+ private readonly elementType?;
977
+ constructor(items: Value[], elementType?: Type);
978
+ get type(): ListType;
979
+ equals(other: Value): boolean;
980
+ toString(): string;
981
+ toJSON(): unknown;
982
+ encode(): TypeValuePair;
983
+ }
984
+
985
+ declare class RecordValue implements Value {
986
+ readonly fields: Record<string, Value>;
987
+ constructor(fields: Record<string, Value>);
988
+ get type(): RecordType;
989
+ equals(other: Value): boolean;
990
+ toString(): string;
991
+ toJSON(): unknown;
934
992
  encode(): TypeValuePair;
935
993
  }
936
994
 
@@ -941,9 +999,16 @@ declare class IdentityIdValue implements Value {
941
999
  * functions are the only crossing between the two, so a wire descriptor never reaches code that expects
942
1000
  * `{Option: ...}` and a client type never reaches the server expecting `{id, underlying}`.
943
1001
  */
1002
+ interface WireRecordField {
1003
+ name: string;
1004
+ type: WireType;
1005
+ }
944
1006
  interface WireType {
945
1007
  id: string;
946
- underlying?: WireType;
1008
+ underlying?: WireType | WireRecordField[];
1009
+ accuracy?: number;
1010
+ precision?: number;
1011
+ scale?: number;
947
1012
  }
948
1013
  declare function typeToWire(type: Type): WireType;
949
1014
  declare function typeFromWire(wire: WireType): Type;
@@ -963,28 +1028,61 @@ declare function framesFromWire(frames: any[]): any[];
963
1028
  declare function envelopeToColumns(envelope: any): {
964
1029
  name: string;
965
1030
  type: Type;
966
- payload: string[];
1031
+ payload: WireCellValue[];
967
1032
  }[];
968
1033
  declare function envelopesToFrames(envelopes: any): {
969
1034
  columns: {
970
1035
  name: string;
971
1036
  type: Type;
972
- payload: string[];
1037
+ payload: WireCellValue[];
973
1038
  }[];
1039
+ row_numbers?: number[];
974
1040
  }[];
975
1041
 
976
1042
  type BaseType = "Blob" | "Boolean" | "Decimal" | "Float4" | "Float8" | "Int1" | "Int2" | "Int4" | "Int8" | "Int16" | "Uint1" | "Uint2" | "Uint4" | "Uint8" | "Uint16" | "Utf8" | "Date" | "DateTime" | "Time" | "Duration" | "Uuid4" | "Uuid7" | "IdentityId" | "None";
977
1043
  interface OptionType {
978
1044
  Option: Type;
979
1045
  }
980
- type Type = BaseType | OptionType;
1046
+ type DigestInnerType = "Float4" | "Float8" | "Int1" | "Int2" | "Int4" | "Int8" | "Int16" | "Uint1" | "Uint2" | "Uint4" | "Uint8" | "Uint16" | "Duration";
1047
+ interface DigestType {
1048
+ Digest: {
1049
+ inner: DigestInnerType;
1050
+ accuracy: number;
1051
+ };
1052
+ }
1053
+ type FixedPointKind = "Decimal";
1054
+ interface DecimalType {
1055
+ Decimal: {
1056
+ precision: number;
1057
+ scale: number;
1058
+ };
1059
+ }
1060
+ type FixedPointType = DecimalType;
1061
+ interface RecordField {
1062
+ name: string;
1063
+ type: Type;
1064
+ }
1065
+ interface ListType {
1066
+ List: Type;
1067
+ }
1068
+ interface RecordType {
1069
+ Record: RecordField[];
1070
+ }
1071
+ type Type = BaseType | OptionType | DigestType | FixedPointType | ListType | RecordType;
981
1072
  declare function isOptionType(t: Type): t is OptionType;
982
- declare function unwrapOptionType(t: Type): BaseType;
1073
+ declare function isDigestType(t: Type): t is DigestType;
1074
+ declare function isListType(t: Type): t is ListType;
1075
+ declare function isRecordType(t: Type): t is RecordType;
1076
+ declare function unwrapOptionType(t: Type): BaseType | DigestType | FixedPointType | ListType | RecordType;
983
1077
  declare function optionDepth(t: Type): number;
984
1078
  declare function innerOfOption(t: OptionType): Type;
1079
+ /** A wire cell: a JSON bool for Boolean, a plain string for every other scalar type, or a real JSON array/object for List/Record. */
1080
+ type WireCellValue = string | boolean | WireCellValue[] | {
1081
+ [key: string]: WireCellValue;
1082
+ };
985
1083
  interface TypeValuePair {
986
1084
  type: Type;
987
- value: string;
1085
+ value: WireCellValue;
988
1086
  }
989
1087
  declare abstract class Value {
990
1088
  abstract readonly type: Type;
@@ -1179,7 +1277,7 @@ interface Diagnostic {
1179
1277
  interface Column {
1180
1278
  name: string;
1181
1279
  type: Type;
1182
- payload: string[];
1280
+ payload: WireCellValue[];
1183
1281
  }
1184
1282
  interface ErrorResponse {
1185
1283
  id: string;
@@ -1215,13 +1313,13 @@ type SingleFrameResult<S extends ShapeNode> = InferShape<S>[];
1215
1313
  declare function asFrameResults<S extends readonly ShapeNode[]>(results: any): FrameResults<S>;
1216
1314
 
1217
1315
  declare function decode(pair: TypeValuePair): Value;
1218
- declare function columnsToRows(columns: Column[]): Record<string, Value>[];
1316
+ declare function columnsToRows(columns: Column[], rowNumbers?: (string | number)[]): Record<string, Value>[];
1219
1317
 
1220
1318
  declare function encodeValue(value: any, name?: string): TypeValuePair;
1221
1319
  /** A parameter as it goes on the wire: the same value, with the type in the wire's own rendering. */
1222
1320
  interface WireValue {
1223
1321
  type: WireType;
1224
- value: string;
1322
+ value: WireCellValue;
1225
1323
  }
1226
1324
  declare function encodeParams(params: any): WireValue[] | Record<string, WireValue>;
1227
1325
 
@@ -1249,15 +1347,14 @@ declare const TYPE_CODE: {
1249
1347
  readonly Uuid4: 20;
1250
1348
  readonly Uuid7: 21;
1251
1349
  readonly Blob: 22;
1252
- readonly Int: 23;
1253
- readonly Uint: 24;
1254
- readonly Decimal: 25;
1255
- readonly Any: 26;
1256
- readonly DictionaryId: 27;
1257
- readonly Type: 28;
1258
- readonly List: 29;
1259
- readonly Record: 30;
1260
- readonly Tuple: 31;
1350
+ readonly Decimal: 23;
1351
+ readonly Any: 24;
1352
+ readonly DictionaryId: 25;
1353
+ readonly Type: 26;
1354
+ readonly List: 27;
1355
+ readonly Record: 28;
1356
+ readonly Tuple: 29;
1357
+ readonly Digest: 30;
1261
1358
  };
1262
1359
  type TypeName = keyof typeof TYPE_CODE;
1263
1360
  declare function typeNameFromCode(code: number): TypeName;
@@ -1319,4 +1416,4 @@ interface RqlToken {
1319
1416
  }
1320
1417
  declare function tokenizeRql(source: string): RqlToken[];
1321
1418
 
1322
- export { type ArrayShapeNode, type BaseType, BlobValue, BooleanValue, type Column, type ColumnAlign, DateTimeValue, DateValue, DecimalValue, type Diagnostic, type DiagnosticColumn, DurationValue, type ErrorResponse, Float4Value, Float8Value, type Fragment, type Frame, type FrameResults, IdentityIdValue, type InferShape, type InferShapes, Int16Value, Int1Value, Int2Value, Int4Value, Int8Value, type MissingPresentation, NONE_PRESENTATION, NONE_VALUE, NoneValue, type ObjectShapeNode, Option, type OptionShapeNode, type OptionType, type Params, type PlannedColumn, type PrimitiveShapeNode, type PrimitiveToTS, type PrimitiveToValue, ROW_NUMBER_KEY, RQL_KEYWORDS, RQL_LITERALS, RQL_OPERATORS, RQL_SYSTEM_COLUMNS, RQL_TYPES, ReifyError, type ResultColumn, type RqlToken, type RqlTokenKind, Shape, ShapeBuilder, ShapeMismatch, type ShapeNode, type SingleFrameResult, TYPE_CODE, type TableLayoutOptions, type TablePlan, TimeValue, type Type, type TypeName, type TypeValuePair, Uint16Value, Uint1Value, Uint2Value, Uint4Value, Uint8Value, Utf8Value, Uuid4Value, Uuid7Value, Value, type ValueRole, type ValueShapeNode, type WireType, asFrameResults, cellText, checkFrame, checkFrames, columnsFromWire, columnsToRows, decode, displayWidth, encodeParams, encodeValue, envelopeToColumns, envelopesToFrames, formatValue, framesFromWire, graphemeWidth, inferColumns, innerOfOption, isOption, isOptionType, noneDepth, noneMarker, noneMarkerDepth, optionDepth, padToWidth, parseValue, planTable, tokenizeRql, transformFrames, transformResult, truncateToWidth, typeFromWire, typeNameFromCode, typeToWire, unwrapOptionType, validateShape, valueRole, valueTypeName };
1419
+ export { type ArrayShapeNode, type BaseType, BlobValue, BooleanValue, type Column, type ColumnAlign, DECIMAL_DEFAULT_SCALE, DateTimeValue, DateValue, type DecimalType, DecimalValue, type Diagnostic, type DiagnosticColumn, type DigestInnerType, type DigestType, DigestValue, DurationValue, type ErrorResponse, FIXED_POINT_MAX_PRECISION, FIXED_POINT_NARROW_PRECISION, type FixedPointKind, type FixedPointType, Float4Value, Float8Value, type Fragment, type Frame, type FrameResults, IdentityIdValue, type InferShape, type InferShapes, Int16Value, Int1Value, Int2Value, Int4Value, Int8Value, type ListType, ListValue, type MissingPresentation, NONE_PRESENTATION, NONE_VALUE, NoneValue, type ObjectShapeNode, Option, type OptionShapeNode, type OptionType, type Params, type PlannedColumn, type PrimitiveShapeNode, type PrimitiveToTS, type PrimitiveToValue, ROW_NUMBER_KEY, RQL_KEYWORDS, RQL_LITERALS, RQL_OPERATORS, RQL_SYSTEM_COLUMNS, RQL_TYPES, type RecordField, type RecordType, RecordValue, ReifyError, type ResultColumn, type RqlToken, type RqlTokenKind, Shape, ShapeBuilder, ShapeMismatch, type ShapeNode, type SingleFrameResult, TYPE_CODE, type TableLayoutOptions, type TablePlan, TimeValue, type Type, type TypeName, type TypeValuePair, Uint16Value, Uint1Value, Uint2Value, Uint4Value, Uint8Value, Utf8Value, Uuid4Value, Uuid7Value, Value, type ValueRole, type ValueShapeNode, type WireCellValue, type WireType, asFrameResults, cellText, checkFrame, checkFrames, columnsFromWire, columnsToRows, decimalType, decode, digestType, digestTypeName, displayWidth, encodeParams, encodeValue, envelopeToColumns, envelopesToFrames, fixedPointKind, fixedPointPrecision, fixedPointScale, fixedPointType, fixedPointTypeName, formatValue, framesFromWire, graphemeWidth, inferColumns, innerOfOption, isDigestType, isFixedPointType, isListType, isOption, isOptionType, isRecordType, noneDepth, noneMarker, noneMarkerDepth, optionDepth, padToWidth, parseValue, planTable, tokenizeRql, transformFrames, transformResult, truncateToWidth, typeFromWire, typeNameFromCode, typeToWire, unwrapOptionType, validateShape, valueRole, valueTypeName };