mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-04 15:24:06 +00:00
Adds broad inline comments and JSDoc for CLI, cron, outbound/channel, plugin SDK, ACP, shared helpers, net policy, and related utility contracts. Proof: git diff --check on latest exact head plus focused cron tests passed; CI had no failing checks observed before merge attempt.
17 lines
820 B
TypeScript
17 lines
820 B
TypeScript
import { asRecord } from "@openclaw/normalization-core/record-coerce";
|
|
import type { NodeListNode, PairedNode, PairingList, PendingRequest } from "./node-list-types.js";
|
|
|
|
/** Extracts pending and paired node arrays from permissive node.pair.list payloads. */
|
|
export function parsePairingList(value: unknown): PairingList {
|
|
const obj = asRecord(value);
|
|
const pending = Array.isArray(obj.pending) ? (obj.pending as PendingRequest[]) : [];
|
|
const paired = Array.isArray(obj.paired) ? (obj.paired as PairedNode[]) : [];
|
|
return { pending, paired };
|
|
}
|
|
|
|
/** Extracts the nodes array from a node.list response, treating malformed payloads as empty. */
|
|
export function parseNodeList(value: unknown): NodeListNode[] {
|
|
const obj = asRecord(value);
|
|
return Array.isArray(obj.nodes) ? (obj.nodes as NodeListNode[]) : [];
|
|
}
|