@upcoming/bee-js 11.1.0 → 12.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upcoming/bee-js",
3
- "version": "11.1.0",
3
+ "version": "12.2.2",
4
4
  "description": "Javascript client for Bee",
5
5
  "keywords": [
6
6
  "bee",
@@ -44,7 +44,9 @@
44
44
  "./dist/cjs/utils/chunk-stream.js": "./dist/cjs/utils/chunk-stream.browser.js",
45
45
  "./dist/mjs/utils/chunk-stream.js": "./dist/mjs/utils/chunk-stream.browser.js",
46
46
  "./dist/cjs/utils/collection.node.js": "./dist/cjs/utils/collection.browser.js",
47
- "./dist/mjs/utils/collection.node.js": "./dist/mjs/utils/collection.browser.js"
47
+ "./dist/mjs/utils/collection.node.js": "./dist/mjs/utils/collection.browser.js",
48
+ "./dist/cjs/utils/tar.js": "./dist/cjs/utils/tar.browser.js",
49
+ "./dist/mjs/utils/tar.js": "./dist/mjs/utils/tar.browser.js"
48
50
  },
49
51
  "files": [
50
52
  "dist"
@@ -56,21 +58,21 @@
56
58
  "build:types": "tsc --emitDeclarationOnly --declaration --outDir dist/types",
57
59
  "build:browser": "webpack --progress",
58
60
  "test": "TS_NODE_PROJECT=tsconfig.test.json jest --runInBand --verbose --forceExit",
61
+ "test:browser": "TS_NODE_PROJECT=tsconfig.test.json jest --config jest.browser.config.js --runInBand --verbose --forceExit",
59
62
  "check": "tsc --project tsconfig.test.json",
60
63
  "lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\" && prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
61
64
  "depcheck": "depcheck ."
62
65
  },
63
66
  "dependencies": {
64
- "axios": "^0.30.2",
65
- "cafe-utility": "^33.6.1",
67
+ "cafe-utility": "^33.9.0",
66
68
  "debug": "^4.4.1",
67
69
  "isomorphic-ws": "^4.0.1",
68
70
  "semver": "^7.3.5",
69
- "ws": "^8.7.0"
71
+ "ws": "^8.20.1"
70
72
  },
