@oceanprotocol/lib 9.0.0-next.4 → 9.0.0-next.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -76,6 +76,7 @@ export interface ServiceJob {
76
76
  status: ServiceStatusNumber;
77
77
  statusText: string;
78
78
  dateCreated: string;
79
+ updatedAt?: number;
79
80
  expiresAt: number;
80
81
  duration: number;
81
82
  exposedPorts: number[];
@@ -89,24 +90,29 @@ export interface ServiceListFilters {
89
90
  status?: ServiceStatusNumber;
90
91
  includeAllStatuses?: boolean;
91
92
  fromTimestamp?: string;
93
+ updatedSince?: string;
92
94
  }
93
95
  export interface ServicePayment {
94
96
  chainId: number;
95
97
  token: string;
96
98
  }
97
99
  export type ServiceUserData = Record<string, unknown>;
98
- export interface ServiceStartParams {
99
- environment: string;
100
- image: string;
100
+ export interface ServiceContainerSpec {
101
+ image?: string;
101
102
  tag?: string;
102
103
  checksum?: string;
103
104
  dockerfile?: string;
104
105
  additionalDockerFiles?: Record<string, string>;
106
+ userData?: ServiceUserData;
105
107
  dockerCmd?: string[];
106
108
  dockerEntrypoint?: string[];
109
+ }
110
+ export type ServiceRestartParams = ServiceContainerSpec;
111
+ export interface ServiceStartParams extends ServiceContainerSpec {
112
+ environment: string;
113
+ image: string;
107
114
  exposedPorts?: number[];
108
115
  resources?: ComputeResourceRequest[];
109
116
  duration: number;
110
- userData?: ServiceUserData;
111
117
  payment: ServicePayment;
112
118
  }
@@ -1,5 +1,5 @@
1
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, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceTemplatePublic, ServiceStartParams, ServiceUserData, ServicePayment, OceanNode, CompleteSignature, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
2
+ import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ComputeResultStream, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, 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
4
  import { P2pProvider, type P2PConfig, type P2PRequestBodyStream } from './P2pProvider.js';
5
5
  export { OCEAN_P2P_PROTOCOL, type P2PConfig } from './P2pProvider.js';
@@ -36,6 +36,11 @@ export declare class BaseProvider {
36
36
  * @param {ComputeJob} job The compute job just started.
37
37
  */
38
38
  private notifyIncentiveBackendJobStarted;
39
+ /**
40
+ * @param {OceanNode} nodeUri The provider URI the service runs on.
41
+ * @param {ServiceJob} service The service job just started.
42
+ */
43
+ private notifyIncentiveBackendServiceStarted;
39
44
  computeStreamableLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId: string, signal?: AbortSignal): Promise<any>;
40
45
  computeStop(jobId: string, nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, agreementId?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
41
46
  computeStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId?: string, agreementId?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
@@ -77,7 +82,7 @@ export declare class BaseProvider {
77
82
  serviceStart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, params: ServiceStartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
78
83
  serviceStop(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
79
84
  serviceExtend(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal): Promise<ServiceJob[]>;
80
- serviceRestart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, userData?: ServiceUserData, dockerCmd?: string[], dockerEntrypoint?: string[], signal?: AbortSignal): Promise<ServiceJob[]>;
85
+ serviceRestart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, params?: ServiceRestartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
81
86
  getServiceStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId?: string, signal?: AbortSignal): Promise<ServiceJob[]>;
82
87
  getServices(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, filters?: ServiceListFilters, signal?: AbortSignal): Promise<ServiceJobListed[]>;
83
88
  serviceGetStreamableLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, since?: string, signal?: AbortSignal): Promise<any>;
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, ComputeResultStream, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceTemplatePublic, ServiceStartParams, ServiceUserData, ServicePayment, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
2
+ import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, ComputeResultStream, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
3
3
  import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
4
4
  import { type P2PRequestBodyStream } from './P2pProvider.js';
5
5
  export declare class HttpProvider {
@@ -291,13 +291,20 @@ export declare class HttpProvider {
291
291
  */
292
292
  serviceExtend(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal): Promise<ServiceJob[]>;
293
293
  /**
294
- * Restarts a running service (recreates the container). When `userData`, `dockerCmd` or
295
- * `dockerEntrypoint` is supplied it REPLACES the stored value;
296
- * otherwise the stored one is reused. Passing a new `dockerCmd` swaps the launch command
297
- * (e.g. a different model) while keeping the same serviceId, host port and expiry.
294
+ * Restarts a running service (recreates the container) while keeping the same serviceId,
295
+ * payment, resources, host port(s) and expiry.
296
+ *
297
+ * The node treats the restart atomically. Passing no container-spec fields in `params`
298
+ * (REUSE mode) bounces the container on its stored spec unchanged. Passing ANY of
299
+ * `image`/`tag`/`checksum`/`dockerfile`/`additionalDockerFiles` (RESPEC mode) rebuilds the
300
+ * container entirely from `params`: `image` becomes mandatory, exactly one of
301
+ * `tag`/`checksum`/`dockerfile` applies, and a `dockerfile` requires `allowImageBuild` on
302
+ * the env (else the node replies 403). `userData`/`dockerCmd`/`dockerEntrypoint` are only
303
+ * sent when supplied — an omitted override reuses the node's stored value, whereas an
304
+ * explicit value (including `[]`) REPLACES it (matches ocean-node's restartService semantics).
298
305
  * @return {Promise<ServiceJob[]>} The restarted service job (single-element array).
299
306
  */
300
- serviceRestart(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, userData?: ServiceUserData, dockerCmd?: string[], dockerEntrypoint?: string[], signal?: AbortSignal): Promise<ServiceJob[]>;
307
+ serviceRestart(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, params?: ServiceRestartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
301
308
  /**
302
309
  * Returns the caller's service jobs (userData stripped). Filter by `serviceId`,
303
310
  * or omit it to list all of the caller's services. Requires a signature.
@@ -1,6 +1,6 @@
1
1
  import { type Libp2p, type Libp2pOptions } from 'libp2p';
2
2
  import { Signer } from 'ethers';
3
- import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, ComputeResultStream, NodeStatus, NodeComputeJob, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceTemplatePublic, ServiceStartParams, ServiceUserData, ServicePayment, OceanNode, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
3
+ import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, ComputeResultStream, NodeStatus, NodeComputeJob, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, OceanNode, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
4
4
  import { NodeLogEntry } from '../../@types/Provider.js';
5
5
  import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
6
6
  import { CID } from 'multiformats/cid';
@@ -218,7 +218,7 @@ export declare class P2pProvider {
218
218
  serviceStart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, params: ServiceStartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
219
219
  serviceStop(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
220
220
  serviceExtend(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal): Promise<ServiceJob[]>;
221
- serviceRestart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, userData?: ServiceUserData, dockerCmd?: string[], dockerEntrypoint?: string[], signal?: AbortSignal): Promise<ServiceJob[]>;
221
+ serviceRestart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, params?: ServiceRestartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
222
222
  getServiceStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId?: string, signal?: AbortSignal): Promise<ServiceJob[]>;
223
223
  /**
224
224
  * Node-wide service listing (SERVICE_LIST) via P2P. Authenticated but NOT owner-scoped:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oceanprotocol/lib",
3
3
  "source": "./src/index.ts",
4
- "version": "9.0.0-next.4",
4
+ "version": "9.0.0-next.6",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "main": "./dist/lib.cjs",
7
7
  "umd:main": "dist/lib.umd.js",