Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support webassembly instantiate streaming #431

Conversation

Tucker-Eric
Copy link
Contributor

This allows passing a Response or Promise<Response> to loadPolicy which will pass the response to WebAssembly.instantiateStreaming() instead of WebAssembly.instantiate() to allow fulfilling the suggestion from MDN

@Tucker-Eric Tucker-Eric force-pushed the support-webassembly-instantiate-streaming branch 5 times, most recently from d6f4f3f to 134bf2a Compare June 8, 2024 00:44
…able to use WebAssembly.instantiateStreaming over WebAssembly.instantiate internally

Signed-off-by: Eric Tucker <[email protected]>
Signed-off-by: Eric Tucker <[email protected]>
@Tucker-Eric Tucker-Eric force-pushed the support-webassembly-instantiate-streaming branch from 134bf2a to b74af11 Compare June 8, 2024 00:48
Copy link
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, I've been wanting that, too. ✨ Thanks!

@srenatus srenatus merged commit c02cf13 into open-policy-agent:main Jun 8, 2024
10 checks passed
@Tucker-Eric
Copy link
Contributor Author

@srenatus thank you! What're the chances we could get a version bump with these changes and #424 in it?

@srenatus
Copy link
Contributor

I'll take care of it next week!

@srenatus
Copy link
Contributor

✔️ It's released: 1.9.0.

I'm curious, what's your use case? How are you using OPA's wasm modules? 😃

@Tucker-Eric
Copy link
Contributor Author

Thank you! @srenatus

We're using it in a monorepo. The policies/wasm build is all in its own package that's imported into the apps using it. The service itself needed to be usable in browsers and Node runtime so we're bundling the wasm policy with vite.

image

That same service is used by:

  • Frontend applications to support dynamic views based RBAC/ABAC
  • Node api
  • Python api (fetches wasm stream and loads it into opa-wasm)

So we get to define the policies in a central place and essentially have 3 different runtimes benefit from using the exact same policies without having to redefine and keep everything in sync for each platform.

@srenatus
Copy link
Contributor

That's awesome. 🚀

I'm currently working on something related to

Frontend applications to support dynamic views based RBAC/ABAC

too, so I've been wondering if you'd like to share notes. Are you on the OPA Slack?

@Tucker-Eric
Copy link
Contributor Author

@srenatus I'd love to share notes and approaches! I'm not in the OPA Slack, do I need an invite to join?

@srenatus
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants