Skip to content

feat: make the API async#3

Merged
gregberge merged 5 commits intomainfrom
async-api
Jan 14, 2026
Merged

feat: make the API async#3
gregberge merged 5 commits intomainfrom
async-api

Conversation

@gregberge
Copy link
Member

BREAKING CHANGE: API is now returning a promise

BREAKING CHANGE: API is now returning a promise
Copilot AI review requested due to automatic review settings January 13, 2026 08:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR converts the fingerprintDiff API from synchronous to asynchronous by implementing NAPI's AsyncTask pattern, enabling non-blocking execution of the image fingerprinting operations.

Changes:

  • Refactored the Rust implementation to use AsyncTask with a new FingerprintDiffTask struct that implements the Task trait
  • Updated TypeScript type definitions to return Promise<unknown> instead of string
  • Updated all test cases to use async/await syntax

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
src/lib.rs Introduced FingerprintDiffTask struct implementing Task trait; moved computation logic to compute() method for async execution; updated fingerprint_diff to return AsyncTask
index.d.ts Changed return type from string to Promise<unknown>
test/index.spec.ts Updated test functions to be async and added await keywords for all fingerprintDiff calls
README.md Updated usage example to include await keyword and documented that the function returns a Promise<string>

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

@gregberge gregberge merged commit 24878af into main Jan 14, 2026
12 checks passed
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