@ethersphere/bee-js 6.9.0 → 7.0.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.
Files changed (144) hide show
  1. package/README.md +107 -65
  2. package/dist/cjs/bee.js +533 -6
  3. package/dist/cjs/chunk/cac.js +3 -3
  4. package/dist/cjs/chunk/soc.js +5 -5
  5. package/dist/cjs/chunk/span.js +2 -6
  6. package/dist/cjs/feed/identifier.js +2 -2
  7. package/dist/cjs/feed/index.js +7 -8
  8. package/dist/cjs/feed/retrievable.js +2 -2
  9. package/dist/cjs/index.js +1 -3
  10. package/dist/cjs/modules/bytes.js +3 -3
  11. package/dist/cjs/modules/bzz.js +9 -20
  12. package/dist/cjs/modules/chunk.js +2 -2
  13. package/dist/cjs/modules/debug/balance.js +4 -4
  14. package/dist/cjs/modules/debug/chequebook.js +8 -8
  15. package/dist/cjs/modules/debug/chunk.js +2 -19
  16. package/dist/cjs/modules/debug/settlements.js +2 -2
  17. package/dist/cjs/modules/debug/stake.js +3 -3
  18. package/dist/cjs/modules/debug/states.js +4 -19
  19. package/dist/cjs/modules/debug/status.js +15 -32
  20. package/dist/cjs/modules/debug/tag.js +1 -1
  21. package/dist/cjs/modules/debug/transactions.js +4 -4
  22. package/dist/cjs/modules/feed.js +6 -7
  23. package/dist/cjs/modules/pinning.js +4 -4
  24. package/dist/cjs/modules/pss.js +1 -1
  25. package/dist/cjs/modules/soc.js +1 -1
  26. package/dist/cjs/modules/status.js +1 -1
  27. package/dist/cjs/modules/stewardship.js +1 -1
  28. package/dist/cjs/package.json +4 -0
  29. package/dist/cjs/types/index.js +5 -1
  30. package/dist/cjs/utils/collection.js +7 -22
  31. package/dist/cjs/utils/collection.node.js +2 -1
  32. package/dist/cjs/utils/data.browser.js +1 -49
  33. package/dist/cjs/utils/error.js +2 -6
  34. package/dist/cjs/utils/eth.js +1 -1
  35. package/dist/cjs/utils/expose.js +1 -8
  36. package/dist/cjs/utils/file.js +2 -2
  37. package/dist/cjs/utils/http.js +6 -25
  38. package/dist/cjs/utils/tar-uploader.browser.js +26 -0
  39. package/dist/cjs/utils/tar-uploader.js +27 -0
  40. package/dist/cjs/utils/tar-writer.browser.js +17 -0
  41. package/dist/cjs/utils/tar-writer.js +21 -0
  42. package/dist/cjs/utils/tar.browser.js +65 -0
  43. package/dist/cjs/utils/tar.js +47 -21
  44. package/dist/cjs/utils/type.js +7 -3
  45. package/dist/cjs/utils/url.js +1 -6
  46. package/dist/index.browser.min.js +1 -1
  47. package/dist/index.browser.min.js.LICENSE.txt +0 -42
  48. package/dist/index.browser.min.js.map +1 -1
  49. package/dist/mjs/bee.js +533 -9
  50. package/dist/mjs/chunk/cac.js +4 -4
  51. package/dist/mjs/chunk/soc.js +6 -6
  52. package/dist/mjs/chunk/span.js +2 -6
  53. package/dist/mjs/feed/identifier.js +2 -2
  54. package/dist/mjs/feed/index.js +7 -11
  55. package/dist/mjs/feed/retrievable.js +2 -2
  56. package/dist/mjs/index.js +1 -2
  57. package/dist/mjs/modules/bytes.js +3 -3
  58. package/dist/mjs/modules/bzz.js +8 -20
  59. package/dist/mjs/modules/chunk.js +2 -2
  60. package/dist/mjs/modules/debug/balance.js +4 -4
  61. package/dist/mjs/modules/debug/chequebook.js +8 -8
  62. package/dist/mjs/modules/debug/chunk.js +1 -17
  63. package/dist/mjs/modules/debug/settlements.js +2 -2
  64. package/dist/mjs/modules/debug/stake.js +3 -3
  65. package/dist/mjs/modules/debug/states.js +4 -19
  66. package/dist/mjs/modules/debug/status.js +15 -34
  67. package/dist/mjs/modules/debug/tag.js +1 -1
  68. package/dist/mjs/modules/debug/transactions.js +4 -4
  69. package/dist/mjs/modules/feed.js +6 -7
  70. package/dist/mjs/modules/pinning.js +4 -4
  71. package/dist/mjs/modules/pss.js +1 -1
  72. package/dist/mjs/modules/soc.js +1 -1
  73. package/dist/mjs/modules/status.js +1 -1
  74. package/dist/mjs/modules/stewardship.js +1 -1
  75. package/dist/mjs/package.json +6 -2
  76. package/dist/mjs/types/index.js +4 -0
  77. package/dist/mjs/utils/collection.js +7 -22
  78. package/dist/mjs/utils/collection.node.js +2 -1
  79. package/dist/mjs/utils/data.browser.js +0 -57
  80. package/dist/mjs/utils/error.js +2 -6
  81. package/dist/mjs/utils/eth.js +1 -1
  82. package/dist/mjs/utils/expose.js +0 -1
  83. package/dist/mjs/utils/http.js +5 -2
  84. package/dist/mjs/utils/tar-uploader.browser.js +22 -0
  85. package/dist/mjs/utils/tar-uploader.js +23 -0
  86. package/dist/mjs/utils/tar-writer.browser.js +12 -0
  87. package/dist/mjs/utils/tar-writer.js +16 -0
  88. package/dist/mjs/utils/tar.browser.js +61 -0
  89. package/dist/mjs/utils/tar.js +45 -16
  90. package/dist/mjs/utils/type.js +4 -1
  91. package/dist/mjs/utils/url.js +1 -6
  92. package/dist/types/bee.d.ts +305 -4
  93. package/dist/types/chunk/soc.d.ts +2 -2
  94. package/dist/types/feed/identifier.d.ts +1 -1
  95. package/dist/types/feed/index.d.ts +1 -1
  96. package/dist/types/index.d.ts +1 -3
  97. package/dist/types/modules/bytes.d.ts +3 -3
  98. package/dist/types/modules/bzz.d.ts +14 -6
  99. package/dist/types/modules/chunk.d.ts +2 -2
  100. package/dist/types/modules/debug/balance.d.ts +4 -4
  101. package/dist/types/modules/debug/chequebook.d.ts +8 -8
  102. package/dist/types/modules/debug/chunk.d.ts +1 -10
  103. package/dist/types/modules/debug/settlements.d.ts +2 -2
  104. package/dist/types/modules/debug/stake.d.ts +3 -3
  105. package/dist/types/modules/debug/states.d.ts +3 -3
  106. package/dist/types/modules/debug/status.d.ts +10 -20
  107. package/dist/types/modules/debug/tag.d.ts +1 -1
  108. package/dist/types/modules/debug/transactions.d.ts +4 -4
  109. package/dist/types/modules/feed.d.ts +6 -9
  110. package/dist/types/modules/pinning.d.ts +4 -4
  111. package/dist/types/modules/pss.d.ts +1 -1
  112. package/dist/types/modules/soc.d.ts +1 -1
  113. package/dist/types/modules/status.d.ts +1 -1
  114. package/dist/types/modules/stewardship.d.ts +1 -1
  115. package/dist/types/types/debug.d.ts +0 -3
  116. package/dist/types/types/index.d.ts +9 -17
  117. package/dist/types/utils/collection.browser.d.ts +1 -1
  118. package/dist/types/utils/collection.d.ts +3 -3
  119. package/dist/types/utils/collection.node.d.ts +1 -1
  120. package/dist/types/utils/data.browser.d.ts +0 -7
  121. package/dist/types/utils/data.d.ts +1 -2
  122. package/dist/types/utils/error.d.ts +2 -7
  123. package/dist/types/utils/eth.d.ts +1 -1
  124. package/dist/types/utils/expose.d.ts +0 -1
  125. package/dist/types/utils/tar-uploader.browser.d.ts +4 -0
  126. package/dist/types/utils/tar-uploader.d.ts +4 -0
  127. package/dist/types/utils/tar-writer.browser.d.ts +3 -0
  128. package/dist/types/utils/tar-writer.d.ts +3 -0
  129. package/dist/types/utils/tar.browser.d.ts +9 -0
  130. package/dist/types/utils/tar.d.ts +10 -2
  131. package/dist/types/utils/type.d.ts +4 -1
  132. package/package.json +4 -19
  133. package/dist/cjs/bee-debug.js +0 -590
  134. package/dist/cjs/chunk/serialize.js +0 -19
  135. package/dist/cjs/utils/stream.js +0 -146
  136. package/dist/cjs/utils/uint64.js +0 -29
  137. package/dist/mjs/bee-debug.js +0 -560
  138. package/dist/mjs/chunk/serialize.js +0 -15
  139. package/dist/mjs/utils/stream.js +0 -129
  140. package/dist/mjs/utils/uint64.js +0 -22
  141. package/dist/types/bee-debug.d.ts +0 -323
  142. package/dist/types/chunk/serialize.d.ts +0 -6
  143. package/dist/types/utils/stream.d.ts +0 -40
  144. package/dist/types/utils/uint64.d.ts +0 -4
@@ -2,18 +2,18 @@ import { BeeRequestOptions, ChainState, ReserveState, WalletBalance } from '../.
2
2
  /**
3
3
  * Get state of reserve
4
4
  *
5
- * @param kyOptions Ky Options for making requests
5
+ * @param requestOptions Options for making requests
6
6
  */
7
7
  export declare function getReserveState(requestOptions: BeeRequestOptions): Promise<ReserveState>;
8
8
  /**
9
9
  * Get state of reserve
10
10
  *
11
- * @param kyOptions Ky Options for making requests
11
+ * @param requestOptions Options for making requests
12
12
  */
13
13
  export declare function getChainState(requestOptions: BeeRequestOptions): Promise<ChainState>;
14
14
  /**
15
15
  * Get wallet balances for xDai and BZZ of the node
16
16
  *
17
- * @param kyOptions Ky Options for making requests
17
+ * @param requestOptions Options for making requests
18
18
  */
19
19
  export declare function getWalletBalance(requestOptions: BeeRequestOptions): Promise<WalletBalance>;
@@ -9,26 +9,25 @@ export declare function getDebugStatus(requestOptions: BeeRequestOptions): Promi
9
9
  /**
10
10
  * Get health of node
11
11
  *
12
- * @param kyOptions Ky Options for making requests
12
+ * @param requestOptions Options for making requests
13
13
  */
14
14
  export declare function getHealth(requestOptions: BeeRequestOptions): Promise<Health>;
15
15
  /**
16
16
  * Get readiness of node
17
17
  *
18
- * @param kyOptions Ky Options for making requests
18
+ * @param requestOptions Options for making requests
19
19
  */
20
20
  export declare function getReadiness(requestOptions: BeeRequestOptions): Promise<boolean>;
21
21
  /**
22
22
  * Get information about Bee node
23
23
  *
24
- * @param kyOptions Ky Options for making requests
24
+ * @param requestOptions Options for making requests
25
25
  */
26
26
  export declare function getNodeInfo(requestOptions: BeeRequestOptions): Promise<NodeInfo>;
27
27
  /**
28
28
  * Connects to a node and checks if it is a supported Bee version by the bee-js
29
29
  *
30
- * @param kyOptions Ky Options for making requests
31
- *
30
+ * @param requestOptions Options for making requests
32
31
  * @returns true if the Bee node version is supported
33
32
  * @deprecated Use `isSupportedExactVersion` instead
34
33
  */
@@ -41,39 +40,30 @@ export declare function isSupportedVersion(requestOptions: BeeRequestOptions): P
41
40
  * `isSupportedApiVersion`, `isSupportedMainApiVersion` or `isSupportedDebugApiVersion`
42
41
  * based on your use-case.
43
42
  *
44
- * @param ky
43
+ * @param requestOptions Options for making requests
45
44
  */
46
45
  export declare function isSupportedExactVersion(requestOptions: BeeRequestOptions): Promise<boolean>;
47
46
  /**
48
47
  * Connects to a node and checks if its main's API version matches with the one that bee-js supports.
49
48
  *
50
- * This is useful if you are not using `BeeDebug` class (for anything else then this check)
49
+ * This is useful if you are not using `Bee` class (for anything else then this check)
51
50
  * and want to make sure about compatibility.
52
51
  *
53
- * @param ky
52
+ * @param requestOptions Options for making requests
54
53
  */
55
54
  export declare function isSupportedMainApiVersion(requestOptions: BeeRequestOptions): Promise<boolean>;
56
55
  /**
57
- * Connects to a node and checks if its Debug API version matches with the one that bee-js supports.
58
- *
59
- * This is useful if you are not using `Bee` class in your application and want to make sure
60
- * about compatibility.
61
- *
62
- * @param ky
63
- */
64
- export declare function isSupportedDebugApiVersion(requestOptions: BeeRequestOptions): Promise<boolean>;
65
- /**
66
- * Connects to a node and checks if its Main and Debug API versions matches with the one that bee-js supports.
56
+ * Connects to a node and checks if its Main API versions matches with the one that bee-js supports.
67
57
  *
68
58
  * This should be the main way how to check compatibility for your app and Bee node.
69
59
  *
70
- * @param ky
60
+ * @param requestOptions Options for making requests
71
61
  */
72
62
  export declare function isSupportedApiVersion(requestOptions: BeeRequestOptions): Promise<boolean>;
73
63
  /**
74
64
  * Returns object with all versions specified by the connected Bee node (properties prefixed with `bee*`)
75
65
  * and versions that bee-js supports (properties prefixed with `supported*`).
76
66
  *
77
- * @param ky
67
+ * @param requestOptions Options for making requests
78
68
  */
79
69
  export declare function getVersions(requestOptions: BeeRequestOptions): Promise<BeeVersions>;
@@ -2,7 +2,7 @@ import { BeeRequestOptions, ExtendedTag } from '../../types';
2
2
  /**
3
3
  * Retrieve tag with extended information from Bee node
4
4
  *
5
- * @param kyOptions Ky Options for making requests
5
+ * @param requestOptions Options for making requests
6
6
  * @param uid UID of tag to be retrieved
7
7
  */
8
8
  export declare function retrieveExtendedTag(requestOptions: BeeRequestOptions, uid: number): Promise<ExtendedTag>;
@@ -2,27 +2,27 @@ import { BeeRequestOptions, NumberString, TransactionHash, TransactionInfo } fro
2
2
  /**
3
3
  * Get list of all pending transactions
4
4
  *
5
- * @param ky Debug Ky instance
5
+ * @param requestOptions Options for making requests
6
6
  */
7
7
  export declare function getAllTransactions(requestOptions: BeeRequestOptions): Promise<TransactionInfo[]>;
8
8
  /**
9
9
  * Get information for specific pending transactions
10
10
  *
11
- * @param ky Debug Ky instance
11
+ * @param requestOptions Options for making requests
12
12
  * @param transactionHash Hash of the transaction
13
13
  */
14
14
  export declare function getTransaction(requestOptions: BeeRequestOptions, transactionHash: TransactionHash): Promise<TransactionInfo>;
15
15
  /**
16
16
  * Rebroadcast existing transaction
17
17
  *
18
- * @param ky Debug Ky instance
18
+ * @param requestOptions Options for making requests
19
19
  * @param transactionHash Hash of the transaction
20
20
  */
21
21
  export declare function rebroadcastTransaction(requestOptions: BeeRequestOptions, transactionHash: TransactionHash): Promise<TransactionHash>;
22
22
  /**
23
23
  * Cancel existing transaction
24
24
  *
25
- * @param ky Debug Ky instance
25
+ * @param requestOptions Options for making requests
26
26
  * @param transactionHash Hash of the transaction
27
27
  * @param gasPrice Optional gas price
28
28
  */
@@ -10,9 +10,6 @@ export interface FeedUpdateOptions {
10
10
  * Specifies the start date as unix time stamp
11
11
  */
12
12
  at?: number;
13
- /**
14
- * Can be 'epoch' or 'sequence' (default: 'sequence')
15
- */
16
13
  type?: FeedType;
17
14
  /**
18
15
  * Fetch specific previous Feed's update (default fetches latest update)
@@ -35,13 +32,13 @@ export interface FetchFeedUpdateResponse extends ReferenceResponse, FeedUpdateHe
35
32
  /**
36
33
  * Create an initial feed root manifest
37
34
  *
38
- * @param ky Ky instance
35
+ * @param requestOptions Options for making requests
39
36
  * @param owner Owner's ethereum address in hex
40
37
  * @param topic Topic in hex
41
38
  * @param postageBatchId Postage BatchId to be used to create the Feed Manifest
42
39
  * @param options Additional options, like type (default: 'sequence')
43
40
  */
44
- export declare function createFeedManifest(requestOptions: BeeRequestOptions, owner: HexEthAddress, topic: Topic, postageBatchId: BatchId, options?: CreateFeedOptions): Promise<Reference>;
41
+ export declare function createFeedManifest(requestOptions: BeeRequestOptions, owner: HexEthAddress, topic: Topic, postageBatchId: BatchId): Promise<Reference>;
45
42
  /**
46
43
  * Find and retrieve feed update
47
44
  *
@@ -50,10 +47,10 @@ export declare function createFeedManifest(requestOptions: BeeRequestOptions, ow
50
47
  * the reference it contains along with its index and the
51
48
  * index of the subsequent update.
52
49
  *
53
- * @param ky Ky instance
54
- * @param owner Owner's ethereum address in hex
55
- * @param topic Topic in hex
56
- * @param options Additional options, like index, at, type
50
+ * @param requestOptions Options for making requests
51
+ * @param owner Owner's ethereum address in hex
52
+ * @param topic Topic in hex
53
+ * @param options Additional options, like index, at, type
57
54
  */
58
55
  export declare function fetchLatestFeedUpdate(requestOptions: BeeRequestOptions, owner: HexEthAddress, topic: Topic, options?: FeedUpdateOptions): Promise<FetchFeedUpdateResponse>;
59
56
  export {};
@@ -5,21 +5,21 @@ export interface GetAllPinResponse {
5
5
  /**
6
6
  * Pin data with given reference
7
7
  *
8
- * @param kyOptions Ky Options for making requests
8
+ * @param requestOptions Options for making requests
9
9
  * @param reference Bee data reference
10
10
  */
11
11
  export declare function pin(requestOptions: BeeRequestOptions, reference: Reference): Promise<void>;
12
12
  /**
13
13
  * Unpin data with given reference
14
14
  *
15
- * @param kyOptions Ky Options for making requests
15
+ * @param requestOptions Options for making requests
16
16
  * @param reference Bee data reference
17
17
  */
18
18
  export declare function unpin(requestOptions: BeeRequestOptions, reference: Reference): Promise<void>;
19
19
  /**
20
20
  * Get pin status for specific address.
21
21
  *
22
- * @param ky Ky instance
22
+ * @param requestOptions Options for making requests
23
23
  * @param reference
24
24
  * @throws Error if given address is not pinned
25
25
  */
@@ -27,6 +27,6 @@ export declare function getPin(requestOptions: BeeRequestOptions, reference: Ref
27
27
  /**
28
28
  * Get list of all pins
29
29
  *
30
- * @param ky Ky instance
30
+ * @param requestOptions Options for making requests
31
31
  */
32
32
  export declare function getAllPins(requestOptions: BeeRequestOptions): Promise<Reference[]>;
@@ -4,7 +4,7 @@ import type { BatchId, BeeRequestOptions, PublicKey } from '../types';
4
4
  /**
5
5
  * Send to recipient or target with Postal Service for Swarm
6
6
  *
7
- * @param kyOptions Ky Options for making requests
7
+ * @param requestOptions Options for making requests
8
8
  * @param topic Topic name
9
9
  * @param target Target message address prefix
10
10
  * @param data
@@ -2,7 +2,7 @@ import { BatchId, BeeRequestOptions, Reference, UploadOptions } from '../types';
2
2
  /**
3
3
  * Upload single owner chunk (SOC) to a Bee node
4
4
  *
5
- * @param ky Ky instance
5
+ * @param requestOptions Options for making requests
6
6
  * @param owner Owner's ethereum address in hex
7
7
  * @param identifier Arbitrary identifier in hex
8
8
  * @param signature Signature in hex
@@ -2,6 +2,6 @@ import { BeeRequestOptions } from '../index';
2
2
  /**
3
3
  * Ping the base bee URL. If connection was not successful throw error
4
4
  *
5
- * @param kyOptions Ky instance for given Bee class instance
5
+ * @param requestOptions Options for making requests
6
6
  */
7
7
  export declare function checkConnection(requestOptions: BeeRequestOptions): Promise<void> | never;
@@ -1,7 +1,7 @@
1
1
  import type { BeeRequestOptions, ReferenceOrEns } from '../types';
2
2
  /**
3
3
  * Reupload locally pinned data
4
- * @param ky Ky instance
4
+ * @param requestOptions Options for making requests
5
5
  * @param reference
6
6
  * @param options
7
7
  * @throws BeeResponseError if not locally pinned or invalid data
@@ -132,15 +132,12 @@ export interface Health {
132
132
  status: 'ok';
133
133
  version: string;
134
134
  apiVersion: string;
135
- debugApiVersion: string;
136
135
  }
137
136
  export interface BeeVersions {
138
137
  supportedBeeVersion: string;
139
138
  supportedBeeApiVersion: string;
140
- supportedBeeDebugApiVersion: string;
141
139
  beeVersion: string;
142
140
  beeApiVersion: string;
143
- beeDebugApiVersion: string;
144
141
  }
145
142
  export declare enum BeeModes {
146
143
  FULL = "full",
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- import { AxiosAdapter } from 'axios';
3
1
  import type { Identifier, SingleOwnerChunk } from '../chunk/soc';
4
2
  import type { FeedUploadOptions } from '../feed';
5
3
  import type { FeedType } from '../feed/type';
@@ -8,9 +6,6 @@ import type { Bytes } from '../utils/bytes';
8
6
  import type { BeeError } from '../utils/error';
9
7
  import type { EthAddress, HexEthAddress } from '../utils/eth';
10
8
  import type { HexString } from '../utils/hex';
11
- import type { Readable as CompatibilityReadable } from 'readable-stream';
12
- import type { Readable as NativeReadable } from 'stream';
13
- import type { ReadableStream as ReadableStreamPonyfill } from 'web-streams-polyfill';
14
9
  export * from './debug';
15
10
  export interface Dictionary<T> {
16
11
  [Key: string]: T;
@@ -31,6 +26,10 @@ export declare const ENCRYPTED_REFERENCE_BYTES_LENGTH = 64;
31
26
  * Minimal depth that can be used for creation of postage batch
32
27
  */
33
28
  export declare const STAMPS_DEPTH_MIN = 17;
29
+ /**
30
+ * Minimal amount that can be used for creation of postage batch
31
+ */
32
+ export declare const STAMPS_AMOUNT_MIN: number;
34
33
  /**
35
34
  * Maximal depth that can be used for creation of postage batch
36
35
  */
@@ -60,11 +59,6 @@ export type EncryptedBytesReference = Bytes<typeof ENCRYPTED_REFERENCE_BYTES_LEN
60
59
  export type BytesReference = PlainBytesReference | EncryptedBytesReference;
61
60
  export type PublicKey = HexString<typeof PUBKEY_HEX_LENGTH>;
62
61
  export type Address = HexString<typeof ADDRESS_HEX_LENGTH>;
63
- /**
64
- * Type representing Readable stream that abstracts away implementation especially the difference between
65
- * browser and NodeJS versions as both are supported.
66
- */
67
- export type Readable = NativeReadable | CompatibilityReadable | ReadableStream | ReadableStreamPonyfill;
68
62
  /**
69
63
  * BatchId is result of keccak256 hash so 64 hex string without prefix.
70
64
  */
@@ -79,7 +73,6 @@ export type BeeRequestOptions = {
79
73
  timeout?: number | false;
80
74
  retry?: number | false;
81
75
  headers?: Record<string, string>;
82
- adapter?: AxiosAdapter;
83
76
  onRequest?: (request: BeeRequest) => void;
84
77
  };
85
78
  export interface BeeOptions extends BeeRequestOptions {
@@ -306,17 +299,16 @@ export interface Data extends Uint8Array {
306
299
  /**
307
300
  * Object represents a file and some of its metadata in [[Directory]] object.
308
301
  */
309
- export interface CollectionEntry<T> {
310
- data: T;
311
- /**
312
- *
313
- */
302
+ export interface CollectionEntry {
314
303
  path: string;
304
+ size: number;
305
+ file?: File;
306
+ fsPath?: string;
315
307
  }
316
308
  /**
317
309
  * Represents Collections
318
310
  */
319
- export type Collection<T> = Array<CollectionEntry<T>>;
311
+ export type Collection = Array<CollectionEntry>;
320
312
  export interface PssSubscription {
321
313
  readonly topic: string;
322
314
  cancel: () => void;
@@ -5,7 +5,7 @@ import { Collection } from '../types';
5
5
  *
6
6
  * @param dir path to the directory
7
7
  */
8
- export declare function makeCollectionFromFS(dir: string): Promise<Collection<Uint8Array>>;
8
+ export declare function makeCollectionFromFS(dir: string): Promise<Collection>;
9
9
  /**
10
10
  * Calculate folder size recursively
11
11
  *
@@ -1,7 +1,7 @@
1
1
  import { Collection } from '../types';
2
- export declare function isCollection(data: unknown): data is Collection<Uint8Array>;
3
- export declare function assertCollection(data: unknown): asserts data is Collection<Uint8Array>;
4
- export declare function makeCollectionFromFileList(fileList: FileList | File[]): Promise<Collection<Uint8Array>>;
2
+ export declare function isCollection(data: unknown): data is Collection;
3
+ export declare function assertCollection(data: unknown): asserts data is Collection;
4
+ export declare function makeCollectionFromFileList(fileList: FileList | File[]): Promise<Collection>;
5
5
  /**
6
6
  * Calculate cumulative size of files
7
7
  *
@@ -5,7 +5,7 @@ import { Collection } from '../types';
5
5
  *
6
6
  * @param dir path to the directory
7
7
  */
8
- export declare function makeCollectionFromFS(dir: string): Promise<Collection<Uint8Array>>;
8
+ export declare function makeCollectionFromFS(dir: string): Promise<Collection>;
9
9
  /**
10
10
  * Calculate folder size recursively
11
11
  *
@@ -1,8 +1 @@
1
- import { Readable } from '../types';
2
- /**
3
- * Validates input and converts to Uint8Array
4
- *
5
- * @param data any string, ArrayBuffer or Uint8Array
6
- */
7
- export declare function prepareData(data: string | Blob | ArrayBuffer | Uint8Array | Readable): Promise<Blob | ReadableStream<Uint8Array> | never>;
8
1
  export declare function prepareWebsocketData(data: string | ArrayBuffer | Blob): Promise<Uint8Array> | never;
@@ -1,3 +1,2 @@
1
- import BlobPolyfill from 'fetch-blob';
2
1
  import type { Data } from 'ws';
3
- export declare function prepareWebsocketData(data: Data | BlobPolyfill): Promise<Uint8Array> | never;
2
+ export declare function prepareWebsocketData(data: Data | Blob): Promise<Uint8Array> | never;
@@ -1,4 +1,3 @@
1
- import { AxiosRequestConfig, AxiosResponse } from 'axios';
2
1
  export declare class BeeError extends Error {
3
2
  constructor(message: string);
4
3
  }
@@ -7,11 +6,7 @@ export declare class BeeArgumentError extends BeeError {
7
6
  constructor(message: string, value: unknown);
8
7
  }
9
8
  export declare class BeeResponseError extends BeeError {
10
- code?: string | undefined;
11
- axiosStatus?: number | undefined;
12
9
  status?: number | undefined;
13
- config?: AxiosRequestConfig<any> | undefined;
14
- request?: any;
15
- response?: AxiosResponse<any, any> | undefined;
16
- constructor(message: string, code?: string | undefined, axiosStatus?: number | undefined, status?: number | undefined, config?: AxiosRequestConfig<any> | undefined, request?: any, response?: AxiosResponse<any, any> | undefined);
10
+ statusText?: string | undefined;
11
+ constructor(message: string, status?: number | undefined, statusText?: string | undefined);
17
12
  }
@@ -1,6 +1,6 @@
1
1
  import { BrandedString, Signer } from '../types';
2
- import { HexString } from './hex';
3
2
  import { Bytes } from './bytes';
3
+ import { HexString } from './hex';
4
4
  export type OverlayAddress = BrandedString<'OverlayAddress'>;
5
5
  export type EthAddress = Bytes<20>;
6
6
  export type HexEthAddress = HexString<40>;
@@ -3,7 +3,6 @@ export { getFolderSize } from './collection.node';
3
3
  export { Bytes, FlexBytes, assertBytes, assertFlexBytes, bytesAtOffset, bytesEqual, flexBytesAtOffset, isBytes, isFlexBytes, } from './bytes';
4
4
  export { HexString, PrefixedHexString, assertHexString, assertPrefixedHexString, bytesToHex, hexToBytes, intToHex, isHexString, makeHexString, } from './hex';
5
5
  export { EthAddress, ethToSwarmAddress, fromLittleEndian, isHexEthAddress, makeEthAddress, makeEthereumWalletSigner, makeHexEthAddress, toLittleEndian, } from './eth';
6
- export { isNodeReadable, isReadable, isReadableStream, normalizeToReadableStream, readableNodeToWeb, readableWebToNode, } from './stream';
7
6
  export { keccak256Hash } from './hash';
8
7
  export { makeMaxTarget } from './pss';
9
8
  export { getAmountForTtl, getDepthForCapacity, getStampCostInBzz, getStampCostInPlur, getStampEffectiveBytes, getStampMaximumCapacityBytes, getStampTtlSeconds, getStampUsage, } from './stamps';
@@ -0,0 +1,4 @@
1
+ import { BatchId, BeeRequestOptions, Collection, CollectionUploadOptions, Reference, UploadRedundancyOptions } from '..';
2
+ export declare function uploadTar(requestOptions: BeeRequestOptions, collection: Collection, postageBatchId: BatchId, options?: CollectionUploadOptions & UploadRedundancyOptions): Promise<import("axios").AxiosResponse<{
3
+ reference: Reference;
4
+ }, any>>;
@@ -0,0 +1,4 @@
1
+ import { BatchId, BeeRequestOptions, Collection, CollectionUploadOptions, Reference, UploadRedundancyOptions } from '..';
2
+ export declare function uploadTar(requestOptions: BeeRequestOptions, collection: Collection, postageBatchId: BatchId, options?: CollectionUploadOptions & UploadRedundancyOptions): Promise<import("axios").AxiosResponse<{
3
+ reference: Reference;
4
+ }, any>>;
@@ -0,0 +1,3 @@
1
+ import { Collection } from '..';
2
+ import { TarStream } from './tar';
3
+ export declare function writeTar(collection: Collection, tarStream: TarStream): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import { Collection } from '..';
2
+ import { TarStream } from './tar';
3
+ export declare function writeTar(collection: Collection, tarStream: TarStream): Promise<void>;
@@ -0,0 +1,9 @@
1
+ export declare class TarStream {
2
+ pieces: Uint8Array[];
3
+ currentFileSize: number;
4
+ get output(): Uint8Array;
5
+ beginFile(path: string, size: number): Promise<void>;
6
+ appendFile(data: Uint8Array): Promise<void>;
7
+ endFile(): Promise<void>;
8
+ end(): Promise<void>;
9
+ }
@@ -1,2 +1,10 @@
1
- import { Collection } from '../types';
2
- export declare function makeTar(data: Collection<Uint8Array>): Uint8Array;
1
+ /// <reference types="node" />
2
+ import { PassThrough } from 'stream';
3
+ export declare class TarStream {
4
+ output: PassThrough;
5
+ currentFileSize: number;
6
+ beginFile(path: string, size: number): Promise<void>;
7
+ appendFile(data: Uint8Array): Promise<void>;
8
+ endFile(): Promise<void>;
9
+ end(): Promise<void>;
10
+ }
@@ -1,5 +1,8 @@
1
+ /// <reference types="node" />
1
2
  import { ReferenceType } from '@ethersphere/swarm-cid';
2
- import { Address, AddressPrefix, AllTagsOptions, BatchId, BeeRequestOptions, CashoutOptions, CollectionUploadOptions, FileUploadOptions, NumberString, PostageBatchOptions, PssMessageHandler, PublicKey, Readable, Reference, ReferenceOrEns, Tag, TransactionHash, TransactionOptions, UploadOptions } from '../types';
3
+ import { Readable } from 'stream';
4
+ import { Address, AddressPrefix, AllTagsOptions, BatchId, BeeRequestOptions, CashoutOptions, CollectionUploadOptions, FileUploadOptions, NumberString, PostageBatchOptions, PssMessageHandler, PublicKey, Reference, ReferenceOrEns, Tag, TransactionHash, TransactionOptions, UploadOptions } from '../types';
5
+ export declare function isReadable(obj: unknown): obj is Readable;
3
6
  export declare function isUint8Array(obj: unknown): obj is Uint8Array;
4
7
  export declare function isInteger(value: unknown): value is number | NumberString;
5
8
  export declare function isObject(value: unknown): value is Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethersphere/bee-js",
3
- "version": "6.9.0",
3
+ "version": "7.0.0",
4
4
  "description": "Javascript client for Bee",
5
5
  "keywords": [
6
6
  "bee",
@@ -34,6 +34,7 @@
34
34
  "types": "dist/types/index.d.ts",
35
35
  "browser": {
36
36
  "stream": false,
37
+ "fs": false,
37
38
  "./src/utils/data.ts": "./src/utils/data.browser.ts",
38
39
  "./dist/cjs/utils/data.js": "./dist/cjs/utils/data.browser.js",
39
40
  "./dist/mjs/utils/data.js": "./dist/mjs/utils/data.browser.js",
@@ -60,16 +61,12 @@
60
61
  },
61
62
  "dependencies": {
62
63
  "@ethersphere/swarm-cid": "^0.1.0",
63
- "@types/readable-stream": "^2.3.13",
64
- "axios": "^0.28.0",
65
- "cafe-utility": "^15.0.2",
64
+ "axios": "^0.28.1",
65
+ "cafe-utility": "^21.3.1",
66
66
  "elliptic": "^6.5.4",
67
- "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
- "tar-js": "^0.3.0",
72
- "web-streams-polyfill": "^4.0.0-beta.3",
73
70
  "ws": "^8.7.0"
74
71
  },
75
72
  "devDependencies": {
@@ -85,8 +82,6 @@
85
82
  "@naholyr/cross-env": "^1.0.0",
86
83
  "@types/chai": "^4.3.4",
87
84
  "@types/chai-as-promised": "^7.1.5",
88
- "@types/content-disposition": "^0.5.4",
89
- "@types/debug": "^4.1.7",
90
85
  "@types/elliptic": "^6.4.14",
91
86
  "@types/mocha": "^10.0.1",
92
87
  "@types/node": "^18.11.11",
@@ -101,9 +96,7 @@
101
96
  "chai": "^4.3.7",
102
97
  "chai-as-promised": "^7.1.1",
103
98
  "chai-parentheses": "^0.0.2",
104
- "cross-blob": "^2.0.1",
105
99
  "cross-env": "^7.0.3",
106
- "debug": "^4.3.4",
107
100
  "depcheck": "^1.4.3",
108
101
  "eslint": "^8.13.0",
109
102
  "eslint-config-prettier": "^8.5.0",
@@ -122,14 +115,6 @@
122
115
  "ts-node": "^10.9.1",
123
116
  "typescript": "^4.9.5",
124
117
  "webpack": "^5.75.0",
125
- "webpack-bundle-analyzer": "^4.5.0",
126
118
  "webpack-cli": "^5.0.1"
127
- },
128
- "engines": {
129
- "node": ">=14.0.0",
130
- "npm": ">=6.0.0",
131
- "beeApiVersion": "4.0.0",
132
- "beeDebugApiVersion": "4.0.0",
133
- "bee": "1.18.2-759f56f"
134
119
  }
135
120
  }