@onlyworlds/sdk 4.50.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 +6 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +11 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ 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
|
+
|
|
8
14
|
## [4.50.0] - 2026-10-22
|
|
9
15
|
|
|
10
16
|
### Added
|
package/dist/index.d.ts
CHANGED
|
@@ -3159,8 +3159,9 @@ declare class OwV2Client {
|
|
|
3159
3159
|
* PUT /me/character -- pick the roster Character that is you in this world, or none (keel PR 160,
|
|
3160
3160
|
* #533). A person member's write key with its PIN; answers GET /me's body. 422 for a hidden
|
|
3161
3161
|
* Character (`character_hidden`, `err.isCharacterHidden`), a guest's pick it did not make, or a
|
|
3162
|
-
* taken Character (`
|
|
3163
|
-
* player, the owner (
|
|
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.
|
|
3164
3165
|
*/
|
|
3165
3166
|
setMyCharacter(character: string | null): Promise<OwMe>;
|
|
3166
3167
|
me(): Promise<OwMe>;
|
package/dist/index.js
CHANGED
|
@@ -544,8 +544,9 @@ var OwV2Client = class {
|
|
|
544
544
|
* PUT /me/character -- pick the roster Character that is you in this world, or none (keel PR 160,
|
|
545
545
|
* #533). A person member's write key with its PIN; answers GET /me's body. 422 for a hidden
|
|
546
546
|
* Character (`character_hidden`, `err.isCharacterHidden`), a guest's pick it did not make, or a
|
|
547
|
-
* taken Character (`
|
|
548
|
-
* player, the owner (
|
|
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.
|
|
549
550
|
*/
|
|
550
551
|
async setMyCharacter(character) {
|
|
551
552
|
if (this.keyKind === "account") {
|
|
@@ -574,6 +575,13 @@ var OwV2Client = class {
|
|
|
574
575
|
// -- Element CRUD --------------------------------------------------------
|
|
575
576
|
/** GET /{type}/ -- one cursor page. */
|
|
576
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
|
+
}
|
|
577
585
|
const query = buildQuery({
|
|
578
586
|
limit: params.limit ?? this.pageSize,
|
|
579
587
|
cursor: params.cursor,
|
|
@@ -1637,6 +1645,7 @@ function objectKey(keyOrUrl) {
|
|
|
1637
1645
|
if (!/^https?:\/\//i.test(keyOrUrl)) return keyOrUrl;
|
|
1638
1646
|
return decodeURIComponent(new URL(keyOrUrl).pathname.replace(/^\/+/, ""));
|
|
1639
1647
|
}
|
|
1648
|
+
var LIST_PARAM_KEYS = /* @__PURE__ */ new Set(["limit", "cursor", "ids", "createdBy", "expand", "fields", "filter", "viewAs"]);
|
|
1640
1649
|
function buildQuery(params) {
|
|
1641
1650
|
const q = new URLSearchParams();
|
|
1642
1651
|
for (const [k, v] of Object.entries(params)) {
|