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

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.
@@ -141,6 +141,7 @@ export declare const PROTOCOL_COMMANDS: {
141
141
  SERVICE_STOP: string;
142
142
  SERVICE_RESTART: string;
143
143
  SERVICE_GET_STATUS: string;
144
+ SERVICE_LIST: string;
144
145
  SERVICE_EXTEND: string;
145
146
  SERVICE_GET_STREAMABLE_LOGS: string;
146
147
  };
@@ -84,6 +84,12 @@ export interface ServiceJob {
84
84
  payment: ServiceJobPayment;
85
85
  extendPayments?: ServiceJobPayment[];
86
86
  }
87
+ export type ServiceJobListed = Omit<ServiceJob, 'dockerCmd' | 'dockerEntrypoint' | 'dockerfile' | 'additionalDockerFiles'>;
88
+ export interface ServiceListFilters {
89
+ status?: ServiceStatusNumber;
90
+ includeAllStatuses?: boolean;
91
+ fromTimestamp?: string;
92
+ }
87
93
  export interface ServicePayment {
88
94
  chainId: number;
89
95
  token: string;
@@ -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, 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, ServiceTemplatePublic, ServiceStartParams, ServiceUserData, 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';
@@ -77,8 +77,9 @@ export declare class BaseProvider {
77
77
  serviceStart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, params: ServiceStartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
78
78
  serviceStop(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
79
79
  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, signal?: AbortSignal): Promise<ServiceJob[]>;
80
+ serviceRestart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, userData?: ServiceUserData, dockerCmd?: string[], dockerEntrypoint?: string[], signal?: AbortSignal): Promise<ServiceJob[]>;
81
81
  getServiceStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId?: string, signal?: AbortSignal): Promise<ServiceJob[]>;
82
+ getServices(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, filters?: ServiceListFilters, signal?: AbortSignal): Promise<ServiceJobListed[]>;
82
83
  serviceGetStreamableLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, since?: string, signal?: AbortSignal): Promise<any>;
83
84
  fetchConfig(nodeUri: OceanNode, payload: Record<string, any>): Promise<any>;
84
85
  pushConfig(nodeUri: OceanNode, payload: Record<string, any>): 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, 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, ServiceTemplatePublic, ServiceStartParams, ServiceUserData, 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,16 +291,26 @@ 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` is
295
- * supplied it REPLACES the stored userData; otherwise the stored one is reused.
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.
296
298
  * @return {Promise<ServiceJob[]>} The restarted service job (single-element array).
297
299
  */
298
- serviceRestart(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, userData?: ServiceUserData, signal?: AbortSignal): Promise<ServiceJob[]>;
300
+ serviceRestart(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, userData?: ServiceUserData, dockerCmd?: string[], dockerEntrypoint?: string[], signal?: AbortSignal): Promise<ServiceJob[]>;
299
301
  /**
300
302
  * Returns the caller's service jobs (userData stripped). Filter by `serviceId`,
301
303
  * or omit it to list all of the caller's services. Requires a signature.
302
304
  * @return {Promise<ServiceJob[]>} The matching service jobs.
303
305
  */
304
306
  getServiceStatus(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId?: string, signal?: AbortSignal): Promise<ServiceJob[]>;
307
+ /**
308
+ * Node-wide service listing (SERVICE_LIST). Authenticated but NOT owner-scoped: any
309
+ * consumer identity sees every owner's services, listing-sanitized (no userData, no
310
+ * dockerCmd/dockerEntrypoint, no Dockerfile). Default (no filters) returns only the
311
+ * services currently holding a resource reservation; see ServiceListFilters.
312
+ * @return {Promise<ServiceJobListed[]>} The matching service jobs.
313
+ */
314
+ getServices(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, filters?: ServiceListFilters, signal?: AbortSignal): Promise<ServiceJobListed[]>;
305
315
  serviceGetStreamableLogs(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, since?: string, signal?: AbortSignal): Promise<any>;
306
316
  }
@@ -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, 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, ServiceTemplatePublic, ServiceStartParams, ServiceUserData, 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,8 +218,15 @@ 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, signal?: AbortSignal): Promise<ServiceJob[]>;
221
+ serviceRestart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, userData?: ServiceUserData, dockerCmd?: string[], dockerEntrypoint?: string[], signal?: AbortSignal): Promise<ServiceJob[]>;
222
222
  getServiceStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId?: string, signal?: AbortSignal): Promise<ServiceJob[]>;
223
+ /**
224
+ * Node-wide service listing (SERVICE_LIST) via P2P. Authenticated but NOT owner-scoped:
225
+ * any consumer identity sees every owner's services, listing-sanitized (no userData, no
226
+ * dockerCmd/dockerEntrypoint, no Dockerfile). Default (no filters) returns only the
227
+ * services currently holding a resource reservation; see ServiceListFilters.
228
+ */
229
+ getServices(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, filters?: ServiceListFilters, signal?: AbortSignal): Promise<ServiceJobListed[]>;
223
230
  /**
224
231
  * Stream a running service's container logs via P2P. `since` optionally bounds the lower time
225
232
  * (Unix seconds, or a relative duration like '30s'/'2h'); omit for the full history then live.
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.2",
4
+ "version": "9.0.0-next.4",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "main": "./dist/lib.cjs",
7
7
  "umd:main": "dist/lib.umd.js",