Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
296 changes: 263 additions & 33 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],
"types": "dist/index.d.ts",
"scripts": {
"prepare": "rimraf dist && npm run compile:types && npm run compile:browser --env mode=production && npm run compile:node --env mode=production",
"prepare": "rimraf dist && npm run compile:types && npm run compile:browser --env mode=production",
"compile:node": "webpack --progress --env target=node",
"compile:types": "tsc --emitDeclarationOnly --declaration",
"compile:browser": "webpack --progress --env target=web",
Expand All @@ -53,7 +53,7 @@
"depcheck": "depcheck ."
},
"dependencies": {
"@ethersphere/bee-js": "^6.2.0",
"@ethersphere/bee-js": "github:fairDataSociety/bee-js",
"@fairdatasociety/fdp-contracts-js": "^3.7.1",
"crypto-js": "^4.1.1",
"ethers": "^5.5.2",
Expand Down
6 changes: 3 additions & 3 deletions src/content-items/handler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Connection } from '../connection/connection'
import { utils } from 'ethers'
import { Reference, BeeRequestOptions } from '@ethersphere/bee-js'
import { Reference, RequestOptions } from '@ethersphere/bee-js'
import { getUnixTimestamp } from '../utils/time'
import { writeFeedData } from '../feed/api'
import { getRawDirectoryMetadataBytes } from '../directory/adapter'
Expand Down Expand Up @@ -37,7 +37,7 @@ export async function addEntryToDirectory(
parentPath: string,
entryPath: string,
isFile: boolean,
downloadOptions?: BeeRequestOptions,
downloadOptions?: RequestOptions,
): Promise<Reference> {
if (!parentPath) {
throw new Error('Incorrect parent path')
Expand Down Expand Up @@ -137,7 +137,7 @@ export async function removeEntryFromDirectory(
parentPath: string,
entryPath: string,
isFile: boolean,
downloadOptions?: BeeRequestOptions,
downloadOptions?: RequestOptions,
): Promise<Reference> {
const metadataWithEpoch = await getRawMetadata(
connection.bee,
Expand Down
4 changes: 2 additions & 2 deletions src/content-items/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Epoch } from '../feed/lookup/epoch'
import { RawDirectoryMetadata, RawFileMetadata } from '../pod/types'
import { BeeRequestOptions } from '@ethersphere/bee-js'
import { RequestOptions } from '@ethersphere/bee-js'
import { CacheInfo } from '../cache/types'
import { LookupAnswer } from '../feed/types'

Expand All @@ -18,7 +18,7 @@ export interface PathInformation {
* Download data options
*/
export interface DownloadOptions {
requestOptions?: BeeRequestOptions
requestOptions?: RequestOptions
cacheInfo?: CacheInfo
}

Expand Down
12 changes: 6 additions & 6 deletions src/content-items/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Bee, Reference, BeeRequestOptions } from '@ethersphere/bee-js'
import { Bee, Reference, RequestOptions } from '@ethersphere/bee-js'
import { EthAddress } from '@ethersphere/bee-js/dist/types/utils/eth'
import { RawDirectoryMetadata, RawFileMetadata } from '../pod/types'
import { DELETE_FEED_MAGIC_WORD, getFeedData, writeFeedData } from '../feed/api'
Expand Down Expand Up @@ -26,7 +26,7 @@ export async function getRawMetadata(
path: string,
address: EthAddress,
podPassword: PodPasswordBytes,
requestOptions?: BeeRequestOptions,
requestOptions?: RequestOptions,
): Promise<RawMetadataWithEpoch> {
const feedData = await getFeedData(bee, path, address, requestOptions)
const data = decryptJson(podPassword, feedData.data.chunkContent())
Expand Down Expand Up @@ -58,7 +58,7 @@ export async function isItemExists(
bee: Bee,
fullPath: string,
address: EthAddress,
requestOptions: BeeRequestOptions | undefined,
requestOptions: RequestOptions | undefined,
): Promise<boolean> {
try {
return (await getFeedData(bee, fullPath, address, requestOptions)).data.text() === DELETE_FEED_MAGIC_WORD
Expand All @@ -81,7 +81,7 @@ export async function assertItemIsNotExists(
bee: Bee,
fullPath: string,
address: EthAddress,
downloadOptions: BeeRequestOptions | undefined,
downloadOptions: RequestOptions | undefined,
): Promise<void> {
if (await isItemExists(bee, fullPath, address, downloadOptions)) {
throw new Error(`${contentType} "${fullPath}" already uploaded to the network`)
Expand Down Expand Up @@ -129,7 +129,7 @@ export async function getPathInfo(
bee: Bee,
path: string,
address: EthAddress,
requestOptions?: BeeRequestOptions,
requestOptions?: RequestOptions,
): Promise<PathInformation> {
const lookupAnswer = await getFeedData(bee, path, address, requestOptions)

Expand Down Expand Up @@ -160,7 +160,7 @@ export async function getCreationPathInfo(
bee: Bee,
fullPath: string,
address: EthAddress,
requestOptions?: BeeRequestOptions,
requestOptions?: RequestOptions,
): Promise<PathInformation | undefined> {
// check that if directory uploaded - than it should be marked as deleted
let pathInfo
Expand Down
6 changes: 3 additions & 3 deletions src/directory/handler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { writeFeedData } from '../feed/api'
import { EthAddress } from '@ethersphere/bee-js/dist/types/utils/eth'
import { Bee, Reference, BeeRequestOptions } from '@ethersphere/bee-js'
import { Bee, Reference, RequestOptions } from '@ethersphere/bee-js'
import {
assertDirectoryName,
assertPartsLength,
Expand Down Expand Up @@ -69,7 +69,7 @@ export async function readDirectory(
address: EthAddress,
podPassword: PodPasswordBytes,
isRecursive?: boolean,
downloadOptions?: BeeRequestOptions,
downloadOptions?: RequestOptions,
): Promise<DirectoryItem> {
const parentRawDirectoryMetadata = (await getRawMetadata(bee, path, address, podPassword, downloadOptions)).metadata
assertRawDirectoryMetadata(parentRawDirectoryMetadata)
Expand Down Expand Up @@ -160,7 +160,7 @@ export async function createDirectory(
fullPath: string,
podWallet: utils.HDNode,
podPassword: PodPasswordBytes,
downloadOptions?: BeeRequestOptions,
downloadOptions?: RequestOptions,
): Promise<void> {
const parts = getPathParts(fullPath)
assertPartsLength(parts)
Expand Down
4 changes: 2 additions & 2 deletions src/feed/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Bee, Data, Reference, BeeRequestOptions, Utils } from '@ethersphere/bee-js'
import { Bee, Data, Reference, RequestOptions, Utils } from '@ethersphere/bee-js'
import { bmtHashString } from '../account/utils'
import { getId } from './handler'
import { lookup } from './lookup/linear'
Expand Down Expand Up @@ -27,7 +27,7 @@ export async function getFeedData(
bee: Bee,
topic: string,
address: Utils.EthAddress | Uint8Array,
requestOptions?: BeeRequestOptions,
requestOptions?: RequestOptions,
): Promise<LookupAnswer> {
const topicHash = bmtHashString(topic)

Expand Down
6 changes: 3 additions & 3 deletions src/file/handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { stringToBytes, wrapBytesWithHelpers } from '../utils/bytes'
import { Bee, Data, BeeRequestOptions } from '@ethersphere/bee-js'
import { Bee, Data, RequestOptions } from '@ethersphere/bee-js'
import { EthAddress } from '@ethersphere/bee-js/dist/types/utils/eth'
import {
assertFullPathWithName,
Expand Down Expand Up @@ -47,7 +47,7 @@ export async function getFileMetadata(
path: string,
address: EthAddress,
podPassword: PodPasswordBytes,
downloadOptions?: BeeRequestOptions,
downloadOptions?: RequestOptions,
): Promise<FileMetadata> {
const data = (await getRawMetadata(bee, path, address, podPassword, downloadOptions)).metadata
assertRawFileMetadata(data)
Expand All @@ -69,7 +69,7 @@ export async function downloadData(
fullPath: string,
address: EthAddress,
podPassword: PodPasswordBytes,
downloadOptions?: BeeRequestOptions,
downloadOptions?: RequestOptions,
): Promise<Data> {
const fileMetadata = await getFileMetadata(bee, fullPath, address, podPassword, downloadOptions)

Expand Down
4 changes: 2 additions & 2 deletions src/file/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Connection } from '../connection/connection'
import { Bee, Reference, BeeRequestOptions, UploadResult } from '@ethersphere/bee-js'
import { Bee, Reference, RequestOptions, UploadResult } from '@ethersphere/bee-js'
import { PathInfo } from '../pod/utils'
import { Blocks, FileShareInfo, RawBlock, RawBlocks } from './types'
import { rawBlocksToBlocks } from './adapter'
Expand Down Expand Up @@ -109,7 +109,7 @@ export function getBaseName(path: string): string | undefined {
export async function downloadBlocksManifest(
bee: Bee,
reference: Reference,
downloadOptions?: BeeRequestOptions,
downloadOptions?: RequestOptions,
): Promise<Blocks> {
const data = (await bee.downloadData(reference, downloadOptions)).text()
const rawBlocks = jsonParse(data, 'blocks manifest')
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BeeRequestOptions } from '@ethersphere/bee-js'
import { RequestOptions } from '@ethersphere/bee-js'
import { EnsEnvironment } from '@fairdatasociety/fdp-contracts-js'
import { CacheOptions } from './cache/types'

Expand All @@ -11,7 +11,7 @@ export interface Options {
/**
* Request options
*/
requestOptions?: BeeRequestOptions
requestOptions?: RequestOptions
/**
* FDP-contracts options
*/
Expand Down