@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.
- package/README.md +14 -6
- package/dist/223.index.browser.min.js +3 -0
- package/dist/223.index.browser.min.js.LICENSE.txt +1 -0
- package/dist/223.index.browser.min.js.map +1 -0
- package/dist/cjs/bee-debug.js +208 -312
- package/dist/cjs/bee.js +258 -353
- package/dist/cjs/chunk/signer.js +11 -22
- package/dist/cjs/chunk/soc.js +33 -50
- package/dist/cjs/chunk/span.js +1 -1
- package/dist/cjs/feed/index.js +50 -65
- package/dist/cjs/feed/json.js +8 -21
- package/dist/cjs/feed/retrievable.js +14 -27
- package/dist/cjs/modules/bytes.js +25 -37
- package/dist/cjs/modules/bzz.js +63 -68
- package/dist/cjs/modules/chunk.js +17 -27
- package/dist/cjs/modules/debug/balance.js +24 -41
- package/dist/cjs/modules/debug/chequebook.js +71 -96
- package/dist/cjs/modules/debug/chunk.js +13 -26
- package/dist/cjs/modules/debug/connectivity.js +32 -53
- package/dist/cjs/modules/debug/settlements.js +12 -25
- package/dist/cjs/modules/debug/stake.js +20 -33
- package/dist/cjs/modules/debug/stamps.js +45 -66
- package/dist/cjs/modules/debug/states.js +27 -40
- package/dist/cjs/modules/debug/status.js +53 -80
- package/dist/cjs/modules/debug/tag.js +6 -17
- package/dist/cjs/modules/debug/transactions.js +23 -40
- package/dist/cjs/modules/feed.js +17 -27
- package/dist/cjs/modules/pinning.js +24 -41
- package/dist/cjs/modules/pss.js +9 -20
- package/dist/cjs/modules/soc.js +12 -20
- package/dist/cjs/modules/status.js +4 -15
- package/dist/cjs/modules/stewardship.js +10 -23
- package/dist/cjs/modules/tag.js +28 -47
- package/dist/cjs/utils/collection.browser.js +4 -17
- package/dist/cjs/utils/collection.js +11 -22
- package/dist/cjs/utils/collection.node.js +42 -86
- package/dist/cjs/utils/data.browser.js +46 -59
- package/dist/cjs/utils/data.js +22 -35
- package/dist/cjs/utils/eth.js +31 -43
- package/dist/cjs/utils/file.js +9 -20
- package/dist/cjs/utils/headers.js +4 -4
- package/dist/cjs/utils/http.js +78 -93
- package/dist/cjs/utils/merge.js +1 -1
- package/dist/cjs/utils/sleep.js +2 -13
- package/dist/cjs/utils/type.js +14 -12
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.LICENSE.txt +1 -3
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee-debug.js +209 -450
- package/dist/mjs/bee.js +256 -491
- package/dist/mjs/chunk/bmt.js +4 -10
- package/dist/mjs/chunk/cac.js +0 -3
- package/dist/mjs/chunk/signer.js +12 -63
- package/dist/mjs/chunk/soc.js +33 -85
- package/dist/mjs/chunk/span.js +3 -6
- package/dist/mjs/feed/identifier.js +0 -6
- package/dist/mjs/feed/index.js +53 -97
- package/dist/mjs/feed/json.js +10 -49
- package/dist/mjs/feed/retrievable.js +13 -64
- package/dist/mjs/feed/topic.js +0 -2
- package/dist/mjs/index.js +1 -2
- package/dist/mjs/modules/bytes.js +25 -65
- package/dist/mjs/modules/bzz.js +64 -108
- package/dist/mjs/modules/chunk.js +17 -54
- package/dist/mjs/modules/debug/balance.js +24 -68
- package/dist/mjs/modules/debug/chequebook.js +75 -138
- package/dist/mjs/modules/debug/chunk.js +13 -51
- package/dist/mjs/modules/debug/connectivity.js +32 -76
- package/dist/mjs/modules/debug/settlements.js +12 -50
- package/dist/mjs/modules/debug/stake.js +20 -61
- package/dist/mjs/modules/debug/stamps.js +47 -94
- package/dist/mjs/modules/debug/states.js +25 -66
- package/dist/mjs/modules/debug/status.js +66 -125
- package/dist/mjs/modules/debug/tag.js +6 -41
- package/dist/mjs/modules/debug/transactions.js +25 -69
- package/dist/mjs/modules/feed.js +17 -57
- package/dist/mjs/modules/pinning.js +24 -68
- package/dist/mjs/modules/pss.js +11 -47
- package/dist/mjs/modules/soc.js +14 -48
- package/dist/mjs/modules/status.js +4 -39
- package/dist/mjs/modules/stewardship.js +10 -47
- package/dist/mjs/modules/tag.js +31 -78
- package/dist/mjs/types/debug.js +0 -1
- package/dist/mjs/types/index.js +0 -4
- package/dist/mjs/utils/bytes.js +6 -14
- package/dist/mjs/utils/collection.browser.js +4 -42
- package/dist/mjs/utils/collection.js +11 -57
- package/dist/mjs/utils/collection.node.js +42 -150
- package/dist/mjs/utils/data.browser.js +49 -94
- package/dist/mjs/utils/data.js +19 -62
- package/dist/mjs/utils/error.js +0 -5
- package/dist/mjs/utils/eth.js +37 -95
- package/dist/mjs/utils/file.js +11 -50
- package/dist/mjs/utils/hash.js +0 -1
- package/dist/mjs/utils/headers.js +6 -14
- package/dist/mjs/utils/hex.js +6 -25
- package/dist/mjs/utils/http.js +80 -138
- package/dist/mjs/utils/merge.js +3 -7
- package/dist/mjs/utils/pss.js +0 -2
- package/dist/mjs/utils/reference.js +2 -5
- package/dist/mjs/utils/sleep.js +2 -37
- package/dist/mjs/utils/stream.js +0 -23
- package/dist/mjs/utils/tar.js +2 -5
- package/dist/mjs/utils/type.js +18 -82
- package/dist/mjs/utils/uint64.js +0 -1
- package/dist/mjs/utils/url.js +2 -10
- package/dist/types/bee-debug.d.ts +2 -2
- package/dist/types/bee.d.ts +2 -26
- package/dist/types/chunk/cac.d.ts +1 -1
- package/dist/types/chunk/soc.d.ts +8 -7
- package/dist/types/feed/index.d.ts +9 -8
- package/dist/types/feed/type.d.ts +1 -1
- package/dist/types/modules/bytes.d.ts +6 -5
- package/dist/types/modules/bzz.d.ts +9 -8
- package/dist/types/modules/chunk.d.ts +5 -4
- package/dist/types/modules/debug/balance.d.ts +10 -9
- package/dist/types/modules/debug/chequebook.d.ts +18 -17
- package/dist/types/modules/debug/chunk.d.ts +6 -5
- package/dist/types/modules/debug/connectivity.d.ts +8 -7
- package/dist/types/modules/debug/settlements.d.ts +6 -5
- package/dist/types/modules/debug/stake.d.ts +5 -4
- package/dist/types/modules/debug/stamps.d.ts +8 -7
- package/dist/types/modules/debug/states.d.ts +8 -7
- package/dist/types/modules/debug/status.d.ts +15 -15
- package/dist/types/modules/debug/tag.d.ts +4 -3
- package/dist/types/modules/debug/transactions.d.ts +6 -5
- package/dist/types/modules/feed.d.ts +4 -3
- package/dist/types/modules/pinning.d.ts +8 -7
- package/dist/types/modules/pss.d.ts +4 -3
- package/dist/types/modules/soc.d.ts +3 -2
- package/dist/types/modules/status.d.ts +3 -3
- package/dist/types/modules/stewardship.d.ts +4 -3
- package/dist/types/modules/tag.d.ts +7 -6
- package/dist/types/types/debug.d.ts +1 -1
- package/dist/types/types/index.d.ts +30 -34
- package/dist/types/utils/eth.d.ts +3 -3
- package/dist/types/utils/hex.d.ts +2 -2
- package/dist/types/utils/http.d.ts +6 -6
- package/package.json +34 -39
- package/dist/cjs/types/ky-options.js +0 -8
- package/dist/cjs/types/ky-universal/common.js +0 -8
- package/dist/cjs/types/ky-universal/hooks.js +0 -8
- package/dist/cjs/types/ky-universal/retry.js +0 -8
- package/dist/mjs/types/ky-options.js +0 -7
- package/dist/mjs/types/ky-universal/common.js +0 -7
- package/dist/mjs/types/ky-universal/hooks.js +0 -7
- package/dist/mjs/types/ky-universal/retry.js +0 -7
- package/dist/types/types/ky-options.d.ts +0 -221
- package/dist/types/types/ky-universal/common.d.ts +0 -13
- package/dist/types/types/ky-universal/hooks.d.ts +0 -92
- package/dist/types/types/ky-universal/retry.d.ts +0 -38
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
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 '
|
|
14
|
+
import type { Options as KyOptions } from 'ky';
|
|
15
15
|
export * from './debug';
|
|
16
|
-
export
|
|
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
|
|
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
|
|
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
|
|
60
|
-
export
|
|
61
|
-
export
|
|
62
|
-
export
|
|
63
|
-
export
|
|
64
|
-
export
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
319
|
-
export
|
|
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
|
|
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
|
|
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
|
|
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
|
|
503
|
-
export
|
|
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
|
-
|
|
512
|
-
|
|
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
|
|
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
|
|
535
|
+
export type BrandedType<Type, Name> = Type & {
|
|
540
536
|
__tag__: Name;
|
|
541
537
|
};
|
|
542
|
-
export
|
|
543
|
-
export
|
|
538
|
+
export type BrandedString<Name> = BrandedType<string, Name>;
|
|
539
|
+
export type FlavoredType<Type, Name> = Type & {
|
|
544
540
|
__tag__?: Name;
|
|
545
541
|
};
|
|
546
|
-
export
|
|
542
|
+
export type AnyJson = boolean | number | string | null | JsonArray | JsonMap;
|
|
547
543
|
interface JsonMap {
|
|
548
544
|
[key: string]: AnyJson;
|
|
549
545
|
}
|
|
550
|
-
|
|
551
|
-
|
|
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
|
|
5
|
-
export
|
|
6
|
-
export
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
19
|
+
* @param kyOptions
|
|
19
20
|
* @param config
|
|
20
21
|
*/
|
|
21
|
-
export declare function http<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.
|
|
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": "
|
|
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.
|
|
75
|
-
"ky-universal": "^0.
|
|
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.
|
|
73
|
+
"web-streams-polyfill": "^4.0.0-beta.3",
|
|
80
74
|
"ws": "^8.7.0"
|
|
81
75
|
},
|
|
82
76
|
"devDependencies": {
|
|
83
|
-
"@babel/cli": "^7.
|
|
84
|
-
"@babel/core": "^7.
|
|
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.
|
|
88
|
-
"@babel/preset-typescript": "^7.
|
|
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": "^
|
|
84
|
+
"@commitlint/config-conventional": "^17.4.2",
|
|
91
85
|
"@ethersphere/bee-factory": "^0.5.2",
|
|
92
86
|
"@fluffy-spoon/substitute": "^1.208.0",
|
|
93
|
-
"@
|
|
94
|
-
"@
|
|
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/
|
|
99
|
-
"@types/
|
|
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.
|
|
107
|
-
"@typescript-eslint/parser": "^5.
|
|
108
|
-
"babel-
|
|
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
|
-
"
|
|
114
|
+
"expect": "^29.4.0",
|
|
121
115
|
"husky": "^8.0.1",
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
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.
|
|
130
|
-
"typescript": "^4.5
|
|
131
|
-
"webpack": "^5.
|
|
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": "^
|
|
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.
|
|
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 });
|