@oxidezap/whatsapp-rust-bridge 0.21.4 → 0.22.1

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.
@@ -934,6 +934,14 @@ export interface LidPnMappingEntry {
934
934
  learning_source: string;
935
935
  }
936
936
 
937
+ export interface LockChatUpdate {
938
+ /** The chat being locked or unlocked (chat lock, the hidden "locked chats" folder on the primary device). */
939
+ jid: Jid;
940
+ timestamp: string;
941
+ action: import('./proto-types.js').proto.SyncActionValue.ILockChatAction;
942
+ from_full_sync: boolean;
943
+ }
944
+
937
945
  export interface LoggedOut {
938
946
  on_connect: boolean;
939
947
  reason: ConnectFailureReason;
@@ -1950,6 +1958,40 @@ export interface JsStoreCallbacks {
1950
1958
  */
1951
1959
  export function initWasmEngine(logger?: any, crypto?: JsCryptoCallbacks): void;
1952
1960
 
1961
+ /**
1962
+ * The intentionally small metadata view exposed to admission policies.
1963
+ * Fields absent in the core are omitted. It does not include the notification's
1964
+ * keys or media paths.
1965
+ */
1966
+ export interface HistorySyncAdmissionMetadata {
1967
+ syncType?: number;
1968
+ chunkOrder?: number;
1969
+ progress?: number;
1970
+ /**
1971
+ * Sender-declared file length. The core does not validate this value.
1972
+ * A decimal string preserves the full uint64 range. Use BigInt(fileLength)
1973
+ * for numeric comparisons.
1974
+ */
1975
+ fileLength?: string;
1976
+ /** Number of bytes present in the inline payload. */
1977
+ inlinePayloadLen?: number;
1978
+ peerDataRequestSessionId?: string;
1979
+ }
1980
+
1981
+ export interface ClientPolicies {
1982
+ /**
1983
+ * Synchronously decide whether to accept a history-sync chunk.
1984
+ * Only the boolean true accepts. False permanently acknowledges the chunk
1985
+ * and prevents retry. Thrown errors and non-boolean results do the same,
1986
+ * including Promise results. Do not use this for transient load shedding.
1987
+ * The callback runs with this policies object as its receiver.
1988
+ * The function is captured at client construction. Mutable state it reads
1989
+ * may still change, but replacing the property does not replace the policy.
1990
+ * Omitting the callback leaves the core's default admission policy in place.
1991
+ */
1992
+ historySyncAdmission?(metadata: HistorySyncAdmissionMetadata): boolean;
1993
+ }
1994
+
1953
1995
  /**
1954
1996
  * Create a full WhatsApp client running in WASM.
1955
1997
  *
@@ -1967,6 +2009,7 @@ export function initWasmEngine(logger?: any, crypto?: JsCryptoCallbacks): void;
1967
2009
  * rooted in WhatsApp's issuer. Absent, null or false keeps strict
1968
2010
  * verification; only an explicit `true` opts in. Anything else rejects the
1969
2011
  * construction as invalid-argument.
2012
+ * @param policies Optional ninth argument. See ClientPolicies; existing calls may omit it.
1970
2013
  */
1971
2014
  export function createWhatsAppClient(
1972
2015
  transport_config: JsTransportCallbacks,
@@ -1977,6 +2020,7 @@ cache_config?: CacheConfig | null,
1977
2020
  version?: readonly [number, number, number] | null,
1978
2021
  wanted_pre_key_count?: number | null,
1979
2022
  danger_skip_cert_chain_verify?: boolean | null,
2023
+ policies?: ClientPolicies | null,
1980
2024
  ): Promise<WasmWhatsAppClient>;
1981
2025
 
1982
2026
  /** Cache entry configuration. */
@@ -3537,6 +3581,7 @@ export type WhatsAppEvent =
3537
3581
  | { type: 'pin_update'; data: PinUpdate }
3538
3582
  | { type: 'mute_update'; data: MuteUpdate }
3539
3583
  | { type: 'archive_update'; data: ArchiveUpdate }
3584
+ | { type: 'lock_chat_update'; data: LockChatUpdate }
3540
3585
  | { type: 'star_update'; data: StarUpdate }
3541
3586
  | { type: 'mark_chat_as_read_update'; data: MarkChatAsReadUpdate }
3542
3587
  | { type: 'delete_chat_update'; data: DeleteChatUpdate }
@@ -4744,7 +4789,7 @@ export interface InitOutput {
4744
4789
  readonly beginWasmAllocationProfile: () => void;
4745
4790
  readonly calculateAgreement: (a: number, b: number, c: number, d: number, e: number) => void;
4746
4791
  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;
4792
+ readonly createWhatsAppClient: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
4748
4793
  readonly decodeSenderKeyRecordComponents: (a: number, b: number, c: number) => void;
4749
4794
  readonly decodeSessionRecordComponents: (a: number, b: number, c: number) => void;
4750
4795
  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 +5005,12 @@ export interface InitOutput {
4960
5005
  readonly intounderlyingsink_write: (a: number, b: number) => number;
4961
5006
  readonly intounderlyingsource_cancel: (a: number) => void;
4962
5007
  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;
5008
+ readonly __wasm_bindgen_func_elem_4670: (a: number, b: number, c: number) => void;
5009
+ readonly __wasm_bindgen_func_elem_28628: (a: number, b: number, c: number, d: number) => void;
5010
+ readonly __wasm_bindgen_func_elem_28630: (a: number, b: number, c: number, d: number) => void;
5011
+ readonly __wasm_bindgen_func_elem_9914: (a: number, b: number, c: number) => void;
5012
+ readonly __wasm_bindgen_func_elem_4669: (a: number, b: number, c: number) => void;
5013
+ readonly __wasm_bindgen_func_elem_4668: (a: number, b: number) => void;
4969
5014
  readonly __wbindgen_export: (a: number, b: number) => number;
4970
5015
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
4971
5016
  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.1",
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",