@ethersphere/bee-js 7.1.2 → 8.0.1

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/dist/mjs/bee.js CHANGED
@@ -21,6 +21,7 @@ import * as debugStatus from "./modules/debug/status.js";
21
21
  import * as debugTag from "./modules/debug/tag.js";
22
22
  import * as transactions from "./modules/debug/transactions.js";
23
23
  import { createFeedManifest } from "./modules/feed.js";
24
+ import * as grantee from "./modules/grantee.js";
24
25
  import * as pinning from "./modules/pinning.js";
25
26
  import * as pss from "./modules/pss.js";
26
27
  import * as status from "./modules/status.js";
@@ -150,10 +151,51 @@ export class Bee {
150
151
  assertReferenceOrEns(reference);
151
152
  return chunk.download(this.getRequestOptionsForCall(options), reference);
152
153
  }
154
+ /**
155
+ * Create a grantees list from the given array of public keys.
156
+ *
157
+ * The grantees list can be obtained with the `getGrantees` method.
158
+ *
159
+ * @param postageBatchId - The ID of the postage batch.
160
+ * @param grantees - An array of public keys representing the grantees.
161
+ * @param requestOptions - Optional request options.
162
+ * @returns A promise that resolves to a `GranteesResult` object.
163
+ */
164
+ async createGrantees(postageBatchId, grantees, requestOptions) {
165
+ assertBatchId(postageBatchId);
166
+ return grantee.createGrantees(this.getRequestOptionsForCall(requestOptions), postageBatchId, grantees);
167
+ }
168
+ /**
169
+ * Retrieves the grantees for a given reference.
170
+ *
171
+ * @param reference - The reference.
172
+ * @param requestOptions - Optional request options.
173
+ * @returns A promise that resolves to a `GetGranteesResult` object.
174
+ */
175
+ async getGrantees(reference, requestOptions) {
176
+ return grantee.getGrantees(reference, this.getRequestOptionsForCall(requestOptions));
177
+ }
178
+ /**
179
+ * Updates the grantees of a specific reference and history.
180
+ *
181
+ * @param reference - The reference.
182
+ * @param history - The history.
183
+ * @param postageBatchId - The ID of the postage batch.
184
+ * @param grantees - The grantees.
185
+ * @param requestOptions - Optional request options.
186
+ * @returns A Promise that resolves to to a `GranteesResult` object.
187
+ */
188
+ async patchGrantees(postageBatchId, reference, history, grantees, requestOptions) {
189
+ assertBatchId(postageBatchId);
190
+ return grantee.patchGrantees(postageBatchId, reference, history, {
191
+ add: grantees.add || [],
192
+ revoke: grantees.revoke || []
193
+ }, this.getRequestOptionsForCall(requestOptions));
194
+ }
153
195
  /**
154
196
  * Upload single file to a Bee node.
155
197
  *
156
- * **To make sure that you won't loose critical data it is highly recommended to also
198
+ * **To make sure that you won't lose critical data it is highly recommended to also
157
199
  * locally pin the data with `options.pin = true`**
158
200
  *
159
201
  * @param postageBatchId Postage BatchId to be used to upload the data with
@@ -24,7 +24,8 @@ export async function upload(requestOptions, data, postageBatchId, options) {
24
24
  });
25
25
  return {
26
26
  reference: response.data.reference,
27
- tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined
27
+ tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined,
28
+ historyAddress: response.headers['swarm-act-history-address'] || ''
28
29
  };
29
30
  }
30
31
  /**
@@ -41,7 +41,8 @@ export async function uploadFile(requestOptions, data, postageBatchId, name, opt
41
41
  });
42
42
  return {
43
43
  reference: response.data.reference,
44
- tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined
44
+ tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined,
45
+ historyAddress: response.headers['swarm-act-history-address'] || ''
45
46
  };
46
47
  }
47
48
  /**
@@ -106,6 +107,7 @@ export async function uploadCollection(requestOptions, collection, postageBatchI
106
107
  const response = await uploadTar(requestOptions, collection, postageBatchId, options);
107
108
  return {
108
109
  reference: response.data.reference,
109
- tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined
110
+ tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined,
111
+ historyAddress: response.headers['swarm-act-history-address'] || ''
110
112
  };
111
113
  }
@@ -1,6 +1,7 @@
1
1
  import { wrapBytesWithHelpers } from "../utils/bytes.js";
2
2
  import { extractUploadHeaders } from "../utils/headers.js";
3
3
  import { http } from "../utils/http.js";
4
+ import { makeTagUid } from "../utils/type.js";
4
5
  const endpoint = 'chunks';
5
6
  /**
6
7
  * Upload chunk to a Bee node
@@ -25,7 +26,11 @@ export async function upload(requestOptions, data, postageBatchId, options) {
25
26
  },
26
27
  responseType: 'json'
27
28
  });
28
- return response.data.reference;
29
+ return {
30
+ reference: response.data.reference,
31
+ tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined,
32
+ historyAddress: response.headers['swarm-act-history-address'] || ''
33
+ };
29
34
  }
30
35
  /**
31
36
  * Download chunk data as a byte array
@@ -0,0 +1,52 @@
1
+ import { extractRedundantUploadHeaders } from "../utils/headers.js";
2
+ import { http } from "../utils/http.js";
3
+ const granteeEndpoint = 'grantee';
4
+ export async function getGrantees(reference, requestOptions) {
5
+ const response = await http(requestOptions, {
6
+ method: 'get',
7
+ url: `${granteeEndpoint}/${reference}`,
8
+ responseType: 'json'
9
+ });
10
+ return {
11
+ status: response.status,
12
+ statusText: response.statusText,
13
+ data: response.data.data
14
+ };
15
+ }
16
+ export async function createGrantees(requestOptions, postageBatchId, grantees) {
17
+ const response = await http(requestOptions, {
18
+ method: 'post',
19
+ url: granteeEndpoint,
20
+ data: {
21
+ grantees: grantees
22
+ },
23
+ headers: {
24
+ ...extractRedundantUploadHeaders(postageBatchId)
25
+ },
26
+ responseType: 'json'
27
+ });
28
+ return {
29
+ status: response.status,
30
+ statusText: response.statusText,
31
+ ref: response.data.ref,
32
+ historyref: response.data.historyref
33
+ };
34
+ }
35
+ export async function patchGrantees(postageBatchId, reference, historyRef, grantees, requestOptions) {
36
+ const response = await http(requestOptions, {
37
+ method: 'patch',
38
+ url: `${granteeEndpoint}/${reference}`,
39
+ data: grantees,
40
+ headers: {
41
+ ...extractRedundantUploadHeaders(postageBatchId),
42
+ 'swarm-act-history-address': historyRef
43
+ },
44
+ responseType: 'json'
45
+ });
46
+ return {
47
+ status: response.status,
48
+ statusText: response.statusText,
49
+ ref: response.data.ref,
50
+ historyref: response.data.historyref
51
+ };
52
+ }
@@ -1,5 +1,6 @@
1
1
  import { extractUploadHeaders } from "../utils/headers.js";
2
2
  import { http } from "../utils/http.js";
3
+ import { makeTagUid } from "../utils/type.js";
3
4
  const socEndpoint = 'soc';
4
5
  /**
5
6
  * Upload single owner chunk (SOC) to a Bee node
@@ -26,5 +27,9 @@ export async function upload(requestOptions, owner, identifier, signature, data,
26
27
  sig: signature
27
28
  }
28
29
  });
29
- return response.data.reference;
30
+ return {
31
+ reference: response.data.reference,
32
+ tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined,
33
+ historyAddress: response.headers['swarm-act-history-address'] || ''
34
+ };
30
35
  }
@@ -3,7 +3,7 @@ export function isCollection(data) {
3
3
  if (!Array.isArray(data)) {
4
4
  return false;
5
5
  }
6
- return data.every(entry => typeof entry === 'object' && entry.path && entry.size);
6
+ return data.every(entry => typeof entry === 'object' && entry.path && entry.size !== undefined);
7
7
  }
8
8
  export function assertCollection(data) {
9
9
  if (!isCollection(data)) {
@@ -42,6 +42,9 @@ export function extractUploadHeaders(postageBatchId, options) {
42
42
  const headers = {
43
43
  'swarm-postage-batch-id': postageBatchId
44
44
  };
45
+ if (options?.act) {
46
+ headers['swarm-act'] = String(options.act);
47
+ }
45
48
  if (options?.pin) {
46
49
  headers['swarm-pin'] = String(options.pin);
47
50
  }
@@ -21,6 +21,13 @@ export async function http(options, config) {
21
21
  const requestConfig = Objects.deepMerge3(DEFAULT_HTTP_CONFIG, config, options);
22
22
  maybeRunOnRequestHook(options, requestConfig);
23
23
  const response = await axios(requestConfig);
24
+ // Axios does not parse array of strings as JSON
25
+ if (Array.isArray(response.data) && response.data.every(element => typeof element === 'string')) {
26
+ const array = response.data;
27
+ response.data = {
28
+ data: array
29
+ };
30
+ }
24
31
  // TODO: https://github.com/axios/axios/pull/6253
25
32
  return response;
26
33
  } catch (e) {
@@ -2,7 +2,7 @@
2
2
  import { Readable } from 'stream';
3
3
  import { Index, IndexBytes } from './feed';
4
4
  import { FeedType } from './feed/type';
5
- import type { Address, AddressPrefix, AllSettlements, AnyJson, BalanceResponse, BatchId, BeeOptions, BeeRequestOptions, BeeVersions, ChainState, ChequebookAddressResponse, ChequebookBalanceResponse, CollectionUploadOptions, Data, DebugStatus, ExtendedTag, FeedReader, FeedWriter, FileData, FileUploadOptions, Health, JsonFeedOptions, LastCashoutActionResponse, LastChequesForPeerResponse, LastChequesResponse, NodeAddresses, NodeInfo, NumberString, Peer, PeerBalance, Pin, PingResponse, PostageBatch, PostageBatchBuckets, PssMessageHandler, PssSubscription, PublicKey, RedistributionState, Reference, RemovePeerResponse, ReserveState, SOCReader, SOCWriter, Settlements, Signer, Tag, Topic, Topology, TransactionHash, TransactionInfo, UploadOptions, UploadRedundancyOptions, UploadResultWithCid, WalletBalance } from './types';
5
+ import type { Address, AddressPrefix, AllSettlements, AnyJson, BalanceResponse, BatchId, BeeOptions, BeeRequestOptions, BeeVersions, ChainState, ChequebookAddressResponse, ChequebookBalanceResponse, CollectionUploadOptions, Data, DebugStatus, ExtendedTag, FeedReader, FeedWriter, FileData, FileUploadOptions, GetGranteesResult, GranteesResult, Health, JsonFeedOptions, LastCashoutActionResponse, LastChequesForPeerResponse, LastChequesResponse, NodeAddresses, NodeInfo, NumberString, Peer, PeerBalance, Pin, PingResponse, PostageBatch, PostageBatchBuckets, PssMessageHandler, PssSubscription, PublicKey, RedistributionState, Reference, RemovePeerResponse, ReserveState, SOCReader, SOCWriter, Settlements, Signer, Tag, Topic, Topology, TransactionHash, TransactionInfo, UploadOptions, UploadRedundancyOptions, UploadResultWithCid, WalletBalance } from './types';
6
6
  import { AllTagsOptions, CashoutOptions, Collection, FeedManifestResult, PostageBatchOptions, ReferenceCidOrEns, ReferenceOrEns, TransactionOptions, UploadResult } from './types';
7
7
  import { EthAddress } from './utils/eth';
8
8
  /**
@@ -75,7 +75,7 @@ export declare class Bee {
75
75
  * @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/develop/access-the-swarm/upload-and-download)
76
76
  * @see [Bee API reference - `POST /chunks`](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks/post)
77
77
  */
78
- uploadChunk(postageBatchId: string | BatchId, data: Uint8Array, options?: UploadOptions, requestOptions?: BeeRequestOptions): Promise<Reference>;
78
+ uploadChunk(postageBatchId: string | BatchId, data: Uint8Array, options?: UploadOptions, requestOptions?: BeeRequestOptions): Promise<UploadResult>;
79
79
  /**
80
80
  * Download chunk as a byte array
81
81
  *
@@ -87,10 +87,43 @@ export declare class Bee {
87
87
  * @see [Bee API reference - `GET /chunks`](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks~1{address}/get)
88
88
  */
89
89
  downloadChunk(reference: ReferenceOrEns | string, options?: BeeRequestOptions): Promise<Data>;
90
+ /**
91
+ * Create a grantees list from the given array of public keys.
92
+ *
93
+ * The grantees list can be obtained with the `getGrantees` method.
94
+ *
95
+ * @param postageBatchId - The ID of the postage batch.
96
+ * @param grantees - An array of public keys representing the grantees.
97
+ * @param requestOptions - Optional request options.
98
+ * @returns A promise that resolves to a `GranteesResult` object.
99
+ */
100
+ createGrantees(postageBatchId: string | BatchId, grantees: string[], requestOptions?: BeeRequestOptions): Promise<GranteesResult>;
101
+ /**
102
+ * Retrieves the grantees for a given reference.
103
+ *
104
+ * @param reference - The reference.
105
+ * @param requestOptions - Optional request options.
106
+ * @returns A promise that resolves to a `GetGranteesResult` object.
107
+ */
108
+ getGrantees(reference: ReferenceOrEns | string, requestOptions?: BeeRequestOptions): Promise<GetGranteesResult>;
109
+ /**
110
+ * Updates the grantees of a specific reference and history.
111
+ *
112
+ * @param reference - The reference.
113
+ * @param history - The history.
114
+ * @param postageBatchId - The ID of the postage batch.
115
+ * @param grantees - The grantees.
116
+ * @param requestOptions - Optional request options.
117
+ * @returns A Promise that resolves to to a `GranteesResult` object.
118
+ */
119
+ patchGrantees(postageBatchId: string | BatchId, reference: Reference | string, history: Reference | string, grantees: {
120
+ add?: string[];
121
+ revoke?: string[];
122
+ }, requestOptions?: BeeRequestOptions): Promise<GranteesResult>;
90
123
  /**
91
124
  * Upload single file to a Bee node.
92
125
  *
93
- * **To make sure that you won't loose critical data it is highly recommended to also
126
+ * **To make sure that you won't lose critical data it is highly recommended to also
94
127
  * locally pin the data with `options.pin = true`**
95
128
  *
96
129
  * @param postageBatchId Postage BatchId to be used to upload the data with
@@ -431,7 +464,7 @@ export declare class Bee {
431
464
  *
432
465
  * @see [Bee docs - Feeds](https://docs.ethswarm.org/docs/develop/tools-and-features/feeds)
433
466
  */
434
- setJsonFeed<T extends AnyJson>(postageBatchId: string | BatchId, topic: string, data: T, options?: JsonFeedOptions, requestOptions?: BeeRequestOptions): Promise<Reference>;
467
+ setJsonFeed<T extends AnyJson>(postageBatchId: string | BatchId, topic: string, data: T, options?: JsonFeedOptions, requestOptions?: BeeRequestOptions): Promise<UploadResult>;
435
468
  /**
436
469
  * High-level function that allows you to easily get data from feed.
437
470
  * Returned data are parsed using JSON.parse().
@@ -1,4 +1,4 @@
1
- import { BatchId, BeeRequestOptions, PlainBytesReference, Reference, Signature, Signer, UploadOptions } from '../types';
1
+ import { BatchId, BeeRequestOptions, PlainBytesReference, Signature, Signer, UploadOptions, UploadResult } from '../types';
2
2
  import { Bytes } from '../utils/bytes';
3
3
  import { EthAddress } from '../utils/eth';
4
4
  import { Chunk } from './cac';
@@ -44,7 +44,7 @@ export declare function makeSingleOwnerChunk(chunk: Chunk, identifier: Identifie
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(requestOptions: BeeRequestOptions, chunk: SingleOwnerChunk, postageBatchId: BatchId, options?: UploadOptions): Promise<Reference>;
47
+ export declare function uploadSingleOwnerChunk(requestOptions: BeeRequestOptions, chunk: SingleOwnerChunk, postageBatchId: BatchId, options?: UploadOptions): Promise<UploadResult>;
48
48
  /**
49
49
  * Helper function to create and upload SOC.
50
50
  *
@@ -55,7 +55,7 @@ export declare function uploadSingleOwnerChunk(requestOptions: BeeRequestOptions
55
55
  * @param data The chunk data
56
56
  * @param options
57
57
  */
