@ethersphere/bee-js 6.0.0-pre.1 → 6.0.0-pre.10
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/README.md +1 -1
- package/dist/cjs/bee-debug.js +3 -0
- package/dist/cjs/bee.js +3 -0
- package/dist/cjs/modules/bytes.js +1 -2
- package/dist/cjs/modules/debug/status.js +1 -1
- package/dist/cjs/modules/pss.js +1 -2
- package/dist/cjs/utils/http.js +11 -1
- package/dist/cjs/utils/tar.js +1 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee-debug.js +3 -0
- package/dist/mjs/bee.js +3 -0
- package/dist/mjs/modules/bytes.js +1 -2
- package/dist/mjs/modules/debug/status.js +1 -1
- package/dist/mjs/modules/pss.js +1 -2
- package/dist/mjs/utils/http.js +15 -3
- package/dist/mjs/utils/tar.js +1 -1
- package/dist/types/modules/debug/status.d.ts +1 -1
- package/dist/types/types/index.d.ts +3 -1
- package/dist/types/utils/http.d.ts +0 -1
- package/package.json +4 -7
package/dist/mjs/bee-debug.js
CHANGED
|
@@ -27,6 +27,9 @@ export class BeeDebug {
|
|
|
27
27
|
if (options?.headers) {
|
|
28
28
|
requestOptions.headers = options.headers;
|
|
29
29
|
}
|
|
30
|
+
if (options?.onRequest) {
|
|
31
|
+
requestOptions.onRequest = options.onRequest;
|
|
32
|
+
}
|
|
30
33
|
this.requestOptions = requestOptions;
|
|
31
34
|
}
|
|
32
35
|
async getNodeAddresses(options) {
|
package/dist/mjs/bee.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { wrapBytesWithHelpers } from "../utils/bytes.js";
|
|
2
|
-
import { prepareData } from "../utils/data.js";
|
|
3
2
|
import { extractUploadHeaders } from "../utils/headers.js";
|
|
4
3
|
import { http } from "../utils/http.js";
|
|
5
4
|
import { makeTagUid } from "../utils/type.js";
|
|
@@ -17,7 +16,7 @@ export async function upload(requestOptions, data, postageBatchId, options) {
|
|
|
17
16
|
url: endpoint,
|
|
18
17
|
method: 'post',
|
|
19
18
|
responseType: 'json',
|
|
20
|
-
data
|
|
19
|
+
data,
|
|
21
20
|
headers: {
|
|
22
21
|
'content-type': 'application/octet-stream',
|
|
23
22
|
...extractUploadHeaders(postageBatchId, options)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import getMajorSemver from 'semver/functions/major.js';
|
|
2
2
|
import { http } from "../../utils/http.js"; // Following lines bellow are automatically updated with GitHub Action when Bee version is updated
|
|
3
3
|
// so if you are changing anything about them change the `update_bee` action accordingly!
|
|
4
|
-
export const SUPPORTED_BEE_VERSION_EXACT = '1.
|
|
4
|
+
export const SUPPORTED_BEE_VERSION_EXACT = '1.13.0-f1067884';
|
|
5
5
|
export const SUPPORTED_API_VERSION = '4.0.0';
|
|
6
6
|
export const SUPPORTED_DEBUG_API_VERSION = '4.0.0';
|
|
7
7
|
export const SUPPORTED_BEE_VERSION = SUPPORTED_BEE_VERSION_EXACT.substring(0, SUPPORTED_BEE_VERSION_EXACT.indexOf('-'));
|
package/dist/mjs/modules/pss.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import WebSocket from 'isomorphic-ws';
|
|
2
|
-
import { prepareData } from "../utils/data.js";
|
|
3
2
|
import { extractUploadHeaders } from "../utils/headers.js";
|
|
4
3
|
import { http } from "../utils/http.js";
|
|
5
4
|
const endpoint = 'pss';
|
|
@@ -18,7 +17,7 @@ export async function send(requestOptions, topic, target, data, postageBatchId,
|
|
|
18
17
|
await http(requestOptions, {
|
|
19
18
|
method: 'post',
|
|
20
19
|
url: `${endpoint}/send/${topic}/${target}`,
|
|
21
|
-
data
|
|
20
|
+
data,
|
|
22
21
|
responseType: 'json',
|
|
23
22
|
params: {
|
|
24
23
|
recipient
|
package/dist/mjs/utils/http.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import { Objects } from 'cafe-utility';
|
|
2
|
+
import { Objects, Strings } from 'cafe-utility';
|
|
3
3
|
export const DEFAULT_HTTP_CONFIG = {
|
|
4
4
|
headers: {
|
|
5
|
-
accept: 'application/json, text/plain, */*'
|
|
6
|
-
'user-agent': `bee-js`
|
|
5
|
+
accept: 'application/json, text/plain, */*'
|
|
7
6
|
}
|
|
8
7
|
};
|
|
9
8
|
/**
|
|
@@ -14,9 +13,22 @@ export const DEFAULT_HTTP_CONFIG = {
|
|
|
14
13
|
export async function http(options, config) {
|
|
15
14
|
try {
|
|
16
15
|
const requestConfig = Objects.deepMerge3(DEFAULT_HTTP_CONFIG, config, options);
|
|
16
|
+
maybeRunOnRequestHook(options, requestConfig);
|
|
17
17
|
const response = await axios(requestConfig);
|
|
18
18
|
return response;
|
|
19
19
|
} catch (e) {
|
|
20
20
|
throw e;
|
|
21
21
|
}
|
|
22
|
+
}
|
|
23
|
+
function maybeRunOnRequestHook(options, requestConfig) {
|
|
24
|
+
if (options.onRequest) {
|
|
25
|
+
options.onRequest({
|
|
26
|
+
method: requestConfig.method || 'GET',
|
|
27
|
+
url: Strings.joinUrl(requestConfig.baseURL, requestConfig.url),
|
|
28
|
+
headers: {
|
|
29
|
+
...requestConfig.headers
|
|
30
|
+
},
|
|
31
|
+
params: requestConfig.params
|
|
32
|
+
});
|
|
33
|
+
}
|
|
22
34
|
}
|
package/dist/mjs/utils/tar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BeeRequestOptions } from '../../index';
|
|
2
2
|
import type { Health, NodeInfo } from '../../types/debug';
|
|
3
3
|
import { BeeVersions } from '../../types/debug';
|
|
4
|
-
export declare const SUPPORTED_BEE_VERSION_EXACT = "1.
|
|
4
|
+
export declare const SUPPORTED_BEE_VERSION_EXACT = "1.13.0-f1067884";
|
|
5
5
|
export declare const SUPPORTED_API_VERSION = "4.0.0";
|
|
6
6
|
export declare const SUPPORTED_DEBUG_API_VERSION = "4.0.0";
|
|
7
7
|
export declare const SUPPORTED_BEE_VERSION: string;
|
|
@@ -78,12 +78,14 @@ export type BeeRequestOptions = {
|
|
|
78
78
|
timeout?: number | false;
|
|
79
79
|
retry?: number | false;
|
|
80
80
|
headers?: Record<string, string>;
|
|
81
|
+
onRequest?: (request: BeeRequest) => void;
|
|
81
82
|
};
|
|
82
83
|
export interface BeeOptions extends BeeRequestOptions {
|
|
83
84
|
/**
|
|
84
85
|
* Signer object or private key of the Signer in form of either hex string or Uint8Array that will be default signer for the instance.
|
|
85
86
|
*/
|
|
86
87
|
signer?: Signer | Uint8Array | string;
|
|
88
|
+
onRequest?: (request: BeeRequest) => void;
|
|
87
89
|
}
|
|
88
90
|
export interface UploadResultWithCid extends UploadResult {
|
|
89
91
|
/**
|
|
@@ -277,7 +279,7 @@ export type HttpMethod = 'GET' | 'DELETE' | 'POST' | 'PATCH' | 'PUT';
|
|
|
277
279
|
export type HookCallback<V> = (value: V) => void | Promise<void>;
|
|
278
280
|
export interface BeeRequest {
|
|
279
281
|
url: string;
|
|
280
|
-
method:
|
|
282
|
+
method: string;
|
|
281
283
|
headers?: Record<string, string>;
|
|
282
284
|
params?: Record<string, unknown>;
|
|
283
285
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethersphere/bee-js",
|
|
3
|
-
"version": "6.0.0-pre.
|
|
3
|
+
"version": "6.0.0-pre.10",
|
|
4
4
|
"description": "Javascript client for Bee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bee",
|
|
@@ -55,21 +55,19 @@
|
|
|
55
55
|
"lint": "eslint --fix \"src/**/*.ts\" \"test/**/*.ts\" && prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
56
56
|
"lint:check": "eslint \"src/**/*.ts\" \"test/**/*.ts\" && prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
57
57
|
"depcheck": "depcheck .",
|
|
58
|
-
"bee": "bee-factory start"
|
|
58
|
+
"bee": "npx bee-factory start"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@ethersphere/swarm-cid": "^0.1.0",
|
|
62
62
|
"@types/readable-stream": "^2.3.13",
|
|
63
63
|
"axios": "^1.3.4",
|
|
64
|
-
"
|
|
65
|
-
"cafe-utility": "8.0.0",
|
|
64
|
+
"cafe-utility": "^9.0.1",
|
|
66
65
|
"elliptic": "^6.5.4",
|
|
67
66
|
"fetch-blob": "2.1.2",
|
|
68
67
|
"isomorphic-ws": "^4.0.1",
|
|
69
68
|
"js-sha3": "^0.8.0",
|
|
70
69
|
"semver": "^7.3.5",
|
|
71
70
|
"tar-js": "^0.3.0",
|
|
72
|
-
"utf-8-validate": "^5.0.9",
|
|
73
71
|
"web-streams-polyfill": "^4.0.0-beta.3",
|
|
74
72
|
"ws": "^8.7.0"
|
|
75
73
|
},
|
|
@@ -82,7 +80,6 @@
|
|
|
82
80
|
"@babel/preset-typescript": "^7.18.6",
|
|
83
81
|
"@commitlint/cli": "^17.0.2",
|
|
84
82
|
"@commitlint/config-conventional": "^17.4.2",
|
|
85
|
-
"@ethersphere/bee-factory": "^0.5.2",
|
|
86
83
|
"@fluffy-spoon/substitute": "^1.208.0",
|
|
87
84
|
"@naholyr/cross-env": "^1.0.0",
|
|
88
85
|
"@types/chai": "^4.3.4",
|
|
@@ -132,6 +129,6 @@
|
|
|
132
129
|
"npm": ">=6.0.0",
|
|
133
130
|
"beeApiVersion": "4.0.0",
|
|
134
131
|
"beeDebugApiVersion": "4.0.0",
|
|
135
|
-
"bee": "1.
|
|
132
|
+
"bee": "1.13.0-f1067884"
|
|
136
133
|
}
|
|
137
134
|
}
|