New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ethersphere/bee-js

Package Overview
Dependencies
Maintainers
2
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethersphere/bee-js - npm Package Compare versions

Comparing version 7.1.2 to 8.0.0

dist/cjs/modules/grantee.js

1

dist/cjs/modules/bytes.js

@@ -31,2 +31,3 @@ "use strict";

tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
historyAddress: response.headers['swarm-act-history-address'] || '',
};

@@ -33,0 +34,0 @@ }

@@ -48,2 +48,3 @@ "use strict";

tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
historyAddress: response.headers['swarm-act-history-address'] || '',
};

@@ -118,4 +119,5 @@ }

tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
historyAddress: response.headers['swarm-act-history-address'] || '',
};
}
exports.uploadCollection = uploadCollection;

@@ -7,2 +7,3 @@ "use strict";

const http_1 = require("../utils/http");
const type_1 = require("../utils/type");
const endpoint = 'chunks';

@@ -32,3 +33,7 @@ /**

});
return response.data.reference;
return {
reference: response.data.reference,
tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
historyAddress: response.headers['swarm-act-history-address'] || '',
};
}

@@ -35,0 +40,0 @@ exports.upload = upload;

@@ -6,2 +6,3 @@ "use strict";

const http_1 = require("../utils/http");
const type_1 = require("../utils/type");
const socEndpoint = 'soc';

@@ -31,4 +32,8 @@ /**

});
return response.data.reference;
return {
reference: response.data.reference,
tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
historyAddress: response.headers['swarm-act-history-address'] || '',
};
}
exports.upload = upload;

@@ -49,2 +49,5 @@ "use strict";

};
if (options?.act) {
headers['swarm-act'] = String(options.act);
}
if (options?.pin) {

@@ -51,0 +54,0 @@ headers['swarm-pin'] = String(options.pin);

@@ -28,2 +28,7 @@ "use strict";

const response = await (0, axios_1.default)(requestConfig);
// Axios does not parse array of strings as JSON
if (Array.isArray(response.data) && response.data.every(element => typeof element === 'string')) {
const array = response.data;
response.data = { data: array };
}
// TODO: https://github.com/axios/axios/pull/6253

@@ -30,0 +35,0 @@ return response;

@@ -24,2 +24,3 @@ import { ReferenceType } from '@ethersphere/swarm-cid';

import { createFeedManifest } from "./modules/feed.js";
import * as grantee from "./modules/grantee.js";
import * as pinning from "./modules/pinning.js";

@@ -155,5 +156,46 @@ import * as pss from "./modules/pss.js";

/**
* Create a grantees list from the given array of public keys.
*
* The grantees list can be obtained with the `getGrantees` method.
*
* @param postageBatchId - The ID of the postage batch.
* @param grantees - An array of public keys representing the grantees.
* @param requestOptions - Optional request options.
* @returns A promise that resolves to a `GranteesResult` object.
*/
async createGrantees(postageBatchId, grantees, requestOptions) {
assertBatchId(postageBatchId);
return grantee.createGrantees(this.getRequestOptionsForCall(requestOptions), postageBatchId, grantees);
}
/**
* Retrieves the grantees for a given reference.
*
* @param reference - The reference.
* @param requestOptions - Optional request options.
* @returns A promise that resolves to a `GetGranteesResult` object.
*/
async getGrantees(reference, requestOptions) {
return grantee.getGrantees(reference, this.getRequestOptionsForCall(requestOptions));
}
/**
* Updates the grantees of a specific reference and history.
*
* @param reference - The reference.
* @param history - The history.
* @param postageBatchId - The ID of the postage batch.
* @param grantees - The grantees.
* @param requestOptions - Optional request options.
* @returns A Promise that resolves to to a `GranteesResult` object.
*/
async patchGrantees(postageBatchId, reference, history, grantees, requestOptions) {
assertBatchId(postageBatchId);
return grantee.patchGrantees(postageBatchId, reference, history, {
add: grantees.add || [],
revoke: grantees.revoke || []
}, this.getRequestOptionsForCall(requestOptions));
}
/**
* Upload single file to a Bee node.
*
* **To make sure that you won't loose critical data it is highly recommended to also
* **To make sure that you won't lose critical data it is highly recommended to also
* locally pin the data with `options.pin = true`**

@@ -160,0 +202,0 @@ *

3

dist/mjs/modules/bytes.js

@@ -27,3 +27,4 @@ import { wrapBytesWithHelpers } from "../utils/bytes.js";

reference: response.data.reference,
tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined
tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined,
historyAddress: response.headers['swarm-act-history-address'] || ''
};

@@ -30,0 +31,0 @@ }

@@ -44,3 +44,4 @@ import { wrapBytesWithHelpers } from "../utils/bytes.js";

reference: response.data.reference,
tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined
tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined,
historyAddress: response.headers['swarm-act-history-address'] || ''
};

@@ -110,4 +111,5 @@ }

reference: response.data.reference,
tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined
tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined,
historyAddress: response.headers['swarm-act-history-address'] || ''
};
}
import { wrapBytesWithHelpers } from "../utils/bytes.js";
import { extractUploadHeaders } from "../utils/headers.js";
import { http } from "../utils/http.js";
import { makeTagUid } from "../utils/type.js";
const endpoint = 'chunks';

@@ -28,3 +29,7 @@ /**

});
return response.data.reference;
return {
reference: response.data.reference,
tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined,
historyAddress: response.headers['swarm-act-history-address'] || ''
};
}

@@ -31,0 +36,0 @@ /**

import { extractUploadHeaders } from "../utils/headers.js";
import { http } from "../utils/http.js";
import { makeTagUid } from "../utils/type.js";
const socEndpoint = 'soc';

@@ -29,3 +30,7 @@ /**

});
return response.data.reference;
return {
reference: response.data.reference,
tagUid: response.headers['swarm-tag'] ? makeTagUid(response.headers['swarm-tag']) : undefined,
historyAddress: response.headers['swarm-act-history-address'] || ''
};
}

@@ -45,2 +45,5 @@ import { BeeError } from "./error.js";

};
if (options?.act) {
headers['swarm-act'] = String(options.act);
}
if (options?.pin) {

@@ -47,0 +50,0 @@ headers['swarm-pin'] = String(options.pin);

@@ -24,2 +24,9 @@ import axios from 'axios';

const response = await axios(requestConfig);
// Axios does not parse array of strings as JSON
if (Array.isArray(response.data) && response.data.every(element => typeof element === 'string')) {
const array = response.data;
response.data = {
data: array
};
}
// TODO: https://github.com/axios/axios/pull/6253

@@ -26,0 +33,0 @@ return response;

@@ -5,3 +5,3 @@ /// <reference types="node" />

import { FeedType } from './feed/type';
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';
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';
import { AllTagsOptions, CashoutOptions, Collection, FeedManifestResult, PostageBatchOptions, ReferenceCidOrEns, ReferenceOrEns, TransactionOptions, UploadResult } from './types';

@@ -79,3 +79,3 @@ import { EthAddress } from './utils/eth';

*/
uploadChunk(postageBatchId: string | BatchId, data: Uint8Array, options?: UploadOptions, requestOptions?: BeeRequestOptions): Promise<Reference>;
uploadChunk(postageBatchId: string | BatchId, data: Uint8Array, options?: UploadOptions, requestOptions?: BeeRequestOptions): Promise<UploadResult>;
/**

@@ -93,5 +93,38 @@ * Download chunk as a byte array

/**
* Create a grantees list from the given array of public keys.
*
* The grantees list can be obtained with the `getGrantees` method.
*
* @param postageBatchId - The ID of the postage batch.
* @param grantees - An array of public keys representing the grantees.
* @param requestOptions - Optional request options.
* @returns A promise that resolves to a `GranteesResult` object.
*/
createGrantees(postageBatchId: string | BatchId, grantees: string[], requestOptions?: BeeRequestOptions): Promise<GranteesResult>;
/**
* Retrieves the grantees for a given reference.
*
* @param reference - The reference.
* @param requestOptions - Optional request options.
* @returns A promise that resolves to a `GetGranteesResult` object.
*/
getGrantees(reference: ReferenceOrEns | string, requestOptions?: BeeRequestOptions): Promise<GetGranteesResult>;
/**
* Updates the grantees of a specific reference and history.
*
* @param reference - The reference.
* @param history - The history.
* @param postageBatchId - The ID of the postage batch.
* @param grantees - The grantees.
* @param requestOptions - Optional request options.
* @returns A Promise that resolves to to a `GranteesResult` object.
*/
patchGrantees(postageBatchId: string | BatchId, reference: Reference | string, history: Reference | string, grantees: {
add?: string[];
revoke?: string[];
}, requestOptions?: BeeRequestOptions): Promise<GranteesResult>;
/**
* Upload single file to a Bee node.
*
* **To make sure that you won't loose critical data it is highly recommended to also
* **To make sure that you won't lose critical data it is highly recommended to also
* locally pin the data with `options.pin = true`**

@@ -437,3 +470,3 @@ *

*/
setJsonFeed<T extends AnyJson>(postageBatchId: string | BatchId, topic: string, data: T, options?: JsonFeedOptions, requestOptions?: BeeRequestOptions): Promise<Reference>;
setJsonFeed<T extends AnyJson>(postageBatchId: string | BatchId, topic: string, data: T, options?: JsonFeedOptions, requestOptions?: BeeRequestOptions): Promise<UploadResult>;
/**

@@ -440,0 +473,0 @@ * High-level function that allows you to easily get data from feed.

@@ -1,2 +0,2 @@

import { BatchId, BeeRequestOptions, PlainBytesReference, Reference, Signature, Signer, UploadOptions } from '../types';
import { BatchId, BeeRequestOptions, PlainBytesReference, Signature, Signer, UploadOptions, UploadResult } from '../types';
import { Bytes } from '../utils/bytes';

@@ -47,3 +47,3 @@ import { EthAddress } from '../utils/eth';

*/
export declare function uploadSingleOwnerChunk(requestOptions: BeeRequestOptions, chunk: SingleOwnerChunk, postageBatchId: BatchId, options?: UploadOptions): Promise<Reference>;
export declare function uploadSingleOwnerChunk(requestOptions: BeeRequestOptions, chunk: SingleOwnerChunk, postageBatchId: BatchId, options?: UploadOptions): Promise<UploadResult>;
/**

@@ -59,3 +59,3 @@ * Helper function to create and upload SOC.

*/
export declare function uploadSingleOwnerChunkData(requestOptions: BeeRequestOptions, signer: Signer, postageBatchId: BatchId | string, identifier: Identifier, data: Uint8Array, options?: UploadOptions): Promise<Reference>;
export declare function uploadSingleOwnerChunkData(requestOptions: BeeRequestOptions, signer: Signer, postageBatchId: BatchId | string, identifier: Identifier, data: Uint8Array, options?: UploadOptions): Promise<UploadResult>;
/**

@@ -62,0 +62,0 @@ * Helper function to download SOC.

import { FeedUpdateOptions } from '../modules/feed';
import { BatchId, BeeRequestOptions, BytesReference, FEED_INDEX_HEX_LENGTH, FeedReader, FeedWriter, PlainBytesReference, Reference, Signer, Topic, UploadOptions } from '../types';
import { BatchId, BeeRequestOptions, BytesReference, FEED_INDEX_HEX_LENGTH, FeedReader, FeedWriter, PlainBytesReference, Signer, Topic, UploadOptions, UploadResult } from '../types';
import { Bytes } from '../utils/bytes';

@@ -24,3 +24,3 @@ import { EthAddress, HexEthAddress } from '../utils/eth';

export declare function findNextIndex(requestOptions: BeeRequestOptions, owner: HexEthAddress, topic: Topic, options?: FeedUpdateOptions): Promise<HexString<typeof FEED_INDEX_HEX_LENGTH>>;
export declare function updateFeed(requestOptions: BeeRequestOptions, signer: Signer, topic: Topic, reference: BytesReference, postageBatchId: BatchId, options?: FeedUploadOptions): Promise<Reference>;
export declare function updateFeed(requestOptions: BeeRequestOptions, signer: Signer, topic: Topic, reference: BytesReference, postageBatchId: BatchId, options?: FeedUploadOptions): Promise<UploadResult>;
export declare function getFeedUpdateChunkReference(owner: EthAddress, topic: Topic, index: Index): PlainBytesReference;

@@ -27,0 +27,0 @@ export declare function downloadFeedUpdate(requestOptions: BeeRequestOptions, owner: EthAddress, topic: Topic, index: Index): Promise<FeedUpdate>;

import { Bee } from '../bee';
import { AnyJson, BatchId, BeeRequestOptions, FeedReader, FeedWriter, JsonFeedOptions, Reference, UploadOptions } from '../types';
import { AnyJson, BatchId, BeeRequestOptions, FeedReader, FeedWriter, JsonFeedOptions, UploadOptions, UploadResult } from '../types';
export declare function getJsonData<T extends AnyJson>(bee: Bee, reader: FeedReader): Promise<T>;
export declare function setJsonData(bee: Bee, writer: FeedWriter, postageBatchId: BatchId, data: AnyJson, options?: JsonFeedOptions & UploadOptions, requestOptions?: BeeRequestOptions): Promise<Reference>;
export declare function setJsonData(bee: Bee, writer: FeedWriter, postageBatchId: BatchId, data: AnyJson, options?: JsonFeedOptions & UploadOptions, requestOptions?: BeeRequestOptions): Promise<UploadResult>;

@@ -1,2 +0,2 @@

import type { BatchId, BeeRequestOptions, Data, Reference, ReferenceOrEns, UploadOptions } from '../types';
import type { BatchId, BeeRequestOptions, Data, ReferenceOrEns, UploadOptions, UploadResult } from '../types';
/**

@@ -14,3 +14,3 @@ * Upload chunk to a Bee node

*/
export declare function upload(requestOptions: BeeRequestOptions, data: Uint8Array, postageBatchId: BatchId, options?: UploadOptions): Promise<Reference>;
export declare function upload(requestOptions: BeeRequestOptions, data: Uint8Array, postageBatchId: BatchId, options?: UploadOptions): Promise<UploadResult>;
/**

@@ -17,0 +17,0 @@ * Download chunk data as a byte array

@@ -1,2 +0,2 @@

import { BatchId, BeeRequestOptions, Reference, UploadOptions } from '../types';
import { BatchId, BeeRequestOptions, UploadOptions, UploadResult } from '../types';
/**

@@ -13,2 +13,2 @@ * Upload single owner chunk (SOC) to a Bee node

*/
export declare function upload(requestOptions: BeeRequestOptions, owner: string, identifier: string, signature: string, data: Uint8Array, postageBatchId: BatchId, options?: UploadOptions): Promise<Reference>;
export declare function upload(requestOptions: BeeRequestOptions, owner: string, identifier: string, signature: string, data: Uint8Array, postageBatchId: BatchId, options?: UploadOptions): Promise<UploadResult>;

