Compare commits

...

4 Commits

Author SHA1 Message Date
556ba6cb30 1.0.60 2021-11-07 15:26:13 +01:00
7321ac680d fix(core): update 2021-11-07 15:26:12 +01:00
2fd8219849 1.0.59 2021-11-07 14:56:48 +01:00
ea56e2218f fix(types): better types for TypedRouter.routeAndAddResponse 2021-11-07 14:56:48 +01:00
5 changed files with 1045 additions and 1567 deletions

2595
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@apiglobal/typedrequest",
"version": "1.0.58",
"version": "1.0.60",
"private": false,
"description": "make typed requests towards apis",
"main": "dist_ts/index.js",
@ -13,12 +13,12 @@
"format": "(gitzone format)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.27",
"@gitzone/tsbundle": "^1.0.87",
"@gitzone/tstest": "^1.0.57",
"@pushrocks/smartexpress": "^3.0.106",
"@gitzone/tsbuild": "^2.1.28",
"@gitzone/tsbundle": "^1.0.88",
"@gitzone/tstest": "^1.0.59",
"@pushrocks/smartexpress": "^3.0.108",
"@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^16.10.1",
"@types/node": "^16.11.6",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},

View File

@ -21,7 +21,7 @@ export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest
public method: string;
/**
* note the overloading is thought to deak with promises
* note the overloading is thought to deal with promises
* @param postEndPointArg
* @param methodArg
*/

View File

@ -91,7 +91,7 @@ export class TypedRouter {
* if typedrequest object has correlation.phase === 'response' -> routes a typed request object to request fire event
* @param typedRequestArg
*/
public async routeAndAddResponse(typedRequestArg: plugins.typedRequestInterfaces.ITypedRequest) {
public async routeAndAddResponse<T extends plugins.typedRequestInterfaces.ITypedRequest = any>(typedRequestArg: T) {
if (!typedRequestArg?.correlation?.phase || typedRequestArg.correlation.phase === 'request') {
const typedHandler = this.getTypedHandlerForMethod(typedRequestArg.method);

View File

@ -6,6 +6,7 @@ export type IPostMethod = (
) => Promise<plugins.typedRequestInterfaces.ITypedRequest>;
/**
* this is an alternative to a post url supplied in `new Typedrequest(new TypedTarget(...), 'someMethodName')`
* enables the use of custom post functions
* used for things like broadcast channels
* e.g. @designestate/dees-comms