@ethersphere/bee-js 10.3.0 → 11.0.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.
- package/dist/cjs/bee.js +17 -10
- package/dist/cjs/chunk/bmt.js +1 -2
- package/dist/cjs/chunk/cac.js +3 -3
- package/dist/cjs/chunk/soc.js +24 -15
- package/dist/cjs/feed/identifier.js +1 -2
- package/dist/cjs/feed/index.js +25 -16
- package/dist/cjs/feed/retrievable.js +1 -2
- package/dist/cjs/index.js +17 -7
- package/dist/cjs/modules/bytes.js +4 -5
- package/dist/cjs/modules/bzz.js +4 -5
- package/dist/cjs/modules/chunk.js +2 -3
- package/dist/cjs/modules/debug/balance.js +4 -5
- package/dist/cjs/modules/debug/chequebook.js +8 -9
- package/dist/cjs/modules/debug/connectivity.js +7 -8
- package/dist/cjs/modules/debug/settlements.js +2 -3
- package/dist/cjs/modules/debug/stake.js +6 -7
- package/dist/cjs/modules/debug/stamps.js +23 -77
- package/dist/cjs/modules/debug/states.js +6 -6
- package/dist/cjs/modules/debug/status.js +9 -9
- package/dist/cjs/modules/debug/transactions.js +4 -5
- package/dist/cjs/modules/envelope.js +1 -2
- package/dist/cjs/modules/feed.js +3 -4
- package/dist/cjs/modules/grantee.js +3 -4
- package/dist/cjs/modules/gsoc.js +2 -3
- package/dist/cjs/modules/pinning.js +4 -5
- package/dist/cjs/modules/pss.js +2 -3
- package/dist/cjs/modules/rchash.js +1 -2
- package/dist/cjs/modules/soc.js +1 -2
- package/dist/cjs/modules/status.js +2 -3
- package/dist/cjs/modules/stewardship.js +2 -3
- package/dist/cjs/modules/tag.js +5 -6
- package/dist/cjs/types/debug.js +3 -3
- package/dist/cjs/types/index.js +2 -2
- package/dist/cjs/utils/bytes.js +2 -2
- package/dist/cjs/utils/chunk-size.js +1 -2
- package/dist/cjs/utils/chunk-stream.browser.js +3 -4
- package/dist/cjs/utils/chunk-stream.js +3 -4
- package/dist/cjs/utils/cid.js +3 -3
- package/dist/cjs/utils/collection.browser.js +2 -3
- package/dist/cjs/utils/collection.js +5 -6
- package/dist/cjs/utils/collection.node.js +2 -3
- package/dist/cjs/utils/data.browser.js +1 -2
- package/dist/cjs/utils/data.js +1 -2
- package/dist/cjs/utils/expose.js +4 -1
- package/dist/cjs/utils/file.js +2 -3
- package/dist/cjs/utils/headers.js +2 -3
- package/dist/cjs/utils/http.js +2 -2
- package/dist/cjs/utils/pss.js +1 -2
- package/dist/cjs/utils/redundancy.js +3 -4
- package/dist/cjs/utils/stamps.js +60 -11
- package/dist/cjs/utils/tar-uploader.browser.js +1 -2
- package/dist/cjs/utils/tar-uploader.js +1 -2
- package/dist/cjs/utils/tar-writer.browser.js +1 -2
- package/dist/cjs/utils/tar-writer.js +1 -2
- package/dist/cjs/utils/type.js +34 -25
- package/dist/cjs/utils/url.js +3 -4
- package/dist/cjs/utils/workaround.js +7 -5
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee.js +0 -3
- package/dist/mjs/modules/debug/stamps.js +37 -110
- package/dist/mjs/modules/debug/states.js +3 -0
- package/dist/mjs/modules/debug/status.js +1 -1
- package/dist/mjs/utils/expose.js +1 -1
- package/dist/mjs/utils/stamps.js +48 -0
- package/dist/mjs/utils/workaround.js +5 -2
- package/dist/types/bee.d.ts +0 -4
- package/dist/types/index.d.ts +3 -2
- package/dist/types/modules/bzz.d.ts +0 -1
- package/dist/types/modules/debug/status.d.ts +1 -1
- package/dist/types/modules/gsoc.d.ts +0 -1
- package/dist/types/modules/pss.d.ts +0 -1
- package/dist/types/types/debug.d.ts +1 -0
- package/dist/types/utils/constants.d.ts +3 -3
- package/dist/types/utils/error.d.ts +2 -2
- package/dist/types/utils/expose.d.ts +1 -1
- package/dist/types/utils/stamps.d.ts +15 -1
- package/dist/types/utils/tar.browser.d.ts +1 -1
- package/dist/types/utils/tar.d.ts +0 -1
- package/dist/types/utils/type.d.ts +0 -1
- package/package.json +9 -12
package/dist/cjs/utils/type.js
CHANGED
|
@@ -15,15 +15,41 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
36
|
+
exports.isReadable = isReadable;
|
|
37
|
+
exports.asNumberString = asNumberString;
|
|
38
|
+
exports.prepareBeeRequestOptions = prepareBeeRequestOptions;
|
|
39
|
+
exports.prepareDownloadOptions = prepareDownloadOptions;
|
|
40
|
+
exports.prepareUploadOptions = prepareUploadOptions;
|
|
41
|
+
exports.prepareRedundantUploadOptions = prepareRedundantUploadOptions;
|
|
42
|
+
exports.prepareFileUploadOptions = prepareFileUploadOptions;
|
|
43
|
+
exports.prepareCollectionUploadOptions = prepareCollectionUploadOptions;
|
|
44
|
+
exports.isTag = isTag;
|
|
45
|
+
exports.preparePssMessageHandler = preparePssMessageHandler;
|
|
46
|
+
exports.prepareGsocMessageHandler = prepareGsocMessageHandler;
|
|
47
|
+
exports.preparePostageBatchOptions = preparePostageBatchOptions;
|
|
48
|
+
exports.prepareTransactionOptions = prepareTransactionOptions;
|
|
49
|
+
exports.assertData = assertData;
|
|
50
|
+
exports.assertFileData = assertFileData;
|
|
51
|
+
exports.prepareAllTagsOptions = prepareAllTagsOptions;
|
|
52
|
+
exports.makeTagUid = makeTagUid;
|
|
27
53
|
const cafe_utility_1 = require("cafe-utility");
|
|
28
54
|
const stream = __importStar(require("stream"));
|
|
29
55
|
const types_1 = require("../types");
|
|
@@ -32,14 +58,12 @@ const typed_bytes_1 = require("./typed-bytes");
|
|
|
32
58
|
function isReadable(value) {
|
|
33
59
|
return typeof stream.Readable !== 'undefined' && value instanceof stream.Readable;
|
|
34
60
|
}
|
|
35
|
-
exports.isReadable = isReadable;
|
|
36
61
|
function asNumberString(value, options) {
|
|
37
62
|
if (typeof value === 'bigint') {
|
|
38
63
|
value = value.toString();
|
|
39
64
|
}
|
|
40
65
|
return cafe_utility_1.Types.asIntegerString(value, options);
|
|
41
66
|
}
|
|
42
|
-
exports.asNumberString = asNumberString;
|
|
43
67
|
function prepareBeeRequestOptions(value) {
|
|
44
68
|
const object = cafe_utility_1.Types.asObject(value, { name: 'BeeRequestOptions' });
|
|
45
69
|
return {
|
|
@@ -52,7 +76,6 @@ function prepareBeeRequestOptions(value) {
|
|
|
52
76
|
endlesslyRetry: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asBoolean(x, { name: 'endlesslyRetry' }), object.endlesslyRetry),
|
|
53
77
|
};
|
|
54
78
|
}
|
|
55
|
-
exports.prepareBeeRequestOptions = prepareBeeRequestOptions;
|
|
56
79
|
function prepareDownloadOptions(value) {
|
|
57
80
|
const object = cafe_utility_1.Types.asObject(value, { name: 'DownloadOptions' });
|
|
58
81
|
return {
|
|
@@ -64,7 +87,6 @@ function prepareDownloadOptions(value) {
|
|
|
64
87
|
actTimestamp: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asNumber(x, { name: 'actTimestamp' }), object.actTimestamp),
|
|
65
88
|
};
|
|
66
89
|
}
|
|
67
|
-
exports.prepareDownloadOptions = prepareDownloadOptions;
|
|
68
90
|
function prepareUploadOptions(value, name = 'UploadOptions') {
|
|
69
91
|
const object = cafe_utility_1.Types.asObject(value, { name });
|
|
70
92
|
return {
|
|
@@ -76,7 +98,6 @@ function prepareUploadOptions(value, name = 'UploadOptions') {
|
|
|
76
98
|
tag: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asInteger(x, { name: 'tag', min: 0 }), object.tag),
|
|
77
99
|
};
|
|
78
100
|
}
|
|
79
|
-
exports.prepareUploadOptions = prepareUploadOptions;
|
|
80
101
|
function prepareRedundantUploadOptions(value, name = 'UploadOptions') {
|
|
81
102
|
const uploadOptions = prepareUploadOptions(value, name);
|
|
82
103
|
const object = cafe_utility_1.Types.asObject(value, { name });
|
|
@@ -85,7 +106,6 @@ function prepareRedundantUploadOptions(value, name = 'UploadOptions') {
|
|
|
85
106
|
redundancyLevel: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asInteger(x, { name: 'redundancyLevel', min: 0 }), object.redundancyLevel),
|
|
86
107
|
};
|
|
87
108
|
}
|
|
88
|
-
exports.prepareRedundantUploadOptions = prepareRedundantUploadOptions;
|
|
89
109
|
function prepareFileUploadOptions(value) {
|
|
90
110
|
const uploadOptions = prepareUploadOptions(value, 'FileUploadOptions');
|
|
91
111
|
const object = cafe_utility_1.Types.asObject(value, { name: 'FileUploadOptions' });
|
|
@@ -96,7 +116,6 @@ function prepareFileUploadOptions(value) {
|
|
|
96
116
|
redundancyLevel: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asInteger(x, { name: 'redundancyLevel', min: 0 }), object.redundancyLevel),
|
|
97
117
|
};
|
|
98
118
|
}
|
|
99
|
-
exports.prepareFileUploadOptions = prepareFileUploadOptions;
|
|
100
119
|
function prepareCollectionUploadOptions(value) {
|
|
101
120
|
const uploadOptions = prepareUploadOptions(value, 'CollectionUploadOptions');
|
|
102
121
|
const object = cafe_utility_1.Types.asObject(value, { name: 'CollectionUploadOptions' });
|
|
@@ -107,7 +126,6 @@ function prepareCollectionUploadOptions(value) {
|
|
|
107
126
|
redundancyLevel: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asInteger(x, { name: 'redundancyLevel', min: 0 }), object.redundancyLevel),
|
|
108
127
|
};
|
|
109
128
|
}
|
|
110
|
-
exports.prepareCollectionUploadOptions = prepareCollectionUploadOptions;
|
|
111
129
|
function isTag(value) {
|
|
112
130
|
try {
|
|
113
131
|
const object = cafe_utility_1.Types.asObject(value, { name: 'Tag' });
|
|
@@ -118,7 +136,6 @@ function isTag(value) {
|
|
|
118
136
|
return false;
|
|
119
137
|
}
|
|
120
138
|
}
|
|
121
|
-
exports.isTag = isTag;
|
|
122
139
|
function preparePssMessageHandler(value) {
|
|
123
140
|
const object = cafe_utility_1.Types.asObject(value, { name: 'PssMessageHandler' });
|
|
124
141
|
return {
|
|
@@ -127,7 +144,6 @@ function preparePssMessageHandler(value) {
|
|
|
127
144
|
onClose: cafe_utility_1.Types.asFunction(object.onClose, { name: 'onClose' }),
|
|
128
145
|
};
|
|
129
146
|
}
|
|
130
|
-
exports.preparePssMessageHandler = preparePssMessageHandler;
|
|
131
147
|
function prepareGsocMessageHandler(value) {
|
|
132
148
|
const object = cafe_utility_1.Types.asObject(value, { name: 'GsocMessageHandler' });
|
|
133
149
|
return {
|
|
@@ -136,7 +152,6 @@ function prepareGsocMessageHandler(value) {
|
|
|
136
152
|
onClose: cafe_utility_1.Types.asFunction(object.onClose, { name: 'onClose' }),
|
|
137
153
|
};
|
|
138
154
|
}
|
|
139
|
-
exports.prepareGsocMessageHandler = prepareGsocMessageHandler;
|
|
140
155
|
function preparePostageBatchOptions(value) {
|
|
141
156
|
const object = cafe_utility_1.Types.asObject(value, { name: 'PostageBatchOptions' });
|
|
142
157
|
return {
|
|
@@ -147,7 +162,6 @@ function preparePostageBatchOptions(value) {
|
|
|
147
162
|
waitForUsableTimeout: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asInteger(x, { name: 'waitForUsableTimeout', min: 0 }), object.waitForUsableTimeout),
|
|
148
163
|
};
|
|
149
164
|
}
|
|
150
|
-
exports.preparePostageBatchOptions = preparePostageBatchOptions;
|
|
151
165
|
function prepareTransactionOptions(value, name = 'TransactionOptions') {
|
|
152
166
|
const object = cafe_utility_1.Types.asObject(value, { name });
|
|
153
167
|
return {
|
|
@@ -155,7 +169,6 @@ function prepareTransactionOptions(value, name = 'TransactionOptions') {
|
|
|
155
169
|
gasPrice: cafe_utility_1.Types.asOptional(x => asNumberString(x, { name: 'gasPrice', min: 0n }), object.gasPrice),
|
|
156
170
|
};
|
|
157
171
|
}
|
|
158
|
-
exports.prepareTransactionOptions = prepareTransactionOptions;
|
|
159
172
|
/**
|
|
160
173
|
* Check whether the given parameter is valid data to upload
|
|
161
174
|
* @param value
|
|
@@ -166,7 +179,6 @@ function assertData(value) {
|
|
|
166
179
|
throw new TypeError('Data must be either string or Uint8Array!');
|
|
167
180
|
}
|
|
168
181
|
}
|
|
169
|
-
exports.assertData = assertData;
|
|
170
182
|
/**
|
|
171
183
|
* Check whether the given parameter is a correct file representation to file upload.
|
|
172
184
|
* @param value
|
|
@@ -177,7 +189,6 @@ function assertFileData(value) {
|
|
|
177
189
|
throw new TypeError('Data must be either string, Readable, Uint8Array or File!');
|
|
178
190
|
}
|
|
179
191
|
}
|
|
180
|
-
exports.assertFileData = assertFileData;
|
|
181
192
|
/**
|
|
182
193
|
* Checks whether optional options for AllTags query are valid
|
|
183
194
|
* @param options
|
|
@@ -189,7 +200,6 @@ function prepareAllTagsOptions(value) {
|
|
|
189
200
|
offset: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asInteger(x, { name: 'offset', min: 0 }), object.offset),
|
|
190
201
|
};
|
|
191
202
|
}
|
|
192
|
-
exports.prepareAllTagsOptions = prepareAllTagsOptions;
|
|
193
203
|
/**
|
|
194
204
|
* Utility functions that return Tag UID
|
|
195
205
|
* @param tagUid
|
|
@@ -206,4 +216,3 @@ function makeTagUid(tagUid) {
|
|
|
206
216
|
}
|
|
207
217
|
throw new TypeError(`Expected number | Tag | string from tagUid, got: ${tagUid}`);
|
|
208
218
|
}
|
|
209
|
-
exports.makeTagUid = makeTagUid;
|
package/dist/cjs/utils/url.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isValidBeeUrl = isValidBeeUrl;
|
|
4
|
+
exports.assertBeeUrl = assertBeeUrl;
|
|
5
|
+
exports.stripLastSlash = stripLastSlash;
|
|
4
6
|
const error_1 = require("./error");
|
|
5
7
|
/**
|
|
6
8
|
* Validates that passed string is valid URL of Bee.
|
|
@@ -21,7 +23,6 @@ function isValidBeeUrl(url) {
|
|
|
21
23
|
return false;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
|
-
exports.isValidBeeUrl = isValidBeeUrl;
|
|
25
26
|
/**
|
|
26
27
|
* Validates that passed string is valid URL of Bee, if not it throws BeeArgumentError.
|
|
27
28
|
* We support only HTTP and HTTPS protocols.
|
|
@@ -33,7 +34,6 @@ function assertBeeUrl(url) {
|
|
|
33
34
|
throw new error_1.BeeArgumentError('URL is not valid!', url);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
exports.assertBeeUrl = assertBeeUrl;
|
|
37
37
|
/**
|
|
38
38
|
* Removes trailing slash out of the given string.
|
|
39
39
|
* @param url
|
|
@@ -44,4 +44,3 @@ function stripLastSlash(url) {
|
|
|
44
44
|
}
|
|
45
45
|
return url;
|
|
46
46
|
}
|
|
47
|
-
exports.stripLastSlash = stripLastSlash;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// TODO: Remove this file after the issue is fixed
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.normalizeBatchTTL = normalizeBatchTTL;
|
|
5
|
+
exports.normalizeCurrentPrice = normalizeCurrentPrice;
|
|
5
6
|
function normalizeBatchTTL(batchTTL) {
|
|
6
7
|
if (!Number.isInteger(batchTTL)) {
|
|
7
8
|
return 1;
|
|
@@ -9,12 +10,14 @@ function normalizeBatchTTL(batchTTL) {
|
|
|
9
10
|
if (batchTTL < 1) {
|
|
10
11
|
return 1;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
// Cap `batchTTL` (represents seconds) to 100 years.
|
|
14
|
+
// We can assume `storagePrice` is invalid (e.g. 1).
|
|
15
|
+
// This is needed to prevent Date objects breaking.
|
|
16
|
+
if (batchTTL > 3155695200) {
|
|
17
|
+
return 3155695200;
|
|
14
18
|
}
|
|
15
19
|
return batchTTL;
|
|
16
20
|
}
|
|
17
|
-
exports.normalizeBatchTTL = normalizeBatchTTL;
|
|
18
21
|
function normalizeCurrentPrice(currentPrice) {
|
|
19
22
|
if (!Number.isInteger(currentPrice)) {
|
|
20
23
|
return 24000;
|
|
@@ -24,4 +27,3 @@ function normalizeCurrentPrice(currentPrice) {
|
|
|
24
27
|
}
|
|
25
28
|
return currentPrice;
|
|
26
29
|
}
|
|
27
|
-
exports.normalizeCurrentPrice = normalizeCurrentPrice;
|