@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.
- package/.turbo/turbo-build.log +18 -18
- package/dist/{bounds-DeUXrllt.js → bounds-4BWKPqaP.js} +1 -4
- package/dist/bounds.js +1 -1
- package/dist/{index-C452Pas0.js → compare-Bnx9CdjS.js} +37 -47
- package/dist/compare-GPoFaKRW.cjs +1 -0
- package/dist/compare.cjs +1 -1
- package/dist/compare.js +34 -2
- package/dist/eslint.config.d.ts +3 -0
- package/dist/eslint.config.d.ts.map +1 -0
- package/dist/{index-D4NCYiQB.js → index-Bv029kh3.js} +2 -2
- package/dist/{index-udOjA9d-.cjs → index-CqisIWWC.cjs} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +489 -465
- package/dist/{scale-BBWhTUqJ.js → scale-DJCMZbfU.js} +1 -1
- package/dist/scale.js +1 -1
- package/dist/series-B7l2au4y.cjs +6 -0
- package/dist/{series-Clbw-fZI.js → series-TpAaBlEg.js} +172 -145
- package/dist/spatial.js +2 -2
- package/dist/src/array/nullable.d.ts.map +1 -1
- package/dist/src/compare/binary.d.ts +25 -0
- package/dist/src/compare/binary.d.ts.map +1 -0
- package/dist/src/compare/binary.spec.d.ts +2 -0
- package/dist/src/compare/binary.spec.d.ts.map +1 -0
- package/dist/src/compare/external.d.ts +3 -0
- package/dist/src/compare/external.d.ts.map +1 -0
- package/dist/src/compare/index.d.ts +1 -1
- package/dist/src/compare/index.d.ts.map +1 -1
- package/dist/src/csv/csv.d.ts +11 -0
- package/dist/src/csv/csv.d.ts.map +1 -0
- package/dist/src/csv/csv.spec.d.ts +2 -0
- package/dist/src/csv/csv.spec.d.ts.map +1 -0
- package/dist/src/csv/index.d.ts +2 -0
- package/dist/src/csv/index.d.ts.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/migrate/migrate.d.ts +1 -1
- package/dist/src/migrate/migrate.d.ts.map +1 -1
- package/dist/src/spatial/bounds/bounds.d.ts.map +1 -1
- package/dist/src/spatial/box/box.d.ts +5 -5
- package/dist/src/spatial/box/box.d.ts.map +1 -1
- package/dist/src/spatial/scale/scale.d.ts +6 -6
- package/dist/src/spatial/scale/scale.d.ts.map +1 -1
- package/dist/src/telem/telem.d.ts +14 -0
- package/dist/src/telem/telem.d.ts.map +1 -1
- package/dist/telem.cjs +1 -1
- package/dist/telem.js +1 -1
- package/dist/unique.cjs +1 -1
- package/dist/unique.js +1 -1
- package/package.json +9 -9
- package/src/array/nullable.ts +9 -0
- package/src/compare/binary.spec.ts +308 -0
- package/src/compare/binary.ts +50 -0
- package/src/compare/external.ts +11 -0
- package/src/compare/index.ts +1 -1
- package/src/csv/csv.spec.ts +28 -0
- package/src/csv/csv.ts +26 -0
- package/src/csv/index.ts +10 -0
- package/src/index.ts +1 -0
- package/src/jsonrpc/jsonrpc.spec.ts +9 -0
- package/src/math/round.spec.ts +2 -1
- package/src/migrate/migrate.spec.ts +238 -0
- package/src/migrate/migrate.ts +62 -4
- package/src/spatial/bounds/bounds.spec.ts +1 -1
- package/src/spatial/bounds/bounds.ts +9 -12
- package/src/spatial/box/box.spec.ts +3 -3
- package/src/spatial/box/box.ts +5 -5
- package/src/spatial/dimensions/dimensions.spec.ts +1 -1
- package/src/spatial/direction/direction.spec.ts +1 -1
- package/src/spatial/location/location.spec.ts +1 -1
- package/src/spatial/scale/scale.spec.ts +1 -1
- package/src/spatial/scale/scale.ts +7 -7
- package/src/telem/telem.spec.ts +87 -0
- package/src/telem/telem.ts +48 -0
- package/tsconfig.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/index-xaxa1hoa.cjs +0 -1
- package/dist/series-B2zqvP8A.cjs +0 -6
- /package/{eslint.config.js → eslint.config.ts} +0 -0
package/src/telem/telem.ts
CHANGED
|
@@ -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