@oceanprotocol/lib 0.19.2 → 0.19.3

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.
@@ -5,6 +5,7 @@ export declare class Config {
5
5
  providerAddress?: string;
6
6
  metadataCacheUri?: string;
7
7
  providerUri?: string;
8
+ rbacUri?: string;
8
9
  web3Provider?: any;
9
10
  oceanTokenAddress?: string;
10
11
  factoryAddress?: string;
@@ -8,7 +8,6 @@ import { SubscribablePromise } from '../utils';
8
8
  import { Instantiable, InstantiableConfig } from '../Instantiable.abstract';
9
9
  import { UserCustomParameters } from '../provider/Provider';
10
10
  import { TransactionReceipt } from 'web3-core';
11
- import { CredentialType } from '../ddo/interfaces/Credentials';
12
11
  import { Consumable } from '../ddo/interfaces/Consumable';
13
12
  export declare enum CreateProgressStep {
14
13
  CreatingDataToken = 0,
@@ -37,8 +36,8 @@ export declare class Assets extends Instantiable {
37
36
  create(metadata: Metadata, publisher: Account, services?: Service[], dtAddress?: string, cap?: string, name?: string, symbol?: string, providerUri?: string): SubscribablePromise<CreateProgressStep, DDO>;
38
37
  resolve(did: string): Promise<DDO>;
39
38
  editMetadata(ddo: DDO, newMetadata: EditableMetadata): Promise<DDO>;
40
- updateCredentials(ddo: DDO, credentialType: CredentialType, allowList: string[], denyList: string[]): Promise<DDO>;
41
- checkCredential(ddo: DDO, credentialType: CredentialType, value: string): Consumable;
39
+ updateCredentials(ddo: DDO, credentialType: string, allowList: string[], denyList: string[]): Promise<DDO>;
40
+ checkCredential(ddo: DDO, credentialType: string, value: string): Consumable;
42
41
  publishDdo(ddo: DDO, consumerAccount: string, encrypt?: boolean): Promise<TransactionReceipt>;
43
42
  updateMetadata(ddo: DDO, consumerAccount: string): Promise<TransactionReceipt>;
44
43
  editServiceTimeout(ddo: DDO, serviceIndex: number, timeout: number): Promise<DDO>;
@@ -48,10 +47,10 @@ export declare class Assets extends Instantiable {
48
47
  query(query: SearchQuery): Promise<any>;
49
48
  createAccessServiceAttributes(creator: Account, cost: string, datePublished: string, timeout?: number, providerUri?: string, requiredParameters?: ServiceCustomParametersRequired): Promise<ServiceAccess>;
50
49
  initialize(asset: DDO | string, serviceType: string, consumerAddress: string, serviceIndex: number, serviceEndpoint: string, userCustomParameters?: UserCustomParameters): Promise<any>;
51
- order(asset: DDO | string, serviceType: string, payerAddress: string, serviceIndex?: number, mpAddress?: string, consumerAddress?: string, userCustomParameters?: UserCustomParameters, searchPreviousOrders?: boolean): Promise<string>;
50
+ order(asset: DDO | string, serviceType: string, payerAddress: string, serviceIndex?: number, mpAddress?: string, consumerAddress?: string, userCustomParameters?: UserCustomParameters, authService?: string, searchPreviousOrders?: boolean): Promise<string>;
52
51
  download(asset: DDO | string, txId: string, tokenAddress: string, consumerAccount: Account, destination: string): Promise<string | true>;
53
52
  simpleDownload(dtAddress: string, serviceEndpoint: string, txId: string, account: string): Promise<string>;
54
53
  getOrderHistory(account: Account, serviceType?: string, fromBlock?: number): Promise<Order[]>;
55
- isConsumable(ddo: DDO, consumer?: string): Promise<Consumable>;
54
+ isConsumable(ddo: DDO, consumer?: string, credentialsType?: string, authService?: string): Promise<Consumable>;
56
55
  isUserCustomParametersValid(serviceCustomParameters: ServiceCustomParameter[], userCustomParameters?: UserCustomParameters): Promise<boolean>;
57
56
  }
@@ -1,6 +1,6 @@
1
1
  import { DDO } from '../ddo/DDO';
2
- import { Credentials, CredentialType, CredentialAction } from '../ddo/interfaces/Credentials';
3
- export declare function checkCredentialExist(credentials: Credentials, credentialType: CredentialType, credentialAction: CredentialAction): boolean;
4
- export declare function removeCredentialDetail(ddo: DDO, credentialType: CredentialType, credentialAction: CredentialAction): DDO;
5
- export declare function updateCredentialDetail(ddo: DDO, credentialType: CredentialType, list: string[], credentialAction: CredentialAction): DDO;
6
- export declare function addCredentialDetail(ddo: DDO, credentialType: CredentialType, list: string[], credentialAction: CredentialAction): DDO;
2
+ import { Credentials, CredentialAction } from '../ddo/interfaces/Credentials';
3
+ export declare function checkCredentialExist(credentials: Credentials, credentialType: string, credentialAction: CredentialAction): boolean;
4
+ export declare function removeCredentialDetail(ddo: DDO, credentialType: string, credentialAction: CredentialAction): DDO;
5
+ export declare function updateCredentialDetail(ddo: DDO, credentialType: string, list: string[], credentialAction: CredentialAction): DDO;
6
+ export declare function addCredentialDetail(ddo: DDO, credentialType: string, list: string[], credentialAction: CredentialAction): DDO;
@@ -64,8 +64,8 @@ export declare class Compute extends Instantiable {
64
64
  createComputeService(consumerAccount: Account, cost: string, datePublished: string, providerAttributes: any, computePrivacy?: ServiceComputePrivacy, timeout?: number, providerUri?: string, requiredCustomParameters?: ServiceCustomParametersRequired): ServiceCompute;
65
65
  private checkOutput;
66
66
  isOrderable(dataset: DDO | string, serviceIndex: number, algorithm: ComputeAlgorithm, algorithmDDO?: DDO): Promise<boolean>;
67
- orderAsset(consumerAccount: string, dataset: DDO | string, serviceIndex: number, algorithm: ComputeAlgorithm, mpAddress?: string, computeAddress?: string, userCustomParameters?: UserCustomParameters, searchPreviousOrders?: boolean): SubscribablePromise<OrderProgressStep, string>;
68
- orderAlgorithm(asset: DDO | string, serviceType: string, payerAddress: string, serviceIndex?: number, mpAddress?: string, consumerAddress?: string, userCustomParameters?: UserCustomParameters, searchPreviousOrders?: boolean): Promise<string>;
67
+ orderAsset(consumerAccount: string, dataset: DDO | string, serviceIndex: number, algorithm: ComputeAlgorithm, mpAddress?: string, computeAddress?: string, userCustomParameters?: UserCustomParameters, authService?: string, searchPreviousOrders?: boolean): SubscribablePromise<OrderProgressStep, string>;
68
+ orderAlgorithm(asset: DDO | string, serviceType: string, payerAddress: string, serviceIndex?: number, mpAddress?: string, consumerAddress?: string, userCustomParameters?: UserCustomParameters, authService?: string, searchPreviousOrders?: boolean): Promise<string>;
69
69
  editComputePrivacy(ddo: DDO, serviceIndex: number, computePrivacy: ServiceComputePrivacy): Promise<DDO>;
70
70
  toggleAllowAllPublishedAlgorithms(ddo: DDO, serviceIndex: number, newState: boolean): Promise<DDO>;
71
71
  createPublisherTrustedAlgorithmfromDID(did: string, ddo?: DDO): Promise<publisherTrustedAlgorithm>;
@@ -0,0 +1,9 @@
1
+ import { Instantiable, InstantiableConfig } from '../Instantiable.abstract';
2
+ export declare class EventAccessControl extends Instantiable {
3
+ private baseUrl;
4
+ static getInstance(config: InstantiableConfig): Promise<EventAccessControl>;
5
+ setBaseUrl(url: string): Promise<void>;
6
+ get url(): string;
7
+ private getIsPermitArgs;
8
+ isPermit(component: string, eventType: string, authService: string, credentials: string, credentialsType: string, did?: string): Promise<boolean>;
9
+ }
@@ -13,10 +13,12 @@ import { Compute } from './Compute';
13
13
  import { OceanPool } from '../balancer/OceanPool';
14
14
  import { OceanFixedRateExchange } from '../exchange/FixedRateExchange';
15
15
  import { OceanDispenser } from '../dispenser/Dispenser';
16
+ import { EventAccessControl } from './EventAccessControl';
16
17
  export declare class Ocean extends Instantiable {
17
18
  static getInstance(config: Config): Promise<Ocean>;
18
19
  network: Network;
19
20
  provider: Provider;
21
+ eventAccessControl: EventAccessControl;
20
22
  web3Provider: any;
21
23
  metadataCache: MetadataCache;
22
24
  onChainMetadata: OnChainMetadata;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oceanprotocol/lib",
3
3
  "source": "./src/index.ts",
4
- "version": "0.19.2",
4
+ "version": "0.19.3",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "main": "./dist/node/lib.js",
7
7
  "exports": "./dist/node/lib.js",
@@ -60,15 +60,15 @@
60
60
  "web3-eth-contract": "^1.5.2"
61
61
  },
62
62
  "devDependencies": {
63
- "@truffle/hdwallet-provider": "^1.4.1",
63
+ "@truffle/hdwallet-provider": "^1.6.0",
64
64
  "@types/chai": "^4.2.19",
65
65
  "@types/chai-spies": "^1.0.3",
66
66
  "@types/crypto-js": "^4.0.1",
67
67
  "@types/mocha": "^9.0.0",
68
- "@types/node": "^16.10.2",
68
+ "@types/node": "^16.11.7",
69
69
  "@types/node-fetch": "^3.0.3",
70
- "@typescript-eslint/eslint-plugin": "^4.32.0",
71
- "@typescript-eslint/parser": "^4.32.0",
70
+ "@typescript-eslint/eslint-plugin": "^4.33.0",
71
+ "@typescript-eslint/parser": "^4.33.0",
72
72
  "auto-changelog": "^2.3.0",
73
73
  "chai": "^4.3.4",
74
74
  "chai-spies": "^1.0.0",
@@ -77,18 +77,18 @@
77
77
  "eslint-config-oceanprotocol": "^1.5.0",
78
78
  "eslint-config-prettier": "^8.3.0",
79
79
  "eslint-plugin-prettier": "^4.0.0",
80
- "microbundle": "^0.13.3",
81
- "mocha": "^9.1.2",
80
+ "microbundle": "^0.14.1",
81
+ "mocha": "^9.1.3",
82
82
  "mock-local-storage": "^1.1.17",
83
83
  "nyc": "^15.1.0",
84
84
  "ora": "5.4.1",
85
85
  "prettier": "^2.3.1",
86
- "release-it": "^14.10.0",
86
+ "release-it": "^14.11.7",
87
87
  "source-map-support": "^0.5.19",
88
- "ts-node": "^10.0.0",
88
+ "ts-node": "^10.4.0",
89
89
  "ts-node-register": "^1.0.0",
90
- "typedoc": "0.22.5",
91
- "typescript": "^4.3.4"
90
+ "typedoc": "0.22.9",
91
+ "typescript": "^4.4.4"
92
92
  },
93
93
  "nyc": {
94
94
  "include": [
@@ -1,63 +0,0 @@
1
- <!--
2
- Copyright 2021 Ocean Protocol Foundation
3
- SPDX-License-Identifier: Apache-2.0
4
- -->
5
-
6
- # On Config Parameters
7
-
8
- We can set any config parameter (a) via an envvar, or (b) via a config file. Envvar values override config file values.
9
-
10
- An `Ocean` instance will hold a `Config` instance that holds various config parameters. These parameters need to get set. This is set based on what's input to `Ocean` constructor:
11
-
12
- 1. dict input: `Ocean({'network':..})`
13
- 2. Config object input: `Ocean(Config('config.ini'))`
14
- 3. no input, so it uses CONFIG_FILE envvar
15
-
16
- Here are examples.
17
-
18
- ## 1. dict input, filled from envvars
19
-
20
- First, in console:
21
-
22
- ```console
23
- export NETWORK_URL=https://rinkeby.infura.io/v3/<your Infura project id>
24
- export AQUARIUS_URL=https://aquarius.rinkeby.oceanprotocol.com
25
- export PROVIDER_URL=https://provider.rinkeby.oceanprotocol.com
26
- ```
27
-
28
- For legacy support, you can also use `metadataStoreUri` instead of `metadataCacheUri`.
29
-
30
- ## 1a. Unsetting envvars
31
-
32
- Recall that parameters set by envvars override config file values. So, to use a config value in a file, we must remove its envvar.
33
-
34
- Here's how. In the console:
35
-
36
- ```console
37
- unset NETWORK_URL AQUARIUS_URL PROVIDER_URL
38
- ```
39
-
40
- ## 2. Config object input, filled from config file
41
-
42
- First, in your working directory, create `config.ini` file and fill as follows:
43
-
44
- ```console
45
- [eth-network]
46
- network = https://rinkeby.infura.io/v3/<your infura project id>
47
-
48
- [resources]
49
- aquarius.url = https://provider.rinkeby.oceanprotocol.com
50
- provider.url = https://aquarius.rinkeby.oceanprotocol.com
51
- ```
52
-
53
-
54
- ## 3. No input, so it uses CONFIG_FILE envvar
55
-
56
- We'll use the `config.ini` file created from the previous example.
57
-
58
- Then, set an envvar for the config file. In the console:
59
-
60
- ```console
61
- export CONFIG_FILE=config.ini
62
- ```
63
-