@owlmeans/web-db 0.1.18-rc.2 → 0.1.18-rc.20

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 @@ 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.13
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.18
74
74
  ```
75
75
 
76
76
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/web-db",
4
- "version": "0.1.18-rc.0",
5
- "generatedAt": "2026-08-16T22:20:50.508Z",
4
+ "version": "0.1.18-rc.20",
5
+ "generatedAt": "2026-09-12T13:35:38.913Z",
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.0"` in `dependencies`
11
+ **Install:** `"@owlmeans/web-db": "^0.1.18-rc.20"` in `dependencies`
12
12
 
13
13
  ## Key Exports
14
14
 
15
15
  | Export | Description |
16
16
  |--------|-------------|
17
- | `makeWebDbService()` | Browser IndexedDB-backed service factory |
18
- | Constants | Default DB names, object store names |
19
- | Types | DB service interface |
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 { makeWebDbService } from '@owlmeans/web-db'
25
- context.registerService(makeWebDbService())
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
- - IndexedDB (browser global)
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
@@ -31,7 +31,7 @@ export const makeWebDbService = (alias = DEFAULT_ALIAS) => {
31
31
  return stores[alias] = db;
32
32
  },
33
33
  erase: async () => {
34
- clear();
34
+ await clear();
35
35
  }
36
36
  }, service => async () => {
37
37
  service.initialized = true;
@@ -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,CAAC,IAAI,IAAI,EAAE,CAAC;gBAC1B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;YACtB,CAAC;YAED,MAAM,IAAI,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,KAAK,GAAG,GAAG,GAAG,EAAE,CAAA;YAE7C,MAAM,EAAE,GAAa;gBACnB,GAAG,EAAE,KAAK,EAAK,EAAU,EAAE,EAAE;oBAC3B,OAAO,MAAM,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAM,CAAA;gBACjC,CAAC;gBAED,GAAG,EAAE,KAAK,EAAK,EAAU,EAAE,KAAQ,EAAE,EAAE;oBACrC,MAAM,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;gBAC5B,CAAC;gBAED,GAAG,E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YAChB,MAAM,KAAK,EAAE,CAAA;QACf,CAAC;KACF,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE;QACvB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAA;IAC5B,CAAC,CAAC,CAAA;IAEF,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,OAAU,EAAE,KAAK,GAAW,aAAa,EACtC,EAAE;IACL,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAA;IAEvC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;IAEhC,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/web-db",
3
- "version": "0.1.18-rc.2",
3
+ "version": "0.1.18-rc.20",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -21,9 +21,9 @@
21
21
  }
22
22
  },
23
23
  "dependencies": {
24
- "@owlmeans/client-context": "^0.1.18-rc.2",
25
- "@owlmeans/client-resource": "^0.1.18-rc.2",
26
- "@owlmeans/context": "^0.1.18-rc.2",
24
+ "@owlmeans/client-context": "^0.1.18-rc.19",
25
+ "@owlmeans/client-resource": "^0.1.18-rc.19",
26
+ "@owlmeans/context": "^0.1.18-rc.14",
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)) as T
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