@minip2p/node 0.10.0 → 0.10.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.
@@ -1,41 +1,18 @@
1
1
  /**
2
- * Types of the values the native addon returns. `minip2p-ffi-core` derives
3
- * them with serde (its `js_shape` module pins the representation), and the
4
- * SDK's backend types describe the same shape, so each native type is the
5
- * SDK type with napi-rs's value encoding: `u64` arrives as `number`, or as a
6
- * `bigint` above `u32::MAX`, and bytes arrive as a `Buffer`.
2
+ * Types of the values the native addon returns: `minip2p-ffi-core`'s serde
3
+ * shape, with napi-rs's value encoding (`u64` as `number`, or `bigint` above
4
+ * `u32::MAX`; bytes as a `Buffer`). The shared serde backend defines them.
7
5
  *
8
6
  * The generated `addon.d.ts` imports these names through its header.
9
7
  */
10
8
 
11
- import type {
12
- IdentifyInfo,
13
- KnownPeerInfo,
14
- RelayReservationInfo,
15
- } from "@minip2p/core";
16
- import type {
17
- BackendConnectionInfo,
18
- BackendOpenStream,
19
- P2pEvent,
20
- PathKind,
21
- } from "@minip2p/core/backend";
22
-
23
- /** One SDK backend value as the addon encodes it. */
24
- export type NativeShape<Value> = Value extends ArrayBuffer
25
- ? Uint8Array
26
- : Value extends number
27
- ? number | bigint
28
- : Value extends string | boolean
29
- ? Value
30
- : Value extends readonly (infer Item)[]
31
- ? readonly NativeShape<Item>[]
32
- : { readonly [Key in keyof Value]: NativeShape<Value[Key]> };
33
-
34
- export type NativeEvent = NativeShape<P2pEvent>;
35
- export type NativeIdentifyInfo = NativeShape<IdentifyInfo>;
36
- export type NativeKnownPeerInfo = NativeShape<KnownPeerInfo>;
37
- export type NativeRelayReservationInfo = NativeShape<RelayReservationInfo>;
38
- export type NativeConnectionInfo = NativeShape<BackendConnectionInfo>;
39
- export type NativeOpenStream = NativeShape<BackendOpenStream>;
40
- export type NativePathKind = NativeShape<PathKind>;
9
+ export type {
10
+ NativeConnectionInfo,
11
+ NativeEvent,
12
+ NativeIdentifyInfo,
13
+ NativeKnownPeerInfo,
14
+ NativeOpenStream,
15
+ NativePathKind,
16
+ NativeRelayReservationInfo,
17
+ } from "@minip2p/core/serde-backend";
41
18
  export type { Reachability } from "@minip2p/core";