@reifydb/core 0.4.12 → 0.5.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
@@ -76,6 +76,7 @@ declare class BlobValue implements Value {
76
76
  * Helper to parse a string as hex
77
77
  */
78
78
  private static parseString;
79
+ toJSON(): string | null;
79
80
  encode(): TypeValuePair;
80
81
  }
81
82
 
@@ -90,6 +91,7 @@ declare class BooleanValue implements Value {
90
91
  * Compare two boolean values for equality
91
92
  */
92
93
  equals(other: Value): boolean;
94
+ toJSON(): boolean | null;
93
95
  encode(): TypeValuePair;
94
96
  }
95
97
 
@@ -159,6 +161,7 @@ declare class DateValue implements Value {
159
161
  * Compare two dates for equality
160
162
  */
161
163
  equals(other: Value): boolean;
164
+ toJSON(): string | null;
162
165
  encode(): TypeValuePair;
163
166
  }
164
167
 
@@ -231,6 +234,7 @@ declare class TimeValue implements Value {
231
234
  * Compare two Time values for equality
232
235
  */
233
236
  equals(other: Value): boolean;
237
+ toJSON(): string | null;
234
238
  encode(): TypeValuePair;
235
239
  }
236
240
 
@@ -326,6 +330,7 @@ declare class DateTimeValue implements Value {
326
330
  * Compare two datetimes for equality
327
331
  */
328
332
  equals(other: Value): boolean;
333
+ toJSON(): string | null;
329
334
  encode(): TypeValuePair;
330
335
  }
331
336
 
@@ -337,6 +342,7 @@ declare class DecimalValue implements Value {
337
342
  valueOf(): string | undefined;
338
343
  toString(): string;
339
344
  equals(other: Value): boolean;
345
+ toJSON(): string | null;
340
346
  encode(): TypeValuePair;
341
347
  }
342
348
 
@@ -354,6 +360,7 @@ declare class Float4Value implements Value {
354
360
  * Compare two Float4 values for equality with limited precision
355
361
  */
356
362
  equals(other: Value): boolean;
363
+ toJSON(): string | null;
357
364
  encode(): TypeValuePair;
358
365
  }
359
366
 
@@ -368,6 +375,7 @@ declare class Float8Value implements Value {
368
375
  * Compare two Float8 values for equality
369
376
  */
370
377
  equals(other: Value): boolean;
378
+ toJSON(): string | null;
371
379
  encode(): TypeValuePair;
372
380
  }
373
381
 
@@ -384,6 +392,7 @@ declare class Int1Value implements Value {
384
392
  * Compare two Int1 values for equality
385
393
  */
386
394
  equals(other: Value): boolean;
395
+ toJSON(): string | null;
387
396
  encode(): TypeValuePair;
388
397
  }
389
398
 
@@ -400,6 +409,7 @@ declare class Int2Value implements Value {
400
409
  * Compare two Int2 values for equality
401
410
  */
402
411
  equals(other: Value): boolean;
412
+ toJSON(): string | null;
403
413
  encode(): TypeValuePair;
404
414
  }
405
415
 
@@ -416,6 +426,7 @@ declare class Int4Value implements Value {
416
426
  * Compare two Int4 values for equality
417
427
  */
418
428
  equals(other: Value): boolean;
429
+ toJSON(): string | null;
419
430
  encode(): TypeValuePair;
420
431
  }
421
432
 
@@ -432,6 +443,7 @@ declare class Int8Value implements Value {
432
443
  * Compare two Int8 values for equality
433
444
  */
434
445
  equals(other: Value): boolean;
446
+ toJSON(): string | null;
435
447
  encode(): TypeValuePair;
436
448
  }
437
449
 
@@ -448,6 +460,7 @@ declare class Int16Value implements Value {
448
460
  * Compare two Int16 values for equality
449
461
  */
450
462
  equals(other: Value): boolean;
463
+ toJSON(): string | null;
451
464
  encode(): TypeValuePair;
452
465
  }
453
466
 
@@ -603,7 +616,7 @@ declare class DurationValue implements Value {
603
616
  * Compare two durations for equality
604
617
  */
605
618
  equals(other: Value): boolean;
606
- toJSON(): string;
619
+ toJSON(): string | null;
607
620
  encode(): TypeValuePair;
608
621
  }
609
622
 
