Hyperlinkv0.8.0-beta.28

Process

Process.Tagconstsrc/Process.ts:2221
<Self>(): ProcessTagBuild<Self>

Define a managed process as a toolkit resource. Self is given explicitly (Effect's () two-stage form). The base tag carries observation + lifecycle; add a schedule with .pipe(schedule(…)). Declare value/error wire schemas on the tag:

class Health extends Process.Tag<Health>()("app/Health") {}

class Prices extends Process.Tag<Prices>()("app/Prices", PriceSchema) {}

class PricesE extends Process.Tag<PricesE>()("app/Prices", PriceSchema, FetchErr) {}

class PricesCfg extends Process.Tag<PricesCfg>()("app/Prices", {
  success: PriceSchema,
  error: FetchErr,
}) {}

Pass options.node to bind the process to a Node.Tag.

constructorsscheduleNode.Tag
Source src/Process.ts:222127 lines
export const Tag = <Self>() => {
  function build(
    key: string,
    second?: Schema.Top | ProcessTagOptions,
    third?: Schema.Top,
  ): HyperlinkTag<Self, ProcessSpec> | NodeBoundTag<Self, ProcessSpec, unknown> {
    if (second === undefined) {
      return buildProcessTag<Self>(key, undefined);
    }
    if (Schema.isSchema(second)) {
      return buildProcessTag<Self>(key, undefined, {
        success: second,
        error: third,
      });
    }
    if (isProcessTagOptions(second)) {
      return buildProcessTag<Self>(key, second);
    }
    return buildProcessTag<Self>(key, undefined);
  }
  // The single, guarded cast: an overloaded *function* (`build`) isn't structurally assignable to a
  // call-signature *object* type (`ProcessTagBuild<Self>`) even when it implements exactly those
  // overloads — a known TS limitation (the same class as QueueHyperlink's `nameQueueService` cast).
  // It's soundness-guarded: `process-built-resource` / `process-contract-shape` .test-d.ts exercise
  // `Process.Tag()` in every form, so a drift between `build` and `ProcessTagBuild` fails the build.
  return build as ProcessTagBuild<Self>;
};