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

JavaScript Transforms SDK: Export SchemaFormat #23164

Merged

Conversation

oleiman
Copy link
Member

@oleiman oleiman commented Sep 1, 2024

Adds a SchemaFormat "enum" (really a JS object with integer-valued fields) to the schema registry module.

The enum previously appeared in our TypeScript typings but was left unimplemented by mistake. Usually, the TS compiler will emit a pure JS object corresponding to such an enum, but our setup doesn't do this because the SDK module(s) are all native code, mediated by quickjs.

This PR also includes an update to the SR example code (to use the enum rather than a bare int) and some quickjs-oriented helper structs related to constructing and exporting a singleton object into a native module.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v24.2.x
  • v24.1.x
  • v23.3.x

Release Notes

Improvements

  • Implements @redpanda-data/transform-sdk-sr.SchemaFormat for the WASM Transforms JS module

@oleiman oleiman self-assigned this Sep 1, 2024
@github-actions github-actions bot added the area/wasm WASM Data Transforms label Sep 1, 2024
@oleiman oleiman force-pushed the xform/sdk/ts/noticket/schema-format-export branch from 00b0a78 to 285d20f Compare September 3, 2024 23:49
Helper class for building up a JavaScript object that can then be
exported as part of a module's function list.

Possible overkill for this use case (enum export), but it could
be useful in the future if we want to export a singleton object
with, for example, native function attributes.
- use container typedef
- avoid blindly throwing an unbounded int into format enum
And update example transform accordingly.
@oleiman oleiman force-pushed the xform/sdk/ts/noticket/schema-format-export branch from 285d20f to f43da48 Compare September 4, 2024 18:58
@oleiman oleiman changed the title DNM: Export SchemaFormat Export SchemaFormat Sep 24, 2024
@oleiman oleiman marked this pull request as ready for review September 24, 2024 19:18
@oleiman oleiman changed the title Export SchemaFormat JavaScript Transforms SDK: Export SchemaFormat Sep 24, 2024
@oleiman oleiman requested a review from rockwotj September 24, 2024 20:33
Copy link
Contributor

@rockwotj rockwotj left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for digging into this

@rockwotj rockwotj merged commit c980c48 into redpanda-data:dev Oct 4, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/wasm WASM Data Transforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants