Releases: StyraInc/opa-typescript
@styra/[email protected]
Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.361.1 (2.393.4) https://github.com/speakeasy-api/speakeasy
Generated
- [typescript v1.4.0] packages/opa
- NPM 1.4.0"
@styra/[email protected]
Patch Changes
- 76cfb32: include sources in npm package
@styra/[email protected]
Minor Changes
-
d66c52f: Let
useAuthz
handle multiple queries at onceIf you don't know the number of evaluations you need, or if you want to do evaluations in a loop, you cannot do that with the "single-decision"
useAuthz
call.So now, you can provide an array of evaluation queries,
{ path?: string; input?: Input; fromResult?: (_?: Result) => boolean; }[],
instead, and you'll get a
UseAuthzResult<T>[]
in return.
@styra/[email protected]
Patch Changes
- 6820c04: Tweak cache key computation and minor performance enhancements
@styra/[email protected]
Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.334.0 (2.369.0) https://github.com/speakeasy-api/speakeasy
Generated
- [typescript v1.3.0] packages/opa
- NPM 1.3.0"
@styra/[email protected]
Minor Changes
-
12f1e98: Support batching requests sent to the backend (optional)
When used with Enterprise OPA's Batch API, this mode allows for sending much
fewer requests to the backend. It's enabled by settingbatch={true}
on<AuthzProvider>
.Note that the Batch API has no notion of "default query", so it's not possible
to use batching without having eitherdefaultPath
(<AuthzProvider>
) or
path
(useAuthz()
,<Authz>
) set.Please note that
fromResult
is exempt from the cache key, so multiple requests
with the same path and input, but differentfromResult
settings will lead to
unforeseen results.
This is on par with the regular (non-batching) caching, and we'll revisit this
if it becomes a problem for users. Please create an issue on Github if it is
problematic for you.Furthermore, batching queries are not wired up with
AbortController
like the
non-batching equivalents are. -
dd082b5: Introduce
@tanstack/react-query
for policy evaluation request cachingWith this release, multiple uses of
useAuthz
and<Authz>
with the same inputs no longer unconditionally lead to API requests.
Using@tanstack/react-query
underneath,useAuthz
will now return cached results when applicable.Furthermore, API requests are retried on transient errors.
You can control the retry count viaAuthzProvider
'sretry
property.NOTE The
fromResult
property/argument is currently exempt from the cache key -- so two requests with the samepath
andinput
will produce the same result even if theirfromResult
differs.
We believe that this is quite uncommon, please file an issue if it is a problem in your use case.For details on how and when the cache is invalidated, please refer to the docs here: https://tanstack.com/query/latest/docs/framework/react/guides/important-defaults
-
f9d7ac2: change exported interfaces names, and AuthzProvider property
The export iterface
SDK
is now calledOPAClient
for consistency with@styra/opa
.It is used in
AuthzProviderContext
andAuthzProviderProps
, and has been renamed fromsdk
toopaClient
.
@styra/[email protected]
Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.330.0 (2.361.10) https://github.com/speakeasy-api/speakeasy
Generated
- [typescript v1.2.4] packages/opa
- NPM 1.2.4
@styra/[email protected]
Minor Changes
-
b12fd17: build: switch to tshy for (dual) build
-
0caf161: add evaluateBatch to SDK interface
So when retrieving the AuthzProvider's
sdk
instance, you can callevaluateBatch
on it, and TypeScript will be happy. -
2217054: expose AuthzContext
The prepared
sdk
instance ofAuthzProvider
can now be retrieved
from any components wrapped intoAuthzProvider
. For example:import { AuthzContext } from "@styra/opa-react"; export default function Component() { const { sdk } = useContext(AuthzContext); // now you can use `sdk.evaluate()` etc directly }
@styra/[email protected]
Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.327.0 (2.359.6) https://github.com/speakeasy-api/speakeasy
Generated
- [typescript v1.2.3] packages/opa
- NPM v1.2.3
@styra/[email protected]
Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.326.3 (2.359.6) https://github.com/speakeasy-api/speakeasy
This is the first time we ship a dual-build package featuring ESM and CommonJS.
Generated
- [typescript v1.2.2] packages/opa
- NPM v1.2.2