@onlyworlds/sdk 4.42.0 → 4.42.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.42.1] - 2026-10-20
9
+
10
+ The calendar reader refuses what the `atlas_calendar` profile refuses (schema-dist `profiles/calendar.md`; Quillon's Unity read, OW Council h58 #8917).
11
+
12
+ ### Fixed
13
+ - **`readCalendarValue` / `readCalendarConfig` no longer throw on a falsy `eras` or `intercalary`** (`false`, `0`, `""`): it threw a `TypeError` where the profile says a reader refuses and shows bare numbers. It now returns `null`.
14
+ - **A step is an integer, so the reader now refuses** an era whose `start` or `end` is not a whole number, a `year_base` other than `0` or `1` (a string `"1"` printed as `"01"` before), and month or weekday names that are not strings. Atlas writes none of these; the Unity SDK refuses them the same way.
15
+
8
16
  ## [4.42.0] - 2026-10-20
9
17
 
10
18
  Schema 00.32.02 (Skeld, OW Council h58 #8811): repinned to schema-dist v0.32.2-dist.29.
package/dist/index.js CHANGED
@@ -3001,18 +3001,21 @@ function readCalendarConfig(value) {
3001
3001
  const cfg = value;
3002
3002
  if (cfg.version !== 1 || typeof cfg.grain !== "string") return null;
3003
3003
  const months = cfg.bundles?.months;
3004
- if (months && (!Array.isArray(months.names) || !Array.isArray(months.lengths) || months.names.length !== months.lengths.length || months.names.length === 0)) return null;
3005
- if (cfg.eras && !Array.isArray(cfg.eras)) return null;
3006
- if (cfg.eras?.some((e) => typeof e?.name !== "string" || !Number.isFinite(e?.start))) return null;
3007
- if (cfg.intercalary && (!Array.isArray(cfg.intercalary) || cfg.intercalary.some((i) => typeof i?.name !== "string" || !Number.isInteger(i?.after_month)))) return null;
3004
+ if (months && (!Array.isArray(months.names) || !Array.isArray(months.lengths) || months.names.length !== months.lengths.length || months.names.length === 0 || !months.names.every(isString))) return null;
3005
+ if (cfg.eras != null && !Array.isArray(cfg.eras)) return null;
3006
+ if (cfg.eras?.some((e) => typeof e?.name !== "string" || !Number.isSafeInteger(e?.start) || e.end != null && !Number.isSafeInteger(e.end) || e.year_base != null && e.year_base !== 0 && e.year_base !== 1)) return null;
3007
+ if (cfg.intercalary != null && (!Array.isArray(cfg.intercalary) || cfg.intercalary.some((i) => typeof i?.name !== "string" || !Number.isInteger(i?.after_month)))) return null;
3008
3008
  if (months && !months.lengths.every(isPositiveInt)) return null;
3009
3009
  const year = cfg.bundles?.year;
3010
3010
  if (year != null && !isPositiveInt(year.steps)) return null;
3011
3011
  const week = cfg.bundles?.week;
3012
- if (week != null && (!isPositiveInt(week.length) || !Array.isArray(week.names))) return null;
3012
+ if (week != null && (!isPositiveInt(week.length) || !Array.isArray(week.names) || !week.names.every(isString))) return null;
3013
3013
  if (cfg.intercalary?.some((i) => i.every_years != null && !isPositiveInt(i.every_years))) return null;
3014
3014
  return cfg;
3015
3015
  }
3016
+ function isString(s) {
3017
+ return typeof s === "string";
3018
+ }
3016
3019
  function isPositiveInt(n) {
3017
3020
  return Number.isSafeInteger(n) && n >= 1;
3018
3021
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.42.0",
3
+ "version": "4.42.1",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {