/** * manifestOverrideEvaluator.ts * * Copyright (c) Microsoft Corporation. All rights reserved. * * @packageDocumentation * Shared, dependency-light runtime resolution of SPFx manifest `conditionalOverrides` — the * flight/killswitch-gated `version`/`path` overrides on a component's loader-config script * resources. Consumed by both the sp-loader runtime and the service worker (which deep-imports this * module from `@microsoft/sp-loader`) so the override semantics stay in one place (and in step with * the server-side `ConditionalOverrideResolver`). * * The condition/override types come from `@microsoft/sp-module-interfaces`; the caller injects its * own flight/killswitch checks via {@link IConditionEvaluators}, so this module has no coupling to * sp-core-library, the service worker `SPConfig`, or any particular flight-state source. */ import type { _IConditionalDependencyReferenceBase as IConditionalDependencyReferenceBase, _IOperatorOrSwitch as IOperatorOrSwitch } from '@microsoft/sp-module-interfaces'; /** * Checks the caller supplies so leaf conditions can be evaluated against its own flight/killswitch * state. */ export interface IConditionEvaluators { /** * Evaluates a numeric (Flights-on-Rails) flight id. */ isFlightEnabled(id: number): boolean; /** * Evaluates a killswitch id (GUID string). */ isKillSwitchActivated(id: string): boolean; /** * Evaluates an ECS (rollout-name) flight. When omitted, `ecsFlight` leaves are treated as not * satisfied. */ isEcsFlightEnabled?(id: string): boolean; } /** * Evaluates an SPFx conditional-override condition tree (`flight` / `killswitch` / `ecsFlight` / * `and` / `or` / `xor` / `not`) against the supplied evaluators. An empty `and` is not satisfied * (matching the server-side resolver); `ecsFlight` is not satisfied unless * {@link IConditionEvaluators.isEcsFlightEnabled} is provided. * * @param condition - The condition tree, or `undefined`. * @param evaluators - The caller's flight/killswitch checks. */ export declare function evaluateOverrideCondition(condition: IOperatorOrSwitch | undefined, evaluators: IConditionEvaluators): boolean; /** * Returns the first override entry whose condition is satisfied (first-match-wins), or `undefined` * if none match or the list is absent. * * @param overrides - The ordered override list. * @param evaluators - The caller's flight/killswitch checks. */ export declare function findFirstMatchingOverride(overrides: T[] | undefined, evaluators: IConditionEvaluators): T | undefined; /** * Coalesces the ordered `conditionalOverrides` list with the deprecated single `fallback` entry: * uses `conditionalOverrides` when present (even when empty), otherwise treats `fallback` as a * single-element list. Mirrors the server-side `ConditionalOverrideResolver` coalescing. * * @param conditionalOverrides - The preferred ordered override list. * @param fallback - The deprecated single fallback entry. */ export declare function coalesceOverrides(conditionalOverrides: T[] | undefined, fallback: T | undefined): T[] | undefined; //# sourceMappingURL=manifestOverrideEvaluator.d.ts.map