@@ -620,6 +633,7 @@ declare class Uint1Value implements Value {
620
633
  * Compare two Uint1 values for equality
621
634
  */
622
635
  equals(other: Value): boolean;
636
+ toJSON(): string | null;
623
637
  encode(): TypeValuePair;
624
638
  }
625
639
 
@@ -636,6 +650,7 @@ declare class Uint2Value implements Value {
636
650
  * Compare two Uint2 values for equality
637
651
  */
638
652
  equals(other: Value): boolean;
653
+ toJSON(): string | null;
639
654
  encode(): TypeValuePair;
640
655
  }
641
656
 
@@ -652,6 +667,7 @@ declare class Uint4Value implements Value {
652
667
  * Compare two Uint4 values for equality
653
668
  */
654
669
  equals(other: Value): boolean;
670
+ toJSON(): string | null;
655
671
  encode(): TypeValuePair;
656
672
  }
657
673
 
@@ -669,6 +685,7 @@ declare class Uint8Value implements Value {
669
685
  * Compare two Uint8 values for equality
670
686
  */
671
687
  equals(other: Value): boolean;
688
+ toJSON(): string | null;
672
689
  encode(): TypeValuePair;
673
690
  }
674
691
 
@@ -685,6 +702,7 @@ declare class Uint16Value implements Value {
685
702
  * Compare two Uint16 values for equality
686
703
  */
687
704
  equals(other: Value): boolean;
705
+ toJSON(): string | null;
688
706
  encode(): TypeValuePair;
689
707
  }
690
708
 
@@ -699,6 +717,7 @@ declare class NoneValue implements Value {
699
717
  get value(): undefined;
700
718
  equals(other: Value): boolean;
701
719
  compare(other: NoneValue): number;
720
+ toJSON(): null;
702
721
  encode(): TypeValuePair;
703
722
  }
704
723
 
@@ -713,6 +732,7 @@ declare class Utf8Value implements Value {
713
732
  * Compare two Utf8 values for equality
714
733
  */
715
734
  equals(other: Value): boolean;
735
+ toJSON(): string | null;
716
736
  encode(): TypeValuePair;
717
737
  }
718
738
 
@@ -776,6 +796,7 @@ declare class Uuid4Value implements Value {
776
796
  * Compare two UUID4 values (for ordering)
777
797
  */
778
798
  compare(other: Uuid4Value): number;
799
+ toJSON(): string | null;
779
800
  encode(): TypeValuePair;
780
801
  }
781
802
 
@@ -844,6 +865,7 @@ declare class Uuid7Value implements Value {
844
865
  * UUID v7 has timestamp-based ordering for UUIDs generated close in time
845
866
  */
846
867
  compare(other: Uuid7Value): number;
868
+ toJSON(): string | null;
847
869
  encode(): TypeValuePair;
848
870
  }
849
871
 
@@ -886,6 +908,7 @@ declare class IdentityIdValue implements Value {
886
908
  * Compare two IdentityId values for equality
887
909
  */
888
910
  equals(other: Value): boolean;
911
+ toJSON(): string | null;
889
912
  encode(): TypeValuePair;
890
913
  }
891
914
 
package/dist/index.js CHANGED
@@ -215,6 +215,9 @@ var BlobValue = class _BlobValue {
215
215
  }
216
216
  return null;
217
217
  }
