mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-29 13:53:37 +00:00
Extract shared normalization/coercion helpers into private @openclaw/normalization-core workspace package while preserving existing plugin SDK helper subpaths.\n\nAlso keeps direct normalization-core imports internal, wires UI/build/loader resolution, and replaces the slow PR network CodeQL lane with a fast added-line boundary scan while retaining full CodeQL for scheduled/manual runs.\n\nVerification: local moved tests, plugin SDK boundary tests, extension loader tests, agents-support shard, UI build/test, build artifacts, lint, workflow guards, autoreview, and GitHub CI passed on PR head 963d893715.
32 lines
975 B
TypeScript
32 lines
975 B
TypeScript
import { normalizeStringEntries } from "@openclaw/normalization-core/string-normalization";
|
|
|
|
export type PluginIdScope = readonly string[] | undefined;
|
|
|
|
export function normalizePluginIdScope(ids?: readonly unknown[]): string[] | undefined {
|
|
if (ids === undefined) {
|
|
return undefined;
|
|
}
|
|
return Array.from(
|
|
new Set(normalizeStringEntries(ids.filter((id): id is string => typeof id === "string"))),
|
|
).toSorted();
|
|
}
|
|
|
|
export function hasExplicitPluginIdScope(ids?: readonly string[]): boolean {
|
|
return ids !== undefined;
|
|
}
|
|
|
|
export function hasNonEmptyPluginIdScope(ids?: readonly string[]): boolean {
|
|
return ids !== undefined && ids.length > 0;
|
|
}
|
|
|
|
export function createPluginIdScopeSet(ids?: readonly string[]): ReadonlySet<string> | null {
|
|
if (ids === undefined) {
|
|
return null;
|
|
}
|
|
return new Set(ids);
|
|
}
|
|
|
|
export function serializePluginIdScope(ids?: readonly string[]): string {
|
|
return ids === undefined ? "__unscoped__" : JSON.stringify(ids);
|
|
}
|