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
retriesSet or override a retry policy on HTTP calls.
Optional
retrySpecifies the status codes which should be retried using the given retry policy.
Optional
serverURLOverrides the base server URL that will be used by an operation.
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 evaluation methods (evaluate, evaluateDefault).