Releases: StyraInc/opa-typescript
@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
@styra/[email protected]
Patch Changes
-
5bf10a5: tweak package (publint)
- remove test files from package
- package.json: move "browser" field to "exports"
@styra/[email protected]
Patch Changes
-
be7bcb5:
AuthzProviderContext
is a type now (was interface)This was done to remove code duplication. No functional changes. But since the
interface was exported before, some care might have to be taken when updating.
@styra/[email protected]
Minor Changes
-
d2b2abc: Add
fromResults
to support unwrapping policy evaluation resultsThis allows us to unwrap results returned from OPA to turn them into a boolean.
Previously, anything different from undefined and false was taken to mean "authorized". Now, we can work with policy evaluation results like
{ "result": false, "details": "..." }
by providing a
fromResults
function likeconst fromResults = (r?: Result): boolean => ((r as Record<string, any>)["foobar"] as boolean) ?? false;
As with input and path, this can (optionally) be set with
<AuthzProvider>
(propertydefaultFromResults
), and with<Authz>
(propertyfromResult
), or passed touseAuthz()
.
@styra/[email protected]
Patch Changes
- 6365272: Update README for v0.2.0 change
@styra/[email protected]
Minor Changes
-
aa75275: Remove function support from component
Allowing a function had unintended consequences for performance, given how
React works. Now, there is only one way to do it:fallback
for non-truthy
results, andchildren
for truthy results.
@styra/[email protected]
Minor Changes
-
f7eab9c: Remove default export: It seems simpler to only rely on the three exports we have:
import { AuthzProvider } from "@styra/opa-react";
import { Authz } from "@styra/opa-react";
import { useAuthz } from "@styra/opa-react";
(Besides types and interfaces.)