@oceanprotocol/lib 8.6.2 → 9.0.0-next.10

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.
@@ -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, 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';
@@ -88,9 +88,8 @@ export declare class P2pProvider {
88
88
  private sendP2pCommand;
89
89
  /**
90
90
  * Returns node status via P2P STATUS command.
91
- * @param {string} nodeUri - multiaddr of the node
91
+ * @param {OceanNode} nodeUri - multiaddr of the node
92
92
  */
93
- getEndpoints(nodeUri: OceanNode): Promise<any>;
94
93
  getNodeStatus(nodeUri: OceanNode, signal?: AbortSignal): Promise<NodeStatus>;
95
94
  getNodeJobs(nodeUri: OceanNode, fromTimestamp?: number, signal?: AbortSignal): Promise<NodeComputeJob[]>;
96
95
  /**
@@ -146,8 +145,18 @@ export declare class P2pProvider {
146
145
  computeStop(jobId: string, nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, agreementId?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
147
146
  /**
148
147
  * Get compute status via P2P.
149
- */
150
- computeStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId?: string, agreementId?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
148
+ * @param {boolean} includeMetrics Owner-only runtime metrics (`runtimeMetrics`) on the
149
+ * returned job(s). To receive them, the node needs owner credentials: an auth token
150
+ * (`signerOrAuthToken` as a string) is ALWAYS sent, regardless of this flag; a `Signer`'s
151
+ * nonce+signature is only computed and sent when this flag is `true` (skipped otherwise
152
+ * to avoid an extra nonce round-trip on every plain status poll). Omitted (default): the
153
+ * node attaches metrics silently if valid owner credentials made it into the request
154
+ * (true automatically for token callers, false for `Signer` callers unless this flag is
155
+ * set), and returns exactly today's response otherwise. `true`: metrics are required —
156
+ * this method also computes the `Signer`'s signature, and the node answers 400/401 if
157
+ * credentials don't verify. `false`: metrics are never attached.
158
+ */
159
+ computeStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId?: string, agreementId?: string, signal?: AbortSignal, includeMetrics?: boolean): Promise<NodeComputeJob | NodeComputeJob[]>;
151
160
  /**
152
161
  * Get compute result as an async generator of Uint8Array chunks via P2P.
153
162
  * Supports resumable downloads via `offset` (byte position to resume from).
@@ -186,8 +195,11 @@ export declare class P2pProvider {
186
195
  PolicyServerPassthrough(nodeUri: OceanNode, request: PolicyServerPassthroughCommand, signal?: AbortSignal): Promise<any>;
187
196
  /**
188
197
  * Initialize Policy Server verification via P2P.
198
+ *
199
+ * A distinct command from the passthrough, so the signed message uses its own command
200
+ * string: `consumerAddress + nonce + "PolicyServerInitialize"`.
189
201
  */
190
- initializePSVerification(nodeUri: OceanNode, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
202
+ initializePSVerification(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
191
203
  /**
192
204
  * Download node logs via P2P.
193
205
  */
@@ -214,4 +226,28 @@ export declare class P2pProvider {
214
226
  getPersistentStorageFileObject(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageObject>;
215
227
  uploadPersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, content: P2PRequestBodyStream, signal?: AbortSignal): Promise<PersistentStorageFileEntry>;
216
228
  deletePersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageDeleteFileResponse>;
229
+ private encryptServiceUserData;
230
+ getServiceTemplates(nodeUri: OceanNode, chainId?: number, signal?: AbortSignal): Promise<ServiceTemplatePublic[]>;
231
+ serviceStart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, params: ServiceStartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
232
+ serviceStop(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
233
+ serviceExtend(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal): Promise<ServiceJob[]>;
234
+ serviceRestart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, params?: ServiceRestartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
235
+ /**
236
+ * @param {boolean} includeMetrics Owner-only runtime metrics (`runtimeMetrics`) on the
237
+ * returned service(s). This command is already authenticated, so metrics are included
238
+ * BY DEFAULT (omitted / `undefined`); pass `false` to opt out.
239
+ */
240
+ getServiceStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId?: string, signal?: AbortSignal, includeMetrics?: boolean): Promise<ServiceJob[]>;
241
+ /**
242
+ * Node-wide service listing (SERVICE_LIST) via P2P. Authenticated but NOT owner-scoped:
243
+ * any consumer identity sees every owner's services, listing-sanitized (no userData, no
244
+ * dockerCmd/dockerEntrypoint, no Dockerfile). Default (no filters) returns only the
245
+ * services currently holding a resource reservation; see ServiceListFilters.
246
+ */
247
+ getServices(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, filters?: ServiceListFilters, signal?: AbortSignal): Promise<ServiceJobListed[]>;
248
+ /**
249
+ * Stream a running service's container logs via P2P. `since` optionally bounds the lower time
250
+ * (Unix seconds, or a relative duration like '30s'/'2h'); omit for the full history then live.
251
+ */
252
+ serviceGetStreamableLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, since?: string, signal?: AbortSignal): Promise<any>;
217
253
  }
@@ -4,3 +4,18 @@
4
4
  */
5
5
  export declare function sleep(ms: number): Promise<unknown>;
6
6
  export declare function isDefined(something: any): boolean;
7
+ /**
8
+ * Returns a copy of the payload with every credential field redacted, at any depth.
9
+ *
10
+ * This must not mutate its input: the caller still needs the real credentials to send the
11
+ * request, and credentials also show up nested (the free-form `policyServer` /
12
+ * `policyServerPassthrough` blobs), so we rebuild containers instead of writing into them.
13
+ *
14
+ * Only plain objects and arrays are walked - Buffers, typed arrays, Dates, streams and the
15
+ * like are passed through untouched.
16
+ *
17
+ * @param {any} value - the payload to redact
18
+ * @param {WeakSet<object>} seen - internal cycle guard
19
+ * @return {any} a redacted copy, safe to log
20
+ */
21
+ export declare function redactSensitiveFields(value: any, seen?: WeakSet<object>): any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oceanprotocol/lib",
3
3
  "source": "./src/index.ts",
4
- "version": "8.6.2",
4
+ "version": "9.0.0-next.10",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "main": "./dist/lib.cjs",
7
7
  "umd:main": "dist/lib.umd.js",
@@ -91,7 +91,7 @@
91
91
  "@libp2p/tcp": "^11.0.13",
92
92
  "@libp2p/websockets": "^10.1.6",
93
93
  "@multiformats/multiaddr": "^13.0.1",
94
- "@oceanprotocol/contracts": "^2.8.0",
94
+ "@oceanprotocol/contracts": "^2.9.0",
95
95
  "@truffle/hdwallet-provider": "^2.0.14",
96
96
  "@types/chai": "^5.2.2",
97
97
  "@types/chai-spies": "^1.0.3",