@onlyworlds/sdk 4.84.0 → 4.85.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 +1 -1
- package/CHANGELOG.md +12 -0
- package/README.md +3 -3
- package/dist/index.d.ts +11 -2
- package/dist/index.js +8 -3
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -106,7 +106,7 @@ against live data). The v1 surface (`OnlyWorldsClient`, the `ElementType` enum)
|
|
|
106
106
|
folding, both Unicode 15.1's from its own files (`nfc` since 4.71.0, `simpleCaseFold`), never
|
|
107
107
|
the runtime's `normalize`, whose Unicode is its ICU's (Node 22: 16.0).
|
|
108
108
|
- World calendars (since 4.20.0): `worldCalendars(elements)` finds the elements carrying
|
|
109
|
-
`atlas_calendar` (Atlas owns the field: read it, never write it); `
|
|
109
|
+
`atlas_calendar` (Atlas owns the field: read it, never write it); `resolveCalendar` picks
|
|
110
110
|
one; `formatStep(config, step)` names a point on the world's integer time line, `parseDate`
|
|
111
111
|
reads one back. No calendar or a broken one is null: show the bare number.
|
|
112
112
|
- Ids: the client mints **UUIDv7** on an id-less `create` (since 4.2.0; keel mints v7 too).
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.85.0] - 2026-10-26
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **`resolveCalendar` is the new name of `resolveCalendarLens`**, with the same arguments and answers. "Lens" now names a cut of a world (what a reader is shown of it), so the function that picks a world's chosen calendar no longer uses the word. `resolveCalendarLens` stays as a deprecated function with the same answers until 5.0; its refusal of an unknown option names the function called.
|
|
13
|
+
|
|
14
|
+
## [4.84.1] - 2026-10-26
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **`validateCalendarConfig` answers with its errors, never a TypeError, when `bundles.months` has no names list** (`0`, `''`, `false`, `{}`, or `names` that is not an array). It read `months?.names.length` and threw where it should have listed the problem; such months now count as none for the festival-day check, and their own error is listed as before. `readCalendarValue` was not affected (it answered `null`). Found by comparing this reader with the Python package's port of it, input by input.
|
|
19
|
+
|
|
8
20
|
## [4.84.0] - 2026-10-26
|
|
9
21
|
|
|
10
22
|
### Changed
|
package/README.md
CHANGED
|
@@ -228,7 +228,7 @@ An accept is refused with nothing written when a proposed field moved since the
|
|
|
228
228
|
|
|
229
229
|
A world's owner can have agent seats propose instead of write (`agent_writes_proposed` on `getWorld()`, set on the world page). An agent seat's `patch`, `upsert` or `editLinks` on an existing element then throws `OwProposedError` (status 202, `err.isProposed`), with the row under `err.proposal`. A `bulk` slot says `status: 202` and carries `proposal` instead. A person's key is never held.
|
|
230
230
|
|
|
231
|
-
## Finding
|
|
231
|
+
## Finding elements in a world
|
|
232
232
|
|
|
233
233
|
When you hold a world's elements in memory (from a sync, or a world file), `lookupWorld` finds the ones a plain question is about, with no model and no network:
|
|
234
234
|
|
|
@@ -317,10 +317,10 @@ The two defaults differ on purpose: private records stay out unless you ask, hid
|
|
|
317
317
|
A world's time is an integer line (`time_range_current` is a point on it, and so is an Event's `start_date`). A calendar names its points: months, days, eras. Atlas keeps a calendar on an element (a Construct by convention) in its `atlas_calendar` field, and the SDK reads it with Atlas's own calendar code (since 4.20.0). Atlas owns that field and is its only writer; read it, never write it.
|
|
318
318
|
|
|
319
319
|
```typescript
|
|
320
|
-
import { worldCalendars,
|
|
320
|
+
import { worldCalendars, resolveCalendar, formatStep, formatYearLabel, parseDate } from '@onlyworlds/sdk';
|
|
321
321
|
|
|
322
322
|
const calendars = worldCalendars(elements); // [{ id, name, config }]: every element with a valid atlas_calendar
|
|
323
|
-
const cal =
|
|
323
|
+
const cal = resolveCalendar(elements, chosenId, { fallbackToOnly: true }); // a world with one calendar uses it
|
|
324
324
|
if (cal) {
|
|
325
325
|
formatStep(cal.config, 400); // "4 Alturiak, 1 DR" (with Harptos, from Atlas's tests)
|
|
326
326
|
formatYearLabel(cal.config, 400); // "1 DR"
|
package/dist/index.d.ts
CHANGED
|
@@ -5394,7 +5394,7 @@ declare function isParseError(r: ParseResult | ParseError): r is ParseError;
|
|
|
5394
5394
|
* the one copy since Atlas 245aad3 deleted its own and imports this one:
|
|
5395
5395
|
* a kernel change is an SDK release, and Atlas's 48 kernel tests run against it there too.
|
|
5396
5396
|
* Its contract is still Atlas's calendar design, §5 and §5b. This file adapts Atlas's
|
|
5397
|
-
* `src/core/calendar-lens.ts` (readCalendarValue, worldCalendars, resolveCalendarLens) to
|
|
5397
|
+
* `src/core/calendar-lens.ts` (readCalendarValue, worldCalendars, and its resolveCalendarLens as resolveCalendar) to
|
|
5398
5398
|
* any element shape, since the SDK has no Atlas `Element`.
|
|
5399
5399
|
*
|
|
5400
5400
|
* The field: a calendar is an element (a Construct by convention) carrying `atlas_calendar`.
|
|
@@ -5442,6 +5442,15 @@ declare function worldCalendars(elements: Iterable<OwCalendarElement>): WorldCal
|
|
|
5442
5442
|
* stays null. With several calendars and no choice, nothing is guessed. An unknown option is a
|
|
5443
5443
|
* TypeError (the caller's bug, not the world's data).
|
|
5444
5444
|
*/
|
|
5445
|
+
declare function resolveCalendar(elements: Iterable<OwCalendarElement>, activeId: string | null | undefined, opts?: {
|
|
5446
|
+
fallbackToOnly?: boolean;
|
|
5447
|
+
}): WorldCalendar | null;
|
|
5448
|
+
/**
|
|
5449
|
+
* The old name of {@link resolveCalendar}, with the same answers: "lens" now names a cut of a
|
|
5450
|
+
* world, not a chosen calendar.
|
|
5451
|
+
*
|
|
5452
|
+
* @deprecated Since 4.85.0. Use `resolveCalendar`; this name leaves in 5.0.
|
|
5453
|
+
*/
|
|
5445
5454
|
declare function resolveCalendarLens(elements: Iterable<OwCalendarElement>, activeId: string | null | undefined, opts?: {
|
|
5446
5455
|
fallbackToOnly?: boolean;
|
|
5447
5456
|
}): WorldCalendar | null;
|
|
@@ -5750,4 +5759,4 @@ declare class TokenResource {
|
|
|
5750
5759
|
getEncryptionInfo(): Promise<EncryptionInfo>;
|
|
5751
5760
|
}
|
|
5752
5761
|
|
|
5753
|
-
export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, ELEMENT_FAMILIES, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GameTier, type ListParams, MESSAGE_PAIR, ONLYWORLDS_VERSION, type OwAccountWorld, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAskContextOptions, type OwAskLeftOut, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtPolicy, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwHiddenRow, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberRole, type OwMessageMember, type OwMintedKey, type OwMySeat, type OwNamesMap, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwProposal, type OwProposalAccepted, type OwProposalConflict, type OwProposalList, type OwProposalQuery, type OwProposalState, type OwProposeInput, type OwProposed, OwProposedError, type OwProposedMark, type OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwSignInBegin, type OwSignInBegun, type OwSignInComplete, OwSignInError, type OwSignInReason, type OwSignInResult, type OwSignInStorage, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, OwStaleProposalError, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwWordPair, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldIndex, type OwWorldLink, type OwWorldMeta, type OwWorldOrigin, type OwWorldProducer, type OwWorldProposalList, type OwWorldProposalQuery, type OwWorldProposalRow, type OwWorldPublicPage, type OwWorldSource, type OwWriteDoor, type OwWriteWorldFileOptions, type OwWriteWorldFileReport, PHOTO_MAX_BYTES, PHOTO_TYPES, PROPOSED_MARK, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, type SectionInfo, type StepBreakdown, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, WORLD_FILE_MEDIA_TYPE, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, base64url, breakdownStep, buildAskContext, buildWorldIndex, detectKeyKind, displayYear, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, handsOnAsProposed, intercalaryInYear, isAddressedTo, isAgentDoor, isDemoKey, isKnownOf, isLeapYear, isMessage, isParseError, isRoomElement, isSentBy, isToEveryone, kindCanWrite, lookupWorld, monthStartSteps, nfc, parseDate, parseErrorEnvelope, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, recipientsOf, renderElement, resolveCalendarLens, resolveEraDomains, senderStatus, simpleCaseFold, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
|
|
5762
|
+
export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, ELEMENT_FAMILIES, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GameTier, type ListParams, MESSAGE_PAIR, ONLYWORLDS_VERSION, type OwAccountWorld, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAskContextOptions, type OwAskLeftOut, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtPolicy, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwHiddenRow, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberRole, type OwMessageMember, type OwMintedKey, type OwMySeat, type OwNamesMap, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwProposal, type OwProposalAccepted, type OwProposalConflict, type OwProposalList, type OwProposalQuery, type OwProposalState, type OwProposeInput, type OwProposed, OwProposedError, type OwProposedMark, type OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwSignInBegin, type OwSignInBegun, type OwSignInComplete, OwSignInError, type OwSignInReason, type OwSignInResult, type OwSignInStorage, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, OwStaleProposalError, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwWordPair, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldIndex, type OwWorldLink, type OwWorldMeta, type OwWorldOrigin, type OwWorldProducer, type OwWorldProposalList, type OwWorldProposalQuery, type OwWorldProposalRow, type OwWorldPublicPage, type OwWorldSource, type OwWriteDoor, type OwWriteWorldFileOptions, type OwWriteWorldFileReport, PHOTO_MAX_BYTES, PHOTO_TYPES, PROPOSED_MARK, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, type SectionInfo, type StepBreakdown, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, WORLD_FILE_MEDIA_TYPE, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, base64url, breakdownStep, buildAskContext, buildWorldIndex, detectKeyKind, displayYear, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, handsOnAsProposed, intercalaryInYear, isAddressedTo, isAgentDoor, isDemoKey, isKnownOf, isLeapYear, isMessage, isParseError, isRoomElement, isSentBy, isToEveryone, kindCanWrite, lookupWorld, monthStartSteps, nfc, parseDate, parseErrorEnvelope, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, recipientsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, senderStatus, simpleCaseFold, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
|
package/dist/index.js
CHANGED
|
@@ -4493,7 +4493,7 @@ function validateCalendarConfig(cfg) {
|
|
|
4493
4493
|
}
|
|
4494
4494
|
const inter = cfg.intercalary ?? [];
|
|
4495
4495
|
if (inter.length > 0 && !months) errors.push("Festival days need months");
|
|
4496
|
-
const monthCount = months?.names.length
|
|
4496
|
+
const monthCount = Array.isArray(months?.names) ? months.names.length : 0;
|
|
4497
4497
|
for (const ic of inter) {
|
|
4498
4498
|
if (!Number.isInteger(ic.after_month) || ic.after_month < 0 || ic.after_month > monthCount) {
|
|
4499
4499
|
errors.push(`Festival day "${ic.name}": pick the month it follows`);
|
|
@@ -4971,8 +4971,8 @@ function worldCalendars(elements) {
|
|
|
4971
4971
|
}
|
|
4972
4972
|
return out;
|
|
4973
4973
|
}
|
|
4974
|
-
function
|
|
4975
|
-
refuseUnknownOptions("
|
|
4974
|
+
function resolveCalendar(elements, activeId, opts) {
|
|
4975
|
+
refuseUnknownOptions("resolveCalendar", opts, ["fallbackToOnly"]);
|
|
4976
4976
|
if (activeId === void 0 && opts?.fallbackToOnly) {
|
|
4977
4977
|
const all = worldCalendars(elements);
|
|
4978
4978
|
return all.length === 1 ? all[0] : null;
|
|
@@ -4980,6 +4980,10 @@ function resolveCalendarLens(elements, activeId, opts) {
|
|
|
4980
4980
|
if (!activeId) return null;
|
|
4981
4981
|
return worldCalendars(elements).find((c) => c.id === activeId) ?? null;
|
|
4982
4982
|
}
|
|
4983
|
+
function resolveCalendarLens(elements, activeId, opts) {
|
|
4984
|
+
refuseUnknownOptions("resolveCalendarLens", opts, ["fallbackToOnly"]);
|
|
4985
|
+
return resolveCalendar(elements, activeId, opts);
|
|
4986
|
+
}
|
|
4983
4987
|
|
|
4984
4988
|
// src/token-resource.ts
|
|
4985
4989
|
var TokenResource = class {
|
|
@@ -5255,6 +5259,7 @@ export {
|
|
|
5255
5259
|
readWorldFile,
|
|
5256
5260
|
recipientsOf,
|
|
5257
5261
|
renderElement,
|
|
5262
|
+
resolveCalendar,
|
|
5258
5263
|
resolveCalendarLens,
|
|
5259
5264
|
resolveEraDomains,
|
|
5260
5265
|
senderStatus,
|