Skip to content

Releases: StyraInc/opa-typescript

@styra/[email protected]

09 Jul 06:59
4f293e1
Compare
Choose a tag to compare

Changes

Based on:

Generated

@styra/[email protected]

09 Jul 06:59
4f293e1
Compare
Choose a tag to compare

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 call evaluateBatch on it, and TypeScript will be happy.

  • 2217054: expose AuthzContext

    The prepared sdk instance of AuthzProvider can now be retrieved
    from any components wrapped into AuthzProvider. 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]

08 Jul 07:54
Compare
Choose a tag to compare

Changes

Based on:

Generated

@styra/[email protected]

05 Jul 18:38
Compare
Choose a tag to compare

Changes

Based on:

This is the first time we ship a dual-build package featuring ESM and CommonJS.

Generated

@styra/[email protected]

05 Jul 18:38
Compare
Choose a tag to compare

Patch Changes

  • 5bf10a5: tweak package (publint)

    1. remove test files from package
    2. package.json: move "browser" field to "exports"

@styra/[email protected]

05 Jul 07:35
dac958e
Compare
Choose a tag to compare

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]

03 Jul 09:28
Compare
Choose a tag to compare

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

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

    by providing a fromResults function like

    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().

@styra/[email protected]

01 Jul 12:19
Compare
Choose a tag to compare

Patch Changes

  • 6365272: Update README for v0.2.0 change

@styra/[email protected]

01 Jul 12:00
Compare
Choose a tag to compare

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, and children for truthy results.

@styra/[email protected]

28 Jun 09:12
e1cd63b
Compare
Choose a tag to compare

Minor Changes

  • f7eab9c: Remove default export: It seems simpler to only rely on the three exports we have:

    1. import { AuthzProvider } from "@styra/opa-react";
    2. import { Authz } from "@styra/opa-react";
    3. import { useAuthz } from "@styra/opa-react";

    (Besides types and interfaces.)