@kedem/okdb 1.0.4 → 1.1.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/README.md +13 -4
- package/bin/okdb.js +1 -1
- package/docs/OKDB-ARCHITECTURE.md +2 -1
- package/docs/manifest.json +1 -0
- package/docs/pipelines.md +2 -0
- package/docs/views.md +351 -0
- package/okdb.js +1 -1
- package/package.json +1 -1
- package/public/sections/queue/parts/queue-buckets.ok.js +1 -1
- package/public/sections/queue/parts/queue-jobs.ok.js +1 -1
- package/public/sections/views/modals/create-view-modal.ok.js +1 -1
- package/public/sections/views/parts/view-detail.ok.js +1 -1
- package/public/sections/views/parts/views-overview.ok.js +1 -1
- package/types/features/views.d.ts +142 -10
package/README.md
CHANGED
|
@@ -232,7 +232,9 @@ for (const change of db.timeMachine.getChanges('orders', fromClock, toClock)) {
|
|
|
232
232
|
Reactive aggregations that update automatically on every write. Declare a view with built-in reducers (`$count`, `$sum`, `$avg`, `$min`, `$max`, `$countBy`) or supply your own, and OKDB keeps the result in sync.
|
|
233
233
|
|
|
234
234
|
```js
|
|
235
|
-
|
|
235
|
+
const env = db.env('default');
|
|
236
|
+
|
|
237
|
+
await env.views.create('orderStats', {
|
|
236
238
|
type: 'orders',
|
|
237
239
|
filter: { status: 'completed' },
|
|
238
240
|
reduce: {
|
|
@@ -243,11 +245,18 @@ await db.views.create('orderStats', {
|
|
|
243
245
|
},
|
|
244
246
|
});
|
|
245
247
|
|
|
246
|
-
// Read the live result — synchronous
|
|
247
|
-
const stats =
|
|
248
|
-
// → {
|
|
248
|
+
// Read the live result — synchronous, O(1)
|
|
249
|
+
const stats = env.views.get('orderStats');
|
|
250
|
+
// → {
|
|
251
|
+
// total: { value: 142500 },
|
|
252
|
+
// count: { value: 312 },
|
|
253
|
+
// avgValue: { value: 456.7 },
|
|
254
|
+
// byRegion: { EU: { value: 140 }, US: { value: 172 } }
|
|
255
|
+
// }
|
|
249
256
|
```
|
|
250
257
|
|
|
258
|
+
See [docs/views.md](./docs/views.md) for the full reducer reference, `map`, `$ref` sub-aggregations, lifecycle management, and HTTP/MCP surface.
|
|
259
|
+
|
|
251
260
|
### 🔑 Authentication & authorization
|
|
252
261
|
|
|
253
262
|
Multi-mode security layer built into the HTTP API. No separate auth service needed.
|