<
Self,
const ClientId extends string,
Client extends Context.ServiceClass<any, ClientId, any>
>(
tag: ApiMetricsTag<Self> & { readonly [clientIdSym]: ClientId },
_client: Client,
options?: ApiMetricsTagOptions
): Layer.Layer<Self, never, Scope.Scope>Like layer, but takes the outbound client's Service class as a witness so the compiler
proves the metrics tag's clientId matches that client's Context key (correct by construction).
_client is type-only — erased at runtime; the layer is exactly layer(tag, options).
export const const layerFor: <
Self,
ClientId extends string,
Client extends Context.ServiceClass<
any,
ClientId,
any
>
>(
tag: ApiMetricsTag<Self> & {
readonly [clientIdSym]: ClientId
},
_client: Client,
options?: ApiMetricsTagOptions
) => Layer.Layer<Self, never, Scope.Scope>
Like
layer
, but takes the outbound client's Service class as a witness so the compiler
proves the metrics tag's clientId matches that client's Context key (correct by construction).
_client is type-only — erased at runtime; the layer is exactly layer(tag, options).
layerFor = <
function (type parameter) Self in <Self, const ClientId extends string, Client extends Context.ServiceClass<any, ClientId, any>>(tag: ApiMetricsTag<Self> & {
readonly [clientIdSym]: ClientId;
}, _client: Client, options?: ApiMetricsTagOptions): Layer.Layer<Self, never, Scope.Scope>
Self,
const function (type parameter) ClientId in <Self, const ClientId extends string, Client extends Context.ServiceClass<any, ClientId, any>>(tag: ApiMetricsTag<Self> & {
readonly [clientIdSym]: ClientId;
}, _client: Client, options?: ApiMetricsTagOptions): Layer.Layer<Self, never, Scope.Scope>
ClientId extends string,
function (type parameter) Client in <Self, const ClientId extends string, Client extends Context.ServiceClass<any, ClientId, any>>(tag: ApiMetricsTag<Self> & {
readonly [clientIdSym]: ClientId;
}, _client: Client, options?: ApiMetricsTagOptions): Layer.Layer<Self, never, Scope.Scope>
Client extends import ContextContext.interface ServiceClass<in out Self, in out Identifier extends string, in out Shape>Class-style service key produced by Context.Service<Self, Shape>()("Id").
When to use
Use when declaring a service as a class so the class value can serve as the
Context key.
Details
The class itself is the Context key, and its string key identifies the
service at runtime.
Namespace containing helper types for class-style Context.Service
declarations.
ServiceClass<any, function (type parameter) ClientId in <Self, const ClientId extends string, Client extends Context.ServiceClass<any, ClientId, any>>(tag: ApiMetricsTag<Self> & {
readonly [clientIdSym]: ClientId;
}, _client: Client, options?: ApiMetricsTagOptions): Layer.Layer<Self, never, Scope.Scope>
ClientId, any>,
>(
tag: ApiMetricsTag<Self> & {
readonly [clientIdSym]: ClientId
}
tag: type ApiMetricsTag<Self> = anyAn
ApiMetrics
instance tag — a
HyperlinkTag
plus the linked client id.
ApiMetricsTag<function (type parameter) Self in <Self, const ClientId extends string, Client extends Context.ServiceClass<any, ClientId, any>>(tag: ApiMetricsTag<Self> & {
readonly [clientIdSym]: ClientId;
}, _client: Client, options?: ApiMetricsTagOptions): Layer.Layer<Self, never, Scope.Scope>
Self> & { readonly [const clientIdSym: typeof clientIdSymWhere the linked outbound client id is stored on an
ApiMetrics
tag.
clientIdSym]: function (type parameter) ClientId in <Self, const ClientId extends string, Client extends Context.ServiceClass<any, ClientId, any>>(tag: ApiMetricsTag<Self> & {
readonly [clientIdSym]: ClientId;
}, _client: Client, options?: ApiMetricsTagOptions): Layer.Layer<Self, never, Scope.Scope>
ClientId },
_client: Client extends Context.ServiceClass<any, ClientId, any>_client: function (type parameter) Client in <Self, const ClientId extends string, Client extends Context.ServiceClass<any, ClientId, any>>(tag: ApiMetricsTag<Self> & {
readonly [clientIdSym]: ClientId;
}, _client: Client, options?: ApiMetricsTagOptions): Layer.Layer<Self, never, Scope.Scope>
Client,
options: ApiMetricsTagOptionsoptions?: ApiMetricsTagOptions,
): import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<function (type parameter) Self in <Self, const ClientId extends string, Client extends Context.ServiceClass<any, ClientId, any>>(tag: ApiMetricsTag<Self> & {
readonly [clientIdSym]: ClientId;
}, _client: Client, options?: ApiMetricsTagOptions): Layer.Layer<Self, never, Scope.Scope>
Self, never, import ScopeScope.Scope> => const layer: <Self>(
tag: ApiMetricsTag<Self>,
options?: ApiMetricsTagOptions
) => Layer.Layer<Self, never, Scope.Scope>
Local layer for one
ApiMetrics
tag — reads the in-process usage registry.
layer(tag: ApiMetricsTag<Self> & {
readonly [clientIdSym]: ClientId
}
tag, options: ApiMetricsTagOptionsoptions);