@onlyworlds/sdk 4.121.1 → 4.122.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/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.122.0] - 2026-10-31
9
+
10
+ ### Added
11
+
12
+ - **`listAccountTokens()` and `revokeAccountToken(tokenId, opts?)`**: the account's tokens (`GET /account/tokens`, each by name and last four, with `last_used_at`, `revoked`, `expires_at`, `keys_minted` and `audience`; typed `OwAccountToken`), and a revoke by id (`DELETE /account/tokens/{tokenId}`), this client's own token included, so a tool done with a sign-in can end it by the `tokenId` the sign-in answered. An id that is not one of the account's tokens is a 404 (`err.isNotFound`); `signal` and `keepalive` go to fetch as `revokeWorldKey`'s do. Account token only; a world key is a `TypeError` before sending.
13
+
8
14
  ## [4.121.1] - 2026-10-31
9
15
 
10
16
  ### Fixed
package/dist/index.d.ts CHANGED
@@ -3558,6 +3558,27 @@ interface OwMintedKey {
3558
3558
  /** True when minted with `keep: true`: no revoke of the token that minted it takes it (a sign-out keeps it). */
3559
3559
  kept?: boolean;
3560
3560
  }
3561
+ /** An account token as GET /account/tokens lists it: by name and last four, never the token itself. */
3562
+ interface OwAccountToken {
3563
+ /** The token's id: revokeAccountToken takes it, and a sign-in answers it as `tokenId`. */
3564
+ id: string;
3565
+ /** The label given at mint (a device, a tool). */
3566
+ name: string;
3567
+ /** The token's last four characters, to tell tokens apart. */
3568
+ last4: string;
3569
+ last_used_at: string | null;
3570
+ revoked: boolean;
3571
+ /** When the token stops working, for a sign-in tool's token with a lifetime; null never expires. Past it the token is refused as a revoked one. */
3572
+ expires_at: string | null;
3573
+ /** How many live world keys this token minted. */
3574
+ keys_minted: number;
3575
+ /** Who the token is for: empty for a token made by hand or a sign-in tool's; `mcp` for a hosted client's grant on the MCP server. */
3576
+ audience: string;
3577
+ /** On an `mcp` token only: the client's name, as it registered itself, or its id when it is no longer registered. */
3578
+ client?: string;
3579
+ /** On an `mcp` token only: the host the client returns the person to. */
3580
+ return_host?: string;
3581
+ }
3561
3582
  interface OwSeat {
3562
3583
  /** The seat's membership id: removeSeat takes it, and GET /members names the seat by it. */
3563
3584
  id: string;
@@ -5093,6 +5114,26 @@ declare class OwV2Client {
5093
5114
  signal?: AbortSignal;
5094
5115
  keepalive?: boolean;
5095
5116
  }): Promise<void>;
