Skip to content

feat: expose text media through Node API - #13

Merged
gabewillen merged 1 commit into
mainfrom
feat/node-process-text-media-json
Aug 7, 2026
Merged

gabewillen merged 1 commit into
mainfrom
feat/node-process-text-media-json

Conversation

@gabewillen

Copy link
Copy Markdown
Contributor

Adds the missing Node-API bridge for the already-public text-media C API.

  • Exposes processTextWithMediaJson from ffi/node/addon.cpp.
  • Preserves optional binary media, MIME type, and JSON options.
  • Enables the standalone TypeScript repository to build matching N-API prebuilds from a core tag.

Focused source diff check passes. No release tag or merge performed.

Expose text processing with optional media and process options through the Node-API addon.
Copilot AI lite review requested due to automatic review settings August 7, 2026 05:53
@gabewillen
gabewillen merged commit b26bc30 into main Aug 7, 2026
13 checks passed
@gabewillen
gabewillen deleted the feat/node-process-text-media-json branch August 7, 2026 05:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a missing Node-API binding in ffi/node/addon.cpp so Node consumers can call the existing public C API entrypoint for processing text with optional attached “source media” and JSON options.

Changes:

  • Introduces ProcessTextWithMediaJSON Node callback to invoke cortext_process_text_with_media_json_with_options.
  • Wires the new callback into the exported instance method table as processTextWithMediaJson.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ffi/node/addon.cpp
Comment on lines +593 to +611
cortext_media media{};
const cortext_media *media_ptr = nullptr;
if (argc >= 3 && !IsNullOrUndefined (env, args[2]))
{
if (!GetUint8Data (env, args[2], &media_data, media_size))
{
return ThrowTypeError (env, "media must be bytes, null, or undefined");
}
if (argc >= 4 && !IsNullOrUndefined (env, args[3])
&& !GetString (env, args[3], media_mimetype))
{
return ThrowTypeError (env, "mediaMimeType must be a string");
}
media = cortext_media{ media_data, media_size,
media_mimetype.empty ()
? nullptr
: media_mimetype.c_str () };
media_ptr = &media;
}
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