58
- export declare function uploadSingleOwnerChunkData(requestOptions: BeeRequestOptions, signer: Signer, postageBatchId: BatchId | string, identifier: Identifier, data: Uint8Array, options?: UploadOptions): Promise<Reference>;
58
+ export declare function uploadSingleOwnerChunkData(requestOptions: BeeRequestOptions, signer: Signer, postageBatchId: BatchId | string, identifier: Identifier, data: Uint8Array, options?: UploadOptions): Promise<UploadResult>;
59
59
  /**
60
60
  * Helper function to download SOC.
61
61
  *
@@ -1,5 +1,5 @@
1
1
  import { FeedUpdateOptions } from '../modules/feed';
2
- import { BatchId, BeeRequestOptions, BytesReference, FEED_INDEX_HEX_LENGTH, FeedReader, FeedWriter, PlainBytesReference, Reference, Signer, Topic, UploadOptions } from '../types';
2
+ import { BatchId, BeeRequestOptions, BytesReference, FEED_INDEX_HEX_LENGTH, FeedReader, FeedWriter, PlainBytesReference, Signer, Topic, UploadOptions, UploadResult } from '../types';
3
3
  import { Bytes } from '../utils/bytes';
4
4
  import { EthAddress, HexEthAddress } from '../utils/eth';
5
5
  import { HexString } from '../utils/hex';
@@ -21,7 +21,7 @@ export interface FeedUpdate {
21
21
  reference: BytesReference;
22
22
  }
23
23
  export declare function findNextIndex(requestOptions: BeeRequestOptions, owner: HexEthAddress, topic: Topic, options?: FeedUpdateOptions): Promise<HexString<typeof FEED_INDEX_HEX_LENGTH>>;
24
- export declare function updateFeed(requestOptions: BeeRequestOptions, signer: Signer, topic: Topic, reference: BytesReference, postageBatchId: BatchId, options?: FeedUploadOptions): Promise<Reference>;
24
+ export declare function updateFeed(requestOptions: BeeRequestOptions, signer: Signer, topic: Topic, reference: BytesReference, postageBatchId: BatchId, options?: FeedUploadOptions): Promise<UploadResult>;
25
25
  export declare function getFeedUpdateChunkReference(owner: EthAddress, topic: Topic, index: Index): PlainBytesReference;
26
26
  export declare function downloadFeedUpdate(requestOptions: BeeRequestOptions, owner: EthAddress, topic: Topic, index: Index): Promise<FeedUpdate>;
27
27
  export declare function makeFeedReader(requestOptions: BeeRequestOptions, type: FeedType, topic: Topic, owner: HexEthAddress): FeedReader;
@@ -1,4 +1,4 @@
1
1
  import { Bee } from '../bee';
2
- import { AnyJson, BatchId, BeeRequestOptions, FeedReader, FeedWriter, JsonFeedOptions, Reference, UploadOptions } from '../types';
2
+ import { AnyJson, BatchId, BeeRequestOptions, FeedReader, FeedWriter, JsonFeedOptions, UploadOptions, UploadResult } from '../types';
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, options?: JsonFeedOptions & UploadOptions, requestOptions?: BeeRequestOptions): Promise<Reference>;
4
+ export declare function setJsonData(bee: Bee, writer: FeedWriter, postageBatchId: BatchId, data: AnyJson, options?: JsonFeedOptions & UploadOptions, requestOptions?: BeeRequestOptions): Promise<UploadResult>;
@@ -1,4 +1,4 @@
1
- import type { BatchId, BeeRequestOptions, Data, Reference, ReferenceOrEns, UploadOptions } from '../types';
1
+ import type { BatchId, BeeRequestOptions, Data, ReferenceOrEns, UploadOptions, UploadResult } from '../types';
2
2
  /**
3
3
  * Upload chunk to a Bee node
4
4
  *
@@ -11,7 +11,7 @@ import type { BatchId, BeeRequestOptions, Data, Reference, ReferenceOrEns, Uploa
11
11
  * @param postageBatchId Postage BatchId that will be assigned to uploaded data
12
12
  * @param options Additional options like tag, encryption, pinning
13
13
  */
