@observertc/observer-js 1.0.0-beta.6 → 1.0.0-beta.8

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
@@ -297,7 +297,8 @@ These return `undefined` (and warn) when the parent is closed; `createObservedCa
297
297
  "Update" means *recompute aggregated metrics and emit the `*-updated` event* at that level.
298
298
  Both the observer and each call have a configurable trigger. Updates are **event-driven** — there
299
299
  is no built-in timer. An app that wants a fixed cadence can call `observer.update()` /
300
- `call.update()` from its own `setInterval`.
300
+ `call.update()` from its own `setInterval`. With `'none'`, **nothing auto-updates** — the level
301
+ updates only when the application calls the public `update()` itself.
301
302
 
302
303
  **Observer-level** (`ObserverConfig.updatePolicy`, default `update-when-all-call-updated`):
303
304
 
@@ -305,6 +306,7 @@ is no built-in timer. An app that wants a fixed cadence can call `observer.updat
305
306
  |--------|-------------------------------------|
306
307
  | `update-on-any-call-updated` | any call updates |
307
308
  | `update-when-all-call-updated` | every call has updated since the last observer update |
309
+ | `none` | never automatically — only when the app calls `observer.update()` |
308
310
 
309
311
  **Call-level** (`ObservedCallSettings.updatePolicy`, defaulted from
310
312
  `ObserverConfig.defaultCallUpdatePolicy`):
@@ -313,6 +315,7 @@ is no built-in timer. An app that wants a fixed cadence can call `observer.updat
313
315
  |--------|--------------------------------|
314
316
  | `update-on-any-client-updated` | any client in the call updates |
315
317
  | `update-when-all-client-updated` | every client has updated since the last call update |
318
+ | `none` | never automatically — only when the app calls `call.update()` |
316
319
 
317
320
  ---
318
321
 
@@ -437,7 +440,7 @@ listen to them, but prefer the bus equivalents above for application logic.
437
440
  new Observer<AppData>(config?: ObserverConfig<AppData>)
438
441
 
439
442
  type ObserverConfig<AppData = Record<string, unknown>> = {
440
- updatePolicy?: 'update-on-any-call-updated' | 'update-when-all-call-updated';
443
+ updatePolicy?: 'update-on-any-call-updated' | 'update-when-all-call-updated' | 'none';
441
444
  defaultCallUpdatePolicy?: ObservedCallSettings['updatePolicy'];
442
445
  appData?: AppData;
443
446
  closeClientIfIdleForMs?: number;
@@ -488,7 +491,7 @@ Key members:
488
491
 
489
492
  ```ts
490
493
  type ObservedCallSettings<AppData = Record<string, unknown>> = {
491
- updatePolicy?: 'update-on-any-client-updated' | 'update-when-all-client-updated';
494
+ updatePolicy?: 'update-on-any-client-updated' | 'update-when-all-client-updated' | 'none';
492
495
  callId: string;
493
496
  appData?: AppData;
494
497
  closeCallIfEmptyForMs?: number;
@@ -929,7 +932,7 @@ yarn test # jest
929
932
 
930
933
  The build is driven by [`tsup`](https://tsup.egoist.dev) (config in `tsup.config.ts`): a single
931
934
  entry (`src/index.ts`), dual ESM + CommonJS output to `dist/` (`index.mjs` / `index.js`) with
932
- `.d.mts` / `.d.ts` types and sourcemaps, targeting Node 22. CI (`.github/workflows/ci.yml`) runs
935
+ `.d.mts` / `.d.ts` types and sourcemaps, targeting Node 20. CI (`.github/workflows/ci.yml`) runs
933
936
  lint + typecheck + **build** + test on every push/PR.
934
937
 
935
938
  **Project layout** (`src/`): `Observer.ts`, `ObservedCall.ts`, `ObservedClient.ts`,
package/dist/index.d.mts CHANGED
@@ -2485,7 +2485,7 @@ declare class Detectors {
2485
2485
  }
2486
2486
 
2487
2487
  type ObservedCallUpdateConfig = {
2488
- updatePolicy?: 'update-on-any-client-updated' | 'update-when-all-client-updated';
2488
+ updatePolicy?: 'update-on-any-client-updated' | 'update-when-all-client-updated' | 'none';
2489
2489
  };
2490
2490
  type ObservedCallSettings<AppData extends Record<string, unknown> = Record<string, unknown>> = ObservedCallUpdateConfig & {
2491
2491
  callId: string;
@@ -2587,7 +2587,7 @@ type AcceptMiddlewarePayload = {
2587
2587
  */
2588
2588
  type AcceptMiddleware = Middleware<AcceptMiddlewarePayload>;
2589
2589
  type ObserverUpdateConfig = {
2590
- updatePolicy?: 'update-on-any-call-updated' | 'update-when-all-call-updated';
2590
+ updatePolicy?: 'update-on-any-call-updated' | 'update-when-all-call-updated' | 'none';
2591
2591
  };
2592
2592
  /** Produces the initial `appData` for a call created without an explicit `appData`. */
2593
2593
  type CallAppDataFactory = (params: {
package/dist/index.d.ts CHANGED
@@ -2485,7 +2485,7 @@ declare class Detectors {
2485
2485
  }
2486
2486
 
2487
2487
  type ObservedCallUpdateConfig = {
2488
- updatePolicy?: 'update-on-any-client-updated' | 'update-when-all-client-updated';
2488
+ updatePolicy?: 'update-on-any-client-updated' | 'update-when-all-client-updated' | 'none';
2489
2489
  };
2490
2490
  type ObservedCallSettings<AppData extends Record<string, unknown> = Record<string, unknown>> = ObservedCallUpdateConfig & {
2491
2491
  callId: string;
@@ -2587,7 +2587,7 @@ type AcceptMiddlewarePayload = {
2587
2587
  */
2588
2588
  type AcceptMiddleware = Middleware<AcceptMiddlewarePayload>;
2589
2589
  type ObserverUpdateConfig = {
2590
- updatePolicy?: 'update-on-any-call-updated' | 'update-when-all-call-updated';
2590
+ updatePolicy?: 'update-on-any-call-updated' | 'update-when-all-call-updated' | 'none';
2591
2591
  };
2592
2592
  /** Produces the initial `appData` for a call created without an explicit `appData`. */
2593
2593
  type CallAppDataFactory = (params: {
package/dist/index.js CHANGED
@@ -2879,6 +2879,8 @@ var ObservedCall = class extends import_events3.EventEmitter {
2879
2879
  case "update-when-all-client-updated":
2880
2880
  this.updater = new OnAllClientCallUpdater(this);
2881
2881
  break;
2882
+ case "none":
2883
+ break;
2882
2884
  }
2883
2885
  this.settings = {
2884
2886
  closeCallIfEmptyForMs: settings.closeCallIfEmptyForMs
@@ -3316,6 +3318,8 @@ var Observer = class extends import_events5.EventEmitter {
3316
3318
  case "update-when-all-call-updated":
3317
3319
  this.updater = new OnAllCallObserverUpdater(this);
3318
3320
  break;
3321
+ case "none":
3322
+ break;
3319
3323
  }
3320
3324
  }
3321
3325
  config;