@synnaxlabs/x 0.46.2 → 0.48.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.
Files changed (78) hide show
  1. package/.turbo/turbo-build.log +18 -18
  2. package/dist/{bounds-DeUXrllt.js → bounds-4BWKPqaP.js} +1 -4
  3. package/dist/bounds.js +1 -1
  4. package/dist/{index-C452Pas0.js → compare-Bnx9CdjS.js} +37 -47
  5. package/dist/compare-GPoFaKRW.cjs +1 -0
  6. package/dist/compare.cjs +1 -1
  7. package/dist/compare.js +34 -2
  8. package/dist/eslint.config.d.ts +3 -0
  9. package/dist/eslint.config.d.ts.map +1 -0
  10. package/dist/{index-D4NCYiQB.js → index-Bv029kh3.js} +2 -2
  11. package/dist/{index-udOjA9d-.cjs → index-CqisIWWC.cjs} +1 -1
  12. package/dist/index.cjs +3 -3
  13. package/dist/index.js +489 -465
  14. package/dist/{scale-BBWhTUqJ.js → scale-DJCMZbfU.js} +1 -1
  15. package/dist/scale.js +1 -1
  16. package/dist/series-B7l2au4y.cjs +6 -0
  17. package/dist/{series-Clbw-fZI.js → series-TpAaBlEg.js} +172 -145
  18. package/dist/spatial.js +2 -2
  19. package/dist/src/array/nullable.d.ts.map +1 -1
  20. package/dist/src/compare/binary.d.ts +25 -0
  21. package/dist/src/compare/binary.d.ts.map +1 -0
  22. package/dist/src/compare/binary.spec.d.ts +2 -0
  23. package/dist/src/compare/binary.spec.d.ts.map +1 -0
  24. package/dist/src/compare/external.d.ts +3 -0
  25. package/dist/src/compare/external.d.ts.map +1 -0
  26. package/dist/src/compare/index.d.ts +1 -1
  27. package/dist/src/compare/index.d.ts.map +1 -1
  28. package/dist/src/csv/csv.d.ts +11 -0
  29. package/dist/src/csv/csv.d.ts.map +1 -0
  30. package/dist/src/csv/csv.spec.d.ts +2 -0
  31. package/dist/src/csv/csv.spec.d.ts.map +1 -0
  32. package/dist/src/csv/index.d.ts +2 -0
  33. package/dist/src/csv/index.d.ts.map +1 -0
  34. package/dist/src/index.d.ts +1 -0
  35. package/dist/src/index.d.ts.map +1 -1
  36. package/dist/src/migrate/migrate.d.ts +1 -1
  37. package/dist/src/migrate/migrate.d.ts.map +1 -1
  38. package/dist/src/spatial/bounds/bounds.d.ts.map +1 -1
  39. package/dist/src/spatial/box/box.d.ts +5 -5
  40. package/dist/src/spatial/box/box.d.ts.map +1 -1
  41. package/dist/src/spatial/scale/scale.d.ts +6 -6
  42. package/dist/src/spatial/scale/scale.d.ts.map +1 -1
  43. package/dist/src/telem/telem.d.ts +14 -0
  44. package/dist/src/telem/telem.d.ts.map +1 -1
  45. package/dist/telem.cjs +1 -1
  46. package/dist/telem.js +1 -1
  47. package/dist/unique.cjs +1 -1
  48. package/dist/unique.js +1 -1
  49. package/package.json +9 -9
  50. package/src/array/nullable.ts +9 -0
  51. package/src/compare/binary.spec.ts +308 -0
  52. package/src/compare/binary.ts +50 -0
  53. package/src/compare/external.ts +11 -0
  54. package/src/compare/index.ts +1 -1
  55. package/src/csv/csv.spec.ts +28 -0
  56. package/src/csv/csv.ts +26 -0
  57. package/src/csv/index.ts +10 -0
  58. package/src/index.ts +1 -0
  59. package/src/jsonrpc/jsonrpc.spec.ts +9 -0
  60. package/src/math/round.spec.ts +2 -1
  61. package/src/migrate/migrate.spec.ts +238 -0
  62. package/src/migrate/migrate.ts +62 -4
  63. package/src/spatial/bounds/bounds.spec.ts +1 -1
  64. package/src/spatial/bounds/bounds.ts +9 -12
  65. package/src/spatial/box/box.spec.ts +3 -3
  66. package/src/spatial/box/box.ts +5 -5
  67. package/src/spatial/dimensions/dimensions.spec.ts +1 -1
  68. package/src/spatial/direction/direction.spec.ts +1 -1
  69. package/src/spatial/location/location.spec.ts +1 -1
  70. package/src/spatial/scale/scale.spec.ts +1 -1
  71. package/src/spatial/scale/scale.ts +7 -7
  72. package/src/telem/telem.spec.ts +87 -0
  73. package/src/telem/telem.ts +48 -0
  74. package/tsconfig.json +1 -1
  75. package/tsconfig.tsbuildinfo +1 -1
  76. package/dist/index-xaxa1hoa.cjs +0 -1
  77. package/dist/series-B2zqvP8A.cjs +0 -6
  78. /package/{eslint.config.js → eslint.config.ts} +0 -0