14
- export declare function upload(requestOptions: BeeRequestOptions, data: Uint8Array, postageBatchId: BatchId, options?: UploadOptions): Promise<Reference>;
14
+ export declare function upload(requestOptions: BeeRequestOptions, data: Uint8Array, postageBatchId: BatchId, options?: UploadOptions): Promise<UploadResult>;
15
15
  /**
16
16
  * Download chunk data as a byte array
17
17
  *
@@ -0,0 +1,7 @@
1
+ import { BatchId, BeeRequestOptions, GetGranteesResult, GranteesResult } from '../types';
2
+ export declare function getGrantees(reference: string, requestOptions: BeeRequestOptions): Promise<GetGranteesResult>;
3
+ export declare function createGrantees(requestOptions: BeeRequestOptions, postageBatchId: BatchId, grantees: string[]): Promise<GranteesResult>;
4
+ export declare function patchGrantees(postageBatchId: BatchId, reference: string, historyRef: string, grantees: {
5
+ add?: string[];
6
+ revoke?: string[];
7
+ }, requestOptions: BeeRequestOptions): Promise<GranteesResult>;
@@ -1,4 +1,4 @@
1
- import { BatchId, BeeRequestOptions, Reference, UploadOptions } from '../types';
1
+ import { BatchId, BeeRequestOptions, UploadOptions, UploadResult } from '../types';
2
2
  /**
3
3
  * Upload single owner chunk (SOC) to a Bee node
4
4
  *
@@ -10,4 +10,4 @@ import { BatchId, BeeRequestOptions, Reference, UploadOptions } from '../types';
10
10
  * @param postageBatchId Postage BatchId that will be assigned to uploaded data
11
11
  * @param options Additional options like tag, encryption, pinning
12
12
  */
