@ethersphere/bee-js 9.0.1 → 9.0.3

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.
@@ -114,6 +114,7 @@ function makeFeedReader(requestOptions, topic, owner) {
114
114
  return {
115
115
  payload: update.payload,
116
116
  feedIndex,
117
+ feedIndexNext: feedIndex.next(),
117
118
  };
118
119
  };
119
120
  const downloadPayload = async (options) => {
@@ -128,6 +129,7 @@ function makeFeedReader(requestOptions, topic, owner) {
128
129
  return {
129
130
  payload,
130
131
  feedIndex,
132
+ feedIndexNext: feedIndex.next(),
131
133
  };
132
134
  };
133
135
  const downloadReference = async (options) => {
@@ -139,6 +141,7 @@ function makeFeedReader(requestOptions, topic, owner) {
139
141
  return {
140
142
  reference: new typed_bytes_1.Reference(payload.payload.toUint8Array()),
141
143
  feedIndex: payload.feedIndex,
144
+ feedIndexNext: payload.feedIndexNext ?? payload.feedIndex.next(),
142
145
  };
143
146
  };
144
147
  return {
@@ -69,6 +69,7 @@ function prepareUploadOptions(value, name = 'UploadOptions') {
69
69
  const object = cafe_utility_1.Types.asObject(value, { name });
70
70
  return {
71
71
  act: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asBoolean(x, { name: 'act' }), object.act),
72
+ actHistoryAddress: cafe_utility_1.Types.asOptional(x => new typed_bytes_1.Reference(x), object.actHistoryAddress),
72
73
  deferred: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asBoolean(x, { name: 'deferred' }), object.deferred),
73
74
  encrypt: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asBoolean(x, { name: 'encrypt' }), object.encrypt),
74
75
  pin: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asBoolean(x, { name: 'pin' }), object.pin),
@@ -163,6 +163,7 @@ class Topic extends bytes_1.Bytes {
163
163
  }
164
164
  exports.Topic = Topic;
165
165
  Topic.LENGTH = 32;
166
+ const MAX_UINT64 = new Uint8Array(8).fill(0xff, 0, 8);
166
167
  class FeedIndex extends bytes_1.Bytes {
167
168
  constructor(bytes) {
168
169
  super(bytes, 8);
@@ -173,7 +174,13 @@ class FeedIndex extends bytes_1.Bytes {
173
174
  toBigInt() {
174
175
  return cafe_utility_1.Binary.uint64ToNumber(this.bytes, 'BE');
175
176
  }
177
+ next() {
178
+ if (cafe_utility_1.Binary.equals(this.bytes, MAX_UINT64)) {
179
+ return FeedIndex.fromBigInt(0n);
180
+ }
181
+ return FeedIndex.fromBigInt(this.toBigInt() + 1n);
182
+ }
176
183
  }
177
184
  exports.FeedIndex = FeedIndex;
178
185
  FeedIndex.LENGTH = 8;
179
- FeedIndex.MINUS_ONE = new FeedIndex(new Uint8Array(8).fill(0xff, 0, 8));
186
+ FeedIndex.MINUS_ONE = new FeedIndex(MAX_UINT64);