@owlmeans/client-resource 0.1.18-rc.12 → 0.1.18-rc.14
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/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Client-side resource persistence layer — browser key-value storage backed reso
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
bun add @owlmeans/client-resource
|
|
15
|
+
bun add @owlmeans/client-resource@^0.1.18-rc.12
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
@@ -80,7 +80,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
80
80
|
your project's skill store (`.agents/skills/`):
|
|
81
81
|
|
|
82
82
|
```sh
|
|
83
|
-
npx @owlmeans/agent-skills
|
|
83
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.13
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/client-resource",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-09-
|
|
4
|
+
"version": "0.1.18-rc.14",
|
|
5
|
+
"generatedAt": "2026-09-10T18:54:42.501Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/client-resource
|
|
9
9
|
|
|
10
10
|
**Layer:** Client
|
|
11
|
-
**Install:** `"@owlmeans/client-resource": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/client-resource": "^0.1.18-rc.14"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
## Key Exports
|
|
14
14
|
|
|
@@ -27,12 +27,22 @@ import { appendClientResource } from '@owlmeans/client-resource'
|
|
|
27
27
|
appendClientResource<Config, Context, Project>(context, 'projects')
|
|
28
28
|
|
|
29
29
|
const projects = context.resource<ClientResource<Project>>('projects')
|
|
30
|
-
await projects.list({ status: ['open', 'blocked'] }, { sort: ['createdAt'] })
|
|
30
|
+
const { items, total } = await projects.list({ status: ['open', 'blocked'] }, { sort: ['createdAt'] })
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
The backing store comes from `cfg.dbs` — the entry whose `alias`
|
|
34
|
-
`
|
|
35
|
-
|
|
33
|
+
The backing store comes from `cfg.dbs` — the `DbConfig` entry whose `alias` equals the resource's.
|
|
34
|
+
`service` is the field that selects the backend: it names the `ClientDbService` to ask, and it is
|
|
35
|
+
required by the type, as is `host`, which nothing on this path reads. `schema` names the store
|
|
36
|
+
inside that service and defaults to the resource alias. So an entry is
|
|
37
|
+
`{ alias: 'projects', service: MY_DB, host: [], schema? }`.
|
|
38
|
+
|
|
39
|
+
With no matching entry the resource asks `DEFAULT_DB_ALIAS` (`client-db`) for a store named after
|
|
40
|
+
itself — which is why a single-backend app (`@owlmeans/web-db` registered under that alias) writes
|
|
41
|
+
no `dbs` entries at all, and a second backend is chosen by adding one that names another service.
|
|
42
|
+
|
|
43
|
+
That binding happens in `init()`, which the context runs while it initializes. Every operation
|
|
44
|
+
before it throws `ResourceError('nodb-client-resource:<alias>')` — read that as "this resource was
|
|
45
|
+
used before its context was ready", not as a storage failure.
|
|
36
46
|
|
|
37
47
|
## A key-value store dressed as a resource
|
|
38
48
|
|
|
@@ -43,17 +53,23 @@ is. So:
|
|
|
43
53
|
- `load(where)`, `get(where)`, `list`, `count` and `purge` read the whole set and evaluate through
|
|
44
54
|
the shared in-memory engine from `@owlmeans/resource`, which is what makes a criteria object mean
|
|
45
55
|
here exactly what it means against a relational store. `{ sort }` orders the result the same way.
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
- `list` answers with the shared `ListResult` — `{ items, total }`, and `page` / `size` echoed back
|
|
57
|
+
as well when a size was asked for. **Unpaged by default**: no `size` (or `size: 0`) returns every
|
|
58
|
+
match, and `page` without `size` throws `UnsupportedArgumentError('page-without-size')`. The
|
|
59
|
+
contract is the one every store shares — [[resource]].
|
|
60
|
+
- `create` mints a base58 id when the record carries none and throws `RecordExists` for one already
|
|
61
|
+
stored; `update` **replaces** the whole record, throwing `MisshapedRecord('id')` for a record that
|
|
62
|
+
carries no id and `UnknownRecordError` for an id the store does not hold; `save` creates when
|
|
63
|
+
there is no id or no stored record and replaces otherwise. `take(id)` **deletes** the record it
|
|
64
|
+
returns.
|
|
51
65
|
- `purge(where)` refuses an empty criteria object. `erase()` empties the store, index included.
|
|
52
66
|
|
|
53
67
|
## Depends On
|
|
54
68
|
|
|
55
|
-
- `@owlmeans/resource
|
|
69
|
+
- `@owlmeans/resource` (the shared criteria engine), `@owlmeans/client-context`, `@owlmeans/context`
|
|
70
|
+
- `@scure/base`, `@noble/hashes` — the base58 id minted for a record that arrives without one
|
|
56
71
|
|
|
57
72
|
## Related
|
|
58
73
|
|
|
74
|
+
- [[resource]] — the criteria engine, `ListResult` and the shared resource contract
|
|
59
75
|
- [[web-db]] — the browser IndexedDB backend behind `ClientDbService`
|
package/build/resource.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAM3E,OAAO,KAAK,EAAuC,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAM7F,KAAK,MAAM,GAAG,YAAY,CAAA;AAC1B,UAAU,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;CAAI;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAC/B,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,cAAc,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAM3E,OAAO,KAAK,EAAuC,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAM7F,KAAK,MAAM,GAAG,YAAY,CAAA;AAC1B,UAAU,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;CAAI;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAC/B,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,cAAc,GAAG,cAAc,WACxE,CAAC,SAAS,MAAM,KAAG,CAuJ7B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/client-resource",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@noble/hashes": "^1.5.0",
|
|
25
|
-
"@owlmeans/client-context": "^0.1.18-rc.
|
|
26
|
-
"@owlmeans/context": "^0.1.18-rc.
|
|
27
|
-
"@owlmeans/resource": "^0.1.18-rc.
|
|
25
|
+
"@owlmeans/client-context": "^0.1.18-rc.14",
|
|
26
|
+
"@owlmeans/context": "^0.1.18-rc.9",
|
|
27
|
+
"@owlmeans/resource": "^0.1.18-rc.10",
|
|
28
28
|
"@scure/base": "^2.3.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|