@oceanprotocol/lib 9.2.2-next.0 → 9.3.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.
@@ -54,7 +54,7 @@ export declare class BaseProvider {
54
54
  * Optional; omitting it keeps the previous behaviour.
55
55
  */
56
56
  getDownloadUrl(did: string, serviceId: string, fileIndex: number, transferTxId: string, nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, policyServer?: any, userCustomParameters?: UserCustomParameters, signal?: AbortSignal): Promise<string | DownloadResponse>;
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[]>;
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, subsidyProviders?: string[]): Promise<ComputeJob | ComputeJob[]>;
58
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[]>;
59
59
  /**
60
60
  * Resolves the node's peerId for the given nodeUri via the node STATUS command,
@@ -218,7 +218,7 @@ export declare class BaseProvider {
218
218
  getServiceTemplates(nodeUri: OceanNode, chainId?: number, signal?: AbortSignal): Promise<ServiceTemplatePublic[]>;
219
219
  serviceStart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, params: ServiceStartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
220
220
  serviceStop(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
221
- serviceExtend(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal): Promise<ServiceJob[]>;
221
+ serviceExtend(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal, subsidyProviders?: string[]): Promise<ServiceJob[]>;
222
222
  serviceRestart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, params?: ServiceRestartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
223
223
  /**
224
224
  * Returns the caller's service jobs (userData stripped). Filter by `serviceId`,
@@ -230,26 +230,6 @@ export declare class BaseProvider {
230
230
  getServiceStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId?: string, signal?: AbortSignal, includeMetrics?: boolean): Promise<ServiceJob[]>;
231
231
  getServices(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, filters?: ServiceListFilters, signal?: AbortSignal): Promise<ServiceJobListed[]>;
232
232
  serviceGetStreamableLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, since?: string, signal?: AbortSignal): Promise<any>;
233
- /**
234
- * Downloads a service's /data/outputs as a zip, dispatching to the HTTP or P2P transport based
235
- * on `nodeUri`. Only for a service started without an output bucket (its results are in the
236
- * bucket otherwise); owner-only.
237
- *
238
- * - `index`: one of the zips the node took whenever a container of the service was removed
239
- * (stop, expiry, restart, recovery), listed as `outputArchives` by getServiceStatus. Works in
240
- * any status until the node's storage expiry deletes it; resumable with `offset`.
241
- * - `'live'`: a zip of the running container's /data/outputs, built as it is read — while the
242
- * service is Running (or Error before teardown). Not resumable; files being written at that
243
- * moment may come out partial.
244
- * @param {OceanNode} nodeUri The provider target (HTTP URL, or peerId / multiaddr for P2P).
245
- * @param {SignerOrAuthTokenOrSignature} signerOrAuthToken Signer, JWT auth token, or precomputed signature used to authenticate the request.
246
- * @param {string} serviceId The service.
247
- * @param {number | 'live'} index An archive index, or `'live'`.
248
- * @param {number} [offset=0] Byte offset to resume an archive download from.
249
- * @param {AbortSignal} [signal] Abort signal that cancels the download.
250
- * @return {Promise<ComputeResultStream>} An async-iterable stream of the zip, starting at `offset`.
251
- */
252
- serviceGetResult(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, index: number | 'live', offset?: number, signal?: AbortSignal): Promise<ComputeResultStream>;
253
233
  fetchConfig(nodeUri: OceanNode, payload: Record<string, any>): Promise<any>;
254
234
  pushConfig(nodeUri: OceanNode, payload: Record<string, any>): Promise<any>;
255
235
  }
@@ -143,9 +143,10 @@ export declare class HttpProvider {
143
143
  * @param {number} queueMaxWaitTime Maximum time in seconds to wait in the compute queue if resources are not available
144
144
  * @param {dockerRegistryAuth} dockerRegistryAuth Docker registry authentication data.
145
145
  * @param {string} outputBucketId Persistent-storage bucket id to store job results in, mounted at /data/outputs. Mutually exclusive with output.
146
+ * @param {string[]} subsidyProviders Optional consumer-selected subsidy provider addresses; resolved tri-state by the node (omit = node default, [] = none, populated = only these). See ocean-node #1485.
146
147
  * @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
147
148
  */
148
- computeStart(nodeUri: string, 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[]>;
149
+ computeStart(nodeUri: string, 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, subsidyProviders?: string[]): Promise<ComputeJob | ComputeJob[]>;
149
150
  /** Instruct the provider to start a FREE compute job
150
151
  * @param {string} nodeUri The provider URI.
151
152
  * @param {SignerOrAuthToken} signerOrAuthToken The consumer signer object or auth token.
@@ -328,9 +329,10 @@ export declare class HttpProvider {
328
329
  serviceStop(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
329
330
  /**
330
331
  * Extends a running service's expiry by paying for additional duration.
332
+ * @param {string[]} subsidyProviders Optional consumer-selected subsidy provider addresses; resolved tri-state by the node (omit = node default, [] = none, populated = only these). See ocean-node #1485.
331
333
  * @return {Promise<ServiceJob[]>} The updated service job (single-element array).
332
334
  */
333
- serviceExtend(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal): Promise<ServiceJob[]>;
335
+ serviceExtend(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal, subsidyProviders?: string[]): Promise<ServiceJob[]>;
334
336
  /**
335
337
  * Restarts a running service (recreates the container) while keeping the same serviceId,
336
338
  * payment, resources, host port(s) and expiry.
@@ -368,16 +370,4 @@ export declare class HttpProvider {
368
370
  */
369
371
  getServices(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, filters?: ServiceListFilters, signal?: AbortSignal): Promise<ServiceJobListed[]>;
370
372
  serviceGetStreamableLogs(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, since?: string, signal?: AbortSignal): Promise<any>;
371
- /**
372
- * Downloads a service's /data/outputs as a zip over HTTP — for a service started without an
373
- * output bucket. Owner-only.
374
- * @param {string} nodeUri The provider URI.
375
- * @param {SignerOrAuthTokenOrSignature} signerOrAuthToken Signer, JWT auth token, or precomputed signature used to authenticate the request.
376
- * @param {string} serviceId The service.
377
- * @param {number | 'live'} index An `index` from the service's `outputArchives` (see getServiceStatus), or `'live'` for a zip of the running container's /data/outputs, built as it is read.
378
- * @param {number} [offset=0] Byte offset to resume an archive download from, sent as the `offset` query parameter (the node answers 200 with the bytes from there on). Must be a non-negative safe integer; not supported with `'live'`.
379
- * @param {AbortSignal} [signal] Abort signal that cancels the in-flight request.
380
- * @return {Promise<ComputeResultStream>} An async-iterable stream of the zip, starting at `offset`.
381
- */
382
- serviceGetResult(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, index: number | 'live', offset?: number, signal?: AbortSignal): Promise<ComputeResultStream>;
383
373
  }
@@ -562,7 +562,7 @@ export declare class P2pProvider {
562
562
  /**
563
563
  * Start a paid compute job via P2P.
564
564
  */
565
- 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[]>;
565
+ 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, subsidyProviders?: string[]): Promise<ComputeJob | ComputeJob[]>;
566
566
  /**
567
567
  * Start a free compute job via P2P.
568
568
  */
@@ -706,7 +706,7 @@ export declare class P2pProvider {
706
706
  getServiceTemplates(nodeUri: OceanNode, chainId?: number, signal?: AbortSignal): Promise<ServiceTemplatePublic[]>;
707
707
  serviceStart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, params: ServiceStartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
708
708
  serviceStop(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
709
- serviceExtend(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal): Promise<ServiceJob[]>;
709
+ serviceExtend(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal, subsidyProviders?: string[]): Promise<ServiceJob[]>;
710
710
  /**
711
711
  * Restarts a running service (recreates the container) while keeping the same serviceId,
712
712
  * payment, resources, host port(s) and expiry.
@@ -744,21 +744,4 @@ export declare class P2pProvider {
744
744
  * (Unix seconds, or a relative duration like '30s'/'2h'); omit for the full history then live.
745
745
  */
746
746
  serviceGetStreamableLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, since?: string, signal?: AbortSignal): Promise<any>;
747
- /**
748
- * Downloads a service's /data/outputs as a zip over libp2p — for a service started without an
749
- * output bucket. Owner-only.
750
- *
751
- * The transfer mirrors `downloadPersistentStorageFile`: `dialAndStream` takes a concurrency
752
- * slot, the first frame is a status JSON (an `httpStatus >= 400` throws and releases the
753
- * slot), and the returned generator streams the zip with flow control, resetting the stream
754
- * and releasing the slot however iteration ends.
755
- * @param {OceanNode} nodeUri The provider node (peerId / multiaddr).
756
- * @param {SignerOrAuthTokenOrSignature} signerOrAuthToken Signer, JWT auth token, or precomputed signature used to authenticate the request.
757
- * @param {string} serviceId The service.
758
- * @param {number | 'live'} index An `index` from the service's `outputArchives` (see getServiceStatus), or `'live'` for a zip of the running container's /data/outputs, built as it is read.
759
- * @param {number} [offset=0] Byte offset to resume an archive download from. Must be a non-negative safe integer; not supported with `'live'`.
760
- * @param {AbortSignal} [signal] Abort signal that cancels the download mid-flight and tears down the stream.
761
- * @return {Promise<ComputeResultStream>} An async-iterable stream of the zip, starting at `offset`.
762
- */
763
- serviceGetResult(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, index: number | 'live', offset?: number, signal?: AbortSignal): Promise<ComputeResultStream>;
764
747
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oceanprotocol/lib",
3
3
  "source": "./src/index.ts",
4
- "version": "9.2.2-next.0",
4
+ "version": "9.3.0-next.0",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "module": "./dist/lib.module.mjs",
7
7
  "type": "module",
@@ -83,7 +83,7 @@
83
83
  "@libp2p/websockets": "^10.1.21",
84
84
  "@multiformats/multiaddr": "^13.0.3",
85
85
  "@oasisprotocol/sapphire-ethers-v6": "^6.0.1",
86
- "@oceanprotocol/ddo-js": "^1.0.0",
86
+ "@oceanprotocol/ddo-js": "^0.4.1",
87
87
  "bignumber.js": "^11.1.5",
88
88
  "cross-fetch": "^4.1.0",
89
89
  "crypto-js": "^4.2.0",
@@ -98,7 +98,7 @@
98
98
  "devDependencies": {
99
99
  "@eslint/js": "^10.0.1",
100
100
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
101
- "@oceanprotocol/contracts": "^2.9.0",
101
+ "@oceanprotocol/contracts": "^3.1.0",
102
102
  "@types/chai": "^5.2.3",
103
103
  "@types/crypto-js": "^4.2.2",
104
104
  "@types/jsonwebtoken": "^9.0.10",
@@ -1,6 +0,0 @@
1
- /**
2
- * Validates the target of a `serviceGetResult` call before anything is signed or dialled: an
3
- * archive `index` (with an optional resume `offset`), or `'live'` (which cannot be resumed —
4
- * each live zip is built afresh, so a byte offset into one means nothing in the next).
5
- */
6
- export declare function assertServiceResultTarget(index: number | 'live', offset: number): void;