@oxidezap/whatsapp-rust-bridge 0.7.2 → 0.8.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.
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/proto-reader.d.ts +98 -10
- package/dist/proto-types.d.ts +428 -425
- package/dist/proto.d.ts +25 -2
- package/package.json +2 -1
package/dist/proto.d.ts
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
|
+
import { UnpairedSurrogateError } from "./proto-reader";
|
|
2
|
+
export { UnpairedSurrogateError };
|
|
3
|
+
/**
|
|
4
|
+
* Encode `obj` as `typeName`.
|
|
5
|
+
*
|
|
6
|
+
* A numeric field takes a `number`, a `bigint`, a `Long` — the `{ low, high,
|
|
7
|
+
* unsigned }` shape `decodeProto` hands back for a 64-bit value past 2^53, so a
|
|
8
|
+
* decoded message re-encodes unchanged — or a string that parses in full as a
|
|
9
|
+
* number. Never `''`, `true`, `[]` or anything else JavaScript would silently
|
|
10
|
+
* turn into a number, and the value must be one the declared type can hold;
|
|
11
|
+
* anything else throws `invalid <type>: <value>`. To leave a field unset, omit
|
|
12
|
+
* it or pass `undefined`/`null`; `''` is not a zero.
|
|
13
|
+
* See `docs/proto-numeric-input.md` for the per-type matrix.
|
|
14
|
+
*/
|
|
1
15
|
export declare function encodeProto(typeName: string, obj: unknown): Uint8Array;
|
|
2
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Opt-in account of what a decode had to change to hand back JavaScript
|
|
18
|
+
* strings. Requesting one turns the check on; without it the decode path is
|
|
19
|
+
* untouched.
|
|
20
|
+
*/
|
|
21
|
+
export interface ProtoDecodeReport {
|
|
22
|
+
/** `string` fields whose wire bytes were not valid UTF-8 and got U+FFFD instead. */
|
|
23
|
+
invalidUtf8Fields: number;
|
|
24
|
+
}
|
|
25
|
+
export declare function decodeProto(typeName: string, data: Uint8Array, report?: ProtoDecodeReport): unknown;
|
|
3
26
|
/**
|
|
4
27
|
* Decode concatenated protobuf payloads with one reader and no per-entry
|
|
5
28
|
* `Uint8Array.subarray()`. `offsets` must contain N + 1 monotonic positions,
|
|
6
29
|
* starting at zero and ending at `data.length`.
|
|
7
30
|
*/
|
|
8
|
-
export declare function decodeProtoBatch(typeName: string, data: Uint8Array, offsets: Uint32Array): unknown[];
|
|
31
|
+
export declare function decodeProtoBatch(typeName: string, data: Uint8Array, offsets: Uint32Array, report?: ProtoDecodeReport): unknown[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxidezap/whatsapp-rust-bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"scripts": {
|
|
31
31
|
"bench": "bun run build && bun run benches/binary.ts && bun run benches/signal.ts && bun run benches/curve.ts && bun run benches/crypto.ts",
|
|
32
32
|
"bench:node": "bun run build && node --expose-gc benches/binary.ts && node --expose-gc benches/signal.ts && node --expose-gc benches/curve.ts && node --expose-gc benches/crypto.ts",
|
|
33
|
+
"bench:proto": "bun run benches/proto-encode.ts",
|
|
33
34
|
"gen:bridge-types": "cargo fetch && cd codegen && cargo run -q --bin gen-types --target $(rustc -vV | grep host | cut -d' ' -f2) > ../src/generated_types.rs.tmp && mv ../src/generated_types.rs.tmp ../src/generated_types.rs",
|
|
34
35
|
"gen:proto-codec": "bun run scripts/gen-ts-proto.ts",
|
|
35
36
|
"gen:proto-types": "bun run scripts/gen-protobufjs-dts.ts",
|