@onlyworlds/sdk 4.102.5 → 4.103.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/AGENTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # For AI agents using @onlyworlds/sdk
2
2
 
3
- **Current as of**: SDK **4.x** · schema-dist **v0.33.0-dist.88** (canonical 00.33.00).
3
+ **Current as of**: SDK **4.x** · schema-dist **v0.33.0-dist.89** (canonical 00.33.00).
4
4
  This line is asserted by `codegen:check` in CI — if the pin moves and this file is not
5
5
  re-read against it, the check fails rather than letting this document rot quietly.
6
6
 
package/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.103.0] - 2026-10-29
9
+
10
+ ### Changed
11
+
12
+ - **Schema repinned to schema-dist `v0.33.0-dist.89`** (from dist.88; the same canonical 00.33.00, so `ONLYWORLDS_VERSION` stays `'00.33.00'` and no type, field or constant moved). The calendar profile's fixture goes from 64 cases to 75 (209 steps, 41 values a reader must refuse) and the message profile's from 85 to 87; every case passes.
13
+ - **`readCalendarConfig` refuses more values, as the calendar profile now rules**, and `readCalendarValue`, `worldCalendars` and `resolveCalendar` follow (no calendar: show bare numbers):
14
+ - a `grain` with nothing left after trimming the room profile's White_Space set (`" "`, a tab, U+3000), where 4.102.5 refused only `""`. The trim is White_Space exactly, never JavaScript's `trim()`: a grain of U+FEFF still reads. `validateCalendarConfig` says `Grain is required` for the same values;
15
+ - an intercalary day whose `after_month` names a month the year does not have: past the last month (`after_month: 5` on a year of two months, which 4.102.5 read as a day in no month), below the first (`-1`), or any intercalary day on a calendar with no months. `after_month: 0` (before the first month) still reads, but only on a calendar that has months. With no months, `after_month` names a place between months and there are none, so even `after_month: 0` refuses there: this follows a ruling of the calendar profile that its fixture will carry later (serial 89's fixture refuses only an `after_month` above 0 there). An empty `intercalary` list still reads, and `validateCalendarConfig` already said `Festival days need months` for these values.
16
+ - **A `format` or `format_intercalary` that is not a string is ignored** and the default template prints. In 4.102.5 `formatStep` threw a TypeError on one.
17
+ - The calendar fixture's new case with a world's elements replays through `worldCalendars`: a calendar is found by the `atlas_calendar` field being present, never by type or supertype. The message fixture's two new cases, a `created_at` with an offset and a fraction of a second read as an instant, and the newest Note listed last, already passed: the message readers read times that way and keep the newest Note wherever it stands.
18
+
8
19
  ## [4.102.5] - 2026-10-29
9
20
 
10
21
  ### Fixed
package/SCHEMA.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # OnlyWorlds Schema Reference
2
2
 
3
- **Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.33.0-dist.88** — canonical schema **00.33.00**, published 2026-10-29.
3
+ **Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.33.0-dist.89** — canonical schema **00.33.00**, published 2026-10-29.
4
4
 
5
5
  GENERATED from the canonical schema YAML — do not hand-edit (regenerate: `python codegen/generate_types.py`).
6
6
  Written for both humans and AI agents reading this package locally.
package/dist/index.js CHANGED
@@ -6029,10 +6029,13 @@ function floorDiv2(a, b) {
6029
6029
  function floorMod(a, b) {
6030
6030
  return (a % b + b) % b;
6031
6031
  }
6032
+ function hasGrain(grain) {
6033
+ return typeof grain === "string" && trimWhiteSpace(grain) !== "";
6034
+ }
6032
6035
  function validateCalendarConfig(cfg) {
6033
6036
  const errors = [];
6034
6037
  if (cfg.version !== 1 && cfg.version !== 2) errors.push(`Unsupported calendar version: ${cfg.version}`);
6035
- if (!cfg.grain || typeof cfg.grain !== "string") errors.push("Grain is required");
6038
+ if (!hasGrain(cfg.grain)) errors.push("Grain is required");
6036
6039
  const months = cfg.bundles?.months;
6037
6040
  if (months) {
6038
6041
  if (!Array.isArray(months.names) || !Array.isArray(months.lengths) || months.names.length === 0 || months.names.length !== months.lengths.length) {
@@ -6094,7 +6097,7 @@ function validateCalendarConfig(cfg) {
6094
6097
  function readCalendarConfig(value) {
6095
6098
  if (typeof value !== "object" || value === null) return null;
6096
6099
  const cfg = value;
6097
- if (cfg.version !== 1 && cfg.version !== 2 || typeof cfg.grain !== "string" || cfg.grain === "") return null;
6100
+ if (cfg.version !== 1 && cfg.version !== 2 || !hasGrain(cfg.grain)) return null;
6098
6101
  const months = cfg.bundles?.months;
6099
6102
  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;
6100
6103
  if (cfg.eras != null && !Array.isArray(cfg.eras)) return null;
@@ -6107,6 +6110,9 @@ function readCalendarConfig(value) {
6107
6110
  if (week != null && (!isPositiveInt(week.length) || !Array.isArray(week.names) || !week.names.every(isString))) return null;
6108
6111
  if (cfg.intercalary?.some((i) => i.every_years != null && !isPositiveInt(i.every_years))) return null;
6109
6112
  if (cfg.version === 2 && cfg.intercalary?.some((i) => leapRuleProblem(i) != null)) return null;
6113
+ if (!months && cfg.intercalary != null && cfg.intercalary.length > 0) return null;
6114
+ const monthCount = months ? months.names.length : 0;
6115
+ if (cfg.intercalary?.some((i) => i.after_month < 0 || i.after_month > monthCount)) return null;
6110
6116
  return cfg;
6111
6117
  }
6112
6118
  function leapRuleProblem(ic) {
@@ -6334,7 +6340,7 @@ function formatStep(cfg, step) {
6334
6340
  step: String(step),
6335
6341
  intercalary: b.intercalary
6336
6342
  };
6337
- const template = b.intercalary != null ? cfg.format_intercalary ?? DEFAULT_FORMAT_INTERCALARY : cfg.format ?? (cfg.bundles?.months ? DEFAULT_FORMAT_MONTHS : DEFAULT_FORMAT_PLAIN);
6343
+ const template = b.intercalary != null ? typeof cfg.format_intercalary === "string" ? cfg.format_intercalary : DEFAULT_FORMAT_INTERCALARY : typeof cfg.format === "string" ? cfg.format : cfg.bundles?.months ? DEFAULT_FORMAT_MONTHS : DEFAULT_FORMAT_PLAIN;
6338
6344
  return renderTemplate(template, values);
6339
6345
  }
6340
6346
  function formatYearLabel(cfg, step) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.102.5",
3
+ "version": "4.103.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {