@minip2p/react-native 0.8.3 → 0.10.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.
Files changed (27) hide show
  1. package/android/src/main/jniLibs/arm64-v8a/libminip2p_ffi.so +0 -0
  2. package/android/src/main/jniLibs/x86_64/libminip2p_ffi.so +0 -0
  3. package/build/Minip2pFfi.xcframework/Info.plist +4 -4
  4. package/build/Minip2pFfi.xcframework/ios-arm64/libminip2p_ffi.a +2 -2
  5. package/build/Minip2pFfi.xcframework/ios-arm64-simulator/libminip2p_ffi.a +2 -2
  6. package/cpp/generated/minip2p_ffi.cpp +3 -2
  7. package/lib/module/adapter.js +124 -25
  8. package/lib/module/adapter.js.map +1 -1
  9. package/lib/module/generated/minip2p_ffi.js +15 -10
  10. package/lib/module/generated/minip2p_ffi.js.map +1 -1
  11. package/lib/module/generated/minip2p_ffi_core.js +908 -293
  12. package/lib/module/generated/minip2p_ffi_core.js.map +1 -1
  13. package/lib/typescript/src/adapter.d.ts.map +1 -1
  14. package/lib/typescript/src/generated/minip2p_ffi-ffi.d.ts +1 -1
  15. package/lib/typescript/src/generated/minip2p_ffi-ffi.d.ts.map +1 -1
  16. package/lib/typescript/src/generated/minip2p_ffi.d.ts +20 -10
  17. package/lib/typescript/src/generated/minip2p_ffi.d.ts.map +1 -1
  18. package/lib/typescript/src/generated/minip2p_ffi_core.d.ts +572 -119
  19. package/lib/typescript/src/generated/minip2p_ffi_core.d.ts.map +1 -1
  20. package/lib/typescript/src/hook-lifecycle.d.ts +2 -2
  21. package/lib/typescript/src/hook-lifecycle.d.ts.map +1 -1
  22. package/package.json +2 -2
  23. package/src/adapter.ts +142 -40
  24. package/src/generated/minip2p_ffi-ffi.ts +1 -1
  25. package/src/generated/minip2p_ffi.ts +25 -14
  26. package/src/generated/minip2p_ffi_core.ts +1015 -355
  27. package/src/hook-lifecycle.ts +2 -2
@@ -324,7 +324,7 @@ export interface P2pEndpointLike {
324
324
  */
325
325
  connectedPeers() /*throws*/: Array<string>;
326
326
  /**
327
- * Returns the transport connection selected for a peer.
327
+ * Returns a snapshot of a peer's established connection.
328
328
  */
329
329
  connectionInfo(peerId: string) /*throws*/: ConnectionInfo | undefined;
330
330
  /**
@@ -360,7 +360,8 @@ export interface P2pEndpointLike {
360
360
  */
361
361
  openStream(peerId: string, protocolId: string) /*throws*/: OpenStreamResult;
362
362
  /**
363
- * Returns the current path to a peer.
363
+ * Returns the path of a peer's established connection; `None` only
364
+ * while the peer is not connected.
364
365
  */
365
366
  path(peerId: string) /*throws*/: PathKind | undefined;
366
367
  /**
@@ -405,12 +406,16 @@ export interface P2pEndpointLike {
405
406
  */
406
407
  start(doorbell: P2pEventDoorbell) /*throws*/: void;
407
408
  /**
408
- * Requests shutdown.
409
+ * Requests shutdown; the driver drains its close for up to
410
+ * `timeout_ms` and reports how that went as its last event,
411
+ * `EndpointClosed`.
409
412
  */
410
- stop(): void;
413
+ stop(timeoutMs: bigint): void;
411
414
  /**
412
415
  * Acknowledges `bytes` of a stream's received data as consumed,
413
- * letting its sender continue. Every registered protocol needs this.
416
+ * letting its sender continue. Every registered protocol needs this,
417
+ * also after the stream's connection closed: unacknowledged bytes keep
418
+ * the ended connection's slot until they are acknowledged or abandoned.
414
419
  */
415
420
  streamConsumed(connId: bigint, streamId: bigint, bytes: bigint) /*throws*/: void;
416
421
  /**
@@ -578,7 +583,7 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
578
583
  }
579
584
 
580
585
  /**
581
- * Returns the transport connection selected for a peer.
586
+ * Returns a snapshot of a peer's established connection.
582
587
  */
583
588
  connectionInfo(peerId: string): ConnectionInfo | undefined /*throws*/ {
584
589
  const __rb: Uint8Array = uniffiCaller.rustCallWithError(
@@ -744,7 +749,8 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
744
749
  }
745
750
 
746
751
  /**
747
- * Returns the current path to a peer.
752
+ * Returns the path of a peer's established connection; `None` only
753
+ * while the peer is not connected.
748
754
  */
749
755
  path(peerId: string): PathKind | undefined /*throws*/ {
750
756
  const __rb: Uint8Array = uniffiCaller.rustCallWithError(
@@ -919,11 +925,14 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
919
925
  }
920
926
 
921
927
  /**
922
- * Requests shutdown.
928
+ * Requests shutdown; the driver drains its close for up to
929
+ * `timeout_ms` and reports how that went as its last event,
930
+ * `EndpointClosed`.
923
931
  */
924
- stop(): void {uniffiCaller.rustCall(
932
+ stop(timeoutMs: bigint): void {uniffiCaller.rustCall(
925
933
  /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_stop(
926
934
  uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
935
+ FfiConverterUInt64.lower(timeoutMs, nativeModule().rustbuffer_alloc),
927
936
  callStatus);
928
937
  },
929
938
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
@@ -932,7 +941,9 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
932
941
 
933
942
  /**
934
943
  * Acknowledges `bytes` of a stream's received data as consumed,
935
- * letting its sender continue. Every registered protocol needs this.
944
+ * letting its sender continue. Every registered protocol needs this,
945
+ * also after the stream's connection closed: unacknowledged bytes keep
946
+ * the ended connection's slot until they are acknowledged or abandoned.
936
947
  */
937
948
  streamConsumed(connId: bigint, streamId: bigint, bytes: bigint): void /*throws*/ {uniffiCaller.rustCallWithError(
938
949
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
@@ -1140,7 +1151,7 @@ function uniffiEnsureInitialized() {
1140
1151
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers() !== 23362) {
1141
1152
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers");
1142
1153
  }
1143
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info() !== 13610) {
1154
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info() !== 45983) {
1144
1155
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info");
1145
1156
  }
1146
1157
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect() !== 7330) {
@@ -1167,7 +1178,7 @@ function uniffiEnsureInitialized() {
1167
1178
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_open_stream() !== 35730) {
1168
1179
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_open_stream");
1169
1180
  }
1170
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_path() !== 4892) {
1181
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_path() !== 57440) {
1171
1182
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_path");
1172
1183
  }
1173
1184
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_peer_id() !== 42474) {
@@ -1197,10 +1208,10 @@ function uniffiEnsureInitialized() {
1197
1208
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_start() !== 43725) {
1198
1209
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_start");
1199
1210
  }
1200
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_stop() !== 11062) {
1211
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_stop() !== 31752) {
1201
1212
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_stop");
1202
1213
  }
1203
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_stream_consumed() !== 61579) {
1214
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_stream_consumed() !== 52358) {
1204
1215
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_stream_consumed");
1205
1216
  }
1206
1217
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_subscribe() !== 41051) {