pontus-x_cli 1.2.7 → 1.2.8
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/README.md +26 -26
- package/dist/commands/compute.d.ts +2 -2
- package/dist/commands/compute.js +46 -40
- package/dist/commands/compute.js.map +1 -1
- package/dist/commands/edit-asset-allowed.d.ts +1 -1
- package/dist/commands/edit-asset-allowed.js +42 -38
- package/dist/commands/edit-asset-allowed.js.map +1 -1
- package/dist/commands/edit-trusted-algos.d.ts +1 -1
- package/dist/commands/edit-trusted-algos.js +34 -34
- package/dist/commands/edit-trusted-algos.js.map +1 -1
- package/dist/commands/generate-manifest.d.ts +3 -3
- package/dist/commands/generate-manifest.js +20 -20
- package/dist/commands/generate-manifest.js.map +1 -1
- package/dist/commands/generate-private-keys.d.ts +2 -2
- package/dist/commands/generate-private-keys.js +26 -26
- package/dist/commands/generate-private-keys.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +48 -48
- package/dist/config.js.map +1 -1
- package/dist/lib/aquarius.js +25 -22
- package/dist/lib/aquarius.js.map +1 -1
- package/dist/lib/spec.d.ts +3 -3
- package/dist/lib/spec.js +30 -25
- package/dist/lib/spec.js.map +1 -1
- package/dist/types/manifest-schema.json +2 -8
- package/dist/types/schema.json +24 -3
- package/dist/utils/asset.d.ts +2 -2
- package/dist/utils/asset.js +23 -23
- package/dist/utils/asset.js.map +1 -1
- package/dist/utils/login.d.ts +2 -2
- package/dist/utils/login.js +13 -13
- package/dist/utils/login.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ $ npm install -g pontus-x_cli
|
|
|
22
22
|
$ pontus-x_cli COMMAND
|
|
23
23
|
running command...
|
|
24
24
|
$ pontus-x_cli (--version)
|
|
25
|
-
pontus-x_cli/1.2.
|
|
25
|
+
pontus-x_cli/1.2.8 linux-x64 node-v26.3.0
|
|
26
26
|
$ pontus-x_cli --help [COMMAND]
|
|
27
27
|
USAGE
|
|
28
28
|
$ pontus-x_cli COMMAND
|
|
@@ -106,7 +106,7 @@ EXAMPLES
|
|
|
106
106
|
$ pontus-x_cli access did:op:af3e93c4f18903f91b108e7204b8a752e7605f4547ed507212bd6aca63af5686
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
_See code: [src/commands/access.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
109
|
+
_See code: [src/commands/access.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/access.ts)_
|
|
110
110
|
|
|
111
111
|
## `pontus-x_cli autocomplete [SHELL]`
|
|
112
112
|
|
|
@@ -161,7 +161,7 @@ EXAMPLES
|
|
|
161
161
|
$ pontus-x_cli change-price did:op:ffeee8c8f19328985ef6743b08e61ef89d5141027fd47612e32e7900cacd2b7a 10
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
_See code: [src/commands/change-price.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
164
|
+
_See code: [src/commands/change-price.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/change-price.ts)_
|
|
165
165
|
|
|
166
166
|
## `pontus-x_cli check-participant-compliance`
|
|
167
167
|
|
|
@@ -182,7 +182,7 @@ EXAMPLES
|
|
|
182
182
|
$ pontus-x_cli check-participant-compliance -p ./CEP.data.json --vp ./CEP.vp.json
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
_See code: [src/commands/check-participant-compliance.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
185
|
+
_See code: [src/commands/check-participant-compliance.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/check-participant-compliance.ts)_
|
|
186
186
|
|
|
187
187
|
## `pontus-x_cli compute [ALGORITHM]`
|
|
188
188
|
|
|
@@ -213,7 +213,7 @@ EXAMPLES
|
|
|
213
213
|
$ pontus-x_cli compute <algorithmDid> -t <tag1> -t <tag2> ...
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
_See code: [src/commands/compute.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
216
|
+
_See code: [src/commands/compute.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/compute.ts)_
|
|
217
217
|
|
|
218
218
|
## `pontus-x_cli compute-results JOBID`
|
|
219
219
|
|
|
@@ -236,7 +236,7 @@ EXAMPLES
|
|
|
236
236
|
$ pontus-x_cli compute-results 215bae450c8f40f59bfc5d1ccada3931 -p https://provider.agrospai.udl.cat
|
|
237
237
|
```
|
|
238
238
|
|
|
239
|
-
_See code: [src/commands/compute-results.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
239
|
+
_See code: [src/commands/compute-results.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/compute-results.ts)_
|
|
240
240
|
|
|
241
241
|
## `pontus-x_cli compute-status JOBID`
|
|
242
242
|
|
|
@@ -259,7 +259,7 @@ EXAMPLES
|
|
|
259
259
|
$ pontus-x_cli compute-status 215bae450c8f40f59bfc5d1ccada3931 -p https://provider.agrospai.udl.cat
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
-
_See code: [src/commands/compute-status.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
262
|
+
_See code: [src/commands/compute-status.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/compute-status.ts)_
|
|
263
263
|
|
|
264
264
|
## `pontus-x_cli edit-additional-metadata DID METADATAFILE`
|
|
265
265
|
|
|
@@ -283,7 +283,7 @@ EXAMPLES
|
|
|
283
283
|
$ pontus-x_cli edit-additional-metadata did:op:dcdb747f8feff3122c6d6c0f45a339a6e09415e721f98f61cc2c1d62ab35a21f ./metadata.json
|
|
284
284
|
```
|
|
285
285
|
|
|
286
|
-
_See code: [src/commands/edit-additional-metadata.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
286
|
+
_See code: [src/commands/edit-additional-metadata.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/edit-additional-metadata.ts)_
|
|
287
287
|
|
|
288
288
|
## `pontus-x_cli edit-algo DID IMAGE TAG CHECKSUM ENTRYPOINT`
|
|
289
289
|
|
|
@@ -310,7 +310,7 @@ EXAMPLES
|
|
|
310
310
|
$ pontus-x_cli edit-algo did:op:dcdb747f8feff3122c6d6c0f45a339a6e09415e721f98f61cc2c1d62ab35a21f rogargon/pandas-profiling 4.16 sha256:81dca5439f07dff4d56097546a9fce7335be3de8e2622dc105c64e54376f86b5 "python /algorithm/src/main.py"
|
|
311
311
|
```
|
|
312
312
|
|
|
313
|
-
_See code: [src/commands/edit-algo.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
313
|
+
_See code: [src/commands/edit-algo.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/edit-algo.ts)_
|
|
314
314
|
|
|
315
315
|
## `pontus-x_cli edit-asset-allowed`
|
|
316
316
|
|
|
@@ -338,7 +338,7 @@ EXAMPLES
|
|
|
338
338
|
$ pontus-x_cli edit-asset-allowed -u 0xAbc123... --public
|
|
339
339
|
```
|
|
340
340
|
|
|
341
|
-
_See code: [src/commands/edit-asset-allowed.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
341
|
+
_See code: [src/commands/edit-asset-allowed.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/edit-asset-allowed.ts)_
|
|
342
342
|
|
|
343
343
|
## `pontus-x_cli edit-asset-url DID URL`
|
|
344
344
|
|
|
@@ -362,7 +362,7 @@ EXAMPLES
|
|
|
362
362
|
$ pontus-x_cli edit-asset-url did:op:af3e93c4f18903f91b108e7204b8a752e7605f4547ed507212bd6aca63af5686 https://raw.githubusercontent.com/plotly/datasets/refs/heads/master/titanic.csv
|
|
363
363
|
```
|
|
364
364
|
|
|
365
|
-
_See code: [src/commands/edit-asset-url.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
365
|
+
_See code: [src/commands/edit-asset-url.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/edit-asset-url.ts)_
|
|
366
366
|
|
|
367
367
|
## `pontus-x_cli edit-trusted-algos`
|
|
368
368
|
|
|
@@ -388,7 +388,7 @@ EXAMPLES
|
|
|
388
388
|
$ pontus-x_cli edit-trusted-algos -d <datasetDid1> <datasetDid2> ... -a <algorithmDid1> <algorithmDid2> ...
|
|
389
389
|
```
|
|
390
390
|
|
|
391
|
-
_See code: [src/commands/edit-trusted-algos.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
391
|
+
_See code: [src/commands/edit-trusted-algos.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/edit-trusted-algos.ts)_
|
|
392
392
|
|
|
393
393
|
## `pontus-x_cli edit-trusted-publishers`
|
|
394
394
|
|
|
@@ -413,7 +413,7 @@ EXAMPLES
|
|
|
413
413
|
$ pontus-x_cli edit-trusted-publishers -d <datasetDid1> <datasetDid2> ... -p <publisherDid1> <publisherDid2> ...
|
|
414
414
|
```
|
|
415
415
|
|
|
416
|
-
_See code: [src/commands/edit-trusted-publishers.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
416
|
+
_See code: [src/commands/edit-trusted-publishers.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/edit-trusted-publishers.ts)_
|
|
417
417
|
|
|
418
418
|
## `pontus-x_cli export-private-key`
|
|
419
419
|
|
|
@@ -435,7 +435,7 @@ EXAMPLES
|
|
|
435
435
|
$ pontus-x_cli export-private-key
|
|
436
436
|
```
|
|
437
437
|
|
|
438
|
-
_See code: [src/commands/export-private-key.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
438
|
+
_See code: [src/commands/export-private-key.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/export-private-key.ts)_
|
|
439
439
|
|
|
440
440
|
## `pontus-x_cli generate-asset-credentials DID`
|
|
441
441
|
|
|
@@ -461,7 +461,7 @@ EXAMPLES
|
|
|
461
461
|
$ pontus-x_cli generate-asset-credentials -p ./CEP.data.json -d ./did.json -c certificate.key did:op:01f8bc1e797a854dc718bd7a802acb07c5fc39f706b03dd454bceb66be6828c6
|
|
462
462
|
```
|
|
463
463
|
|
|
464
|
-
_See code: [src/commands/generate-asset-credentials.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
464
|
+
_See code: [src/commands/generate-asset-credentials.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/generate-asset-credentials.ts)_
|
|
465
465
|
|
|
466
466
|
## `pontus-x_cli generate-did-web`
|
|
467
467
|
|
|
@@ -482,7 +482,7 @@ EXAMPLES
|
|
|
482
482
|
$ pontus-x_cli generate-did-web -d <https://compliance.agrospai.udl.cat> -c certificate-chain.crt
|
|
483
483
|
```
|
|
484
484
|
|
|
485
|
-
_See code: [src/commands/generate-did-web.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
485
|
+
_See code: [src/commands/generate-did-web.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/generate-did-web.ts)_
|
|
486
486
|
|
|
487
487
|
## `pontus-x_cli generate-manifest`
|
|
488
488
|
|
|
@@ -506,7 +506,7 @@ EXAMPLES
|
|
|
506
506
|
$ pontus-x_cli generate-manifest --keys-dir ./keys --password-env KEY_PASSWORD --output manifest.yaml
|
|
507
507
|
```
|
|
508
508
|
|
|
509
|
-
_See code: [src/commands/generate-manifest.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
509
|
+
_See code: [src/commands/generate-manifest.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/generate-manifest.ts)_
|
|
510
510
|
|
|
511
511
|
## `pontus-x_cli generate-participant-credentials`
|
|
512
512
|
|
|
@@ -529,7 +529,7 @@ EXAMPLES
|
|
|
529
529
|
$ pontus-x_cli generate-participant-credentials -p ./CEP.data.json -d ./did.json -c certificate.key
|
|
530
530
|
```
|
|
531
531
|
|
|
532
|
-
_See code: [src/commands/generate-participant-credentials.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
532
|
+
_See code: [src/commands/generate-participant-credentials.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/generate-participant-credentials.ts)_
|
|
533
533
|
|
|
534
534
|
## `pontus-x_cli generate-private-keys`
|
|
535
535
|
|
|
@@ -555,7 +555,7 @@ EXAMPLES
|
|
|
555
555
|
$ pontus-x_cli generate-private-keys --count 5 --output-dir ./keys
|
|
556
556
|
```
|
|
557
557
|
|
|
558
|
-
_See code: [src/commands/generate-private-keys.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
558
|
+
_See code: [src/commands/generate-private-keys.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/generate-private-keys.ts)_
|
|
559
559
|
|
|
560
560
|
## `pontus-x_cli get DID`
|
|
561
561
|
|
|
@@ -575,7 +575,7 @@ EXAMPLES
|
|
|
575
575
|
$ pontus-x_cli get did:op:ffeee8c8f19328985ef6743b08e61ef89d5141027fd47612e32e7900cacd2b7a
|
|
576
576
|
```
|
|
577
577
|
|
|
578
|
-
_See code: [src/commands/get.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
578
|
+
_See code: [src/commands/get.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/get.ts)_
|
|
579
579
|
|
|
580
580
|
## `pontus-x_cli help [COMMAND]`
|
|
581
581
|
|
|
@@ -618,7 +618,7 @@ EXAMPLES
|
|
|
618
618
|
$ pontus-x_cli login d999baae98ac5246568fd726be8832c49626867d.json
|
|
619
619
|
```
|
|
620
620
|
|
|
621
|
-
_See code: [src/commands/login.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
621
|
+
_See code: [src/commands/login.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/login.ts)_
|
|
622
622
|
|
|
623
623
|
## `pontus-x_cli logout`
|
|
624
624
|
|
|
@@ -635,7 +635,7 @@ EXAMPLES
|
|
|
635
635
|
$ pontus-x_cli logout
|
|
636
636
|
```
|
|
637
637
|
|
|
638
|
-
_See code: [src/commands/logout.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
638
|
+
_See code: [src/commands/logout.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/logout.ts)_
|
|
639
639
|
|
|
640
640
|
## `pontus-x_cli publish PATH`
|
|
641
641
|
|
|
@@ -667,7 +667,7 @@ EXAMPLES
|
|
|
667
667
|
$ pontus-x_cli publish samples/publish/algo/index.ts
|
|
668
668
|
```
|
|
669
669
|
|
|
670
|
-
_See code: [src/commands/publish.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
670
|
+
_See code: [src/commands/publish.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/publish.ts)_
|
|
671
671
|
|
|
672
672
|
## `pontus-x_cli render [DID]`
|
|
673
673
|
|
|
@@ -684,7 +684,7 @@ FLAGS
|
|
|
684
684
|
-t, --tags=<value>... Tags to filter datasets (they must have all the provided tags)
|
|
685
685
|
```
|
|
686
686
|
|
|
687
|
-
_See code: [src/commands/render.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
687
|
+
_See code: [src/commands/render.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/render.ts)_
|
|
688
688
|
|
|
689
689
|
## `pontus-x_cli revoke`
|
|
690
690
|
|
|
@@ -708,7 +708,7 @@ EXAMPLES
|
|
|
708
708
|
$ pontus-x_cli revoke -d did:op:ffeee8c8f19328985ef6743b08e61ef89d5141027fd47612e32e7900cacd2b7a did:op:abcee8c8f19328985ef6743b08e61ef89d5141027fd47612e32e7900cacd2b7b
|
|
709
709
|
```
|
|
710
710
|
|
|
711
|
-
_See code: [src/commands/revoke.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
711
|
+
_See code: [src/commands/revoke.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/revoke.ts)_
|
|
712
712
|
|
|
713
713
|
## `pontus-x_cli self-description DID SDURL`
|
|
714
714
|
|
|
@@ -732,7 +732,7 @@ EXAMPLES
|
|
|
732
732
|
$ pontus-x_cli self-description did:op:d22954f2cbf6a85c897ce605c275cc786e099592cc59e3b7dd66b93e784bed8c https://example.com/self-description.json
|
|
733
733
|
```
|
|
734
734
|
|
|
735
|
-
_See code: [src/commands/self-description.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.
|
|
735
|
+
_See code: [src/commands/self-description.ts](https://github.com/AgrospAI/pontus-x_cli/blob/v1.2.8/src/commands/self-description.ts)_
|
|
736
736
|
<!-- commandsstop -->
|
|
737
737
|
|
|
738
738
|
# Useful information
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComputeJob } from
|
|
2
|
-
import { Command } from
|
|
1
|
+
import type { ComputeJob } from "@oceanprotocol/lib";
|
|
2
|
+
import { Command } from "@oclif/core";
|
|
3
3
|
export default class Compute extends Command {
|
|
4
4
|
static args: {
|
|
5
5
|
algorithm: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
package/dist/commands/compute.js
CHANGED
|
@@ -3,28 +3,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
7
|
+
const promises_1 = require("node:timers/promises");
|
|
8
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
9
|
+
const core_1 = require("@oclif/core");
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
6
12
|
const config_1 = require("../config");
|
|
7
13
|
const aquarius_1 = require("../lib/aquarius");
|
|
8
14
|
const asset_1 = require("../utils/asset");
|
|
9
15
|
const connection_1 = require("../utils/connection");
|
|
10
16
|
const login_1 = require("../utils/login");
|
|
11
|
-
const prompts_1 = require("@inquirer/prompts");
|
|
12
|
-
const core_1 = require("@oclif/core");
|
|
13
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
14
|
-
const fs_1 = __importDefault(require("fs"));
|
|
15
|
-
const promises_1 = require("node:timers/promises");
|
|
16
|
-
const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
17
17
|
class Compute extends core_1.Command {
|
|
18
18
|
async run() {
|
|
19
19
|
const { args, flags } = await this.parse(Compute);
|
|
20
20
|
// Network selection
|
|
21
21
|
const network = flags.network || (0, login_1.getEnvNetwork)() || (await (0, login_1.askForNetwork)());
|
|
22
22
|
const chainId = config_1.NETWORK_CONFIGS[network].chainId;
|
|
23
|
-
console.log(`${chalk_1.default.green(
|
|
23
|
+
console.log(`${chalk_1.default.green("Using network:")} ${network}\n`);
|
|
24
24
|
var algoParams = {};
|
|
25
25
|
if (flags.algoParams) {
|
|
26
26
|
try {
|
|
27
|
-
const jsonString =
|
|
27
|
+
const jsonString = node_fs_1.default.readFileSync(flags.algoParams, "utf-8");
|
|
28
28
|
algoParams = JSON.parse(jsonString);
|
|
29
29
|
}
|
|
30
30
|
catch (err) {
|
|
@@ -32,34 +32,38 @@ class Compute extends core_1.Command {
|
|
|
32
32
|
this.error(`Error reading file: ${message}`);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
this.log(
|
|
35
|
+
this.log("Algorithm parameters:", flags.parameters, Object.keys(algoParams));
|
|
36
36
|
// Authentication selection
|
|
37
37
|
const loginInfos = await (0, login_1.getLoginInfos)(flags.manifest);
|
|
38
38
|
const inputLoginInfo = loginInfos.length === 1 ? loginInfos[0] : null;
|
|
39
39
|
if (inputLoginInfo) {
|
|
40
|
-
console.log(`${chalk_1.default.green(
|
|
40
|
+
console.log(`${chalk_1.default.green("Using account:")} ${chalk_1.default.blue(inputLoginInfo.ownerAddress)} ${chalk_1.default.magenta(inputLoginInfo.ownerName)}\n`);
|
|
41
41
|
}
|
|
42
42
|
const loginInfo = inputLoginInfo !== null && inputLoginInfo !== void 0 ? inputLoginInfo : (await askForAccountSelection(loginInfos));
|
|
43
43
|
// Algorithm selection
|
|
44
|
-
const inputAlgorithm = args.algorithm
|
|
44
|
+
const inputAlgorithm = args.algorithm
|
|
45
|
+
? await (0, aquarius_1.getAssetInfo)(args.algorithm)
|
|
46
|
+
: null;
|
|
45
47
|
if (inputAlgorithm) {
|
|
46
48
|
console.log(`Algorithm to run: ${chalk_1.default.blue(inputAlgorithm.name)} (${chalk_1.default.gray(inputAlgorithm.did)})\n`);
|
|
47
49
|
}
|
|
48
50
|
const algorithm = inputAlgorithm !== null && inputAlgorithm !== void 0 ? inputAlgorithm : (await askForAlgorithm(chainId));
|
|
49
51
|
// Datasets selection
|
|
50
|
-
const inputDatasets = flags.datasets
|
|
52
|
+
const inputDatasets = flags.datasets
|
|
53
|
+
? await (0, aquarius_1.getAssetsFromDids)(flags.datasets)
|
|
54
|
+
: null;
|
|
51
55
|
if (inputDatasets) {
|
|
52
|
-
console.log(
|
|
56
|
+
console.log("\nThe following assets will be used:");
|
|
53
57
|
for (const asset of inputDatasets) {
|
|
54
58
|
const ownerName = await (0, aquarius_1.getOwnerName)(asset.owner);
|
|
55
|
-
console.log(`${chalk_1.default.blue(asset.did)} | ${chalk_1.default.green(asset.created.split(
|
|
59
|
+
console.log(`${chalk_1.default.blue(asset.did)} | ${chalk_1.default.green(asset.created.split("T")[0])} | ${chalk_1.default.yellow(ownerName)} | ${chalk_1.default.magenta(asset.name)}`);
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
62
|
const datasets = inputDatasets !== null && inputDatasets !== void 0 ? inputDatasets : (await askForDatasets(chainId));
|
|
59
63
|
// Confirmation prompt
|
|
60
64
|
if (!flags.yes &&
|
|
61
|
-
!readline_sync_1.default.keyInYNStrict(
|
|
62
|
-
console.log(
|
|
65
|
+
!readline_sync_1.default.keyInYNStrict("\nDo you want to proceed with running the algorithm on the selected datasets?")) {
|
|
66
|
+
console.log("Operation cancelled by the user.");
|
|
63
67
|
return;
|
|
64
68
|
}
|
|
65
69
|
// Run compute
|
|
@@ -72,7 +76,9 @@ class Compute extends core_1.Command {
|
|
|
72
76
|
const computeJob = await connection.nautilus.compute({
|
|
73
77
|
algorithm: { did: algorithm.did, algocustomdata: algoParams },
|
|
74
78
|
dataset: { did: datasets[0].did },
|
|
75
|
-
additionalDatasets: datasets
|
|
79
|
+
additionalDatasets: datasets
|
|
80
|
+
.filter((_, i) => i > 0)
|
|
81
|
+
.map((dataset) => ({ did: dataset.did })),
|
|
76
82
|
});
|
|
77
83
|
const firstDatasetAsset = await connection.nautilus.getAquariusAsset(datasets[0].did);
|
|
78
84
|
const provider = firstDatasetAsset.services[0].serviceEndpoint;
|
|
@@ -91,51 +97,51 @@ class Compute extends core_1.Command {
|
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
Compute.args = {
|
|
94
|
-
algorithm: core_1.Args.string({ description:
|
|
100
|
+
algorithm: core_1.Args.string({ description: "Algorithm DID (did:op:...)" }),
|
|
95
101
|
};
|
|
96
|
-
Compute.description =
|
|
102
|
+
Compute.description = "Compute the algorithm on one or more datasets.";
|
|
97
103
|
Compute.examples = [
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
"<%= config.bin %> <%= command.id %> <algorithmDid> -d <datasetDid1> <datasetDid2> ...",
|
|
105
|
+
"<%= config.bin %> <%= command.id %> <algorithmDid> -t <tag1> -t <tag2> ...",
|
|
100
106
|
];
|
|
101
107
|
Compute.flags = {
|
|
102
108
|
datasets: core_1.Flags.string({
|
|
103
|
-
char:
|
|
104
|
-
description:
|
|
109
|
+
char: "d",
|
|
110
|
+
description: "Dataset DIDs (did:op:...)",
|
|
105
111
|
multiple: true,
|
|
106
112
|
}),
|
|
107
113
|
yes: core_1.Flags.boolean({
|
|
108
|
-
char:
|
|
114
|
+
char: "y",
|
|
109
115
|
default: false,
|
|
110
|
-
description:
|
|
116
|
+
description: "Automatic yes to prompts",
|
|
111
117
|
}),
|
|
112
118
|
manifest: core_1.Flags.string({
|
|
113
|
-
char:
|
|
114
|
-
description:
|
|
119
|
+
char: "m",
|
|
120
|
+
description: "Path to manifest file with the accounts to use for authentication",
|
|
115
121
|
}),
|
|
116
122
|
algoParams: core_1.Flags.string({
|
|
117
|
-
char:
|
|
118
|
-
description:
|
|
123
|
+
char: "a",
|
|
124
|
+
description: "Path to algorithm parameters file with the algorithm execution parameters",
|
|
119
125
|
}),
|
|
120
126
|
network: core_1.Flags.string({
|
|
121
|
-
char:
|
|
122
|
-
description:
|
|
127
|
+
char: "n",
|
|
128
|
+
description: "Network to use (env: NETWORK)",
|
|
123
129
|
options: Object.keys(config_1.NETWORK_CONFIGS),
|
|
124
130
|
}),
|
|
125
131
|
};
|
|
126
132
|
exports.default = Compute;
|
|
127
133
|
async function askForDatasets(chainId) {
|
|
128
|
-
console.log(
|
|
134
|
+
console.log("\nSelect the filters to find the datasets you want to use:");
|
|
129
135
|
return (0, asset_1.PromptForAssets)({
|
|
130
|
-
assetTypes: [
|
|
131
|
-
accessTypes: [
|
|
136
|
+
assetTypes: ["dataset"],
|
|
137
|
+
accessTypes: ["compute"],
|
|
132
138
|
chainIds: [chainId],
|
|
133
139
|
});
|
|
134
140
|
}
|
|
135
141
|
async function askForAlgorithm(chainId) {
|
|
136
|
-
console.log(
|
|
142
|
+
console.log("\nSelect an algorithm to run:");
|
|
137
143
|
const answer = await (0, prompts_1.search)({
|
|
138
|
-
message:
|
|
144
|
+
message: "Search for an algorithm by name:",
|
|
139
145
|
pageSize: 10,
|
|
140
146
|
source: async (input, { signal }) => {
|
|
141
147
|
if (!input) {
|
|
@@ -145,8 +151,8 @@ async function askForAlgorithm(chainId) {
|
|
|
145
151
|
if (signal.aborted)
|
|
146
152
|
return [];
|
|
147
153
|
const assets = await (0, aquarius_1.searchAssets)({
|
|
148
|
-
assetTypes: [
|
|
149
|
-
accessTypes: [
|
|
154
|
+
assetTypes: ["algorithm"],
|
|
155
|
+
accessTypes: ["compute"],
|
|
150
156
|
chainIds: [chainId],
|
|
151
157
|
searchText: input,
|
|
152
158
|
signal,
|
|
@@ -166,8 +172,8 @@ async function askForAlgorithm(chainId) {
|
|
|
166
172
|
}
|
|
167
173
|
async function askForAccountSelection(loginInfos) {
|
|
168
174
|
const answer = await (0, prompts_1.select)({
|
|
169
|
-
message:
|
|
170
|
-
choices: loginInfos.map(info => ({
|
|
175
|
+
message: "Select the account to use:",
|
|
176
|
+
choices: loginInfos.map((info) => ({
|
|
171
177
|
name: `${info.ownerAddress} (${info.ownerName})`,
|
|
172
178
|
value: info,
|
|
173
179
|
})),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute.js","sourceRoot":"","sources":["../../src/commands/compute.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"compute.js","sourceRoot":"","sources":["../../src/commands/compute.ts"],"names":[],"mappings":";;;;;AAAA,sDAAyB;AACzB,mDAAkD;AAClD,+CAAmD;AAEnD,sCAAmD;AACnD,kDAA0B;AAC1B,kEAAyC;AACzC,qCAAyD;AACzD,6CAMwB;AACxB,yCAAgD;AAChD,mDAAgD;AAChD,yCAKuB;AAEvB,MAAqB,OAAQ,SAAQ,cAAO;IAqC1C,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAElD,oBAAoB;QACpB,MAAM,OAAO,GACV,KAAK,CAAC,OAAmB,IAAI,IAAA,qBAAa,GAAE,IAAI,CAAC,MAAM,IAAA,qBAAa,GAAE,CAA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AE,GAAG,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,IAAI,KAAK,SAAS,GAAG;oBAClD,KAAK,EAAE,KAAK;iBACb,CAAC,CAAC;YACL,CAAC;YAED,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,sBAAsB,CACnC,UAAuB;IAEvB,MAAM,MAAM,GAAG,MAAM,IAAA,gBAAM,EAAC;QAC1B,OAAO,EAAE,4BAA4B;QACrC,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACjC,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,SAAS,GAAG;YAChD,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;KACJ,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -3,29 +3,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const nautilus_1 = require("@deltadao/nautilus");
|
|
7
|
+
const core_1 = require("@oclif/core");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
6
10
|
const config_1 = require("../config");
|
|
7
11
|
const aquarius_1 = require("../lib/aquarius");
|
|
8
12
|
const asset_1 = require("../utils/asset");
|
|
9
13
|
const connection_1 = require("../utils/connection");
|
|
10
14
|
const login_1 = require("../utils/login");
|
|
11
|
-
const nautilus_1 = require("@deltadao/nautilus");
|
|
12
|
-
const core_1 = require("@oclif/core");
|
|
13
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
14
|
-
const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
15
15
|
class EditAssetAllowed extends core_1.Command {
|
|
16
16
|
async run() {
|
|
17
17
|
var _a, _b, _c;
|
|
18
18
|
const { flags } = await this.parse(EditAssetAllowed);
|
|
19
19
|
// Validation
|
|
20
20
|
if (flags.public && ((_a = flags.users) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
21
|
-
this.error(
|
|
21
|
+
this.error("You cannot specify user addresses and set the asset as public at the same time.");
|
|
22
22
|
}
|
|
23
23
|
if (!flags.public && !((_b = flags.users) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
24
|
-
this.error(
|
|
24
|
+
this.error("You must either specify user addresses with -u or use --public to remove all restrictions.");
|
|
25
25
|
}
|
|
26
26
|
// Network selection
|
|
27
27
|
const network = flags.network || (0, login_1.getEnvNetwork)() || (await (0, login_1.askForNetwork)());
|
|
28
|
-
console.log(`${chalk_1.default.green(
|
|
28
|
+
console.log(`${chalk_1.default.green("Using network:")} ${network}\n`);
|
|
29
29
|
const chainId = config_1.NETWORK_CONFIGS[network].chainId;
|
|
30
30
|
// Authentication selection
|
|
31
31
|
const loginInfos = await (0, login_1.getLoginInfos)(flags.manifest);
|
|
@@ -34,28 +34,28 @@ class EditAssetAllowed extends core_1.Command {
|
|
|
34
34
|
const assets = flags.datasets
|
|
35
35
|
? await (0, aquarius_1.getAssetsFromDids)(flags.datasets)
|
|
36
36
|
: await askForAssets(loginInfos, chainId);
|
|
37
|
-
console.log(
|
|
37
|
+
console.log("\nThe following assets will be edited:");
|
|
38
38
|
for (const asset of assets) {
|
|
39
39
|
const ownerName = await (0, aquarius_1.getOwnerName)(asset.owner);
|
|
40
|
-
console.log(`${chalk_1.default.blue(asset.did)} | ${chalk_1.default.green(asset.created.split(
|
|
40
|
+
console.log(`${chalk_1.default.blue(asset.did)} | ${chalk_1.default.green(asset.created.split("T")[0])} | ${chalk_1.default.yellow(ownerName)} | ${chalk_1.default.magenta(asset.name)}`);
|
|
41
41
|
}
|
|
42
42
|
// Summary of what will change
|
|
43
43
|
if (flags.public) {
|
|
44
|
-
console.log(
|
|
44
|
+
console.log("\nAssets will be set as public (all address restrictions removed).");
|
|
45
45
|
}
|
|
46
46
|
else if ((_c = flags.users) === null || _c === void 0 ? void 0 : _c.length) {
|
|
47
|
-
console.log(
|
|
47
|
+
console.log("\nThe following addresses will be set as allowed users:");
|
|
48
48
|
for (const address of flags.users) {
|
|
49
49
|
console.log(` ${chalk_1.default.cyan(address)}`);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
console.log(
|
|
53
|
+
console.log("\nNo users specified — assets will be set to deny all (empty allow list).");
|
|
54
54
|
}
|
|
55
55
|
// Confirmation prompt
|
|
56
56
|
if (!flags.yes &&
|
|
57
|
-
!readline_sync_1.default.keyInYNStrict(
|
|
58
|
-
console.log(
|
|
57
|
+
!readline_sync_1.default.keyInYNStrict("\nDo you want to proceed with editing the allowed users for the selected assets?")) {
|
|
58
|
+
console.log("Operation cancelled by the user.");
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
// Edit each asset
|
|
@@ -70,17 +70,21 @@ class EditAssetAllowed extends core_1.Command {
|
|
|
70
70
|
const aquariusAsset = await connection.nautilus.getAquariusAsset(asset.did);
|
|
71
71
|
const assetBuilder = new nautilus_1.AssetBuilder(aquariusAsset);
|
|
72
72
|
if (flags.public) {
|
|
73
|
-
|
|
74
|
-
[nautilus_1.CredentialListTypes.ALLOW, nautilus_1.CredentialListTypes.DENY].forEach(type => {
|
|
73
|
+
[nautilus_1.CredentialListTypes.ALLOW, nautilus_1.CredentialListTypes.DENY].forEach((type) => {
|
|
75
74
|
var _a, _b, _c, _d;
|
|
76
75
|
// Delete current allowed addresses
|
|
77
|
-
const existing = (_d = (_c = (_b = (_a = aquariusAsset.credentials) === null || _a === void 0 ? void 0 : _a[type]) === null || _b === void 0 ? void 0 : _b.find((c) => c.type ===
|
|
76
|
+
const existing = (_d = (_c = (_b = (_a = aquariusAsset.credentials) === null || _a === void 0 ? void 0 : _a[type]) === null || _b === void 0 ? void 0 : _b.find((c) => c.type === "address")) === null || _c === void 0 ? void 0 : _c.values) !== null && _d !== void 0 ? _d : [];
|
|
78
77
|
assetBuilder.removeCredentialAddresses(type, existing);
|
|
79
78
|
});
|
|
80
79
|
}
|
|
81
80
|
else {
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
[nautilus_1.CredentialListTypes.ALLOW].forEach((type) => {
|
|
82
|
+
var _a;
|
|
83
|
+
assetBuilder.addCredentialAddresses(type, [
|
|
84
|
+
asset.owner,
|
|
85
|
+
...((_a = flags.users) !== null && _a !== void 0 ? _a : []),
|
|
86
|
+
]);
|
|
87
|
+
});
|
|
84
88
|
}
|
|
85
89
|
const nautilusAsset = assetBuilder.build();
|
|
86
90
|
const result = await connection.nautilus.edit(nautilusAsset);
|
|
@@ -92,49 +96,49 @@ class EditAssetAllowed extends core_1.Command {
|
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
|
-
EditAssetAllowed.description =
|
|
99
|
+
EditAssetAllowed.description = "Overwrite the list of allowed users for assets";
|
|
96
100
|
EditAssetAllowed.examples = [
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
"<%= config.bin %> <%= command.id %> -u 0xAbc123... 0xDef456... -d <assetDid1> <assetDid2>",
|
|
102
|
+
"<%= config.bin %> <%= command.id %> -u 0xAbc123... --public",
|
|
99
103
|
];
|
|
100
104
|
EditAssetAllowed.flags = {
|
|
101
105
|
users: core_1.Flags.string({
|
|
102
|
-
char:
|
|
103
|
-
description:
|
|
106
|
+
char: "u",
|
|
107
|
+
description: "Ethereum addresses of users to allow (0x...)",
|
|
104
108
|
multiple: true,
|
|
105
109
|
required: false,
|
|
106
110
|
}),
|
|
107
111
|
datasets: core_1.Flags.string({
|
|
108
|
-
char:
|
|
109
|
-
description:
|
|
112
|
+
char: "d",
|
|
113
|
+
description: "Asset DIDs to edit (did:op:...)",
|
|
110
114
|
multiple: true,
|
|
111
115
|
}),
|
|
112
116
|
yes: core_1.Flags.boolean({
|
|
113
|
-
char:
|
|
114
|
-
description:
|
|
117
|
+
char: "y",
|
|
118
|
+
description: "Skip confirmation prompt",
|
|
115
119
|
}),
|
|
116
120
|
manifest: core_1.Flags.string({
|
|
117
|
-
char:
|
|
118
|
-
description:
|
|
121
|
+
char: "m",
|
|
122
|
+
description: "Path to manifest file with the accounts to use for authentication",
|
|
119
123
|
}),
|
|
120
124
|
public: core_1.Flags.boolean({
|
|
121
|
-
char:
|
|
122
|
-
description:
|
|
125
|
+
char: "p",
|
|
126
|
+
description: "Make assets public (remove all address restrictions)",
|
|
123
127
|
}),
|
|
124
128
|
network: core_1.Flags.string({
|
|
125
|
-
char:
|
|
126
|
-
description:
|
|
129
|
+
char: "n",
|
|
130
|
+
description: "Network to use (env: NETWORK)",
|
|
127
131
|
options: Object.keys(config_1.NETWORK_CONFIGS),
|
|
128
132
|
}),
|
|
129
133
|
};
|
|
130
134
|
exports.default = EditAssetAllowed;
|
|
131
135
|
async function askForAssets(loginInfos, chainId) {
|
|
132
|
-
console.log(
|
|
136
|
+
console.log("\nPlease select the filters to find the assets you want to edit:");
|
|
133
137
|
return (0, asset_1.PromptForAssets)({
|
|
134
|
-
assetTypes: [
|
|
135
|
-
accessTypes: [
|
|
138
|
+
assetTypes: ["dataset", "algorithm"],
|
|
139
|
+
accessTypes: ["access", "compute"],
|
|
136
140
|
chainIds: [chainId],
|
|
137
|
-
ownerChoices: loginInfos.map(info => ({
|
|
141
|
+
ownerChoices: loginInfos.map((info) => ({
|
|
138
142
|
name: info.ownerName,
|
|
139
143
|
value: info.ownerAddress,
|
|
140
144
|
})),
|