@onlyworlds/sdk 4.49.0 → 4.51.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 +14 -0
- package/dist/index.d.ts +18 -2
- package/dist/index.js +29 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.51.0] - 2026-10-22
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **`list()` and `listAll()` refuse an unknown top-level key** with a TypeError before anything is sent, naming the key and where a wire filter goes (`filter: { name__icontains: ... }`). Until now an unknown key was dropped without a word, so a plain-JavaScript caller who wrote `list('character', { name__icontains: 'probe' })` got every Character, unfiltered, and TypeScript's compile-time check was the only fence. A cleanup script written that way deleted 99 Characters on a test world on 2026-10-22; this is the SDK's half of the lesson. A caller who passed a stray key by accident now hears about it; the known keys are `limit`, `cursor`, `ids`, `createdBy`, `expand`, `fields`, `filter`, `viewAs`.
|
|
13
|
+
|
|
14
|
+
## [4.50.0] - 2026-10-22
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- `setMyCharacter(characterId | null)`: `PUT /me/character`, a person member's pick of the roster Character that is them in this world (keel PR 160, #533); answers the `/me` body. `err.isCharacterHidden` for the 422 `character_hidden` it and the member PATCH answer.
|
|
19
|
+
- `hidden?: true` on every element body (`OwElementBase`): present only when the owner or a co-builder hid the element and this reader still sees it (keel #537); never on other readers' bodies, ignored in a write.
|
|
20
|
+
- `site` joins `OwWriteDoor`: a write or delete the owner made signed in on onlyworlds.com (keel #530).
|
|
21
|
+
|
|
8
22
|
## [4.49.0] - 2026-10-22
|
|
9
23
|
|
|
10
24
|
### Changed
|
package/dist/index.d.ts
CHANGED
|
@@ -29,8 +29,10 @@ interface OwElementBase {
|
|
|
29
29
|
created_by?: string | null;
|
|
30
30
|
/** The membership whose write last changed this element (server-managed, read-only); null for the world's owner and for anything last changed before writes recorded it. */
|
|
31
31
|
changed_by?: string | null;
|
|
32
|
-
/** The door of the last write (server-managed, read-only): `seat` (an agent seat), `mcp`, `declared` (a client that sent X-OW-Agent), then `api`, `v1`, `sync`,
|
|
33
|
-
changed_via?: 'seat' | 'mcp' | 'declared' | 'api' | 'v1' | 'sync' | 'server' | null;
|
|
32
|
+
/** The door of the last write (server-managed, read-only): `seat` (an agent seat), `mcp`, `declared` (a client that sent X-OW-Agent), then `api`, `v1`, `sync`, `server` (keel's own writes) or `site` (the owner signed in on onlyworlds.com; keel PR 160). The first three are agent-made. Null for anything last changed before writes recorded it. */
|
|
33
|
+
changed_via?: 'seat' | 'mcp' | 'declared' | 'api' | 'v1' | 'sync' | 'server' | 'site' | null;
|
|
34
|
+
/** Present, and true, only when the world's owner or a co-builder hid this element and this reader still sees it (server-managed, read-only): the owner, a co-builder, a key the owner minted, or the member who made it; to every other reader the element does not exist. Absent otherwise, whatever `fields` asked; on the read, the list, the change feed's upserts and MCP, never in the download, world sync or v1. Sent in a write it is ignored. */
|
|
35
|
+
hidden?: true;
|
|
34
36
|
/** Present, and true, only on a stub (server-managed, read-only): an element a guest or player reaches only through its own Character's sheet. A stub keeps id, type, name, description, supertype, subtype, image_url, created_at, updated_at and change_seq, and the fields its type lists in PUBLIC_FIELDS with their values; every other field reads unset ("", null, []), created_by/changed_by/changed_via null, no extension fields, and its files are 404. Its empties are not values and not a deletion: never write a stub back. Absent: the element is whole. See isKnownOf(). */
|
|
35
37
|
known_of?: true;
|
|
36
38
|
/** Namespaced extension fields (atlas_* / shadow_* / x_*), returned verbatim. */
|
|
@@ -2920,6 +2922,11 @@ declare class OwApiError extends Error {
|
|
|
2920
2922
|
* previewJoin, whose `characters` mark each `taken`. The code is not spent.
|
|
2921
2923
|
*/
|
|
2922
2924
|
get isCharacterTaken(): boolean;
|
|
2925
|
+
/**
|
|
2926
|
+
* setMyCharacter, or the member PATCH's `character` (keel #421, PR 160): the picked Character is
|
|
2927
|
+
* hidden (422 `character_hidden`, `param` character). Unhide it first, or pick another.
|
|
2928
|
+
*/
|
|
2929
|
+
get isCharacterHidden(): boolean;
|
|
2923
2930
|
/**
|
|
2924
2931
|
* The `character` sent was refused (422 `invalid_request`, `param` character). On redeemJoin
|
|
2925
2932
|
* at a table (keel #422 PR 2): the pick is off the link's list, hidden or deleted since the
|
|
@@ -3148,6 +3155,15 @@ declare class OwV2Client {
|
|
|
3148
3155
|
* creates; null for the owner) and the member's Character. A world key's call; an account
|
|
3149
3156
|
* token is a TypeError before sending.
|
|
3150
3157
|
*/
|
|
3158
|
+
/**
|
|
3159
|
+
* PUT /me/character -- pick the roster Character that is you in this world, or none (keel PR 160,
|
|
3160
|
+
* #533). A person member's write key with its PIN; answers GET /me's body. 422 for a hidden
|
|
3161
|
+
* Character (`character_hidden`, `err.isCharacterHidden`), a guest's pick it did not make, or a
|
|
3162
|
+
* taken Character (`invalid_request`, `param` character); 404 for one this key cannot see; 403 for
|
|
3163
|
+
* an agent seat, a player, the owner (whose own is the world's `owner_character`, set with
|
|
3164
|
+
* patchWorld) or a read key. A guest's view resets once.
|
|
3165
|
+
*/
|
|
3166
|
+
setMyCharacter(character: string | null): Promise<OwMe>;
|
|
3151
3167
|
me(): Promise<OwMe>;
|
|
3152
3168
|
/**
|
|
3153
3169
|
* GET /members -- the world's roster: each member's id (null for the owner), kind, role,
|
package/dist/index.js
CHANGED
|
@@ -191,6 +191,13 @@ var OwApiError = class extends Error {
|
|
|
191
191
|
get isCharacterTaken() {
|
|
192
192
|
return this.status === 422 && this.code === "character_taken";
|
|
193
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* setMyCharacter, or the member PATCH's `character` (keel #421, PR 160): the picked Character is
|
|
196
|
+
* hidden (422 `character_hidden`, `param` character). Unhide it first, or pick another.
|
|
197
|
+
*/
|
|
198
|
+
get isCharacterHidden() {
|
|
199
|
+
return this.status === 422 && this.code === "character_hidden";
|
|
200
|
+
}
|
|
194
201
|
/**
|
|
195
202
|
* The `character` sent was refused (422 `invalid_request`, `param` character). On redeemJoin
|
|
196
203
|
* at a table (keel #422 PR 2): the pick is off the link's list, hidden or deleted since the
|
|
@@ -533,6 +540,20 @@ var OwV2Client = class {
|
|
|
533
540
|
* creates; null for the owner) and the member's Character. A world key's call; an account
|
|
534
541
|
* token is a TypeError before sending.
|
|
535
542
|
*/
|
|
543
|
+
/**
|
|
544
|
+
* PUT /me/character -- pick the roster Character that is you in this world, or none (keel PR 160,
|
|
545
|
+
* #533). A person member's write key with its PIN; answers GET /me's body. 422 for a hidden
|
|
546
|
+
* Character (`character_hidden`, `err.isCharacterHidden`), a guest's pick it did not make, or a
|
|
547
|
+
* taken Character (`invalid_request`, `param` character); 404 for one this key cannot see; 403 for
|
|
548
|
+
* an agent seat, a player, the owner (whose own is the world's `owner_character`, set with
|
|
549
|
+
* patchWorld) or a read key. A guest's view resets once.
|
|
550
|
+
*/
|
|
551
|
+
async setMyCharacter(character) {
|
|
552
|
+
if (this.keyKind === "account") {
|
|
553
|
+
throw new TypeError("setMyCharacter needs a world key: an account token is not a member of one world");
|
|
554
|
+
}
|
|
555
|
+
return this.request("PUT", "/me/character", { write: true, body: { character } });
|
|
556
|
+
}
|
|
536
557
|
async me() {
|
|
537
558
|
if (this.keyKind === "account") {
|
|
538
559
|
throw new TypeError("me needs a world key: an account token is not a member of one world");
|
|
@@ -554,6 +575,13 @@ var OwV2Client = class {
|
|
|
554
575
|
// -- Element CRUD --------------------------------------------------------
|
|
555
576
|
/** GET /{type}/ -- one cursor page. */
|
|
556
577
|
async list(type, params = {}) {
|
|
578
|
+
for (const k of Object.keys(params)) {
|
|
579
|
+
if (!LIST_PARAM_KEYS.has(k)) {
|
|
580
|
+
throw new TypeError(
|
|
581
|
+
`list: unknown parameter '${k}'. A wire filter (name, name__icontains, supertype, subtype, characters) goes under filter: { ${k}: ... }; the other keys are ${[...LIST_PARAM_KEYS].join(", ")}. Nothing was sent: an unknown key was once dropped, and the list came back whole.`
|
|
582
|
+
);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
557
585
|
const query = buildQuery({
|
|
558
586
|
limit: params.limit ?? this.pageSize,
|
|
559
587
|
cursor: params.cursor,
|
|
@@ -1617,6 +1645,7 @@ function objectKey(keyOrUrl) {
|
|
|
1617
1645
|
if (!/^https?:\/\//i.test(keyOrUrl)) return keyOrUrl;
|
|
1618
1646
|
return decodeURIComponent(new URL(keyOrUrl).pathname.replace(/^\/+/, ""));
|
|
1619
1647
|
}
|
|
1648
|
+
var LIST_PARAM_KEYS = /* @__PURE__ */ new Set(["limit", "cursor", "ids", "createdBy", "expand", "fields", "filter", "viewAs"]);
|
|
1620
1649
|
function buildQuery(params) {
|
|
1621
1650
|
const q = new URLSearchParams();
|
|
1622
1651
|
for (const [k, v] of Object.entries(params)) {
|