feat(FN-2718): add unavailable node policy setting and validation

- Define and export unavailable node policy types in core settings interfaces
- Add project-level unavailable node policy default and runtime validation helper
- Add core unit coverage for unavailable node policy parsing and acceptance cases
- Guard Paperclip mint requests to include companyId only when available for type-safe payloads
- Document unavailable node policy in the settings reference
This commit is contained in:
Fusion
2026-04-27 22:40:08 -07:00
committed by gsxdsm
parent 4149596352
commit 35db935feb
7 changed files with 85 additions and 4 deletions

View File

@@ -0,0 +1,20 @@
import type { UnavailableNodePolicy } from "./types.js";
const UNAVAILABLE_NODE_POLICIES: readonly UnavailableNodePolicy[] = ["block", "fallback-local"] as const;
/**
* Validates a project unavailable-node routing policy value.
*
* Returns the normalized policy value when valid, otherwise undefined.
*/
export function validateUnavailableNodePolicy(value: unknown): UnavailableNodePolicy | undefined {
if (value === undefined) {
return undefined;
}
if (typeof value !== "string") {
return undefined;
}
return (UNAVAILABLE_NODE_POLICIES as readonly string[]).includes(value)
? (value as UnavailableNodePolicy)
: undefined;
}