Repository navigation
OnlyWorlds Unity SDK 0.36.0
The calendar held to the TypeScript SDK's own answers: OWCalendar replays its recorded labels, parses, durations,
validations and resolutions, follows it where it differed, and gains ValidateValue and a FormatDuration that takes
a span that need not be whole; the reader refuses an era year_base other than 0 or 1 (the schema pin at dist.109).
A lost key mint can be found: MintWorldKeyAsync takes an idempotencyKey, and MadeWorldKeyAsync answers the key
it made. A minor release because it adds public API (below).
Added
OWClient.MadeWorldKeyAsync(worldId, idempotencyKey): the key a lost mint made. It reads GET
/account/worlds/{id}/keys/made?key=and answers the key's row without the key itself (OWWorldKeyRow), a revoked
key included, or null when that mint made none (the server's one 404) or the server is from before the lookup (a
405). Any other refusal throws. An account token only. Parity with the TypeScript SDK 4.134.0, its test vectors
ported.MintWorldKeyAsynctakes anidempotencyKey, sent as theIdempotency-Keyheader. The mint remembers it on
the key's row and never replays (a second mint with the same key makes a second key), so when an answer is lost,
MadeWorldKeyAsyncfinds the key, the tool revokes it by its id and mints again. An empty key is refused, nothing
sent.OWMintedKeyis nowOWWorldKeyRowwith the full key added; its fields are unchanged.OWCalendar.ValidateValue(JToken): a rawatlas_calendarvalue validated as the TypeScript SDK's
validateCalendarConfigvalidates it.Validate(CalendarConfig)sees only whatReadConfigcould read, so a value
the reader refuses reached it as null; this reads the value itself and names what is wrong with it ("start must be a
number", "except must be a list", "except and offset need calendar version 2" on a version-1 entry), in the
TypeScript SDK's words and order, reading the value as JavaScript does (a missing key printsundefined, mixed
values compare as<compares them). Where the TypeScript SDK throws (a null value,erasorintercalarythat is
not iterable, a null entry), it answers instead:eras must be a list,intercalary must be a list, or the entry
read as one with no keys. A JSON string is a string here: parse it first.OWCalendar.FormatDuration(CalendarConfig, double): a span that need not be whole, as the TypeScript SDK takes
any number: the step count to two decimals, rounded as JavaScript'sMath.roundrounds (2.5reads "2.5 days",
0.125"0.13 days"). Thelongoverload answers as before, and the same for every whole span.
Changed
- The calendar reader refuses an era
year_baseother than 0 or 1, as the TypeScript and Godot SDKs do: the schema
pin moves tov0.34.0-dist.109(canonical00.34.00unchanged, no field, type or link moved), whose calendar
profile now says in its refusal list what its field table always said, with one fixture case,
refuse-year-base-five(77 cases, 43 refusals). A calendar withyear_base: 5was read before and is bare
numbers now. The generated models changed in their serial and published stamps only; the calendar fixture's test
copy and the parity vectors (from the TypeScript SDK 4.133.2) moved with the pin. OWCalendar.Validate(CalendarConfig)follows the TypeScript SDK in two checks. A grain of White_Space alone (the
room profile's set) is "Grain is required", as the calendar profile reads a grain; an era whosedirectionis
neither absent,"up"nor"down"("Up") no longer gets the up era's "end must be after start" (it still reads
as up when a date is formatted). Neither reaches a calendarReadConfigproduced from a grain the profile refuses,
so this changes answers only for a hand-built config or a stray direction word.OWCalendarLens.ResolveLensmatches the chosen id only against an element id that is a string, as the
TypeScript SDK's===does: an element whose id is the number 5 is no longer chosen by"5".OWCalendarLens.WorldCalendarsreads a name JavaScript reads as false as no name:0orfalsenames the
calendar "(unnamed calendar)", as""and a missing name already did.
Fixed
OWCalendar.FormatDurationwrites a year count as JavaScript does. A count of 1e15 years or more printed
4.5E+15; it now prints4500000000000000, and every count is the shortest spelling that reads back (Mono's"R"
is not that).OWCalendar.ParseDatematches a capital I with dot above (U+0130) as JavaScript lowercases it, toiand
U+0307: a month named "İlkyaz" now reads from "i̇lkyaz 2 3" as the TypeScript SDK reads it.
Tests
- The calendar against the TypeScript SDK's own answers:
Fixtures/calendar/calendar_parity.json(sha256
f756303b…a58ea), generated from the built code of@onlyworlds/sdk4.133.1 at commit3cd810band vendored
byte for byte from the Godot SDK.OWCalendarParityTestsreplays every record through the Unity API: 3,695 year and
mid labels, 1,000 month starts, 50 year lengths, 2,250 durations, 250 era years, 15,171 parses, 147 validations
(throughValidateValue, and the 50 the reader takes throughValidatetoo) and 784 resolutions. Each difference
kept on purpose is a named entry that selects its records and asserts they still differ, so a change that agrees
turns it red: a non-string era abbrev (the typed reader reads it as absent, where npm prints it in a label and throws
on it inparseDate), version 1'sexceptandoffset(unknown keys there, so the typedValidatecannot see
them), an element id read as text, and the resolutions no Unity call takes (an unknown option key, a number for the
chosen id). Pinned by hand where npm has no answer: ayear_baseother than 0 or 1 still reads as a calendar here
(narrowed at the next schema pin), a bare step past 2^53 parses exactly, final sigma is not reproduced, and a
non-stringstep_namereads the grain.