5117
+ /**
5118
+ * GET /account/tokens -- the account's tokens, each by name and last four, never the token
5119
+ * itself: when it was last used, whether it is revoked, when it expires, how many live world
5120
+ * keys it minted, and who it is for (`audience`). Account token only.
5121
+ */
5122
+ listAccountTokens(): Promise<OwAccountToken[]>;
5123
+ /**
5124
+ * DELETE /account/tokens/{tokenId} -- revoke one of the account's tokens, this client's own
5125
+ * included (a tool done with a sign-in revokes it by the `tokenId` the sign-in answered); every
5126
+ * other token stays live. A token a tool got through Sign in with OnlyWorlds takes the world keys
5127
+ * it minted with it, unless the person holds another live token of the same tool, which then
5128
+ * takes them; a token made by hand or by a password sign-in revokes itself only. An id that is
5129
+ * not one of the account's tokens is a 404 (`err.isNotFound`). Once a client revokes its own
5130
+ * token, its next call is refused as a revoked token's. `signal` and `keepalive` go to fetch
5131
+ * as given, as revokeWorldKey's do. Account token only.
5132
+ */
5133
+ revokeAccountToken(tokenId: string, opts?: {
5134
+ signal?: AbortSignal;
5135
+ keepalive?: boolean;
5136
+ }): Promise<void>;
5096
5137
  /**
5097
5138
  * Start Sign in with OnlyWorlds from a tool's page: mint `state` and a PKCE verifier, keep them
5098
5139
  * under `clientId` in `storage` (sessionStorage by default; in Node pass one), and send the
@@ -6892,4 +6933,4 @@ declare class TokenResource {
6892
6933
  getEncryptionInfo(): Promise<EncryptionInfo>;
6893
6934
  }
6894
6935
 
6895
- export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, CHARTER_PAIRS, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, DATE_FIELD, ELEMENT_FAMILIES, ELEMENT_GROUPS, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementGroup, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GROUP_COLORS, GROUP_ORDER, 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 OwCharterWorld, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDoor, type OwDragField, 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 OwOpener, type OwOpenerKind, type OwOpenerState, type OwOpenerSurface, 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 OwReadingAids, type OwReadingAidsCharter, type OwReadingAidsDomain, type OwReadingAidsGuide, type OwReadingAidsHub, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwServedReadingAids, 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 OwStrand, type OwStrandSlot, type OwStrandWorld, type OwTool, type OwToolNeeds, type OwToolOpen, 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, STRAND_FIELD, type SectionInfo, type StepBreakdown, TOOLS, 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, charterOf, dateOf, degreeOf, detectKeyKind, displayYear, domainsOf, doorWhere, doorsOf, dragField, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, groupOf, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isCharterElement, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, lensesInUse, lookupWorld, monthStartSteps, nfc, noteOf, openersFor, outDegreeOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, readingAidOf, recipientsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, senderStatus, simpleCaseFold, strandOf, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
6936
+ export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, CHARTER_PAIRS, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, DATE_FIELD, ELEMENT_FAMILIES, ELEMENT_GROUPS, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementGroup, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GROUP_COLORS, GROUP_ORDER, GameTier, type ListParams, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountToken, 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 OwCharterWorld, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDoor, type OwDragField, 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 OwOpener, type OwOpenerKind, type OwOpenerState, type OwOpenerSurface, 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 OwReadingAids, type OwReadingAidsCharter, type OwReadingAidsDomain, type OwReadingAidsGuide, type OwReadingAidsHub, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwServedReadingAids, 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 OwStrand, type OwStrandSlot, type OwStrandWorld, type OwTool, type OwToolNeeds, type OwToolOpen, 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, STRAND_FIELD, type SectionInfo, type StepBreakdown, TOOLS, 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, charterOf, dateOf, degreeOf, detectKeyKind, displayYear, domainsOf, doorWhere, doorsOf, dragField, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, groupOf, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isCharterElement, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, lensesInUse, lookupWorld, monthStartSteps, nfc, noteOf, openersFor, outDegreeOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, readingAidOf, recipientsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, senderStatus, simpleCaseFold, strandOf, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
package/dist/index.js CHANGED
@@ -1952,6 +1952,41 @@ var OwV2Client = class {
1952
1952
  if (opts.keepalive !== void 0) send.keepalive = opts.keepalive;
1953
1953
  await this.request("DELETE", `/account/worlds/${encodeURIComponent(worldId)}/keys/${encodeURIComponent(keyId)}`, send);
1954
1954
  }
1955
+ /**
1956
+ * GET /account/tokens -- the account's tokens, each by name and last four, never the token
1957
+ * itself: when it was last used, whether it is revoked, when it expires, how many live world
1958
+ * keys it minted, and who it is for (`audience`). Account token only.
1959
+ */
1960
+ async listAccountTokens() {
1961
+ if (this.keyKind !== "account") {
1962
+ throw new TypeError("listAccountTokens needs an account token (ow_a_)");
1963
+ }
1964
+ const page = await this.request("GET", "/account/tokens");
1965
+ return page.data;
1966
+ }
1967
+ /**
1968
+ * DELETE /account/tokens/{tokenId} -- revoke one of the account's tokens, this client's own
1969
+ * included (a tool done with a sign-in revokes it by the `tokenId` the sign-in answered); every
1970
+ * other token stays live. A token a tool got through Sign in with OnlyWorlds takes the world keys
1971
+ * it minted with it, unless the person holds another live token of the same tool, which then
1972
+ * takes them; a token made by hand or by a password sign-in revokes itself only. An id that is
1973
+ * not one of the account's tokens is a 404 (`err.isNotFound`). Once a client revokes its own
1974
+ * token, its next call is refused as a revoked token's. `signal` and `keepalive` go to fetch
1975
+ * as given, as revokeWorldKey's do. Account token only.
1976
+ */
1977
+ async revokeAccountToken(tokenId, opts = {}) {
1978
+ only("revokeAccountToken", opts, ["signal", "keepalive"]);
1979
+ if (this.keyKind !== "account") {
1980
+ throw new TypeError("revokeAccountToken needs an account token (ow_a_)");
1981
+ }
1982
+ if (typeof tokenId !== "string" || tokenId === "") {
1983
+ throw new TypeError(`revokeAccountToken: tokenId is a token's id, a non-empty string; got ${JSON.stringify(tokenId) ?? String(tokenId)}. Nothing was sent.`);
1984
+ }
1985
+ const send = {};
1986
+ if (opts.signal !== void 0) send.signal = opts.signal;
1987
+ if (opts.keepalive !== void 0) send.keepalive = opts.keepalive;
1988
+ await this.request("DELETE", `/account/tokens/${encodeURIComponent(tokenId)}`, send);
1989
+ }
1955
1990
  // -- Sign in with OnlyWorlds (OAuth 2.1 code + PKCE) ----------------------
1956
1991
  /**
1957
1992
  * Start Sign in with OnlyWorlds from a tool's page: mint `state` and a PKCE verifier, keep them
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.121.1",
3
+ "version": "4.122.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {