@ethersphere/bee-js 5.2.0 → 6.0.0-pre.1
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-debug.js +58 -72
- package/dist/cjs/bee.js +71 -86
- package/dist/cjs/chunk/soc.js +14 -14
- package/dist/cjs/feed/index.js +20 -21
- package/dist/cjs/feed/json.js +2 -2
- package/dist/cjs/feed/retrievable.js +7 -8
- package/dist/cjs/index.js +7 -7
- package/dist/cjs/modules/bytes.js +15 -15
- package/dist/cjs/modules/bzz.js +24 -25
- package/dist/cjs/modules/chunk.js +10 -10
- package/dist/cjs/modules/debug/balance.js +16 -16
- package/dist/cjs/modules/debug/chequebook.js +34 -34
- package/dist/cjs/modules/debug/chunk.js +8 -8
- package/dist/cjs/modules/debug/connectivity.js +24 -24
- package/dist/cjs/modules/debug/settlements.js +8 -8
- package/dist/cjs/modules/debug/stake.js +11 -11
- package/dist/cjs/modules/debug/stamps.js +25 -25
- package/dist/cjs/modules/debug/states.js +12 -12
- package/dist/cjs/modules/debug/status.js +24 -24
- package/dist/cjs/modules/debug/tag.js +4 -4
- package/dist/cjs/modules/debug/transactions.js +16 -16
- package/dist/cjs/modules/feed.js +14 -14
- package/dist/cjs/modules/pinning.js +14 -14
- package/dist/cjs/modules/pss.js +6 -6
- package/dist/cjs/modules/soc.js +6 -6
- package/dist/cjs/modules/status.js +3 -3
- package/dist/cjs/modules/stewardship.js +7 -7
- package/dist/cjs/modules/tag.js +20 -20
- package/dist/cjs/utils/error.js +1 -35
- package/dist/cjs/utils/headers.js +3 -3
- package/dist/cjs/utils/http.js +14 -141
- package/dist/cjs/utils/type.js +1 -4
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.LICENSE.txt +0 -8
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee-debug.js +59 -73
- package/dist/mjs/bee.js +72 -87
- package/dist/mjs/chunk/soc.js +14 -14
- package/dist/mjs/feed/index.js +20 -21
- package/dist/mjs/feed/json.js +2 -2
- package/dist/mjs/feed/retrievable.js +7 -8
- package/dist/mjs/index.js +2 -2
- package/dist/mjs/modules/bytes.js +15 -15
- package/dist/mjs/modules/bzz.js +24 -25
- package/dist/mjs/modules/chunk.js +10 -10
- package/dist/mjs/modules/debug/balance.js +16 -16
- package/dist/mjs/modules/debug/chequebook.js +34 -34
- package/dist/mjs/modules/debug/chunk.js +8 -8
- package/dist/mjs/modules/debug/connectivity.js +24 -24
- package/dist/mjs/modules/debug/settlements.js +8 -8
- package/dist/mjs/modules/debug/stake.js +11 -11
- package/dist/mjs/modules/debug/stamps.js +25 -25
- package/dist/mjs/modules/debug/states.js +12 -12
- package/dist/mjs/modules/debug/status.js +24 -25
- package/dist/mjs/modules/debug/tag.js +4 -4
- package/dist/mjs/modules/debug/transactions.js +16 -16
- package/dist/mjs/modules/feed.js +14 -14
- package/dist/mjs/modules/pinning.js +14 -14
- package/dist/mjs/modules/pss.js +6 -6
- package/dist/mjs/modules/soc.js +6 -6
- package/dist/mjs/modules/status.js +3 -3
- package/dist/mjs/modules/stewardship.js +7 -7
- package/dist/mjs/modules/tag.js +20 -20
- package/dist/mjs/utils/error.js +0 -31
- package/dist/mjs/utils/headers.js +3 -3
- package/dist/mjs/utils/http.js +10 -138
- package/dist/mjs/utils/type.js +2 -5
- package/dist/types/bee-debug.d.ts +50 -50
- package/dist/types/bee.d.ts +34 -34
- package/dist/types/chunk/soc.d.ts +5 -6
- package/dist/types/feed/index.d.ts +7 -8
- package/dist/types/feed/json.d.ts +2 -2
- package/dist/types/feed/retrievable.d.ts +2 -2
- package/dist/types/index.d.ts +2 -4
- package/dist/types/modules/bytes.d.ts +4 -5
- package/dist/types/modules/bzz.d.ts +5 -6
- package/dist/types/modules/chunk.d.ts +3 -4
- package/dist/types/modules/debug/balance.d.ts +5 -6
- package/dist/types/modules/debug/chequebook.d.ts +9 -10
- package/dist/types/modules/debug/chunk.d.ts +3 -4
- package/dist/types/modules/debug/connectivity.d.ts +7 -8
- package/dist/types/modules/debug/settlements.d.ts +3 -4
- package/dist/types/modules/debug/stake.d.ts +4 -5
- package/dist/types/modules/debug/stamps.d.ts +7 -8
- package/dist/types/modules/debug/states.d.ts +4 -5
- package/dist/types/modules/debug/status.d.ts +10 -10
- package/dist/types/modules/debug/tag.d.ts +2 -3
- package/dist/types/modules/debug/transactions.d.ts +5 -6
- package/dist/types/modules/feed.d.ts +3 -4
- package/dist/types/modules/pinning.d.ts +5 -6
- package/dist/types/modules/pss.d.ts +2 -3
- package/dist/types/modules/soc.d.ts +2 -3
- package/dist/types/modules/status.d.ts +2 -2
- package/dist/types/modules/stewardship.d.ts +3 -4
- package/dist/types/modules/tag.d.ts +6 -7
- package/dist/types/types/debug.d.ts +2 -2
- package/dist/types/types/index.d.ts +12 -51
- package/dist/types/utils/error.d.ts +0 -26
- package/dist/types/utils/headers.d.ts +1 -1
- package/dist/types/utils/http.d.ts +12 -21
- package/dist/types/utils/type.d.ts +2 -2
- package/package.json +4 -4
- package/dist/223.index.browser.min.js +0 -3
- package/dist/223.index.browser.min.js.LICENSE.txt +0 -1
- package/dist/223.index.browser.min.js.map +0 -1
- package/dist/cjs/utils/merge.js +0 -34
- package/dist/cjs/utils/sleep.js +0 -12
- package/dist/mjs/utils/merge.js +0 -32
- package/dist/mjs/utils/sleep.js +0 -8
- package/dist/types/utils/merge.d.ts +0 -8
- package/dist/types/utils/sleep.d.ts +0 -6
|
@@ -10,19 +10,19 @@ const stewardshipEndpoint = 'stewardship';
|
|
|
10
10
|
* @param options
|
|
11
11
|
* @throws BeeResponseError if not locally pinned or invalid data
|
|
12
12
|
*/
|
|
13
|
-
async function reupload(
|
|
14
|
-
await (0, http_1.http)(
|
|
13
|
+
async function reupload(requestOptions, reference) {
|
|
14
|
+
await (0, http_1.http)(requestOptions, {
|
|
15
15
|
method: 'put',
|
|
16
|
-
|
|
16
|
+
url: `${stewardshipEndpoint}/${reference}`,
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
exports.reupload = reupload;
|
|
20
|
-
async function isRetrievable(
|
|
21
|
-
const response = await (0, http_1.http)(
|
|
20
|
+
async function isRetrievable(requestOptions, reference) {
|
|
21
|
+
const response = await (0, http_1.http)(requestOptions, {
|
|
22
22
|
method: 'get',
|
|
23
23
|
responseType: 'json',
|
|
24
|
-
|
|
24
|
+
url: `${stewardshipEndpoint}/${reference}`,
|
|
25
25
|
});
|
|
26
|
-
return response.
|
|
26
|
+
return response.data.isRetrievable;
|
|
27
27
|
}
|
|
28
28
|
exports.isRetrievable = isRetrievable;
|
package/dist/cjs/modules/tag.js
CHANGED
|
@@ -8,13 +8,13 @@ const endpoint = 'tags';
|
|
|
8
8
|
*
|
|
9
9
|
* @param url Bee tag URL
|
|
10
10
|
*/
|
|
11
|
-
async function createTag(
|
|
12
|
-
const response = await (0, http_1.http)(
|
|
11
|
+
async function createTag(requestOptions) {
|
|
12
|
+
const response = await (0, http_1.http)(requestOptions, {
|
|
13
13
|
method: 'post',
|
|
14
|
-
|
|
14
|
+
url: endpoint,
|
|
15
15
|
responseType: 'json',
|
|
16
16
|
});
|
|
17
|
-
return response.
|
|
17
|
+
return response.data;
|
|
18
18
|
}
|
|
19
19
|
exports.createTag = createTag;
|
|
20
20
|
/**
|
|
@@ -23,12 +23,12 @@ exports.createTag = createTag;
|
|
|
23
23
|
* @param url Bee tag URL
|
|
24
24
|
* @param uid UID of tag to be retrieved
|
|
25
25
|
*/
|
|
26
|
-
async function retrieveTag(
|
|
27
|
-
const response = await (0, http_1.http)(
|
|
28
|
-
|
|
26
|
+
async function retrieveTag(requestOptions, uid) {
|
|
27
|
+
const response = await (0, http_1.http)(requestOptions, {
|
|
28
|
+
url: `${endpoint}/${uid}`,
|
|
29
29
|
responseType: 'json',
|
|
30
30
|
});
|
|
31
|
-
return response.
|
|
31
|
+
return response.data;
|
|
32
32
|
}
|
|
33
33
|
exports.retrieveTag = retrieveTag;
|
|
34
34
|
/**
|
|
@@ -38,13 +38,13 @@ exports.retrieveTag = retrieveTag;
|
|
|
38
38
|
* @param offset
|
|
39
39
|
* @param limit
|
|
40
40
|
*/
|
|
41
|
-
async function getAllTags(
|
|
42
|
-
const response = await (0, http_1.http)(
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
async function getAllTags(requestOptions, offset, limit) {
|
|
42
|
+
const response = await (0, http_1.http)(requestOptions, {
|
|
43
|
+
url: endpoint,
|
|
44
|
+
params: { offset, limit },
|
|
45
45
|
responseType: 'json',
|
|
46
46
|
});
|
|
47
|
-
return response.
|
|
47
|
+
return response.data.tags;
|
|
48
48
|
}
|
|
49
49
|
exports.getAllTags = getAllTags;
|
|
50
50
|
/**
|
|
@@ -52,10 +52,10 @@ exports.getAllTags = getAllTags;
|
|
|
52
52
|
* @param url
|
|
53
53
|
* @param uid
|
|
54
54
|
*/
|
|
55
|
-
async function deleteTag(
|
|
56
|
-
await (0, http_1.http)(
|
|
55
|
+
async function deleteTag(requestOptions, uid) {
|
|
56
|
+
await (0, http_1.http)(requestOptions, {
|
|
57
57
|
method: 'delete',
|
|
58
|
-
|
|
58
|
+
url: `${endpoint}/${uid}`,
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
exports.deleteTag = deleteTag;
|
|
@@ -65,11 +65,11 @@ exports.deleteTag = deleteTag;
|
|
|
65
65
|
* @param uid
|
|
66
66
|
* @param reference
|
|
67
67
|
*/
|
|
68
|
-
async function updateTag(
|
|
69
|
-
await (0, http_1.http)(
|
|
68
|
+
async function updateTag(requestOptions, uid, reference) {
|
|
69
|
+
await (0, http_1.http)(requestOptions, {
|
|
70
70
|
method: 'patch',
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
url: `${endpoint}/${uid}`,
|
|
72
|
+
data: {
|
|
73
73
|
reference,
|
|
74
74
|
},
|
|
75
75
|
});
|
package/dist/cjs/utils/error.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BeeArgumentError = exports.BeeError = void 0;
|
|
4
4
|
class BeeError extends Error {
|
|
5
5
|
constructor(message) {
|
|
6
6
|
super(message);
|
|
@@ -14,37 +14,3 @@ class BeeArgumentError extends BeeError {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.BeeArgumentError = BeeArgumentError;
|
|
17
|
-
class BeeRequestError extends BeeError {
|
|
18
|
-
/**
|
|
19
|
-
* @param message
|
|
20
|
-
* @param requestOptions KyOptions that were used to assemble the request. THIS MIGHT NOT BE COMPLETE! If custom Ky instance was used that has set defaults then these defaults are not visible in this object!
|
|
21
|
-
*/
|
|
22
|
-
constructor(message, requestOptions) {
|
|
23
|
-
super(message);
|
|
24
|
-
this.requestOptions = requestOptions;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.BeeRequestError = BeeRequestError;
|
|
28
|
-
class BeeResponseError extends BeeError {
|
|
29
|
-
/**
|
|
30
|
-
* @param status HTTP status code number
|
|
31
|
-
* @param response Response returned from the server
|
|
32
|
-
* @param responseBody Response body as string which is returned from response.text() call
|
|
33
|
-
* @param requestOptions KyOptions that were used to assemble the request. THIS MIGHT NOT BE COMPLETE! If custom Ky instance was used that has set defaults then these defaults are not visible in this object!
|
|
34
|
-
* @param message
|
|
35
|
-
*/
|
|
36
|
-
constructor(status, response, responseBody, requestOptions, message) {
|
|
37
|
-
super(message);
|
|
38
|
-
this.status = status;
|
|
39
|
-
this.response = response;
|
|
40
|
-
this.responseBody = responseBody;
|
|
41
|
-
this.requestOptions = requestOptions;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.BeeResponseError = BeeResponseError;
|
|
45
|
-
class BeeNotAJsonError extends BeeError {
|
|
46
|
-
constructor() {
|
|
47
|
-
super(`Received response is not valid JSON.`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.BeeNotAJsonError = BeeNotAJsonError;
|
|
@@ -29,9 +29,9 @@ function readTagUid(header) {
|
|
|
29
29
|
return parseInt(header, 10);
|
|
30
30
|
}
|
|
31
31
|
function readFileHeaders(headers) {
|
|
32
|
-
const name = readContentDispositionFilename(headers
|
|
33
|
-
const tagUid = readTagUid(headers
|
|
34
|
-
const contentType = headers
|
|
32
|
+
const name = readContentDispositionFilename(headers['content-disposition']);
|
|
33
|
+
const tagUid = readTagUid(headers['swarm-tag-uid']);
|
|
34
|
+
const contentType = headers['content-type'] || undefined;
|
|
35
35
|
return {
|
|
36
36
|
name,
|
|
37
37
|
tagUid,
|
package/dist/cjs/utils/http.js
CHANGED
|
@@ -1,157 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.http = exports.
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const merge_1 = require("./merge");
|
|
8
|
-
exports.DEFAULT_KY_CONFIG = {
|
|
6
|
+
exports.http = exports.DEFAULT_HTTP_CONFIG = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const cafe_utility_1 = require("cafe-utility");
|
|
9
|
+
exports.DEFAULT_HTTP_CONFIG = {
|
|
9
10
|
headers: {
|
|
10
11
|
accept: 'application/json, text/plain, */*',
|
|
11
12
|
'user-agent': `bee-js`,
|
|
12
13
|
},
|
|
13
14
|
};
|
|
14
|
-
function isHttpError(e) {
|
|
15
|
-
return (0, type_1.isObject)(e) && typeof e.response !== 'undefined';
|
|
16
|
-
}
|
|
17
|
-
function isHttpRequestError(e) {
|
|
18
|
-
return (0, type_1.isObject)(e) && typeof e.request !== 'undefined';
|
|
19
|
-
}
|
|
20
|
-
function headersToObject(header) {
|
|
21
|
-
return [...header.entries()].reduce((obj, [key, val]) => {
|
|
22
|
-
obj[key] = val;
|
|
23
|
-
return obj;
|
|
24
|
-
}, {});
|
|
25
|
-
}
|
|
26
|
-
function wrapRequest(request) {
|
|
27
|
-
return {
|
|
28
|
-
url: request.url,
|
|
29
|
-
method: request.method.toUpperCase(),
|
|
30
|
-
headers: headersToObject(request.headers),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function wrapRequestClosure(cb) {
|
|
34
|
-
return async (request) => {
|
|
35
|
-
await cb(wrapRequest(request));
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
exports.wrapRequestClosure = wrapRequestClosure;
|
|
39
|
-
function wrapResponseClosure(cb) {
|
|
40
|
-
return async (request, options, response) => {
|
|
41
|
-
await cb({
|
|
42
|
-
headers: headersToObject(response.headers),
|
|
43
|
-
status: response.status,
|
|
44
|
-
statusText: response.statusText,
|
|
45
|
-
request: wrapRequest(request),
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
exports.wrapResponseClosure = wrapResponseClosure;
|
|
50
|
-
/**
|
|
51
|
-
* Filters out entries that has undefined value from headers object.
|
|
52
|
-
* Modifies the original object!
|
|
53
|
-
*
|
|
54
|
-
* @param obj
|
|
55
|
-
*/
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
57
|
-
function filterHeaders(obj) {
|
|
58
|
-
if (obj === undefined) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
(0, type_1.isStrictlyObject)(obj);
|
|
62
|
-
const typedObj = obj;
|
|
63
|
-
for (const key in typedObj) {
|
|
64
|
-
if (typedObj[key] === undefined) {
|
|
65
|
-
delete typedObj[key];
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if (Object.keys(typedObj).length === 0) {
|
|
69
|
-
return undefined;
|
|
70
|
-
}
|
|
71
|
-
return typedObj;
|
|
72
|
-
}
|
|
73
|
-
exports.filterHeaders = filterHeaders;
|
|
74
15
|
/**
|
|
75
|
-
* Main
|
|
76
|
-
* @param
|
|
77
|
-
* @param config
|
|
16
|
+
* Main function to make HTTP requests.
|
|
17
|
+
* @param options User defined settings
|
|
18
|
+
* @param config Internal settings and/or Bee settings
|
|
78
19
|
*/
|
|
79
|
-
async function http(
|
|
20
|
+
async function http(options, config) {
|
|
80
21
|
try {
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
const response = (await ky(path, {
|
|
84
|
-
...kyConfig,
|
|
85
|
-
searchParams: filterHeaders(kyConfig.searchParams),
|
|
86
|
-
}));
|
|
87
|
-
switch (responseType) {
|
|
88
|
-
case 'stream':
|
|
89
|
-
if (!response.body) {
|
|
90
|
-
throw new error_1.BeeError('Response was expected to get data but did not get any!');
|
|
91
|
-
}
|
|
92
|
-
response.parsedData = (0, stream_1.normalizeToReadableStream)(response.body);
|
|
93
|
-
break;
|
|
94
|
-
case 'arraybuffer':
|
|
95
|
-
response.parsedData = (await response.arrayBuffer());
|
|
96
|
-
break;
|
|
97
|
-
case 'json':
|
|
98
|
-
try {
|
|
99
|
-
response.parsedData = (await response.json());
|
|
100
|
-
}
|
|
101
|
-
catch (e) {
|
|
102
|
-
throw new error_1.BeeNotAJsonError();
|
|
103
|
-
}
|
|
104
|
-
break;
|
|
105
|
-
default:
|
|
106
|
-
break; // If responseType is not set, then no data are expected
|
|
107
|
-
}
|
|
22
|
+
const requestConfig = cafe_utility_1.Objects.deepMerge3(exports.DEFAULT_HTTP_CONFIG, config, options);
|
|
23
|
+
const response = await (0, axios_1.default)(requestConfig);
|
|
108
24
|
return response;
|
|
109
25
|
}
|
|
110
26
|
catch (e) {
|
|
111
|
-
|
|
112
|
-
if (e instanceof error_1.BeeNotAJsonError) {
|
|
113
|
-
throw e;
|
|
114
|
-
}
|
|
115
|
-
if (isHttpError(e)) {
|
|
116
|
-
let message;
|
|
117
|
-
// We store the response body here as it can be read only once in Response's lifecycle so to make it exposed
|
|
118
|
-
// to the user in the BeeResponseError, for further analysis.
|
|
119
|
-
const body = await e.response.text();
|
|
120
|
-
try {
|
|
121
|
-
// The response can be Bee's JSON with structure `{code, message}` lets try to parse it
|
|
122
|
-
message = JSON.parse(body).message;
|
|
123
|
-
}
|
|
124
|
-
catch (e) { }
|
|
125
|
-
if (message) {
|
|
126
|
-
throw new error_1.BeeResponseError(e.response.status, e.response, body, config, `${e.response.statusText}: ${message}`);
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
throw new error_1.BeeResponseError(e.response.status, e.response, body, config, e.response.statusText);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
else if (isHttpRequestError(e)) {
|
|
133
|
-
throw new error_1.BeeRequestError(e.message, config);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
// Node 18 has native `fetch` implementation called Undici. Errors from this implementation have top level generic
|
|
137
|
-
// message "fetch failed" with the more specific error placed into `cause` property. Instead of "fetch failed" we
|
|
138
|
-
// expose the underlying problem.
|
|
139
|
-
if (e.cause) {
|
|
140
|
-
throw new error_1.BeeError(e.cause.message);
|
|
141
|
-
}
|
|
142
|
-
throw new error_1.BeeError(e.message);
|
|
143
|
-
}
|
|
27
|
+
throw e;
|
|
144
28
|
}
|
|
145
29
|
}
|
|
146
30
|
exports.http = http;
|
|
147
|
-
let ky;
|
|
148
|
-
async function getKy() {
|
|
149
|
-
if (ky) {
|
|
150
|
-
return ky;
|
|
151
|
-
}
|
|
152
|
-
ky = (await import('ky-universal')).default;
|
|
153
|
-
if (!ky) {
|
|
154
|
-
throw new Error('Ky was not found while it should have been!');
|
|
155
|
-
}
|
|
156
|
-
return ky;
|
|
157
|
-
}
|
package/dist/cjs/utils/type.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assertTransactionHash = exports.makeTagUid = exports.assertAllTagsOptions = exports.assertFileData = exports.assertData = exports.assertCashoutOptions = exports.assertTransactionOptions = exports.assertPostageBatchOptions = exports.assertPublicKey = exports.assertPssMessageHandler = exports.assertAddressPrefix = exports.assertTag = exports.isTag = exports.assertCollectionUploadOptions = exports.assertFileUploadOptions = exports.assertUploadOptions = exports.assertRequestOptions = exports.assertBatchId = exports.assertAddress = exports.addCidConversionFunction = exports.makeReferenceOrEns = exports.assertReferenceOrEns = exports.assertReference = exports.assertPositiveInteger = exports.assertNonNegativeInteger = exports.assertInteger = exports.assertBoolean = exports.assertStrictlyObject = exports.isError = exports.isStrictlyObject = exports.isObject = exports.isInteger = exports.isUint8Array = void 0;
|
|
4
|
+
const swarm_cid_1 = require("@ethersphere/swarm-cid");
|
|
4
5
|
const types_1 = require("../types");
|
|
5
6
|
const error_1 = require("./error");
|
|
6
7
|
const file_1 = require("./file");
|
|
7
8
|
const hex_1 = require("./hex");
|
|
8
9
|
const stream_1 = require("./stream");
|
|
9
|
-
const swarm_cid_1 = require("@ethersphere/swarm-cid");
|
|
10
10
|
function isUint8Array(obj) {
|
|
11
11
|
return obj instanceof Uint8Array;
|
|
12
12
|
}
|
|
@@ -194,9 +194,6 @@ function assertRequestOptions(value, name = 'RequestOptions') {
|
|
|
194
194
|
if (options.timeout) {
|
|
195
195
|
assertNonNegativeInteger(options.timeout, `${name}.timeout`);
|
|
196
196
|
}
|
|
197
|
-
if (options.fetch && typeof options.fetch !== 'function') {
|
|
198
|
-
throw new TypeError(`${name}.fetch has to be a function or undefined!`);
|
|
199
|
-
}
|
|
200
197
|
}
|
|
201
198
|
exports.assertRequestOptions = assertRequestOptions;
|
|
202
199
|
function assertUploadOptions(value, name = 'UploadOptions') {
|