<const S extends Spec, HSelf>(
groupId: string,
spec: S,
options: {
readonly description?: string
readonly kind?: string
readonly node: AddressedNode<HSelf>
}
): {
<Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>
}
readonly groupId: string
readonly description: string | undefined
readonly [specSym]: FlatSpec
readonly [specTypeSym]?: S
readonly [groupSym]: RpcGroupOf<S>
}
<const S extends Spec, HSelf>(
groupId: string,
spec: S,
options: {
readonly description?: string
readonly kind?: string
readonly node: NodeKey<HSelf>
}
): NodeTagFactory<S, HSelf>
<const S extends Spec>(
groupId: string,
spec: S,
options?: { readonly description?: string; readonly kind?: string }
): TagFactory<S>Build a factory tag-maker that bakes a shared Spec once under a groupId:
every instance shares the same contract + RPC group, and callers never pass the spec
— only an instance key. Use for resource families (many instances, one contract). The
groupId (e.g. "queue") is the wire prefix for the family's procedures, so a shared
RpcServer can node this family next to other resource types without tag collisions;
instances are told apart by the per-call key header.
Pass options.node to bind the whole family to a Node: every instance becomes a
node-bearing tag and ships only-the-tag (see Hyperlink.client / Hyperlink.connect).
const Queue = Hyperlink.tagFor("queue", { pause: Hyperlink.effect(Schema.Void) });
class Jobs extends Queue<Jobs>("@app/Jobs") {} // spec baked in; just the instance key
class Mail extends Queue<Mail>("@app/Mail") {} // shares contract + group, routed by keyfunction function tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: AddressedNode<HSelf>;
}): {
<Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>;
};
readonly groupId: string;
readonly description: string | undefined;
readonly [specSym]: FlatSpec;
readonly [specTypeSym]?: S;
readonly [groupSym]: RpcGroupOf<S>;
} (+2 overloads)
Build a factory tag-maker that bakes a shared
Spec
once under a groupId:
every instance shares the same contract + RPC group, and callers never pass the spec
— only an instance key. Use for resource families (many instances, one contract). The
groupId (e.g. "queue") is the wire prefix for the family's procedures, so a shared
RpcServer can node this family next to other resource types without tag collisions;
instances are told apart by the per-call key header.
Pass options.node to bind the whole family to a
Node
: every instance becomes a
node-bearing tag and ships only-the-tag (see
Hyperlink.client
/
Hyperlink.connect
).
const Queue = Hyperlink.tagFor("queue", { pause: Hyperlink.effect(Schema.Void) });
class Jobs extends Queue<Jobs>("@app/Jobs") {} // spec baked in; just the instance key
class Mail extends Queue<Mail>("@app/Mail") {} // shares contract + group, routed by key
tagFor<const function (type parameter) S in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: AddressedNode<HSelf>;
}): {
<Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>;
};
readonly groupId: string;
readonly description: string | undefined;
readonly [specSym]: FlatSpec;
readonly [specTypeSym]?: S;
readonly [groupSym]: RpcGroupOf<S>;
}
S extends Spec, function (type parameter) HSelf in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: AddressedNode<HSelf>;
}): {
<Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>;
};
readonly groupId: string;
readonly description: string | undefined;
readonly [specSym]: FlatSpec;
readonly [specTypeSym]?: S;
readonly [groupSym]: RpcGroupOf<S>;
}
HSelf>(
groupId: stringgroupId: string,
spec: const S extends Specspec: function (type parameter) S in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: AddressedNode<HSelf>;
}): {
<Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>;
};
readonly groupId: string;
readonly description: string | undefined;
readonly [specSym]: FlatSpec;
readonly [specTypeSym]?: S;
readonly [groupSym]: RpcGroupOf<S>;
}
S,
options: {
readonly description?: string
readonly kind?: string
readonly node: AddressedNode<HSelf>
}
options: {
readonly description?: string | undefineddescription?: string;
readonly kind?: string | undefinedkind?: string;
readonly node: AddressedNode<HSelf>node: import AddressedNodeAddressedNode<function (type parameter) HSelf in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: AddressedNode<HSelf>;
}): {
<Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>;
};
readonly groupId: string;
readonly description: string | undefined;
readonly [specSym]: FlatSpec;
readonly [specTypeSym]?: S;
readonly [groupSym]: RpcGroupOf<S>;
}
HSelf>;
},
): {
<function (type parameter) Self in <Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>;
}
Self>(key: stringkey: string): interface NodeBoundTag<Self, S extends Spec, HSelf, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>A
HyperlinkTag
bound to a concrete
Node
— its [nodeSym] narrowed to that node's
NodeKey<HSelf>, which is how
Hyperlink.client
discriminates the node-aware path. Returned
by the node-bearing tag constructors. It's a named type (not an inline & { [nodeSym] }) so a
consumer can export a node-bearing tag without leaking the internal symbol (TS4020).
NodeBoundTag<function (type parameter) Self in <Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>;
}
Self, function (type parameter) S in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: AddressedNode<HSelf>;
}): {
<Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>;
};
readonly groupId: string;
readonly description: string | undefined;
readonly [specSym]: FlatSpec;
readonly [specTypeSym]?: S;
readonly [groupSym]: RpcGroupOf<S>;
}
S, function (type parameter) HSelf in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: AddressedNode<HSelf>;
}): {
<Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>;
};
readonly groupId: string;
readonly description: string | undefined;
readonly [specSym]: FlatSpec;
readonly [specTypeSym]?: S;
readonly [groupSym]: RpcGroupOf<S>;
}
HSelf> & {
readonly [const nodeSym: typeof nodeSymWhere the resource's
Node
(if any) is stowed on a Tag.
nodeSym]: import AddressedNodeAddressedNode<function (type parameter) HSelf in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: AddressedNode<HSelf>;
}): {
<Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>;
};
readonly groupId: string;
readonly description: string | undefined;
readonly [specSym]: FlatSpec;
readonly [specTypeSym]?: S;
readonly [groupSym]: RpcGroupOf<S>;
}
HSelf>;
};
readonly groupId: stringgroupId: string;
readonly description: string | undefineddescription: string | undefined;
readonly [const specSym: typeof specSymWhere the contract spec is stowed on a Tag (hidden from the value surface). Exported so
the public
HyperlinkTag
type is nameable across modules.
specSym]: type FlatSpec = {
[x: string]: AnyMethod | AnyLocalMethod
}
A flat spec — a path-keyed record of leaves (no nested groups). The wire machinery runs on this;
a (possibly nested)
Spec
flattens to it via
flattenSpec
.
FlatSpec;
readonly [const specTypeSym: typeof specTypeSymPhantom carrier of a tag's (possibly nested) spec type S, so functions can infer S from a tag —
specSym
holds the flat spec at runtime and can't carry the nested S. Type-only, never set at
runtime.
specTypeSym]?: function (type parameter) S in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: AddressedNode<HSelf>;
}): {
<Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>;
};
readonly groupId: string;
readonly description: string | undefined;
readonly [specSym]: FlatSpec;
readonly [specTypeSym]?: S;
readonly [groupSym]: RpcGroupOf<S>;
}
S;
readonly [const groupSym: typeof groupSymWhere the built RPC group is stowed on a Tag.
groupSym]: type RpcGroupOf<S extends Spec> =
RpcGroup.RpcGroup<RpcUnionOf<S, "">>
The precisely-typed RPC contract group for a
Spec
. Carrying this exact type
(rather than a loose Rpc<string, …>) is what keeps the remote client's requirement
channel honest: concrete schemas declare never encoding/decoding services, so
RpcClient.make infers a real R (just the transport Protocol) instead of any.
RpcGroupOf<function (type parameter) S in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: AddressedNode<HSelf>;
}): {
<Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>;
};
readonly groupId: string;
readonly description: string | undefined;
readonly [specSym]: FlatSpec;
readonly [specTypeSym]?: S;
readonly [groupSym]: RpcGroupOf<S>;
}
S>;
};
function function tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: NodeKey<HSelf>;
}): NodeTagFactory<S, HSelf> (+2 overloads)
Build a factory tag-maker that bakes a shared
Spec
once under a groupId:
every instance shares the same contract + RPC group, and callers never pass the spec
— only an instance key. Use for resource families (many instances, one contract). The
groupId (e.g. "queue") is the wire prefix for the family's procedures, so a shared
RpcServer can node this family next to other resource types without tag collisions;
instances are told apart by the per-call key header.
Pass options.node to bind the whole family to a
Node
: every instance becomes a
node-bearing tag and ships only-the-tag (see
Hyperlink.client
/
Hyperlink.connect
).
const Queue = Hyperlink.tagFor("queue", { pause: Hyperlink.effect(Schema.Void) });
class Jobs extends Queue<Jobs>("@app/Jobs") {} // spec baked in; just the instance key
class Mail extends Queue<Mail>("@app/Mail") {} // shares contract + group, routed by key
tagFor<const function (type parameter) S in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: NodeKey<HSelf>;
}): NodeTagFactory<S, HSelf>
S extends Spec, function (type parameter) HSelf in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: NodeKey<HSelf>;
}): NodeTagFactory<S, HSelf>
HSelf>(
groupId: stringgroupId: string,
spec: const S extends Specspec: function (type parameter) S in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: NodeKey<HSelf>;
}): NodeTagFactory<S, HSelf>
S,
options: {
readonly description?: string
readonly kind?: string
readonly node: NodeKey<HSelf>
}
options: { readonly description?: string | undefineddescription?: string; readonly kind?: string | undefinedkind?: string; readonly node: NodeKey<HSelf>node: import NodeKeyNodeKey<function (type parameter) HSelf in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: NodeKey<HSelf>;
}): NodeTagFactory<S, HSelf>
HSelf> },
): interface NodeTagFactory<S extends Spec, HSelf>A node-bearing
tagFor
factory: every instance it makes carries the family's
Node
, so each is a node-bearing tag (
Hyperlink.client
resolves the transport
from it). Otherwise identical to
TagFactory
.
NodeTagFactory<function (type parameter) S in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: NodeKey<HSelf>;
}): NodeTagFactory<S, HSelf>
S, function (type parameter) HSelf in tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: NodeKey<HSelf>;
}): NodeTagFactory<S, HSelf>
HSelf>;
function function tagFor<const S extends Spec>(groupId: string, spec: S, options?: {
readonly description?: string;
readonly kind?: string;
}): TagFactory<S> (+2 overloads)
Build a factory tag-maker that bakes a shared
Spec
once under a groupId:
every instance shares the same contract + RPC group, and callers never pass the spec
— only an instance key. Use for resource families (many instances, one contract). The
groupId (e.g. "queue") is the wire prefix for the family's procedures, so a shared
RpcServer can node this family next to other resource types without tag collisions;
instances are told apart by the per-call key header.
Pass options.node to bind the whole family to a
Node
: every instance becomes a
node-bearing tag and ships only-the-tag (see
Hyperlink.client
/
Hyperlink.connect
).
const Queue = Hyperlink.tagFor("queue", { pause: Hyperlink.effect(Schema.Void) });
class Jobs extends Queue<Jobs>("@app/Jobs") {} // spec baked in; just the instance key
class Mail extends Queue<Mail>("@app/Mail") {} // shares contract + group, routed by key
tagFor<const function (type parameter) S in tagFor<const S extends Spec>(groupId: string, spec: S, options?: {
readonly description?: string;
readonly kind?: string;
}): TagFactory<S>
S extends Spec>(
groupId: stringgroupId: string,
spec: const S extends Specspec: function (type parameter) S in tagFor<const S extends Spec>(groupId: string, spec: S, options?: {
readonly description?: string;
readonly kind?: string;
}): TagFactory<S>
S,
options: | {
readonly description?: string
readonly kind?: string
}
| undefined
options?: { readonly description?: string | undefineddescription?: string; readonly kind?: string | undefinedkind?: string },
): interface TagFactory<S extends Spec>A
tagFor
factory: <Self>(key) => tag, plus the shared family metadata
(groupId / description / spec / group) that
serveInstances
reads without an
instance.
TagFactory<function (type parameter) S in tagFor<const S extends Spec>(groupId: string, spec: S, options?: {
readonly description?: string;
readonly kind?: string;
}): TagFactory<S>
S>;
function function tagFor<const S extends Spec, HSelf>(groupId: string, spec: S, options: {
readonly description?: string;
readonly kind?: string;
readonly node: AddressedNode<HSelf>;
}): {
<Self>(key: string): NodeBoundTag<Self, S, HSelf> & {
readonly [nodeSym]: AddressedNode<HSelf>;
};
readonly groupId: string;
readonly description: string | undefined;
readonly [specSym]: FlatSpec;
readonly [specTypeSym]?: S;
readonly [groupSym]: RpcGroupOf<S>;
} (+2 overloads)
Build a factory tag-maker that bakes a shared
Spec
once under a groupId:
every instance shares the same contract + RPC group, and callers never pass the spec
— only an instance key. Use for resource families (many instances, one contract). The
groupId (e.g. "queue") is the wire prefix for the family's procedures, so a shared
RpcServer can node this family next to other resource types without tag collisions;
instances are told apart by the per-call key header.
Pass options.node to bind the whole family to a
Node
: every instance becomes a
node-bearing tag and ships only-the-tag (see
Hyperlink.client
/
Hyperlink.connect
).
const Queue = Hyperlink.tagFor("queue", { pause: Hyperlink.effect(Schema.Void) });
class Jobs extends Queue<Jobs>("@app/Jobs") {} // spec baked in; just the instance key
class Mail extends Queue<Mail>("@app/Mail") {} // shares contract + group, routed by key
tagFor<const function (type parameter) S in tagFor<const S extends Spec>(groupId: string, spec: S, options?: {
readonly description?: string;
readonly kind?: string;
readonly node?: NodeKey<unknown>;
}): TagFactory<S>
S extends Spec>(
groupId: stringgroupId: string,
spec: const S extends Specspec: function (type parameter) S in tagFor<const S extends Spec>(groupId: string, spec: S, options?: {
readonly description?: string;
readonly kind?: string;
readonly node?: NodeKey<unknown>;
}): TagFactory<S>
S,
options: | {
readonly description?: string
readonly kind?: string
readonly node?: NodeKey<unknown>
}
| undefined
options?: { readonly description?: string | undefineddescription?: string; readonly kind?: string | undefinedkind?: string; readonly node?: anynode?: import NodeKeyNodeKey<unknown> },
): interface TagFactory<S extends Spec>A
tagFor
factory: <Self>(key) => tag, plus the shared family metadata
(groupId / description / spec / group) that
serveInstances
reads without an
instance.
TagFactory<function (type parameter) S in tagFor<const S extends Spec>(groupId: string, spec: S, options?: {
readonly description?: string;
readonly kind?: string;
readonly node?: NodeKey<unknown>;
}): TagFactory<S>
S> {
const claimGroupId: (
groupId: string
) => void
Reserve a group id (wire prefix); a duplicate throws — two resources can't share a prefix.
claimGroupId(groupId: stringgroupId);
const const group: RpcGroup.RpcGroup<any>const group: {
requests: ReadonlyMap<string, R>;
annotations: Context.Context<never>;
add: (...rpcs: Rpcs2) => RpcGroup.RpcGroup<any>;
merge: (...groups: Groups) => RpcGroup.RpcGroup<any>;
omit: (...tags: Tags) => RpcGroup.RpcGroup<any>;
middleware: (middleware: M) => RpcGroup.RpcGroup<Rpc.Rpc<string, Schema.Top, Schema.Top, Schema.Top, AnyService | M, ApplyServices<M['Identifier'], unknown>>>;
prefix: (prefix: Prefix) => RpcGroup.RpcGroup<Rpc.Rpc<`${Prefix}${string}`, Schema.Top, Schema.Top, Schema.Top, AnyService, unknown>>;
toHandlers: (build: Handlers | Effect.Effect<Handlers, EX, RX>) => Effect.Effect<Context.Context<Rpc.Handler<string>>, EX, RX | RpcGroup.HandlersServices<any, Handlers>>;
toLayer: (build: Handlers | Effect.Effect<Handlers, EX, RX>) => Layer.Layer<Rpc.Handler<string>, EX, Exclude<RX, Scope.Scope> | RpcGroup.HandlersServices<any, Handlers>>;
of: (handlers: Handlers) => Handlers;
toLayerHandler: (tag: Tag, build: Handler | Effect.Effect<Handler, EX, RX>) => Layer.Layer<Rpc.Handler<Tag>, EX, Exclude<RX, Scope.Scope> | (Handler extends (...args: any) => Stream.Stream<infer _A, infer _E, infer _R> | Rpc.Wrapper<Stream.Stream<infer _A…;
accessHandler: (tag: Tag) => Effect.Effect<(payload: unknown, options: { readonly client: Rpc.ServerClient; readonly requestId: RequestId; readonly headers: Headers.Headers }) => Effect.Effect<unknown, unknown, never>, never, Rpc.Handler<Tag>>;
annotate: (service: Context.Key<I, S>, value: S) => RpcGroup.RpcGroup<any>;
annotateRpcs: (service: Context.Key<I, S>, value: S) => RpcGroup.RpcGroup<any>;
annotateMerge: (annotations: Context.Context<S>) => RpcGroup.RpcGroup<any>;
annotateRpcsMerge: (annotations: Context.Context<S>) => RpcGroup.RpcGroup<any>;
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; <…;
}
group = const buildRpcGroup: (
groupId: string,
spec: FlatSpec
) => RpcGroup.RpcGroup<any>
Build the shared RPC contract group from a
Spec
, namespaced by groupId. A bare
Schema becomes a payload-free rpc returning that schema; a descriptor maps straight to
its parts. Every procedure's wire tag is
wireTag
-prefixed by groupId.
buildRpcGroup(groupId: stringgroupId, const flattenSpec: (
spec: Spec,
prefix?: string
) => FlatSpec
Flatten a nested spec to a flat path-keyed record (identity for a flat spec).
flattenSpec(spec: const S extends Specspec));
const const node: anynode = options: | {
readonly description?: string
readonly kind?: string
readonly node?: NodeKey<unknown>
}
| undefined
options?.node?: anynode;
const const factory: <Self>(key: string) => Context.ServiceClass<Self, string, Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends {
readonly _tag: "constant";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
readonly _tag: "ref";
} ? Subscribable<SuccessOf<AsMethod<S[K]>>> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>> & {
...;
}
factory = <function (type parameter) Self in <Self>(key: string): Context.ServiceClass<Self, string, Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<...> ? LocalEffect<...> : S[K] extends {
...;
} ? SuccessOf<...> : S[K] extends {
...;
} ? Subscribable<...> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>> & {
...;
}
Self>(key: stringkey: string) =>
const buildInstanceTag: <Self, S>(groupId: string, key: string, spec: Spec, group: RpcGroupOf<S>, description: string | undefined, node: NodeKey<unknown> | undefined, kindOverride: string | undefined, fromServiceMarker?: boolean) => Context.ServiceClass<Self, string, Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends {
readonly _tag: "constant";
} ? SuccessOf<...> : S[K] extends {
...;
} ? Subscribable<...> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>> & {
...;
}
The single tag-creation primitive: dup-key guard + Context.Service + stow groupId/spec/group.
Both
makeTag
(per-tag spec) and
tagFor
(shared spec) go through it. key is the
instance identity (Context key + routing header); groupId is the wire prefix.
buildInstanceTag<function (type parameter) Self in <Self>(key: string): Context.ServiceClass<Self, string, Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<...> ? LocalEffect<...> : S[K] extends {
...;
} ? SuccessOf<...> : S[K] extends {
...;
} ? Subscribable<...> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>> & {
...;
}
Self, function (type parameter) S in tagFor<const S extends Spec>(groupId: string, spec: S, options?: {
readonly description?: string;
readonly kind?: string;
readonly node?: NodeKey<unknown>;
}): TagFactory<S>
S>(
groupId: stringgroupId,
key: stringkey,
spec: const S extends Specspec,
const group: RpcGroup.RpcGroup<any>const group: {
requests: ReadonlyMap<string, R>;
annotations: Context.Context<never>;
add: (...rpcs: Rpcs2) => RpcGroup.RpcGroup<any>;
merge: (...groups: Groups) => RpcGroup.RpcGroup<any>;
omit: (...tags: Tags) => RpcGroup.RpcGroup<any>;
middleware: (middleware: M) => RpcGroup.RpcGroup<Rpc.Rpc<string, Schema.Top, Schema.Top, Schema.Top, AnyService | M, ApplyServices<M['Identifier'], unknown>>>;
prefix: (prefix: Prefix) => RpcGroup.RpcGroup<Rpc.Rpc<`${Prefix}${string}`, Schema.Top, Schema.Top, Schema.Top, AnyService, unknown>>;
toHandlers: (build: Handlers | Effect.Effect<Handlers, EX, RX>) => Effect.Effect<Context.Context<Rpc.Handler<string>>, EX, RX | RpcGroup.HandlersServices<any, Handlers>>;
toLayer: (build: Handlers | Effect.Effect<Handlers, EX, RX>) => Layer.Layer<Rpc.Handler<string>, EX, Exclude<RX, Scope.Scope> | RpcGroup.HandlersServices<any, Handlers>>;
of: (handlers: Handlers) => Handlers;
toLayerHandler: (tag: Tag, build: Handler | Effect.Effect<Handler, EX, RX>) => Layer.Layer<Rpc.Handler<Tag>, EX, Exclude<RX, Scope.Scope> | (Handler extends (...args: any) => Stream.Stream<infer _A, infer _E, infer _R> | Rpc.Wrapper<Stream.Stream<infer _A…;
accessHandler: (tag: Tag) => Effect.Effect<(payload: unknown, options: { readonly client: Rpc.ServerClient; readonly requestId: RequestId; readonly headers: Headers.Headers }) => Effect.Effect<unknown, unknown, never>, never, Rpc.Handler<Tag>>;
annotate: (service: Context.Key<I, S>, value: S) => RpcGroup.RpcGroup<any>;
annotateRpcs: (service: Context.Key<I, S>, value: S) => RpcGroup.RpcGroup<any>;
annotateMerge: (annotations: Context.Context<S>) => RpcGroup.RpcGroup<any>;
annotateRpcsMerge: (annotations: Context.Context<S>) => RpcGroup.RpcGroup<any>;
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; <…;
}
group,
options: | {
readonly description?: string
readonly kind?: string
readonly node?: NodeKey<unknown>
}
| undefined
options?.description?: string | undefineddescription,
const node: anynode,
options: | {
readonly description?: string
readonly kind?: string
readonly node?: NodeKey<unknown>
}
| undefined
options?.kind?: string | undefinedkind,
);
// Stow the shared groupId/description/spec/group on the factory too, so the family
// server ({@link serveInstances}) can read the contract + prefix without an instance.
return var Object: ObjectConstructorProvides functionality common to all JavaScript objects.
Object.ObjectConstructor.assign<<Self>(key: string) => Context.ServiceClass<Self, string, Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends {
readonly _tag: "constant";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
readonly _tag: "ref";
} ? Subscribable<SuccessOf<AsMethod<S[K]>>> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>> & {
...;
}, {
...;
}>(target: <Self>(key: string) => Context.ServiceClass<Self, string, Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends {
readonly _tag: "constant";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
readonly _tag: "ref";
} ? Subscribable<SuccessOf<AsMethod<S[K]>>> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>> & {
...;
}, source: {
...;
}): (<Self>(key: string) => Context.ServiceClass<Self, string, Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends {
readonly _tag: "constant";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
readonly _tag: "ref";
} ? Subscribable<SuccessOf<AsMethod<S[K]>>> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>> & {
...;
}) & {
...;
} (+3 overloads)
Copy the values of all of the enumerable own properties from one or more source objects to a
target object. Returns the target object.
assign(const factory: <Self>(key: string) => Context.ServiceClass<Self, string, Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends {
readonly _tag: "constant";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
readonly _tag: "ref";
} ? Subscribable<SuccessOf<AsMethod<S[K]>>> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>> & {
...;
}
factory, {
groupId: stringgroupId,
description: string | undefineddescription: options: | {
readonly description?: string
readonly kind?: string
readonly node?: NodeKey<unknown>
}
| undefined
options?.description?: string | undefineddescription,
[const specSym: typeof specSymWhere the contract spec is stowed on a Tag (hidden from the value surface). Exported so
the public
HyperlinkTag
type is nameable across modules.
specSym]: const flattenSpec: (
spec: Spec,
prefix?: string
) => FlatSpec
Flatten a nested spec to a flat path-keyed record (identity for a flat spec).
flattenSpec(spec: const S extends Specspec),
[const groupSym: typeof groupSymWhere the built RPC group is stowed on a Tag.
groupSym]: const group: RpcGroup.RpcGroup<any>const group: {
requests: ReadonlyMap<string, R>;
annotations: Context.Context<never>;
add: (...rpcs: Rpcs2) => RpcGroup.RpcGroup<any>;
merge: (...groups: Groups) => RpcGroup.RpcGroup<any>;
omit: (...tags: Tags) => RpcGroup.RpcGroup<any>;
middleware: (middleware: M) => RpcGroup.RpcGroup<Rpc.Rpc<string, Schema.Top, Schema.Top, Schema.Top, AnyService | M, ApplyServices<M['Identifier'], unknown>>>;
prefix: (prefix: Prefix) => RpcGroup.RpcGroup<Rpc.Rpc<`${Prefix}${string}`, Schema.Top, Schema.Top, Schema.Top, AnyService, unknown>>;
toHandlers: (build: Handlers | Effect.Effect<Handlers, EX, RX>) => Effect.Effect<Context.Context<Rpc.Handler<string>>, EX, RX | RpcGroup.HandlersServices<any, Handlers>>;
toLayer: (build: Handlers | Effect.Effect<Handlers, EX, RX>) => Layer.Layer<Rpc.Handler<string>, EX, Exclude<RX, Scope.Scope> | RpcGroup.HandlersServices<any, Handlers>>;
of: (handlers: Handlers) => Handlers;
toLayerHandler: (tag: Tag, build: Handler | Effect.Effect<Handler, EX, RX>) => Layer.Layer<Rpc.Handler<Tag>, EX, Exclude<RX, Scope.Scope> | (Handler extends (...args: any) => Stream.Stream<infer _A, infer _E, infer _R> | Rpc.Wrapper<Stream.Stream<infer _A…;
accessHandler: (tag: Tag) => Effect.Effect<(payload: unknown, options: { readonly client: Rpc.ServerClient; readonly requestId: RequestId; readonly headers: Headers.Headers }) => Effect.Effect<unknown, unknown, never>, never, Rpc.Handler<Tag>>;
annotate: (service: Context.Key<I, S>, value: S) => RpcGroup.RpcGroup<any>;
annotateRpcs: (service: Context.Key<I, S>, value: S) => RpcGroup.RpcGroup<any>;
annotateMerge: (annotations: Context.Context<S>) => RpcGroup.RpcGroup<any>;
annotateRpcsMerge: (annotations: Context.Context<S>) => RpcGroup.RpcGroup<any>;
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; <…;
}
group,
});
}