<Self, S extends Spec>(
tag: HyperlinkTag<Self, S>,
impl: WireServiceOf<S>
): HyperlinkInstance<S>Pair a factory instance tag with its implementation, for Hyperlink.serveInstances.
Not how you serve a single custom resource on a shared node: this returns a
HyperlinkInstance for the serveInstances family. To serve a custom Hyperlink.Tag
alongside queues/processes, pass its Hyperlink.serve layer to Node.httpServer,
then reach it with Hyperlink.client.
const const instance: <Self, S extends Spec>(
tag: HyperlinkTag<Self, S>,
impl: WireServiceOf<S>
) => HyperlinkInstance<S>
Pair a factory instance tag with its implementation, for
Hyperlink.serveInstances
.
Not how you serve a single custom resource on a shared node: this returns a
HyperlinkInstance
for the
serveInstances
family. To serve a custom Hyperlink.Tag
alongside queues/processes, pass its
Hyperlink.serve
layer to
Node.httpServer
,
then reach it with
Hyperlink.client
.
instance = <function (type parameter) Self in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, impl: WireServiceOf<S>): HyperlinkInstance<S>Self, function (type parameter) S in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, impl: WireServiceOf<S>): HyperlinkInstance<S>S extends Spec>(
tag: HyperlinkTag<Self, S>(parameter) tag: {
groupId: string;
description: string | undefined;
key: Identifier;
of: (this: void, self: 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…;
context: (self: 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[…;
use: (f: (service: 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<AsMe…;
useSync: (f: (service: 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<AsMe…;
Identifier: Identifier;
Service: Shape;
stack: string | undefined;
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; <…;
toString: () => string;
toJSON: () => unknown;
}
tag: interface HyperlinkTag<Self, S extends Spec, 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; }>>The type of a resource tag carrying spec S — what
Hyperlink.Tag
/ a
Hyperlink.tagFor
factory produce (and what you extend). Lets a consumer write
<S extends Spec>(tag: HyperlinkTag<Self, S>) and read the spec through named types
(
specOf
/
groupOf
) instead of a Parameters<typeof specOf> workaround.
HyperlinkTag<function (type parameter) Self in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, impl: WireServiceOf<S>): HyperlinkInstance<S>Self, function (type parameter) S in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, impl: WireServiceOf<S>): HyperlinkInstance<S>S>,
impl: WireServiceOf<S>impl: type WireServiceOf<S extends Spec> = {
readonly [K in keyof S as S[K] extends AnyLocalMethod
? never
: K]: S[K] extends {
readonly _tag: "ref"
}
? Subscribable<SuccessOf<AsMethod<S[K]>>>
: S[K] extends {
readonly kind: MethodKind
}
? ServiceMethod<AsMethod<S[K]>>
: S[K] extends Spec
? WireServiceOf<S[K]>
: never
}
The wire-only service: just the
Method
s (used by the server impl + forwarder).
WireServiceOf<function (type parameter) S in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, impl: WireServiceOf<S>): HyperlinkInstance<S>S>,
): interface HyperlinkInstance<S extends Spec>One instance of a factory paired with its implementation — the element of
Hyperlink.serveInstances
. Built by
Hyperlink.instance
.
HyperlinkInstance<function (type parameter) S in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, impl: WireServiceOf<S>): HyperlinkInstance<S>S> => ({ HyperlinkInstance<S>.key: stringkey: tag: HyperlinkTag<Self, S>(parameter) tag: {
groupId: string;
description: string | undefined;
key: Identifier;
of: (this: void, self: 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…;
context: (self: 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[…;
use: (f: (service: 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<AsMe…;
useSync: (f: (service: 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<AsMe…;
Identifier: Identifier;
Service: Shape;
stack: string | undefined;
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; <…;
toString: () => string;
toJSON: () => unknown;
}
tag.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; }>>.key: stringkey, HyperlinkInstance<S>.impl: WireServiceOf<S>impl });