(tag: unknown): ReadonlyArray<ProtocolKind>The full set of ProtocolKinds a tag's Node speaks — every transport in its
endpoints set (a multi-protocol node has several), or its single primary kind, or [] for a
nodeless/bare tag. A structural read; the server asserts its own transport is a member of this
set (ProtocolKindMismatch) so a node served over any of its declared transports passes.
export const const nodeKindsOf: (
tag: unknown
) => ReadonlyArray<ProtocolKind>
The full set of
ProtocolKind
s a tag's
Node
speaks — every transport in its
endpoints set (a multi-protocol node has several), or its single primary kind, or [] for a
nodeless/bare tag. A structural read; the server asserts its own transport is a member of this
set (
ProtocolKindMismatch
) so a node served over any of its declared transports passes.
nodeKindsOf = (tag: unknowntag: unknown): interface ReadonlyArray<T>ReadonlyArray<import ProtocolKindProtocolKind> => {
const const node: anynode = const nodeOf: (
tag: unknown
) => NodeKey<unknown> | undefined
The
Node
a tag is bound to (its transport key), or undefined for a nodeless/bare tag
or any non-tag. Accepts unknown so a Group member passes straight in — walk a group tree and
collect the distinct nodes to know which nodes back its resources.
nodeOf(tag: unknowntag);
if (const node: anynode === var undefinedundefined) {
return [];
}
const const kinds: ProtocolKind[]kinds: interface Array<T>Array<import ProtocolKindProtocolKind> = [];
if (import PredicatePredicate.const hasProperty: <"endpoints">(self: unknown, property: "endpoints") => self is { [K in "endpoints"]: unknown; } (+1 overload)Checks whether a value has a given property key.
When to use
Use when you need a Predicate guard for property access on unknown
values with a simple structural object check.
Details
Uses the in operator and isObjectKeyword. This does not check property
value types.
Example (Guarding object properties)
import { Predicate } from "effect"
const hasName = Predicate.hasProperty("name")
const data: unknown = { name: "Ada" }
if (hasName(data)) {
console.log(data.name)
}
hasProperty(const node: anynode, "endpoints")) {
const const ep: unknownep = const node: {
endpoints: unknown
}
node.endpoints: unknownendpoints;
if (import PredicatePredicate.const hasProperty: <"Http">(self: unknown, property: "Http") => self is { [K in "Http"]: unknown; } (+1 overload)Checks whether a value has a given property key.
When to use
Use when you need a Predicate guard for property access on unknown
values with a simple structural object check.
Details
Uses the in operator and isObjectKeyword. This does not check property
value types.
Example (Guarding object properties)
import { Predicate } from "effect"
const hasName = Predicate.hasProperty("name")
const data: unknown = { name: "Ada" }
if (hasName(data)) {
console.log(data.name)
}
hasProperty(const ep: unknownep, "Http")) const kinds: ProtocolKind[]kinds.Array<ProtocolKind>.push(...items: ProtocolKind[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push("Http");
if (import PredicatePredicate.const hasProperty: <"WebSocket">(self: unknown, property: "WebSocket") => self is { [K in "WebSocket"]: unknown; } (+1 overload)Checks whether a value has a given property key.
When to use
Use when you need a Predicate guard for property access on unknown
values with a simple structural object check.
Details
Uses the in operator and isObjectKeyword. This does not check property
value types.
Example (Guarding object properties)
import { Predicate } from "effect"
const hasName = Predicate.hasProperty("name")
const data: unknown = { name: "Ada" }
if (hasName(data)) {
console.log(data.name)
}
hasProperty(const ep: unknownep, "WebSocket")) const kinds: ProtocolKind[]kinds.Array<ProtocolKind>.push(...items: ProtocolKind[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push("WebSocket");
if (import PredicatePredicate.const hasProperty: <"IpcSocket">(self: unknown, property: "IpcSocket") => self is { [K in "IpcSocket"]: unknown; } (+1 overload)Checks whether a value has a given property key.
When to use
Use when you need a Predicate guard for property access on unknown
values with a simple structural object check.
Details
Uses the in operator and isObjectKeyword. This does not check property
value types.
Example (Guarding object properties)
import { Predicate } from "effect"
const hasName = Predicate.hasProperty("name")
const data: unknown = { name: "Ada" }
if (hasName(data)) {
console.log(data.name)
}
hasProperty(const ep: unknownep, "IpcSocket")) const kinds: ProtocolKind[]kinds.Array<ProtocolKind>.push(...items: ProtocolKind[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push("IpcSocket");
}
if (const kinds: ProtocolKind[]kinds.Array<ProtocolKind>.length: numberGets or sets the length of the array. This is a number one higher than the highest index in the array.
length > 0) {
return const kinds: ProtocolKind[]kinds;
}
const const single: anysingle = const nodeKindOf: (
tag: unknown
) => ProtocolKind | undefined
The declared
ProtocolKind
of the
Node
a tag is bound to (how a client reaches it —
Http/WebSocket/IpcSocket), or undefined for a nodeless/bare tag or a node with no declared
kind. A structural read (like
kindOf
) — the server uses it to reject a node-bound resource
served over a mismatched transport (
ProtocolKindMismatch
).
nodeKindOf(tag: unknowntag);
return const single: anysingle !== var undefinedundefined ? [const single: anysingle] : [];
};