@oceanprotocol/lib 9.3.0-next.4 → 9.3.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.
@@ -0,0 +1,68 @@
1
+ export type EscrowEventType = 'Auth' | 'Lock' | 'ReLock' | 'Claimed' | 'Canceled' | 'Deposit' | 'Withdraw' | 'Subsidized' | 'LockSponsored' | 'SponsorRefunded';
2
+ /**
3
+ * Numeric range bound for a range filter. `min`/`max` are inclusive, `gt`/`lt` exclusive.
4
+ * uint256 bounds must be passed as strings (the node compares them with BigInt).
5
+ * Note: `gt`/`lt` only take effect over the P2P transport — the HTTP REST route reads only
6
+ * `min`/`max`, so `gt`/`lt` are dropped (with a warning) when querying an HTTP node.
7
+ */
8
+ export interface RangeFilter {
9
+ min?: string | number;
10
+ max?: string | number;
11
+ gt?: string | number;
12
+ lt?: string | number;
13
+ }
14
+ /**
15
+ * One indexed escrow event row, keyed by `${txHash}-${logIndex}`. The base fields are always
16
+ * present; the rest depend on `eventType`. All uint256 fields are decimal strings.
17
+ */
18
+ export interface EscrowEventRecord {
19
+ id: string;
20
+ eventType: EscrowEventType;
21
+ chainId: number;
22
+ contract: string;
23
+ block: number;
24
+ txHash: string;
25
+ payer?: string;
26
+ payee?: string;
27
+ token?: string;
28
+ jobId?: string;
29
+ provider?: string;
30
+ proof?: string;
31
+ amount?: string;
32
+ expiry?: string;
33
+ oldAmount?: string;
34
+ newAmount?: string;
35
+ newExpiry?: string;
36
+ maxLockedAmount?: string;
37
+ maxLockSeconds?: string;
38
+ maxLockCounts?: string;
39
+ expiryTimestamp?: string;
40
+ subsidyAmount?: string;
41
+ bonusAmount?: string;
42
+ reclaimable?: boolean;
43
+ }
44
+ /**
45
+ * Filters for `getEscrowEvents`. All fields are optional. Equality filters match exactly
46
+ * (addresses are case-insensitive on input, returned lowercased). `ranges` holds numeric
47
+ * range filters keyed by record field, e.g. `{ block: { min: 100, max: 200 } }`.
48
+ *
49
+ * Range-filterable fields: `block`, `chainId` (store-side), and the uint256 fields `amount`,
50
+ * `subsidyAmount`, `bonusAmount`, `oldAmount`, `newAmount`, `maxLockedAmount`, `maxLockSeconds`,
51
+ * `maxLockCounts`, `expiry`, `newExpiry`, `expiryTimestamp` (node-side BigInt). A range on any
52
+ * other field is rejected by the node.
53
+ */
54
+ export interface EscrowEventsFilter {
55
+ chainId?: number;
56
+ eventType?: EscrowEventType;
57
+ payer?: string;
58
+ payee?: string;
59
+ token?: string;
60
+ provider?: string;
61
+ contract?: string;
62
+ reclaimable?: boolean;
63
+ jobId?: string;
64
+ txId?: string;
65
+ ranges?: Record<string, RangeFilter>;
66
+ offset?: number;
67
+ size?: number;
68
+ }
@@ -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,8 @@ export declare const PROTOCOL_COMMANDS: {
243
244
  SERVICE_LIST: string;
244
245
  SERVICE_EXTEND: string;
245
246
  SERVICE_GET_STREAMABLE_LOGS: string;
247
+ GET_ESCROW_EVENTS: string;
248
+ SERVICE_GET_RESULT: string;
246
249
  };
247
250
  export interface NodeLogsParams {
248
251
  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;
@@ -15,6 +15,7 @@ export * from './Provider.js';
15
15
  export * from './Router.js';
16
16
  export * from './ReturnTypes.js';
17
17
  export * from './Escrow.js';
18
+ export * from './EscrowEvents.js';
18
19
  export * from './OPFSubsidyProvider.js';
19
20
  export * from './OneTimeSubsidyProvider.js';
20
21
  export * from './SubsidyView.js';
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ComputeResultStream, FindComputeProvidersRequest, FindComputeProvidersResult, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, NodeStatus, NodeComputeJob, NodeMetricsSnapshot, NodeMetricsHistoryResult, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, OceanNode, CompleteSignature, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
2
+ import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ComputeResultStream, FindComputeProvidersRequest, FindComputeProvidersResult, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, NodeStatus, NodeComputeJob, NodeMetricsSnapshot, NodeMetricsHistoryResult, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, OceanNode, CompleteSignature, SignerOrAuthTokenOrSignature, EscrowEventRecord, EscrowEventsFilter } from '../../@types/index.js';
3
3
  import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
