Optional
fallbackFall back to sequential evaluate calls if server doesn't support batch API.
Optional
fetchSets various request options on the fetch
call made by an SDK method.
Optional
fromfromResult allows you to provide a function to convert the generic Result
type into another type
Assuming that your policy evaluates to an object like {"allowed": true}
,
this fromResult
function would let you convert it to a boolean:
const res = await new OPAClient(serverURL).evaluate<any, boolean>(
"policy/result",
{ action: "read" },
{
fromResult: (r?: Result) => (r as Record<string, any>)["allowed"] ?? false,
},
);
Optional
rejectWith rejectMixed
set, a batch result that contains any errors causes a Promise
rejection.
Optional
retriesSet or override a retry policy on HTTP calls.
Optional
retrySpecifies the status codes which should be retried using the given retry policy.
Optional
timeoutSets a timeout, in milliseconds, on HTTP requests made by an SDK method. If
fetchOptions.signal
is set then it will take precedence over this option.
Extra per-request options for using the high-level SDK's evaluateBatch method.