Skip to content

Releases: StyraInc/opa-typescript

@styra/[email protected]

12 Aug 08:35
Compare
Choose a tag to compare

Changes

Based on:

Generated

  • [typescript v1.4.0] packages/opa
  • NPM 1.4.0"

@styra/[email protected]

17 Jul 12:33
315fcdc
Compare
Choose a tag to compare

Patch Changes

  • 76cfb32: include sources in npm package

@styra/[email protected]

16 Jul 08:41
Compare
Choose a tag to compare

Minor Changes

  • d66c52f: Let useAuthz handle multiple queries at once

    If 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]

15 Jul 13:56
Compare
Choose a tag to compare

Patch Changes

  • 6820c04: Tweak cache key computation and minor performance enhancements

@styra/[email protected]

12 Jul 11:16
Compare
Choose a tag to compare

Changes

Based on:

Generated

  • [typescript v1.3.0] packages/opa
  • NPM 1.3.0"

@styra/[email protected]

12 Jul 11:16
Compare
Choose a tag to compare

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 setting batch={true} on <AuthzProvider>.

    Note that the Batch API has no notion of "default query", so it's not possible
    to use batching without having either defaultPath (<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 different fromResult 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 caching

    With 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 via AuthzProvider's retry property.

    NOTE The fromResult property/argument is currently exempt from the cache key -- so two requests with the same path and input will produce the same result even if their fromResult 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 called OPAClient for consistency with @styra/opa.

    It is used in AuthzProviderContext and AuthzProviderProps, and has been renamed from sdk to opaClient.

@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