<Su extends Schema.Top>(success: Su): RefField<
Method<undefined, Su, typeof Schema.Never, true>
>Define a ref field — reactive state surfaced as a Subscribable (get + changes),
uniform local and remote. The impl owns a SubscriptionRef (writes it) and provides it via
subscribable; consumers read (yield* svc.x.get) and observe (svc.x.changes) — a read
is an honest Effect, not a synchronous peek. For values fixed at acquire use constant; for on-demand
calls use effect.
export const const ref: <Su extends Schema.Top>(
success: Su
) => RefField<
Method<undefined, Su, typeof Schema.Never, true>
>
Define a ref field — reactive state surfaced as a
Subscribable
(get + changes),
uniform local and remote. The impl owns a SubscriptionRef (writes it) and provides it via
subscribable
; consumers read (yield* svc.x.get) and observe (svc.x.changes) — a read
is an honest Effect, not a synchronous peek. For values fixed at acquire use constant; for on-demand
calls use effect.
ref = <function (type parameter) Su in <Su extends Schema.Top>(success: Su): RefField<Method<undefined, Su, typeof Schema.Never, true>>Su extends import SchemaSchema.Top>(
success: Su extends Schema.Topsuccess: function (type parameter) Su in <Su extends Schema.Top>(success: Su): RefField<Method<undefined, Su, typeof Schema.Never, true>>Su,
): type RefField<M extends AnyMethod> = Omit<
M,
"annotate"
> & {
readonly _tag: "ref"
} & {
readonly annotate: <
A extends MethodAnnotations
>(
a: A
) => Marked<
Method<
M["payload"],
M["success"],
M["error"],
M["stream"],
M["annotations"] & A,
Derive
>,
{
readonly _tag: "ref"
}
>
}
A
Method
marked as a ref field (via
ref
) — surfaces as a
Subscribable
.
Tagged with a readable _tag: "ref".
RefField<interface Method<P extends Schema.Struct.Fields | Schema.Top | undefined, Su extends Schema.Top, E extends Schema.Top, Str extends boolean = false, Ann extends MethodAnnotations = MethodAnnotations, Client = Derive>One method of a resource contract — built by
effect
/
effectFn
/
Hyperlink.stream
. Carries its kind, schemas
(payload / success / error), whether it's a stream (a push source vs a one-shot
read), and tool annotations. .annotate({...}) returns a copy with merged annotations,
mirroring Effect's schema idiom.
For a streaming method, success is the element schema and error is the stream
error schema — they become an RpcSchema.Stream on the wire, and the service member
surfaces as a Stream rather than an Effect.
Method<undefined, function (type parameter) Su in <Su extends Schema.Top>(success: Su): RefField<Method<undefined, Su, typeof Schema.Never, true>>Su, typeof import SchemaSchema.const Never: Schema.Neverconst Never: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<never, readonly []>) => Schema.Never;
annotateKey: (annotations: Schema.Annotations.Key<never>) => Schema.Never;
check: (checks_0: Check<never>, ...checks: Array<Check<never>>) => Schema.Never;
rebuild: (ast: Never) => Schema.Never;
make: (input: never, options?: Schema.MakeOptions) => never;
makeOption: (input: never, options?: Schema.MakeOptions) => Option.Option<never>;
makeEffect: (input: never, options?: Schema.MakeOptions) => Effect.Effect<never, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
Never
.
Schema for the never type. Always fails validation — no value satisfies it.
Never, true>> =>
const marked: <
M extends AnyMethod,
Mark extends object
>(
method: M,
mark: Mark
) => Marked<M, Mark>
Attach a shape marker whose .annotate() preserves it (rebuilds the marker after annotating).
marked(function stream<Su>(success: Su): Method<undefined, Su, Schema.Never, true, MethodAnnotations, Derive> (+5 overloads)Define a stream (a live, idempotent push source) whose elements are success. The
service member surfaces as a Stream<Success, Error> (a property, or (payload) => Stream
when a payload is declared) rather than an Effect — drive dashboard atoms, a CLI
--watch, or a TUI from it. Conventionally named changes when it carries a resource's
whole observable state (a snapshot stream); back it with a SubscriptionRef's .changes.
Counts as a query for tools (an idempotent read). success is the element schema and
error (if any) is the stream error schema; both must be encodable (they cross RPC).
payload is a single schema or struct fields — same as Effect's Rpc.make.
changes: Hyperlink.stream(QueueSnapshot).annotate({ description: "Live queue state." }),
tail: Hyperlink.stream(LogLine, { payload: Schema.Struct({ since: Schema.Number }) }),
stream(success: Su extends Schema.Topsuccess), { _tag: "ref"_tag: "ref" as type const = "ref"const });