@trainheroic-unofficial/dto 3.5.1 → 3.5.2

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.mts CHANGED
@@ -1349,7 +1349,9 @@ type WorkoutDate = readonly [number, number, number];
1349
1349
  /**
1350
1350
  * Parse a `YYYY-M-D` string into the `WorkoutDate` tuple. The single home for this
1351
1351
  * conversion, shared by the MCP tools and the CLI so they cannot drift on what counts
1352
- * as a valid date. Each part must be an integer.
1352
+ * as a valid date. Each part must be a run of digits (`Number("")` is 0, so a blank part such as
1353
+ * the trailing one in "2026-9-" must be rejected explicitly), and month/day must be in range so
1354
+ * a typo cannot land a session on a date the calendar does not have.
1353
1355
  */
1354
1356
  declare function parseWorkoutDate(s: string): WorkoutDate;
1355
1357
  /** Unit advisories surfaced when building: informational notes and override warnings. */
package/dist/index.mjs CHANGED
@@ -789,15 +789,19 @@ const workoutSpecSchema = z.object({
789
789
  /**
790
790
  * Parse a `YYYY-M-D` string into the `WorkoutDate` tuple. The single home for this
791
791
  * conversion, shared by the MCP tools and the CLI so they cannot drift on what counts
792
- * as a valid date. Each part must be an integer.
792
+ * as a valid date. Each part must be a run of digits (`Number("")` is 0, so a blank part such as
793
+ * the trailing one in "2026-9-" must be rejected explicitly), and month/day must be in range so
794
+ * a typo cannot land a session on a date the calendar does not have.
793
795
  */
794
796
  function parseWorkoutDate(s) {
795
- const parts = s.split("-").map((p) => Number(p));
796
- if (parts.length !== 3 || parts.some((n) => !Number.isInteger(n))) throw new Error(`date must be YYYY-M-D, got "${s}".`);
797
+ const parts = s.split("-");
798
+ if (parts.length !== 3 || parts.some((p) => !/^\d+$/u.test(p))) throw new Error(`date must be YYYY-M-D, got "${s}".`);
799
+ const [year, month, day] = parts.map(Number);
800
+ if (month < 1 || month > 12 || day < 1 || day > 31) throw new Error(`date must be YYYY-M-D with a real month and day, got "${s}".`);
797
801
  return [
798
- parts[0],
799
- parts[1],
800
- parts[2]
802
+ year,
803
+ month,
804
+ day
801
805
  ];
802
806
  }
803
807
  /** Body for `POST /v5/sessions/template` (library create, not save-from-session). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trainheroic-unofficial/dto",
3
- "version": "3.5.1",
3
+ "version": "3.5.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",