@onlyworlds/sdk 4.121.0 → 4.121.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 CHANGED
@@ -5,6 +5,12 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.121.1] - 2026-10-31
9
+
10
+ ### Fixed
11
+
12
+ - **`draught` reads with `world` set, as `list`, `get` and `getWorld` do.** The API serves the draught to an account token that names the world (the account's own access there) and to a keyless reader of a world open to the public; the client refused both before sending. It now sends `world=<id>` with the Bearer, or with no credential.
13
+
8
14
  ## [4.121.0] - 2026-10-31
9
15
 
10
16
  ### Added
package/dist/index.d.ts CHANGED
@@ -3805,7 +3805,7 @@ interface OwClientConfig {
3805
3805
  /**
3806
3806
  * The key: an ow_w_ (write) or ow_r_ (read) world key, an ow_a_ account token (sent as a Bearer token, for the account routes, and with `world` set for that world's reads), or a 10-digit legacy key.
3807
3807
  * Leave it out for a client that holds none, such as a friend with only a link (since 4.30.0): it can call health,
3808
- * previewJoin, redeemJoin and signInWithPassword (and with `world` set, list, listAll, get and getWorld), and any
3808
+ * previewJoin, redeemJoin and signInWithPassword (and with `world` set, list, listAll, get, getWorld and draught), and any
3809
3809
  * other call is a TypeError before anything is sent.
3810
3810
  */
3811
3811
  apiKey?: string;
@@ -4435,7 +4435,8 @@ declare class OwV2Client {
4435
4435
  * and in no other section; a room-marked Message is in `messages` or nowhere. `lens` (a lens id)
4436
4436
  * adds `lenses`, one frame with that lens read for this key's own view (beside `depth` or `budget`
4437
4437
  * a 422); with no policy key but `compact`, the packet adds one frame per lens chosen with
4438
- * setMyLenses. Served `Cache-Control: private, no-store`.
4438
+ * setMyLenses. Served `Cache-Control: private, no-store`. On a client with `world` set, an account token
4439
+ * reads the draught as the account's own access there, and no key reads it as the public reads the world.
4439
4440
  */
4440
4441
  draught(characterId: string, policy?: OwDraughtPolicy & {
4441
4442
  compact?: false;
package/dist/index.js CHANGED
@@ -876,7 +876,7 @@ var OwV2Client = class {
876
876
  compact: policy.compact,
877
877
  lens: policy.lens
878
878
  });
879
- return this.request("GET", `/character/${characterId}/context`, { query });
879
+ return this.request("GET", `/character/${characterId}/context`, { query, worldRead: true });
880
880
  }
881
881
  /**
882
882
  * Cursor-walk every page of a type. Politeness: uses config pageSize. On a client with `world`
@@ -2055,14 +2055,14 @@ var OwV2Client = class {
2055
2055
  const worldRead = opts.auth !== false && opts.worldRead === true && method.toUpperCase() === "GET";
2056
2056
  const accountToken = opts.auth !== false && this.keyKind === "account" ? opts.accountToken : void 0;
2057
2057
  if (opts.auth !== false && this.keyKind === "none" && !(worldRead && this.world !== void 0)) {
2058
- 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`);
2058
+ 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, getWorld and draught with \`world\` set`);
2059
2059
  }
2060
2060
  if (opts.auth !== false && this.keyKind === "account" && !ACCOUNT_ROUTE.test(path)) {
2061
2061
  if (!worldRead && accountToken === void 0) {
2062
- throw new TypeError(`${method} ${path} needs a world key: an account token sends the /account routes, worldLenses, setMyLenses and members, and with \`world\` set reads a world through list, listAll, get and getWorld only. Nothing was sent.`);
2062
+ throw new TypeError(`${method} ${path} needs a world key: an account token sends the /account routes, worldLenses, setMyLenses and members, and with \`world\` set reads a world through list, listAll, get, getWorld and draught only. Nothing was sent.`);
2063
2063
  }
2064
2064
  if (worldRead && this.world === void 0) {
2065
- 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.`);
2065
+ throw new TypeError(`${method} ${path}: an account token reads a world only with \`world\` set (new OwV2Client({ apiKey, world })), through list, listAll, get, getWorld and draught. Nothing was sent.`);
2066
2066
  }
2067
2067
  if (accountToken === "world" && this.world === void 0) {
2068
2068
  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.`);
@@ -2316,10 +2316,10 @@ var CLIENT_CONFIG_KEYS = ["apiKey", "apiPin", "baseUrl", "pageSize", "changesPag
2316
2316
  function worldOf(value, keyKind) {
2317
2317
  if (value === void 0) return void 0;
2318
2318
  if (typeof value !== "string" || value.trim() === "") {
2319
- throw new TypeError(`OwV2Client: world is a world's id, a non-empty string; got ${JSON.stringify(value) ?? String(value)}. With it, an account token or no key reads that world through list, listAll, get and getWorld.`);
2319
+ throw new TypeError(`OwV2Client: world is a world's id, a non-empty string; got ${JSON.stringify(value) ?? String(value)}. With it, an account token or no key reads that world through list, listAll, get, getWorld and draught.`);
2320
2320
  }
2321
2321
  if (keyKind !== "account" && keyKind !== "none") {
2322
- throw new TypeError("OwV2Client: a world key reads its own world; `world` is for an account token or no key, which read the world it names through list, listAll, get and getWorld.");
2322
+ throw new TypeError("OwV2Client: a world key reads its own world; `world` is for an account token or no key, which read the world it names through list, listAll, get, getWorld and draught.");
2323
2323
  }
2324
2324
  return value;
2325
2325
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.121.0",
3
+ "version": "4.121.1",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {