From d9e6807ca0aff560e031c0e74160d298ef03fafc Mon Sep 17 00:00:00 2001 From: kingchenc Date: Sun, 14 Jun 2026 00:50:03 +0200 Subject: [PATCH] fix: correct RelativeStrengthAB binding wrapper casing (#296) The WASM and Node binding wrappers were named with the lowercase-b acronym (WasmRelativeStrengthAb, RelativeStrengthAbNode) while the core type and every other surface use RelativeStrengthAB. The published JS/WASM class name was already correct via js_name/js_class, so this only aligns the internal Rust identifiers and the auto-generated TypeScript type alias (RelativeStrengthAbNode -> RelativeStrengthABNode). Runtime API unchanged. --- CHANGELOG.md | 9 +++++++++ bindings/node/index.d.ts | 2 +- bindings/node/src/lib.rs | 4 ++-- bindings/wasm/src/lib.rs | 6 +++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 169e4cbd..7d7d1675 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Python binding: upgraded `pyo3` and `rust-numpy` from 0.28 to 0.29. No public API changes; the full test suite passes unchanged. +### Fixed +- Corrected the internal casing of the `RelativeStrengthAB` binding wrappers, + which used `...Ab` (`WasmRelativeStrengthAb` in the WASM crate, + `RelativeStrengthAbNode` in the Node crate) while every other surface uses the + acronym `AB`. The published JS/WASM class name was already `RelativeStrengthAB` + (set via `js_name`/`js_class`), so the runtime API is unchanged; the only + visible change is the auto-generated TypeScript type alias, renamed + `RelativeStrengthAbNode` → `RelativeStrengthABNode` in `index.d.ts`. + ### Security - Resolved the pyo3 advisories RUSTSEC-2026-0176 (out-of-bounds read in `PyList`/`PyTuple` `nth`/`nth_back`) and RUSTSEC-2026-0177 (missing `Sync` diff --git a/bindings/node/index.d.ts b/bindings/node/index.d.ts index 334c9103..6937a845 100644 --- a/bindings/node/index.d.ts +++ b/bindings/node/index.d.ts @@ -1645,7 +1645,7 @@ export declare class Cointegration { isReady(): boolean warmupPeriod(): number } -export type RelativeStrengthAbNode = RelativeStrengthAB +export type RelativeStrengthABNode = RelativeStrengthAB export declare class RelativeStrengthAB { constructor(maPeriod: number, rsiPeriod: number) update(a: number, b: number): RelativeStrengthValue | null diff --git a/bindings/node/src/lib.rs b/bindings/node/src/lib.rs index a6d989d2..5a7cfa1f 100644 --- a/bindings/node/src/lib.rs +++ b/bindings/node/src/lib.rs @@ -1174,12 +1174,12 @@ pub struct RelativeStrengthValue { } #[napi(js_name = "RelativeStrengthAB")] -pub struct RelativeStrengthAbNode { +pub struct RelativeStrengthABNode { inner: wc::RelativeStrengthAB, } #[napi] -impl RelativeStrengthAbNode { +impl RelativeStrengthABNode { #[napi(constructor)] pub fn new(ma_period: u32, rsi_period: u32) -> napi::Result { Ok(Self { diff --git a/bindings/wasm/src/lib.rs b/bindings/wasm/src/lib.rs index 14cdaaf4..2bd646b6 100644 --- a/bindings/wasm/src/lib.rs +++ b/bindings/wasm/src/lib.rs @@ -730,14 +730,14 @@ impl WasmCointegration { // ---------- RelativeStrengthAB (two params, object output) ---------- #[wasm_bindgen(js_name = "RelativeStrengthAB")] -pub struct WasmRelativeStrengthAb { +pub struct WasmRelativeStrengthAB { inner: wc::RelativeStrengthAB, } #[wasm_bindgen(js_class = "RelativeStrengthAB")] -impl WasmRelativeStrengthAb { +impl WasmRelativeStrengthAB { #[wasm_bindgen(constructor)] - pub fn new(ma_period: usize, rsi_period: usize) -> Result { + pub fn new(ma_period: usize, rsi_period: usize) -> Result { Ok(Self { inner: wc::RelativeStrengthAB::new(ma_period, rsi_period).map_err(map_err)?, })