Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
4a06bedf3b | |||
9787adf3f0 | |||
280e67b86b | |||
592e941211 | |||
68ec93459b | |||
8a4b3fa47e | |||
ad7c2e97b8 | |||
0ff28152f3 | |||
4718a03d7d | |||
f99f79efb1 |
@ -30,7 +30,7 @@ snyk:
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci command npm cache verify
|
||||
- npmci command npm cache clean --force
|
||||
- npmci command npm install -g snyk
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
|
8
package-lock.json
generated
8
package-lock.json
generated
@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "@apiglobal/typedrequest",
|
||||
"version": "1.0.8",
|
||||
"version": "1.0.13",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@apiglobal/typedrequest-interfaces": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest-interfaces/-/typedrequest-interfaces-1.0.5.tgz",
|
||||
"integrity": "sha512-j0RN3smGRjcbVw/L1JYEH9Gewy0fTIh3z7KLRNPCSNaNfIziw/93PyC6KcuXI9dgzlg0x/KCqOKdH9Z0rUykWw=="
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@apiglobal/typedrequest-interfaces/-/typedrequest-interfaces-1.0.7.tgz",
|
||||
"integrity": "sha512-yPl0UcLFMwSQL7bK52wVjkgvadC+x2YS3+7T15V1A1dXNxa96yd4WX1fqcKqwnBrvYexq/8FaxWGi98tZ0oNwg=="
|
||||
},
|
||||
"@babel/code-frame": {
|
||||
"version": "7.5.5",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@apiglobal/typedrequest",
|
||||
"version": "1.0.8",
|
||||
"version": "1.0.13",
|
||||
"private": false,
|
||||
"description": "make typed requests towards apis",
|
||||
"main": "dist/index.js",
|
||||
@ -21,7 +21,7 @@
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apiglobal/typedrequest-interfaces": "^1.0.5",
|
||||
"@apiglobal/typedrequest-interfaces": "^1.0.7",
|
||||
"@pushrocks/smartrequest": "^1.1.23"
|
||||
},
|
||||
"files": [
|
||||
|
29
ts/index.ts
29
ts/index.ts
@ -1,27 +1,2 @@
|
||||
import * as plugins from './typedrequest.plugins';
|
||||
|
||||
export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest> {
|
||||
public urlEndPoint: string;
|
||||
public method: string;
|
||||
|
||||
// STATIC
|
||||
constructor(urlEndPointArg: string, methodArg: T['method']) {
|
||||
this.urlEndPoint = urlEndPointArg;
|
||||
this.method = methodArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* firest the request
|
||||
*/
|
||||
public async fire(fireArg: T['request']): Promise<T['response']> {
|
||||
const response = await plugins.smartrequest.request(this.urlEndPoint, {
|
||||
method: 'POST',
|
||||
requestBody: {
|
||||
method: this.method,
|
||||
request: fireArg,
|
||||
response: null
|
||||
}
|
||||
});
|
||||
return response.body.response;
|
||||
}
|
||||
}
|
||||
export * from './typedrequest.classes.typedrequest';
|
||||
export * from './typedrequest.classes.typedhandler';
|
||||
|
1
ts/typedrequest.classes.typedhandler.ts
Normal file
1
ts/typedrequest.classes.typedhandler.ts
Normal file
@ -0,0 +1 @@
|
||||
export class TypedHandler {}
|
27
ts/typedrequest.classes.typedrequest.ts
Normal file
27
ts/typedrequest.classes.typedrequest.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import * as plugins from './typedrequest.plugins';
|
||||
|
||||
export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest> {
|
||||
public urlEndPoint: string;
|
||||
public method: string;
|
||||
|
||||
// STATIC
|
||||
constructor(urlEndPointArg: string, methodArg: T['method']) {
|
||||
this.urlEndPoint = urlEndPointArg;
|
||||
this.method = methodArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* firest the request
|
||||
*/
|
||||
public async fire(fireArg: T['request']): Promise<T['response']> {
|
||||
const response = await plugins.smartrequest.request(this.urlEndPoint, {
|
||||
method: 'POST',
|
||||
requestBody: {
|
||||
method: this.method,
|
||||
request: fireArg,
|
||||
response: null
|
||||
}
|
||||
});
|
||||
return response.body.response;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user