@oxidezap/whatsapp-rust-bridge 0.21.4 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1950,6 +1950,40 @@ export interface JsStoreCallbacks {
1950
1950
  */
1951
1951
  export function initWasmEngine(logger?: any, crypto?: JsCryptoCallbacks): void;
1952
1952
 
1953
+ /**
1954
+ * The intentionally small metadata view exposed to admission policies.
1955
+ * Fields absent in the core are omitted. It does not include the notification's
1956
+ * keys or media paths.
1957
+ */
1958
+ export interface HistorySyncAdmissionMetadata {
1959
+ syncType?: number;
1960
+ chunkOrder?: number;
1961
+ progress?: number;
1962
+ /**
1963
+ * Sender-declared file length. The core does not validate this value.
1964
+ * A decimal string preserves the full uint64 range. Use BigInt(fileLength)
1965
+ * for numeric comparisons.
1966
+ */
1967
+ fileLength?: string;
1968
+ /** Number of bytes present in the inline payload. */
1969
+ inlinePayloadLen?: number;
1970
+ peerDataRequestSessionId?: string;
1971
+ }
1972
+
1973
+ export interface ClientPolicies {
1974
+ /**
1975
+ * Synchronously decide whether to accept a history-sync chunk.
1976
+ * Only the boolean true accepts. False permanently acknowledges the chunk
1977
+ * and prevents retry. Thrown errors and non-boolean results do the same,
1978
+ * including Promise results. Do not use this for transient load shedding.
1979
+ * The callback runs with this policies object as its receiver.
1980
+ * The function is captured at client construction. Mutable state it reads
1981
+ * may still change, but replacing the property does not replace the policy.
1982
+ * Omitting the callback leaves the core's default admission policy in place.
1983
+ */
1984
+ historySyncAdmission?(metadata: HistorySyncAdmissionMetadata): boolean;
1985
+ }
1986
+
1953
1987
  /**
1954
1988
  * Create a full WhatsApp client running in WASM.
1955
1989
  *
@@ -1967,6 +2001,7 @@ export function initWasmEngine(logger?: any, crypto?: JsCryptoCallbacks): void;
1967
2001
  * rooted in WhatsApp's issuer. Absent, null or false keeps strict
1968
2002
  * verification; only an explicit `true` opts in. Anything else rejects the
1969
2003
  * construction as invalid-argument.
2004
+ * @param policies Optional ninth argument. See ClientPolicies; existing calls may omit it.
1970
2005
  */
1971
2006
  export function createWhatsAppClient(
1972
2007
  transport_config: JsTransportCallbacks,
@@ -1977,6 +2012,7 @@ cache_config?: CacheConfig | null,
1977
2012
  version?: readonly [number, number, number] | null,
1978
2013
  wanted_pre_key_count?: number | null,
1979
2014
  danger_skip_cert_chain_verify?: boolean | null,
2015
+ policies?: ClientPolicies | null,
1980
2016
  ): Promise<WasmWhatsAppClient>;
1981
2017
 
1982
2018
  /** Cache entry configuration. */
@@ -4744,7 +4780,7 @@ export interface InitOutput {
4744
4780
  readonly beginWasmAllocationProfile: () => void;
4745
4781
  readonly calculateAgreement: (a: number, b: number, c: number, d: number, e: number) => void;
4746
4782
  readonly calculateSignature: (a: number, b: number, c: number, d: number, e: number) => void;
4747
- readonly createWhatsAppClient: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
4783
+ readonly createWhatsAppClient: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
4748
4784
  readonly decodeSenderKeyRecordComponents: (a: number, b: number, c: number) => void;
4749
4785
  readonly decodeSessionRecordComponents: (a: number, b: number, c: number) => void;
4750
4786
  readonly decryptEventResponsePayload: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
@@ -4960,12 +4996,12 @@ export interface InitOutput {
4960
4996
  readonly intounderlyingsink_write: (a: number, b: number) => number;
4961
4997
  readonly intounderlyingsource_cancel: (a: number) => void;
4962
4998
  readonly intounderlyingsource_pull: (a: number, b: number) => number;
4963
- readonly __wasm_bindgen_func_elem_4656: (a: number, b: number, c: number) => void;
4964
- readonly __wasm_bindgen_func_elem_28598: (a: number, b: number, c: number, d: number) => void;
4965
- readonly __wasm_bindgen_func_elem_28600: (a: number, b: number, c: number, d: number) => void;
4966
- readonly __wasm_bindgen_func_elem_9893: (a: number, b: number, c: number) => void;
4967
- readonly __wasm_bindgen_func_elem_4655: (a: number, b: number, c: number) => void;
4968
- readonly __wasm_bindgen_func_elem_4654: (a: number, b: number) => void;
4999
+ readonly __wasm_bindgen_func_elem_4659: (a: number, b: number, c: number) => void;
5000
+ readonly __wasm_bindgen_func_elem_28605: (a: number, b: number, c: number, d: number) => void;
5001
+ readonly __wasm_bindgen_func_elem_28607: (a: number, b: number, c: number, d: number) => void;
5002
+ readonly __wasm_bindgen_func_elem_9899: (a: number, b: number, c: number) => void;
5003
+ readonly __wasm_bindgen_func_elem_4658: (a: number, b: number, c: number) => void;
5004
+ readonly __wasm_bindgen_func_elem_4657: (a: number, b: number) => void;
4969
5005
  readonly __wbindgen_export: (a: number, b: number) => number;
4970
5006
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
4971
5007
  readonly __wbindgen_export3: (a: number) => void;
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxidezap/whatsapp-rust-bridge",
3
- "version": "0.21.4",
3
+ "version": "0.22.0",
4
4
  "description": "A high-performance utilities for WhatsApp, powered by Rust and WebAssembly.",
5
5
  "author": "João Lucas <jlucaso@hotmail.com>",
6
6
  "license": "MIT",