import { findRequestByPathMethod } from "./find-request.js";
//#region src/libs/get-request-uid-by-path-method.ts
/**
* Get the request uid by path and method
*/
var getRequestUidByPathMethod = (requests, payload) => {
	const { requestUid, method, path } = payload ?? {};
	if (requestUid) return requestUid;
	if (!path || !method) return Object.keys(requests)[0];
	const requestsArray = Object.values(requests);
	const exactMatch = requestsArray.find((item) => item.path.toLowerCase() === path.toLowerCase() && item.method.toLowerCase() === method.toLowerCase());
	if (exactMatch) return exactMatch.uid;
	const { request } = findRequestByPathMethod(path, method, requestsArray);
	return request?.uid || Object.keys(requests)[0];
};
//#endregion
export { getRequestUidByPathMethod };

//# sourceMappingURL=get-request-uid-by-path-method.js.map