@net-protocol/storage 0.1.10 → 0.1.12
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/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -4
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/package.json +9 -2
package/dist/index.d.mts
CHANGED
|
@@ -183,6 +183,7 @@ declare class StorageClient {
|
|
|
183
183
|
filename?: string;
|
|
184
184
|
useChunkedStorageBackend?: boolean;
|
|
185
185
|
keyFormat?: "raw" | "bytes32";
|
|
186
|
+
chunkSize?: number;
|
|
186
187
|
}): {
|
|
187
188
|
transactionConfigs: WriteTransactionConfig[];
|
|
188
189
|
topLevelHash: string;
|
|
@@ -297,6 +298,7 @@ declare function resolveOperator(reference: XmlReference, defaultOperator: strin
|
|
|
297
298
|
*/
|
|
298
299
|
declare function getReferenceKey(reference: XmlReference, defaultOperator: string): string;
|
|
299
300
|
|
|
301
|
+
declare const OPTIMAL_CHUNK_SIZE: number;
|
|
300
302
|
/**
|
|
301
303
|
* Split data into chunks of specified size
|
|
302
304
|
*/
|
|
@@ -325,7 +327,7 @@ declare function computeTopLevelHash(chunkHashes: string[]): string;
|
|
|
325
327
|
/**
|
|
326
328
|
* Complete chunking and hash generation process
|
|
327
329
|
*/
|
|
328
|
-
declare function processDataForStorage(data: string, operatorAddress: string, storageKey?: string): {
|
|
330
|
+
declare function processDataForStorage(data: string, operatorAddress: string, storageKey?: string, chunkSize?: number): {
|
|
329
331
|
chunks: string[];
|
|
330
332
|
chunkHashes: string[];
|
|
331
333
|
xmlMetadata: string;
|
|
@@ -512,4 +514,4 @@ declare const CONCURRENT_XML_FETCHES = 3;
|
|
|
512
514
|
*/
|
|
513
515
|
declare function resolveXmlRecursive(content: string, defaultOperator: string, client: PublicClient, maxDepth: number, visited?: Set<string>, inheritedOperator?: string): Promise<string>;
|
|
514
516
|
|
|
515
|
-
export { BulkStorageKey, CHUNKED_STORAGE_CONTRACT, CHUNKED_STORAGE_READER_CONTRACT, CONCURRENT_XML_FETCHES, MAX_XML_DEPTH, SAFE_STORAGE_READER_CONTRACT, STORAGE_CONTRACT, STORAGE_ROUTER_CONTRACT, StorageClient, StorageClientOptions, StorageData, type StreamingChunkResult, type StreamingProcessResult, assembleChunks, base64ToDataUri, chunkData, chunkDataForStorage, computeTopLevelHash, containsXmlReferences, detectFileTypeFromBase64, detectStorageType, encodeStorageKeyForUrl, estimateChunkCount, fileToDataUri, formatStorageKeyForDisplay, generateStorageEmbedTag, generateXmlMetadata, generateXmlMetadataWithSource, getChunkCount, getReferenceKey, getStorageKeyBytes, isBinaryFile, parseNetReferences, processDataForStorage, processFileStreaming, processFileStreamingComplete, readFileSlice, resolveOperator, resolveXmlRecursive, shouldSuggestXmlStorage, validateDataSize };
|
|
517
|
+
export { BulkStorageKey, CHUNKED_STORAGE_CONTRACT, CHUNKED_STORAGE_READER_CONTRACT, CONCURRENT_XML_FETCHES, MAX_XML_DEPTH, OPTIMAL_CHUNK_SIZE, SAFE_STORAGE_READER_CONTRACT, STORAGE_CONTRACT, STORAGE_ROUTER_CONTRACT, StorageClient, StorageClientOptions, StorageData, type StreamingChunkResult, type StreamingProcessResult, assembleChunks, base64ToDataUri, chunkData, chunkDataForStorage, computeTopLevelHash, containsXmlReferences, detectFileTypeFromBase64, detectStorageType, encodeStorageKeyForUrl, estimateChunkCount, fileToDataUri, formatStorageKeyForDisplay, generateStorageEmbedTag, generateXmlMetadata, generateXmlMetadataWithSource, getChunkCount, getReferenceKey, getStorageKeyBytes, isBinaryFile, parseNetReferences, processDataForStorage, processFileStreaming, processFileStreamingComplete, readFileSlice, resolveOperator, resolveXmlRecursive, shouldSuggestXmlStorage, validateDataSize };
|
package/dist/index.d.ts
CHANGED
|
@@ -183,6 +183,7 @@ declare class StorageClient {
|
|
|
183
183
|
filename?: string;
|
|
184
184
|
useChunkedStorageBackend?: boolean;
|
|
185
185
|
keyFormat?: "raw" | "bytes32";
|
|
186
|
+
chunkSize?: number;
|
|
186
187
|
}): {
|
|
187
188
|
transactionConfigs: WriteTransactionConfig[];
|
|
188
189
|
topLevelHash: string;
|
|
@@ -297,6 +298,7 @@ declare function resolveOperator(reference: XmlReference, defaultOperator: strin
|
|
|
297
298
|
*/
|
|
298
299
|
declare function getReferenceKey(reference: XmlReference, defaultOperator: string): string;
|
|
299
300
|
|
|
301
|
+
declare const OPTIMAL_CHUNK_SIZE: number;
|
|
300
302
|
/**
|
|
301
303
|
* Split data into chunks of specified size
|
|
302
304
|
*/
|
|
@@ -325,7 +327,7 @@ declare function computeTopLevelHash(chunkHashes: string[]): string;
|
|
|
325
327
|
/**
|
|
326
328
|
* Complete chunking and hash generation process
|
|
327
329
|
*/
|
|
328
|
-
declare function processDataForStorage(data: string, operatorAddress: string, storageKey?: string): {
|
|
330
|
+
declare function processDataForStorage(data: string, operatorAddress: string, storageKey?: string, chunkSize?: number): {
|
|
329
331
|
chunks: string[];
|
|
330
332
|
chunkHashes: string[];
|
|
331
333
|
xmlMetadata: string;
|
|
@@ -512,4 +514,4 @@ declare const CONCURRENT_XML_FETCHES = 3;
|
|
|
512
514
|
*/
|
|
513
515
|
declare function resolveXmlRecursive(content: string, defaultOperator: string, client: PublicClient, maxDepth: number, visited?: Set<string>, inheritedOperator?: string): Promise<string>;
|
|
514
516
|
|
|
515
|
-
export { BulkStorageKey, CHUNKED_STORAGE_CONTRACT, CHUNKED_STORAGE_READER_CONTRACT, CONCURRENT_XML_FETCHES, MAX_XML_DEPTH, SAFE_STORAGE_READER_CONTRACT, STORAGE_CONTRACT, STORAGE_ROUTER_CONTRACT, StorageClient, StorageClientOptions, StorageData, type StreamingChunkResult, type StreamingProcessResult, assembleChunks, base64ToDataUri, chunkData, chunkDataForStorage, computeTopLevelHash, containsXmlReferences, detectFileTypeFromBase64, detectStorageType, encodeStorageKeyForUrl, estimateChunkCount, fileToDataUri, formatStorageKeyForDisplay, generateStorageEmbedTag, generateXmlMetadata, generateXmlMetadataWithSource, getChunkCount, getReferenceKey, getStorageKeyBytes, isBinaryFile, parseNetReferences, processDataForStorage, processFileStreaming, processFileStreamingComplete, readFileSlice, resolveOperator, resolveXmlRecursive, shouldSuggestXmlStorage, validateDataSize };
|
|
517
|
+
export { BulkStorageKey, CHUNKED_STORAGE_CONTRACT, CHUNKED_STORAGE_READER_CONTRACT, CONCURRENT_XML_FETCHES, MAX_XML_DEPTH, OPTIMAL_CHUNK_SIZE, SAFE_STORAGE_READER_CONTRACT, STORAGE_CONTRACT, STORAGE_ROUTER_CONTRACT, StorageClient, StorageClientOptions, StorageData, type StreamingChunkResult, type StreamingProcessResult, assembleChunks, base64ToDataUri, chunkData, chunkDataForStorage, computeTopLevelHash, containsXmlReferences, detectFileTypeFromBase64, detectStorageType, encodeStorageKeyForUrl, estimateChunkCount, fileToDataUri, formatStorageKeyForDisplay, generateStorageEmbedTag, generateXmlMetadata, generateXmlMetadataWithSource, getChunkCount, getReferenceKey, getStorageKeyBytes, isBinaryFile, parseNetReferences, processDataForStorage, processFileStreaming, processFileStreamingComplete, readFileSlice, resolveOperator, resolveXmlRecursive, shouldSuggestXmlStorage, validateDataSize };
|
package/dist/index.js
CHANGED
|
@@ -1010,8 +1010,8 @@ function validateDataSize(chunks) {
|
|
|
1010
1010
|
function computeTopLevelHash(chunkHashes) {
|
|
1011
1011
|
return core.keccak256HashString(chunkHashes.join(""));
|
|
1012
1012
|
}
|
|
1013
|
-
function processDataForStorage(data, operatorAddress, storageKey) {
|
|
1014
|
-
const chunks = chunkData(data);
|
|
1013
|
+
function processDataForStorage(data, operatorAddress, storageKey, chunkSize) {
|
|
1014
|
+
const chunks = chunkData(data, chunkSize);
|
|
1015
1015
|
const validation = validateDataSize(chunks);
|
|
1016
1016
|
if (!validation.valid) {
|
|
1017
1017
|
return {
|
|
@@ -1482,7 +1482,8 @@ var StorageClient = class {
|
|
|
1482
1482
|
const result = processDataForStorage(
|
|
1483
1483
|
params.data,
|
|
1484
1484
|
params.operatorAddress,
|
|
1485
|
-
params.storageKey
|
|
1485
|
+
params.storageKey,
|
|
1486
|
+
params.chunkSize
|
|
1486
1487
|
);
|
|
1487
1488
|
if (!result.valid) {
|
|
1488
1489
|
throw new Error(result.error || "Failed to process data for storage");
|
|
@@ -1775,6 +1776,7 @@ exports.CHUNKED_STORAGE_CONTRACT = CHUNKED_STORAGE_CONTRACT;
|
|
|
1775
1776
|
exports.CHUNKED_STORAGE_READER_CONTRACT = CHUNKED_STORAGE_READER_CONTRACT;
|
|
1776
1777
|
exports.CONCURRENT_XML_FETCHES = CONCURRENT_XML_FETCHES;
|
|
1777
1778
|
exports.MAX_XML_DEPTH = MAX_XML_DEPTH;
|
|
1779
|
+
exports.OPTIMAL_CHUNK_SIZE = OPTIMAL_CHUNK_SIZE;
|
|
1778
1780
|
exports.SAFE_STORAGE_READER_CONTRACT = SAFE_STORAGE_READER_CONTRACT;
|
|
1779
1781
|
exports.STORAGE_CONTRACT = STORAGE_CONTRACT;
|
|
1780
1782
|
exports.STORAGE_ROUTER_CONTRACT = STORAGE_ROUTER_CONTRACT;
|