@minip2p/core 0.7.3 → 0.7.5
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/README.md +3 -1
- package/dist/backend.d.ts +22 -5
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js +2 -0
- package/dist/backend.js.map +1 -1
- package/dist/errors.d.ts +12 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +17 -0
- package/dist/errors.js.map +1 -1
- package/dist/event-drain.d.ts +17 -0
- package/dist/event-drain.d.ts.map +1 -0
- package/dist/event-drain.js +75 -0
- package/dist/event-drain.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/native-ids.d.ts +31 -0
- package/dist/native-ids.d.ts.map +1 -0
- package/dist/native-ids.js +62 -0
- package/dist/native-ids.js.map +1 -0
- package/dist/sdk.d.ts +65 -10
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +442 -48
- package/dist/sdk.js.map +1 -1
- package/dist/types.d.ts +33 -22
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +24 -22
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/backend.ts +22 -5
- package/src/errors.ts +21 -0
- package/src/event-drain.ts +87 -0
- package/src/index.ts +1 -0
- package/src/native-ids.ts +66 -0
- package/src/sdk.ts +512 -80
- package/src/types.ts +32 -22
package/src/types.ts
CHANGED
|
@@ -40,51 +40,51 @@ export interface Minip2pMdnsOptions {
|
|
|
40
40
|
|
|
41
41
|
/** Coarse local reachability states. */
|
|
42
42
|
export const Reachability = {
|
|
43
|
-
Private:
|
|
44
|
-
Public:
|
|
45
|
-
Unknown:
|
|
43
|
+
Private: "Private",
|
|
44
|
+
Public: "Public",
|
|
45
|
+
Unknown: "Unknown",
|
|
46
46
|
} as const;
|
|
47
47
|
export type Reachability = (typeof Reachability)[keyof typeof Reachability];
|
|
48
48
|
|
|
49
49
|
/** Sources contributing peer-discovery observations. */
|
|
50
50
|
export const DiscoverySource = {
|
|
51
|
-
Mdns:
|
|
52
|
-
SignedBeacon:
|
|
51
|
+
Mdns: "Mdns",
|
|
52
|
+
SignedBeacon: "SignedBeacon",
|
|
53
53
|
} as const;
|
|
54
54
|
export type DiscoverySource =
|
|
55
55
|
(typeof DiscoverySource)[keyof typeof DiscoverySource];
|
|
56
56
|
|
|
57
57
|
/** Fatal native-driver failure categories. */
|
|
58
58
|
export const DriverFailureKind = {
|
|
59
|
-
Invariant:
|
|
60
|
-
Panic:
|
|
61
|
-
Swarm:
|
|
62
|
-
Transport:
|
|
59
|
+
Invariant: "Invariant",
|
|
60
|
+
Panic: "Panic",
|
|
61
|
+
Swarm: "Swarm",
|
|
62
|
+
Transport: "Transport",
|
|
63
63
|
} as const;
|
|
64
64
|
export type DriverFailureKind =
|
|
65
65
|
(typeof DriverFailureKind)[keyof typeof DriverFailureKind];
|
|
66
66
|
|
|
67
67
|
/** Non-fatal endpoint runtime error categories. */
|
|
68
68
|
export const EndpointErrorKind = {
|
|
69
|
-
Driver:
|
|
70
|
-
Identify:
|
|
71
|
-
IdentifyStreamRejected:
|
|
72
|
-
Multistream:
|
|
73
|
-
OpenStreamFailed:
|
|
74
|
-
Ping:
|
|
75
|
-
Transport:
|
|
76
|
-
UnsupportedProtocol:
|
|
69
|
+
Driver: "Driver",
|
|
70
|
+
Identify: "Identify",
|
|
71
|
+
IdentifyStreamRejected: "IdentifyStreamRejected",
|
|
72
|
+
Multistream: "Multistream",
|
|
73
|
+
OpenStreamFailed: "OpenStreamFailed",
|
|
74
|
+
Ping: "Ping",
|
|
75
|
+
Transport: "Transport",
|
|
76
|
+
UnsupportedProtocol: "UnsupportedProtocol",
|
|
77
77
|
} as const;
|
|
78
78
|
export type EndpointErrorKind =
|
|
79
79
|
(typeof EndpointErrorKind)[keyof typeof EndpointErrorKind];
|
|
80
80
|
|
|
81
81
|
/** Terminal NAT connection failure categories. */
|
|
82
82
|
export const NatErrorKind = {
|
|
83
|
-
DialFailed:
|
|
84
|
-
NoPathAvailable:
|
|
85
|
-
Protocol:
|
|
86
|
-
RelayRefused:
|
|
87
|
-
Timeout:
|
|
83
|
+
DialFailed: "DialFailed",
|
|
84
|
+
NoPathAvailable: "NoPathAvailable",
|
|
85
|
+
Protocol: "Protocol",
|
|
86
|
+
RelayRefused: "RelayRefused",
|
|
87
|
+
Timeout: "Timeout",
|
|
88
88
|
} as const;
|
|
89
89
|
export type NatErrorKind = (typeof NatErrorKind)[keyof typeof NatErrorKind];
|
|
90
90
|
|
|
@@ -448,6 +448,8 @@ export const P2pEvent_Tags = {
|
|
|
448
448
|
StreamData: "StreamData",
|
|
449
449
|
StreamReady: "StreamReady",
|
|
450
450
|
StreamRemoteWriteClosed: "StreamRemoteWriteClosed",
|
|
451
|
+
StreamWriteAccepted: "StreamWriteAccepted",
|
|
452
|
+
StreamWriteStopped: "StreamWriteStopped",
|
|
451
453
|
} as const;
|
|
452
454
|
export type P2pEventTag = (typeof P2pEvent_Tags)[keyof typeof P2pEvent_Tags];
|
|
453
455
|
|
|
@@ -500,6 +502,14 @@ export type P2pEvent =
|
|
|
500
502
|
typeof P2pEvent_Tags.StreamRemoteWriteClosed,
|
|
501
503
|
{ peerId: string; connId: number; streamId: number }
|
|
502
504
|
>
|
|
505
|
+
| RawEvent<
|
|
506
|
+
typeof P2pEvent_Tags.StreamWriteAccepted,
|
|
507
|
+
{ peerId: string; connId: number; streamId: number }
|
|
508
|
+
>
|
|
509
|
+
| RawEvent<
|
|
510
|
+
typeof P2pEvent_Tags.StreamWriteStopped,
|
|
511
|
+
{ peerId: string; connId: number; streamId: number; errorCode: bigint }
|
|
512
|
+
>
|
|
503
513
|
| RawEvent<
|
|
504
514
|
typeof P2pEvent_Tags.StreamClosed,
|
|
505
515
|
{ peerId: string; connId: number; streamId: number }
|