@onlyworlds/sdk 4.95.0 → 4.96.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 +12 -0
- package/README.md +2 -0
- package/dist/index.d.ts +18 -3
- package/dist/index.js +11 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.96.1] - 2026-10-27
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **The lens and graph readers read the world's now as the API serves it.** `GET /world` names the world's now `time_range_current`, and a world folder names it `time_current`; `resolveLens` and `worldGraph` read only `now` and `time_current`, so a World body passed straight from the API had no now: no fence, and a `window` that cut nothing. They now read `now`, else `time_current`, else `time_range_current`, and `OwLensWorld` types the third. A shared edge case holds it in both packages; the Python package's `resolve_lens` and `world_graph` read the same.
|
|
13
|
+
|
|
14
|
+
## [4.96.0] - 2026-10-27
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **`DATE_FIELD`** and **`dateOf(element)`**: the lens profile's date table, exported (each dated type's date field by the type's lowercase name; the ten timeless types are not in it; frozen), and an element's date as that table reads it: the whole number in its type's date field, or null for a timeless type, a body with no known `type`, and a date field that is absent, null or not a whole number. It reads the body it is given, so a known-of stub reads null. A timeline or a horizon can now date elements exactly as the lens reader's fence does, from one table. The Python package's `DATE_FIELD` and `date_of` give the same answers.
|
|
19
|
+
|
|
8
20
|
## [4.95.0] - 2026-10-27
|
|
9
21
|
|
|
10
22
|
### Added
|
package/README.md
CHANGED
|
@@ -407,6 +407,8 @@ if (r.unreadable) console.warn(`x_lens.${r.unreadable} is outside the profile's
|
|
|
407
407
|
|
|
408
408
|
The world holds the elements as the owner is served them; the reader's `rung` (`owner`, `contributor`, `guest` with its `whole` and `known_of` ids, `public`) decides what it sees, and an owner reading `as` another reader keeps the owner's two counts (`anchor_not_visible`, `not_visible`), which no other reader ever carries. The profile: [`profiles/lens.md`](https://github.com/OnlyWorlds/schema-dist/blob/main/profiles/lens.md).
|
|
409
409
|
|
|
410
|
+
`DATE_FIELD` is the profile's date table (each dated type's date field; the ten timeless types are not in it), and `dateOf(el)` is an element's date as that table reads it: the whole number in its type's date field, else null. A timeline or a horizon dates elements exactly as the lens reader's fence does.
|
|
411
|
+
|
|
410
412
|
`worldGraph(world, reader, options)` reads the same snapshot, for the same reader, as nodes and edges: `nodes` (`{ id, type, name, family, icon }`, by id), `edges` (`{ source, field, target, index }`, one per link, by source, field and index), `edgesCut` (links to elements that are not nodes, by reason; with a lens, `outside_lens` counts links to elements the reader sees that the lens left out), `cut` and `unreadable` (the `x_lens` key a lens could not be read by, else null). Room elements, hidden and proposed ones and map space are out unless `rooms`, `hidden`, `proposed` or `mapSpace` brings them back (`hidden` and `proposed` are the owner's alone, and a public reader takes no flag); with `{ lens }` the nodes are exactly what the lens kept.
|
|
411
413
|
|
|
412
414
|
```typescript
|
package/dist/index.d.ts
CHANGED
|
@@ -5052,12 +5052,14 @@ interface OwLensWorld {
|
|
|
5052
5052
|
members?: readonly OwMessageMember[] | null;
|
|
5053
5053
|
/** The world's now, in its own time unit: the default `as_of`. */
|
|
5054
5054
|
now?: number | null;
|
|
5055
|
-
/** The World's own now (
|
|
5055
|
+
/** The World's own now as a world folder spells it (`time_current`), read when `now` is not given. */
|
|
5056
5056
|
time_current?: number | null;
|
|
5057
|
+
/** The World's own now as the API serves it (`GET /world`'s `time_range_current`), read when neither `now` nor `time_current` is given. */
|
|
5058
|
+
time_range_current?: number | null;
|
|
5057
5059
|
}
|
|
5058
5060
|
/** `resolveLens`'s options. */
|
|
5059
5061
|
interface OwLensOptions {
|
|
5060
|
-
/** The reading's date, a whole number in the world's time unit; absent: the world's now (`now`, else `time_current`); none at all: no fence, and the window cuts nothing. */
|
|
5062
|
+
/** The reading's date, a whole number in the world's time unit; absent: the world's now (`now`, else `time_current`, else `time_range_current`); none at all: no fence, and the window cuts nothing. */
|
|
5061
5063
|
asOf?: number | null;
|
|
5062
5064
|
/** The reading's wall-clock time for the mail rule's thirty days, a date-time; absent: the machine's time. Never the world's now. */
|
|
5063
5065
|
clock?: string | null;
|
|
@@ -5098,6 +5100,19 @@ interface OwLensReading {
|
|
|
5098
5100
|
/** The first `x_lens` key whose value is outside the profile's table (`x_lens` itself when it is not an object): the lens resolves to nothing. Null for a readable lens. */
|
|
5099
5101
|
unreadable: string | null;
|
|
5100
5102
|
}
|
|
5103
|
+
/**
|
|
5104
|
+
* The lens profile's date table: each dated type's date field, by the type's lowercase name. The other ten
|
|
5105
|
+
* types are timeless and never fenced. The lens reader's fence and window read it, and so can a timeline or a
|
|
5106
|
+
* horizon that must date elements the same way. Frozen.
|
|
5107
|
+
*/
|
|
5108
|
+
declare const DATE_FIELD: Readonly<Record<string, string>>;
|
|
5109
|
+
/**
|
|
5110
|
+
* An element's date as the lens profile reads it: the whole number in its type's date field (`DATE_FIELD`),
|
|
5111
|
+
* in the world's own time unit. Null for a timeless type, a body with no known `type`, and a date field that is
|
|
5112
|
+
* absent, null or not a whole number. It reads the body it is given: a known-of stub serves no date, so it
|
|
5113
|
+
* reads null, whatever the element's own date is.
|
|
5114
|
+
*/
|
|
5115
|
+
declare function dateOf(element: object | null | undefined): number | null;
|
|
5101
5116
|
/**
|
|
5102
5117
|
* True when the element is a lens: a Construct with supertype `Lens`, the type and the supertype each
|
|
5103
5118
|
* trimmed (Unicode White_Space at both ends) and compared without regard to case, the whole word
|
|
@@ -6364,4 +6379,4 @@ declare class TokenResource {
|
|
|
6364
6379
|
getEncryptionInfo(): Promise<EncryptionInfo>;
|
|
6365
6380
|
}
|
|
6366
6381
|
|
|
6367
|
-
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, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountWorld, type OwAddress, OwAddressError, type OwAddressForm, type OwAddressReading, type OwAddressReason, type OwAddressingOptions, 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 OwDraughtLens, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwGraphCutReason, type OwGraphEdge, type OwGraphMark, type OwGraphNode, type OwGraphOptions, type OwHiddenRow, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLensCutReason, type OwLensMail, type OwLensOptions, type OwLensReader, type OwLensReading, type OwLensWorld, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberLenses, 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 OwWorldGraph, type OwWorldIndex, type OwWorldLens, type OwWorldLensReading, type OwWorldLenses, 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, degreeOf, detectKeyKind, displayYear, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, lensesInUse, lookupWorld, monthStartSteps, nfc, noteOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, recipientsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, senderStatus, simpleCaseFold, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
|
|
6382
|
+
export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, DATE_FIELD, 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, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountWorld, type OwAddress, OwAddressError, type OwAddressForm, type OwAddressReading, type OwAddressReason, type OwAddressingOptions, 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 OwDraughtLens, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwGraphCutReason, type OwGraphEdge, type OwGraphMark, type OwGraphNode, type OwGraphOptions, type OwHiddenRow, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLensCutReason, type OwLensMail, type OwLensOptions, type OwLensReader, type OwLensReading, type OwLensWorld, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberLenses, 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 OwWorldGraph, type OwWorldIndex, type OwWorldLens, type OwWorldLensReading, type OwWorldLenses, 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, dateOf, degreeOf, detectKeyKind, displayYear, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, lensesInUse, lookupWorld, monthStartSteps, nfc, noteOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, recipientsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, senderStatus, simpleCaseFold, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
|
package/dist/index.js
CHANGED
|
@@ -4073,7 +4073,7 @@ var TYPE_ORDER = [
|
|
|
4073
4073
|
"zone"
|
|
4074
4074
|
];
|
|
4075
4075
|
var TYPE_RANK = new Map(TYPE_ORDER.map((t, i) => [t, i]));
|
|
4076
|
-
var DATE_FIELD = {
|
|
4076
|
+
var DATE_FIELD = Object.freeze({
|
|
4077
4077
|
character: "birth_date",
|
|
4078
4078
|
creature: "birth_date",
|
|
4079
4079
|
institution: "founding_date",
|
|
@@ -4086,7 +4086,7 @@ var DATE_FIELD = {
|
|
|
4086
4086
|
narrative: "start_date",
|
|
4087
4087
|
relation: "start_date",
|
|
4088
4088
|
zone: "start_date"
|
|
4089
|
-
};
|
|
4089
|
+
});
|
|
4090
4090
|
var CUT_REASONS = [
|
|
4091
4091
|
"budget",
|
|
4092
4092
|
"types",
|
|
@@ -4111,6 +4111,12 @@ var isBody2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
|
4111
4111
|
var own = (v, key) => Object.prototype.hasOwnProperty.call(v, key);
|
|
4112
4112
|
var valueOf = (v, key) => own(v, key) && v[key] !== void 0 ? v[key] : null;
|
|
4113
4113
|
var whole = (v) => typeof v === "number" && Number.isInteger(v) ? v : null;
|
|
4114
|
+
function dateOf(element) {
|
|
4115
|
+
if (!isBody2(element)) return null;
|
|
4116
|
+
const type = typeof element.type === "string" ? fold(element.type) : "";
|
|
4117
|
+
if (!own(DATE_FIELD, type)) return null;
|
|
4118
|
+
return whole(valueOf(element, DATE_FIELD[type]));
|
|
4119
|
+
}
|
|
4114
4120
|
function byCodePoint2(a, b) {
|
|
4115
4121
|
const x = Array.from(a);
|
|
4116
4122
|
const y = Array.from(b);
|
|
@@ -4540,7 +4546,7 @@ function readingDate(fn, world, opts) {
|
|
|
4540
4546
|
if (asOfV !== null && whole(asOfV) === null) throw new TypeError(`${fn}: asOf is a whole number; got ${JSON.stringify(asOfV)}.`);
|
|
4541
4547
|
const clockV = valueOf(opts, "clock");
|
|
4542
4548
|
if (clockV !== null && timeKey(clockV) === null) throw new TypeError(`${fn}: clock is a date-time; got ${JSON.stringify(clockV)}.`);
|
|
4543
|
-
const asOf = asOfV !== null ? asOfV : whole(world.now) ?? whole(world.time_current);
|
|
4549
|
+
const asOf = asOfV !== null ? asOfV : whole(world.now) ?? whole(world.time_current) ?? whole(world.time_range_current);
|
|
4544
4550
|
return { asOf, clock: clockV };
|
|
4545
4551
|
}
|
|
4546
4552
|
function lensReading(r, lens, clockV) {
|
|
@@ -6481,6 +6487,7 @@ export {
|
|
|
6481
6487
|
ASK_LIMITS,
|
|
6482
6488
|
CALENDAR_FIELD,
|
|
6483
6489
|
CALENDAR_SUPERTYPE,
|
|
6490
|
+
DATE_FIELD,
|
|
6484
6491
|
ELEMENT_FAMILIES,
|
|
6485
6492
|
ELEMENT_ICONS,
|
|
6486
6493
|
ELEMENT_LABELS,
|
|
@@ -6522,6 +6529,7 @@ export {
|
|
|
6522
6529
|
breakdownStep,
|
|
6523
6530
|
buildAskContext,
|
|
6524
6531
|
buildWorldIndex,
|
|
6532
|
+
dateOf,
|
|
6525
6533
|
degreeOf,
|
|
6526
6534
|
detectKeyKind,
|
|
6527
6535
|
displayYear,
|