@owlmeans/web-db 0.1.18-rc.3 → 0.1.18-rc.30
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 +3 -3
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/web-db/SKILL.md +29 -8
- package/build/service.js +1 -1
- package/build/service.js.map +1 -1
- package/package.json +4 -4
- package/src/service.ts +2 -2
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ IndexedDB-backed client database service for OwlMeans web applications.
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
bun add @owlmeans/web-db
|
|
15
|
+
bun add @owlmeans/web-db@^0.1.18-rc.30
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
@@ -52,7 +52,7 @@ Registers the DB service in the context.
|
|
|
52
52
|
### `WebDbService`
|
|
53
53
|
|
|
54
54
|
Extends `ClientDbService` with `initialize(alias?)` returning a `ClientDb`:
|
|
55
|
-
- `get<T>(id): Promise<T>`
|
|
55
|
+
- `get<T>(id): Promise<T | undefined>` — a miss is `undefined`, not an error
|
|
56
56
|
- `set<T>(id, value): Promise<void>`
|
|
57
57
|
- `has(id): Promise<boolean>`
|
|
58
58
|
- `del(id): Promise<boolean>`
|
|
@@ -70,7 +70,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
70
70
|
your project's skill store (`.agents/skills/`):
|
|
71
71
|
|
|
72
72
|
```sh
|
|
73
|
-
npx @owlmeans/agent-skills
|
|
73
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.28
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
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/web-db",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-
|
|
4
|
+
"version": "0.1.18-rc.30",
|
|
5
|
+
"generatedAt": "2026-09-17T08:16:11.228Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,24 +8,45 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/web-db
|
|
9
9
|
|
|
10
10
|
**Layer:** Web (React)
|
|
11
|
-
**Install:** `"@owlmeans/web-db": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/web-db": "^0.1.18-rc.30"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
## Key Exports
|
|
14
14
|
|
|
15
15
|
| Export | Description |
|
|
16
16
|
|--------|-------------|
|
|
17
|
-
| `
|
|
18
|
-
|
|
|
19
|
-
|
|
|
17
|
+
| `appendWebDbService(context, alias?)` | Register the service on a client context and return the context |
|
|
18
|
+
| `makeWebDbService(alias?)` | The bare service, when you register it yourself |
|
|
19
|
+
| `WebDbService` | The `ClientDbService` contract from [[client-resource]] — `initialize(alias?)`, `erase()` |
|
|
20
|
+
| `DEFAULT_ALIAS` | `client-db`, the same alias `@owlmeans/client-resource` looks for |
|
|
20
21
|
|
|
21
22
|
## Usage
|
|
22
23
|
|
|
23
24
|
```typescript
|
|
24
|
-
import {
|
|
25
|
-
|
|
25
|
+
import { appendWebDbService } from '@owlmeans/web-db'
|
|
26
|
+
import { appendClientResource } from '@owlmeans/client-resource'
|
|
27
|
+
|
|
28
|
+
appendWebDbService(context)
|
|
29
|
+
appendClientResource<Config, Context, Project>(context, 'projects')
|
|
26
30
|
```
|
|
27
31
|
|
|
32
|
+
This package supplies the **storage**, not the query surface: it hands
|
|
33
|
+
`@owlmeans/client-resource` a `ClientDb` over `idb-keyval`, and that resource is what answers
|
|
34
|
+
`get`/`load`/`list`/`count`/`create`/`update`/`save`/`delete`/`take`/`purge`, criteria and `{ sort }`
|
|
35
|
+
included. Every read walks the whole store: all records are loaded out of IndexedDB and the criteria
|
|
36
|
+
applied in memory. `list(where)` with no `size` therefore answers **every** match, and `size: 0`
|
|
37
|
+
says the same explicitly; a `size` does slice `page * size` out of what was already read, so paging
|
|
38
|
+
saves the read nothing. `page` without `size` raises
|
|
39
|
+
`UnsupportedArgumentError('page-without-size')`.
|
|
40
|
+
|
|
41
|
+
`initialize(alias)` returns one `ClientDb` per alias, memoised, and prefixes every key with that
|
|
42
|
+
alias, so two resources on one browser never collide. `erase()` clears the **whole** IndexedDB
|
|
43
|
+
store, every alias at once — a per-resource wipe is `ClientResource.erase()`.
|
|
44
|
+
|
|
28
45
|
## Depends On
|
|
29
46
|
|
|
30
|
-
- `@owlmeans/client-resource`, `@owlmeans/client-context`
|
|
31
|
-
-
|
|
47
|
+
- `@owlmeans/client-resource`, `@owlmeans/client-context`, `@owlmeans/context`
|
|
48
|
+
- `idb-keyval` (runtime) — IndexedDB behind it
|
|
49
|
+
|
|
50
|
+
## Related
|
|
51
|
+
|
|
52
|
+
- [[client-resource]] — the resource this service backs
|
package/build/service.js
CHANGED
package/build/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAG3C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAMjD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAK,GAAW,aAAa,EAAgB,EAAE;IAC9E,MAAM,MAAM,GAA6B,EAAE,CAAA;IAC3C,MAAM,OAAO,GAAG,aAAa,CAAe,KAAK,EAAE;QACjD,UAAU,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;YACxB,KAAK,GAAG,KAAK,IAAI,aAAa,CAAA;YAE9B,IAAI,MAAM,CAAC,KAAK,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|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@owlmeans/client-context": "^0.1.18-rc.
|
|
25
|
-
"@owlmeans/client-resource": "^0.1.18-rc.
|
|
26
|
-
"@owlmeans/context": "^0.1.18-rc.
|
|
24
|
+
"@owlmeans/client-context": "^0.1.18-rc.30",
|
|
25
|
+
"@owlmeans/client-resource": "^0.1.18-rc.29",
|
|
26
|
+
"@owlmeans/context": "^0.1.18-rc.25",
|
|
27
27
|
"idb-keyval": "^6.2.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
package/src/service.ts
CHANGED
|
@@ -22,7 +22,7 @@ export const makeWebDbService = (alias: string = DEFAULT_ALIAS): WebDbService =>
|
|
|
22
22
|
|
|
23
23
|
const db: ClientDb = {
|
|
24
24
|
get: async <T>(id: string) => {
|
|
25
|
-
return await get(_key(id))
|
|
25
|
+
return await get<T>(_key(id))
|
|
26
26
|
},
|
|
27
27
|
|
|
28
28
|
set: async <T>(id: string, value: T) => {
|
|
@@ -47,7 +47,7 @@ export const makeWebDbService = (alias: string = DEFAULT_ALIAS): WebDbService =>
|
|
|
47
47
|
},
|
|
48
48
|
|
|
49
49
|
erase: async () => {
|
|
50
|
-
clear()
|
|
50
|
+
await clear()
|
|
51
51
|
}
|
|
52
52
|
}, service => async () => {
|
|
53
53
|
service.initialized = true
|