@synnaxlabs/x 0.44.4 → 0.45.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.
Files changed (150) hide show
  1. package/.turbo/turbo-build.log +38 -38
  2. package/dist/{base-BORMP3mH.js → base-DRybODwJ.js} +7 -6
  3. package/dist/base-KIBsp6TI.cjs +1 -0
  4. package/dist/binary.cjs +1 -1
  5. package/dist/binary.js +1 -1
  6. package/dist/{bounds-BXbqBINt.cjs → bounds-C2TKFgVk.cjs} +1 -1
  7. package/dist/{bounds-BQqppNFf.js → bounds-DeUXrllt.js} +11 -11
  8. package/dist/bounds.cjs +1 -1
  9. package/dist/bounds.js +1 -1
  10. package/dist/{box-DRH5SOaY.js → box-BYuq-Gjx.js} +4 -4
  11. package/dist/{box-qgxWXNhm.cjs → box-Blu-4d1n.cjs} +1 -1
  12. package/dist/box.cjs +1 -1
  13. package/dist/box.js +1 -1
  14. package/dist/caseconv.cjs +1 -1
  15. package/dist/caseconv.js +1 -1
  16. package/dist/compare.cjs +1 -1
  17. package/dist/compare.js +1 -1
  18. package/dist/deep.cjs +1 -1
  19. package/dist/deep.js +211 -99
  20. package/dist/{dimensions-qY12pyfC.cjs → dimensions-Cg5Owbwn.cjs} +1 -1
  21. package/dist/{dimensions-RaRkesPq.js → dimensions-DC0uLPwn.js} +1 -1
  22. package/dist/dimensions.cjs +1 -1
  23. package/dist/dimensions.js +1 -1
  24. package/dist/{direction-DKdfJwj7.js → direction-C_b4tfRN.js} +1 -1
  25. package/dist/{direction-XCdrc4is.cjs → direction-DqQB9M37.cjs} +1 -1
  26. package/dist/direction.cjs +1 -1
  27. package/dist/direction.js +1 -1
  28. package/dist/external-CtHGFcox.cjs +1 -0
  29. package/dist/{external-BM_NS5yM.js → external-tyaEMW4S.js} +1 -1
  30. package/dist/get-CXkBfLu1.js +82 -0
  31. package/dist/get-OP63N4c3.cjs +1 -0
  32. package/dist/{index-B5l_quQn.js → index-BHXRDFYj.js} +1 -1
  33. package/dist/index-Bxlv0uf_.js +57 -0
  34. package/dist/{index-CBMHFqs4.js → index-C452Pas0.js} +25 -22
  35. package/dist/{index-BQe8OIgm.cjs → index-CwGPVvbl.cjs} +1 -1
  36. package/dist/index-uDxeM-cl.cjs +1 -0
  37. package/dist/index-xaxa1hoa.cjs +1 -0
  38. package/dist/index.cjs +3 -3
  39. package/dist/index.js +442 -380
  40. package/dist/location-BPoXwOni.cjs +1 -0
  41. package/dist/{location-CGLioInQ.js → location-CVxysrHI.js} +31 -30
  42. package/dist/location.cjs +1 -1
  43. package/dist/location.js +1 -1
  44. package/dist/{scale-76Azh2EE.cjs → scale-BHs716im.cjs} +1 -1
  45. package/dist/{scale-BhIvACdB.js → scale-DjxC6ep2.js} +4 -4
  46. package/dist/scale.cjs +1 -1
  47. package/dist/scale.js +1 -1
  48. package/dist/series-C6ZwNf8i.cjs +6 -0
  49. package/dist/{series-kgnLXSDr.js → series-W5Aafjeu.js} +268 -251
  50. package/dist/{spatial-QY891r0E.js → spatial-DnsaOypA.js} +1 -1
  51. package/dist/{spatial-BsGadoUr.cjs → spatial-DrxzaD5U.cjs} +1 -1
  52. package/dist/spatial.cjs +1 -1
  53. package/dist/spatial.js +8 -8
  54. package/dist/src/caseconv/caseconv.d.ts +9 -0
  55. package/dist/src/caseconv/caseconv.d.ts.map +1 -1
  56. package/dist/src/color/color.d.ts +7 -0
  57. package/dist/src/color/color.d.ts.map +1 -1
  58. package/dist/src/deep/copy.spec.d.ts +2 -0
  59. package/dist/src/deep/copy.spec.d.ts.map +1 -0
  60. package/dist/src/deep/external.d.ts +3 -1
  61. package/dist/src/deep/external.d.ts.map +1 -1
  62. package/dist/src/deep/get.bench.d.ts +2 -0
  63. package/dist/src/deep/get.bench.d.ts.map +1 -0
  64. package/dist/src/deep/get.d.ts +16 -0
  65. package/dist/src/deep/get.d.ts.map +1 -0
  66. package/dist/src/deep/get.spec.d.ts +2 -0
  67. package/dist/src/deep/get.spec.d.ts.map +1 -0
  68. package/dist/src/deep/partial.spec.d.ts +2 -0
  69. package/dist/src/deep/partial.spec.d.ts.map +1 -0
  70. package/dist/src/deep/path.d.ts +4 -92
  71. package/dist/src/deep/path.d.ts.map +1 -1
  72. package/dist/src/deep/remove.bench.d.ts +2 -0
  73. package/dist/src/deep/remove.bench.d.ts.map +1 -0
  74. package/dist/src/deep/remove.d.ts +2 -0
  75. package/dist/src/deep/remove.d.ts.map +1 -0
  76. package/dist/src/deep/remove.spec.d.ts +2 -0
  77. package/dist/src/deep/remove.spec.d.ts.map +1 -0
  78. package/dist/src/deep/set.bench.d.ts +2 -0
  79. package/dist/src/deep/set.bench.d.ts.map +1 -0
  80. package/dist/src/deep/set.d.ts +2 -0
  81. package/dist/src/deep/set.d.ts.map +1 -0
  82. package/dist/src/deep/set.spec.d.ts +2 -0
  83. package/dist/src/deep/set.spec.d.ts.map +1 -0
  84. package/dist/src/index.d.ts +1 -0
  85. package/dist/src/index.d.ts.map +1 -1
  86. package/dist/src/primitive/primitive.d.ts +4 -0
  87. package/dist/src/primitive/primitive.d.ts.map +1 -1
  88. package/dist/src/spatial/location/location.d.ts +2 -2
  89. package/dist/src/spatial/location/location.d.ts.map +1 -1
  90. package/dist/src/status/status.d.ts +2 -1
  91. package/dist/src/status/status.d.ts.map +1 -1
  92. package/dist/src/telem/series.d.ts +1 -0
  93. package/dist/src/telem/series.d.ts.map +1 -1
  94. package/dist/src/telem/telem.d.ts +15 -6
  95. package/dist/src/telem/telem.d.ts.map +1 -1
  96. package/dist/src/undefined.d.ts +2 -0
  97. package/dist/src/undefined.d.ts.map +1 -0
  98. package/dist/telem.cjs +1 -1
  99. package/dist/telem.js +1 -1
  100. package/dist/{xy-BKIJiLu_.cjs → xy-DWwtHmgn.cjs} +1 -1
  101. package/dist/{xy-CBuhMaIo.js → xy-DYPw8-8C.js} +1 -1
  102. package/dist/xy.cjs +1 -1
  103. package/dist/xy.js +1 -1
  104. package/dist/zod.cjs +1 -1
  105. package/dist/zod.js +1 -1
  106. package/package.json +4 -4
  107. package/src/caseconv/caseconv.spec.ts +30 -0
  108. package/src/caseconv/caseconv.ts +46 -0
  109. package/src/color/color.spec.ts +40 -0
  110. package/src/color/color.ts +72 -0
  111. package/src/deep/copy.spec.ts +148 -0
  112. package/src/deep/external.ts +3 -1
  113. package/src/deep/get.bench.ts +170 -0
  114. package/src/deep/get.spec.ts +196 -0
  115. package/src/deep/get.ts +79 -0
  116. package/src/deep/partial.spec.ts +194 -0
  117. package/src/deep/path.spec.ts +92 -183
  118. package/src/deep/path.ts +27 -198
  119. package/src/deep/remove.bench.ts +238 -0
  120. package/src/deep/remove.spec.ts +219 -0
  121. package/src/deep/remove.ts +102 -0
  122. package/src/deep/set.bench.ts +208 -0
  123. package/src/deep/set.spec.ts +369 -0
  124. package/src/deep/set.ts +91 -0
  125. package/src/index.ts +1 -0
  126. package/src/primitive/primitive.spec.ts +9 -0
  127. package/src/primitive/primitive.ts +9 -0
  128. package/src/spatial/location/location.ts +2 -0
  129. package/src/status/status.spec.ts +52 -0
  130. package/src/status/status.ts +19 -6
  131. package/src/telem/series.ts +2 -0
  132. package/src/telem/telem.spec.ts +302 -0
  133. package/src/telem/telem.ts +60 -18
  134. package/src/undefined.ts +14 -0
  135. package/tsconfig.tsbuildinfo +1 -1
  136. package/dist/base-BLNViP3D.cjs +0 -1
  137. package/dist/external-E3ErJeeM.cjs +0 -1
  138. package/dist/index-D2xcvEO5.js +0 -46
  139. package/dist/index-DOJlZHqJ.cjs +0 -1
  140. package/dist/index-DdhM_E4k.cjs +0 -1
  141. package/dist/location-DJ_K4SlP.cjs +0 -1
  142. package/dist/path-Blh4wJuA.js +0 -110
  143. package/dist/path-CPSfCjde.cjs +0 -1
  144. package/dist/series-tAhThbnz.cjs +0 -6
  145. package/dist/src/deep/delete.d.ts +0 -3
  146. package/dist/src/deep/delete.d.ts.map +0 -1
  147. package/dist/src/deep/delete.spec.d.ts +0 -2
  148. package/dist/src/deep/delete.spec.d.ts.map +0 -1
  149. package/src/deep/delete.spec.ts +0 -73
  150. package/src/deep/delete.ts +0 -27
@@ -109,6 +109,7 @@ export class TimeStamp
109
109
  if (value === Infinity) value = TimeStamp.MAX;
110
110
  else value = TimeStamp.MIN;
111
111
  }
112
+ if (primitive.isCrudeValueExtension<bigint>(value)) value = value.value;
112
113
  super(BigInt(value.valueOf()) + offset);
113
114
  }
114
115
  }
@@ -443,6 +444,23 @@ export class TimeStamp
443
444
  return this.date().getUTCHours();
444
445
  }
445
446
 
447
+ /**
448
+ * @returns the integer hour that the timestamp corresponds to within its day in local time.
449
+ */
450
+ get localHour(): number {
451
+ return this.date().getHours();
452
+ }
453
+
454
+ /**
455
+ * @returns a copy of the timestamp with the hour changed.
456
+ * @param hour the value to set the hour to.
457
+ */
458
+ setLocalHour(hour: number): TimeStamp {
459
+ const d = this.date();
460
+ d.setHours(hour);
461
+ return new TimeStamp(d);
462
+ }
463
+
446
464
  /**
447
465
  * @returns a copy of the timestamp with the hour changed.
448
466
  * @param hour the value to set the hour to.
@@ -450,7 +468,7 @@ export class TimeStamp
450
468
  setHour(hour: number): TimeStamp {
451
469
  const d = this.date();
452
470
  d.setUTCHours(hour);
453
- return new TimeStamp(d, "UTC");
471
+ return new TimeStamp(d);
454
472
  }
455
473
 
456
474
  /** @returns the integer minute that the timestamp corresponds to within its hour. */
