@ethersphere/bee-js 9.0.2 → 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.
- package/dist/cjs/feed/index.js +3 -0
- package/dist/cjs/utils/typed-bytes.js +8 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/feed/index.js +6 -3
- package/dist/mjs/utils/typed-bytes.js +8 -1
- package/dist/types/utils/typed-bytes.d.ts +2 -1
- package/package.json +1 -1
package/dist/cjs/feed/index.js
CHANGED
|
@@ -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 {
|
|
@@ -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(
|
|
186
|
+
FeedIndex.MINUS_ONE = new FeedIndex(MAX_UINT64);
|