@onlyworlds/sdk 4.93.1 → 4.94.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 +5 -0
- package/CHANGELOG.md +13 -0
- package/dist/index.d.ts +60 -7
- package/dist/index.js +49 -15
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -75,6 +75,11 @@ against live data). The v1 surface (`OnlyWorldsClient`, the `ElementType` enum)
|
|
|
75
75
|
for (`my_seats`, since 4.82.0: `{ id, kind, name, character }`, agent seats first), and the
|
|
76
76
|
world's Charter with up to five skill Objects: an agent reads `charter` first. `client.members()` is the roster's rows. An
|
|
77
77
|
account token is a TypeError.
|
|
78
|
+
- Lenses chosen (a world key, or an account token): `worldLenses(worldId, { resolve })` lists the
|
|
79
|
+
world's lenses; `setMyLenses(lensIds)` sets the ones you start with (an account token needs the
|
|
80
|
+
client's `world`). With an account token, `setMemberLenses(worldId, memberId, lensIds)` sets a
|
|
81
|
+
row's list: your own, a seat you answer for, or the owner's own with `'owner'`; it returns an
|
|
82
|
+
`OwMemberLenses` (`{ id, role, kind, lenses }`, `id` null for the owner's own).
|
|
78
83
|
- Signing in (no key needed): `new OwV2Client().signInWithPassword({ email, password,
|
|
79
84
|
tokenName })` (or `username`) mints an `ow_a_` account token named for the device and ends
|
|
80
85
|
the sign-in session; only the token comes back. Refusals: `OwSignInError` with `reason`
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.94.0] - 2026-10-27
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`setMemberLenses(worldId, memberId, lensIds)`**: `PATCH /account/worlds/{world_id}/members/{member_id}` with `{ lenses }` alone, the lenses a row starts with, lens ids in order (0 to 20, `[]` for none, which is a choice). An account token's call: a member sets its own row, a seat it answers for, or any seat as a co-builder; the owner any seat, and its own list with `'owner'` as `memberId`. Nothing but `lenses` is sent. A world key, or anything but a list, is a TypeError before sending. keel's codes are the 404 for a lens you or the row's holder cannot see, 422 `not_a_lens`, `lens_is_template` and `lens_hidden`, and 422 when the owner names a person's row.
|
|
13
|
+
- **`OwMemberLenses`**: what `setMemberLenses` returns, keel's `MemberLenses`: `id` (null for the owner's own list), `role`, `kind` (`owner` for the owner's own list), `lenses` as you are shown it, and `x_served_trimmed`, the served-only mark naming `lenses` when the list keeps a lens you cannot see.
|
|
14
|
+
|
|
15
|
+
- **`expiresAt` on `completeSignIn`'s result**: when the account token stops working, as the exchange now answers it (`expires_at`), for a tool whose registration asks for a lifetime; null for one with none, whose token works until it is revoked, and from a server that does not send it.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- **`worldLenses` and `setMyLenses` take an account token**, as keel's document now declares. `worldLenses(worldId)` sends the Bearer token alone, the world in its path, no `world=`. `setMyLenses(lensIds)` sets your own list in the world the client's `world` names, sending `world=<id>` and the Bearer token; an account client without `world` set is a TypeError before sending. On a world key both send as before (`setMyLenses` with its PIN, never a `world`). `request()` takes the rule as an option, `accountToken: 'path' | 'world'`, beside `worldRead`.
|
|
20
|
+
|
|
8
21
|
## [4.93.1] - 2026-10-27
|
|
9
22
|
|
|
10
23
|
### Fixed
|
package/dist/index.d.ts
CHANGED
|
@@ -3104,6 +3104,26 @@ interface OwSeat {
|
|
|
3104
3104
|
last_active: string | null;
|
|
3105
3105
|
[k: string]: unknown;
|
|
3106
3106
|
}
|
|
3107
|
+
/**
|
|
3108
|
+
* setMemberLenses's answer (keel's `MemberLenses`): the row whose lenses were set, as you are shown it.
|
|
3109
|
+
* Not the roster row: only these keys come back.
|
|
3110
|
+
*/
|
|
3111
|
+
interface OwMemberLenses {
|
|
3112
|
+
/** The membership; null for the owner's own list (`'owner'` as the member id). */
|
|
3113
|
+
id: string | null;
|
|
3114
|
+
/** The row's role; `owner` for the owner's own list. */
|
|
3115
|
+
role: OwMemberRole;
|
|
3116
|
+
/** `person`, `agent` or `player`; `owner` for the owner's own list. */
|
|
3117
|
+
kind: string;
|
|
3118
|
+
/** The row's lenses, lens ids in its order, as you are shown it; empty for none, which is a choice. */
|
|
3119
|
+
lenses: string[];
|
|
3120
|
+
/**
|
|
3121
|
+
* Served only, never written: present only when the list keeps a lens you cannot see, which stays
|
|
3122
|
+
* in the list where it stands and is left out of `lenses`; then it names `lenses`.
|
|
3123
|
+
*/
|
|
3124
|
+
x_served_trimmed?: 'lenses'[];
|
|
3125
|
+
[k: string]: unknown;
|
|
3126
|
+
}
|
|
3107
3127
|
/** POST /account/worlds/{id}/seats's answer: the seat, its key and secret, shown in this answer only. */
|
|
3108
3128
|
interface OwSeatCreated {
|
|
3109
3129
|
world: {
|
|
@@ -3360,10 +3380,11 @@ interface OwClientConfig {
|
|
|
3360
3380
|
* A world's id, for a client that holds an account token (`ow_a_`) or no key. `list`, `listAll`,
|
|
3361
3381
|
* `get` and `getWorld` then read that world, sending `world=<id>`: an account token reads it as
|
|
3362
3382
|
* that account's own access there (the owner the whole world, a member its member key's view,
|
|
3363
|
-
* anyone else the public view), and no key reads it as the public does.
|
|
3364
|
-
*
|
|
3365
|
-
*
|
|
3366
|
-
*
|
|
3383
|
+
* anyone else the public view), and no key reads it as the public does. An account token also
|
|
3384
|
+
* sets its own lenses there with `setMyLenses` (`world=<id>`), the one write it names. On such a
|
|
3385
|
+
* client every other world call is a TypeError before sending; the account calls and
|
|
3386
|
+
* `worldLenses` (the world in its path) work as without it. Given with a world key, or as
|
|
3387
|
+
* anything but a non-empty string, it is a TypeError when the client is constructed.
|
|
3367
3388
|
*/
|
|
3368
3389
|
world?: string;
|
|
3369
3390
|
}
|
|
@@ -3772,6 +3793,11 @@ interface OwSignInResult {
|
|
|
3772
3793
|
* sending the token itself as the bearer. Null from a server that does not send it yet.
|
|
3773
3794
|
*/
|
|
3774
3795
|
tokenId: string | null;
|
|
3796
|
+
/**
|
|
3797
|
+
* When the token stops working (ISO 8601), for a tool whose registration asks for a lifetime; null
|
|
3798
|
+
* for one with none, whose token works until it is revoked, and from a server that does not send it.
|
|
3799
|
+
*/
|
|
3800
|
+
expiresAt: string | null;
|
|
3775
3801
|
tokenType: 'bearer';
|
|
3776
3802
|
account: {
|
|
3777
3803
|
id: string;
|
|
@@ -3857,7 +3883,9 @@ declare class OwV2Client {
|
|
|
3857
3883
|
* on the owner's keys the owner's own; answers GET /me's body. The draught reads the list whenever it
|
|
3858
3884
|
* is given no lens and no policy. 404 for a lens this key cannot see; 422 `not_a_lens`,
|
|
3859
3885
|
* `lens_is_template` or `lens_hidden` (`param` lenses); 403 for a read key. A lens only narrows what
|
|
3860
|
-
* the holder may already read.
|
|
3886
|
+
* the holder may already read. An account token sets your own list in the world the client's
|
|
3887
|
+
* `world` names (`world=<id>`, the Bearer token, no PIN); without `world` set it is a TypeError
|
|
3888
|
+
* before sending. A world key sends no `world`: the key names its world.
|
|
3861
3889
|
*/
|
|
3862
3890
|
setMyLenses(lensIds: string[]): Promise<OwMe>;
|
|
3863
3891
|
/**
|
|
@@ -3868,7 +3896,8 @@ declare class OwV2Client {
|
|
|
3868
3896
|
* of what a reader cannot see; with `resolve`, the owner may `readAs` another reader (`guest`,
|
|
3869
3897
|
* `contributor`, `co-builder`, `public`, or a membership id of this world): 403
|
|
3870
3898
|
* `read_as_owner_only` from any other key, 422 without `resolve`. `worldId` is the key's own world
|
|
3871
|
-
* (another is a 404).
|
|
3899
|
+
* (another is a 404). An account token reads the world `worldId` names, as its owner or as its
|
|
3900
|
+
* member there: the Bearer token alone, no `world=` (the client's `world` is not needed). Served
|
|
3872
3901
|
* `Cache-Control: private, no-store`.
|
|
3873
3902
|
*/
|
|
3874
3903
|
worldLenses(worldId: string, opts?: {
|
|
@@ -4401,6 +4430,22 @@ declare class OwV2Client {
|
|
|
4401
4430
|
* goes with it, any other stays. Needs the client's `ow_a_` token.
|
|
4402
4431
|
*/
|
|
4403
4432
|
removeSeat(worldId: string, seatId: string): Promise<void>;
|
|
4433
|
+
/**
|
|
4434
|
+
* PATCH /account/worlds/{worldId}/members/{memberId} with `lenses` alone -- set the lenses a row
|
|
4435
|
+
* starts with: lens ids in order, 0 to 20, repeats dropped by keel; an empty list is a choice too.
|
|
4436
|
+
* A member sets its own row (any role), an agent's or a player's seat it answers for (its sponsor),
|
|
4437
|
+
* or any seat as a co-builder; the owner sets any seat, and its own list with `'owner'` as
|
|
4438
|
+
* `memberId`. Any other row is a 404; the owner naming a person's row is a 422 (a person sets its
|
|
4439
|
+
* own, with setMyLenses). Each id must be a lens of this world that you and the row's holder can
|
|
4440
|
+
* both see: one either cannot see is the same 404, a Construct that is no lens 422 `not_a_lens`, a
|
|
4441
|
+
* template 422 `lens_is_template`, a hidden lens 422 `lens_hidden` (`param` lenses); a lens already
|
|
4442
|
+
* in the row's list is kept, hidden or not. A lens in the list that you cannot see stays at its
|
|
4443
|
+
* place, outside the 20, and the answer's `lenses` is the list as you are shown it, with
|
|
4444
|
+
* `x_served_trimmed` naming `lenses` when one was kept. The answer is `{id, role, kind, lenses}`
|
|
4445
|
+
* (keel's `MemberLenses`), `id` null and `role` and `kind` `owner` for the owner's own list. The body is `{ lenses }` and
|
|
4446
|
+
* nothing else: a role, Character or sponsor change is not sent here. Needs the client's `ow_a_` token.
|
|
4447
|
+
*/
|
|
4448
|
+
setMemberLenses(worldId: string, memberId: string, lensIds: string[]): Promise<OwMemberLenses>;
|
|
4404
4449
|
/**
|
|
4405
4450
|
* PUT /{type}/{id}/hidden -- hide an element. The owner's key or a co-builder's
|
|
4406
4451
|
* (a person's or a seat's) with its PIN; hiding a hidden element again changes nothing, and
|
|
@@ -4644,6 +4689,14 @@ declare class OwV2Client {
|
|
|
4644
4689
|
* that needs a credential, is a TypeError before sending.
|
|
4645
4690
|
*/
|
|
4646
4691
|
worldRead?: boolean;
|
|
4692
|
+
/**
|
|
4693
|
+
* A route keel's document declares the account token on beside the world key (worldLenses,
|
|
4694
|
+
* setMyLenses): an account client sends it with its Bearer token. `'path'`: the path names the
|
|
4695
|
+
* world, and nothing is added. `'world'`: the world is named with `world=<id>`, added from the
|
|
4696
|
+
* client's `world`, and an account client without `world` set is a TypeError before sending.
|
|
4697
|
+
* A world key sends as without it; a keyless client is still refused.
|
|
4698
|
+
*/
|
|
4699
|
+
accountToken?: 'path' | 'world';
|
|
4647
4700
|
}): Promise<T>;
|
|
4648
4701
|
}
|
|
4649
4702
|
/**
|
|
@@ -6303,4 +6356,4 @@ declare class TokenResource {
|
|
|
6303
6356
|
getEncryptionInfo(): Promise<EncryptionInfo>;
|
|
6304
6357
|
}
|
|
6305
6358
|
|
|
6306
|
-
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 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, 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 };
|
|
6359
|
+
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, 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
|
@@ -609,6 +609,7 @@ async function completeSignIn(baseUrl, fetchImpl, opts) {
|
|
|
609
609
|
return {
|
|
610
610
|
token: ok.token,
|
|
611
611
|
tokenId: typeof ok.token_id === "string" && ok.token_id !== "" ? ok.token_id : null,
|
|
612
|
+
expiresAt: typeof ok.expires_at === "string" && ok.expires_at !== "" ? ok.expires_at : null,
|
|
612
613
|
tokenType: "bearer",
|
|
613
614
|
account: { id: ok.account.id, username: typeof ok.account.username === "string" ? ok.account.username : "" },
|
|
614
615
|
resume: record.resume ?? null
|
|
@@ -695,16 +696,15 @@ var OwV2Client = class {
|
|
|
695
696
|
* on the owner's keys the owner's own; answers GET /me's body. The draught reads the list whenever it
|
|
696
697
|
* is given no lens and no policy. 404 for a lens this key cannot see; 422 `not_a_lens`,
|
|
697
698
|
* `lens_is_template` or `lens_hidden` (`param` lenses); 403 for a read key. A lens only narrows what
|
|
698
|
-
* the holder may already read.
|
|
699
|
+
* the holder may already read. An account token sets your own list in the world the client's
|
|
700
|
+
* `world` names (`world=<id>`, the Bearer token, no PIN); without `world` set it is a TypeError
|
|
701
|
+
* before sending. A world key sends no `world`: the key names its world.
|
|
699
702
|
*/
|
|
700
703
|
async setMyLenses(lensIds) {
|
|
701
|
-
if (this.keyKind === "account") {
|
|
702
|
-
throw new TypeError("setMyLenses needs a world key: an account token is not a member of one world");
|
|
703
|
-
}
|
|
704
704
|
if (!Array.isArray(lensIds)) {
|
|
705
705
|
throw new TypeError("setMyLenses: lensIds is a list of lens ids ([] for none). Nothing was sent.");
|
|
706
706
|
}
|
|
707
|
-
return this.request("PUT", "/me/lenses", { body: { lenses: lensIds } });
|
|
707
|
+
return this.request("PUT", "/me/lenses", { accountToken: "world", body: { lenses: lensIds } });
|
|
708
708
|
}
|
|
709
709
|
/**
|
|
710
710
|
* GET /world/{worldId}/lenses -- every lens in the world this key can see, templates included and
|
|
@@ -714,19 +714,17 @@ var OwV2Client = class {
|
|
|
714
714
|
* of what a reader cannot see; with `resolve`, the owner may `readAs` another reader (`guest`,
|
|
715
715
|
* `contributor`, `co-builder`, `public`, or a membership id of this world): 403
|
|
716
716
|
* `read_as_owner_only` from any other key, 422 without `resolve`. `worldId` is the key's own world
|
|
717
|
-
* (another is a 404).
|
|
717
|
+
* (another is a 404). An account token reads the world `worldId` names, as its owner or as its
|
|
718
|
+
* member there: the Bearer token alone, no `world=` (the client's `world` is not needed). Served
|
|
718
719
|
* `Cache-Control: private, no-store`.
|
|
719
720
|
*/
|
|
720
721
|
async worldLenses(worldId, opts = {}) {
|
|
721
722
|
only("worldLenses", opts, ["resolve", "readAs"]);
|
|
722
|
-
if (this.keyKind === "account") {
|
|
723
|
-
throw new TypeError("worldLenses needs a world key: an account token is not a member of one world");
|
|
724
|
-
}
|
|
725
723
|
if (opts.resolve !== void 0 && typeof opts.resolve !== "boolean") {
|
|
726
724
|
throw new TypeError("worldLenses: resolve is true or false. Nothing was sent.");
|
|
727
725
|
}
|
|
728
726
|
const query = buildQuery({ resolve: opts.resolve, read_as: opts.readAs });
|
|
729
|
-
return this.request("GET", `/world/${encodeURIComponent(worldId)}/lenses`, { query });
|
|
727
|
+
return this.request("GET", `/world/${encodeURIComponent(worldId)}/lenses`, { query, accountToken: "path" });
|
|
730
728
|
}
|
|
731
729
|
async me() {
|
|
732
730
|
if (this.keyKind === "account") {
|
|
@@ -1583,6 +1581,34 @@ var OwV2Client = class {
|
|
|
1583
1581
|
}
|
|
1584
1582
|
await this.request("DELETE", `/account/worlds/${encodeURIComponent(worldId)}/seats/${encodeURIComponent(seatId)}`);
|
|
1585
1583
|
}
|
|
1584
|
+
/**
|
|
1585
|
+
* PATCH /account/worlds/{worldId}/members/{memberId} with `lenses` alone -- set the lenses a row
|
|
1586
|
+
* starts with: lens ids in order, 0 to 20, repeats dropped by keel; an empty list is a choice too.
|
|
1587
|
+
* A member sets its own row (any role), an agent's or a player's seat it answers for (its sponsor),
|
|
1588
|
+
* or any seat as a co-builder; the owner sets any seat, and its own list with `'owner'` as
|
|
1589
|
+
* `memberId`. Any other row is a 404; the owner naming a person's row is a 422 (a person sets its
|
|
1590
|
+
* own, with setMyLenses). Each id must be a lens of this world that you and the row's holder can
|
|
1591
|
+
* both see: one either cannot see is the same 404, a Construct that is no lens 422 `not_a_lens`, a
|
|
1592
|
+
* template 422 `lens_is_template`, a hidden lens 422 `lens_hidden` (`param` lenses); a lens already
|
|
1593
|
+
* in the row's list is kept, hidden or not. A lens in the list that you cannot see stays at its
|
|
1594
|
+
* place, outside the 20, and the answer's `lenses` is the list as you are shown it, with
|
|
1595
|
+
* `x_served_trimmed` naming `lenses` when one was kept. The answer is `{id, role, kind, lenses}`
|
|
1596
|
+
* (keel's `MemberLenses`), `id` null and `role` and `kind` `owner` for the owner's own list. The body is `{ lenses }` and
|
|
1597
|
+
* nothing else: a role, Character or sponsor change is not sent here. Needs the client's `ow_a_` token.
|
|
1598
|
+
*/
|
|
1599
|
+
async setMemberLenses(worldId, memberId, lensIds) {
|
|
1600
|
+
if (this.keyKind !== "account") {
|
|
1601
|
+
throw new TypeError("setMemberLenses needs an account token (ow_a_): a world key sets its own holder's list with setMyLenses");
|
|
1602
|
+
}
|
|
1603
|
+
if (!Array.isArray(lensIds)) {
|
|
1604
|
+
throw new TypeError("setMemberLenses: lensIds is a list of lens ids ([] for none). Nothing was sent.");
|
|
1605
|
+
}
|
|
1606
|
+
return this.request(
|
|
1607
|
+
"PATCH",
|
|
1608
|
+
`/account/worlds/${encodeURIComponent(worldId)}/members/${encodeURIComponent(memberId)}`,
|
|
1609
|
+
{ body: { lenses: lensIds } }
|
|
1610
|
+
);
|
|
1611
|
+
}
|
|
1586
1612
|
// -- The hidden mark ------------------------------------------
|
|
1587
1613
|
/**
|
|
1588
1614
|
* PUT /{type}/{id}/hidden -- hide an element. The owner's key or a co-builder's
|
|
@@ -1920,20 +1946,27 @@ var OwV2Client = class {
|
|
|
1920
1946
|
if (opts.ifMatch !== void 0 && !(Number.isInteger(opts.ifMatch) && opts.ifMatch >= 0)) {
|
|
1921
1947
|
throw new TypeError(`ifMatch must be a whole number (an element's change_seq), got ${String(opts.ifMatch)}`);
|
|
1922
1948
|
}
|
|
1949
|
+
if (opts.accountToken !== void 0 && opts.accountToken !== "path" && opts.accountToken !== "world") {
|
|
1950
|
+
throw new TypeError(`accountToken is 'path' or 'world', got ${JSON.stringify(opts.accountToken) ?? String(opts.accountToken)}. Nothing was sent.`);
|
|
1951
|
+
}
|
|
1923
1952
|
const worldRead = opts.auth !== false && opts.worldRead === true && method.toUpperCase() === "GET";
|
|
1953
|
+
const accountToken = opts.auth !== false && this.keyKind === "account" ? opts.accountToken : void 0;
|
|
1924
1954
|
if (opts.auth !== false && this.keyKind === "none" && !(worldRead && this.world !== void 0)) {
|
|
1925
1955
|
throw new TypeError(`${method} ${path} needs a key, and this client holds none: without one, only health, previewJoin, redeemJoin and signInWithPassword work, and list, listAll, get and getWorld with \`world\` set`);
|
|
1926
1956
|
}
|
|
1927
1957
|
if (opts.auth !== false && this.keyKind === "account" && !ACCOUNT_ROUTE.test(path)) {
|
|
1928
|
-
if (!worldRead) {
|
|
1929
|
-
throw new TypeError(`${method} ${path} needs a world key: an account token sends the /account routes, and with \`world\` set reads a world through list, listAll, get and getWorld only. Nothing was sent.`);
|
|
1958
|
+
if (!worldRead && accountToken === void 0) {
|
|
1959
|
+
throw new TypeError(`${method} ${path} needs a world key: an account token sends the /account routes, worldLenses and setMyLenses, and with \`world\` set reads a world through list, listAll, get and getWorld only. Nothing was sent.`);
|
|
1930
1960
|
}
|
|
1931
|
-
if (this.world === void 0) {
|
|
1961
|
+
if (worldRead && this.world === void 0) {
|
|
1932
1962
|
throw new TypeError(`${method} ${path}: an account token reads a world only with \`world\` set (new OwV2Client({ apiKey, world })), through list, listAll, get and getWorld. Nothing was sent.`);
|
|
1933
1963
|
}
|
|
1964
|
+
if (accountToken === "world" && this.world === void 0) {
|
|
1965
|
+
throw new TypeError(`${method} ${path}: an account token names the world it sends to with \`world\`: set it (new OwV2Client({ apiKey, world })). Nothing was sent.`);
|
|
1966
|
+
}
|
|
1934
1967
|
}
|
|
1935
1968
|
let query = opts.query ?? "";
|
|
1936
|
-
if (worldRead && this.world !== void 0) {
|
|
1969
|
+
if ((worldRead || accountToken === "world") && this.world !== void 0) {
|
|
1937
1970
|
const world = `world=${encodeURIComponent(this.world)}`;
|
|
1938
1971
|
query = query ? `${query}&${world}` : world;
|
|
1939
1972
|
}
|
|
@@ -2166,7 +2199,8 @@ var REQUEST_OPTION_KEYS = [
|
|
|
2166
2199
|
"onEtag",
|
|
2167
2200
|
"signal",
|
|
2168
2201
|
"keepalive",
|
|
2169
|
-
"worldRead"
|
|
2202
|
+
"worldRead",
|
|
2203
|
+
"accountToken"
|
|
2170
2204
|
];
|
|
2171
2205
|
var ACCOUNT_ROUTE = /^\/account(?:[/?]|$)/;
|
|
2172
2206
|
function only(method, obj, keys, hint = "") {
|