@ethersphere/bee-js 5.1.1 → 5.1.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.
Files changed (151) hide show
  1. package/README.md +14 -6
  2. package/dist/223.index.browser.min.js +3 -0
  3. package/dist/223.index.browser.min.js.LICENSE.txt +1 -0
  4. package/dist/223.index.browser.min.js.map +1 -0
  5. package/dist/cjs/bee-debug.js +208 -312
  6. package/dist/cjs/bee.js +258 -353
  7. package/dist/cjs/chunk/signer.js +11 -22
  8. package/dist/cjs/chunk/soc.js +33 -50
  9. package/dist/cjs/chunk/span.js +1 -1
  10. package/dist/cjs/feed/index.js +50 -65
  11. package/dist/cjs/feed/json.js +8 -21
  12. package/dist/cjs/feed/retrievable.js +14 -27
  13. package/dist/cjs/modules/bytes.js +25 -37
  14. package/dist/cjs/modules/bzz.js +63 -68
  15. package/dist/cjs/modules/chunk.js +17 -27
  16. package/dist/cjs/modules/debug/balance.js +24 -41
  17. package/dist/cjs/modules/debug/chequebook.js +71 -96
  18. package/dist/cjs/modules/debug/chunk.js +13 -26
  19. package/dist/cjs/modules/debug/connectivity.js +32 -53
  20. package/dist/cjs/modules/debug/settlements.js +12 -25
  21. package/dist/cjs/modules/debug/stake.js +20 -33
  22. package/dist/cjs/modules/debug/stamps.js +45 -66
  23. package/dist/cjs/modules/debug/states.js +27 -40
  24. package/dist/cjs/modules/debug/status.js +53 -80
  25. package/dist/cjs/modules/debug/tag.js +6 -17
  26. package/dist/cjs/modules/debug/transactions.js +23 -40
  27. package/dist/cjs/modules/feed.js +17 -27
  28. package/dist/cjs/modules/pinning.js +24 -41
  29. package/dist/cjs/modules/pss.js +9 -20
  30. package/dist/cjs/modules/soc.js +12 -20
  31. package/dist/cjs/modules/status.js +4 -15
  32. package/dist/cjs/modules/stewardship.js +10 -23
  33. package/dist/cjs/modules/tag.js +28 -47
  34. package/dist/cjs/utils/collection.browser.js +4 -17
  35. package/dist/cjs/utils/collection.js +11 -22
  36. package/dist/cjs/utils/collection.node.js +42 -86
  37. package/dist/cjs/utils/data.browser.js +46 -59
  38. package/dist/cjs/utils/data.js +22 -35
  39. package/dist/cjs/utils/eth.js +31 -43
  40. package/dist/cjs/utils/file.js +9 -20
  41. package/dist/cjs/utils/headers.js +4 -4
  42. package/dist/cjs/utils/http.js +78 -93
  43. package/dist/cjs/utils/merge.js +1 -1
  44. package/dist/cjs/utils/sleep.js +2 -13
  45. package/dist/cjs/utils/type.js +14 -12
  46. package/dist/index.browser.min.js +1 -1
  47. package/dist/index.browser.min.js.LICENSE.txt +1 -3
  48. package/dist/index.browser.min.js.map +1 -1
  49. package/dist/mjs/bee-debug.js +209 -450
  50. package/dist/mjs/bee.js +256 -491
  51. package/dist/mjs/chunk/bmt.js +4 -10
  52. package/dist/mjs/chunk/cac.js +0 -3
  53. package/dist/mjs/chunk/signer.js +12 -63
  54. package/dist/mjs/chunk/soc.js +33 -85
  55. package/dist/mjs/chunk/span.js +3 -6
  56. package/dist/mjs/feed/identifier.js +0 -6
  57. package/dist/mjs/feed/index.js +53 -97
  58. package/dist/mjs/feed/json.js +10 -49
  59. package/dist/mjs/feed/retrievable.js +13 -64
  60. package/dist/mjs/feed/topic.js +0 -2
  61. package/dist/mjs/index.js +1 -2
  62. package/dist/mjs/modules/bytes.js +25 -65
  63. package/dist/mjs/modules/bzz.js +64 -108
  64. package/dist/mjs/modules/chunk.js +17 -54
  65. package/dist/mjs/modules/debug/balance.js +24 -68
  66. package/dist/mjs/modules/debug/chequebook.js +75 -138
  67. package/dist/mjs/modules/debug/chunk.js +13 -51
  68. package/dist/mjs/modules/debug/connectivity.js +32 -76
  69. package/dist/mjs/modules/debug/settlements.js +12 -50
  70. package/dist/mjs/modules/debug/stake.js +20 -61
  71. package/dist/mjs/modules/debug/stamps.js +47 -94
  72. package/dist/mjs/modules/debug/states.js +25 -66
  73. package/dist/mjs/modules/debug/status.js +66 -125
  74. package/dist/mjs/modules/debug/tag.js +6 -41
  75. package/dist/mjs/modules/debug/transactions.js +25 -69
  76. package/dist/mjs/modules/feed.js +17 -57
  77. package/dist/mjs/modules/pinning.js +24 -68
  78. package/dist/mjs/modules/pss.js +11 -47
  79. package/dist/mjs/modules/soc.js +14 -48
  80. package/dist/mjs/modules/status.js +4 -39
  81. package/dist/mjs/modules/stewardship.js +10 -47
  82. package/dist/mjs/modules/tag.js +31 -78
  83. package/dist/mjs/types/debug.js +0 -1
  84. package/dist/mjs/types/index.js +0 -4
  85. package/dist/mjs/utils/bytes.js +6 -14
  86. package/dist/mjs/utils/collection.browser.js +4 -42
  87. package/dist/mjs/utils/collection.js +11 -57
  88. package/dist/mjs/utils/collection.node.js +42 -150
  89. package/dist/mjs/utils/data.browser.js +49 -94
  90. package/dist/mjs/utils/data.js +19 -62
  91. package/dist/mjs/utils/error.js +0 -5
  92. package/dist/mjs/utils/eth.js +37 -95
  93. package/dist/mjs/utils/file.js +11 -50
  94. package/dist/mjs/utils/hash.js +0 -1
  95. package/dist/mjs/utils/headers.js +6 -14
  96. package/dist/mjs/utils/hex.js +6 -25
  97. package/dist/mjs/utils/http.js +80 -138
  98. package/dist/mjs/utils/merge.js +3 -7
  99. package/dist/mjs/utils/pss.js +0 -2
  100. package/dist/mjs/utils/reference.js +2 -5
  101. package/dist/mjs/utils/sleep.js +2 -37
  102. package/dist/mjs/utils/stream.js +0 -23
  103. package/dist/mjs/utils/tar.js +2 -5
  104. package/dist/mjs/utils/type.js +18 -82
  105. package/dist/mjs/utils/uint64.js +0 -1
  106. package/dist/mjs/utils/url.js +2 -10
  107. package/dist/types/bee-debug.d.ts +2 -2
  108. package/dist/types/bee.d.ts +2 -26
  109. package/dist/types/chunk/cac.d.ts +1 -1
  110. package/dist/types/chunk/soc.d.ts +8 -7
  111. package/dist/types/feed/index.d.ts +9 -8
  112. package/dist/types/feed/type.d.ts +1 -1
  113. package/dist/types/modules/bytes.d.ts +6 -5
  114. package/dist/types/modules/bzz.d.ts +9 -8
  115. package/dist/types/modules/chunk.d.ts +5 -4
  116. package/dist/types/modules/debug/balance.d.ts +10 -9
  117. package/dist/types/modules/debug/chequebook.d.ts +18 -17
  118. package/dist/types/modules/debug/chunk.d.ts +6 -5
  119. package/dist/types/modules/debug/connectivity.d.ts +8 -7
  120. package/dist/types/modules/debug/settlements.d.ts +6 -5
  121. package/dist/types/modules/debug/stake.d.ts +5 -4
  122. package/dist/types/modules/debug/stamps.d.ts +8 -7
  123. package/dist/types/modules/debug/states.d.ts +8 -7
  124. package/dist/types/modules/debug/status.d.ts +15 -15
  125. package/dist/types/modules/debug/tag.d.ts +4 -3
  126. package/dist/types/modules/debug/transactions.d.ts +6 -5
  127. package/dist/types/modules/feed.d.ts +4 -3
  128. package/dist/types/modules/pinning.d.ts +8 -7
  129. package/dist/types/modules/pss.d.ts +4 -3
  130. package/dist/types/modules/soc.d.ts +3 -2
  131. package/dist/types/modules/status.d.ts +3 -3
  132. package/dist/types/modules/stewardship.d.ts +4 -3
  133. package/dist/types/modules/tag.d.ts +7 -6
  134. package/dist/types/types/debug.d.ts +1 -1
  135. package/dist/types/types/index.d.ts +30 -34
  136. package/dist/types/utils/eth.d.ts +3 -3
  137. package/dist/types/utils/hex.d.ts +2 -2
  138. package/dist/types/utils/http.d.ts +6 -6
  139. package/package.json +34 -39
  140. package/dist/cjs/types/ky-options.js +0 -8
  141. package/dist/cjs/types/ky-universal/common.js +0 -8
  142. package/dist/cjs/types/ky-universal/hooks.js +0 -8
  143. package/dist/cjs/types/ky-universal/retry.js +0 -8
  144. package/dist/mjs/types/ky-options.js +0 -7
  145. package/dist/mjs/types/ky-universal/common.js +0 -7
  146. package/dist/mjs/types/ky-universal/hooks.js +0 -7
  147. package/dist/mjs/types/ky-universal/retry.js +0 -7
  148. package/dist/types/types/ky-options.d.ts +0 -221
  149. package/dist/types/types/ky-universal/common.d.ts +0 -13
  150. package/dist/types/types/ky-universal/hooks.d.ts +0 -92
  151. package/dist/types/types/ky-universal/retry.d.ts +0 -38
@@ -1,17 +1,18 @@
1
- import { Ky, Reference, Tag } from '../types';
1
+ import { Reference, Tag } from '../types';
2
+ import type { Options as KyOptions } from 'ky';
2
3
  /**
3
4
  * Create new tag on the Bee node
4
5
  *
5
6
  * @param url Bee tag URL
6
7
  */
7
- export declare function createTag(ky: Ky): Promise<Tag>;
8
+ export declare function createTag(kyOptions: KyOptions): Promise<Tag>;
8
9
  /**
9
10
  * Retrieve tag information from Bee node
10
11
  *
11
12
  * @param url Bee tag URL
12
13
  * @param uid UID of tag to be retrieved
13
14
  */
14
- export declare function retrieveTag(ky: Ky, uid: number): Promise<Tag>;
15
+ export declare function retrieveTag(kyOptions: KyOptions, uid: number): Promise<Tag>;
15
16
  /**
16
17
  * Get limited listing of all tags.
17
18
  *
@@ -19,17 +20,17 @@ export declare function retrieveTag(ky: Ky, uid: number): Promise<Tag>;
19
20
  * @param offset
20
21
  * @param limit
21
22
  */
22
- export declare function getAllTags(ky: Ky, offset?: number, limit?: number): Promise<Tag[]>;
23
+ export declare function getAllTags(kyOptions: KyOptions, offset?: number, limit?: number): Promise<Tag[]>;
23
24
  /**
24
25
  * Removes tag from the Bee node.
25
26
  * @param url
26
27
  * @param uid
27
28
  */
28
- export declare function deleteTag(ky: Ky, uid: number): Promise<void>;
29
+ export declare function deleteTag(kyOptions: KyOptions, uid: number): Promise<void>;
29
30
  /**
30
31
  * Updates tag
31
32
  * @param url
32
33
  * @param uid
33
34
  * @param reference
34
35
  */
35
- export declare function updateTag(ky: Ky, uid: number, reference: Reference): Promise<void>;
36
+ export declare function updateTag(kyOptions: KyOptions, uid: number, reference: Reference): Promise<void>;
@@ -80,7 +80,7 @@ export interface TransactionOptions {
80
80
  */
81
81
  gasLimit?: NumberString;
82
82
  }
83
- export declare type CashoutOptions = TransactionOptions & RequestOptions;
83
+ export type CashoutOptions = TransactionOptions & RequestOptions;
84
84
  export interface CashoutResult {
85
85
  recipient: string;
86
86
  lastPayout: NumberString;
@@ -11,9 +11,9 @@ import type ky from 'ky-universal';
11
11
  import type { Readable as NativeReadable } from 'stream';
12
12
  import type { Readable as CompatibilityReadable } from 'readable-stream';
13
13
  import type { ReadableStream as ReadableStreamPonyfill } from 'web-streams-polyfill';
14
- import { Options as KyOptions } from './ky-options';
14
+ import type { Options as KyOptions } from 'ky';
15
15
  export * from './debug';
16
- export declare type Ky = typeof ky;
16
+ export type Ky = typeof ky;
17
17
  export interface Dictionary<T> {
18
18
  [Key: string]: T;
19
19
  }
@@ -48,34 +48,34 @@ export declare const FEED_INDEX_HEX_LENGTH = 16;
48
48
  *
49
49
  * @see [Bee docs - Store with Encryption](https://docs.ethswarm.org/docs/access-the-swarm/store-with-encryption)
50
50
  */
51
- export declare type Reference = HexString<typeof REFERENCE_HEX_LENGTH> | HexString<typeof ENCRYPTED_REFERENCE_HEX_LENGTH>;
51
+ export type Reference = HexString<typeof REFERENCE_HEX_LENGTH> | HexString<typeof ENCRYPTED_REFERENCE_HEX_LENGTH>;
52
52
  /**
53
53
  * Type that represents either Swarm's reference in hex string or ESN domain (something.eth).
54
54
  */
55
- export declare type ReferenceOrEns = Reference | string;
55
+ export type ReferenceOrEns = Reference | string;
56
56
  /**
57
57
  * Type that represents either Swarm's reference in hex string, ESN domain (something.eth) or CID using one of the Swarm's codecs.
58
58
  */
59
- export declare type ReferenceCidOrEns = ReferenceOrEns | string;
60
- export declare type PlainBytesReference = Bytes<typeof REFERENCE_BYTES_LENGTH>;
61
- export declare type EncryptedBytesReference = Bytes<typeof ENCRYPTED_REFERENCE_BYTES_LENGTH>;
62
- export declare type BytesReference = PlainBytesReference | EncryptedBytesReference;
63
- export declare type PublicKey = HexString<typeof PUBKEY_HEX_LENGTH>;
64
- export declare type Address = HexString<typeof ADDRESS_HEX_LENGTH>;
59
+ export type ReferenceCidOrEns = ReferenceOrEns | string;
60
+ export type PlainBytesReference = Bytes<typeof REFERENCE_BYTES_LENGTH>;
61
+ export type EncryptedBytesReference = Bytes<typeof ENCRYPTED_REFERENCE_BYTES_LENGTH>;
62
+ export type BytesReference = PlainBytesReference | EncryptedBytesReference;
63
+ export type PublicKey = HexString<typeof PUBKEY_HEX_LENGTH>;
64
+ export type Address = HexString<typeof ADDRESS_HEX_LENGTH>;
65
65
  /**
66
66
  * Type representing Readable stream that abstracts away implementation especially the difference between
67
67
  * browser and NodeJS versions as both are supported.
68
68
  */
69
- export declare type Readable = NativeReadable | CompatibilityReadable | ReadableStream | ReadableStreamPonyfill;
69
+ export type Readable = NativeReadable | CompatibilityReadable | ReadableStream | ReadableStreamPonyfill;
70
70
  /**
71
71
  * BatchId is result of keccak256 hash so 64 hex string without prefix.
72
72
  */
73
- export declare type BatchId = HexString<typeof BATCH_ID_HEX_LENGTH>;
73
+ export type BatchId = HexString<typeof BATCH_ID_HEX_LENGTH>;
74
74
  /**
75
75
  * AddressPrefix is an HexString of length equal or smaller then ADDRESS_HEX_LENGTH.
76
76
  * It represents PSS Address Prefix that is used to define address neighborhood that will receive the PSS message.
77
77
  */
78
- export declare type AddressPrefix = HexString;
78
+ export type AddressPrefix = HexString;
79
79
  /**
80
80
  * Internal interface that represents configuration for creating a request with Ky
81
81
  */
@@ -151,8 +151,6 @@ export interface UploadOptions extends RequestOptions {
151
151
  *
152
152
  * Locally pinned data is possible to reupload to network if it disappear.
153
153
  *
154
- * **Warning! Not allowed when node is in Gateway mode!**
155
- *
156
154
  * @see [Bee docs - Pinning](https://docs.ethswarm.org/docs/access-the-swarm/pinning)
157
155
  * @see [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/Collection/paths/~1bzz/post)
158
156
  */
@@ -160,8 +158,6 @@ export interface UploadOptions extends RequestOptions {
160
158
  /**
161
159
  * Will encrypt the uploaded data and return longer hash which also includes the decryption key.
162
160
  *
163
- * **Warning! Not allowed when node is in Gateway mode!**
164
- *
165
161
  * @see [Bee docs - Store with Encryption](https://docs.ethswarm.org/docs/access-the-swarm/store-with-encryption)
166
162
  * @see [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/Collection/paths/~1bzz/post)
167
163
  * @see Reference
@@ -299,7 +295,7 @@ export interface CollectionEntry<T> {
299
295
  /**
300
296
  * Represents Collections
301
297
  */
302
- export declare type Collection<T> = Array<CollectionEntry<T>>;
298
+ export type Collection<T> = Array<CollectionEntry<T>>;
303
299
  export interface PssSubscription {
304
300
  readonly topic: string;
305
301
  cancel: () => void;
@@ -315,8 +311,8 @@ export interface BeeGenericResponse {
315
311
  export interface ReferenceResponse {
316
312
  reference: Reference;
317
313
  }
318
- export declare type HttpMethod = 'GET' | 'DELETE' | 'POST' | 'PATCH' | 'PUT';
319
- export declare type HookCallback<V> = (value: V) => void | Promise<void>;
314
+ export type HttpMethod = 'GET' | 'DELETE' | 'POST' | 'PATCH' | 'PUT';
315
+ export type HookCallback<V> = (value: V) => void | Promise<void>;
320
316
  export interface BeeRequest {
321
317
  url: string;
322
318
  method: HttpMethod;
@@ -337,7 +333,7 @@ export declare const TOPIC_HEX_LENGTH = 64;
337
333
  /**
338
334
  * Hex string of length 64 chars without prefix that specifies topics for feed.
339
335
  */
340
- export declare type Topic = HexString<typeof TOPIC_HEX_LENGTH>;
336
+ export type Topic = HexString<typeof TOPIC_HEX_LENGTH>;
341
337
  /**
342
338
  * Result of upload calls.
343
339
  */
@@ -448,7 +444,7 @@ export interface PostageBatchBuckets {
448
444
  bucketUpperBound: number;
449
445
  buckets?: BatchBucket[];
450
446
  }
451
- export declare type TransactionHash = BrandedString<'TransactionHash'>;
447
+ export type TransactionHash = BrandedString<'TransactionHash'>;
452
448
  export interface TransactionInfo {
453
449
  transactionHash: TransactionHash;
454
450
  to: HexEthAddress;
@@ -493,14 +489,14 @@ export interface PostageBatchOptions extends RequestOptions {
493
489
  /**
494
490
  * With this type a number should be represented in a string
495
491
  */
496
- export declare type NumberString = FlavoredType<string, 'NumberString'>;
492
+ export type NumberString = FlavoredType<string, 'NumberString'>;
497
493
  /*********************************************************
498
494
  * Ethereum compatible signing interfaces and definitions
499
495
  */
500
496
  export declare const SIGNATURE_HEX_LENGTH = 130;
501
497
  export declare const SIGNATURE_BYTES_LENGTH = 65;
502
- export declare type Signature = Bytes<typeof SIGNATURE_BYTES_LENGTH>;
503
- export declare type PrivateKeyBytes = Bytes<32>;
498
+ export type Signature = Bytes<typeof SIGNATURE_BYTES_LENGTH>;
499
+ export type PrivateKeyBytes = Bytes<32>;
504
500
  /**
505
501
  * Signing function that takes digest in Uint8Array to be signed that has helpers to convert it
506
502
  * conveniently into other types like hex-string (non prefix).
@@ -508,8 +504,8 @@ export declare type PrivateKeyBytes = Bytes<32>;
508
504
  *
509
505
  * @see Data
510
506
  */
511
- declare type SyncSigner = (digest: Data) => Signature | HexString<typeof SIGNATURE_HEX_LENGTH> | string;
512
- declare type AsyncSigner = (digest: Data) => Promise<Signature | HexString<typeof SIGNATURE_HEX_LENGTH> | string>;
507
+ type SyncSigner = (digest: Data) => Signature | HexString<typeof SIGNATURE_HEX_LENGTH> | string;
508
+ type AsyncSigner = (digest: Data) => Promise<Signature | HexString<typeof SIGNATURE_HEX_LENGTH> | string>;
513
509
  /**
514
510
  * Interface for implementing Ethereum compatible signing.
515
511
  *
@@ -527,7 +523,7 @@ declare type AsyncSigner = (digest: Data) => Promise<Signature | HexString<typeo
527
523
  * @property address The ethereum address of the signer in bytes.
528
524
  * @see hashWithEthereumPrefix
529
525
  */
530
- export declare type Signer = {
526
+ export type Signer = {
531
527
  sign: SyncSigner | AsyncSigner;
532
528
  address: EthAddress;
533
529
  };
@@ -536,16 +532,16 @@ export declare type Signer = {
536
532
  *
537
533
  * See https://spin.atomicobject.com/2018/01/15/typescript-flexible-nominal-typing/
538
534
  */
539
- export declare type BrandedType<Type, Name> = Type & {
535
+ export type BrandedType<Type, Name> = Type & {
540
536
  __tag__: Name;
541
537
  };
542
- export declare type BrandedString<Name> = BrandedType<string, Name>;
543
- export declare type FlavoredType<Type, Name> = Type & {
538
+ export type BrandedString<Name> = BrandedType<string, Name>;
539
+ export type FlavoredType<Type, Name> = Type & {
544
540
  __tag__?: Name;
545
541
  };
546
- export declare type AnyJson = boolean | number | string | null | JsonArray | JsonMap;
542
+ export type AnyJson = boolean | number | string | null | JsonArray | JsonMap;
547
543
  interface JsonMap {
548
544
  [key: string]: AnyJson;
549
545
  }
550
- declare type JsonArray = Array<AnyJson>;
551
- declare type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>;
546
+ type JsonArray = Array<AnyJson>;
547
+ type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>;
@@ -1,9 +1,9 @@
1
1
  import { BrandedString, Signer } from '../types';
2
2
  import { HexString } from './hex';
3
3
  import { Bytes } from './bytes';
4
- export declare type OverlayAddress = BrandedString<'OverlayAddress'>;
5
- export declare type EthAddress = Bytes<20>;
6
- export declare type HexEthAddress = HexString<40>;
4
+ export type OverlayAddress = BrandedString<'OverlayAddress'>;
5
+ export type EthAddress = Bytes<20>;
6
+ export type HexEthAddress = HexString<40>;
7
7
  export declare function makeEthAddress(address: EthAddress | Uint8Array | string | unknown): EthAddress;
8
8
  export declare function makeHexEthAddress(address: EthAddress | Uint8Array | string | unknown): HexEthAddress;
9
9
  /**
@@ -5,7 +5,7 @@ import { BrandedType, FlavoredType } from '../types';
5
5
  * For example for 32 bytes hex representation you have to use 64 length.
6
6
  * TODO: Make Length mandatory: https://github.com/ethersphere/bee-js/issues/208
7
7
  */
8
- export declare type HexString<Length extends number = number> = FlavoredType<string & {
8
+ export type HexString<Length extends number = number> = FlavoredType<string & {
9
9
  readonly length: Length;
10
10
  }, 'HexString'>;
11
11
  /**
@@ -15,7 +15,7 @@ export declare type HexString<Length extends number = number> = FlavoredType<str
15
15
  * Because of that it does not contain the Length property as the variables
16
16
  * should be validated and converted to HexString ASAP.
17
17
  */
18
- export declare type PrefixedHexString = BrandedType<string, 'PrefixedHexString'>;
18
+ export type PrefixedHexString = BrandedType<string, 'PrefixedHexString'>;
19
19
  /**
20
20
  * Creates unprefixed hex string from wide range of data.
21
21
  *
@@ -1,8 +1,9 @@
1
- import type { BeeRequest, BeeResponse, HookCallback, Ky } from '../types';
2
- import { Options as KyOptions } from 'ky-universal';
1
+ import type { BeeRequest, BeeResponse, HookCallback } from '../types';
2
+ import type { Options as KyOptions } from 'ky-universal';
3
3
  import { KyRequestOptions } from '../types';
4
+ export declare const DEFAULT_KY_CONFIG: KyOptions;
4
5
  interface KyResponse<T> extends Response {
5
- data: T;
6
+ parsedData: T;
6
7
  }
7
8
  export declare function wrapRequestClosure(cb: HookCallback<BeeRequest>): (request: Request) => Promise<void>;
8
9
  export declare function wrapResponseClosure(cb: HookCallback<BeeResponse>): (request: Request, options: unknown, response: Response) => Promise<void>;
@@ -15,9 +16,8 @@ export declare function wrapResponseClosure(cb: HookCallback<BeeResponse>): (req
15
16
  export declare function filterHeaders(obj?: object): Record<string, string> | undefined;
16
17
  /**
17
18
  * Main utility function to make HTTP requests.
18
- * @param ky
19
+ * @param kyOptions
19
20
  * @param config
20
21
  */
21
- export declare function http<T>(ky: Ky, config: KyRequestOptions): Promise<KyResponse<T>>;
22
- export declare function makeDefaultKy(kyConfig: KyOptions): Ky;
22
+ export declare function http<T>(kyOptions: KyOptions, config: KyRequestOptions): Promise<KyResponse<T>>;
23
23
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethersphere/bee-js",
3
- "version": "5.1.1",
3
+ "version": "5.1.2",
4
4
  "description": "Javascript client for Bee",
5
5
  "keywords": [
6
6
  "bee",
@@ -50,13 +50,7 @@
50
50
  "build:types": "tsc --emitDeclarationOnly --declaration --outDir dist/types",
51
51
  "build:browser": "webpack --progress",
52
52
  "mock-ci": "npm run lint:check && npm run check:types && npm run test",
53
- "test": "npm run build:browser && jest --verbose --selectProjects=node:unit node:integration dom:integration --config=jest.config.ts",
54
- "test:integration:browser": "npm run build:browser && jest --verbose --selectProjects=dom:integration --config=jest.config.ts",
55
- "test:integration:node": "jest --verbose --selectProjects=node:integration --config=jest.config.ts",
56
- "test:integration": "npm run build:browser && jest --verbose --selectProjects=node:integration dom:integration --config=jest.config.ts",
57
- "test:unit": "jest --verbose --selectProjects=node:unit --config=jest.config.ts ",
58
- "test:node": "jest --verbose --selectProjects=node:unit node:integration --config=jest.config.ts",
59
- "test:browser": "npm run test:integration:browser",
53
+ "test": "mocha",
60
54
  "check:types": "tsc --project tsconfig.test.json",
61
55
  "lint": "eslint --fix \"src/**/*.ts\" \"test/**/*.ts\" && prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
62
56
  "lint:check": "eslint \"src/**/*.ts\" \"test/**/*.ts\" && prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
@@ -71,72 +65,73 @@
71
65
  "fetch-blob": "2.1.2",
72
66
  "isomorphic-ws": "^4.0.1",
73
67
  "js-sha3": "^0.8.0",
74
- "ky": "^0.25.1",
75
- "ky-universal": "^0.8.2",
68
+ "ky": "^0.33.2",
69
+ "ky-universal": "^0.11.0",
76
70
  "semver": "^7.3.5",
77
71
  "tar-js": "^0.3.0",
78
72
  "utf-8-validate": "^5.0.9",
79
- "web-streams-polyfill": "^4.0.0-beta.1",
73
+ "web-streams-polyfill": "^4.0.0-beta.3",
80
74
  "ws": "^8.7.0"
81
75
  },
82
76
  "devDependencies": {
83
- "@babel/cli": "^7.17.10",
84
- "@babel/core": "^7.18.2",
77
+ "@babel/cli": "^7.19.3",
78
+ "@babel/core": "^7.20.5",
85
79
  "@babel/plugin-proposal-class-properties": "^7.16.7",
86
80
  "@babel/plugin-transform-runtime": "^7.17.0",
87
- "@babel/preset-env": "^7.17.10",
88
- "@babel/preset-typescript": "^7.14.5",
81
+ "@babel/preset-env": "^7.20.2",
82
+ "@babel/preset-typescript": "^7.18.6",
89
83
  "@commitlint/cli": "^17.0.2",
90
- "@commitlint/config-conventional": "^16.2.1",
84
+ "@commitlint/config-conventional": "^17.4.2",
91
85
  "@ethersphere/bee-factory": "^0.5.2",
92
86
  "@fluffy-spoon/substitute": "^1.208.0",
93
- "@jest/test-sequencer": "^27.5.0",
94
- "@jest/types": "^27.5.1",
87
+ "@naholyr/cross-env": "^1.0.0",
88
+ "@types/chai": "^4.3.4",
89
+ "@types/chai-as-promised": "^7.1.5",
95
90
  "@types/content-disposition": "^0.5.4",
96
91
  "@types/debug": "^4.1.7",
97
92
  "@types/elliptic": "^6.4.14",
98
- "@types/expect-puppeteer": "^4.4.7",
99
- "@types/glob": "^7.2.0",
100
- "@types/jest": "^26.0.23",
101
- "@types/jest-environment-puppeteer": "^4.4.1",
102
- "@types/node": "^15.12.4",
103
- "@types/puppeteer": "^5.4.5",
93
+ "@types/mocha": "^10.0.1",
94
+ "@types/node": "^18.11.11",
104
95
  "@types/semver": "^7.3.9",
96
+ "@types/sinon": "^10.0.13",
97
+ "@types/sinon-chai": "^3.2.9",
105
98
  "@types/ws": "^8.5.3",
106
- "@typescript-eslint/eslint-plugin": "^5.10.0",
107
- "@typescript-eslint/parser": "^5.26.0",
108
- "babel-jest": "^28.1.0",
109
- "babel-loader": "^8.2.5",
99
+ "@typescript-eslint/eslint-plugin": "^5.46.0",
100
+ "@typescript-eslint/parser": "^5.46.0",
101
+ "babel-loader": "^9.1.0",
110
102
  "babel-plugin-add-import-extension": "^1.6.0",
103
+ "chai": "^4.3.7",
104
+ "chai-as-promised": "^7.1.1",
105
+ "chai-parentheses": "^0.0.2",
111
106
  "cross-blob": "^2.0.1",
112
107
  "cross-env": "^7.0.3",
113
108
  "debug": "^4.3.4",
114
109
  "depcheck": "^1.4.3",
115
110
  "eslint": "^8.13.0",
116
111
  "eslint-config-prettier": "^8.5.0",
117
- "eslint-plugin-jest": "^25.7.0",
118
112
  "eslint-plugin-prettier": "^4.0.0",
119
113
  "eslint-plugin-unused-imports": "^2.0.0",
120
- "glob": "^8.0.1",
114
+ "expect": "^29.4.0",
121
115
  "husky": "^8.0.1",
122
- "jest": "^27.5.1",
123
- "jest-puppeteer": "^6.1.0",
124
- "nock": "^13.2.4",
116
+ "mocha": "^10.2.0",
117
+ "nock": "^13.3.0",
118
+ "playwright-test": "^8.1.2",
125
119
  "prettier": "^2.6.2",
126
- "puppeteer": "^14.1.0",
127
120
  "rimraf": "^3.0.2",
121
+ "sinon": "^15.0.1",
122
+ "sinon-chai": "^3.7.0",
128
123
  "terser-webpack-plugin": "^5.3.1",
129
- "ts-node": "^10.8.0",
130
- "typescript": "^4.5.4",
131
- "webpack": "^5.72.1",
124
+ "ts-node": "^10.9.1",
125
+ "typescript": "^4.9.5",
126
+ "webpack": "^5.75.0",
132
127
  "webpack-bundle-analyzer": "^4.5.0",
133
- "webpack-cli": "^4.9.2"
128
+ "webpack-cli": "^5.0.1"
134
129
  },
135
130
  "engines": {
136
131
  "node": ">=14.0.0",
137
132
  "npm": ">=6.0.0",
138
133
  "beeApiVersion": "4.0.0",
139
134
  "beeDebugApiVersion": "4.0.0",
140
- "bee": "1.10.0-904cbb08"
135
+ "bee": "1.11.1-1992b846"
141
136
  }
142
137
  }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- /**
3
- * Types extracted from Ky as a backport for older Ky non-ESM version
4
- *
5
- * @author https://github.com/sindresorhus
6
- * @licence MIT https://github.com/sindresorhus/ky/blob/main/license
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- "use strict";
2
- /**
3
- * Types extracted from Ky as a backport for older Ky non-ESM version
4
- *
5
- * @author https://github.com/sindresorhus
6
- * @licence MIT https://github.com/sindresorhus/ky/blob/main/license
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- "use strict";
2
- /**
3
- * Types extracted from Ky as a backport for older Ky non-ESM version
4
- *
5
- * @author https://github.com/sindresorhus
6
- * @licence MIT https://github.com/sindresorhus/ky/blob/main/license
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- "use strict";
2
- /**
3
- * Types extracted from Ky as a backport for older Ky non-ESM version
4
- *
5
- * @author https://github.com/sindresorhus
6
- * @licence MIT https://github.com/sindresorhus/ky/blob/main/license
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- /**
2
- * Types extracted from Ky as a backport for older Ky non-ESM version
3
- *
4
- * @author https://github.com/sindresorhus
5
- * @licence MIT https://github.com/sindresorhus/ky/blob/main/license
6
- */
7
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * Types extracted from Ky as a backport for older Ky non-ESM version
3
- *
4
- * @author https://github.com/sindresorhus
5
- * @licence MIT https://github.com/sindresorhus/ky/blob/main/license
6
- */
7
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * Types extracted from Ky as a backport for older Ky non-ESM version
3
- *
4
- * @author https://github.com/sindresorhus
5
- * @licence MIT https://github.com/sindresorhus/ky/blob/main/license
6
- */
7
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * Types extracted from Ky as a backport for older Ky non-ESM version
3
- *
4
- * @author https://github.com/sindresorhus
5
- * @licence MIT https://github.com/sindresorhus/ky/blob/main/license
6
- */
7
- export {};