fix(core): update
This commit is contained in:
parent
5d673799cc
commit
5acbf420ae
707
package-lock.json
generated
707
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -9,15 +9,16 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild --web)",
|
||||
"build": "(tsbuild --web && tsbundle npm)",
|
||||
"format": "(gitzone format)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.24",
|
||||
"@gitzone/tsbundle": "^1.0.69",
|
||||
"@gitzone/tstest": "^1.0.33",
|
||||
"@pushrocks/smartexpress": "^3.0.69",
|
||||
"@pushrocks/smartexpress": "^3.0.72",
|
||||
"@pushrocks/tapbundle": "^3.2.1",
|
||||
"@types/node": "^14.0.13",
|
||||
"@types/node": "^14.0.14",
|
||||
"tslint": "^6.1.2",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
@ -25,8 +26,7 @@
|
||||
"@apiglobal/typedrequest-interfaces": "^1.0.13",
|
||||
"@pushrocks/lik": "^4.0.13",
|
||||
"@pushrocks/smartdelay": "^2.0.9",
|
||||
"@pushrocks/smartjson": "^3.0.10",
|
||||
"@pushrocks/smartrequest": "^1.1.47"
|
||||
"@pushrocks/webrequest": "^2.0.9"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
|
@ -54,6 +54,7 @@ tap.test('should fire a request', async () => {
|
||||
const response = await typedRequest.fire({
|
||||
name: 'really'
|
||||
});
|
||||
console.log('this is the response:');
|
||||
console.log(response);
|
||||
expect(response.surname).to.equal('wow');
|
||||
});
|
||||
|
@ -47,7 +47,6 @@ export class TypedHandler<T extends plugins.typedRequestInterfaces.ITypedRequest
|
||||
typedRequestArg.response = response;
|
||||
}
|
||||
|
||||
|
||||
return typedRequestArg;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import * as plugins from './typedrequest.plugins';
|
||||
import { TypedResponseError } from './typedrequest.classes.typedresponseerror';
|
||||
|
||||
export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest> {
|
||||
public webrequest = new plugins.webrequest.WebRequest();
|
||||
public urlEndPoint: string;
|
||||
public method: string;
|
||||
|
||||
@ -15,16 +16,18 @@ export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest
|
||||
* firest the request
|
||||
*/
|
||||
public async fire(fireArg: T['request']): Promise<T['response']> {
|
||||
const response = await plugins.smartrequest.postJson(this.urlEndPoint, {
|
||||
requestBody: {
|
||||
method: this.method,
|
||||
request: fireArg,
|
||||
response: null
|
||||
}
|
||||
const response = await this.webrequest.postJson(this.urlEndPoint, {
|
||||
method: this.method,
|
||||
request: fireArg,
|
||||
response: null
|
||||
});
|
||||
const responseBody: T = response.body;
|
||||
const responseBody: T = response;
|
||||
if (responseBody.error) {
|
||||
console.error(`Got an error ${responseBody.error.text} with data ${JSON.stringify(responseBody.error.data)}`);
|
||||
console.error(
|
||||
`Got an error ${responseBody.error.text} with data ${JSON.stringify(
|
||||
responseBody.error.data
|
||||
)}`
|
||||
);
|
||||
if (!responseBody.retry) {
|
||||
throw new TypedResponseError(responseBody.error.text, responseBody.error.data);
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ export { typedRequestInterfaces };
|
||||
// pushrocks scope
|
||||
import * as lik from '@pushrocks/lik';
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import * as smartrequest from '@pushrocks/smartrequest';
|
||||
import * as smartjson from '@pushrocks/smartjson';
|
||||
import * as webrequest from '@pushrocks/webrequest';
|
||||
|
||||
export { lik, smartdelay, smartrequest, smartjson };
|
||||
export { lik, smartdelay, webrequest };
|
||||
|
Loading…
Reference in New Issue
Block a user