@@ -84,2 +84,13 @@ import type { Identifier, SingleOwnerChunk } from '../chunk/soc';

}
export interface GranteesResult {
status: number;
statusText: string;
ref: Reference;
historyref: Reference;
}
export interface GetGranteesResult {
status: number;
statusText: string;
data: string[];
}
export interface UploadResultWithCid extends UploadResult {

@@ -106,5 +117,14 @@ /**

tagUid?: number;
/**
* History address of the uploaded data with ACT.
*/
historyAddress: string;
}
export interface UploadOptions {
/**
* If set to true, an ACT will be created for the uploaded data.
*
*/
act?: boolean;
/**
* Will pin the data locally in the Bee node as well.

@@ -221,2 +241,3 @@ *

export interface UploadHeaders {
'swarm-act'?: string;
'swarm-pin'?: string;

@@ -405,5 +426,5 @@ 'swarm-encrypt'?: string;

*
* @returns Reference that points at Single Owner Chunk that contains the new update and pointer to the updated chunk reference.
* @returns UpdateResult that points at Single Owner Chunk that contains the new update and pointer to the updated chunk reference.
*/
upload(postageBatchId: string | BatchId, reference: BytesReference | Reference, options?: FeedUploadOptions): Promise<Reference>;
upload(postageBatchId: string | BatchId, reference: BytesReference | Reference, options?: FeedUploadOptions): Promise<UploadResult>;
}

@@ -433,3 +454,3 @@ /**

*/
upload: (postageBatchId: string | BatchId, identifier: Identifier, data: Uint8Array, options?: UploadOptions) => Promise<Reference>;
upload: (postageBatchId: string | BatchId, identifier: Identifier, data: Uint8Array, options?: UploadOptions) => Promise<UploadResult>;
}

@@ -436,0 +457,0 @@ /**

{
"name": "@ethersphere/bee-js",
"version": "7.1.2",
"version": "8.0.0",
"description": "Javascript client for Bee",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc