mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-10-19 13:30:37 +00:00
fix(types): declare idempotency input contracts (#8820)
This commit is contained in:
parent
6133939acd
commit
67d13dc7a8
1 changed files with 8 additions and 3 deletions
|
|
@ -2,6 +2,11 @@ import { createHash } from "node:crypto";
|
|||
import { getIdempotencyKey, checkIdempotency } from "@/lib/idempotencyLayer";
|
||||
import { calculateCost } from "@/lib/usage/costCalculator";
|
||||
import { attachOmniRouteMetaHeaders } from "@/domain/omnirouteResponseMeta";
|
||||
import type { EffectiveServiceTier } from "./serviceTier.ts";
|
||||
|
||||
type HeadersLike = Headers | Record<string, unknown> | null | undefined;
|
||||
type IdempotencyRequest = { headers?: HeadersLike } | null | undefined;
|
||||
type LoggerLike = { debug?: (...args: unknown[]) => void } | null | undefined;
|
||||
|
||||
/**
|
||||
* NEXA fusion-idempotency fix: compose the effective idempotency key from the raw
|
||||
|
|
@ -55,13 +60,13 @@ export async function checkIdempotencyCache({
|
|||
startTime,
|
||||
log,
|
||||
}: {
|
||||
clientRawRequest: unknown;
|
||||
clientRawRequest: IdempotencyRequest;
|
||||
provider: string;
|
||||
model: string;
|
||||
body?: unknown;
|
||||
effectiveServiceTier: unknown;
|
||||
effectiveServiceTier: EffectiveServiceTier | null | undefined;
|
||||
startTime: number;
|
||||
log: unknown;
|
||||
log: LoggerLike;
|
||||
}): Promise<{ hit: { success: true; response: Response } | null; idempotencyKey: string | null }> {
|
||||
// NEXA fusion-idempotency fix: namespace the raw header key (see composeIdempotencyKey).
|
||||
const rawIdempotencyKey = getIdempotencyKey(clientRawRequest?.headers);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue