refactor: dedupe reader helpers

This commit is contained in:
Peter Steinberger
2026-04-07 04:31:30 +01:00
parent d9fbfa268f
commit 2f115bc645
10 changed files with 63 additions and 60 deletions

View File

@@ -1,4 +1,4 @@
import { normalizeTrimmedStringList } from "openclaw/plugin-sdk/text-runtime";
import { normalizeOptionalTrimmedStringList } from "openclaw/plugin-sdk/text-runtime";
import {
type BrowserConfig,
type BrowserProfileConfig,
@@ -113,13 +113,7 @@ function resolveCdpPortRangeStart(
return start;
}
function normalizeStringList(raw: string[] | undefined): string[] | undefined {
if (!Array.isArray(raw) || raw.length === 0) {
return undefined;
}
const values = normalizeTrimmedStringList(raw);
return values.length > 0 ? values : undefined;
}
const normalizeStringList = normalizeOptionalTrimmedStringList;
function resolveBrowserSsrFPolicy(cfg: BrowserConfig | undefined): SsrFPolicy | undefined {
const rawPolicy = cfg?.ssrfPolicy as

View File

@@ -7,6 +7,7 @@
*/
import type * as Lark from "@larksuiteoapi/node-sdk";
import { readStringValue } from "openclaw/plugin-sdk/text-runtime";
import { cleanBlocksForDescendant } from "./docx-table-ops.js";
import type { FeishuDocxBlock, FeishuDocxBlockChild } from "./docx-types.js";
@@ -25,7 +26,8 @@ function normalizeChildIds(children: string[] | string | undefined): string[] |
if (Array.isArray(children)) {
return children;
}
return typeof children === "string" ? [children] : undefined;
const child = readStringValue(children);
return child ? [child] : undefined;
}
function toDescendantBlock(block: FeishuDocxBlock): DocxDescendantCreateBlock {