@@ -154,6 +154,32 @@ export class TimeStamp
154
154
  private static parseDateTimeString(str: string, tzInfo: TZInfo = "UTC"): bigint {
155
155
  if (!str.includes("/") && !str.includes("-"))
156
156
  return TimeStamp.parseTimeString(str, tzInfo);
157
+
158
+ const isDateTimeLocal =
159
+ str.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?$/) != null;
160
+
161
+ if (isDateTimeLocal) {
162
+ let datePart = str;
163
+ let ms = 0;
164
+
165
+ if (str.includes(".")) {
166
+ const parts = str.split(".");
167
+ datePart = parts[0];
168
+ const msPart = parts[1] || "0";
169
+ ms = parseInt(msPart.padEnd(3, "0").slice(0, 3));
170
+ }
171
+
172
+ const d =
173
+ tzInfo === "local"
174
+ ? new Date(datePart.replace("T", " "))
175
+ : new Date(`${datePart}Z`);
176
+
177
+ const baseBigInt = BigInt(d.getTime()) * TimeStamp.MILLISECOND.valueOf();
178
+ const msBigInt = BigInt(ms) * TimeStamp.MILLISECOND.valueOf();
179
+
180
+ return baseBigInt + msBigInt;
181
+ }
182
+
157
183
  const d = new Date(str);
158
184
  // Essential to note that this makes the date midnight in UTC! Not local!
159
185
  // As a result, we need to add the tzInfo offset back in.
@@ -560,6 +586,28 @@ export class TimeStamp
560
586
  return this.sub(this.remainder(span));
561
587
  }
562
588
 
589
+ /**
590
+ * Determines the appropriate string format based on the span magnitude.
591
+ *
592
+ * @param span - The span that provides context for format selection
593
+ * @returns The appropriate TimeStampStringFormat
594
+ *
595
+ * Rules:
596
+ * - For spans >= 30 days: "shortDate" (e.g., "Nov 5")
597
+ * - For spans >= 1 day: "dateTime" (e.g., "Nov 5 14:23:45")
598
+ * - For spans >= 1 hour: "time" (e.g., "14:23:45")
599
+ * - For spans >= 1 second: "preciseTime" (e.g., "14:23:45.123")
600
+ * - For spans < 1 second: "ISOTime" (full precision time)
601
+ */
602
+ formatBySpan(span: TimeSpan): TimeStampStringFormat {
603
+ if (span.greaterThanOrEqual(TimeSpan.days(30))) return "shortDate";
604
+ if (span.greaterThanOrEqual(TimeSpan.DAY)) return "dateTime";
605
+ if (span.greaterThanOrEqual(TimeSpan.HOUR)) return "time";
606
+ if (span.greaterThanOrEqual(TimeSpan.SECOND)) return "preciseTime";
607
+
608
+ return "ISOTime";
609
+ }
610
+
563
611
  /**
564
612
  * @returns A new TimeStamp representing the current time in UTC. It's important to
565
613
  * note that this TimeStamp is only accurate to the millisecond level (that's the best
package/tsconfig.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "baseUrl": ".",
5
5
  "composite": true
6
6
  },
7
- "include": ["src/**/*"]
7
+ "include": ["src/**/*", "eslint.config.ts"]
8
8
  }