@reifydb/core 0.0.1-alpha.1

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.
@@ -0,0 +1,1280 @@
1
+ /**
2
+ * MIT License
3
+ * Copyright (c) 2025 ReifyDB
4
+ * See license.md file for full license text
5
+ */
6
+ declare const UNDEFINED_VALUE = "\u27EAundefined\u27EB";
7
+
8
+ /**
9
+ * MIT License
10
+ * Copyright (c) 2025 ReifyDB
11
+ * See license.md file for full license text
12
+ */
13
+
14
+ /**
15
+ * A binary large object (BLOB) value that can hold arbitrary byte data.
16
+ */
17
+ declare class BlobValue implements Value {
18
+ readonly type: Type;
19
+ private readonly bytes?;
20
+ constructor(value?: Uint8Array | ArrayBuffer | string | number[]);
21
+ /**
22
+ * Create a new BLOB from raw bytes
23
+ */
24
+ static new(bytes: Uint8Array | number[]): BlobValue;
25
+ /**
26
+ * Create an empty BLOB
27
+ */
28
+ static empty(): BlobValue;
29
+ /**
30
+ * Create a BLOB from a byte array
31
+ */
32
+ static fromBytes(bytes: number[]): BlobValue;
33
+ /**
34
+ * Create a BLOB from a hex string
35
+ */
36
+ static fromHex(hex: string): BlobValue;
37
+ /**
38
+ * Create a BLOB from a base64 string
39
+ */
40
+ static fromBase64(base64: string): BlobValue;
41
+ /**
42
+ * Create a BLOB from a UTF-8 string
43
+ */
44
+ static fromUtf8(str: string): BlobValue;
45
+ /**
46
+ * Parse a blob string (hex or undefined)
47
+ */
48
+ static parse(str: string): BlobValue;
49
+ /**
50
+ * Get the raw bytes
51
+ */
52
+ asBytes(): Uint8Array | undefined;
53
+ /**
54
+ * Get the length in bytes
55
+ */
56
+ length(): number;
57
+ /**
58
+ * Check if the BLOB is empty
59
+ */
60
+ isEmpty(): boolean;
61
+ /**
62
+ * Convert to hex string with 0x prefix
63
+ */
64
+ toHex(): string | undefined;
65
+ /**
66
+ * Convert to base64 string
67
+ */
68
+ toBase64(): string | undefined;
69
+ /**
70
+ * Convert to UTF-8 string
71
+ */
72
+ toUtf8(): string | undefined;
73
+ /**
74
+ * Format as hex string with 0x prefix
75
+ */
76
+ toString(): string;
77
+ valueOf(): Uint8Array | undefined;
78
+ /**
79
+ * Get the internal representation
80
+ */
81
+ get value(): Uint8Array | undefined;
82
+ /**
83
+ * Compare two blobs for equality
84
+ */
85
+ equals(other: Value): boolean;
86
+ /**
87
+ * Helper to parse a string as hex
88
+ */
89
+ private static parseString;
90
+ encode(): TypeValuePair;
91
+ }
92
+
93
+ /**
94
+ * MIT License
95
+ * Copyright (c) 2025 ReifyDB
96
+ * See license.md file for full license text
97
+ */
98
+
99
+ declare class BoolValue implements Value {
100
+ readonly type: Type;
101
+ readonly value?: boolean;
102
+ constructor(value?: boolean);
103
+ static parse(str: string): BoolValue;
104
+ valueOf(): boolean | undefined;
105
+ toString(): string;
106
+ /**
107
+ * Compare two boolean values for equality
108
+ */
109
+ equals(other: Value): boolean;
110
+ encode(): TypeValuePair;
111
+ }
112
+
113
+ /**
114
+ * MIT License
115
+ * Copyright (c) 2025 ReifyDB
116
+ * See license.md file for full license text
117
+ */
118
+
119
+ /**
120
+ * A date value representing a calendar date (year, month, day) without time information.
121
+ * Always interpreted in UTC.
122
+ * Internally stored as months and days.
123
+ */
124
+ declare class DateValue implements Value {
125
+ readonly type: Type;
126
+ private readonly months?;
127
+ private readonly days?;
128
+ constructor(value?: Date | string | number);
129
+ /**
130
+ * Create a DateValue from year, month (1-12), and day (1-31)
131
+ */
132
+ static fromYMD(year: number, month: number, day: number): DateValue;
133
+ /**
134
+ * Get today's date (in UTC)
135
+ */
136
+ static today(): DateValue;
137
+ /**
138
+ * Parse a date string in YYYY-MM-DD format
139
+ */
140
+ static parse(str: string): DateValue;
141
+ /**
142
+ * Convert to days since Unix epoch (1970-01-01) for storage
143
+ */
144
+ toDaysSinceEpoch(): number | undefined;
145
+ /**
146
+ * Create from days since Unix epoch
147
+ */
148
+ static fromDaysSinceEpochToComponents(days: number): {
149
+ months: number;
150
+ days: number;
151
+ } | null;
152
+ /**
153
+ * Get the year component
154
+ */
155
+ year(): number | undefined;
156
+ /**
157
+ * Get the month component (1-12)
158
+ */
159
+ month(): number | undefined;
160
+ /**
161
+ * Get the day component (1-31)
162
+ */
163
+ day(): number | undefined;
164
+ /**
165
+ * Format as YYYY-MM-DD string
166
+ */
167
+ toString(): string;
168
+ valueOf(): Date | undefined;
169
+ /**
170
+ * Get the internal representation
171
+ */
172
+ get value(): Date | undefined;
173
+ /**
174
+ * Helper to parse YYYY-MM-DD format
175
+ */
176
+ private static parseDate;
177
+ /**
178
+ * Helper to validate a date
179
+ */
180
+ private static isValidDate;
181
+ /**
182
+ * Compare two dates for equality
183
+ */
184
+ equals(other: Value): boolean;
185
+ encode(): TypeValuePair;
186
+ }
187
+
188
+ /**
189
+ * MIT License
190
+ * Copyright (c) 2025 ReifyDB
191
+ * See license.md file for full license text
192
+ */
193
+
194
+ /**
195
+ * A time value representing time of day (hour, minute, second, nanosecond) without date information.
196
+ * Internally stored as nanoseconds since midnight.
197
+ */
198
+ declare class TimeValue implements Value {
199
+ readonly type: Type;
200
+ readonly value?: bigint;
201
+ private static readonly NANOS_PER_SECOND;
202
+ private static readonly NANOS_PER_MINUTE;
203
+ private static readonly NANOS_PER_HOUR;
204
+ private static readonly NANOS_PER_DAY;
205
+ constructor(value?: bigint | string | number);
206
+ /**
207
+ * Create a TimeValue from hour, minute, second, and nanosecond
208
+ */
209
+ static fromHMSN(hour: number, minute: number, second: number, nano?: number): TimeValue;
210
+ /**
211
+ * Create a TimeValue from hour, minute, and second (no fractional seconds)
212
+ */
213
+ static fromHMS(hour: number, minute: number, second: number): TimeValue;
214
+ /**
215
+ * Create midnight (00:00:00.000000000)
216
+ */
217
+ static midnight(): TimeValue;
218
+ /**
219
+ * Create noon (12:00:00.000000000)
220
+ */
221
+ static noon(): TimeValue;
222
+ /**
223
+ * Parse a time string in HH:MM:SS[.nnnnnnnnn] format
224
+ */
225
+ static parse(str: string): TimeValue;
226
+ /**
227
+ * Get the hour component (0-23)
228
+ */
229
+ hour(): number | undefined;
230
+ /**
231
+ * Get the minute component (0-59)
232
+ */
233
+ minute(): number | undefined;
234
+ /**
235
+ * Get the second component (0-59)
236
+ */
237
+ second(): number | undefined;
238
+ /**
239
+ * Get the nanosecond component (0-999999999)
240
+ */
241
+ nanosecond(): number | undefined;
242
+ /**
243
+ * Convert to nanoseconds since midnight for storage
244
+ */
245
+ toNanosSinceMidnight(): bigint | undefined;
246
+ /**
247
+ * Create from nanoseconds since midnight
248
+ */
249
+ static fromNanosSinceMidnight(nanos: bigint | number): TimeValue;
250
+ /**
251
+ * Format as HH:MM:SS.nnnnnnnnn string
252
+ */
253
+ toString(): string;
254
+ valueOf(): bigint | undefined;
255
+ /**
256
+ * Helper to parse HH:MM:SS[.nnnnnnnnn] format
257
+ */
258
+ private static parseTime;
259
+ /**
260
+ * Compare two Time values for equality
261
+ */
262
+ equals(other: Value): boolean;
263
+ encode(): TypeValuePair;
264
+ }
265
+
266
+ /**
267
+ * MIT License
268
+ * Copyright (c) 2025 ReifyDB
269
+ * See license.md file for full license text
270
+ */
271
+
272
+ /**
273
+ * A date and time value with nanosecond precision.
274
+ * Always in UTC timezone.
275
+ * Internally stored as months, days, and nanoseconds.
276
+ */
277
+ declare class DateTimeValue implements Value {
278
+ readonly type: Type;
279
+ private readonly months?;
280
+ private readonly days?;
281
+ private readonly nanos?;
282
+ constructor(value?: Date | string | number | bigint);
283
+ /**
284
+ * Create a DateTimeValue from year, month, day, hour, minute, second, nanosecond
285
+ */
286
+ static fromYMDHMSN(year: number, month: number, day: number, hour: number, minute: number, second: number, nano?: number): DateTimeValue;
287
+ /**
288
+ * Create a DateTimeValue from year, month, day, hour, minute, second (no fractional)
289
+ */
290
+ static fromYMDHMS(year: number, month: number, day: number, hour: number, minute: number, second: number): DateTimeValue;
291
+ /**
292
+ * Create from Unix timestamp in seconds
293
+ */
294
+ static fromTimestamp(seconds: number): DateTimeValue;
295
+ /**
296
+ * Create from Unix timestamp in milliseconds
297
+ */
298
+ static fromTimestampMillis(millis: number): DateTimeValue;
299
+ /**
300
+ * Create from nanoseconds since Unix epoch
301
+ */
302
+ static fromNanosSinceEpoch(nanos: bigint): DateTimeValue;
303
+ /**
304
+ * Create from separate seconds and nanoseconds
305
+ */
306
+ static fromParts(seconds: number, nanos: number): DateTimeValue;
307
+ /**
308
+ * Get current datetime
309
+ */
310
+ static now(): DateTimeValue;
311
+ /**
312
+ * Get default datetime (Unix epoch)
313
+ */
314
+ static default(): DateTimeValue;
315
+ /**
316
+ * Parse a datetime string in ISO 8601 format
317
+ */
318
+ static parse(str: string): DateTimeValue;
319
+ /**
320
+ * Get Unix timestamp in seconds
321
+ */
322
+ timestamp(): number | undefined;
323
+ /**
324
+ * Get Unix timestamp in nanoseconds
325
+ */
326
+ timestampNanos(): bigint | undefined;
327
+ /**
328
+ * Convert to nanoseconds since Unix epoch for storage
329
+ */
330
+ toNanosSinceEpoch(): bigint | undefined;
331
+ /**
332
+ * Get separate seconds and nanoseconds for storage
333
+ */
334
+ toParts(): [number, number] | undefined;
335
+ /**
336
+ * Get the date component
337
+ */
338
+ date(): DateValue | undefined;
339
+ /**
340
+ * Get the time component
341
+ */
342
+ time(): TimeValue | undefined;
343
+ /**
344
+ * Format as ISO 8601 string with nanosecond precision and Z suffix
345
+ */
346
+ toString(): string;
347
+ valueOf(): Date | undefined;
348
+ /**
349
+ * Get the internal representation as a Date
350
+ */
351
+ get value(): Date | undefined;
352
+ /**
353
+ * Helper to parse ISO 8601 datetime format
354
+ */
355
+ private static parseDateTime;
356
+ /**
357
+ * Helper to validate a date
358
+ */
359
+ private static isValidDate;
360
+ /**
361
+ * Compare two datetimes for equality
362
+ */
363
+ equals(other: Value): boolean;
364
+ encode(): TypeValuePair;
365
+ }
366
+
367
+ /**
368
+ * MIT License
369
+ * Copyright (c) 2025 ReifyDB
370
+ * See license.md file for full license text
371
+ */
372
+
373
+ declare class Float4Value implements Value {
374
+ private static readonly MAX_VALUE;
375
+ private static readonly MIN_VALUE;
376
+ private static readonly MIN_POSITIVE;
377
+ readonly type: Type;
378
+ readonly value?: number;
379
+ constructor(value?: number);
380
+ static parse(str: string): Float4Value;
381
+ valueOf(): number | undefined;
382
+ toString(): string;
383
+ /**
384
+ * Compare two Float4 values for equality with limited precision
385
+ */
386
+ equals(other: Value): boolean;
387
+ encode(): TypeValuePair;
388
+ }
389
+
390
+ /**
391
+ * MIT License
392
+ * Copyright (c) 2025 ReifyDB
393
+ * See license.md file for full license text
394
+ */
395
+
396
+ declare class Float8Value implements Value {
397
+ readonly type: Type;
398
+ readonly value?: number;
399
+ constructor(value?: number);
400
+ static parse(str: string): Float8Value;
401
+ valueOf(): number | undefined;
402
+ toString(): string;
403
+ /**
404
+ * Compare two Float8 values for equality
405
+ */
406
+ equals(other: Value): boolean;
407
+ encode(): TypeValuePair;
408
+ }
409
+
410
+ /**
411
+ * MIT License
412
+ * Copyright (c) 2025 ReifyDB
413
+ * See license.md file for full license text
414
+ */
415
+
416
+ declare class Int1Value implements Value {
417
+ readonly type: Type;
418
+ readonly value?: number;
419
+ private static readonly MIN_VALUE;
420
+ private static readonly MAX_VALUE;
421
+ constructor(value?: number);
422
+ static parse(str: string): Int1Value;
423
+ valueOf(): number | undefined;
424
+ toString(): string;
425
+ /**
426
+ * Compare two Int1 values for equality
427
+ */
428
+ equals(other: Value): boolean;
429
+ encode(): TypeValuePair;
430
+ }
431
+
432
+ /**
433
+ * MIT License
434
+ * Copyright (c) 2025 ReifyDB
435
+ * See license.md file for full license text
436
+ */
437
+
438
+ declare class Int2Value implements Value {
439
+ readonly type: Type;
440
+ readonly value?: number;
441
+ private static readonly MIN_VALUE;
442
+ private static readonly MAX_VALUE;
443
+ constructor(value?: number);
444
+ static parse(str: string): Int2Value;
445
+ valueOf(): number | undefined;
446
+ toString(): string;
447
+ /**
448
+ * Compare two Int2 values for equality
449
+ */
450
+ equals(other: Value): boolean;
451
+ encode(): TypeValuePair;
452
+ }
453
+
454
+ /**
455
+ * MIT License
456
+ * Copyright (c) 2025 ReifyDB
457
+ * See license.md file for full license text
458
+ */
459
+
460
+ declare class Int4Value implements Value {
461
+ readonly type: Type;
462
+ readonly value?: number;
463
+ private static readonly MIN_VALUE;
464
+ private static readonly MAX_VALUE;
465
+ constructor(value?: number);
466
+ static parse(str: string): Int4Value;
467
+ valueOf(): number | undefined;
468
+ toString(): string;
469
+ /**
470
+ * Compare two Int4 values for equality
471
+ */
472
+ equals(other: Value): boolean;
473
+ encode(): TypeValuePair;
474
+ }
475
+
476
+ /**
477
+ * MIT License
478
+ * Copyright (c) 2025 ReifyDB
479
+ * See license.md file for full license text
480
+ */
481
+
482
+ declare class Int8Value implements Value {
483
+ readonly type: Type;
484
+ readonly value?: bigint;
485
+ private static readonly MIN_VALUE;
486
+ private static readonly MAX_VALUE;
487
+ constructor(value?: bigint | number);
488
+ static parse(str: string): Int8Value;
489
+ valueOf(): bigint | undefined;
490
+ toString(): string;
491
+ /**
492
+ * Compare two Int8 values for equality
493
+ */
494
+ equals(other: Value): boolean;
495
+ encode(): TypeValuePair;
496
+ }
497
+
498
+ /**
499
+ * MIT License
500
+ * Copyright (c) 2025 ReifyDB
501
+ * See license.md file for full license text
502
+ */
503
+
504
+ declare class Int16Value implements Value {
505
+ readonly type: Type;
506
+ readonly value?: bigint;
507
+ private static readonly MIN_VALUE;
508
+ private static readonly MAX_VALUE;
509
+ constructor(value?: bigint | number | string);
510
+ static parse(str: string): Int16Value;
511
+ valueOf(): bigint | undefined;
512
+ toString(): string;
513
+ /**
514
+ * Compare two Int16 values for equality
515
+ */
516
+ equals(other: Value): boolean;
517
+ encode(): TypeValuePair;
518
+ }
519
+
520
+ /**
521
+ * MIT License
522
+ * Copyright (c) 2025 ReifyDB
523
+ * See license.md file for full license text
524
+ */
525
+
526
+ /**
527
+ * An interval value representing a duration between two points in time.
528
+ * Internally stored as months, days, and nanoseconds.
529
+ */
530
+ declare class IntervalValue implements Value {
531
+ readonly type: Type;
532
+ private readonly months?;
533
+ private readonly days?;
534
+ private readonly nanos?;
535
+ constructor(value?: {
536
+ months: number;
537
+ days: number;
538
+ nanos: bigint;
539
+ } | string);
540
+ /**
541
+ * Create a new interval from months, days, and nanoseconds
542
+ */
543
+ static new(months: number, days: number, nanos: bigint): IntervalValue;
544
+ /**
545
+ * Create an interval from seconds
546
+ */
547
+ static fromSeconds(seconds: number): IntervalValue;
548
+ /**
549
+ * Create an interval from milliseconds
550
+ */
551
+ static fromMilliseconds(milliseconds: number): IntervalValue;
552
+ /**
553
+ * Create an interval from microseconds
554
+ */
555
+ static fromMicroseconds(microseconds: number): IntervalValue;
556
+ /**
557
+ * Create an interval from nanoseconds
558
+ */
559
+ static fromNanoseconds(nanoseconds: bigint): IntervalValue;
560
+ /**
561
+ * Create an interval from minutes
562
+ */
563
+ static fromMinutes(minutes: number): IntervalValue;
564
+ /**
565
+ * Create an interval from hours
566
+ */
567
+ static fromHours(hours: number): IntervalValue;
568
+ /**
569
+ * Create an interval from days
570
+ */
571
+ static fromDays(days: number): IntervalValue;
572
+ /**
573
+ * Create an interval from weeks
574
+ */
575
+ static fromWeeks(weeks: number): IntervalValue;
576
+ /**
577
+ * Create an interval from months
578
+ */
579
+ static fromMonths(months: number): IntervalValue;
580
+ /**
581
+ * Create an interval from years
582
+ */
583
+ static fromYears(years: number): IntervalValue;
584
+ /**
585
+ * Create a zero interval
586
+ */
587
+ static zero(): IntervalValue;
588
+ /**
589
+ * Get default interval (zero)
590
+ */
591
+ static default(): IntervalValue;
592
+ /**
593
+ * Parse an interval string in ISO 8601 duration format
594
+ */
595
+ static parse(str: string): IntervalValue;
596
+ /**
597
+ * Get total seconds (truncated)
598
+ */
599
+ seconds(): bigint | undefined;
600
+ /**
601
+ * Get total milliseconds (truncated)
602
+ */
603
+ milliseconds(): bigint | undefined;
604
+ /**
605
+ * Get total microseconds (truncated)
606
+ */
607
+ microseconds(): bigint | undefined;
608
+ /**
609
+ * Get total nanoseconds
610
+ */
611
+ nanoseconds(): bigint | undefined;
612
+ /**
613
+ * Get months component
614
+ */
615
+ getMonths(): number | undefined;
616
+ /**
617
+ * Get days component
618
+ */
619
+ getDays(): number | undefined;
620
+ /**
621
+ * Get nanoseconds component
622
+ */
623
+ getNanos(): bigint | undefined;
624
+ /**
625
+ * Check if interval is positive (any component > 0)
626
+ */
627
+ isPositive(): boolean;
628
+ /**
629
+ * Check if interval is negative (any component < 0)
630
+ */
631
+ isNegative(): boolean;
632
+ /**
633
+ * Get absolute value of interval
634
+ */
635
+ abs(): IntervalValue;
636
+ /**
637
+ * Negate the interval
638
+ */
639
+ negate(): IntervalValue;
640
+ /**
641
+ * Format as ISO 8601 duration string
642
+ */
643
+ toString(): string;
644
+ valueOf(): {
645
+ months: number;
646
+ days: number;
647
+ nanos: bigint;
648
+ } | undefined;
649
+ /**
650
+ * Get the internal representation
651
+ */
652
+ get value(): {
653
+ months: number;
654
+ days: number;
655
+ nanos: bigint;
656
+ } | undefined;
657
+ /**
658
+ * Helper to parse ISO 8601 duration format
659
+ */
660
+ private static parseDuration;
661
+ /**
662
+ * Compare two intervals for equality
663
+ */
664
+ equals(other: Value): boolean;
665
+ encode(): TypeValuePair;
666
+ }
667
+
668
+ /**
669
+ * MIT License
670
+ * Copyright (c) 2025 ReifyDB
671
+ * See license.md file for full license text
672
+ */
673
+
674
+ declare class Uint1Value implements Value {
675
+ readonly type: Type;
676
+ readonly value?: number;
677
+ private static readonly MIN_VALUE;
678
+ private static readonly MAX_VALUE;
679
+ constructor(value?: number);
680
+ static parse(str: string): Uint1Value;
681
+ valueOf(): number | undefined;
682
+ toString(): string;
683
+ /**
684
+ * Compare two Uint1 values for equality
685
+ */
686
+ equals(other: Value): boolean;
687
+ encode(): TypeValuePair;
688
+ }
689
+
690
+ /**
691
+ * MIT License
692
+ * Copyright (c) 2025 ReifyDB
693
+ * See license.md file for full license text
694
+ */
695
+
696
+ declare class Uint2Value implements Value {
697
+ readonly type: Type;
698
+ readonly value?: number;
699
+ private static readonly MIN_VALUE;
700
+ private static readonly MAX_VALUE;
701
+ constructor(value?: number);
702
+ static parse(str: string): Uint2Value;
703
+ valueOf(): number | undefined;
704
+ toString(): string;
705
+ /**
706
+ * Compare two Uint2 values for equality
707
+ */
708
+ equals(other: Value): boolean;
709
+ encode(): TypeValuePair;
710
+ }
711
+
712
+ /**
713
+ * MIT License
714
+ * Copyright (c) 2025 ReifyDB
715
+ * See license.md file for full license text
716
+ */
717
+
718
+ declare class Uint4Value implements Value {
719
+ readonly type: Type;
720
+ readonly value?: number;
721
+ private static readonly MIN_VALUE;
722
+ private static readonly MAX_VALUE;
723
+ constructor(value?: number);
724
+ static parse(str: string): Uint4Value;
725
+ valueOf(): number | undefined;
726
+ toString(): string;
727
+ /**
728
+ * Compare two Uint4 values for equality
729
+ */
730
+ equals(other: Value): boolean;
731
+ encode(): TypeValuePair;
732
+ }
733
+
734
+ /**
735
+ * MIT License
736
+ * Copyright (c) 2025 ReifyDB
737
+ * See license.md file for full license text
738
+ */
739
+
740
+ declare class Uint8Value implements Value {
741
+ readonly type: Type;
742
+ readonly value?: bigint;
743
+ private static readonly MIN_VALUE;
744
+ private static readonly MAX_VALUE;
745
+ constructor(value?: bigint | number);
746
+ static parse(str: string): Uint8Value;
747
+ valueOf(): bigint | undefined;
748
+ toNumber(): number | undefined;
749
+ toString(): string;
750
+ /**
751
+ * Compare two Uint8 values for equality
752
+ */
753
+ equals(other: Value): boolean;
754
+ encode(): TypeValuePair;
755
+ }
756
+
757
+ /**
758
+ * MIT License
759
+ * Copyright (c) 2025 ReifyDB
760
+ * See license.md file for full license text
761
+ */
762
+
763
+ declare class Uint16Value implements Value {
764
+ readonly type: Type;
765
+ readonly value?: bigint;
766
+ private static readonly MIN_VALUE;
767
+ private static readonly MAX_VALUE;
768
+ constructor(value?: bigint | number | string);
769
+ static parse(str: string): Uint16Value;
770
+ valueOf(): bigint | undefined;
771
+ toString(): string;
772
+ /**
773
+ * Compare two Uint16 values for equality
774
+ */
775
+ equals(other: Value): boolean;
776
+ encode(): TypeValuePair;
777
+ }
778
+
779
+ /**
780
+ * MIT License
781
+ * Copyright (c) 2025 ReifyDB
782
+ * See license.md file for full license text
783
+ */
784
+
785
+ declare class RowNumberValue implements Value {
786
+ private static readonly MIN_VALUE;
787
+ private static readonly MAX_VALUE;
788
+ readonly type: Type;
789
+ readonly value?: bigint;
790
+ constructor(value?: bigint | number);
791
+ static parse(str: string): RowNumberValue;
792
+ valueOf(): bigint | undefined;
793
+ toString(): string;
794
+ /**
795
+ * Compare two RowNumber values for equality
796
+ */
797
+ equals(other: Value): boolean;
798
+ encode(): TypeValuePair;
799
+ }
800
+
801
+ /**
802
+ * MIT License
803
+ * Copyright (c) 2025 ReifyDB
804
+ * See license.md file for full license text
805
+ */
806
+
807
+ /**
808
+ * An undefined value wrapper type
809
+ */
810
+ declare class UndefinedValue implements Value {
811
+ readonly type: Type;
812
+ constructor();
813
+ /**
814
+ * Create a new UndefinedValue
815
+ */
816
+ static new(): UndefinedValue;
817
+ /**
818
+ * Get default UndefinedValue
819
+ */
820
+ static default(): UndefinedValue;
821
+ /**
822
+ * Parse a string as undefined
823
+ */
824
+ static parse(str: string): UndefinedValue;
825
+ /**
826
+ * Check if this value is undefined (always true)
827
+ */
828
+ isUndefined(): boolean;
829
+ /**
830
+ * Format as string
831
+ */
832
+ toString(): string;
833
+ valueOf(): undefined;
834
+ /**
835
+ * Get the internal representation (always undefined)
836
+ */
837
+ get value(): undefined;
838
+ /**
839
+ * Compare two undefined values (always equal)
840
+ */
841
+ equals(other: Value): boolean;
842
+ /**
843
+ * Compare two undefined values for ordering (always equal)
844
+ */
845
+ compare(other: UndefinedValue): number;
846
+ encode(): TypeValuePair;
847
+ }
848
+
849
+ /**
850
+ * MIT License
851
+ * Copyright (c) 2025 ReifyDB
852
+ * See license.md file for full license text
853
+ */
854
+
855
+ declare class Utf8Value implements Value {
856
+ readonly type: Type;
857
+ readonly value?: string;
858
+ constructor(value?: string);
859
+ static parse(str: string): Utf8Value;
860
+ valueOf(): string | undefined;
861
+ toString(): string;
862
+ /**
863
+ * Compare two Utf8 values for equality
864
+ */
865
+ equals(other: Value): boolean;
866
+ encode(): TypeValuePair;
867
+ }
868
+
869
+ /**
870
+ * MIT License
871
+ * Copyright (c) 2025 ReifyDB
872
+ * See license.md file for full license text
873
+ */
874
+
875
+ /**
876
+ * A UUID version 4 (random) value type
877
+ */
878
+ declare class Uuid4Value implements Value {
879
+ readonly type: Type;
880
+ private readonly uuid?;
881
+ constructor(value?: string);
882
+ /**
883
+ * Generate a new random UUID v4
884
+ */
885
+ static generate(): Uuid4Value;
886
+ /**
887
+ * Create a new Uuid4Value from a string
888
+ */
889
+ static new(uuid: string): Uuid4Value;
890
+ /**
891
+ * Get the nil UUID (all zeros)
892
+ */
893
+ static nil(): Uuid4Value;
894
+ /**
895
+ * Get default Uuid4Value (nil UUID)
896
+ */
897
+ static default(): Uuid4Value;
898
+ /**
899
+ * Parse a UUID string
900
+ */
901
+ static parse(str: string): Uuid4Value;
902
+ /**
903
+ * Get the UUID string
904
+ */
905
+ asString(): string | undefined;
906
+ /**
907
+ * Get the UUID as bytes (16-byte array)
908
+ */
909
+ asBytes(): Uint8Array | undefined;
910
+ /**
911
+ * Check if this is the nil UUID
912
+ */
913
+ isNil(): boolean;
914
+ /**
915
+ * Get the UUID version
916
+ */
917
+ getVersion(): number | undefined;
918
+ /**
919
+ * Format as string
920
+ */
921
+ toString(): string;
922
+ valueOf(): string | undefined;
923
+ /**
924
+ * Get the internal representation
925
+ */
926
+ get value(): string | undefined;
927
+ /**
928
+ * Compare two UUID4 values for equality
929
+ */
930
+ equals(other: Value): boolean;
931
+ /**
932
+ * Compare two UUID4 values (for ordering)
933
+ */
934
+ compare(other: Uuid4Value): number;
935
+ encode(): TypeValuePair;
936
+ }
937
+
938
+ /**
939
+ * MIT License
940
+ * Copyright (c) 2025 ReifyDB
941
+ * See license.md file for full license text
942
+ */
943
+
944
+ /**
945
+ * A UUID version 7 (timestamp-based) value type
946
+ */
947
+ declare class Uuid7Value implements Value {
948
+ readonly type: Type;
949
+ private readonly uuid?;
950
+ constructor(value?: string);
951
+ /**
952
+ * Generate a new timestamp-based UUID v7
953
+ */
954
+ static generate(): Uuid7Value;
955
+ /**
956
+ * Create a new Uuid7Value from a string
957
+ */
958
+ static new(uuid: string): Uuid7Value;
959
+ /**
960
+ * Get the nil UUID (all zeros)
961
+ */
962
+ static nil(): Uuid7Value;
963
+ /**
964
+ * Get default Uuid7Value (nil UUID)
965
+ */
966
+ static default(): Uuid7Value;
967
+ /**
968
+ * Parse a UUID string
969
+ */
970
+ static parse(str: string): Uuid7Value;
971
+ /**
972
+ * Get the UUID string
973
+ */
974
+ asString(): string | undefined;
975
+ /**
976
+ * Get the UUID as bytes (16-byte array)
977
+ */
978
+ asBytes(): Uint8Array | undefined;
979
+ /**
980
+ * Extract the timestamp from UUID v7 (milliseconds since Unix epoch)
981
+ */
982
+ getTimestamp(): number | undefined;
983
+ /**
984
+ * Check if this is the nil UUID
985
+ */
986
+ isNil(): boolean;
987
+ /**
988
+ * Get the UUID version
989
+ */
990
+ getVersion(): number | undefined;
991
+ /**
992
+ * Format as string
993
+ */
994
+ toString(): string;
995
+ valueOf(): string | undefined;
996
+ /**
997
+ * Get the internal representation
998
+ */
999
+ get value(): string | undefined;
1000
+ /**
1001
+ * Compare two UUID7 values for equality
1002
+ */
1003
+ equals(other: Value): boolean;
1004
+ /**
1005
+ * Compare two UUID7 values (for ordering)
1006
+ * UUID v7 has timestamp-based ordering for UUIDs generated close in time
1007
+ */
1008
+ compare(other: Uuid7Value): number;
1009
+ encode(): TypeValuePair;
1010
+ }
1011
+
1012
+ /**
1013
+ * MIT License
1014
+ * Copyright (c) 2025 ReifyDB
1015
+ * See license.md file for full license text
1016
+ */
1017
+
1018
+ /**
1019
+ * An IdentityId value type that wraps a UUID v7
1020
+ */
1021
+ declare class IdentityIdValue implements Value {
1022
+ readonly type: Type;
1023
+ readonly value?: string;
1024
+ constructor(value?: string);
1025
+ /**
1026
+ * Generate a new IdentityId with a UUID v7
1027
+ */
1028
+ static generate(): IdentityIdValue;
1029
+ /**
1030
+ * Get the nil IdentityId (all zeros)
1031
+ */
1032
+ static nil(): IdentityIdValue;
1033
+ /**
1034
+ * Parse a string as an IdentityId
1035
+ */
1036
+ static parse(str: string): IdentityIdValue;
1037
+ /**
1038
+ * Get the UUID string value
1039
+ */
1040
+ valueOf(): string | undefined;
1041
+ /**
1042
+ * Format as string
1043
+ */
1044
+ toString(): string;
1045
+ /**
1046
+ * Extract the timestamp from the UUID v7 (milliseconds since Unix epoch)
1047
+ */
1048
+ getTimestamp(): number | undefined;
1049
+ /**
1050
+ * Check if this is the nil UUID
1051
+ */
1052
+ isNil(): boolean;
1053
+ /**
1054
+ * Compare two IdentityId values for equality
1055
+ */
1056
+ equals(other: Value): boolean;
1057
+ encode(): TypeValuePair;
1058
+ }
1059
+
1060
+ /**
1061
+ * MIT License
1062
+ * Copyright (c) 2025 ReifyDB
1063
+ * See license.md file for full license text
1064
+ */
1065
+
1066
+ type Type = "Blob" | "Bool" | "Float4" | "Float8" | "Int1" | "Int2" | "Int4" | "Int8" | "Int16" | "Uint1" | "Uint2" | "Uint4" | "Uint8" | "Uint16" | "Utf8" | "Date" | "DateTime" | "Time" | "Interval" | "Uuid4" | "Uuid7" | "Undefined" | "RowNumber" | "IdentityId";
1067
+ interface TypeValuePair {
1068
+ type: Type;
1069
+ value: string;
1070
+ }
1071
+ declare abstract class Value {
1072
+ abstract readonly type: Type;
1073
+ abstract encode(): TypeValuePair;
1074
+ abstract equals(other: Value): boolean;
1075
+ }
1076
+
1077
+ /**
1078
+ * MIT License
1079
+ * Copyright (c) 2025 ReifyDB
1080
+ * See license.md file for full license text
1081
+ */
1082
+
1083
+ declare function decode(pair: TypeValuePair): Value;
1084
+
1085
+ /**
1086
+ * MIT License
1087
+ * Copyright (c) 2025 ReifyDB
1088
+ * See license.md file for full license text
1089
+ */
1090
+
1091
+ type PrimitiveToTS<T extends Type> = T extends 'Blob' ? Uint8Array : T extends 'Bool' ? boolean : T extends 'Float4' ? number : T extends 'Float8' ? number : T extends 'Int1' ? number : T extends 'Int2' ? number : T extends 'Int4' ? number : T extends 'Int8' ? bigint : T extends 'Int16' ? bigint : T extends 'Uint1' ? number : T extends 'Uint2' ? number : T extends 'Uint4' ? number : T extends 'Uint8' ? bigint : T extends 'Uint16' ? bigint : T extends 'Utf8' ? string : T extends 'Date' ? Date : T extends 'DateTime' ? Date : T extends 'Time' ? string : T extends 'Interval' ? string : T extends 'Uuid4' ? string : T extends 'Uuid7' ? string : T extends 'Undefined' ? undefined : T extends 'RowNumber' ? bigint : T extends 'IdentityId' ? string : never;
1092
+ type PrimitiveToValue<T extends Type> = T extends 'Blob' ? BlobValue : T extends 'Bool' ? BoolValue : T extends 'Float4' ? Float4Value : T extends 'Float8' ? Float8Value : T extends 'Int1' ? Int1Value : T extends 'Int2' ? Int2Value : T extends 'Int4' ? Int4Value : T extends 'Int8' ? Int8Value : T extends 'Int16' ? Int16Value : T extends 'Uint1' ? Uint1Value : T extends 'Uint2' ? Uint2Value : T extends 'Uint4' ? Uint4Value : T extends 'Uint8' ? Uint8Value : T extends 'Uint16' ? Uint16Value : T extends 'Utf8' ? Utf8Value : T extends 'Date' ? DateValue : T extends 'DateTime' ? DateTimeValue : T extends 'Time' ? TimeValue : T extends 'Interval' ? IntervalValue : T extends 'Uuid4' ? Uuid4Value : T extends 'Uuid7' ? Uuid7Value : T extends 'Undefined' ? UndefinedValue : T extends 'RowNumber' ? RowNumberValue : T extends 'IdentityId' ? IdentityIdValue : never;
1093
+ type InferSchema<S> = S extends PrimitiveSchemaNode<infer T> ? T extends Type ? PrimitiveToTS<T> : never : S extends ValueSchemaNode<infer T> ? T extends Type ? PrimitiveToValue<T> : never : S extends ObjectSchemaNode<infer P> ? {
1094
+ [K in keyof P]: InferSchema<P[K]>;
1095
+ } : S extends ArraySchemaNode<infer T> ? InferSchema<T>[] : S extends OptionalSchemaNode<infer T> ? InferSchema<T> | undefined : never;
1096
+ type InferSchemas<S extends readonly SchemaNode[]> = {
1097
+ [K in keyof S]: InferSchema<S[K]>[];
1098
+ };
1099
+
1100
+ /**
1101
+ * MIT License
1102
+ * Copyright (c) 2025 ReifyDB
1103
+ * See license.md file for full license text
1104
+ */
1105
+
1106
+ declare class SchemaBuilder {
1107
+ static blob(): PrimitiveSchemaNode<'Blob'>;
1108
+ static bool(): PrimitiveSchemaNode<'Bool'>;
1109
+ static boolean(): PrimitiveSchemaNode<'Bool'>;
1110
+ static float4(): PrimitiveSchemaNode<'Float4'>;
1111
+ static float8(): PrimitiveSchemaNode<'Float8'>;
1112
+ static float(): PrimitiveSchemaNode<'Float8'>;
1113
+ static double(): PrimitiveSchemaNode<'Float8'>;
1114
+ static int1(): PrimitiveSchemaNode<'Int1'>;
1115
+ static int2(): PrimitiveSchemaNode<'Int2'>;
1116
+ static int4(): PrimitiveSchemaNode<'Int4'>;
1117
+ static int8(): PrimitiveSchemaNode<'Int8'>;
1118
+ static int16(): PrimitiveSchemaNode<'Int16'>;
1119
+ static int(): PrimitiveSchemaNode<'Int4'>;
1120
+ static bigint(): PrimitiveSchemaNode<'Int8'>;
1121
+ static uint1(): PrimitiveSchemaNode<'Uint1'>;
1122
+ static uint2(): PrimitiveSchemaNode<'Uint2'>;
1123
+ static uint4(): PrimitiveSchemaNode<'Uint4'>;
1124
+ static uint8(): PrimitiveSchemaNode<'Uint8'>;
1125
+ static uint16(): PrimitiveSchemaNode<'Uint16'>;
1126
+ static utf8(): PrimitiveSchemaNode<'Utf8'>;
1127
+ static string(): PrimitiveSchemaNode<'Utf8'>;
1128
+ static date(): PrimitiveSchemaNode<'Date'>;
1129
+ static datetime(): PrimitiveSchemaNode<'DateTime'>;
1130
+ static time(): PrimitiveSchemaNode<'Time'>;
1131
+ static interval(): PrimitiveSchemaNode<'Interval'>;
1132
+ static uuid4(): PrimitiveSchemaNode<'Uuid4'>;
1133
+ static uuid7(): PrimitiveSchemaNode<'Uuid7'>;
1134
+ static uuid(): PrimitiveSchemaNode<'Uuid7'>;
1135
+ static undefined(): PrimitiveSchemaNode<'Undefined'>;
1136
+ static rownumber(): PrimitiveSchemaNode<'RowNumber'>;
1137
+ static identityid(): PrimitiveSchemaNode<'IdentityId'>;
1138
+ static object<P extends Record<string, SchemaNode>>(properties: P): ObjectSchemaNode<P>;
1139
+ static array<T extends SchemaNode>(items: T): ArraySchemaNode<T>;
1140
+ static optional<T extends SchemaNode>(schema: T): OptionalSchemaNode<T>;
1141
+ static number(): PrimitiveSchemaNode<'Float8'>;
1142
+ static boolValue(): ValueSchemaNode<'Bool'>;
1143
+ static int1Value(): ValueSchemaNode<'Int1'>;
1144
+ static int2Value(): ValueSchemaNode<'Int2'>;
1145
+ static int4Value(): ValueSchemaNode<'Int4'>;
1146
+ static int8Value(): ValueSchemaNode<'Int8'>;
1147
+ static int16Value(): ValueSchemaNode<'Int16'>;
1148
+ static uint1Value(): ValueSchemaNode<'Uint1'>;
1149
+ static uint2Value(): ValueSchemaNode<'Uint2'>;
1150
+ static uint4Value(): ValueSchemaNode<'Uint4'>;
1151
+ static uint8Value(): ValueSchemaNode<'Uint8'>;
1152
+ static uint16Value(): ValueSchemaNode<'Uint16'>;
1153
+ static float4Value(): ValueSchemaNode<'Float4'>;
1154
+ static float8Value(): ValueSchemaNode<'Float8'>;
1155
+ static utf8Value(): ValueSchemaNode<'Utf8'>;
1156
+ static dateValue(): ValueSchemaNode<'Date'>;
1157
+ static dateTimeValue(): ValueSchemaNode<'DateTime'>;
1158
+ static timeValue(): ValueSchemaNode<'Time'>;
1159
+ static intervalValue(): ValueSchemaNode<'Interval'>;
1160
+ static uuid4Value(): ValueSchemaNode<'Uuid4'>;
1161
+ static uuid7Value(): ValueSchemaNode<'Uuid7'>;
1162
+ static undefinedValue(): ValueSchemaNode<'Undefined'>;
1163
+ static blobValue(): ValueSchemaNode<'Blob'>;
1164
+ static rowIdValue(): ValueSchemaNode<'RowNumber'>;
1165
+ static identityIdValue(): ValueSchemaNode<'IdentityId'>;
1166
+ }
1167
+ declare const Schema: typeof SchemaBuilder;
1168
+
1169
+ /**
1170
+ * MIT License
1171
+ * Copyright (c) 2025 ReifyDB
1172
+ * See license.md file for full license text
1173
+ */
1174
+
1175
+ declare function parseValue(schema: SchemaNode, value: any): any;
1176
+
1177
+ /**
1178
+ * MIT License
1179
+ * Copyright (c) 2025 ReifyDB
1180
+ * See license.md file for full license text
1181
+ */
1182
+
1183
+ declare function validateSchema(schema: SchemaNode, value: any): boolean;
1184
+
1185
+ /**
1186
+ * MIT License
1187
+ * Copyright (c) 2025 ReifyDB
1188
+ * See license.md file for full license text
1189
+ */
1190
+ interface PrimitiveSchemaNode<T extends string = string> {
1191
+ kind: 'primitive';
1192
+ type: T;
1193
+ }
1194
+ interface ObjectSchemaNode<P extends Record<string, SchemaNode> = Record<string, SchemaNode>> {
1195
+ kind: 'object';
1196
+ properties: P;
1197
+ }
1198
+ interface ArraySchemaNode<T extends SchemaNode = SchemaNode> {
1199
+ kind: 'array';
1200
+ items: T;
1201
+ }
1202
+ interface OptionalSchemaNode<T extends SchemaNode = SchemaNode> {
1203
+ kind: 'optional';
1204
+ schema: T;
1205
+ }
1206
+ interface ValueSchemaNode<T extends string = string> {
1207
+ kind: 'value';
1208
+ type: T;
1209
+ }
1210
+ type SchemaNode = PrimitiveSchemaNode | ObjectSchemaNode | ArraySchemaNode | OptionalSchemaNode | ValueSchemaNode;
1211
+
1212
+ /**
1213
+ * MIT License
1214
+ * Copyright (c) 2025 ReifyDB
1215
+ * See license.md file for full license text
1216
+ */
1217
+
1218
+ type Params = (TypeValuePair | null)[] | Record<string, TypeValuePair | null>;
1219
+ interface Frame {
1220
+ columns: Column[];
1221
+ }
1222
+ interface DiagnosticColumn {
1223
+ name: string;
1224
+ ty: Type;
1225
+ }
1226
+ interface Span {
1227
+ offset: number;
1228
+ line: number;
1229
+ fragment: string;
1230
+ }
1231
+ interface Diagnostic {
1232
+ code: string;
1233
+ statement?: string;
1234
+ message: string;
1235
+ column?: DiagnosticColumn;
1236
+ span?: Span;
1237
+ label?: string;
1238
+ help?: string;
1239
+ notes: Array<string>;
1240
+ cause?: Diagnostic;
1241
+ }
1242
+ interface Column {
1243
+ name: string;
1244
+ ty: Type;
1245
+ data: string[];
1246
+ }
1247
+ interface ErrorResponse {
1248
+ id: string;
1249
+ type: "Err";
1250
+ payload: {
1251
+ diagnostic: Diagnostic;
1252
+ };
1253
+ }
1254
+ declare class ReifyError extends Error {
1255
+ readonly code: string;
1256
+ readonly statement?: string;
1257
+ readonly column?: DiagnosticColumn;
1258
+ readonly span?: Span;
1259
+ readonly label?: string;
1260
+ readonly help?: string;
1261
+ readonly notes: string[];
1262
+ readonly cause?: Diagnostic;
1263
+ constructor(response: ErrorResponse);
1264
+ toString(): string;
1265
+ }
1266
+ /**
1267
+ * Simplified type for inferring frame results to avoid deep instantiation
1268
+ * This provides a workaround for TypeScript's limitation with deeply nested types
1269
+ */
1270
+ type FrameResults<S extends readonly SchemaNode[]> = S extends readonly [infer First, ...infer Rest] ? First extends SchemaNode ? Rest extends readonly SchemaNode[] ? [InferSchema<First>[], ...FrameResults<Rest>] : [InferSchema<First>[]] : never : [];
1271
+ /**
1272
+ * Helper type to extract a single frame result
1273
+ */
1274
+ type SingleFrameResult<S extends SchemaNode> = InferSchema<S>[];
1275
+ /**
1276
+ * Type-safe cast helper for frame results
1277
+ */
1278
+ declare function asFrameResults<S extends readonly SchemaNode[]>(results: any): FrameResults<S>;
1279
+
1280
+ export { type ArraySchemaNode, BlobValue, BoolValue, type Column, DateTimeValue, DateValue, type Diagnostic, type DiagnosticColumn, type ErrorResponse, Float4Value, Float8Value, type Frame, type FrameResults, IdentityIdValue, type InferSchema, type InferSchemas, Int16Value, Int1Value, Int2Value, Int4Value, Int8Value, IntervalValue, type ObjectSchemaNode, type OptionalSchemaNode, type Params, type PrimitiveSchemaNode, type PrimitiveToTS, type PrimitiveToValue, ReifyError, RowNumberValue, Schema, SchemaBuilder, type SchemaNode, type SingleFrameResult, type Span, TimeValue, type Type, type TypeValuePair, UNDEFINED_VALUE, Uint16Value, Uint1Value, Uint2Value, Uint4Value, Uint8Value, UndefinedValue, Utf8Value, Uuid4Value, Uuid7Value, Value, type ValueSchemaNode, asFrameResults, decode, parseValue, validateSchema };