@ethersphere/bee-js 3.3.3 → 3.4.0-pre.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/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/utils/data.browser.js +0 -1
- package/dist/mjs/utils/data.js +4 -5
- 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/dist/mjs/utils/data.js
CHANGED
|
@@ -30,7 +30,7 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
import
|
|
33
|
+
import BlobPolyfill from 'fetch-blob';
|
|
34
34
|
import { isNodeReadable, isReadableStream, readableWebToNode } from "./stream.js";
|
|
35
35
|
/**
|
|
36
36
|
* Prepare data for valid input for node-fetch.
|
|
@@ -43,17 +43,17 @@ import { isNodeReadable, isReadableStream, readableWebToNode } from "./stream.js
|
|
|
43
43
|
|
|
44
44
|
export function prepareData(data) {
|
|
45
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
if (typeof data === 'string') return new
|
|
46
|
+
if (typeof data === 'string') return new BlobPolyfill([data], {
|
|
47
47
|
type: 'text/plain'
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
if (data instanceof Uint8Array || data instanceof ArrayBuffer) {
|
|
51
|
-
return new
|
|
51
|
+
return new BlobPolyfill([data], {
|
|
52
52
|
type: 'application/octet-stream'
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
if (data instanceof
|
|
56
|
+
if (data instanceof BlobPolyfill || isNodeReadable(data)) return data;
|
|
57
57
|
|
|
58
58
|
if (isReadableStream(data)) {
|
|
59
59
|
return readableWebToNode(data);
|
|
@@ -72,7 +72,6 @@ export function prepareWebsocketData(data) {
|
|
|
72
72
|
if (typeof data === 'string') return new TextEncoder().encode(data);
|
|
73
73
|
if (data instanceof Buffer) return new Uint8Array(data);
|
|
74
74
|
if (data instanceof ArrayBuffer) return new Uint8Array(data);
|
|
75
|
-
if (data instanceof Blob) return new Uint8Array(yield new Response(data).arrayBuffer());
|
|
76
75
|
if (isBufferArray(data)) return new Uint8Array(Buffer.concat(data));
|
|
77
76
|
throw new TypeError('unknown websocket data type');
|
|
78
77
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Data } from 'ws';
|
|
2
|
-
import
|
|
2
|
+
import BlobPolyfill from 'fetch-blob';
|
|
3
3
|
import { Readable } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Prepare data for valid input for node-fetch.
|
|
@@ -10,4 +10,4 @@ import { Readable } from '../types';
|
|
|
10
10
|
* @param data any string, ArrayBuffer, Uint8Array or Readable
|
|
11
11
|
*/
|
|
12
12
|
export declare function prepareData(data: string | ArrayBuffer | Uint8Array | Readable): Promise<Blob | ReadableStream<Uint8Array> | never>;
|
|
13
|
-
export declare function prepareWebsocketData(data: Data |
|
|
13
|
+
export declare function prepareWebsocketData(data: Data | BlobPolyfill): Promise<Uint8Array> | never;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethersphere/bee-js",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0-pre.0",
|
|
4
4
|
"description": "Javascript client for Bee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bee",
|
|
@@ -66,15 +66,15 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@types/readable-stream": "^2.3.13",
|
|
68
68
|
"bufferutil": "^4.0.6",
|
|
69
|
-
"cross-blob": "^2.0.1",
|
|
70
69
|
"elliptic": "^6.5.4",
|
|
70
|
+
"fetch-blob": "2.1.2",
|
|
71
71
|
"isomorphic-ws": "^4.0.1",
|
|
72
72
|
"js-sha3": "^0.8.0",
|
|
73
73
|
"ky": "^0.25.1",
|
|
74
74
|
"ky-universal": "^0.8.2",
|
|
75
75
|
"semver": "^7.3.5",
|
|
76
76
|
"tar-js": "^0.3.0",
|
|
77
|
-
"utf-8-validate": "^5.0.
|
|
77
|
+
"utf-8-validate": "^5.0.9",
|
|
78
78
|
"web-streams-polyfill": "^4.0.0-beta.1",
|
|
79
79
|
"ws": "^8.5.0"
|
|
80
80
|
},
|
|
@@ -94,11 +94,11 @@
|
|
|
94
94
|
"@types/debug": "^4.1.7",
|
|
95
95
|
"@types/elliptic": "^6.4.14",
|
|
96
96
|
"@types/expect-puppeteer": "^4.4.7",
|
|
97
|
-
"@types/glob": "^7.
|
|
97
|
+
"@types/glob": "^7.2.0",
|
|
98
98
|
"@types/jest": "^26.0.23",
|
|
99
99
|
"@types/jest-environment-puppeteer": "^4.4.1",
|
|
100
100
|
"@types/node": "^15.12.4",
|
|
101
|
-
"@types/puppeteer": "^5.4.
|
|
101
|
+
"@types/puppeteer": "^5.4.5",
|
|
102
102
|
"@types/semver": "^7.3.9",
|
|
103
103
|
"@types/ws": "^7.4.5",
|
|
104
104
|
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
|
@@ -106,24 +106,25 @@
|
|
|
106
106
|
"babel-jest": "^27.0.5",
|
|
107
107
|
"babel-loader": "^8.2.3",
|
|
108
108
|
"babel-plugin-add-import-extension": "^1.6.0",
|
|
109
|
+
"cross-blob": "^2.0.1",
|
|
109
110
|
"cross-env": "^7.0.3",
|
|
110
|
-
"debug": "^4.3.
|
|
111
|
+
"debug": "^4.3.4",
|
|
111
112
|
"depcheck": "^1.4.3",
|
|
112
113
|
"eslint": "^8.8.0",
|
|
113
|
-
"eslint-config-prettier": "^8.
|
|
114
|
+
"eslint-config-prettier": "^8.5.0",
|
|
114
115
|
"eslint-plugin-jest": "^25.7.0",
|
|
115
116
|
"eslint-plugin-prettier": "^4.0.0",
|
|
116
117
|
"eslint-plugin-unused-imports": "^2.0.0",
|
|
117
118
|
"glob": "^7.1.7",
|
|
118
119
|
"husky": "^7.0.4",
|
|
119
|
-
"jest": "^27.
|
|
120
|
-
"jest-puppeteer": "^
|
|
121
|
-
"nock": "^13.2.
|
|
122
|
-
"prettier": "^2.
|
|
120
|
+
"jest": "^27.5.1",
|
|
121
|
+
"jest-puppeteer": "^6.1.0",
|
|
122
|
+
"nock": "^13.2.4",
|
|
123
|
+
"prettier": "^2.6.2",
|
|
123
124
|
"puppeteer": "^13.2.0",
|
|
124
125
|
"rimraf": "^3.0.2",
|
|
125
126
|
"terser-webpack-plugin": "^5.3.0",
|
|
126
|
-
"ts-node": "^10.
|
|
127
|
+
"ts-node": "^10.7.0",
|
|
127
128
|
"typedoc": "^0.22.11",
|
|
128
129
|
"typedoc-plugin-markdown": "^3.11.12",
|
|
129
130
|
"typescript": "^4.5.4",
|
|
@@ -138,4 +139,4 @@
|
|
|
138
139
|
"beeDebugApiVersion": "2.0.0",
|
|
139
140
|
"bee": "1.5.0-dda5606e"
|
|
140
141
|
}
|
|
141
|
-
}
|
|
142
|
+
}
|