@oceanprotocol/lib 6.1.1 → 7.0.0-next.0
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/CHANGELOG.md +16 -0
- package/CodeExamples.md +2 -3
- package/ComputeExamples.md +254 -308
- package/dist/lib.cjs +3 -1
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.modern.js +3 -1
- package/dist/lib.modern.js.map +1 -1
- package/dist/lib.module.mjs +3 -1
- package/dist/lib.module.mjs.map +1 -1
- package/dist/lib.umd.js +3 -1
- package/dist/lib.umd.js.map +1 -1
- package/dist/types/@types/Compute.d.ts +1 -0
- package/dist/types/@types/File.d.ts +8 -1
- package/dist/types/config/ConfigHelper.d.ts +1 -0
- package/dist/types/services/Aquarius.d.ts +0 -1
- package/dist/types/services/Provider.d.ts +3 -282
- package/dist/types/services/providers/BaseProvider.d.ts +47 -0
- package/dist/types/services/providers/HttpProvider.d.ts +246 -0
- package/dist/types/services/providers/P2pProvider.d.ts +180 -0
- package/dist/types/utils/FetchHelper.d.ts +6 -5
- package/package.json +12 -2
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
export interface HeadersObject {
|
|
2
2
|
[key: string]: string;
|
|
3
3
|
}
|
|
4
|
+
export declare enum FileObjectType {
|
|
5
|
+
URL = "url",
|
|
6
|
+
IPFS = "ipfs",
|
|
7
|
+
ARWEAVE = "arweave",
|
|
8
|
+
S3 = "s3",
|
|
9
|
+
FTP = "ftp"
|
|
10
|
+
}
|
|
4
11
|
export declare enum EncryptMethod {
|
|
5
12
|
AES = "AES",
|
|
6
13
|
ECIES = "ECIES"
|
|
7
14
|
}
|
|
8
15
|
export interface BaseFileObject {
|
|
9
|
-
type: string;
|
|
16
|
+
type: FileObjectType | string;
|
|
10
17
|
encryptedBy?: string;
|
|
11
18
|
encryptMethod?: EncryptMethod;
|
|
12
19
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Config } from '.';
|
|
2
2
|
export declare const configHelperNetworks: Config[];
|
|
3
3
|
export declare const KNOWN_CONFIDENTIAL_EVMS: number[];
|
|
4
|
+
export declare const getNodeEndpointConfig: () => Partial<Config>;
|
|
4
5
|
export declare class ConfigHelper {
|
|
5
6
|
getAddressesFromEnv(network: string, customAddresses?: any): Partial<Config>;
|
|
6
7
|
/**
|
|
@@ -1,282 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
private getConsumerAddress;
|
|
5
|
-
private getSignature;
|
|
6
|
-
private getAuthorization;
|
|
7
|
-
/**
|
|
8
|
-
* Returns the provider endpoints
|
|
9
|
-
* @param {string} providerUri - the provider url
|
|
10
|
-
* @return {Promise<any>}
|
|
11
|
-
*/
|
|
12
|
-
getEndpoints(providerUri: string, authorization?: string): Promise<any>;
|
|
13
|
-
/**
|
|
14
|
-
* Returns the node public key
|
|
15
|
-
* @return {string} The node public key
|
|
16
|
-
*/
|
|
17
|
-
private getNodePublicKey;
|
|
18
|
-
/**
|
|
19
|
-
* This function returns the endpoint URL for a given service name.
|
|
20
|
-
* @param {ServiceEndpoint[]} servicesEndpoints - The array of service endpoints
|
|
21
|
-
* @param {string} serviceName - The name of the service
|
|
22
|
-
* @returns {ServiceEndpoint} The endpoint URL for the given service name
|
|
23
|
-
*/
|
|
24
|
-
getEndpointURL(servicesEndpoints: ServiceEndpoint[], serviceName: string): ServiceEndpoint;
|
|
25
|
-
/**
|
|
26
|
-
* This function returns an array of service endpoints for a given provider endpoint.
|
|
27
|
-
* @param {string} providerEndpoint - The provider endpoint
|
|
28
|
-
* @param {any} endpoints - The endpoints object
|
|
29
|
-
* @returns {ServiceEndpoint[]} An array of service endpoints
|
|
30
|
-
*/
|
|
31
|
-
getServiceEndpoints(providerEndpoint: string, endpoints: any): Promise<ServiceEndpoint[]>;
|
|
32
|
-
/**
|
|
33
|
-
* Get current nonce from the provider.
|
|
34
|
-
* @param {string} providerUri provider uri address
|
|
35
|
-
* @param {string} consumerAddress Publisher address
|
|
36
|
-
* @param {AbortSignal} signal abort signal
|
|
37
|
-
* @param {string} providerEndpoints Identifier of the asset to be registered in ocean
|
|
38
|
-
* @param {string} serviceEndpoints document description object (DDO)=
|
|
39
|
-
* @return {Promise<string>} urlDetails
|
|
40
|
-
*/
|
|
41
|
-
getNonce(providerUri: string, consumerAddress: string, signal?: AbortSignal, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<number>;
|
|
42
|
-
/**
|
|
43
|
-
* Encrypt data using the Provider's own symmetric key
|
|
44
|
-
* @param {string} data data in json format that needs to be sent , it can either be a DDO or a File array
|
|
45
|
-
* @param {number} chainId network's id so provider can choose the corresponding Signer object
|
|
46
|
-
* @param {string} providerUri provider uri address
|
|
47
|
-
* @param {AbortSignal} signal abort signal
|
|
48
|
-
* @return {Promise<string>} urlDetails
|
|
49
|
-
*/
|
|
50
|
-
encrypt(data: any, chainId: number, providerUri: string, signerOrAuthToken: Signer | string, policyServer?: any, signal?: AbortSignal): Promise<string>;
|
|
51
|
-
/**
|
|
52
|
-
* Get file details for a given DID and service ID.
|
|
53
|
-
* @param {string} did - The DID to check.
|
|
54
|
-
* @param {string} serviceId - The service ID to check.
|
|
55
|
-
* @param {string} providerUri - The URI of the provider.
|
|
56
|
-
* @param {boolean} [withChecksum=false] - Whether or not to include a checksum.
|
|
57
|
-
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
58
|
-
* @returns {Promise<FileInfo[]>} A promise that resolves with an array of file info objects.
|
|
59
|
-
*/
|
|
60
|
-
checkDidFiles(did: string, serviceId: string, providerUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
61
|
-
/**
|
|
62
|
-
* Get File details (if possible)
|
|
63
|
-
* @param {StorageObject} file one of the supported file structures
|
|
64
|
-
* @param {string} providerUri uri of the provider that will be used to check the file
|
|
65
|
-
* @param {boolean} [withChecksum=false] - Whether or not to include a checksum.
|
|
66
|
-
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
67
|
-
* @returns {Promise<FileInfo[]>} A promise that resolves with an array of file info objects.
|
|
68
|
-
*/
|
|
69
|
-
getFileInfo(file: StorageObject, providerUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
70
|
-
/**
|
|
71
|
-
* Returns compute environments from a provider.
|
|
72
|
-
* @param {string} providerUri - The URI of the provider.
|
|
73
|
-
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
74
|
-
* @returns {Promise<{[chainId: number]: ComputeEnvironment[]}>} A promise that resolves with an object containing compute environments for each chain ID.
|
|
75
|
-
*/
|
|
76
|
-
getComputeEnvironments(providerUri: string, signal?: AbortSignal): Promise<ComputeEnvironment[]>;
|
|
77
|
-
/**
|
|
78
|
-
* Initializes the provider for a service request.
|
|
79
|
-
* @param {string} did - The asset DID .
|
|
80
|
-
* @param {string} serviceId - The asset service ID.
|
|
81
|
-
* @param {number} fileIndex - The file index.
|
|
82
|
-
* @param {string} consumerAddress - The consumer address.
|
|
83
|
-
* @param {string} providerUri - The URI of the provider.
|
|
84
|
-
* @param {AbortSignal} [signal] - The abort signal if any.
|
|
85
|
-
* @param {UserCustomParameters} [userCustomParameters] - The custom parameters if any.
|
|
86
|
-
* @param {string} [computeEnv] - The compute environment if any.
|
|
87
|
-
* @param {number} [validUntil] - The validity time if any.
|
|
88
|
-
* @returns {Promise<ProviderInitialize>} A promise that resolves with ProviderInitialize response.
|
|
89
|
-
*/
|
|
90
|
-
initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, providerUri: string, signal?: AbortSignal, userCustomParameters?: UserCustomParameters, computeEnv?: string, validUntil?: number): Promise<ProviderInitialize>;
|
|
91
|
-
/** Initializes the provider for a compute request.
|
|
92
|
-
* @param {ComputeAsset[]} assets The datasets array to initialize compute request.
|
|
93
|
-
* @param {ComputeAlgorithmber} algorithm The algorithm to use.
|
|
94
|
-
* @param {string} computeEnv The compute environment.
|
|
95
|
-
* @param {string} providerUri The provider URI.
|
|
96
|
-
* @param {string} accountId caller address
|
|
97
|
-
* @param {string} chainId The chain Id to start compute on
|
|
98
|
-
* @param {string} token The token to use for the compute payment
|
|
99
|
-
* @param {number} maxJobDuration The maximum duration the job can take
|
|
100
|
-
* @param {AbortSignal} signal abort signal
|
|
101
|
-
* @return {Promise<ProviderComputeInitialize>} ProviderComputeInitialize data
|
|
102
|
-
*/
|
|
103
|
-
initializeComputeV1(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, providerUri: string, accountId: string, chainId: number, token: string, maxJobDuration: number, signal?: AbortSignal): Promise<ProviderComputeInitializeResults>;
|
|
104
|
-
/** Initializes the provider for a compute request.
|
|
105
|
-
* @param {ComputeAsset[]} assets The datasets array to initialize compute request.
|
|
106
|
-
* @param {ComputeAlgorithmber} algorithm The algorithm to use.
|
|
107
|
-
* @param {string} computeEnv The compute environment.
|
|
108
|
-
* @param {string} token The payment token address.
|
|
109
|
-
* @param {number} validUntil The job expiration date.
|
|
110
|
-
* @param {string} providerUri The provider URI.
|
|
111
|
-
* @param {SignerOrAuthToken} signerOrAuthToken Signer or auth token
|
|
112
|
-
* @param {ComputeResourceRequest[]} resources The resources to start compute job with.
|
|
113
|
-
* @param {number} chainId The chain used to do payments
|
|
114
|
-
* @param {any} policyServer Policy server data.
|
|
115
|
-
* @param {AbortSignal} signal abort signal
|
|
116
|
-
* @param {dockerRegistryAuth} dockerRegistryAuth Docker registry authentication data.
|
|
117
|
-
* @return {Promise<ProviderComputeInitialize>} ProviderComputeInitialize data
|
|
118
|
-
*/
|
|
119
|
-
initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, token: string, validUntil: number, providerUri: string, signerOrAuthToken: Signer | string, resources: ComputeResourceRequest[], chainId: number, policyServer?: any, signal?: AbortSignal, dockerRegistryAuth?: dockerRegistryAuth): Promise<ProviderComputeInitializeResults>;
|
|
120
|
-
/**
|
|
121
|
-
* Gets the download URL.
|
|
122
|
-
* @param {string} did - The DID.
|
|
123
|
-
* @param {string} serviceId - The service ID.
|
|
124
|
-
* @param {number} fileIndex - The file index.
|
|
125
|
-
* @param {string} transferTxId - The transfer transaction ID.
|
|
126
|
-
* @param {string} providerUri - The provider URI.
|
|
127
|
-
* @param {SignerOrAuthToken} signerOrAuthToken - The signer or auth token.
|
|
128
|
-
* @param {any} policyServer Policy server data.
|
|
129
|
-
* @param {UserCustomParameters} userCustomParameters - The user custom parameters.
|
|
130
|
-
* @returns {Promise<any>} The download URL.
|
|
131
|
-
*/
|
|
132
|
-
getDownloadUrl(did: string, serviceId: string, fileIndex: number, transferTxId: string, providerUri: string, signerOrAuthToken: Signer | string, policyServer?: any, userCustomParameters?: UserCustomParameters): Promise<any>;
|
|
133
|
-
/** Instruct the provider to start a PAYED compute job
|
|
134
|
-
* @param {string} providerUri The provider URI.
|
|
135
|
-
* @param {SignerOrAuthToken} signerOrAuthToken The consumer signer object or auth token.
|
|
136
|
-
* @param {string} computeEnv The compute environment.
|
|
137
|
-
* @param {ComputeAsset} datasets The dataset to start compute on + additionalDatasets (the additional datasets if that is the case)
|
|
138
|
-
* @param {ComputeAlgorithm} algorithm The algorithm to start compute with.
|
|
139
|
-
* @param {number} maxJobDuration The compute job max execution time.
|
|
140
|
-
* @param {string} token The token address for compute payment.
|
|
141
|
-
* @param {ComputeResourceRequest} resources The resources to start compute job with.
|
|
142
|
-
* @param {chainId} chainId The chain used to do payments
|
|
143
|
-
* @param {ComputeJobMetadata} metadata The compute job metadata. Additional metadata to be stored in the database.
|
|
144
|
-
* @param {ComputeOutput} output The compute job output settings.
|
|
145
|
-
* @param {any} policyServer Policy server data.
|
|
146
|
-
* @param {AbortSignal} signal abort signal
|
|
147
|
-
* @param {number} queueMaxWaitTime Maximum time in seconds to wait in the compute queue if resources are not available
|
|
148
|
-
* @param {dockerRegistryAuth} dockerRegistryAuth Docker registry authentication data.
|
|
149
|
-
* @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
|
|
150
|
-
*/
|
|
151
|
-
computeStart(providerUri: string, signerOrAuthToken: Signer | string, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, maxJobDuration: number, token: string, resources: ComputeResourceRequest[], chainId: number, // network used by payment (only for payed compute jobs)
|
|
152
|
-
metadata?: ComputeJobMetadata, additionalViewers?: string[], output?: ComputeOutput, policyServer?: any, signal?: AbortSignal, queueMaxWaitTime?: number, dockerRegistryAuth?: dockerRegistryAuth): Promise<ComputeJob | ComputeJob[]>;
|
|
153
|
-
/** Instruct the provider to start a FREE compute job
|
|
154
|
-
* @param {string} providerUri The provider URI.
|
|
155
|
-
* @param {SignerOrAuthToken} signerOrAuthToken The consumer signer object or auth token.
|
|
156
|
-
* @param {string} computeEnv The compute environment.
|
|
157
|
-
* @param {ComputeAsset} datasets The dataset to start compute on + additionalDatasets (the additional datasets if that is the case)
|
|
158
|
-
* @param {ComputeAlgorithm} algorithm The algorithm to start compute with.
|
|
159
|
-
* @param {ComputeResourceRequest} resources The resources to start compute job with.
|
|
160
|
-
* @param {ComputeJobMetadata} metadata The compute job metadata. Additional metadata to be stored in the database.
|
|
161
|
-
* @param {ComputeOutput} output The compute job output settings.
|
|
162
|
-
* @param {any} policyServer Policy server data.
|
|
163
|
-
* @param {AbortSignal} signal abort signal
|
|
164
|
-
* @param {number} queueMaxWaitTime Maximum time in seconds to wait in the compute queue if resources are not available
|
|
165
|
-
* @param {dockerRegistryAuth} dockerRegistryAuth Docker registry authentication data.
|
|
166
|
-
* @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
|
|
167
|
-
*/
|
|
168
|
-
freeComputeStart(providerUri: string, signerOrAuthToken: Signer | string, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, resources?: ComputeResourceRequest[], metadata?: ComputeJobMetadata, additionalViewers?: string[], output?: ComputeOutput, policyServer?: any, signal?: AbortSignal, queueMaxWaitTime?: number, dockerRegistryAuth?: dockerRegistryAuth): Promise<ComputeJob | ComputeJob[]>;
|
|
169
|
-
/**
|
|
170
|
-
*
|
|
171
|
-
* @param providerUri provider URL
|
|
172
|
-
* @param signerOrAuthToken signer or auth token
|
|
173
|
-
* @param jobId jobId
|
|
174
|
-
* @param signal abort signal
|
|
175
|
-
* @returns logs response
|
|
176
|
-
*/
|
|
177
|
-
computeStreamableLogs(providerUri: string, signerOrAuthToken: Signer | string, jobId: string, signal?: AbortSignal): Promise<any>;
|
|
178
|
-
getComputeStartRoutes(providerUri: string, isFreeCompute?: boolean): Promise<string | null>;
|
|
179
|
-
/** Instruct the provider to Stop the execution of a to stop a compute job.
|
|
180
|
-
* @param {string} jobId the compute job id
|
|
181
|
-
* @param {string} providerUri The provider URI.
|
|
182
|
-
* @param {SignerOrAuthToken} signerOrAuthToken The consumer signer or auth token.
|
|
183
|
-
* @param {string} agreementId The agreement id.
|
|
184
|
-
* @param {AbortSignal} signal abort signal
|
|
185
|
-
* @return {Promise<ComputeJob | ComputeJob[]>}
|
|
186
|
-
*/
|
|
187
|
-
computeStop(jobId: string, providerUri: string, signerOrAuthToken: Signer | string, agreementId?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
188
|
-
/** Get compute status for a specific jobId/documentId/owner.
|
|
189
|
-
* @param {string} providerUri The URI of the provider we want to query
|
|
190
|
-
* @param {string} consumerAddress The consumer ethereum address
|
|
191
|
-
* @param {string} jobId The ID of a compute job.
|
|
192
|
-
* @param {string} agreementId The ID of the service agreement (tx id)
|
|
193
|
-
* @param {AbortSignal} signal abort signal
|
|
194
|
-
* @return {Promise<ComputeJob | ComputeJob[]>}
|
|
195
|
-
*/
|
|
196
|
-
computeStatus(providerUri: string, consumerAddress: string, jobId?: string, agreementId?: string, signal?: AbortSignal, authorization?: string): Promise<ComputeJob | ComputeJob[]>;
|
|
197
|
-
/** Get compute result url
|
|
198
|
-
* @param {string} providerUri The URI of the provider we want to query
|
|
199
|
-
* @param {SignerOrAuthToken} signerOrAuthToken signer or auth token
|
|
200
|
-
* @param {string} jobId The ID of a compute job.
|
|
201
|
-
* @param {number} index Result index
|
|
202
|
-
* @return {Promise<string>}
|
|
203
|
-
*/
|
|
204
|
-
getComputeResultUrl(providerUri: string, signerOrAuthToken: Signer | string, jobId: string, index: number): Promise<string>;
|
|
205
|
-
/** Generates an auth token
|
|
206
|
-
* @param {Signer} consumer consumer Signer wallet object
|
|
207
|
-
* @param {string} providerUri The URI of the provider we want to query
|
|
208
|
-
* @param {AbortSignal} signal abort signal
|
|
209
|
-
* @return {Promise<ComputeJob | ComputeJob[]>}
|
|
210
|
-
*/
|
|
211
|
-
generateAuthToken(consumer: Signer, providerUri: string, signal?: AbortSignal): Promise<string>;
|
|
212
|
-
/** Generates an auth token
|
|
213
|
-
* @param {Signer} consumer consumer Signer wallet object
|
|
214
|
-
* @param {string} token The auth token to invalidate
|
|
215
|
-
* @param {string} providerUri The URI of the provider we want to query
|
|
216
|
-
* @param {AbortSignal} signal abort signal
|
|
217
|
-
* @return {Promise<ComputeJob | ComputeJob[]>}
|
|
218
|
-
*/
|
|
219
|
-
invalidateAuthToken(consumer: Signer, token: string, providerUri: string, signal?: AbortSignal): Promise<{
|
|
220
|
-
success: boolean;
|
|
221
|
-
}>;
|
|
222
|
-
/** Check for a valid provider at URL
|
|
223
|
-
* @param {String} url provider uri address
|
|
224
|
-
* @param {AbortSignal} signal abort signal
|
|
225
|
-
* @return {Promise<boolean>} valid or not
|
|
226
|
-
*/
|
|
227
|
-
isValidProvider(url: string, signal?: AbortSignal): Promise<boolean>;
|
|
228
|
-
/** Sends a PolicyServer request to node to be passthrough to PS
|
|
229
|
-
* @param {string} providerUri The provider URI.
|
|
230
|
-
* @param {PolicyServerPassthroughCommand} request The request to be passed through to the Policy Server.
|
|
231
|
-
* @param {AbortSignal} signal abort signal
|
|
232
|
-
*/
|
|
233
|
-
PolicyServerPassthrough(providerUri: string, request: PolicyServerPassthroughCommand, signal?: AbortSignal): Promise<any>;
|
|
234
|
-
/** Initialize Policy Server verification
|
|
235
|
-
* @param {string} providerUri The provider URI.
|
|
236
|
-
* @param {PolicyServerInitializeCommand} request The request to be sent to the Policy Server.
|
|
237
|
-
* @param {AbortSignal} signal abort signal
|
|
238
|
-
*/
|
|
239
|
-
initializePSVerification(providerUri: string, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
|
|
240
|
-
/**
|
|
241
|
-
* Download node logs as an admin.
|
|
242
|
-
* @param {string} providerUri - The provider URI.
|
|
243
|
-
* @param {Signer} signer - The admin signer.
|
|
244
|
-
* @param {string} startTime - Start time (epoch ms) to get logs from.
|
|
245
|
-
* @param {string} endTime - End time (epoch ms) to get logs to.
|
|
246
|
-
* @param {number} [maxLogs] - Maximum number of logs to retrieve (default: 100, max: 1000).
|
|
247
|
-
* @param {string} [moduleName] - Filter logs by module name.
|
|
248
|
-
* @param {string} [level] - Filter logs by log level.
|
|
249
|
-
* @param {number} [page] - Pagination page number.
|
|
250
|
-
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
251
|
-
* @returns {Promise<any>} The logs response body stream.
|
|
252
|
-
*/
|
|
253
|
-
downloadNodeLogs(providerUri: string, signer: Signer, startTime: string, endTime: string, maxLogs?: number, moduleName?: string, level?: string, page?: number, signal?: AbortSignal): Promise<any>;
|
|
254
|
-
/**
|
|
255
|
-
* Private method that removes the leading 0x from a string.
|
|
256
|
-
* @param {string} input - The input string.
|
|
257
|
-
* @returns The transformed string.
|
|
258
|
-
*/
|
|
259
|
-
private noZeroX;
|
|
260
|
-
/**
|
|
261
|
-
* Private method that removes the leading 0x from a string.
|
|
262
|
-
* @param {string} input - The input string.
|
|
263
|
-
* @param {boolean} zeroOutput - Whether to include 0x in the output if the input is valid and zeroOutput is true.
|
|
264
|
-
* @returns The transformed string.
|
|
265
|
-
*/
|
|
266
|
-
private zeroXTransformer;
|
|
267
|
-
/**
|
|
268
|
-
* Private method that matches an input string against a regular expression and returns the first capture group.
|
|
269
|
-
* @param {string} input - The input string to match.
|
|
270
|
-
* @param {RegExp} regexp - The regular expression to match against.
|
|
271
|
-
* @param {string} conversorName - The name of the method calling this function.
|
|
272
|
-
* @returns An object with two properties: `valid` (a boolean indicating whether the input matched the regular expression) and `output` (the first capture group of the match, or the original input if there was no match).
|
|
273
|
-
*/
|
|
274
|
-
private inputMatch;
|
|
275
|
-
/**
|
|
276
|
-
* Private method that fetches data from a URL using the GET method.
|
|
277
|
-
* @param {string} url - The URL to fetch data from.
|
|
278
|
-
* @returns A Promise that resolves to a Response object.
|
|
279
|
-
*/
|
|
280
|
-
private getData;
|
|
281
|
-
}
|
|
282
|
-
export declare const ProviderInstance: Provider;
|
|
1
|
+
import { BaseProvider } from './providers/BaseProvider.js';
|
|
2
|
+
export { BaseProvider as Provider, isP2pUri, OCEAN_P2P_PROTOCOL, type P2PConfig } from './providers/BaseProvider.js';
|
|
3
|
+
export declare const ProviderInstance: BaseProvider;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Signer } from 'ethers';
|
|
2
|
+
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ComputeResultStream, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse } from '../../@types/index.js';
|
|
3
|
+
import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
|
|
4
|
+
import { HttpProvider } from './HttpProvider.js';
|
|
5
|
+
import { P2pProvider, type P2PConfig } from './P2pProvider.js';
|
|
6
|
+
export { OCEAN_P2P_PROTOCOL, type P2PConfig } from './P2pProvider.js';
|
|
7
|
+
export declare function getConsumerAddress(signerOrAuthToken: Signer | string): Promise<string>;
|
|
8
|
+
export declare function getSignature(signerOrAuthToken: Signer | string, nonce: string, command: string): Promise<string | null>;
|
|
9
|
+
export declare function getAuthorization(signerOrAuthToken: Signer | string): string | undefined;
|
|
10
|
+
export declare function isP2pUri(nodeUri: string): boolean;
|
|
11
|
+
export declare class BaseProvider {
|
|
12
|
+
private httpProvider;
|
|
13
|
+
private p2pProvider;
|
|
14
|
+
protected getImpl(nodeUri: string): HttpProvider | P2pProvider;
|
|
15
|
+
getNonce(nodeUri: string, consumerAddress: string, signal?: AbortSignal, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<number>;
|
|
16
|
+
encrypt(data: any, chainId: number, nodeUri: string, signerOrAuthToken: Signer | string, policyServer?: any, signal?: AbortSignal): Promise<string>;
|
|
17
|
+
checkDidFiles(did: string, serviceId: string, nodeUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
18
|
+
getFileInfo(file: StorageObject, nodeUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
19
|
+
getComputeEnvironments(nodeUri: string, signal?: AbortSignal): Promise<ComputeEnvironment[]>;
|
|
20
|
+
initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, nodeUri: string, signal?: AbortSignal, userCustomParameters?: UserCustomParameters, computeEnv?: string, validUntil?: number): Promise<ProviderInitialize>;
|
|
21
|
+
initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, token: string, validUntil: number, nodeUri: string, signerOrAuthToken: Signer | string, resources: ComputeResourceRequest[], chainId: number, policyServer?: any, signal?: AbortSignal, output?: ComputeOutput, dockerRegistryAuth?: dockerRegistryAuth): Promise<ProviderComputeInitializeResults>;
|
|
22
|
+
getDownloadUrl(did: string, serviceId: string, fileIndex: number, transferTxId: string, nodeUri: string, signerOrAuthToken: Signer | string, policyServer?: any, userCustomParameters?: UserCustomParameters): Promise<string | DownloadResponse>;
|
|
23
|
+
computeStart(nodeUri: string, signerOrAuthToken: Signer | string, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, maxJobDuration: number, token: string, resources: ComputeResourceRequest[], chainId: number, metadata?: ComputeJobMetadata, additionalViewers?: string[], output?: ComputeOutput, policyServer?: any, signal?: AbortSignal, queueMaxWaitTime?: number, dockerRegistryAuth?: dockerRegistryAuth): Promise<ComputeJob | ComputeJob[]>;
|
|
24
|
+
freeComputeStart(nodeUri: string, signerOrAuthToken: Signer | string, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, resources?: ComputeResourceRequest[], metadata?: ComputeJobMetadata, additionalViewers?: string[], output?: ComputeOutput, policyServer?: any, signal?: AbortSignal, queueMaxWaitTime?: number, dockerRegistryAuth?: dockerRegistryAuth): Promise<ComputeJob | ComputeJob[]>;
|
|
25
|
+
computeStreamableLogs(nodeUri: string, signerOrAuthToken: Signer | string, jobId: string, signal?: AbortSignal): Promise<any>;
|
|
26
|
+
computeStop(jobId: string, nodeUri: string, signerOrAuthToken: Signer | string, agreementId?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
27
|
+
computeStatus(nodeUri: string, signerOrAuthToken: Signer | string, jobId?: string, agreementId?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
28
|
+
getComputeResultUrl(nodeUri: string, signerOrAuthToken: Signer | string, jobId: string, index: number): Promise<string>;
|
|
29
|
+
getComputeResult(nodeUri: string, signerOrAuthToken: Signer | string, jobId: string, index: number, offset?: number): Promise<ComputeResultStream>;
|
|
30
|
+
generateAuthToken(consumer: Signer, nodeUri: string, signal?: AbortSignal): Promise<string>;
|
|
31
|
+
invalidateAuthToken(consumer: Signer, token: string, nodeUri: string, signal?: AbortSignal): Promise<{
|
|
32
|
+
success: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
resolveDdo(nodeUri: string, did: string, signal?: AbortSignal): Promise<any>;
|
|
35
|
+
validateDdo(nodeUri: string, ddo: DDO, signer: Signer, signal?: AbortSignal): Promise<ValidateMetadata>;
|
|
36
|
+
isValidProvider(url: string, signal?: AbortSignal): Promise<boolean>;
|
|
37
|
+
PolicyServerPassthrough(nodeUri: string, request: PolicyServerPassthroughCommand, signal?: AbortSignal): Promise<any>;
|
|
38
|
+
initializePSVerification(nodeUri: string, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
|
|
39
|
+
downloadNodeLogs(nodeUri: string, signer: Signer, startTime: string, endTime: string, maxLogs?: number, moduleName?: string, level?: string, page?: number, signal?: AbortSignal): Promise<any>;
|
|
40
|
+
setupP2P(config: P2PConfig): Promise<void>;
|
|
41
|
+
getDiscoveredNodes(): Array<{
|
|
42
|
+
peerId: string;
|
|
43
|
+
multiaddrs: string[];
|
|
44
|
+
}>;
|
|
45
|
+
fetchConfig(nodeUri: string, payload: Record<string, any>): Promise<any>;
|
|
46
|
+
pushConfig(nodeUri: string, payload: Record<string, any>): Promise<any>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { Signer } from 'ethers';
|
|
2
|
+
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, ComputeResultStream } from '../../@types/index.js';
|
|
3
|
+
import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
|
|
4
|
+
export declare class HttpProvider {
|
|
5
|
+
protected getConsumerAddress(s: Signer | string): Promise<string>;
|
|
6
|
+
protected getSignature(s: Signer | string, nonce: string, command: string): Promise<string>;
|
|
7
|
+
protected getAuthorization(s: Signer | string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the provider endpoints
|
|
10
|
+
* @param {string} nodeUri - the provider url
|
|
11
|
+
* @return {Promise<any>}
|
|
12
|
+
*/
|
|
13
|
+
getEndpoints(nodeUri: string, authorization?: string): Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the node public key
|
|
16
|
+
* @return {string} The node public key
|
|
17
|
+
*/
|
|
18
|
+
private getNodePublicKey;
|
|
19
|
+
/**
|
|
20
|
+
* This function returns the endpoint URL for a given service name.
|
|
21
|
+
* @param {ServiceEndpoint[]} servicesEndpoints - The array of service endpoints
|
|
22
|
+
* @param {string} serviceName - The name of the service
|
|
23
|
+
* @returns {ServiceEndpoint} The endpoint URL for the given service name
|
|
24
|
+
*/
|
|
25
|
+
getEndpointURL(servicesEndpoints: ServiceEndpoint[], serviceName: string): ServiceEndpoint;
|
|
26
|
+
/**
|
|
27
|
+
* This function returns an array of service endpoints for a given provider endpoint.
|
|
28
|
+
* @param {string} providerEndpoint - The provider endpoint
|
|
29
|
+
* @param {any} endpoints - The endpoints object
|
|
30
|
+
* @returns {ServiceEndpoint[]} An array of service endpoints
|
|
31
|
+
*/
|
|
32
|
+
getServiceEndpoints(providerEndpoint: string, endpoints: any): Promise<ServiceEndpoint[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Get current nonce from the provider.
|
|
35
|
+
* @param {string} nodeUri provider uri address
|
|
36
|
+
* @param {string} consumerAddress Publisher address
|
|
37
|
+
* @param {AbortSignal} signal abort signal
|
|
38
|
+
* @param {string} providerEndpoints Identifier of the asset to be registered in ocean
|
|
39
|
+
* @param {string} serviceEndpoints document description object (DDO)=
|
|
40
|
+
* @return {Promise<string>} urlDetails
|
|
41
|
+
*/
|
|
42
|
+
getNonce(nodeUri: string, consumerAddress: string, signal?: AbortSignal, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<number>;
|
|
43
|
+
/**
|
|
44
|
+
* Encrypt data using the Provider's own symmetric key
|
|
45
|
+
* @param {string} data data in json format that needs to be sent , it can either be a DDO or a File array
|
|
46
|
+
* @param {number} chainId network's id so provider can choose the corresponding Signer object
|
|
47
|
+
* @param {string} nodeUri provider uri address
|
|
48
|
+
* @param {AbortSignal} signal abort signal
|
|
49
|
+
* @return {Promise<string>} urlDetails
|
|
50
|
+
*/
|
|
51
|
+
encrypt(data: any, chainId: number, nodeUri: string, signerOrAuthToken: Signer | string, policyServer?: any, signal?: AbortSignal): Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Get file details for a given DID and service ID.
|
|
54
|
+
* @param {string} did - The DID to check.
|
|
55
|
+
* @param {string} serviceId - The service ID to check.
|
|
56
|
+
* @param {string} nodeUri - The URI of the provider.
|
|
57
|
+
* @param {boolean} [withChecksum=false] - Whether or not to include a checksum.
|
|
58
|
+
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
59
|
+
* @returns {Promise<FileInfo[]>} A promise that resolves with an array of file info objects.
|
|
60
|
+
*/
|
|
61
|
+
checkDidFiles(did: string, serviceId: string, nodeUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Get File details (if possible)
|
|
64
|
+
* @param {StorageObject} file one of the supported file structures
|
|
65
|
+
* @param {string} nodeUri uri of the provider that will be used to check the file
|
|
66
|
+
* @param {boolean} [withChecksum=false] - Whether or not to include a checksum.
|
|
67
|
+
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
68
|
+
* @returns {Promise<FileInfo[]>} A promise that resolves with an array of file info objects.
|
|
69
|
+
*/
|
|
70
|
+
getFileInfo(file: StorageObject, nodeUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Returns compute environments from a provider.
|
|
73
|
+
* @param {string} nodeUri - The URI of the provider.
|
|
74
|
+
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
75
|
+
* @returns {Promise<ComputeEnvironment[]>} A promise that resolves with compute environments.
|
|
76
|
+
*/
|
|
77
|
+
getComputeEnvironments(nodeUri: string, signal?: AbortSignal): Promise<ComputeEnvironment[]>;
|
|
78
|
+
/**
|
|
79
|
+
* Initializes the provider for a service request.
|
|
80
|
+
* @param {string} did - The asset DID .
|
|
81
|
+
* @param {string} serviceId - The asset service ID.
|
|
82
|
+
* @param {number} fileIndex - The file index.
|
|
83
|
+
* @param {string} consumerAddress - The consumer address.
|
|
84
|
+
* @param {string} nodeUri - The URI of the provider.
|
|
85
|
+
* @param {AbortSignal} [signal] - The abort signal if any.
|
|
86
|
+
* @param {UserCustomParameters} [userCustomParameters] - The custom parameters if any.
|
|
87
|
+
* @param {string} [computeEnv] - The compute environment if any.
|
|
88
|
+
* @param {number} [validUntil] - The validity time if any.
|
|
89
|
+
* @returns {Promise<ProviderInitialize>} A promise that resolves with ProviderInitialize response.
|
|
90
|
+
*/
|
|
91
|
+
initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, nodeUri: string, signal?: AbortSignal, userCustomParameters?: UserCustomParameters, computeEnv?: string, validUntil?: number): Promise<ProviderInitialize>;
|
|
92
|
+
/** Initializes the provider for a compute request.
|
|
93
|
+
* @param {ComputeAsset[]} assets The datasets array to initialize compute request.
|
|
94
|
+
* @param {ComputeAlgorithmber} algorithm The algorithm to use.
|
|
95
|
+
* @param {string} computeEnv The compute environment.
|
|
96
|
+
* @param {string} token The payment token address.
|
|
97
|
+
* @param {number} validUntil The job expiration date.
|
|
98
|
+
* @param {string} nodeUri The provider URI.
|
|
99
|
+
* @param {SignerOrAuthToken} signerOrAuthToken Signer or auth token
|
|
100
|
+
* @param {ComputeResourceRequest[]} resources The resources to start compute job with.
|
|
101
|
+
* @param {number} chainId The chain used to do payments
|
|
102
|
+
* @param {any} policyServer Policy server data.
|
|
103
|
+
* @param {AbortSignal} signal abort signal
|
|
104
|
+
* @param {dockerRegistryAuth} dockerRegistryAuth Docker registry authentication data.
|
|
105
|
+
* @return {Promise<ProviderComputeInitialize>} ProviderComputeInitialize data
|
|
106
|
+
*/
|
|
107
|
+
initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, token: string, validUntil: number, nodeUri: string, signerOrAuthToken: Signer | string, resources: ComputeResourceRequest[], chainId: number, policyServer?: any, signal?: AbortSignal, output?: ComputeOutput, dockerRegistryAuth?: dockerRegistryAuth): Promise<ProviderComputeInitializeResults>;
|
|
108
|
+
/**
|
|
109
|
+
* Gets the download URL.
|
|
110
|
+
* @param {string} did - The DID.
|
|
111
|
+
* @param {string} serviceId - The service ID.
|
|
112
|
+
* @param {number} fileIndex - The file index.
|
|
113
|
+
* @param {string} transferTxId - The transfer transaction ID.
|
|
114
|
+
* @param {string} nodeUri - The provider URI.
|
|
115
|
+
* @param {SignerOrAuthToken} signerOrAuthToken - The signer or auth token.
|
|
116
|
+
* @param {any} policyServer Policy server data.
|
|
117
|
+
* @param {UserCustomParameters} userCustomParameters - The user custom parameters.
|
|
118
|
+
* @returns {Promise<any>} The download URL.
|
|
119
|
+
*/
|
|
120
|
+
getDownloadUrl(did: string, serviceId: string, fileIndex: number, transferTxId: string, nodeUri: string, signerOrAuthToken: Signer | string, policyServer?: any, userCustomParameters?: UserCustomParameters): Promise<any>;
|
|
121
|
+
/** Instruct the provider to start a PAYED compute job
|
|
122
|
+
* @param {string} nodeUri The provider URI.
|
|
123
|
+
* @param {SignerOrAuthToken} signerOrAuthToken The consumer signer object or auth token.
|
|
124
|
+
* @param {string} computeEnv The compute environment.
|
|
125
|
+
* @param {ComputeAsset} datasets The dataset to start compute on + additionalDatasets (the additional datasets if that is the case)
|
|
126
|
+
* @param {ComputeAlgorithm} algorithm The algorithm to start compute with.
|
|
127
|
+
* @param {number} maxJobDuration The compute job max execution time.
|
|
128
|
+
* @param {string} token The token address for compute payment.
|
|
129
|
+
* @param {ComputeResourceRequest} resources The resources to start compute job with.
|
|
130
|
+
* @param {chainId} chainId The chain used to do payments
|
|
131
|
+
* @param {ComputeJobMetadata} metadata The compute job metadata. Additional metadata to be stored in the database.
|
|
132
|
+
* @param {ComputeOutput} output The compute job output settings.
|
|
133
|
+
* @param {any} policyServer Policy server data.
|
|
134
|
+
* @param {AbortSignal} signal abort signal
|
|
135
|
+
* @param {number} queueMaxWaitTime Maximum time in seconds to wait in the compute queue if resources are not available
|
|
136
|
+
* @param {dockerRegistryAuth} dockerRegistryAuth Docker registry authentication data.
|
|
137
|
+
* @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
|
|
138
|
+
*/
|
|
139
|
+
computeStart(nodeUri: string, signerOrAuthToken: Signer | string, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, maxJobDuration: number, token: string, resources: ComputeResourceRequest[], chainId: number, metadata?: ComputeJobMetadata, additionalViewers?: string[], output?: ComputeOutput, policyServer?: any, signal?: AbortSignal, queueMaxWaitTime?: number, dockerRegistryAuth?: dockerRegistryAuth): Promise<ComputeJob | ComputeJob[]>;
|
|
140
|
+
/** Instruct the provider to start a FREE compute job
|
|
141
|
+
* @param {string} nodeUri The provider URI.
|
|
142
|
+
* @param {SignerOrAuthToken} signerOrAuthToken The consumer signer object or auth token.
|
|
143
|
+
* @param {string} computeEnv The compute environment.
|
|
144
|
+
* @param {ComputeAsset} datasets The dataset to start compute on + additionalDatasets (the additional datasets if that is the case)
|
|
145
|
+
* @param {ComputeAlgorithm} algorithm The algorithm to start compute with.
|
|
146
|
+
* @param {ComputeResourceRequest} resources The resources to start compute job with.
|
|
147
|
+
* @param {ComputeJobMetadata} metadata The compute job metadata. Additional metadata to be stored in the database.
|
|
148
|
+
* @param {ComputeOutput} output The compute job output settings.
|
|
149
|
+
* @param {any} policyServer Policy server data.
|
|
150
|
+
* @param {AbortSignal} signal abort signal
|
|
151
|
+
* @param {number} queueMaxWaitTime Maximum time in seconds to wait in the compute queue if resources are not available
|
|
152
|
+
* @param {dockerRegistryAuth} dockerRegistryAuth Docker registry authentication data.
|
|
153
|
+
* @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
|
|
154
|
+
*/
|
|
155
|
+
freeComputeStart(nodeUri: string, signerOrAuthToken: Signer | string, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, resources?: ComputeResourceRequest[], metadata?: ComputeJobMetadata, additionalViewers?: string[], output?: ComputeOutput, policyServer?: any, signal?: AbortSignal, queueMaxWaitTime?: number, dockerRegistryAuth?: dockerRegistryAuth): Promise<ComputeJob | ComputeJob[]>;
|
|
156
|
+
/**
|
|
157
|
+
* @param nodeUri provider URL
|
|
158
|
+
* @param signerOrAuthToken signer or auth token
|
|
159
|
+
* @param jobId jobId
|
|
160
|
+
* @param signal abort signal
|
|
161
|
+
* @returns logs response
|
|
162
|
+
*/
|
|
163
|
+
computeStreamableLogs(nodeUri: string, signerOrAuthToken: Signer | string, jobId: string, signal?: AbortSignal): Promise<any>;
|
|
164
|
+
/** Instruct the provider to Stop the execution of a to stop a compute job.
|
|
165
|
+
* @param {string} jobId the compute job id
|
|
166
|
+
* @param {string} nodeUri The provider URI.
|
|
167
|
+
* @param {SignerOrAuthToken} signerOrAuthToken The consumer signer or auth token.
|
|
168
|
+
* @param {string} agreementId The agreement id.
|
|
169
|
+
* @param {AbortSignal} signal abort signal
|
|
170
|
+
* @return {Promise<ComputeJob | ComputeJob[]>}
|
|
171
|
+
*/
|
|
172
|
+
computeStop(jobId: string, nodeUri: string, signerOrAuthToken: Signer | string, agreementId?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
173
|
+
/** Get compute status for a specific jobId/documentId/owner.
|
|
174
|
+
* @param {string} nodeUri The URI of the provider we want to query
|
|
175
|
+
* @param {string} consumerAddress The consumer ethereum address
|
|
176
|
+
* @param {string} jobId The ID of a compute job.
|
|
177
|
+
* @param {string} agreementId The ID of the service agreement (tx id)
|
|
178
|
+
* @param {AbortSignal} signal abort signal
|
|
179
|
+
* @return {Promise<ComputeJob | ComputeJob[]>}
|
|
180
|
+
*/
|
|
181
|
+
computeStatus(nodeUri: string, signerOrAuthToken: Signer | string, jobId?: string, agreementId?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
182
|
+
/** Get compute result url
|
|
183
|
+
* @param {string} nodeUri The URI of the provider we want to query
|
|
184
|
+
* @param {SignerOrAuthToken} signerOrAuthToken signer or auth token
|
|
185
|
+
* @param {string} jobId The ID of a compute job.
|
|
186
|
+
* @param {number} index Result index
|
|
187
|
+
* @return {Promise<string>}
|
|
188
|
+
*/
|
|
189
|
+
getComputeResultUrl(nodeUri: string, signerOrAuthToken: Signer | string, jobId: string, index: number): Promise<string>;
|
|
190
|
+
getComputeResult(nodeUri: string, signerOrAuthToken: Signer | string, jobId: string, index: number, offset?: number): Promise<ComputeResultStream>;
|
|
191
|
+
/** Generates an auth token
|
|
192
|
+
* @param {Signer} consumer consumer Signer wallet object
|
|
193
|
+
* @param {string} nodeUri The URI of the provider we want to query
|
|
194
|
+
* @param {AbortSignal} signal abort signal
|
|
195
|
+
* @return {Promise<string>}
|
|
196
|
+
*/
|
|
197
|
+
generateAuthToken(consumer: Signer, nodeUri: string, signal?: AbortSignal): Promise<string>;
|
|
198
|
+
/** Invalidates an auth token
|
|
199
|
+
* @param {Signer} consumer consumer Signer wallet object
|
|
200
|
+
* @param {string} token The auth token to invalidate
|
|
201
|
+
* @param {string} nodeUri The URI of the provider we want to query
|
|
202
|
+
* @param {AbortSignal} signal abort signal
|
|
203
|
+
* @return {Promise<{ success: boolean }>}
|
|
204
|
+
*/
|
|
205
|
+
invalidateAuthToken(consumer: Signer, token: string, nodeUri: string, signal?: AbortSignal): Promise<{
|
|
206
|
+
success: boolean;
|
|
207
|
+
}>;
|
|
208
|
+
/** Check for a valid provider at URL
|
|
209
|
+
* @param {String} url provider uri address
|
|
210
|
+
* @param {AbortSignal} signal abort signal
|
|
211
|
+
* @return {Promise<boolean>} valid or not
|
|
212
|
+
*/
|
|
213
|
+
isValidProvider(url: string, signal?: AbortSignal): Promise<boolean>;
|
|
214
|
+
/** Sends a PolicyServer request to node to be passthrough to PS
|
|
215
|
+
* @param {string} nodeUri The provider URI.
|
|
216
|
+
* @param {PolicyServerPassthroughCommand} request The request to be passed through to the Policy Server.
|
|
217
|
+
* @param {AbortSignal} signal abort signal
|
|
218
|
+
*/
|
|
219
|
+
PolicyServerPassthrough(nodeUri: string, request: PolicyServerPassthroughCommand, signal?: AbortSignal): Promise<any>;
|
|
220
|
+
/** Initialize Policy Server verification
|
|
221
|
+
* @param {string} nodeUri The provider URI.
|
|
222
|
+
* @param {PolicyServerInitializeCommand} request The request to be sent to the Policy Server.
|
|
223
|
+
* @param {AbortSignal} signal abort signal
|
|
224
|
+
*/
|
|
225
|
+
initializePSVerification(nodeUri: string, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
|
|
226
|
+
/**
|
|
227
|
+
* Download node logs as an admin.
|
|
228
|
+
* @param {string} nodeUri - The provider URI.
|
|
229
|
+
* @param {Signer} signer - The admin signer.
|
|
230
|
+
* @param {string} startTime - Start time (epoch ms) to get logs from.
|
|
231
|
+
* @param {string} endTime - End time (epoch ms) to get logs to.
|
|
232
|
+
* @param {number} [maxLogs] - Maximum number of logs to retrieve (default: 100, max: 1000).
|
|
233
|
+
* @param {string} [moduleName] - Filter logs by module name.
|
|
234
|
+
* @param {string} [level] - Filter logs by log level.
|
|
235
|
+
* @param {number} [page] - Pagination page number.
|
|
236
|
+
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
237
|
+
* @returns {Promise<any>} The logs response body stream.
|
|
238
|
+
*/
|
|
239
|
+
downloadNodeLogs(nodeUri: string, signer: Signer, startTime: string, endTime: string, maxLogs?: number, moduleName?: string, level?: string, page?: number, signal?: AbortSignal): Promise<any>;
|
|
240
|
+
private noZeroX;
|
|
241
|
+
private zeroXTransformer;
|
|
242
|
+
private inputMatch;
|
|
243
|
+
resolveDdo(nodeUri: string, did: string, signal?: AbortSignal): Promise<any>;
|
|
244
|
+
validateDdo(nodeUri: string, ddo: DDO, signer: Signer, signal?: AbortSignal): Promise<ValidateMetadata>;
|
|
245
|
+
private getData;
|
|
246
|
+
}
|