@owlmeans/resource 0.1.18-rc.6 → 0.1.18-rc.7

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/resource",
4
- "version": "0.1.18-rc.6",
5
- "generatedAt": "2026-08-18T14:48:00.501Z",
4
+ "version": "0.1.18-rc.7",
5
+ "generatedAt": "2026-08-24T21:14:00.098Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/resource
9
9
 
10
10
  **Layer:** Core
11
- **Install:** `"@owlmeans/resource": "^0.1.18-rc.6"` in `dependencies`
11
+ **Install:** `"@owlmeans/resource": "^0.1.18-rc.7"` in `dependencies`
12
12
 
13
13
  ## Key Exports
14
14
 
@@ -48,6 +48,32 @@ const page2 = await projects.list(
48
48
  // page2.pager echoes { page, size, total } for building pagination UI.
49
49
  ```
50
50
 
51
+ ### Calling the CRUD surface
52
+
53
+ A **write** takes the record as its only data argument, and the id travels inside it. There is no
54
+ `(id, changes)` overload on any of them — passing an id first fails to compile with
55
+ `TS2559: Type 'string' has no properties in common with type 'Partial<...>'`.
56
+
57
+ | Call | Signature | Notes |
58
+ |---|---|---|
59
+ | `create(record, opts?)` | `Partial<T> → T` | throws `RecordExists`; implementations may refuse a caller-supplied id |
60
+ | `save(record, opts?)` | `Partial<T> → T` | create-or-replace |
61
+ | `update(record, opts?)` | `Partial<T> → T` | replaces the whole record; throws `UnknownRecordError` |
62
+
63
+ A **read** takes the id first, plus an optional field to look it up by (`opts` is that field name,
64
+ or `{ field, ttl }`):
65
+
66
+ | Call | Signature | Notes |
67
+ |---|---|---|
68
+ | `load(id, field?, opts?)` | `string → T \| null` | the miss-tolerant read |
69
+ | `get(id, field?, opts?)` | `string → T` | throws `UnknownRecordError` instead of returning `null` |
70
+ | `list(criteria?, opts?)` | `→ { items, pager }` | |
71
+ | `delete(id \| record, opts?)` | `→ T \| null` | returns what it removed |
72
+ | `pick(id \| record, opts?)` | `→ T` | **also deletes** — it is `delete` that throws on a miss, never a read |
73
+
74
+ Every method returns the record(s) themselves, never a driver result object — there is no
75
+ `rowsAffected`/`rowCount` anywhere on this contract.
76
+
51
77
  ## The migration framework
52
78
 
53
79
  Migrations are **automatic on app setup**: a backend runs them inside the resource's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/resource",
3
- "version": "0.1.18-rc.6",
3
+ "version": "0.1.18-rc.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {