@ethersphere/bee-js 1.2.1 → 3.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 (181) hide show
  1. package/CHANGELOG.md +135 -2
  2. package/README.md +3 -1
  3. package/dist/index.browser.min.js +1 -1
  4. package/dist/index.browser.min.js.LICENSE.txt +51 -0
  5. package/dist/index.browser.min.js.map +1 -1
  6. package/dist/index.min.js +1 -1
  7. package/dist/index.min.js.LICENSE.txt +42 -0
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/src/bee-debug.d.ts +75 -38
  10. package/dist/src/bee.d.ts +88 -82
  11. package/dist/src/chunk/soc.d.ts +6 -6
  12. package/dist/src/feed/index.d.ts +7 -7
  13. package/dist/src/feed/json.d.ts +2 -2
  14. package/dist/src/modules/bytes.d.ts +8 -11
  15. package/dist/src/modules/bzz.d.ts +9 -14
  16. package/dist/src/modules/chunk.d.ts +7 -11
  17. package/dist/src/modules/debug/balance.d.ts +9 -9
  18. package/dist/src/modules/debug/chequebook.d.ts +17 -18
  19. package/dist/src/modules/debug/chunk.d.ts +5 -5
  20. package/dist/src/modules/debug/connectivity.d.ts +7 -7
  21. package/dist/src/modules/debug/settlements.d.ts +5 -5
  22. package/dist/src/modules/debug/stamps.d.ts +7 -5
  23. package/dist/src/modules/debug/states.d.ts +5 -5
  24. package/dist/src/modules/debug/status.d.ts +5 -4
  25. package/dist/src/modules/debug/tag.d.ts +3 -3
  26. package/dist/src/modules/debug/transactions.d.ts +9 -9
  27. package/dist/src/modules/feed.d.ts +5 -5
  28. package/dist/src/modules/pinning.d.ts +9 -9
  29. package/dist/src/modules/pss.d.ts +4 -3
  30. package/dist/src/modules/soc.d.ts +3 -3
  31. package/dist/src/modules/status.d.ts +3 -2
  32. package/dist/src/modules/stewardship.d.ts +4 -4
  33. package/dist/src/modules/tag.d.ts +6 -6
  34. package/dist/src/types/debug.d.ts +4 -2
  35. package/dist/src/types/index.d.ts +71 -19
  36. package/dist/src/utils/bytes.d.ts +1 -1
  37. package/dist/src/utils/data.browser.d.ts +3 -1
  38. package/dist/src/utils/data.d.ts +7 -4
  39. package/dist/src/utils/expose.d.ts +6 -9
  40. package/dist/src/utils/headers.d.ts +3 -3
  41. package/dist/src/utils/http.d.ts +25 -0
  42. package/dist/src/utils/merge.d.ts +8 -0
  43. package/dist/src/utils/pss.d.ts +9 -0
  44. package/dist/src/utils/stream.d.ts +37 -0
  45. package/dist/src/utils/type.d.ts +19 -9
  46. package/package.json +15 -8
  47. package/.babelrc.js +0 -33
  48. package/.depcheckrc.json +0 -27
  49. package/.editorconfig +0 -6
  50. package/.eslintignore +0 -1
  51. package/.eslintrc.js +0 -108
  52. package/.gitattributes +0 -1
  53. package/.github/config.yaml +0 -23
  54. package/.github/workflows/check.yaml +0 -57
  55. package/.github/workflows/publish_npmjs.yaml +0 -20
  56. package/.github/workflows/release_github.yaml +0 -20
  57. package/.github/workflows/tests.yaml +0 -128
  58. package/.huskyrc +0 -5
  59. package/.prettierrc +0 -13
  60. package/.vscode/launch.json +0 -49
  61. package/.vscode/settings.json +0 -39
  62. package/CODEOWNERS +0 -1
  63. package/CODE_OF_CONDUCT.md +0 -76
  64. package/commitlint.config.js +0 -3
  65. package/dist/src/modules/stamps.d.ts +0 -4
  66. package/dist/src/utils/hooks.d.ts +0 -31
  67. package/dist/src/utils/safe-axios.d.ts +0 -8
  68. package/jest-puppeteer.config.js +0 -5
  69. package/jest.config.ts +0 -170
  70. package/src/bee-debug.ts +0 -440
  71. package/src/bee.ts +0 -941
  72. package/src/chunk/bmt.ts +0 -55
  73. package/src/chunk/cac.ts +0 -79
  74. package/src/chunk/serialize.ts +0 -16
  75. package/src/chunk/signer.ts +0 -141
  76. package/src/chunk/soc.ts +0 -190
  77. package/src/chunk/span.ts +0 -33
  78. package/src/feed/index.ts +0 -221
  79. package/src/feed/json.ts +0 -32
  80. package/src/feed/topic.ts +0 -23
  81. package/src/feed/type.ts +0 -12
  82. package/src/index.ts +0 -24
  83. package/src/modules/bytes.ts +0 -75
  84. package/src/modules/bzz.ts +0 -184
  85. package/src/modules/chunk.ts +0 -75
  86. package/src/modules/debug/balance.ts +0 -63
  87. package/src/modules/debug/chequebook.ts +0 -174
  88. package/src/modules/debug/chunk.ts +0 -39
  89. package/src/modules/debug/connectivity.ts +0 -61
  90. package/src/modules/debug/settlements.ts +0 -33
  91. package/src/modules/debug/stamps.ts +0 -69
  92. package/src/modules/debug/states.ts +0 -35
  93. package/src/modules/debug/status.ts +0 -34
  94. package/src/modules/debug/tag.ts +0 -19
  95. package/src/modules/debug/transactions.ts +0 -79
  96. package/src/modules/feed.ts +0 -92
  97. package/src/modules/pinning.ts +0 -74
  98. package/src/modules/pss.ts +0 -48
  99. package/src/modules/soc.ts +0 -41
  100. package/src/modules/stamps.ts +0 -59
  101. package/src/modules/status.ts +0 -13
  102. package/src/modules/stewardship.ts +0 -21
  103. package/src/modules/tag.ts +0 -83
  104. package/src/types/axios/index.d.ts +0 -18
  105. package/src/types/debug.ts +0 -204
  106. package/src/types/index.ts +0 -497
  107. package/src/types/tar-js.d.ts +0 -1
  108. package/src/types/webpack-bundle-analyzer/index.d.ts +0 -13
  109. package/src/utils/bytes.ts +0 -144
  110. package/src/utils/collection.ts +0 -151
  111. package/src/utils/data.browser.ts +0 -24
  112. package/src/utils/data.ts +0 -35
  113. package/src/utils/error.ts +0 -23
  114. package/src/utils/eth.ts +0 -229
  115. package/src/utils/expose.ts +0 -10
  116. package/src/utils/file.ts +0 -40
  117. package/src/utils/hash.ts +0 -16
  118. package/src/utils/headers.ts +0 -63
  119. package/src/utils/hex.ts +0 -186
  120. package/src/utils/hooks.ts +0 -89
  121. package/src/utils/safe-axios.ts +0 -98
  122. package/src/utils/tar.ts +0 -30
  123. package/src/utils/type.ts +0 -302
  124. package/src/utils/uint64.ts +0 -31
  125. package/src/utils/url.ts +0 -52
  126. package/test/bee.sh +0 -187
  127. package/test/data/1.txt +0 -1
  128. package/test/data/2.txt +0 -0
  129. package/test/data/empty +0 -0
  130. package/test/data/sub/3.txt +0 -1
  131. package/test/data/sub//303/251 +0 -0
  132. package/test/data/sub//360/237/230/216 +0 -0
  133. package/test/integration/bee-class.browser.spec.ts +0 -215
  134. package/test/integration/bee-class.spec.ts +0 -595
  135. package/test/integration/bee-debug-class.spec.ts +0 -85
  136. package/test/integration/chunk/bmt.spec.ts +0 -33
  137. package/test/integration/chunk/cac.spec.ts +0 -27
  138. package/test/integration/chunk/soc.spec.ts +0 -38
  139. package/test/integration/feed/index.spec.ts +0 -84
  140. package/test/integration/modules/bytes.spec.ts +0 -23
  141. package/test/integration/modules/bzz.spec.ts +0 -270
  142. package/test/integration/modules/chunk.spec.ts +0 -29
  143. package/test/integration/modules/debug/balance.spec.ts +0 -70
  144. package/test/integration/modules/debug/chequebook.spec.ts +0 -64
  145. package/test/integration/modules/debug/connectivity.spec.ts +0 -69
  146. package/test/integration/modules/debug/settlements.spec.ts +0 -34
  147. package/test/integration/modules/debug/states.spec.ts +0 -34
  148. package/test/integration/modules/debug/status.spec.ts +0 -65
  149. package/test/integration/modules/debug/tag.spec.ts +0 -27
  150. package/test/integration/modules/feed.spec.ts +0 -61
  151. package/test/integration/modules/pinning.spec.ts +0 -155
  152. package/test/integration/modules/pss.spec.ts +0 -92
  153. package/test/integration/modules/status.spec.ts +0 -10
  154. package/test/integration/modules/stewardship.spec.ts +0 -32
  155. package/test/integration/modules/tag.spec.ts +0 -51
  156. package/test/test-type-sequencer.js +0 -36
  157. package/test/testpage/testpage.html +0 -20
  158. package/test/unit/assertions.ts +0 -376
  159. package/test/unit/bee-class.spec.ts +0 -685
  160. package/test/unit/bee-debug-class.spec.ts +0 -365
  161. package/test/unit/chunk/bmt.spec.ts +0 -16
  162. package/test/unit/chunk/cac.spec.ts +0 -29
  163. package/test/unit/chunk/serialize.spec.ts +0 -24
  164. package/test/unit/chunk/signer.spec.ts +0 -140
  165. package/test/unit/chunk/soc.spec.ts +0 -25
  166. package/test/unit/chunk/span.spec.ts +0 -38
  167. package/test/unit/feed/json.spec.ts +0 -73
  168. package/test/unit/nock.ts +0 -134
  169. package/test/unit/utils/bytes.spec.ts +0 -32
  170. package/test/unit/utils/collection.spec.ts +0 -22
  171. package/test/unit/utils/eth.spec.ts +0 -224
  172. package/test/unit/utils/hex.spec.ts +0 -115
  173. package/test/unit/utils/hooks.spec.ts +0 -179
  174. package/test/unit/utils/safe-axios.spec.ts +0 -20
  175. package/test/unit/utils/type.spec.ts +0 -32
  176. package/test/unit/utils/uint64.spec.ts +0 -102
  177. package/test/utils.ts +0 -292
  178. package/tsconfig.json +0 -18
  179. package/tsconfig.test.json +0 -11
  180. package/typedoc.json +0 -7
  181. package/webpack.config.ts +0 -141
package/dist/src/bee.d.ts CHANGED
@@ -1,10 +1,7 @@
1
- /// <reference types="node" />
2
- import type { Readable } from 'stream';
3
- import { AxiosRequestConfig } from 'axios';
4
1
  import { FeedType } from './feed/type';
5
2
  import { EthAddress } from './utils/eth';
6
- import { AllTagsOptions, NumberString, PostageBatchOptions } from './types';
7
- import type { Tag, FileData, Reference, UploadOptions, PublicKey, AddressPrefix, PssMessageHandler, PssSubscription, CollectionUploadOptions, FileUploadOptions, Data, Signer, FeedReader, FeedWriter, SOCWriter, SOCReader, Topic, BeeOptions, JsonFeedOptions, AnyJson, Pin, PostageBatch, BatchId } from './types';
3
+ import { AllTagsOptions, Collection, Readable, RequestOptions, UploadResult } from './types';
4
+ import type { Tag, FileData, Reference, UploadOptions, PublicKey, AddressPrefix, PssMessageHandler, PssSubscription, CollectionUploadOptions, FileUploadOptions, Data, Signer, FeedReader, FeedWriter, SOCWriter, SOCReader, Topic, BeeOptions, JsonFeedOptions, AnyJson, Pin, BatchId } from './types';
8
5
  /**
9
6
  * The main component that abstracts operations available on the main Bee API.
10
7
  *
@@ -20,6 +17,11 @@ export declare class Bee {
20
17
  * Default Signer object used for signing operations, mainly Feeds.
21
18
  */
22
19
  readonly signer?: Signer;
20
+ /**
21
+ * Ky instance that defines connection to Bee node
22
+ * @private
23
+ */
24
+ private readonly ky;
23
25
  /**
24
26
  * @param url URL on which is the main API of Bee node exposed
25
27
  * @param options
@@ -30,30 +32,31 @@ export declare class Bee {
30
32
  *
31
33
  * @param postageBatchId Postage BatchId to be used to upload the data with
32
34
  * @param data Data to be uploaded
33
- * @param options Additional options like tag, encryption, pinning, content-type
35
+ * @param options Additional options like tag, encryption, pinning, content-type and request options
34
36
  *
35
37
  * @returns reference is a content hash of the data
36
38
  * @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
37
39
  * @see [Bee API reference - `POST /bytes`](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes/post)
38
40
  */
39
- uploadData(postageBatchId: string | BatchId, data: string | Uint8Array, options?: UploadOptions): Promise<Reference>;
41
+ uploadData(postageBatchId: string | BatchId, data: string | Uint8Array, options?: UploadOptions): Promise<UploadResult>;
40
42
  /**
41
43
  * Download data as a byte array
42
44
  *
43
45
  * @param reference Bee data reference
46
+ * @param options Options that affects the request behavior
44
47
  * @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
45
48
  * @see [Bee API reference - `GET /bytes`](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes~1{reference}/get)
46
49
  */
47
- downloadData(reference: Reference | string): Promise<Data>;
50
+ downloadData(reference: Reference | string, options?: RequestOptions): Promise<Data>;
48
51
  /**
49
52
  * Download data as a Readable stream
50
53
  *
51
54
  * @param reference Bee data reference
52
- * @param axiosOptions optional - alter default options of axios HTTP client
55
+ * @param options Options that affects the request behavior
53
56
  * @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
54
57
  * @see [Bee API reference - `GET /bytes`](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes~1{reference}/get)
55
58
  */
56
- downloadReadableData(reference: Reference | string, axiosOptions?: AxiosRequestConfig): Promise<Readable>;
59
+ downloadReadableData(reference: Reference | string, options?: RequestOptions): Promise<ReadableStream<Uint8Array>>;
57
60
  /**
58
61
  * Upload single file to a Bee node.
59
62
  *
@@ -63,72 +66,92 @@ export declare class Bee {
63
66
  * @param postageBatchId Postage BatchId to be used to upload the data with
64
67
  * @param data Data or file to be uploaded
65
68
  * @param name Optional name of the uploaded file
66
- * @param options Additional options like tag, encryption, pinning, content-type
69
+ * @param options Additional options like tag, encryption, pinning, content-type and request options
67
70
  *
68
71
  * @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
69
72
  * @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
70
73
  * @see [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/File/paths/~1bzz/post)
71
74
  * @returns reference is a content hash of the file
72
75
  */
73
- uploadFile(postageBatchId: string | BatchId, data: string | Uint8Array | Readable | File, name?: string, options?: FileUploadOptions): Promise<Reference>;
76
+ uploadFile(postageBatchId: string | BatchId, data: string | Uint8Array | Readable | File, name?: string, options?: FileUploadOptions): Promise<UploadResult>;
74
77
  /**
75
78
  * Download single file.
76
79
  *
77
80
  * @param reference Bee file reference
78
81
  * @param path If reference points to manifest, then this parameter defines path to the file
82
+ * @param options Options that affects the request behavior
79
83
  *
80
84
  * @see Data
81
85
  * @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
82
86
  * @see [Bee API reference - `GET /bzz`](https://docs.ethswarm.org/api/#tag/Collection/paths/~1bzz~1{reference}~1{path}/get)
83
87
  */
84
- downloadFile(reference: Reference | string, path?: string): Promise<FileData<Data>>;
88
+ downloadFile(reference: Reference | string, path?: string, options?: RequestOptions): Promise<FileData<Data>>;
85
89
  /**
86
90
  * Download single file as a readable stream
87
91
  *
88
92
  * @param reference Hash reference to file
89
93
  * @param path If reference points to manifest / collections, then this parameter defines path to the file
94
+ * @param options Options that affects the request behavior
90
95
  *
91
96
  * @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
92
97
  * @see [Bee API reference - `GET /bzz`](https://docs.ethswarm.org/api/#tag/Collection/paths/~1bzz~1{reference}~1{path}/get)
93
98
  */
94
- downloadReadableFile(reference: Reference | string, path?: string): Promise<FileData<Readable>>;
99
+ downloadReadableFile(reference: Reference | string, path?: string, options?: RequestOptions): Promise<FileData<ReadableStream<Uint8Array>>>;
95
100
  /**
96
101
  * Upload collection of files to a Bee node
97
102
  *
98
103
  * Uses the FileList API from the browser.
99
104
  *
105
+ * The returned `UploadResult.tag` might be undefined if called in CORS-enabled environment.
106
+ * This will be fixed upon next Bee release. https://github.com/ethersphere/bee-js/issues/406
107
+ *
100
108
  * @param postageBatchId Postage BatchId to be used to upload the data with
101
109
  * @param fileList list of files to be uploaded
102
- * @param options Additional options like tag, encryption, pinning
110
+ * @param options Additional options like tag, encryption, pinning and request options
103
111
  *
104
112
  * @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
105
113
  * @see [Bee docs - Upload directory](https://docs.ethswarm.org/docs/access-the-swarm/upload-a-directory/)
106
114
  * @see [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/Collection/paths/~1bzz/post)
107
115
  */
108
- uploadFiles(postageBatchId: string | BatchId, fileList: FileList | File[], options?: CollectionUploadOptions): Promise<Reference>;
116
+ uploadFiles(postageBatchId: string | BatchId, fileList: FileList | File[], options?: CollectionUploadOptions): Promise<UploadResult>;
117
+ /**
118
+ * Upload Collection that you can assembly yourself.
119
+ *
120
+ * The returned `UploadResult.tag` might be undefined if called in CORS-enabled environment.
121
+ * This will be fixed upon next Bee release. https://github.com/ethersphere/bee-js/issues/406
122
+ *
123
+ * @param postageBatchId
124
+ * @param collection
125
+ * @param options Collections and request options
126
+ */
127
+ uploadCollection(postageBatchId: string | BatchId, collection: Collection<Uint8Array | Readable>, options?: CollectionUploadOptions): Promise<UploadResult>;
109
128
  /**
110
129
  * Upload collection of files.
111
130
  *
112
131
  * Available only in Node.js as it uses the `fs` module.
113
132
  *
133
+ * The returned `UploadResult.tag` might be undefined if called in CORS-enabled environment.
134
+ * This will be fixed upon next Bee release. https://github.com/ethersphere/bee-js/issues/406
135
+ *
114
136
  * @param postageBatchId Postage BatchId to be used to upload the data with
115
137
  * @param dir the path of the files to be uploaded
116
- * @param options Additional options like tag, encryption, pinning
138
+ * @param options Additional options like tag, encryption, pinning and request options
117
139
  *
118
140
  * @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
119
141
  * @see [Bee docs - Upload directory](https://docs.ethswarm.org/docs/access-the-swarm/upload-a-directory/)
120
142
  * @see [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/Collection/paths/~1bzz/post)
121
143
  */
122
- uploadFilesFromDirectory(postageBatchId: string | BatchId, dir: string, options?: CollectionUploadOptions): Promise<Reference>;
144
+ uploadFilesFromDirectory(postageBatchId: string | BatchId, dir: string, options?: CollectionUploadOptions): Promise<UploadResult>;
123
145
  /**
124
146
  * Create a new Tag which is meant for tracking progres of syncing data across network.
125
147
  *
126
148
  * **Warning! Not allowed when node is in Gateway mode!**
127
149
  *
150
+ * @param options Options that affects the request behavior
128
151
  * @see [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/access-the-swarm/syncing)
129
152
  * @see [Bee API reference - `POST /tags`](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags/post)
130
153
  */
131
- createTag(): Promise<Tag>;
154
+ createTag(options?: RequestOptions): Promise<Tag>;
132
155
  /**
133
156
  * Fetches all tags.
134
157
  *
@@ -136,7 +159,7 @@ export declare class Bee {
136
159
  *
137
160
  * **Warning! Not allowed when node is in Gateway mode!**
138
161
  *
139
- * @param options
162
+ * @param options Options that affects the request behavior
140
163
  * @throws TypeError if limit or offset are not numbers or undefined
141
164
  * @throws BeeArgumentError if limit or offset have invalid options
142
165
  *
@@ -150,26 +173,28 @@ export declare class Bee {
150
173
  * **Warning! Not allowed when node is in Gateway mode!**
151
174
  *
152
175
  * @param tagUid UID or tag object to be retrieved
176
+ * @param options Options that affects the request behavior
153
177
  * @throws TypeError if tagUid is in not correct format
154
178
  *
155
179
  * @see [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/access-the-swarm/syncing)
156
180
  * @see [Bee API reference - `GET /tags/{uid}`](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1{uid}/get)
157
181
  *
158
182
  */
159
- retrieveTag(tagUid: number | Tag): Promise<Tag>;
183
+ retrieveTag(tagUid: number | Tag, options?: RequestOptions): Promise<Tag>;
160
184
  /**
161
185
  * Delete Tag
162
186
  *
163
187
  * **Warning! Not allowed when node is in Gateway mode!**
164
188
  *
165
189
  * @param tagUid UID or tag object to be retrieved
190
+ * @param options Options that affects the request behavior
166
191
  * @throws TypeError if tagUid is in not correct format
167
192
  * @throws BeeResponse error if something went wrong on the Bee node side while deleting the tag.
168
193
  *
169
194
  * @see [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/access-the-swarm/syncing)
170
195
  * @see [Bee API reference - `DELETE /tags/{uid}`](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1{uid}/delete)
171
196
  */
172
- deleteTag(tagUid: number | Tag): Promise<void>;
197
+ deleteTag(tagUid: number | Tag, options?: RequestOptions): Promise<void>;
173
198
  /**
174
199
  * Update tag's total chunks count.
175
200
  *
@@ -180,63 +205,79 @@ export declare class Bee {
180
205
  *
181
206
  * @param tagUid UID or tag object to be retrieved
182
207
  * @param reference The root reference that contains all the chunks to be counted
208
+ * @param options Options that affects the request behavior
183
209
  * @throws TypeError if tagUid is in not correct format
184
210
  * @throws BeeResponse error if something went wrong on the Bee node side while deleting the tag.
185
211
  *
186
212
  * @see [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/access-the-swarm/syncing)
187
213
  * @see [Bee API reference - `PATCH /tags/{uid}`](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1{uid}/patch)
188
214
  */
189
- updateTag(tagUid: number | Tag, reference: Reference | string): Promise<void>;
215
+ updateTag(tagUid: number | Tag, reference: Reference | string, options?: RequestOptions): Promise<void>;
190
216
  /**
191
217
  * Pin local data with given reference
192
218
  *
193
219
  * **Warning! Not allowed when node is in Gateway mode!**
194
220
  *
195
221
  * @param reference Data reference
222
+ * @param options Options that affects the request behavior
196
223
  * @throws TypeError if reference is in not correct format
197
224
  *
198
225
  * @see [Bee docs - Pinning](https://docs.ethswarm.org/docs/access-the-swarm/pinning)
199
226
  */
200
- pin(reference: Reference | string): Promise<void>;
227
+ pin(reference: Reference | string, options?: RequestOptions): Promise<void>;
201
228
  /**
202
229
  * Unpin local data with given reference
203
230
  *
204
231
  * **Warning! Not allowed when node is in Gateway mode!**
205
232
  *
206
233
  * @param reference Data reference
234
+ * @param options Options that affects the request behavior
207
235
  * @throws TypeError if reference is in not correct format
208
236
  *
209
237
  * @see [Bee docs - Pinning](https://docs.ethswarm.org/docs/access-the-swarm/pinning)
210
238
  */
211
- unpin(reference: Reference | string): Promise<void>;
239
+ unpin(reference: Reference | string, options?: RequestOptions): Promise<void>;
212
240
  /**
213
241
  * Get list of all locally pinned references
214
242
  *
215
243
  * **Warning! Not allowed when node is in Gateway mode!**
216
244
  *
245
+ * @param options Options that affects the request behavior
217
246
  * @see [Bee docs - Pinning](https://docs.ethswarm.org/docs/access-the-swarm/pinning)
218
247
  */
219
- getAllPins(): Promise<Reference[]>;
248
+ getAllPins(options?: RequestOptions): Promise<Reference[]>;
220
249
  /**
221
250
  * Get pinning status of chunk with given reference
222
251
  *
223
252
  * **Warning! Not allowed when node is in Gateway mode!**
224
253
  *
225
254
  * @param reference Bee data reference
255
+ * @param options Options that affects the request behavior
226
256
  * @throws TypeError if reference is in not correct format
227
257
  *
228
258
  * @see [Bee docs - Pinning](https://docs.ethswarm.org/docs/access-the-swarm/pinning)
229
259
  */
230
- getPin(reference: Reference | string): Promise<Pin>;
260
+ getPin(reference: Reference | string, options?: RequestOptions): Promise<Pin>;
231
261
  /**
232
262
  * Instructs the Bee node to reupload a locally pinned data into the network.
233
263
  *
234
264
  * @param reference
235
- * @param axiosOptions
265
+ * @param options Options that affects the request behavior
236
266
  * @throws BeeArgumentError if the reference is not locally pinned
237
267
  * @throws TypeError if reference is in not correct format
268
+ *
269
+ * @see [Bee API reference - `PUT /stewardship`](https://docs.ethswarm.org/api/#tag/Stewardship/paths/~1stewardship~1{reference}/put)
270
+ */
271
+ reuploadPinnedData(reference: Reference | string, options?: RequestOptions): Promise<void>;
272
+ /**
273
+ * Checks if content specified by reference is retrievable from the network.
274
+ *
275
+ * @param reference The checked content
276
+ * @param options Options that affects the request behavior
277
+ *
278
+ * @see [Bee API reference - `GET /stewardship`](https://docs.ethswarm.org/api/#tag/Stewardship/paths/~1stewardship~1{reference}/get)
238
279
  */
239
- reuploadPinnedData(reference: Reference | string, axiosOptions?: AxiosRequestConfig): Promise<void>;
280
+ isReferenceRetrievable(reference: Reference | string, options?: RequestOptions): Promise<boolean>;
240
281
  /**
241
282
  * Send data to recipient or target with Postal Service for Swarm.
242
283
  *
@@ -252,15 +293,16 @@ export declare class Bee {
252
293
  *
253
294
  * @param postageBatchId Postage BatchId that will be assigned to sent message
254
295
  * @param topic Topic name
255
- * @param target Target message address prefix
296
+ * @param target Target message address prefix. Has a limit on length. Recommend to use `Utils.Pss.makeMaxTarget()` to get the most specific target that Bee node will accept.
256
297
  * @param data Message to be sent
257
298
  * @param recipient Recipient public key
299
+ * @param options Options that affects the request behavior
258
300
  * @throws TypeError if `data`, `batchId`, `target` or `recipient` are in invalid format
259
301
  *
260
302
  * @see [Bee docs - PSS](https://docs.ethswarm.org/docs/dapps-on-swarm/pss)
261
303
  * @see [Bee API reference - `POST /pss`](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1send~1{topic}~1{targets}/post)
262
304
  */
263
- pssSend(postageBatchId: string | BatchId, topic: string, target: AddressPrefix, data: string | Uint8Array, recipient?: string | PublicKey): Promise<void>;
305
+ pssSend(postageBatchId: string | BatchId, topic: string, target: AddressPrefix, data: string | Uint8Array, recipient?: string | PublicKey, options?: RequestOptions): Promise<void>;
264
306
  /**
265
307
  * Subscribe to messages for given topic with Postal Service for Swarm
266
308
  *
@@ -314,31 +356,34 @@ export declare class Bee {
314
356
  * @param type The type of the feed, can be 'epoch' or 'sequence'
315
357
  * @param topic Topic in hex or bytes
316
358
  * @param owner Owner's ethereum address in hex or bytes
359
+ * @param options Options that affects the request behavior
317
360
  *
318
361
  * @see [Bee docs - Feeds](https://docs.ethswarm.org/docs/dapps-on-swarm/feeds)
319
362
  * @see [Bee API reference - `POST /feeds`](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1{owner}~1{topic}/post)
320
363
  */
321
- createFeedManifest(postageBatchId: string | BatchId, type: FeedType, topic: Topic | Uint8Array | string, owner: EthAddress | Uint8Array | string): Promise<Reference>;
364
+ createFeedManifest(postageBatchId: string | BatchId, type: FeedType, topic: Topic | Uint8Array | string, owner: EthAddress | Uint8Array | string, options?: RequestOptions): Promise<Reference>;
322
365
  /**
323
366
  * Make a new feed reader for downloading feed updates.
324
367
  *
325
368
  * @param type The type of the feed, can be 'epoch' or 'sequence'
326
369
  * @param topic Topic in hex or bytes
327
370
  * @param owner Owner's ethereum address in hex or bytes
371
+ * @param options Options that affects the request behavior
328
372
  *
329
373
  * @see [Bee docs - Feeds](https://docs.ethswarm.org/docs/dapps-on-swarm/feeds)
330
374
  */
331
- makeFeedReader(type: FeedType, topic: Topic | Uint8Array | string, owner: EthAddress | Uint8Array | string): FeedReader;
375
+ makeFeedReader(type: FeedType, topic: Topic | Uint8Array | string, owner: EthAddress | Uint8Array | string, options?: RequestOptions): FeedReader;
332
376
  /**
333
377
  * Make a new feed writer for updating feeds
334
378
  *
335
379
  * @param type The type of the feed, can be 'epoch' or 'sequence'
336
380
  * @param topic Topic in hex or bytes
337
381
  * @param signer The signer's private key or a Signer instance that can sign data
382
+ * @param options Options that affects the request behavior
338
383
  *
339
384
  * @see [Bee docs - Feeds](https://docs.ethswarm.org/docs/dapps-on-swarm/feeds)
340
385
  */
341
- makeFeedWriter(type: FeedType, topic: Topic | Uint8Array | string, signer?: Signer | Uint8Array | string): FeedWriter;
386
+ makeFeedWriter(type: FeedType, topic: Topic | Uint8Array | string, signer?: Signer | Uint8Array | string, options?: RequestOptions): FeedWriter;
342
387
  /**
343
388
  * High-level function that allows you to easily set JSON data to feed.
344
389
  * JSON-like data types are supported.
@@ -391,76 +436,37 @@ export declare class Bee {
391
436
  * Returns an object for reading single owner chunks
392
437
  *
393
438
  * @param ownerAddress The ethereum address of the owner
394
- *
439
+ * @param options Options that affects the request behavior
395
440
  * @see [Bee docs - Chunk Types](https://docs.ethswarm.org/docs/dapps-on-swarm/chunk-types#single-owner-chunks)
396
441
  */
397
- makeSOCReader(ownerAddress: EthAddress | Uint8Array | string): SOCReader;
442
+ makeSOCReader(ownerAddress: EthAddress | Uint8Array | string, options?: RequestOptions): SOCReader;
398
443
  /**
399
444
  * Returns an object for reading and writing single owner chunks
400
445
  *
401
446
  * @param signer The signer's private key or a Signer instance that can sign data
402
- *
447
+ * @param options Options that affects the request behavior
403
448
  * @see [Bee docs - Chunk Types](https://docs.ethswarm.org/docs/dapps-on-swarm/chunk-types#single-owner-chunks)
404
449
  */
405
- makeSOCWriter(signer?: Signer | Uint8Array | string): SOCWriter;
406
- /**
407
- * Creates new postage batch from the funds that the node has available in its Ethereum account.
408
- *
409
- * For better understanding what each parameter means and what are the optimal values please see
410
- * [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive).
411
- *
412
- * **WARNING: THIS CREATES TRANSACTIONS THAT SPENDS MONEY**
413
- * **Warning! Not allowed when node is in Gateway mode!**
414
- *
415
- * @param amount Amount that represents the value per chunk, has to be greater or equal zero.
416
- * @param depth Logarithm of the number of chunks that can be stamped with the batch.
417
- * @param options Options for creation of postage batch
418
- * @throws BeeArgumentError when negative amount or depth is specified
419
- * @throws TypeError if non-integer value is passed to amount or depth
420
- *
421
- * @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
422
- * @see [Bee API reference - `POST /stamps`](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1{amount}~1{depth}/post)
423
- * @deprecated Use DebugBee for postage batch management
424
- */
425
- createPostageBatch(amount: NumberString, depth: number, options?: PostageBatchOptions): Promise<BatchId>;
426
- /**
427
- * Return details for specific postage batch.
428
- *
429
- * **Warning! Not allowed when node is in Gateway mode!**
430
- *
431
- * @param postageBatchId Batch ID
432
- *
433
- * @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
434
- * @see [Bee API reference - `GET /stamps/${id}`](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1{id}/get)
435
- * @deprecated Use DebugBee for postage batch management
436
- */
437
- getPostageBatch(postageBatchId: BatchId | string): Promise<PostageBatch>;
438
- /**
439
- * Return all postage batches that has the node available.
440
- *
441
- * **Warning! Not allowed when node is in Gateway mode!**
442
- *
443
- * @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
444
- * @see [Bee API reference - `GET /stamps`](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps/get)
445
- * @deprecated Use DebugBee for postage batch management
446
- */
447
- getAllPostageBatch(): Promise<PostageBatch[]>;
450
+ makeSOCWriter(signer?: Signer | Uint8Array | string, options?: RequestOptions): SOCWriter;
448
451
  /**
449
452
  * Ping the Bee node to see if there is a live Bee node on the given URL.
450
453
  *
454
+ * @param options Options that affects the request behavior
451
455
  * @throws If connection was not successful throw error
452
456
  */
453
- checkConnection(): Promise<void> | never;
457
+ checkConnection(options?: RequestOptions): Promise<void> | never;
454
458
  /**
455
459
  * Ping the Bee node to see if there is a live Bee node on the given URL.
456
460
  *
461
+ * @param options Options that affects the request behavior
457
462
  * @returns true if successful, false on error
458
463
  */
459
- isConnected(): Promise<boolean>;
464
+ isConnected(options?: RequestOptions): Promise<boolean>;
460
465
  /**
461
466
  * @param signer
462
467
  * @private
463
468
  * @throws BeeError if either no Signer was passed or no default Signer was specified for the instance
464
469
  */
465
470
  private resolveSigner;
471
+ private getKy;
466
472
  }
@@ -1,6 +1,6 @@
1
1
  import { Bytes } from '../utils/bytes';
2
2
  import { Chunk, ChunkAddress } from './cac';
3
- import { UploadOptions, Signature, Signer, BatchId, Reference } from '../types';
3
+ import { UploadOptions, Signature, Signer, BatchId, Reference, Ky } from '../types';
4
4
  import { EthAddress } from '../utils/eth';
5
5
  export declare type Identifier = Bytes<32>;
6
6
  /**
@@ -39,23 +39,23 @@ export declare function makeSingleOwnerChunk(chunk: Chunk, identifier: Identifie
39
39
  *
40
40
  * It uses the Chunk API and calculates the address before uploading.
41
41
  *
42
- * @param url The url of the Bee service
42
+ * @param ky Ky instance
43
43
  * @param chunk A chunk object
44
44
  * @param postageBatchId Postage BatchId that will be assigned to uploaded data
45
45
  * @param options Upload options
46
46
  */
47
- export declare function uploadSingleOwnerChunk(url: string, chunk: SingleOwnerChunk, postageBatchId: BatchId, options?: UploadOptions): Promise<Reference>;
47
+ export declare function uploadSingleOwnerChunk(ky: Ky, chunk: SingleOwnerChunk, postageBatchId: BatchId, options?: UploadOptions): Promise<Reference>;
48
48
  /**
49
49
  * Helper function to create and upload SOC.
50
50
  *
51
- * @param url The url of the Bee service
51
+ * @param ky Ky instance
52
52
  * @param signer The singer interface for signing the chunk
53
53
  * @param postageBatchId
54
54
  * @param identifier The identifier of the chunk
55
55
  * @param data The chunk data
56
56
  * @param options
57
57
  */
