mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-19 21:32:20 +03:00
Merged via /merge-batch (v3.8.51 provenance sweep). Boarded and validated together with the batch's other retirement PRs in a combined worktree — full gate suite green. This PR's own conflicts (against #11711's EdgeTTS retirement, both touching test-masking-allowlist.json and the "Image / video / audio generation" README bullet) were reconciled additively/subtractively (both retirements now correctly reflected), re-validated with this PR's own 62 focused tests, and pushed before merge. Thank you.
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
export const RETIRED_MICROSOFT_DESIGNER_WEB_PROVIDER_IDS: ReadonlySet<string> = new Set([
|
|
"microsoft-designer-web",
|
|
"msdesigner",
|
|
]);
|
|
|
|
export const MICROSOFT_DESIGNER_WEB_RETIRED_MESSAGE =
|
|
"Provider has been retired from OmniRoute runtime.";
|
|
|
|
function normalizeProviderId(providerId: unknown): string {
|
|
return typeof providerId === "string" ? providerId.trim().toLowerCase() : "";
|
|
}
|
|
|
|
export function isMicrosoftDesignerWebRetiredProviderId(providerId: unknown): boolean {
|
|
return RETIRED_MICROSOFT_DESIGNER_WEB_PROVIDER_IDS.has(normalizeProviderId(providerId));
|
|
}
|
|
|
|
export function assertMicrosoftDesignerWebProviderAvailable(providerId: unknown): void {
|
|
if (!isMicrosoftDesignerWebRetiredProviderId(providerId)) return;
|
|
|
|
const error = new Error(MICROSOFT_DESIGNER_WEB_RETIRED_MESSAGE);
|
|
(error as Error & { status?: number }).status = 410;
|
|
throw error;
|
|
}
|
|
|
|
export function isMicrosoftDesignerWebProviderRetiredError(
|
|
error: unknown
|
|
): error is Error & { status: 410 } {
|
|
return (
|
|
error instanceof Error &&
|
|
(error as Error & { status?: number }).status === 410 &&
|
|
error.message === MICROSOFT_DESIGNER_WEB_RETIRED_MESSAGE
|
|
);
|
|
}
|