@oceanprotocol/lib 3.4.3 → 4.0.0-next.1

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.
@@ -16,6 +16,7 @@ export interface ComputeEnvironment {
16
16
  storageExpiry: number;
17
17
  maxJobDuration: number;
18
18
  lastSeen: number;
19
+ free: boolean;
19
20
  }
20
21
  export interface ComputeResult {
21
22
  filename: string;
@@ -49,7 +50,36 @@ export interface ComputeOutput {
49
50
  secretStoreUri?: string;
50
51
  whitelist?: string[];
51
52
  }
53
+ export declare enum FileObjectType {
54
+ URL = "url",
55
+ IPFS = "ipfs",
56
+ ARWEAVE = "arweave"
57
+ }
58
+ export declare enum EncryptMethod {
59
+ AES = "AES",
60
+ ECIES = "ECIES"
61
+ }
62
+ export interface HeadersObject {
63
+ [key: string]: string;
64
+ }
65
+ export interface BaseFileObject {
66
+ type: string;
67
+ encryptedBy?: string;
68
+ encryptMethod?: EncryptMethod;
69
+ }
70
+ export interface UrlFileObject extends BaseFileObject {
71
+ url: string;
72
+ method: string;
73
+ headers?: [HeadersObject];
74
+ }
75
+ export interface IpfsFileObject extends BaseFileObject {
76
+ hash: string;
77
+ }
78
+ export interface ArweaveFileObject extends BaseFileObject {
79
+ transactionId: string;
80
+ }
52
81
  export interface ComputeAsset {
82
+ fileObject?: BaseFileObject;
53
83
  documentId: string;
54
84
  serviceId: string;
55
85
  transferTxId?: string;
@@ -58,6 +88,7 @@ export interface ComputeAsset {
58
88
  };
59
89
  }
60
90
  export interface ComputeAlgorithm {
91
+ fileObject?: BaseFileObject;
61
92
  documentId?: string;
62
93
  serviceId?: string;
63
94
  meta?: MetadataAlgorithm;
@@ -99,7 +99,18 @@ export declare class Provider {
99
99
  * @param {AbortSignal} signal abort signal
100
100
  * @return {Promise<ProviderComputeInitialize>} ProviderComputeInitialize data
101
101
  */
102
- initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, validUntil: number, providerUri: string, accountId: string, signal?: AbortSignal): Promise<ProviderComputeInitializeResults>;
102
+ initializeComputeV1(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, validUntil: number, providerUri: string, accountId: string, signal?: AbortSignal): Promise<ProviderComputeInitializeResults>;
103
+ /** Initializes the provider for a compute request.
104
+ * @param {ComputeAsset[]} assets The datasets array to initialize compute request.
105
+ * @param {ComputeAlgorithmber} algorithm The algorithm to use.
106
+ * @param {string} computeEnv The compute environment.
107
+ * @param {number} validUntil The job expiration date.
108
+ * @param {string} providerUri The provider URI.
109
+ * @param {Signer} signer caller address
110
+ * @param {AbortSignal} signal abort signal
111
+ * @return {Promise<ProviderComputeInitialize>} ProviderComputeInitialize data
112
+ */
113
+ initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, validUntil: number, providerUri: string, signer: Signer, signal?: AbortSignal): Promise<ProviderComputeInitializeResults>;
103
114
  /**
104
115
  * Gets the download URL.
105
116
  * @param {string} did - The DID.
@@ -112,7 +123,7 @@ export declare class Provider {
112
123
  * @returns {Promise<any>} The download URL.
113
124
  */
114
125
  getDownloadUrl(did: string, serviceId: string, fileIndex: number, transferTxId: string, providerUri: string, signer: Signer, userCustomParameters?: UserCustomParameters): Promise<any>;
115
- /** Instruct the provider to start a compute job
126
+ /** Instruct the provider to start a compute job (Old C2D V1) Kept for now, for backwards compatibility
116
127
  * @param {string} providerUri The provider URI.
117
128
  * @param {Signer} signer The consumer signer object.
118
129
  * @param {string} computeEnv The compute environment.
@@ -123,7 +134,19 @@ export declare class Provider {
123
134
  * @param {ComputeOutput} output The compute job output settings.
124
135
  * @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
125
136
  */
126
- computeStart(providerUri: string, consumer: Signer, computeEnv: string, dataset: ComputeAsset, algorithm: ComputeAlgorithm, signal?: AbortSignal, additionalDatasets?: ComputeAsset[], output?: ComputeOutput): Promise<ComputeJob | ComputeJob[]>;
137
+ computeStartV1(providerUri: string, consumer: Signer, computeEnv: string, dataset: ComputeAsset, algorithm: ComputeAlgorithm, signal?: AbortSignal, additionalDatasets?: ComputeAsset[], output?: ComputeOutput): Promise<ComputeJob | ComputeJob[]>;
138
+ /** Instruct the provider to start a compute job (new C2D V2)
139
+ * @param {string} providerUri The provider URI.
140
+ * @param {Signer} signer The consumer signer object.
141
+ * @param {string} computeEnv The compute environment.
142
+ * @param {ComputeAsset} datasets The dataset to start compute on + additionalDatasets (the additional datasets if that is the case)
143
+ * @param {ComputeAlgorithm} algorithm The algorithm to start compute with.
144
+ * @param {AbortSignal} signal abort signal
145
+ * @param {ComputeOutput} output The compute job output settings.
146
+ * @param {boolean} freeEnvironment is it a free environment? uses different route
147
+ * @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
148
+ */
149
+ computeStart(providerUri: string, consumer: Signer, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, signal?: AbortSignal, output?: ComputeOutput, freeEnvironment?: boolean): Promise<ComputeJob | ComputeJob[]>;
127
150
  /** Instruct the provider to Stop the execution of a to stop a compute job.
128
151
  * @param {string} did the asset did
129
152
  * @param {string} consumerAddress The consumer address.
@@ -485,7 +485,7 @@ Initializes the provider for a compute request.
485
485
  | `computeEnv` | `string` | The compute environment. |
486
486
  | `validUntil` | `number` | The job expiration date. |
487
487
  | `providerUri` | `string` | The provider URI. |
488
- | `accountId` | `string` | caller address |
488
+ | `signer` | `Signer` | caller account |
489
489
  | `signal?` | `AbortSignal` | abort signal |
490
490
 
491
491
  #### Returns
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oceanprotocol/lib",
3
3
  "source": "./src/index.ts",
4
- "version": "3.4.3",
4
+ "version": "4.0.0-next.1",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "main": "./dist/lib.js",
7
7
  "umd:main": "dist/lib.umd.js",