Comparing version 1.1.6 to 1.1.7
@@ -7,4 +7,5 @@ /// <reference types="node" /> | ||
port?: string | number; | ||
timeout?: string | number; | ||
timeout?: number; | ||
logging?: boolean; | ||
logger?: Function; | ||
} | ||
@@ -11,0 +12,0 @@ export declare class Api { |
@@ -18,7 +18,8 @@ "use strict"; | ||
return { | ||
host: config.host, | ||
host: config.host || '127.0.0.1', | ||
protocol: config.protocol || 'http', | ||
port: config.port || 1984, | ||
port: config.port || 80, | ||
timeout: config.timeout || 20000, | ||
logging: config.logging || false, | ||
logger: config.logger || console.log | ||
}; | ||
@@ -55,11 +56,11 @@ } | ||
baseURL: `${this.config.protocol}://${this.config.host}:${this.config.port}`, | ||
timeout: 1000, | ||
timeout: this.config.timeout, | ||
}); | ||
if (this.config.logging) { | ||
instance.interceptors.request.use(request => { | ||
console.log(`Requesting: ${request.baseURL}/${request.url}`); | ||
this.config.logger(`Requesting: ${request.baseURL}/${request.url}`); | ||
return request; | ||
}); | ||
instance.interceptors.response.use(response => { | ||
console.log(`Response: ${response.config.url} - ${response.status}`); | ||
this.config.logger(`Response: ${response.config.url} - ${response.status}`); | ||
return response; | ||
@@ -66,0 +67,0 @@ }); |
@@ -7,4 +7,5 @@ /// <reference types="node" /> | ||
port?: string | number; | ||
timeout?: string | number; | ||
timeout?: number; | ||
logging?: boolean; | ||
logger?: Function; | ||
} | ||
@@ -11,0 +12,0 @@ export declare class Api { |
@@ -16,7 +16,8 @@ import Axios from 'axios'; | ||
return { | ||
host: config.host, | ||
host: config.host || '127.0.0.1', | ||
protocol: config.protocol || 'http', | ||
port: config.port || 1984, | ||
port: config.port || 80, | ||
timeout: config.timeout || 20000, | ||
logging: config.logging || false, | ||
logger: config.logger || console.log | ||
}; | ||
@@ -53,11 +54,11 @@ } | ||
baseURL: `${this.config.protocol}://${this.config.host}:${this.config.port}`, | ||
timeout: 1000, | ||
timeout: this.config.timeout, | ||
}); | ||
if (this.config.logging) { | ||
instance.interceptors.request.use(request => { | ||
console.log(`Requesting: ${request.baseURL}/${request.url}`); | ||
this.config.logger(`Requesting: ${request.baseURL}/${request.url}`); | ||
return request; | ||
}); | ||
instance.interceptors.response.use(response => { | ||
console.log(`Response: ${response.config.url} - ${response.status}`); | ||
this.config.logger(`Response: ${response.config.url} - ${response.status}`); | ||
return response; | ||
@@ -64,0 +65,0 @@ }); |
{ | ||
"name": "arweave", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "Arweave JS client library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,4 +7,5 @@ import Axios, { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios'; | ||
port?: string|number, | ||
timeout?: string|number, | ||
logging?: boolean | ||
timeout?: number, | ||
logging?: boolean, | ||
logger?: Function | ||
} | ||
@@ -33,7 +34,8 @@ | ||
return { | ||
host: config.host, | ||
host: config.host || '127.0.0.1', | ||
protocol: config.protocol || 'http', | ||
port: config.port || 1984, | ||
port: config.port || 80, | ||
timeout: config.timeout || 20000, | ||
logging: config.logging || false, | ||
logger: config.logger || console.log | ||
}; | ||
@@ -78,3 +80,3 @@ } | ||
baseURL: `${this.config.protocol}://${this.config.host}:${this.config.port}`, | ||
timeout: 1000, | ||
timeout: this.config.timeout, | ||
}); | ||
@@ -85,3 +87,3 @@ | ||
instance.interceptors.request.use( request => { | ||
console.log(`Requesting: ${request.baseURL}/${request.url}`); | ||
this.config.logger(`Requesting: ${request.baseURL}/${request.url}`); | ||
return request; | ||
@@ -91,3 +93,3 @@ }); | ||
instance.interceptors.response.use( response => { | ||
console.log(`Response: ${response.config.url} - ${response.status}`); | ||
this.config.logger(`Response: ${response.config.url} - ${response.status}`); | ||
return response; | ||
@@ -94,0 +96,0 @@ }); |
@@ -14,3 +14,3 @@ import * as chai from 'chai'; | ||
const instance = dist.init({ host: 'arweave.net', port: 1984, logging: false }); | ||
const instance = dist.init({ host: 'arweave.net', logging: false }); | ||
@@ -60,3 +60,3 @@ expect(instance.api.constructor.name).to.equal('Api') | ||
const instance = dist.init({ host: 'arweave.net', port: 1984, logging: false }); | ||
const instance = dist.init({ host: 'arweave.net', logging: false }); | ||
@@ -104,3 +104,3 @@ expect(instance.api.constructor.name).to.equal('Api') | ||
const instance = dist.init({ host: 'arweave.net', port: 1984, logging: false }); | ||
const instance = dist.init({ host: 'arweave.net', logging: false }); | ||
@@ -148,3 +148,3 @@ expect(instance.api.constructor.name).to.equal('Api') | ||
const instance = dist.init({ host: 'arweave.net', port: 1984, logging: false }); | ||
const instance = dist.init({ host: 'arweave.net', logging: false }); | ||
@@ -151,0 +151,0 @@ expect(instance).to.be.an('object'); |
@@ -14,3 +14,3 @@ import * as chai from 'chai'; | ||
const arweave = Arweave.init({ host: 'arweave.net', port: 1984, logging: false }); | ||
const arweave = Arweave.init({ host: 'arweave.net', logging: false }); | ||
@@ -46,3 +46,3 @@ const digestRegex = /^[a-z0-9-_]{43}$/i; | ||
this.timeout(3000); | ||
this.timeout(5000); | ||
@@ -66,3 +66,3 @@ const info = await arweave.network.getInfo(); | ||
this.timeout(3000); | ||
this.timeout(5000); | ||
@@ -99,3 +99,3 @@ const walletA = await arweave.wallets.generate(); | ||
this.timeout(3000); | ||
this.timeout(5000); | ||
@@ -138,3 +138,3 @@ const wallet = await arweave.wallets.generate(); | ||
this.timeout(3000); | ||
this.timeout(5000); | ||
@@ -185,3 +185,3 @@ const wallet = await arweave.wallets.generate(); | ||
this.timeout(3000); | ||
this.timeout(5000); | ||
@@ -215,3 +215,3 @@ const transactionStatus = await arweave.transactions.getStatus(liveDataTxid); | ||
this.timeout(3000); | ||
this.timeout(5000); | ||
@@ -218,0 +218,0 @@ const wallet = await arweave.wallets.generate(); |
@@ -7,3 +7,3 @@ import * as chai from 'chai'; | ||
const arweave = Arweave.init({ host: 'arweave.net', port: 1984, logging: false }); | ||
const arweave = Arweave.init({ host: 'arweave.net', logging: false }); | ||
@@ -10,0 +10,0 @@ describe('Silo', function () { |
@@ -13,3 +13,3 @@ import * as chai from 'chai'; | ||
//@ts-ignore | ||
const arweave = window.Arweave.init({ host: 'arweave.net', port: 1984, logging: false }); | ||
const arweave = window.Arweave.init({ host: 'arweave.net', logging: false }); | ||
@@ -16,0 +16,0 @@ //@ts-ignore |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3540225
40644