@waku/message-encryption 0.0.29-ce62600.0 → 0.0.29-f387f59.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.
@@ -818,7 +818,7 @@ function decodeMessage(buf, codec, opts) {
818
818
  * A general purpose buffer pool
819
819
  */
820
820
  function pool(size) {
821
- const SIZE = size ?? 8192;
821
+ const SIZE = 8192;
822
822
  const MAX = SIZE >>> 1;
823
823
  let slab;
824
824
  let offset = SIZE;
@@ -1331,12 +1331,17 @@ function message(encode, decode) {
1331
1331
  * npm i protons-runtime
1332
1332
  * ```
1333
1333
  */
1334
- class CodeError extends Error {
1335
- code;
1336
- constructor(message, code, options) {
1337
- super(message, options);
1338
- this.code = code;
1339
- }
1334
+ /**
1335
+ * Thrown when a repeated field has too many elements
1336
+ */
1337
+ class MaxLengthError extends Error {
1338
+ /**
1339
+ * This will be removed in a future release
1340
+ *
1341
+ * @deprecated use the `.name` property instead
1342
+ */
1343
+ code = 'ERR_MAX_LENGTH';
1344
+ name = 'MaxLengthError';
1340
1345
  }
1341
1346
 
1342
1347
  /* eslint-disable import/export */
@@ -1638,7 +1643,7 @@ var FilterRequest;
1638
1643
  }
1639
1644
  case 3: {
1640
1645
  if (opts.limits?.contentFilters != null && obj.contentFilters.length === opts.limits.contentFilters) {
1641
- throw new CodeError('decode error - map field "contentFilters" had too many elements', 'ERR_MAX_LENGTH');
1646
+ throw new MaxLengthError('Decode error - map field "contentFilters" had too many elements');
1642
1647
  }
1643
1648
  obj.contentFilters.push(FilterRequest.ContentFilter.codec().decode(reader, reader.uint32(), {
1644
1649
  limits: opts.limits?.contentFilters$
@@ -1691,7 +1696,7 @@ var MessagePush$1;
1691
1696
  switch (tag >>> 3) {
1692
1697
  case 1: {
1693
1698
  if (opts.limits?.messages != null && obj.messages.length === opts.limits.messages) {
1694
- throw new CodeError('decode error - map field "messages" had too many elements', 'ERR_MAX_LENGTH');
1699
+ throw new MaxLengthError('Decode error - map field "messages" had too many elements');
1695
1700
  }
1696
1701
  obj.messages.push(WakuMessage$3.codec().decode(reader, reader.uint32(), {
1697
1702
  limits: opts.limits?.messages$
@@ -2110,7 +2115,7 @@ var FilterSubscribeRequest;
2110
2115
  }
2111
2116
  case 11: {
2112
2117
  if (opts.limits?.contentTopics != null && obj.contentTopics.length === opts.limits.contentTopics) {
2113
- throw new CodeError('decode error - map field "contentTopics" had too many elements', 'ERR_MAX_LENGTH');
2118
+ throw new MaxLengthError('Decode error - map field "contentTopics" had too many elements');
2114
2119
  }
2115
2120
  obj.contentTopics.push(reader.string());
2116
2121
  break;
@@ -2832,113 +2837,26 @@ var WakuMessage$1;
2832
2837
  /* eslint-disable @typescript-eslint/no-namespace */
2833
2838
  /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
2834
2839
  /* eslint-disable @typescript-eslint/no-empty-interface */
2835
- var Index;
2836
- (function (Index) {
2840
+ var WakuMessageKeyValue;
2841
+ (function (WakuMessageKeyValue) {
2837
2842
  let _codec;
2838
- Index.codec = () => {
2843
+ WakuMessageKeyValue.codec = () => {
2839
2844
  if (_codec == null) {
2840
2845
  _codec = message((obj, w, opts = {}) => {
2841
2846
  if (opts.lengthDelimited !== false) {
2842
2847
  w.fork();
2843
2848
  }
2844
- if ((obj.digest != null && obj.digest.byteLength > 0)) {
2849
+ if (obj.messageHash != null) {
2845
2850
  w.uint32(10);
2846
- w.bytes(obj.digest);
2847
- }
2848
- if ((obj.receiverTime != null && obj.receiverTime !== 0n)) {
2849
- w.uint32(16);
2850
- w.sint64(obj.receiverTime);
2851
+ w.bytes(obj.messageHash);
2851
2852
  }
2852
- if ((obj.senderTime != null && obj.senderTime !== 0n)) {
2853
- w.uint32(24);
2854
- w.sint64(obj.senderTime);
2855
- }
2856
- if ((obj.pubsubTopic != null && obj.pubsubTopic !== '')) {
2857
- w.uint32(34);
2858
- w.string(obj.pubsubTopic);
2859
- }
2860
- if (opts.lengthDelimited !== false) {
2861
- w.ldelim();
2862
- }
2863
- }, (reader, length, opts = {}) => {
2864
- const obj = {
2865
- digest: alloc$1(0),
2866
- receiverTime: 0n,
2867
- senderTime: 0n,
2868
- pubsubTopic: ''
2869
- };
2870
- const end = length == null ? reader.len : reader.pos + length;
2871
- while (reader.pos < end) {
2872
- const tag = reader.uint32();
2873
- switch (tag >>> 3) {
2874
- case 1: {
2875
- obj.digest = reader.bytes();
2876
- break;
2877
- }
2878
- case 2: {
2879
- obj.receiverTime = reader.sint64();
2880
- break;
2881
- }
2882
- case 3: {
2883
- obj.senderTime = reader.sint64();
2884
- break;
2885
- }
2886
- case 4: {
2887
- obj.pubsubTopic = reader.string();
2888
- break;
2889
- }
2890
- default: {
2891
- reader.skipType(tag & 7);
2892
- break;
2893
- }
2894
- }
2895
- }
2896
- return obj;
2897
- });
2898
- }
2899
- return _codec;
2900
- };
2901
- Index.encode = (obj) => {
2902
- return encodeMessage(obj, Index.codec());
2903
- };
2904
- Index.decode = (buf, opts) => {
2905
- return decodeMessage(buf, Index.codec(), opts);
2906
- };
2907
- })(Index || (Index = {}));
2908
- var PagingInfo;
2909
- (function (PagingInfo) {
2910
- (function (Direction) {
2911
- Direction["BACKWARD"] = "BACKWARD";
2912
- Direction["FORWARD"] = "FORWARD";
2913
- })(PagingInfo.Direction || (PagingInfo.Direction = {}));
2914
- let __DirectionValues;
2915
- (function (__DirectionValues) {
2916
- __DirectionValues[__DirectionValues["BACKWARD"] = 0] = "BACKWARD";
2917
- __DirectionValues[__DirectionValues["FORWARD"] = 1] = "FORWARD";
2918
- })(__DirectionValues || (__DirectionValues = {}));
2919
- (function (Direction) {
2920
- Direction.codec = () => {
2921
- return enumeration(__DirectionValues);
2922
- };
2923
- })(PagingInfo.Direction || (PagingInfo.Direction = {}));
2924
- let _codec;
2925
- PagingInfo.codec = () => {
2926
- if (_codec == null) {
2927
- _codec = message((obj, w, opts = {}) => {
2928
- if (opts.lengthDelimited !== false) {
2929
- w.fork();
2930
- }
2931
- if (obj.pageSize != null) {
2932
- w.uint32(8);
2933
- w.uint64(obj.pageSize);
2934
- }
2935
- if (obj.cursor != null) {
2853
+ if (obj.message != null) {
2936
2854
  w.uint32(18);
2937
- Index.codec().encode(obj.cursor, w);
2855
+ WakuMessage.codec().encode(obj.message, w);
2938
2856
  }
2939
- if (obj.direction != null) {
2940
- w.uint32(24);
2941
- PagingInfo.Direction.codec().encode(obj.direction, w);
2857
+ if (obj.pubsubTopic != null) {
2858
+ w.uint32(26);
2859
+ w.string(obj.pubsubTopic);
2942
2860
  }
2943
2861
  if (opts.lengthDelimited !== false) {
2944
2862
  w.ldelim();
@@ -2950,17 +2868,17 @@ var PagingInfo;
2950
2868
  const tag = reader.uint32();
2951
2869
  switch (tag >>> 3) {
2952
2870
  case 1: {
2953
- obj.pageSize = reader.uint64();
2871
+ obj.messageHash = reader.bytes();
2954
2872
  break;
2955
2873
  }
2956
2874
  case 2: {
2957
- obj.cursor = Index.codec().decode(reader, reader.uint32(), {
2958
- limits: opts.limits?.cursor
2875
+ obj.message = WakuMessage.codec().decode(reader, reader.uint32(), {
2876
+ limits: opts.limits?.message
2959
2877
  });
2960
2878
  break;
2961
2879
  }
2962
2880
  case 3: {
2963
- obj.direction = PagingInfo.Direction.codec().decode(reader);
2881
+ obj.pubsubTopic = reader.string();
2964
2882
  break;
2965
2883
  }
2966
2884
  default: {
@@ -2974,217 +2892,125 @@ var PagingInfo;
2974
2892
  }
2975
2893
  return _codec;
2976
2894
  };
2977
- PagingInfo.encode = (obj) => {
2978
- return encodeMessage(obj, PagingInfo.codec());
2895
+ WakuMessageKeyValue.encode = (obj) => {
2896
+ return encodeMessage(obj, WakuMessageKeyValue.codec());
2979
2897
  };
2980
- PagingInfo.decode = (buf, opts) => {
2981
- return decodeMessage(buf, PagingInfo.codec(), opts);
2898
+ WakuMessageKeyValue.decode = (buf, opts) => {
2899
+ return decodeMessage(buf, WakuMessageKeyValue.codec(), opts);
2982
2900
  };
2983
- })(PagingInfo || (PagingInfo = {}));
2984
- var ContentFilter;
2985
- (function (ContentFilter) {
2901
+ })(WakuMessageKeyValue || (WakuMessageKeyValue = {}));
2902
+ var StoreQueryRequest;
2903
+ (function (StoreQueryRequest) {
2986
2904
  let _codec;
2987
- ContentFilter.codec = () => {
2905
+ StoreQueryRequest.codec = () => {
2988
2906
  if (_codec == null) {
2989
2907
  _codec = message((obj, w, opts = {}) => {
2990
2908
  if (opts.lengthDelimited !== false) {
2991
2909
  w.fork();
2992
2910
  }
2993
- if ((obj.contentTopic != null && obj.contentTopic !== '')) {
2911
+ if ((obj.requestId != null && obj.requestId !== '')) {
2994
2912
  w.uint32(10);
2995
- w.string(obj.contentTopic);
2913
+ w.string(obj.requestId);
2996
2914
  }
2997
- if (opts.lengthDelimited !== false) {
2998
- w.ldelim();
2915
+ if ((obj.includeData != null && obj.includeData !== false)) {
2916
+ w.uint32(16);
2917
+ w.bool(obj.includeData);
2999
2918
  }
3000
- }, (reader, length, opts = {}) => {
3001
- const obj = {
3002
- contentTopic: ''
3003
- };
3004
- const end = length == null ? reader.len : reader.pos + length;
3005
- while (reader.pos < end) {
3006
- const tag = reader.uint32();
3007
- switch (tag >>> 3) {
3008
- case 1: {
3009
- obj.contentTopic = reader.string();
3010
- break;
3011
- }
3012
- default: {
3013
- reader.skipType(tag & 7);
3014
- break;
3015
- }
2919
+ if (obj.pubsubTopic != null) {
2920
+ w.uint32(82);
2921
+ w.string(obj.pubsubTopic);
2922
+ }
2923
+ if (obj.contentTopics != null) {
2924
+ for (const value of obj.contentTopics) {
2925
+ w.uint32(90);
2926
+ w.string(value);
3016
2927
  }
3017
2928
  }
3018
- return obj;
3019
- });
3020
- }
3021
- return _codec;
3022
- };
3023
- ContentFilter.encode = (obj) => {
3024
- return encodeMessage(obj, ContentFilter.codec());
3025
- };
3026
- ContentFilter.decode = (buf, opts) => {
3027
- return decodeMessage(buf, ContentFilter.codec(), opts);
3028
- };
3029
- })(ContentFilter || (ContentFilter = {}));
3030
- var HistoryQuery;
3031
- (function (HistoryQuery) {
3032
- let _codec;
3033
- HistoryQuery.codec = () => {
3034
- if (_codec == null) {
3035
- _codec = message((obj, w, opts = {}) => {
3036
- if (opts.lengthDelimited !== false) {
3037
- w.fork();
2929
+ if (obj.timeStart != null) {
2930
+ w.uint32(96);
2931
+ w.sint64(obj.timeStart);
3038
2932
  }
3039
- if (obj.pubsubTopic != null) {
3040
- w.uint32(18);
3041
- w.string(obj.pubsubTopic);
2933
+ if (obj.timeEnd != null) {
2934
+ w.uint32(104);
2935
+ w.sint64(obj.timeEnd);
3042
2936
  }
3043
- if (obj.contentFilters != null) {
3044
- for (const value of obj.contentFilters) {
3045
- w.uint32(26);
3046
- ContentFilter.codec().encode(value, w);
2937
+ if (obj.messageHashes != null) {
2938
+ for (const value of obj.messageHashes) {
2939
+ w.uint32(162);
2940
+ w.bytes(value);
3047
2941
  }
3048
2942
  }
3049
- if (obj.pagingInfo != null) {
3050
- w.uint32(34);
3051
- PagingInfo.codec().encode(obj.pagingInfo, w);
2943
+ if (obj.paginationCursor != null) {
2944
+ w.uint32(410);
2945
+ w.bytes(obj.paginationCursor);
3052
2946
  }
3053
- if (obj.startTime != null) {
3054
- w.uint32(40);
3055
- w.sint64(obj.startTime);
2947
+ if ((obj.paginationForward != null && obj.paginationForward !== false)) {
2948
+ w.uint32(416);
2949
+ w.bool(obj.paginationForward);
3056
2950
  }
3057
- if (obj.endTime != null) {
3058
- w.uint32(48);
3059
- w.sint64(obj.endTime);
2951
+ if (obj.paginationLimit != null) {
2952
+ w.uint32(424);
2953
+ w.uint64(obj.paginationLimit);
3060
2954
  }
3061
2955
  if (opts.lengthDelimited !== false) {
3062
2956
  w.ldelim();
3063
2957
  }
3064
2958
  }, (reader, length, opts = {}) => {
3065
2959
  const obj = {
3066
- contentFilters: []
2960
+ requestId: '',
2961
+ includeData: false,
2962
+ contentTopics: [],
2963
+ messageHashes: [],
2964
+ paginationForward: false
3067
2965
  };
3068
2966
  const end = length == null ? reader.len : reader.pos + length;
3069
2967
  while (reader.pos < end) {
3070
2968
  const tag = reader.uint32();
3071
2969
  switch (tag >>> 3) {
3072
- case 2: {
3073
- obj.pubsubTopic = reader.string();
2970
+ case 1: {
2971
+ obj.requestId = reader.string();
3074
2972
  break;
3075
2973
  }
3076
- case 3: {
3077
- if (opts.limits?.contentFilters != null && obj.contentFilters.length === opts.limits.contentFilters) {
3078
- throw new CodeError('decode error - map field "contentFilters" had too many elements', 'ERR_MAX_LENGTH');
3079
- }
3080
- obj.contentFilters.push(ContentFilter.codec().decode(reader, reader.uint32(), {
3081
- limits: opts.limits?.contentFilters$
3082
- }));
2974
+ case 2: {
2975
+ obj.includeData = reader.bool();
3083
2976
  break;
3084
2977
  }
3085
- case 4: {
3086
- obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32(), {
3087
- limits: opts.limits?.pagingInfo
3088
- });
2978
+ case 10: {
2979
+ obj.pubsubTopic = reader.string();
3089
2980
  break;
3090
2981
  }
3091
- case 5: {
3092
- obj.startTime = reader.sint64();
2982
+ case 11: {
2983
+ if (opts.limits?.contentTopics != null && obj.contentTopics.length === opts.limits.contentTopics) {
2984
+ throw new MaxLengthError('Decode error - map field "contentTopics" had too many elements');
2985
+ }
2986
+ obj.contentTopics.push(reader.string());
3093
2987
  break;
3094
2988
  }
3095
- case 6: {
3096
- obj.endTime = reader.sint64();
2989
+ case 12: {
2990
+ obj.timeStart = reader.sint64();
3097
2991
  break;
3098
2992
  }
3099
- default: {
3100
- reader.skipType(tag & 7);
2993
+ case 13: {
2994
+ obj.timeEnd = reader.sint64();
3101
2995
  break;
3102
2996
  }
3103
- }
3104
- }
3105
- return obj;
3106
- });
3107
- }
3108
- return _codec;
3109
- };
3110
- HistoryQuery.encode = (obj) => {
3111
- return encodeMessage(obj, HistoryQuery.codec());
3112
- };
3113
- HistoryQuery.decode = (buf, opts) => {
3114
- return decodeMessage(buf, HistoryQuery.codec(), opts);
3115
- };
3116
- })(HistoryQuery || (HistoryQuery = {}));
3117
- var HistoryResponse;
3118
- (function (HistoryResponse) {
3119
- let HistoryError;
3120
- (function (HistoryError) {
3121
- HistoryError["NONE"] = "NONE";
3122
- HistoryError["INVALID_CURSOR"] = "INVALID_CURSOR";
3123
- HistoryError["TOO_MANY_REQUESTS"] = "TOO_MANY_REQUESTS";
3124
- HistoryError["SERVICE_UNAVAILABLE"] = "SERVICE_UNAVAILABLE";
3125
- })(HistoryError = HistoryResponse.HistoryError || (HistoryResponse.HistoryError = {}));
3126
- let __HistoryErrorValues;
3127
- (function (__HistoryErrorValues) {
3128
- __HistoryErrorValues[__HistoryErrorValues["NONE"] = 0] = "NONE";
3129
- __HistoryErrorValues[__HistoryErrorValues["INVALID_CURSOR"] = 1] = "INVALID_CURSOR";
3130
- __HistoryErrorValues[__HistoryErrorValues["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
3131
- __HistoryErrorValues[__HistoryErrorValues["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
3132
- })(__HistoryErrorValues || (__HistoryErrorValues = {}));
3133
- (function (HistoryError) {
3134
- HistoryError.codec = () => {
3135
- return enumeration(__HistoryErrorValues);
3136
- };
3137
- })(HistoryError = HistoryResponse.HistoryError || (HistoryResponse.HistoryError = {}));
3138
- let _codec;
3139
- HistoryResponse.codec = () => {
3140
- if (_codec == null) {
3141
- _codec = message((obj, w, opts = {}) => {
3142
- if (opts.lengthDelimited !== false) {
3143
- w.fork();
3144
- }
3145
- if (obj.messages != null) {
3146
- for (const value of obj.messages) {
3147
- w.uint32(18);
3148
- WakuMessage.codec().encode(value, w);
3149
- }
3150
- }
3151
- if (obj.pagingInfo != null) {
3152
- w.uint32(26);
3153
- PagingInfo.codec().encode(obj.pagingInfo, w);
3154
- }
3155
- if (obj.error != null && __HistoryErrorValues[obj.error] !== 0) {
3156
- w.uint32(32);
3157
- HistoryResponse.HistoryError.codec().encode(obj.error, w);
3158
- }
3159
- if (opts.lengthDelimited !== false) {
3160
- w.ldelim();
3161
- }
3162
- }, (reader, length, opts = {}) => {
3163
- const obj = {
3164
- messages: [],
3165
- error: HistoryError.NONE
3166
- };
3167
- const end = length == null ? reader.len : reader.pos + length;
3168
- while (reader.pos < end) {
3169
- const tag = reader.uint32();
3170
- switch (tag >>> 3) {
3171
- case 2: {
3172
- if (opts.limits?.messages != null && obj.messages.length === opts.limits.messages) {
3173
- throw new CodeError('decode error - map field "messages" had too many elements', 'ERR_MAX_LENGTH');
2997
+ case 20: {
2998
+ if (opts.limits?.messageHashes != null && obj.messageHashes.length === opts.limits.messageHashes) {
2999
+ throw new MaxLengthError('Decode error - map field "messageHashes" had too many elements');
3174
3000
  }
3175
- obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32(), {
3176
- limits: opts.limits?.messages$
3177
- }));
3001
+ obj.messageHashes.push(reader.bytes());
3178
3002
  break;
3179
3003
  }
3180
- case 3: {
3181
- obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32(), {
3182
- limits: opts.limits?.pagingInfo
3183
- });
3004
+ case 51: {
3005
+ obj.paginationCursor = reader.bytes();
3184
3006
  break;
3185
3007
  }
3186
- case 4: {
3187
- obj.error = HistoryResponse.HistoryError.codec().decode(reader);
3008
+ case 52: {
3009
+ obj.paginationForward = reader.bool();
3010
+ break;
3011
+ }
3012
+ case 53: {
3013
+ obj.paginationLimit = reader.uint64();
3188
3014
  break;
3189
3015
  }
3190
3016
  default: {
@@ -3198,17 +3024,17 @@ var HistoryResponse;
3198
3024
  }
3199
3025
  return _codec;
3200
3026
  };
3201
- HistoryResponse.encode = (obj) => {
3202
- return encodeMessage(obj, HistoryResponse.codec());
3027
+ StoreQueryRequest.encode = (obj) => {
3028
+ return encodeMessage(obj, StoreQueryRequest.codec());
3203
3029
  };
3204
- HistoryResponse.decode = (buf, opts) => {
3205
- return decodeMessage(buf, HistoryResponse.codec(), opts);
3030
+ StoreQueryRequest.decode = (buf, opts) => {
3031
+ return decodeMessage(buf, StoreQueryRequest.codec(), opts);
3206
3032
  };
3207
- })(HistoryResponse || (HistoryResponse = {}));
3208
- var HistoryRpc;
3209
- (function (HistoryRpc) {
3033
+ })(StoreQueryRequest || (StoreQueryRequest = {}));
3034
+ var StoreQueryResponse;
3035
+ (function (StoreQueryResponse) {
3210
3036
  let _codec;
3211
- HistoryRpc.codec = () => {
3037
+ StoreQueryResponse.codec = () => {
3212
3038
  if (_codec == null) {
3213
3039
  _codec = message((obj, w, opts = {}) => {
3214
3040
  if (opts.lengthDelimited !== false) {
@@ -3218,20 +3044,31 @@ var HistoryRpc;
3218
3044
  w.uint32(10);
3219
3045
  w.string(obj.requestId);
3220
3046
  }
3221
- if (obj.query != null) {
3222
- w.uint32(18);
3223
- HistoryQuery.codec().encode(obj.query, w);
3047
+ if (obj.statusCode != null) {
3048
+ w.uint32(80);
3049
+ w.uint32(obj.statusCode);
3224
3050
  }
3225
- if (obj.response != null) {
3226
- w.uint32(26);
3227
- HistoryResponse.codec().encode(obj.response, w);
3051
+ if (obj.statusDesc != null) {
3052
+ w.uint32(90);
3053
+ w.string(obj.statusDesc);
3054
+ }
3055
+ if (obj.messages != null) {
3056
+ for (const value of obj.messages) {
3057
+ w.uint32(162);
3058
+ WakuMessageKeyValue.codec().encode(value, w);
3059
+ }
3060
+ }
3061
+ if (obj.paginationCursor != null) {
3062
+ w.uint32(410);
3063
+ w.bytes(obj.paginationCursor);
3228
3064
  }
3229
3065
  if (opts.lengthDelimited !== false) {
3230
3066
  w.ldelim();
3231
3067
  }
3232
3068
  }, (reader, length, opts = {}) => {
3233
3069
  const obj = {
3234
- requestId: ''
3070
+ requestId: '',
3071
+ messages: []
3235
3072
  };
3236
3073
  const end = length == null ? reader.len : reader.pos + length;
3237
3074
  while (reader.pos < end) {
@@ -3241,16 +3078,25 @@ var HistoryRpc;
3241
3078
  obj.requestId = reader.string();
3242
3079
  break;
3243
3080
  }
3244
- case 2: {
3245
- obj.query = HistoryQuery.codec().decode(reader, reader.uint32(), {
3246
- limits: opts.limits?.query
3247
- });
3081
+ case 10: {
3082
+ obj.statusCode = reader.uint32();
3248
3083
  break;
3249
3084
  }
3250
- case 3: {
3251
- obj.response = HistoryResponse.codec().decode(reader, reader.uint32(), {
3252
- limits: opts.limits?.response
3253
- });
3085
+ case 11: {
3086
+ obj.statusDesc = reader.string();
3087
+ break;
3088
+ }
3089
+ case 20: {
3090
+ if (opts.limits?.messages != null && obj.messages.length === opts.limits.messages) {
3091
+ throw new MaxLengthError('Decode error - map field "messages" had too many elements');
3092
+ }
3093
+ obj.messages.push(WakuMessageKeyValue.codec().decode(reader, reader.uint32(), {
3094
+ limits: opts.limits?.messages$
3095
+ }));
3096
+ break;
3097
+ }
3098
+ case 51: {
3099
+ obj.paginationCursor = reader.bytes();
3254
3100
  break;
3255
3101
  }
3256
3102
  default: {
@@ -3264,13 +3110,13 @@ var HistoryRpc;
3264
3110
  }
3265
3111
  return _codec;
3266
3112
  };
3267
- HistoryRpc.encode = (obj) => {
3268
- return encodeMessage(obj, HistoryRpc.codec());
3113
+ StoreQueryResponse.encode = (obj) => {
3114
+ return encodeMessage(obj, StoreQueryResponse.codec());
3269
3115
  };
3270
- HistoryRpc.decode = (buf, opts) => {
3271
- return decodeMessage(buf, HistoryRpc.codec(), opts);
3116
+ StoreQueryResponse.decode = (buf, opts) => {
3117
+ return decodeMessage(buf, StoreQueryResponse.codec(), opts);
3272
3118
  };
3273
- })(HistoryRpc || (HistoryRpc = {}));
3119
+ })(StoreQueryResponse || (StoreQueryResponse = {}));
3274
3120
  var RateLimitProof;
3275
3121
  (function (RateLimitProof) {
3276
3122
  let _codec;
@@ -3590,7 +3436,7 @@ var PeerExchangeResponse;
3590
3436
  switch (tag >>> 3) {
3591
3437
  case 1: {
3592
3438
  if (opts.limits?.peerInfos != null && obj.peerInfos.length === opts.limits.peerInfos) {
3593
- throw new CodeError('decode error - map field "peerInfos" had too many elements', 'ERR_MAX_LENGTH');
3439
+ throw new MaxLengthError('Decode error - map field "peerInfos" had too many elements');
3594
3440
  }
3595
3441
  obj.peerInfos.push(PeerInfo.codec().decode(reader, reader.uint32(), {
3596
3442
  limits: opts.limits?.peerInfos$
@@ -3713,7 +3559,7 @@ var WakuMetadataRequest;
3713
3559
  }
3714
3560
  case 2: {
3715
3561
  if (opts.limits?.shards != null && obj.shards.length === opts.limits.shards) {
3716
- throw new CodeError('decode error - map field "shards" had too many elements', 'ERR_MAX_LENGTH');
3562
+ throw new MaxLengthError('Decode error - map field "shards" had too many elements');
3717
3563
  }
3718
3564
  obj.shards.push(reader.uint32());
3719
3565
  break;
@@ -3772,7 +3618,7 @@ var WakuMetadataResponse;
3772
3618
  }
3773
3619
  case 2: {
3774
3620
  if (opts.limits?.shards != null && obj.shards.length === opts.limits.shards) {
3775
- throw new CodeError('decode error - map field "shards" had too many elements', 'ERR_MAX_LENGTH');
3621
+ throw new MaxLengthError('Decode error - map field "shards" had too many elements');
3776
3622
  }
3777
3623
  obj.shards.push(reader.uint32());
3778
3624
  break;
@@ -4134,6 +3980,11 @@ var ProtocolError;
4134
3980
  * Ensure that the pubsub topic used for decoder creation is the same as the one used for protocol.
4135
3981
  */
4136
3982
  ProtocolError["TOPIC_DECODER_MISMATCH"] = "Topic decoder mismatch";
3983
+ /**
3984
+ * The topics passed in the decoders do not match each other, or don't exist at all.
3985
+ * Ensure that all the pubsub topics used in the decoders are valid and match each other.
3986
+ */
3987
+ ProtocolError["INVALID_DECODER_TOPICS"] = "Invalid decoder topics";
4137
3988
  /**
4138
3989
  * Failure to find a peer with suitable protocols. This may due to a connection issue.
4139
3990
  * Mitigation can be: retrying after a given time period, display connectivity issue
@@ -4164,12 +4015,6 @@ var ProtocolError;
4164
4015
  ProtocolError["REQUEST_TIMEOUT"] = "Request timeout";
4165
4016
  })(ProtocolError || (ProtocolError = {}));
4166
4017
 
4167
- var PageDirection;
4168
- (function (PageDirection) {
4169
- PageDirection["BACKWARD"] = "backward";
4170
- PageDirection["FORWARD"] = "forward";
4171
- })(PageDirection || (PageDirection = {}));
4172
-
4173
4018
  var Tags;
4174
4019
  (function (Tags) {
4175
4020
  Tags["BOOTSTRAP"] = "bootstrap";
@@ -4188,15 +4033,18 @@ var EConnectionStateEvents;
4188
4033
  EConnectionStateEvents["CONNECTION_STATUS"] = "waku:connection";
4189
4034
  })(EConnectionStateEvents || (EConnectionStateEvents = {}));
4190
4035
 
4191
- /**
4192
- * DefaultPubsubTopic is the default gossipsub topic to use for Waku.
4193
- */
4194
- const DefaultPubsubTopic = "/waku/2/default-waku/proto";
4195
4036
  /**
4196
4037
  * The default cluster ID for The Waku Network
4197
4038
  */
4198
4039
  const DEFAULT_CLUSTER_ID = 1;
4199
4040
 
4041
+ var HealthStatus;
4042
+ (function (HealthStatus) {
4043
+ HealthStatus["Unhealthy"] = "Unhealthy";
4044
+ HealthStatus["MinimallyHealthy"] = "MinimallyHealthy";
4045
+ HealthStatus["SufficientlyHealthy"] = "SufficientlyHealthy";
4046
+ })(HealthStatus || (HealthStatus = {}));
4047
+
4200
4048
  const singleShardInfoToPubsubTopic = (shardInfo) => {
4201
4049
  if (shardInfo.shard === undefined)
4202
4050
  throw new Error("Invalid shard");
@@ -4269,7 +4117,9 @@ function contentTopicToPubsubTopic(contentTopic, clusterId = DEFAULT_CLUSTER_ID,
4269
4117
  /**
4270
4118
  * Used when creating encoders/decoders to determine which pubsub topic to use
4271
4119
  */
4272
- function determinePubsubTopic(contentTopic, pubsubTopicShardInfo) {
4120
+ function determinePubsubTopic(contentTopic,
4121
+ // TODO: make it accept ShardInfo https://github.com/waku-org/js-waku/issues/2086
4122
+ pubsubTopicShardInfo) {
4273
4123
  if (typeof pubsubTopicShardInfo == "string") {
4274
4124
  return pubsubTopicShardInfo;
4275
4125
  }
@@ -4853,6 +4703,8 @@ var common = setup;
4853
4703
  return false;
4854
4704
  }
4855
4705
 
4706
+ let m;
4707
+
4856
4708
  // Is webkit? http://stackoverflow.com/a/16459606/376773
4857
4709
  // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
4858
4710
  return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
@@ -4860,7 +4712,7 @@ var common = setup;
4860
4712
  (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
4861
4713
  // Is firefox >= v31?
4862
4714
  // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
4863
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
4715
+ (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
4864
4716
  // Double check webkit in userAgent just in case we are in a worker
4865
4717
  (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
4866
4718
  }
@@ -5326,4 +5178,4 @@ function postCipher(message) {
5326
5178
  return { payload, sig };
5327
5179
  }
5328
5180
 
5329
- export { Decoder$1 as D, Logger as L, WakuMessage$3 as W, decryptAsymmetric as a, postCipher as b, DecodedMessage as c, determinePubsubTopic as d, encryptAsymmetric as e, DefaultPubsubTopic as f, encryptSymmetric as g, decryptSymmetric as h, preCipher as p };
5181
+ export { Decoder$1 as D, Logger as L, WakuMessage$3 as W, decryptAsymmetric as a, postCipher as b, DecodedMessage as c, determinePubsubTopic as d, encryptAsymmetric as e, encryptSymmetric as f, decryptSymmetric as g, preCipher as p };