Skip to content

Commit

Permalink
x/sdk: schema_registry_example
Browse files Browse the repository at this point in the history
Depends on avsc, which has some weird polyfill (?) issues w/ finding
buffer.SlowBuffer. We also need to address the issue of wasm-merging
a whole node project in the GHA container. But with some massaging,
this example does pass the integration test suite for transforms.

Signed-off-by: Oren Leiman <[email protected]>
  • Loading branch information
oleiman committed Aug 22, 2024
1 parent e2339e1 commit 93bdef4
Show file tree
Hide file tree
Showing 5 changed files with 591 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/transform-sdk/js/schema_registry_example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
node_modules/**/*
user_code.js
29 changes: 29 additions & 0 deletions src/transform-sdk/js/schema_registry_example/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as esbuild from 'esbuild'
import { polyfillNode } from "esbuild-plugin-polyfill-node";

await esbuild.build({
entryPoints: ["src/index.ts"],
outfile: "dist/schema_registry_example.js",
bundle: true,
external: [
// This package is provided by the Redpanda JavaScript runtime.
"@redpanda-data/transform-sdk",
"@redpanda-data/transform-sdk-sr",
],
target: "es2022",
platform: "neutral", // We're running in Wasm
plugins: [
polyfillNode({
globals: {
// Allow a global Buffer variable if referenced.
buffer: true,
// Don't inject the process global, the Redpanda JavaScript runtime
// does that.
process: false,
},
polyfills: {
// Any NodeJS APIs that need to polyfilled can be added here.
},
}),
],
});
Loading

0 comments on commit 93bdef4

Please sign in to comment.