@onlyworlds/sdk 4.60.0 → 4.61.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/AGENTS.md CHANGED
@@ -27,7 +27,7 @@ against live data). The v1 surface (`OnlyWorldsClient`, the `ElementType` enum)
27
27
  - Never send a `"world"` field in payloads — world identity comes from the API key (422 otherwise).
28
28
  - v2 link fields use ONE name both directions (no `_ids` suffix — that is v1 dialect only).
29
29
  - PATCH is destructive on sent fields; use `editLinks` (atomic add/remove) for relationships.
30
- - Offline or stale edits: pass `{ ifMatch: el.change_seq }` to `patch`/`editLinks` (since 4.9.0).
30
+ - Offline or stale edits: pass `{ ifMatch: el.change_seq }` to `patch`/`editLinks` (since 4.9.0) and `delete` (since 4.61.0, keel #563).
31
31
  If the element moved, nothing is written and `OwPreconditionFailedError` (412) carries
32
32
  `current`; the server never merges, the client decides.
33
33
  - Polling: `changesHead()` (since 4.15.0) gives `{head, cursor, epoch, unchanged}` without a
package/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.61.0] - 2026-10-22
9
+
10
+ ### Added
11
+
12
+ - **`delete(type, id, { ifMatch })`** (keel #563, PR 183, live 2026-10-22 21:3x): `DELETE` reads `If-Match` exactly as `PATCH` does. With the element's `change_seq` as you read it, a delete of an element someone changed since is refused, `OwPreconditionFailedError` (412) with `current`, nothing deleted; on an element already gone it is the idempotent 204. Under a world's proposals switch a delete is never a proposal. The options object refuses an unknown key like every other.
13
+ - Tests: the header sent and left out, the unknown option, the 412; each watched failing with the header dropped. The wire gate now reads from keel's document which Character operations take `If-Match` (it held a hand list of two and missed this one) and fails on 4.60.0.
14
+
8
15
  ## [4.60.0] - 2026-10-22
9
16
 
10
17
  ### Added
package/README.md CHANGED
@@ -186,7 +186,7 @@ Edits to the world itself (its name, calendar, `public_read`) don't appear in th
186
186
 
187
187
  ### Only if unchanged
188
188
 
189
- A client that edits offline, or from a copy it has held a while, can ask for an update to land only if nobody changed the element since it was read: pass the `change_seq` you read as `ifMatch`, on `patch` or `editLinks`.
189
+ A client that edits offline, or from a copy it has held a while, can ask for an update to land only if nobody changed the element since it was read: pass the `change_seq` you read as `ifMatch`, on `patch`, `editLinks` or `delete` (since 4.61.0: a delete of an element someone changed since you read it is refused, nothing deleted).
190
190
 
191
191
  ```typescript
192
192
  try {
package/dist/index.d.ts CHANGED
@@ -3510,8 +3510,15 @@ declare class OwV2Client {
3510
3510
  * DELETE /{type}/{id}/ -- idempotent (204 on absent). Server writes a
3511
3511
  * tombstone AND scrubs the id from every other element's links in the same
3512
3512
  * transaction -- no client-side unlink pass needed, ever.
3513
+ *
3514
+ * `ifMatch` (keel #563, as on patch()): the element's `change_seq` as you read it. The delete
3515
+ * lands only if nothing changed since; otherwise an OwPreconditionFailedError (412) whose
3516
+ * `current` is the element as it is now, and nothing is deleted. On an element already gone it
3517
+ * is the idempotent 204. Under a world's proposals switch a delete is never a proposal.
3513
3518
  */
3514
- delete(type: ElementType | string, id: string): Promise<void>;
3519
+ delete(type: ElementType | string, id: string, opts?: {
3520
+ ifMatch?: number;
3521
+ }): Promise<void>;
3515
3522
  /**
3516
3523
  * POST /{type}/{id}/links/{field} with {add, remove} -- atomic link merge.
3517
3524
  * Dedupes, tolerates already-present/already-absent ids. Returns the FULL
package/dist/index.js CHANGED
@@ -766,9 +766,15 @@ var OwV2Client = class {
766
766
  * DELETE /{type}/{id}/ -- idempotent (204 on absent). Server writes a
767
767
  * tombstone AND scrubs the id from every other element's links in the same
768
768
  * transaction -- no client-side unlink pass needed, ever.
769
+ *
770
+ * `ifMatch` (keel #563, as on patch()): the element's `change_seq` as you read it. The delete
771
+ * lands only if nothing changed since; otherwise an OwPreconditionFailedError (412) whose
772
+ * `current` is the element as it is now, and nothing is deleted. On an element already gone it
773
+ * is the idempotent 204. Under a world's proposals switch a delete is never a proposal.
769
774
  */
770
- async delete(type, id) {
771
- await this.request("DELETE", `/${type}/${id}/`, { write: true, elementWrite: true, allowEmpty: true });
775
+ async delete(type, id, opts = {}) {
776
+ only("delete", opts, ["ifMatch"]);
777
+ await this.request("DELETE", `/${type}/${id}/`, { write: true, elementWrite: true, allowEmpty: true, ifMatch: opts.ifMatch });
772
778
  }
773
779
  /**
774
780
  * POST /{type}/{id}/links/{field} with {add, remove} -- atomic link merge.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.60.0",
3
+ "version": "4.61.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {