@ethersphere/bee-js 9.7.0 → 9.7.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/cjs/bee.js +2 -1
- package/dist/cjs/utils/chunk-stream.js +15 -3
- package/dist/cjs/utils/http.js +1 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee.js +2 -1
- package/dist/mjs/utils/chunk-stream.js +14 -3
- package/dist/mjs/utils/http.js +1 -1
- package/dist/types/bee.d.ts +1 -1
- package/dist/types/utils/chunk-stream.d.ts +2 -2
- package/package.json +3 -3
package/dist/mjs/bee.js
CHANGED
|
@@ -695,7 +695,8 @@ export class Bee {
|
|
|
695
695
|
for (let i = 0n; i < 0xffffn; i++) {
|
|
696
696
|
const signer = new PrivateKey(Binary.numberToUint256(start + i, 'BE'));
|
|
697
697
|
const socAddress = makeSOCAddress(identifier, signer.publicKey().address());
|
|
698
|
-
|
|
698
|
+
// TODO: test the significance of the hardcoded 256
|
|
699
|
+
const actualProximity = 256 - Binary.proximity(socAddress.toUint8Array(), targetOverlay.toUint8Array());
|
|
699
700
|
if (actualProximity <= 256 - proximity) {
|
|
700
701
|
return signer;
|
|
701
702
|
}
|
|
@@ -39,6 +39,7 @@ export async function streamDirectory(bee, dir, postageBatchId, onUploadProgress
|
|
|
39
39
|
for (const file of files) {
|
|
40
40
|
total += totalChunks(file.size);
|
|
41
41
|
}
|
|
42
|
+
let hasIndexHtml = false;
|
|
42
43
|
async function onChunk(chunk) {
|
|
43
44
|
await queue.enqueue(async () => {
|
|
44
45
|
await bee.uploadChunk(postageBatchId, chunk.build(), options, requestOptions);
|
|
@@ -69,10 +70,20 @@ export async function streamDirectory(bee, dir, postageBatchId, onUploadProgress
|
|
|
69
70
|
Filename: filename
|
|
70
71
|
});
|
|
71
72
|
if (file.path === 'index.html') {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
hasIndexHtml = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (hasIndexHtml || options?.indexDocument || options?.errorDocument) {
|
|
77
|
+
const metadata = {};
|
|
78
|
+
if (options?.indexDocument) {
|
|
79
|
+
metadata['website-index-document'] = options.indexDocument;
|
|
80
|
+
} else if (hasIndexHtml) {
|
|
81
|
+
metadata['website-index-document'] = 'index.html';
|
|
82
|
+
}
|
|
83
|
+
if (options?.errorDocument) {
|
|
84
|
+
metadata['website-error-document'] = options.errorDocument;
|
|
75
85
|
}
|
|
86
|
+
mantaray.addFork('/', NULL_ADDRESS, metadata);
|
|
76
87
|
}
|
|
77
88
|
return mantaray.saveRecursively(bee, postageBatchId, options, requestOptions);
|
|
78
89
|
}
|
package/dist/mjs/utils/http.js
CHANGED
|
@@ -59,7 +59,7 @@ function maybeRunOnRequestHook(options, requestConfig) {
|
|
|
59
59
|
if (options.onRequest) {
|
|
60
60
|
options.onRequest({
|
|
61
61
|
method: requestConfig.method || 'GET',
|
|
62
|
-
url: Strings.joinUrl(requestConfig.baseURL, requestConfig.url),
|
|
62
|
+
url: Strings.joinUrl([requestConfig.baseURL, requestConfig.url]),
|
|
63
63
|
headers: {
|
|
64
64
|
...requestConfig.headers
|
|
65
65
|
},
|
package/dist/types/bee.d.ts
CHANGED
|
@@ -193,7 +193,7 @@ export declare class Bee {
|
|
|
193
193
|
*/
|
|
194
194
|
uploadFiles(postageBatchId: BatchId | Uint8Array | string, fileList: FileList | File[], options?: CollectionUploadOptions, requestOptions?: BeeRequestOptions): Promise<UploadResult>;
|
|
195
195
|
hashDirectory(dir: string): Promise<Reference>;
|
|
196
|
-
streamDirectory(postageBatchId: BatchId | Uint8Array | string, dir: string, onUploadProgress?: (progress: UploadProgress) => void, options?:
|
|
196
|
+
streamDirectory(postageBatchId: BatchId | Uint8Array | string, dir: string, onUploadProgress?: (progress: UploadProgress) => void, options?: CollectionUploadOptions, requestOptions?: BeeRequestOptions): Promise<UploadResult>;
|
|
197
197
|
streamFiles(postageBatchId: BatchId | Uint8Array | string, files: File[] | FileList, onUploadProgress?: (progress: UploadProgress) => void, options?: UploadOptions, requestOptions?: BeeRequestOptions): Promise<UploadResult>;
|
|
198
198
|
/**
|
|
199
199
|
* Upload Collection that you can assembly yourself.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Bee, BeeRequestOptions, UploadOptions, UploadResult } from '..';
|
|
1
|
+
import { Bee, BeeRequestOptions, CollectionUploadOptions, UploadOptions, UploadResult } from '..';
|
|
2
2
|
import { BatchId } from './typed-bytes';
|
|
3
3
|
import { UploadProgress } from './upload-progress';
|
|
4
4
|
export declare function hashDirectory(dir: string): Promise<import("./typed-bytes").Reference>;
|
|
5
|
-
export declare function streamDirectory(bee: Bee, dir: string, postageBatchId: BatchId | string | Uint8Array, onUploadProgress?: (progress: UploadProgress) => void, options?:
|
|
5
|
+
export declare function streamDirectory(bee: Bee, dir: string, postageBatchId: BatchId | string | Uint8Array, onUploadProgress?: (progress: UploadProgress) => void, options?: CollectionUploadOptions, requestOptions?: BeeRequestOptions): Promise<UploadResult>;
|
|
6
6
|
export declare function streamFiles(_bee: Bee, _files: File[] | FileList, _postageBatchId: BatchId, _onUploadProgress?: (progress: UploadProgress) => void, _options?: UploadOptions, _requestOptions?: BeeRequestOptions): Promise<UploadResult>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethersphere/bee-js",
|
|
3
|
-
"version": "9.7.
|
|
3
|
+
"version": "9.7.1",
|
|
4
4
|
"description": "Javascript client for Bee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bee",
|
|
@@ -55,14 +55,14 @@
|
|
|
55
55
|
"build:node": "tsc -p tsconfig.json && tsc -p tsconfig-mjs.json && ./build-fixup && babel --plugins \"babel-plugin-add-import-extension\" --out-dir dist/mjs/ dist/mjs/",
|
|
56
56
|
"build:types": "tsc --emitDeclarationOnly --declaration --outDir dist/types",
|
|
57
57
|
"build:browser": "webpack --progress",
|
|
58
|
-
"test": "jest --config=jest.config.ts --runInBand --verbose",
|
|
58
|
+
"test": "jest --config=jest.config.ts --runInBand --verbose --forceExit",
|
|
59
59
|
"check": "tsc --project tsconfig.test.json",
|
|
60
60
|
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\" && prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
61
61
|
"depcheck": "depcheck ."
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"axios": "^0.30.0",
|
|
65
|
-
"cafe-utility": "^
|
|
65
|
+
"cafe-utility": "^31.0.0",
|
|
66
66
|
"isomorphic-ws": "^4.0.1",
|
|
67
67
|
"semver": "^7.3.5",
|
|
68
68
|
"ws": "^8.7.0"
|