58
- export declare function uploadSingleOwnerChunkData(url: string, signer: Signer, postageBatchId: BatchId | string, identifier: Identifier, data: Uint8Array, options?: UploadOptions): Promise<Reference>;
58
+ export declare function uploadSingleOwnerChunkData(ky: Ky, signer: Signer, postageBatchId: BatchId | string, identifier: Identifier, data: Uint8Array, options?: UploadOptions): Promise<Reference>;
59
59
  /**
60
60
  * Helper function to download SOC.
61
61
  *
@@ -63,4 +63,4 @@ export declare function uploadSingleOwnerChunkData(url: string, signer: Signer,
63
63
  * @param ownerAddress The singer interface for signing the chunk
64
64
  * @param identifier The identifier of the chunk
65
65
  */
66
- export declare function downloadSingleOwnerChunk(url: string, ownerAddress: EthAddress, identifier: Identifier): Promise<SingleOwnerChunk>;
66
+ export declare function downloadSingleOwnerChunk(ky: Ky, ownerAddress: EthAddress, identifier: Identifier): Promise<SingleOwnerChunk>;
@@ -1,6 +1,6 @@
1
1
  import { Identifier } from '../chunk/soc';
2
2
  import { FeedUpdateOptions } from '../modules/feed';
3
- import { Reference, UploadOptions, Signer, FeedReader, FeedWriter, Topic, BatchId } from '../types';
3
+ import { Reference, UploadOptions, Signer, FeedReader, FeedWriter, Topic, BatchId, Ky } from '../types';
4
4
  import { Bytes } from '../utils/bytes';
5
5
  import { HexString } from '../utils/hex';
6
6
  import { EthAddress, HexEthAddress } from '../utils/eth';
@@ -25,11 +25,11 @@ export declare function isEpoch(epoch: unknown): epoch is Epoch;
25
25
  export declare function makeSequentialFeedIdentifier(topic: Topic, index: number): Identifier;
26
26
  export declare function makeFeedIndexBytes(s: string): IndexBytes;
27
27
  export declare function makeFeedIdentifier(topic: Topic, index: Index): Identifier;
28
- export declare function uploadFeedUpdate(url: string, signer: Signer, topic: Topic, index: Index, reference: ChunkReference, postageBatchId: BatchId, options?: FeedUploadOptions): Promise<Reference>;
29
- export declare function findNextIndex(url: string, owner: HexEthAddress, topic: Topic, options?: FeedUpdateOptions): Promise<HexString<typeof INDEX_HEX_LENGTH>>;
30
- export declare function updateFeed(url: string, signer: Signer, topic: Topic, reference: ChunkReference, postageBatchId: BatchId, options?: FeedUploadOptions): Promise<Reference>;
28
+ export declare function uploadFeedUpdate(ky: Ky, signer: Signer, topic: Topic, index: Index, reference: ChunkReference, postageBatchId: BatchId, options?: FeedUploadOptions): Promise<Reference>;
29
+ export declare function findNextIndex(ky: Ky, owner: HexEthAddress, topic: Topic, options?: FeedUpdateOptions): Promise<HexString<typeof INDEX_HEX_LENGTH>>;
30
+ export declare function updateFeed(ky: Ky, signer: Signer, topic: Topic, reference: ChunkReference, postageBatchId: BatchId, options?: FeedUploadOptions): Promise<Reference>;
31
31
  export declare function verifyChunkReference(data: Uint8Array): ChunkReference;
32
- export declare function downloadFeedUpdate(url: string, owner: EthAddress, topic: Topic, index: Index): Promise<FeedUpdate>;
33
- export declare function makeFeedReader(url: string, type: FeedType, topic: Topic, owner: HexEthAddress): FeedReader;
34
- export declare function makeFeedWriter(url: string, type: FeedType, topic: Topic, signer: Signer): FeedWriter;
32
+ export declare function downloadFeedUpdate(ky: Ky, owner: EthAddress, topic: Topic, index: Index): Promise<FeedUpdate>;
33
+ export declare function makeFeedReader(ky: Ky, type: FeedType, topic: Topic, owner: HexEthAddress): FeedReader;
34
+ export declare function makeFeedWriter(ky: Ky, type: FeedType, topic: Topic, signer: Signer): FeedWriter;
35
35
  export {};
@@ -1,4 +1,4 @@
1
- import { FeedWriter, FeedReader, AnyJson, BatchId, Reference } from '../types';
1
+ import { FeedWriter, FeedReader, AnyJson, BatchId, Reference, RequestOptions } from '../types';
2
2
  import { Bee } from '../bee';
3
3
  export declare function getJsonData<T extends AnyJson>(bee: Bee, reader: FeedReader): Promise<T>;
4
- export declare function setJsonData(bee: Bee, writer: FeedWriter, postageBatchId: BatchId, data: AnyJson): Promise<Reference>;
4
+ export declare function setJsonData(bee: Bee, writer: FeedWriter, postageBatchId: BatchId, data: AnyJson, options?: RequestOptions): Promise<Reference>;
@@ -1,28 +1,25 @@
1
- /// <reference types="node" />
2
- import type { AxiosRequestConfig } from 'axios';
3
- import type { Readable } from 'stream';
4
- import { BatchId, Data, Reference, UploadOptions } from '../types';
1
+ import type { BatchId, Data, Ky, Reference, UploadOptions } from '../types';
2
+ import { UploadResult } from '../types';
5
3
  /**
6
4
  * Upload data to a Bee node
7
5
  *
8
- * @param url Bee URL
6
+ * @param ky Ky instance
9
7
  * @param data Data to be uploaded
10
8
  * @param postageBatchId Postage BatchId that will be assigned to uploaded data
11
9
  * @param options Additional options like tag, encryption, pinning
12
10
  */
13
- export declare function upload(url: string, data: string | Uint8Array, postageBatchId: BatchId, options?: UploadOptions): Promise<Reference>;
11
+ export declare function upload(ky: Ky, data: string | Uint8Array, postageBatchId: BatchId, options?: UploadOptions): Promise<UploadResult>;
14
12
  /**
15
13
  * Download data as a byte array
16
14
  *
17
- * @param url Bee URL
15
+ * @param ky
18
16
  * @param hash Bee content reference
19
17
  */
20
- export declare function download(url: string, hash: Reference): Promise<Data>;
18
+ export declare function download(ky: Ky, hash: Reference): Promise<Data>;
21
19
  /**
22
20
  * Download data as a readable stream
23
21
  *
24
- * @param url Bee URL
22
+ * @param ky
25
23
  * @param hash Bee content reference
26
- * @param axiosOptions optional - alter default options of axios HTTP client
27
24
  */
28
- export declare function downloadReadable(url: string, hash: Reference, axiosOptions?: AxiosRequestConfig): Promise<Readable>;
25
+ export declare function downloadReadable(ky: Ky, hash: Reference): Promise<ReadableStream<Uint8Array>>;
@@ -1,40 +1,35 @@
1
- /// <reference types="node" />
2
- import { BatchId, Collection, CollectionUploadOptions, Data, FileData, FileUploadOptions, Reference } from '../types';
3
- import { AxiosRequestConfig } from 'axios';
4
- import { Readable } from 'stream';
1
+ import { BatchId, Collection, CollectionUploadOptions, Data, FileData, FileUploadOptions, Ky, Readable, UploadResult } from '../types';
5
2
  /**
6
3
  * Upload single file
7
4
  *
8
- * @param url Bee URL
5
+ * @param ky
9
6
  * @param data Files data
10
7
  * @param postageBatchId Postage BatchId that will be assigned to uploaded data
11
8
  * @param name Name that will be attached to the uploaded file. Wraps the data into manifest with set index document.
12
9
  * @param options
13
10
  */
14
- export declare function uploadFile(url: string, data: string | Uint8Array | Readable | ArrayBuffer, postageBatchId: BatchId, name?: string, options?: FileUploadOptions): Promise<Reference>;
11
+ export declare function uploadFile(ky: Ky, data: string | Uint8Array | Readable | ArrayBuffer, postageBatchId: BatchId, name?: string, options?: FileUploadOptions): Promise<UploadResult>;
15
12
  /**
16
13
  * Download single file as a buffer
17
14
  *
18
- * @param url Bee URL
15
+ * @param ky Ky instance for given Bee class instance
19
16
  * @param hash Bee file or collection hash
20
17
  * @param path If hash is collection then this defines path to a single file in the collection
21
- * @param axiosOptions optional - alter default options of axios HTTP client
22
18
  */
23
- export declare function downloadFile(url: string, hash: string, path?: string, axiosOptions?: AxiosRequestConfig): Promise<FileData<Data>>;
19
+ export declare function downloadFile(ky: Ky, hash: string, path?: string): Promise<FileData<Data>>;
24
20
  /**
25
21
  * Download single file as a readable stream
26
22
  *
27
- * @param url Bee URL
23
+ * @param ky Ky instance for given Bee class instance
28
24
  * @param hash Bee file or collection hash
29
25
  * @param path If hash is collection then this defines path to a single file in the collection
30
- * @param axiosOptions optional - alter default options of axios HTTP client
31
26
  */
32
- export declare function downloadFileReadable(url: string, hash: string, path?: string, axiosOptions?: AxiosRequestConfig): Promise<FileData<Readable>>;
27
+ export declare function downloadFileReadable(ky: Ky, hash: string, path?: string): Promise<FileData<ReadableStream<Uint8Array>>>;
33
28
  /**
34
29
  * Upload collection
35
- * @param url Bee URL
30
+ * @param ky Ky instance for given Bee class instance
36
31
  * @param collection Collection of Uint8Array buffers to upload
37
32
  * @param postageBatchId Postage BatchId that will be assigned to uploaded data
38
33
  * @param options
39
34
  */
40
- export declare function uploadCollection(url: string, collection: Collection<Uint8Array>, postageBatchId: BatchId, options?: CollectionUploadOptions): Promise<Reference>;
35
+ export declare function uploadCollection(ky: Ky, collection: Collection<Uint8Array>, postageBatchId: BatchId, options?: CollectionUploadOptions): Promise<UploadResult>;
@@ -1,7 +1,4 @@
1
- /// <reference types="node" />
2
- import type { AxiosRequestConfig } from 'axios';
3
- import type { Readable } from 'stream';
4
- import type { BatchId, UploadOptions } from '../types';
1
+ import type { BatchId, Ky, UploadOptions } from '../types';
5
2
  import { Reference } from '../types';
6
3
  /**
7
4
  * Upload chunk to a Bee node
@@ -10,25 +7,24 @@ import { Reference } from '../types';
10
7
  * The span stores the length of the payload in uint64 little endian encoding.
11
8
  * Upload expects the chuck data to be set accordingly.
12
9
  *
13
- * @param url Bee URL
10
+ * @param ky Ky instance
14
11
  * @param data Chunk data to be uploaded
15
12
  * @param postageBatchId Postage BatchId that will be assigned to uploaded data
16
13
  * @param options Additional options like tag, encryption, pinning
17
14
  */
18
- export declare function upload(url: string, data: Uint8Array, postageBatchId: BatchId, options?: UploadOptions): Promise<Reference>;
15
+ export declare function upload(ky: Ky, data: Uint8Array, postageBatchId: BatchId, options?: UploadOptions): Promise<Reference>;
19
16
  /**
20
17
  * Download chunk data as a byte array
21
18
  *
22
- * @param url Bee URL
19
+ * @param ky Ky instance for given Bee class instance
23
20
  * @param hash Bee content reference
24
21
  *
25
22
  */
26
- export declare function download(url: string, hash: string): Promise<Uint8Array>;
23
+ export declare function download(ky: Ky, hash: string): Promise<Uint8Array>;
27
24
  /**
28
25
  * Download chunk data as a readable stream
29
26
  *
30
- * @param url Bee URL
27
+ * @param ky Ky instance for given Bee class instance
31
28
  * @param hash Bee content reference
32
- * @param axiosOptions optional - alter default options of axios HTTP client
33
29
  */
34
- export declare function downloadReadable(url: string, hash: string, axiosOptions: AxiosRequestConfig): Promise<Readable>;
30
+ export declare function downloadReadable(ky: Ky, hash: string): Promise<ReadableStream<Uint8Array>>;