Skip to content

Commit e626fba

Browse files
committed
Fix stringified resources.
1 parent 8bf0fc2 commit e626fba

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/commands.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
getIndexingWaitSettings,
1111
IndexerWaitParams,
1212
isEthersFormat,
13+
stringifyResources,
1314
} from "./helpers.js";
1415
import {
1516
Aquarius,
@@ -31,6 +32,7 @@ import { Asset } from '@oceanprotocol/ddo-js';
3132
import { Signer, ethers } from "ethers";
3233
import { interactiveFlow } from "./interactiveFlow.js";
3334
import { publishAsset } from "./publishAsset.js";
35+
import { stringify } from "querystring";
3436

3537
export class Commands {
3638
public signer: Signer;
@@ -1068,7 +1070,13 @@ export class Commands {
10681070
);
10691071
return;
10701072
}
1071-
console.log("Exiting compute environments: ", computeEnvs);
1073+
const parsedComputeEnvs = [];
1074+
for (const env of computeEnvs) {
1075+
const stringified = stringifyResources(env);
1076+
parsedComputeEnvs.push(stringified);
1077+
}
1078+
1079+
console.log("Exiting compute environments: ", parsedComputeEnvs);
10721080
}
10731081

10741082
public async computeStreamableLogs(args: string[]) {

src/helpers.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,4 +506,16 @@ export function getIndexingWaitSettings(): IndexerWaitParams {
506506
}
507507

508508
return indexingParams
509+
}
510+
511+
export function stringifyResources(obj) {
512+
for (const key in obj) {
513+
if (obj[key] && typeof obj[key] === 'object') {
514+
if (key === 'resources' && Array.isArray(obj[key])) {
515+
obj[key] = obj[key].map(item => JSON.stringify(item));
516+
} else {
517+
stringifyResources(obj[key]);
518+
}
519+
}
520+
}
509521
}

0 commit comments

Comments
 (0)