@onlyworlds/sdk 4.67.0 → 4.68.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,13 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.68.0] - 2026-10-23
9
+
10
+ ### Fixed
11
+
12
+ - **`patchWorld` strips `counts`**, which a keyless `GET /world` carries (keel #421 PR 4, the public reader on since 2026-10-23) and `PATCH` answers as an unknown key, so the body of a keyless read goes back too. Quillon's port found it (h29 #11241); the Python package's live wire test went red on the same key the same hour.
13
+ - **`reviewNewElement` refuses a reason with an accept** before sending (keel takes `{ decision: 'accept' }` alone; a reason was its 422), and **checks its answer**: an accept that answers no `element`, or a decline no `deleted`, is a `TypeError` naming the route. Both as the Python package does (Quillon, h29 #11241).
14
+
8
15
  ## [4.67.0] - 2026-10-23
9
16
 
10
17
  ### Added
package/dist/index.js CHANGED
@@ -1653,9 +1653,18 @@ var OwV2Client = class {
1653
1653
  if (opts?.decision !== "accept" && opts?.decision !== "decline") {
1654
1654
  throw new TypeError(`reviewNewElement: decision must be 'accept' or 'decline', got ${JSON.stringify(opts?.decision) ?? String(opts?.decision)}. Nothing was sent.`);
1655
1655
  }
1656
+ if (opts.reason !== void 0 && opts.decision !== "decline") {
1657
+ throw new TypeError("reviewNewElement: a reason goes with a decline only. Nothing was sent.");
1658
+ }
1656
1659
  const body = { decision: opts.decision };
1657
1660
  if (opts.reason !== void 0) body.reason = opts.reason;
1658
- return this.request("POST", `/${type}/${encodeURIComponent(id)}/review`, { elementWrite: true, body });
1661
+ const path = `/${type}/${encodeURIComponent(id)}/review`;
1662
+ const answer = await this.request("POST", path, { elementWrite: true, body });
1663
+ const settled = opts.decision === "accept" ? "element" : "deleted";
1664
+ if (answer === null || typeof answer !== "object" || !(settled in answer)) {
1665
+ throw new TypeError(`reviewNewElement: POST ${path} answered no ${settled}: ${JSON.stringify(answer)?.slice(0, 200)}`);
1666
+ }
1667
+ return answer;
1659
1668
  }
1660
1669
  // -- The account's worlds and keys (account token) -----------------------
1661
1670
  /**
@@ -1870,7 +1879,7 @@ var HeadPollState = class {
1870
1879
  }
1871
1880
  };
1872
1881
  var READ_ONLY_FIELDS = ["world", "type", "created_at", "updated_at", "change_seq", "known_of"];
1873
- var WORLD_READ_ONLY_FIELDS = ["id", "slug", "public_page", "public_read", "agent_narrator_rule", "agent_writes_proposed", "origin"];
1882
+ var WORLD_READ_ONLY_FIELDS = ["id", "slug", "public_page", "public_read", "agent_narrator_rule", "agent_writes_proposed", "origin", "counts"];
1874
1883
  function proposalsPath(type, id) {
1875
1884
  return `/${type}/${encodeURIComponent(id)}/proposals`;
1876
1885
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.67.0",
3
+ "version": "4.68.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {