@waku/core 0.0.37-987c6cd.0 → 0.0.37-c24842a.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.
@@ -3379,6 +3379,18 @@ var PushResponse;
3379
3379
  w.uint32(18);
3380
3380
  w.string(obj.info);
3381
3381
  }
3382
+ if (obj.statusCode != null) {
3383
+ w.uint32(80);
3384
+ w.uint32(obj.statusCode);
3385
+ }
3386
+ if (obj.statusDesc != null) {
3387
+ w.uint32(90);
3388
+ w.string(obj.statusDesc);
3389
+ }
3390
+ if (obj.relayPeerCount != null) {
3391
+ w.uint32(96);
3392
+ w.uint32(obj.relayPeerCount);
3393
+ }
3382
3394
  if (opts.lengthDelimited !== false) {
3383
3395
  w.ldelim();
3384
3396
  }
@@ -3398,6 +3410,18 @@ var PushResponse;
3398
3410
  obj.info = reader.string();
3399
3411
  break;
3400
3412
  }
3413
+ case 10: {
3414
+ obj.statusCode = reader.uint32();
3415
+ break;
3416
+ }
3417
+ case 11: {
3418
+ obj.statusDesc = reader.string();
3419
+ break;
3420
+ }
3421
+ case 12: {
3422
+ obj.relayPeerCount = reader.uint32();
3423
+ break;
3424
+ }
3401
3425
  default: {
3402
3426
  reader.skipType(tag & 7);
3403
3427
  break;
@@ -3482,6 +3506,141 @@ var PushRpc$1;
3482
3506
  return decodeMessage(buf, PushRpc.codec(), opts);
3483
3507
  };
3484
3508
  })(PushRpc$1 || (PushRpc$1 = {}));
3509
+ var LightPushRequestV3;
3510
+ (function (LightPushRequestV3) {
3511
+ let _codec;
3512
+ LightPushRequestV3.codec = () => {
3513
+ if (_codec == null) {
3514
+ _codec = message$1((obj, w, opts = {}) => {
3515
+ if (opts.lengthDelimited !== false) {
3516
+ w.fork();
3517
+ }
3518
+ if ((obj.requestId != null && obj.requestId !== '')) {
3519
+ w.uint32(10);
3520
+ w.string(obj.requestId);
3521
+ }
3522
+ if (obj.pubsubTopic != null) {
3523
+ w.uint32(162);
3524
+ w.string(obj.pubsubTopic);
3525
+ }
3526
+ if (obj.message != null) {
3527
+ w.uint32(170);
3528
+ WakuMessage$1.codec().encode(obj.message, w);
3529
+ }
3530
+ if (opts.lengthDelimited !== false) {
3531
+ w.ldelim();
3532
+ }
3533
+ }, (reader, length, opts = {}) => {
3534
+ const obj = {
3535
+ requestId: ''
3536
+ };
3537
+ const end = length == null ? reader.len : reader.pos + length;
3538
+ while (reader.pos < end) {
3539
+ const tag = reader.uint32();
3540
+ switch (tag >>> 3) {
3541
+ case 1: {
3542
+ obj.requestId = reader.string();
3543
+ break;
3544
+ }
3545
+ case 20: {
3546
+ obj.pubsubTopic = reader.string();
3547
+ break;
3548
+ }
3549
+ case 21: {
3550
+ obj.message = WakuMessage$1.codec().decode(reader, reader.uint32(), {
3551
+ limits: opts.limits?.message
3552
+ });
3553
+ break;
3554
+ }
3555
+ default: {
3556
+ reader.skipType(tag & 7);
3557
+ break;
3558
+ }
3559
+ }
3560
+ }
3561
+ return obj;
3562
+ });
3563
+ }
3564
+ return _codec;
3565
+ };
3566
+ LightPushRequestV3.encode = (obj) => {
3567
+ return encodeMessage(obj, LightPushRequestV3.codec());
3568
+ };
3569
+ LightPushRequestV3.decode = (buf, opts) => {
3570
+ return decodeMessage(buf, LightPushRequestV3.codec(), opts);
3571
+ };
3572
+ })(LightPushRequestV3 || (LightPushRequestV3 = {}));
3573
+ var LightPushResponseV3;
3574
+ (function (LightPushResponseV3) {
3575
+ let _codec;
3576
+ LightPushResponseV3.codec = () => {
3577
+ if (_codec == null) {
3578
+ _codec = message$1((obj, w, opts = {}) => {
3579
+ if (opts.lengthDelimited !== false) {
3580
+ w.fork();
3581
+ }
3582
+ if ((obj.requestId != null && obj.requestId !== '')) {
3583
+ w.uint32(10);
3584
+ w.string(obj.requestId);
3585
+ }
3586
+ if ((obj.statusCode != null && obj.statusCode !== 0)) {
3587
+ w.uint32(80);
3588
+ w.uint32(obj.statusCode);
3589
+ }
3590
+ if (obj.statusDesc != null) {
3591
+ w.uint32(90);
3592
+ w.string(obj.statusDesc);
3593
+ }
3594
+ if (obj.relayPeerCount != null) {
3595
+ w.uint32(96);
3596
+ w.uint32(obj.relayPeerCount);
3597
+ }
3598
+ if (opts.lengthDelimited !== false) {
3599
+ w.ldelim();
3600
+ }
3601
+ }, (reader, length, opts = {}) => {
3602
+ const obj = {
3603
+ requestId: '',
3604
+ statusCode: 0
3605
+ };
3606
+ const end = length == null ? reader.len : reader.pos + length;
3607
+ while (reader.pos < end) {
3608
+ const tag = reader.uint32();
3609
+ switch (tag >>> 3) {
3610
+ case 1: {
3611
+ obj.requestId = reader.string();
3612
+ break;
3613
+ }
3614
+ case 10: {
3615
+ obj.statusCode = reader.uint32();
3616
+ break;
3617
+ }
3618
+ case 11: {
3619
+ obj.statusDesc = reader.string();
3620
+ break;
3621
+ }
3622
+ case 12: {
3623
+ obj.relayPeerCount = reader.uint32();
3624
+ break;
3625
+ }
3626
+ default: {
3627
+ reader.skipType(tag & 7);
3628
+ break;
3629
+ }
3630
+ }
3631
+ }
3632
+ return obj;
3633
+ });
3634
+ }
3635
+ return _codec;
3636
+ };
3637
+ LightPushResponseV3.encode = (obj) => {
3638
+ return encodeMessage(obj, LightPushResponseV3.codec());
3639
+ };
3640
+ LightPushResponseV3.decode = (buf, opts) => {
3641
+ return decodeMessage(buf, LightPushResponseV3.codec(), opts);
3642
+ };
3643
+ })(LightPushResponseV3 || (LightPushResponseV3 = {}));
3485
3644
  var RateLimitProof$1;
3486
3645
  (function (RateLimitProof) {
3487
3646
  let _codec;
@@ -5397,26 +5556,34 @@ var ProtocolError;
5397
5556
  ProtocolError["INVALID_DECODER_TOPICS"] = "Invalid decoder topics";
5398
5557
  })(ProtocolError || (ProtocolError = {}));
5399
5558
 
5559
+ // Peer tags
5400
5560
  var Tags;
5401
5561
  (function (Tags) {
5402
5562
  Tags["BOOTSTRAP"] = "bootstrap";
5403
5563
  Tags["PEER_EXCHANGE"] = "peer-exchange";
5404
5564
  Tags["LOCAL"] = "local-peer-cache";
5405
5565
  })(Tags || (Tags = {}));
5566
+ // Connection tag
5567
+ const CONNECTION_LOCKED_TAG = "locked";
5406
5568
 
5407
5569
  /**
5408
5570
  * The default cluster ID for The Waku Network
5409
5571
  */
5410
5572
  const DEFAULT_CLUSTER_ID = 1;
5411
5573
 
5412
- var HealthStatusChangeEvents;
5413
- (function (HealthStatusChangeEvents) {
5414
- HealthStatusChangeEvents["StatusChange"] = "health:change";
5415
- })(HealthStatusChangeEvents || (HealthStatusChangeEvents = {}));
5416
5574
  var HealthStatus;
5417
5575
  (function (HealthStatus) {
5576
+ /**
5577
+ * No peer connections
5578
+ */
5418
5579
  HealthStatus["Unhealthy"] = "Unhealthy";
5580
+ /**
5581
+ * At least 1 peer supporting both Filter and LightPush protocols
5582
+ */
5419
5583
  HealthStatus["MinimallyHealthy"] = "MinimallyHealthy";
5584
+ /**
5585
+ * At least 2 peers supporting both Filter and LightPush protocols
5586
+ */
5420
5587
  HealthStatus["SufficientlyHealthy"] = "SufficientlyHealthy";
5421
5588
  })(HealthStatus || (HealthStatus = {}));
5422
5589
 
@@ -5497,27 +5664,6 @@ const pubsubTopicToSingleShardInfo = (pubsubTopics) => {
5497
5664
  shard
5498
5665
  };
5499
5666
  };
5500
- const pubsubTopicsToShardInfo = (pubsubTopics) => {
5501
- const shardInfoSet = new Set();
5502
- const clusterIds = new Set();
5503
- for (const topic of pubsubTopics) {
5504
- const { clusterId, shard } = pubsubTopicToSingleShardInfo(topic);
5505
- shardInfoSet.add(`${clusterId}:${shard}`);
5506
- clusterIds.add(clusterId);
5507
- }
5508
- if (shardInfoSet.size === 0) {
5509
- throw new Error("No valid pubsub topics provided");
5510
- }
5511
- if (clusterIds.size > 1) {
5512
- throw new Error("Pubsub topics from multiple cluster IDs are not supported");
5513
- }
5514
- const clusterId = clusterIds.values().next().value;
5515
- const shards = Array.from(shardInfoSet).map((info) => parseInt(info.split(":")[1]));
5516
- return {
5517
- clusterId,
5518
- shards
5519
- };
5520
- };
5521
5667
  /**
5522
5668
  * Given a string, will throw an error if it is not formatted as a valid content topic for autosharding based on https://rfc.vac.dev/spec/51/
5523
5669
  * @param contentTopic String to validate
@@ -6520,4 +6666,4 @@ var version_0 = /*#__PURE__*/Object.freeze({
6520
6666
  proto: message
6521
6667
  });
6522
6668
 
6523
- export { sha256 as $, anumber as A, randomBytes as B, sha512 as C, enumeration as D, message$1 as E, FilterSubscribeRequest as F, encodeMessage as G, decodeMessage as H, Hash as I, ahash as J, toBytes as K, Logger as L, MessagePush as M, clean as N, aexists as O, ProtocolError as P, sha256$1 as Q, bases as R, StoreQueryRequest$1 as S, Tags as T, base64url as U, encodeUint8Array as V, bytesToUtf8 as W, WakuMetadataRequest as X, pubsubTopicsToShardInfo as Y, WakuMetadataResponse as Z, concat as _, base58btc as a, bytesToHex as a0, numberToBytes as a1, createDecoder as a2, Version as a3, message as a4, DecodedMessage as a5, Encoder as a6, Decoder as a7, base32 as b, coerce as c, base36 as d, equals as e, allocUnsafe as f, alloc$1 as g, encodingLength as h, encode$2 as i, decode$2 as j, FilterSubscribeResponse$1 as k, PushRpc$1 as l, PushResponse as m, StoreQueryResponse$1 as n, createEncoder as o, pubsubTopicToSingleShardInfo as p, contentTopicToShardIndex as q, fromString as r, hexToBytes as s, toString as t, utf8ToBytes as u, version_0 as v, isBytes as w, abytes as x, bytesToHex$1 as y, concatBytes as z };
6669
+ export { sha256 as $, anumber as A, randomBytes as B, CONNECTION_LOCKED_TAG as C, sha512 as D, enumeration as E, FilterSubscribeRequest as F, message$1 as G, encodeMessage as H, decodeMessage as I, Hash as J, ahash as K, Logger as L, MessagePush as M, toBytes as N, clean as O, ProtocolError as P, aexists as Q, sha256$1 as R, StoreQueryRequest$1 as S, Tags as T, bases as U, base64url as V, encodeUint8Array as W, bytesToUtf8 as X, WakuMetadataRequest as Y, WakuMetadataResponse as Z, concat as _, base58btc as a, bytesToHex as a0, numberToBytes as a1, createDecoder as a2, Version as a3, message as a4, DecodedMessage as a5, Encoder as a6, Decoder as a7, base32 as b, coerce as c, base36 as d, equals as e, allocUnsafe as f, alloc$1 as g, encodingLength as h, encode$2 as i, decode$2 as j, FilterSubscribeResponse$1 as k, PushRpc$1 as l, PushResponse as m, StoreQueryResponse$1 as n, createEncoder as o, pubsubTopicToSingleShardInfo as p, contentTopicToShardIndex as q, fromString as r, hexToBytes as s, toString as t, utf8ToBytes as u, version_0 as v, isBytes as w, abytes as x, bytesToHex$1 as y, concatBytes as z };