Hyperlinkv0.8.0-beta.28

Hyperlink

Hyperlink.monitoredDependencyconstsrc/Hyperlink.ts:2823

Build the common monitored dependency contract: status (one-shot read), changes (live snapshot stream), and readiness derived from status. Still a plain Hyperlink.Tag shape — not a new resource kind.

Compose behaviour the usual way: tag + withReadiness (see Resources → behaviour via piped combinators).

constructorsHyperlink.TagwithReadiness
Source src/Hyperlink.ts:282320 lines
export const monitoredDependency = <
  Status extends Schema.Top,
  Change extends Schema.Top,
>(
  options: MonitoredDependencyOptions<Status, Change>,
): MonitoredDependency<Status, Change> => ({
  spec: contract({
    status: effect(options.status),
    changes: stream(options.changes),
  }),
  readiness: ((svc, _base: any) =>
    (Effect.map as any)(
      (svc as MonitoredDependencyService<Status>).status,
      (s: Schema.Schema.Type<Status>): Readiness => {
        const ready = options.readyWhen(s);
        const detail = options.detail?.(s);
        return detail === undefined ? { ready } : { ready, detail };
      },
    )) as ReadinessOf<MonitoredDependencyService<Status>>,
});