@onlyworlds/sdk 4.119.0 → 4.121.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/dist/index.js CHANGED
@@ -773,7 +773,7 @@ var OwV2Client = class {
773
773
  if (this.keyKind === "account") {
774
774
  throw new TypeError("setMyCharacter needs a world key: an account token is not a member of one world");
775
775
  }
776
- return this.request("PUT", "/me/character", { write: true, body: { character } });
776
+ return this.request("PUT", "/me/character", { body: { character } });
777
777
  }
778
778
  /**
779
779
  * PUT /me/lenses -- choose the lenses this key's holder starts with: lens ids in order, 0 to 20,
@@ -1714,11 +1714,11 @@ var OwV2Client = class {
1714
1714
  * lists, search, counts and the link arrays that name it. 204, no body. No Idempotency-Key.
1715
1715
  */
1716
1716
  async hide(type, id) {
1717
- await this.request("PUT", `/${type}/${id}/hidden`, { write: true, body: {}, allowEmpty: true });
1717
+ await this.request("PUT", `/${type}/${id}/hidden`, { body: {}, allowEmpty: true });
1718
1718
  }
1719
1719
  /** DELETE /{type}/{id}/hidden -- clear the mark; an element that is not hidden stays as it is. 204. */
1720
1720
  async unhide(type, id) {
1721
- await this.request("DELETE", `/${type}/${id}/hidden`, { write: true, allowEmpty: true });
1721
+ await this.request("DELETE", `/${type}/${id}/hidden`, { allowEmpty: true });
1722
1722
  }
1723
1723
  /**
1724
1724
  * GET /world/hidden -- every hidden element of the world, newest first: `{type, id, set_at,
@@ -1908,7 +1908,8 @@ var OwV2Client = class {
1908
1908
  }
1909
1909
  /**
1910
1910
  * POST /account/worlds/{id}/keys -- mint a world key, `scope` `'write'` (the default) or
1911
- * `'read'`, `name` as the key list shows it (at most 255 characters). The full key comes back
1911
+ * `'read'`, `name` as the key list shows it (trimmed, at most 80 characters, else a 422; null or blank: no
1912
+ * name). The full key comes back
1912
1913
  * once in `key`. The owner mints a world key; a member mints their own member key, 409
1913
1914
  * `pin_required` (`err.isPinRequired`) for a write key while the account has no PIN. Account
1914
1915
  * token only; no Idempotency-Key. `keep: true` keeps the key across a sign-out: revoking the token
@@ -1928,7 +1929,7 @@ var OwV2Client = class {
1928
1929
  if (opts.scope !== void 0) body.scope = opts.scope;
1929
1930
  if (opts.name !== void 0) body.name = opts.name;
1930
1931
  if (opts.keep !== void 0) body.keep = opts.keep;
1931
- return this.request("POST", `/account/worlds/${encodeURIComponent(worldId)}/keys`, { write: true, body });
1932
+ return this.request("POST", `/account/worlds/${encodeURIComponent(worldId)}/keys`, { body });
1932
1933
  }
1933
1934
  /**
1934
1935
  * DELETE /account/worlds/{worldId}/keys/{keyId} -- revoke a world key, by the `id` mintWorldKey
@@ -3437,15 +3438,19 @@ function domainsOf(world, reader) {
3437
3438
 
3438
3439
  // src/strand.ts
3439
3440
  var STRAND_FIELD = "x_strand";
3440
- var SLOTS = ["narrative", "event", "location"];
3441
3441
  var EMPTY = () => ({ narrative: null, event: null, location: null, character: null, now: null, same: null });
3442
+ function optionalId(value) {
3443
+ if (value === null || value === void 0) return null;
3444
+ return typeof value === "string" && value !== "" ? value : void 0;
3445
+ }
3442
3446
  function markOf(value) {
3443
3447
  if (!isBody2(value)) return null;
3444
3448
  const v = value;
3445
- for (const slot of SLOTS) {
3446
- if (typeof v[slot] !== "string" || v[slot] === "") return null;
3447
- }
3448
- return { narrative: v.narrative, event: v.event, location: v.location };
3449
+ if (typeof v.narrative !== "string" || v.narrative === "") return null;
3450
+ const event = optionalId(v.event);
3451
+ const location = optionalId(v.location);
3452
+ if (event === void 0 || location === void 0) return null;
3453
+ return { narrative: v.narrative, event, location };
3449
3454
  }
3450
3455
  function strandOf(world, reader) {
3451
3456
  if (!isBody2(world) || !Array.isArray(world.elements)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.119.0",
3
+ "version": "4.121.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {