OptionalfetchSets various request options on the fetch call made by an SDK method.
OptionalfromfromResult 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,
},
);
OptionalretriesSet or override a retry policy on HTTP calls.
OptionalretrySpecifies the status codes which should be retried using the given retry policy.
OptionalserverOverrides the base server URL that will be used by an operation.
OptionaltimeoutSets 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).