@omgbase/core 0.3.0 → 0.4.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.
@@ -14,11 +14,19 @@ export class Watcher {
14
14
  async start() {
15
15
  if (!this.source.watch)
16
16
  throw new Error("source does not support watch()");
17
- this.sub = await this.source.watch((paths) => {
17
+ this.sub = await this.source.watch((ev) => {
18
+ if (ev.event !== "batch")
19
+ return; // `ready` is surfaced through ready()
18
20
  // A batch arrives from the adapter's stream; reconcile it off the callback.
19
- void this.ingest(paths).catch((err) => this.opts.onError?.(err));
21
+ void this.ingest(ev.paths).catch((err) => this.opts.onError?.(err));
20
22
  });
21
23
  }
24
+ /** The live subscription's `ready` (spec/sync §5); throws before `start()`. */
25
+ ready() {
26
+ if (!this.sub)
27
+ throw new Error("watcher not started");
28
+ return this.sub.ready;
29
+ }
22
30
  async ingest(paths) {
23
31
  if (paths.length === 0)
24
32
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omgbase/core",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Open Markdown Graph Base — embedded engine",
5
5
  "license": "MIT",
6
6
  "repository": {