218
+ toJSON() {
219
+ return this.bytes === void 0 ? null : this.toHex();
220
+ }
218
221
  encode() {
219
222
  return {
220
223
  type: this.type,
@@ -265,6 +268,9 @@ var BooleanValue = class _BooleanValue {
265
268
  const otherBoolean = other;
266
269
  return this.value === otherBoolean.value;
267
270
  }
271
+ toJSON() {
272
+ return this.value ?? null;
273
+ }
268
274
  encode() {
269
275
  return {
270
276
  type: this.type,
@@ -502,6 +508,12 @@ var DateValue = class _DateValue {
502
508
  }
503
509
  return this.months === otherDate.months && this.days === otherDate.days;
504
510
  }
511
+ toJSON() {
512
+ if (this.months === void 0 || this.days === void 0) {
513
+ return null;
514
+ }
515
+ return this.toString();
516
+ }
505
517
  encode() {
506
518
  return {
507
519
  type: this.type,
@@ -691,6 +703,9 @@ var _TimeValue = class _TimeValue {
691
703
  const otherTime = other;
692
704
  return this.value === otherTime.value;
693
705
  }
706
+ toJSON() {
707
+ return this.value === void 0 ? null : this.toString();
708
+ }
694
709
  encode() {
695
710
  return {
696
711
  type: this.type,
@@ -1043,6 +1058,12 @@ var DateTimeValue = class _DateTimeValue {
1043
1058
  }
1044
1059
  return this.months === otherDateTime.months && this.days === otherDateTime.days && this.nanos === otherDateTime.nanos;
1045
1060
  }
1061
+ toJSON() {
1062
+ if (this.months === void 0 || this.days === void 0 || this.nanos === void 0) {
1063
+ return null;
1064
+ }
1065
+ return this.toString();
1066
+ }
1046
1067
  encode() {
1047
1068
  return {
1048
1069
  type: this.type,
@@ -1083,6 +1104,9 @@ var DecimalValue = class _DecimalValue {
1083
1104
  const otherDecimal = other;
1084
1105
  return this.value === otherDecimal.value;
1085
1106
  }
1107
+ toJSON() {
1108
+ return this.value ?? null;
1109
+ }
1086
1110
  encode() {
1087
1111
  return {
1088
1112
  type: this.type,
@@ -1149,6 +1173,9 @@ var _Float4Value = class _Float4Value {
1149
1173
  const epsilon = 1e-6;
1150
1174
  return Math.abs(this.value - otherFloat.value) <= epsilon;
1151
1175
  }
1176
+ toJSON() {
1177
+ return this.value === void 0 ? null : this.value.toString();
1178
+ }
1152
1179
  encode() {
1153
1180
  return {
1154
1181
  type: this.type,
@@ -1205,6 +1232,9 @@ var Float8Value = class _Float8Value {
1205
1232
  const epsilon = 1e-14;
1206
1233
  return Math.abs(this.value - otherFloat.value) <= epsilon;
1207
1234
  }
1235
+ toJSON() {
1236
+ return this.value === void 0 ? null : this.value.toString();
1237
+ }
1208
1238
  encode() {
1209
1239
  return {
1210
1240
  type: this.type,
@@ -1254,6 +1284,9 @@ var _Int1Value = class _Int1Value {
1254
1284
  const otherInt = other;
1255
1285
  return this.value === otherInt.value;
1256
1286
  }
1287
+ toJSON() {
1288
+ return this.value === void 0 ? null : this.value.toString();
1289
+ }
1257
1290
  encode() {
1258
1291
  return {
1259
1292
  type: this.type,
@@ -1306,6 +1339,9 @@ var _Int2Value = class _Int2Value {
1306
1339
  const otherInt = other;
1307
1340
  return this.value === otherInt.value;
1308
1341
  }
1342
+ toJSON() {
1343
+ return this.value === void 0 ? null : this.value.toString();
1344
+ }
1309
1345
  encode() {
1310
1346
  return {
1311
1347
  type: this.type,
@@ -1358,6 +1394,9 @@ var _Int4Value = class _Int4Value {
1358
1394
  const otherInt = other;
1359
1395
  return this.value === otherInt.value;
1360
1396
  }
1397
+ toJSON() {
1398
+ return this.value === void 0 ? null : this.value.toString();
1399
+ }
1361
1400
  encode() {
1362
1401
  return {
1363
1402
  type: this.type,
@@ -1415,6 +1454,9 @@ var _Int8Value = class _Int8Value {
1415
1454
  const otherInt = other;
1416
1455
  return this.value === otherInt.value;
1417
1456
  }
1457
+ toJSON() {
1458
+ return this.value === void 0 ? null : this.value.toString();
1459
+ }
1418
1460
  encode() {
1419
1461
  return {
1420
1462
  type: this.type,
@@ -1483,6 +1525,9 @@ var _Int16Value = class _Int16Value {
1483
1525
  const otherInt = other;
1484
1526
  return this.value === otherInt.value;
1485
1527
  }
1528
+ toJSON() {
1529
+ return this.value === void 0 ? null : this.value.toString();
1530
+ }
1486
1531
  encode() {
1487
1532
  return {
1488
1533
  type: this.type,
@@ -1891,7 +1936,7 @@ var DurationValue = class _DurationValue {
1891
1936
  return this.months === otherDuration.months && this.days === otherDuration.days && this.nanos === otherDuration.nanos;
1892
1937
  }
1893
1938
  toJSON() {
1894
- return this.value === void 0 ? NONE_VALUE : this.toIsoString();
1939
+ return this.months === void 0 ? null : this.toIsoString();
1895
1940
  }
1896
1941
  encode() {
1897
1942
  return {
@@ -1942,6 +1987,9 @@ var _Uint1Value = class _Uint1Value {
1942
1987
  const otherUint = other;
1943
1988
  return this.value === otherUint.value;
1944
1989
  }
1990
+ toJSON() {
1991
+ return this.value === void 0 ? null : this.value.toString();
1992
+ }
1945
1993
  encode() {
1946
1994
  return {
1947
1995
  type: this.type,
@@ -1994,6 +2042,9 @@ var _Uint2Value = class _Uint2Value {
1994
2042
  const otherUint = other;
1995
2043
  return this.value === otherUint.value;
1996
2044
  }
2045
+ toJSON() {
2046
+ return this.value === void 0 ? null : this.value.toString();
2047
+ }
1997
2048
  encode() {
1998
2049
  return {
1999
2050
  type: this.type,
@@ -2046,6 +2097,9 @@ var _Uint4Value = class _Uint4Value {
2046
2097
  const otherUint = other;
2047
2098
  return this.value === otherUint.value;
2048
2099
  }
2100
+ toJSON() {
2101
+ return this.value === void 0 ? null : this.value.toString();
2102
+ }
2049
2103
  encode() {
2050
2104
  return {
2051
2105
  type: this.type,
@@ -2107,6 +2161,9 @@ var _Uint8Value = class _Uint8Value {
2107
2161
  const otherUint = other;
2108
2162
  return this.value === otherUint.value;
2109
2163
  }
2164
+ toJSON() {
2165
+ return this.value === void 0 ? null : this.value.toString();
2166
+ }
2110
2167
  encode() {
2111
2168
  return {
2112
2169
  type: this.type,
@@ -2175,6 +2232,9 @@ var _Uint16Value = class _Uint16Value {
2175
2232
  const otherUint = other;
2176
2233
  return this.value === otherUint.value;
2177
2234
  }
2235
+ toJSON() {
2236
+ return this.value === void 0 ? null : this.value.toString();
2237
+ }
2178
2238
  encode() {
2179
2239
  return {
2180
2240
  type: this.type,
@@ -2220,6 +2280,9 @@ var NoneValue = class _NoneValue {
2220
2280
  compare(other) {
2221
2281
  return 0;
2222
2282
  }
2283
+ toJSON() {
2284
+ return null;
2285
+ }
2223
2286
  encode() {
2224
2287
  return {
2225
2288
  type: "None",
@@ -2263,6 +2326,9 @@ var Utf8Value = class _Utf8Value {
2263
2326
  const otherUtf8 = other;
2264
2327
  return this.value === otherUtf8.value;
2265
2328
  }
2329
+ toJSON() {
2330
+ return this.value ?? null;
2331
+ }
2266
2332
  encode() {
2267
2333
  return {
2268
2334
  type: this.type,
@@ -2409,6 +2475,9 @@ var Uuid4Value = class _Uuid4Value {
2409
2475
  }
2410
2476
  return 0;
2411
2477
  }
2478
+ toJSON() {
2479
+ return this.uuid ?? null;
2480
+ }
2412
2481
  encode() {
2413
2482
  return {
2414
2483
  type: this.type,
@@ -2566,6 +2635,9 @@ var Uuid7Value = class _Uuid7Value {
2566
2635
  }
2567
2636
  return 0;
2568
2637
  }
2638
+ toJSON() {
2639
+ return this.uuid ?? null;
2640
+ }
2569
2641
  encode() {
2570
2642
  return {
2571
2643
  type: this.type,
@@ -2662,6 +2734,9 @@ var IdentityIdValue = class _IdentityIdValue {
2662
2734
  const otherIdentityId = other;
2663
2735
  return this.value === otherIdentityId.value;
2664
2736
  }
2737
+ toJSON() {
2738
+ return this.value ?? null;
2739
+ }
2665
2740
  encode() {
2666
2741
  return {
2667
2742
  type: this.type,