mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
make lint more solid
This commit is contained in:
parent
093a6ea4af
commit
1d9754fba6
@ -8,7 +8,7 @@
|
||||
"test:watch": "mocha -w --watch-extensions js,ts,json",
|
||||
"test:cover": "nyc mocha",
|
||||
"clean": "rm -rf ./dist/ ./doc/ ./coverage ./.nyc_output",
|
||||
"lint": "tslint -c tslint.json 'src/**/*.ts'",
|
||||
"lint": "tslint -c tslint.json 'src/**/*.ts' 'test/**/*.ts'",
|
||||
"start": "npm link @oceanprotocol/keeper-contracts @oceanprotocol/secret-store-client && npm run build:watch",
|
||||
"build": "npm run clean && npm run lint && tsc && npm run doc",
|
||||
"build:watch": "tsc -w",
|
||||
|
@ -14,23 +14,23 @@ export default class Aquarius {
|
||||
this.url = config.aquariusUri
|
||||
}
|
||||
|
||||
public async getAccessUrl(accessToken: any, payload: any): Promise<string | void> {
|
||||
public async getAccessUrl(accessToken: any, payload: any): Promise<string> {
|
||||
|
||||
const accessUrl = await AquariusConnectorProvider.getConnector().post(
|
||||
`${accessToken.service_endpoint}/${accessToken.resource_id}`,
|
||||
payload)
|
||||
.then((response: any) => {
|
||||
const accessUrl: string = await AquariusConnectorProvider.getConnector()
|
||||
.post(`${accessToken.service_endpoint}/${accessToken.resource_id}`, payload)
|
||||
.then((response: any): string => {
|
||||
if (response.ok) {
|
||||
return response.text()
|
||||
}
|
||||
Logger.log("Failed: ", response.status, response.statusText)
|
||||
Logger.error("Failed: ", response.status, response.statusText)
|
||||
})
|
||||
.then((consumptionUrl: string) => {
|
||||
.then((consumptionUrl: string): string => {
|
||||
Logger.log("Success accessing consume endpoint: ", consumptionUrl)
|
||||
return consumptionUrl
|
||||
})
|
||||
.catch((error) => {
|
||||
Logger.error("Error fetching the data asset consumption url: ", error)
|
||||
return null
|
||||
})
|
||||
|
||||
return accessUrl
|
||||
@ -77,7 +77,7 @@ export default class Aquarius {
|
||||
|
||||
public async storeDDO(ddo: DDO): Promise<DDO> {
|
||||
const fullUrl = this.url + `/api/v1/aquarius/assets/ddo`
|
||||
const result = await AquariusConnectorProvider.getConnector()
|
||||
const result: DDO = await AquariusConnectorProvider.getConnector()
|
||||
.post(fullUrl, DDO.serialize(ddo))
|
||||
.then((response: any) => {
|
||||
if (response.ok) {
|
||||
|
@ -7,7 +7,7 @@ export default class AquariusConnectorProvider {
|
||||
AquariusConnectorProvider.connector = connector
|
||||
}
|
||||
|
||||
public static getConnector() {
|
||||
public static getConnector(): AquariusConnector {
|
||||
|
||||
if (!AquariusConnectorProvider.connector) {
|
||||
AquariusConnectorProvider.connector = new AquariusConnector()
|
||||
|
@ -1,3 +1,3 @@
|
||||
export default class Query {
|
||||
public value: number = 1
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,9 @@ export default class AquariusConnectorMock extends AquariusConnector {
|
||||
json: () => {
|
||||
return this.returnData ? this.returnData : []
|
||||
},
|
||||
text: () => {
|
||||
return this.returnData ? this.returnData.toString() : ""
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -84,7 +84,6 @@ describe("Ocean", () => {
|
||||
|
||||
assert(orders.length === 1)
|
||||
assert(orders[0].getId() === order.getId())
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user