@oceanprotocol/lib 9.2.0 → 9.2.2-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.
@@ -59,6 +59,8 @@ export interface ComputeEnvironment {
59
59
  storageExpiry?: number;
60
60
  minJobDuration?: number;
61
61
  maxJobDuration?: number;
62
+ minServiceDuration?: number;
63
+ maxServiceDuration?: number;
62
64
  maxJobs?: number;
63
65
  runningJobs: number;
64
66
  runningfreeJobs?: number;
@@ -81,6 +81,7 @@ export interface NodeStatus {
81
81
  uptime: number;
82
82
  persistentStorage?: {
83
83
  accessLists?: AccessList[];
84
+ allowBucketSharing?: boolean;
84
85
  };
85
86
  }
86
87
  /**
@@ -243,6 +244,7 @@ export declare const PROTOCOL_COMMANDS: {
243
244
  SERVICE_LIST: string;
244
245
  SERVICE_EXTEND: string;
245
246
  SERVICE_GET_STREAMABLE_LOGS: string;
247
+ SERVICE_GET_RESULT: string;
246
248
  };
247
249
  export interface NodeLogsParams {
248
250
  logId?: string;
@@ -66,6 +66,13 @@ export interface ServiceJobPayment {
66
66
  cost?: string | number;
67
67
  [key: string]: any;
68
68
  }
69
+ export interface ServiceOutputArchive {
70
+ index: number;
71
+ filename: string;
72
+ filesize: number;
73
+ createdAt: number;
74
+ containerId: string;
75
+ }
69
76
  export interface ServiceJob {
70
77
  serviceId: string;
71
78
  clusterHash: string;
@@ -94,8 +101,10 @@ export interface ServiceJob {
94
101
  extendPayments?: ServiceJobPayment[];
95
102
  runtimeMetrics?: ContainerMetricsSnapshot;
96
103
  metadata?: ComputeJobMetadata;
104
+ outputBucketId?: string;
105
+ outputArchives?: ServiceOutputArchive[];
97
106
  }
98
- export type ServiceJobListed = Omit<ServiceJob, 'dockerCmd' | 'dockerEntrypoint' | 'dockerfile' | 'additionalDockerFiles' | 'runtimeMetrics'>;
107
+ export type ServiceJobListed = Omit<ServiceJob, 'dockerCmd' | 'dockerEntrypoint' | 'dockerfile' | 'additionalDockerFiles' | 'runtimeMetrics' | 'outputArchives'>;
99
108
  export interface ServiceListFilters {
100
109
  status?: ServiceStatusNumber;
101
110
  includeAllStatuses?: boolean;
@@ -230,6 +230,26 @@ 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>;
233
253
  fetchConfig(nodeUri: OceanNode, payload: Record<string, any>): Promise<any>;
234
254
  pushConfig(nodeUri: OceanNode, payload: Record<string, any>): Promise<any>;
235
255
  }
@@ -368,4 +368,16 @@ export declare class HttpProvider {
368
368
  */
369
369
  getServices(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, filters?: ServiceListFilters, signal?: AbortSignal): Promise<ServiceJobListed[]>;
370
370
  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>;
371
383
  }
@@ -744,4 +744,21 @@ 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>;
747
764
  }
@@ -0,0 +1,6 @@
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;
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.0",
4
+ "version": "9.2.2-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": "^0.4.1",
86
+ "@oceanprotocol/ddo-js": "^1.0.0",
87
87
  "bignumber.js": "^11.1.5",
88
88
  "cross-fetch": "^4.1.0",
89
89
  "crypto-js": "^4.2.0",