13
- export declare function upload(requestOptions: BeeRequestOptions, owner: string, identifier: string, signature: string, data: Uint8Array, postageBatchId: BatchId, options?: UploadOptions): Promise<Reference>;
13
+ export declare function upload(requestOptions: BeeRequestOptions, owner: string, identifier: string, signature: string, data: Uint8Array, postageBatchId: BatchId, options?: UploadOptions): Promise<UploadResult>;
@@ -81,6 +81,17 @@ export interface BeeOptions extends BeeRequestOptions {
81
81
  */
82
82
  signer?: Signer | Uint8Array | string;
83
83
  }
84
+ export interface GranteesResult {
85
+ status: number;
86
+ statusText: string;
87
+ ref: Reference;
88
+ historyref: Reference;
89
+ }
90
+ export interface GetGranteesResult {
91
+ status: number;
92
+ statusText: string;
93
+ data: string[];
94
+ }
84
95
  export interface UploadResultWithCid extends UploadResult {
85
96
  /**
86
97
  * Function that converts the reference into Swarm CIDs
@@ -102,8 +113,17 @@ export interface UploadResult {
102
113
  * Automatically created tag's UID.
103
114
  */
104
115
  tagUid?: number;
116
+ /**
117
+ * History address of the uploaded data with ACT.
118
+ */
119
+ historyAddress: string;
105
120
  }
106
121
  export interface UploadOptions {
122
+ /**
123
+ * If set to true, an ACT will be created for the uploaded data.
124
+ *
125
+ */
126
+ act?: boolean;
107
127
  /**
108
128
  * Will pin the data locally in the Bee node as well.
109
129
  *
@@ -216,6 +236,7 @@ export interface CollectionUploadOptions extends UploadOptions {
216
236
  errorDocument?: string;
217
237
  }
218
238
  export interface UploadHeaders {
239
+ 'swarm-act'?: string;
219
240
  'swarm-pin'?: string;
220
241
  'swarm-encrypt'?: string;
221
242
  'swarm-tag'?: string;
@@ -399,9 +420,9 @@ export interface FeedWriter extends FeedReader {
399
420
  * @param reference The reference to be stored in the new update
400
421
  * @param options Additional options like `at`
401
422
  *
402
- * @returns Reference that points at Single Owner Chunk that contains the new update and pointer to the updated chunk reference.
423
+ * @returns UpdateResult that points at Single Owner Chunk that contains the new update and pointer to the updated chunk reference.
403
424
  */
404
- upload(postageBatchId: string | BatchId, reference: BytesReference | Reference, options?: FeedUploadOptions): Promise<Reference>;
425
+ upload(postageBatchId: string | BatchId, reference: BytesReference | Reference, options?: FeedUploadOptions): Promise<UploadResult>;
405
426
  }
406
427
  /**
407
428
  * Interface for downloading single owner chunks
@@ -426,7 +447,7 @@ export interface SOCWriter extends SOCReader {
426
447
  * @param data The chunk payload data
427
448
  * @param options Upload options
428
449
  */
429
- upload: (postageBatchId: string | BatchId, identifier: Identifier, data: Uint8Array, options?: UploadOptions) => Promise<Reference>;
450
+ upload: (postageBatchId: string | BatchId, identifier: Identifier, data: Uint8Array, options?: UploadOptions) => Promise<UploadResult>;
430
451
  }
431
452
  /**
432
453
  * Interface representing Postage stamp batch.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethersphere/bee-js",
3
- "version": "7.1.2",
3
+ "version": "8.0.1",
4
4
  "description": "Javascript client for Bee",
5
5
  "keywords": [
6
6
  "bee",