71
73
  "devDependencies": {
72
74
  "@babel/cli": "^7.19.3",
73
- "@babel/core": "^7.20.5",
75
+ "@babel/core": "^7.29.0",
74
76
  "@babel/plugin-proposal-class-properties": "^7.16.7",
75
77
  "@babel/plugin-transform-runtime": "^7.17.0",
76
78
  "@babel/preset-env": "^7.20.2",
@@ -90,9 +92,10 @@
90
92
  "eslint": "^8.13.0",
91
93
  "eslint-config-prettier": "^8.5.0",
92
94
  "eslint-plugin-prettier": "^4.0.0",
93
- "eslint-plugin-unused-imports": "^2.0.0",
95
+ "eslint-plugin-unused-imports": "^4.4.1",
94
96
  "husky": "^8.0.1",
95
97
  "jest": "^30.2.0",
98
+ "jest-environment-jsdom": "^30.4.1",
96
99
  "prettier": "^2.6.2",
97
100
  "rimraf": "^3.0.2",
98
101
  "terser-webpack-plugin": "^5.3.1",
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BeeDev = void 0;
4
- const cafe_utility_1 = require("cafe-utility");
5
- const _1 = require(".");
6
- const connectivity_1 = require("./modules/debug/connectivity");
7
- const http_1 = require("./utils/http");
8
- class BeeDev extends _1.Bee {
9
- async getNodeAddresses(options) {
10
- const requestOptions = super.getRequestOptionsForCall(options);
11
- const response = await (0, http_1.http)(requestOptions, {
12
- url: 'addresses',
13
- responseType: 'json',
14
- });
15
- const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
16
- return {
17
- overlay: new _1.PeerAddress(cafe_utility_1.Types.asString(body.overlay, { name: 'overlay' })),
18
- underlay: [],
19
- ethereum: new _1.EthAddress(cafe_utility_1.Types.asString(body.ethereum, { name: 'ethereum' })),
20
- publicKey: new _1.PublicKey(cafe_utility_1.Types.asString(body.publicKey, { name: 'publicKey' })),
21
- pssPublicKey: new _1.PublicKey(cafe_utility_1.Types.asString(body.pssPublicKey, { name: 'pssPublicKey' })),
22
- };
23
- }
24
- async getTopology(options) {
25
- const requestOptions = super.getRequestOptionsForCall(options);
26
- const response = await (0, http_1.http)(requestOptions, {
27
- url: `topology`,
28
- responseType: 'json',
29
- });
30
- const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
31
- const bins = cafe_utility_1.Types.asObject(body.bins, { name: 'bins' });
32
- return {
33
- baseAddr: '0bab5ca208a980950604f900f2791613fc980676c2dee7dd92a4fdda5a54bf26',
34
- population: cafe_utility_1.Types.asNumber(body.population, { name: 'population' }),
35
- connected: cafe_utility_1.Types.asNumber(body.connected, { name: 'connected' }),
36
- timestamp: cafe_utility_1.Types.asString(body.timestamp, { name: 'timestamp' }),
37
- nnLowWatermark: cafe_utility_1.Types.asNumber(body.nnLowWatermark, { name: 'nnLowWatermark' }),
38
- depth: cafe_utility_1.Types.asNumber(body.depth, { name: 'depth' }),
39
- reachability: 'Public',
40
- networkAvailability: 'Available',
41
- bins: {
42
- bin_0: (0, connectivity_1.asBin)(bins.bin_0, 'bin_0'),
43
- bin_1: (0, connectivity_1.asBin)(bins.bin_1, 'bin_1'),
44
- bin_2: (0, connectivity_1.asBin)(bins.bin_2, 'bin_2'),
45
- bin_3: (0, connectivity_1.asBin)(bins.bin_3, 'bin_3'),
46
- bin_4: (0, connectivity_1.asBin)(bins.bin_4, 'bin_4'),
47
- bin_5: (0, connectivity_1.asBin)(bins.bin_5, 'bin_5'),
48
- bin_6: (0, connectivity_1.asBin)(bins.bin_6, 'bin_6'),
49
- bin_7: (0, connectivity_1.asBin)(bins.bin_7, 'bin_7'),
50
- bin_8: (0, connectivity_1.asBin)(bins.bin_8, 'bin_8'),
51
- bin_9: (0, connectivity_1.asBin)(bins.bin_9, 'bin_9'),
52
- bin_10: (0, connectivity_1.asBin)(bins.bin_10, 'bin_10'),
53
- bin_11: (0, connectivity_1.asBin)(bins.bin_11, 'bin_11'),
54
- bin_12: (0, connectivity_1.asBin)(bins.bin_12, 'bin_12'),
55
- bin_13: (0, connectivity_1.asBin)(bins.bin_13, 'bin_13'),
56
- bin_14: (0, connectivity_1.asBin)(bins.bin_14, 'bin_14'),
57
- bin_15: (0, connectivity_1.asBin)(bins.bin_15, 'bin_15'),
58
- bin_16: (0, connectivity_1.asBin)(bins.bin_16, 'bin_16'),
59
- bin_17: (0, connectivity_1.asBin)(bins.bin_17, 'bin_17'),
60
- bin_18: (0, connectivity_1.asBin)(bins.bin_18, 'bin_18'),
61
- bin_19: (0, connectivity_1.asBin)(bins.bin_19, 'bin_19'),
62
- bin_20: (0, connectivity_1.asBin)(bins.bin_20, 'bin_20'),
63
- bin_21: (0, connectivity_1.asBin)(bins.bin_21, 'bin_21'),
64
- bin_22: (0, connectivity_1.asBin)(bins.bin_22, 'bin_22'),
65
- bin_23: (0, connectivity_1.asBin)(bins.bin_23, 'bin_23'),
66
- bin_24: (0, connectivity_1.asBin)(bins.bin_24, 'bin_24'),
67
- bin_25: (0, connectivity_1.asBin)(bins.bin_25, 'bin_25'),
68
- bin_26: (0, connectivity_1.asBin)(bins.bin_26, 'bin_26'),
69
- bin_27: (0, connectivity_1.asBin)(bins.bin_27, 'bin_27'),
70
- bin_28: (0, connectivity_1.asBin)(bins.bin_28, 'bin_28'),
71
- bin_29: (0, connectivity_1.asBin)(bins.bin_29, 'bin_29'),
72
- bin_30: (0, connectivity_1.asBin)(bins.bin_30, 'bin_30'),
73
- bin_31: (0, connectivity_1.asBin)(bins.bin_31, 'bin_31'),
74
- },
75
- };
76
- }
77
- }
78
- exports.BeeDev = BeeDev;
@@ -1,98 +0,0 @@
1
- import { Types } from 'cafe-utility';
2
- import { Bee, EthAddress, PeerAddress, PublicKey } from "./index.js";
3
- import { asBin } from "./modules/debug/connectivity.js";
4
- import { http } from "./utils/http.js";
5
- export class BeeDev extends Bee {
6
- async getNodeAddresses(options) {
7
- const requestOptions = super.getRequestOptionsForCall(options);
8
- const response = await http(requestOptions, {
9
- url: 'addresses',
10
- responseType: 'json'
11
- });
12
- const body = Types.asObject(response.data, {
13
- name: 'response.data'
14
- });
15
- return {
16
- overlay: new PeerAddress(Types.asString(body.overlay, {
17
- name: 'overlay'
18
- })),
19
- underlay: [],
20
- ethereum: new EthAddress(Types.asString(body.ethereum, {
21
- name: 'ethereum'
22
- })),
23
- publicKey: new PublicKey(Types.asString(body.publicKey, {
24
- name: 'publicKey'
25
- })),
26
- pssPublicKey: new PublicKey(Types.asString(body.pssPublicKey, {
27
- name: 'pssPublicKey'
28
- }))
29
- };
30
- }
31
- async getTopology(options) {
32
- const requestOptions = super.getRequestOptionsForCall(options);
33
- const response = await http(requestOptions, {
34
- url: `topology`,
35
- responseType: 'json'
36
- });
37
- const body = Types.asObject(response.data, {
38
- name: 'response.data'
39
- });
40
- const bins = Types.asObject(body.bins, {
41
- name: 'bins'
42
- });
43
- return {
44
- baseAddr: '0bab5ca208a980950604f900f2791613fc980676c2dee7dd92a4fdda5a54bf26',
45
- population: Types.asNumber(body.population, {
46
- name: 'population'
47
- }),
48
- connected: Types.asNumber(body.connected, {
49
- name: 'connected'
50
- }),
51
- timestamp: Types.asString(body.timestamp, {
52
- name: 'timestamp'
53
- }),
54
- nnLowWatermark: Types.asNumber(body.nnLowWatermark, {
55
- name: 'nnLowWatermark'
56
- }),
57
- depth: Types.asNumber(body.depth, {
58
- name: 'depth'
59
- }),
60
- reachability: 'Public',
61
- networkAvailability: 'Available',
62
- bins: {
63
- bin_0: asBin(bins.bin_0, 'bin_0'),
64
- bin_1: asBin(bins.bin_1, 'bin_1'),
65
- bin_2: asBin(bins.bin_2, 'bin_2'),
66
- bin_3: asBin(bins.bin_3, 'bin_3'),
67
- bin_4: asBin(bins.bin_4, 'bin_4'),
68
- bin_5: asBin(bins.bin_5, 'bin_5'),
69
- bin_6: asBin(bins.bin_6, 'bin_6'),
70
- bin_7: asBin(bins.bin_7, 'bin_7'),
71
- bin_8: asBin(bins.bin_8, 'bin_8'),
72
- bin_9: asBin(bins.bin_9, 'bin_9'),
73
- bin_10: asBin(bins.bin_10, 'bin_10'),
74
- bin_11: asBin(bins.bin_11, 'bin_11'),
75
- bin_12: asBin(bins.bin_12, 'bin_12'),
76
- bin_13: asBin(bins.bin_13, 'bin_13'),
77
- bin_14: asBin(bins.bin_14, 'bin_14'),
78
- bin_15: asBin(bins.bin_15, 'bin_15'),
79
- bin_16: asBin(bins.bin_16, 'bin_16'),
80
- bin_17: asBin(bins.bin_17, 'bin_17'),
81
- bin_18: asBin(bins.bin_18, 'bin_18'),
82
- bin_19: asBin(bins.bin_19, 'bin_19'),
83
- bin_20: asBin(bins.bin_20, 'bin_20'),
84
- bin_21: asBin(bins.bin_21, 'bin_21'),
85
- bin_22: asBin(bins.bin_22, 'bin_22'),
86
- bin_23: asBin(bins.bin_23, 'bin_23'),
87
- bin_24: asBin(bins.bin_24, 'bin_24'),
88
- bin_25: asBin(bins.bin_25, 'bin_25'),
89
- bin_26: asBin(bins.bin_26, 'bin_26'),
90
- bin_27: asBin(bins.bin_27, 'bin_27'),
91
- bin_28: asBin(bins.bin_28, 'bin_28'),
92
- bin_29: asBin(bins.bin_29, 'bin_29'),
93
- bin_30: asBin(bins.bin_30, 'bin_30'),
94
- bin_31: asBin(bins.bin_31, 'bin_31')
95
- }
96
- };
97
- }
98
- }
@@ -1,5 +0,0 @@
1
- import { Bee, BeeRequestOptions, NodeAddresses, Topology } from '.';
2
- export declare class BeeDev extends Bee {
3
- getNodeAddresses(options?: BeeRequestOptions): Promise<NodeAddresses>;
4
- getTopology(options?: BeeRequestOptions): Promise<Topology>;
5
- }