@oceanprotocol/lib 9.0.0-next.11 → 9.0.0-next.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/lib.modern.mjs +2 -2
- package/dist/lib.module.mjs +2 -2
- package/dist/types/@types/Compute.d.ts +67 -1
- package/dist/types/@types/Datatoken.d.ts +1 -1
- package/dist/types/@types/File.d.ts +1 -1
- package/dist/types/@types/NFTFactory.d.ts +1 -1
- package/dist/types/@types/PolicyServer.d.ts +3 -1
- package/dist/types/@types/Provider.d.ts +1 -0
- package/dist/types/config/Config.d.ts +2 -2
- package/dist/types/config/ConfigHelper.d.ts +1 -1
- package/dist/types/contracts/EnterpriseFeeCollector.d.ts +3 -3
- package/dist/types/contracts/Escrow.d.ts +3 -3
- package/dist/types/services/Provider.d.ts +1 -1
- package/dist/types/services/providers/BaseProvider.d.ts +104 -11
- package/dist/types/services/providers/HttpProvider.d.ts +25 -4
- package/dist/types/services/providers/P2pProvider.d.ts +460 -16
- package/dist/types/services/providers/lpFraming.d.ts +173 -0
- package/dist/types/utils/C2dCapability.d.ts +78 -0
- package/dist/types/utils/General.d.ts +15 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MetadataAlgorithm, ConsumerParameter } from '@oceanprotocol/ddo-js';
|
|
2
|
-
import { StorageObject, EncryptMethod } from './File';
|
|
2
|
+
import { StorageObject, EncryptMethod } from './File.js';
|
|
3
|
+
import { NodeP2P } from './Provider.js';
|
|
3
4
|
export type ComputeResultType = 'algorithmLog' | 'output' | 'configrationLog' | 'publishLog';
|
|
4
5
|
export interface RunningPlatform {
|
|
5
6
|
architecture: string;
|
|
@@ -239,3 +240,68 @@ export interface dockerRegistryAuth {
|
|
|
239
240
|
auth?: string;
|
|
240
241
|
}
|
|
241
242
|
export type ComputeResultStream = AsyncIterable<Uint8Array>;
|
|
243
|
+
/**
|
|
244
|
+
* One resource dimension of a compute-provider search, e.g. `{ resource: 'cpu', value: 4 }`.
|
|
245
|
+
* `resource` is deliberately an open string here too, matching the underlying capability
|
|
246
|
+
* format — a caller can ask for a resource type this package has no built-in knowledge of
|
|
247
|
+
* (`'fpga'`, `'pcie'`, anything a compute engine reports) and still get a well-typed request.
|
|
248
|
+
*/
|
|
249
|
+
export interface ComputeSearchDimension {
|
|
250
|
+
resource: string;
|
|
251
|
+
value: number;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* A typed request to `BaseProvider.findComputeProviders`. Built entirely from ordinary typed
|
|
255
|
+
* values — never a hand-built JSON string, never a content id.
|
|
256
|
+
*/
|
|
257
|
+
export interface FindComputeProvidersRequest {
|
|
258
|
+
free: boolean;
|
|
259
|
+
/** One entry per resource dimension. The result is the intersection of all of them. */
|
|
260
|
+
resources: ComputeSearchDimension[];
|
|
261
|
+
/**
|
|
262
|
+
* Optional per-resource qualifier (e.g. `{ gpu: 'A100' }`) applied only at the verification
|
|
263
|
+
* step, against a candidate's real compute environments. Never hashed and never part of a
|
|
264
|
+
* lookup string — nothing that discriminates within a resource is.
|
|
265
|
+
*/
|
|
266
|
+
models?: Record<string, string>;
|
|
267
|
+
signal?: AbortSignal;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* A compute provider that announced a matching bucket for every requested dimension *and*
|
|
271
|
+
* whose real compute environments (fetched during verification) actually satisfy the request.
|
|
272
|
+
* `node` is directly usable as the `node` argument to other typed calls on this SDK's provider
|
|
273
|
+
* client (e.g. `getComputeEnvironments`, `initializeCompute`).
|
|
274
|
+
*/
|
|
275
|
+
export interface ComputeProviderMatch {
|
|
276
|
+
node: NodeP2P;
|
|
277
|
+
environments: ComputeEnvironment[];
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* The outcome of one requested dimension's provider lookup, before verification and before it
|
|
281
|
+
* is intersected with any other requested dimension. Carried on the result specifically so an
|
|
282
|
+
* empty search is never a mystery — a caller can see exactly which dimension(s) had nothing,
|
|
283
|
+
* instead of a single opaque empty list.
|
|
284
|
+
*/
|
|
285
|
+
export interface ComputeSearchDimensionResult {
|
|
286
|
+
resource: string;
|
|
287
|
+
/** The value as requested, before bucketing. */
|
|
288
|
+
value: number;
|
|
289
|
+
/** The bucket this dimension's lookup actually used. */
|
|
290
|
+
bucket: number;
|
|
291
|
+
/** Provider ids that announced this bucket, before verification or intersection with other dimensions. */
|
|
292
|
+
providerIds: string[];
|
|
293
|
+
/** Set when this dimension's lookup ended early. `providerIds` is still real, just possibly incomplete. */
|
|
294
|
+
partial?: true;
|
|
295
|
+
/** Present alongside `partial`, describing why the lookup ended early. */
|
|
296
|
+
error?: string;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Result of `BaseProvider.findComputeProviders`. Always a typed value, even when nothing
|
|
300
|
+
* matched — "nothing found" is a normal outcome here, never a thrown error.
|
|
301
|
+
*/
|
|
302
|
+
export interface FindComputeProvidersResult {
|
|
303
|
+
/** Providers that satisfy every requested dimension, verified against their real environments. */
|
|
304
|
+
providers: ComputeProviderMatch[];
|
|
305
|
+
/** One entry per requested dimension, in request order. */
|
|
306
|
+
dimensions: ComputeSearchDimensionResult[];
|
|
307
|
+
}
|
|
@@ -4,6 +4,8 @@ export interface PolicyServerPassthroughCommand {
|
|
|
4
4
|
export interface PolicyServerInitializeCommand {
|
|
5
5
|
documentId?: string;
|
|
6
6
|
serviceId?: string;
|
|
7
|
-
consumerAddress?: string;
|
|
8
7
|
policyServer?: any;
|
|
8
|
+
consumerAddress?: string;
|
|
9
|
+
nonce?: string;
|
|
10
|
+
signature?: string;
|
|
9
11
|
}
|
|
@@ -114,6 +114,7 @@ export declare const PROTOCOL_COMMANDS: {
|
|
|
114
114
|
HANDLE_INDEXING_THREAD: string;
|
|
115
115
|
COLLECT_FEES: string;
|
|
116
116
|
POLICY_SERVER_PASSTHROUGH: string;
|
|
117
|
+
POLICY_SERVER_INITIALIZE: string;
|
|
117
118
|
GET_P2P_PEER: string;
|
|
118
119
|
GET_P2P_PEERS: string;
|
|
119
120
|
GET_P2P_NETWORK_STATS: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import { AbiItem } from '../@types';
|
|
3
|
-
import { Config } from '../config';
|
|
4
|
-
import { SmartContractWithAddress } from './SmartContractWithAddress';
|
|
2
|
+
import { AbiItem } from '../@types/index.js';
|
|
3
|
+
import { Config } from '../config/index.js';
|
|
4
|
+
import { SmartContractWithAddress } from './SmartContractWithAddress.js';
|
|
5
5
|
export declare class EnterpriseFeeCollectorContract extends SmartContractWithAddress {
|
|
6
6
|
getDefaultAbi(): AbiItem[];
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Signer, TransactionRequest } from 'ethers';
|
|
2
|
-
import { AbiItem, ReceiptOrEstimate, ValidationResponse, DepositData, PermitData, AuthData, LockData } from '../@types';
|
|
3
|
-
import { Config } from '../config';
|
|
4
|
-
import { SmartContractWithAddress } from './SmartContractWithAddress';
|
|
2
|
+
import { AbiItem, ReceiptOrEstimate, ValidationResponse, DepositData, PermitData, AuthData, LockData } from '../@types/index.js';
|
|
3
|
+
import { Config } from '../config/index.js';
|
|
4
|
+
import { SmartContractWithAddress } from './SmartContractWithAddress.js';
|
|
5
5
|
export declare class EscrowContract extends SmartContractWithAddress {
|
|
6
6
|
abiEnterprise: AbiItem[];
|
|
7
7
|
getDefaultAbi(): AbiItem[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BaseProvider } from './providers/BaseProvider.js';
|
|
2
|
-
export { BaseProvider as Provider, isP2pUri, OCEAN_P2P_PROTOCOL, type P2PConfig } from './providers/BaseProvider.js';
|
|
2
|
+
export { BaseProvider as Provider, isP2pUri, OCEAN_P2P_PROTOCOL, type P2PConfig, type P2pProviderRecord, type Multiaddr, P2pError, type P2pErrorType, classifyP2pError, isRetryableP2pError } from './providers/BaseProvider.js';
|
|
3
3
|
export declare const ProviderInstance: BaseProvider;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ComputeResultStream, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, OceanNode, CompleteSignature, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
|
|
2
|
+
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ComputeResultStream, FindComputeProvidersRequest, FindComputeProvidersResult, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, OceanNode, CompleteSignature, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
|
|
3
3
|
import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
|
|
4
|
-
import { P2pProvider, type P2PConfig, type P2PRequestBodyStream } from './P2pProvider.js';
|
|
5
|
-
export { OCEAN_P2P_PROTOCOL, type P2PConfig } from './P2pProvider.js';
|
|
4
|
+
import { type P2pProvider, type P2PConfig, type P2PRequestBodyStream } from './P2pProvider.js';
|
|
5
|
+
export { OCEAN_P2P_PROTOCOL, type P2PConfig, type P2pProviderRecord, type Multiaddr, P2pError, type P2pErrorType, classifyP2pError, isRetryableP2pError } from './P2pProvider.js';
|
|
6
6
|
export declare function getConsumerAddress(signerOrAuthToken: SignerOrAuthTokenOrSignature): Promise<string>;
|
|
7
7
|
export declare function getSignature(signerOrAuthToken: SignerOrAuthTokenOrSignature, nonce: string, command: string, issuerPeerId?: string): Promise<string | null>;
|
|
8
8
|
export declare function getAuthorization(signerOrAuthToken: SignerOrAuthTokenOrSignature): string | undefined;
|
|
@@ -18,9 +18,42 @@ export declare class BaseProvider {
|
|
|
18
18
|
checkDidFiles(did: string, serviceId: string, nodeUri: OceanNode, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
19
19
|
getFileInfo(file: StorageObject, nodeUri: OceanNode, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
20
20
|
getComputeEnvironments(nodeUri: OceanNode, signal?: AbortSignal): Promise<ComputeEnvironment[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Searches for compute providers that can satisfy a typed resource request — a caller never
|
|
23
|
+
* builds a lookup string, computes a bucket, or sees a content id; it passes ordinary typed
|
|
24
|
+
* values in and gets typed providers back.
|
|
25
|
+
*
|
|
26
|
+
* `node` selects the transport the same way every other method on this class does. Provider
|
|
27
|
+
* discovery here is a DHT lookup, so it must identify the P2P network — a peer id, a
|
|
28
|
+
* multiaddr, or a {@link NodeP2P} — rather than a plain HTTP provider URL; there is no HTTP
|
|
29
|
+
* equivalent for it (yet).
|
|
30
|
+
*
|
|
31
|
+
* A multi-dimension request (e.g. `cpu` *and* `ram`) is handled as an intersection of one
|
|
32
|
+
* lookup per dimension, never as a single wider lookup string. Because bucketing rounds down
|
|
33
|
+
* on both the announcing and the querying side, a bucket match is a prefilter, not proof of
|
|
34
|
+
* anything: a request for `cpu: 9` buckets to `8` and matches a provider whose real maximum
|
|
35
|
+
* is exactly `8`. Every candidate surviving the intersection is therefore verified here
|
|
36
|
+
* against its real compute environments before it is returned; `models` — a per-resource
|
|
37
|
+
* qualifier such as a GPU name — is applied only at that step, never as part of a lookup
|
|
38
|
+
* string, because nothing that discriminates within a resource is ever hashed.
|
|
39
|
+
*
|
|
40
|
+
* Never throws for "nothing found". A fleet that has not heard of a requested resource (or,
|
|
41
|
+
* dimension by dimension, any resource) simply yields no providers for it, and `dimensions`
|
|
42
|
+
* says exactly which requested resource that was — a caller is never left staring at a
|
|
43
|
+
* silently empty result with no way to tell which part of the request came up short.
|
|
44
|
+
*/
|
|
45
|
+
findComputeProviders(node: OceanNode, request: FindComputeProvidersRequest): Promise<FindComputeProvidersResult>;
|
|
21
46
|
initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, nodeUri: OceanNode, signal?: AbortSignal, userCustomParameters?: UserCustomParameters, computeEnv?: string, validUntil?: number): Promise<ProviderInitialize>;
|
|
22
47
|
initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, token: string, validUntil: number, nodeUri: OceanNode, consumerAddress: string, resources: ComputeResourceRequest[], chainId: number, policyServer?: any, signal?: AbortSignal, queueMaxWaitTime?: number, dockerRegistryAuthData?: dockerRegistryAuth, output?: ComputeOutput): Promise<ProviderComputeInitializeResults>;
|
|
23
|
-
|
|
48
|
+
/**
|
|
49
|
+
* @param signal Cancels the operation. On the P2P transport it covers the whole
|
|
50
|
+
* transfer — the nonce round-trip, the dial and every frame of the body — so a
|
|
51
|
+
* download already running stops when it fires. The HTTP transport returns a URL for
|
|
52
|
+
* the caller to fetch and so performs no transfer here, but building that URL from a
|
|
53
|
+
* `Signer` does fetch a nonce from the node, and the signal covers that request.
|
|
54
|
+
* Optional; omitting it keeps the previous behaviour.
|
|
55
|
+
*/
|
|
56
|
+
getDownloadUrl(did: string, serviceId: string, fileIndex: number, transferTxId: string, nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, policyServer?: any, userCustomParameters?: UserCustomParameters, signal?: AbortSignal): Promise<string | DownloadResponse>;
|
|
24
57
|
computeStart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, 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, outputBucketId?: string): Promise<ComputeJob | ComputeJob[]>;
|
|
25
58
|
freeComputeStart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, resources?: ComputeResourceRequest[], metadata?: ComputeJobMetadata, additionalViewers?: string[], output?: ComputeOutput, policyServer?: any, signal?: AbortSignal, queueMaxWaitTime?: number, dockerRegistryAuth?: dockerRegistryAuth, outputBucketId?: string): Promise<ComputeJob | ComputeJob[]>;
|
|
26
59
|
/**
|
|
@@ -58,8 +91,28 @@ export declare class BaseProvider {
|
|
|
58
91
|
* credentials don't verify. `false`: metrics are never attached.
|
|
59
92
|
*/
|
|
60
93
|
computeStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId?: string, agreementId?: string, signal?: AbortSignal, includeMetrics?: boolean): Promise<NodeComputeJob | NodeComputeJob[]>;
|
|
61
|
-
|
|
62
|
-
|
|
94
|
+
/**
|
|
95
|
+
* A fetchable URL for a compute result.
|
|
96
|
+
*
|
|
97
|
+
* HTTP-transport only. A P2P peer answers with the result bytes themselves and the
|
|
98
|
+
* protocol carries no location for them, so this rejects for a P2P target — use
|
|
99
|
+
* {@link getComputeResult} there, which returns the bytes as an async iterable.
|
|
100
|
+
*
|
|
101
|
+
* @param signal Cancels the nonce round-trip the URL is built from. Only reaches the
|
|
102
|
+
* network when `signerOrAuthToken` is a `Signer`; a token or a pre-made signature
|
|
103
|
+
* needs no nonce and this becomes pure string assembly. Optional; omitting it keeps
|
|
104
|
+
* the previous behaviour.
|
|
105
|
+
*/
|
|
106
|
+
getComputeResultUrl(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId: string, index: number, signal?: AbortSignal): Promise<string>;
|
|
107
|
+
/**
|
|
108
|
+
* @param signal Cancels the operation. On the P2P transport it covers the whole
|
|
109
|
+
* transfer — the nonce round-trip, the dial and every frame the returned generator
|
|
110
|
+
* reads — so a result already being transferred stops when it fires. The HTTP
|
|
111
|
+
* transport covers the same ground: the nonce round-trip, the request and the
|
|
112
|
+
* response body. On both, aborting mid-transfer makes the iterable throw rather than
|
|
113
|
+
* end quietly. Optional; omitting it keeps the previous behaviour.
|
|
114
|
+
*/
|
|
115
|
+
getComputeResult(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId: string, index: number, offset?: number, signal?: AbortSignal): Promise<ComputeResultStream>;
|
|
63
116
|
generateAuthToken(consumer: Signer, nodeUri: OceanNode, signal?: AbortSignal): Promise<string>;
|
|
64
117
|
generateSignedAuthToken(address: string, signature: string, nonce: string, nodeUri: OceanNode, validUntil?: number, signal?: AbortSignal): Promise<string>;
|
|
65
118
|
invalidateAuthToken(consumer: Signer, token: string, nodeUri: OceanNode, signal?: AbortSignal): Promise<{
|
|
@@ -69,17 +122,57 @@ export declare class BaseProvider {
|
|
|
69
122
|
validateDdo(nodeUri: OceanNode, ddo: DDO, signerOrAuthToken: SignerOrAuthTokenOrSignature, signal?: AbortSignal): Promise<ValidateMetadata>;
|
|
70
123
|
isValidProvider(url: OceanNode, signal?: AbortSignal): Promise<boolean>;
|
|
71
124
|
PolicyServerPassthrough(nodeUri: OceanNode, request: PolicyServerPassthroughCommand, signal?: AbortSignal): Promise<any>;
|
|
72
|
-
initializePSVerification(nodeUri: OceanNode, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
|
|
125
|
+
initializePSVerification(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
|
|
73
126
|
downloadNodeLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, startTime: string, endTime: string, maxLogs?: number, moduleName?: string, level?: string, page?: number, signal?: AbortSignal): Promise<NodeLogEntry[]>;
|
|
74
127
|
getNodeStatus(nodeUri: OceanNode, signal?: AbortSignal): Promise<NodeStatus>;
|
|
75
128
|
getNodeJobs(nodeUri: OceanNode, fromTimestamp?: number, signal?: AbortSignal): Promise<NodeComputeJob[]>;
|
|
76
129
|
setupP2P(config: P2PConfig): Promise<void>;
|
|
77
130
|
getLibp2pNode(): import("libp2p").Libp2p<import("@libp2p/interface").ServiceMap>;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Stop the shared libp2p node: close connections and release the node, so nothing
|
|
133
|
+
* keeps the process alive. Long-lived Node.js processes should call this on
|
|
134
|
+
* shutdown. There is no relay reservation to release — ocean.js listens on nothing
|
|
135
|
+
* and only ever *dials* through a relay. Safe to call when P2P was never started,
|
|
136
|
+
* and safe to call twice.
|
|
137
|
+
*/
|
|
138
|
+
stopP2P(): Promise<void>;
|
|
139
|
+
/** Alias for {@link stopP2P}. */
|
|
140
|
+
dispose(): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Every peer this client knows about, with the state of the connection to it.
|
|
143
|
+
*
|
|
144
|
+
* `peerId` and `multiaddrs` are unchanged; the connection fields are added. They are
|
|
145
|
+
* what tells a known peer apart from a reachable one — a peer can sit in the peer store
|
|
146
|
+
* with three addresses and be unreachable, or be connected only over a circuit relay
|
|
147
|
+
* that will cut the connection off after a byte budget.
|
|
148
|
+
*/
|
|
149
|
+
getDiscoveredNodes(): Promise<Awaited<ReturnType<P2pProvider['getDiscoveredNodes']>>>;
|
|
150
|
+
/**
|
|
151
|
+
* Whether P2P can do anything, as opposed to whether it is switched on: routing-table
|
|
152
|
+
* size, DHT mode, the peer store lifetimes the running node applies, and the resolution
|
|
153
|
+
* lanes.
|
|
154
|
+
*
|
|
155
|
+
* The routing table is the one to read first. A DHT lookup against an empty table finds
|
|
156
|
+
* nothing however many connections are open, because a connection to a peer that does
|
|
157
|
+
* not speak the DHT protocol is not a place a walk can start.
|
|
158
|
+
*/
|
|
159
|
+
getP2pDiagnostics(): ReturnType<P2pProvider['getP2pDiagnostics']>;
|
|
82
160
|
getMultiaddrFromPeerId(peerId: string): Promise<string>;
|
|
161
|
+
/**
|
|
162
|
+
* Which tier answered each peer-address resolution — an open connection, the peer
|
|
163
|
+
* store, or a DHT walk — plus cache hits, misses and invalidations.
|
|
164
|
+
*
|
|
165
|
+
* Read this to see whether the peer store is doing its job: an address now lives
|
|
166
|
+
* there as long as the DHT provider record that names it, and the visible effect of
|
|
167
|
+
* that should be resolutions moving out of the `dht` lane and into `peer-store`.
|
|
168
|
+
*/
|
|
169
|
+
getPeerResolutionStats(): Record<string, number>;
|
|
170
|
+
/**
|
|
171
|
+
* Forgets the cached addresses for a peer, so the next call to it resolves afresh.
|
|
172
|
+
* Failed dials already do this; call it directly when something outside the library
|
|
173
|
+
* knows a node has moved.
|
|
174
|
+
*/
|
|
175
|
+
invalidatePeerResolution(peerId: string): void;
|
|
83
176
|
createPersistentStorageBucket(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, payload: PersistentStorageCreateBucketRequest, signal?: AbortSignal): Promise<{
|
|
84
177
|
bucketId: string;
|
|
85
178
|
owner: string;
|
|
@@ -104,7 +104,12 @@ export declare class HttpProvider {
|
|
|
104
104
|
* @param {UserCustomParameters} userCustomParameters - The user custom parameters.
|
|
105
105
|
* @returns {Promise<any>} The download URL.
|
|
106
106
|
*/
|
|
107
|
-
|
|
107
|
+
/**
|
|
108
|
+
* @param {AbortSignal} signal Cancels the nonce round-trip. No download is performed
|
|
109
|
+
* here — the return value is a URL the caller fetches itself — but building that URL
|
|
110
|
+
* from a `Signer` requires a nonce from the node, and that request was uncancellable.
|
|
111
|
+
*/
|
|
112
|
+
getDownloadUrl(did: string, serviceId: string, fileIndex: number, transferTxId: string, nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, policyServer?: any, userCustomParameters?: UserCustomParameters, signal?: AbortSignal): Promise<any>;
|
|
108
113
|
/** Instruct the provider to start a PAYED compute job
|
|
109
114
|
* @param {string} nodeUri The provider URI.
|
|
110
115
|
* @param {SignerOrAuthToken} signerOrAuthToken The consumer signer object or auth token.
|
|
@@ -183,10 +188,20 @@ export declare class HttpProvider {
|
|
|
183
188
|
* @param {SignerOrAuthToken} signerOrAuthToken signer or auth token
|
|
184
189
|
* @param {string} jobId The ID of a compute job.
|
|
185
190
|
* @param {number} index Result index
|
|
191
|
+
* @param {AbortSignal} signal Cancels the nonce round-trip. This method is often
|
|
192
|
+
* described as pure string assembly, and that is only true when a token or a
|
|
193
|
+
* pre-made signature is supplied: given a `Signer` it fetches a nonce from the node
|
|
194
|
+
* first, and that request had no cancellation at all.
|
|
186
195
|
* @return {Promise<string>}
|
|
187
196
|
*/
|
|
188
|
-
getComputeResultUrl(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId: string, index: number): Promise<string>;
|
|
189
|
-
|
|
197
|
+
getComputeResultUrl(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId: string, index: number, signal?: AbortSignal): Promise<string>;
|
|
198
|
+
/**
|
|
199
|
+
* @param {AbortSignal} signal Cancels the whole operation: the nonce round-trip, the
|
|
200
|
+
* request, and the response body. Aborting mid-transfer makes the returned iterable
|
|
201
|
+
* throw rather than end quietly, so a partially read result is never mistaken for a
|
|
202
|
+
* complete one.
|
|
203
|
+
*/
|
|
204
|
+
getComputeResult(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId: string, index: number, offset?: number, signal?: AbortSignal): Promise<ComputeResultStream>;
|
|
190
205
|
/** Generates an auth token
|
|
191
206
|
* @param {Signer} consumer consumer Signer wallet object
|
|
192
207
|
* @param {string} nodeUri The URI of the provider we want to query
|
|
@@ -217,11 +232,17 @@ export declare class HttpProvider {
|
|
|
217
232
|
*/
|
|
218
233
|
PolicyServerPassthrough(nodeUri: string, request: PolicyServerPassthroughCommand, signal?: AbortSignal): Promise<any>;
|
|
219
234
|
/** Initialize Policy Server verification
|
|
235
|
+
*
|
|
236
|
+
* Authenticated exactly like `PolicyServerPassthrough`, but it is a distinct command, so
|
|
237
|
+
* the signed message uses its own command string:
|
|
238
|
+
* `consumerAddress + nonce + "PolicyServerInitialize"`. A signature is therefore scoped to
|
|
239
|
+
* one endpoint and cannot be replayed against the other.
|
|
220
240
|
* @param {string} nodeUri The provider URI.
|
|
241
|
+
* @param {SignerOrAuthTokenOrSignature} signerOrAuthToken The consumer signer object, auth token or signature.
|
|
221
242
|
* @param {PolicyServerInitializeCommand} request The request to be sent to the Policy Server.
|
|
222
243
|
* @param {AbortSignal} signal abort signal
|
|
223
244
|
*/
|
|
224
|
-
initializePSVerification(nodeUri: string, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
|
|
245
|
+
initializePSVerification(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
|
|
225
246
|
/**
|
|
226
247
|
* Download node logs as an admin.
|
|
227
248
|
* @param {string} nodeUri - The provider URI.
|