Skip to content

Commit

Permalink
Version Packages
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and srenatus committed Jul 3, 2024
1 parent d2b2abc commit 00c1ee4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 26 deletions.
25 changes: 0 additions & 25 deletions .changeset/tough-cows-kiss.md

This file was deleted.

26 changes: 26 additions & 0 deletions packages/opa-react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# @styra/opa-react

## 0.3.0

### Minor Changes

- d2b2abc: Add `fromResults` to support unwrapping policy evaluation results

This 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

```json
{
"result": false,
"details": "..."
}
```

by providing a `fromResults` function like

```ts
const 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>` (property `defaultFromResults`), and with `<Authz>` (property `fromResult`), or passed to `useAuthz()`.

## 0.2.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/opa-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@styra/opa-react",
"version": "0.2.1",
"version": "0.3.0",
"repository": {
"type": "git",
"url": "https://github.com/StyraInc/opa-typescript.git",
Expand Down

0 comments on commit 00c1ee4

Please sign in to comment.