@oceanprotocol/lib 8.0.4 → 8.0.6
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/lib.cjs +4 -4
- package/dist/lib.module.mjs +3 -3
- package/dist/lib.umd.js +4 -4
- package/dist/types/@types/AccessList.d.ts +6 -0
- package/dist/types/@types/File.d.ts +26 -1
- package/dist/types/@types/Provider.d.ts +10 -0
- package/dist/types/services/providers/BaseProvider.d.ts +12 -2
- package/dist/types/services/providers/HttpProvider.d.ts +14 -1
- package/dist/types/services/providers/P2pProvider.d.ts +12 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AccessList } from './AccessList';
|
|
1
2
|
export interface HeadersObject {
|
|
2
3
|
[key: string]: string;
|
|
3
4
|
}
|
|
@@ -45,4 +46,28 @@ export interface FtpFileObject extends BaseFileObject {
|
|
|
45
46
|
/** Full FTP or FTPS URL: ftp://[user:password@]host[:port]/path or ftps://... */
|
|
46
47
|
url: string;
|
|
47
48
|
}
|
|
48
|
-
export
|
|
49
|
+
export interface PersistentStorageObject extends BaseFileObject {
|
|
50
|
+
type: 'nodePersistentStorage';
|
|
51
|
+
bucketId: string;
|
|
52
|
+
fileName: string;
|
|
53
|
+
}
|
|
54
|
+
export type StorageObject = UrlFileObject | IpfsFileObject | ArweaveFileObject | S3FileObject | FtpFileObject | PersistentStorageObject;
|
|
55
|
+
export type PersistentStorageAccessList = AccessList;
|
|
56
|
+
export interface PersistentStorageCreateBucketRequest {
|
|
57
|
+
accessLists: PersistentStorageAccessList[];
|
|
58
|
+
}
|
|
59
|
+
export interface PersistentStorageBucket {
|
|
60
|
+
bucketId: string;
|
|
61
|
+
owner: string;
|
|
62
|
+
createdAt: number;
|
|
63
|
+
accessLists: PersistentStorageAccessList[];
|
|
64
|
+
}
|
|
65
|
+
export interface PersistentStorageFileEntry {
|
|
66
|
+
bucketId: string;
|
|
67
|
+
name: string;
|
|
68
|
+
size: number;
|
|
69
|
+
lastModified: number;
|
|
70
|
+
}
|
|
71
|
+
export interface PersistentStorageDeleteFileResponse {
|
|
72
|
+
success: boolean;
|
|
73
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AccessList } from './AccessList.js';
|
|
1
2
|
export interface ProviderFees {
|
|
2
3
|
providerFeeAddress: string;
|
|
3
4
|
providerFeeToken: string;
|
|
@@ -75,6 +76,9 @@ export interface NodeStatus {
|
|
|
75
76
|
accessLists: string[] | null;
|
|
76
77
|
};
|
|
77
78
|
uptime: number;
|
|
79
|
+
persistentStorage?: {
|
|
80
|
+
accessLists?: AccessList[];
|
|
81
|
+
};
|
|
78
82
|
}
|
|
79
83
|
export interface UserCustomParameters {
|
|
80
84
|
[key: string]: any;
|
|
@@ -117,6 +121,12 @@ export declare const PROTOCOL_COMMANDS: {
|
|
|
117
121
|
PUSH_CONFIG: string;
|
|
118
122
|
GET_LOGS: string;
|
|
119
123
|
JOBS: string;
|
|
124
|
+
PERSISTENT_STORAGE_CREATE_BUCKET: string;
|
|
125
|
+
PERSISTENT_STORAGE_GET_BUCKETS: string;
|
|
126
|
+
PERSISTENT_STORAGE_LIST_FILES: string;
|
|
127
|
+
PERSISTENT_STORAGE_UPLOAD_FILE: string;
|
|
128
|
+
PERSISTENT_STORAGE_GET_FILE_OBJECT: string;
|
|
129
|
+
PERSISTENT_STORAGE_DELETE_FILE: string;
|
|
120
130
|
};
|
|
121
131
|
export interface NodeLogsParams {
|
|
122
132
|
logId?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Multiaddr } from '@multiformats/multiaddr';
|
|
2
2
|
import { Signer } from 'ethers';
|
|
3
|
-
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ComputeResultStream, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, NodeStatus, NodeComputeJob, NodeLogsParams, NodeLogEntry } from '../../@types/index.js';
|
|
3
|
+
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ComputeResultStream, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, NodeStatus, NodeComputeJob, NodeLogsParams, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject } from '../../@types/index.js';
|
|
4
4
|
import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
|
|
5
|
-
import { type P2PConfig } from './P2pProvider.js';
|
|
5
|
+
import { type P2PConfig, type P2PRequestBodyStream } from './P2pProvider.js';
|
|
6
6
|
export { OCEAN_P2P_PROTOCOL, type P2PConfig } from './P2pProvider.js';
|
|
7
7
|
export declare function getConsumerAddress(signerOrAuthToken: Signer | string): Promise<string>;
|
|
8
8
|
export declare function getSignature(signerOrAuthToken: Signer | string, nonce: string, command: string): Promise<string | null>;
|
|
@@ -52,6 +52,16 @@ export declare class BaseProvider {
|
|
|
52
52
|
* For auto-signed log fetching (HTTP or P2P), use downloadNodeLogs().
|
|
53
53
|
*/
|
|
54
54
|
fetchNodeLogs(nodeUri: string | Multiaddr[], address: string, signature: string, nonce: string, logParams?: NodeLogsParams): Promise<NodeLogEntry[]>;
|
|
55
|
+
createPersistentStorageBucket(nodeUri: string | Multiaddr[], signerOrAuthToken: Signer | string, payload: PersistentStorageCreateBucketRequest, signal?: AbortSignal): Promise<{
|
|
56
|
+
bucketId: string;
|
|
57
|
+
owner: string;
|
|
58
|
+
accessList: PersistentStorageAccessList[];
|
|
59
|
+
}>;
|
|
60
|
+
getPersistentStorageBuckets(nodeUri: string | Multiaddr[], signerOrAuthToken: Signer | string, owner: string, signal?: AbortSignal): Promise<PersistentStorageBucket[]>;
|
|
61
|
+
listPersistentStorageFiles(nodeUri: string | Multiaddr[], signerOrAuthToken: Signer | string, bucketId: string, signal?: AbortSignal): Promise<PersistentStorageFileEntry[]>;
|
|
62
|
+
getPersistentStorageFileObject(nodeUri: string | Multiaddr[], signerOrAuthToken: Signer | string, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageObject>;
|
|
63
|
+
uploadPersistentStorageFile(nodeUri: string | Multiaddr[], signerOrAuthToken: Signer | string, bucketId: string, fileName: string, content: P2PRequestBodyStream, signal?: AbortSignal): Promise<PersistentStorageFileEntry>;
|
|
64
|
+
deletePersistentStorageFile(nodeUri: string | Multiaddr[], signerOrAuthToken: Signer | string, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageDeleteFileResponse>;
|
|
55
65
|
fetchConfig(nodeUri: string | Multiaddr[], payload: Record<string, any>): Promise<any>;
|
|
56
66
|
pushConfig(nodeUri: string | Multiaddr[], payload: Record<string, any>): Promise<any>;
|
|
57
67
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, ComputeResultStream, NodeStatus, NodeComputeJob, NodeLogEntry } from '../../@types/index.js';
|
|
2
|
+
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, ComputeResultStream, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject } from '../../@types/index.js';
|
|
3
3
|
import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
|
|
4
|
+
import { type P2PRequestBodyStream } from './P2pProvider.js';
|
|
4
5
|
export declare class HttpProvider {
|
|
5
6
|
protected getConsumerAddress(s: Signer | string): Promise<string>;
|
|
6
7
|
protected getSignature(s: Signer | string, nonce: string, command: string): Promise<string>;
|
|
7
8
|
protected getAuthorization(s: Signer | string): string;
|
|
9
|
+
private getPersistentStorageSignaturePayload;
|
|
10
|
+
private resolvePersistentStorageRoute;
|
|
8
11
|
/**
|
|
9
12
|
* Returns the provider endpoints
|
|
10
13
|
* @param {string} nodeUri - the provider url
|
|
@@ -245,4 +248,14 @@ export declare class HttpProvider {
|
|
|
245
248
|
resolveDdo(nodeUri: string, did: string, signal?: AbortSignal): Promise<any>;
|
|
246
249
|
validateDdo(nodeUri: string, ddo: DDO, signer: Signer, signal?: AbortSignal): Promise<ValidateMetadata>;
|
|
247
250
|
private getData;
|
|
251
|
+
createPersistentStorageBucket(nodeUri: string, signerOrAuthToken: Signer | string, payload: PersistentStorageCreateBucketRequest, signal?: AbortSignal): Promise<{
|
|
252
|
+
bucketId: string;
|
|
253
|
+
owner: string;
|
|
254
|
+
accessList: PersistentStorageAccessList[];
|
|
255
|
+
}>;
|
|
256
|
+
getPersistentStorageBuckets(nodeUri: string, signerOrAuthToken: Signer | string, owner: string, signal?: AbortSignal): Promise<PersistentStorageBucket[]>;
|
|
257
|
+
listPersistentStorageFiles(nodeUri: string, signerOrAuthToken: Signer | string, bucketId: string, signal?: AbortSignal): Promise<PersistentStorageFileEntry[]>;
|
|
258
|
+
getPersistentStorageFileObject(nodeUri: string, signerOrAuthToken: Signer | string, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageObject>;
|
|
259
|
+
uploadPersistentStorageFile(nodeUri: string, signerOrAuthToken: Signer | string, bucketId: string, fileName: string, content: P2PRequestBodyStream, signal?: AbortSignal): Promise<PersistentStorageFileEntry>;
|
|
260
|
+
deletePersistentStorageFile(nodeUri: string, signerOrAuthToken: Signer | string, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageDeleteFileResponse>;
|
|
248
261
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Libp2p, type Libp2pOptions } from 'libp2p';
|
|
2
2
|
import { type Multiaddr } from '@multiformats/multiaddr';
|
|
3
3
|
import { Signer } from 'ethers';
|
|
4
|
-
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, ComputeResultStream, NodeStatus, NodeComputeJob } from '../../@types/index.js';
|
|
4
|
+
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, ComputeResultStream, NodeStatus, NodeComputeJob, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject } from '../../@types/index.js';
|
|
5
5
|
import { NodeLogsParams, NodeLogEntry } from '../../@types/Provider.js';
|
|
6
6
|
import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
|
|
7
7
|
export declare const OCEAN_P2P_PROTOCOL = "/ocean/nodes/1.0.0";
|
|
@@ -199,4 +199,15 @@ export declare class P2pProvider {
|
|
|
199
199
|
* the caller is responsible for nonce retrieval and signing.
|
|
200
200
|
*/
|
|
201
201
|
pushConfig(nodeUri: string | Multiaddr[], payload: Record<string, any>): Promise<any>;
|
|
202
|
+
private getPersistentStorageSignaturePayload;
|
|
203
|
+
createPersistentStorageBucket(nodeUri: string | Multiaddr[], signerOrAuthToken: Signer | string, payload: PersistentStorageCreateBucketRequest, signal?: AbortSignal): Promise<{
|
|
204
|
+
bucketId: string;
|
|
205
|
+
owner: string;
|
|
206
|
+
accessList: PersistentStorageAccessList[];
|
|
207
|
+
}>;
|
|
208
|
+
getPersistentStorageBuckets(nodeUri: string | Multiaddr[], signerOrAuthToken: Signer | string, owner: string, signal?: AbortSignal): Promise<PersistentStorageBucket[]>;
|
|
209
|
+
listPersistentStorageFiles(nodeUri: string | Multiaddr[], signerOrAuthToken: Signer | string, bucketId: string, signal?: AbortSignal): Promise<PersistentStorageFileEntry[]>;
|
|
210
|
+
getPersistentStorageFileObject(nodeUri: string | Multiaddr[], signerOrAuthToken: Signer | string, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageObject>;
|
|
211
|
+
uploadPersistentStorageFile(nodeUri: string | Multiaddr[], signerOrAuthToken: Signer | string, bucketId: string, fileName: string, content: P2PRequestBodyStream, signal?: AbortSignal): Promise<PersistentStorageFileEntry>;
|
|
212
|
+
deletePersistentStorageFile(nodeUri: string | Multiaddr[], signerOrAuthToken: Signer | string, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageDeleteFileResponse>;
|
|
202
213
|
}
|