4
4
  import { type P2pProvider, type P2PConfig, type P2PRequestBodyStream } from './P2pProvider.js';
5
5
  export { OCEAN_P2P_PROTOCOL, type P2PConfig, type P2pProviderRecord, type Multiaddr, P2pError, type P2pErrorType, classifyP2pError, isRetryableP2pError } from './P2pProvider.js';
@@ -126,6 +126,27 @@ export declare class BaseProvider {
126
126
  downloadNodeLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, startTime: string, endTime: string, maxLogs?: number, moduleName?: string, level?: string, page?: number, signal?: AbortSignal): Promise<NodeLogEntry[]>;
127
127
  getNodeStatus(nodeUri: OceanNode, signal?: AbortSignal): Promise<NodeStatus>;
128
128
  getNodeJobs(nodeUri: OceanNode, fromTimestamp?: number, signal?: AbortSignal): Promise<NodeComputeJob[]>;
129
+ /**
130
+ * Queries indexed escrow events from a node. A public read — no auth is sent. Routes to HTTP
131
+ * (`GET /api/services/escrow/events`) or P2P (GET_ESCROW_EVENTS) depending on the node target.
132
+ * Returns a single page (default size 100, max 250 server-side); use `getAllEscrowEvents` to
133
+ * walk every page.
134
+ * @param {OceanNode} nodeUri - node HTTP endpoint, peerId or multiaddr
135
+ * @param {EscrowEventsFilter} [filter] - optional equality / range filters and pagination
136
+ * @param {AbortSignal} [signal] - optional abort signal to cancel the request
137
+ * @return {Promise<EscrowEventRecord[]>} the matching event rows, or [] on failure
138
+ */
139
+ getEscrowEvents(nodeUri: OceanNode, filter?: EscrowEventsFilter, signal?: AbortSignal): Promise<EscrowEventRecord[]>;
140
+ /**
141
+ * Like `getEscrowEvents` but transparently walks every page until a short page is returned.
142
+ * Exact for `block`/`chainId` ranges (store-side); a very selective uint256 amount range can
143
+ * still be incomplete, since the node applies a bounded scan per page.
144
+ * @param {OceanNode} nodeUri - node HTTP endpoint, peerId or multiaddr
145
+ * @param {EscrowEventsFilter} [filter] - optional equality / range filters and starting offset
146
+ * @param {AbortSignal} [signal] - optional abort signal to cancel the request
147
+ * @return {Promise<EscrowEventRecord[]>} all matching event rows, or [] on failure
148
+ */
149
+ getAllEscrowEvents(nodeUri: OceanNode, filter?: EscrowEventsFilter, signal?: AbortSignal): Promise<EscrowEventRecord[]>;
129
150
  /**
130
151
  * Returns the live per-node resource metrics snapshot. Routes to HTTP (`GET /nodeMetrics`)
131
152
  * or P2P (GET_NODE_METRICS command) depending on the node target.
@@ -230,6 +251,26 @@ export declare class BaseProvider {
230
251
  getServiceStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId?: string, signal?: AbortSignal, includeMetrics?: boolean): Promise<ServiceJob[]>;
231
252
  getServices(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, filters?: ServiceListFilters, signal?: AbortSignal): Promise<ServiceJobListed[]>;
232
253
  serviceGetStreamableLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, since?: string, signal?: AbortSignal): Promise<any>;
254
+ /**
255
+ * Downloads a service's /data/outputs as a zip, dispatching to the HTTP or P2P transport based
256
+ * on `nodeUri`. Only for a service started without an output bucket (its results are in the
257
+ * bucket otherwise); owner-only.
258
+ *
259
+ * - `index`: one of the zips the node took whenever a container of the service was removed
260
+ * (stop, expiry, restart, recovery), listed as `outputArchives` by getServiceStatus. Works in
261
+ * any status until the node's storage expiry deletes it; resumable with `offset`.
262
+ * - `'live'`: a zip of the running container's /data/outputs, built as it is read — while the
263
+ * service is Running (or Error before teardown). Not resumable; files being written at that
264
+ * moment may come out partial.
265
+ * @param {OceanNode} nodeUri The provider target (HTTP URL, or peerId / multiaddr for P2P).
266
+ * @param {SignerOrAuthTokenOrSignature} signerOrAuthToken Signer, JWT auth token, or precomputed signature used to authenticate the request.
267
+ * @param {string} serviceId The service.
268
+ * @param {number | 'live'} index An archive index, or `'live'`.
269
+ * @param {number} [offset=0] Byte offset to resume an archive download from.
270
+ * @param {AbortSignal} [signal] Abort signal that cancels the download.
271
+ * @return {Promise<ComputeResultStream>} An async-iterable stream of the zip, starting at `offset`.
272
+ */
273
+ serviceGetResult(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, index: number | 'live', offset?: number, signal?: AbortSignal): Promise<ComputeResultStream>;
233
274
  fetchConfig(nodeUri: OceanNode, payload: Record<string, any>): Promise<any>;
234
275
  pushConfig(nodeUri: OceanNode, payload: Record<string, any>): Promise<any>;
235
276
  }
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, ComputeResultStream, NodeStatus, NodeComputeJob, NodeLogEntry, NodeMetricsSnapshot, NodeMetricsHistoryResult, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
2
+ import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, ComputeResultStream, NodeStatus, NodeComputeJob, NodeLogEntry, NodeMetricsSnapshot, NodeMetricsHistoryResult, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, SignerOrAuthTokenOrSignature, EscrowEventRecord, EscrowEventsFilter } 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 {
@@ -30,6 +30,17 @@ export declare class HttpProvider {
30
30
  * @return {Promise<NodeMetricsHistoryResult | null>} the history, or null if unavailable
31
31
  */
32
32
  getNodeMetricsHistory(nodeUri: string, startTime?: number | string, stopTime?: number | string, signal?: AbortSignal): Promise<NodeMetricsHistoryResult | null>;
33
+ /**
34
+ * Queries indexed escrow events via the REST route `GET /api/services/escrow/events`.
35
+ * Equality filters go on the query string; `ranges` are flattened to `<field>Min`/`<field>Max`.
36
+ * The REST route reads only `min`/`max`, so any `gt`/`lt` bound is dropped (with a warning) —
37
+ * use the P2P transport for exclusive bounds. A public read: no auth is sent.
38
+ * @param {string} nodeUri - node HTTP endpoint
39
+ * @param {EscrowEventsFilter} [filter] - optional equality / range filters and pagination
40
+ * @param {AbortSignal} [signal] - optional abort signal to cancel the request
41
+ * @return {Promise<EscrowEventRecord[]>} the matching event rows, or [] on failure
42
+ */
43
+ getEscrowEvents(nodeUri: string, filter?: EscrowEventsFilter, signal?: AbortSignal): Promise<EscrowEventRecord[]>;
33
44
  /**
34
45
  * Returns the node public key
35
46
  * @return {string} The node public key
@@ -370,4 +381,16 @@ export declare class HttpProvider {
370
381
  */
371
382
  getServices(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, filters?: ServiceListFilters, signal?: AbortSignal): Promise<ServiceJobListed[]>;
372
383
  serviceGetStreamableLogs(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, since?: string, signal?: AbortSignal): Promise<any>;
384
+ /**
385
+ * Downloads a service's /data/outputs as a zip over HTTP — for a service started without an
386
+ * output bucket. Owner-only.
387
+ * @param {string} nodeUri The provider URI.
388
+ * @param {SignerOrAuthTokenOrSignature} signerOrAuthToken Signer, JWT auth token, or precomputed signature used to authenticate the request.
389
+ * @param {string} serviceId The service.
390
+ * @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.
391
+ * @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'`.
392
+ * @param {AbortSignal} [signal] Abort signal that cancels the in-flight request.
393
+ * @return {Promise<ComputeResultStream>} An async-iterable stream of the zip, starting at `offset`.
394
+ */
395
+ serviceGetResult(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, index: number | 'live', offset?: number, signal?: AbortSignal): Promise<ComputeResultStream>;
373
396
  }
@@ -1,7 +1,7 @@
1
1
  import { type Libp2p, type Libp2pOptions } from 'libp2p';
2
2
  import { type Multiaddr } from '@multiformats/multiaddr';
3
3
  import { Signer } from 'ethers';
4
- import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, ComputeResultStream, NodeStatus, NodeComputeJob, NodeMetricsSnapshot, NodeMetricsHistoryResult, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, OceanNode, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
4
+ import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, ComputeResultStream, NodeStatus, NodeComputeJob, NodeMetricsSnapshot, NodeMetricsHistoryResult, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, OceanNode, SignerOrAuthTokenOrSignature, EscrowEventRecord, EscrowEventsFilter } from '../../@types/index.js';
5
5
  import { NodeLogEntry } from '../../@types/Provider.js';
6
6
  import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
7
7
  import { CID } from 'multiformats/cid';
@@ -502,6 +502,16 @@ export declare class P2pProvider {
502
502
  */
503
503
  getNodeStatus(nodeUri: OceanNode, signal?: AbortSignal): Promise<NodeStatus>;
504
504
  getNodeJobs(nodeUri: OceanNode, fromTimestamp?: number, signal?: AbortSignal): Promise<NodeComputeJob[]>;
505
+ /**
506
+ * Queries indexed escrow events via the P2P GET_ESCROW_EVENTS command. The `ranges` object
507
+ * (including exclusive `gt`/`lt` bounds) is passed through verbatim; the node compares uint256
508
+ * bounds with BigInt. A public read: no signer / auth token is sent.
509
+ * @param {OceanNode} nodeUri - peerId/multiaddr of the node
510
+ * @param {EscrowEventsFilter} [filter] - optional equality / range filters and pagination
511
+ * @param {AbortSignal} [signal] - optional abort signal to cancel the request
512
+ * @return {Promise<EscrowEventRecord[]>} the matching event rows, or [] on failure
513
+ */
514
+ getEscrowEvents(nodeUri: OceanNode, filter?: EscrowEventsFilter, signal?: AbortSignal): Promise<EscrowEventRecord[]>;
505
515
  /**
506
516
  * Returns the live per-node resource metrics snapshot via the P2P GET_NODE_METRICS command.
507
517
  * @param {OceanNode} nodeUri - peerId/multiaddr of the node
@@ -744,4 +754,21 @@ export declare class P2pProvider {
744
754
  * (Unix seconds, or a relative duration like '30s'/'2h'); omit for the full history then live.
745
755
  */
746
756
  serviceGetStreamableLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, since?: string, signal?: AbortSignal): Promise<any>;
757
+ /**
758
+ * Downloads a service's /data/outputs as a zip over libp2p — for a service started without an
759
+ * output bucket. Owner-only.
760
+ *
761
+ * The transfer mirrors `downloadPersistentStorageFile`: `dialAndStream` takes a concurrency
762
+ * slot, the first frame is a status JSON (an `httpStatus >= 400` throws and releases the
763
+ * slot), and the returned generator streams the zip with flow control, resetting the stream
764
+ * and releasing the slot however iteration ends.
765
+ * @param {OceanNode} nodeUri The provider node (peerId / multiaddr).
766
+ * @param {SignerOrAuthTokenOrSignature} signerOrAuthToken Signer, JWT auth token, or precomputed signature used to authenticate the request.
767
+ * @param {string} serviceId The service.
768
+ * @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.
769
+ * @param {number} [offset=0] Byte offset to resume an archive download from. Must be a non-negative safe integer; not supported with `'live'`.
770
+ * @param {AbortSignal} [signal] Abort signal that cancels the download mid-flight and tears down the stream.
771
+ * @return {Promise<ComputeResultStream>} An async-iterable stream of the zip, starting at `offset`.
772
+ */
773
+ serviceGetResult(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, index: number | 'live', offset?: number, signal?: AbortSignal): Promise<ComputeResultStream>;
747
774
  }
@@ -158,6 +158,8 @@ export declare class LpFrameReader {
158
158
  private discarded;
159
159
  /** Set when the stream ends in an error, whether raised locally or by the peer. */
160
160
  private closeError;
161
+ /** Set when the peer closed its writable end, i.e. finished sending the response. */
162
+ private remoteEnded;
161
163
  constructor(lp: ReturnType<typeof lpStream>, stream: Stream, maxBufferSize?: number);
162
164
  /** Bytes delivered by the transport that are not yet part of a complete frame. */
163
165
  get pendingBytes(): number;
@@ -165,9 +167,11 @@ export declare class LpFrameReader {
165
167
  signal: AbortSignal;
166
168
  }): Promise<Uint8Array>;
167
169
  /**
168
- * True when `err` is the graceful end of the stream: an end-of-file thrown with
169
- * every delivered byte already accounted for by a complete frame. A truncated
170
- * frame throws the same error type but leaves bytes pending, and returns false.
170
+ * True when `err` is the graceful end of the stream: an end-of-file thrown after the
171
+ * peer closed its writable end, with every delivered byte already accounted for by a
172
+ * complete frame. A truncated frame throws the same error type but leaves bytes
173
+ * pending, and a stream ended by its connection closing never saw the peer's close;
174
+ * both return false.
171
175
  */
172
176
  isCleanEnd(err: unknown): boolean;
173
177
  }
@@ -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.3.0-next.4",
4
+ "version": "9.3.0-next.6",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "module": "./dist/lib.module.mjs",
7
7
  "type": "module",