Hyperlinkv0.8.0-beta.28

QueueHyperlink

QueueHyperlink.QueueLayerConfigtypesrc/QueueHyperlink.ts:1077
QueueLayerConfig<Item, A, E, R, RR>

The worker config for QueueHyperlink.layer — the engine queue config without itemSchema (the tag already carries it). The item type is the tag's itemSchema decoded type, so effect: (item, ctx) => … is typed against it.

modelsQueueHyperlink.layer
export type QueueLayerConfig<Item, A, E, R, RR = never> = Omit<
  QueueHyperlinkConfigWithItemSchema<Item, E, R, A>,
  "itemSchema" | "refill"
> & {
  /**
   * Optional self-refill. Its loader carries its **own** requirement `RR` — independent of the
   * worker `R` — so a refill that pulls from a source (a repository/DB service) the worker doesn't
   * use is expressible; the layer's requirement is the union `R | RR`. (Sharing one `R` would
   * intersect to `never`, since the requirement channel is contravariant.)
   *
   * `RR` is kept to `load`'s **return** only (the handle is requirement-free here) so TS infers it
   * cleanly — if `RR` also appeared on the handle parameter its variance would conflict and default
   * to `never`.
   */
  readonly refill?: {
    /** Run `load` once when the worker pool starts (bootstrap). @default false */
    readonly onStart?: boolean;
    /** Run `load` each time the queue drains to empty (re-poll the source). @default false */
    readonly onDrained?: boolean;
    /** Load + enqueue work from a source. Handle its own errors (best-effort). */
    readonly load: (
      queue: QueueHandle<Item, E, QueueEnqueueErrors, never, A>,
    ) => Effect.Effect<void, never, RR>;
  };
};