Skip to content

Commit

Permalink
Update node bindings (#815)
Browse files Browse the repository at this point in the history
* Update node bindings package.json

* Fix group stream callback type

* Add Cargo config for cross builds
  • Loading branch information
rygine authored Jun 5, 2024
1 parent 960ed4d commit 1871734
Show file tree
Hide file tree
Showing 4 changed files with 2,187 additions and 65 deletions.
3 changes: 3 additions & 0 deletions bindings_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ napi-build = "2.0.1"
[profile.release]
lto = true
strip = "symbols"

[package.metadata.cross.build.env]
volumes = ["__LIB12_DEP=../"]
15 changes: 11 additions & 4 deletions bindings_node/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@xmtp/bindings-node",
"name": "@xmtp/mls-client-bindings-node",
"version": "0.0.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -9,13 +9,16 @@
"default": "./dist/index.ts"
}
},
"files": [
"dist"
],
"napi": {
"name": "bindings_node",
"triples": {}
},
"license": "MIT",
"devDependencies": {
"@napi-rs/cli": "^2.18.3",
"@napi-rs/cli": "^3.0.0-alpha.55",
"viem": "^2.11.1"
},
"engines": {
Expand All @@ -25,12 +28,16 @@
"artifacts": "napi artifacts",
"build": "napi build --platform --release",
"build:clean": "rm -rf dist",
"build:cross": "napi build --platform --release --use-cross",
"build:debug": "napi build --platform",
"build:finish": "mkdir dist && mv index.js dist && mv index.d.ts dist && mv *.node dist",
"build:release": "yarn build:clean && yarn build && yarn build:finish",
"prepublishOnly": "napi prepublish -t npm",
"universal": "napi universal",
"version": "napi version"
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
2 changes: 1 addition & 1 deletion bindings_node/src/groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ impl NapiGroup {
Ok(group_name)
}

#[napi(ts_args_type = "callback: (err: null | Error, result: NapiGroup) => void")]
#[napi(ts_args_type = "callback: (err: null | Error, result: NapiMessage) => void")]
pub fn stream(&self, callback: JsFunction) -> Result<NapiStreamCloser> {
let tsfn: ThreadsafeFunction<NapiMessage, ErrorStrategy::CalleeHandled> =
callback.create_threadsafe_function(0, |ctx| Ok(vec![ctx.value]))?;
Expand Down
Loading

0 comments on commit 1871734

Please sign in to comment.