@oceanprotocol/lib 4.2.1 → 4.3.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.
- package/CHANGELOG.md +8 -0
- package/ComputeExamples.md +7 -1
- package/dist/lib.cjs +1 -1
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.modern.js +1 -1
- package/dist/lib.modern.js.map +1 -1
- package/dist/lib.module.mjs +1 -1
- package/dist/lib.module.mjs.map +1 -1
- package/dist/lib.umd.js +1 -1
- package/dist/lib.umd.js.map +1 -1
- package/dist/types/@types/Compute.d.ts +4 -0
- package/dist/types/@types/PolicyServer.d.ts +7 -0
- package/dist/types/services/Provider.d.ts +12 -6
- package/package.json +2 -2
|
@@ -56,6 +56,9 @@ export interface ComputeResult {
|
|
|
56
56
|
type: ComputeResultType;
|
|
57
57
|
index?: number;
|
|
58
58
|
}
|
|
59
|
+
export type ComputeJobMetadata = {
|
|
60
|
+
[key: string]: string | number | boolean;
|
|
61
|
+
};
|
|
59
62
|
export interface ComputeJob {
|
|
60
63
|
owner: string;
|
|
61
64
|
did?: string;
|
|
@@ -69,6 +72,7 @@ export interface ComputeJob {
|
|
|
69
72
|
algoDID?: string;
|
|
70
73
|
agreementId?: string;
|
|
71
74
|
expireTimestamp: number;
|
|
75
|
+
metadata?: ComputeJobMetadata;
|
|
72
76
|
}
|
|
73
77
|
export interface ComputeOutput {
|
|
74
78
|
publishAlgorithmLog?: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import { Arweave, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UrlFile, UserCustomParameters, Ipfs, ComputeResourceRequest } from '../@types';
|
|
2
|
+
import { Arweave, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UrlFile, UserCustomParameters, Ipfs, ComputeResourceRequest, ComputeJobMetadata } from '../@types';
|
|
3
|
+
import { PolicyServer } from '../@types/PolicyServer.js';
|
|
3
4
|
export declare class Provider {
|
|
4
5
|
private getConsumerAddress;
|
|
5
6
|
private getSignature;
|
|
@@ -111,10 +112,11 @@ export declare class Provider {
|
|
|
111
112
|
* @param {SignerOrAuthToken} signerOrAuthToken Signer or auth token
|
|
112
113
|
* @param {ComputeResourceRequest[]} resources The resources to start compute job with.
|
|
113
114
|
* @param {number} chainId The chain used to do payments
|
|
115
|
+
* @param {PolicyServer} policyServer The policy server object.
|
|
114
116
|
* @param {AbortSignal} signal abort signal
|
|
115
117
|
* @return {Promise<ProviderComputeInitialize>} ProviderComputeInitialize data
|
|
116
118
|
*/
|
|
117
|
-
initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, token: string, validUntil: number, providerUri: string, signerOrAuthToken: Signer | string, resources: ComputeResourceRequest[], chainId: number, signal?: AbortSignal): Promise<ProviderComputeInitializeResults>;
|
|
119
|
+
initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, token: string, validUntil: number, providerUri: string, signerOrAuthToken: Signer | string, resources: ComputeResourceRequest[], chainId: number, policyServer?: PolicyServer, signal?: AbortSignal): Promise<ProviderComputeInitializeResults>;
|
|
118
120
|
/**
|
|
119
121
|
* Gets the download URL.
|
|
120
122
|
* @param {string} did - The DID.
|
|
@@ -123,11 +125,11 @@ export declare class Provider {
|
|
|
123
125
|
* @param {string} transferTxId - The transfer transaction ID.
|
|
124
126
|
* @param {string} providerUri - The provider URI.
|
|
125
127
|
* @param {SignerOrAuthToken} signerOrAuthToken - The signer or auth token.
|
|
126
|
-
* @param {
|
|
128
|
+
* @param {PolicyServer} policyServer - The policy server (if any is to be used).
|
|
127
129
|
* @param {UserCustomParameters} userCustomParameters - The user custom parameters.
|
|
128
130
|
* @returns {Promise<any>} The download URL.
|
|
129
131
|
*/
|
|
130
|
-
getDownloadUrl(did: string, serviceId: string, fileIndex: number, transferTxId: string, providerUri: string, signerOrAuthToken: Signer | string, policyServer?:
|
|
132
|
+
getDownloadUrl(did: string, serviceId: string, fileIndex: number, transferTxId: string, providerUri: string, signerOrAuthToken: Signer | string, policyServer?: PolicyServer, userCustomParameters?: UserCustomParameters): Promise<any>;
|
|
131
133
|
/** Instruct the provider to start a compute job (Old C2D V1) Kept for now, for backwards compatibility
|
|
132
134
|
* @param {string} providerUri The provider URI.
|
|
133
135
|
* @param {Signer} signer The consumer signer object.
|
|
@@ -151,12 +153,14 @@ export declare class Provider {
|
|
|
151
153
|
* @param {string} token The token address for compute payment.
|
|
152
154
|
* @param {ComputeResourceRequest} resources The resources to start compute job with.
|
|
153
155
|
* @param {chainId} chainId The chain used to do payments
|
|
156
|
+
* @param {ComputeJobMetadata} metadata The compute job metadata. Additional metadata to be stored in the database.
|
|
154
157
|
* @param {ComputeOutput} output The compute job output settings.
|
|
158
|
+
* @param {PolicyServer} policyServer The policy server object.
|
|
155
159
|
* @param {AbortSignal} signal abort signal
|
|
156
160
|
* @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
|
|
157
161
|
*/
|
|
158
162
|
computeStart(providerUri: string, signerOrAuthToken: Signer | string, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, maxJobDuration: number, token: string, resources: ComputeResourceRequest[], chainId: number, // network used by payment (only for payed compute jobs)
|
|
159
|
-
output?: ComputeOutput, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
163
|
+
metadata?: ComputeJobMetadata, output?: ComputeOutput, policyServer?: PolicyServer, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
160
164
|
/** Instruct the provider to start a FREE compute job (new C2D V2)
|
|
161
165
|
* @param {string} providerUri The provider URI.
|
|
162
166
|
* @param {SignerOrAuthToken} signerOrAuthToken The consumer signer object or auth token.
|
|
@@ -164,11 +168,13 @@ export declare class Provider {
|
|
|
164
168
|
* @param {ComputeAsset} datasets The dataset to start compute on + additionalDatasets (the additional datasets if that is the case)
|
|
165
169
|
* @param {ComputeAlgorithm} algorithm The algorithm to start compute with.
|
|
166
170
|
* @param {ComputeResourceRequest} resources The resources to start compute job with.
|
|
171
|
+
* @param {ComputeJobMetadata} metadata The compute job metadata. Additional metadata to be stored in the database.
|
|
167
172
|
* @param {ComputeOutput} output The compute job output settings.
|
|
173
|
+
* @param {PolicyServer} policyServer The policy server object.
|
|
168
174
|
* @param {AbortSignal} signal abort signal
|
|
169
175
|
* @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
|
|
170
176
|
*/
|
|
171
|
-
freeComputeStart(providerUri: string, signerOrAuthToken: Signer | string, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, resources?: ComputeResourceRequest[], output?: ComputeOutput, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
177
|
+
freeComputeStart(providerUri: string, signerOrAuthToken: Signer | string, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, resources?: ComputeResourceRequest[], metadata?: ComputeJobMetadata, output?: ComputeOutput, policyServer?: PolicyServer, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
172
178
|
/**
|
|
173
179
|
*
|
|
174
180
|
* @param providerUri provider URL
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanprotocol/lib",
|
|
3
3
|
"source": "./src/index.ts",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.3.0",
|
|
5
5
|
"description": "JavaScript client library for Ocean Protocol",
|
|
6
6
|
"main": "./dist/lib.cjs",
|
|
7
7
|
"umd:main": "dist/lib.umd.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@oasisprotocol/sapphire-paratime": "^1.3.2",
|
|
60
60
|
"@oceanprotocol/contracts": "^2.3.0",
|
|
61
|
-
"@oceanprotocol/ddo-js": "^0.1.
|
|
61
|
+
"@oceanprotocol/ddo-js": "^0.1.2",
|
|
62
62
|
"@rdfjs/dataset": "^2.0.2",
|
|
63
63
|
"@rdfjs/formats-common": "^3.1.0",
|
|
64
64
|
"@zazuko/env-node": "^2.1.4",
|