@ethersphere/bee-js 3.3.3 → 3.3.4
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/LICENSE +24 -22
- package/dist/cjs/modules/debug/status.js +1 -1
- package/dist/cjs/utils/data.browser.js +6 -10
- package/dist/cjs/utils/data.js +4 -6
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/modules/debug/status.js +1 -1
- package/dist/mjs/utils/data.browser.js +0 -1
- package/dist/mjs/utils/data.js +4 -5
- package/dist/types/modules/debug/status.d.ts +1 -1
- package/dist/types/types/debug.d.ts +19 -0
- package/dist/types/utils/data.browser.d.ts +0 -1
- package/dist/types/utils/data.d.ts +2 -2
- package/package.json +14 -13
package/LICENSE
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022, The Swarm Authors
|
|
4
|
+
All rights reserved.
|
|
2
5
|
|
|
3
6
|
Redistribution and use in source and binary forms, with or without
|
|
4
|
-
modification, are permitted provided that the following conditions are
|
|
5
|
-
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
6
15
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
copyright notice, this list of conditions and the following disclaimer
|
|
11
|
-
in the documentation and/or other materials provided with the
|
|
12
|
-
distribution.
|
|
13
|
-
* Neither the name of Swarm nor the names of its
|
|
14
|
-
contributors may be used to endorse or promote products derived from
|
|
15
|
-
this software without specific prior written permission.
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
16
19
|
|
|
17
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
29
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -17,7 +17,7 @@ const http_1 = require("../../utils/http");
|
|
|
17
17
|
const major_js_1 = __importDefault(require("semver/functions/major.js"));
|
|
18
18
|
// Following lines bellow are automatically updated with GitHub Action when Bee version is updated
|
|
19
19
|
// so if you are changing anything about them change the `update_bee` action accordingly!
|
|
20
|
-
exports.SUPPORTED_BEE_VERSION_EXACT = '1.5.
|
|
20
|
+
exports.SUPPORTED_BEE_VERSION_EXACT = '1.5.1-d0a77598';
|
|
21
21
|
exports.SUPPORTED_API_VERSION = '3.0.0';
|
|
22
22
|
exports.SUPPORTED_DEBUG_API_VERSION = '2.0.0';
|
|
23
23
|
exports.SUPPORTED_BEE_VERSION = exports.SUPPORTED_BEE_VERSION_EXACT.substring(0, exports.SUPPORTED_BEE_VERSION_EXACT.indexOf('-'));
|
|
@@ -8,13 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.prepareWebsocketData = exports.prepareData = void 0;
|
|
16
13
|
const stream_1 = require("./stream");
|
|
17
|
-
const cross_blob_1 = __importDefault(require("cross-blob"));
|
|
18
14
|
/**
|
|
19
15
|
* Validates input and converts to Uint8Array
|
|
20
16
|
*
|
|
@@ -23,11 +19,11 @@ const cross_blob_1 = __importDefault(require("cross-blob"));
|
|
|
23
19
|
function prepareData(data) {
|
|
24
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
21
|
if (typeof data === 'string')
|
|
26
|
-
return new
|
|
22
|
+
return new Blob([data], { type: 'text/plain' });
|
|
27
23
|
if (data instanceof Uint8Array || data instanceof ArrayBuffer) {
|
|
28
|
-
return new
|
|
24
|
+
return new Blob([data], { type: 'application/octet-stream' });
|
|
29
25
|
}
|
|
30
|
-
if (data instanceof
|
|
26
|
+
if (data instanceof Blob) {
|
|
31
27
|
return data;
|
|
32
28
|
}
|
|
33
29
|
// Currently it is not possible to stream requests from browsers
|
|
@@ -41,7 +37,7 @@ function prepareData(data) {
|
|
|
41
37
|
buffers.push(d);
|
|
42
38
|
});
|
|
43
39
|
data.on('end', () => {
|
|
44
|
-
resolve(new
|
|
40
|
+
resolve(new Blob(buffers, { type: 'application/octet-stream' }));
|
|
45
41
|
});
|
|
46
42
|
});
|
|
47
43
|
}
|
|
@@ -57,7 +53,7 @@ function prepareData(data) {
|
|
|
57
53
|
buffers.push(value);
|
|
58
54
|
}
|
|
59
55
|
} while (!done);
|
|
60
|
-
resolve(new
|
|
56
|
+
resolve(new Blob(buffers, { type: 'application/octet-stream' }));
|
|
61
57
|
}));
|
|
62
58
|
}
|
|
63
59
|
throw new TypeError('unknown data type');
|
|
@@ -70,7 +66,7 @@ function prepareWebsocketData(data) {
|
|
|
70
66
|
return new TextEncoder().encode(data);
|
|
71
67
|
if (data instanceof ArrayBuffer)
|
|
72
68
|
return new Uint8Array(data);
|
|
73
|
-
if (data instanceof
|
|
69
|
+
if (data instanceof Blob)
|
|
74
70
|
return new Uint8Array(yield new Response(data).arrayBuffer());
|
|
75
71
|
throw new TypeError('unknown websocket data type');
|
|
76
72
|
});
|
package/dist/cjs/utils/data.js
CHANGED
|
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.prepareWebsocketData = exports.prepareData = void 0;
|
|
16
|
-
const
|
|
16
|
+
const fetch_blob_1 = __importDefault(require("fetch-blob"));
|
|
17
17
|
const stream_1 = require("./stream");
|
|
18
18
|
/**
|
|
19
19
|
* Prepare data for valid input for node-fetch.
|
|
@@ -26,11 +26,11 @@ const stream_1 = require("./stream");
|
|
|
26
26
|
function prepareData(data) {
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
28
|
if (typeof data === 'string')
|
|
29
|
-
return new
|
|
29
|
+
return new fetch_blob_1.default([data], { type: 'text/plain' });
|
|
30
30
|
if (data instanceof Uint8Array || data instanceof ArrayBuffer) {
|
|
31
|
-
return new
|
|
31
|
+
return new fetch_blob_1.default([data], { type: 'application/octet-stream' });
|
|
32
32
|
}
|
|
33
|
-
if (data instanceof
|
|
33
|
+
if (data instanceof fetch_blob_1.default || (0, stream_1.isNodeReadable)(data))
|
|
34
34
|
return data;
|
|
35
35
|
if ((0, stream_1.isReadableStream)(data)) {
|
|
36
36
|
return (0, stream_1.readableWebToNode)(data);
|
|
@@ -50,8 +50,6 @@ function prepareWebsocketData(data) {
|
|
|
50
50
|
return new Uint8Array(data);
|
|
51
51
|
if (data instanceof ArrayBuffer)
|
|
52
52
|
return new Uint8Array(data);
|
|
53
|
-
if (data instanceof cross_blob_1.default)
|
|
54
|
-
return new Uint8Array(yield new Response(data).arrayBuffer());
|
|
55
53
|
if (isBufferArray(data))
|
|
56
54
|
return new Uint8Array(Buffer.concat(data));
|
|
57
55
|
throw new TypeError('unknown websocket data type');
|