@@ -680,6 +698,7 @@ export class TimeSpan
680
698
  {
681
699
  constructor(value: CrudeTimeSpan) {
682
700
  if (typeof value === "number") value = Math.trunc(value.valueOf());
701
+ if (primitive.isCrudeValueExtension<bigint>(value)) value = value.value;
683
702
  super(BigInt(value.valueOf()));
684
703
  }
685
704
 
@@ -693,6 +712,7 @@ export class TimeSpan
693
712
  if (span instanceof TimeSpan) return span;
694
713
  if (span instanceof Rate) return span.period;
695
714
  if (span instanceof TimeStamp) return new TimeSpan(span);
715
+ if (primitive.isCrudeValueExtension<bigint>(span)) span = span.value;
696
716
  if (["number", "bigint"].includes(typeof span)) return TimeSpan.seconds(span);
697
717
  return new TimeSpan(span);
698
718
  }
@@ -707,6 +727,7 @@ export class TimeSpan
707
727
  if (span instanceof TimeSpan) return span;
708
728
  if (span instanceof Rate) return span.period;
709
729
  if (span instanceof TimeStamp) return new TimeSpan(span);
730
+ if (primitive.isCrudeValueExtension<bigint>(span)) span = span.value;
710
731
  if (["number", "bigint"].includes(typeof span)) return TimeSpan.milliseconds(span);
711
732
  return new TimeSpan(span);
712
733
  }
@@ -1022,6 +1043,7 @@ export class Rate
1022
1043
  implements primitive.Stringer
1023
1044
  {
1024
1045
  constructor(value: CrudeRate) {
1046
+ if (primitive.isCrudeValueExtension<number>(value)) value = value.value;
1025
1047
  super(value.valueOf());
1026
1048
  }
1027
1049
 
@@ -1083,7 +1105,7 @@ export class Rate
1083
1105
  * @returns A TimeSpan that corresponds to the given number of bytes.
1084
1106
  */
1085
1107
  byteSpan(size: Size, density: CrudeDensity): TimeSpan {
1086
- return this.span(size.valueOf() / density.valueOf());
1108
+ return this.span(size.valueOf() / new Density(density).valueOf());
1087
1109
  }
1088
1110
 
1089
1111
  /**
@@ -1093,7 +1115,7 @@ export class Rate
1093
1115
  * @returns A new Rate representing the sum of the two rates.
1094
1116
  */
1095
1117
  add(other: CrudeRate): Rate {
1096
- return new Rate(math.add(this.valueOf(), other.valueOf()));
1118
+ return new Rate(math.add(this.valueOf(), new Rate(other).valueOf()));
1097
1119
  }
1098
1120
 
1099
1121
  /**
@@ -1103,7 +1125,7 @@ export class Rate
1103
1125
  * @returns A new Rate representing the difference of the two rates.
1104
1126
  */
1105
1127
  sub(other: CrudeRate): Rate {
1106
- return new Rate(math.sub(this.valueOf(), other.valueOf()));
1128
+ return new Rate(math.sub(this.valueOf(), new Rate(other).valueOf()));
1107
1129
  }
1108
1130
 
1109
1131
  /**
@@ -1166,6 +1188,7 @@ export class Density
1166
1188
  * @returns A Density representing the given number of bytes per value.
1167
1189
  */
1168
1190
  constructor(value: CrudeDensity) {
1191
+ if (primitive.isCrudeValueExtension<number>(value)) value = value.value;
1169
1192
  super(value.valueOf());
1170
1193
  }
1171
1194
 
@@ -1196,7 +1219,7 @@ export class Density
1196
1219
  * @returns A new Density representing the sum of the two densities.
1197
1220
  */
1198
1221
  add(other: CrudeDensity): Density {
1199
- return new Density(math.add(this.valueOf(), other.valueOf()));
1222
+ return new Density(math.add(this.valueOf(), new Density(other).valueOf()));
1200
1223
  }
1201
1224
 
1202
1225
  /**
@@ -1206,7 +1229,7 @@ export class Density
1206
1229
  * @returns A new Density representing the difference of the two densities.
1207
1230
  */
1208
1231
  sub(other: CrudeDensity): Density {
1209
- return new Density(math.sub(this.valueOf(), other.valueOf()));
1232
+ return new Density(math.sub(this.valueOf(), new Density(other).valueOf()));
1210
1233
  }
1211
1234
 
1212
1235
  /**
@@ -1533,6 +1556,7 @@ export class DataType
1533
1556
  implements primitive.Stringer
1534
1557
  {
1535
1558
  constructor(value: CrudeDataType) {
1559
+ if (primitive.isCrudeValueExtension<string>(value)) value = value.value;
1536
1560
  if (
1537
1561
  value instanceof DataType ||
1538
1562
  typeof value === "string" ||
@@ -1815,26 +1839,31 @@ export class Size
1815
1839
  implements primitive.Stringer
1816
1840
  {
1817
1841
  constructor(value: CrudeSize) {
1842
+ if (primitive.isCrudeValueExtension<number>(value)) value = value.value;
1818
1843
  super(value.valueOf());
1819
1844
  }
1820
1845
 
1821
1846
  /** @returns true if the Size is larger than the other size. */
1822
1847
  largerThan(other: CrudeSize): boolean {
1848
+ if (primitive.isCrudeValueExtension<number>(other)) other = other.value;
1823
1849
  return this.valueOf() > other.valueOf();
1824
1850
  }
1825
1851
 
1826
1852
  /** @returns true if the Size is smaller than the other size. */
1827
1853
  smallerThan(other: CrudeSize): boolean {
1854
+ if (primitive.isCrudeValueExtension<number>(other)) other = other.value;
1828
1855
  return this.valueOf() < other.valueOf();
1829
1856
  }
1830
1857
 
1831
1858
  /** @returns a new Size representing the sum of the two Sizes. */
1832
1859
  add(other: CrudeSize): Size {
1860
+ if (primitive.isCrudeValueExtension<number>(other)) other = other.value;
1833
1861
  return new Size(math.add(this.valueOf(), other.valueOf()));
1834
1862
  }
1835
1863
 
1836
1864
  /** @returns a new Size representing the difference of the two Sizes. */
1837
1865
  sub(other: CrudeSize): Size {
1866
+ if (primitive.isCrudeValueExtension<number>(other)) other = other.value;
1838
1867
  return new Size(math.sub(this.valueOf(), other.valueOf()));
1839
1868
  }
1840
1869
 
@@ -1860,12 +1889,14 @@ export class Size
1860
1889
 
1861
1890
  /** @returns a new Size representing the truncated value of the Size. */
1862
1891
  truncate(span: CrudeSize): Size {
1863
- return new Size(Math.trunc(this.valueOf() / span.valueOf()) * span.valueOf());
1892
+ return new Size(
1893
+ Math.trunc(this.valueOf() / new Size(span).valueOf()) * new Size(span).valueOf(),
1894
+ );
1864
1895
  }
1865
1896
 
1866
1897
  /** @returns a new Size representing the remainder of the Size. */
1867
1898
  remainder(span: CrudeSize): Size {
1868
- return Size.bytes(this.valueOf() % span.valueOf());
1899
+ return Size.bytes(this.valueOf() % new Size(span).valueOf());
1869
1900
  }
1870
1901
 
1871
1902
  /** @returns the number of gigabytes in the Size. */
@@ -1929,7 +1960,7 @@ export class Size
1929
1960
  * @returns A Size representing the given number of kilobytes.
1930
1961
  */
1931
1962
  static kilobytes(value: CrudeSize = 1): Size {
1932
- return Size.bytes(value.valueOf() * 1e3);
1963
+ return Size.bytes(new Size(value).valueOf() * 1e3);
1933
1964
  }
1934
1965
 
1935
1966
  /** A kilobyte */
@@ -1942,7 +1973,7 @@ export class Size
1942
1973
  * @returns A Size representing the given number of megabytes.
1943
1974
  */
1944
1975
  static megabytes(value: CrudeSize = 1): Size {
1945
- return Size.kilobytes(value.valueOf() * 1e3);
1976
+ return Size.kilobytes(new Size(value).valueOf() * 1e3);
1946
1977
  }
1947
1978
 
1948
1979
  /** A megabyte */
@@ -1955,7 +1986,7 @@ export class Size
1955
1986
  * @returns A Size representing the given number of gigabytes.
1956
1987
  */
1957
1988
  static gigabytes(value: CrudeSize = 1): Size {
1958
- return Size.megabytes(value.valueOf() * 1e3);
1989
+ return Size.megabytes(new Size(value).valueOf() * 1e3);
1959
1990
  }
1960
1991
 
1961
1992
  /** A gigabyte */
@@ -1968,7 +1999,7 @@ export class Size
1968
1999
  * @returns A Size representing the given number of terabytes.
1969
2000
  */
1970
2001
  static terabytes(value: CrudeSize): Size {
1971
- return Size.gigabytes(value.valueOf() * 1e3);
2002
+ return Size.gigabytes(new Size(value).valueOf() * 1e3);
1972
2003
  }
1973
2004
 
1974
2005
  /** A terabyte. */
@@ -1996,17 +2027,28 @@ export type CrudeTimeStamp =
1996
2027
  | number
1997
2028
  | Date
1998
2029
  | string
1999
- | DateComponents;
2030
+ | DateComponents
2031
+ | primitive.CrudeValueExtension<bigint>;
2000
2032
  export type TimeStampT = number;
2001
- export type CrudeTimeSpan = bigint | TimeSpan | TimeStamp | number | Rate;
2033
+ export type CrudeTimeSpan =
2034
+ | bigint
2035
+ | TimeSpan
2036
+ | TimeStamp
2037
+ | number
2038
+ | Rate
2039
+ | primitive.CrudeValueExtension<bigint>;
2002
2040
  export type TimeSpanT = number;
2003
- export type CrudeRate = Rate | number;
2041
+ export type CrudeRate = Rate | number | primitive.CrudeValueExtension<number>;
2004
2042
  export type RateT = number;
2005
- export type CrudeDensity = Density | number;
2043
+ export type CrudeDensity = Density | number | primitive.CrudeValueExtension<number>;
2006
2044
  export type DensityT = number;
2007
- export type CrudeDataType = DataType | string | TypedArray;
2045
+ export type CrudeDataType =
2046
+ | DataType
2047
+ | string
2048
+ | TypedArray
2049
+ | primitive.CrudeValueExtension<string>;
2008
2050
  export type DataTypeT = string;
2009
- export type CrudeSize = Size | number;
2051
+ export type CrudeSize = Size | number | primitive.CrudeValueExtension<number>;
2010
2052
  export type SizeT = number;
2011
2053
  export interface CrudeTimeRange {
2012
2054
  start: CrudeTimeStamp;
@@ -0,0 +1,14 @@
1
+ // Copyright 2025 Synnax Labs, Inc.
2
+ //
3
+ // Use of this software is governed by the Business Source License included in the file
4
+ // licenses/BSL.txt.
5
+ //
6
+ // As of the Change Date specified in that file, in accordance with the Business Source
7
+ // License, use of this software will be governed by the Apache License, Version 2.0,
8
+ // included in the file licenses/APL.txt.
9
+
10
+ export type IsExactlyUndefined<T> = [T] extends [undefined] // T can be assigned to undefined
11
+ ? [undefined] extends [T] // undefined can be assigned to T
12
+ ? true // both directions → exactly undefined
13
+ : false
14
+ : false;