@ethersphere/bee-js 6.0.0 → 6.2.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.
@@ -20,17 +20,13 @@ export class BeeDebug {
20
20
  // which could lead to double slash in URL to which Bee responds with
21
21
  // unnecessary redirects.
22
22
  this.url = stripLastSlash(url);
23
- const requestOptions = {
23
+ this.requestOptions = {
24
24
  baseURL: this.url,
25
- timeout: options?.timeout ?? false
25
+ timeout: options?.timeout ?? false,
26
+ headers: options?.headers,
27
+ onRequest: options?.onRequest,
28
+ adapter: options?.adapter
26
29
  };
27
- if (options?.headers) {
28
- requestOptions.headers = options.headers;
29
- }
30
- if (options?.onRequest) {
31
- requestOptions.onRequest = options.onRequest;
32
- }
33
- this.requestOptions = requestOptions;
34
30
  }
35
31
  async getNodeAddresses(options) {
36
32
  assertRequestOptions(options);
package/dist/mjs/bee.js CHANGED
@@ -6,7 +6,7 @@ import { makeFeedReader, makeFeedWriter } from "./feed/index.js";
6
6
  import { getJsonData, setJsonData } from "./feed/json.js";
7
7
  import { areAllSequentialFeedsUpdateRetrievable } from "./feed/retrievable.js";
8
8
  import { makeTopic, makeTopicFromString } from "./feed/topic.js";
9
- import { assertFeedType, DEFAULT_FEED_TYPE } from "./feed/type.js";
9
+ import { DEFAULT_FEED_TYPE, assertFeedType } from "./feed/type.js";
10
10
  import * as bytes from "./modules/bytes.js";
11
11
  import * as bzz from "./modules/bzz.js";
12
12
  import * as chunk from "./modules/chunk.js";
@@ -47,17 +47,13 @@ export class Bee {
47
47
  if (options?.signer) {
48
48
  this.signer = makeSigner(options.signer);
49
49
  }
50
- const requestOptions = {
50
+ this.requestOptions = {
51
51
  baseURL: this.url,
52
- timeout: options?.timeout ?? false
52
+ timeout: options?.timeout ?? false,
53
+ headers: options?.headers,
54
+ onRequest: options?.onRequest,
55
+ adapter: options?.adapter
53
56
  };
54
- if (options?.headers) {
55
- requestOptions.headers = options.headers;
56
- }
57
- if (options?.onRequest) {
58
- requestOptions.onRequest = options.onRequest;
59
- }
60
- this.requestOptions = requestOptions;
61
57
  }
62
58
  /**
63
59
  * Upload data to a Bee node
@@ -24,7 +24,7 @@ export async function upload(requestOptions, data, postageBatchId, options) {
24
24
  });
25
25
  return {
26
26
  reference: response.data.reference,
27
- tagUid: makeTagUid(response.headers['swarm-tag'])
27
+ tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined
28
28
  };
29
29
  }
30
30
  /**
@@ -40,7 +40,7 @@ export async function uploadFile(requestOptions, data, postageBatchId, name, opt
40
40
  });
41
41
  return {
42
42
  reference: response.data.reference,
43
- tagUid: makeTagUid(response.headers['swarm-tag'])
43
+ tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined
44
44
  };
45
45
  }
46
46
  /**
@@ -110,6 +110,6 @@ export async function uploadCollection(requestOptions, collection, postageBatchI
110
110
  });
111
111
  return {
112
112
  reference: response.data.reference,
113
- tagUid: makeTagUid(response.headers['swarm-tag'])
113
+ tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined
114
114
  };
115
115
  }
@@ -1,6 +1,6 @@
1
1
  import { Index, IndexBytes } from './feed';
2
2
  import { FeedType } from './feed/type';
3
- import type { AddressPrefix, AnyJson, BatchId, BeeOptions, BeeRequestOptions, CollectionUploadOptions, Data, FeedReader, FeedWriter, FileData, FileUploadOptions, JsonFeedOptions, Pin, PssMessageHandler, PssSubscription, PublicKey, Reference, Signer, SOCReader, SOCWriter, Tag, Topic, UploadOptions, UploadResultWithCid } from './types';
3
+ import type { AddressPrefix, AnyJson, BatchId, BeeOptions, BeeRequestOptions, CollectionUploadOptions, Data, FeedReader, FeedWriter, FileData, FileUploadOptions, JsonFeedOptions, Pin, PssMessageHandler, PssSubscription, PublicKey, Reference, SOCReader, SOCWriter, Signer, Tag, Topic, UploadOptions, UploadResultWithCid } from './types';
4
4
  import { AllTagsOptions, Collection, FeedManifestResult, Readable, ReferenceCidOrEns, ReferenceOrEns, UploadResult } from './types';
5
5
  import { EthAddress } from './utils/eth';
6
6
  /**
@@ -137,11 +137,17 @@ export declare enum BeeModes {
137
137
  DEV = "dev"
138
138
  }
139
139
  export interface RedistributionState {
140
+ minimumGasFunds: NumberString;
141
+ hasSufficientFunds: boolean;
140
142
  isFrozen: boolean;
143
+ isFullySynced: boolean;
144
+ phase: string;
141
145
  round: number;
142
146
  lastWonRound: number;
143
147
  lastPlayedRound: number;
144
148
  lastFrozenRound: number;
149
+ lastSelectedRound: number;
150
+ lastSampleDuration: string;
145
151
  block: number;
146
152
  reward: NumberString;
147
153
  fees: NumberString;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ import { AxiosAdapter } from 'axios';
2
3
  import type { Identifier, SingleOwnerChunk } from '../chunk/soc';
3
4
  import type { FeedUploadOptions } from '../feed';
4
5
  import type { FeedType } from '../feed/type';
@@ -78,6 +79,7 @@ export type BeeRequestOptions = {
78
79
  timeout?: number | false;
79
80
  retry?: number | false;
80
81
  headers?: Record<string, string>;
82
+ adapter?: AxiosAdapter;
81
83
  onRequest?: (request: BeeRequest) => void;
82
84
  };
83
85
  export interface BeeOptions extends BeeRequestOptions {
@@ -85,7 +87,6 @@ export interface BeeOptions extends BeeRequestOptions {
85
87
  * Signer object or private key of the Signer in form of either hex string or Uint8Array that will be default signer for the instance.
86
88
  */
87
89
  signer?: Signer | Uint8Array | string;
88
- onRequest?: (request: BeeRequest) => void;
89
90
  }
90
91
  export interface UploadResultWithCid extends UploadResult {
91
92
  /**
@@ -107,7 +108,7 @@ export interface UploadResult {
107
108
  /**
108
109
  * Automatically created tag's UID.
109
110
  */
110
- tagUid: number;
111
+ tagUid?: number;
111
112
  }
112
113
  export interface UploadOptions {
113
114
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethersphere/bee-js",
3
- "version": "6.0.0",
3
+ "version": "6.2.0",
4
4
  "description": "Javascript client for Bee",
5
5
  "keywords": [
6
6
  "bee",
@@ -61,7 +61,7 @@
61
61
  "@ethersphere/swarm-cid": "^0.1.0",
62
62
  "@types/readable-stream": "^2.3.13",
63
63
  "axios": "^1.3.4",
64
- "cafe-utility": "^9.0.1",
64
+ "cafe-utility": "^10.8.1",
65
65
  "elliptic": "^6.5.4",
66
66
  "fetch-blob": "2.1.2",
67
67
  "isomorphic-ws": "^4.0.1",